!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("babylonjs",[],t):"object"==typeof exports?exports.babylonjs=t():e.BABYLON=t()}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=129)}([function(e,t,i){"use strict";i.d(t,"u",function(){return s}),i.d(t,"v",function(){return a}),i.d(t,"h",function(){return c}),i.d(t,"e",function(){return l}),i.d(t,"f",function(){return u}),i.d(t,"w",function(){return h}),i.d(t,"x",function(){return d}),i.d(t,"y",function(){return f}),i.d(t,"r",function(){return p}),i.d(t,"q",function(){return _}),i.d(t,"j",function(){return g}),i.d(t,"n",function(){return m}),i.d(t,"z",function(){return v}),i.d(t,"i",function(){return y}),i.d(t,"s",function(){return n}),i.d(t,"c",function(){return T}),i.d(t,"d",function(){return E}),i.d(t,"k",function(){return b}),i.d(t,"a",function(){return A}),i.d(t,"b",function(){return x}),i.d(t,"l",function(){return R}),i.d(t,"m",function(){return P}),i.d(t,"g",function(){return S}),i.d(t,"p",function(){return C}),i.d(t,"o",function(){return M}),i.d(t,"t",function(){return O});var n,r=i(34),o=i(12),s=1/2.2,a=2.2,c=.001,l=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=this.r||0;return e=397*(e=397*e^(this.g||0))^(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 u(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=o.a.Clamp(this.r,e,t),i.g=o.a.Clamp(this.g,e,t),i.b=o.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"#"+o.a.ToHex(e)+o.a.ToHex(t)+o.a.ToHex(i)},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,a),e.g=Math.pow(this.g,a),e.b=Math.pow(this.b,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,s),e.g=Math.pow(this.g,s),e.b=Math.pow(this.b,s),this},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}(),u=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=o.a.Clamp(this.r,e,t),i.g=o.a.Clamp(this.g,e,t),i.b=o.a.Clamp(this.b,e,t),i.a=o.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=this.r||0;return e=397*(e=397*(e=397*e^(this.g||0))^(this.b||0))^(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,n=255*this.a|0;return"#"+o.a.ToHex(e)+o.a.ToHex(t)+o.a.ToHex(i)+o.a.ToHex(n)},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,a),e.g=Math.pow(this.g,a),e.b=Math.pow(this.b,a),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,s),e.g=Math.pow(this.g,s),e.b=Math.pow(this.b,s),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;nn.x?n.x:r)n.y?n.y:o)i.x?t.x:i.x,t.y>i.y?t.y:i.y)},e.Transform=function(t,i){var n=e.Zero();return e.TransformToRef(t,i,n),n},e.TransformToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+n[12],o=e.x*n[1]+e.y*n[5]+n[13];i.x=r,i.y=o},e.PointInTriangle=function(e,t,i,n){var r=.5*(-i.y*n.x+t.y*(-i.x+n.x)+t.x*(i.y-n.y)+i.x*n.y),o=r<0?-1:1,s=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*o,a=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return s>0&&a>0&&s+a<2*r*o},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},e.DistanceOfPointFromSegment=function(t,i,n){var r=e.DistanceSquared(i,n);if(0===r)return e.Distance(t,i);var o=n.subtract(i),s=Math.max(0,Math.min(1,e.Dot(t.subtract(i),o)/r)),a=i.add(o.multiplyByFloats(s,s));return e.Distance(t,a)},e}(),d=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.x=e,this.y=t,this.z=i}return e.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+"}"},e.prototype.getClassName=function(){return"Vector3"},e.prototype.getHashCode=function(){var e=this.x||0;return e=397*(e=397*e^(this.y||0))^(this.z||0)},e.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,this},e.prototype.toQuaternion=function(){return _.RotationYawPitchRoll(this.y,this.x,this.z)},e.prototype.addInPlace=function(e){return this.addInPlaceFromFloats(e.x,e.y,e.z)},e.prototype.addInPlaceFromFloats=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y,this.z+t.z)},e.prototype.addToRef=function(e,t){return t.copyFromFloats(this.x+e.x,this.y+e.y,this.z+e.z)},e.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y,this.z-t.z)},e.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e.x,e.y,e.z,t)},e.prototype.subtractFromFloats=function(t,i,n){return new e(this.x-t,this.y-i,this.z-n)},e.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(this.x-e,this.y-t,this.z-i)},e.prototype.negate=function(){return new e(-this.x,-this.y,-this.z)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.scale=function(t){return new e(this.x*t,this.y*t,this.z*t)},e.prototype.scaleToRef=function(e,t){return t.copyFromFloats(this.x*e,this.y*e,this.z*e)},e.prototype.scaleAndAddToRef=function(e,t){return t.addInPlaceFromFloats(this.x*e,this.y*e,this.z*e)},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=c),e&&o.a.WithinEpsilon(this.x,e.x,t)&&o.a.WithinEpsilon(this.y,e.y,t)&&o.a.WithinEpsilon(this.z,e.z,t)},e.prototype.equalsToFloats=function(e,t,i){return this.x===e&&this.y===t&&this.z===i},e.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},e.prototype.multiply=function(e){return this.multiplyByFloats(e.x,e.y,e.z)},e.prototype.multiplyToRef=function(e,t){return t.copyFromFloats(this.x*e.x,this.y*e.y,this.z*e.z)},e.prototype.multiplyByFloats=function(t,i,n){return new e(this.x*t,this.y*i,this.z*n)},e.prototype.divide=function(t){return new e(this.x/t.x,this.y/t.y,this.z/t.z)},e.prototype.divideToRef=function(e,t){return t.copyFromFloats(this.x/e.x,this.y/e.y,this.z/e.z)},e.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},e.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e.x,e.y,e.z)},e.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e.x,e.y,e.z)},e.prototype.minimizeInPlaceFromFloats=function(e,t,i){return ethis.x&&(this.x=e),t>this.y&&(this.y=t),i>this.z&&(this.z=i),this},e.prototype.isNonUniformWithinEpsilon=function(e){var t=Math.abs(this.x),i=Math.abs(this.y);if(!o.a.WithinEpsilon(t,i,e))return!0;var n=Math.abs(this.z);return!o.a.WithinEpsilon(t,n,e)||!o.a.WithinEpsilon(i,n,e)},Object.defineProperty(e.prototype,"isNonUniform",{get:function(){var e=Math.abs(this.x),t=Math.abs(this.y);if(e!==t)return!0;var i=Math.abs(this.z);return e!==i||t!==i},enumerable:!0,configurable:!0}),e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.reorderInPlace=function(e){var t=this;return"xyz"===(e=e.toLowerCase())?this:(I.Vector3[0].copyFrom(this),["x","y","z"].forEach(function(i,n){t[i]=I.Vector3[0][e[n]]}),this)},e.prototype.rotateByQuaternionToRef=function(t,i){return t.toRotationMatrix(I.Matrix[0]),e.TransformCoordinatesToRef(this,I.Matrix[0],i),i},e.prototype.rotateByQuaternionAroundPointToRef=function(e,t,i){return this.subtractToRef(t,I.Vector3[0]),I.Vector3[0].rotateByQuaternionToRef(e,I.Vector3[0]),t.addToRef(I.Vector3[0],i),i},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){var t=new e(0,0,0);return this.normalizeToRef(t),t},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?e.copyFromFloats(this.x,this.y,this.z):this.scaleToRef(1/t,e)},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e.prototype.copyFrom=function(e){return this.copyFromFloats(e.x,e.y,e.z)},e.prototype.copyFromFloats=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.setAll=function(e){return this.x=this.y=this.z=e,this},e.GetClipFactor=function(t,i,n,r){var o=e.Dot(t,n)-r;return o/(o-(e.Dot(i,n)-r))},e.GetAngleBetweenVectors=function(t,i,n){var r=t.normalizeToRef(I.Vector3[1]),o=i.normalizeToRef(I.Vector3[2]),s=e.Dot(r,o),a=I.Vector3[3];return e.CrossToRef(r,o,a),e.Dot(a,n)>0?Math.acos(s):-Math.acos(s)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromFloatArray=function(t,i){return e.FromArray(t,i)},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]},e.FromFloatArrayToRef=function(t,i,n){return e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n){n.copyFromFloats(e,t,i)},e.Zero=function(){return new e(0,0,0)},e.One=function(){return new e(1,1,1)},e.Up=function(){return new e(0,1,0)},Object.defineProperty(e,"UpReadOnly",{get:function(){return e._UpReadOnly},enumerable:!0,configurable:!0}),e.Down=function(){return new e(0,-1,0)},e.Forward=function(){return new e(0,0,1)},e.Backward=function(){return new e(0,0,-1)},e.Right=function(){return new e(1,0,0)},e.Left=function(){return new e(-1,0,0)},e.TransformCoordinates=function(t,i){var n=e.Zero();return e.TransformCoordinatesToRef(t,i,n),n},e.TransformCoordinatesToRef=function(t,i,n){e.TransformCoordinatesFromFloatsToRef(t.x,t.y,t.z,i,n)},e.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,s=e*o[0]+t*o[4]+i*o[8]+o[12],a=e*o[1]+t*o[5]+i*o[9]+o[13],c=e*o[2]+t*o[6]+i*o[10]+o[14],l=1/(e*o[3]+t*o[7]+i*o[11]+o[15]);r.x=s*l,r.y=a*l,r.z=c*l},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){this.TransformNormalFromFloatsToRef(e.x,e.y,e.z,t,i)},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r){var o=n.m;r.x=e*o[0]+t*o[4]+i*o[8],r.y=e*o[1]+t*o[5]+i*o[9],r.z=e*o[2]+t*o[6]+i*o[10]},e.CatmullRom=function(t,i,n,r,o){var s=o*o,a=o*s;return new e(.5*(2*i.x+(-t.x+n.x)*o+(2*t.x-5*i.x+4*n.x-r.x)*s+(-t.x+3*i.x-3*n.x+r.x)*a),.5*(2*i.y+(-t.y+n.y)*o+(2*t.y-5*i.y+4*n.y-r.y)*s+(-t.y+3*i.y-3*n.y+r.y)*a),.5*(2*i.z+(-t.z+n.z)*o+(2*t.z-5*i.z+4*n.z-r.z)*s+(-t.z+3*i.z-3*n.z+r.z)*a))},e.Clamp=function(t,i,n){var r=new e;return e.ClampToRef(t,i,n,r),r},e.ClampToRef=function(e,t,i,n){var r=e.x;r=(r=r>i.x?i.x:r)i.y?i.y:o)i.z?i.z:s)this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.prototype.normalize=function(){var e=this.length();return 0===e?this:this.scaleInPlace(1/e)},e.prototype.toVector3=function(){return new d(this.x,this.y,this.z)},e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromFloatArrayToRef=function(t,i,n){e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n,r){r.x=e,r.y=t,r.z=i,r.w=n},e.Zero=function(){return new e(0,0,0,0)},e.One=function(){return new e(1,1,1,1)},e.Normalize=function(t){var i=e.Zero();return e.NormalizeToRef(t,i),i},e.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},e.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},e.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,o=e.w-t.w;return i*i+n*n+r*r+o*o},e.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+e.z*n[8],o=e.x*n[1]+e.y*n[5]+e.z*n[9],s=e.x*n[2]+e.y*n[6]+e.z*n[10];i.x=r,i.y=o,i.z=s,i.w=e.w},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r,o){var s=r.m;o.x=e*s[0]+t*s[4]+i*s[8],o.y=e*s[1]+t*s[5]+i*s[9],o.z=e*s[2]+t*s[6]+i*s[10],o.w=n},e.FromVector3=function(t,i){return void 0===i&&(i=0),new e(t.x,t.y,t.z,i)},e}(),p=function(){function e(e,t){this.width=e,this.height=t}return e.prototype.toString=function(){return"{W: "+this.width+", H: "+this.height+"}"},e.prototype.getClassName=function(){return"Size"},e.prototype.getHashCode=function(){var e=this.width||0;return e=397*e^(this.height||0)},e.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.multiplyByFloats=function(t,i){return new e(this.width*t,this.height*i)},e.prototype.clone=function(){return new e(this.width,this.height)},e.prototype.equals=function(e){return!!e&&(this.width===e.width&&this.height===e.height)},Object.defineProperty(e.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),e.Zero=function(){return new e(0,0)},e.prototype.add=function(t){return new e(this.width+t.width,this.height+t.height)},e.prototype.subtract=function(t){return new e(this.width-t.width,this.height-t.height)},e.Lerp=function(t,i,n){return new e(t.width+(i.width-t.width)*n,t.height+(i.height-t.height)*n)},e}(),_=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.x=e,this.y=t,this.z=i,this.w=n}return e.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},e.prototype.getClassName=function(){return"Quaternion"},e.prototype.getHashCode=function(){var e=this.x||0;return e=397*(e=397*(e=397*e^(this.y||0))^(this.z||0))^(this.w||0)},e.prototype.asArray=function(){return[this.x,this.y,this.z,this.w]},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)},e.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)},e.prototype.scale=function(t){return new e(this.x*t,this.y*t,this.z*t,this.w*t)},e.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,this},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,this},e.prototype.multiply=function(t){var i=new e(0,0,0,1);return this.multiplyToRef(t,i),i},e.prototype.multiplyToRef=function(e,t){var i=this.x*e.w+this.y*e.z-this.z*e.y+this.w*e.x,n=-this.x*e.z+this.y*e.w+this.z*e.x+this.w*e.y,r=this.x*e.y-this.y*e.x+this.z*e.w+this.w*e.z,o=-this.x*e.x-this.y*e.y-this.z*e.z+this.w*e.w;return t.copyFromFloats(i,n,r,o),this},e.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},e.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this.x,-this.y,-this.z,this.w),this},e.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.conjugate=function(){return new e(-this.x,-this.y,-this.z,this.w)},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.prototype.toEulerAngles=function(e){void 0===e&&(e="YZX");var t=d.Zero();return this.toEulerAnglesToRef(t),t},e.prototype.toEulerAnglesToRef=function(e){var t=this.z,i=this.x,n=this.y,r=this.w,o=r*r,s=t*t,a=i*i,c=n*n,l=n*t-i*r;return l<-.4999999?(e.y=2*Math.atan2(n,r),e.x=Math.PI/2,e.z=0):l>.4999999?(e.y=2*Math.atan2(n,r),e.x=-Math.PI/2,e.z=0):(e.z=Math.atan2(2*(i*n+t*r),-s-a+c+o),e.x=Math.asin(-2*(t*n-i*r)),e.y=Math.atan2(2*(t*i+n*r),s-a-c+o)),this},e.prototype.toRotationMatrix=function(e){return g.FromQuaternionToRef(this,e),this},e.prototype.fromRotationMatrix=function(t){return e.FromRotationMatrixToRef(t,this),this},e.FromRotationMatrix=function(t){var i=new e;return e.FromRotationMatrixToRef(t,i),i},e.FromRotationMatrixToRef=function(e,t){var i,n=e.m,r=n[0],o=n[4],s=n[8],a=n[1],c=n[5],l=n[9],u=n[2],h=n[6],d=n[10],f=r+c+d;f>0?(i=.5/Math.sqrt(f+1),t.w=.25/i,t.x=(h-l)*i,t.y=(s-u)*i,t.z=(a-o)*i):r>c&&r>d?(i=2*Math.sqrt(1+r-c-d),t.w=(h-l)/i,t.x=.25*i,t.y=(o+a)/i,t.z=(s+u)/i):c>d?(i=2*Math.sqrt(1+c-r-d),t.w=(s-u)/i,t.x=(o+a)/i,t.y=.25*i,t.z=(l+h)/i):(i=2*Math.sqrt(1+d-r-c),t.w=(a-o)/i,t.x=(s+u)/i,t.y=(l+h)/i,t.z=.25*i)},e.Dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},e.AreClose=function(t,i){return e.Dot(t,i)>=0},e.Zero=function(){return new e(0,0,0,0)},e.Inverse=function(t){return new e(-t.x,-t.y,-t.z,t.w)},e.InverseToRef=function(e,t){return t.set(-e.x,-e.y,-e.z,e.w),t},e.Identity=function(){return new e(0,0,0,1)},e.IsIdentity=function(e){return e&&0===e.x&&0===e.y&&0===e.z&&1===e.w},e.RotationAxis=function(t,i){return e.RotationAxisToRef(t,i,new e)},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(t/2);return e.normalize(),i.w=Math.cos(t/2),i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromEulerAngles=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerAnglesToRef=function(t,i,n,r){return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerVector=function(t){var i=new e;return e.RotationYawPitchRollToRef(t.y,t.x,t.z,i),i},e.FromEulerVectorToRef=function(t,i){return e.RotationYawPitchRollToRef(t.y,t.x,t.z,i),i},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){var r=.5*i,o=.5*t,s=.5*e,a=Math.sin(r),c=Math.cos(r),l=Math.sin(o),u=Math.cos(o),h=Math.sin(s),d=Math.cos(s);n.x=d*l*c+h*u*a,n.y=h*u*c-d*l*a,n.z=d*u*a-h*l*c,n.w=d*u*c+h*l*a},e.RotationAlphaBetaGamma=function(t,i,n){var r=new e;return e.RotationAlphaBetaGammaToRef(t,i,n,r),r},e.RotationAlphaBetaGammaToRef=function(e,t,i,n){var r=.5*(i+e),o=.5*(i-e),s=.5*t;n.x=Math.cos(o)*Math.sin(s),n.y=Math.sin(o)*Math.sin(s),n.z=Math.sin(r)*Math.cos(s),n.w=Math.cos(r)*Math.cos(s)},e.RotationQuaternionFromAxis=function(t,i,n){var r=new e(0,0,0,0);return e.RotationQuaternionFromAxisToRef(t,i,n,r),r},e.RotationQuaternionFromAxisToRef=function(t,i,n,r){var o=I.Matrix[0];g.FromXYZAxesToRef(t.normalize(),i.normalize(),n.normalize(),o),e.FromRotationMatrixToRef(o,r)},e.Slerp=function(t,i,n){var r=e.Identity();return e.SlerpToRef(t,i,n,r),r},e.SlerpToRef=function(e,t,i,n){var r,o,s=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,a=!1;if(s<0&&(a=!0,s=-s),s>.999999)o=1-i,r=a?-i:i;else{var c=Math.acos(s),l=1/Math.sin(c);o=Math.sin((1-i)*c)*l,r=a?-Math.sin(i*c)*l:Math.sin(i*c)*l}n.x=o*e.x+r*t.x,n.y=o*e.y+r*t.y,n.z=o*e.z+r*t.z,n.w=o*e.w+r*t.w},e.Hermite=function(t,i,n,r,o){var s=o*o,a=o*s,c=2*a-3*s+1,l=-2*a+3*s,u=a-2*s+o,h=a-s;return new e(t.x*c+n.x*l+i.x*u+r.x*h,t.y*c+n.y*l+i.y*u+r.y*h,t.z*c+n.z*l+i.z*u+r.z*h,t.w*c+n.w*l+i.w*u+r.w*h)},e}(),g=function(){function e(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,this._m=new Float32Array(16),this._updateIdentityStatus(!1)}return Object.defineProperty(e.prototype,"m",{get:function(){return this._m},enumerable:!0,configurable:!0}),e.prototype._markAsUpdated=function(){this.updateFlag=e._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},e.prototype._updateIdentityStatus=function(t,i,n,r){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),this.updateFlag=e._updateFlagSeed++,this._isIdentity=t,this._isIdentity3x2=t||n,this._isIdentityDirty=!this._isIdentity&&i,this._isIdentity3x2Dirty=!this._isIdentity3x2&&r},e.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity},e.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]?this._isIdentity3x2=!1:0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},e.prototype.determinant=function(){if(!0===this._isIdentity)return 1;var e=this._m,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11],f=e[12],p=e[13],_=e[14],g=e[15],m=h*g-_*d,v=u*g-p*d,y=u*_-p*h,b=l*g-f*d,T=l*_-h*f,E=l*p-f*u;return t*+(s*m-a*v+c*y)+i*-(o*m-a*b+c*T)+n*+(o*v-s*b+c*E)+r*-(o*y-s*T+a*E)},e.prototype.toArray=function(){return this._m},e.prototype.asArray=function(){return this._m},e.prototype.invert=function(){return this.invertToRef(this),this},e.prototype.reset=function(){return e.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},e.prototype.add=function(t){var i=new e;return this.addToRef(t,i),i},e.prototype.addToRef=function(e,t){for(var i=this._m,n=t._m,r=e.m,o=0;o<16;o++)n[o]=i[o]+r[o];return t._markAsUpdated(),this},e.prototype.addToSelf=function(e){for(var t=this._m,i=e.m,n=0;n<16;n++)t[n]+=i[n];return this._markAsUpdated(),this},e.prototype.invertToRef=function(t){if(!0===this._isIdentity)return e.IdentityToRef(t),this;var i=this._m,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],c=i[5],l=i[6],u=i[7],h=i[8],d=i[9],f=i[10],p=i[11],_=i[12],g=i[13],m=i[14],v=i[15],y=f*v-m*p,b=d*v-g*p,T=d*m-g*f,E=h*v-_*p,A=h*m-f*_,x=h*g-_*d,R=+(c*y-l*b+u*T),P=-(a*y-l*E+u*A),S=+(a*b-c*E+u*x),C=-(a*T-c*A+l*x),M=n*R+r*P+o*S+s*C;if(0===M)return t.copyFrom(this),this;var O=1/M,I=l*v-m*u,D=c*v-g*u,L=c*m-g*l,w=a*v-_*u,F=a*m-_*l,N=a*g-_*c,B=l*p-f*u,U=c*p-d*u,V=c*f-d*l,G=a*p-h*u,k=a*f-h*l,z=a*d-h*c,j=-(r*y-o*b+s*T),H=+(n*y-o*E+s*A),W=-(n*b-r*E+s*x),X=+(n*T-r*A+o*x),Y=+(r*I-o*D+s*L),K=-(n*I-o*w+s*F),Q=+(n*D-r*w+s*N),q=-(n*L-r*F+o*N),Z=-(r*B-o*U+s*V),J=+(n*B-o*G+s*k),$=-(n*U-r*G+s*z),ee=+(n*V-r*k+o*z);return e.FromValuesToRef(R*O,j*O,Y*O,Z*O,P*O,H*O,K*O,J*O,S*O,W*O,Q*O,$*O,C*O,X*O,q*O,ee*O,t),this},e.prototype.addAtIndex=function(e,t){return this._m[e]+=t,this._markAsUpdated(),this},e.prototype.multiplyAtIndex=function(e,t){return this._m[e]*=t,this._markAsUpdated(),this},e.prototype.setTranslationFromFloats=function(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this._markAsUpdated(),this},e.prototype.addTranslationFromFloats=function(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this._markAsUpdated(),this},e.prototype.setTranslation=function(e){return this.setTranslationFromFloats(e.x,e.y,e.z)},e.prototype.getTranslation=function(){return new d(this._m[12],this._m[13],this._m[14])},e.prototype.getTranslationToRef=function(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],this},e.prototype.removeRotationAndScaling=function(){var t=this.m;return e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]),this},e.prototype.multiply=function(t){var i=new e;return this.multiplyToRef(t,i),i},e.prototype.copyFrom=function(e){e.copyToArray(this._m);var t=e;return this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this},e.prototype.copyToArray=function(e,t){void 0===t&&(t=0);for(var i=0;i<16;i++)e[t+i]=this._m[i];return this},e.prototype.multiplyToRef=function(e,t){return this._isIdentity?(t.copyFrom(e),this):e._isIdentity?(t.copyFrom(this),this):(this.multiplyToArray(e,t._m,0),t._markAsUpdated(),this)},e.prototype.multiplyToArray=function(e,t,i){var n=this._m,r=e.m,o=n[0],s=n[1],a=n[2],c=n[3],l=n[4],u=n[5],h=n[6],d=n[7],f=n[8],p=n[9],_=n[10],g=n[11],m=n[12],v=n[13],y=n[14],b=n[15],T=r[0],E=r[1],A=r[2],x=r[3],R=r[4],P=r[5],S=r[6],C=r[7],M=r[8],O=r[9],I=r[10],D=r[11],L=r[12],w=r[13],F=r[14],N=r[15];return t[i]=o*T+s*R+a*M+c*L,t[i+1]=o*E+s*P+a*O+c*w,t[i+2]=o*A+s*S+a*I+c*F,t[i+3]=o*x+s*C+a*D+c*N,t[i+4]=l*T+u*R+h*M+d*L,t[i+5]=l*E+u*P+h*O+d*w,t[i+6]=l*A+u*S+h*I+d*F,t[i+7]=l*x+u*C+h*D+d*N,t[i+8]=f*T+p*R+_*M+g*L,t[i+9]=f*E+p*P+_*O+g*w,t[i+10]=f*A+p*S+_*I+g*F,t[i+11]=f*x+p*C+_*D+g*N,t[i+12]=m*T+v*R+y*M+b*L,t[i+13]=m*E+v*P+y*O+b*w,t[i+14]=m*A+v*S+y*I+b*F,t[i+15]=m*x+v*C+y*D+b*N,this},e.prototype.equals=function(e){var t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;var i=this.m,n=t.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]},e.prototype.clone=function(){var t=new e;return t.copyFrom(this),t},e.prototype.getClassName=function(){return"Matrix"},e.prototype.getHashCode=function(){for(var e=this._m[0]||0,t=1;t<16;t++)e=397*e^(this._m[t]||0);return e},e.prototype.decompose=function(t,i,n){if(this._isIdentity)return n&&n.setAll(0),t&&t.setAll(1),i&&i.copyFromFloats(0,0,0,1),!0;var r=this._m;if(n&&n.copyFromFloats(r[12],r[13],r[14]),(t=t||I.Vector3[0]).x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),t.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),t.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),this.determinant()<=0&&(t.y*=-1),0===t.x||0===t.y||0===t.z)return i&&i.copyFromFloats(0,0,0,1),!1;if(i){var o=1/t.x,s=1/t.y,a=1/t.z;e.FromValuesToRef(r[0]*o,r[1]*o,r[2]*o,0,r[4]*s,r[5]*s,r[6]*s,0,r[8]*a,r[9]*a,r[10]*a,0,0,0,0,1,I.Matrix[0]),_.FromRotationMatrixToRef(I.Matrix[0],i)}return!0},e.prototype.getRow=function(e){if(e<0||e>3)return null;var t=4*e;return new f(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])},e.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},e.prototype.transpose=function(){return e.Transpose(this)},e.prototype.transposeToRef=function(t){return e.TransposeToRef(this,t),this},e.prototype.setRowFromFloats=function(e,t,i,n,r){if(e<0||e>3)return this;var o=4*e;return this._m[o+0]=t,this._m[o+1]=i,this._m[o+2]=n,this._m[o+3]=r,this._markAsUpdated(),this},e.prototype.scale=function(t){var i=new e;return this.scaleToRef(t,i),i},e.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]=this._m[i]*e;return t._markAsUpdated(),this},e.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t._markAsUpdated(),this},e.prototype.toNormalMatrix=function(t){var i=I.Matrix[0];this.invertToRef(i),i.transposeToRef(t);var n=t._m;e.FromValuesToRef(n[0],n[1],n[2],0,n[4],n[5],n[6],0,n[8],n[9],n[10],0,0,0,0,1,t)},e.prototype.getRotationMatrix=function(){var t=new e;return this.getRotationMatrixToRef(t),t},e.prototype.getRotationMatrixToRef=function(t){var i=I.Vector3[0];if(!this.decompose(i))return e.IdentityToRef(t),this;var n=this._m,r=1/i.x,o=1/i.y,s=1/i.z;return e.FromValuesToRef(n[0]*r,n[1]*r,n[2]*r,0,n[4]*o,n[5]*o,n[6]*o,0,n[8]*s,n[9]*s,n[10]*s,0,0,0,0,1,t),this},e.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this._markAsUpdated()},e.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this._markAsUpdated()},e.FromArray=function(t,i){void 0===i&&(i=0);var n=new e;return e.FromArrayToRef(t,i,n),n},e.FromArrayToRef=function(e,t,i){for(var n=0;n<16;n++)i._m[n]=e[n+t];i._markAsUpdated()},e.FromFloat32ArrayToRefScaled=function(e,t,i,n){for(var r=0;r<16;r++)n._m[r]=e[r+t]*i;n._markAsUpdated()},Object.defineProperty(e,"IdentityReadOnly",{get:function(){return e._identityReadOnly},enumerable:!0,configurable:!0}),e.FromValuesToRef=function(e,t,i,n,r,o,s,a,c,l,u,h,d,f,p,_,g){var m=g._m;m[0]=e,m[1]=t,m[2]=i,m[3]=n,m[4]=r,m[5]=o,m[6]=s,m[7]=a,m[8]=c,m[9]=l,m[10]=u,m[11]=h,m[12]=d,m[13]=f,m[14]=p,m[15]=_,g._markAsUpdated()},e.FromValues=function(t,i,n,r,o,s,a,c,l,u,h,d,f,p,_,g){var m=new e,v=m._m;return v[0]=t,v[1]=i,v[2]=n,v[3]=r,v[4]=o,v[5]=s,v[6]=a,v[7]=c,v[8]=l,v[9]=u,v[10]=h,v[11]=d,v[12]=f,v[13]=p,v[14]=_,v[15]=g,m._markAsUpdated(),m},e.Compose=function(t,i,n){var r=new e;return e.ComposeToRef(t,i,n,r),r},e.ComposeToRef=function(e,t,i,n){var r=n._m,o=t.x,s=t.y,a=t.z,c=t.w,l=o+o,u=s+s,h=a+a,d=o*l,f=o*u,p=o*h,_=s*u,g=s*h,m=a*h,v=c*l,y=c*u,b=c*h,T=e.x,E=e.y,A=e.z;r[0]=(1-(_+m))*T,r[1]=(f+b)*T,r[2]=(p-y)*T,r[3]=0,r[4]=(f-b)*E,r[5]=(1-(d+m))*E,r[6]=(g+v)*E,r[7]=0,r[8]=(p+y)*A,r[9]=(g-v)*A,r[10]=(1-(d+_))*A,r[11]=0,r[12]=i.x,r[13]=i.y,r[14]=i.z,r[15]=1,n._markAsUpdated()},e.Identity=function(){var t=e.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},e.IdentityToRef=function(t){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)},e.Zero=function(){var t=e.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},e.RotationX=function(t){var i=new e;return e.RotationXToRef(t,i),i},e.Invert=function(t){var i=new e;return t.invertToRef(i),i},e.RotationXToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationY=function(t){var i=new e;return e.RotationYToRef(t,i),i},e.RotationYToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationZ=function(t){var i=new e;return e.RotationZToRef(t,i),i},e.RotationZToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationAxis=function(t,i){var n=new e;return e.RotationAxisToRef(t,i,n),n},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(-t),r=Math.cos(-t),o=1-r;e.normalize();var s=i._m;s[0]=e.x*e.x*o+r,s[1]=e.x*e.y*o-e.z*n,s[2]=e.x*e.z*o+e.y*n,s[3]=0,s[4]=e.y*e.x*o+e.z*n,s[5]=e.y*e.y*o+r,s[6]=e.y*e.z*o-e.x*n,s[7]=0,s[8]=e.z*e.x*o-e.y*n,s[9]=e.z*e.y*o+e.x*n,s[10]=e.z*e.z*o+r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},e.RotationAlignToRef=function(e,t,i){var n=d.Cross(t,e),r=d.Dot(t,e),o=1/(1+r),s=i._m;s[0]=n.x*n.x*o+r,s[1]=n.y*n.x*o-n.z,s[2]=n.z*n.x*o+n.y,s[3]=0,s[4]=n.x*n.y*o+n.z,s[5]=n.y*n.y*o+r,s[6]=n.z*n.y*o-n.x,s[7]=0,s[8]=n.x*n.z*o-n.y,s[9]=n.y*n.z*o+n.x,s[10]=n.z*n.z*o+r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){_.RotationYawPitchRollToRef(e,t,i,I.Quaternion[0]),I.Quaternion[0].toRotationMatrix(n)},e.Scaling=function(t,i,n){var r=new e;return e.ScalingToRef(t,i,n,r),r},e.ScalingToRef=function(t,i,n,r){e.FromValuesToRef(t,0,0,0,0,i,0,0,0,0,n,0,0,0,0,1,r),r._updateIdentityStatus(1===t&&1===i&&1===n)},e.Translation=function(t,i,n){var r=new e;return e.TranslationToRef(t,i,n,r),r},e.TranslationToRef=function(t,i,n,r){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,i,n,1,r),r._updateIdentityStatus(0===t&&0===i&&0===n)},e.Lerp=function(t,i,n){var r=new e;return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){for(var r=n._m,o=e.m,s=t.m,a=0;a<16;a++)r[a]=o[a]*(1-i)+s[a]*i;n._markAsUpdated()},e.DecomposeLerp=function(t,i,n){var r=new e;return e.DecomposeLerpToRef(t,i,n,r),r},e.DecomposeLerpToRef=function(t,i,n,r){var o=I.Vector3[0],s=I.Quaternion[0],a=I.Vector3[1];t.decompose(o,s,a);var c=I.Vector3[2],l=I.Quaternion[1],u=I.Vector3[3];i.decompose(c,l,u);var h=I.Vector3[4];d.LerpToRef(o,c,n,h);var f=I.Quaternion[2];_.SlerpToRef(s,l,n,f);var p=I.Vector3[5];d.LerpToRef(a,u,n,p),e.ComposeToRef(h,f,p,r)},e.LookAtLH=function(t,i,n){var r=new e;return e.LookAtLHToRef(t,i,n,r),r},e.LookAtLHToRef=function(t,i,n,r){var o=I.Vector3[0],s=I.Vector3[1],a=I.Vector3[2];i.subtractToRef(t,a),a.normalize(),d.CrossToRef(n,a,o);var c=o.lengthSquared();0===c?o.x=1:o.normalizeFromLength(Math.sqrt(c)),d.CrossToRef(a,o,s),s.normalize();var l=-d.Dot(o,t),u=-d.Dot(s,t),h=-d.Dot(a,t);e.FromValuesToRef(o.x,s.x,a.x,0,o.y,s.y,a.y,0,o.z,s.z,a.z,0,l,u,h,1,r)},e.LookAtRH=function(t,i,n){var r=new e;return e.LookAtRHToRef(t,i,n,r),r},e.LookAtRHToRef=function(t,i,n,r){var o=I.Vector3[0],s=I.Vector3[1],a=I.Vector3[2];t.subtractToRef(i,a),a.normalize(),d.CrossToRef(n,a,o);var c=o.lengthSquared();0===c?o.x=1:o.normalizeFromLength(Math.sqrt(c)),d.CrossToRef(a,o,s),s.normalize();var l=-d.Dot(o,t),u=-d.Dot(s,t),h=-d.Dot(a,t);e.FromValuesToRef(o.x,s.x,a.x,0,o.y,s.y,a.y,0,o.z,s.z,a.z,0,l,u,h,1,r)},e.OrthoLH=function(t,i,n,r){var o=new e;return e.OrthoLHToRef(t,i,n,r,o),o},e.OrthoLHToRef=function(t,i,n,r,o){var s=2/t,a=2/i,c=2/(r-n),l=-(r+n)/(r-n);e.FromValuesToRef(s,0,0,0,0,a,0,0,0,0,c,0,0,0,l,1,o),o._updateIdentityStatus(1===s&&1===a&&1===c&&0===l)},e.OrthoOffCenterLH=function(t,i,n,r,o,s){var a=new e;return e.OrthoOffCenterLHToRef(t,i,n,r,o,s,a),a},e.OrthoOffCenterLHToRef=function(t,i,n,r,o,s,a){var c=2/(i-t),l=2/(r-n),u=2/(s-o),h=-(s+o)/(s-o),d=(t+i)/(t-i),f=(r+n)/(n-r);e.FromValuesToRef(c,0,0,0,0,l,0,0,0,0,u,0,d,f,h,1,a),a._markAsUpdated()},e.OrthoOffCenterRH=function(t,i,n,r,o,s){var a=new e;return e.OrthoOffCenterRHToRef(t,i,n,r,o,s,a),a},e.OrthoOffCenterRHToRef=function(t,i,n,r,o,s,a){e.OrthoOffCenterLHToRef(t,i,n,r,o,s,a),a._m[10]*=-1},e.PerspectiveLH=function(t,i,n,r){var o=new e,s=2*n/t,a=2*n/i,c=(r+n)/(r-n),l=-2*r*n/(r-n);return e.FromValuesToRef(s,0,0,0,0,a,0,0,0,0,c,1,0,0,l,0,o),o._updateIdentityStatus(!1),o},e.PerspectiveFovLH=function(t,i,n,r){var o=new e;return e.PerspectiveFovLHToRef(t,i,n,r,o),o},e.PerspectiveFovLHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=n,c=r,l=1/Math.tan(.5*t),u=s?l/i:l,h=s?l:l*i,d=(c+a)/(c-a),f=-2*c*a/(c-a);e.FromValuesToRef(u,0,0,0,0,h,0,0,0,0,d,1,0,0,f,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovRH=function(t,i,n,r){var o=new e;return e.PerspectiveFovRHToRef(t,i,n,r,o),o},e.PerspectiveFovRHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=n,c=r,l=1/Math.tan(.5*t),u=s?l/i:l,h=s?l:l*i,d=-(c+a)/(c-a),f=-2*c*a/(c-a);e.FromValuesToRef(u,0,0,0,0,h,0,0,0,0,d,-1,0,0,f,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovWebVRToRef=function(e,t,i,n,r){void 0===r&&(r=!1);var o=r?-1:1,s=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),c=Math.tan(e.leftDegrees*Math.PI/180),l=Math.tan(e.rightDegrees*Math.PI/180),u=2/(c+l),h=2/(s+a),d=n._m;d[0]=u,d[1]=d[2]=d[3]=d[4]=0,d[5]=h,d[6]=d[7]=0,d[8]=(c-l)*u*.5,d[9]=-(s-a)*h*.5,d[10]=-i/(t-i),d[11]=1*o,d[12]=d[13]=d[15]=0,d[14]=-2*i*t/(i-t),n._markAsUpdated()},e.GetFinalMatrix=function(t,i,n,r,o,s){var a=t.width,c=t.height,l=t.x,u=t.y,h=e.FromValues(a/2,0,0,0,0,-c/2,0,0,0,0,s-o,0,l+a/2,c/2+u,o,1),d=I.Matrix[0];return i.multiplyToRef(n,d),d.multiplyToRef(r,d),d.multiply(h)},e.GetAsMatrix2x2=function(e){var t=e.m;return new Float32Array([t[0],t[1],t[4],t[5]])},e.GetAsMatrix3x3=function(e){var t=e.m;return new Float32Array([t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]])},e.Transpose=function(t){var i=new e;return e.TransposeToRef(t,i),i},e.TransposeToRef=function(e,t){var i=t._m,n=e.m;i[0]=n[0],i[1]=n[4],i[2]=n[8],i[3]=n[12],i[4]=n[1],i[5]=n[5],i[6]=n[9],i[7]=n[13],i[8]=n[2],i[9]=n[6],i[10]=n[10],i[11]=n[14],i[12]=n[3],i[13]=n[7],i[14]=n[11],i[15]=n[15],t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty)},e.Reflection=function(t){var i=new e;return e.ReflectionToRef(t,i),i},e.ReflectionToRef=function(t,i){t.normalize();var n=t.normal.x,r=t.normal.y,o=t.normal.z,s=-2*n,a=-2*r,c=-2*o;e.FromValuesToRef(s*n+1,a*n,c*n,0,s*r,a*r+1,c*r,0,s*o,a*o,c*o+1,0,s*t.d,a*t.d,c*t.d,1,i)},e.FromXYZAxesToRef=function(t,i,n,r){e.FromValuesToRef(t.x,t.y,t.z,0,i.x,i.y,i.z,0,n.x,n.y,n.z,0,0,0,0,1,r)},e.FromQuaternionToRef=function(e,t){var i=e.x*e.x,n=e.y*e.y,r=e.z*e.z,o=e.x*e.y,s=e.z*e.w,a=e.z*e.x,c=e.y*e.w,l=e.y*e.z,u=e.x*e.w;t._m[0]=1-2*(n+r),t._m[1]=2*(o+s),t._m[2]=2*(a-c),t._m[3]=0,t._m[4]=2*(o-s),t._m[5]=1-2*(r+i),t._m[6]=2*(l+u),t._m[7]=0,t._m[8]=2*(a+c),t._m[9]=2*(l-u),t._m[10]=1-2*(n+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t._markAsUpdated()},e._updateFlagSeed=0,e._identityReadOnly=e.Identity(),e}(),m=function(){function e(e,t,i,n){this.normal=new d(e,t,i),this.d=n}return e.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},e.prototype.clone=function(){return new e(this.normal.x,this.normal.y,this.normal.z,this.d)},e.prototype.getClassName=function(){return"Plane"},e.prototype.getHashCode=function(){var e=this.normal.getHashCode();return e=397*e^(this.d||0)},e.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},e.prototype.transform=function(t){var i=I.Matrix[0];g.TransposeToRef(t,i);var n=i.m,r=this.normal.x,o=this.normal.y,s=this.normal.z,a=this.d;return new e(r*n[0]+o*n[1]+s*n[2]+a*n[3],r*n[4]+o*n[5]+s*n[6]+a*n[7],r*n[8]+o*n[9]+s*n[10]+a*n[11],r*n[12]+o*n[13]+s*n[14]+a*n[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,s=t.z-e.z,a=i.x-e.x,c=i.y-e.y,l=i.z-e.z,u=o*l-s*c,h=s*a-r*l,d=r*c-o*a,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 d.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return d.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 n=-(t.x*e.x+t.y*e.y+t.z*e.z);return d.Dot(i,t)+n},e}(),v=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}(),y=function(){function e(){}return e.GetPlanes=function(t){for(var i=[],n=0;n<6;n++)i.push(new m(0,0,0,0));return e.GetPlanesToRef(t,i),i},e.GetNearPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[2],t.normal.y=i[7]+i[6],t.normal.z=i[11]+i[10],t.d=i[15]+i[14],t.normalize()},e.GetFarPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[2],t.normal.y=i[7]-i[6],t.normal.z=i[11]-i[10],t.d=i[15]-i[14],t.normalize()},e.GetLeftPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[0],t.normal.y=i[7]+i[4],t.normal.z=i[11]+i[8],t.d=i[15]+i[12],t.normalize()},e.GetRightPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[0],t.normal.y=i[7]-i[4],t.normal.z=i[11]-i[8],t.d=i[15]-i[12],t.normalize()},e.GetTopPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[1],t.normal.y=i[7]-i[5],t.normal.z=i[11]-i[9],t.d=i[15]-i[13],t.normalize()},e.GetBottomPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[1],t.normal.y=i[7]+i[5],t.normal.z=i[11]+i[9],t.d=i[15]+i[13],t.normalize()},e.GetPlanesToRef=function(t,i){e.GetNearPlaneToRef(t,i[0]),e.GetFarPlaneToRef(t,i[1]),e.GetLeftPlaneToRef(t,i[2]),e.GetRightPlaneToRef(t,i[3]),e.GetTopPlaneToRef(t,i[4]),e.GetBottomPlaneToRef(t,i[5])},e}();!function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE"}(n||(n={}));var b,T=function(){function e(){}return e.X=new d(1,0,0),e.Y=new d(0,1,0),e.Z=new d(0,0,1),e}(),E=function(){function e(){}return e.Interpolate=function(e,t,i,n,r){for(var o=1-3*n+3*t,s=3*n-6*t,a=3*t,c=e,l=0;l<5;l++){var u=c*c;c-=(o*(u*c)+s*u+a*c-e)*(1/(3*o*u+2*s*c+a)),c=Math.min(1,Math.max(0,c))}return 3*Math.pow(1-c,2)*c*i+3*(1-c)*Math.pow(c,2)*r+Math.pow(c,3)},e}();!function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"}(b||(b={}));var A=function(){function e(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return e.prototype.degrees=function(){return 180*this._radians/Math.PI},e.prototype.radians=function(){return this._radians},e.BetweenTwoPoints=function(t,i){var n=i.subtract(t);return new e(Math.atan2(n.y,n.x))},e.FromRadians=function(t){return new e(t)},e.FromDegrees=function(t){return new e(t*Math.PI/180)},e}(),x=function(){return function(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;var n=Math.pow(t.x,2)+Math.pow(t.y,2),r=(Math.pow(e.x,2)+Math.pow(e.y,2)-n)/2,o=(n-Math.pow(i.x,2)-Math.pow(i.y,2))/2,s=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new h((r*(t.y-i.y)-o*(e.y-t.y))/s,((e.x-t.x)*o-(t.x-i.x)*r)/s),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=A.BetweenTwoPoints(this.centerPoint,this.startPoint);var a=this.startAngle.degrees(),c=A.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),l=A.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();c-a>180&&(c-=360),c-a<-180&&(c+=360),l-c>180&&(l-=360),l-c<-180&&(l+=360),this.orientation=c-a<0?b.CW:b.CCW,this.angle=A.FromDegrees(this.orientation===b.CW?a-l:l-a)}}(),R=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new h(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new h(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 h(e,t),a=new h(i,n),c=new x(o,s,a),l=c.angle.radians()/r;c.orientation===b.CW&&(l*=-1);for(var u=c.startAngle.radians()+l,d=0;d1)return h.Zero();for(var t=e*this.length(),i=0,n=0;n=i&&t<=a){var c=s.normalize(),l=t-i;return new h(o.x+c.x*l,o.y+c.y*l)}i=a}return h.Zero()},e.StartingAt=function(t,i){return new e(t,i)},e}(),P=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=o.a.WithinEpsilon(Math.abs(e.y)/r,1,c)?o.a.WithinEpsilon(Math.abs(e.x)/r,1,c)?o.a.WithinEpsilon(Math.abs(e.z)/r,1,c)?d.Zero():new d(0,0,1):new d(1,0,0):new d(0,-1,0),i=d.Cross(e,n)):(i=d.Cross(e,t),d.CrossToRef(i,e,i));return i.normalize(),i},e}(),S=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},a=0;a<=r;a++)o.push(new d(s(a/r,t.x,i.x,n.x),s(a/r,t.y,i.y,n.y),s(a/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,a=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},c=0;c<=o;c++)s.push(new d(a(c/o,t.x,i.x,n.x,r.x),a(c/o,t.y,i.y,n.y,r.y),a(c/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,a=1/o,c=0;c<=o;c++)s.push(d.Hermite(t,i,n,r,c*a));return new e(s)},e.CreateCatmullRomSpline=function(t,i,n){var r=new Array,o=1/i,s=0;if(n){for(var a=t.length,c=0;c=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s}function a(e,t,i,n){return new(i||(i=Promise))(function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(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(s,a)}c((n=n.apply(e,t||[])).next())})}function c(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]this._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,"isMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!0,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0&&this._mesh.material){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n-1?t:e.ShadersRepository+t,this._engine._loadFile(n+".vertex.fx",i)):i(window.atob(t.substr(7)))},e.prototype._loadFragmentShader=function(t,i){var n;if(o.a.IsWindowObjectExist()&&t instanceof HTMLElement)return void i(o.a.GetDOMTextContent(t));"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)))},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,a="\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?(s.a.Error("Vertex shader: "+this.name.vertexElement+a),s.a.Error("Fragment shader: "+this.name.fragmentElement+c)):this.name.vertex?(s.a.Error("Vertex shader: "+this.name.vertex+a),s.a.Error("Fragment shader: "+this.name.fragment+c)):(s.a.Error("Vertex shader: "+this.name+a),s.a.Error("Fragment shader: "+this.name+c))},e.prototype._processShaderConversion=function(e,t,i){var n=this._processPrecision(e);if(1!=this._engine.webGLVersion)if(-1===n.indexOf("#version 3")){var r=-1!==n.search(/#extension.+GL_EXT_draw_buffers.+require/),o=n.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"");o=(o=(o=(o=o.replace(/varying(?![\n\r])\s/g,t?"in ":"out ")).replace(/attribute[ \t]/g,"in ")).replace(/[ \t]attribute/g," in")).replace(/texture2D\s*\(/g,"texture("),t&&(o=(o=(o=(o=(o=(o=(o=o.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(r?"":"out vec4 glFragColor;\n")+"void main(")),-1!==this.defines.indexOf("#define MULTIVIEW\n")&&!t&&(o="#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+o),i(o)}else i(n.replace("#version 300 es",""));else i(n)},e.prototype._processIncludes=function(t,i){for(var n=this,r=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,o=r.exec(t),s=new String(t);null!=o;){var a=o[1];if(-1!==a.indexOf("__decl__")&&(a=a.replace(/__decl__/,""),this._engine.supportsUniformBuffers&&(a=(a=a.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),a+="Declaration"),!e.IncludesShadersStore[a]){var c=e.ShadersRepository+"ShadersInclude/"+a+".fx";return void this._engine._loadFile(c,function(t){e.IncludesShadersStore[a]=t,n._processIncludes(s,i)})}var l=e.IncludesShadersStore[a];if(o[2])for(var u=o[3].split(","),h=0;h
";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 d});var n=i(1),r=i(2),o=i(8),s=i(9),a=i(0),c=i(44),l=i(3),u=i(22),h=i(19),d=function(e){function t(i,n,r,a,c,u,h,d,f,p){void 0===r&&(r=!1),void 0===a&&(a=!0),void 0===c&&(c=t.TRILINEAR_SAMPLINGMODE),void 0===u&&(u=null),void 0===h&&(h=null),void 0===d&&(d=null),void 0===f&&(f=!1);var _=e.call(this,n)||this;if(_.url=null,_.uOffset=0,_.vOffset=0,_.uScale=1,_.vScale=1,_.uAng=0,_.vAng=0,_.wAng=0,_.uRotationCenter=.5,_.vRotationCenter=.5,_.wRotationCenter=.5,_.inspectableCustomProperties=null,_._noMipmap=!1,_._invertY=!1,_._rowGenerationMatrix=null,_._cachedTextureMatrix=null,_._projectionModeMatrix=null,_._t0=null,_._t1=null,_._t2=null,_._cachedUOffset=-1,_._cachedVOffset=-1,_._cachedUScale=0,_._cachedVScale=0,_._cachedUAng=-1,_._cachedVAng=-1,_._cachedWAng=-1,_._cachedProjectionMatrixId=-1,_._cachedCoordinatesMode=-1,_._initialSamplingMode=t.BILINEAR_SAMPLINGMODE,_._buffer=null,_._deleteBuffer=!1,_._format=null,_._delayedOnLoad=null,_._delayedOnError=null,_.onLoadObservable=new o.c,_._isBlocking=!0,_.name=i||"",_.url=i,_._noMipmap=r,_._invertY=a,_._initialSamplingMode=c,_._buffer=d,_._deleteBuffer=f,p&&(_._format=p),!(n=_.getScene()))return _;n.getEngine().onBeforeTextureInitObservable.notifyObservers(_);var g=function(){_._texture&&_._texture._invertVScale&&(_.vScale=-1),_.onLoadObservable.hasObservers()&&_.onLoadObservable.notifyObservers(_),u&&u(),!_.isBlocking&&n&&n.resetCachedMaterial()};return _.url?(_._texture=_._getFromCache(_.url,r,c,a),_._texture?_._texture.isReady?s.h.SetImmediate(function(){return g()}):_._texture.onLoadedObservable.add(g):n.useDelayedTextureLoading?(_.delayLoadState=l.a.DELAYLOADSTATE_NOTLOADED,_._delayedOnLoad=g,_._delayedOnError=h):(_._texture=n.getEngine().createTexture(_.url,r,a,n,c,g,h,_._buffer,void 0,_._format),f&&delete _._buffer),_):(_._delayedOnLoad=g,_._delayedOnError=h,_)}return n.d(t,e),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"invertY",{get:function(){return this._invertY},enumerable:!0,configurable:!0}),t.prototype.updateURL=function(e,t,i){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(l.a.MATERIAL_TextureDirtyFlag)),this.url=e,this._buffer=t,this.delayLoadState=l.a.DELAYLOADSTATE_NOTLOADED,i&&(this._delayedOnLoad=i),this.delayLoad()},t.prototype.delayLoad=function(){if(this.delayLoadState===l.a.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();e&&(this.delayLoadState=l.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY),this._texture?this._delayedOnLoad&&(this._texture.isReady?s.h.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format),this._deleteBuffer&&delete this._buffer),this._delayedOnLoad=null,this._delayedOnError=null)}},t.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this.uScale,t*=this.vScale,e-=this.uRotationCenter*this.uScale,t-=this.vRotationCenter*this.vScale,i-=this.wRotationCenter,a.x.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this.uScale+this.uOffset,n.y+=this.vRotationCenter*this.vScale+this.vOffset,n.z+=this.wRotationCenter},t.prototype.getTextureMatrix=function(){var e=this;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedTextureMatrix||(this._cachedTextureMatrix=a.j.Zero(),this._rowGenerationMatrix=new a.j,this._t0=a.x.Zero(),this._t1=a.x.Zero(),this._t2=a.x.Zero()),a.j.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),a.j.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix);var t=this.getScene();return t?(t.markAllMaterialsAsDirty(l.a.MATERIAL_TextureDirtyFlag,function(t){return t.hasTexture(e)}),this._cachedTextureMatrix):this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=this,i=this.getScene();if(!i)return this._cachedTextureMatrix;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.coordinatesMode===this._cachedCoordinatesMode){if(this.coordinatesMode!==t.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=a.j.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=a.j.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:a.j.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case t.PROJECTION_MODE:a.j.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var n=i.getProjectionMatrix();this._cachedProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:a.j.IdentityToRef(this._cachedTextureMatrix)}return i.markAllMaterialsAsDirty(l.a.MATERIAL_TextureDirtyFlag,function(t){return-1!==t.getActiveTextures().indexOf(e)}),this._cachedTextureMatrix},t.prototype.clone=function(){var e=this;return r.a.Clone(function(){return new t(e._texture?e._texture.url:null,e.getScene(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture?e._texture._buffer:void 0)},this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return"string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)&&(t.base64String=this._buffer,t.name=t.name.replace("data:","")),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t},t.prototype.getClassName=function(){return"Texture"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},t.Parse=function(e,i,n){if(e.customType){var o=s.h.Instantiate(e.customType).Parse(e,i,n);return e.samplingMode&&o.updateSamplingMode&&o._samplingMode&&o._samplingMode!==e.samplingMode&&o.updateSamplingMode(e.samplingMode),o}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,i,n);if(!e.name&&!e.isRenderTarget)return null;var c=r.a.Parse(function(){var r,o=!0;if(e.noMipmap&&(o=!1),e.mirrorPlane){var s=t._CreateMirror(e.name,e.renderTargetSize,i,o);return s._waitingRenderList=e.renderList,s.mirrorPlane=a.n.FromArray(e.mirrorPlane),s}if(e.isRenderTarget){var c=null;if(e.isCube){if(i.reflectionProbes)for(var l=0;l0},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||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}},e}(),T=function(){function e(){}return e.FetchToRef=function(e,t,i,n,r,o){var s=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*n%n|0)*i);o.r=r[s]/255,o.g=r[s+1]/255,o.b=r[s+2]/255,o.a=r[s+3]/255},e.Mix=function(e,t,i){return e*(1-i)+t*i},e.Instantiate=function(t){if(e.RegisteredExternalClasses&&e.RegisteredExternalClasses[t])return e.RegisteredExternalClasses[t];var i=h.a.GetClass(t);if(i)return i;u.a.Warn(t+" not found, you may have missed an import.");for(var n=t.split("."),r=window||this,o=0,s=n.length;o>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=c.a.SCALEMODE_NEAREST),n){case c.a.SCALEMODE_FLOOR:r=e.FloorPOT(t);break;case c.a.SCALEMODE_NEAREST:r=e.NearestPOT(t);break;case c.a.SCALEMODE_CEILING:default:r=e.CeilingPOT(t)}return Math.min(r,i)},e.GetFilename=function(e){var t=e.lastIndexOf("/");return t<0?e:e.substring(t+1)},e.GetFolderPath=function(e,t){void 0===t&&(t=!1);var i=e.lastIndexOf("/");return i<0?t?e:"":e.substring(0,i+1)},e.ToDegrees=function(e){return 180*e/Math.PI},e.ToRadians=function(e){return e*Math.PI/180},e.EncodeArrayBufferTobase64=function(e){for(var t,i,n,r,o,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",u=0,h=new Uint8Array(e);u>2,o=(3&t)<<4|(i=u>4,s=(15&i)<<2|(n=u>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),l+=c.charAt(r)+c.charAt(o)+c.charAt(s)+c.charAt(a);return"data:image/png;base64,"+l},e.ExtractMinAndMaxIndexed=function(e,t,i,n,o){void 0===o&&(o=null);for(var s=new r.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new r.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=i;c=200&&t.status<300||0===t.status&&(!l.a.IsWindowObjectExist()||e.IsFileURL()))return void i(o?t.response:t.responseText,t.responseURL);var n=e.DefaultRetryStrategy;if(n){var f=n(h,t,a);if(-1!==f)return t.removeEventListener("loadend",u),t=new _.a,void(r=setTimeout(function(){return s(a+1)},f))}var g=new y("Error status: "+t.status+" "+t.statusText+" - Unable to load "+h,t);if(!c)throw g;c(t,g)}};t.addEventListener("readystatechange",p),t.send()};s(0)};if(r&&r.enableSceneOffline){var g=function(e){e&&e.status>400?c&&c(e):d||p()};r.open(function(){d||r&&r.loadFile(t,function(e){d||i(e),f.onCompleteObservable.notifyObservers(f)},n?function(e){d||n(e)}:void 0,g,o)},g)}else p();return f},e.LoadScript=function(e,t,i,n){if(l.a.IsWindowObjectExist()){var r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.setAttribute("type","text/javascript"),o.setAttribute("src",e),n&&(o.id=n),o.onload=function(){t&&t()},o.onerror=function(t){i&&i("Unable to load script '"+e+"'",t)},r.appendChild(o)}},e.LoadScriptAsync=function(e,t){return new Promise(function(i,n){if(l.a.IsWindowObjectExist()){var r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.setAttribute("type","text/javascript"),o.setAttribute("src",e),t&&(o.id=t),o.onload=function(){i(!0)},o.onerror=function(e){i(!1)},r.appendChild(o)}else i(!1)})},e.ReadFileAsDataURL=function(e,t,i){var n=new FileReader,r={onCompleteObservable:new s.c,abort:function(){return n.abort()}};return n.onloadend=function(e){r.onCompleteObservable.notifyObservers(r)},n.onload=function(e){t(e.target.result)},n.onprogress=i,n.readAsDataURL(e),r},e.ReadFile=function(e,t,i,n){var r=new FileReader,o={onCompleteObservable:new s.c,abort:function(){return r.abort()}};return r.onloadend=function(e){return o.onCompleteObservable.notifyObservers(o)},r.onerror=function(i){u.a.Log("Error while reading file: "+e.name),t(JSON.stringify({autoClear:!0,clearColor:[1,0,0],ambientColor:[0,0,0],gravity:[0,-9.807,0],meshes:[],cameras:[],lights:[]}))},r.onload=function(e){t(e.target.result)},i&&(r.onprogress=i),n?r.readAsArrayBuffer(e):r.readAsText(e),o},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.CheckExtends=function(e,t,i){t.minimizeInPlace(e),i.maximizeInPlace(e)},e.DeepCopy=function(e,t,i,n){d.a.DeepCopy(e,t,i,n)},e.IsEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},e.EndsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},e.RegisterTopRootEvents=function(e){for(var t=0;t=r.gradient&&e<=o.gradient)return void i(r,o,(e-r.gradient)/(o.gradient-r.gradient))}var s=t.length-1;i(t[s],t[s],1)},e.BaseUrl="",e.UseCustomRequestHeaders=!1,e.CustomRequestHeaders=_.a.CustomRequestHeaders,e.DefaultRetryStrategy=b.ExponentialBackoff(),e.CorsBehavior="anonymous",e.UseFallbackTexture=!0,e.RegisteredExternalClasses={},e.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",e._tmpFloatArray=new Float32Array(1),e.GetDOMTextContent=l.a.GetDOMTextContent,e.PreprocessUrl=function(e){return e},e.NoneLogLevel=u.a.NoneLogLevel,e.MessageLogLevel=u.a.MessageLogLevel,e.WarningLogLevel=u.a.WarningLogLevel,e.ErrorLogLevel=u.a.ErrorLogLevel,e.AllLogLevel=u.a.AllLogLevel,e.IsWindowObjectExist=l.a.IsWindowObjectExist,e.PerformanceNoneLogLevel=0,e.PerformanceUserMarkLogLevel=1,e.PerformanceConsoleLogLevel=2,e.StartPerformanceCounter=e._StartPerformanceCounterDisabled,e.EndPerformanceCounter=e._EndPerformanceCounterDisabled,e}(),E=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=f.a.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var i=f.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=f.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 A(e,t){return function(i){i.__bjsclassName__=e,i.__bjsmoduleName__=null!=t?t:null}}var x=function(){function e(e,t,i,n){void 0===n&&(n=0),this.iterations=e,this.index=n-1,this._done=!1,this._fn=t,this._successCallback=i}return e.prototype.executeNext=function(){this._done||(this.index+1=t)break;if(n(s),o&&o()){e.breakLoop();break}}e.executeNext()},s)},r)},e}()},function(e,t,i){"use strict";i.d(t,"d",function(){return x}),i.d(t,"a",function(){return R}),i.d(t,"c",function(){return P}),i.d(t,"b",function(){return S});var n=i(1),r=i(8),o=i(105),s=i(61),a=i(106),c=i(9),l=i(0),u=i(12),h=i(5),d=i(20),f=i(26),p=i(94),_=i(3),g=i(35),m=i(6),v=i(23),y=i(92),b=i(19),T=i(107),E=i(73),A=function(){return function(){}}(),x=function(){return function(){}}(),R=function(){return function(){}}(),P=function(){return function(){}}(),S=function(){function e(t,i,n,s){var u=this;void 0===s&&(s=!1),this.forcePOTTextures=!1,this.isFullscreen=!1,this.isPointerLock=!1,this.cullBackFaces=!0,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.enableOfflineSupport=!1,this.disableManifestCheck=!1,this.scenes=new Array,this.onNewSceneAddedObservable=new r.c,this.postProcesses=new Array,this.validateShaderPrograms=!1,this.onResizeObservable=new r.c,this.onCanvasBlurObservable=new r.c,this.onCanvasFocusObservable=new r.c,this.onCanvasPointerOutObservable=new r.c,this.onBeforeTextureInitObservable=new r.c,this.disableUniformBuffers=!1,this._uniformBuffers=new Array,this.onBeginFrameObservable=new r.c,this.customAnimationFrameRequester=null,this.onEndFrameObservable=new r.c,this.onBeforeShaderCompilationObservable=new r.c,this.onAfterShaderCompilationObservable=new r.c,this._windowIsBackground=!1,this._webGLVersion=1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._colorWrite=!0,this._drawCalls=new c.f,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this._deterministicLockstep=!1,this._lockstepMaxSteps=4,this.onContextLostObservable=new r.c,this.onContextRestoredObservable=new r.c,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this._performanceMonitor=new o.a,this._fps=60,this._deltaTime=0,this.disablePerformanceMonitorInBackground=!1,this.disableVertexArrayObjects=!1,this._depthCullingState=new p.b,this._stencilState=new p.c,this._alphaState=new p.a,this._alphaMode=e.ALPHA_DISABLE,this._internalTexturesCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._activeRequests=new Array,this._texturesSupported=new Array,this.premultipliedAlpha=!0,this._viewportCached=new l.y(0,0,0,0),this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},a.a.Apply();var h=null;if(e.Instances.push(this),t){if(n=n||{},t.getContext){if(h=t,this._renderingCanvas=h,null!=i&&(n.antialias=i),void 0===n.deterministicLockstep&&(n.deterministicLockstep=!1),void 0===n.lockstepMaxSteps&&(n.lockstepMaxSteps=4),void 0===n.preserveDrawingBuffer&&(n.preserveDrawingBuffer=!1),void 0===n.audioEngine&&(n.audioEngine=!0),void 0===n.stencil&&(n.stencil=!0),!1===n.premultipliedAlpha&&(this.premultipliedAlpha=!1),this._deterministicLockstep=n.deterministicLockstep,this._lockstepMaxSteps=n.lockstepMaxSteps,this._doNotHandleContextLost=!!n.doNotHandleContextLost,navigator&&navigator.userAgent)for(var d=navigator.userAgent,f=0,_=e.ExceptionList;f<_.length;f++){var v=_[f],y=v.key,b=v.targets;if(new RegExp(y).test(d)){if(v.capture&&v.captureConstraint){var T=v.capture,E=v.captureConstraint,x=new RegExp(T).exec(d);if(x&&x.length>0)if(parseInt(x[x.length-1])>=E)continue}for(var R=0,P=b;R1&&!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 b.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;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 s=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),a=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);s&&a&&(this._caps.highPrecisionShaderSupported=0!==s.precision&&0!==a.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=c.h.QueueNewFrame(this.customAnimationFrameRequester.renderFunction||this._bindedRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=c.h.QueueNewFrame(this._bindedRenderFunction):this._renderingQueueLaunched=!1},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=c.h.QueueNewFrame(this._bindedRenderFunction)))},e.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},e.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&c.h.RequestFullscreen(this._renderingCanvas))},e.prototype.exitFullscreen=function(){this.isFullscreen&&c.h.ExitFullscreen()},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,s=e.y||0;this._cachedViewport=e,this._viewport(o*n,s*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&&(this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)){this._renderingCanvas.width=e,this._renderingCanvas.height=t;for(var i=0;i65535){o=!0;break}i=o?new Uint32Array(e):new Uint16Array(e)}else i=new Uint16Array(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),r.references=1,r.is32Bits=o,r},e.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},e.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},e.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},e.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},e.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},e.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},e.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},e.prototype._vertexAttribPointer=function(e,t,i,n,r,o,s){var a=this._currentBufferPointers[t],c=!1;a.active?(a.buffer!==e&&(a.buffer=e,c=!0),a.size!==i&&(a.size=i,c=!0),a.type!==n&&(a.type=n,c=!0),a.normalized!==r&&(a.normalized=r,c=!0),a.stride!==o&&(a.stride=o,c=!0),a.offset!==s&&(a.offset=s,c=!0)):(c=!0,a.active=!0,a.index=t,a.size=i,a.type=n,a.normalized=r,a.stride=o,a.offset=s,a.buffer=e),(c||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,n,r,o,s))},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 s=o.getBuffer();s&&(this._vertexAttribPointer(s,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(s))))}}},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 s=0,a=0;a=0&&(this._gl.enableVertexAttribArray(c),this._vertexAttribArraysEnabled[c]=!0,this._vertexAttribPointer(e,c,i[a],this._gl.FLOAT,!1,n,s)),s+=4*i[a]}}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":"",a=this._compileShader(t,"vertex",n,s),c=this._compileShader(i,"fragment",n,s),l=this._createShaderProgram(e,a,c,r,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),l},e.prototype.createPipelineContext=function(){var e=new T.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 s=this.createTransformFeedback();this.bindTransformFeedback(s),this.setTranformFeedbackVaryings(o,r),e.transformFeedback=s}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,s;if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(i))throw new Error(o);if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(n))throw new Error(o);if(s=t.getProgramInfoLog(r))throw new Error(s)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS)&&(s=t.getProgramInfoLog(r))))throw new Error(s);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,s){var a=e;a.program=n?this.createRawShaderProgram(a,t,i,void 0,s):this.createShaderProgram(a,t,i,o,void 0,s),a.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?g.substring(T).toLowerCase():""),A=null,x=0,R=e._TextureLoaders;xl||t.height>l||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),s.texImage2D(s.TEXTURE_2D,0,c,c,s.UNSIGNED_BYTE,_._workingCanvas),b.width=i,b.height=n,!1);var u=new f.a(_,f.a.DATASOURCE_TEMP);return _._bindTextureDirectly(s.TEXTURE_2D,u,!0),s.texImage2D(s.TEXTURE_2D,0,c,c,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),_._rescaleTexture(u,b,r,c,function(){_._releaseTexture(u),_._bindTextureDirectly(s.TEXTURE_2D,b,!0),o()}),!0},o)};!m||y?l instanceof HTMLImageElement?O(l):c.h.LoadImage(g,O,C,r?r.offlineProvider:null):"string"==typeof l||l instanceof ArrayBuffer||l instanceof Blob?c.h.LoadImage(l,O,C,r?r.offlineProvider:null):O(l)}return b},e.prototype._rescaleTexture=function(t,i,n,r,o){var s=this,a=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(){s._rescalePostProcess.onApply=function(e){e._bindTexture("textureSampler",t)};var e=n;e||(e=s.scenes[s.scenes.length-1]),e.postProcessManager.directRender([s._rescalePostProcess],a,!0),s._bindTextureDirectly(s._gl.TEXTURE_2D,i,!0),s._gl.copyTexImage2D(s._gl.TEXTURE_2D,0,r,0,0,i.width,i.height,0),s.unBindFramebuffer(a),s._releaseTexture(a),o&&o()})},e.prototype.createRawTexture=function(t,i,n,r,o,s,a,c,l){throw void 0===c&&(c=null),void 0===l&&(l=e.TEXTURETYPE_UNSIGNED_INT),b.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(e,t,i,n){var r=new f.a(this,f.a.DATASOURCE_DYNAMIC);return r.baseWidth=e,r.baseHeight=t,i&&(e=this.needPOTTextures?c.h.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?c.h.GetExponentOfTwo(t,this._caps.maxTextureSize):t),r.width=e,r.height=t,r.isReady=!1,r.generateMipMaps=i,r.samplingMode=n,this.updateTextureSamplingMode(n,r),this._internalTexturesCache.push(r),r},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 s=r?this._getInternalFormat(r):this._gl.RGBA;this._gl.texImage2D(this._gl.TEXTURE_2D,0,s,s,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 m.a.Error("WebGL 1 does not support texture comparison.")},e.prototype._setupDepthStencilTexture=function(t,i,n,r,o){var s=i.width||i,a=i.height||i;t.baseWidth=s,t.baseHeight=a,t.width=s,t.height=a,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 f.a(this,f.a.DATASOURCE_DEPTHTEXTURE);if(!this._caps.depthTextureExtension)return m.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 y.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 f.a(this,f.a.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(r.TEXTURE_2D,o,!0);var s=t.width||t,a=t.height||t,c=this._getSamplingParameters(n.samplingMode,!!n.generateMipMaps);n.type!==e.TEXTURETYPE_FLOAT||this._caps.textureFloat||(n.type=e.TEXTURETYPE_UNSIGNED_INT,m.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,c.mag),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,c.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),s,a,0,this._getInternalFormat(n.format),this._getWebGLTextureType(n.type),null);var l=this._currentFramebuffer,u=r.createFramebuffer();return this._bindUnboundFramebuffer(u),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,o._webGLTexture,0),o._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!n.generateStencilBuffer,n.generateDepthBuffer,s,a),n.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(r.TEXTURE_2D,null),r.bindRenderbuffer(r.RENDERBUFFER,null),this._bindUnboundFramebuffer(l),o._framebuffer=u,o.baseWidth=s,o.baseHeight=a,o.width=s,o.height=a,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,s=this._gl;return e?(o=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,o),r>1?s.renderbufferStorageMultisample(s.RENDERBUFFER,r,s.DEPTH24_STENCIL8,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,n),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,o)):t&&(o=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,o),r>1?s.renderbufferStorageMultisample(s.RENDERBUFFER,r,s.DEPTH_COMPONENT16,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,i,n),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.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,i.getParameter(i.MAX_SAMPLES)),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,s){void 0===o&&(o=0),void 0===s&&(s=0);var a=this._gl,c=a.TEXTURE_2D;e.isCube&&(c=a.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(c,s,t,i,n,0,r)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s);this._unpackFlipY(e.invertY);var c=r.TEXTURE_2D;e.isCube&&(c=r.TEXTURE_CUBE_MAP_POSITIVE_X+i);var l=Math.round(u.a.Log2(e.width)),h=Math.round(u.a.Log2(e.height)),d=Math.pow(2,Math.max(l-n,0)),f=Math.pow(2,Math.max(h-n,0));r.texImage2D(c,n,a,d,f,0,s,o,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),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s),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,a,s,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,s,a){throw void 0===a&&(a=null),b.a.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture3D=function(t,i,n,r,o,s,a,c,l,u){throw void 0===l&&(l=null),void 0===u&&(u=e.TEXTURETYPE_UNSIGNED_INT),b.a.WarnImport("Engine.RawTexture")},e.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;if(o){var s=this._getSamplingParameters(r,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,s.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,s.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,s,a,l,u){var h=this;void 0===u&&(u=e.TEXTURE_TRILINEAR_SAMPLINGMODE);var d=this.getCaps().maxTextureSize,f=Math.min(d,this.needPOTTextures?c.h.GetExponentOfTwo(n,d):n),p=Math.min(d,this.needPOTTextures?c.h.GetExponentOfTwo(r,d):r),_=this._gl;_&&(t._webGLTexture?(this._bindTextureDirectly(_.TEXTURE_2D,t,!0),this._unpackFlipY(void 0===o||!!o),t.baseWidth=n,t.baseHeight=r,t.width=f,t.height=p,t.isReady=!0,l(f,p,function(){h._prepareWebGLTextureContinuation(t,i,s,a,u)})||this._prepareWebGLTextureContinuation(t,i,s,a,u)):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 s=0;s-1;return i&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n?(this._activateCurrentTexture(),t&&t.isMultiview?this._gl.bindTexture(e,t?t._colorTextureArray:null):this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)):i&&(r=!0,this._activateCurrentTexture()),o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r},e.prototype._bindTexture=function(e,t){void 0!==e&&(t&&(t._associatedChannel=e),this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,t))},e.prototype.setTextureFromPostProcess=function(e,t){this._bindTexture(e,t?t._textures.data[t._currentRenderTextureInd]:null)},e.prototype.setTextureFromPostProcessOutput=function(e,t){this._bindTexture(e,t?t._outputTexture:null)},e.prototype.unbindAllTextures=function(){for(var e=0;e1&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)},e.prototype.setTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},e.prototype.setDepthStencilTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0):this._setTexture(e,null))},e.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},e.prototype._getTextureWrapMode=function(t){switch(t){case e.TEXTURE_WRAP_ADDRESSMODE:return this._gl.REPEAT;case e.TEXTURE_CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case e.TEXTURE_MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},e.prototype._setTexture=function(t,i,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),!i)return null!=this._boundTexturesCache[t]&&(this._activeChannel=t,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)),!1;if(i.video)this._activeChannel=t,i.update();else if(i.delayLoadState===e.DELAYLOADSTATE_NOTLOADED)return i.delayLoad(),!1;var o;o=r?i.depthStencilTexture:i.isReady()?i.getInternalTexture():i.isCube?this.emptyCubeTexture:i.is3D?this.emptyTexture3D:this.emptyTexture,!n&&o&&(o._associatedChannel=t);var s=!0;if(this._boundTexturesCache[t]===o&&(n||this._bindSamplerUniformToChannel(o._associatedChannel,t),s=!1),this._activeChannel=t,o&&o.isMultiview)s&&this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,o,n);else if(o&&o.is3D)s&&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(s&&this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,o,n),o._cachedCoordinatesMode!==i.coordinatesMode){o._cachedCoordinatesMode=i.coordinatesMode;var a=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,a,o),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_T,a)}this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP,i)}else s&&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(),g.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(),h.a.ResetCache();for(var i=0,n=this._activeRequests;i-1?s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+n,e._webGLTexture,r):s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e._webGLTexture,r);var c=void 0!==e.type?this._getWebGLTextureType(e.type):s.UNSIGNED_BYTE;switch(c){case s.UNSIGNED_BYTE:o||(o=new Uint8Array(4*t*i)),c=s.UNSIGNED_BYTE;break;default:o||(o=new Float32Array(4*t*i)),c=s.FLOAT}return s.readPixels(0,0,t,i,s.RGBA,c,o),s.bindFramebuffer(s.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 s=t.RGBA,a=t.UNSIGNED_BYTE,c=new Uint8Array(4);t.readPixels(0,0,1,1,s,a,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}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 s=this,a=c.h.LoadFile(e,t,i,n,r,o);return this._activeRequests.push(a),a.onCompleteObservable.add(function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)}),a},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.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=_.a.ALPHA_DISABLE,e.ALPHA_ADD=_.a.ALPHA_ADD,e.ALPHA_COMBINE=_.a.ALPHA_COMBINE,e.ALPHA_SUBTRACT=_.a.ALPHA_SUBTRACT,e.ALPHA_MULTIPLY=_.a.ALPHA_MULTIPLY,e.ALPHA_MAXIMIZED=_.a.ALPHA_MAXIMIZED,e.ALPHA_ONEONE=_.a.ALPHA_ONEONE,e.ALPHA_PREMULTIPLIED=_.a.ALPHA_PREMULTIPLIED,e.ALPHA_PREMULTIPLIED_PORTERDUFF=_.a.ALPHA_PREMULTIPLIED_PORTERDUFF,e.ALPHA_INTERPOLATE=_.a.ALPHA_INTERPOLATE,e.ALPHA_SCREENMODE=_.a.ALPHA_SCREENMODE,e.DELAYLOADSTATE_NONE=_.a.DELAYLOADSTATE_NONE,e.DELAYLOADSTATE_LOADED=_.a.DELAYLOADSTATE_LOADED,e.DELAYLOADSTATE_LOADING=_.a.DELAYLOADSTATE_LOADING,e.DELAYLOADSTATE_NOTLOADED=_.a.DELAYLOADSTATE_NOTLOADED,e.NEVER=_.a.NEVER,e.ALWAYS=_.a.ALWAYS,e.LESS=_.a.LESS,e.EQUAL=_.a.EQUAL,e.LEQUAL=_.a.LEQUAL,e.GREATER=_.a.GREATER,e.GEQUAL=_.a.GEQUAL,e.NOTEQUAL=_.a.NOTEQUAL,e.KEEP=_.a.KEEP,e.REPLACE=_.a.REPLACE,e.INCR=_.a.INCR,e.DECR=_.a.DECR,e.INVERT=_.a.INVERT,e.INCR_WRAP=_.a.INCR_WRAP,e.DECR_WRAP=_.a.DECR_WRAP,e.TEXTURE_CLAMP_ADDRESSMODE=_.a.TEXTURE_CLAMP_ADDRESSMODE,e.TEXTURE_WRAP_ADDRESSMODE=_.a.TEXTURE_WRAP_ADDRESSMODE,e.TEXTURE_MIRROR_ADDRESSMODE=_.a.TEXTURE_MIRROR_ADDRESSMODE,e.TEXTUREFORMAT_ALPHA=_.a.TEXTUREFORMAT_ALPHA,e.TEXTUREFORMAT_LUMINANCE=_.a.TEXTUREFORMAT_LUMINANCE,e.TEXTUREFORMAT_LUMINANCE_ALPHA=_.a.TEXTUREFORMAT_LUMINANCE_ALPHA,e.TEXTUREFORMAT_RGB=_.a.TEXTUREFORMAT_RGB,e.TEXTUREFORMAT_RGBA=_.a.TEXTUREFORMAT_RGBA,e.TEXTUREFORMAT_RED=_.a.TEXTUREFORMAT_RED,e.TEXTUREFORMAT_R=_.a.TEXTUREFORMAT_R,e.TEXTUREFORMAT_RG=_.a.TEXTUREFORMAT_RG,e.TEXTUREFORMAT_RED_INTEGER=_.a.TEXTUREFORMAT_RED_INTEGER,e.TEXTUREFORMAT_R_INTEGER=_.a.TEXTUREFORMAT_R_INTEGER,e.TEXTUREFORMAT_RG_INTEGER=_.a.TEXTUREFORMAT_RG_INTEGER,e.TEXTUREFORMAT_RGB_INTEGER=_.a.TEXTUREFORMAT_RGB_INTEGER,e.TEXTUREFORMAT_RGBA_INTEGER=_.a.TEXTUREFORMAT_RGBA_INTEGER,e.TEXTURETYPE_UNSIGNED_BYTE=_.a.TEXTURETYPE_UNSIGNED_BYTE,e.TEXTURETYPE_UNSIGNED_INT=_.a.TEXTURETYPE_UNSIGNED_INT,e.TEXTURETYPE_FLOAT=_.a.TEXTURETYPE_FLOAT,e.TEXTURETYPE_HALF_FLOAT=_.a.TEXTURETYPE_HALF_FLOAT,e.TEXTURETYPE_BYTE=_.a.TEXTURETYPE_BYTE,e.TEXTURETYPE_SHORT=_.a.TEXTURETYPE_SHORT,e.TEXTURETYPE_UNSIGNED_SHORT=_.a.TEXTURETYPE_UNSIGNED_SHORT,e.TEXTURETYPE_INT=_.a.TEXTURETYPE_INT,e.TEXTURETYPE_UNSIGNED_INTEGER=_.a.TEXTURETYPE_UNSIGNED_INTEGER,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=_.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=_.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=_.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=_.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,e.TEXTURETYPE_UNSIGNED_INT_24_8=_.a.TEXTURETYPE_UNSIGNED_INT_24_8,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=_.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=_.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=_.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV,e.TEXTURE_NEAREST_SAMPLINGMODE=_.a.TEXTURE_NEAREST_SAMPLINGMODE,e.TEXTURE_BILINEAR_SAMPLINGMODE=_.a.TEXTURE_BILINEAR_SAMPLINGMODE,e.TEXTURE_TRILINEAR_SAMPLINGMODE=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=_.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=_.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=_.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=_.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=_.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=_.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,e.TEXTURE_NEAREST_LINEAR=_.a.TEXTURE_NEAREST_LINEAR,e.TEXTURE_NEAREST_NEAREST=_.a.TEXTURE_NEAREST_NEAREST,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=_.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=_.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,e.TEXTURE_LINEAR_LINEAR=_.a.TEXTURE_LINEAR_LINEAR,e.TEXTURE_LINEAR_NEAREST=_.a.TEXTURE_LINEAR_NEAREST,e.TEXTURE_EXPLICIT_MODE=_.a.TEXTURE_EXPLICIT_MODE,e.TEXTURE_SPHERICAL_MODE=_.a.TEXTURE_SPHERICAL_MODE,e.TEXTURE_PLANAR_MODE=_.a.TEXTURE_PLANAR_MODE,e.TEXTURE_CUBIC_MODE=_.a.TEXTURE_CUBIC_MODE,e.TEXTURE_PROJECTION_MODE=_.a.TEXTURE_PROJECTION_MODE,e.TEXTURE_SKYBOX_MODE=_.a.TEXTURE_SKYBOX_MODE,e.TEXTURE_INVCUBIC_MODE=_.a.TEXTURE_INVCUBIC_MODE,e.TEXTURE_EQUIRECTANGULAR_MODE=_.a.TEXTURE_EQUIRECTANGULAR_MODE,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=_.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=_.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,e.SCALEMODE_FLOOR=_.a.SCALEMODE_FLOOR,e.SCALEMODE_NEAREST=_.a.SCALEMODE_NEAREST,e.SCALEMODE_CEILING=_.a.SCALEMODE_CEILING,e.CollisionsEpsilon=.001,e._RescalePostProcessFactory=null,e}()},function(e,t,i){"use strict";i.d(t,"b",function(){return P}),i.d(t,"c",function(){return C}),i.d(t,"a",function(){return O});var n=i(1),r=i(8),o=i(9),s=i(32),a=i(29),c=i(0),l=i(25),u=i(4),h=i(13),d=i(57),f=i(24),p=i(49),_=i(43),g=i(20),m=i(66),v=i(55),y=i(3),b=i(2),T=i(6),E=i(22),A=i(19),x=i(14),R=i(110),P=function(){return function(){}}(),S=function(){return function(){this.visibleInstances={},this.batchCache=new C,this.instancesBufferSize=2048}}(),C=function(){return function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array}}(),M=function(){return function(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._morphTargetManager=null}}(),O=function(e){function t(i,n,r,o,c,l){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===l&&(l=!0);var u=e.call(this,i,n)||this;if(u._internalMeshDataInfo=new M,u.delayLoadState=y.a.DELAYLOADSTATE_NONE,u.instances=new Array,u._creationDataStorage=null,u._geometry=null,u._instanceDataStorage=new S,u._effectiveMaterial=null,u._shouldGenerateFlatShading=!1,u._originalBuilderSideOrientation=t.DEFAULTSIDE,u.overrideMaterialSideOrientation=null,n=u.getScene(),o){if(o._geometry&&o._geometry.applyToMesh(u),s.a.DeepCopy(o,u,["name","material","skeleton","instances","parent","uniqueId","source","metadata","hasLODLevels","geometry","isBlocked","areNormalsFrozen","onBeforeDrawObservable","onBeforeRenderObservable","onAfterRenderObservable","onBeforeDraw","onAfterWorldMatrixUpdateObservable","onCollideObservable","onCollisionPositionChangeObservable","onRebuildObservable","onDisposeObservable"],["_poseMatrix"]),u._internalMeshDataInfo._source=o,n.useClonedMeshhMap&&(o._internalMeshDataInfo.meshMap||(o._internalMeshDataInfo.meshMap={}),o._internalMeshDataInfo.meshMap[u.uniqueId]=u),u._originalBuilderSideOrientation=o._originalBuilderSideOrientation,u._creationDataStorage=o._creationDataStorage,o._ranges){var h=o._ranges;for(var i in h)h.hasOwnProperty(i)&&h[i]&&u.createAnimationRange(i,h[i].from,h[i].to)}var d;if(o.metadata&&o.metadata.clone?u.metadata=o.metadata.clone():u.metadata=o.metadata,a.a&&a.a.HasTags(o)&&a.a.AddTagsTo(u,a.a.GetTags(o,!0)),u.parent=o.parent,u.setPivotMatrix(o.getPivotMatrix()),u.id=i+"."+o.id,u.material=o.material,!c)for(var f=o.getDescendants(!0),p=0;p0},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 T.a.Warn("You cannot use a mesh as LOD level twice"),this;var i=new R.a(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;ir)return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,n._LODLevels[n._LODLevels.length-1].mesh),this;for(var o=0;o0;this.computeWorldMatrix();var s=this.material||r.defaultMaterial;if(s)if(s._storeEffectOnSubMeshes)for(var a=0,c=this.subMeshes;a0){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,s=this.subMeshes;o=n){r=!0;break}if(a.verticesStart+a.verticesCount>=t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new p.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++)p.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 h.a;r.set(t,e);var o=this.getScene();new d.a(d.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=d.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(u.b.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(u.b.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(u.b.NormalKind);if(!r)return this;h.a.ComputeNormals(i,n,r),this.updateVerticesData(u.b.NormalKind,r,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;var e=this._geometry,t=this._geometry.copy(d.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 h.a;n.indices=e;var r=this.getScene();new d.a(d.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,s=t.getRenderId(),a=i?o.intermediateDefaultRenderId:o.defaultRenderId;r.visibleInstances[e]=o[s],!r.visibleInstances[e]&&a&&(r.visibleInstances[e]=o[a])}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 s=this._instanceDataStorage,a=s.instancesBufferSize,c=s.instancesBuffer,l=16*(o.length+1)*4;s.instancesBufferSizeh&&n++,0!==_&&f++,d+=_,h=_}if(c[f]++,f>o&&(o=f),0===d)r++;else{var g=1/d,m=0;for(p=0;p.001&&s++}}var v=this.skeleton.bones.length,y=this.getVerticesData(u.b.MatricesIndicesKind),b=this.getVerticesData(u.b.MatricesIndicesExtraKind),T=0;for(l=0;l=v||E<0)&&T++}return{skinned:!0,valid:0===r&&0===s&&0===T,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+s+"\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===y.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=y.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.h.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=y.a.DELAYLOADSTATE_LOADED,e._removePendingData(t)},function(){},e.offlineProvider,i),this},t.prototype.isInFrustum=function(t){return this.delayLoadState!==y.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(u.b.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(u.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,h=l?this.getVerticesData(u.b.MatricesIndicesExtraKind):null,d=l?this.getVerticesData(u.b.MatricesWeightsExtraKind):null,f=e.getTransformMatrices(this),p=c.x.Zero(),_=new c.j,g=new c.j,m=0,v=0;v0&&(c.j.FromFloat32ArrayToRefScaled(f,Math.floor(16*o[m+a]),y,g),_.addToSelf(g));if(l)for(a=0;a<4;a++)(y=d[m+a])>0&&(c.j.FromFloat32ArrayToRefScaled(f,Math.floor(16*h[m+a]),y,g),_.addToSelf(g));c.x.TransformCoordinatesFromFloatsToRef(t._sourcePositions[v],t._sourcePositions[v+1],t._sourcePositions[v+2],_,p),p.toArray(n,v),c.x.TransformNormalFromFloatsToRef(t._sourceNormals[v],t._sourceNormals[v+1],t._sourceNormals[v+2],_,p),p.toArray(r,v),_.reset()}return this.updateVerticesData(u.b.PositionKind,n),this.updateVerticesData(u.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.x.Zero(),max:c.x.Zero()}},t.Center=function(e){var i=e instanceof Array?t.MinMax(e):e;return c.x.Center(i.min,i.max)},t.MergeMeshes=function(e,i,n,r,o,s){var a;if(void 0===i&&(i=!0),!n){var c=0;for(a=0;a65536)return T.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(s){var l,u,d=null;o=!1}var f,_=new Array,g=new Array,v=null,y=new Array,b=null;for(a=0;a0?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,s=r*o;return e*(2*s-3*o+1)+i*(-2*s+3*o)+t*(s-2*o+r)+n*(s-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 s});var n=i(0),r=i(4),o=i(19),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.x.Zero();if(this.positions){var o=n.x.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=l.numInfluencers):(t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)}return!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.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 s=0,a=!1,l=!1,u=!1,h=!1,d=!1;if(e.lightsEnabled&&!o)for(var f=0,p=t.lightSources;f0&&(h=!0,g.prepareDefines(i,s))}}if(_.lightmapMode!=c.a.LIGHTMAP_DEFAULT?(u=!0,i["LIGHTMAPEXCLUDED"+s]=!0,i["LIGHTMAPNOSPECULAR"+s]=_.lightmapMode==c.a.LIGHTMAP_SHADOWSONLY):(i["LIGHTMAPEXCLUDED"+s]=!1,i["LIGHTMAPNOSPECULAR"+s]=!1),++s===r)break}i.SPECULARTERM=d,i.SHADOWS=h;for(var v=s;v0&&(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.PrepareAttributesForMorphTargets=function(e,t,i){var r=i.NUM_MORPH_INFLUENCERS;if(r>0&&s.a.LastCreatedEngine)for(var o=s.a.LastCreatedEngine.getCaps().maxVertexAttribs,c=t.morphTargetManager,l=c&&c.supportsNormals&&i.NORMAL,u=c&&c.supportsTangents&&i.TANGENT,h=0;ho&&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&&(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.BindLights=function(t,i,n,r,s,a){void 0===s&&(s=4),void 0===a&&(a=!1);for(var c=Math.min(i.lightSources.length,s),l=0;l-1){var n=i.getTransformMatrixTexture();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._tempFogColor=o.e.Black(),e}()},function(e,t,i){"use strict";var n=i(1),r=i(9),o=i(47),s=i(8),a=i(28),c=i(61),l=i(29),u=i(0),h=i(42),d=i(24),f=i(21),p=i(30),_=i(31),g=i(63),m=i(38),v=i(50),y=i(36),b=i(83),T=i(91),E=i(14),A=i(3),x=i(35),R=i(6),P=i(23),S=i(19),C=i(17),M=i(79),O=i(51),I=function(){function e(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}return Object.defineProperty(e.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!0,configurable:!0}),e}(),D=function(){function e(e){this._wheelEventName="",this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._totalPointersPressed=0,this._doubleClickOccured=!1,this._pointerX=0,this._pointerY=0,this._startingPointerPosition=new u.w(0,0),this._previousStartingPointerPosition=new u.w(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._scene=e}return Object.defineProperty(e.prototype,"meshUnderPointer",{get:function(){return this._pointerOverMesh},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"unTranslatedPointer",{get:function(){return new u.w(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pointerX",{get:function(){return this._pointerX},set:function(e){this._pointerX=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pointerY",{get:function(){return this._pointerY},set:function(e){this._pointerY=e},enumerable:!0,configurable:!0}),e.prototype._updatePointerPosition=function(e){var t=this._scene.getEngine().getRenderingCanvasClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},e.prototype._processPointerMove=function(e,t){var i=this._scene,n=i.getEngine().getRenderingCanvas();if(n){n.tabIndex=1,n.style.cursor=i.defaultCursor;var r=!!(e&&e.hit&&e.pickedMesh);r?(i.setPointerOverMesh(e.pickedMesh),this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.hasPointerTriggers&&(this._pointerOverMesh.actionManager.hoverCursor?n.style.cursor=this._pointerOverMesh.actionManager.hoverCursor:n.style.cursor=i.hoverCursor)):i.setPointerOverMesh(null);for(var o=0,s=i._pointerMoveStage;oe.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(A.a.ACTION_OnLongPressTrigger,y.a.CreateNew(t.pickedMesh,i)))},e.LongPressDelay)}}else for(var s=0,a=r._pointerDownStage;se.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 s=e.pickedMesh._getActionManagerForTrigger();if(s&&!i.ignore){s.processTrigger(A.a.ACTION_OnPickUpTrigger,y.a.CreateNew(e.pickedMesh,t)),!i.hasSwiped&&i.singleClick&&s.processTrigger(A.a.ACTION_OnPickTrigger,y.a.CreateNew(e.pickedMesh,t));var a=e.pickedMesh._getActionManagerForTrigger(A.a.ACTION_OnDoublePickTrigger);i.doubleClick&&a&&a.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 s=new I;o._currentPickResult=null;var a=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&&(a=o._initActionManager(a,s))&&(c=a.hasPickTriggers);var l=!1;if(c){var u=n.button;if(s.hasSwiped=o._isPointerSwiping(),!s.hasSwiped){var h=!e.ExclusiveDoubleClickMode;h||(h=!t.hasSpecificMask(C.a.POINTERDOUBLETAP)&&!i.hasSpecificMask(C.a.POINTERDOUBLETAP))&&!M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(a=o._initActionManager(a,s))&&(h=!a.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),h?(Date.now()-o._previousStartingPointerTime>e.DoubleClickDelay||u!==o._previousButtonPressed)&&(s.singleClick=!0,r(s,o._currentPickResult),l=!0):(o._previousDelayedSimpleClickTimeout=o._delayedSimpleClickTimeout,o._delayedSimpleClickTimeout=window.setTimeout(o._delayedSimpleClick.bind(o,u,s,r),e.DoubleClickDelay));var d=t.hasSpecificMask(C.a.POINTERDOUBLETAP)||i.hasSpecificMask(C.a.POINTERDOUBLETAP);!d&&M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(a=o._initActionManager(a,s))&&(d=a.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 s=0,a=this.activeCameras;s0},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;if(this._registerTransientComponents(),this.isReady())return this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1);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?u.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=u.i.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(){var e=t._uniqueIdCounter;return t._uniqueIdCounter++,e},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.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!=(s.layerMask&this.activeCamera.layerMask)&&(s.alwaysSelectAsActiveMesh||s.isInFrustum(this._frustumPlanes))&&(this._activeMeshes.push(s),this.activeCamera._activeMeshes.push(s),a!==s&&a._activate(this._renderId,!1),s._activate(this._renderId,!1)&&(s.isAnInstance||(a._internalAbstractMeshDataInfo._onlyForInstances=!1),a._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(s,a)),s._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,s=0;s1)this.activeCamera.outputRenderTarget._bindFrameBuffer();else{var e=this.activeCamera.outputRenderTarget.getInternalTexture();e?this.getEngine().bindFramebuffer(e):R.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 s=0,a=this._gatherActiveCameraRenderTargetsStage;s0){r.h.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)this._renderForCamera(e);else{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(a,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 m=0,v=this._afterRenderStage;m-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.j.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.j.PerspectiveFovRHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED):c.j.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.j.OrthoOffCenterRHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-o,this.orthoTop||o,this.minZ,this.maxZ,this._projectionMatrix):c.j.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?c.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=c.i.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 s=this._postProcesses[o];s&&s.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=s.h.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.j.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.j.Identity()},t.prototype._getWebVRViewMatrix=function(){return c.j.Identity()},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=s.h.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;ea.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.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,a=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=s.t.Vector3[0],d=s.t.Matrix[0],f=s.t.Matrix[1],p=0,_=0;_0&&(s.j.FromFloat32ArrayToRefScaled(u,Math.floor(16*i[p+g]),m,f),d.addToSelf(f));if(o)for(g=0;g<4;g++)(m=l[p+g])>0&&(s.j.FromFloat32ArrayToRefScaled(u,Math.floor(16*a[p+g]),m,f),d.addToSelf(f));s.x.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=s.t.Matrix[0],i=s.t.Matrix[1];return s.j.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 a=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||!a||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:s.x.Zero()}e.depthSortedFacets=[];for(var h=0;hs.h?r.maximum.x-r.minimum.x:s.h,e.bbSize.y=r.maximum.y-r.minimum.y>s.h?r.maximum.y-r.minimum.y:s.h,e.bbSize.z=r.maximum.z-r.minimum.z>s.h?r.maximum.z-r.minimum.z:s.h;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),s.x.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||s<0||s>r.subDiv.max||a<0||a>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*s+r.subDiv.max*r.subDiv.max*a]},t.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),c=s.t.Matrix[5];a.invertToRef(c);var l=s.t.Vector3[8];s.x.TransformCoordinatesFromFloatsToRef(e,t,i,c,l);var u=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,n,r,o);return n&&s.x.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),u},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var s=null,a=0,c=0,l=0,u=0,h=0,d=0,f=0,p=0,_=this.getFacetLocalPositions(),g=this.getFacetLocalNormals(),m=this.getFacetsAtLocalCoordinates(e,t,i);if(!m)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=(a=(d=e+y.x*h)-e)*a+(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.q.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new o.q),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 s.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.x.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.x.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.q.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.q),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,s){var a=e._tmpVecs[0],c=this.object;if(c.rotationQuaternion)if(s){var l=e._tmpQuat;c.rotationQuaternion.multiplyToRef(s,l),t.setRotationQuaternion(l,o.s.WORLD,i)}else t.setRotationQuaternion(c.rotationQuaternion,o.s.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(c.getAbsolutePosition()),t.setAbsolutePosition(a,i)):(i.setAbsolutePosition(c.getAbsolutePosition()),i.position.x-=a.x,i.position.y-=a.y,i.position.z-=a.z)},e.prototype.syncImpostorWithBone=function(t,i,n,r,s,a){var c=this.object;if(c.rotationQuaternion)if(s){var l=e._tmpQuat;t.getRotationQuaternionToRef(o.s.WORLD,i,l),l.multiplyToRef(s,c.rotationQuaternion)}else t.getRotationQuaternionToRef(o.s.WORLD,i,c.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),c.setAbsolutePosition(u)},e.DEFAULT_OBJECT_SIZE=new o.x(1,1,1),e.IDENTITY_QUATERNION=o.q.Identity(),e._tmpVecs=r.a.BuildArray(3,o.x.Zero),e._tmpQuat=o.q.Identity(),e.NoImpostor=0,e.SphereImpostor=1,e.BoxImpostor=2,e.PlaneImpostor=3,e.MeshImpostor=4,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";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 s[0])for(var c=0;c0,o.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,o.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===p.a.INVCUBIC_MODE,o.REFLECTIONMAP_3D=this._reflectionTexture.isCube,this._reflectionTexture.coordinatesMode){case p.a.EXPLICIT_MODE:o.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case p.a.PLANAR_MODE:o.setReflectionMode("REFLECTIONMAP_PLANAR");break;case p.a.PROJECTION_MODE:o.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case p.a.SKYBOX_MODE:o.setReflectionMode("REFLECTIONMAP_SKYBOX"),o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!this._reflectionTexture.getReflectionTextureMatrix().isIdentity();break;case p.a.SPHERICAL_MODE:o.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case p.a.EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case p.a.FIXED_EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case p.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case p.a.CUBIC_MODE:case p.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;f.a.PrepareDefinesForMergedUV(this._emissiveTexture,o,"EMISSIVE")}else o.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;f.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;f.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;f.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===A.a.ALPHA_PREMULTIPLIED||this.alphaMode===A.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),f.a.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),f.a.PrepareDefinesForAttributes(e,o,!0,!0,!0),f.a.PrepareDefinesForFrameBoundValues(r,s,o,n),o.isDirty){o.markAsProcessed();var a=new u.c;o.REFLECTION&&a.addFallback(0,"REFLECTION"),o.SPECULAR&&a.addFallback(0,"SPECULAR"),o.BUMP&&a.addFallback(0,"BUMP"),o.PARALLAX&&a.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&a.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&a.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&a.addFallback(1,"FOG"),o.POINTSIZE&&a.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&a.addFallback(0,"LOGARITHMICDEPTH"),f.a.HandleFallbacksForShadows(o,a,this._maxSimultaneousLights),o.SPECULARTERM&&a.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&a.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&a.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&a.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&a.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&a.addFallback(4,"FRESNEL"),o.MULTIVIEW&&a.addFallback(0,"MULTIVIEW");var h=[c.b.PositionKind];o.NORMAL&&h.push(c.b.NormalKind),o.UV1&&h.push(c.b.UVKind),o.UV2&&h.push(c.b.UV2Kind),o.VERTEXCOLOR&&h.push(c.b.ColorKind),f.a.PrepareAttributesForBones(h,e,o,a),f.a.PrepareAttributesForInstances(h,o),f.a.PrepareAttributesForMorphTargets(h,e,o);var d="default",_=["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"],m=["Material","Scene"];l.a&&(l.a.PrepareUniforms(_,o),l.a.PrepareSamplers(g,o)),f.a.PrepareUniformsAndSamplersList({uniformsNames:_,uniformBuffersNames:m,samplers:g,defines:o,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(d=this.customShaderNameResolve(d,_,m,g,o));var v=o.toString(),y=i.effect,b=r.getEngine().createEffect(d,{attributes:h,uniformsNames:_,uniformBuffersNames:m,samplers:g,defines:v,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS}},s);b&&(this.allowShaderHotSwapping&&y&&!b.isReady()?(b=y,o.markAsUnprocessed()):(r.resetCachedMaterial(),i.setEffect(b,o),this.buildUniformLayout()))}return!(!i.effect||!i.effect.isReady())&&(o._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vDiffuseColor",4),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var c=n.effect;if(c){this._activeEffect=c,o.INSTANCES||this.bindOnlyWorldMatrix(e),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var l=this._mustRebind(r,c,i.visibility);f.a.BindBonesParameters(i,c);var u=this._uniformBuffer;if(l){if(u.bindToEffect(c,"Material"),this.bindViewProjection(c),!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 a.e(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),f.a.BindTextureMatrix(this._diffuseTexture,u,"diffuse"),this._diffuseTexture.hasAlpha&&c.setFloat("alphaCutOff",this.alphaCutOff)),this._ambientTexture&&t.AmbientTextureEnabled&&(u.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),f.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&t.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),f.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),f.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&t.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),f.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),this._specularTexture&&t.SpecularTextureEnabled&&(u.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),f.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),f.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:a.e.BlackReadOnly),u.updateFloat("visibility",i.visibility),u.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha)}if(r.texturesEnabled&&(this._diffuseTexture&&t.DiffuseTextureEnabled&&c.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&t.AmbientTextureEnabled&&c.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&t.OpacityTextureEnabled&&c.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&t.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?c.setTexture("reflectionCubeSampler",this._reflectionTexture):c.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&t.EmissiveTextureEnabled&&c.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&t.LightmapTextureEnabled&&c.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&t.SpecularTextureEnabled&&c.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&c.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&t.RefractionTextureEnabled)){d=1;this._refractionTexture.isCube?c.setTexture("refractionCubeSampler",this._refractionTexture):c.setTexture("refraction2DSampler",this._refractionTexture)}f.a.BindClipPlane(c,r),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),f.a.BindEyePosition(c,r),c.setColor3("vAmbientColor",this._globalAmbientColor)}!l&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&f.a.BindLights(r,i,c,o,this._maxSimultaneousLights),(r.fogEnabled&&i.applyFog&&r.fogMode!==s.a.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(c),f.a.BindFogParameters(r,i,c),o.NUM_MORPH_INFLUENCERS&&f.a.BindMorphTargetParameters(i,c),f.a.BindLogDepth(o,c,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}(d.a);_.a.RegisteredTypes["BABYLON.StandardMaterial"]=R,s.a.DefaultMaterialFactory=function(e){return new R("default material",e)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.BuildArray=function(e,t){for(var i=[],n=0;n0&&-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;al.x)return!1}else if(r=1/this.direction.x,o=(c.x-this.origin.x)*r,(s=(l.x-this.origin.x)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(u=Math.max(o,u))>(h=Math.min(s,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,(s=(l.y-this.origin.y)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(u=Math.max(o,u))>(h=Math.min(s,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,(s=(l.z-this.origin.z)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(u=Math.max(o,u))>(h=Math.min(s,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,s=e.radius+t,a=s*s;if(o<=a)return!0;var c=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(c<0)&&o-c*c<=a},e.prototype.intersectsTriangle=function(t,i,n){var o=e.TmpVector3[0],a=e.TmpVector3[1],c=e.TmpVector3[2],l=e.TmpVector3[3],u=e.TmpVector3[4];i.subtractToRef(t,o),n.subtractToRef(t,a),r.x.CrossToRef(this.direction,a,c);var h=r.x.Dot(o,c);if(0===h)return null;var d=1/h;this.origin.subtractToRef(t,l);var f=r.x.Dot(l,c)*d;if(f<0||f>1)return null;r.x.CrossToRef(l,o,u);var p=r.x.Dot(this.direction,u)*d;if(p<0||f+p>1)return null;var _=r.x.Dot(a,u)*d;return _>this.length?null:new s.a(f,p,_)},e.prototype.intersectsPlane=function(e){var t,i=r.x.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=r.x.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsMesh=function(t,i){var n=r.t.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,s=r.t.Vector3[0],a=r.t.Vector3[1],c=r.t.Vector3[2],l=r.t.Vector3[3];i.subtractToRef(t,s),this.direction.scaleToRef(e.rayl,c),o.addToRef(c,a),t.subtractToRef(o,l);var u,h,d,f,p=r.x.Dot(s,s),_=r.x.Dot(s,c),g=r.x.Dot(c,c),m=r.x.Dot(s,l),v=r.x.Dot(c,l),y=p*g-_*_,b=y,T=y;yb&&(h=b,f=v+_,T=g)),f<0?(f=0,-m<0?h=0:-m>p?h=b:(h=-m,b=p)):f>T&&(f=T,-m+_<0?h=0:-m+_>p?h=b:(h=-m+_,b=p)),u=Math.abs(h)0&&d<=this.length&&x.lengthSquared()=r.distance))&&(r=l,i)))break}return r||new o.a},a.a.prototype._internalMultiPick=function(e,t,i){if(!o.a)return null;for(var n=new Array,r=0;r0&&(t.push(a-1),t.push(a)),a++}var d=new o.a;return d.indices=t,d.positions=i,r&&(d.colors=s),d},o.a.CreateDashedLines=function(e){var t,i,r=e.dashSize||3,s=e.gapSize||1,a=e.dashNb||200,c=e.points,l=new Array,u=new Array,h=n.x.Zero(),d=0,f=0,p=0,_=0,g=0;for(g=0;g0)):!i._pointerCaptures[c.pointerId]&&s.distance>a.distance&&(i.mainSceneTrackerPredicate&&i.mainSceneTrackerPredicate(a.pickedMesh)?(i._notifyObservers(t,a,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.onAfterRenderObservable.add(function(){i.shouldRender&&i.render()}),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add(function(){i.dispose()}),this._updateCamera()}return e.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new a.a("shared gizmo light",new c.x(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=c.e.Gray()),this._sharedGizmoLight},Object.defineProperty(e,"DefaultUtilityLayer",{get:function(){return null==e._DefaultUtilityLayer&&(e._DefaultUtilityLayer=new e(s.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(s.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.onAfterRenderObservable.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.originalScene.activeCameras.length>1?this.utilityLayerScene.activeCamera=this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.utilityLayerScene.activeCamera=this.originalScene.activeCamera},e._DefaultUtilityLayer=null,e._DefaultKeepDepthUtilityLayer=null,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),r=i(2),o=i(8),s=i(0),a=function(e){function t(i,n,r){void 0===n&&(n=null),void 0===r&&(r=!0);var a=e.call(this,i,n)||this;return a._forward=new s.x(0,0,1),a._forwardInverted=new s.x(0,0,-1),a._up=new s.x(0,1,0),a._right=new s.x(1,0,0),a._rightInverted=new s.x(-1,0,0),a._position=s.x.Zero(),a._rotation=s.x.Zero(),a._rotationQuaternion=null,a._scaling=s.x.One(),a._isDirty=!1,a._transformToBoneReferal=null,a._billboardMode=t.BILLBOARDMODE_NONE,a._preserveParentRotationForBillboard=!1,a.scalingDeterminant=1,a._infiniteDistance=!1,a.ignoreNonUniformScaling=!1,a.reIntegrateRotationIntoRotationQuaternion=!1,a._poseMatrix=null,a._localMatrix=s.j.Zero(),a._usePivotMatrix=!1,a._absolutePosition=s.x.Zero(),a._pivotMatrix=s.j.Identity(),a._postMultiplyPivotMatrix=!1,a._isWorldMatrixFrozen=!1,a._indexInSceneTransformNodesArray=-1,a.onAfterWorldMatrixUpdateObservable=new o.c,a._nonUniformScaling=!1,r&&a.getScene().addTransformNode(a),a}return n.d(t,e),Object.defineProperty(t.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"preserveParentRotationForBillboard",{get:function(){return this._preserveParentRotationForBillboard},set:function(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"infiniteDistance",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"forward",{get:function(){return s.x.Normalize(s.x.TransformNormal(this.getScene().useRightHandedSystem?this._forwardInverted:this._forward,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return s.x.Normalize(s.x.TransformNormal(this._up,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return s.x.Normalize(s.x.TransformNormal(this.getScene().useRightHandedSystem?this._rightInverted:this._right,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),t.prototype.updatePoseMatrix=function(e){return this._poseMatrix?(this._poseMatrix.copyFrom(e),this):(this._poseMatrix=e.clone(),this)},t.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=s.j.Identity()),this._poseMatrix},t.prototype._isSynchronized=function(){var e=this._cache;if(this.billboardMode!==e.billboardMode||this.billboardMode!==t.BILLBOARDMODE_NONE)return!1;if(e.pivotMatrixUpdated)return!1;if(this.infiniteDistance)return!1;if(!e.position.equals(this._position))return!1;if(this._rotationQuaternion){if(!e.rotationQuaternion.equals(this._rotationQuaternion))return!1}else if(!e.rotation.equals(this._rotation))return!1;return!!e.scaling.equals(this._scaling)},t.prototype._initCache=function(){e.prototype._initCache.call(this);var t=this._cache;t.localMatrixUpdated=!1,t.position=s.x.Zero(),t.scaling=s.x.Zero(),t.rotation=s.x.Zero(),t.rotationQuaternion=new s.q(0,0,0,0),t.billboardMode=-1,t.infiniteDistance=!1},t.prototype.markAsDirty=function(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Object.defineProperty(t.prototype,"absolutePosition",{get:function(){return this._absolutePosition},enumerable:!0,configurable:!0}),t.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},t.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=s.j.Invert(this._pivotMatrix)),this},t.prototype.getPivotMatrix=function(){return this._pivotMatrix},t.prototype.freezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this._isWorldMatrixFrozen=!0,this},t.prototype.unfreezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this},Object.defineProperty(t.prototype,"isWorldMatrixFrozen",{get:function(){return this._isWorldMatrixFrozen},enumerable:!0,configurable:!0}),t.prototype.getAbsolutePosition=function(){return this.computeWorldMatrix(),this._absolutePosition},t.prototype.setAbsolutePosition=function(e){if(!e)return this;var t,i,n;if(void 0===e.x){if(arguments.length<3)return this;t=arguments[0],i=arguments[1],n=arguments[2]}else t=e.x,i=e.y,n=e.z;if(this.parent){var r=s.t.Matrix[0];this.parent.getWorldMatrix().invertToRef(r),s.x.TransformCoordinatesFromFloatsToRef(t,i,n,r,this.position)}else this.position.x=t,this.position.y=i,this.position.z=n;return this},t.prototype.setPositionWithLocalVector=function(e){return this.computeWorldMatrix(),this.position=s.x.TransformNormal(e,this._localMatrix),this},t.prototype.getPositionExpressedInLocalSpace=function(){this.computeWorldMatrix();var e=s.t.Matrix[0];return this._localMatrix.invertToRef(e),s.x.TransformNormal(this.position,e)},t.prototype.locallyTranslate=function(e){return this.computeWorldMatrix(!0),this.position=s.x.TransformCoordinates(e,this._localMatrix),this},t.prototype.lookAt=function(e,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=s.s.LOCAL);var a=t._lookAtVectorCache,c=o===s.s.LOCAL?this.position:this.getAbsolutePosition();if(e.subtractToRef(c,a),this.setDirection(a,i,n,r),o===s.s.WORLD&&this.parent)if(this.rotationQuaternion){var l=s.t.Matrix[0];this.rotationQuaternion.toRotationMatrix(l);var u=s.t.Matrix[1];this.parent.getWorldMatrix().getRotationMatrixToRef(u),u.invert(),l.multiplyToRef(u,l),this.rotationQuaternion.fromRotationMatrix(l)}else{var h=s.t.Quaternion[0];s.q.FromEulerVectorToRef(this.rotation,h);l=s.t.Matrix[0];h.toRotationMatrix(l);u=s.t.Matrix[1];this.parent.getWorldMatrix().getRotationMatrixToRef(u),u.invert(),l.multiplyToRef(u,l),h.fromRotationMatrix(l),h.toEulerAnglesToRef(this.rotation)}return this},t.prototype.getDirection=function(e){var t=s.x.Zero();return this.getDirectionToRef(e,t),t},t.prototype.getDirectionToRef=function(e,t){return s.x.TransformNormalToRef(e,this.getWorldMatrix(),t),this},t.prototype.setDirection=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=-Math.atan2(e.z,e.x)+Math.PI/2,o=Math.sqrt(e.x*e.x+e.z*e.z),a=-Math.atan2(e.y,o);return this.rotationQuaternion?s.q.RotationYawPitchRollToRef(r+t,a+i,n,this.rotationQuaternion):(this.rotation.x=a+i,this.rotation.y=r+t,this.rotation.z=n),this},t.prototype.setPivotPoint=function(e,t){void 0===t&&(t=s.s.LOCAL),0==this.getScene().getRenderId()&&this.computeWorldMatrix(!0);var i=this.getWorldMatrix();if(t==s.s.WORLD){var n=s.t.Matrix[0];i.invertToRef(n),e=s.x.TransformCoordinates(e,n)}return this.setPivotMatrix(s.j.Translation(-e.x,-e.y,-e.z),!0)},t.prototype.getPivotPoint=function(){var e=s.x.Zero();return this.getPivotPointToRef(e),e},t.prototype.getPivotPointToRef=function(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this},t.prototype.getAbsolutePivotPoint=function(){var e=s.x.Zero();return this.getAbsolutePivotPointToRef(e),e},t.prototype.getAbsolutePivotPointToRef=function(e){return e.x=this._pivotMatrix.m[12],e.y=this._pivotMatrix.m[13],e.z=this._pivotMatrix.m[14],this.getPivotPointToRef(e),s.x.TransformCoordinatesToRef(e,this.getWorldMatrix(),e),this},t.prototype.setParent=function(e){if(!e&&!this.parent)return this;var t=s.t.Quaternion[0],i=s.t.Vector3[0],n=s.t.Vector3[1];if(e){var r=s.t.Matrix[0],o=s.t.Matrix[1];this.computeWorldMatrix(!0),e.computeWorldMatrix(!0),e.getWorldMatrix().invertToRef(o),this.getWorldMatrix().multiplyToRef(o,r),r.decompose(n,t,i)}else this.parent&&this.parent.computeWorldMatrix&&this.parent.computeWorldMatrix(!0),this.computeWorldMatrix(!0),this.getWorldMatrix().decompose(n,t,i);return this.rotationQuaternion?this.rotationQuaternion.copyFrom(t):t.toEulerAnglesToRef(this.rotation),this.scaling.copyFrom(n),this.position.copyFrom(i),this.parent=e,this},Object.defineProperty(t.prototype,"nonUniformScaling",{get:function(){return this._nonUniformScaling},enumerable:!0,configurable:!0}),t.prototype._updateNonUniformScalingState=function(e){return this._nonUniformScaling!==e&&(this._nonUniformScaling=e,!0)},t.prototype.attachToBone=function(e,t){return this._transformToBoneReferal=t,this.parent=e,e.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this},t.prototype.detachFromBone=function(){return this.parent?(this.parent.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,this.parent=null,this):this},t.prototype.rotate=function(e,i,n){var r;if(e.normalize(),this.rotationQuaternion||(this.rotationQuaternion=this.rotation.toQuaternion(),this.rotation.setAll(0)),n&&n!==s.s.LOCAL){if(this.parent){var o=s.t.Matrix[0];this.parent.getWorldMatrix().invertToRef(o),e=s.x.TransformNormal(e,o)}(r=s.q.RotationAxisToRef(e,i,t._rotationAxisCache)).multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)}else r=s.q.RotationAxisToRef(e,i,t._rotationAxisCache),this.rotationQuaternion.multiplyToRef(r,this.rotationQuaternion);return this},t.prototype.rotateAround=function(e,t,i){t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=s.q.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.setAll(0));var n=s.t.Vector3[0],r=s.t.Vector3[1],o=s.t.Vector3[2],a=s.t.Quaternion[0],c=s.t.Matrix[0],l=s.t.Matrix[1],u=s.t.Matrix[2],h=s.t.Matrix[3];return e.subtractToRef(this.position,n),s.j.TranslationToRef(n.x,n.y,n.z,c),s.j.TranslationToRef(-n.x,-n.y,-n.z,l),s.j.RotationAxisToRef(t,i,u),l.multiplyToRef(u,h),h.multiplyToRef(c,h),h.decompose(r,a,o),this.position.addInPlace(o),a.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this},t.prototype.translate=function(e,t,i){var n=e.scale(t);if(i&&i!==s.s.LOCAL)this.setAbsolutePosition(this.getAbsolutePosition().add(n));else{var r=this.getPositionExpressedInLocalSpace().add(n);this.setPositionWithLocalVector(r)}return this},t.prototype.addRotation=function(e,t,i){var n;this.rotationQuaternion?n=this.rotationQuaternion:(n=s.t.Quaternion[1],s.q.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,n));var r=s.t.Quaternion[0];return s.q.RotationYawPitchRollToRef(t,e,i,r),n.multiplyInPlace(r),this.rotationQuaternion||n.toEulerAnglesToRef(this.rotation),this},t.prototype._getEffectiveParent=function(){return this.parent},t.prototype.computeWorldMatrix=function(e){if(this._isWorldMatrixFrozen&&!this._isDirty)return this._worldMatrix;var i=this.getScene().getRenderId();if(!this._isDirty&&!e&&this.isSynchronized())return this._currentRenderId=i,this._worldMatrix;this._updateCache();var n=this._cache;n.pivotMatrixUpdated=!1,n.billboardMode=this.billboardMode,n.infiniteDistance=this.infiniteDistance,this._currentRenderId=i,this._childUpdateId++,this._isDirty=!1;var r=this._getEffectiveParent(),o=this._billboardMode!==t.BILLBOARDMODE_NONE&&!this.preserveParentRotationForBillboard,a=this.getScene().activeCamera,c=n.scaling,l=n.position;if(this._infiniteDistance)if(!this.parent&&a){var u=a.getWorldMatrix(),h=new s.x(u.m[12],u.m[13],u.m[14]);l.copyFromFloats(this._position.x+h.x,this._position.y+h.y,this._position.z+h.z)}else l.copyFrom(this._position);else l.copyFrom(this._position);c.copyFromFloats(this._scaling.x*this.scalingDeterminant,this._scaling.y*this.scalingDeterminant,this._scaling.z*this.scalingDeterminant);var d=n.rotationQuaternion;if(this._rotationQuaternion){if(this.reIntegrateRotationIntoRotationQuaternion)this.rotation.lengthSquared()&&(this._rotationQuaternion.multiplyInPlace(s.q.RotationYawPitchRoll(this._rotation.y,this._rotation.x,this._rotation.z)),this._rotation.copyFromFloats(0,0,0));d.copyFrom(this._rotationQuaternion)}else s.q.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,d),n.rotation.copyFrom(this._rotation);if(this._usePivotMatrix){var f=s.t.Matrix[1];s.j.ScalingToRef(c.x,c.y,c.z,f);var p=s.t.Matrix[0];d.toRotationMatrix(p),this._pivotMatrix.multiplyToRef(f,s.t.Matrix[4]),s.t.Matrix[4].multiplyToRef(p,this._localMatrix),this._postMultiplyPivotMatrix&&this._localMatrix.multiplyToRef(this._pivotMatrixInverse,this._localMatrix),this._localMatrix.addTranslationFromFloats(l.x,l.y,l.z)}else s.j.ComposeToRef(c,d,l,this._localMatrix);if(r&&r.getWorldMatrix){if(o){this._transformToBoneReferal?r.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),s.t.Matrix[7]):s.t.Matrix[7].copyFrom(r.getWorldMatrix());var _=s.t.Vector3[5],g=s.t.Vector3[6];s.t.Matrix[7].decompose(g,void 0,_),s.j.ScalingToRef(g.x,g.y,g.z,s.t.Matrix[7]),s.t.Matrix[7].setTranslation(_),this._localMatrix.multiplyToRef(s.t.Matrix[7],this._worldMatrix)}else this._transformToBoneReferal?(this._localMatrix.multiplyToRef(r.getWorldMatrix(),s.t.Matrix[6]),s.t.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)):this._localMatrix.multiplyToRef(r.getWorldMatrix(),this._worldMatrix);this._markSyncedWithParent()}else this._worldMatrix.copyFrom(this._localMatrix);if(o&&a){var m=s.t.Vector3[0];if(this._worldMatrix.getTranslationToRef(m),s.t.Matrix[1].copyFrom(a.getViewMatrix()),s.t.Matrix[1].setTranslationFromFloats(0,0,0),s.t.Matrix[1].invertToRef(s.t.Matrix[0]),(this.billboardMode&t.BILLBOARDMODE_ALL)!==t.BILLBOARDMODE_ALL){s.t.Matrix[0].decompose(void 0,s.t.Quaternion[0],void 0);var v=s.t.Vector3[1];s.t.Quaternion[0].toEulerAnglesToRef(v),(this.billboardMode&t.BILLBOARDMODE_X)!==t.BILLBOARDMODE_X&&(v.x=0),(this.billboardMode&t.BILLBOARDMODE_Y)!==t.BILLBOARDMODE_Y&&(v.y=0),(this.billboardMode&t.BILLBOARDMODE_Z)!==t.BILLBOARDMODE_Z&&(v.z=0),s.j.RotationYawPitchRollToRef(v.y,v.x,v.z,s.t.Matrix[0])}this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(s.t.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(s.t.Vector3[0])}return this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this._scaling.isNonUniform?this._updateNonUniformScalingState(!0):r&&r._nonUniformScaling?this._updateNonUniformScalingState(r._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=s.j.Invert(this._worldMatrix)),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix},t.prototype._afterComputeWorldMatrix=function(){},t.prototype.registerAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.add(e),this},t.prototype.unregisterAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.removeCallback(e),this},t.prototype.getPositionInCameraSpace=function(e){return void 0===e&&(e=null),e||(e=this.getScene().activeCamera),s.x.TransformCoordinates(this.absolutePosition,e.getViewMatrix())},t.prototype.getDistanceToCamera=function(e){return void 0===e&&(e=null),e||(e=this.getScene().activeCamera),this.absolutePosition.subtract(e.globalPosition).length()},t.prototype.clone=function(e,i,n){var o=this,s=r.a.Clone(function(){return new t(e,o.getScene())},this);if(s.name=e,s.id=e,i&&(s.parent=i),!n)for(var a=this.getDescendants(!0),c=0;cl.max||l.min>c.max)},d=function(){function e(e,t,i){this._isLocked=!1,this.boundingBox=new s.a(e,t,i),this.boundingSphere=new a.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(!a.a.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!s.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.x.Cross(i.directions[0],n.directions[0]),i,n)&&(!!h(r.x.Cross(i.directions[0],n.directions[1]),i,n)&&(!!h(r.x.Cross(i.directions[0],n.directions[2]),i,n)&&(!!h(r.x.Cross(i.directions[1],n.directions[0]),i,n)&&(!!h(r.x.Cross(i.directions[1],n.directions[1]),i,n)&&(!!h(r.x.Cross(i.directions[1],n.directions[2]),i,n)&&(!!h(r.x.Cross(i.directions[2],n.directions[0]),i,n)&&(!!h(r.x.Cross(i.directions[2],n.directions[1]),i,n)&&!!h(r.x.Cross(i.directions[2],n.directions[2]),i,n))))))))))))))},e.TmpVector3=n.a.BuildArray(2,r.x.Zero),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return h});var n=i(1),r=i(2),o=i(8),s=i(9),a=i(71),c=i(0),l=i(23),u=i(3),h=function(){function e(t){this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this.getAlphaFromRGB=!1,this.level=1,this.coordinatesIndex=0,this._coordinatesMode=u.a.TEXTURE_EXPLICIT_MODE,this.wrapU=u.a.TEXTURE_WRAP_ADDRESSMODE,this.wrapV=u.a.TEXTURE_WRAP_ADDRESSMODE,this.wrapR=u.a.TEXTURE_WRAP_ADDRESSMODE,this.anisotropicFilteringLevel=e.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this.gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this.isRenderTarget=!1,this.animations=new Array,this.onDisposeObservable=new o.c,this._onDisposeObserver=null,this.delayLoadState=u.a.DELAYLOADSTATE_NONE,this._scene=null,this._texture=null,this._uid=null,this._cachedSize=c.r.Zero(),this._scene=t||l.a.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this)),this._uid=null}return Object.defineProperty(e.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(u.a.MATERIAL_TextureDirtyFlag|u.a.MATERIAL_MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(u.a.MATERIAL_TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isCube",{get:function(){return!!this._texture&&this._texture.isCube},set:function(e){this._texture&&(this._texture.isCube=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"noMipmap",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this._uid||(this._uid=s.h.RandomId()),this._uid},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.name},e.prototype.getClassName=function(){return"BaseTexture"},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,"isBlocking",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getTextureMatrix=function(){return c.j.IdentityReadOnly},e.prototype.getReflectionTextureMatrix=function(){return c.j.IdentityReadOnly},e.prototype.getInternalTexture=function(){return this._texture},e.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()},e.prototype.isReady=function(){return this.delayLoadState===u.a.DELAYLOADSTATE_NOTLOADED?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady},e.prototype.getSize=function(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;if(this._texture._size)return this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size,this._cachedSize}return this._cachedSize},e.prototype.getBaseSize=function(){return this.isReady()&&this._texture?this._texture._size?new c.r(this._texture._size,this._texture._size):new c.r(this._texture.baseWidth,this._texture.baseHeight):c.r.Zero()},e.prototype.updateSamplingMode=function(e){if(this._texture){var t=this.getScene();t&&t.getEngine().updateTextureSamplingMode(e,this._texture)}},e.prototype.scale=function(e){},Object.defineProperty(e.prototype,"canRescale",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype._getFromCache=function(e,t,i,n){if(!this._scene)return null;for(var r=this._scene.getEngine().getLoadedTexturesCache(),o=0;o=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[s]).isReady())0==--i&&t();else{r=n.onLoadObservable;var o=function(){r.removeCallback(o),0==--i&&t()};r.add(o)}},s=0;s1)?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.x(i/2,r/2,s/2),h=2+t,d=2*h,f=[],p=[],_=[],g=[],m=0;m<=h;m++){for(var v=m/h,y=v*Math.PI*c,b=0;b<=d;b++){var T=b/d,E=T*Math.PI*2*a,A=n.j.RotationZ(-y),x=n.j.RotationY(E),R=n.x.TransformCoordinates(n.x.Up(),A),P=n.x.TransformCoordinates(R,x),S=P.multiply(u),C=P.divide(u).normalize();p.push(S.x,S.y,S.z),_.push(C.x,C.y,C.z),g.push(T,v)}if(m>0)for(var M=p.length/3,O=M-2*(d+1);O+d+2a&&(a=u)}return new t(e,s,a-s+1,i,n,r,o)},t}(l)},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 s=this.pickedMesh.getVerticesData(r.b.NormalKind),a=n.x.FromArray(s,3*o[3*this.faceId]),c=n.x.FromArray(s,3*o[3*this.faceId+1]),l=n.x.FromArray(s,3*o[3*this.faceId+2]);a=a.scale(this.bu),c=c.scale(this.bv),l=l.scale(1-this.bu-this.bv),i=new n.x(a.x+c.x+l.x,a.y+c.y+l.y,a.z+c.z+l.z)}else{var u=this.pickedMesh.getVerticesData(r.b.PositionKind),h=n.x.FromArray(u,3*o[3*this.faceId]),d=n.x.FromArray(u,3*o[3*this.faceId+1]),f=n.x.FromArray(u,3*o[3*this.faceId+2]),p=h.subtract(d),_=f.subtract(d);i=n.x.Cross(p,_)}if(e){var g=this.pickedMesh.getWorldMatrix();this.pickedMesh.nonUniformScaling&&(n.t.Matrix[0].copyFrom(g),(g=n.t.Matrix[0]).setTranslationFromFloats(0,0,0),g.invert(),g.transposeToRef(n.t.Matrix[1]),g=n.t.Matrix[1]),i=n.x.TransformNormal(i,g)}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.w.FromArray(t,2*e[3*this.faceId]),o=n.w.FromArray(t,2*e[3*this.faceId+1]),s=n.w.FromArray(t,2*e[3*this.faceId+2]);return i=i.scale(1-this.bu-this.bv),o=o.scale(this.bu),s=s.scale(this.bv),new n.w(i.x+o.x+s.x,i.y+o.y+s.y)},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 s});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}}(),s=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(13);o.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],r=[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=[],a=e.width||e.size||1,c=e.height||e.size||1,l=e.depth||e.size||1,u=e.wrap||!1,h=void 0===e.topBaseAt?1:e.topBaseAt,d=void 0===e.bottomBaseAt?0:e.bottomBaseAt,f=[2,0,3,1][h=(h+4)%4],p=[2,0,1,3][d=(d+4)%4],_=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-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(u){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],_=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,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]],m=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],v=[17,18,19,16],y=[22,23,20,21];f>0;)g.unshift(g.pop()),v.unshift(v.pop()),f--;for(;p>0;)m.unshift(m.pop()),y.unshift(y.pop()),p--;g=g.flat(),m=m.flat(),_=_.concat(g).concat(m),i.push(v[0],v[2],v[3],v[0],v[1],v[2]),i.push(y[0],y[2],y[3],y[0],y[1],y[2])}var b=[a/2,c/2,l/2];t=_.reduce(function(e,t,i){return e.concat(t*b[i%3])},[]);for(var T=0===e.sideOrientation?0:e.sideOrientation||o.a.DEFAULTSIDE,E=e.faceUV||new Array(6),A=e.faceColors,x=[],R=0;R<6;R++)void 0===E[R]&&(E[R]=new n.y(0,0,1,1)),A&&void 0===A[R]&&(A[R]=new n.f(1,1,1,1));for(var P=0;P<6;P++)if(s.push(E[P].z,E[P].w),s.push(E[P].x,E[P].w),s.push(E[P].x,E[P].y),s.push(E[P].z,E[P].y),A)for(var S=0;S<4;S++)x.push(A[P].r,A[P].g,A[P].b,A[P].a);o.a._ComputeSides(T,t,i,r,s,e.frontUVs,e.backUVs);var C=new o.a;if(C.indices=i,C.positions=t,C.normals=r,C.uvs=s,A){var M=T===o.a.DOUBLESIDE?x.concat(x):x;C.colors=M}return C},r.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 r.a(e,i);return t.sideOrientation=r.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,o.a.CreateBox(t).applyToMesh(n,t.updatable),n},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(11),o=i(13),s=i(16);o.a.CreateCylinder=function(e){var t,i=e.height||2,r=0===e.diameterTop?0:e.diameterTop||e.diameter||1,s=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1,a=e.tessellation||24,c=e.subdivisions||1,l=!!e.hasRings,u=!!e.enclose,h=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,d=0===e.sideOrientation?0:e.sideOrientation||o.a.DEFAULTSIDE,f=e.faceUV||new Array(3),p=e.faceColors,_=2+(1+(1!==h&&u?2:0))*(l?c:1);for(t=0;t<_;t++)p&&void 0===p[t]&&(p[t]=new n.f(1,1,1,1));for(t=0;t<_;t++)f&&void 0===f[t]&&(f[t]=new n.y(0,0,1,1));var g,m,v,y,b,T,E=new Array,A=new Array,x=new Array,R=new Array,P=new Array,S=2*Math.PI*h/a,C=(s-r)/2/i,M=n.x.Zero(),O=n.x.Zero(),I=n.x.Zero(),D=n.x.Zero(),L=n.x.Zero(),w=n.c.Y,F=1,N=1,B=0,U=0;for(y=0;y<=c;y++)for(v=((m=y/c)*(r-s)+s)/2,F=l&&0!==y&&y!==c?2:1,T=0;T1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(e.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._scene=t.getScene(),this._attachedNode=t,e._planeScene||(this._debugMode?e._planeScene=this._scene:(e._planeScene=new r.a(this._scene.getEngine()),e._planeScene.detachControl(),this._scene.getEngine().scenes.pop(),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 s.x(0,0,0);this._pointerObserver=this._scene.onPointerObservable.add(function(t,n){var r;if(i.enabled)if(t.type==a.a.POINTERDOWN)!i.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&(r=t.pickInfo.pickedMesh,i._attachedNode==r||r.isDescendantOf(i._attachedNode))&&i._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==a.a.POINTERUP)i.currentDraggingPointerID==t.event.pointerId&&i.releaseDrag();else if(t.type==a.a.POINTERMOVE){var o=t.event.pointerId;i.currentDraggingPointerID===e._AnyMouseID&&o!==e._AnyMouseID&&"mouse"==t.event.pointerType&&(i._lastPointerRay[i.currentDraggingPointerID]&&(i._lastPointerRay[o]=i._lastPointerRay[i.currentDraggingPointerID],delete i._lastPointerRay[i.currentDraggingPointerID]),i.currentDraggingPointerID=o),i._lastPointerRay[o]||(i._lastPointerRay[o]=new c.a(new s.x,new s.x)),t.pickInfo&&t.pickInfo.ray&&(i._lastPointerRay[o].origin.copyFrom(t.pickInfo.ray.origin),i._lastPointerRay[o].direction.copyFrom(t.pickInfo.ray.direction),i.currentDraggingPointerID==o&&i.dragging&&i._moveDrag(t.pickInfo.ray))}}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(function(){i._moving&&i.moveAttached&&(l.a._RemoveAndStorePivotPoint(i._attachedNode),i._targetPosition.subtractToRef(i._attachedNode.absolutePosition,i._tmpVector),i._tmpVector.scaleInPlace(i.dragDeltaRatio),i._attachedNode.getAbsolutePosition().addToRef(i._tmpVector,i._tmpVector),i.validateDrag(i._tmpVector)&&i._attachedNode.setAbsolutePosition(i._tmpVector),l.a._RestorePivotPoint(i._attachedNode))})},e.prototype.releaseDrag=function(){this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID}),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&this._scene.activeCamera.attachControl(this._attachedElement,!0)},e.prototype.startDrag=function(t,i,n){void 0===t&&(t=e._AnyMouseID),this._startDrag(t,i,n);var r=this._lastPointerRay[t];t===e._AnyMouseID&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},e.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this._attachedNode){l.a._RemoveAndStorePivotPoint(this._attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this._attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this._attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&!this._scene.activeCamera.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?(s.x.TransformCoordinatesToRef(this._options.dragAxis,this._attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=s.x.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(s.x.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*s.x.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=s.x.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?s.x.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),s.x.CrossToRef(this._lineA,this._lineB,this._lookAt),s.x.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?s.x.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});var n=i(3),r=function(){function e(){}return Object.defineProperty(e,"ForceFullSceneLoadingForIncremental",{get:function(){return e._ForceFullSceneLoadingForIncremental},set:function(t){e._ForceFullSceneLoadingForIncremental=t},enumerable:!0,configurable:!0}),Object.defineProperty(e,"ShowLoadingScreen",{get:function(){return e._ShowLoadingScreen},set:function(t){e._ShowLoadingScreen=t},enumerable:!0,configurable:!0}),Object.defineProperty(e,"loggingLevel",{get:function(){return e._loggingLevel},set:function(t){e._loggingLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CleanBoneMatrixWeights",{get:function(){return e._CleanBoneMatrixWeights},set:function(t){e._CleanBoneMatrixWeights=t},enumerable:!0,configurable:!0}),e._ForceFullSceneLoadingForIncremental=!1,e._ShowLoadingScreen=!0,e._CleanBoneMatrixWeights=!1,e._loggingLevel=n.a.SCENELOADER_NO_LOGGING,e}()},function(e,t,i){"use strict";var n="helperFunctions",r="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}";i(5).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";i.d(t,"a",function(){return d});var n=i(0),r=i(13),o=i(4),s=i(49),a=i(55),c=i(43),l=i(3),u=i(9),h=i(29),d=function(){function e(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),this.delayLoadState=l.a.DELAYLOADSTATE_NONE,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this.id=e,this.uniqueId=t.getUniqueId(),this._engine=t.getEngine(),this._meshes=[],this._scene=t,this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):(this._totalVertices=0,this._indices=[]),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0))}return Object.defineProperty(e.prototype,"boundingBias",{get:function(){return this._boundingBias},set:function(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)},enumerable:!0,configurable:!0}),e.CreateGeometryForMesh=function(t){var i=new e(e.RandomId(),t.getScene());return i.applyToMesh(t),i},Object.defineProperty(e.prototype,"extend",{get:function(){return this._extend},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._engine},e.prototype.isReady=function(){return this.delayLoadState===l.a.DELAYLOADSTATE_LOADED||this.delayLoadState===l.a.DELAYLOADSTATE_NONE},Object.defineProperty(e.prototype,"doNotSerialize",{get:function(){for(var e=0;e0&&(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(o.b.PositionKind,u,!1)}if(l.normalsAttrDesc&&l.normalsAttrDesc.count>0){var h=new Float32Array(t,l.normalsAttrDesc.offset,l.normalsAttrDesc.count);i.setVerticesData(o.b.NormalKind,h,!1)}if(l.tangetsAttrDesc&&l.tangetsAttrDesc.count>0){var d=new Float32Array(t,l.tangetsAttrDesc.offset,l.tangetsAttrDesc.count);i.setVerticesData(o.b.TangentKind,d,!1)}if(l.uvsAttrDesc&&l.uvsAttrDesc.count>0){var f=new Float32Array(t,l.uvsAttrDesc.offset,l.uvsAttrDesc.count);i.setVerticesData(o.b.UVKind,f,!1)}if(l.uvs2AttrDesc&&l.uvs2AttrDesc.count>0){var p=new Float32Array(t,l.uvs2AttrDesc.offset,l.uvs2AttrDesc.count);i.setVerticesData(o.b.UV2Kind,p,!1)}if(l.uvs3AttrDesc&&l.uvs3AttrDesc.count>0){var _=new Float32Array(t,l.uvs3AttrDesc.offset,l.uvs3AttrDesc.count);i.setVerticesData(o.b.UV3Kind,_,!1)}if(l.uvs4AttrDesc&&l.uvs4AttrDesc.count>0){var g=new Float32Array(t,l.uvs4AttrDesc.offset,l.uvs4AttrDesc.count);i.setVerticesData(o.b.UV4Kind,g,!1)}if(l.uvs5AttrDesc&&l.uvs5AttrDesc.count>0){var m=new Float32Array(t,l.uvs5AttrDesc.offset,l.uvs5AttrDesc.count);i.setVerticesData(o.b.UV5Kind,m,!1)}if(l.uvs6AttrDesc&&l.uvs6AttrDesc.count>0){var v=new Float32Array(t,l.uvs6AttrDesc.offset,l.uvs6AttrDesc.count);i.setVerticesData(o.b.UV6Kind,v,!1)}if(l.colorsAttrDesc&&l.colorsAttrDesc.count>0){var y=new Float32Array(t,l.colorsAttrDesc.offset,l.colorsAttrDesc.count);i.setVerticesData(o.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(o.b.MatricesIndicesKind,T,!1)}if(l.matricesWeightsAttrDesc&&l.matricesWeightsAttrDesc.count>0){var x=new Float32Array(t,l.matricesWeightsAttrDesc.offset,l.matricesWeightsAttrDesc.count);i.setVerticesData(o.b.MatricesWeightsKind,x,!1)}if(l.indicesAttrDesc&&l.indicesAttrDesc.count>0){var R=new Int32Array(t,l.indicesAttrDesc.offset,l.indicesAttrDesc.count);i.setIndices(R,null)}if(l.subMeshesAttrDesc&&l.subMeshesAttrDesc.count>0){var P=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(o.b.MatricesIndicesKind,T,t.matricesIndices._updatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,i.setVerticesData(o.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(o.b.MatricesIndicesExtraKind,T,t.matricesIndicesExtra._updatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,i),i.setVerticesData(o.b.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&i.setVerticesData(o.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(o.b.MatricesIndicesKind),s=t.getVerticesData(o.b.MatricesIndicesExtraKind),c=e.matricesWeights,l=e.matricesWeightsExtra,u=e.numBoneInfluencer,h=c.length,d=0;du-1)&&(p=u-1),f>.001){var m=1/f;for(_=0;_<4;_++)c[d+_]*=m;if(l)for(_=0;_<4;_++)l[d+_]*=m}else p>=4?(l[d+p-4]=1-f,s[d+p-4]=i):(c[d+p]=1-f,r[d+p]=i)}t.setVerticesData(o.b.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(o.b.MatricesIndicesExtraKind,s)}}}},e.Parse=function(t,i,s){if(i.getGeometryByID(t.id))return null;var a=new e(t.id,i,void 0,t.updatable);return h.a&&h.a.AddTagsTo(a,t.tags),t.delayLoadingFile?(a.delayLoadState=l.a.DELAYLOADSTATE_NOTLOADED,a.delayLoadingFile=s+t.delayLoadingFile,a._boundingInfo=new c.a(n.x.FromArray(t.boundingBoxMinimum),n.x.FromArray(t.boundingBoxMaximum)),a._delayInfo=[],t.hasUVs&&a._delayInfo.push(o.b.UVKind),t.hasUVs2&&a._delayInfo.push(o.b.UV2Kind),t.hasUVs3&&a._delayInfo.push(o.b.UV3Kind),t.hasUVs4&&a._delayInfo.push(o.b.UV4Kind),t.hasUVs5&&a._delayInfo.push(o.b.UV5Kind),t.hasUVs6&&a._delayInfo.push(o.b.UV6Kind),t.hasColors&&a._delayInfo.push(o.b.ColorKind),t.hasMatricesIndices&&a._delayInfo.push(o.b.MatricesIndicesKind),t.hasMatricesWeights&&a._delayInfo.push(o.b.MatricesWeightsKind),a._delayLoadingFunction=r.a.ImportVertexData):r.a.ImportVertexData(t,a),i.pushGeometry(a,!0),a},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return d});var n=i(1),r=i(8),o=i(0),s=i(42),a=i(53),c=i(54),l=i(48),u=i(41),h=i(33),d=function(e){function t(i,n,s){void 0===n&&(n=o.e.Gray()),void 0===s&&(s=u.a.DefaultUtilityLayer);var a=e.call(this,s)||this;a._pointerObserver=null,a.snapDistance=0,a.onSnapObservable=new r.c;var l=new h.a("",s.utilityLayerScene);l.diffuseColor=n,l.specularColor=n.subtract(new o.e(.1,.1,.1));var d=new h.a("",s.utilityLayerScene);d.diffuseColor=n.add(new o.e(.3,.3,.3));var f=t._CreateArrow(s.utilityLayerScene,l);f.lookAt(a._rootMesh.position.add(i)),f.scaling.scaleInPlace(1/3),f.parent=a._rootMesh;var p=0,_=new o.x,g={snapDistance:0};a.dragBehavior=new c.a({dragAxis:i}),a.dragBehavior.moveAttached=!1,a._rootMesh.addBehavior(a.dragBehavior);var m=new o.x,v=new o.j;a.dragBehavior.onDragObservable.add(function(e){if(a.attachedMesh)if(a.attachedMesh.parent?(a.attachedMesh.parent.computeWorldMatrix().invertToRef(v),v.setTranslationFromFloats(0,0,0),o.x.TransformCoordinatesToRef(e.delta,v,m)):m.copyFrom(e.delta),0==a.snapDistance)a.attachedMesh.position.addInPlace(m);else if(p+=e.dragDistance,Math.abs(p)>a.snapDistance){var t=Math.floor(Math.abs(p)/a.snapDistance);p%=a.snapDistance,m.normalizeToRef(_),_.scaleInPlace(a.snapDistance*t),a.attachedMesh.position.addInPlace(_),g.snapDistance=a.snapDistance*t,a.onSnapObservable.notifyObservers(g)}}),a._pointerObserver=s.utilityLayerScene.onPointerObservable.add(function(e){if(!a._customMeshSet){var t=e.pickInfo&&-1!=a._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?d:l;a._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var y=s._getSharedGizmoLight();return y.includedOnlyMeshes=y.includedOnlyMeshes.concat(a._rootMesh.getChildMeshes(!1)),a}return n.d(t,e),t._CreateArrow=function(e,t){var i=new s.a("arrow",e),n=a.a.CreateCylinder("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375,tessellation:96},e),r=a.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 s.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-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=n.e.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},e.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=_.a.CreateBox("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.rotationQuaternion=n.q.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=g.a.CreateSphere("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=n.q.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=b.a.CreateCylinder("physicsBodyCylinderViewMesh",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=n.q.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugMeshMesh=function(e,t){var i=new p.a(e.name,t,null,e);return i.position=n.x.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 v.a.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case v.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 v.a.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case v.a.NoImpostor:if(t)t.getChildMeshes().filter(function(e){return e.physicsImpostor?1:0}).forEach(function(e){i._getDebugBoxMesh(r).parent=e});break;case v.a.CylinderImpostor:n=this._getDebugCylinderMesh(r);var s=e.object.getBoundingInfo();n.scaling.x=s.boundingBox.maximum.x-s.boundingBox.minimum.x,n.scaling.y=s.boundingBox.maximum.y-s.boundingBox.minimum.y,n.scaling.z=s.boundingBox.maximum.z-s.boundingBox.minimum.z}return n},e.prototype.dispose=function(){for(var e=this._numMeshes,t=0;t=0;a--){var c=e[a],l=c.getParent();if(l){var u=this._debugLines[r];u||(u=[n.x.Zero(),n.x.Zero()],this._debugLines[r]=u),c.getAbsolutePositionToRef(o,u[0]),l.getAbsolutePositionToRef(o,u[1]),u[0].subtractInPlace(s),u[1].subtractInPlace(s),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?E.a.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:this._debugMesh},t):(this._debugMesh=E.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 c}),i.d(t,"DebugLayer",function(){return f}),i.d(t,"PhysicsViewer",function(){return T}),i.d(t,"RayHelper",function(){return A}),i.d(t,"SkeletonViewer",function(){return x})},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(1),r=i(0),o=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n._normalMatrix=new r.j,n.allowShaderHotSwapping=!0,n._storeEffectOnSubMeshes=!0,n}return n.d(t,e),t.prototype.getEffect=function(){return this._activeEffect},t.prototype.isReady=function(e,t){return!!e&&(!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},t.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},t.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},t.prototype._afterBind=function(t,i){void 0===i&&(i=null),e.prototype._afterBind.call(this,t),this.getScene()._cachedEffect=i},t.prototype._mustRebind=function(e,t,i){return void 0===i&&(i=1),e.isCachedMaterialInvalid(this,t,i)},t}(i(20).a)},function(e,t,i){"use strict";i.d(t,"a",function(){return d});var n=i(1),r=i(2),o=i(0),s=i(4),a=i(7),c=i(15),l=i(5),u=i(20),h=i(22),d=function(e){function t(t,i,r,s){void 0===s&&(s={});var a=e.call(this,t,i)||this;return a._textures={},a._textureArrays={},a._floats={},a._ints={},a._floatsArrays={},a._colors3={},a._colors3Arrays={},a._colors4={},a._vectors2={},a._vectors3={},a._vectors4={},a._matrices={},a._matrices3x3={},a._matrices2x2={},a._vectors2Arrays={},a._vectors3Arrays={},a._cachedWorldViewMatrix=new o.j,a._shaderPath=r,a._options=n.a({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},s),a}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.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._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=[],a=new l.c,u=0;u4&&(o.push(s.b.MatricesIndicesExtraKind),o.push(s.b.MatricesWeightsExtraKind));var h=e.skeleton;r.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),a.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:a,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")&&this._effect.setMatrix("worldViewProjection",e.multiply(t.getTransformMatrix())))},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._vectors2)this._effect.setVector2(i,this._vectors2[i]);for(i in this._vectors3)this._effect.setVector3(i,this._vectors3[i]);for(i in this._vectors4)this._effect.setVector4(i,this._vectors4[i]);for(i in this._matrices)this._effect.setMatrix(i,this._matrices[i]);for(i in this._matrices3x3)this._effect.setMatrix3x3(i,this._matrices3x3[i]);for(i in this._matrices2x2)this._effect.setMatrix2x2(i,this._matrices2x2[i]);for(i in this._vectors2Arrays)this._effect.setArray2(i,this._vectors2Arrays[i]);for(i in this._vectors3Arrays)this._effect.setArray3(i,this._vectors3Arrays[i])}this._afterBind(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-o)&&!(l-dd-s))},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,s=i.z,a=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!(af)&&(!(cp)&&!(l_))},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,i,n,o){var s=e.TmpVector3[0];return r.x.ClampToRef(n,t,i,s),r.x.DistanceSquared(n,s)<=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.x.Zero),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){this.references=0,this.capacity=0,this.is32Bits=!1}return Object.defineProperty(e.prototype,"underlyingResource",{get:function(){return null},enumerable:!0,configurable:!0}),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(3),r=function(){function e(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}return Object.defineProperty(e,"HasTriggers",{get:function(){for(var t in e.Triggers)if(e.Triggers.hasOwnProperty(t))return!0;return!1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"HasPickTriggers",{get:function(){for(var t in e.Triggers)if(e.Triggers.hasOwnProperty(t)){var i=parseInt(t);if(i>=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(11),r=i(13);r.a.CreatePlane=function(e){var t=[],i=[],n=[],o=[],s=e.width||e.size||1,a=e.height||e.size||1,c=0===e.sideOrientation?0:e.sideOrientation||r.a.DEFAULTSIDE,l=s/2,u=a/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 s={size:t,width:t,height:t,sideOrientation:r,updatable:n};return o.CreatePlane(e,s,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 n});var n=function(){return function(e,t,i){this.bu=e,this.bv=t,this.distance=i,this.faceId=0,this.subMeshId=0}}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(34),r=i(0),o=function(){function e(e,t,i){this.center=r.x.Zero(),this.centerWorld=r.x.Zero(),this.minimum=r.x.Zero(),this.maximum=r.x.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.x.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.j.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]),s=this.center.addToRef(r,n[2]);return this.reConstruct(o,s,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.x.TransformCoordinatesToRef(this.center,t,this.centerWorld);var i=e.TmpVector3[0];r.x.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.x.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?(p.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?f.push(r):f.push(i),g){for(var m=new Array,v=0;v0){var p=f.properties[0].value,_=null===f.properties[0].targetType?p:n.getMeshByName(p);_._meshId&&(_.mesh=n.getMeshByID(_._meshId)),d={trigger:t[f.name],parameter:_}}else d=t[f.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 a=n[o],c=this._getKeyValue(a.value);if(a.interpolation===I.STEP)return c;var l=this._getKeyValue(s.value),u=void 0!==a.outTangent&&void 0!==s.inTangent,h=s.frame-a.frame,d=(t-a.frame)/h,f=this.getEasingFunction();switch(null!=f&&(d=f.ease(d)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var p=u?this.floatInterpolateFunctionWithTangents(c,a.outTangent*h,l,s.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,a.outTangent.scale(h),l,s.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 g=u?this.vector3InterpolateFunctionWithTangents(c,a.outTangent.scale(h),l,s.inTangent.scale(h),d):this.vector3InterpolateFunction(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_VECTOR2:var m=u?this.vector2InterpolateFunctionWithTangents(c,a.outTangent.scale(h),l,s.inTangent.scale(h),d):this.vector2InterpolateFunction(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_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?(o.j.DecomposeLerpToRef(t,i,n,r),r):o.j.DecomposeLerp(t,i,n):r?(o.j.LerpToRef(t,i,n,r),r):o.j.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&&(c=u.values[1]),u.values.length>=2&&(l=u.values[2]);break;case e.ANIMATIONTYPE_QUATERNION:if(i=o.q.FromArray(u.values),u.values.length>=8){var h=o.q.FromArray(u.values.slice(4,8));h.equals(o.q.Zero())||(c=h)}if(u.values.length>=12){var d=o.q.FromArray(u.values.slice(8,12));d.equals(o.q.Zero())||(l=d)}break;case e.ANIMATIONTYPE_MATRIX:i=o.j.FromArray(u.values);break;case e.ANIMATIONTYPE_COLOR3:i=o.e.FromArray(u.values);break;case e.ANIMATIONTYPE_VECTOR3:default:i=o.x.FromArray(u.values)}var f={};f.frame=u.frame,f.value=i,null!=c&&(f.inTangent=c),null!=l&&(f.outTangent=l),a.push(f)}if(r.setKeys(a),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),this._currentFrame=e;var i=this._animation._interpolate(e,this._animationState);this.setValue(i,-1)},e.prototype._prepareForSpeedRatioChange=function(e){var t=this._previousDelay*(this._animation.framePerSecond*e)/1e3;this._ratioOffset=this._previousRatio-t},e.prototype.animate=function(e,t,i,n,r,o){void 0===o&&(o=-1);var s=this._animation,a=s.targetPropertyPath;if(!a||a.length<1)return this._stopped=!0,!1;var c=!0;(tthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);var l,u,h=i-t,d=e*(s.framePerSecond*r)/1e3+this._ratioOffset,f=0;if(this._previousDelay=e,this._previousRatio=d,!n&&i>=t&&d>=h)c=!1,f=s._getKeyValue(this._maxValue);else if(!n&&t>=i&&d<=h)c=!1,f=s._getKeyValue(this._minValue);else if(this._animationState.loopMode!==B.ANIMATIONLOOPMODE_CYCLE){var p=i.toString()+t.toString();if(!this._offsetsCache[p]){this._animationState.repeatCount=0,this._animationState.loopMode=B.ANIMATIONLOOPMODE_CYCLE;var _=s._interpolate(t,this._animationState),g=s._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),s.dataType){case B.ANIMATIONTYPE_FLOAT:this._offsetsCache[p]=g-_;break;case B.ANIMATIONTYPE_QUATERNION:this._offsetsCache[p]=g.subtract(_);break;case B.ANIMATIONTYPE_VECTOR3:this._offsetsCache[p]=g.subtract(_);case B.ANIMATIONTYPE_VECTOR2:this._offsetsCache[p]=g.subtract(_);case B.ANIMATIONTYPE_SIZE:this._offsetsCache[p]=g.subtract(_);case B.ANIMATIONTYPE_COLOR3:this._offsetsCache[p]=g.subtract(_)}this._highLimitsCache[p]=g}f=this._highLimitsCache[p],l=this._offsetsCache[p]}if(void 0===l)switch(s.dataType){case B.ANIMATIONTYPE_FLOAT:l=0;break;case B.ANIMATIONTYPE_QUATERNION:l=V;break;case B.ANIMATIONTYPE_VECTOR3:l=G;break;case B.ANIMATIONTYPE_VECTOR2:l=k;break;case B.ANIMATIONTYPE_SIZE:l=z;break;case B.ANIMATIONTYPE_COLOR3:l=j}if(this._host&&this._host.syncRoot){var m=this._host.syncRoot;u=t+(i-t)*((m.masterFrame-m.fromFrame)/(m.toFrame-m.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=s._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}(),W=i(16),X=i(47),Y=i(34),K=function(e){function t(t,i,n,r,s,a,c){void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=null),void 0===a&&(a=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 o.j,l._invertedAbsoluteTransform=new o.j,l._scalingDeterminant=1,l._worldTransform=new o.j,l._needToDecompose=!0,l._needToCompose=!1,l._linkedTransformNode=null,l._waitingTransformNodeId=null,l._skeleton=i,l._localMatrix=r?r.clone():o.j.Identity(),l._restPose=s||l._localMatrix.clone(),l._baseMatrix=a||l._localMatrix.clone(),l._index=c,i.bones.push(l),l.setParent(n,!1),(a||r)&&l._updateDifferenceMatrix(),l}return l.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++},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=o.x.Zero(),this._localRotation=o.q.Zero(),this._localPosition=o.x.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},t.prototype._compose=function(){this._needToCompose&&(this._needToCompose=!1,o.j.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix))},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),a&&this.stopAnimation(e,void 0,c),s||(s=new Q(this,e,t,i,n,r,o,void 0,l));var u=!c||c(e);if(e.animations&&u&&s.appendAnimations(e,e.animations),e.getAnimatables)for(var h=e.getAnimatables(),d=0;d=l&&s.frame<=u&&(n?(c=s.value.clone(),_?(a=c.getTranslation(),c.setTranslation(a.scaleInPlace(g))):m&&r?(a=c.getTranslation(),c.setTranslation(a.multiplyInPlace(r))):c=s.value):c=s.value,v.push({frame:s.frame+i,value:c}));return this.animations[0].createRange(t,l+i,u+i),!0};var q=function(){return function(){}}(),Z=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 r.c,this.onAnimationLoopObservable=new r.c,this.onAnimationGroupEndObservable=new r.c,this.onAnimationGroupPauseObservable=new r.c,this.onAnimationGroupPlayObservable=new r.c,this._scene=t||P.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 s={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,s)}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;r=.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}(),ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},t}($),te=function(e){function t(t){void 0===t&&(t=1);var i=e.call(this)||this;return i.amplitude=t,i}return l.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}($),ie=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 l.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,s=e*o,a=Math.log(-s*(1-i)+1)/Math.log(i),c=Math.floor(a),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}($),ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t.prototype.easeInCore=function(e){return e*e*e},t}($),re=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 l.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}($),oe=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.exponent=t,i}return l.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}($),se=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.power=t,i}return l.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},t}($),ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t.prototype.easeInCore=function(e){return e*e},t}($),ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t.prototype.easeInCore=function(e){return e*e*e*e},t}($),le=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e},t}($),ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},t}($),he=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 l.d(t,e),t.prototype.easeInCore=function(e){return o.d.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},t}($),de=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}(),fe=i(11),pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.d(t,e),t}(n.a),_e=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 l.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(ge.b.audioEngine.audioContext&&this._soundSource){var i=e?ge.b.audioEngine.audioContext.currentTime+e:ge.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():ge.b.audioEngine.audioContext&&(this.stop(0),this._startOffset+=ge.b.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){ge.b.audioEngine.canUseWebAudio&&this._soundGain&&(t&&ge.b.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(ge.b.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,ge.b.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,ge.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())),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(o.t.Matrix[0]),this.setPosition(o.t.Matrix[0].getTranslation());else{var i=t.getBoundingInfo();this.setPosition(i.boundingSphere.centerWorld)}ge.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()):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 s,a=t.name;s=t.url?n+t.url:n+a;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()):window.setTimeout(u,300)};c=new e(a,new ArrayBuffer(0),i,null,l),u()}else c=new e(a,s,i,function(){i._removePendingData(c)},l),i._addPendingData(c);if(t.position){var h=o.x.FromArray(t.position);c.setPosition(h)}if(t.isDirectional&&(c.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var d=o.x.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 be.a.WarnImport("AudioSceneComponent")},e}(),Ee=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(){ge.b.audioEngine.canUseWebAudio&&ge.b.audioEngine.audioContext&&(this._outputAudioNode=ge.b.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(ge.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(ge.b.audioEngine&&ge.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(),ge.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){ge.b.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},e.prototype.switchPanningModelToHRTF=function(){if(ge.b.audioEngine.canUseWebAudio)for(var e=0;e0?e.activeCameras[0]:e.activeCamera)&&i.audioContext){i.audioContext.listener.setPosition(t.position.x,t.position.y,t.position.z),t.rigCameras&&t.rigCameras.length>0&&(t=t.rigCameras[0]);var n,r=o.j.Invert(t.getViewMatrix()),s=o.x.TransformNormal(new o.x(0,0,-1),r);for(s.normalize(),isNaN(s.x)||isNaN(s.y)||isNaN(s.z)||i.audioContext.listener.setOrientation(s.x,s.y,s.z,0,1,0),n=0;n0?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!==Pe.a.POINTERDOWN?e.type===Pe.a.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){var e=X.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=X.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}(),Ce=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=B.CreateAnimation("radius",B.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=B.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 te(.3),e.EasingMode=$.EASINGMODE_EASEOUT,e}(),Me=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!==Pe.a.POINTERDOWN?e.type===Pe.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 o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new o.x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),s=0;sl.upperRadiusLimit?l.upperRadiusLimit:c),c):0},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var i=X.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=B.CreateAnimation("beta",B.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=B.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 o.w.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new o.w(n,i)},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=X.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 oe,e.EasingMode=$.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),Oe=function(){return function(e,t,i,n){void 0===t&&(t=new o.x),void 0===i&&(i=0),void 0===n&&(n=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=n}}(),Ie=function(){function e(e){this.ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new Oe(o.x.Up()),new Oe(o.x.Down()),new Oe(o.x.Left()),new Oe(o.x.Right()),new Oe(o.x.Forward()),new Oe(o.x.Forward().scaleInPlace(-1))],this._tmpMatrix=new o.j,this._tmpVector=new o.x,this._zeroVector=o.x.Zero(),this._lookAtTmpMatrix=new o.j}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=o.q.RotationYawPitchRoll(t._target.rotation.y,t._target.rotation.x,t._target.rotation.z)),t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix),o.x.TransformCoordinatesToRef(i.direction,t._tmpMatrix,i.rotatedDirection),i.diff=o.x.GetAngleBetweenVectors(i.rotatedDirection,e,o.x.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}(),Le=i(54),we=function(){function e(){this._startDistance=0,this._initialScale=new o.x(0,0,0),this._targetScale=new o.x(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new Le.a({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new Le.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}(),Fe=i(24),Ne=i(21),Be=i(45),Ue=function(){function e(){this._sceneRenderObserver=null,this._targetPosition=new o.x(0,0,0),this._moving=!1,this._startingOrientation=new o.q,this.zDragFactor=3,this.rotateDraggedObject=!0,this.dragging=!1,this.dragDeltaRatio=.2,this.currentDraggingPointerID=-1,this.detachCameraControls=!0,this.onDragStartObservable=new r.c,this.onDragEndObservable=new r.c}return Object.defineProperty(e.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._ownerNode=t,this._scene=this._ownerNode.getScene(),e._virtualScene||(e._virtualScene=new W.a(this._scene.getEngine()),e._virtualScene.detachControl(),this._scene.getEngine().scenes.pop());var n=null,r=new o.x(0,0,0);this._virtualOriginMesh=new Fe.a("",e._virtualScene),this._virtualOriginMesh.rotationQuaternion=new o.q,this._virtualDragMesh=new Fe.a("",e._virtualScene),this._virtualDragMesh.rotationQuaternion=new o.q;var s=null;this._pointerObserver=this._scene.onPointerObservable.add(function(e,t){if(e.type==Pe.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._scene.activeCamera&&i._scene.activeCamera.cameraRigMode==Ne.a.RIG_MODE_NONE&&e.pickInfo.ray.origin.copyFrom(i._scene.activeCamera.globalPosition),n=i._ownerNode,Be.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=o.q.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z));var a=n.parent;n.setParent(null),i._virtualDragMesh.rotationQuaternion.copyFrom(n.rotationQuaternion),n.setParent(a),i._virtualOriginMesh.addChild(i._virtualDragMesh),i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition),i.dragging=!0,i.currentDraggingPointerID=e.event.pointerId,i.detachCameraControls&&i._scene.activeCamera&&!i._scene.activeCamera.leftCamera&&(i._scene.activeCamera.inputs.attachedElement?(s=i._scene.activeCamera.inputs.attachedElement,i._scene.activeCamera.detachControl(i._scene.activeCamera.inputs.attachedElement)):s=null),Be.a._RestorePivotPoint(n),i.onDragStartObservable.notifyObservers({})}}else if(e.type==Pe.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&&s&&i._scene.activeCamera&&!i._scene.activeCamera.leftCamera&&i._scene.activeCamera.attachControl(s,!0),i.onDragEndObservable.notifyObservers({}));else if(e.type==Pe.a.POINTERMOVE&&i.currentDraggingPointerID==e.event.pointerId&&i.dragging&&e.pickInfo&&e.pickInfo.ray&&n){var c=i.zDragFactor;i._scene.activeCamera&&i._scene.activeCamera.cameraRigMode==Ne.a.RIG_MODE_NONE&&(e.pickInfo.ray.origin.copyFrom(i._scene.activeCamera.globalPosition),c=0);var l=e.pickInfo.ray.origin.subtract(r);r.copyFrom(e.pickInfo.ray.origin);var u=-o.x.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&&o.x.TransformCoordinatesToRef(i._targetPosition,o.j.Invert(n.parent.getWorldMatrix()),i._targetPosition),i._moving||i._startingOrientation.copyFrom(i._virtualDragMesh.rotationQuaternion),i._moving=!0}var h});var a=new o.q;this._sceneRenderObserver=t.getScene().onBeforeRenderObservable.add(function(){if(i.dragging&&i._moving&&n){if(Be.a._RemoveAndStorePivotPoint(n),n.position.addInPlace(i._targetPosition.subtract(n.position).scale(i.dragDeltaRatio)),i.rotateDraggedObject){a.copyFrom(i._startingOrientation),a.x=-a.x,a.y=-a.y,a.z=-a.z,i._virtualDragMesh.rotationQuaternion.multiplyToRef(a,a),o.q.RotationYawPitchRollToRef(a.toEulerAngles("xyz").y,0,0,a),a.multiplyToRef(i._startingOrientation,a);var e=n.parent;(!e||e.scaling&&!e.scaling.isNonUniformWithinEpsilon(.001))&&(n.setParent(null),o.q.SlerpToRef(n.rotationQuaternion,a,i.dragDeltaRatio,n.rotationQuaternion),n.setParent(e))}Be.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}(),Ve=function(){function e(e,t,i){if(this.targetPosition=o.x.Zero(),this.poleTargetPosition=o.x.Zero(),this.poleTargetLocalOffset=o.x.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=o.q.Identity(),this._bone1Mat=o.j.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=o.x.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(),s=this._bone2.getScale();this._bone1Length=this._bone1.length*r.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*s.y*this.mesh.scaling.y}else if(this._bone1.children[0]){e.computeWorldMatrix(!0);var a=this._bone2.children[0].getAbsolutePosition(e),c=this._bone2.getAbsolutePosition(e),l=this._bone1.getAbsolutePosition(e);this._bone1Length=o.x.Distance(a,c),this._bone2Length=o.x.Distance(c,l)}this._bone1.getRotationMatrixToRef(o.s.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],s=e._tmpMats[1];this.targetMesh&&i.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,n):this.poleTargetMesh&&o.x.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),n);var a=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,a),n.subtractToRef(a,h),0==h.x&&0==h.y&&0==h.z?h.y=1:h.normalize(),i.subtractToRef(a,u),u.normalize(),o.x.CrossToRef(u,h,c),c.normalize(),o.x.CrossToRef(u,c,l),l.normalize(),o.j.FromXYZAxesToRef(l,u,c,r);var f=this._bone1Length,p=this._bone2Length,_=o.x.Distance(a,i);this._maxReach>0&&(_=Math.min(this._maxReach,_));var g=(p*p+_*_-f*f)/(2*p*_),m=(_*_+f*f-p*p)/(2*_*f);g>1&&(g=1),m>1&&(m=1),g<-1&&(g=-1),m<-1&&(m=-1);var v=Math.acos(g),y=Math.acos(m),b=-v-y;if(this._rightHandedSystem)o.j.RotationYawPitchRollToRef(0,0,this._adjustRoll,s),s.multiplyToRef(r,r),o.j.RotationAxisToRef(this._bendAxis,y,s),s.multiplyToRef(r,r);else{var T=e._tmpVecs[5];T.copyFrom(this._bendAxis),T.x*=-1,o.j.RotationAxisToRef(T,-y,s),s.multiplyToRef(r,r)}this.poleAngle&&(o.j.RotationAxisToRef(u,this.poleAngle,s),r.multiplyToRef(s,r)),this._bone1&&(this.slerpAmount<1?(this._slerping||o.q.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),o.q.FromRotationMatrixToRef(r,d),o.q.SlerpToRef(this._bone1Quat,d,this.slerpAmount,this._bone1Quat),b=this._bone2Ang*(1-this.slerpAmount)+b*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,o.s.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(r,o.s.WORLD,this.mesh),this._bone1Mat.copyFrom(r),this._slerping=!1)),this._bone2.setAxisAngle(this._bendAxis,b,o.s.LOCAL),this._bone2Ang=b}},e._tmpVecs=[o.x.Zero(),o.x.Zero(),o.x.Zero(),o.x.Zero(),o.x.Zero(),o.x.Zero()],e._tmpQuat=o.q.Identity(),e._tmpMats=[o.j.Identity(),o.j.Identity()],e}(),Ge=function(){function e(e,t,i,n){if(this.upAxis=o.x.Up(),this.upAxisSpace=o.s.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=o.q.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=o.x.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=o.c.Y,s=o.c.X;null!=n.yawAxis&&(r=n.yawAxis.clone()).normalize(),null!=n.pitchAxis&&(s=n.pitchAxis.clone()).normalize();var a=o.x.Cross(s,r);this._transformYawPitch=o.j.Identity(),o.j.FromXYZAxesToRef(s,r,a,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}t.getParent()||this.upAxisSpace!=o.s.BONE||(this.upAxisSpace=o.s.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],s=e._tmpMats[1],a=this.mesh,c=t.getParent(),l=e._tmpVecs[1];l.copyFrom(this.upAxis),this.upAxisSpace==o.s.BONE&&c?(this._transformYawPitch&&o.x.TransformCoordinatesToRef(l,this._transformYawPitchInv,l),c.getDirectionToRef(l,this.mesh,l)):this.upAxisSpace==o.s.LOCAL&&(a.getDirectionToRef(l,l),1==a.scaling.x&&1==a.scaling.y&&1==a.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==o.s.BONE&&1==l.y&&c)c.getRotationMatrixToRef(o.s.WORLD,this.mesh,d);else if(this.upAxisSpace!=o.s.LOCAL||1!=l.y||c){(_=e._tmpVecs[2]).copyFrom(this._fowardAxis),this._transformYawPitch&&o.x.TransformCoordinatesToRef(_,this._transformYawPitchInv,_),c?c.getDirectionToRef(_,this.mesh,_):a.getDirectionToRef(_,_);var p=o.x.Cross(l,_);p.normalize();var _=o.x.Cross(p,l);o.j.FromXYZAxesToRef(p,l,_,d)}else d.copyFrom(a.getWorldMatrix());d.invertToRef(f);var g=null;if(h){var m=e._tmpVecs[3];n.subtractToRef(i,m),o.x.TransformCoordinatesToRef(m,f,m),g=Math.sqrt(m.x*m.x+m.z*m.z);var v=Math.atan2(m.y,g),y=v;v>this._maxPitch?(m.y=this._maxPitchTan*g,y=this._maxPitch):vthis._maxYaw||bMath.PI?this._isAngleBetween(b,this._maxYaw,this._midYawConstraint)?(m.z=this._maxYawCos*g,m.x=this._maxYawSin*g,T=this._maxYaw):this._isAngleBetween(b,this._midYawConstraint,this._minYaw)&&(m.z=this._minYawCos*g,m.x=this._minYawSin*g,T=this._minYaw):b>this._maxYaw?(m.z=this._maxYawCos*g,m.x=this._maxYawSin*g,T=this._maxYaw):bMath.PI){var E=e._tmpVecs[8];E.copyFrom(o.c.Z),this._transformYawPitch&&o.x.TransformCoordinatesToRef(E,this._transformYawPitchInv,E);var A=e._tmpMats[4];this._boneQuat.toRotationMatrix(A),this.mesh.getWorldMatrix().multiplyToRef(A,A),o.x.TransformCoordinatesToRef(E,A,E),o.x.TransformCoordinatesToRef(E,f,E);var x=Math.atan2(E.x,E.z);if(this._getAngleBetween(x,b)>this._getAngleBetween(x,this._midYawConstraint)){null==g&&(g=Math.sqrt(m.x*m.x+m.z*m.z));var R=this._getAngleBetween(x,this._maxYaw);this._getAngleBetween(x,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=m[v][b];g&&(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},ge.b.prototype.createRawTexture3D=function(e,t,i,n,r,o,s,a,c,l){void 0===c&&(c=null),void 0===l&&(l=ge.b.TEXTURETYPE_UNSIGNED_INT);var u=new ze.a(this,ze.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=a,u.is3D=!0,this._doNotHandleContextLost||(u._bufferView=e),this.updateRawTexture3D(u,e,r,s,c,l),this._bindTextureDirectly(this._gl.TEXTURE_3D,u,!0);var h=this._getSamplingParameters(a,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},ge.b.prototype.updateRawTexture3D=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=ge.b.TEXTURETYPE_UNSIGNED_INT);var s=this._getWebGLTextureType(o),a=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,a,s,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),e.isReady=!0};var je=function(e){function t(t,i,n,r,o,s,a,c,l){void 0===s&&(s=!0),void 0===a&&(a=!1),void 0===c&&(c=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=_.a.TEXTURETYPE_UNSIGNED_INT);var u=e.call(this,null,o,!s,a)||this;return u.format=r,u._engine=o.getEngine(),u._texture=o.getEngine().createRawTexture(t,i,n,r,s,a,c,null,l),u.wrapU=ke.a.CLAMP_ADDRESSMODE,u.wrapV=ke.a.CLAMP_ADDRESSMODE,u}return l.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,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,_.a.TEXTUREFORMAT_LUMINANCE,r,o,s,a)},t.CreateLuminanceAlphaTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,_.a.TEXTUREFORMAT_LUMINANCE_ALPHA,r,o,s,a)},t.CreateAlphaTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,_.a.TEXTUREFORMAT_ALPHA,r,o,s,a)},t.CreateRGBTexture=function(e,i,n,r,o,s,a,c){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=_.a.TEXTURETYPE_UNSIGNED_INT),new t(e,i,n,_.a.TEXTUREFORMAT_RGB,r,o,s,a,c)},t.CreateRGBATexture=function(e,i,n,r,o,s,a,c){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=_.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=_.a.TEXTURETYPE_UNSIGNED_INT),new t(e,i,n,_.a.TEXTUREFORMAT_RGBA,r,o,s,a,c)},t.CreateRTexture=function(e,i,n,r,o,s,a,c){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=ke.a.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=_.a.TEXTURETYPE_FLOAT),new t(e,i,n,_.a.TEXTUREFORMAT_R,r,o,s,a,c)},t}(ke.a),He=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=o.j.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 r.c,this.bones=[],this._scene=i||P.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&&!this.needInitialSkinMatrix},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(){return 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 s=this._ranges[o];if(s){var a={};a.name=o,a.from=s.from,a.to=s.to,e.ranges.push(a)}}}return e},e.Parse=function(t,i){var n,r=new e(t.name,t.id,i);for(t.dimensionsAtRest&&(r.dimensionsAtRest=o.x.FromArray(t.dimensionsAtRest)),r.needInitialSkinMatrix=t.needInitialSkinMatrix,n=0;n-1&&(a=r.bones[s.parentBoneIndex]);var c=s.rest?o.j.FromArray(s.rest):null,l=new K(s.name,r,a,o.j.FromArray(s.matrix),c);void 0!==s.id&&null!==s.id&&(l.id=s.id),s.length&&(l.length=s.length),s.metadata&&(l.metadata=s.metadata),s.animation&&l.animations.push(B.Parse(s.animation)),void 0!==s.linkedTransformNodeId&&null!==s.linkedTransformNodeId&&(r._hasWaitingData=!0,l._waitingTransformNodeId=s.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}(),Qe=function(e){function t(t,i,n){var o=e.call(this,t,i,n)||this;return o.onButtonDownObservable=new r.c,o.onButtonUpObservable=new r.c,o.type=Ke.GENERIC,o._buttons=new Array(n.buttons.length),o}return l.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"},l.c([Object(L.c)()],e.prototype,"gamepadRotationSensibility",void 0),l.c([Object(L.c)()],e.prototype,"gamepadMoveSensibility",void 0),e}();We.ArcRotateCameraGamepadInput=qe;var Ze=i(51),Je=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===Ze.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===Pe.a.POINTERWHEEL){var r=e.event,o=0,s=r;if(s.wheelDelta)if(i.wheelDeltaPercentage){if((o=i.computeDeltaFromMouseWheelLegacyEvent(s,i.camera.radius))>0){for(var a=i.camera.radius,c=i.camera.inertialRadiusOffset+o,l=0;l<20&&Math.abs(c)>.001;l++)a-=c,c*=i.camera.inertia;a=D.a.Clamp(a,0,Number.MAX_VALUE),o=i.computeDeltaFromMouseWheelLegacyEvent(s,a)}}else o=s.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,Pe.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"},l.c([Object(L.c)()],e.prototype,"wheelPrecision",void 0),l.c([Object(L.c)()],e.prototype,"wheelDeltaPercentage",void 0),e}();We.ArcRotateCameraMouseWheelInput=$e;var et=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(s,a){var c=s.event,l="touch"===c.pointerType;if(!n.isInVRExclusivePointerMode&&(s.type===Pe.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(s.type===Pe.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(s.type===Pe.a.POINTERDOUBLETAP)i.onDoubleTap(c.pointerType);else if(s.type===Pe.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(s.type===Pe.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,g=p*p+_*_,m={x:(i.pointA.x+i.pointB.x)/2,y:(i.pointA.y+i.pointB.y)/2,pointerId:c.pointerId,type:s.type};i.onMultiTouch(i.pointA,i.pointB,r,g,o,m),o=m,r=g}}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,Pe.a.POINTERDOWN|Pe.a.POINTERUP|Pe.a.POINTERMOVE),this._onLostFocus=function(){i.pointA=i.pointB=null,r=0,o=null,i.onLostFocus()},e.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),ye.h.RegisterTopRootEvents([{name:"blur",handler:this._onLostFocus}])},e.prototype.detachControl=function(e){this._onLostFocus&&ye.h.UnregisterTopRootEvents([{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(){},l.c([Object(L.c)()],e.prototype,"buttons",void 0),e}(),tt=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 l.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 s=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*s*(this.angularSensibilityX+this.angularSensibilityY)/2),0!==this.panningSensibility&&r&&o){var a=o.x-r.x,c=o.y-r.y;this.camera.inertialPanningX+=-a/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*s*(this.angularSensibilityX+this.angularSensibilityY)/2),this._isPinching=!0;else if(0!==this.panningSensibility&&this.multiTouchPanning&&o&&r){a=o.x-r.x,c=o.y-r.y;this.camera.inertialPanningX+=-a/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},l.c([Object(L.c)()],t.prototype,"buttons",void 0),l.c([Object(L.c)()],t.prototype,"angularSensibilityX",void 0),l.c([Object(L.c)()],t.prototype,"angularSensibilityY",void 0),l.c([Object(L.c)()],t.prototype,"pinchPrecision",void 0),l.c([Object(L.c)()],t.prototype,"pinchDeltaPercentage",void 0),l.c([Object(L.c)()],t.prototype,"panningSensibility",void 0),l.c([Object(L.c)()],t.prototype,"multiTouchPanning",void 0),l.c([Object(L.c)()],t.prototype,"multiTouchPanAndZoom",void 0),t}(et);We.ArcRotateCameraPointersInput=tt;var it=function(e){function t(t){return e.call(this,t)||this}return l.d(t,e),t.prototype.addMouseWheel=function(){return this.add(new $e),this},t.prototype.addPointers=function(){return this.add(new tt),this},t.prototype.addKeyboard=function(){return this.add(new Je),this},t}(Xe);it.prototype.addVRDeviceOrientation=function(){return this.add(new nt),this};var nt=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),window.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}();We.ArcRotateCameraVRDeviceOrientationInput=nt;var rt=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===Ze.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},l.c([Object(L.c)()],e.prototype,"keysHeightOffsetIncr",void 0),l.c([Object(L.c)()],e.prototype,"keysHeightOffsetDecr",void 0),l.c([Object(L.c)()],e.prototype,"keysHeightOffsetModifierAlt",void 0),l.c([Object(L.c)()],e.prototype,"keysHeightOffsetModifierCtrl",void 0),l.c([Object(L.c)()],e.prototype,"keysHeightOffsetModifierShift",void 0),l.c([Object(L.c)()],e.prototype,"keysRotationOffsetIncr",void 0),l.c([Object(L.c)()],e.prototype,"keysRotationOffsetDecr",void 0),l.c([Object(L.c)()],e.prototype,"keysRotationOffsetModifierAlt",void 0),l.c([Object(L.c)()],e.prototype,"keysRotationOffsetModifierCtrl",void 0),l.c([Object(L.c)()],e.prototype,"keysRotationOffsetModifierShift",void 0),l.c([Object(L.c)()],e.prototype,"keysRadiusIncr",void 0),l.c([Object(L.c)()],e.prototype,"keysRadiusDecr",void 0),l.c([Object(L.c)()],e.prototype,"keysRadiusModifierAlt",void 0),l.c([Object(L.c)()],e.prototype,"keysRadiusModifierCtrl",void 0),l.c([Object(L.c)()],e.prototype,"keysRadiusModifierShift",void 0),l.c([Object(L.c)()],e.prototype,"heightSensibility",void 0),l.c([Object(L.c)()],e.prototype,"rotationSensibility",void 0),l.c([Object(L.c)()],e.prototype,"radiusSensibility",void 0),e}();We.FollowCameraKeyboardMoveInput=st;var at=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===Pe.a.POINTERWHEEL){var r=e.event,o=0,s=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*s*i.wheelDeltaPercentage*i.camera.radius:i.axisControlHeight?o=.01*s*i.wheelDeltaPercentage*i.camera.heightOffset:i.axisControlRotation&&(o=.01*s*i.wheelDeltaPercentage*i.camera.rotationOffset)):o=s*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,Pe.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"},l.c([Object(L.c)()],e.prototype,"axisControlRadius",void 0),l.c([Object(L.c)()],e.prototype,"axisControlHeight",void 0),l.c([Object(L.c)()],e.prototype,"axisControlRotation",void 0),l.c([Object(L.c)()],e.prototype,"wheelPrecision",void 0),l.c([Object(L.c)()],e.prototype,"wheelDeltaPercentage",void 0),e}();We.FollowCameraMouseWheelInput=at;var ct=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 l.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 s=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2);this.pinchDeltaPercentage?(s*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=s*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=s*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=s*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=s),this.axisPinchControlHeight&&(this.camera.heightOffset+=s),this.axisPinchControlRadius&&(this.camera.radius-=s))}},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)}},l.c([Object(L.c)()],t.prototype,"angularSensibilityX",void 0),l.c([Object(L.c)()],t.prototype,"angularSensibilityY",void 0),l.c([Object(L.c)()],t.prototype,"pinchPrecision",void 0),l.c([Object(L.c)()],t.prototype,"pinchDeltaPercentage",void 0),l.c([Object(L.c)()],t.prototype,"axisXControlRadius",void 0),l.c([Object(L.c)()],t.prototype,"axisXControlHeight",void 0),l.c([Object(L.c)()],t.prototype,"axisXControlRotation",void 0),l.c([Object(L.c)()],t.prototype,"axisYControlRadius",void 0),l.c([Object(L.c)()],t.prototype,"axisYControlHeight",void 0),l.c([Object(L.c)()],t.prototype,"axisYControlRotation",void 0),l.c([Object(L.c)()],t.prototype,"axisPinchControlRadius",void 0),l.c([Object(L.c)()],t.prototype,"axisPinchControlHeight",void 0),l.c([Object(L.c)()],t.prototype,"axisPinchControlRotation",void 0),t}(et);We.FollowCameraPointersInput=ct;var lt=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===Ze.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 o.x(0,0,t*this._offsetY/this.touchMoveSensibility);o.j.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(o.x.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},l.c([Object(L.c)()],e.prototype,"touchAngularSensibility",void 0),l.c([Object(L.c)()],e.prototype,"touchMoveSensibility",void 0),e}();We.FreeCameraTouchInput=ht;var dt=function(e){function t(t){var i=e.call(this,t)||this;return i._mouseInput=null,i}return l.d(t,e),t.prototype.addKeyboard=function(){return this.add(new lt),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new ut(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 ht),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(Xe);dt.prototype.addDeviceOrientation=function(){return this._deviceOrientationInput||(this._deviceOrientationInput=new ft,this.add(this._deviceOrientationInput)),this};var ft=function(){function e(){var e=this;this._screenOrientationAngle=0,this._screenQuaternion=new o.q,this._alpha=0,this._beta=0,this._gamma=0,this._onDeviceOrientationChangedObservable=new r.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=-ye.h.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 o.q(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}return 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 o.q),this._camera&&this._camera.onDisposeObservable.add(function(){t._onDeviceOrientationChangedObservable.clear()})},enumerable:!0,configurable:!0}),e.prototype.attachControl=function(e,t){window.addEventListener("orientationchange",this._orientationChanged),window.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&&(o.q.RotationYawPitchRollToRef(ye.h.ToRadians(this._alpha),ye.h.ToRadians(this._beta),-ye.h.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}();We.FreeCameraDeviceOrientationInput=ft;var pt=function(){function e(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this._cameraTransform=o.j.Identity(),this._deltaTransform=o.x.Zero(),this._vector3=o.x.Zero(),this._vector2=o.w.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!==Ke.POSE_ENABLED&&(i.gamepad&&e.type!==Ke.XBOX||(i.gamepad=e))}),this._onGamepadDisconnectedObserver=n.onGamepadDisconnectedObservable.add(function(e){i.gamepad===e&&(i.gamepad=null)}),this.gamepad=n.getGamepadByType(Ke.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 s=r.x/this.gamepadAngularSensibility,a=r.y/this.gamepadAngularSensibility;r.x=Math.abs(s)>.001?0+s:0,r.y=Math.abs(a)>.001?0+a:0}else r={x:0,y:0};e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):o.j.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),o.x.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"},l.c([Object(L.c)()],e.prototype,"gamepadAngularSensibility",void 0),l.c([Object(L.c)()],e.prototype,"gamepadMoveSensibility",void 0),e}();We.FreeCameraGamepadInput=pt;var _t,gt=i(61);!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(_t||(_t={}));var mt=function(){function e(t){var i=this;if(this._leftJoystick=!!t,e._globalJoystickIndex++,this._axisTargetedByLeftAndRight=_t.X,this._axisTargetedByUpAndDown=_t.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new gt.a,this.deltaPosition=o.x.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 o.w(0,0),this._joystickPreviousPointerPos=new o.w(0,0),this._joystickPointerStartPos=new o.w(0,0),this._deltaJoystickVector=new o.w(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 _t.X:this.deltaPosition.x=Math.min(1,Math.max(-1,t));break;case _t.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,t));break;case _t.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 _t.X:this.deltaPosition.x=Math.min(1,Math.max(-1,i));break;case _t.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,i));break;case _t.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 _t.X:case _t.Y:case _t.Z:this._axisTargetedByLeftAndRight=e;break;default:this._axisTargetedByLeftAndRight=_t.X}},e.prototype.setAxisForUpDown=function(e){switch(e){case _t.X:case _t.Y:case _t.Z:this._axisTargetedByUpAndDown=e;break;default:this._axisTargetedByUpAndDown=_t.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}();dt.prototype.addVirtualJoystick=function(){return this.add(new vt),this};var vt=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=o.j.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),n=o.x.TransformCoordinates(new o.x(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(_t.Z),this._leftjoystick.setAxisForLeftRight(_t.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new mt(!1),this._rightjoystick.setAxisForUpDown(_t.X),this._rightjoystick.setAxisForLeftRight(_t.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}();We.FreeCameraVirtualJoystickInput=vt;var yt=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var s=e.call(this,t,i,n,r)||this;return s.cameraDirection=new o.x(0,0,0),s.cameraRotation=new o.w(0,0),s.updateUpVectorFromRotation=!1,s._tmpQuaternion=new o.q,s.rotation=new o.x(0,0,0),s.speed=2,s.noRotationConstraint=!1,s.lockedTarget=null,s._currentTarget=o.x.Zero(),s._initialFocalDistance=1,s._viewMatrix=o.j.Zero(),s._camMatrix=o.j.Zero(),s._cameraTransformMatrix=o.j.Zero(),s._cameraRotationMatrix=o.j.Zero(),s._referencePoint=new o.x(0,0,1),s._transformedReferencePoint=o.x.Zero(),s._globalCurrentTarget=o.x.Zero(),s._globalCurrentUpVector=o.x.Zero(),s._defaultUp=o.x.Up(),s._cachedRotationZ=0,s._cachedQuaternionRotationZ=0,s}return l.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 o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new o.q(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+=o.h),o.j.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&&o.q.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(o.t.Matrix[0]),o.x.TransformNormalToRef(this.cameraDirection,o.t.Matrix[0],o.t.Vector3[0]),void this.position.addInPlace(o.t.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()&&o.q.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion);if(!this.noRotationConstraint){var n=Math.PI/2*.95;this.rotation.x>n&&(this.rotation.x=n),this.rotation.x<-n&&(this.rotation.x=-n)}}t&&(Math.abs(this.cameraDirection.x)ge.b.CollisionsEpsilon&&(s.position.addInPlace(s._diffPosition),s.onCollide&&i&&s.onCollide(i))},s.inputs=new dt(s),s.inputs.addKeyboard().addMouse(),s}return l.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 o.x(0,0,0),this.cameraRotation=new o.w(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?o.x.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=o.x.Zero(),this._transformedDirection=o.x.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"},l.c([Object(L.o)()],t.prototype,"ellipsoid",void 0),l.c([Object(L.o)()],t.prototype,"ellipsoidOffset",void 0),l.c([Object(L.c)()],t.prototype,"checkCollisions",void 0),l.c([Object(L.c)()],t.prototype,"applyGravity",void 0),t}(yt);F.a.AddNodeConstructor("TouchCamera",function(e,t){return function(){return new Tt(e,o.x.Zero(),t)}});var Tt=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addTouch(),r._setupInputs(),r}return l.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}(bt);F.a.AddNodeConstructor("ArcRotateCamera",function(e,t){return function(){return new Et(e,0,0,1,o.x.Zero(),t)}});var Et=function(e){function t(t,i,n,s,a,c,l){void 0===l&&(l=!0);var u=e.call(this,t,o.x.Zero(),c,l)||this;return u._upVector=o.x.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=o.x.Zero(),u.panningInertia=.9,u.zoomOnFactor=1,u.targetScreenOffset=o.w.Zero(),u.allowUpsideDown=!0,u.useInputToRestoreState=!0,u._viewMatrix=new o.j,u.panningAxis=new o.x(1,1,0),u.onMeshTargetChangedObservable=new r.c,u.checkCollisions=!1,u.collisionRadius=new o.x(.5,.5,.5),u._previousPosition=o.x.Zero(),u._collisionVelocity=o.x.Zero(),u._newPosition=o.x.Zero(),u._computationVector=o.x.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),s=Math.sin(u.beta);0===s&&(s=1e-4);var a=u._getTargetPosition();u._computationVector.copyFromFloats(u.radius*n*s,u.radius*o,u.radius*r*s),a.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,a,c),u._viewMatrix.addAtIndex(12,u.targetScreenOffset.x),u._viewMatrix.addAtIndex(13,u.targetScreenOffset.y),u._collisionTriggered=!1},u._target=o.x.Zero(),a&&u.setTarget(a),u.alpha=i,u.beta=n,u.radius=s,u.getViewMatrix(),u.inputs=new it(u),u.inputs.addKeyboard().addMouseWheel().addPointers(),u}return l.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 o.j,this._upToYMatrix=new o.j,this._upVector=o.x.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!0,configurable:!0}),t.prototype.setMatUp=function(){o.j.RotationAlignToRef(o.x.UpReadOnly,this._upVector,this._YToUpMatrix),o.j.RotationAlignToRef(this._upVector,o.x.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 Ce,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 Me,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 Se,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 o.x(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=o.w.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(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.setTarget(this._storedTarget.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||o.x.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||o.x.TransformCoordinatesToRef(this._computationVector,this._YToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var s=this.getScene().collisionCoordinator;this._collider||(this._collider=s.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,s.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var a=this.upVector;this.allowUpsideDown&&n<0&&(a=(a=a.clone()).negate()),this._computeViewMatrix(this._position,r,a),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=fe.a.MinMax(e),n=o.x.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=fe.a.MinMax(r),n=o.x.Distance(i.min,i.max)}else{i=e,n=e.distance}this._target=fe.a.Center(i),t||(this.maxZ=2*n)},t.prototype.createRigCamera=function(e,i){var n=0;switch(this.cameraRigMode){case Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ne.a.RIG_MODE_VR:n=this._cameraRigParams.stereoHalfAngle*(0===i?1:-1);break;case Ne.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 Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ne.a.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case Ne.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"},l.c([Object(L.c)()],t.prototype,"alpha",void 0),l.c([Object(L.c)()],t.prototype,"beta",void 0),l.c([Object(L.c)()],t.prototype,"radius",void 0),l.c([Object(L.o)("target")],t.prototype,"_target",void 0),l.c([Object(L.o)("upVector")],t.prototype,"_upVector",void 0),l.c([Object(L.c)()],t.prototype,"inertialAlphaOffset",void 0),l.c([Object(L.c)()],t.prototype,"inertialBetaOffset",void 0),l.c([Object(L.c)()],t.prototype,"inertialRadiusOffset",void 0),l.c([Object(L.c)()],t.prototype,"lowerAlphaLimit",void 0),l.c([Object(L.c)()],t.prototype,"upperAlphaLimit",void 0),l.c([Object(L.c)()],t.prototype,"lowerBetaLimit",void 0),l.c([Object(L.c)()],t.prototype,"upperBetaLimit",void 0),l.c([Object(L.c)()],t.prototype,"lowerRadiusLimit",void 0),l.c([Object(L.c)()],t.prototype,"upperRadiusLimit",void 0),l.c([Object(L.c)()],t.prototype,"inertialPanningX",void 0),l.c([Object(L.c)()],t.prototype,"inertialPanningY",void 0),l.c([Object(L.c)()],t.prototype,"pinchToPanMaxDistance",void 0),l.c([Object(L.c)()],t.prototype,"panningDistanceLimit",void 0),l.c([Object(L.o)()],t.prototype,"panningOriginTarget",void 0),l.c([Object(L.c)()],t.prototype,"panningInertia",void 0),l.c([Object(L.c)()],t.prototype,"zoomOnFactor",void 0),l.c([Object(L.c)()],t.prototype,"targetScreenOffset",void 0),l.c([Object(L.c)()],t.prototype,"allowUpsideDown",void 0),l.c([Object(L.c)()],t.prototype,"useInputToRestoreState",void 0),t}(yt);F.a.AddNodeConstructor("DeviceOrientationCamera",function(e,t){return function(){return new At(e,o.x.Zero(),t)}});var At=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r._tmpDragQuaternion=new o.q,r._disablePointerInputWhenUsingDeviceOrientation=!0,r._dragFactor=0,r._quaternionCache=new o.q,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 o.q),o.q.FromEulerAnglesToRef(0,e.offsetX*r._dragFactor,0,r._tmpDragQuaternion),r._initialQuaternion.multiplyToRef(r._tmpDragQuaternion,r._initialQuaternion))}))}),r}return l.d(t,e),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=o.c.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new o.q),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}(bt),xt=function(e){function t(t){return e.call(this,t)||this}return l.d(t,e),t.prototype.addKeyboard=function(){return this.add(new rt),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this.add(new ot(e)),this},t}(Xe),Rt=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var s=e.call(this,t,i,n,r)||this;return s.ellipsoid=new o.x(1,1,1),s.ellipsoidOffset=new o.x(0,0,0),s.checkCollisions=!1,s.applyGravity=!1,s.cameraDirection=o.x.Zero(),s._trackRoll=0,s.rollCorrect=100,s.bankedTurn=!1,s.bankedTurnLimit=Math.PI/2,s.bankedTurnMultiplier=1,s._needMoveForGravity=!1,s._oldPosition=o.x.Zero(),s._diffPosition=o.x.Zero(),s._newPosition=o.x.Zero(),s._collisionMask=-1,s._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null);var n;n=t,s._newPosition.copyFrom(n),s._newPosition.subtractToRef(s._oldPosition,s._diffPosition),s._diffPosition.length()>ge.b.CollisionsEpsilon&&(s.position.addInPlace(s._diffPosition),s.onCollide&&i&&s.onCollide(i))},s.inputs=new xt(s),s.inputs.addKeyboard().addMouse(),s}return l.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 o.x(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?o.x.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=o.x.Zero(),this._transformedDirection=o.x.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"},l.c([Object(L.o)()],t.prototype,"ellipsoid",void 0),l.c([Object(L.o)()],t.prototype,"ellipsoidOffset",void 0),l.c([Object(L.c)()],t.prototype,"checkCollisions",void 0),l.c([Object(L.c)()],t.prototype,"applyGravity",void 0),t}(yt),Pt=function(e){function t(t){return e.call(this,t)||this}return l.d(t,e),t.prototype.addKeyboard=function(){return this.add(new st),this},t.prototype.addMouseWheel=function(){return this.add(new at),this},t.prototype.addPointers=function(){return this.add(new ct),this},t.prototype.addVRDeviceOrientation=function(){return console.warn("DeviceOrientation support not yet implemented for FollowCamera."),this},t}(Xe);F.a.AddNodeConstructor("FollowCamera",function(e,t){return function(){return new Ct(e,o.x.Zero(),t)}}),F.a.AddNodeConstructor("ArcFollowCamera",function(e,t){return function(){return new Mt(e,0,0,1,null,t)}});var St,Ct=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 Pt(o),o.inputs.addKeyboard().addMouseWheel().addPointers(),o}return l.d(t,e),t.prototype._follow=function(e){if(e){var t;if(e.rotationQuaternion){var i=new o.j;e.rotationQuaternion.toRotationMatrix(i),t=Math.atan2(i.m[8],i.m[10])}else t=e.rotation.y;var n=ye.h.ToRadians(this.rotationOffset)+t,r=e.getAbsolutePosition(),s=r.x+Math.sin(n)*this.radius,a=r.z+Math.cos(n)*this.radius,c=s-this.position.x,l=r.y+this.heightOffset-this.position.y,u=a-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 o.x(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"},l.c([Object(L.c)()],t.prototype,"radius",void 0),l.c([Object(L.c)()],t.prototype,"lowerRadiusLimit",void 0),l.c([Object(L.c)()],t.prototype,"upperRadiusLimit",void 0),l.c([Object(L.c)()],t.prototype,"rotationOffset",void 0),l.c([Object(L.c)()],t.prototype,"lowerRotationOffsetLimit",void 0),l.c([Object(L.c)()],t.prototype,"upperRotationOffsetLimit",void 0),l.c([Object(L.c)()],t.prototype,"heightOffset",void 0),l.c([Object(L.c)()],t.prototype,"lowerHeightOffsetLimit",void 0),l.c([Object(L.c)()],t.prototype,"upperHeightOffsetLimit",void 0),l.c([Object(L.c)()],t.prototype,"cameraAcceleration",void 0),l.c([Object(L.c)()],t.prototype,"maxCameraSpeed",void 0),l.c([Object(L.k)("lockedTargetId")],t.prototype,"lockedTarget",void 0),t}(yt),Mt=function(e){function t(t,i,n,r,s,a){var c=e.call(this,t,o.x.Zero(),a)||this;return c.alpha=i,c.beta=n,c.radius=r,c.target=s,c._cartesianCoordinates=o.x.Zero(),c._follow(),c}return l.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}(yt),Ot=i(35),It=i(39);!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"}(St||(St={}));var Dt,Lt,wt=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),s=Math.cos(-n);this._calculatedPosition.x=this._calculatedPosition.x*s-this._calculatedPosition.z*r,this._calculatedPosition.z=this._calculatedPosition.x*r+this._calculatedPosition.z*s}}o.x.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),o.q.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(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&&(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 o.q),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 It.a(o.x.Zero(),new o.x(0,0,1),e);var t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),n=new o.x(0,0,-1),r=o.x.TransformNormal(n,t),s=o.x.Normalize(r);return new It.a(i,s,e)},t.POINTING_POSE="POINTING_POSE",t}(Ke);!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"}(Dt||(Dt={})),function(e){e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right"}(Lt||(Lt={}));var Nt=function(e){function t(t,i,n,o){void 0===o&&(o=!1);var s=e.call(this,t,i,n,0,1,2,3)||this;return s._leftTrigger=0,s._rightTrigger=0,s.onButtonDownObservable=new r.c,s.onButtonUpObservable=new r.c,s.onPadDownObservable=new r.c,s.onPadUpObservable=new r.c,s._buttonA=0,s._buttonB=0,s._buttonX=0,s._buttonY=0,s._buttonBack=0,s._buttonStart=0,s._buttonLB=0,s._buttonRB=0,s._buttonLeftStick=0,s._buttonRightStick=0,s._dPadUp=0,s._dPadDown=0,s._dPadLeft=0,s._dPadRight=0,s._isXboxOnePad=!1,s.type=Ke.XBOX,s._isXboxOnePad=o,s}return l.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,Dt.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,Dt.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,Dt.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,Dt.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,Dt.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,Dt.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,Dt.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,Dt.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,Dt.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,Dt.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,Lt.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,Lt.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,Lt.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,Lt.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.axes[2],this.rightTrigger=this.browserGamepad.axes[5],this.buttonBack=this.browserGamepad.buttons[9].value,this.buttonStart=this.browserGamepad.buttons[8].value,this.buttonLeftStick=this.browserGamepad.buttons[6].value,this.buttonRightStick=this.browserGamepad.buttons[7].value,this.dPadUp=this.browserGamepad.buttons[11].value,this.dPadDown=this.browserGamepad.buttons[12].value,this.dPadLeft=this.browserGamepad.buttons[13].value,this.dPadRight=this.browserGamepad.buttons[14].value):(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}(Ke),Bt=function(){function e(e){var t=this;this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new r.c,Ot.a.IsWindowObjectExist()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator.getGamepads||navigator.webkitGetGamepads||navigator.msGetGamepads||navigator.webkitGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new r.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&&(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported?(window.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),window.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1)):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=Ke.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}(),Wt="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";zt.a.ShadersStore.passPixelShader=Wt;var Xt="\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}";zt.a.ShadersStore.passCubePixelShader=Xt;var Yt=function(e){function t(t,i,n,r,o,s,a,c){return void 0===n&&(n=null),void 0===a&&(a=_.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1),e.call(this,t,"pass",null,null,i,n,r,o,s,void 0,a,void 0,null,c)||this}return l.d(t,e),t}(Ht),Kt=function(e){function t(t,i,n,r,o,s,a,c){void 0===n&&(n=null),void 0===a&&(a=_.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=e.call(this,t,"passCube",null,null,i,n,r,o,s,"#define POSITIVEX",a,void 0,null,c)||this;return l._face=0,l}return l.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}(Ht);ge.b._RescalePostProcessFactory=function(e){return new Yt("rescale",1,null,ge.b.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,ge.b.TEXTURETYPE_UNSIGNED_INT)};var Qt="\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}";zt.a.ShadersStore.anaglyphPixelShader=Qt;var qt=function(e){function t(t,i,n,r,o,s){var a=e.call(this,t,"anaglyph",null,["leftSampler"],i,n[1],r,o,s)||this;return a._passedProcess=n[0]._rigPostProcess,a.onApplyObservable.add(function(e){e.setTextureFromPostProcess("leftSampler",a._passedProcess)}),a}return l.d(t,e),t}(Ht);Ne.a._setStereoscopicAnaglyphRigMode=function(e){e._rigCameras[0]._rigPostProcess=new Yt(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new qt(e.name+"_anaglyph",1,e._rigCameras)},F.a.AddNodeConstructor("AnaglyphArcRotateCamera",function(e,t,i){return function(){return new Zt(e,0,0,1,o.x.Zero(),i.interaxial_distance,t)}});var Zt=function(e){function t(t,i,n,r,o,s,a){var c=e.call(this,t,i,n,r,o,a)||this;return c.interaxialDistance=s,c.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:s}),c}return l.d(t,e),t.prototype.getClassName=function(){return"AnaglyphArcRotateCamera"},t}(Et);F.a.AddNodeConstructor("AnaglyphFreeCamera",function(e,t,i){return function(){return new Jt(e,o.x.Zero(),i.interaxial_distance,t)}});var Jt=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return l.d(t,e),t.prototype.getClassName=function(){return"AnaglyphFreeCamera"},t}(bt);F.a.AddNodeConstructor("AnaglyphGamepadCamera",function(e,t,i){return function(){return new $t(e,o.x.Zero(),i.interaxial_distance,t)}});var $t=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return l.d(t,e),t.prototype.getClassName=function(){return"AnaglyphGamepadCamera"},t}(Gt);F.a.AddNodeConstructor("AnaglyphUniversalCamera",function(e,t,i){return function(){return new ei(e,o.x.Zero(),i.interaxial_distance,t)}});var ei=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return l.d(t,e),t.prototype.getClassName=function(){return"AnaglyphUniversalCamera"},t}(Vt),ti="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}";zt.a.ShadersStore.stereoscopicInterlacePixelShader=ti;var ii=function(e){function t(t,i,n,r,s,a){var c=e.call(this,t,"stereoscopicInterlace",["stepSize"],["camASampler"],1,i[1],r,s,a,n?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return c._passedProcess=i[0]._rigPostProcess,c._stepSize=new o.w(1/c.width,1/c.height),c.onSizeChangedObservable.add(function(){c._stepSize=new o.w(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 l.d(t,e),t}(Ht);Ne.a._setStereoscopicRigMode=function(e){var t=e.cameraRigMode===Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e._rigCameras[0]._rigPostProcess=new Yt(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new ii(e.name+"_stereoInterlace",e._rigCameras,t)},F.a.AddNodeConstructor("StereoscopicArcRotateCamera",function(e,t,i){return function(){return new ni(e,0,0,1,o.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var ni=function(e){function t(t,i,n,r,o,s,a,c){var l=e.call(this,t,i,n,r,o,c)||this;return l.interaxialDistance=s,l.isStereoscopicSideBySide=a,l.setCameraRigMode(a?Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:s}),l}return l.d(t,e),t.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},t}(Et);F.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new ri(e,o.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var ri=function(e){function t(t,i,n,r,o){var s=e.call(this,t,i,o)||this;return s.interaxialDistance=n,s.isStereoscopicSideBySide=r,s.setCameraRigMode(r?Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),s}return l.d(t,e),t.prototype.getClassName=function(){return"StereoscopicFreeCamera"},t}(bt);F.a.AddNodeConstructor("StereoscopicGamepadCamera",function(e,t,i){return function(){return new oi(e,o.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var oi=function(e){function t(t,i,n,r,o){var s=e.call(this,t,i,o)||this;return s.interaxialDistance=n,s.isStereoscopicSideBySide=r,s.setCameraRigMode(r?Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),s}return l.d(t,e),t.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},t}(Gt);F.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new si(e,o.x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var si=function(e){function t(t,i,n,r,o){var s=e.call(this,t,i,o)||this;return s.interaxialDistance=n,s.isStereoscopicSideBySide=r,s.setCameraRigMode(r?Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),s}return l.d(t,e),t.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},t}(Vt);F.a.AddNodeConstructor("VirtualJoysticksCamera",function(e,t){return function(){return new ai(e,o.x.Zero(),t)}});var ai=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addVirtualJoystick(),r}return l.d(t,e),t.prototype.getClassName=function(){return"VirtualJoysticksCamera"},t}(bt),ci=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 o.j.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 o.j.Translation(-e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftPreViewMatrix",{get:function(){return o.j.Translation(.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightPreViewMatrix",{get:function(){return o.j.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}(),li="\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}";zt.a.ShadersStore.vrDistortionCorrectionPixelShader=li;var ui=function(e){function t(t,i,n,r){var s=e.call(this,t,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,r.postProcessScaleFactor,i,ke.a.BILINEAR_SAMPLINGMODE)||this;return s._isRightEye=n,s._distortionFactors=r.distortionK,s._postProcessScaleFactor=r.postProcessScaleFactor,s._lensCenterOffset=r.lensCenterOffset,s.adaptScaleToCurrentViewport=!0,s.onSizeChangedObservable.add(function(){s._scaleIn=new o.w(2,2/s.aspectRatio),s._scaleFactor=new o.w(1/s._postProcessScaleFactor*.5,1/s._postProcessScaleFactor*.5*s.aspectRatio),s._lensCenter=new o.w(s._isRightEye?.5-.5*s._lensCenterOffset:.5+.5*s._lensCenterOffset,.5)}),s.onApplyObservable.add(function(e){e.setFloat2("LensCenter",s._lensCenter.x,s._lensCenter.y),e.setFloat2("Scale",s._scaleFactor.x,s._scaleFactor.y),e.setFloat2("ScaleIn",s._scaleIn.x,s._scaleIn.y),e.setFloat4("HmdWarpParam",s._distortionFactors[0],s._distortionFactors[1],s._distortionFactors[2],s._distortionFactors[3])}),s}return l.d(t,e),t}(Ht),hi="#ifdef GL_ES\nprecision mediump sampler2DArray;\n#endif\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\nvoid main(void)\n{\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\n}";zt.a.ShadersStore.vrMultiviewToSingleviewPixelShader=hi;var di=i(63),fi=i(83),pi=i(91);ge.b.prototype.createRenderTargetCubeTexture=function(e,t){var i=l.a({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:ge.b.TEXTURETYPE_UNSIGNED_INT,samplingMode:ge.b.TEXTURE_TRILINEAR_SAMPLINGMODE,format:ge.b.TEXTUREFORMAT_RGBA},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(i.type!==ge.b.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==ge.b.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=ge.b.TEXTURE_NEAREST_SAMPLINGMODE);var n=this._gl,r=new ze.a(this,ze.a.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,r,!0);var o=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);i.type!==ge.b.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=ge.b.TEXTURETYPE_UNSIGNED_INT,p.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 s=0;s<6;s++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var a=n.createFramebuffer();return this._bindUnboundFramebuffer(a),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=a,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 _i=function(e){function t(t,i,n,s,a,c,l,u,h,d,f,p,g){void 0===a&&(a=!0),void 0===c&&(c=_.a.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=!1),void 0===u&&(u=ke.a.TRILINEAR_SAMPLINGMODE),void 0===h&&(h=!0),void 0===d&&(d=!1),void 0===f&&(f=!1),void 0===p&&(p=_.a.TEXTUREFORMAT_RGBA),void 0===g&&(g=!1);var m=e.call(this,null,n,!s)||this;return m.isCube=l,m.renderParticles=!0,m.renderSprites=!1,m.coordinatesMode=ke.a.PROJECTION_MODE,m.ignoreCameraViewport=!1,m.onBeforeBindObservable=new r.c,m.onAfterUnbindObservable=new r.c,m.onBeforeRenderObservable=new r.c,m.onAfterRenderObservable=new r.c,m.onClearObservable=new r.c,m._currentRefreshId=-1,m._refreshRate=1,m._samples=1,m.boundingBoxPosition=o.x.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=!!s,m._doNotChangeAspectRatio=a,m._renderingManager=new pi.b(n),m._renderingManager._useSceneAutoClearSetup=!0,f?m:(m._renderTargetOptions={generateMipMaps:s,type:c,format:p,samplingMode:u,generateDepthBuffer:h,generateStencilBuffer:d},u===ke.a.NEAREST_SAMPLINGMODE&&(m.wrapU=ke.a.CLAMP_ADDRESSMODE,m.wrapV=ke.a.CLAMP_ADDRESSMODE),g||(l?(m._texture=n.getEngine().createRenderTargetCubeTexture(m.getRenderSize(),m._renderTargetOptions),m.coordinatesMode=ke.a.INVCUBIC_MODE,m._textureMatrix=o.j.Identity()):m._texture=n.getEngine().createRenderTargetTexture(m._size,m._renderTargetOptions)),m)):m}return l.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))},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),a=this.getScene()){var i,n=a.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),a.incrementRenderId(),a.resetCachedMaterial();else this.renderToTarget(0,u,e,t);this.onAfterUnbindObservable.notifyObservers(this),a.activeCamera&&(this.activeCamera&&this.activeCamera!==a.activeCamera&&a.setTransformMatrix(a.activeCamera.getViewMatrix(),a.activeCamera.getProjectionMatrix(!0)),n.setViewport(a.activeCamera.viewport)),a.resetCachedMaterial()}},t.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=ye.h.NearestPOT(i+16384/(128+i));return Math.min(ye.h.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 s=0,a=r._beforeRenderTargetDrawStage;s=0&&t.customRenderTargets.splice(i,1);for(var n=0,r=t.cameras;n=0&&o.customRenderTargets.splice(i,1)}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}(ke.a);ke.a._CreateRenderTargetTexture=function(e,t,i,n){return new _i(e,t,i,n)};var gi=function(e){function t(t,i){void 0===i&&(i=512);var n=e.call(this,"multiview rtt",i,t,!1,!0,ze.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 l.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}(_i);ge.b.prototype.createMultiviewRenderTargetTexture=function(e,t){var i=this._gl;if(!this.getCaps().multiview)throw"Multiview is not supported";var n=new ze.a(this,ze.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},ge.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)},Ne.a.prototype._useMultiviewToSingleView=!1,Ne.a.prototype._multiviewTexture=null,Ne.a.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new gi(this.getScene(),{width:e,height:t})):this._multiviewTexture=new gi(this.getScene(),{width:e,height:t})},W.a.prototype._transformMatrixR=o.j.Zero(),W.a.prototype._multiviewSceneUbo=null,W.a.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=new di.a(this.getEngine(),void 0,!0),this._multiviewSceneUbo.addUniform("viewProjection",16),this._multiviewSceneUbo.addUniform("viewProjectionR",16),this._multiviewSceneUbo.addUniform("view",16)},W.a.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,o.t.Matrix[0]),o.i.GetRightPlaneToRef(o.t.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())},W.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}(bt),Ai=function(e){function t(t){var i=e.call(this,t)||this;return i.onTriggerStateChangedObservable=new r.c,i.onMainButtonStateChangedObservable=new r.c,i.onSecondaryButtonStateChangedObservable=new r.c,i.onPadStateChangedObservable=new r.c,i.onPadValuesChangedObservable=new r.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 l.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}");zt.a.ShadersStore.imageProcessingPixelShader=Si;var Ci=function(e){function t(t,i,n,r,o,s,a,c){void 0===n&&(n=null),void 0===a&&(a=_.a.TEXTURETYPE_UNSIGNED_INT);var l=e.call(this,t,"imageProcessing",[],[],i,n,r,o,s,null,a,"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 l.d(t,e),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){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 s=r.scenes;n=s[s.length-1]}else n=P.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"];xi.a&&(xi.a.PrepareSamplers(i,this._defines),xi.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)},l.c([Object(L.c)()],t.prototype,"_fromLinearSpace",void 0),t}(Ht),Mi=i(13),Oi=i(4);fe.a._GroundMeshParser=function(e,t){return Ii.Parse(e,t)};var Ii=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.generateOctree=!1,n}return l.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=o.t.Matrix[5];i.invertToRef(n);var r=o.t.Vector3[8];if(o.x.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 s=this._getFacetAt(e,t),a=-(s.x*e+s.z*t+s.w)/s.y;return o.x.TransformCoordinatesFromFloatsToRef(0,a,0,i,r),r.y},t.prototype.getNormalAtCoordinates=function(e,t){var i=new o.x(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},t.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var n=this.getWorldMatrix(),r=o.t.Matrix[5];n.invertToRef(r);var s=o.t.Vector3[8];if(o.x.TransformCoordinatesFromFloatsToRef(e,0,t,r,s),e=s.x,t=s.z,ethis._maxX||tthis._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var a=this._getFacetAt(e,t);return o.x.TransformNormalFromFloatsToRef(a.x,a.y,a.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){u=!0;var h=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=h}for(t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var d=new o.x(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),f=4*(((d.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(d.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),p=e.buffer[f]/255,_=e.buffer[f+1]/255,g=e.buffer[f+2]/255,m=e.buffer[f+3]/255;u&&(p=1-p,_=1-_,g=1-g);var v=p*c.r+_*c.g+g*c.b;d.y=m>=l?e.minHeight+(e.maxHeight-e.minHeight)*v:e.minHeight-o.h,r.push(d.x,d.y,d.z),s.push(0,0,0),a.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t=e.minHeight,x=r[3*b+1]>=e.minHeight,R=r[3*T+1]>=e.minHeight;A&&x&&R&&(n.push(y),n.push(b),n.push(T)),r[3*E+1]>=e.minHeight&&A&&R&&(n.push(E),n.push(y),n.push(T))}Mi.a.ComputeNormals(r,n,s);var P=new Mi.a;return P.indices=n,P.positions=r,P.normals=s,P.uvs=a,P},fe.a.CreateGround=function(e,t,i,n,r,o){var s={width:t,height:i,subdivisions:n,updatable:o};return Di.CreateGround(e,s,r)},fe.a.CreateTiledGround=function(e,t,i,n,r,o,s,a,c){var l={xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:o,precision:s,updatable:c};return Di.CreateTiledGround(e,l,a)},fe.a.CreateGroundFromHeightMap=function(e,t,i,n,r,o,s,a,c,l,u){var h={width:i,height:n,subdivisions:r,minHeight:o,maxHeight:s,updatable:c,onReady:l,alphaFilter:u};return Di.CreateGroundFromHeightMap(e,t,h,a)};var Di=function(){function e(){}return e.CreateGround=function(e,t,i){var n=new Ii(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,Mi.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 fe.a(e,i);return Mi.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,s=i.height||10,a=i.subdivisions||1,c=i.minHeight||0,l=i.maxHeight||1,u=i.colorFilter||new o.e(.3,.59,.11),h=i.alphaFilter||0,d=i.updatable,f=i.onReady;n=n||P.a.LastCreatedScene;var p=new Ii(e,n);p._subdivisionsX=a,p._subdivisionsY=a,p._width=r,p._height=s,p._maxX=p._width/2,p._maxZ=p._height/2,p._minX=-p._maxX,p._minZ=-p._maxZ,p._setReady(!1);return ye.h.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 o=e.width,_=e.height;t.width=o,t.height=_,i.drawImage(e,0,0);var g=i.getImageData(0,0,o,_).data;Mi.a.CreateGroundFromHeightMap({width:r,height:s,subdivisions:a,minHeight:c,maxHeight:l,colorFilter:u,buffer:g,bufferWidth:o,bufferHeight:_,alphaFilter:h}).applyToMesh(p,d),f&&f(p),p._setReady(!0)}},function(){},n.offlineProvider),p},e}();Mi.a.CreateTorus=function(e){for(var t=[],i=[],n=[],r=[],s=e.diameter||1,a=e.thickness||.5,c=e.tessellation||16,l=0===e.sideOrientation?0:e.sideOrientation||Mi.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=o.j.Translation(s/2,0,0).multiply(o.j.RotationY(f)),_=0;_<=c;_++){var g=1-_/c,m=_*Math.PI*2/c+Math.PI,v=Math.cos(m),y=Math.sin(m),b=new o.x(v,y,0),T=b.scale(a/2),E=new o.w(d,g);T=o.x.TransformCoordinates(T,p),b=o.x.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,x=(_+1)%u;t.push(h*u+_),t.push(h*u+x),t.push(A*u+_),t.push(h*u+x),t.push(A*u+x),t.push(A*u+_)}Mi.a._ComputeSides(l,i,t,n,r,e.frontUVs,e.backUVs);var R=new Mi.a;return R.indices=t,R.positions=i,R.normals=n,R.uvs=r,R},fe.a.CreateTorus=function(e,t,i,n,r,o,s){var a={diameter:t,thickness:i,tessellation:n,sideOrientation:s,updatable:o};return wi.CreateTorus(e,a,r)};var Li,wi=function(){function e(){}return e.CreateTorus=function(e,t,i){var n=new fe.a(e,i);return t.sideOrientation=fe.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,Mi.a.CreateTorus(t).applyToMesh(n,t.updatable),n},e}(),Fi=i(53),Ni=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=fe.a.CreateTorus("gazeTracker",.0035,.0025,20,t,!1),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;var n=new Ri.a("targetMat",t);n.specularColor=o.e.Black(),n.emissiveColor=new o.e(.7,.7,.7),n.backFaceCulling=!1,this._gazeTracker.material=n}}return e.prototype._getForwardRay=function(e){return new It.a(o.x.Zero(),new o.x(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}(),Bi=function(e){function t(t,i,n){var r=e.call(this,i,n)||this;r.webVRController=t,r._laserPointer=fe.a.CreateCylinder("laserPointer",1,.004,2e-4,20,1,i,!1);var s=new Ri.a("laserPointerMat",i);if(s.emissiveColor=new o.e(.7,.7,.7),s.alpha=.6,r._laserPointer.material=s,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 fe.a("preloadControllerMesh",i),c=new fe.a(Ft.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 l.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}(Ni),Ui=function(e){function t(t,i){var n=e.call(this,i)||this;return n.getCamera=t,n}return l.d(t,e),t.prototype._getForwardRay=function(e){var t=this.getCamera();return t?t.getForwardRay(e):new It.a(o.x.Zero(),o.x.Forward())},t}(Ni),Vi=function(){return function(){}}(),Gi=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.onEnteringVRObservable=new r.c,this.onAfterEnteringVRObservable=new r.c,this.onExitingVRObservable=new r.c,this.onControllerMeshLoadedObservable=new r.c,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._rotationAllowed=!0,this._teleportBackwardsVector=new o.x(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new o.x(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this.onNewMeshSelected=new r.c,this.onNewMeshPicked=new r.c,this.onBeforeCameraTeleport=new r.c,this.onAfterCameraTeleport=new r.c,this.onSelectedMeshUnselected=new r.c,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.requestPointerLockOnFullScreen=!0,this._onResize=function(){i.moveButtonToBottomRight(),i._fullscreenVRpresenting&&i._webVRready&&i.exitVR()},this._onFullscreenChange=function(){var e=document;void 0!==e.fullscreen?i._fullscreenVRpresenting=document.fullscreen:void 0!==e.mozFullScreen?i._fullscreenVRpresenting=e.mozFullScreen:void 0!==e.webkitIsFullScreen?i._fullscreenVRpresenting=e.webkitIsFullScreen:void 0!==e.msIsFullScreen?i._fullscreenVRpresenting=e.msIsFullScreen:void 0!==document.msFullscreenElement&&(i._fullscreenVRpresenting=document.msFullscreenElement),!i._fullscreenVRpresenting&&i._canvas&&(i.exitVR(),i._useCustomVRButton||(i._btnVR.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._castRayAndSelectObject(i._cameraGazer):i._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){if(e.type!==Ke.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===Ke.XBOX&&(e.onbuttondown(function(e){i._interactionsEnabled&&e===Dt.A&&i._cameraGazer._selectionPointerDown()}),e.onbuttonup(function(e){i._interactionsEnabled&&e===Dt.A&&i._cameraGazer._selectionPointerUp()}));else{var t=e,n=new Bi(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 Ai&&("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=o.x.Zero(),this._workingQuaternion=o.q.Identity(),this._workingMatrix=o.j.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 o.x(0,this._defaultHeight,0),t.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new At("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 yt&&this._scene.activeCamera.rotation)){var n=this._scene.activeCamera;n.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(n.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(o.q.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=ci.GetDefault()),t.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new yi("VRDeviceOrientationVRHelper",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new Ei("WebVRHelper",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new Ui(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 s=document.createElement("style");s.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(s),this.moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener("click",function(){i.isInVRMode?i.exitVR():i.enterVR()}),window.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.exitVR(),i._fullscreenVRpresenting&&i._scene.getEngine().exitFullscreen())},Pe.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),window.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 ee,this._circleEase.setEasingMode($.EASINGMODE_EASEINOUT),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,"_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){p.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 p.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(){this._canvas&&!this._useCustomVRButton&&(this._btnVR.style.top=this._canvas.offsetTop+this._canvas.offsetHeight-70+"px",this._btnVR.style.left=this._canvas.offsetLeft+this._canvas.offsetWidth-100+"px")},e.prototype.displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||(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){p.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=o.q.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera){var t=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,i=o.q.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-t,n=this.webVRCamera.rotationQuaternion.toEulerAngles().y;this.webVRCamera.rotationQuaternion=o.q.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){p.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 xi.a;t.vignetteColor=new o.f(0,0,0,0),t.vignetteEnabled=!0,this._postProcessMove=new Ci("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=o.q.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,o.q.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),o.x.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var r=new It.a(n,this._workingVector),s=this._scene.pickWithRay(r,this._raySelectionPredicate);s&&s.pickedPoint&&s.pickedMesh&&this._isTeleportationFloor(s.pickedMesh)&&s.distance<5&&this.teleportCamera(s.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===St.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=fe.a.CreateGround("teleportationTarget",2,2,2,this._scene),this._teleportationTarget.isPickable=!1;var e=new Pi("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 Ri.a("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;var n=fe.a.CreateTorus("torusTeleportation",.75,.1,25,this._scene,!1);n.isPickable=!1,n.parent=this._teleportationTarget;var r=new B("animationInnerCircle","position.y",30,B.ANIMATIONTYPE_FLOAT,B.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 s=new ue;s.setEasingMode($.EASINGMODE_EASEINOUT),r.setEasingFunction(s),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 bt){e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];var i=o.q.FromRotationMatrix(o.j.RotationY(Math.PI/4*this._rotationAngle)),n=new B("animationRotation","rotationQuaternion",90,B.ANIMATIONTYPE_QUATERNION,B.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 s=new B("animationPP","vignetteWeight",90,B.ANIMATIONTYPE_FLOAT,B.ANIMATIONLOOPMODE_CONSTANT),a=[];a.push({frame:0,value:0}),a.push({frame:3,value:4}),a.push({frame:6,value:0}),s.setKeys(a),s.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(s);var c=new B("animationPP2","vignetteStretch",90,B.ANIMATIONTYPE_FLOAT,B.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=o.x.Cross(o.c.Y,n),s=o.x.Cross(n,r);o.x.RotationFromAxisToRef(s,n,r,this._teleportationTarget.rotation)}this._teleportationTarget.position.y+=.1}},e.prototype.teleportCamera=function(e){var t=this;if(this.currentVRCamera instanceof bt){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 B("animationCameraTeleportation","position",90,B.ANIMATIONTYPE_VECTOR3,B.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 B("animationPP","vignetteWeight",90,B.ANIMATIONTYPE_FLOAT,B.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 s=new B("animationPP2","vignetteStretch",90,B.ANIMATIONTYPE_FLOAT,B.ANIMATIONLOOPMODE_CONSTANT),a=[];a.push({frame:0,value:0}),a.push({frame:5,value:10}),a.push({frame:11,value:0}),s.setKeys(a),this._postProcessMove.animations.push(s),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(o.x.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 o.z(0,0,.5,1),this.rigCameras[0].position.x=-e/2,this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new o.z(.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._currentXRFrame||!e._currentXRFrame.getDevicePose)return!1;var n=e._currentXRFrame.getDevicePose(e._frameOfReference);return!(!n||!n.poseModelMatrix)&&(o.j.FromFloat32ArrayToRefScaled(n.poseModelMatrix,0,1,t._TmpMatrix),this._scene.useRightHandedSystem||t._TmpMatrix.toggleModelMatrixHandInPlace(),t._TmpMatrix.getTranslationToRef(this.position),t._TmpMatrix.getRotationMatrixToRef(t._TmpMatrix),o.q.FromRotationMatrixToRef(t._TmpMatrix,this.rotationQuaternion),this.computeWorldMatrix(),this._updateNumberOfRigCameras(e._currentXRFrame.views.length),e._currentXRFrame.views.forEach(function(t,r){o.j.FromFloat32ArrayToRefScaled(n.getViewMatrix(t),0,1,i.rigCameras[r]._computedViewMatrix),o.j.FromFloat32ArrayToRefScaled(t.projectionMatrix,0,1,i.rigCameras[r]._projectionMatrix),i._scene.useRightHandedSystem||(i.rigCameras[r]._computedViewMatrix.toggleModelMatrixHandInPlace(),i.rigCameras[r]._projectionMatrix.toggleProjectionMatrixHandInPlace());var s=e._xrSession.baseLayer.getViewport(t),a=e._xrSession.baseLayer.framebufferWidth,c=e._xrSession.baseLayer.framebufferHeight;i.rigCameras[r].viewport.width=s.width/a,i.rigCameras[r].viewport.height=s.height/c,i.rigCameras[r].viewport.x=s.x/a,i.rigCameras[r].viewport.y=s.y/c,i.rigCameras[r].outputRenderTarget=e._sessionRenderTargetTexture}),!0)},t._TmpMatrix=new o.j,t}(bt),zi=function(){function e(e){this.scene=e,this.onXRFrameObservable=new r.c,this.onXRSessionEnded=new r.c,this._sessionRenderTargetTexture=null,this._tmpMatrix=new o.j}return e.prototype.initializeAsync=function(){var e=this;return p.a.Warn("The WebXR APIs are still under development and are subject to change in the future."),this._xrNavigator=navigator,this._xrNavigator.xr?this._xrNavigator.xr.requestDevice().then(function(t){return e._xrDevice=t,e.scene.getEngine()._gl.setCompatibleXRDevice(e._xrDevice)}):Promise.reject("webXR not supported by this browser")},e.prototype.enterXRAsync=function(t,i){var n=this;return this._xrDevice.requestSession(t).then(function(e){return n._xrSession=e,n._xrSession.addEventListener("end",function(){n._sessionRenderTargetTexture=null,n.scene.getEngine().restoreDefaultFramebuffer(),n.scene.getEngine().customAnimationFrameRequester=null,n.onXRSessionEnded.notifyObservers(null),n.scene.getEngine()._renderLoop()},{once:!0}),n._xrSession.baseLayer=new XRWebGLLayer(n._xrSession,n.scene.getEngine()._gl),n._xrSession.requestFrameOfReference(i)}).then(function(t){n._frameOfReference=t,n.scene.getEngine().customAnimationFrameRequester={requestAnimationFrame:n._xrSession.requestAnimationFrame.bind(n._xrSession),renderFunction:function(e,t){n._currentXRFrame=t,n.onXRFrameObservable.notifyObservers(null),n.scene.getEngine()._renderLoop()}},n._sessionRenderTargetTexture=e._CreateRenderTargetTextureFromSession(n._xrSession,n.scene),window.cancelAnimationFrame(n.scene.getEngine()._frameHandler),n.scene.getEngine()._renderLoop()})},e.prototype.exitXRAsync=function(){return this._xrSession.end()},e.prototype.environmentPointHitTestAsync=function(e){var t=this;return new Promise(function(i){var n=new Float32Array([e.origin.x,e.origin.y,e.origin.z]),r=new Float32Array([e.direction.x,e.direction.y,e.direction.z]);t.scene.useRightHandedSystem||(n[2]*=-1,r[2]*=-1),t._xrSession.requestHitTest(n,r,t._frameOfReference).then(function(e){if(e.length>0){o.j.FromFloat32ArrayToRefScaled(e[0].hitMatrix,0,1,t._tmpMatrix);var n=t._tmpMatrix.getTranslation();t.scene.useRightHandedSystem||(n.z*=-1),i(n)}else i(null)}).catch(function(){i(null)})})},e.prototype.supportsSessionAsync=function(e){return this._xrDevice.supportsSession(e).then(function(){return!0}).catch(function(){return!1})},e._CreateRenderTargetTextureFromSession=function(e,t){var i=new ze.a(t.getEngine(),ze.a.DATASOURCE_UNKNOWN,!0);i.width=e.baseLayer.framebufferWidth,i.height=e.baseLayer.framebufferHeight,i._framebuffer=e.baseLayer.framebuffer;var n=new _i("XR renderTargetTexture",{width:i.width,height:i.height},t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0);return n._texture=i,n},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"}(Li||(Li={}));var ji,Hi=function(){function e(e){this.scene=e,this.state=Li.NOT_IN_XR,this.onStateChangedObservable=new r.c,this._nonVRCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this.camera=new ki("",e),this._sessionManager=new zi(e),this.container=new Fe.a("",e),this.camera.parent=this.container}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(Li.EXITING_XR),this._sessionManager.exitXRAsync()},e.prototype.enterXRAsync=function(e,t){var i=this;if(!this._supported)throw"XR session not supported by this browser";return this._setState(Li.ENTERING_XR),this._sessionManager.enterXRAsync(e,t).then(function(){i._originalSceneAutoClear=i.scene.autoClear,i._nonVRCamera=i.scene.activeCamera,i.scene.autoClear=!1,i.scene.activeCamera=i.camera,i._sessionManager.onXRFrameObservable.add(function(){i.camera.updateFromXRSessionManager(i._sessionManager)}),i._sessionManager.onXRSessionEnded.addOnce(function(){i.camera.rigCameras.forEach(function(e){e.outputRenderTarget=null}),i.scene.autoClear=i._originalSceneAutoClear,i.scene.activeCamera=i._nonVRCamera,i._sessionManager.onXRFrameObservable.clear(),i._setState(Li.NOT_IN_XR)}),i._setState(Li.IN_XR)})},e.prototype.environmentPointHitTestAsync=function(e){return this._sessionManager.environmentPointHitTestAsync(e)},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=o.q.FromEulerVector(this.container.rotation)),this.container.rotationQuaternion.multiplyInPlace(e),this.container.position.rotateByQuaternionAroundPointToRef(e,this.camera.globalPosition,this.container.position)},e.prototype.supportsSessionAsync=function(e){return this._supported?this._sessionManager.supportsSessionAsync(e):Promise.resolve(!1)},e.prototype.dispose=function(){this.camera.dispose(),this.container.dispose(),this.onStateChangedObservable.clear(),this._sessionManager.dispose()},e._TmpVector=new o.x,e}(),Wi=function(){function e(e,t){this.element=e,this.initializationOptions=t}return e.prototype.update=function(e){},e}(),Xi=function(){return function(){}}(),Yi=function(){function e(e,t){var i=this;if(this.scene=e,this._buttons=[],this._activeButton=null,this.activeButtonChangedObservable=new r.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 Wi(n,{immersive:!0,outputContext:t.outputCanvasContext})),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"};var o=document.createElement("button");o.style.cssText=n.style.cssText,o.innerText="Window",this._buttons.push(new Wi(o,{immersive:!1,environmentIntegration:!0,outputContext:t.outputCanvasContext})),this._buttons[this._buttons.length-1].update=function(e){this.element.style.display=null===e||e===this?"":"none",this.element.innerText=e===this?"EXIT":"Window"},this._updateButtons(null)}var s=e.getEngine().getRenderingCanvas();s&&s.parentNode&&(s.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),s=o._buttons.map(function(e){return i.supportsSessionAsync(e.initializationOptions)});return i.onStateChangedObservable.add(function(e){e==Li.NOT_IN_XR&&o._updateButtons(null)}),Promise.all(s).then(function(e){return e.forEach(function(e,t){e&&(o._overlay.appendChild(o._buttons[t].element),o._buttons[t].element.onclick=function(){return l.b(r,void 0,void 0,function(){return l.e(this,function(e){switch(e.label){case 0:return i.state!=Li.IN_XR?[3,2]:(o._updateButtons(null),[4,i.exitXRAsync()]);case 1:return e.sent(),[2];case 2:return i.state!=Li.NOT_IN_XR?[3,4]:(o._updateButtons(o._buttons[t]),[4,i.enterXRAsync(o._buttons[t].initializationOptions,"eye-level")]);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}(),Ki=function(){function e(e){this.pointer=new Fe.a("controllerPointer",e)}return e.prototype.dispose=function(){this.grip&&this.grip.dispose(),this.pointer.dispose()},e}(),Qi=function(){function e(e){var t=this;this.helper=e,this.controllers=[],this._tmpMatrix=new o.j,this._frameObserver=e._sessionManager.onXRFrameObservable.add(function(){if(e._sessionManager._currentXRFrame&&e._sessionManager._currentXRFrame.getDevicePose){var i=e._sessionManager._currentXRFrame;e._sessionManager._xrSession.getInputSources().forEach(function(n,r){var s=i.getInputPose(n,e._sessionManager._frameOfReference);if(s){t.controllers.length<=r&&t.controllers.push(new Ki(e.container.getScene()));var a=t.controllers[r];s.gripMatrix&&(a.grip||(a.grip=new Fe.a("controllerGrip",e.container.getScene())),o.j.FromFloat32ArrayToRefScaled(s.gripMatrix,0,1,t._tmpMatrix),a.grip.getScene().useRightHandedSystem||t._tmpMatrix.toggleModelMatrixHandInPlace(),a.grip.rotationQuaternion||(a.grip.rotationQuaternion=new o.q),t._tmpMatrix.decompose(a.grip.scaling,a.grip.rotationQuaternion,a.grip.position)),o.j.FromFloat32ArrayToRefScaled(s.targetRay.transformMatrix,0,1,t._tmpMatrix),a.pointer.getScene().useRightHandedSystem||t._tmpMatrix.toggleModelMatrixHandInPlace(),a.pointer.rotationQuaternion||(a.pointer.rotationQuaternion=new o.q),t._tmpMatrix.decompose(a.pointer.scaling,a.pointer.rotationQuaternion,a.pointer.position)}})}})}return e.prototype.dispose=function(){this.controllers.forEach(function(e){e.dispose()}),this.helper._sessionManager.onXRFrameObservable.remove(this._frameObserver)},e}(),qi=function(){function e(e,t){var i=this;this._canvas=null,this.canvasContext=null,t||((t=document.createElement("canvas")).style.cssText="position:absolute; bottom:0px;right:0px;z-index:10;width:100%;height:100%;background-color: #000000;"),this._setManagedOutputCanvas(t),e.onStateChangedObservable.add(function(t){t==Li.ENTERING_XR?i._addCanvas():e.state==Li.NOT_IN_XR&&i._removeCanvas()})}return e.prototype.dispose=function(){this._removeCanvas(),this._setManagedOutputCanvas(null)},e.prototype._setManagedOutputCanvas=function(e){this._removeCanvas(),e?(this._canvas=e,this.canvasContext=this._canvas.getContext("xrpresent")):(this._canvas=null,this.canvasContext=null)},e.prototype._addCanvas=function(){this._canvas&&document.body.appendChild(this._canvas)},e.prototype._removeCanvas=function(){this._canvas&&document.body.contains(this._canvas)&&document.body.removeChild(this._canvas)},e}(),Zi=(ji={root:0,found:!1},function(e,t,i,n){ji.root=0,ji.found=!1;var r=t*t-4*e*i;if(r<0)return ji;var o=Math.sqrt(r),s=(-t-o)/(2*e),a=(-t+o)/(2*e);if(s>a){var c=a;a=s,s=c}return s>0&&s0&&a=0))},e.prototype._canDoCollision=function(e,t,i,n){var r=o.x.Distance(this._basePointWorld,e),s=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(r>this._velocityWorldLength+s+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+s)},e.prototype._testTriangle=function(e,t,i,n,r,s){var a,c=!1;t||(t=[]),t[e]||(t[e]=new o.n(0,0,0,0),t[e].copyFromPoints(i,n,r));var l=t[e];if(s||l.isFrontFacingTo(this._normalizedVelocity,0)){var u=l.signedDistanceTo(this._basePoint),h=o.x.Dot(l.normal,this._velocity);if(0==h){if(Math.abs(u)>=1)return;c=!0,a=0}else{var d=(1-u)/h;if((a=(-1-u)/h)>d){var f=d;d=a,a=f}if(a>1||d<0)return;a<0&&(a=0),a>1&&(a=1)}this._collisionPoint.copyFromFloats(0,0,0);var p=!1,_=1;if(c||(this._basePoint.subtractToRef(l.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(a,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,n,r,l.normal)&&(p=!0,_=a,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!p){var g=this._velocity.lengthSquared(),m=g;this._basePoint.subtractToRef(i,this._tempVector);var v=2*o.x.Dot(this._velocity,this._tempVector),y=this._tempVector.lengthSquared()-1,b=Zi(m,v,y,_);b.found&&(_=b.root,p=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(n,this._tempVector),v=2*o.x.Dot(this._velocity,this._tempVector),y=this._tempVector.lengthSquared()-1,(b=Zi(m,v,y,_)).found&&(_=b.root,p=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),v=2*o.x.Dot(this._velocity,this._tempVector),y=this._tempVector.lengthSquared()-1,(b=Zi(m,v,y,_)).found&&(_=b.root,p=!0,this._collisionPoint.copyFrom(r)),n.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex);var T=this._edge.lengthSquared(),E=o.x.Dot(this._edge,this._velocity),A=o.x.Dot(this._edge,this._baseToVertex);if(m=T*-g+E*E,v=T*(2*o.x.Dot(this._velocity,this._baseToVertex))-2*E*A,y=T*(1-this._baseToVertex.lengthSquared())+A*A,(b=Zi(m,v,y,_)).found){var x=(E*b.root-A)/T;x>=0&&x<=1&&(_=b.root,p=!0,this._edge.scaleInPlace(x),i.addToRef(this._edge,this._collisionPoint))}r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),T=this._edge.lengthSquared(),E=o.x.Dot(this._edge,this._velocity),A=o.x.Dot(this._edge,this._baseToVertex),m=T*-g+E*E,v=T*(2*o.x.Dot(this._velocity,this._baseToVertex))-2*E*A,y=T*(1-this._baseToVertex.lengthSquared())+A*A,(b=Zi(m,v,y,_)).found&&(x=(E*b.root-A)/T)>=0&&x<=1&&(_=b.root,p=!0,this._edge.scaleInPlace(x),n.addToRef(this._edge,this._collisionPoint)),i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),T=this._edge.lengthSquared(),E=o.x.Dot(this._edge,this._velocity),A=o.x.Dot(this._edge,this._baseToVertex),m=T*-g+E*E,v=T*(2*o.x.Dot(this._velocity,this._baseToVertex))-2*E*A,y=T*(1-this._baseToVertex.lengthSquared())+A*A,(b=Zi(m,v,y,_)).found&&(x=(E*b.root-A)/T)>=0&&x<=1&&(_=b.root,p=!0,this._edge.scaleInPlace(x),r.addToRef(this._edge,this._collisionPoint))}if(p){var R=_*this._velocity.length();(!this.collisionFound||R=n)r.copyFrom(e);else{var a=o?o.collisionMask:i.collisionMask;i._initialize(e,t,s);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!==Fe.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};ge.b.prototype.createTransformFeedback=function(){return this._gl.createTransformFeedback()},ge.b.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},ge.b.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},ge.b.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},ge.b.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},ge.b.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},ge.b.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)};var pn=i(107),_n=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),gn=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return _n.COPY;case 86:return _n.PASTE;case 88:return _n.CUT;default:return-1}},e}(),mn=i(59),vn=i(55),yn=function(){function e(e,t,i){this.lengthComputable=e,this.loaded=t,this.total=i}return e.FromProgressEvent=function(t){return new e(t.lengthComputable,t.loaded,t.total)},e}(),bn=function(){function e(){}return Object.defineProperty(e,"ForceFullSceneLoadingForIncremental",{get:function(){return vn.a.ForceFullSceneLoadingForIncremental},set:function(e){vn.a.ForceFullSceneLoadingForIncremental=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"ShowLoadingScreen",{get:function(){return vn.a.ShowLoadingScreen},set:function(e){vn.a.ShowLoadingScreen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"loggingLevel",{get:function(){return vn.a.loggingLevel},set:function(e){vn.a.loggingLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CleanBoneMatrixWeights",{get:function(){return vn.a.CleanBoneMatrixWeights},set:function(e){vn.a.CleanBoneMatrixWeights=e},enumerable:!0,configurable:!0}),e._getDefaultPlugin=function(){return e._registeredPlugins[".babylon"]},e._getPluginForExtension=function(t){var i=e._registeredPlugins[t];return i||(p.a.Warn("Unable to find a plugin to load "+t+" 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"),e._getDefaultPlugin())},e._getPluginForDirectLoad=function(t){for(var i in e._registeredPlugins){var n=e._registeredPlugins[i].plugin;if(n.canDirectLoad&&n.canDirectLoad(t))return e._registeredPlugins[i]}return e._getDefaultPlugin()},e._getPluginForFilename=function(t){var i=t.indexOf("?");-1!==i&&(t=t.substring(0,i));var n=t.lastIndexOf("."),r=t.substring(n,t.length).toLowerCase();return e._getPluginForExtension(r)},e._getDirectLoad=function(e){return"data:"===e.substr(0,5)?e.substr(5):null},e._loadData=function(t,i,n,r,o,s,a){var c,l=e._getDirectLoad(t.name),u=a?e._getPluginForExtension(a):l?e._getPluginForDirectLoad(t.name):e._getPluginForFilename(t.name);if(!(c=u.plugin.createPlugin?u.plugin.createPlugin():u.plugin))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.";var h,d=u.isBinary;e.OnPluginActivatedObservable.notifyObservers(c);var f=function(e,t){i.isDisposed?o("Scene has been disposed"):(i.offlineProvider=h,n(c,e,t))},p=null,_=!1,g=c.onDisposeObservable;g&&g.add(function(){_=!0,p&&(p.abort(),p=null),s()});var m=function(){_||(p=ye.h.LoadFile(t.url,f,r?function(e){r(yn.FromProgressEvent(e))}:void 0,h,d,function(e,t){o("Failed to load scene."+(t?" "+t.message:""),t)}))};if(l)return f(l),c;var v=t.file||mn.a.FilesToLoad[t.name.toLowerCase()];if(-1===t.rootUrl.indexOf("file:")||-1!==t.rootUrl.indexOf("file:")&&!v){var y=i.getEngine(),b=y.enableOfflineSupport;if(b){for(var T=!1,E=0,A=i.disableOfflineSupportExceptionRules;Es.snapDistance?(r=Math.floor(Math.abs(h)/s.snapDistance),h<0&&(r*=-1),h%=s.snapDistance,d.scaleToRef(s.snapDistance*r,d),n=!0):d.scaleInPlace(0)),s.attachedMesh.scaling.addInPlace(d),n&&(f.snapDistance=s.snapDistance*r,s.onSnapObservable.notifyObservers(f))}}),s._pointerObserver=n.utilityLayerScene.onPointerObservable.add(function(e){if(!s._customMeshSet){var t=e.pickInfo&&-1!=s._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?a:s._coloredMaterial;s._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var p=n._getSharedGizmoLight();return p.includedOnlyMeshes=p.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes()),s}return l.d(t,e),t.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),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}(On.a),Ln=i(46),wn=i(40),Fn=function(e){function t(t,i){void 0===t&&(t=o.e.Gray()),void 0===i&&(i=In.a.DefaultKeepDepthUtilityLayer);var n=e.call(this,i)||this;n._boundingDimensions=new o.x(1,1,1),n._renderObserver=null,n._pointerObserver=null,n._scaleDragSpeed=.2,n._tmpQuaternion=new o.q,n._tmpVector=new o.x(0,0,0),n._tmpRotationMatrix=new o.j,n.ignoreChildren=!1,n.includeChildPredicate=null,n.rotationSphereSize=.1,n.scaleBoxSize=.1,n.fixedDragMeshScreenSize=!1,n.fixedDragMeshScreenSizeDistanceFactor=10,n.onDragStartObservable=new r.c,n.onScaleBoxDragObservable=new r.c,n.onScaleBoxDragEndObservable=new r.c,n.onRotationSphereDragObservable=new r.c,n.onRotationSphereDragEndObservable=new r.c,n.scalePivot=null,n._existingMeshScale=new o.x,n._dragMesh=null,n.pointerDragBehavior=new Le.a,n._updateScale=!1,n._anchorMesh=new Fe.a("anchor",i.utilityLayerScene),n.coloredMaterial=new Ri.a("",i.utilityLayerScene),n.coloredMaterial.disableLighting=!0,n.hoverColoredMaterial=new Ri.a("",i.utilityLayerScene),n.hoverColoredMaterial.disableLighting=!0,n._lineBoundingBox=new Fe.a("",i.utilityLayerScene),n._lineBoundingBox.rotationQuaternion=new o.q;var s=[];s.push(wn.a.CreateLines("lines",{points:[new o.x(0,0,0),new o.x(n._boundingDimensions.x,0,0)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(0,0,0),new o.x(0,n._boundingDimensions.y,0)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(0,0,0),new o.x(0,0,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(n._boundingDimensions.x,0,0),new o.x(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(n._boundingDimensions.x,0,0),new o.x(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(0,n._boundingDimensions.y,0),new o.x(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(0,n._boundingDimensions.y,0),new o.x(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(0,0,n._boundingDimensions.z),new o.x(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(0,0,n._boundingDimensions.z),new o.x(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new o.x(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new o.x(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),s.push(wn.a.CreateLines("lines",{points:[new o.x(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new o.x(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),s.forEach(function(e){e.color=t,e.position.addInPlace(new o.x(-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 Fe.a("",i.utilityLayerScene),n._rotateSpheresParent.rotationQuaternion=new o.q;for(var a=function(e){var t=Ln.a.CreateSphere("",{diameter:1},i.utilityLayerScene);t.rotationQuaternion=new o.q,t.material=c.coloredMaterial,(d=new Le.a({})).moveAttached=!1,d.updateDragPlane=!1,t.addBehavior(d);var r=new o.x(1,0,0),s=0;d.onDragStartObservable.add(function(){r.copyFrom(t.forward),s=0}),d.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 p.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Be.a._RemoveAndStorePivotPoint(n.attachedMesh);var a=r,c=t.dragPlaneNormal.scale(o.x.Dot(t.dragPlaneNormal,a)),l=a.subtract(c).normalizeToNew(),u=o.x.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=o.q.RotationYawPitchRoll(n.attachedMesh.rotation.y,n.attachedMesh.rotation.x,n.attachedMesh.rotation.z)),n._anchorMesh.rotationQuaternion||(n._anchorMesh.rotationQuaternion=o.q.RotationYawPitchRoll(n._anchorMesh.rotation.y,n._anchorMesh.rotation.x,n._anchorMesh.rotation.z)),s+=u,Math.abs(s)<=2*Math.PI&&(e>=8?o.q.RotationYawPitchRollToRef(0,0,u,n._tmpQuaternion):e>=4?o.q.RotationYawPitchRollToRef(u,0,0,n._tmpQuaternion):o.q.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(),Be.a._RestorePivotPoint(n.attachedMesh)}n._updateDummy()}),d.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(t)}),d.onDragEndObservable.add(function(){n.onRotationSphereDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()}),c._rotateSpheresParent.addChild(t)},c=this,l=0;l<12;l++)a(l);n._rootMesh.addChild(n._rotateSpheresParent),n._scaleBoxesParent=new Fe.a("",i.utilityLayerScene),n._scaleBoxesParent.rotationQuaternion=new o.q;for(var u=0;u<2;u++)for(var h=0;h<2;h++)for(var d,f=function(){var e=Mn.a.CreateBox("",{size:1},i.utilityLayerScene);e.material=_.coloredMaterial;var t=new o.x(0==u?-1:1,0==h?-1:1,0==g?-1:1);(d=new Le.a({dragAxis:t})).moveAttached=!1,e.addBehavior(d),d.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 p.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Be.a._RemoveAndStorePivotPoint(n.attachedMesh);var r=t.dragDistance/n._boundingDimensions.length()*n._anchorMesh.scaling.length(),s=new o.x(r,r,r);s.scaleInPlace(n._scaleDragSpeed),n.updateBoundingBox(),n.scalePivot?(n.attachedMesh.getWorldMatrix().getRotationMatrixToRef(n._tmpRotationMatrix),n._boundingDimensions.scaleToRef(.5,n._tmpVector),o.x.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector),n._boundingDimensions.multiplyToRef(n.scalePivot,n._tmpVector),o.x.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(s),(n._anchorMesh.scaling.x<0||n._anchorMesh.scaling.y<0||n._anchorMesh.scaling.z<0)&&n._anchorMesh.scaling.subtractInPlace(s),n._anchorMesh.removeChild(n.attachedMesh),n.attachedMesh.setParent(i),Be.a._RestorePivotPoint(n.attachedMesh)}n._updateDummy()}),d.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(e)}),d.onDragEndObservable.add(function(){n.onScaleBoxDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()}),_._scaleBoxesParent.addChild(e)},_=this,g=0;g<2;g++)f();n._rootMesh.addChild(n._scaleBoxesParent);var m=new Array;return n._pointerObserver=i.utilityLayerScene.onPointerObservable.add(function(e){m[e.event.pointerId]?e.pickInfo&&e.pickInfo.pickedMesh!=m[e.event.pointerId]&&(m[e.event.pointerId].material=n.coloredMaterial,delete m[e.event.pointerId]):n._rotateSpheresParent.getChildMeshes().concat(n._scaleBoxesParent.getChildMeshes()).forEach(function(t){e.pickInfo&&e.pickInfo.pickedMesh==t&&(m[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 l.d(t,e),t.prototype.setColor=function(e){this.coloredMaterial.emissiveColor=e,this.hoverColoredMaterial.emissiveColor=e.clone().add(new o.e(.3,.3,.3)),this._lineBoundingBox.getChildren().forEach(function(t){t.color&&(t.color=e)})},t.prototype._attachedMeshChanged=function(e){var t=this;if(e){Be.a._RemoveAndStorePivotPoint(e);var i=e.parent;this._anchorMesh.addChild(e),this._anchorMesh.removeChild(e),e.setParent(i),Be.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){Be.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=o.q.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=o.q.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),Be.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 o.x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(o.x.Cross(e[r].position.normalizeToNew(),o.x.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 o.x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(o.x.Cross(e[r].position.normalizeToNew(),o.x.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 o.x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(o.x.Cross(e[r].position.normalizeToNew(),o.x.Forward()).normalizeToNew().add(e[r].position))),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var s=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(s,s,s)}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 o.x(-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 s=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(s,s,s)}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=fe.a.CreateBox("dummy",1,this.gizmoLayer.utilityLayerScene),this._dragMesh.visibility=0,this._dragMesh.rotationQuaternion=new o.q,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=o.q.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=Mn.a.CreateBox("box",{size:1},e.getScene()),s=e.getHierarchyBoundingVectors();return s.max.subtractToRef(s.min,r.scaling),0===r.scaling.y&&(r.scaling.y=o.h),0===r.scaling.x&&(r.scaling.x=o.h),0===r.scaling.z&&(r.scaling.z=o.h),r.position.set((s.max.x+s.min.x)/2,(s.max.y+s.min.y)/2,(s.max.z+s.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){p.a.Error("Custom meshes are not supported on this gizmo")},t}(On.a),Nn=function(e){function t(t,i,n,s){void 0===i&&(i=o.e.Gray()),void 0===n&&(n=In.a.DefaultUtilityLayer),void 0===s&&(s=32);var a=e.call(this,n)||this;a._pointerObserver=null,a.snapDistance=0,a.onSnapObservable=new r.c;var c=new Ri.a("",n.utilityLayerScene);c.diffuseColor=i,c.specularColor=i.subtract(new o.e(.1,.1,.1));var l=new Ri.a("",n.utilityLayerScene);l.diffuseColor=i.add(new o.e(.3,.3,.3));var u=new Fe.a("",n.utilityLayerScene),h=fe.a.CreateTorus("",.6,.03,s,n.utilityLayerScene);h.visibility=0;var d=fe.a.CreateTorus("",.6,.005,s,n.utilityLayerScene);d.material=c,d.rotation.x=Math.PI/2,h.rotation.x=Math.PI/2,u.addChild(d),u.addChild(h),u.lookAt(a._rootMesh.position.add(t)),a._rootMesh.addChild(u),u.scaling.scaleInPlace(1/3),a.dragBehavior=new Le.a({dragPlaneNormal:t}),a.dragBehavior.moveAttached=!1,a.dragBehavior.maxDragAngle=9*Math.PI/20,a.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,a._rootMesh.addBehavior(a.dragBehavior);var f=new o.x;a.dragBehavior.onDragStartObservable.add(function(e){a.attachedMesh&&f.copyFrom(e.dragPlanePoint)});var p=new o.j,_=new o.x,g=new o.x,m={snapDistance:0},v=0,y=new o.j,b=new o.x,T=new o.q;a.dragBehavior.onDragObservable.add(function(e){if(a.attachedMesh){a.attachedMesh.rotationQuaternion||(a.attachedMesh.rotationQuaternion=o.q.RotationYawPitchRoll(a.attachedMesh.rotation.y,a.attachedMesh.rotation.x,a.attachedMesh.rotation.z));var i=a.attachedMesh.parent;i&&a.attachedMesh.setParent(null);var r=e.dragPlanePoint.subtract(a.attachedMesh.absolutePosition).normalize(),s=f.subtract(a.attachedMesh.absolutePosition).normalize(),c=o.x.Cross(r,s),l=o.x.Dot(r,s),u=Math.atan2(c.length(),l);if(_.copyFrom(t),g.copyFrom(t),a.updateGizmoRotationToMatchAttachedMesh&&(a.attachedMesh.rotationQuaternion.toRotationMatrix(p),g=o.x.TransformCoordinates(_,p)),n.utilityLayerScene.activeCamera){var h=n.utilityLayerScene.activeCamera.position.subtract(a.attachedMesh.position);o.x.Dot(h,g)>0&&(_.scaleInPlace(-1),g.scaleInPlace(-1))}o.x.Dot(g,c)>0&&(u=-u);var d=!1;if(0!=a.snapDistance)if(v+=u,Math.abs(v)>a.snapDistance){var E=Math.floor(Math.abs(v)/a.snapDistance);v<0&&(E*=-1),v%=a.snapDistance,u=a.snapDistance*E,d=!0}else u=0;y.reset(),a.attachedMesh.parent&&(a.attachedMesh.parent.computeWorldMatrix().invertToRef(y),y.getRotationMatrixToRef(y),o.x.TransformCoordinatesToRef(_,y,_));var A=Math.sin(u/2);T.set(_.x*A,_.y*A,_.z*A,Math.cos(u/2)),y.determinant()>0&&(T.toEulerAnglesToRef(b),o.q.RotationYawPitchRollToRef(b.y,-b.x,-b.z,T)),a.updateGizmoRotationToMatchAttachedMesh?a.attachedMesh.rotationQuaternion.multiplyToRef(T,a.attachedMesh.rotationQuaternion):T.multiplyToRef(a.attachedMesh.rotationQuaternion,a.attachedMesh.rotationQuaternion),f.copyFrom(e.dragPlanePoint),d&&(m.snapDistance=u,a.onSnapObservable.notifyObservers(m)),i&&a.attachedMesh.setParent(i)}}),a._pointerObserver=n.utilityLayerScene.onPointerObservable.add(function(e){if(!a._customMeshSet){var t=e.pickInfo&&-1!=a._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?l:c;a._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var E=n._getSharedGizmoLight();return E.includedOnlyMeshes=E.includedOnlyMeshes.concat(a._rootMesh.getChildMeshes(!1)),a}return l.d(t,e),t.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),e.prototype.dispose.call(this)},t}(On.a),Bn=function(e){function t(t,i){void 0===t&&(t=In.a.DefaultUtilityLayer),void 0===i&&(i=32);var n=e.call(this,t)||this;return n.onDragStartObservable=new r.c,n.onDragEndObservable=new r.c,n.xGizmo=new Nn(new o.x(1,0,0),o.e.Red().scale(.5),t,i),n.yGizmo=new Nn(new o.x(0,1,0),o.e.Green().scale(.5),t,i),n.zGizmo=new Nn(new o.x(0,0,1),o.e.Blue().scale(.5),t,i),[n.xGizmo,n.yGizmo,n.zGizmo].forEach(function(e){e.dragBehavior.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){n.onDragEndObservable.notifyObservers({})})}),n.attachedMesh=null,n}return l.d(t,e),Object.defineProperty(t.prototype,"attachedMesh",{get:function(){return this.xGizmo.attachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.attachedMesh=e,this.yGizmo.attachedMesh=e,this.zGizmo.attachedMesh=e)},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){p.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}(On.a),Un=function(e){function t(t){void 0===t&&(t=In.a.DefaultUtilityLayer);var i=e.call(this,t)||this;return i.onDragStartObservable=new r.c,i.onDragEndObservable=new r.c,i.xGizmo=new Cn.a(new o.x(1,0,0),o.e.Red().scale(.5),t),i.yGizmo=new Cn.a(new o.x(0,1,0),o.e.Green().scale(.5),t),i.zGizmo=new Cn.a(new o.x(0,0,1),o.e.Blue().scale(.5),t),[i.xGizmo,i.yGizmo,i.zGizmo].forEach(function(e){e.dragBehavior.onDragStartObservable.add(function(){i.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){i.onDragEndObservable.notifyObservers({})})}),i.attachedMesh=null,i}return l.d(t,e),Object.defineProperty(t.prototype,"attachedMesh",{get:function(){return this.xGizmo.attachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.attachedMesh=e,this.yGizmo.attachedMesh=e,this.zGizmo.attachedMesh=e)},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){p.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}(On.a);Mi.a.CreatePolyhedron=function(e){var t=[];t[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},t[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]]},t[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},t[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},t[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},t[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},t[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},t[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},t[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},t[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},t[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},t[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},t[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},t[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},t[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};var i,n,r,s,a,c,l=e.type&&(e.type<0||e.type>=t.length)?0:e.type||0,u=e.size,h=e.sizeX||u||1,d=e.sizeY||u||1,f=e.sizeZ||u||1,p=e.custom||t[l],_=p.face.length,g=e.faceUV||new Array(_),m=e.faceColors,v=void 0===e.flat||e.flat,y=0===e.sideOrientation?0:e.sideOrientation||Mi.a.DEFAULTSIDE,b=new Array,T=new Array,E=new Array,A=new Array,x=new Array,R=0,P=0,S=new Array,C=0,M=0;if(v)for(M=0;M<_;M++)m&&void 0===m[M]&&(m[M]=new o.f(1,1,1,1)),g&&void 0===g[M]&&(g[M]=new o.y(0,0,1,1));if(v)for(M=0;M<_;M++){var O=p.face[M].length;for(r=2*Math.PI/O,s=.5*Math.tan(r/2),a=.5,C=0;C0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&o.j.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=o.x.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var s=0;sthis._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y)}}var u=this._orthoRight-this._orthoLeft,h=this._orthoTop-this._orthoBottom;o.j.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._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.getDepthMinZ=function(e){return 1},t.prototype.getDepthMaxZ=function(e){return 1},t.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},l.c([Object(L.c)()],t.prototype,"shadowFrustumSize",null),l.c([Object(L.c)()],t.prototype,"shadowOrthoScale",null),l.c([Object(L.c)()],t.prototype,"autoUpdateExtends",void 0),t}(jn);fe.a.CreateHemisphere=function(e,t,i,n){var r={segments:t,diameter:i};return Wn.CreateHemisphere(e,r,n)};var Wn=function(){function e(){}return e.CreateHemisphere=function(e,t,i){t.diameter||(t.diameter=1),t.segments||(t.segments=16);var n=Ln.a.CreateSphere("",{slice:.5,diameter:t.diameter,segments:t.segments},i),r=fe.a.CreateDisc("",t.diameter/2,3*t.segments+(4-t.segments),i);r.rotation.x=-Math.PI/2,r.parent=n;var o=fe.a.MergeMeshes([r,n],!0);return o.name=e,o},e}();F.a.AddNodeConstructor("Light_Type_2",function(e,t){return function(){return new Xn(e,o.x.Zero(),o.x.Zero(),0,0,t)}});var Xn=function(e){function t(t,i,n,r,s,a){var c=e.call(this,t,a)||this;return c._innerAngle=0,c._projectionTextureMatrix=o.j.Zero(),c._projectionTextureLightNear=1e-6,c._projectionTextureLightFar=1e3,c._projectionTextureUpDirection=o.x.Up(),c._projectionTextureViewLightDirty=!0,c._projectionTextureProjectionLightDirty=!0,c._projectionTextureDirty=!0,c._projectionTextureViewTargetVector=o.x.Zero(),c._projectionTextureViewLightMatrix=o.j.Zero(),c._projectionTextureProjectionLightMatrix=o.j.Zero(),c._projectionTextureScalingMatrix=o.j.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=s,c}return l.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 zn.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;o.j.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),o.j.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);o.j.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=o.x.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=o.x.Normalize(this.direction)),this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},t.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},l.c([Object(L.c)()],t.prototype,"angle",null),l.c([Object(L.c)()],t.prototype,"innerAngle",null),l.c([Object(L.c)()],t.prototype,"shadowAngleScale",null),l.c([Object(L.c)()],t.prototype,"exponent",void 0),l.c([Object(L.c)()],t.prototype,"projectionTextureLightNear",null),l.c([Object(L.c)()],t.prototype,"projectionTextureLightFar",null),l.c([Object(L.c)()],t.prototype,"projectionTextureUpDirection",null),l.c([Object(L.m)("projectedLightTexture")],t.prototype,"_projectionTexture",void 0),t}(jn),Yn=function(e){function t(t){var i=e.call(this,t)||this;return i.cachedPosition=new o.x,i.cachedForward=new o.x(0,0,1),i._light=null,i.attachedMesh=new Fe.a("",i.gizmoLayer.utilityLayerScene),i._material=new Ri.a("light",i.gizmoLayer.originalScene),i._material.diffuseColor=new o.e(.5,.5,.5),i._material.specularColor=new o.e(.1,.1,.1),i}return l.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 Ti.a?this._lightMesh=t._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene):this._lightMesh=e instanceof Hn?t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof Xn?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 o.q,e.position&&this.attachedMesh.position.copyFrom(e.position),e.direction&&this.attachedMesh.setDirection(e.direction),this._update()}},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&&(o.x.DistanceSquared(this.attachedMesh.forward,this.cachedForward)>1e-4?(this._light.direction.copyFrom(this.attachedMesh.forward),this.cachedForward.copyFrom(this.attachedMesh.forward)):o.x.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 fe.a("hemisphereLight",e),n=Wn.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 fe.a("pointLight",e),n=Ln.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 fe.a("spotLight",e);Ln.a.CreateSphere(i.name,{segments:10,diameter:1},e).parent=i;var n=Wn.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 fe.a("directionalLight",e),n=new fe.a(i.name,e);n.parent=i,Ln.a.CreateSphere(i.name,{diameter:1.2,segments:10},e).parent=n;var r=fe.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,(s=r.clone(i.name)).scaling.y=.5,s.position.x+=-1.25;var o,s,a=fe.a.CreateCylinder(i.name,1,0,.6,6,1,e);return a.position.y+=3,a.parent=n,(o=a.clone(i.name)).position.y=1.5,o.position.x+=1.25,(s=a.clone(i.name)).position.y=1.5,s.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 fe.a("root",t);i.rotation.x=Math.PI/2;var n=new fe.a("linePivot",t);n.parent=i;var r=fe.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++){(s=n.clone("lineParentClone")).rotation.z=Math.PI/4,s.rotation.y=Math.PI/2+Math.PI/2*o,s.getChildMeshes()[0].scaling.y=.5,s.getChildMeshes()[0].scaling.x=s.getChildMeshes()[0].scaling.z=.8,s.getChildMeshes()[0].position.y=s.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return i;for(o=0;o<4;o++){(s=n.clone("linePivotClone")).rotation.z=Math.PI/2,s.rotation.y=Math.PI/2*o}if(e<4)return i;for(o=0;o<4;o++){var s;(s=n.clone("linePivotClone")).rotation.z=Math.PI+Math.PI/4,s.rotation.y=Math.PI/2+Math.PI/2*o,s.getChildMeshes()[0].scaling.y=.5,s.getChildMeshes()[0].scaling.x=s.getChildMeshes()[0].scaling.z=.8,s.getChildMeshes()[0].position.y=s.getChildMeshes()[0].scaling.y/2+1.2}return e<5?i:((s=n.clone("linePivotClone")).rotation.z=Math.PI,i)},t}(On.a),Kn=i(44);zt.a.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};";var Qn="#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";zt.a.IncludesShadersStore.kernelBlurFragment=Qn;var qn="#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";zt.a.IncludesShadersStore.kernelBlurFragment2=qn;var Zn="\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\nvec4 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}\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}";zt.a.ShadersStore.kernelBlurPixelShader=Zn;zt.a.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";var Jn="\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}";zt.a.ShadersStore.kernelBlurVertexShader=Jn;var $n=function(e){function t(t,i,n,r,o,s,a,c,l,u,h){void 0===s&&(s=ke.a.BILINEAR_SAMPLINGMODE),void 0===l&&(l=_.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,s,a,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 l.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=[],s=[],a=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}(Ht),er=function(e){function t(t,i,n,r,s,a,c){void 0===s&&(s=_.a.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=ke.a.BILINEAR_SAMPLINGMODE),void 0===c&&(c=!0);var l=e.call(this,t,i,n,r,!0,s,!1,a,c)||this;return l.scene=n,l.mirrorPlane=new o.n(0,1,0,1),l._transformMatrix=o.j.Zero(),l._mirrorMatrix=o.j.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(){o.j.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=o.x.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 l.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?_.a.TEXTURETYPE_FLOAT:_.a.TEXTURETYPE_HALF_FLOAT;this._blurX=new $n("horizontal blur",new o.w(1,0),this._blurKernelX,this._blurRatio,null,ke.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 $n("vertical blur",new o.w(0,1),this._blurKernelY,this._blurRatio,null,ke.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}(_i);ke.a._CreateMirror=function(e,t,i,n){return new er(e,t,i,n)},ge.b.prototype._createDepthStencilCubeTexture=function(e,t){var i=new ze.a(this,ze.a.DATASOURCE_UNKNOWN);if(i.isCube=!0,1===this.webGLVersion)return p.a.Error("Depth cube texture is not supported by WebGL 1."),i;var n=l.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},ge.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)})},ge.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)},ge.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)},ge.b.prototype._partialLoadImg=function(e,t,i,n,r,o){var s;void 0===o&&(o=null);s=ye.h.LoadImage(e,function(){i[t]=s,i._internalCount++,n&&n._removePendingData(s),6===i._internalCount&&r(i)},function(e,t){n&&n._removePendingData(s),o&&o(e,t)},n?n.offlineProvider:null),n&&n._addPendingData(s)},ge.b.prototype.createCubeTexture=function(e,t,i,n,r,o,s,a,c,l,u,h,d){var f=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=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 _=this._gl,g=h||new ze.a(this,ze.a.DATASOURCE_CUBE);g.isCube=!0,g.url=e,g.generateMipMaps=!n,g._lodGenerationScale=l,g._lodGenerationOffset=u,this._doNotHandleContextLost||(g._extension=a,g._files=i);for(var m=e.lastIndexOf("."),v=a||(m>-1?e.substring(m).toLowerCase():""),y=null,b=0,T=ge.b._TextureLoaders;b-1?t.substring(m).toLowerCase():""),y=".dds"===v,b=".env"===v;if(b?(g.gammaSpace=!1,g._prefiltered=!1):(g._prefiltered=u,u&&(g.gammaSpace=!1)),g._texture=g._getFromCache(t,r),!s&&(b||y||n||(n=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),s=[],n))for(var T=0;T0,o.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!a.invertZ:a.invertZ,o.LODINREFLECTIONALPHA=a.lodLevelInAlpha,o.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,o.REFLECTIONBGR=this.switchToBGR,a.coordinatesMode===ke.a.INVCUBIC_MODE&&(o.INVERTCUBICMAP=!0),o.REFLECTIONMAP_3D=a.isCube,a.coordinatesMode){case ke.a.EXPLICIT_MODE:o.REFLECTIONMAP_EXPLICIT=!0;break;case ke.a.PLANAR_MODE:o.REFLECTIONMAP_PLANAR=!0;break;case ke.a.PROJECTION_MODE:o.REFLECTIONMAP_PROJECTION=!0;break;case ke.a.SKYBOX_MODE:o.REFLECTIONMAP_SKYBOX=!0,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!a.getReflectionTextureMatrix().isIdentity();break;case ke.a.SPHERICAL_MODE:o.REFLECTIONMAP_SPHERICAL=!0;break;case ke.a.EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case ke.a.FIXED_EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case ke.a.CUBIC_MODE:case ke.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===_.a.ALPHA_PREMULTIPLIED||this.alphaMode===_.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(ir.a.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),ir.a.PrepareDefinesForFrameBoundValues(r,s,o,i),ir.a.PrepareDefinesForAttributes(e,o,!1,!0,!1)&&e&&(r.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(Oi.b.NormalKind)||(e.createNormals(!0),p.a.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var c=new zt.c;o.FOG&&c.addFallback(0,"FOG"),o.POINTSIZE&&c.addFallback(1,"POINTSIZE"),o.MULTIVIEW&&c.addFallback(0,"MULTIVIEW"),ir.a.HandleFallbacksForShadows(o,c,this._maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&c.addCPUSkinningFallback(0,e);var l=[Oi.b.PositionKind];o.NORMAL&&l.push(Oi.b.NormalKind),o.UV1&&l.push(Oi.b.UVKind),o.UV2&&l.push(Oi.b.UV2Kind),ir.a.PrepareAttributesForBones(l,e,o,c),ir.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"];xi.a&&(xi.a.PrepareUniforms(u,o),xi.a.PrepareSamplers(h,o)),ir.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}},s),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),ir.a.BindBonesParameters(t,this._activeEffect);var s=this._mustRebind(n,o,t.visibility);if(s){this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o);var a=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(n.texturesEnabled&&(this._diffuseTexture&&or.a.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),ir.a.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),a&&or.a.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",a.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",a.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",a.getSize().width,a.lodGenerationScale,a.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&&or.a.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),a&&or.a.ReflectionTextureEnabled&&(r.REFLECTIONBLUR&&r.TEXTURELODSUPPORT?this._uniformBuffer.setTexture("reflectionSampler",a):r.REFLECTIONBLUR?(this._uniformBuffer.setTexture("reflectionSampler",a._lodTextureMid||a),this._uniformBuffer.setTexture("reflectionSamplerLow",a._lodTextureLow||a),this._uniformBuffer.setTexture("reflectionSamplerHigh",a._lodTextureHigh||a)):this._uniformBuffer.setTexture("reflectionSampler",a),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)))),ir.a.BindClipPlane(this._activeEffect,n),ir.a.BindEyePosition(o,n)}!s&&this.isFrozen||(n.lightsEnabled&&ir.a.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,!1),this.bindView(o),ir.a.BindFogParameters(n,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect)}}},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 L.a.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=L.a.Serialize(this);return e.customType="BABYLON.BackgroundMaterial",e},t.prototype.getClassName=function(){return"BackgroundMaterial"},t.Parse=function(e,i,n){return L.a.Parse(function(){return new t(e.name,i)},e,i,n)},t.StandardReflectance0=.05,t.StandardReflectance90=.5,l.c([Object(L.e)()],t.prototype,"_primaryColor",void 0),l.c([Object(L.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColor",void 0),l.c([Object(L.e)()],t.prototype,"__perceptualColor",void 0),l.c([Object(L.c)()],t.prototype,"_primaryColorShadowLevel",void 0),l.c([Object(L.c)()],t.prototype,"_primaryColorHighlightLevel",void 0),l.c([Object(L.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColorHighlightLevel",null),l.c([Object(L.m)()],t.prototype,"_reflectionTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),l.c([Object(L.c)()],t.prototype,"_reflectionBlur",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionBlur",void 0),l.c([Object(L.m)()],t.prototype,"_diffuseTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLights",void 0),l.c([Object(L.c)()],t.prototype,"_shadowLevel",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLevel",void 0),l.c([Object(L.o)()],t.prototype,"_sceneCenter",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"sceneCenter",void 0),l.c([Object(L.c)()],t.prototype,"_opacityFresnel",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityFresnel",void 0),l.c([Object(L.c)()],t.prototype,"_reflectionFresnel",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFresnel",void 0),l.c([Object(L.c)()],t.prototype,"_reflectionFalloffDistance",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFalloffDistance",void 0),l.c([Object(L.c)()],t.prototype,"_reflectionAmount",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionAmount",void 0),l.c([Object(L.c)()],t.prototype,"_reflectionReflectance0",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance0",void 0),l.c([Object(L.c)()],t.prototype,"_reflectionReflectance90",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance90",void 0),l.c([Object(L.c)()],t.prototype,"_useRGBColor",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRGBColor",void 0),l.c([Object(L.c)()],t.prototype,"_enableNoise",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableNoise",void 0),l.c([Object(L.c)()],t.prototype,"_maxSimultaneousLights",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"maxSimultaneousLights",void 0),l.c([Object(L.i)()],t.prototype,"_imageProcessingConfiguration",void 0),t}(rr.a);s.a.RegisteredTypes["BABYLON.BackgroundMaterial"]=dr;var fr=i(80),pr=function(){function e(t,i){var n=this;this._errorHandler=function(e,t){n.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=l.a({},e._getDefaultOptions(),t),this._scene=i,this.onErrorObservable=new r.c,this._setupBackground(),this._setupImageProcessing()}return e._getDefaultOptions=function(){return{createGround:!0,groundSize:15,groundTexture:this._groundTextureCDNUrl,groundColor:new o.e(.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:_.a.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._skyboxTextureCDNUrl,skyboxColor:new o.e(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:o.x.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=l.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 o.f(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=tr.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}},e.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new fe.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 Et&&this._scene.activeCamera.upperRadiusLimit&&(i=t=2*this._scene.activeCamera.upperRadiusLimit);var s=o.length();s>t&&(i=t=2*s),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=fe.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 dr("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=_.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 ke.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=ke.a.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new er("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,ke.a.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new o.n(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.gammaSpace=!1,this._groundMirror.renderList))for(var i=0;i\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}";zt.a.ShadersStore.rgbdDecodePixelShader=mr;var vr=function(){function e(){}return e._ExpandDefaultBRDFTexture=function(e){var t=e.getEngine(),i=t.getCaps(),n=!1;if(i.textureHalfFloatRender&&i.textureHalfFloatLinearFiltering?(n=!0,e.type=_.a.TEXTURETYPE_HALF_FLOAT):i.textureFloatRender&&i.textureFloatLinearFiltering&&(n=!0,e.type=_.a.TEXTURETYPE_FLOAT),n){e.isReady=!1;var r=new Ht("rgbdDecode","rgbdDecode",null,null,1,null,_.a.TEXTURE_TRILINEAR_SAMPLINGMODE,t,!1,void 0,e.type,void 0,null,!1);e._isRGBD=!1,e.invertY=!1;var o=t.createRenderTargetTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:_.a.TEXTURE_BILINEAR_SAMPLINGMODE,type:e.type,format:_.a.TEXTUREFORMAT_RGBA});r.getEffect().executeWhenCompiled(function(){r.onApply=function(t){t._bindTexture("textureSampler",e),t.setFloat2("scale",1,1)},t.scenes[0].postProcessManager.directRender([r],o,!0),t.restoreDefaultFramebuffer(),t._releaseTexture(e),t._releaseFramebufferObjects(o),r&&r.dispose(),o._swapAndDie(e),e.isReady=!0})}},e.GetEnvironmentBRDFTexture=function(e){var t=this;if(!e.environmentBRDFTexture){var i=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;var n=ke.a.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture",e,!0,!0,ke.a.BILINEAR_SAMPLINGMODE);n._texture._isRGBD=!0,n.wrapU=ke.a.CLAMP_ADDRESSMODE,n.wrapV=ke.a.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=n,e.useDelayedTextureLoading=i,n.onLoadObservable.addOnce(function(){t._ExpandDefaultBRDFTexture(n._texture)})}return e.environmentBRDFTexture},e._environmentBRDFBase64Texture="data:image/png;base64,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",e}(),yr=function(){function e(t){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indiceOfRefraction=e._DefaultIndiceOfRefraction,this.indiceOfRefraction=e._DefaultIndiceOfRefraction,this._texture=null,this.texture=null,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=o.e.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=t}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t,i,n){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&or.a.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&or.a.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&or.a.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(t,i){this._isEnabled?(t.CLEARCOAT=!0,t._areTexturesDirty&&i.texturesEnabled&&(this._texture&&or.a.ClearCoatTextureEnabled?ir.a.PrepareDefinesForMergedUV(this._texture,t,"CLEARCOAT_TEXTURE"):t.CLEARCOAT_TEXTURE=!1,this._bumpTexture&&or.a.ClearCoatBumpTextureEnabled?ir.a.PrepareDefinesForMergedUV(this._bumpTexture,t,"CLEARCOAT_BUMP"):t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_DEFAULTIOR=this._indiceOfRefraction===e._DefaultIndiceOfRefraction,this._isTintEnabled?(t.CLEARCOAT_TINT=!0,this._tintTexture&&or.a.ClearCoatTintTextureEnabled?ir.a.PrepareDefinesForMergedUV(this._tintTexture,t,"CLEARCOAT_TINT_TEXTURE"):t.CLEARCOAT_TINT_TEXTURE=!1):(t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1))):(t.CLEARCOAT=!1,t.CLEARCOAT_TEXTURE=!1,t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i,n,r,o,s){if(!e.useUbo||!r||!e.isSync){this._texture&&or.a.ClearCoatTextureEnabled&&(e.updateFloat2("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level),ir.a.BindTextureMatrix(this._texture,e,"clearCoat")),this._bumpTexture&&i.getCaps().standardDerivatives&&or.a.ClearCoatTextureEnabled&&!n&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),ir.a.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",o?1:-1,s?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",o?-1:1,s?-1:1)),this._tintTexture&&or.a.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),ir.a.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);var a=1-this._indiceOfRefraction,c=1+this._indiceOfRefraction,l=Math.pow(-a/c,2),u=1/this._indiceOfRefraction;e.updateFloat4("vClearCoatRefractionParams",l,u,a,c),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&or.a.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._bumpTexture&&i.getCaps().standardDerivatives&&or.a.ClearCoatBumpTextureEnabled&&!n&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&or.a.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))},e.prototype.hasTexture=function(e){return this._texture===e||(this._bumpTexture===e||this._tintTexture===e)},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},e.prototype.dispose=function(e){e&&(this._texture&&this._texture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._tintTexture&&this._tintTexture.dispose())},e.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},e.AddFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i},e.AddUniforms=function(e){e.push("vClearCoatTangentSpaceParams","vClearCoatParams","vClearCoatRefractionParams","vClearCoatTintParams","clearCoatColorAtDistance","clearCoatMatrix","clearCoatBumpMatrix","clearCoatTintMatrix","vClearCoatInfos","vClearCoatBumpInfos","vClearCoatTintInfos")},e.AddSamplers=function(e){e.push("clearCoatSampler","clearCoatBumpSampler","clearCoatTintSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vClearCoatParams",2),e.addUniform("vClearCoatRefractionParams",4),e.addUniform("vClearCoatInfos",2),e.addUniform("clearCoatMatrix",16),e.addUniform("vClearCoatBumpInfos",2),e.addUniform("vClearCoatTangentSpaceParams",2),e.addUniform("clearCoatBumpMatrix",16),e.addUniform("vClearCoatTintParams",4),e.addUniform("clearCoatColorAtDistance",1),e.addUniform("vClearCoatTintInfos",2),e.addUniform("clearCoatTintMatrix",16)},e.prototype.copyTo=function(e){L.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return L.a.Serialize(this)},e.prototype.parse=function(e){var t=this;L.a.Parse(function(){return t},e,null)},e._DefaultIndiceOfRefraction=1.5,l.c([Object(L.c)()],e.prototype,"_isEnabled",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),l.c([Object(L.c)()],e.prototype,"intensity",void 0),l.c([Object(L.c)()],e.prototype,"roughness",void 0),l.c([Object(L.c)()],e.prototype,"_indiceOfRefraction",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indiceOfRefraction",void 0),l.c([Object(L.m)()],e.prototype,"_texture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),l.c([Object(L.m)()],e.prototype,"_bumpTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"bumpTexture",void 0),l.c([Object(L.c)()],e.prototype,"_isTintEnabled",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTintEnabled",void 0),l.c([Object(L.e)()],e.prototype,"tintColor",void 0),l.c([Object(L.c)()],e.prototype,"tintColorAtDistance",void 0),l.c([Object(L.c)()],e.prototype,"tintThickness",void 0),l.c([Object(L.m)()],e.prototype,"_tintTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"tintTexture",void 0),e}(),br=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new o.w(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&&or.a.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!t.isVerticesDataPresent(Oi.b.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&or.a.AnisotropicTextureEnabled?ir.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&&or.a.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),ir.a.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&or.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){L.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return L.a.Serialize(this)},e.prototype.parse=function(e){var t=this;L.a.Parse(function(){return t},e,null)},l.c([Object(L.c)()],e.prototype,"_isEnabled",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),l.c([Object(L.c)()],e.prototype,"intensity",void 0),l.c([Object(L.n)()],e.prototype,"direction",void 0),l.c([Object(L.m)()],e.prototype,"_texture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),Tr=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){L.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return L.a.Serialize(this)},e.prototype.parse=function(e){var t=this;L.a.Parse(function(){return t},e,null)},e.DEFAULT_USE_ENERGY_CONSERVATION=!0,e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,e.DEFAULT_USE_SPHERICAL_HARMONICS=!0,l.c([Object(L.c)()],e.prototype,"_useEnergyConservation",void 0),l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useEnergyConservation",void 0),l.c([Object(L.c)()],e.prototype,"_useSmithVisibilityHeightCorrelated",void 0),l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSmithVisibilityHeightCorrelated",void 0),l.c([Object(L.c)()],e.prototype,"_useSphericalHarmonics",void 0),l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSphericalHarmonics",void 0),e}(),Er=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=o.e.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&&or.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&&or.a.SheenTextureEnabled?ir.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&&or.a.SheenTextureEnabled&&(e.updateFloat2("vSheenInfos",this._texture.coordinatesIndex,this._texture.level),ir.a.BindTextureMatrix(this._texture,e,"sheen")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity)),t.texturesEnabled&&this._texture&&or.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){L.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return L.a.Serialize(this)},e.prototype.parse=function(e){var t=this;L.a.Parse(function(){return t},e,null)},l.c([Object(L.c)()],e.prototype,"_isEnabled",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),l.c([Object(L.c)()],e.prototype,"_linkSheenWithAlbedo",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkSheenWithAlbedo",void 0),l.c([Object(L.c)()],e.prototype,"intensity",void 0),l.c([Object(L.e)()],e.prototype,"color",void 0),l.c([Object(L.m)()],e.prototype,"_texture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),Ar=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=o.e.White(),this.tintColorAtDistance=1,this.diffusionDistance=o.e.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&&or.a.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&or.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_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&&or.a.ThicknessTextureEnabled&&ir.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&&or.a.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,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&&or.a.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),ir.a.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),o&&or.a.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",o.getReflectionTextureMatrix());var s=1;o.isCube||o.depth&&(s=o.depth),e.updateFloat4("vRefractionInfos",o.level,1/this._indexOfRefraction,s,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&&or.a.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),o&&or.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){or.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!!(or.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){L.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return L.a.Serialize(this)},e.prototype.parse=function(e){var t=this;L.a.Parse(function(){return t},e,null)},l.c([Object(L.c)()],e.prototype,"_isRefractionEnabled",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isRefractionEnabled",void 0),l.c([Object(L.c)()],e.prototype,"_isTranslucencyEnabled",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTranslucencyEnabled",void 0),l.c([Object(L.c)()],e.prototype,"_isScatteringEnabled",void 0),l.c([Object(L.c)()],e.prototype,"refractionIntensity",void 0),l.c([Object(L.c)()],e.prototype,"translucencyIntensity",void 0),l.c([Object(L.c)()],e.prototype,"scatteringIntensity",void 0),l.c([Object(L.m)()],e.prototype,"_thicknessTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"thicknessTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"refractionTexture",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertRefractionY",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkRefractionWithTransparency",void 0),l.c([Object(L.c)()],e.prototype,"minimumThickness",void 0),l.c([Object(L.c)()],e.prototype,"maximumThickness",void 0),l.c([Object(L.e)()],e.prototype,"tintColor",void 0),l.c([Object(L.c)()],e.prototype,"tintColorAtDistance",void 0),l.c([Object(L.e)()],e.prototype,"diffusionDistance",void 0),l.c([Object(L.c)()],e.prototype,"_useMaskFromThicknessTexture",void 0),l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTexture",void 0),e}(),xr="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";zt.a.IncludesShadersStore.pbrFragmentDeclaration=xr;var Rr="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};";zt.a.IncludesShadersStore.pbrUboDeclaration=Rr;var Pr="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";zt.a.IncludesShadersStore.pbrFragmentExtraDeclaration=Pr;var Sr="#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#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 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#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";zt.a.IncludesShadersStore.pbrFragmentSamplersDeclaration=Sr;i(88);var Cr="\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";zt.a.IncludesShadersStore.pbrHelperFunctions=Cr;var Mr="#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";zt.a.IncludesShadersStore.harmonicsFunctions=Mr;var Or="\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}";zt.a.IncludesShadersStore.pbrDirectLightingSetupFunctions=Or;var Ir="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}";zt.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions=Ir;var Dr="\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\n\n\n\n#ifdef MS_BRDF_ENERGY_CONSERVATION\n\n\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness,sampler2D brdfSampler) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(brdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;\n}\n#endif\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#if defined(SHEEN) && defined(REFLECTION)\n\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\nreturn sheenEnvironmentReflectance;\n}\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\n#ifdef CLEARCOAT\n\n\n\n\n\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\nreturn t*t;\n#endif\n}\n#endif\n\n\n\n\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\n#ifdef SHEEN\n\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;\nfloat cos2h=NdotH*NdotH;\nfloat sin2h=1.-cos2h;\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\nfloat a2=alphaTB.x*alphaTB.y;\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\nfloat v2=dot(v,v);\nfloat w2=a2/v2;\nreturn a2*w2*w2*RECIPROCAL_PI;\n}\n#endif\n\n\n\n\n#ifdef BRDF_V_HEIGHT_CORRELATED\n\n\n\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\n#ifdef MOBILE\n\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\nreturn 0.5/(GGXV+GGXL);\n#else\nfloat a2=alphaG*alphaG;\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\nreturn 0.5/(GGXV+GGXL);\n#endif\n}\n#else\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\n{\n#ifdef MOBILE\n\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nfloat alphaSquared=alphaG*alphaG;\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\n{\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\n\nreturn visibility;\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\nfloat v=0.5/(lambdaV+lambdaL);\nreturn v;\n}\n#endif\n#ifdef CLEARCOAT\nfloat visibility_Kelemen(float VdotH) {\n\n\n\nreturn 0.25/(VdotH*VdotH);\n}\n#endif\n#ifdef SHEEN\n\n\n\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\n{\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\n}\n#endif\n\n\n\n\n\n\n\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\n\n\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel/PI;\n}\n#ifdef SS_TRANSLUCENCY\n\n\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\nvec3 S=1./maxEps(diffusionDistance);\nvec3 temp=exp((-0.333333333*thickness)*S);\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\n}\n\n\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\nfloat t=1.0+w;\nfloat invt2=1.0/square(t);\nreturn saturate((NdotL+w)*invt2);\n}\n#endif\n";zt.a.IncludesShadersStore.pbrBRDFFunctions=Dr;var Lr="#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";zt.a.IncludesShadersStore.pbrDirectLightingFunctions=Lr;var wr="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=microsurfaceAverageSlope*cubeMapDimensionPixels;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\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";zt.a.IncludesShadersStore.pbrIBLFunctions=wr;i(121),i(122),i(123),i(115);var Fr="#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 Vr);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&&or.a.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&or.a.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&or.a.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var s=this._getReflectionTexture();if(s&&or.a.ReflectionTextureEnabled&&!s.isReadyOrNotBlocking())return!1;if(this._lightmapTexture&&or.a.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&or.a.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(or.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&&or.a.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&or.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(Oi.b.NormalKind)||(e.createNormals(!0),p.a.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));var a=t.effect,c=this._prepareEffect(e,n,this.onCompiled,this.onError,i);return c&&(this.allowShaderHotSwapping&&a&&!c.isReady()?(c=a,n.markAsUnprocessed()):(r.resetCachedMaterial(),t.setEffect(c,n),this.buildUniformLayout())),!(!t.effect||!t.effect.isReady())&&(n._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},t.prototype._prepareEffect=function(e,t,i,n,r,o){if(void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),this._prepareDefines(e,t,r,o),!t.isDirty)return null;t.markAsProcessed();var s=this.getScene().getEngine(),a=new zt.c,c=0;t.USESPHERICALINVERTEX&&a.addFallback(c++,"USESPHERICALINVERTEX"),t.FOG&&a.addFallback(c,"FOG"),t.SPECULARAA&&a.addFallback(c,"SPECULARAA"),t.POINTSIZE&&a.addFallback(c,"POINTSIZE"),t.LOGARITHMICDEPTH&&a.addFallback(c,"LOGARITHMICDEPTH"),t.PARALLAX&&a.addFallback(c,"PARALLAX"),t.PARALLAXOCCLUSION&&a.addFallback(c++,"PARALLAXOCCLUSION"),c=br.AddFallbacks(t,a,c),c=br.AddFallbacks(t,a,c),c=Ar.AddFallbacks(t,a,c),c=Er.AddFallbacks(t,a,c),t.ENVIRONMENTBRDF&&a.addFallback(c++,"ENVIRONMENTBRDF"),t.TANGENT&&a.addFallback(c++,"TANGENT"),t.BUMP&&a.addFallback(c++,"BUMP"),c=ir.a.HandleFallbacksForShadows(t,a,this._maxSimultaneousLights,c++),t.SPECULARTERM&&a.addFallback(c++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&a.addFallback(c++,"USESPHERICALFROMREFLECTIONMAP"),t.LIGHTMAP&&a.addFallback(c++,"LIGHTMAP"),t.NORMAL&&a.addFallback(c++,"NORMAL"),t.AMBIENT&&a.addFallback(c++,"AMBIENT"),t.EMISSIVE&&a.addFallback(c++,"EMISSIVE"),t.VERTEXCOLOR&&a.addFallback(c++,"VERTEXCOLOR"),t.NUM_BONE_INFLUENCERS>0&&a.addCPUSkinningFallback(c++,e),t.MORPHTARGETS&&a.addFallback(c++,"MORPHTARGETS"),t.MULTIVIEW&&a.addFallback(0,"MULTIVIEW");var l=[Oi.b.PositionKind];t.NORMAL&&l.push(Oi.b.NormalKind),t.TANGENT&&l.push(Oi.b.TangentKind),t.UV1&&l.push(Oi.b.UVKind),t.UV2&&l.push(Oi.b.UV2Kind),t.VERTEXCOLOR&&l.push(Oi.b.ColorKind),ir.a.PrepareAttributesForBones(l,e,t,a),ir.a.PrepareAttributesForInstances(l,t),ir.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","microSurfaceSampler","environmentBrdfSampler","boneSampler"],f=["Material","Scene"];Ar.AddUniforms(h),Ar.AddSamplers(d),yr.AddUniforms(h),yr.AddSamplers(d),br.AddUniforms(h),br.AddSamplers(d),Er.AddUniforms(h),Er.AddSamplers(d),xi.a&&(xi.a.PrepareUniforms(h,t),xi.a.PrepareSamplers(d,t)),ir.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 s.createEffect(u,{attributes:l,uniformsNames:h,uniformBuffersNames:f,samplers:d,defines:p,fallbacks:a,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS}},s)},t.prototype._prepareDefines=function(e,i,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var o=this.getScene(),s=o.getEngine();if(ir.a.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,ir.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&&or.a.DiffuseTextureEnabled?ir.a.PrepareDefinesForMergedUV(this._albedoTexture,i,"ALBEDO"):i.ALBEDO=!1,this._ambientTexture&&or.a.AmbientTextureEnabled?(ir.a.PrepareDefinesForMergedUV(this._ambientTexture,i,"AMBIENT"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&or.a.OpacityTextureEnabled?(ir.a.PrepareDefinesForMergedUV(this._opacityTexture,i,"OPACITY"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;var a=this._getReflectionTexture();if(a&&or.a.ReflectionTextureEnabled){switch(i.REFLECTION=!0,i.GAMMAREFLECTION=a.gammaSpace,i.RGBDREFLECTION=a.isRGBD,i.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!a.invertZ:a.invertZ,i.LODINREFLECTIONALPHA=a.lodLevelInAlpha,a.coordinatesMode===ke.a.INVCUBIC_MODE&&(i.INVERTCUBICMAP=!0),i.REFLECTIONMAP_3D=a.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,a.coordinatesMode){case ke.a.EXPLICIT_MODE:i.REFLECTIONMAP_EXPLICIT=!0;break;case ke.a.PLANAR_MODE:i.REFLECTIONMAP_PLANAR=!0;break;case ke.a.PROJECTION_MODE:i.REFLECTIONMAP_PROJECTION=!0;break;case ke.a.SKYBOX_MODE:i.REFLECTIONMAP_SKYBOX=!0;break;case ke.a.SPHERICAL_MODE:i.REFLECTIONMAP_SPHERICAL=!0;break;case ke.a.EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case ke.a.FIXED_EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case ke.a.CUBIC_MODE:case ke.a.INVCUBIC_MODE:default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!a.boundingBoxSize}a.coordinatesMode!==ke.a.SKYBOX_MODE?a.sphericalPolynomial&&(i.USESPHERICALFROMREFLECTIONMAP=!0,this._forceIrradianceInFragment||o.getEngine().getCaps().maxVaryingVectors<=8?i.USESPHERICALINVERTEX=!1:i.USESPHERICALINVERTEX=!0):i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!a.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.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1;this._lightmapTexture&&or.a.LightmapTextureEnabled?(ir.a.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace):i.LIGHTMAP=!1,this._emissiveTexture&&or.a.EmissiveTextureEnabled?ir.a.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,or.a.SpecularTextureEnabled?(this._metallicTexture?(ir.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?(ir.a.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._microSurfaceTexture?ir.a.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),o.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&or.a.BumpTextureEnabled&&!this._disableBumpMap?(ir.a.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&or.a.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&or.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.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),i.PREMULTIPLYALPHA=this.alphaMode===_.a.ALPHA_PREMULTIPLIED||this.alphaMode===_.a.ALPHA_PREMULTIPLIED_PORTERDUFF,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel,i.SPECULARAA=o.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(ir.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(Oi.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),ir.a.PrepareDefinesForFrameBoundValues(o,s,i,!!n,r),ir.a.PrepareDefinesForAttributes(e,i,!0,!0,!0,this._transparencyMode!==t.PBRMATERIAL_OPAQUE)},t.prototype.forceCompilation=function(e,t,i){var n=this,r=l.a({clipPlane:!1},i),o=new Vr,s=this._prepareEffect(e,o,void 0,void 0,void 0,r.clipPlane);s.isReady()?t&&t(this):s.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),yr.PrepareUniformBuffer(e),br.PrepareUniformBuffer(e),Er.PrepareUniformBuffer(e),Ar.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(),s=n._materialDefines;if(s){var a=n.effect;if(a){this._activeEffect=a,s.INSTANCES||this.bindOnlyWorldMatrix(e),s.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var c=this._mustRebind(r,a,i.visibility);ir.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&&or.a.DiffuseTextureEnabled&&(u.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),ir.a.BindTextureMatrix(this._albedoTexture,u,"albedo")),this._ambientTexture&&or.a.AmbientTextureEnabled&&(u.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),ir.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&or.a.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),ir.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),l&&or.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)}var f=l.sphericalPolynomial;if(s.USESPHERICALFROMREFLECTIONMAP&&f)if(s.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&&or.a.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),ir.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&or.a.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),ir.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),or.a.SpecularTextureEnabled&&(this._metallicTexture?(u.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),ir.a.BindTextureMatrix(this._metallicTexture,u,"reflectivity")):this._reflectivityTexture&&(u.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),ir.a.BindTextureMatrix(this._reflectivityTexture,u,"reflectivity")),this._microSurfaceTexture&&(u.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),ir.a.BindTextureMatrix(this._microSurfaceTexture,u,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&or.a.BumpTextureEnabled&&!this._disableBumpMap&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),ir.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),s.METALLICWORKFLOW?(o.t.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,o.t.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,u.updateColor4("vReflectivityColor",o.t.Color3[0],0)):u.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface),u.updateColor3("vEmissiveColor",or.a.EmissiveTextureEnabled?this._emissiveColor:o.e.BlackReadOnly),u.updateColor3("vReflectionColor",this._reflectionColor),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,this._lightingInfos.w=this._specularIntensity,u.updateVector4("vLightingIntensity",this._lightingInfos)}r.texturesEnabled&&(this._albedoTexture&&or.a.DiffuseTextureEnabled&&u.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&or.a.AmbientTextureEnabled&&u.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&or.a.OpacityTextureEnabled&&u.setTexture("opacitySampler",this._opacityTexture),l&&or.a.ReflectionTextureEnabled&&(s.LODBASEDMICROSFURACE?u.setTexture("reflectionSampler",l):(u.setTexture("reflectionSampler",l._lodTextureMid||l),u.setTexture("reflectionSamplerLow",l._lodTextureLow||l),u.setTexture("reflectionSamplerHigh",l._lodTextureHigh||l))),s.ENVIRONMENTBRDF&&u.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&or.a.EmissiveTextureEnabled&&u.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&or.a.LightmapTextureEnabled&&u.setTexture("lightmapSampler",this._lightmapTexture),or.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&&or.a.BumpTextureEnabled&&!this._disableBumpMap&&u.setTexture("bumpSampler",this._bumpTexture)),this.subSurface.bindForSubMesh(u,r,h,this.isFrozen,s.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),ir.a.BindClipPlane(this._activeEffect,r),r.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor);var _=r._forcedViewPosition?r._forcedViewPosition:r._mirroredCameraPosition?r._mirroredCameraPosition:r.activeCamera.globalPosition,g=r.useRightHandedSystem===(null!=r._mirroredCameraPosition);a.setFloat4("vEyePosition",_.x,_.y,_.z,g?-1:1),a.setColor3("vAmbientColor",this._globalAmbientColor),a.setFloat2("vDebugMode",this.debugLimit,this.debugFactor)}!c&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&ir.a.BindLights(r,i,this._activeEffect,s,this._maxSimultaneousLights,this._lightFalloff!==t.LIGHTFALLOFF_STANDARD),(r.fogEnabled&&i.applyFog&&r.fogMode!==W.a.FOGMODE_NONE||l)&&this.bindView(a),ir.a.BindFogParameters(r,i,this._activeEffect,!0),s.NUM_MORPH_INFLUENCERS&&ir.a.BindMorphTargetParameters(i,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),ir.a.BindLogDepth(s,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,l.c([Object(L.i)()],t.prototype,"_imageProcessingConfiguration",void 0),l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),l.c([Object(L.c)()],t.prototype,"useLogarithmicDepth",null),l.c([Object(L.c)()],t.prototype,"transparencyMode",null),t}(rr.a),kr=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 o.e(0,0,0),r.albedoColor=new o.e(1,1,1),r.reflectivityColor=new o.e(1,1,1),r.reflectionColor=new o.e(1,1,1),r.emissiveColor=new o.e(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=vr.GetEnvironmentBRDFTexture(n),r}return l.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===Gr.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Gr.LIGHTFALLOFF_PHYSICAL:Gr.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===Gr.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Gr.LIGHTFALLOFF_GLTF:Gr.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=L.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=L.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},t.Parse=function(e,i,n){var r=L.a.Parse(function(){return new t(e.name,i)},e,i,n);return e.clearCoat&&r.clearCoat.parse(e.clearCoat),e.anisotropy&&r.anisotropy.parse(e.anisotropy),e.brdf&&r.brdf.parse(e.brdf),e.sheen&&r.sheen.parse(e.brdf),r},t.PBRMATERIAL_OPAQUE=Gr.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Gr.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Gr.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Gr.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=Gr.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveIntensity",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularIntensity",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"disableBumpMap",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureStrength",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicTexture",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurfaceTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty",null)],t.prototype,"lightmapTexture",void 0),l.c([Object(L.e)("ambient"),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientColor",void 0),l.c([Object(L.e)("albedo"),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoColor",void 0),l.c([Object(L.e)("reflectivity"),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityColor",void 0),l.c([Object(L.e)("reflection"),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionColor",void 0),l.c([Object(L.e)("emissive"),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveColor",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurface",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromAlbedoTexture",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureGreen",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMetallnessFromMetallicTextureBlue",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),l.c([Object(L.c)()],t.prototype,"usePhysicalLightFalloff",null),l.c([Object(L.c)()],t.prototype,"useGLTFLightFalloff",null),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOverAlpha",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),l.c([Object(L.m)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),l.c([Object(L.c)(),Object(L.b)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),t}(Gr);s.a.RegisteredTypes["BABYLON.PBRMaterial"]=kr;var zr=i(62),jr=i(71);function Hr(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var Wr=Hr("DXT1"),Xr=Hr("DXT3"),Yr=Hr("DXT5"),Kr=Hr("DX10"),Qr=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===Kr?i[32]:0,s=_.a.TEXTURETYPE_UNSIGNED_INT;switch(r){case 113:s=_.a.TEXTURETYPE_HALF_FLOAT;break;case 116:s=_.a.TEXTURETYPE_FLOAT;break;case Kr:if(10===o){s=_.a.TEXTURETYPE_HALF_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===Wr||r===Xr||r===Yr,dxgiFormat:o,textureType:s}},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,s){for(var a=new Float32Array(r),c=new Uint16Array(o,n),l=0,u=0;u>8)},e._GetRGBArrayBuffer=function(e,t,i,n,r,o,s,a){for(var c=new Uint8Array(n),l=new Uint8Array(r,i),u=0,h=0;h>8&255,R>>16&255,R>>24&255)))}var C=e._ExtractLongWordOrder(b[23]),M=e._ExtractLongWordOrder(b[24]),O=e._ExtractLongWordOrder(b[25]),I=e._ExtractLongWordOrder(b[26]);P&&(E=t._getRGBABufferInternalSizedFormat(r.textureType)),m=1,131072&b[2]&&!1!==o&&(m=Math.max(1,b[7]));for(var D=c||0;D0?r.sphericalPolynomial=jr.a.ConvertCubeMapToSphericalPolynomial({size:b[4],right:l[0],left:l[1],up:l[2],down:l[3],front:l[4],back:l[5],format:_.a.TEXTUREFORMAT_RGBA,type:_.a.TEXTURETYPE_FLOAT,gammaSpace:!1}):r.sphericalPolynomial=void 0}else p.a.Error("Compressed textures are not supported on this platform.");else p.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else p.a.Error("Invalid magic number in DDS header")},e.StoreLODInAlphaChannel=!1,e}();ge.b.prototype.createPrefilteredCubeTexture=function(e,t,i,n,r,o,s,a,c){var l=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=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 zr.b,o._dataSource=ze.a.DATASOURCE_CUBEPREFILTERED,l.getCaps().textureLOD)r&&r(o);else{var s=l._gl,a=e.width;if(a){for(var u=[],h=0;h<3;h++){var d=1-h/2,f=n,_=D.a.Log2(a)*i+n,g=f+(_-f)*d,m=Math.round(Math.min(Math.max(g,0),_)),v=new ze.a(l,ze.a.DATASOURCE_TEMP);if(v.type=o.type,v.format=o.format,v.width=Math.pow(2,Math.max(D.a.Log2(a)-m,0)),v.height=v.width,v.isCube=!0,l._bindTextureDirectly(s.TEXTURE_CUBE_MAP,v,!0),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),e.isDDS){var y=e.info,b=e.data;l._unpackFlipY(y.isCompressed),Qr.UploadDDSLevels(l,v,b,y,!0,6,m)}else p.a.Warn("DDS is the only prefiltered cube map supported so far.");l._bindTextureDirectly(s.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,s,a,c,i,n)};var qr=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,s=t.getEngine(),a=!1;if(Array.isArray(e))for(var c=0;c1)&&t.generateMipMaps,s._unpackFlipY(o.isCompressed),Qr.UploadDDSLevels(s,t,l,o,a,6,-1,c),o.isFourCC||1!==o.mipmapCount||s.generateMipMapsForCubemap(t)}else{var u=e;o=Qr.GetDDSInfo(u),t.width=o.width,t.height=o.height,i&&(o.sphericalPolynomial=new zr.b),a=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&t.generateMipMaps,s._unpackFlipY(o.isCompressed),Qr.UploadDDSLevels(s,t,u,o,a,6),o.isFourCC||1!==o.mipmapCount||s.generateMipMapsForCubemap(t)}s._setCubeMapTextureParams(a),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=Qr.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(){Qr.UploadDDSLevels(t.getEngine(),t,e,n,r,1)})},e}();ge.b._TextureLoaders.push(new qr);var Zr="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}";zt.a.ShadersStore.rgbdEncodePixelShader=Zr;var Jr=function(){function e(){}return e.GetEnvInfo=function(t){for(var i=new DataView(t),n=0,r=0;r-1?e.substring(0,i):e)+t},e.prototype.getFallbackTextureUrl=function(e,t){var i=new RegExp(t+"$");return e.replace(i,"")},e.prototype.loadCubeData=function(e,t,i,n,r){if(!Array.isArray(e)){t._invertVScale=!t.invertY;var o=t.getEngine(),s=new eo(e,6),a=s.numberOfMipmapLevels>1&&t.generateMipMaps;o._unpackFlipY(!0),s.uploadLevels(t,t.generateMipMaps),t.width=s.pixelWidth,t.height=s.pixelHeight,o._setCubeMapTextureParams(a),t.isReady=!0}},e.prototype.loadData=function(e,t,i){t._invertVScale=!t.invertY;var n=new eo(e,1);i(n.pixelWidth,n.pixelHeight,!1,!0,function(){n.uploadLevels(t,t.generateMipMaps)},n.isInvalid)},e}();ge.b._TextureLoaders.unshift(new to);W.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!a.poster||a.autoPlay&&l?l&&c._createInternalTexture():(c._texture=c._engine.createTexture(a.poster,!1,!0,n),c._displayingPosterTexture=!0),c}return l.d(t,e),Object.defineProperty(t.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new r.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 ye.h.SetCorsBehavior(e.currentSrc,e),e;var t=document.createElement("video");return"string"==typeof e?(ye.h.SetCorsBehavior(e,t),t.src=e):(ye.h.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){p.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){p.a.Error(e.name)})},t}(ke.a),no=function(e){function t(i,n,r,s){var a=e.call(this,i,s)||this;a._useDirectMapping=!1,a._videoMode=t.MODE_MONOSCOPIC,a._onBeforeCameraRenderObserver=null,s=a.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)||(s.activeCamera?.48*s.activeCamera.maxZ:1e3),void 0===r.useDirectMapping?a._useDirectMapping=!0:a._useDirectMapping=r.useDirectMapping,void 0===r.faceForward&&(r.faceForward=!0),a._setReady(!1);var c={loop:r.loop,autoPlay:r.autoPlay,autoUpdateTexture:!0,poster:r.poster},l=a._material=new dr(i+"_material",s),u=a._videoTexture=new io(i+"_texture",n,s,!1,a._useDirectMapping,ke.a.TRILINEAR_SAMPLINGMODE,c);if(a._mesh=fe.a.CreateSphere(i+"_mesh",r.resolution,r.size,s,!1,fe.a.BACKSIDE),u.onLoadObservable.addOnce(function(){a._setReady(!0)}),l.useEquirectangularFOV=!0,l.fovMultiplier=1,l.opacityFresnel=!1,a._useDirectMapping?(u.wrapU=ke.a.CLAMP_ADDRESSMODE,u.wrapV=ke.a.CLAMP_ADDRESSMODE,l.diffuseTexture=u):(u.coordinatesMode=ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,u.wrapV=ke.a.CLAMP_ADDRESSMODE,l.reflectionTexture=u),a._mesh.material=l,a._mesh.parent=a,r.clickToPlay&&(s.onPointerUp=function(){a._videoTexture.video.play()}),r.faceForward&&s.activeCamera){var h=s.activeCamera,d=o.x.Forward(),f=o.x.TransformNormal(d,h.getViewMatrix());f.normalize(),a.rotation.y=Math.acos(o.x.Dot(d,f))}return a}return l.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}),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=.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){i._videoTexture.uOffset=e.isRightCamera?.5:0});break;case t.MODE_TOPBOTTOM:this._videoTexture.vScale=.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}(_r.a),ro=function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new ye.f,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new ye.f,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}(),oo=function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new ye.f,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new ye.f,this._captureFrameTime=!1,this._frameTime=new ye.f,this._captureRenderTime=!1,this._renderTime=new ye.f,this._captureInterFrameTime=!1,this._interFrameTime=new ye.f,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new ye.f,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new ye.f,this._capturePhysicsTime=!1,this._physicsTime=new ye.f,this._captureAnimationsTime=!1,this._animationsTime=new ye.f,this._captureCameraRenderTime=!1,this._cameraRenderTime=new ye.f,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&&(ye.h.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&&(ye.h.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(){ye.h.StartPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.beginMonitoring()}),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add(function(){ye.h.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(){ye.h.StartPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.beginMonitoring()}),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add(function(){ye.h.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(){ye.h.StartPerformanceCounter("Particles"),t._particlesRenderTime.beginMonitoring()}),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add(function(){ye.h.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(){ye.h.StartPerformanceCounter("Sprites"),t._spritesRenderTime.beginMonitoring()}),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add(function(){ye.h.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(){ye.h.StartPerformanceCounter("Physics"),t._physicsTime.beginMonitoring()}),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add(function(){ye.h.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(),ye.h.StartPerformanceCounter("Main render")}),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add(function(){t._renderTime.endMonitoring(!1),ye.h.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(),ye.h.StartPerformanceCounter("Rendering camera "+e.name)}),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add(function(e){t._cameraRenderTime.endMonitoring(!1),ye.h.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}(),so=i(20),ao="#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(Oi.b.MatricesIndicesExtraKind),o.push(Oi.b.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),r.push("#define BonesPerMesh "+(s.skeleton?s.skeleton.bones.length+1:0))):r.push("#define NUM_BONE_INFLUENCERS 0");var f=s.morphTargetManager,p=0;f&&f.numInfluencers>0&&(r.push("#define MORPHTARGETS"),p=f.numInfluencers,r.push("#define NUM_MORPH_INFLUENCERS "+p),ir.a.PrepareAttributesForMorphTargets(o,s,{NUM_MORPH_INFLUENCERS:p})),t&&(r.push("#define INSTANCES"),o.push("world0"),o.push("world1"),o.push("world2"),o.push("world3")),this._addCustomEffectDefines(r);var _=r.join("\n");return this._cachedDefines!==_&&(this._cachedDefines=_,this._effectLayerMapGenerationEffect=this._scene.getEngine().createEffect("glowMapGeneration",o,["world","mBones","viewProjection","glowColor","morphTargetInfluences","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity"],["diffuseSampler","emissiveSampler","opacitySampler"],_,void 0,void 0,void 0,{maxSimultaneousMorphTargets:p})),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 ye.h.Instantiate(e.customType).Parse(e,t,i)},e._SceneComponentInitialization=function(e){throw be.a.WarnImport("EffectLayerSceneComponent")},l.c([Object(L.c)()],e.prototype,"name",void 0),l.c([Object(L.f)()],e.prototype,"neutralColor",void 0),l.c([Object(L.c)()],e.prototype,"isEnabled",void 0),l.c([Object(L.d)()],e.prototype,"camera",null),l.c([Object(L.c)()],e.prototype,"renderingGroupId",null),e}();n.a.AddParser(Ae.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 s=o._mainTexture;s._shouldRender()&&(this.scene.incrementRenderId(),s.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}(),yo="\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}";zt.a.ShadersStore.layerPixelShader=yo;var bo="\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}";zt.a.ShadersStore.layerVertexShader=bo;var To=function(){function e(e,t,i,n,s){this.name=e,this.scale=new o.w(1,1),this.offset=new o.w(0,0),this.alphaBlendingMode=_.a.ALPHA_COMBINE,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this._vertexBuffers={},this.onDisposeObservable=new r.c,this.onBeforeRenderObservable=new r.c,this.onAfterRenderObservable=new r.c,this.texture=t?new ke.a(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===s?new o.f(1,1,1,1):s,this._scene=i||P.a.LastCreatedScene;var a=this._scene._getComponent(Ae.a.NAME_LAYER);a||(a=new vo(this._scene),this._scene._addComponent(a)),this._scene.layers.push(this);var c=this._scene.getEngine(),l=[];l.push(1,1),l.push(-1,1),l.push(-1,-1),l.push(1,-1);var u=new Oi.b(c,l,Oi.b.PositionKind,!1,!1,2);this._vertexBuffers[Oi.b.PositionKind]=u,this._createIndexBuffer(),this._effect=c.createEffect("layer",[Oi.b.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],""),this._alphaTestEffect=c.createEffect("layer",[Oi.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[Oi.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(so.a.TriangleFillMode,0,6):(t.setAlphaMode(this.alphaBlendingMode),t.drawElementsType(so.a.TriangleFillMode,0,6),t.setAlphaMode(_.a.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this)}},e.prototype.dispose=function(){var e=this._vertexBuffers[Oi.b.PositionKind];e&&(e.dispose(),this._vertexBuffers[Oi.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}(),Eo=function(){function e(e,t,i,n,r){this.size=e,this.position=t,this.alphaMode=_.a.ALPHA_ONEONE,this.color=i||new o.e(1,1,1),this.texture=n?new ke.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}(),Ao="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}";zt.a.ShadersStore.lensFlarePixelShader=Ao;var xo="\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}";zt.a.ShadersStore.lensFlareVertexShader=xo;var Ro=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||P.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[Oi.b.PositionKind]=new Oi.b(r,o,Oi.b.PositionKind,!1,!1,2);var s=[];s.push(0),s.push(1),s.push(2),s.push(0),s.push(2),s.push(3),this._indexBuffer=r.createIndexBuffer(s),this._effect=r.createEffect("lensFlare",[Oi.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=o.x.Project(t,o.j.Identity(),this._scene.getTransformMatrix(),e),this._positionX=t.x,this._positionY=t.y,t=o.x.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 It.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 s=1-D.a.Clamp(r/this.borderLimit,0,1);if(s<0)return!1;s>1&&(s=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 a=n.x+n.width/2,c=n.y+n.height/2,l=a-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}();Ro._SceneComponentInitialization=function(e){var t=e._getComponent(Ae.a.NAME_LENSFLARESYSTEM);t||(t=new Po(e),e._addComponent(t))};var So="#ifndef FLOAT\nvec4 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}\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}";zt.a.ShadersStore.shadowMapPixelShader=So;var Co="\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#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(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";zt.a.ShadersStore.shadowMapVertexShader=Co;var Mo="\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}";zt.a.ShadersStore.depthBoxBlurPixelShader=Mo;var Oo=function(){function e(t,i,n){this.onBeforeShadowMapRenderObservable=new r.c,this.onBeforeShadowMapRenderMeshObservable=new r.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=o.x.Zero(),this._viewMatrix=o.j.Zero(),this._projectionMatrix=o.j.Zero(),this._transformMatrix=o.j.Zero(),this._cachedPosition=new o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new o.x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=o.j.Identity(),this._mapSize=t,this._light=i,this._scene=i.getScene(),i._shadowGenerator=this,e._SceneComponentInitialization(this._scene);var s=this._scene.getEngine().getCaps();n?s.textureFloatRender&&s.textureFloatLinearFiltering?this._textureType=_.a.TEXTURETYPE_FLOAT:s.textureHalfFloatRender&&s.textureHalfFloatLinearFiltering?this._textureType=_.a.TEXTURETYPE_HALF_FLOAT:this._textureType=_.a.TEXTURETYPE_UNSIGNED_INT:s.textureHalfFloatRender&&s.textureHalfFloatLinearFiltering?this._textureType=_.a.TEXTURETYPE_HALF_FLOAT:s.textureFloatRender&&s.textureFloatLinearFiltering?this._textureType=_.a.TEXTURETYPE_FLOAT:this._textureType=_.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},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}),e.prototype.getDarkness=function(){return this._darkness},e.prototype.setDarkness=function(e){return this._darkness=e>=1?1:e<=0?0:e,this},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.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 _i(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture(_.a.LESS,!0)):this._shadowMap=new _i(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube()),this._shadowMap.wrapU=ke.a.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=ke.a.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode(ke.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 o.f(0,0,0,0),r=new o.f(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)})},e.prototype._initializeBlurRTTAndPostProcesses=function(){var e=this,t=this._scene.getEngine(),i=this._mapSize/this.blurScale;this.useKernelBlur&&1===this.blurScale||(this._shadowMap2=new _i(this._light.name+"_shadowMap2",i,this._scene,!1,!0,this._textureType),this._shadowMap2.wrapU=ke.a.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=ke.a.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode(ke.a.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new $n(this._light.name+"KernelBlurX",new o.w(1,0),this.blurKernel,1,null,ke.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 $n(this._light.name+"KernelBlurY",new o.w(0,1),this.blurKernel,1,null,ke.a.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===_.a.TEXTURETYPE_UNSIGNED_INT&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new Ht(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,ke.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=s.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!==_.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=[Oi.b.PositionKind],r=e.getMesh(),o=e.getMaterial();if(this.normalBias&&r.isVerticesDataPresent(Oi.b.NormalKind)&&(n.push(Oi.b.NormalKind),i.push("#define NORMAL"),r.nonUniformScaling&&i.push("#define NONUNIFORMSCALING"),this.getLight().getTypeID()===zn.a.LIGHTTYPEID_DIRECTIONALLIGHT&&i.push("#define DIRECTIONINLIGHTDATA")),o&&o.needAlphaTesting()){var s=o.getAlphaTestTexture();s&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(Oi.b.UVKind)&&(n.push(Oi.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(Oi.b.UV2Kind)&&1===s.coordinatesIndex&&(n.push(Oi.b.UV2Kind),i.push("#define UV2")))}if(r.useBones&&r.computeBonesUsingShaders&&r.skeleton){n.push(Oi.b.MatricesIndicesKind),n.push(Oi.b.MatricesWeightsKind),r.numBoneInfluencers>4&&(n.push(Oi.b.MatricesIndicesExtraKind),n.push(Oi.b.MatricesWeightsExtraKind));var a=r.skeleton;i.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),a.isUsingTextureForMatrices?i.push("#define BONETEXTURE"):i.push("#define BonesPerMesh "+(a.bones.length+1))}else i.push("#define NUM_BONE_INFLUENCERS 0");var c=r.morphTargetManager,l=0;if(c&&c.numInfluencers>0&&(i.push("#define MORPHTARGETS"),l=c.numInfluencers,i.push("#define NUM_MORPH_INFLUENCERS "+l),ir.a.PrepareAttributesForMorphTargets(n,r,{NUM_MORPH_INFLUENCERS:l})),t&&(i.push("#define INSTANCES"),n.push("world0"),n.push("world1"),n.push("world2"),n.push("world3")),this.customShaderOptions&&this.customShaderOptions.defines)for(var u=0,h=this.customShaderOptions.defines;uMath.PI;)r-=2*Math.PI;var s=r/Math.PI,a=o/Math.PI;s=.5*s+.5;var c=Math.round(s*i);c<0?c=0:c>=i&&(c=i-1);var l=Math.round(a*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 o.x(-1,-1,-1),new o.x(1,-1,-1),new o.x(-1,1,-1),new o.x(1,1,-1)],e.FACE_BACK=[new o.x(1,-1,1),new o.x(-1,-1,1),new o.x(1,1,1),new o.x(-1,1,1)],e.FACE_RIGHT=[new o.x(1,-1,-1),new o.x(1,-1,1),new o.x(1,1,-1),new o.x(1,1,1)],e.FACE_LEFT=[new o.x(-1,-1,1),new o.x(-1,-1,-1),new o.x(-1,1,1),new o.x(-1,1,-1)],e.FACE_DOWN=[new o.x(-1,1,-1),new o.x(1,1,-1),new o.x(-1,1,1),new o.x(1,1,1)],e.FACE_UP=[new o.x(-1,-1,1),new o.x(1,-1,1),new o.x(-1,-1,-1),new o.x(1,-1,-1)],e}(),Bo=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:s+=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 No.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,s,a=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),g=new Float32Array(_);a>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==(s=i-128)||s>h-u)throw"HDR Bad Format, bad scanline data (run)";for(;s-- >0;)p[u++]=n}else{if(0==(s=i)||s>h-u)throw"HDR Bad Format, bad scanline data (non-run)";if(p[u++]=n,--s>0)for(var m=0;m255){var m=255/g;f*=m,p*=m,_*=m}c[3*d+0]=f,c[3*d+1]=p,c[3*d+2]=_}c?a.push(c):a.push(h)}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===ge.b.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=ge.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(_.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=o.x.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(r.boundingBoxSize=o.x.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);s.a.RegisteredTypes["BABYLON.HDRCubeTexture"]=Uo;var Vo=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.onInfluenceChanged=new r.c,this._onDataLayoutChanged=new r.c,this._animationPropertiesOverride=null,this._scene=i||P.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}),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.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())),L.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.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._removeAfterStep.forEach(function(e){t.world.remove(e.physicsBody)}),this._removeAfterStep=[])},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(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 s in o)o.hasOwnProperty(s)&&(r[s]=o[s]);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,s){if(n&&s.rotationQuaternion){var a=s.getPhysicsImpostor();if(a)if(a.parent!==e){var c=s.getAbsolutePosition().subtract(e.object.getAbsolutePosition()),l=s.rotationQuaternion.multiply(o.q.Inverse(n));a.physicsBody&&(t.removePhysicsBody(a),a.physicsBody=null),a.parent=e,a.resetUpdateFlags(),e.physicsBody.addShape(t._createShape(a),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+=a.getParam("mass")}n.multiplyInPlace(s.rotationQuaternion),s.getChildMeshes(!0).filter(function(e){return!!e.physicsImpostor}).forEach(r.bind(t,s.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),this._removeAfterStep.push(e)},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 zo.e.HingeJoint:case zo.e.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,o);break;case zo.e.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case zo.e.SpringJoint:var s=r;n=new this.BJSCANNON.Spring(t,i,{restLength:s.length,stiffness:s.stiffness,damping:s.damping,localAnchorA:o.pivotA,localAnchorB:o.pivotB});break;case zo.e.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,o);break;case zo.e.PointToPointJoint:case zo.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!==zo.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!==zo.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));a++);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}();jo.DefaultPluginFactory=function(){return new Wo};var Xo=function(){function e(e,t){void 0===t&&(t=OIMO),this.name="OimoJSPlugin",this._tmpImpostorsArray=[],this._tmpPositionVector=o.x.Zero(),this.BJSOIMO=t,this.world=new this.BJSOIMO.World({iterations:e}),this.world.clear(),this._raycastResult=new Ho}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){p.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];(a=e.object).getChildMeshes&&a.getChildMeshes().forEach(function(e){e.physicsImpostor&&n.push(e.physicsImpostor)});var r=function(e){return Math.max(e,jo.Epsilon)},s=new o.q;n.forEach(function(n){if(n.object.rotationQuaternion){var o=n.object.rotationQuaternion;s=o.clone();var a=o.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*a.x),i.rotShape.push(57.29577951308232*a.y),i.rotShape.push(57.29577951308232*a.z)}switch(n.type){case ko.a.ParticleImpostor:p.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case ko.a.SphereImpostor:var h=c.x,d=c.y,f=c.z,_=Math.max(r(h),r(d),r(f))/2;i.type.push("sphere"),i.size.push(_),i.size.push(_),i.size.push(_);break;case ko.a.CylinderImpostor:var g=r(c.x)/2,m=r(c.y);i.type.push("cylinder"),i.size.push(g),i.size.push(m),i.size.push(m);break;case ko.a.PlaneImpostor:case ko.a.BoxImpostor:default:g=r(c.x),m=r(c.y);var v=r(c.z);i.type.push("box"),i.size.push(g),i.size.push(m),i.size.push(v)}n.object.rotationQuaternion=o}}),e.physicsBody=this.world.add(i),e.physicsBody.resetQuaternion(s),e.physicsBody.updatePosition(0)}else this._tmpPositionVector.copyFromFloats(0,0,0);var a;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||{},s={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 zo.e.BallAndSocketJoint:n="jointBall";break;case zo.e.SpringJoint:p.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");var a=r;s.min=a.length||s.min,s.max=Math.max(s.min,s.max);case zo.e.DistanceJoint:n="jointDistance",s.max=r.maxDistance;break;case zo.e.PrismaticJoint:n="jointPrisme";break;case zo.e.SliderJoint:n="jointSlide";break;case zo.e.WheelJoint:n="jointWheel";break;case zo.e.HingeJoint:default:n="jointHinge"}s.type=n,e.joint.physicsJoint=this.world.add(s)}},e.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){p.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 o.x(t.x,t.y,t.z):null},e.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new o.x(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?p.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 p.a.Warn("raycast is not currently supported by the Oimo physics plugin"),this._raycastResult.reset(e,t),this._raycastResult},e}();Mi.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),s=e.offset||o;s=s>o?o:Math.floor(s);var a,c,l,u,h=0===e.sideOrientation?0:e.sideOrientation||Mi.a.DEFAULTSIDE,d=e.uvs,f=e.colors,p=[],_=[],g=[],m=[],v=[],y=[],b=[],T=[],E=[],A=[];if(t.length<2){var x=[],R=[];for(l=0;l0&&(C=P[u].subtract(P[u-1]).length()+b[c],v[c].push(C),b[c]=C),u++;n&&(u--,p.push(P[0].x,P[0].y,P[0].z),C=P[u].subtract(P[0]).length()+b[c],v[c].push(C),b[c]=C),E[c]=S+D,A[c]=I,I+=S+D}var L,w,F=null,N=null;for(l=0;l3?0:u,h);var A=Yo.CreateRibbon(e,{pathArray:b,closeArray:c,closePath:l,updatable:f,sideOrientation:p,invertUV:g,frontUVs:m||void 0,backUVs:v||void 0},d);return A._creationDataStorage.pathArray=b,A._creationDataStorage.path3D=y,A._creationDataStorage.cap=u,A},e}(),Qo=function(){function e(e,t){var i=this;void 0===e&&(e=!0),void 0===t&&(t=Ammo),this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name="AmmoJSPlugin",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new o.q,this._tmpContactCallbackResult=!1,this._tmpVector=new o.x,this._tmpMatrix=new o.j,"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=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(){i._tmpContactCallbackResult=!0},this._raycastResult=new Ho,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)):p.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(a))for(var c=0,l=a._onPhysicsCollideCallbacks;c3?3:a;var c=(new Ammo.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,a);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 s=i.getIndices();s||(s=[]);var a=i.getVerticesData(Oi.b.PositionKind);a||(a=[]),i.computeWorldMatrix(!1);for(var c=s.length/3,l=0;l0){if(e.type!=ko.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 ko.a.SphereImpostor:n=new Ammo.btSphereShape(s.x/2);break;case ko.a.CylinderImpostor:this._tmpAmmoVectorA.setValue(s.x/2,s.y/2,s.z/2),n=new Ammo.btCylinderShape(this._tmpAmmoVectorA);break;case ko.a.PlaneImpostor:case ko.a.BoxImpostor:this._tmpAmmoVectorA.setValue(s.x/2,s.y/2,s.z/2),n=new Ammo.btBoxShape(this._tmpAmmoVectorA);break;case ko.a.MeshImpostor:if(0==e.getParam("mass")){var u=new Ammo.btTriangleMesh;e._pluginData.toDispose.push(u);var h=this._addMeshVerts(u,r,r);n=0==h?new Ammo.btCompoundShape:new Ammo.btBvhTriangleMeshShape(u);break}case ko.a.ConvexHullImpostor:var d=new Ammo.btConvexHullShape;0==(h=this._addHullVerts(d,r,r))?(e._pluginData.toDispose.push(d),n=new Ammo.btCompoundShape):n=d;break;case ko.a.NoImpostor:n=new Ammo.btSphereShape(s.x/2);break;case ko.a.SoftbodyImpostor:n=this._createSoftbody(e);break;case ko.a.ClothImpostor:n=this._createCloth(e);break;case ko.a.RopeImpostor:n=this._createRope(e);break;default:p.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();return t?new o.x(t.x(),t.y(),t.z()):null},e.prototype.getAngularVelocity=function(e){if(e.soft)var t=e.physicsBody.angularVelocity();else t=e.physicsBody.getAngularVelocity();return t?new o.x(t.x(),t.y(),t.z()):null},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:(p.a.Warn("Pressure is not a property of a rigid body"),0)},e.prototype.setBodyPressure=function(e,t){e.soft?e.type===ko.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):p.a.Warn("Pressure can only be applied to a softbody")},e.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(p.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):p.a.Warn("Stiffness cannot be applied to a rigid body")},e.prototype.getBodyVelocityIterations=function(e){return e.soft?e._pluginData.velocityIterations||0:(p.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):p.a.Warn("Velocity iterations cannot be applied to a rigid body")},e.prototype.getBodyPositionIterations=function(e){return e.soft?e._pluginData.positionIterations||0:(p.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):p.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 s=e.segments,a=Math.round((s-1)*i)+s*(s-1-Math.round((s-1)*n));e.physicsBody.appendAnchor(a,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){p.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){p.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){p.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()),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 qo=function(){function e(e,t,i,n,r){var s=this;void 0===n&&(n=!0),void 0===r&&(r=!1),this.name=e,this._viewMatrix=o.j.Identity(),this._target=o.x.Zero(),this._add=o.x.Zero(),this._invertYAxis=!1,this.position=o.x.Zero(),this._scene=i,this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this),this._renderTargetTexture=new _i(e,t,i,n,!0,r?_.a.TEXTURETYPE_FLOAT:_.a.TEXTURETYPE_UNSIGNED_INT,!0),this._renderTargetTexture.onBeforeRenderObservable.add(function(e){switch(e){case 0:s._add.copyFromFloats(1,0,0);break;case 1:s._add.copyFromFloats(-1,0,0);break;case 2:s._add.copyFromFloats(0,s._invertYAxis?1:-1,0);break;case 3:s._add.copyFromFloats(0,s._invertYAxis?-1:1,0);break;case 4:s._add.copyFromFloats(0,0,1);break;case 5:s._add.copyFromFloats(0,0,-1)}s._attachedMesh&&s.position.copyFrom(s._attachedMesh.getAbsolutePosition()),s.position.addToRef(s._add,s._target),o.j.LookAtLHToRef(s.position,s._target,o.x.Up(),s._viewMatrix),i.activeCamera&&(s._projectionMatrix=o.j.PerspectiveFovLH(Math.PI/2,1,i.activeCamera.minZ,i.activeCamera.maxZ),i.setTransformMatrix(s._viewMatrix,s._projectionMatrix)),i._forcedViewPosition=s.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=L.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 s=o.length>n.length?o[o.length-1]:0;i.setEnabled(!1);for(var a=0;a0&&i.addLODLevel(s,null),!0===r&&i.setEnabled(!0)}else ye.h.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}},ts=function(e,t,i,r,o){void 0===o&&(o=!1);var a=new _e(e),c="importScene has failed JSON parse";try{var l=JSON.parse(t);c="";var u,h,d=bn.loggingLevel===bn.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 _=l.environmentTextureSize?l.environmentTextureSize:128,g=new Uo((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e,_,!0,!f);l.environmentTextureRotationY&&(g.rotationY=l.environmentTextureRotationY),e.environmentTexture=g}else if(ye.h.EndsWith(l.environmentTexture,".env")){var m=new tr((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(m.rotationY=l.environmentTextureRotationY),e.environmentTexture=m}else{var v=tr.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.lights&&null!==l.lights)for(u=0,h=l.lights.length;u0){for(var te=0;te0){for(var ne=0;ne-1&&void 0!==u.skeletons&&null!==u.skeletons)if(!1===m.indexOf(y.skeletonId)>-1)for(var O=0,I=u.skeletons.length;O1,n.wrapU=_.a.TEXTURE_CLAMP_ADDRESSMODE,n.wrapV=_.a.TEXTURE_CLAMP_ADDRESSMODE,n.wrapR=_.a.TEXTURE_CLAMP_ADDRESSMODE,n.anisotropicFilteringLevel=1,n._texture=n._getFromCache(t,!0),n._texture||(i.useDelayedTextureLoading?n.delayLoadState=_.a.DELAYLOADSTATE_NOTLOADED:n.loadTexture()),n):n}return l.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,_.a.TEXTUREFORMAT_RGBA,!1,!1,_.a.TEXTURE_BILINEAR_SAMPLINGMODE):i.createRawTexture3D(null,1,1,1,_.a.TEXTUREFORMAT_RGBA,!1,!1,_.a.TEXTURE_BILINEAR_SAMPLINGMODE),this._texture=e;var n=function(n){if("string"==typeof n){for(var r,o=null,s=null,a=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=s[f];o[f]=b/d*255}e.is3D?(e.updateSize(c,c,c),i.updateRawTexture3D(e,o,_.a.TEXTUREFORMAT_RGBA,!1)):(e.updateSize(c*c,c),i.updateRawTexture(e,o,_.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===_.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=_.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);s.a.RegisteredTypes["BABYLON.ColorGradingTexture"]=cs;var ls=function(e){function t(t,i,n,r,o,s,a){void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===s&&(s=null),void 0===a&&(a=null);var c=e.call(this,i)||this;if(c._onLoad=null,c._onError=null,c.coordinatesMode=ke.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=s,c._onError=a,c.hasAlpha=!1,c.isCube=!0,c._texture=c._getFromCache(t,c._noMipmap),c._texture?s&&(c._texture.isReady?ye.h.SetImmediate(function(){return s()}):c._texture.onLoadedObservable.add(s)):i.useDelayedTextureLoading?c.delayLoadState=ge.b.DELAYLOADSTATE_NOTLOADED:c.loadImage(c.loadTexture.bind(c),c._onError),c}return l.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,ge.b.TEXTUREFORMAT_RGB,i.getEngine().getCaps().textureFloat?ge.b.TEXTURETYPE_FLOAT:ge.b.TEXTURETYPE_UNSIGNED_INTEGER,this._noMipmap,function(){for(var i=e.getFloat32ArrayFromArrayBuffer(e._buffer),n=No.ConvertPanoramaToCubemap(i,e._width,e._height,e._size),r=[],o=0;o<6;o++){var s=n[t._FacesMapping[o]];r.push(s)}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)p.a.Error("Unable to load TGA file - Not enough data");else{n+=r.id_length;var o,s=!1,a=!1,c=!1;switch(r.image_type){case e._TYPE_RLE_INDEXED:s=!0;case e._TYPE_INDEXED:a=!0;break;case e._TYPE_RLE_RGB:s=!0;case e._TYPE_RGB:break;case e._TYPE_RLE_GREY:s=!0;case e._TYPE_GREY:c=!0}var l,u,h,d,f,_,g,m=r.pixel_size>>3,v=r.width*r.height*m;if(a&&(l=i.subarray(n,n+=r.colormap_length*(r.colormap_size>>3))),s){var y,b,T;o=new Uint8Array(v);for(var E=0,A=new Uint8Array(m);n>e._ORIGIN_SHIFT){default:case e._ORIGIN_UL:u=0,d=1,g=r.width,h=0,f=1,_=r.height;break;case e._ORIGIN_BL:u=0,d=1,g=r.width,h=r.height-1,f=-1,_=-1;break;case e._ORIGIN_UR:u=r.width-1,d=-1,g=-1,h=0,f=1,_=r.height;break;case e._ORIGIN_BR:u=r.width-1,d=-1,g=-1,h=r.height-1,f=-1,_=-1}var x=e["_getImageData"+(c?"Grey":"")+r.pixel_size+"bits"](r,l,o,h,f,_,u,d,g);t.getEngine()._uploadDataToTextureDirectly(t,x)}}},e._getImageData8bits=function(e,t,i,n,r,o,s,a,c){var l,u,h,d=i,f=t,p=e.width,_=e.height,g=0,m=new Uint8Array(p*_*4);for(h=n;h!==o;h+=r)for(u=s;u!==c;u+=a,g++)l=d[g],m[4*(u+p*h)+3]=255,m[4*(u+p*h)+2]=f[3*l+0],m[4*(u+p*h)+1]=f[3*l+1],m[4*(u+p*h)+0]=f[3*l+2];return m},e._getImageData16bits=function(e,t,i,n,r,o,s,a,c){var l,u,h,d=i,f=e.width,p=e.height,_=0,g=new Uint8Array(f*p*4);for(h=n;h!==o;h+=r)for(u=s;u!==c;u+=a,_+=2){var m=255*((31744&(l=d[_+0]+(d[_+1]<<8)))>>10)/31|0,v=255*((992&l)>>5)/31|0,y=255*(31&l)/31|0;g[4*(u+f*h)+0]=m,g[4*(u+f*h)+1]=v,g[4*(u+f*h)+2]=y,g[4*(u+f*h)+3]=32768&l?0:255}return g},e._getImageData24bits=function(e,t,i,n,r,o,s,a,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=s;l!==c;l+=a,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,s,a,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=s;l!==c;l+=a,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,s,a,c){var l,u,h,d=i,f=e.width,p=e.height,_=0,g=new Uint8Array(f*p*4);for(h=n;h!==o;h+=r)for(u=s;u!==c;u+=a,_++)l=d[_],g[4*(u+f*h)+0]=l,g[4*(u+f*h)+1]=l,g[4*(u+f*h)+2]=l,g[4*(u+f*h)+3]=255;return g},e._getImageDataGrey16bits=function(e,t,i,n,r,o,s,a,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=s;l!==c;l+=a,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}(),hs=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=us.GetTGAHeader(n);i(r.width,r.height,t.generateMipMaps,!1,function(){us.UploadContent(t,n)})},e}();ge.b._TextureLoaders.push(new hs),ge.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,s.width,s.height,0,0,s.width,s.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"];g.push(A),m.push(x),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,_,0,h.RGBA,this._getWebGLTextureType(T),null),h.framebufferTexture2D(h.DRAW_FRAMEBUFFER,x,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=_,A.width=f,A.height=_,A.isReady=!0,A.samples=1,A.generateMipMaps=i,A.samplingMode=b,A.type=T,A._generateDepthBuffer=n,A._generateStencilBuffer=r,A._attachments=m,this._internalTexturesCache.push(A)}if(o&&this._caps.depthTextureExtension){var R=new ze.a(this,ze.a.DATASOURCE_MULTIRENDERTARGET);h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,R._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,_,0,h.DEPTH_COMPONENT,h.UNSIGNED_SHORT,null),h.framebufferTexture2D(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.TEXTURE_2D,R._webGLTexture,0),R._framebuffer=d,R.baseWidth=f,R.baseHeight=_,R.width=f,R.height=_,R.isReady=!0,R.samples=1,R.generateMipMaps=i,R.samplingMode=h.NEAREST,R._generateDepthBuffer=n,R._generateStencilBuffer=r,g.push(R),this._internalTexturesCache.push(R)}return h.drawBuffers(m),h.bindRenderbuffer(h.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),this.resetTextureCache(),g},ge.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,i.getParameter(i.MAX_SAMPLES)),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),s=[];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(a.type),a.width,a.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,c,i.RENDERBUFFER,l),a._MSAAFramebuffer=r,a._MSAARenderBuffer=l,a.samples=t,a._depthStencilBuffer=o,i.bindRenderbuffer(i.RENDERBUFFER,null),s.push(c)}i.drawBuffers(s)}else this._bindUnboundFramebuffer(e[0]._framebuffer);return this._bindUnboundFramebuffer(null),t};var ds=function(e){function t(t,i,n,r,o){var s=this,a=!(!o||!o.generateMipMaps)&&o.generateMipMaps,c=!(!o||!o.generateDepthTexture)&&o.generateDepthTexture,l=!o||void 0===o.doNotChangeAspectRatio||o.doNotChangeAspectRatio;if((s=e.call(this,t,i,r,a,l)||this)._engine=r.getEngine(),s.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}(_i),fs=function(){function e(e){this.name=Ae.a.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array,e.layers=new Array}return e.prototype.register=function(){this.scene._beforeClearStage.registerStep(Ae.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){ye.h.StartPerformanceCounter("Procedural textures",this.scene.proceduralTextures.length>0);for(var e=0;e0)}},e}(),ps="\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}";zt.a.ShadersStore.proceduralVertexShader=ps;var _s=function(e){function t(t,i,n,o,s,a,c){void 0===s&&(s=null),void 0===a&&(a=!0),void 0===c&&(c=!1);var l=e.call(this,null,o,!a)||this;l.isCube=c,l.isEnabled=!0,l.autoClear=!0,l.onGeneratedObservable=new r.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=(o=l.getScene())._getComponent(Ae.a.NAME_PROCEDURALTEXTURE);u||(u=new fs(o),o._addComponent(u)),o.proceduralTextures.push(l),l._engine=o.getEngine(),l.name=t,l.isRenderTarget=!0,l._size=i,l._generateMipMaps=a,l.setFragment(n),l._fallbackTexture=s,c?(l._texture=l._engine.createRenderTargetCubeTexture(i,{generateMipMaps:a,generateDepthBuffer:!1,generateStencilBuffer:!1}),l.setFloat("face",0)):l._texture=l._engine.createRenderTargetTexture(i,{generateMipMaps:a,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[Oi.b.PositionKind]=new Oi.b(l._engine,h,Oi.b.PositionKind,!1,!1,2),l._createIndexBuffer(),l}return l.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[Oi.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===_i.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=_i.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,[Oi.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(so.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(so.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[Oi.b.PositionKind];n&&(n.dispose(),this._vertexBuffers[Oi.b.PositionKind]=null),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),e.prototype.dispose.call(this)}},l.c([Object(L.c)()],t.prototype,"isEnabled",void 0),l.c([Object(L.c)()],t.prototype,"autoClear",void 0),l.c([Object(L.c)()],t.prototype,"_generateMipMaps",void 0),l.c([Object(L.c)()],t.prototype,"_size",void 0),l.c([Object(L.c)()],t.prototype,"refreshRate",null),t}(ke.a),gs=i(60),ms=function(e){function t(t,i,n,r,o,s){var a=e.call(this,t,n,null,r,o,s)||this;return a._animate=!0,a._time=0,a._texturePath=i,a._loadJson(i),a.refreshRate=1,a}return l.d(t,e),t.prototype._loadJson=function(e){var t=this,i=function(){p.a.Log("No config file found in "+e+" trying to use ShadersStore or DOM element");try{t.setFragment(t._texturePath)}catch(e){p.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture")}},n=e+"/config.json",r=new gs.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){p.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;ee.EPSILON?1:0;l|=h,u.push(h)}switch(l){case 0:(o.x.Dot(this.normal,t.plane.normal)>0?i:n).push(t);break;case 1:r.push(t);break;case 2:s.push(t);break;case 3:var d,f=[],p=[];for(a=0;a=3&&(d=new ws(f,t.shared)).plane&&r.push(d),p.length>=3&&(d=new ws(p,t.shared)).plane&&s.push(d)}},e.EPSILON=1e-5,e}(),ws=function(){function e(e,t){this.vertices=e,this.shared=t,this.plane=Ls.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}(),Fs=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||Mi.a.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);for(var l=2*Math.PI*a,u=l/s,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}(),Hs=function(){function e(){}return e.Rectangle=function(e,t,i,n){return[new o.w(e,t),new o.w(i,t),new o.w(i,n),new o.w(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,s=0,a=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-s.min.x)/s.width,1-(t.y-s.min.y)/s.height)});var h=a.length;for(l=0;ls.elements.length-1?s.elements[0]:s.elements[h+1],e.push(f.x,0,f.y),e.push(f.x,-a,f.y),e.push(d.x,0,d.y),e.push(d.x,-a,d.y);var p=new o.x(f.x,0,f.y),_=new o.x(d.x,0,d.y).subtract(p),g=new o.x(0,1,0),m=o.x.Cross(_,g);m=m.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(m.x,m.y,m.z),t.push(m.x,m.y,m.z),t.push(m.x,m.y,m.z),t.push(m.x,m.y,m.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(-m.x,-m.y,-m.z),t.push(-m.x,-m.y,-m.z),t.push(-m.x,-m.y,-m.z),t.push(-m.x,-m.y,-m.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}();Mi.a.CreatePolygon=function(e,t,i,n,r,s){for(var a=i||new Array(3),c=n,l=[],u=0;u<3;u++)void 0===a[u]&&(a[u]=new o.y(0,0,1,1)),c&&void 0===c[u]&&(c[u]=new o.f(1,1,1,1));for(var h=e.getVerticesData(Oi.b.PositionKind),d=e.getVerticesData(Oi.b.NormalKind),f=e.getVerticesData(Oi.b.UVKind),p=e.getIndices(),_=0,g=0,m=0;m1?1:t.arc:1,s=void 0===t.closed||t.closed,a=t.shape,c=t.radius||1,l=t.tessellation||64,u=t.clip||0,h=t.updatable,d=fe.a._GetDefaultSideOrientation(t.sideOrientation),f=t.cap||fe.a.NO_CAP,p=2*Math.PI,_=new Array,g=t.invertUV||!1,m=0,v=0,y=p/l*r,b=new Array;for(m=0;m<=l-u;m++){b=[];for(f!=fe.a.CAP_START&&f!=fe.a.CAP_ALL||(b.push(new o.x(0,a[0].y,0)),b.push(new o.x(Math.cos(m*y)*a[0].x*c,a[0].y,Math.sin(m*y)*a[0].x*c))),v=0;v1)?1:t.arc||1;var f,p,_=function(e,t,i,n,r,s,a,c){for(var l,u,h,d,f=t.getTangents(),p=t.getNormals(),_=t.getDistances(),g=2*Math.PI/r*c,m=s||function(){return n},v=o.t.Matrix[0],y=a===fe.a.NO_CAP||a===fe.a.CAP_END?0:2,b=0;b3?0:l,t.arc);var v=Yo.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=a,v._creationDataStorage.cap=l,v._creationDataStorage.arc=t.arc,v._creationDataStorage.radius=s,v},e}();Mi.a.CreateIcoSphere=function(e){var t,i=e.sideOrientation||Mi.a.DEFAULTSIDE,n=e.radius||1,r=void 0===e.flat||e.flat,s=e.subdivisions||4,a=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],g=new Array,m=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]=o.x.Zero(),E[t]=o.w.Zero();for(var A=0;A<20;A++){for(t=0;t<3;t++){var x=d[3*A+t];T[t].copyFromFloats(h[3*f[x]],h[3*f[x]+1],h[3*f[x]+2]),T[t].normalize().scaleInPlace(n),E[t].copyFromFloats(p[2*x]*(138/1024)+60/1024+_[A]*(-40/1024),p[2*x+1]*(239/1024)+26/1024+_[A]*(20/1024))}for(var R=function(e,t,i,n){var u,h=o.x.Lerp(T[0],T[2],t/s),d=o.x.Lerp(T[1],T[2],t/s),f=s===t?T[2]:o.x.Lerp(h,d,e/(s-t));if(f.normalize(),r){var p=o.x.Lerp(T[0],T[2],n/s),_=o.x.Lerp(T[1],T[2],n/s);u=o.x.Lerp(p,_,i/(s-n))}else u=new o.x(f.x,f.y,f.z);u.x/=a,u.y/=c,u.z/=l,u.normalize();var A=o.w.Lerp(E[0],E[2],t/s),x=o.w.Lerp(E[1],E[2],t/s),R=s===t?E[2]:o.w.Lerp(A,x,e/(s-t));m.push(f.x*a,f.y*c,f.z*l),v.push(u.x,u.y,u.z),y.push(R.x,R.y),g.push(b),b++},P=0;P0)?1:0)+((c=o.x.Dot(e[s+1].position,t)-i>0)?1:0)+((u=o.x.Dot(e[s+2].position,t)-i>0)?1:0)){case 0:r.push(e[s]),r.push(e[s+1]),r.push(e[s+2]);break;case 1:if(a&&(h=e[s+1],d=e[s+2],f=n(e[s],h),p=n(e[s],d)),c){h=e[s],d=e[s+2],f=n(e[s+1],h),p=n(e[s+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[s],d=e[s+1],f=n(e[s+2],h),p=n(e[s+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:a||(d=n(h=e[s].clone(),e[s+1]),f=n(h,e[s+2]),r.push(h),r.push(d),r.push(f)),c||(d=n(h=e[s+1].clone(),e[s+2]),f=n(h,e[s]),r.push(h),r.push(d),r.push(f)),u||(d=n(h=e[s+2].clone(),e[s]),f=n(h,e[s+1]),r.push(h),r.push(d),r.push(f))}}return r},x=0;xc||i.deleted||i.isDirty))for(var r=0;r<3;++r)if(i.error[r]>0,function(e){if(r){var t=e+a.verticesStart,s=o.x.FromArray(r,3*t),l=function(e){if(i)for(var t=0;t0&&this._reconstructedMesh.setVerticesData(Oi.b.UVKind,a),c.length>0&&this._reconstructedMesh.setVerticesData(Oi.b.ColorKind,c);var y=this._mesh.subMeshes[e];e>0&&(this._reconstructedMesh.subMeshes=[],g.forEach(function(e){Os.b.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())}),Os.b.AddToMesh(y.materialIndex,_,d,p,3*r.length,this._reconstructedMesh))},e.prototype.initDecimatedMesh=function(){this._reconstructedMesh=new fe.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 s=0;s.999)return!0;var f=o.x.Cross(h,d).normalize();if(n[s]=!1,o.x.Dot(f,a.normal)<.2)return!0}else n[s]=!0,r.push(a)}}return!1},e.prototype.updateTriangles=function(e,t,i,n){for(var r=n,o=0;o=400&&o?o(l):i()},!1),l.addEventListener("error",function(){p.a.Error("error on XHR request."),i()},!1),l.send()}else p.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=us.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}(),da=function(){function e(){this.direction1=new o.x(0,1,0),this.direction2=new o.x(0,1,0),this.minEmitBox=new o.x(-.5,-.5,-.5),this.maxEmitBox=new o.x(.5,.5,.5)}return e.prototype.startDirectionFunction=function(e,t,i){var n=D.a.RandomRange(this.direction1.x,this.direction2.x),r=D.a.RandomRange(this.direction1.y,this.direction2.y),s=D.a.RandomRange(this.direction1.z,this.direction2.z);o.x.TransformNormalFromFloatsToRef(n,r,s,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=D.a.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),r=D.a.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),s=D.a.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);o.x.TransformCoordinatesFromFloatsToRef(n,r,s,e,t)},e.prototype.clone=function(){var t=new e;return S.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){o.x.FromArrayToRef(e.direction1,0,this.direction1),o.x.FromArrayToRef(e.direction2,0,this.direction2),o.x.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),o.x.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},e}(),fa=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)))o.x.TransformNormalFromFloatsToRef(0,1,0,e,t);else{var n=i.position.subtract(e.getTranslation()).normalize(),r=D.a.RandomRange(0,this.directionRandomizer),s=D.a.RandomRange(0,this.directionRandomizer),a=D.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=s,n.z+=a,n.normalize(),o.x.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)}},e.prototype.startPositionFunction=function(e,t,i){var n,r=D.a.RandomRange(0,2*Math.PI);n=this.emitFromSpawnPointOnly?1e-4:1-(n=D.a.RandomRange(0,this.heightRange))*n;var s=this._radius-D.a.RandomRange(0,this._radius*this.radiusRange),a=(s*=n)*Math.sin(r),c=s*Math.cos(r),l=n*this._height;o.x.TransformCoordinatesFromFloatsToRef(a,l,c,e,t)},e.prototype.clone=function(){var t=new e(this._radius,this._angle,this.directionRandomizer);return S.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}(),pa=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=D.a.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),s=Math.atan2(n.x,n.z);s+=D.a.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,n.y=r,n.x=Math.sin(s),n.z=Math.cos(s),n.normalize(),o.x.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=D.a.RandomRange(-this.height/2,this.height/2),r=D.a.RandomRange(0,2*Math.PI),s=D.a.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),a=Math.sqrt(s)*this.radius,c=a*Math.cos(r),l=a*Math.sin(r);o.x.TransformCoordinatesFromFloatsToRef(c,n,l,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return S.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}(),_a=function(e){function t(t,i,n,r,s){void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=new o.x(0,1,0)),void 0===s&&(s=new o.x(0,1,0));var a=e.call(this,t,i,n)||this;return a.direction1=r,a.direction2=s,a}return l.d(t,e),t.prototype.startDirectionFunction=function(e,t,i){var n=D.a.RandomRange(this.direction1.x,this.direction2.x),r=D.a.RandomRange(this.direction1.y,this.direction2.y),s=D.a.RandomRange(this.direction1.z,this.direction2.z);o.x.TransformNormalFromFloatsToRef(n,r,s,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return S.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}(pa),ga=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=D.a.RandomRange(0,this.directionRandomizer),s=D.a.RandomRange(0,this.directionRandomizer),a=D.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=s,n.z+=a,n.normalize(),o.x.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=this.radius-D.a.RandomRange(0,this.radius*this.radiusRange),r=D.a.RandomRange(0,1),s=D.a.RandomRange(0,2*Math.PI),a=Math.acos(2*r-1),c=n*Math.cos(s)*Math.sin(a),l=n*Math.cos(a),u=n*Math.sin(s)*Math.sin(a);o.x.TransformCoordinatesFromFloatsToRef(c,Math.abs(l),u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return S.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}(),ma=function(){function e(){this.direction1=new o.x(0,1,0),this.direction2=new o.x(0,1,0)}return e.prototype.startDirectionFunction=function(e,t,i){var n=D.a.RandomRange(this.direction1.x,this.direction2.x),r=D.a.RandomRange(this.direction1.y,this.direction2.y),s=D.a.RandomRange(this.direction1.z,this.direction2.z);o.x.TransformNormalFromFloatsToRef(n,r,s,e,t)},e.prototype.startPositionFunction=function(e,t,i){o.x.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},e.prototype.clone=function(){var t=new e;return S.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){o.x.FromArrayToRef(e.direction1,0,this.direction1),o.x.FromArrayToRef(e.direction2,0,this.direction2)},e}(),va=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=D.a.RandomRange(0,this.directionRandomizer),s=D.a.RandomRange(0,this.directionRandomizer),a=D.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=s,n.z+=a,n.normalize(),o.x.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=this.radius-D.a.RandomRange(0,this.radius*this.radiusRange),r=D.a.RandomRange(0,1),s=D.a.RandomRange(0,2*Math.PI),a=Math.acos(2*r-1),c=n*Math.cos(s)*Math.sin(a),l=n*Math.cos(a),u=n*Math.sin(s)*Math.sin(a);o.x.TransformCoordinatesFromFloatsToRef(c,l,u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return S.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}(),ya=function(e){function t(t,i,n){void 0===t&&(t=1),void 0===i&&(i=new o.x(0,1,0)),void 0===n&&(n=new o.x(0,1,0));var r=e.call(this,t)||this;return r.direction1=i,r.direction2=n,r}return l.d(t,e),t.prototype.startDirectionFunction=function(e,t,i){var n=D.a.RandomRange(this.direction1.x,this.direction2.x),r=D.a.RandomRange(this.direction1.y,this.direction2.y),s=D.a.RandomRange(this.direction1.z,this.direction2.z);o.x.TransformNormalFromFloatsToRef(n,r,s,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.direction1,this.direction2);return S.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}(va),ba=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 o.x(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 o.w(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new o.x(0,0,0),this.gravity=o.x.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 o.f(1,1,1,1),this.color2=new o.f(1,1,1,1),this.colorDead=new o.f(0,0,0,1),this.textureMask=new o.f(1,1,1,1),this._isSubEmitter=!1,this.billboardMode=_.a.PARTICLES_BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new xi.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:o.x.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:o.x.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:o.x.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:o.x.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;r0&&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"}(ua||(ua={}));var Ea=function(){function e(e){this.particleSystem=e,this.type=ua.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,e.emitter&&e.emitter.dispose||(e.emitter=new Fe.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 o.x?t=t.clone():t instanceof Fe.a&&((t=new fe.a("",t.getScene())).isVisible=!1):t=new o.x;var i=new e(this.particleSystem.clone("",t));return 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 be.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}(),Aa="\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}";zt.a.ShadersStore.particlesPixelShader=Aa;var xa="\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}";zt.a.ShadersStore.particlesVertexShader=xa;var Ra=function(e){function t(t,i,n,s,a,c){void 0===s&&(s=null),void 0===a&&(a=!1),void 0===c&&(c=.01);var l=e.call(this,t)||this;return l._inheritedVelocityOffset=new o.x,l.onDisposeObservable=new r.c,l._particles=new Array,l._stockParticles=new Array,l._newPartsExcess=0,l._vertexBuffers={},l._scaledColorStep=new o.f(0,0,0,0),l._colorDiff=new o.f(0,0,0,0),l._scaledDirection=o.x.Zero(),l._scaledGravity=o.x.Zero(),l._currentRenderId=-1,l._useInstancing=!1,l._started=!1,l._stopped=!1,l._actualFrame=0,l._currentEmitRate1=0,l._currentEmitRate2=0,l._currentStartSize1=0,l._currentStartSize2=0,l._rawTextureWidth=256,l._useRampGradients=!1,l._disposeEmitterOnDispose=!1,l.recycleParticle=function(e){var t=l._particles.pop();t!==e&&t.copyTo(e),l._stockParticles.push(t)},l._createParticle=function(){var e;if(0!==l._stockParticles.length?(e=l._stockParticles.pop())._reset():e=new Ta(l),l._subEmitters&&l._subEmitters.length>0){var t=l._subEmitters[Math.floor(Math.random()*l._subEmitters.length)];e._attachedSubEmitters=[],t.forEach(function(t){if(t.type===ua.ATTACHED){var i=t.clone();e._attachedSubEmitters.push(i),i.particleSystem.start()}})}return e},l._emitFromParticle=function(e){if(l._subEmitters&&0!==l._subEmitters.length){var t=Math.floor(Math.random()*l._subEmitters.length);l._subEmitters[t].forEach(function(t){if(t.type===ua.END){var i=t.clone();e._inheritParticleInfoToSubEmitter(i),i.particleSystem._rootParticleSystem=l,l.activeSubSystems.push(i.particleSystem),i.particleSystem.start()}})}},l._capacity=i,l._epsilon=c,l._isAnimationSheetEnabled=a,l._scene=n||P.a.LastCreatedScene,l._attachImageProcessingConfiguration(null),l._customEffect=s,l._scene.particleSystems.push(l),l._useInstancing=l._scene.getEngine().getCaps().instancedArrays,l._createIndexBuffer(),l._createVertexBuffers(),l.particleEmitterType=new da,l.updateFunction=function(e){var t=null,i=null;l.noiseTexture&&(t=l.noiseTexture.getSize(),i=l.noiseTexture.getContent());for(var n,r=function(){n=e[s];var r=l._scaledUpdateSpeed,a=n.age;if(n.age+=r,n.age>n.lifeTime){var c=n.age-a;r=(n.lifeTime-a)*r/c,n.age=n.lifeTime}var u=n.age/n.lifeTime;l._colorGradients&&l._colorGradients.length>0?ye.h.GetCurrentGradient(u,l._colorGradients,function(e,t,i){e!==n._currentColorGradient&&(n._currentColor1.copyFrom(n._currentColor2),t.getColorToRef(n._currentColor2),n._currentColorGradient=e),o.f.LerpToRef(n._currentColor1,n._currentColor2,i,n.color)}):(n.colorStep.scaleToRef(r,l._scaledColorStep),n.color.addInPlace(l._scaledColorStep),n.color.a<0&&(n.color.a=0)),l._angularSpeedGradients&&l._angularSpeedGradients.length>0&&ye.h.GetCurrentGradient(u,l._angularSpeedGradients,function(e,t,i){e!==n._currentAngularSpeedGradient&&(n._currentAngularSpeed1=n._currentAngularSpeed2,n._currentAngularSpeed2=t.getFactor(),n._currentAngularSpeedGradient=e),n.angularSpeed=D.a.Lerp(n._currentAngularSpeed1,n._currentAngularSpeed2,i)}),n.angle+=n.angularSpeed*r;var h=r;if(l._velocityGradients&&l._velocityGradients.length>0&&ye.h.GetCurrentGradient(u,l._velocityGradients,function(e,t,i){e!==n._currentVelocityGradient&&(n._currentVelocity1=n._currentVelocity2,n._currentVelocity2=t.getFactor(),n._currentVelocityGradient=e),h*=D.a.Lerp(n._currentVelocity1,n._currentVelocity2,i)}),n.direction.scaleToRef(h,l._scaledDirection),l._limitVelocityGradients&&l._limitVelocityGradients.length>0&&ye.h.GetCurrentGradient(u,l._limitVelocityGradients,function(e,t,i){e!==n._currentLimitVelocityGradient&&(n._currentLimitVelocity1=n._currentLimitVelocity2,n._currentLimitVelocity2=t.getFactor(),n._currentLimitVelocityGradient=e);var r=D.a.Lerp(n._currentLimitVelocity1,n._currentLimitVelocity2,i);n.direction.length()>r&&n.direction.scaleInPlace(l.limitVelocityDamping)}),l._dragGradients&&l._dragGradients.length>0&&ye.h.GetCurrentGradient(u,l._dragGradients,function(e,t,i){e!==n._currentDragGradient&&(n._currentDrag1=n._currentDrag2,n._currentDrag2=t.getFactor(),n._currentDragGradient=e);var r=D.a.Lerp(n._currentDrag1,n._currentDrag2,i);l._scaledDirection.scaleInPlace(1-r)}),n.position.addInPlace(l._scaledDirection),i&&t&&n._randomNoiseCoordinates1){var d=l._fetchR(n._randomNoiseCoordinates1.x,n._randomNoiseCoordinates1.y,t.width,t.height,i),f=l._fetchR(n._randomNoiseCoordinates1.z,n._randomNoiseCoordinates2.x,t.width,t.height,i),p=l._fetchR(n._randomNoiseCoordinates2.y,n._randomNoiseCoordinates2.z,t.width,t.height,i),_=o.t.Vector3[0],g=o.t.Vector3[1];_.copyFromFloats((2*d-1)*l.noiseStrength.x,(2*f-1)*l.noiseStrength.y,(2*p-1)*l.noiseStrength.z),_.scaleToRef(r,g),n.direction.addInPlace(g)}if(l.gravity.scaleToRef(r,l._scaledGravity),n.direction.addInPlace(l._scaledGravity),l._sizeGradients&&l._sizeGradients.length>0&&ye.h.GetCurrentGradient(u,l._sizeGradients,function(e,t,i){e!==n._currentSizeGradient&&(n._currentSize1=n._currentSize2,n._currentSize2=t.getFactor(),n._currentSizeGradient=e),n.size=D.a.Lerp(n._currentSize1,n._currentSize2,i)}),l._useRampGradients&&(l._colorRemapGradients&&l._colorRemapGradients.length>0&&ye.h.GetCurrentGradient(u,l._colorRemapGradients,function(e,t,i){var r=D.a.Lerp(e.factor1,t.factor1,i),o=D.a.Lerp(e.factor2,t.factor2,i);n.remapData.x=r,n.remapData.y=o-r}),l._alphaRemapGradients&&l._alphaRemapGradients.length>0&&ye.h.GetCurrentGradient(u,l._alphaRemapGradients,function(e,t,i){var r=D.a.Lerp(e.factor1,t.factor1,i),o=D.a.Lerp(e.factor2,t.factor2,i);n.remapData.z=r,n.remapData.w=o-r})),l._isAnimationSheetEnabled&&n.updateCellIndex(),n._inheritParticleInfoToSubEmitters(),n.age>=n.lifeTime)return l._emitFromParticle(n),n._attachedSubEmitters&&(n._attachedSubEmitters.forEach(function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()}),n._attachedSubEmitters=null),l.recycleParticle(n),s--,"continue"},s=0;st.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 ye.c;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 Fe.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=o.j.Translation(r.x,r.y,r.z)}this.updateFunction(this._particles);for(var s,a=function(){if(c._particles.length===c._capacity)return"break";t=c._createParticle(),c._particles.push(t);var e=D.a.RandomRange(c.minEmitPower,c.maxEmitPower);if(c.startPositionFunction?c.startPositionFunction(c._emitterWorldMatrix,t.position,t):c.particleEmitterType.startPositionFunction(c._emitterWorldMatrix,t.position,t),c.startDirectionFunction?c.startDirectionFunction(c._emitterWorldMatrix,t.direction,t):c.particleEmitterType.startDirectionFunction(c._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),c.targetStopDuration&&c._lifeTimeGradients&&c._lifeTimeGradients.length>0){var n=D.a.Clamp(c._actualFrame/c.targetStopDuration);ye.h.GetCurrentGradient(n,c._lifeTimeGradients,function(e,i){var r=e,o=i,s=r.getFactor(),a=o.getFactor(),c=(n-r.gradient)/(o.gradient-r.gradient);t.lifeTime=D.a.Lerp(s,a,c)})}else t.lifeTime=D.a.RandomRange(c.minLifeTime,c.maxLifeTime);if(c._sizeGradients&&0!==c._sizeGradients.length?(t._currentSizeGradient=c._sizeGradients[0],t._currentSize1=t._currentSizeGradient.getFactor(),t.size=t._currentSize1,c._sizeGradients.length>1?t._currentSize2=c._sizeGradients[1].getFactor():t._currentSize2=t._currentSize1):t.size=D.a.RandomRange(c.minSize,c.maxSize),t.scale.copyFromFloats(D.a.RandomRange(c.minScaleX,c.maxScaleX),D.a.RandomRange(c.minScaleY,c.maxScaleY)),c._startSizeGradients&&c._startSizeGradients[0]&&c.targetStopDuration){var r=c._actualFrame/c.targetStopDuration;ye.h.GetCurrentGradient(r,c._startSizeGradients,function(e,n,r){e!==i._currentStartSizeGradient&&(i._currentStartSize1=i._currentStartSize2,i._currentStartSize2=n.getFactor(),i._currentStartSizeGradient=e);var o=D.a.Lerp(i._currentStartSize1,i._currentStartSize2,r);t.scale.scaleInPlace(o)})}c._angularSpeedGradients&&0!==c._angularSpeedGradients.length?(t._currentAngularSpeedGradient=c._angularSpeedGradients[0],t.angularSpeed=t._currentAngularSpeedGradient.getFactor(),t._currentAngularSpeed1=t.angularSpeed,c._angularSpeedGradients.length>1?t._currentAngularSpeed2=c._angularSpeedGradients[1].getFactor():t._currentAngularSpeed2=t._currentAngularSpeed1):t.angularSpeed=D.a.RandomRange(c.minAngularSpeed,c.maxAngularSpeed),t.angle=D.a.RandomRange(c.minInitialRotation,c.maxInitialRotation),c._velocityGradients&&c._velocityGradients.length>0&&(t._currentVelocityGradient=c._velocityGradients[0],t._currentVelocity1=t._currentVelocityGradient.getFactor(),c._velocityGradients.length>1?t._currentVelocity2=c._velocityGradients[1].getFactor():t._currentVelocity2=t._currentVelocity1),c._limitVelocityGradients&&c._limitVelocityGradients.length>0&&(t._currentLimitVelocityGradient=c._limitVelocityGradients[0],t._currentLimitVelocity1=t._currentLimitVelocityGradient.getFactor(),c._limitVelocityGradients.length>1?t._currentLimitVelocity2=c._limitVelocityGradients[1].getFactor():t._currentLimitVelocity2=t._currentLimitVelocity1),c._dragGradients&&c._dragGradients.length>0&&(t._currentDragGradient=c._dragGradients[0],t._currentDrag1=t._currentDragGradient.getFactor(),c._dragGradients.length>1?t._currentDrag2=c._dragGradients[1].getFactor():t._currentDrag2=t._currentDrag1),c._colorGradients&&0!==c._colorGradients.length?(t._currentColorGradient=c._colorGradients[0],t._currentColorGradient.getColorToRef(t.color),t._currentColor1.copyFrom(t.color),c._colorGradients.length>1?c._colorGradients[1].getColorToRef(t._currentColor2):t._currentColor2.copyFrom(t.color)):(s=D.a.RandomRange(0,1),o.f.LerpToRef(c.color1,c.color2,s,t.color),c.colorDead.subtractToRef(t.color,c._colorDiff),c._colorDiff.scaleToRef(1/t.lifeTime,t.colorStep)),c._isAnimationSheetEnabled&&(t._initialStartSpriteCellID=c.startSpriteCellID,t._initialEndSpriteCellID=c.endSpriteCellID),t.direction.addInPlace(c._inheritedVelocityOffset),c._useRampGradients&&(t.remapData=new o.y(0,1,0,1)),c.noiseTexture&&(t._randomNoiseCoordinates1?(t._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(t._randomNoiseCoordinates1=new o.x(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2=new o.x(Math.random(),Math.random(),Math.random()))),t._inheritParticleInfoToSubEmitters()},c=this,l=0;l-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;ye.h.GetCurrentGradient(r,this._emitRateGradients,function(e,i,r){e!==t._currentEmitRateGradient&&(t._currentEmitRate1=t._currentEmitRate2,t._currentEmitRate2=i.getFactor(),t._currentEmitRateGradient=e),n=D.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,s=0;s-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 s=new t(e,this._capacity,this._scene,n);return s.customShader=r,S.a.DeepCopy(this,s,["particles","customShader","noiseTexture"]),void 0===i&&(i=this.emitter),s.noiseTexture=this.noiseTexture,s.emitter=i,this.particleTexture&&(s.particleTexture=new ke.a(this.particleTexture.url,this._scene)),this._colorGradients&&this._colorGradients.forEach(function(e){s.addColorGradient(e.gradient,e.color1,e.color2)}),this._dragGradients&&this._dragGradients.forEach(function(e){s.addDragGradient(e.gradient,e.factor1,e.factor2)}),this._angularSpeedGradients&&this._angularSpeedGradients.forEach(function(e){s.addAngularSpeedGradient(e.gradient,e.factor1,e.factor2)}),this._emitRateGradients&&this._emitRateGradients.forEach(function(e){s.addEmitRateGradient(e.gradient,e.factor1,e.factor2)}),this._lifeTimeGradients&&this._lifeTimeGradients.forEach(function(e){s.addLifeTimeGradient(e.gradient,e.factor1,e.factor2)}),this._limitVelocityGradients&&this._limitVelocityGradients.forEach(function(e){s.addLimitVelocityGradient(e.gradient,e.factor1,e.factor2)}),this._sizeGradients&&this._sizeGradients.forEach(function(e){s.addSizeGradient(e.gradient,e.factor1,e.factor2)}),this._startSizeGradients&&this._startSizeGradients.forEach(function(e){s.addStartSizeGradient(e.gradient,e.factor1,e.factor2)}),this._velocityGradients&&this._velocityGradients.forEach(function(e){s.addVelocityGradient(e.gradient,e.factor1,e.factor2)}),this._rampGradients&&this._rampGradients.forEach(function(e){s.addRampGradient(e.gradient,e.color)}),this._colorRemapGradients&&this._colorRemapGradients.forEach(function(e){s.addColorRemapGradient(e.gradient,e.factor1,e.factor2)}),this._alphaRemapGradients&&this._alphaRemapGradients.forEach(function(e){s.addAlphaRemapGradient(e.gradient,e.factor1,e.factor2)}),this.preventAutoStart||s.start(),s},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(s,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 ye.c;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 ye.d;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===Ra.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=o.j.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(so.a.PointListDrawMode,0,this._currentActiveCount),this._engine.endTransformFeedback(),this._engine.setRasterizerState(!0),this._engine.bindTransformFeedbackBuffer(null),!e){this._engine.enableEffect(this._renderEffect);var s=this._scene.getViewMatrix();if(this._renderEffect.setMatrix("view",s),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 a=this.particleTexture.getBaseSize();this._renderEffect.setFloat3("sheetInfos",this.spriteCellWidth/a.width,this.spriteCellHeight/a.height,a.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=s.clone();l.invert(),this._renderEffect.setMatrix("invView",l),ir.a.BindClipPlane(this._renderEffect,this._scene)}switch(this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._renderEffect),this.blendMode){case Ra.BLENDMODE_ADD:this._engine.setAlphaMode(_.a.ALPHA_ADD);break;case Ra.BLENDMODE_ONEONE:this._engine.setAlphaMode(_.a.ALPHA_ONEONE);break;case Ra.BLENDMODE_STANDARD:this._engine.setAlphaMode(_.a.ALPHA_COMBINE);break;case Ra.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(_.a.ALPHA_MULTIPLY)}this.forceDepthWrite&&this._engine.setDepthWrite(!0),this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex],null),this._engine.drawArraysType(so.a.TriangleFanDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(_.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 S.a.DeepCopy(this,n),void 0===i&&(i=this.emitter),n.emitter=i,this.particleTexture&&(n.particleTexture=new ke.a(this.particleTexture.url,this._scene)),n},t.prototype.serialize=function(){var e={};return Ra._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),Ra._Parse(e,o,i,n),e.preventAutoStart&&(o.preventAutoStart=e.preventAutoStart),r||o.preventAutoStart||o.start(),o},t}(ba),Da=(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=Ln.a.CreateSphere("emitterSphere",{diameter:e.diameter,segments:e.segments},i);n.renderingGroupId=t;var r=new Ri.a("emitterSphereMaterial",i);r.emissiveColor=e.color,n.material=r;for(var o=0,s=this.systems;o0&&t.set(this._uvs32,Oi.b.UVKind),this._colors32.length>0&&t.set(this._colors32,Oi.b.ColorKind);var i=new fe.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,s=e.getVerticesData(Oi.b.PositionKind),a=e.getIndices(),c=e.getVerticesData(Oi.b.UVKind),l=e.getVerticesData(Oi.b.ColorKind),u=e.getVerticesData(Oi.b.NormalKind),h=0,d=a.length/3;n?(n=n>d?d:n,i=Math.round(d/n),r=0):i=i>d?d:i;for(var f=[],p=[],_=[],g=[],m=o.x.Zero(),v=i;hd-(i=v+Math.floor((1+r)*Math.random()))&&(i=d-h),f.length=0,p.length=0,_.length=0,g.length=0;for(var y=0,b=3*h;b<3*(h+i);b++){p.push(y);var T=a[b];f.push(s[3*T],s[3*T+1],s[3*T+2]),c&&_.push(c[2*T],c[2*T+1]),l&&g.push(l[4*T],l[4*T+1],l[4*T+2],l[4*T+3]),y++}var E,A,x=this.nbParticles,R=this._posToShape(f),P=this._uvsToShapeUV(_);for(E=0;E65535&&(this._needs32Bits=!0)}if(this._pickable){var C=n.length/3;for(_=0;_=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var O=this.mesh._boundingInfo;O&&(v.copyFrom(O.minimum),y.copyFrom(O.maximum))}var I=(x=this.particles[e]._pos)/3|0;P=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,G=L._globalPosition;if(this._depthSort&&this._depthSortParticles){var k=this.depthSortedParticles[D];k.ind=L._ind,k.indicesLength=L._model._indicesLength,k.sqDistance=o.x.DistanceSquared(L.position,b)}if(!L.alive||L._stillInvisible&&!L.isVisible)x+=3*(M=w.length),P+=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],H=j._rotationMatrix,W=j._globalPosition,X=B.x*H[1]+B.y*H[4]+B.z*H[7],Y=B.x*H[0]+B.y*H[3]+B.z*H[6],K=B.x*H[2]+B.y*H[5]+B.z*H[8];if(G.x=W.x+Y,G.y=W.y+X,G.z=W.z+K,this._computeParticleRotation||this.billboard){var Q=n.m;N[0]=Q[0]*H[0]+Q[1]*H[3]+Q[2]*H[6],N[1]=Q[0]*H[1]+Q[1]*H[4]+Q[2]*H[7],N[2]=Q[0]*H[2]+Q[1]*H[5]+Q[2]*H[8],N[3]=Q[4]*H[0]+Q[5]*H[3]+Q[6]*H[6],N[4]=Q[4]*H[1]+Q[5]*H[4]+Q[6]*H[7],N[5]=Q[4]*H[2]+Q[5]*H[5]+Q[6]*H[8],N[6]=Q[8]*H[0]+Q[9]*H[3]+Q[10]*H[6],N[7]=Q[8]*H[1]+Q[9]*H[4]+Q[10]*H[7],N[8]=Q[8]*H[2]+Q[9]*H[5]+Q[10]*H[8]}}else if(G.x=B.x,G.y=B.y,G.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 s=this._options.falloff===Va.Constant?this._options.strength:this._options.strength*(1-r/this._options.radius);return{force:i.multiplyByFloats(s,s,s),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=Ln.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 o.x(2*i,2*i,2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(n,!0)},e}(),Ha=function(){function e(e,t,i,n){this._physicsHelper=e,this._scene=t,this._origin=i,this._options=n,this._dataFetched=!1,this._options=l.a({},new Ya,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}(),Wa=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=o.x.Zero(),this._originDirection=o.x.Zero(),this._cylinderPosition=o.x.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=l.a({},new Ka,this._options),this._origin.addToRef(new o.x(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new o.x(0,this._options.height,0),this._originTop),this._options.updraftMode===Ga.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===Ga.Perpendicular)var i=this._originDirection;else i=t.subtract(this._originTop);var n=o.x.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=Fi.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}(),Xa=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=o.x.Zero(),this._cylinderPosition=o.x.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=l.a({},new Qa,this._options),this._origin.addToRef(new o.x(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new o.x(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 o.x(this._origin.x,t.y,this._origin.z),n=t.subtract(i),r=new It.a(i,n,this._options.radius).intersectsMesh(e.object),s=r.pickedPoint;if(!s)return null;var a=r.distance/this._options.radius,c=s.normalize();if(a>this._options.centripetalForceThreshold&&(c=c.negate()),a>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=o.x.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 o.x(l,u,h);return{force:f=f.multiplyByFloats(this._options.strength,this._options.strength,this._options.strength),contactPoint:t,distanceFromOrigin:a}},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=Fi.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}(),Ya=function(){return function(){this.radius=5,this.strength=10,this.falloff=Va.Constant,this.sphere={segments:32,diameter:1}}}(),Ka=function(){return function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=Ga.Center}}(),Qa=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"}(Va||(Va={})),function(e){e[e.Center=0]="Center",e[e.Perpendicular=1]="Perpendicular"}(Ga||(Ga={}));var qa="\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}";zt.a.ShadersStore.blackAndWhitePixelShader=qa;var Za=function(e){function t(t,i,n,r,o,s){var a=e.call(this,t,"blackAndWhite",["degree"],null,i,n,r,o,s)||this;return a.degree=1,a.onApplyObservable.add(function(e){e.setFloat("degree",a.degree)}),a}return l.d(t,e),t}(Ht),Ja=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}(Ht),Rc="#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}";zt.a.ShadersStore.grainPixelShader=Rc;var Pc=function(e){function t(t,i,n,r,o,s,a,c){void 0===a&&(a=_.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=e.call(this,t,"grain",["intensity","animatedSeed"],[],i,n,r,o,s,null,a,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 l.d(t,e),t}(Ht),Sc="\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}";zt.a.ShadersStore.highlightsPixelShader=Sc;var Cc=function(e){function t(t,i,n,r,o,s,a){return void 0===a&&(a=_.a.TEXTURETYPE_UNSIGNED_INT),e.call(this,t,"highlights",null,null,i,n,r,o,s,null,a)||this}return l.d(t,e),t}(Ht);zt.a.IncludesShadersStore.mrtFragmentDeclaration="#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n";var Mc="#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}";zt.a.ShadersStore.geometryPixelShader=Mc;var Oc="precision highp float;\nprecision highp int;\n#include\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{\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(position,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(position,1.0);\n#endif\n#include\nvec4 pos=vec4(finalWorld*vec4(position,1.0));\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normal,0.0)));\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(position,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(position,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(position,1.0);\n#endif\n#endif\n#ifdef POSITION\nvPosition=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";zt.a.ShadersStore.geometryVertexShader=Oc;var Ic=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=[Oi.b.PositionKind,Oi.b.NormalKind],o=e.getMesh();i&&i.needAlphaTesting()&&(n.push("#define ALPHATEST"),o.isVerticesDataPresent(Oi.b.UVKind)&&(r.push(Oi.b.UVKind),n.push("#define UV1")),o.isVerticesDataPresent(Oi.b.UV2Kind)&&(r.push(Oi.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(Oi.b.MatricesIndicesKind),r.push(Oi.b.MatricesWeightsKind),o.numBoneInfluencers>4&&(r.push(Oi.b.MatricesIndicesExtraKind),r.push(Oi.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"),t&&(n.push("#define INSTANCES"),r.push("world0"),r.push("world1"),r.push("world2"),r.push("world3")),n.push("#define RENDER_TARGET_COUNT "+this._multiRenderTarget.textures.length);var s=n.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._effect=this._scene.getEngine().createEffect("geometry",r,["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones"],["diffuseSampler"],s,void 0,void 0,void 0,{buffersCount:this._enablePosition?3:2})),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 ds("gBuffer",{width:t.getRenderWidth()*this._ratio,height:t.getRenderHeight()*this._ratio},i,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:_.a.TEXTURETYPE_FLOAT}),this.isSupported){this._multiRenderTarget.wrapU=ke.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=ke.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add(function(e){e.clear(new o.f(0,0,0,1),!0,!0,!0)});var n=function(t){var i=t.getRenderingMesh(),n=e._scene,r=n.getEngine(),s=t.getMaterial();if(s){if(e._enableVelocity&&!e._previousTransformationMatrices[i.uniqueId]&&(e._previousTransformationMatrices[i.uniqueId]={world:o.j.Identity(),viewProjection:n.getTransformMatrix()},i.skeleton)){var a=i.skeleton.getTransformMatrices(i);e._previousBonesTransformationMatrices[i.uniqueId]=e._copyBonesTransformationMatrices(a,new Float32Array(a.length))}r.setState(s.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,so.a.TriangleFillMode),e._effect.setMatrix("viewProjection",n.getTransformMatrix()),e._effect.setMatrix("view",n.getViewMatrix()),s&&s.needAlphaTesting()){var u=s.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])),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,so.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 s;if(o.length){for(t.setColorWrite(!1),s=0;s0){var i=this._renderEffects[t[0]].getPostProcesses();i&&(i[0].samples=e)}return!0},e.prototype.dispose=function(){},l.c([Object(L.c)()],e.prototype,"_name",void 0),e}(),Gc=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(W.a.prototype,"postProcessRenderPipelineManager",{get:function(){if(!this._postProcessRenderPipelineManager){var e=this._getComponent(Ae.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER);e||(e=new kc(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Gc}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var kc=function(){function e(e){this.name=Ae.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Ae.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}(),zc=function(e){function t(t,i,n,r,o){void 0===t&&(t=""),void 0===i&&(i=!0),void 0===n&&(n=P.a.LastCreatedScene),void 0===o&&(o=!0);var s=e.call(this,n.getEngine(),t)||this;s._camerasToBeAttached=[],s.SharpenPostProcessId="SharpenPostProcessEffect",s.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",s.FxaaPostProcessId="FxaaPostProcessEffect",s.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",s.GrainPostProcessId="GrainPostProcessEffect",s._glowLayer=null,s.animations=[],s._imageProcessingConfigurationObserver=null,s._sharpenEnabled=!1,s._bloomEnabled=!1,s._depthOfFieldEnabled=!1,s._depthOfFieldBlurLevel=pc.Low,s._fxaaEnabled=!1,s._imageProcessingEnabled=!0,s._bloomScale=.5,s._chromaticAberrationEnabled=!1,s._grainEnabled=!1,s._buildAllowed=!0,s._resizeObserver=null,s._hardwareScaleLevel=1,s._bloomKernel=64,s._bloomWeight=.15,s._bloomThreshold=.9,s._samples=1,s._hasCleared=!1,s._prevPostProcess=null,s._prevPrevPostProcess=null,s._depthOfFieldSceneObserver=null,s._cameras=r||n.cameras,s._cameras=s._cameras.slice(),s._camerasToBeAttached=s._cameras.slice(),s._buildAllowed=o,s._scene=n;var a=s._scene.getEngine().getCaps();s._hdr=i&&(a.textureHalfFloatRender||a.textureFloatRender),s._hdr?a.textureHalfFloatRender?s._defaultPipelineTextureType=_.a.TEXTURETYPE_HALF_FLOAT:a.textureFloatRender&&(s._defaultPipelineTextureType=_.a.TEXTURETYPE_FLOAT):s._defaultPipelineTextureType=_.a.TEXTURETYPE_UNSIGNED_INT,n.postProcessRenderPipelineManager.addPipeline(s);var c=s._scene.getEngine();return s.sharpen=new Uc("sharpen",1,null,ke.a.BILINEAR_SAMPLINGMODE,c,!1,s._defaultPipelineTextureType,!0),s._sharpenEffect=new Ja(c,s.SharpenPostProcessId,function(){return s.sharpen},!0),s.depthOfField=new mc(s._scene,null,s._depthOfFieldBlurLevel,s._defaultPipelineTextureType,!0),s.bloom=new nc(s._scene,s._bloomScale,s._bloomWeight,s.bloomKernel,s._defaultPipelineTextureType,!0),s.chromaticAberration=new oc("ChromaticAberration",c.getRenderWidth(),c.getRenderHeight(),1,null,ke.a.BILINEAR_SAMPLINGMODE,c,!1,s._defaultPipelineTextureType,!0),s._chromaticAberrationEffect=new Ja(c,s.ChromaticAberrationPostProcessId,function(){return s.chromaticAberration},!0),s.grain=new Pc("Grain",1,null,ke.a.BILINEAR_SAMPLINGMODE,c,!1,s._defaultPipelineTextureType,!0),s._grainEffect=new Ja(c,s.GrainPostProcessId,function(){return s.grain},!0),s._resizeObserver=c.onResizeObservable.add(function(){s._hardwareScaleLevel=c.getHardwareScalingLevel(),s.bloomKernel=s.bloomKernel}),s._imageProcessingConfigurationObserver=s._scene.imageProcessingConfiguration.onUpdateParameters.add(function(){s.bloom._downscale._exposure=s._scene.imageProcessingConfiguration.exposure}),s._buildPipeline(),s}return l.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 nc(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 Ci("imageProcessing",1,null,ke.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this._hdr?(this.addEffect(new Ja(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 xc("fxaa",1,null,ke.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new Ja(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._enableMSAAOnFirstPostProcess(this.samples)&&this.samples>1&&p.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 Ht("BlurV","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthSampler"],t,null,ke.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 o.x(Math.cos(i)*r,Math.sin(i)*r,n)},t.prototype._generateHemisphere=function(){for(var e,t=this.samples,i=[],n=0;n1&&p.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 Ht("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",_.a.TEXTURETYPE_UNSIGNED_INT),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,r=i.downSampleX4PostProcess.width,o=i.downSampleX4PostProcess.height,s=-2;s<2;s++)for(var a=-2;a<2;a++)n[t]=(s+.5)*(1/r),n[t+1]=(a+.5)*(1/o),t+=2;e.setArray2("dsOffsets",n)},this.addEffect(new Ja(e.getEngine(),"HDRDownSampleX4",function(){return i.downSampleX4PostProcess},!0))},t.prototype._createBrightPassPostProcess=function(e,t){var i=this,n=new Array(8);this.brightPassPostProcess=new Ht("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",_.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 Ja(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 s=e.getEngine(),a=new $n("HDRBlurH_"+i,new o.w(1,0),this[n],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,_.a.TEXTURETYPE_UNSIGNED_INT),c=new $n("HDRBlurV_"+i,new o.w(0,1),this[n],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,_.a.TEXTURETYPE_UNSIGNED_INT);a.onActivateObservable.add(function(){var e=a.width/s.getRenderWidth();a.kernel=r[n]*e}),c.onActivateObservable.add(function(){var e=c.height/s.getRenderHeight();c.kernel=r.horizontalBlur?64*e:r[n]*e}),this.addEffect(new Ja(e.getEngine(),"HDRBlurH"+i,function(){return a},!0)),this.addEffect(new Ja(e.getEngine(),"HDRBlurV"+i,function(){return c},!0)),this.blurHPostProcesses.push(a),this.blurVPostProcesses.push(c)},t.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new Ht("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",_.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 Ja(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 Ht("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var s=o.w.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),s.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),s.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2("depthValues",s)}},this.addEffect(new Ja(e.getEngine(),"HDRVLS",function(){return i.volumetricLightPostProcess},!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new Ht("HDRVLSMerge","standard",[],["originalSampler"],t,null,ke.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 Ja(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 Ht("HDRLuminance","standard",["lumOffsets"],[],{width:r,height:r},null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LUMINANCE",i);var s=[];this.luminancePostProcess.onApply=function(e){var t=1/n.luminancePostProcess.width,i=1/n.luminancePostProcess.height;s[0]=-.5*t,s[1]=.5*i,s[2]=.5*t,s[3]=.5*i,s[4]=-.5*t,s[5]=-.5*i,s[6]=.5*t,s[7]=-.5*i,e.setArray2("lumOffsets",s)},this.addEffect(new Ja(e.getEngine(),"HDRLuminance",function(){return n.luminancePostProcess},!0));for(var a=t.LuminanceSteps-1;a>=0;a--){r=Math.pow(3,a);var c="#define LUMINANCE_DOWN_SAMPLE\n";0===a&&(c+="#define FINAL_DOWN_SAMPLER");var l=new Ht("HDRLuminanceDownSample"+a,"standard",["dsOffsets","halfDestPixelSize"],[],{width:r,height:r},null,ke.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,s=-1;s<2;s++)for(var a=-1;a<2;a++)r[o]=s/u.width,r[o+1]=a/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 o.y(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 Ja(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 Ht("HDR","standard",["averageLuminance"],["textureAdderSampler"],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n.join("\n"),_.a.TEXTURETYPE_UNSIGNED_INT);var r=1,o=0,s=0;this.hdrPostProcess.onApply=function(t){if(t.setTextureFromPostProcess("textureAdderSampler",i._currentDepthOfFieldSource),o+=e.getEngine().getDeltaTime(),r<0)r=i._hdrCurrentLuminance;else{var n=(s-o)/1e3;i._hdrCurrentLuminancer-i.hdrIncreaseRate*n?r-=i.hdrIncreaseRate*n:r=i._hdrCurrentLuminance}i.hdrAutoExposure?i._currentExposure=i._fixedExposure/r:(r=D.a.Clamp(r,i.hdrMinimumLuminance,1e20),t.setFloat("averageLuminance",r)),s=o,i._currentDepthOfFieldSource=i.hdrFinalPostProcess},this.addEffect(new Ja(e.getEngine(),"HDR",function(){return i.hdrPostProcess},!0))},t.prototype._createLensFlarePostProcess=function(e,t){var i=this;this.lensFlarePostProcess=new Ht("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",_.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new Ja(e.getEngine(),"HDRLensFlare",function(){return i.lensFlarePostProcess},!0)),this._createBlurPostProcesses(e,t/4,2),this.lensFlareComposePostProcess=new Ht("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",_.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new Ja(e.getEngine(),"HDRLensFlareCompose",function(){return i.lensFlareComposePostProcess},!0));var n=new o.w(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=o.j.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),s=o.j.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),a=o.x.Dot(t.toVector3(),new o.x(1,0,0))+o.x.Dot(n.toVector3(),new o.x(0,0,1));a*=4;var c=o.j.FromValues(.5*Math.cos(a),-Math.sin(a),0,0,Math.sin(a),.5*Math.cos(a),0,0,0,0,1,0,0,0,0,1),l=s.multiply(c).multiply(r);e.setMatrix("lensStarMatrix",l),i._currentDepthOfFieldSource=i.lensFlareFinalPostProcess}}},t.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new Ht("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",_.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 Ja(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var i=this;this.motionBlurPostProcess=new Ht("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],t,null,ke.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),_.a.TEXTURETYPE_UNSIGNED_INT);var n=0,r=o.j.Identity(),s=o.j.Identity(),a=o.j.Identity(),c=o.w.Zero();this.motionBlurPostProcess.onApply=function(t){(a=e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(s),t.setMatrix("inverseViewProjection",s),t.setMatrix("prevViewProjection",r),r=a,c.x=i.motionBlurPostProcess.width,c.y=i.motionBlurPostProcess.height,t.setVector2("screenSize",c),n=e.getEngine().getFps()/60,t.setFloat("motionScale",n),t.setFloat("motionStrength",i.motionStrength),t.setTexture("depthSampler",i._getDepthTexture())},this.addEffect(new Ja(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 _i("volumetricLightScatteringMap",{width:n.getRenderWidth()*t,height:n.getRenderHeight()*t},e,!1,!0,_.a.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=ke.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=ke.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 s,a=function(e){var t=e.getRenderingMesh();if(!i._meshExcluded(t)){var n=e.getMaterial();if(n){var r=t.getScene(),o=r.getEngine();o.setState(n.backFaceCulling);var s=t._getInstancesRenderList(e._id);if(!s.mustReturn){var a=o.getCaps().instancedArrays&&null!==s.visibleInstances[e._id];if(i._isReady(e,a)){var c=i._volumetricLightScatteringPass;if(t===i.mesh&&(c=e.effect?e.effect:n.getEffect()),o.enableEffect(c),t._bind(e,c,so.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,so.a.TriangleFillMode,s,a,function(e,t){return c.setMatrix("world",t)})}}}}},c=new o.f(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function(){s=e.clearColor,e.clearColor=c}),this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function(){e.clearColor=s}),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(_.a.ALPHA_COMBINE),o=0;o4&&(r.push(Oi.b.MatricesIndicesExtraKind),r.push(Oi.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"),t&&(n.push("#define INSTANCES"),r.push("world0"),r.push("world1"),r.push("world2"),r.push("world3"));var s=n.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._effect=this._scene.getEngine().createEffect("depth",r,["world","mBones","viewProjection","diffuseMatrix","depthValues"],["diffuseSampler"],s)),this._effect.isReady()},e.prototype.getDepthMap=function(){return this._depthMap},e.prototype.dispose=function(){this._depthMap.dispose()},e._SceneComponentInitialization=function(e){throw be.a.WarnImport("DepthRendererSceneComponent")},e}();W.a.prototype.enableDepthRenderer=function(e){if(!(e=e||this.activeCamera))throw"No camera available to enable depth renderer";if(this._depthRenderer||(this._depthRenderer={}),!this._depthRenderer[e.id]){var t=0;if(this.getEngine().getCaps().textureHalfFloatRender)t=_.a.TEXTURETYPE_HALF_FLOAT;else{if(!this.getEngine().getCaps().textureFloatRender)throw"Depth renderer does not support int texture type";t=_.a.TEXTURETYPE_FLOAT}this._depthRenderer[e.id]=new cl(this,t,e)}return this._depthRenderer[e.id]},W.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 ll=function(){function e(e){this.name=Ae.a.NAME_DEPTHRENDERER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Ae.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER,this,this._gatherRenderTargets),this.scene._gatherActiveCameraRenderTargetsStage.registerStep(Ae.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}();cl._SceneComponentInitialization=function(e){var t=e._getComponent(Ae.a.NAME_DEPTHRENDERER);t||(t=new ll(e),e._addComponent(t))};var ul="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";zt.a.ShadersStore.linePixelShader=ul;var hl="\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}";zt.a.ShadersStore.lineVertexShader=hl;Fe.a.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},Fe.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new fl(this,e,t),this},Object.defineProperty(Fe.a.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),Vs.b.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new pl(this,e,t),this},Vs.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),Vs.b.prototype.enableEdgesRendering.apply(this,arguments),this};var dl=function(){return function(){this.edges=new Array,this.edgesConnectedCount=0}}(),fl=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 as.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[Oi.b.PositionKind];e&&e._rebuild(),(e=this._buffers[Oi.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[Oi.b.PositionKind];e&&(e.dispose(),this._buffers[Oi.b.PositionKind]=null),(e=this._buffers[Oi.b.NormalKind])&&(e.dispose(),this._buffers[Oi.b.NormalKind]=null),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 s;void 0===t?s=!0:s=o.x.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}";zt.a.ShadersStore.outlinePixelShader=_l;var gl="\nattribute vec3 position;\nattribute vec3 normal;\n#include\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 offsetPosition=position+normal*offset;\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,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";zt.a.ShadersStore.outlineVertexShader=gl;W.a.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new ml(this)),this._outlineRenderer},Object.defineProperty(Fe.a.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(Fe.a.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var ml=function(){function e(e){this.name=Ae.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(Ae.a.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(Ae.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(),s=o.getCaps().instancedArrays&&null!==t.visibleInstances[e._id]&&void 0!==t.visibleInstances[e._id];if(this.isReady(e,s)){var a=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:a.outlineWidth),this._effect.setColor4("color",i?a.overlayColor:a.outlineColor,i?a.overlayAlpha:c.alpha),this._effect.setMatrix("viewProjection",r.getTransformMatrix()),a.useBones&&a.computeBonesUsingShaders&&a.skeleton&&this._effect.setMatrices("mBones",a.skeleton.getTransformMatrices(a)),a._bind(e,this._effect,so.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),a._processRendering(e,this._effect,so.a.TriangleFillMode,t,s,function(e,t){n._effect.setMatrix("world",t)}),o.setZOffset(0)}}},e.prototype.isReady=function(e,t){var i=[],n=[Oi.b.PositionKind,Oi.b.NormalKind],r=e.getMesh(),o=e.getMaterial();o&&(o.needAlphaTesting()&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(Oi.b.UVKind)&&(n.push(Oi.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(Oi.b.UV2Kind)&&(n.push(Oi.b.UV2Kind),i.push("#define UV2"))),o.useLogarithmicDepth&&i.push("#define LOGARITHMICDEPTH")),r.useBones&&r.computeBonesUsingShaders?(n.push(Oi.b.MatricesIndicesKind),n.push(Oi.b.MatricesWeightsKind),r.numBoneInfluencers>4&&(n.push(Oi.b.MatricesIndicesExtraKind),n.push(Oi.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"),t&&(i.push("#define INSTANCES"),n.push("world0"),n.push("world1"),n.push("world2"),n.push("world3"));var s=i.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._effect=this.scene.getEngine().createEffect("outline",n,["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant"],["diffuseSampler"],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(_.a.REPLACE),this._engine.setStencilFunction(_.a.ALWAYS),this._engine.setStencilMask(e._StencilReference),this._engine.setStencilFunctionReference(e._StencilReference),this.render(i,n,!0),this._engine.setColorWrite(!0),this._engine.setStencilFunction(_.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(_.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}(),vl=i(109),yl=function(){function e(e,t){this.name=e,this.color=new o.f(1,1,1,1),this.width=1,this.height=1,this.angle=0,this.cellIndex=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=o.x.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=a,i))break}}return r||new en.a},W.a.prototype.pickSprite=function(e,t,i,n,r){return this.createPickingRayInCameraSpaceToRef(e,t,this._tempSpritePickingRay,r),this._internalPickSprites(this._tempSpritePickingRay,i,n,r)},W.a.prototype.pickSpriteWithRay=function(e,t,i,n){if(!this._tempSpritePickingRay)return null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}return It.a.TransformToRef(e,n.getViewMatrix(),this._tempSpritePickingRay),this._internalPickSprites(this._tempSpritePickingRay,t,i,n)},W.a.prototype.setPointerOverSprite=function(e){this._pointerOverSprite!==e&&(this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(_.a.ACTION_OnPointerOutTrigger,c.a.CreateNewFromSprite(this._pointerOverSprite,this)),this._pointerOverSprite=e,this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(_.a.ACTION_OnPointerOverTrigger,c.a.CreateNewFromSprite(this._pointerOverSprite,this)))},W.a.prototype.getPointerOverSprite=function(){return this._pointerOverSprite};var bl=function(){function e(e){this.name=Ae.a.NAME_SPRITE,this.scene=e,this.scene.spriteManagers=new Array,this.scene._tempSpritePickingRay=It.a?It.a.Zero():null,this.scene.onBeforeSpritesRenderingObservable=new r.c,this.scene.onAfterSpritesRenderingObservable=new r.c,this._spritePredicate=function(e){return!!e.actionManager&&(e.isPickable&&e.actionManager.hasPointerTriggers)}}return e.prototype.register=function(){this.scene._pointerMoveStage.registerStep(Ae.a.STEP_POINTERMOVE_SPRITE,this,this._pointerMove),this.scene._pointerDownStage.registerStep(Ae.a.STEP_POINTERDOWN_SPRITE,this,this._pointerDown),this.scene._pointerUpStage.registerStep(Ae.a.STEP_POINTERUP_SPRITE,this,this._pointerUp)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){this.scene.onBeforeSpritesRenderingObservable.clear(),this.scene.onAfterSpritesRenderingObservable.clear();for(var e=this.scene.spriteManagers;e.length;)e[0].dispose()},e.prototype._pickSpriteButKeepRay=function(e,t,i,n,r){var o=this.scene.pickSprite(t,i,this._spritePredicate,n,r);return o&&(o.ray=e?e.ray:null),o},e.prototype._pointerMove=function(e,t,i,n,r){var o=this.scene;return n?o.setPointerOverSprite(null):(i=this._pickSpriteButKeepRay(i,e,t,!1,o.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite?(o.setPointerOverSprite(i.pickedSprite),o._pointerOverSprite&&o._pointerOverSprite.actionManager&&o._pointerOverSprite.actionManager.hoverCursor?r.style.cursor=o._pointerOverSprite.actionManager.hoverCursor:r.style.cursor=o.hoverCursor):o.setPointerOverSprite(null),i},e.prototype._pointerDown=function(e,t,i,n){var r=this.scene;if(r._pickedDownSprite=null,r.spriteManagers.length>0&&(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(_.a.ACTION_OnLeftPickTrigger,c.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnCenterPickTrigger,c.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnRightPickTrigger,c.a.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickDownTrigger,c.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(_.a.ACTION_OnPickUpTrigger,c.a.CreateNewFromSprite(o.pickedSprite,r,n)),o.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||o.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickTrigger,c.a.CreateNewFromSprite(o.pickedSprite,r,n)))),r._pickedDownSprite&&r._pickedDownSprite.actionManager&&r._pickedDownSprite!==o.pickedSprite&&r._pickedDownSprite.actionManager.processTrigger(_.a.ACTION_OnPickOutTrigger,c.a.CreateNewFromSprite(r._pickedDownSprite,r,n)))}return i},e}(),Tl="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}";zt.a.ShadersStore.spritesPixelShader=Tl;var El="\nattribute vec4 position;\nattribute vec4 options;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform vec2 textureInfos;\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;\nvec2 uvScale=textureInfos.xy;\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-cellInfo.x),1.0-abs(offset.y-cellInfo.y));\nvUV=(uvOffset+cellInfo.zw)*uvScale;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}";zt.a.ShadersStore.spritesVertexShader=El;var Al,xl=function(){function e(e,t,i,n,o,s,a){if(void 0===s&&(s=.01),void 0===a&&(a=ke.a.TRILINEAR_SAMPLINGMODE),this.name=e,this.sprites=new Array,this.renderingGroupId=0,this.layerMask=268435455,this.fogEnabled=!0,this.isPickable=!1,this.onDisposeObservable=new r.c,this._vertexBuffers={},o._getComponent(Ae.a.NAME_SPRITE)||o._addComponent(new bl(o)),this._capacity=i,this._spriteTexture=new ke.a(t,o,!0,!1,a),this._spriteTexture.wrapU=ke.a.CLAMP_ADDRESSMODE,this._spriteTexture.wrapV=ke.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=s,this._scene=o,this._scene.spriteManagers.push(this);for(var c=[],l=0,u=0;u>0;this._vertexData[o+10]=t.cellIndex-s*r,this._vertexData[o+11]=s,this._vertexData[o+12]=t.color.r,this._vertexData[o+13]=t.color.g,this._vertexData[o+14]=t.color.b,this._vertexData[o+15]=t.color.a},e.prototype.intersects=function(e,t,i,n){for(var r=Math.min(this._capacity,this.sprites.length),s=o.x.Zero(),a=o.x.Zero(),c=Number.MAX_VALUE,l=null,u=o.x.Zero(),h=o.x.Zero(),d=t.getViewMatrix(),f=0;f_&&(c=_,l=p,n))break}}}if(l){var g=new en.a;d.invertToRef(o.t.Matrix[0]),g.hit=!0,g.pickedSprite=l,g.distance=c;var m=o.t.Vector3[0];return m.copyFrom(e.direction),m.normalize(),m.scaleInPlace(c),e.origin.addToRef(m,u),g.pickedPoint=o.x.TransformCoordinates(u,o.t.Matrix[0]),g}return null},e.prototype.render=function(){if(this._effectBase.isReady()&&this._effectFog.isReady()&&this._spriteTexture&&this._spriteTexture.isReady()&&this.sprites.length){for(var e=this._scene.getEngine(),t=this._spriteTexture.getBaseSize(),i=e.getDeltaTime(),n=Math.min(this._capacity,this.sprites.length),r=t.width/this.cellWidth,o=0,s=!0,a=0;a-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 Ml(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){p.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){p.a.Error("Error running tasks-done callbacks."),console.log(e)}this._isLoading=!1,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(),s=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");o.readEntries(function(e){i.count+=e.length;for(var o=0,a=e;o0)){for(var i=new Array,n=[],r=e.dataTransfer?e.dataTransfer.items:null,o=0;o0&&p.a.ClearLogCache(),this._engine.stopRenderLoop()),bn.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)})):p.a.Error("Please provide a valid .babylon file.")},e}(),zl=i(105),jl=i(106),Hl=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}(),Wl=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 l.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}(Hl),Xl=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 l.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}(Hl),Yl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.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}(Hl),Kl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.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}(Hl),Ql=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.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}(Hl),ql=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.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}(Hl),Zl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.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}(Hl),Jl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l.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}(Hl),$l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._canBeMerged=function(e){if(!(e instanceof fe.a))return!1;var t=e;return!t.isDisposed()&&(!(!t.isVisible||!t.isEnabled())&&(!(t.instances.length>0)&&(!t.skeleton&&!t.hasLODLevels)))},t}return l.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,s=0;s=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var n=!0,r=!0,o=0;o0)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&&ye.h.Download(e,this._fileName)},e._defaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},e}(),lu=function(){function e(){}return e.CreateScreenshot=function(e,t,i,n,r){var o,s;if(void 0===r&&(r="image/png"),i.precision)o=Math.round(e.getRenderWidth()*i.precision),s=Math.round(o/e.getAspectRatio(t));else if(i.width&&i.height)o=i.width,s=i.height;else if(i.width&&!i.height)o=i.width,s=Math.round(o/e.getAspectRatio(t));else if(i.height&&!i.width)s=i.height,o=Math.round(s*e.getAspectRatio(t));else{if(isNaN(i))return void p.a.Error("Invalid 'size' parameter !");s=i,o=i}ye.h._ScreenshotCanvas||(ye.h._ScreenshotCanvas=document.createElement("canvas")),ye.h._ScreenshotCanvas.width=o,ye.h._ScreenshotCanvas.height=s;var a=ye.h._ScreenshotCanvas.getContext("2d"),c=e.getRenderWidth()/e.getRenderHeight(),l=o,u=l/c;u>s&&(l=(u=s)*c);var h=Math.max(0,o-l)/2,d=Math.max(0,s-u)/2,f=e.getRenderingCanvas();a&&f&&a.drawImage(f,h,d,l,u),ye.h.EncodeScreenshotCanvasData(n,r)},e.CreateScreenshotUsingRenderTarget=function(e,t,i,n,r,o,s,a){var c,l;if(void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===s&&(s=!1),i.precision)c=Math.round(e.getRenderWidth()*i.precision),l=Math.round(c/e.getAspectRatio(t)),i={width:c,height:l};else if(i.width&&i.height)c=i.width,l=i.height;else if(i.width&&!i.height)c=i.width,l=Math.round(c/e.getAspectRatio(t)),i={width:c,height:l};else if(i.height&&!i.width)l=i.height,i={width:c=Math.round(l*e.getAspectRatio(t)),height:l};else{if(isNaN(i))return void p.a.Error("Invalid 'size' parameter !");l=i,c=i}var u=t.getScene(),h=null;u.activeCamera!==t&&(h=u.activeCamera,u.activeCamera=t);var d=e.getRenderingCanvas();if(d){var f={width:d.width,height:d.height};e.setSize(c,l),u.render();var g=new _i("screenShot",i,u,!1,!1,_.a.TEXTURETYPE_UNSIGNED_INT,!1,ke.a.NEAREST_SAMPLINGMODE);g.renderList=null,g.samples=o,s&&g.addPostProcess(new xc("antialiasing",1,u.activeCamera)),g.onAfterRenderObservable.add(function(){ye.h.DumpFramebuffer(c,l,e,n,r,a)}),u.incrementRenderId(),u.resetCachedMaterial(),g.render(!0),g.dispose(),h&&(u.activeCamera=h),e.setSize(f.width,f.height),t.getProjectionMatrix(!0)}else p.a.Error("No rendering canvas found !")},e}();ye.h.CreateScreenshot=lu.CreateScreenshot,ye.h.CreateScreenshotUsingRenderTarget=lu.CreateScreenshotUsingRenderTarget,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"}(Sl||(Sl={})),i.d(t,"AbstractScene",function(){return n.a}),i.d(t,"Action",function(){return a}),i.d(t,"ActionEvent",function(){return c.a}),i.d(t,"ActionManager",function(){return C}),i.d(t,"Condition",function(){return u}),i.d(t,"ValueCondition",function(){return h}),i.d(t,"PredicateCondition",function(){return d}),i.d(t,"StateCondition",function(){return f}),i.d(t,"SwitchBooleanAction",function(){return g}),i.d(t,"SetStateAction",function(){return m}),i.d(t,"SetValueAction",function(){return v}),i.d(t,"IncrementValueAction",function(){return y}),i.d(t,"PlayAnimationAction",function(){return b}),i.d(t,"StopAnimationAction",function(){return T}),i.d(t,"DoNothingAction",function(){return E}),i.d(t,"CombineAction",function(){return A}),i.d(t,"ExecuteCodeAction",function(){return x}),i.d(t,"SetParentAction",function(){return R}),i.d(t,"PlaySoundAction",function(){return M}),i.d(t,"StopSoundAction",function(){return O}),i.d(t,"InterpolateValueAction",function(){return U}),i.d(t,"Animatable",function(){return Q}),i.d(t,"_IAnimationState",function(){return N}),i.d(t,"Animation",function(){return B}),i.d(t,"TargetedAnimation",function(){return q}),i.d(t,"AnimationGroup",function(){return Z}),i.d(t,"AnimationPropertiesOverride",function(){return J}),i.d(t,"EasingFunction",function(){return $}),i.d(t,"CircleEase",function(){return ee}),i.d(t,"BackEase",function(){return te}),i.d(t,"BounceEase",function(){return ie}),i.d(t,"CubicEase",function(){return ne}),i.d(t,"ElasticEase",function(){return re}),i.d(t,"ExponentialEase",function(){return oe}),i.d(t,"PowerEase",function(){return se}),i.d(t,"QuadraticEase",function(){return ae}),i.d(t,"QuarticEase",function(){return ce}),i.d(t,"QuinticEase",function(){return le}),i.d(t,"SineEase",function(){return ue}),i.d(t,"BezierCurveEase",function(){return he}),i.d(t,"RuntimeAnimation",function(){return H}),i.d(t,"AnimationEvent",function(){return de}),i.d(t,"AnimationKeyInterpolation",function(){return I}),i.d(t,"AnimationRange",function(){return w}),i.d(t,"KeepAssets",function(){return pe}),i.d(t,"AssetContainer",function(){return _e}),i.d(t,"Analyser",function(){return me}),i.d(t,"AudioEngine",function(){return ve}),i.d(t,"AudioSceneComponent",function(){return xe}),i.d(t,"Sound",function(){return Te}),i.d(t,"SoundTrack",function(){return Ee}),i.d(t,"WeightedSound",function(){return Re}),i.d(t,"AutoRotationBehavior",function(){return Se}),i.d(t,"BouncingBehavior",function(){return Ce}),i.d(t,"FramingBehavior",function(){return Me}),i.d(t,"AttachToBoxBehavior",function(){return Ie}),i.d(t,"FadeInOutBehavior",function(){return De}),i.d(t,"MultiPointerScaleBehavior",function(){return we}),i.d(t,"PointerDragBehavior",function(){return Le.a}),i.d(t,"SixDofDragBehavior",function(){return Ue}),i.d(t,"Bone",function(){return K}),i.d(t,"BoneIKController",function(){return Ve}),i.d(t,"BoneLookController",function(){return Ge}),i.d(t,"Skeleton",function(){return He}),i.d(t,"CameraInputTypes",function(){return We}),i.d(t,"CameraInputsManager",function(){return Xe}),i.d(t,"Camera",function(){return Ne.a}),i.d(t,"TargetCamera",function(){return yt}),i.d(t,"FreeCamera",function(){return bt}),i.d(t,"FreeCameraInputsManager",function(){return dt}),i.d(t,"TouchCamera",function(){return Tt}),i.d(t,"ArcRotateCamera",function(){return Et}),i.d(t,"ArcRotateCameraInputsManager",function(){return it}),i.d(t,"DeviceOrientationCamera",function(){return At}),i.d(t,"FlyCamera",function(){return Rt}),i.d(t,"FlyCameraInputsManager",function(){return xt}),i.d(t,"FollowCamera",function(){return Ct}),i.d(t,"ArcFollowCamera",function(){return Mt}),i.d(t,"GamepadCamera",function(){return Gt}),i.d(t,"UniversalCamera",function(){return Vt}),i.d(t,"VirtualJoysticksCamera",function(){return ai}),i.d(t,"ArcRotateCameraGamepadInput",function(){return qe}),i.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return Je}),i.d(t,"ArcRotateCameraMouseWheelInput",function(){return $e}),i.d(t,"ArcRotateCameraPointersInput",function(){return tt}),i.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return nt}),i.d(t,"FlyCameraKeyboardInput",function(){return rt}),i.d(t,"FlyCameraMouseInput",function(){return ot}),i.d(t,"FollowCameraKeyboardMoveInput",function(){return st}),i.d(t,"FollowCameraMouseWheelInput",function(){return at}),i.d(t,"FollowCameraPointersInput",function(){return ct}),i.d(t,"FreeCameraDeviceOrientationInput",function(){return ft}),i.d(t,"FreeCameraGamepadInput",function(){return pt}),i.d(t,"FreeCameraKeyboardMoveInput",function(){return lt}),i.d(t,"FreeCameraMouseInput",function(){return ut}),i.d(t,"FreeCameraTouchInput",function(){return ht}),i.d(t,"FreeCameraVirtualJoystickInput",function(){return vt}),i.d(t,"AnaglyphArcRotateCamera",function(){return Zt}),i.d(t,"AnaglyphFreeCamera",function(){return Jt}),i.d(t,"AnaglyphGamepadCamera",function(){return $t}),i.d(t,"AnaglyphUniversalCamera",function(){return ei}),i.d(t,"StereoscopicArcRotateCamera",function(){return ni}),i.d(t,"StereoscopicFreeCamera",function(){return ri}),i.d(t,"StereoscopicGamepadCamera",function(){return oi}),i.d(t,"StereoscopicUniversalCamera",function(){return si}),i.d(t,"VRCameraMetrics",function(){return ci}),i.d(t,"VRDeviceOrientationArcRotateCamera",function(){return vi}),i.d(t,"VRDeviceOrientationFreeCamera",function(){return yi}),i.d(t,"VRDeviceOrientationGamepadCamera",function(){return bi}),i.d(t,"OnAfterEnteringVRObservableEvent",function(){return Vi}),i.d(t,"VRExperienceHelper",function(){return Gi}),i.d(t,"WebVRFreeCamera",function(){return Ei}),i.d(t,"WebXRCamera",function(){return ki}),i.d(t,"WebXREnterExitUIButton",function(){return Wi}),i.d(t,"WebXREnterExitUIOptions",function(){return Xi}),i.d(t,"WebXREnterExitUI",function(){return Yi}),i.d(t,"WebXRState",function(){return Li}),i.d(t,"WebXRExperienceHelper",function(){return Hi}),i.d(t,"WebXRController",function(){return Ki}),i.d(t,"WebXRInput",function(){return Qi}),i.d(t,"WebXRManagedOutputCanvas",function(){return qi}),i.d(t,"WebXRSessionManager",function(){return zi}),i.d(t,"Collider",function(){return Ji}),i.d(t,"DefaultCollisionCoordinator",function(){return $i}),i.d(t,"PickingInfo",function(){return en.a}),i.d(t,"IntersectionInfo",function(){return tn.a}),i.d(t,"_MeshCollisionData",function(){return nn.a}),i.d(t,"BoundingBox",function(){return rn.a}),i.d(t,"BoundingInfo",function(){return on.a}),i.d(t,"BoundingSphere",function(){return sn.a}),i.d(t,"Ray",function(){return It.a}),i.d(t,"Octree",function(){return cn}),i.d(t,"OctreeBlock",function(){return an}),i.d(t,"OctreeSceneComponent",function(){return ln}),i.d(t,"AxesViewer",function(){return un.AxesViewer}),i.d(t,"BoneAxesViewer",function(){return un.BoneAxesViewer}),i.d(t,"DebugLayer",function(){return un.DebugLayer}),i.d(t,"PhysicsViewer",function(){return un.PhysicsViewer}),i.d(t,"RayHelper",function(){return un.RayHelper}),i.d(t,"SkeletonViewer",function(){return un.SkeletonViewer}),i.d(t,"Constants",function(){return _.a}),i.d(t,"InstancingAttributeInfo",function(){return ge.d}),i.d(t,"DepthTextureCreationOptions",function(){return ge.a}),i.d(t,"EngineCapabilities",function(){return ge.c}),i.d(t,"Engine",function(){return ge.b}),i.d(t,"EngineStore",function(){return P.a}),i.d(t,"NullEngineOptions",function(){return hn.b}),i.d(t,"NullEngine",function(){return hn.a}),i.d(t,"WebGLPipelineContext",function(){return pn.a}),i.d(t,"_OcclusionDataStorage",function(){return fn}),i.d(t,"_forceTransformFeedbackToBundle",function(){return!0}),i.d(t,"KeyboardEventTypes",function(){return Ze.a}),i.d(t,"KeyboardInfo",function(){return Ze.b}),i.d(t,"KeyboardInfoPre",function(){return Ze.c}),i.d(t,"PointerEventTypes",function(){return Pe.a}),i.d(t,"PointerInfoBase",function(){return Pe.c}),i.d(t,"PointerInfoPre",function(){return Pe.d}),i.d(t,"PointerInfo",function(){return Pe.b}),i.d(t,"ClipboardEventTypes",function(){return _n}),i.d(t,"ClipboardInfo",function(){return gn}),i.d(t,"DaydreamController",function(){return Tn}),i.d(t,"GearVRController",function(){return En}),i.d(t,"GenericController",function(){return An}),i.d(t,"OculusTouchController",function(){return xn}),i.d(t,"PoseEnabledControllerType",function(){return St}),i.d(t,"PoseEnabledControllerHelper",function(){return wt}),i.d(t,"PoseEnabledController",function(){return Ft}),i.d(t,"ViveController",function(){return Rn}),i.d(t,"WebVRController",function(){return Ai}),i.d(t,"WindowsMotionController",function(){return Sn}),i.d(t,"StickValues",function(){return Ye}),i.d(t,"Gamepad",function(){return Ke}),i.d(t,"GenericPad",function(){return Qe}),i.d(t,"GamepadManager",function(){return Bt}),i.d(t,"GamepadSystemSceneComponent",function(){return Ut}),i.d(t,"Xbox360Button",function(){return Dt}),i.d(t,"Xbox360Dpad",function(){return Lt}),i.d(t,"Xbox360Pad",function(){return Nt}),i.d(t,"AxisDragGizmo",function(){return Cn.a}),i.d(t,"AxisScaleGizmo",function(){return Dn}),i.d(t,"BoundingBoxGizmo",function(){return Fn}),i.d(t,"Gizmo",function(){return On.a}),i.d(t,"GizmoManager",function(){return kn}),i.d(t,"PlaneRotationGizmo",function(){return Nn}),i.d(t,"PositionGizmo",function(){return Un}),i.d(t,"RotationGizmo",function(){return Bn}),i.d(t,"ScaleGizmo",function(){return Gn}),i.d(t,"LightGizmo",function(){return Yn}),i.d(t,"EnvironmentHelper",function(){return pr}),i.d(t,"PhotoDome",function(){return gr}),i.d(t,"_forceSceneHelpersToBundle",function(){return!0}),i.d(t,"VideoDome",function(){return no}),i.d(t,"EngineInstrumentation",function(){return ro}),i.d(t,"SceneInstrumentation",function(){return oo}),i.d(t,"_TimeToken",function(){return dn}),i.d(t,"EffectLayer",function(){return lo}),i.d(t,"EffectLayerSceneComponent",function(){return uo}),i.d(t,"GlowLayer",function(){return po}),i.d(t,"HighlightLayer",function(){return mo}),i.d(t,"Layer",function(){return To}),i.d(t,"LayerSceneComponent",function(){return vo}),i.d(t,"LensFlare",function(){return Eo}),i.d(t,"LensFlareSystem",function(){return Ro}),i.d(t,"LensFlareSystemSceneComponent",function(){return Po}),i.d(t,"Light",function(){return zn.a}),i.d(t,"ShadowLight",function(){return jn}),i.d(t,"DirectionalLight",function(){return Hn}),i.d(t,"HemisphericLight",function(){return Ti.a}),i.d(t,"PointLight",function(){return Do}),i.d(t,"SpotLight",function(){return Xn}),i.d(t,"ShadowGenerator",function(){return Oo}),i.d(t,"ShadowGeneratorSceneComponent",function(){return Io}),i.d(t,"DefaultLoadingScreen",function(){return Lo}),i.d(t,"SceneLoaderProgressEvent",function(){return yn}),i.d(t,"SceneLoader",function(){return bn}),i.d(t,"SceneLoaderFlags",function(){return vn.a}),i.d(t,"_BabylonLoaderRegistered",function(){return!0}),i.d(t,"ColorCurves",function(){return is.a}),i.d(t,"EffectFallbacks",function(){return zt.c}),i.d(t,"EffectCreationOptions",function(){return zt.b}),i.d(t,"Effect",function(){return zt.a}),i.d(t,"FresnelParameters",function(){return ns}),i.d(t,"ImageProcessingConfigurationDefines",function(){return xi.b}),i.d(t,"ImageProcessingConfiguration",function(){return xi.a}),i.d(t,"Material",function(){return so.a}),i.d(t,"MaterialDefines",function(){return nr.a}),i.d(t,"MaterialHelper",function(){return ir.a}),i.d(t,"MultiMaterial",function(){return Fo.a}),i.d(t,"PushMaterial",function(){return rr.a}),i.d(t,"ShaderMaterial",function(){return as.a}),i.d(t,"StandardMaterialDefines",function(){return Ri.b}),i.d(t,"StandardMaterial",function(){return Ri.a}),i.d(t,"BaseTexture",function(){return Kn.a}),i.d(t,"CubeTexture",function(){return tr}),i.d(t,"EquiRectangularCubeTexture",function(){return ls}),i.d(t,"HDRCubeTexture",function(){return Uo}),i.d(t,"InternalTexture",function(){return ze.a}),i.d(t,"MirrorTexture",function(){return er}),i.d(t,"MultiRenderTarget",function(){return ds}),i.d(t,"RawTexture",function(){return je}),i.d(t,"RenderTargetTexture",function(){return _i}),i.d(t,"Texture",function(){return ke.a}),i.d(t,"UniformBuffer",function(){return di.a}),i.d(t,"MaterialFlags",function(){return or.a}),i.d(t,"BackgroundMaterial",function(){return dr}),i.d(t,"PBRMaterialDefines",function(){return Vr}),i.d(t,"PBRBaseMaterial",function(){return Gr}),i.d(t,"PBRBaseSimpleMaterial",function(){return rs}),i.d(t,"PBRMaterial",function(){return kr}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return os}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return ss}),i.d(t,"ColorGradingTexture",function(){return cs}),i.d(t,"DynamicTexture",function(){return Pi}),i.d(t,"_DDSTextureLoader",function(){return qr}),i.d(t,"_ENVTextureLoader",function(){return $r}),i.d(t,"_KTXTextureLoader",function(){return to}),i.d(t,"ProceduralTexture",function(){return _s}),i.d(t,"RawCubeTexture",function(){return bs}),i.d(t,"RawTexture3D",function(){return Ts}),i.d(t,"RefractionTexture",function(){return Es}),i.d(t,"VideoTexture",function(){return io}),i.d(t,"HtmlElementTexture",function(){return As}),i.d(t,"_TGATextureLoader",function(){return hs}),i.d(t,"CustomProceduralTexture",function(){return ms}),i.d(t,"NoiseProceduralTexture",function(){return ys}),i.d(t,"ProceduralTextureSceneComponent",function(){return fs}),i.d(t,"Scalar",function(){return D.a}),i.d(t,"ToGammaSpace",function(){return o.u}),i.d(t,"ToLinearSpace",function(){return o.v}),i.d(t,"Epsilon",function(){return o.h}),i.d(t,"Color3",function(){return o.e}),i.d(t,"Color4",function(){return o.f}),i.d(t,"Vector2",function(){return o.w}),i.d(t,"Vector3",function(){return o.x}),i.d(t,"Vector4",function(){return o.y}),i.d(t,"Size",function(){return o.r}),i.d(t,"Quaternion",function(){return o.q}),i.d(t,"Matrix",function(){return o.j}),i.d(t,"Plane",function(){return o.n}),i.d(t,"Viewport",function(){return o.z}),i.d(t,"Frustum",function(){return o.i}),i.d(t,"Space",function(){return o.s}),i.d(t,"Axis",function(){return o.c}),i.d(t,"BezierCurve",function(){return o.d}),i.d(t,"Orientation",function(){return o.k}),i.d(t,"Angle",function(){return o.a}),i.d(t,"Arc2",function(){return o.b}),i.d(t,"Path2",function(){return o.l}),i.d(t,"Path3D",function(){return o.m}),i.d(t,"Curve3",function(){return o.g}),i.d(t,"PositionNormalVertex",function(){return o.p}),i.d(t,"PositionNormalTextureVertex",function(){return o.o}),i.d(t,"Tmp",function(){return o.t}),i.d(t,"SphericalHarmonics",function(){return zr.a}),i.d(t,"SphericalPolynomial",function(){return zr.b}),i.d(t,"AbstractMesh",function(){return Fe.a}),i.d(t,"Buffer",function(){return Oi.a}),i.d(t,"VertexBuffer",function(){return Oi.b}),i.d(t,"CSG",function(){return Ns}),i.d(t,"Geometry",function(){return wo.a}),i.d(t,"GroundMesh",function(){return Ii}),i.d(t,"TrailMesh",function(){return Bs}),i.d(t,"InstancedMesh",function(){return Us.a}),i.d(t,"LinesMesh",function(){return Vs.b}),i.d(t,"InstancedLinesMesh",function(){return Vs.a}),i.d(t,"_CreationDataStorage",function(){return fe.b}),i.d(t,"_InstancesBatch",function(){return fe.c}),i.d(t,"Mesh",function(){return fe.a}),i.d(t,"VertexData",function(){return Mi.a}),i.d(t,"MeshBuilder",function(){return Js}),i.d(t,"SimplificationSettings",function(){return $s}),i.d(t,"SimplificationQueue",function(){return ea}),i.d(t,"SimplificationType",function(){return qs}),i.d(t,"SimplicationQueueSceneComponent",function(){return sa}),i.d(t,"Polygon",function(){return Hs}),i.d(t,"PolygonMeshBuilder",function(){return Ws}),i.d(t,"BaseSubMesh",function(){return Os.a}),i.d(t,"SubMesh",function(){return Os.b}),i.d(t,"MeshLODLevel",function(){return aa.a}),i.d(t,"TransformNode",function(){return _r.a}),i.d(t,"BoxBuilder",function(){return Mn.a}),i.d(t,"SphereBuilder",function(){return Ln.a}),i.d(t,"CylinderBuilder",function(){return Fi.a}),i.d(t,"LinesBuilder",function(){return wn.a}),i.d(t,"PlaneBuilder",function(){return fr.a}),i.d(t,"DataBuffer",function(){return ca.a}),i.d(t,"WebGLDataBuffer",function(){return la.a}),i.d(t,"DracoCompression",function(){return Ms}),i.d(t,"DiscBuilder",function(){return Gs}),i.d(t,"RibbonBuilder",function(){return Yo}),i.d(t,"HemisphereBuilder",function(){return Wn}),i.d(t,"TorusBuilder",function(){return wi}),i.d(t,"TorusKnotBuilder",function(){return ks}),i.d(t,"PolygonBuilder",function(){return Xs}),i.d(t,"ShapeBuilder",function(){return Ko}),i.d(t,"LatheBuilder",function(){return Ys}),i.d(t,"GroundBuilder",function(){return Di}),i.d(t,"TubeBuilder",function(){return Ks}),i.d(t,"PolyhedronBuilder",function(){return Vn}),i.d(t,"IcoSphereBuilder",function(){return Qs}),i.d(t,"DecalBuilder",function(){return Zs}),i.d(t,"MorphTarget",function(){return Vo}),i.d(t,"MorphTargetManager",function(){return Go}),i.d(t,"Node",function(){return F.a}),i.d(t,"Database",function(){return ha}),i.d(t,"BaseParticleSystem",function(){return ba}),i.d(t,"GPUParticleSystem",function(){return Ia}),i.d(t,"Particle",function(){return Ta}),i.d(t,"ParticleHelper",function(){return La}),i.d(t,"ParticleSystem",function(){return Ra}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return 42}),i.d(t,"ParticleSystemSet",function(){return Da}),i.d(t,"SolidParticle",function(){return wa}),i.d(t,"ModelShape",function(){return Fa}),i.d(t,"DepthSortedParticle",function(){return Na}),i.d(t,"SolidParticleSystem",function(){return Ua}),i.d(t,"SubEmitterType",function(){return ua}),i.d(t,"SubEmitter",function(){return Ea}),i.d(t,"BoxParticleEmitter",function(){return da}),i.d(t,"ConeParticleEmitter",function(){return fa}),i.d(t,"CylinderParticleEmitter",function(){return pa}),i.d(t,"CylinderDirectedParticleEmitter",function(){return _a}),i.d(t,"HemisphericParticleEmitter",function(){return ga}),i.d(t,"PointParticleEmitter",function(){return ma}),i.d(t,"SphereParticleEmitter",function(){return va}),i.d(t,"SphereDirectedParticleEmitter",function(){return ya}),i.d(t,"PhysicsEngine",function(){return jo}),i.d(t,"PhysicsEngineSceneComponent",function(){return ka}),i.d(t,"PhysicsHelper",function(){return za}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return Ya}),i.d(t,"PhysicsUpdraftEventOptions",function(){return Ka}),i.d(t,"PhysicsVortexEventOptions",function(){return Qa}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return Va}),i.d(t,"PhysicsUpdraftMode",function(){return Ga}),i.d(t,"PhysicsImpostor",function(){return ko.a}),i.d(t,"PhysicsJoint",function(){return zo.e}),i.d(t,"DistanceJoint",function(){return zo.a}),i.d(t,"MotorEnabledJoint",function(){return zo.d}),i.d(t,"HingeJoint",function(){return zo.c}),i.d(t,"Hinge2Joint",function(){return zo.b}),i.d(t,"CannonJSPlugin",function(){return Wo}),i.d(t,"AmmoJSPlugin",function(){return Qo}),i.d(t,"OimoJSPlugin",function(){return Xo}),i.d(t,"AnaglyphPostProcess",function(){return qt}),i.d(t,"BlackAndWhitePostProcess",function(){return Za}),i.d(t,"BloomEffect",function(){return nc}),i.d(t,"BloomMergePostProcess",function(){return ic}),i.d(t,"BlurPostProcess",function(){return $n}),i.d(t,"ChromaticAberrationPostProcess",function(){return oc}),i.d(t,"CircleOfConfusionPostProcess",function(){return ac}),i.d(t,"ColorCorrectionPostProcess",function(){return lc}),i.d(t,"ConvolutionPostProcess",function(){return hc}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return dc}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return pc}),i.d(t,"DepthOfFieldEffect",function(){return mc}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return _c}),i.d(t,"DepthOfFieldMergePostProcess",function(){return gc}),i.d(t,"DisplayPassPostProcess",function(){return yc}),i.d(t,"ExtractHighlightsPostProcess",function(){return ec}),i.d(t,"FilterPostProcess",function(){return Tc}),i.d(t,"FxaaPostProcess",function(){return xc}),i.d(t,"GrainPostProcess",function(){return Pc}),i.d(t,"HighlightsPostProcess",function(){return Cc}),i.d(t,"ImageProcessingPostProcess",function(){return Ci}),i.d(t,"MotionBlurPostProcess",function(){return wc}),i.d(t,"PassPostProcess",function(){return Yt}),i.d(t,"PassCubePostProcess",function(){return Kt}),i.d(t,"PostProcess",function(){return Ht}),i.d(t,"PostProcessManager",function(){return fi.a}),i.d(t,"RefractionPostProcess",function(){return Nc}),i.d(t,"SharpenPostProcess",function(){return Uc}),i.d(t,"StereoscopicInterlacePostProcess",function(){return ii}),i.d(t,"TonemappingOperator",function(){return el}),i.d(t,"TonemapPostProcess",function(){return tl}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return ol}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return ui}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return mi}),i.d(t,"PostProcessRenderEffect",function(){return Ja}),i.d(t,"PostProcessRenderPipeline",function(){return Vc}),i.d(t,"PostProcessRenderPipelineManager",function(){return Gc}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return kc}),i.d(t,"DefaultRenderingPipeline",function(){return zc}),i.d(t,"LensRenderingPipeline",function(){return Wc}),i.d(t,"SSAO2RenderingPipeline",function(){return Kc}),i.d(t,"SSAORenderingPipeline",function(){return qc}),i.d(t,"StandardRenderingPipeline",function(){return Jc}),i.d(t,"ReflectionProbe",function(){return qo}),i.d(t,"BoundingBoxRenderer",function(){return sl}),i.d(t,"DepthRenderer",function(){return cl}),i.d(t,"DepthRendererSceneComponent",function(){return ll}),i.d(t,"EdgesRenderer",function(){return fl}),i.d(t,"LineEdgesRenderer",function(){return pl}),i.d(t,"GeometryBufferRenderer",function(){return Ic}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return Dc}),i.d(t,"OutlineRenderer",function(){return ml}),i.d(t,"RenderingGroup",function(){return vl.a}),i.d(t,"RenderingGroupInfo",function(){return pi.a}),i.d(t,"RenderingManager",function(){return pi.b}),i.d(t,"UtilityLayerRenderer",function(){return In.a}),i.d(t,"Scene",function(){return W.a}),i.d(t,"SceneComponentConstants",function(){return Ae.a}),i.d(t,"Stage",function(){return Ae.b}),i.d(t,"Sprite",function(){return yl}),i.d(t,"SpriteManager",function(){return xl}),i.d(t,"SpriteSceneComponent",function(){return bl}),i.d(t,"_AlphaState",function(){return Rl.a}),i.d(t,"_DepthCullingState",function(){return Rl.b}),i.d(t,"_StencilState",function(){return Rl.c}),i.d(t,"AndOrNotEvaluator",function(){return Pl.a}),i.d(t,"AssetTaskState",function(){return Al}),i.d(t,"AbstractAssetTask",function(){return Cl}),i.d(t,"AssetsProgressEvent",function(){return Ml}),i.d(t,"MeshAssetTask",function(){return Ol}),i.d(t,"TextFileAssetTask",function(){return Il}),i.d(t,"BinaryFileAssetTask",function(){return Dl}),i.d(t,"ImageAssetTask",function(){return Ll}),i.d(t,"TextureAssetTask",function(){return wl}),i.d(t,"CubeTextureAssetTask",function(){return Fl}),i.d(t,"HDRCubeTextureAssetTask",function(){return Nl}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return Bl}),i.d(t,"AssetsManager",function(){return Ul}),i.d(t,"DDSTools",function(){return Qr}),i.d(t,"expandToProperty",function(){return L.b}),i.d(t,"serialize",function(){return L.c}),i.d(t,"serializeAsTexture",function(){return L.m}),i.d(t,"serializeAsColor3",function(){return L.e}),i.d(t,"serializeAsFresnelParameters",function(){return L.h}),i.d(t,"serializeAsVector2",function(){return L.n}),i.d(t,"serializeAsVector3",function(){return L.o}),i.d(t,"serializeAsMeshReference",function(){return L.k}),i.d(t,"serializeAsColorCurves",function(){return L.g}),i.d(t,"serializeAsColor4",function(){return L.f}),i.d(t,"serializeAsImageProcessingConfiguration",function(){return L.i}),i.d(t,"serializeAsQuaternion",function(){return L.l}),i.d(t,"serializeAsMatrix",function(){return L.j}),i.d(t,"serializeAsCameraReference",function(){return L.d}),i.d(t,"SerializationHelper",function(){return L.a}),i.d(t,"Deferred",function(){return Vl}),i.d(t,"EnvironmentTextureTools",function(){return Jr}),i.d(t,"MeshExploder",function(){return Gl}),i.d(t,"FilesInput",function(){return kl}),i.d(t,"KhronosTextureContainer",function(){return eo}),i.d(t,"EventState",function(){return r.a}),i.d(t,"Observer",function(){return r.d}),i.d(t,"MultiObserver",function(){return r.b}),i.d(t,"Observable",function(){return r.c}),i.d(t,"PerformanceMonitor",function(){return zl.a}),i.d(t,"RollingAverage",function(){return zl.b}),i.d(t,"PromisePolyfill",function(){return jl.a}),i.d(t,"SceneOptimization",function(){return Hl}),i.d(t,"TextureOptimization",function(){return Wl}),i.d(t,"HardwareScalingOptimization",function(){return Xl}),i.d(t,"ShadowsOptimization",function(){return Yl}),i.d(t,"PostProcessesOptimization",function(){return Kl}),i.d(t,"LensFlaresOptimization",function(){return Ql}),i.d(t,"CustomOptimization",function(){return ql}),i.d(t,"ParticlesOptimization",function(){return Zl}),i.d(t,"RenderTargetsOptimization",function(){return Jl}),i.d(t,"MergeMeshesOptimization",function(){return $l}),i.d(t,"SceneOptimizerOptions",function(){return eu}),i.d(t,"SceneOptimizer",function(){return tu}),i.d(t,"SceneSerializer",function(){return ou}),i.d(t,"SmartArray",function(){return kt.a}),i.d(t,"SmartArrayNoDuplicate",function(){return kt.b}),i.d(t,"StringDictionary",function(){return gt.a}),i.d(t,"Tags",function(){return su.a}),i.d(t,"TextureTools",function(){return au}),i.d(t,"TGATools",function(){return us}),i.d(t,"ColorGradient",function(){return ye.c}),i.d(t,"Color3Gradient",function(){return ye.b}),i.d(t,"FactorGradient",function(){return ye.d}),i.d(t,"LoadFileError",function(){return ye.e}),i.d(t,"RetryStrategy",function(){return ye.g}),i.d(t,"Tools",function(){return ye.h}),i.d(t,"PerfCounter",function(){return ye.f}),i.d(t,"className",function(){return ye.i}),i.d(t,"AsyncLoop",function(){return ye.a}),i.d(t,"VideoRecorder",function(){return cu}),i.d(t,"JoystickAxis",function(){return _t}),i.d(t,"VirtualJoystick",function(){return mt}),i.d(t,"WorkerPool",function(){return xs}),i.d(t,"Logger",function(){return p.a}),i.d(t,"_TypeStore",function(){return s.a}),i.d(t,"FilesInputStore",function(){return mn.a}),i.d(t,"DeepCopier",function(){return S.a}),i.d(t,"PivotTools",function(){return Be.a}),i.d(t,"PrecisionDate",function(){return X.a}),i.d(t,"ScreenshotTools",function(){return lu}),i.d(t,"WebRequest",function(){return gs.a}),i.d(t,"InspectableType",function(){return Sl}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return jr.a}),i.d(t,"HDRTools",function(){return Bo}),i.d(t,"PanoramaToCubeMapTools",function(){return No})},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(5).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(5).a.IncludesShadersStore.fogFragment=n},function(e,t,i){"use strict";var n="fogVertexDeclaration",r="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif";i(5).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="morphTargetsVertexGlobalDeclaration",r="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif";i(5).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#endif";i(5).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#endif";i(5).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 s=e._SimplifyNegation(r[o].trim()),a=s.split("&&");if(a.length>1)for(var c=0;c=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 a});var n,r=i(9);!function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"}(n||(n={}));var o=function(){return function(){this.count=0,this.target=0,this.results=[]}}(),s=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 o=this,s=new e;return s._onFulfilled=t,s._onRejected=i,this._children.push(s),s._parent=this,this._state!==n.Pending&&r.h.SetImmediate(function(){if(o._state===n.Fulfilled||o._rejectWasConsumed){var e=s._resolve(o._result);if(null!=e)if(void 0!==e._state){var t=e;s._children.push(t),t._parent=s,s=t}else s._result=e}else s._reject(o._reason)}),s},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;ri._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(5),r=(i(67),i(96),i(68),i(69),i(70),i(90),"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(6),o=i(10),s=i(92),a=i(26),c=i(3),l=i(78),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 s="undefined"!=typeof self?self:void 0!==e?e:window;return"undefined"==typeof URL&&(s.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(s.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.setMatrix=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.setColor3=function(e,t){},i.prototype.setColor4=function(e,t,i){},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,s,l,u,h){void 0===r&&(r=c.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=null);var d=new a.a(this,a.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 s.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 a.a(this,a.a.DATASOURCE_RENDERTARGET),r=e.width||e,o=e.height||e;return n._depthStencilBuffer={},n._framebuffer={},n.baseWidth=r,n.baseHeight=o,n.width=r,n.height=o,n.isReady=!0,n.samples=1,n.generateMipMaps=!!i.generateMipMaps,n.samplingMode=i.samplingMode,n.type=i.type,n._generateDepthBuffer=i.generateDepthBuffer,n._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(n),n},i.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},i.prototype.bindFramebuffer=function(e,t,i,n,r){this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._currentFramebuffer=e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer,this._cachedViewport&&!r&&this.setViewport(this._cachedViewport,i,n)},i.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&(e._MSAAFramebuffer&&(this._currentFramebuffer=e._framebuffer),i()),this._currentFramebuffer=null},i.prototype.createDynamicVertexBuffer=function(e){var t=new l.a;return t.references=1,t.capacity=1,t},i.prototype.updateDynamicTexture=function(e,t,i,n,r){void 0===n&&(n=!1)},i.prototype.areAllEffectsReady=function(){return!0},i.prototype.getError=function(){return 0},i.prototype._getUnpackAlignement=function(){return 1},i.prototype._unpackFlipY=function(e){},i.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0)},i.prototype.updateDynamicVertexBuffer=function(e,t,i,n){},i.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},i.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},i.prototype._releaseBuffer=function(e){return e.references--,0===e.references},i.prototype.releaseEffects=function(){},i.prototype.displayLoadingUI=function(){},i.prototype.hideLoadingUI=function(){},i.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,s){void 0===o&&(o=0),void 0===s&&(s=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(119))},function(e,t,i){"use strict";i.r(t),function(e){i.d(t,"Debug",function(){return l});var n=i(97),r=i(74);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,"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,"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,"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,"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,"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,"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,"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,"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,"Scalar",function(){return n.Scalar}),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,"Color3",function(){return n.Color3}),i.d(t,"Color4",function(){return n.Color4}),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,"Size",function(){return n.Size}),i.d(t,"Quaternion",function(){return n.Quaternion}),i.d(t,"Matrix",function(){return n.Matrix}),i.d(t,"Plane",function(){return n.Plane}),i.d(t,"Viewport",function(){return n.Viewport}),i.d(t,"Frustum",function(){return n.Frustum}),i.d(t,"Space",function(){return n.Space}),i.d(t,"Axis",function(){return n.Axis}),i.d(t,"BezierCurve",function(){return n.BezierCurve}),i.d(t,"Orientation",function(){return n.Orientation}),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,"Tmp",function(){return n.Tmp}),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,"LinesBuilder",function(){return n.LinesBuilder}),i.d(t,"PlaneBuilder",function(){return n.PlaneBuilder}),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,"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,"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,"ColorGradient",function(){return n.ColorGradient}),i.d(t,"Color3Gradient",function(){return n.Color3Gradient}),i.d(t,"FactorGradient",function(){return n.FactorGradient}),i.d(t,"LoadFileError",function(){return n.LoadFileError}),i.d(t,"RetryStrategy",function(){return n.RetryStrategy}),i.d(t,"Tools",function(){return n.Tools}),i.d(t,"PerfCounter",function(){return n.PerfCounter}),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,"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,"WebXRController",function(){return n.WebXRController}),i.d(t,"WebXRInput",function(){return n.WebXRInput}),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,"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,"DynamicTexture",function(){return n.DynamicTexture}),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,"ProceduralTexture",function(){return n.ProceduralTexture}),i.d(t,"RawCubeTexture",function(){return n.RawCubeTexture}),i.d(t,"RawTexture3D",function(){return n.RawTexture3D}),i.d(t,"RefractionTexture",function(){return n.RefractionTexture}),i.d(t,"VideoTexture",function(){return n.VideoTexture}),i.d(t,"HtmlElementTexture",function(){return n.HtmlElementTexture}),i.d(t,"DracoCompression",function(){return n.DracoCompression}),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,"TorusBuilder",function(){return n.TorusBuilder}),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,"GroundBuilder",function(){return n.GroundBuilder}),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,"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,"CubeMapToSphericalPolynomialTools",function(){return n.CubeMapToSphericalPolynomialTools}),i.d(t,"HDRTools",function(){return n.HDRTools}),i.d(t,"PanoramaToCubeMapTools",function(){return n.PanoramaToCubeMapTools}),i.d(t,"_TGATextureLoader",function(){return n._TGATextureLoader}),i.d(t,"CustomProceduralTexture",function(){return n.CustomProceduralTexture}),i.d(t,"NoiseProceduralTexture",function(){return n.NoiseProceduralTexture}),i.d(t,"ProceduralTextureSceneComponent",function(){return n.ProceduralTextureSceneComponent}),i.d(t,"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});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 r)s.Debug[c]=r[c],a.push(c);for(var c in n)s[c]=n[c]}var l={AxesViewer:r.AxesViewer,BoneAxesViewer:r.BoneAxesViewer,PhysicsViewer:r.PhysicsViewer,SkeletonViewer:r.SkeletonViewer}}.call(this,i(119))}])});