1!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 n={},r.m=i=[function(e,t,i){"use strict";i.d(t,"d",function(){return c}),i.d(t,"e",function(){return p}),i.d(t,"f",function(){return l}),i.d(t,"b",function(){return f}),i.d(t,"a",function(){return u}),i.d(t,"c",function(){return h});var o=i(14),n=i(32),r=i(50),a=i(11),s=i(99),c=(y.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+"}"},y.prototype.getClassName=function(){return"Vector2"},y.prototype.getHashCode=function(){var e=0|this.x;return 397*e^(0|this.y)},y.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,this},y.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},y.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},y.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},y.prototype.set=function(e,t){return this.copyFromFloats(e,t)},y.prototype.add=function(e){return new y(this.x+e.x,this.y+e.y)},y.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,this},y.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},y.prototype.addVector3=function(e){return new y(this.x+e.x,this.y+e.y)},y.prototype.subtract=function(e){return new y(this.x-e.x,this.y-e.y)},y.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,this},y.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},y.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},y.prototype.multiply=function(e){return new y(this.x*e.x,this.y*e.y)},y.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,this},y.prototype.multiplyByFloats=function(e,t){return new y(this.x*e,this.y*t)},y.prototype.divide=function(e){return new y(this.x/e.x,this.y/e.y)},y.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,this},y.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},y.prototype.negate=function(){return new y(-this.x,-this.y)},y.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},y.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y)},y.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},y.prototype.scale=function(e){var t=new y(0,0);return this.scaleToRef(e,t),t},y.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,this},y.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,this},y.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},y.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=n.a),e&&o.a.WithinEpsilon(this.x,e.x,t)&&o.a.WithinEpsilon(this.y,e.y,t)},y.prototype.floor=function(){return new y(Math.floor(this.x),Math.floor(this.y))},y.prototype.fract=function(){return new y(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},y.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},y.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},y.prototype.normalize=function(){var e=this.length();return 0===e||(this.x/=e,this.y/=e),this},y.prototype.clone=function(){return new y(this.x,this.y)},y.Zero=function(){return new y(0,0)},y.One=function(){return new y(1,1)},y.FromArray=function(e,t){return void 0===t&&(t=0),new y(e[t],e[t+1])},y.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1]},y.CatmullRom=function(e,t,i,n,r){var o=r*r,a=r*o;return new y(.5*(2*t.x+(-e.x+i.x)*r+(2*e.x-5*t.x+4*i.x-n.x)*o+(-e.x+3*t.x-3*i.x+n.x)*a),.5*(2*t.y+(-e.y+i.y)*r+(2*e.y-5*t.y+4*i.y-n.y)*o+(-e.y+3*t.y-3*i.y+n.y)*a))},y.Clamp=function(e,t,i){var n=(n=(n=e.x)>i.x?i.x:n)<t.x?t.x:n,r=e.y;return new y(n,r=(r=r>i.y?i.y:r)<t.y?t.y:r)},y.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,c=-2*a+3*o,l=a-2*o+r,u=a-o;return new y(e.x*s+i.x*c+t.x*l+n.x*u,e.y*s+i.y*c+t.y*l+n.y*u)},y.Lerp=function(e,t,i){return new y(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},y.Dot=function(e,t){return e.x*t.x+e.y*t.y},y.Normalize=function(e){var t=e.clone();return t.normalize(),t},y.Minimize=function(e,t){return new y(e.x<t.x?e.x:t.x,e.y<t.y?e.y:t.y)},y.Maximize=function(e,t){return new y(e.x>t.x?e.x:t.x,e.y>t.y?e.y:t.y)},y.Transform=function(e,t){var i=y.Zero();return y.TransformToRef(e,t,i),i},y.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},y.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,a=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*o,s=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return 0<a&&0<s&&a+s<2*r*o},y.Distance=function(e,t){return Math.sqrt(y.DistanceSquared(e,t))},y.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},y.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},y.DistanceOfPointFromSegment=function(e,t,i){var n=y.DistanceSquared(t,i);if(0===n)return y.Distance(e,t);var r=i.subtract(t),o=Math.max(0,Math.min(1,y.Dot(e.subtract(t),r)/n)),a=t.add(r.multiplyByFloats(o,o));return y.Distance(e,a)},y),p=(Object.defineProperty(b.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0}
1,enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),b.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+"}"},b.prototype.getClassName=function(){return"Vector3"},b.prototype.getHashCode=function(){var e=0|this._x;return 397*(e=397*e^(0|this._y))^(0|this._z)},b.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},b.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},b.prototype.toQuaternion=function(){return f.RotationYawPitchRoll(this._y,this._x,this._z)},b.prototype.addInPlace=function(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)},b.prototype.addInPlaceFromFloats=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},b.prototype.add=function(e){return new b(this._x+e._x,this._y+e._y,this._z+e._z)},b.prototype.addToRef=function(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)},b.prototype.subtractInPlace=function(e){return this.x-=e._x,this.y-=e._y,this.z-=e._z,this},b.prototype.subtract=function(e){return new b(this._x-e._x,this._y-e._y,this._z-e._z)},b.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)},b.prototype.subtractFromFloats=function(e,t,i){return new b(this._x-e,this._y-t,this._z-i)},b.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(this._x-e,this._y-t,this._z-i)},b.prototype.negate=function(){return new b(-this._x,-this._y,-this._z)},b.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},b.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)},b.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},b.prototype.scale=function(e){return new b(this._x*e,this._y*e,this._z*e)},b.prototype.scaleToRef=function(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)},b.prototype.scaleAndAddToRef=function(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)},b.prototype.projectOnPlane=function(e,t){var i=b.Zero();return this.projectOnPlaneToRef(e,t,i),i},b.prototype.projectOnPlaneToRef=function(e,t,i){var n=e.normal,r=e.d,o=m.Vector3[0];this.subtractToRef(t,o),o.normalize();var a=b.Dot(o,n),s=-(b.Dot(t,n)+r)/a,c=o.scaleInPlace(s);t.addToRef(c,i)},b.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z},b.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=n.a),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)},b.prototype.equalsToFloats=function(e,t,i){return this._x===e&&this._y===t&&this._z===i},b.prototype.multiplyInPlace=function(e){return this.x*=e._x,this.y*=e._y,this.z*=e._z,this},b.prototype.multiply=function(e){return this.multiplyByFloats(e._x,e._y,e._z)},b.prototype.multiplyToRef=function(e,t){return t.copyFromFloats(this._x*e._x,this._y*e._y,this._z*e._z)},b.prototype.multiplyByFloats=function(e,t,i){return new b(this._x*e,this._y*t,this._z*i)},b.prototype.divide=function(e){return new b(this._x/e._x,this._y/e._y,this._z/e._z)},b.prototype.divideToRef=function(e,t){return t.copyFromFloats(this._x/e._x,this._y/e._y,this._z/e._z)},b.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},b.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)},b.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)},b.prototype.minimizeInPlaceFromFloats=function(e,t,i){return e<this._x&&(this.x=e),t<this._y&&(this.y=t),i<this._z&&(this.z=i),this},b.prototype.maximizeInPlaceFromFloats=function(e,t,i){return e>this._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this},b.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(b.prototype,"isNonUniform",{get:function(){var e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)}
1,enumerable:!1,configurable:!0}),b.prototype.floor=function(){return new b(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},b.prototype.fract=function(){return new b(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},b.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},b.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},b.prototype.normalize=function(){return this.normalizeFromLength(this.length())},b.prototype.reorderInPlace=function(i){var n=this;return"xyz"===(i=i.toLowerCase())||(m.Vector3[0].copyFrom(this),["x","y","z"].forEach(function(e,t){n[e]=m.Vector3[0][i[t]]})),this},b.prototype.rotateByQuaternionToRef=function(e,t){return e.toRotationMatrix(m.Matrix[0]),b.TransformCoordinatesToRef(this,m.Matrix[0],t),t},b.prototype.rotateByQuaternionAroundPointToRef=function(e,t,i){return this.subtractToRef(t,m.Vector3[0]),m.Vector3[0].rotateByQuaternionToRef(e,m.Vector3[0]),t.addToRef(m.Vector3[0],i),i},b.prototype.cross=function(e){return b.Cross(this,e)},b.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},b.prototype.normalizeToNew=function(){var e=new b(0,0,0);return this.normalizeToRef(e),e},b.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)},b.prototype.clone=function(){return new b(this._x,this._y,this._z)},b.prototype.copyFrom=function(e){return this.copyFromFloats(e._x,e._y,e._z)},b.prototype.copyFromFloats=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},b.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},b.prototype.setAll=function(e){return this.x=this.y=this.z=e,this},b.GetClipFactor=function(e,t,i,n){var r=b.Dot(e,i)-n;return r/(r-(b.Dot(t,i)-n))},b.GetAngleBetweenVectors=function(e,t,i){var n=e.normalizeToRef(m.Vector3[1]),r=t.normalizeToRef(m.Vector3[2]),o=b.Dot(n,r),a=m.Vector3[3];return b.CrossToRef(n,r,a),0<b.Dot(a,i)?Math.acos(o):-Math.acos(o)},b.FromArray=function(e,t){return void 0===t&&(t=0),new b(e[t],e[t+1],e[t+2])},b.FromFloatArray=function(e,t){return b.FromArray(e,t)},b.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]},b.FromFloatArrayToRef=function(e,t,i){return b.FromArrayToRef(e,t,i)},b.FromFloatsToRef=function(e,t,i,n){n.copyFromFloats(e,t,i)},b.Zero=function(){return new b(0,0,0)},b.One=function(){return new b(1,1,1)},b.Up=function(){return new b(0,1,0)},Object.defineProperty(b,"UpReadOnly",{get:function(){return b._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(b,"ZeroReadOnly",{get:function(){return b._ZeroReadOnly},enumerable:!1,configurable:!0}),b.Down=function(){return new b(0,-1,0)},b.Forward=function(e){return void 0===e&&(e=!1),new b(0,0,e?-1:1)},b.Backward=function(e){return void 0===e&&(e=!1),new b(0,0,e?1:-1)},b.Right=function(){return new b(1,0,0)},b.Left=function(){return new b(-1,0,0)},b.TransformCoordinates=function(e,t){var i=b.Zero();return b.TransformCoordinatesToRef(e,t,i),i},b.TransformCoordinatesToRef=function(e,t,i){b.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i)},b.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,a=e*o[0]+t*o[4]+i*o[8]+o[12],s=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=a*l,r.y=s*l,r.z=c*l},b.TransformNormal=function(e,t){var i=b.Zero();return b.TransformNormalToRef(e,t,i),i},b.TransformNormalToRef=function(e,t,i){this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i)},b.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]},b.CatmullRom=function(e,t,i,n,r){var o=r*r,a=r*o;return new b(.5*(2*t._x+(-e._x+i._x)*r+(2*e._x-5*t._x+4*i._x-n._x)*o+(-e._x+3*t._x-3*i._x+n._x)*a),.5*(2*t._y+(-e._y+i._y)*r+(2*e._y-5*t._y+4*i._y-n._y)*o+(-e._y+3*t._y-3*i._y+n._y)*a),.5*(2*t._z+(-e._z+i._z)*r+(2*e._z-5*t._z+4*i._z-n._z)*o+(-e._z+3*t._z-3*i._z+n._z)*a))},b.Clamp=function(e,t,i){var n=new b;return b.ClampToRef(e,t,i,n),n},b.ClampToRef=function(e,t,i,n){var r=(r=(r=e._x)>i._x?i._x:r)<t._x?t._x:r,o=(o=(o=e._y)>i._y?i._y:o)<t._y?t._y:o,a=(a=(a=e._z)>i._z?i._z:a)<t._z?t._z:a;n.copyFromFloats(r,o,a)},b.CheckExtends=function(e,t,i){t.minimizeInPlace(e),i.maximizeInPlace(e)},b.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,c=-2*a+3*o,l=a-2*o+r,u=a-o;return new b(e._x*s+i._x*c+t._x*l+n._x*u,e._y*s+i._y*c+t._y*l+n._y*u,e._z*s+i._z*c+t._z*l+n._z*u)},b.Lerp=function(e,t,i){var n=new b(0,0,0);return b.LerpToRef(e,t,i,n),n},b.LerpToRef=function(e,t,i,n){n.x=e._x+(t._x-e._x)*i,n.y=e._y+(t._y-e._y)*i,n.z=e._z+(t._z-e._z)*i},b.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z},b.Cross=function(e,t){var i=b.Zero();return b.CrossToRef(e,t,i),i},b.CrossToRef=function(e,t,i){var n=e._y*t._z-e._z*t._y,r=e._z*t._x-e._x*t._z,o=e._x*t._y-e._y*t._x;i.copyFromFloats(n,r,o)},b.Normalize=function(e){var t=b.Zero();return b.NormalizeToRef(e,t),t},b.NormalizeToRef=function(e,t){e.normalizeToRef(t)},b.Project=function(e,t,i,n){var r=n.width,o=n.height,a=n.x,s=n.y,c=m.Matrix[1];u.FromValuesToRef(r/2,0,0,0,0,-o/2,0,0,0,0,.5,0,a+r/2,o/2+s,.5,1,c);var l=m.Matrix[0];return t.multiplyToRef(i,l),l.multiplyToRef(c,l),b.TransformCoordinates(e,l)},b._UnprojectFromInvertedMatrixToRef=function(e,t,i){b.TransformCoordinatesToRef(e,t,i);var n=t.m,r=e._x*n[3]+e._y*n[7]+e._z*n[11]+n[15];o.a.WithinEpsilon(r,1)&&i.scaleInPlace(1/r)},b.UnprojectFromTransform=function(e,t,i,n,r){var o=m.Matrix[0];n.multiplyToRef(r,o),o.invert(),e.x=e._x/t*2-1,e.y=-(e._y/i*2-1);var a=new b;return b._UnprojectFromInvertedMatrixToRef(e,o,a),a},b.Unproject=function(e,t,i,n,r,o){var a=b.Zero();return b.UnprojectToRef(e,t,i,n,r,o,a),a},b.UnprojectToRef=function(e,t,i,n,r,o,a){b.UnprojectFloatsToRef(e._x,e._y,e._z,t,i,n,r,o,a)},b.UnprojectFloatsToRef=function(e,t,i,n,r,o,a,s,c){var l=m.Matrix[0];o.multiplyToRef(a,l),l.multiplyToRef(s,l),l.invert();var u=m.Vector3[0];u.x=e/n*2-1,u.y=-(t/r*2-1),u.z=2*i-1,b._UnprojectFromInvertedMatrixToRef(u,l,c)},b.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},b.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},b.Distance=function(e,t){return Math.sqrt(b.DistanceSquared(e,t))},b.DistanceSquared=function(e,t){var i=e._x-t._x,n=e._y-t._y,r=e._z-t._z;return i*i+n*n+r*r},b.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},b.RotationFromAxis=function(e,t,i){var n=b.Zero();return b.RotationFromAxisToRef(e,t,i,n),n},b.RotationFromAxisToRef=function(e,t,i,n){var r=m.Quaternion[0];f.RotationQuaternionFromAxisToRef(e,t,i,r),r.toEulerAnglesToRef(n)},b._UpReadOnly=b.Up(),b._ZeroReadOnly=b.Zero(),b),l=(v.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},v.prototype.getClassName=function(){return"Vector4"},v.prototype.getHashCode=function(){var e=0|this.x;return 397*(e=397*(e=397*e^(0|this.y))^(0|this.z))^(0|this.w)},v.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},v.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this},v.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},v.prototype.add=function(e){return new v(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},v.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,this},v.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.
1y,this.z-=e.z,this.w-=e.w,this},v.prototype.subtract=function(e){return new v(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},v.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,this},v.prototype.subtractFromFloats=function(e,t,i,n){return new v(this.x-e,this.y-t,this.z-i,this.w-n)},v.prototype.subtractFromFloatsToRef=function(e,t,i,n,r){return r.x=this.x-e,r.y=this.y-t,r.z=this.z-i,r.w=this.w-n,this},v.prototype.negate=function(){return new v(-this.x,-this.y,-this.z,-this.w)},v.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this},v.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y,-1*this.z,-1*this.w)},v.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},v.prototype.scale=function(e){return new v(this.x*e,this.y*e,this.z*e,this.w*e)},v.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},v.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},v.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},v.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=n.a),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)&&o.a.WithinEpsilon(this.w,e.w,t)},v.prototype.equalsToFloats=function(e,t,i,n){return this.x===e&&this.y===t&&this.z===i&&this.w===n},v.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},v.prototype.multiply=function(e){return new v(this.x*e.x,this.y*e.y,this.z*e.z,this.w*e.w)},v.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,this},v.prototype.multiplyByFloats=function(e,t,i,n){return new v(this.x*e,this.y*t,this.z*i,this.w*n)},v.prototype.divide=function(e){return new v(this.x/e.x,this.y/e.y,this.z/e.z,this.w/e.w)},v.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,this},v.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},v.prototype.minimizeInPlace=function(e){return e.x<this.x&&(this.x=e.x),e.y<this.y&&(this.y=e.y),e.z<this.z&&(this.z=e.z),e.w<this.w&&(this.w=e.w),this},v.prototype.maximizeInPlace=function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},v.prototype.floor=function(){return new v(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},v.prototype.fract=function(){return new v(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},v.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},v.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},v.prototype.normalize=function(){var e=this.length();return 0===e?this:this.scaleInPlace(1/e)},v.prototype.toVector3=function(){return new p(this.x,this.y,this.z)},v.prototype.clone=function(){return new v(this.x,this.y,this.z,this.w)},v.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},v.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},v.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},v.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},v.FromArray=function(e,t){return new v(e[t=t||0],e[t+1],e[t+2],e[t+3])},v.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},v.FromFloatArrayToRef=function(e,t,i){v.FromArrayToRef(e,t,i)},v.FromFloatsToRef=function(e,t,i,n,r){r.x=e,r.y=t,r.z=i,r.w=n},v.Zero=function(){return new v(0,0,0,0)},v.One=function(){return new v(1,1,1,1)},v.Normalize=function(e){var t=v.Zero();return v.NormalizeToRef(e,t),t},v.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},v.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},v.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},v.Distance=function(e,t){return Math.sqrt(v.DistanceSquared(e,t))},v.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},v.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},v.TransformNormal=function(e,t){var i=v.Zero();return v.TransformNormalToRef(e,t,i),i},v.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],a=e.x*n[2]+e.y*n[6]+e.z*n[10];i.x=r,i.y=o,i.z=a,i.w=e.w},v.TransformNormalFromFloatsToRef=function(e,t,i,n,r,o){var a=r.m;o.x=e*a[0]+t*a[4]+i*a[8],o.y=e*a[1]+t*a[5]+i*a[9],o.z=e*a[2]+t*a[6]+i*a[10],o.w=n},v.FromVector3=function(e,t){return void 0===t&&(t=0),new v(e._x,e._y,e._z,t)},v),f=(Object.defineProperty(g.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0}
1,enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._isDirty=!0},enumerable:!1,configurable:!0}),g.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+" W:"+this._w+"}"},g.prototype.getClassName=function(){return"Quaternion"},g.prototype.getHashCode=function(){var e=0|this._x;return 397*(e=397*(e=397*e^(0|this._y))^(0|this._z))^(0|this._w)},g.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},g.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w},g.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=n.a),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)&&o.a.WithinEpsilon(this._w,e._w,t)},g.prototype.clone=function(){return new g(this._x,this._y,this._z,this._w)},g.prototype.copyFrom=function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this.w=e._w,this},g.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},g.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},g.prototype.add=function(e){return new g(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)},g.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this},g.prototype.subtract=function(e){return new g(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)},g.prototype.scale=function(e){return new g(this._x*e,this._y*e,this._z*e,this._w*e)},g.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},g.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},g.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},g.prototype.multiply=function(e){var t=new g(0,0,0,1);return this.multiplyToRef(e,t),t},g.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},g.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},g.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),this},g.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},g.prototype.conjugate=function(){return new g(-this._x,-this._y,-this._z,this._w)},g.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},g.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},g.prototype.toEulerAngles=function(e){void 0===e&&(e="YZX");var t=p.Zero();return this.toEulerAnglesToRef(t),t},g.prototype.toEulerAnglesToRef=function(e){var t=this._z,i=this._x,n=this._y,r=this._w,o=r*r,a=t*t,s=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):.4999999<l?(e.y=2*Math.atan2(n,r),e.x=-Math.PI/2,e.z=0):(e.z=Math.atan2(2*(i*n+t*r),-a-s+c+o),e.x=Math.asin(-2*(t*n-i*r)),e.y=Math.atan2(2*(t*i+n*r),a-s-c+o)),this},g.prototype.toRotationMatrix=function(e){return u.FromQuaternionToRef(this,e),this},g.prototype.fromRotationMatrix=function(e){return g.FromRotationMatrixToRef(e,this),this},g.FromRotationMatrix=function(e){var t=new g;return g.FromRotationMatrixToRef(e,t),t},g.FromRotationMatrixToRef=function(e,t){var i,n=e.m,r=n[0],o=n[4],a=n[8],s=n[1],c=n[5],l=n[9],u=n[2],h=n[6],d=n[10],p=r+c+d;0<p?(i=.5/Math.sqrt(p+1),t.w=.25/i,t.x=(h-l)*i,t.y=(a-u)*i,t.z=(s-o)*i):c<r&&d<r?(i=2*Math.sqrt(1+r-c-d),t.w=(h-l)/i,t.x=.25*i,t.y=(o+s)/i,t.z=(a+u)/i):d<c?(i=2*Math.sqrt(1+c-r-d),t.w=(a-u)/i,t.x=(o+s)/i,t.y=.25*i,t.z=(l+h)/i):(i=2*Math.sqrt(1+d-r-c),t.w=(s-o)/i,t.x=(a+u)/i,t.y=(l+h)/i,t.z=.25*i)},g.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}
1,g.AreClose=function(e,t){return 0<=g.Dot(e,t)},g.Zero=function(){return new g(0,0,0,0)},g.Inverse=function(e){return new g(-e._x,-e._y,-e._z,e._w)},g.InverseToRef=function(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t},g.Identity=function(){return new g(0,0,0,1)},g.IsIdentity=function(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w},g.RotationAxis=function(e,t){return g.RotationAxisToRef(e,t,new g)},g.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},g.FromArray=function(e,t){return new g(e[t=t||0],e[t+1],e[t+2],e[t+3])},g.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},g.FromEulerAngles=function(e,t,i){var n=new g;return g.RotationYawPitchRollToRef(t,e,i,n),n},g.FromEulerAnglesToRef=function(e,t,i,n){return g.RotationYawPitchRollToRef(t,e,i,n),n},g.FromEulerVector=function(e){var t=new g;return g.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t},g.FromEulerVectorToRef=function(e,t){return g.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t},g.RotationYawPitchRoll=function(e,t,i){var n=new g;return g.RotationYawPitchRollToRef(e,t,i,n),n},g.RotationYawPitchRollToRef=function(e,t,i,n){var r=.5*i,o=.5*t,a=.5*e,s=Math.sin(r),c=Math.cos(r),l=Math.sin(o),u=Math.cos(o),h=Math.sin(a),d=Math.cos(a);n.x=d*l*c+h*u*s,n.y=h*u*c-d*l*s,n.z=d*u*s-h*l*c,n.w=d*u*c+h*l*s},g.RotationAlphaBetaGamma=function(e,t,i){var n=new g;return g.RotationAlphaBetaGammaToRef(e,t,i,n),n},g.RotationAlphaBetaGammaToRef=function(e,t,i,n){var r=.5*(i+e),o=.5*(i-e),a=.5*t;n.x=Math.cos(o)*Math.sin(a),n.y=Math.sin(o)*Math.sin(a),n.z=Math.sin(r)*Math.cos(a),n.w=Math.cos(r)*Math.cos(a)},g.RotationQuaternionFromAxis=function(e,t,i){var n=new g(0,0,0,0);return g.RotationQuaternionFromAxisToRef(e,t,i,n),n},g.RotationQuaternionFromAxisToRef=function(e,t,i,n){var r=m.Matrix[0];u.FromXYZAxesToRef(e.normalize(),t.normalize(),i.normalize(),r),g.FromRotationMatrixToRef(r,n)},g.Slerp=function(e,t,i){var n=g.Identity();return g.SlerpToRef(e,t,i,n),n},g.SlerpToRef=function(e,t,i,n){var r,o,a,s,c=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,l=!1;c<0&&(l=!0,c=-c),s=.999999<c?(a=1-i,l?-i:i):(r=Math.acos(c),o=1/Math.sin(r),a=Math.sin((1-i)*r)*o,l?-Math.sin(i*r)*o:Math.sin(i*r)*o),n.x=a*e._x+s*t._x,n.y=a*e._y+s*t._y,n.z=a*e._z+s*t._z,n.w=a*e._w+s*t._w},g.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,c=-2*a+3*o,l=a-2*o+r,u=a-o;return new g(e._x*s+i._x*c+t._x*l+n._x*u,e._y*s+i._y*c+t._y*l+n._y*u,e._z*s+i._z*c+t._z*l+n._z*u,e._w*s+i._w*c+t._w*l+n._w*u)},g),u=(Object.defineProperty(z,"Use64Bits",{get:function(){return s.a.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),z.prototype._markAsUpdated=function(){this.updateFlag=z._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},z.prototype._updateIdentityStatus=function(e,t,i,n){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!0),this.updateFlag=z._updateFlagSeed++,this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&n},z.prototype.isIdentity=function(){var e;return this._isIdentityDirty&&(this._isIdentityDirty=!1,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]),this._isIdentity},z.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||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},z.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],a=e[5],s=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],_=e[15],g=h*_-m*d,v=u*_-f*d,b=u*m-f*h,y=l*_-p*d,T=l*m-h*p,E=l*f-p*u;return t*(a*g-s*v+c*b)+i*-(o*g-s*y+c*T)+n*(o*v-a*y+c*E)+r*-(o*b-a*T+s*E)},z.prototype.toArray=function(){return this._m},z.prototype.asArray=function(){return this._m},z.prototype.invert=function(){return this.invertToRef(this),this},z.prototype.reset=function(){return z.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},z.prototype.add=function(e){var t=new z;return this.addToRef(e,t),t},z.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},z.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},z.prototype.invertToRef=function(e){if(!0===this._isIdentity)return z.IdentityToRef(e),this;var t=this._m,i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],h=t[9],d=t[10
1],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],v=d*g-_*p,b=h*g-m*p,y=h*_-m*d,T=u*g-f*p,E=u*_-d*f,S=u*m-f*h,A=+(s*v-c*b+l*y),C=-(a*v-c*T+l*E),P=+(a*b-s*T+l*S),x=-(a*y-s*E+c*S),R=i*A+n*C+r*P+o*x;if(0==R)return e.copyFrom(this),this;var O=1/R,M=c*g-_*l,I=s*g-m*l,D=s*_-m*c,L=a*g-f*l,N=a*_-f*c,F=a*m-f*s,w=c*p-d*l,B=s*p-h*l,U=s*d-h*c,V=a*p-u*l,k=a*d-u*c,G=a*h-u*s;return z.FromValuesToRef(A*O,-(n*v-r*b+o*y)*O,(n*M-r*I+o*D)*O,-(n*w-r*B+o*U)*O,C*O,(i*v-r*T+o*E)*O,-(i*M-r*L+o*N)*O,(i*w-r*V+o*k)*O,P*O,-(i*b-n*T+o*S)*O,(i*I-n*L+o*F)*O,-(i*B-n*V+o*G)*O,x*O,(i*y-n*E+r*S)*O,-(i*D-n*N+r*F)*O,(i*U-n*k+r*G)*O,e),this},z.prototype.addAtIndex=function(e,t){return this._m[e]+=t,this._markAsUpdated(),this},z.prototype.multiplyAtIndex=function(e,t){return this._m[e]*=t,this._markAsUpdated(),this},z.prototype.setTranslationFromFloats=function(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this._markAsUpdated(),this},z.prototype.addTranslationFromFloats=function(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this._markAsUpdated(),this},z.prototype.setTranslation=function(e){return this.setTranslationFromFloats(e._x,e._y,e._z)},z.prototype.getTranslation=function(){return new p(this._m[12],this._m[13],this._m[14])},z.prototype.getTranslationToRef=function(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],this},z.prototype.removeRotationAndScaling=function(){var e=this.m;return z.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]),this},z.prototype.multiply=function(e){var t=new z;return this.multiplyToRef(e,t),t},z.prototype.copyFrom=function(e){return e.copyToArray(this._m),this._updateIdentityStatus(e._isIdentity,e._isIdentityDirty,e._isIdentity3x2,e._isIdentity3x2Dirty),this},z.prototype.copyToArray=function(e,t){void 0===t&&(t=0);var i=this._m;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this},z.prototype.multiplyToRef=function(e,t){return this._isIdentity?t.copyFrom(e):e._isIdentity?t.copyFrom(this):(this.multiplyToArray(e,t._m,0),t._markAsUpdated()),this},z.prototype.multiplyToArray=function(e,t,i){var n=this._m,r=e.m,o=n[0],a=n[1],s=n[2],c=n[3],l=n[4],u=n[5],h=n[6],d=n[7],p=n[8],f=n[9],m=n[10],_=n[11],g=n[12],v=n[13],b=n[14],y=n[15],T=r[0],E=r[1],S=r[2],A=r[3],C=r[4],P=r[5],x=r[6],R=r[7],O=r[8],M=r[9],I=r[10],D=r[11],L=r[12],N=r[13],F=r[14],w=r[15];return t[i]=o*T+a*C+s*O+c*L,t[i+1]=o*E+a*P+s*M+c*N,t[i+2]=o*S+a*x+s*I+c*F,t[i+3]=o*A+a*R+s*D+c*w,t[i+4]=l*T+u*C+h*O+d*L,t[i+5]=l*E+u*P+h*M+d*N,t[i+6]=l*S+u*x+h*I+d*F,t[i+7]=l*A+u*R+h*D+d*w,t[i+8]=p*T+f*C+m*O+_*L,t[i+9]=p*E+f*P+m*M+_*N,t[i+10]=p*S+f*x+m*I+_*F,t[i+11]=p*A+f*R+m*D+_*w,t[i+12]=g*T+v*C+b*O+y*L,t[i+13]=g*E+v*P+b*M+y*N,t[i+14]=g*S+v*x+b*I+y*F,t[i+15]=g*A+v*R+b*D+y*w,this},z.prototype.equals=function(e){if(!e)return!1;if((this._isIdentity||e._isIdentity)&&!this._isIdentityDirty&&!e._isIdentityDirty)return this._isIdentity&&e._isIdentity;var t=this.m,i=e.m;return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]&&t[4]===i[4]&&t[5]===i[5]&&t[6]===i[6]&&t[7]===i[7]&&t[8]===i[8]&&t[9]===i[9]&&t[10]===i[10]&&t[11]===i[11]&&t[12]===i[12]&&t[13]===i[13]&&t[14]===i[14]&&t[15]===i[15]},z.prototype.clone=function(){var e=new z;return e.copyFrom(this),e},z.prototype.getClassName=function(){return"Matrix"},z.prototype.getHashCode=function(){for(var e=0|this._m[0],t=1;t<16;t++)e=397*e^(0|this._m[t]);return e},z.prototype.decompose=function(e,t,i){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;var n,r,o,a=this._m;return i&&i.copyFromFloats(a[12],a[13],a[14]),(e=e||m.Vector3[0]).x=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]),e.y=Math.sqrt(a[4]*a[4]+a[5]*a[5]+a[6]*a[6]),e.z=Math.sqrt(a[8]*a[8]+a[9]*a[9]+a[10]*a[10]),this.determinant()<=0&&(e.y*=-1),0===e._x||0===e._y||0===e._z?(t&&t.copyFromFloats(0,0,0,1),!1):(t&&(n=1/e._x,r=1/e._y,o=1/e._z,z.FromValuesToRef(a[0]*n,a[1]*n,a[2]*n,0,a[4]*r,a[5]*r,a[6]*r,0,a[8]*o,a[9]*o,a[10]*o,0,0,0,0,1,m.Matrix[0]),f.FromRotationMatrixToRef(m.Matrix[0],t)),!0)},z.prototype.getRow=function(e){if(e<0||3<e)return null;var t=4*e;return new l(this._m[0+t],this._m[1+t],this._m[2+t],this._m[3+t])},z.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},z.prototype.transpose=function(){return z.Transpose(this)},z.prototype.transposeToRef=function(e){return z.TransposeToRef(this,e),this},z.prototype.setRowFromFloats=function(e,t,i,n,r){if(e<0||3<e)return this;var o=4*e;return this._m[0+o]=t,this._m[1+o]=i,this._m[2+o]=n,this._m[3+o]=r,this._markAsUpdated(),this},z.prototype.scale=function(e){var t=new z;return this.scaleToRef(e,t),t},z.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]=this._m[i]*e;return t._markAsUpdated(),this},z.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t._markAsUpdated(),this},z.prototype.toNormalMatrix=function(e){var t=m.Matrix[0];this.invertToRef(t),t.transposeToRef(e);var i=e._m;z.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,e)},z.prototype.getRotationMatrix=function(){var e=new z;return this.getRotationMatrixToRef(e),e},z.prototype.getRotationMatrixToRef=function(e){var t=m.Vector3[0];if(!this.decompose(t))return z.IdentityToRef(e),this;var i=this._m,n=1/t._x,r=1/t._y,o=1/t._z;return z.FromValuesToRef(i[0]*n,i[1]*n,i[2]*n,0,i[4]*r,i[5]*r,i[6]*r,0,i[8]*o,i[9]*o,i[10]*o,0,0,0,0,1,e),this},z.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this._markAsUpdated()},z.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;
1e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this._markAsUpdated()},z.FromArray=function(e,t){void 0===t&&(t=0);var i=new z;return z.FromArrayToRef(e,t,i),i},z.FromArrayToRef=function(e,t,i){for(var n=0;n<16;n++)i._m[n]=e[n+t];i._markAsUpdated()},z.FromFloat32ArrayToRefScaled=function(e,t,i,n){for(var r=0;r<16;r++)n._m[r]=e[r+t]*i;n._markAsUpdated()},Object.defineProperty(z,"IdentityReadOnly",{get:function(){return z._identityReadOnly},enumerable:!1,configurable:!0}),z.FromValuesToRef=function(e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m,_){var g=_._m;g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=o,g[6]=a,g[7]=s,g[8]=c,g[9]=l,g[10]=u,g[11]=h,g[12]=d,g[13]=p,g[14]=f,g[15]=m,_._markAsUpdated()},z.FromValues=function(e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m){var _=new z,g=_._m;return g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=o,g[6]=a,g[7]=s,g[8]=c,g[9]=l,g[10]=u,g[11]=h,g[12]=d,g[13]=p,g[14]=f,g[15]=m,_._markAsUpdated(),_},z.Compose=function(e,t,i){var n=new z;return z.ComposeToRef(e,t,i,n),n},z.ComposeToRef=function(e,t,i,n){var r=n._m,o=t._x,a=t._y,s=t._z,c=t._w,l=o+o,u=a+a,h=s+s,d=o*l,p=o*u,f=o*h,m=a*u,_=a*h,g=s*h,v=c*l,b=c*u,y=c*h,T=e._x,E=e._y,S=e._z;r[0]=(1-(m+g))*T,r[1]=(p+y)*T,r[2]=(f-b)*T,r[3]=0,r[4]=(p-y)*E,r[5]=(1-(d+g))*E,r[6]=(_+v)*E,r[7]=0,r[8]=(f+b)*S,r[9]=(_-v)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,n._markAsUpdated()},z.Identity=function(){var e=z.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e},z.IdentityToRef=function(e){z.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0)},z.Zero=function(){var e=z.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e},z.RotationX=function(e){var t=new z;return z.RotationXToRef(e,t),t},z.Invert=function(e){var t=new z;return e.invertToRef(t),t},z.RotationXToRef=function(e,t){var i=Math.sin(e),n=Math.cos(e);z.FromValuesToRef(1,0,0,0,0,n,i,0,0,-i,n,0,0,0,0,1,t),t._updateIdentityStatus(1===n&&0===i)},z.RotationY=function(e){var t=new z;return z.RotationYToRef(e,t),t},z.RotationYToRef=function(e,t){var i=Math.sin(e),n=Math.cos(e);z.FromValuesToRef(n,0,-i,0,0,1,0,0,i,0,n,0,0,0,0,1,t),t._updateIdentityStatus(1===n&&0===i)},z.RotationZ=function(e){var t=new z;return z.RotationZToRef(e,t),t},z.RotationZToRef=function(e,t){var i=Math.sin(e),n=Math.cos(e);z.FromValuesToRef(n,i,0,0,-i,n,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(1===n&&0===i)},z.RotationAxis=function(e,t){var i=new z;return z.RotationAxisToRef(e,t,i),i},z.RotationAxisToRef=function(e,t,i){var n=Math.sin(-t),r=Math.cos(-t),o=1-r;e.normalize();var a=i._m;a[0]=e._x*e._x*o+r,a[1]=e._x*e._y*o-e._z*n,a[2]=e._x*e._z*o+e._y*n,a[3]=0,a[4]=e._y*e._x*o+e._z*n,a[5]=e._y*e._y*o+r,a[6]=e._y*e._z*o-e._x*n,a[7]=0,a[8]=e._z*e._x*o-e._y*n,a[9]=e._z*e._y*o+e._x*n,a[10]=e._z*e._z*o+r,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,i._markAsUpdated()},z.RotationAlignToRef=function(e,t,i){var n=p.Cross(t,e),r=p.Dot(t,e),o=1/(1+r),a=i._m;a[0]=n._x*n._x*o+r,a[1]=n._y*n._x*o-n._z,a[2]=n._z*n._x*o+n._y,a[3]=0,a[4]=n._x*n._y*o+n._z,a[5]=n._y*n._y*o+r,a[6]=n._z*n._y*o-n._x,a[7]=0,a[8]=n._x*n._z*o-n._y,a[9]=n._y*n._z*o+n._x,a[10]=n._z*n._z*o+r,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,i._markAsUpdated()},z.RotationYawPitchRoll=function(e,t,i){var n=new z;return z.RotationYawPitchRollToRef(e,t,i,n),n},z.RotationYawPitchRollToRef=function(e,t,i,n){f.RotationYawPitchRollToRef(e,t,i,m.Quaternion[0]),m.Quaternion[0].toRotationMatrix(n)},z.Scaling=function(e,t,i){var n=new z;return z.ScalingToRef(e,t,i,n),n},z.ScalingToRef=function(e,t,i,n){z.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,n),n._updateIdentityStatus(1===e&&1===t&&1===i)},z.Translation=function(e,t,i){var n=new z;return z.TranslationToRef(e,t,i,n),n},z.TranslationToRef=function(e,t,i,n){z.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,n),n._updateIdentityStatus(0===e&&0===t&&0===i)},z.Lerp=function(e,t,i){var n=new z;return z.LerpToRef(e,t,i,n),n},z.LerpToRef=function(e,t,i,n){for(var r=n._m,o=e.m,a=t.m,s=0;s<16;s++)r[s]=o[s]*(1-i)+a[s]*i;n._markAsUpdated()},z.DecomposeLerp=function(e,t,i){var n=new z;return z.DecomposeLerpToRef(e,t,i,n),n},z.DecomposeLerpToRef=function(e,t,i,n){var r=m.Vector3[0],o=m.Quaternion[0],a=m.Vector3[1];e.decompose(r,o,a);var s=m.Vector3[2],c=m.Quaternion[1],l=m.Vector3[3];t.decompose(s,c,l);var u=m.Vector3[4];p.LerpToRef(r,s,i,u);var h=m.Quaternion[2];f.SlerpToRef(o,c,i,h);var d=m.Vector3[5];p.LerpToRef(a,l,i,d),z.ComposeToRef(u,h,d,n)},z.LookAtLH=function(e,t,i){var n=new z;return z.LookAtLHToRef(e,t,i,n),n},z.LookAtLHToRef=function(e,t,i,n){var r=m.Vector3[0],o=m.Vector3[1],a=m.Vector3[2];t.subtractToRef(e,a),a.normalize(),p.CrossToRef(i,a,r);var s=r.lengthSquared();0===s?r.x=1:r.normalizeFromLength(Math.sqrt(s)),p.CrossToRef(a,r,o),o.normalize();var c=-p.Dot(r,e),l=-p.Dot(o,e),u=-p.Dot(a,e);z.FromValuesToRef(r._x,o._x,a._x,0,r._y,o._y,a._y,0,r._z,o._z,a._z,0,c,l,u,1,n)},z.LookAtRH=function(e,t,i){var n=new z;return z.LookAtRHToRef(e,t,i,n),n},z.LookAtRHToRef=function(e,t,i,n){var r=m.Vector3[0],o=m.Vector3[1],a=m.Vector3[2];e.subtractToRef(t,a),a.normalize(),p.CrossToRef(i,a,r);var s=r.lengthSquared();0===s?r.x=1:r.normalizeFromLength(Math.sqrt(s)),p.CrossToRef(a,r,o),o.normalize();var c=-p.Dot(r,e),l=-p.Dot(o,e),u=-p.Dot(a,e);z.FromValuesToRef(r._x,o._x,a._x,0,r._y,o._y,a._y,0,r._z,o._z,a._z,0,c,l,u,1,n)},z.OrthoLH=function(e,t,i,n){var r=new z;return z.OrthoLHToRef(e,t,i,n,r),r},z.OrthoLHToRef=function(e,t,i,n,r){var o=2/e,a=2/t,s=2/(n-i),c=-(n+i)/(n-i);z.FromValuesToRef(o,0,0,0,0,a,0,0,0,0,s,0,0,0,c,1,r),r._updateIdentityStatus(1==o&&1==a&&1==s&&0==c)},z.OrthoOffCenterLH=function(e,t,i,n,r,o){var a=new z;return z.OrthoOffCenterLHToRef(e,t,i,n,r,o,a),a},z.OrthoOffCenterLHToRef=function(e,t,i,n,r,o,a){z.FromValuesToRef(2/(t-e),0,0,0,0,2/(n-i),0,0,0,0,2/(o-r),0,(e+t)/(e-t),(n+i)/(i-n),-(o+r)/(o-r),1,a),a._markAsUpdated()},z.OrthoOffCenterRH=function(e,t,i,n,r,o){var a=new z;return z.OrthoOffCenterRHToRef(e,t,i,n,r,o,a),a},z.OrthoOffCenterRHToRef=function(e,t,i,n,r,o,a){z.OrthoOffCenterLHToRef(e,t,i,n,r,o,a),a._m[10]*=-1},z.PerspectiveLH=function(e,t,i,n){var r=new z;return z.FromValuesToRef(2*i/e,0,0,0,0,2*i/t,0,0,0,0,(n+i)/(n-i),1,0,0,-2*n*i/(n-i),0,r),r._updateIdentityStatus(!1),r},z.PerspectiveFovLH=function(e,t,i,n){var r=new z;return z.PerspectiveFovLHToRef(e,t,i,n,r),r},z.PerspectiveFovLHToRef=function(e,t,i,n,r,o){void 0===o&&(o=!0);var a=i,s=n,c=1/Math.tan(.5*e);z.FromValuesToRef(o?c/t:c,0,0,0,0,o?c:c*t,0,0,0,0,(s+a)/(s-a),1,0,0,-2*s*a/(s-a),0,r),r._updateIdentityStatus(!1)},z.PerspectiveFovReverseLHToRef=function(e,t,i,n,r,o){void 0===o&&(o=!0);var a=1/Math.tan(.5*e);z.FromValuesToRef(o?a/t:a,0,0,0,0,o?a:a*t,0,0,0,0,-i,1,0,0,1,0,r),r._updateIdentityStatus(!1)},z.PerspectiveFovRH=function(e,t,i,n){var r=new z;return z.PerspectiveFovRHToRef(e,t,i,n,r),r},z.PerspectiveFovRHToRef=function(e,t,i,n,r,o){void 0===o&&(o=!0);var a=i,s=n,c=1/Math.tan(.5*e);z.FromValuesToRef(o?c/t:c,0,0,0,0,o?c:c*t,0,0,0,0,-(s+a)/(s-a),-1,0,0,-2*s*a/(s-a),0,r),r._updateIdentityStatus(!1)},z.PerspectiveFovReverseRHToRef=function(e,t,i,n,r,o){void 0===o&&(o=!0);var a=1/Math.tan(.5*e);z.FromValuesToRef(o?a/t:a,0,0,0,0,o?a:a*t,0,0,0,0,-i,-1,0,0,-1,0,r),r._updateIdentityStatus(!1)},z.PerspectiveFovWebVRToRef=function(e,t,i,n,r){void 0===r&&(r=!1);var o=r?-1:1,a=Math.tan(e.upDegrees*Math.PI/180),s=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/(a+s),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]=-(a-s)*h*.5,d[10]=-i/(t-i),d[11]=o,d[12]=d[13]=d[15]=0,d[14]=-2*i*t/(i-t),n._markAsUpdated()}
1,z.GetFinalMatrix=function(e,t,i,n,r,o){var a=e.width,s=e.height,c=e.x,l=e.y,u=z.FromValues(a/2,0,0,0,0,-s/2,0,0,0,0,o-r,0,c+a/2,s/2+l,r,1),h=m.Matrix[0];return t.multiplyToRef(i,h),h.multiplyToRef(n,h),h.multiply(u)},z.GetAsMatrix2x2=function(e){var t=e.m,i=[t[0],t[1],t[4],t[5]];return s.a.MatrixUse64Bits?i:new Float32Array(i)},z.GetAsMatrix3x3=function(e){var t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return s.a.MatrixUse64Bits?i:new Float32Array(i)},z.Transpose=function(e){var t=new z;return z.TransposeToRef(e,t),t},z.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)},z.Reflection=function(e){var t=new z;return z.ReflectionToRef(e,t),t},z.ReflectionToRef=function(e,t){e.normalize();var i=e.normal.x,n=e.normal.y,r=e.normal.z,o=-2*i,a=-2*n,s=-2*r;z.FromValuesToRef(o*i+1,a*i,s*i,0,o*n,a*n+1,s*n,0,o*r,a*r,s*r+1,0,o*e.d,a*e.d,s*e.d,1,t)},z.FromXYZAxesToRef=function(e,t,i,n){z.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,n)},z.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,a=e._z*e._w,s=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+a),t._m[2]=2*(s-c),t._m[3]=0,t._m[4]=2*(o-a),t._m[5]=1-2*(r+i),t._m[6]=2*(l+u),t._m[7]=0,t._m[8]=2*(s+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()},z._updateFlagSeed=0,z._identityReadOnly=z.Identity(),z),m=(_.Vector3=r.a.BuildArray(6,p.Zero),_.Matrix=r.a.BuildArray(2,u.Identity),_.Quaternion=r.a.BuildArray(3,f.Zero),_),h=(d.Vector2=r.a.BuildArray(3,c.Zero),d.Vector3=r.a.BuildArray(13,p.Zero),d.Vector4=r.a.BuildArray(3,l.Zero),d.Quaternion=r.a.BuildArray(2,f.Zero),d.Matrix=r.a.BuildArray(8,u.Identity),d);function d(){}function _(){}function z(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,s.a.MatrixTrackPrecisionChange&&s.a.MatrixTrackedMatrices.push(this),this._m=new s.a.MatrixCurrentType(16),this._updateIdentityStatus(!1)}function g(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._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=n}function v(e,t,i,n){this.x=e,this.y=t,this.z=i,this.w=n}function b(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this._isDirty=!0,this._x=e,this._y=t,this._z=i}function y(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}a.a.RegisteredTypes["BABYLON.Vector2"]=c,a.a.RegisteredTypes["BABYLON.Vector3"]=p,a.a.RegisteredTypes["BABYLON.Vector4"]=l,a.a.RegisteredTypes["BABYLON.Matrix"]=u},function(e,t,i){"use strict";i.d(t,"d",function(){return r}),i.d(t,"a",function(){return o}),i.d(t,"c",function(){return a}),i.d(t,"b",function(){return s}),i.d(t,"e",function(){return c});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var o=function(){return(o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function a(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a}function s(e,a,s,c){return new(s=s||Promise)(function(i,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function r(e){try{o(c.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?i(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,r)}o((c=c.apply(e,a||[])).next())})}function c(i,n){var r,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!((a=0<(a=s.trys).length&&a[a.length-1])||6!==t[0]&&2!==t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(i,s)}catch(e){t=[6,e],o=0}finally{r=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}Object.create,Object.create},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.ALPHA_DISABLE=0,r.ALPHA_ADD=1,r.ALPHA_COMBINE=2,r.ALPHA_SUBTRACT=3,r.ALPHA_MULTIPLY=4,r.ALPHA_MAXIMIZED=5,r.ALPHA_ONEONE=6,r.ALPHA_PREMULTIPLIED=7,r.ALPHA_PREMULTIPLIED_PORTERDUFF=8,r.ALPHA_INTERPOLATE=9,r.ALPHA_SCREENMODE=10,r.ALPHA_ONEONE_ONEONE=11,r.ALPHA_ALPHATOCOLOR=12,r.ALPHA_REVERSEONEMINUS=13,r.ALPHA_SRC_DSTONEMINUSSRCALPHA=14,r.ALPHA_ONEONE_ONEZERO=15,r.ALPHA_EXCLUSION=16,r.ALPHA_EQUATION_ADD=0,r.ALPHA_EQUATION_SUBSTRACT=1,r.ALPHA_EQUATION_REVERSE_SUBTRACT=2,r.ALPHA_EQUATION_MAX=3,r.ALPHA_EQUATION_MIN=4,r.ALPHA_EQUATION_DARKEN=5,r.DELAYLOADSTATE_NONE=0,r.DELAYLOADSTATE_LOADED=1,r.DELAYLOADSTATE_LOADING=2,r.DELAYLOADSTATE_NOTLOADED=4,r.NEVER=512,r.ALWAYS=519,r.LESS=513,r.EQUAL=514,r.LEQUAL=515,r.GREATER=516,r.GEQUAL=518,r.NOTEQUAL=517,r.KEEP=7680,r.REPLACE=7681,r.INCR=7682,r.DECR=7683,r.INVERT=5386,r.INCR_WRAP=34055,r.DECR_WRAP=34056,r.TEXTURE_CLAMP_ADDRESSMODE=0,r.TEXTURE_WRAP_ADDRESSMODE=1,r.TEXTURE_MIRROR_ADDRESSMODE=2,r.TEXTUREFORMAT_ALPHA=0,r.TEXTUREFORMAT_LUMINANCE=1,r.TEXTUREFORMAT_LUMINANCE_ALPHA=2,r.TEXTUREFORMAT_RGB=4,r.TEXTUREFORMAT_RGBA=5,r.TEXTUREFORMAT_RED=6,r.TEXTUREFORMAT_R=6,r.TEXTUREFORMAT_RG=7,r.TEXTUREFORMAT_RED_INTEGER=8,r.TEXTUREFORMAT_R_INTEGER=8,r.TEXTUREFORMAT_RG_INTEGER=9,r.TEXTUREFORMAT_RGB_INTEGER=10,r.TEXTUREFORMAT_RGBA_INTEGER=11,r.TEXTURETYPE_UNSIGNED_BYTE=0,r.TEXTURETYPE_UNSIGNED_INT=0,r.TEXTURETYPE_FLOAT=1,r.TEXTURETYPE_HALF_FLOAT=2,r.TEXTURETYPE_BYTE=3,r.TEXTURETYPE_SHORT=4,r.TEXTURETYPE_UNSIGNED_SHORT=5,r.TEXTURETYPE_INT=6,r.TEXTURETYPE_UNSIGNED_INTEGER=7,r.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,r.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,r.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,r.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,r.TEXTURETYPE_UNSIGNED_INT_24_8=12,r.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,r.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,r.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,r.TEXTURE_NEAREST_SAMPL
1INGMODE=1,r.TEXTURE_NEAREST_NEAREST=1,r.TEXTURE_BILINEAR_SAMPLINGMODE=2,r.TEXTURE_LINEAR_LINEAR=2,r.TEXTURE_TRILINEAR_SAMPLINGMODE=3,r.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,r.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,r.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,r.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,r.TEXTURE_NEAREST_LINEAR=7,r.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,r.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,r.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,r.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,r.TEXTURE_LINEAR_NEAREST=12,r.TEXTURE_EXPLICIT_MODE=0,r.TEXTURE_SPHERICAL_MODE=1,r.TEXTURE_PLANAR_MODE=2,r.TEXTURE_CUBIC_MODE=3,r.TEXTURE_PROJECTION_MODE=4,r.TEXTURE_SKYBOX_MODE=5,r.TEXTURE_INVCUBIC_MODE=6,r.TEXTURE_EQUIRECTANGULAR_MODE=7,r.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,r.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,r.TEXTURE_FILTERING_QUALITY_OFFLINE=4096,r.TEXTURE_FILTERING_QUALITY_HIGH=64,r.TEXTURE_FILTERING_QUALITY_MEDIUM=16,r.TEXTURE_FILTERING_QUALITY_LOW=8,r.SCALEMODE_FLOOR=1,r.SCALEMODE_NEAREST=2,r.SCALEMODE_CEILING=3,r.MATERIAL_TextureDirtyFlag=1,r.MATERIAL_LightDirtyFlag=2,r.MATERIAL_FresnelDirtyFlag=4,r.MATERIAL_AttributesDirtyFlag=8,r.MATERIAL_MiscDirtyFlag=16,r.MATERIAL_AllDirtyFlag=31,r.MATERIAL_TriangleFillMode=0,r.MATERIAL_WireFrameFillMode=1,r.MATERIAL_PointFillMode=2,r.MATERIAL_PointListDrawMode=3,r.MATERIAL_LineListDrawMode=4,r.MATERIAL_LineLoopDrawMode=5,r.MATERIAL_LineStripDrawMode=6,r.MATERIAL_TriangleStripDrawMode=7,r.MATERIAL_TriangleFanDrawMode=8,r.MATERIAL_ClockWiseSideOrientation=0,r.MATERIAL_CounterClockWiseSideOrientation=1,r.ACTION_NothingTrigger=0,r.ACTION_OnPickTrigger=1,r.ACTION_OnLeftPickTrigger=2,r.ACTION_OnRightPickTrigger=3,r.ACTION_OnCenterPickTrigger=4,r.ACTION_OnPickDownTrigger=5,r.ACTION_OnDoublePickTrigger=6,r.ACTION_OnPickUpTrigger=7,r.ACTION_OnPickOutTrigger=16,r.ACTION_OnLongPressTrigger=8,r.ACTION_OnPointerOverTrigger=9,r.ACTION_OnPointerOutTrigger=10,r.ACTION_OnEveryFrameTrigger=11,r.ACTION_OnIntersectionEnterTrigger=12,r.ACTION_OnIntersectionExitTrigger=13,r.ACTION_OnKeyDownTrigger=14,r.ACTION_OnKeyUpTrigger=15,r.PARTICLES_BILLBOARDMODE_Y=2,r.PARTICLES_BILLBOARDMODE_ALL=7,r.PARTICLES_BILLBOARDMODE_STRETCHED=8,r.MESHES_CULLINGSTRATEGY_STANDARD=0,r.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,r.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,r.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,r.SCENELOADER_NO_LOGGING=0,r.SCENELOADER_MINIMAL_LOGGING=1,r.SCENELOADER_SUMMARY_LOGGING=2,r.SCENELOADER_DETAILED_LOGGING=3,r.PREPASS_COLOR_INDEX=0,r.PREPASS_IRRADIANCE_INDEX=1,r.PREPASS_DEPTHNORMAL_INDEX=2,r.PREPASS_ALBEDO_INDEX=3,r);function r(){}},function(e,t,i){"use strict";i.d(t,"b",function(){return a}),i.d(t,"c",function(){return s}),i.d(t,"m",function(){return c}),i.d(t,"e",function(){return m}),i.d(t,"h",function(){return _}),i.d(t,"n",function(){return g}),i.d(t,"o",function(){return v}),i.d(t,"k",function(){return b}),i.d(t,"g",function(){return y}),i.d(t,"f",function(){return T}),i.d(t,"i",function(){return E}),i.d(t,"l",function(){return S}),i.d(t,"j",function(){return A}),i.d(t,"d",function(){return C}),i.d(t,"a",function(){return P});function n(e,t,i){var n=e();h.a&&h.a.AddTagsTo(n,t.tags);var r=f(n);for(var o in r){var a=r[o],s=t[o],c=a.type;if(null!=s&&"uniqueId"!==o)switch(c){case 0:case 6:case 11:n[o]=s;break;case 1:n[o]=i||s.isRenderTarget?s:s.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:case 12:n[o]=i?s:s.clone()}}return n}var h=i(43),d=i(0),r=i(21),p=i(10),l={},u={};function f(e){var t=e.getClassName();if(u[t])return u[t];u[t]={};for(var i=u[t],n=e,r=t;r;){var o=l[r];for(var a in o)i[a]=o[a];var s=void 0,c=!1;do{if(!(s=Object.getPrototypeOf(n)).getClassName){c=!0;break}if(s.getClassName()!==r)break;n=s}while(s);if(c)break;r=s.getClassName(),n=s}return i}function o(r,o){return function(e,t){var i,n=(i=e.getClassName(),l[i]||(l[i]={}),l[i]);n[t]||(n[t]={type:r,sourceName:o})}}function a(e,t){return void 0===t&&(t=null),n=e,void 0===(r=t)&&(r=null),function(t,e){var i=r||"_"+e;Object.defineProperty(t,e,{get:function(){return this[i]},set:function(e){this[i]!==e&&(this[i]=e,t[n].apply(this))},enumerable:!0,configurable:!0})};var n,r}function s(e){return o(0,e)}function c(e){return o(1,e)}function m(e){return o(2,e)}function _(e){return o(3,e)}function g(e){return o(4,e)}function v(e){return o(5,e)}function b(e){return o(6,e)}function y(e){return o(7,e)}function T(e){return o(8,e)}function E(e){return o(9,e)}function S(e){return o(10,e)}function A(e){return o(12,e)}function C(e){return o(11,e)}var P=(x.AppendSerializedAnimations=function(e,t){if(e.animations){t.animations=[];for(var i=0;i<e.animations.length;i++){var n=e.animations[i];t.animations.push(n.serialize())}}},x.Serialize=function(e,t){t=t||{},h.a&&(t.tags=h.a.GetTags(e));var i=f(e);for(var n in i){var r=i[n],o=r.sourceName||n,a=r.type,s=e[n];if(null!=s)switch(a){case 0:t[o]=s;break;case 1:t[o]=s.serialize();break;case 2:t[o]=s.asArray();break;case 3:t[o]=s.serialize();break;case 4:case 5:t[o]=s.asArray();break;case 6:t[o]=s.id;break;case 7:t[o]=s.serialize();break;case 8:t[o]=s.asArray();break;case 9:t[o]=s.serialize();break;case 10:t[o]=s.asArray();break;case 11:t[o]=s.id;case 12:t[o]=s.asArray()}}return t},x.Parse=function(e,t,i,n){void 0===n&&(n=null);var r=e();n=n||"",h.a&&h.a.AddTagsTo(r,t.tags);var o=f(r);for(var a in o){var s=o[a],c=t[s.sourceName||a],l=s.type;if(null!=c){var u=r;switch(l){case 0:u[a]=c;break;case 1:i&&(u[a]=x._TextureParser(c,i,n));break;case 2:u[a]=p.a.FromArray(c);break;case 3:u[a]=x._FresnelParametersParser(c);break;case 4:u[a]=d.d.FromArray(c);break;case 5:u[a]=d.e.FromArray(c);break;case 6:i&&(u[a]=i.getLastMeshByID(c));break;case 7:u[a]=x._ColorCurvesParser(c);break;case 8:u[a]=p.b.FromArray(c);break;case 9:u[a]=x._ImageProcessingConfigurationParser(c);break;case 10:u[a]=d.b.FromArray(c);break;case 11:i&&(u[a]=i.getCameraByID(c));case 12:u[a]=d.a.FromArray(c)}}}return r},x.Clone=function(e,t){return n(e,t,!1)},x.Instanciate=function(e,t){return n(e,t,!0)},x._ImageProcessingConfigurationParser=function(e){throw r.a.WarnImport("ImageProcessingConfiguration")},x._FresnelParametersParser=function(e){throw r.a.WarnImport("FresnelParameters")},x._ColorCurvesParser=function(e){throw r.a.WarnImport("ColorCurves")},x._TextureParser=function(e,t,i){throw r.a.WarnImport("Texture")},x);function x(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return m}),i.d(t,"b",function(){return l});var m=(n.prototype.createVertexBuffer=function(e,t,i,n,r,o,a){void 0===o&&(o=!1);var s=o?t:t*Float32Array.BYTES_PER_ELEMENT,c=n?o?n:n*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new l(this._engine,this,e,this._updatable,!0,c,void 0===r?this._instanced:r,s,i,void 0,void 0,!0,this._divisor||a)},n.prototype.isUpdatable=function(){return this._updatable},n.prototype.getData=function(){return this._data},n.prototype.getBuffer=function(){return this._buffer},n.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},n.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))},n.prototype._rebuild=function(){this._buffer=null,this.create(this._data)},n.prototype.update=function(e){this.create(e)},n.prototype.updateDirectly=function(e,t,i,n){void 0===n&&(n=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,n?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),this._data=null)},n.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)},n),l=(Object.defineProperty(_.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){this._instanceDivisor=e,this._instanced=0!=e}
1,enumerable:!1,configurable:!0}),_.prototype._rebuild=function(){this._buffer&&this._buffer._rebuild()},_.prototype.getKind=function(){return this._kind},_.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},_.prototype.getData=function(){return this._buffer.getData()},_.prototype.getBuffer=function(){return this._buffer.getBuffer()},_.prototype.getStrideSize=function(){return this.byteStride/_.GetTypeByteLength(this.type)},_.prototype.getOffset=function(){return this.byteOffset/_.GetTypeByteLength(this.type)},_.prototype.getSize=function(){return this._size},_.prototype.getIsInstanced=function(){return this._instanced},_.prototype.getInstanceDivisor=function(){return this._instanceDivisor},_.prototype.create=function(e){this._buffer.create(e)},_.prototype.update=function(e){this._buffer.update(e)},_.prototype.updateDirectly=function(e,t,i){void 0===i&&(i=!1),this._buffer.updateDirectly(e,t,void 0,i)},_.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose()},_.prototype.forEach=function(e,t){_.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,t)},_.DeduceStride=function(e){switch(e){case _.UVKind:case _.UV2Kind:case _.UV3Kind:case _.UV4Kind:case _.UV5Kind:case _.UV6Kind:return 2;case _.NormalKind:case _.PositionKind:return 3;case _.ColorKind:case _.MatricesIndicesKind:case _.MatricesIndicesExtraKind:case _.MatricesWeightsKind:case _.MatricesWeightsExtraKind:case _.TangentKind:return 4;default:throw new Error("Invalid kind '"+e+"'")}},_.GetTypeByteLength=function(e){switch(e){case _.BYTE:case _.UNSIGNED_BYTE:return 1;case _.SHORT:case _.UNSIGNED_SHORT:return 2;case _.INT:case _.UNSIGNED_INT:case _.FLOAT:return 4;default:throw new Error("Invalid type '"+e+"'")}},_.ForEach=function(e,t,i,n,r,o,a,s){if(e instanceof Array)for(var c=t/4,l=i/4,u=0;u<o;u+=n){for(var h=0;h<n;h++)s(e[c+h],u+h);c+=l}else for(var d=e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),p=_.GetTypeByteLength(r),u=0;u<o;u+=n){for(var f=t,h=0;h<n;h++)s(_._GetFloatValue(d,r,f,a),u+h),f+=p;t+=i}},_._GetFloatValue=function(e,t,i,n){switch(t){case _.BYTE:var r=e.getInt8(i);return n&&(r=Math.max(r/127,-1)),r;case _.UNSIGNED_BYTE:return r=e.getUint8(i),n&&(r/=255),r;case _.SHORT:return r=e.getInt16(i,!0),n&&(r=Math.max(r/32767,-1)),r;case _.UNSIGNED_SHORT:return r=e.getUint16(i,!0),n&&(r/=65535),r;case _.INT:return e.getInt32(i,!0);case _.UNSIGNED_INT:return e.getUint32(i,!0);case _.FLOAT:return e.getFloat32(i,!0);default:throw new Error("Invalid component type "+t)}},_.BYTE=5120,_.UNSIGNED_BYTE=5121,_.SHORT=5122,_.UNSIGNED_SHORT=5123,_.INT=5124,_.UNSIGNED_INT=5125,_.FLOAT=5126,_.PositionKind="position",_.NormalKind="normal",_.TangentKind="tangent",_.UVKind="uv",_.UV2Kind="uv2",_.UV3Kind="uv3",_.UV4Kind="uv4",_.UV5Kind="uv5",_.UV6Kind="uv6",_.ColorKind="color",_.MatricesIndicesKind="matricesIndices",_.MatricesWeightsKind="matricesWeights",_.MatricesIndicesExtraKind="matricesIndicesExtra",_.MatricesWeightsExtraKind="matricesWeightsExtra",_);function _(e,t,i,n,r,o,a,s,c,l,u,h,d){var p;void 0===u&&(u=!1),void 0===h&&(h=!1),void 0===d&&(d=1),t instanceof m?(this._buffer=t,this._ownsBuffer=!1):(this._buffer=new m(e,t,n,o,r,a,h),this._ownsBuffer=!0),this._kind=i,null==l?(p=this.getData(),this.type=_.FLOAT,p instanceof Int8Array?this.type=_.BYTE:p instanceof Uint8Array?this.type=_.UNSIGNED_BYTE:p instanceof Int16Array?this.type=_.SHORT:p instanceof Uint16Array?this.type=_.UNSIGNED_SHORT:p instanceof Int32Array?this.type=_.INT:p instanceof Uint32Array&&(this.type=_.UNSIGNED_INT)):this.type=l;var f=_.GetTypeByteLength(this.type);h?(this._size=c||(o?o/f:_.DeduceStride(i)),this.byteStride=o||this._buffer.byteStride||this._size*f,this.byteOffset=s||0):(this._size=c||o||_.DeduceStride(i),this.byteStride=o?o*f:this._buffer.byteStride||this._size*f,this.byteOffset=(s||0)*f),this.normalized=u,this._instanced=void 0!==a&&a,this._instanceDivisor=a?d:0}function n(e,t,i,n,r,o,a,s){void 0===n&&(n=0),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),e.getSce
1ne?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=i,this._instanced=o,this._divisor=s||1,this._data=t,this.byteStride=a?n:n*Float32Array.BYTES_PER_ELEMENT,r||this.create()}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var b=i(6),o=i(2),y=i(44),d=i(7),T=i(215),n=(Object.defineProperty(E.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new b.c),this._onBindObservable},enumerable:!1,configurable:!0}),E.prototype._useFinalCode=function(e,t,i){var n,r;i?(n=i.vertexElement||i.vertex||i.spectorName||i,r=i.fragmentElement||i.fragment||i.spectorName||i,this._vertexSourceCode="#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode="#define SHADER_NAME fragment:"+r+"\n"+t):(this._vertexSourceCode=e,this._fragmentSourceCode=t),this._prepareEffect()},Object.defineProperty(E.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),E.prototype.isReady=function(){try{return this._isReadyInternal()}catch(e){return!1}},E.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},E.prototype.getEngine=function(){return this._engine},E.prototype.getPipelineContext=function(){return this._pipelineContext},E.prototype.getAttributesNames=function(){return this._attributesNames},E.prototype.getAttributeLocation=function(e){return this._attributes[e]},E.prototype.getAttributeLocationByName=function(e){return this._attributeLocationByName[e]},E.prototype.getAttributesCount=function(){return this._attributes.length},E.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},E.prototype.getUniform=function(e){return this._uniforms[e]},E.prototype.getSamplers=function(){return this._samplerList},E.prototype.getUniformNames=function(){return this._uniformsNames},E.prototype.getUniformBuffersNames=function(){return this._uniformBuffersNamesList},E.prototype.getIndexParameters=function(){return this._indexParameters},E.prototype.getCompilationError=function(){return this._compilationError},E.prototype.allFallbacksProcessed=function(){return this._allFallbacksProcessed},E.prototype.executeWhenCompiled=function(t){var e=this;this.isReady()?t(this):(this.onCompileObservable.add(function(e){t(e)}),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout(function(){e._checkIsReady(null)},16))},E.prototype._checkIsReady=function(e){var t=this;try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}setTimeout(function(){t._checkIsReady(e)},16)},E.prototype._loadShader=function(e,t,i,n){var r;"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?n(y.a.GetDOMTextContent(e)):"source:"!==e.substr(0,7)?"base64:"!==e.substr(0,7)?E.ShadersStore[e+t+"Shader"]?n(E.ShadersStore[e+t+"Shader"]):i&&E.ShadersStore[e+i+"Shader"]?n(E.ShadersStore[e+i+"Shader"]):(r="."===e[0]||"/"===e[0]||-1<e.indexOf("http")?e:E.ShadersRepository+e,this._engine._loadFile(r+"."+t.toLowerCase()+".fx",n)):n(window.atob(e.substr(7))):n(e.substr(7))},Object.defineProperty(E.prototype,"vertexSourceCode",{get:function(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:this._vertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"fragmentSourceCode",{get:function(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:this._fragmentSourceCode},enumerable:!1,configurable:!0}),E.prototype._rebuildProgram=function(e,t,i,n){var r=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){var e=r.getEngine().scenes;if(e)for(var t=0;t<e.length;t++)e[t].markAllMaterialsAsDirty(o.a.MATERIAL_AllDirtyFlag);r._pipelineContext._handlesSpectorRebuildCallback(i)},this._fallbacks=null,this._prepareEffect()},E.prototype._prepareEffect=function(){var r=this,o=this._attributesNames,e=this.defines;this._valueCache={};var a=this._pipelineContext;try{var s=this._engine;this._pipelineContext=s.createPipelineContext();var t=this._rebuildProgram.bind(this);this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?s._preparePipelineContext(this._pipelineContext,this._vertexSourceCodeOverride,this._fragmentSourceCodeOverride,!0,t,null,this._transformFeedbackVaryings):s._preparePipelineContext(this._pipelineContext,this._vertexSourceCode,this._fragmentSourceCode,!1,t,e,this._transformFeedbackVaryings),s._executeWhenRenderingStateIsCompiled(this._pipelineContext,function(){if(s.supportsUniformBuffers)for(var e in r._uniformBuffersNames)r.bindUniformBlock(e,r._uniformBuffersNames[e]);var t;
1if(s.getUniforms(r._pipelineContext,r._uniformsNames).forEach(function(e,t){r._uniforms[r._uniformsNames[t]]=e}),r._attributes=s.getAttributes(r._pipelineContext,o),o)for(var i=0;i<o.length;i++){var n=o[i];r._attributeLocationByName[n]=r._attributes[i]}for(t=0;t<r._samplerList.length;t++)null==r.getUniform(r._samplerList[t])&&(r._samplerList.splice(t,1),t--);r._samplerList.forEach(function(e,t){r._samplers[e]=t}),s.bindSamplers(r),r._compilationError="",r._isReady=!0,r.onCompiled&&r.onCompiled(r),r.onCompileObservable.notifyObservers(r),r.onCompileObservable.clear(),r._fallbacks&&r._fallbacks.unBindMesh(),a&&r.getEngine()._deletePipelineContext(a)}),this._pipelineContext.isAsync&&this._checkIsReady(a)}catch(r){this._processCompilationErrors(r,a)}},E.prototype._getShaderCodeAndErrorLine=function(e,t,i){var n,r,o,a=i?/FRAGMENT SHADER ERROR: 0:(\d+?):/:/VERTEX SHADER ERROR: 0:(\d+?):/,s=null;return t&&e&&(n=t.match(a))&&2===n.length&&(r=parseInt(n[1]),(o=e.split("\n",-1)).length>=r&&(s="Offending line ["+r+"] in "+(i?"fragment":"vertex")+" code: "+o[r-1])),[e,s]},E.prototype._processCompilationErrors=function(e,t){var i,n,r,o,a;void 0===t&&(t=null),this._compilationError=e.message;var s,c,l,u=this._attributesNames,h=this._fallbacks;d.a.Error("Unable to compile effect:"),d.a.Error("Uniforms: "+this._uniformsNames.map(function(e){return" "+e})),d.a.Error("Attributes: "+u.map(function(e){return" "+e})),d.a.Error("Defines:\r\n"+this.defines),E.LogShaderCodeOnCompilationError&&((l=c=s=null)!==(r=this._pipelineContext)&&void 0!==r&&r._getVertexShaderCode()&&(l=(i=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1))[0],s=i[1],l&&(d.a.Error("Vertex code:"),d.a.Error(l))),null!==(o=this._pipelineContext)&&void 0!==o&&o._getFragmentShaderCode()&&(l=(n=this._getShaderCodeAndErrorLine(null===(a=this._pipelineContext)||void 0===a?void 0:a._getFragmentShaderCode(),this._compilationError,!0))[0],c=n[1],l&&(d.a.Error("Fragment code:"),d.a.Error(l))),s&&d.a.Error(s),c&&d.a.Error(c)),d.a.Error("Error: "+this._compilationError),t&&(this._pipelineContext=t,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)),h?(this._pipelineContext=null,h.hasMoreFallbacks?(this._allFallbacksProcessed=!1,d.a.Error("Trying next fallback."),this.defines=h.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):this._allFallbacksProcessed=!0},Object.defineProperty(E.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!1,configurable:!0}),E.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers[e],t)},E.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t)},E.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t)},E.prototype.setTextureArray=function(e,t){var i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){for(var n=this._samplerList.indexOf(e),r=1;r<t.length;r++){var o=i+(r-1).toString();this._samplerList.splice(n+r,0,o)}for(var a=0,s=0,c=this._samplerList;s<c.length;s++){var l=c[s];this._samplers[l]=a,a+=1}}this._engine.setTextureArray(this._samplers[e],this._uniforms[e],t)},E.prototype.setTextureFromPostProcess=function(e,t){this._engine.setTextureFromPostProcess(this._samplers[e],t)},E.prototype.setTextureFromPostProcessOutput=function(e,t){this._engine.setTextureFromPostProcessOutput(this._samplers[e],t)},E.prototype._cacheMatrix=function(e,t){var i=this._valueCache[e],n=t.updateFlag;return(void 0===i||i!==n)&&(this._valueCache[e]=n,!0)},E.prototype._cacheFloat2=function(e,t,i){var n=this._valueCache[e];if(!n||2!==n.length)return n=[t,i],this._valueCache[e]=n,!0;var r=!1;return n[0]!==t&&(n[0]=t,r=!0),n[1]!==i&&(n[1]=i,r=!0),r},E.prototype._cacheFloat3=function(e,t,i,n){var r=this._valueCache[e];if(!r||3!==r.length)return r=[t,i,n],this._valueCache[e]=r,!0;var o=!1;return r[0]!==t&&(r[0]=t,o=!0),r[1]!==i&&(r[1]=i,o=!0),r[2]!==n&&(r[2]=n,o=!0),o},E.prototype._cacheFloat4=function(e,t,i,n,r){var o=this._valueCache[e];if(!o||4!==o.length)return o=[t,i,n,r],this._valueCache[e]=o,!0;var a=!1;return o[0]!==t&&(o[0]=t,a=!0),o[1]!==i&&(o[1]=i,a=!0),o[2]!==n&&(o[2]=n,a=!0),o[3]!==r&&(o[3]=r,a=!0),a},E.prototype.bindUniformBuffer=function(e,t){var i=this._uniformBuffersNames[t];void 0!==i&&E._baseCache[i]!==e&&(E._baseCache[i]=e,this._engine.b
1indUniformBufferBase(e,i))},E.prototype.bindUniformBlock=function(e,t){this._engine.bindUniformBlock(this._pipelineContext,e,t)},E.prototype.setInt=function(e,t){var i=this._valueCache[e];return void 0!==i&&i===t||(this._valueCache[e]=t,this._engine.setInt(this._uniforms[e],t)),this},E.prototype.setIntArray=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray(this._uniforms[e],t),this},E.prototype.setIntArray2=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray2(this._uniforms[e],t),this},E.prototype.setIntArray3=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray3(this._uniforms[e],t),this},E.prototype.setIntArray4=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray4(this._uniforms[e],t),this},E.prototype.setFloatArray=function(e,t){return this._valueCache[e]=null,this._engine.setArray(this._uniforms[e],t),this},E.prototype.setFloatArray2=function(e,t){return this._valueCache[e]=null,this._engine.setArray2(this._uniforms[e],t),this},E.prototype.setFloatArray3=function(e,t){return this._valueCache[e]=null,this._engine.setArray3(this._uniforms[e],t),this},E.prototype.setFloatArray4=function(e,t){return this._valueCache[e]=null,this._engine.setArray4(this._uniforms[e],t),this},E.prototype.setArray=function(e,t){return this._valueCache[e]=null,this._engine.setArray(this._uniforms[e],t),this},E.prototype.setArray2=function(e,t){return this._valueCache[e]=null,this._engine.setArray2(this._uniforms[e],t),this},E.prototype.setArray3=function(e,t){return this._valueCache[e]=null,this._engine.setArray3(this._uniforms[e],t),this},E.prototype.setArray4=function(e,t){return this._valueCache[e]=null,this._engine.setArray4(this._uniforms[e],t),this}
1,E.prototype.setMatrices=function(e,t){return t&&(this._valueCache[e]=null,this._engine.setMatrices(this._uniforms[e],t)),this},E.prototype.setMatrix=function(e,t){return this._cacheMatrix(e,t)&&this._engine.setMatrices(this._uniforms[e],t.toArray()),this},E.prototype.setMatrix3x3=function(e,t){return this._valueCache[e]=null,this._engine.setMatrix3x3(this._uniforms[e],t),this},E.prototype.setMatrix2x2=function(e,t){return this._valueCache[e]=null,this._engine.setMatrix2x2(this._uniforms[e],t),this},E.prototype.setFloat=function(e,t){var i=this._valueCache[e];return void 0!==i&&i===t||(this._valueCache[e]=t,this._engine.setFloat(this._uniforms[e],t)),this},E.prototype.setBool=function(e,t){var i=this._valueCache[e];return void 0!==i&&i===t||(this._valueCache[e]=t,this._engine.setInt(this._uniforms[e],t?1:0)),this},E.prototype.setVector2=function(e,t){return this._cacheFloat2(e,t.x,t.y)&&this._engine.setFloat2(this._uniforms[e],t.x,t.y),this},E.prototype.setFloat2=function(e,t,i){return this._cacheFloat2(e,t,i)&&this._engine.setFloat2(this._uniforms[e],t,i),this},E.prototype.setVector3=function(e,t){return this._cacheFloat3(e,t.x,t.y,t.z)&&this._engine.setFloat3(this._uniforms[e],t.x,t.y,t.z),this},E.prototype.setFloat3=function(e,t,i,n){return this._cacheFloat3(e,t,i,n)&&this._engine.setFloat3(this._uniforms[e],t,i,n),this},E.prototype.setVector4=function(e,t){return this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&this._engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w),this},E.prototype.setFloat4=function(e,t,i,n,r){return this._cacheFloat4(e,t,i,n,r)&&this._engine.setFloat4(this._uniforms[e],t,i,n,r),this},E.prototype.setColor3=function(e,t){return this._cacheFloat3(e,t.r,t.g,t.b)&&this._engine.setFloat3(this._uniforms[e],t.r,t.g,t.b),this},E.prototype.setColor4=function(e,t,i){return this._cacheFloat4(e,t.r,t.g,t.b,i)&&this._engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i),this},E.prototype.setDirectColor4=function(e,t){return this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&this._engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a),this},E.prototype.dispose=function(){this._engine._releaseEffect(this)},E.RegisterShader=function(e,t,i){t&&(E.ShadersStore[e+"PixelShader"]=t),i&&(E.ShadersStore[e+"VertexShader"]=i)},E.ResetCache=function(){E._baseCache={}},E.ShadersRepository="src/Shaders/",E.LogShaderCodeOnCompilationError=!0,E._uniqueIdSeed=0,E._baseCache={},E.ShadersStore={},E.IncludesShadersStore={},E);function E(i,e,t,n,r,o,a,s,c,l){var u,h=this;void 0===n&&(n=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===c&&(c=null),this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new b.c,this.onErrorObservable=new b.c,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._bonesComputationForcedToCPU=!1,this._multiTarget=!1,this._uniformBuffersNames={},this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._pipelineContext=null,this._valueCache={},this.name=i;var d,p,f=null;if(e.attributes){var m=e;if(this._engine=t,this._attributesNames=m.attributes,this._uniformsNames=m.uniformsNames.concat(m.samplers),this._samplerList=m.samplers.slice(),this.defines=m.defines,this.onError=m.onError,this.onCompiled=m.onCompiled,this._fallbacks=m.fallbacks,this._indexParameters=m.indexParameters,this._transformFeedbackVaryings=m.transformFeedbackVaryings||null,this._multiTarget=!!m.multiTarget,m.uniformBuffersNames){this._uniformBuffersNamesList=m.uniformBuffersNames.slice();for(var _=0;_<m.uniformBuffersNames.length;_++)this._uniformBuffersNames[m.uniformBuffersNames[_]]=_}f=null!==(u=m.processFinalCode)&&void 0!==u?u:null}else this._engine=r,this.defines=null==o?"":o,this._uniformsNames=t.concat(n),this._samplerList=n?n.slice():[],this._attributesNames=e,this._uniformBuffersNamesList=[],this.onError=c,this.onCompiled=s,this._indexParameters=l,this._fallbacks=a;this._attributeLocationByName={},this.uniqueId=E._uniqueIdSeed++;var g=y.a.IsWindowObjectExist()?this._engine.getHostDocument():null;i.vertexSource?d="source:"+i.vertexSource:i.vertexElement?(d=g?g.getElementById(i.vertexElement):null)||(d=i.vertexElement):d=i.vertex||i,i.fragmentSource?p="source:"+i.fragmentSource:i.fragmentElement?(p=g?g.getElementById(i.fragmentElement):null)||(p=i.fragmentElement):p=i.fragment||i;var v={defines:this.defines.split("\n"),indexParameters:this._indexParameters,isFragment:!1,shouldUseHighPrecisionShader:this._engine._shouldUseHighPrecisionShader,processor:this._engine._shaderProcessor,supp
1ortsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:E.ShadersRepository,includesShadersStore:E.IncludesShadersStore,version:(100*this._engine.webGLVersion).toString(),platformName:2<=this._engine.webGLVersion?"WEBGL2":"WEBGL1"};this._loadShader(d,"Vertex","",function(t){h._loadShader(p,"Fragment","Pixel",function(e){T.a.Process(t,v,function(t){f&&(t=f("vertex",t)),v.isFragment=!0,T.a.Process(e,v,function(e){f&&(e=f("fragment",e)),h._useFinalCode(t,e,i)})})})})}},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"d",function(){return a}),i.d(t,"b",function(){return r}),i.d(t,"c",function(){return o});var n=(l.prototype.initalize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},l),a=function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1},r=(c.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e<this._observers.length;e++)this._observables[e].remove(this._observers[e]);this._observers=null,this._observables=null},c.Watch=function(e,t,i,n){void 0===i&&(i=-1),void 0===n&&(n=null);var r=new c;r._observers=new Array;for(var o=0,a=r._observables=e;o<a.length;o++){var s=a[o].add(t,i,!1,n);s&&r._observers.push(s)}return r},c),o=(Object.defineProperty(s.prototype,"observers",{get:function(){return this._observers},enumerable:!1,configurable:!0}),s.prototype.add=function(e,t,i,n,r){if(void 0===t&&(t=-1),void 0===i&&(i=!1),void 0===n&&(n=null),void 0===r&&(r=!1),!e)return null;var o=new a(e,t,n);return o.unregisterOnNextCall=r,i?this._observers.unshift(o):this._observers.push(o),this._onObserverAdded&&this._onObserverAdded(o),o},s.prototype.addOnce=function(e){return this.add(e,void 0,void 0,void 0,!0)},s.prototype.remove=function(e){return!!e&&-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0)},s.prototype.removeCallback=function(e,t){for(var i=0;i<this._observers.length;i++){var n=this._observers[i];if(!(n._willBeUnregistered||n.callback!==e||t&&t!==n.scope))return this._deferUnregister(n),!0}return!1},s.prototype._deferUnregister=function(e){var t=this;e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(function(){t._remove(e)},0)},s.prototype._remove=function(e){if(!e)return!1;var t=this._observers.indexOf(e);return-1!==t&&(this._observers.splice(t,1),!0)},s.prototype.makeObserverTopPriority=function(e){this._remove(e),this._observers.unshift(e)},s.prototype.makeObserverBottomPriority=function(e){this._remove(e),this._observers.push(e)},s.prototype.notifyObservers=function(e,t,i,n){if(void 0===t&&(t=-1),!this._observers.length)return!0;var r=this._eventState;r.mask=t,r.target=i,r.currentTarget=n,r.skipNextObservers=!1,r.lastReturnValue=e;for(var o=0,a=this._observers;o<a.length;o++){var s=a[o];if(!s._willBeUnregistered&&(s.mask&t&&(s.scope?r.lastReturnValue=s.callback.apply(s.scope,[e,r]):r.lastReturnValue=s.callback(e,r),s.unregisterOnNextCall&&this._deferUnregister(s)),r.skipNextObservers))return!1}return!0},s.prototype.notifyObserversWithPromise=function(i,e,t,n){var r=this;void 0===e&&(e=-1);var o=Promise.resolve(i);if(!this._observers.length)return o;var a=this._eventState;return a.mask=e,a.target=t,a.currentTarget=n,a.skipNextObservers=!1,this._observers.forEach(function(t){a.skipNextObservers||t._willBeUnregistered||t.mask&e&&(o=t.scope?o.then(function(e){return a.lastReturnValue=e,t.callback.apply(t.scope,[i,a])}):o.then(function(e){return a.lastReturnValue=e,t.callback(i,a)}),t.unregisterOnNextCall&&r._deferUnregister(t))}),o.then(function(){return i})},s.prototype.notifyObserver=function(e,t,i){void 0===i&&(i=-1);var n=this._eventState;n.mask=i,n.skipNextObservers=!1,e.callback(t,n)},s.prototype.hasObservers=function(){return 0<this._observers.length},s.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},s.prototype.clone=function(){var e=new s;return e._observers=this._observers.slice(0),e},s.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t<i.length;t++){var n=i[t];if(n.mask&e||n.mask===e)return!0}return!1},s);function s(e){this._observers=new Array,this._eventState=new n(0),e&&(this._onObserverAdded=e)}function c(){}function l(e,t,i,n){void 0===t&&(t=!1),this.initalize(e,t,i,n)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r._AddLogEntry=function(e){r._LogCache=e+r._LogCache,r.OnNe
1wCacheEntry&&r.OnNewCacheEntry(e)},r._FormatMessage=function(e){function t(e){return e<10?"0"+e:""+e}var i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e},r._LogDisabled=function(e){},r._LogEnabled=function(e){var t=r._FormatMessage(e);console.log("BJS - "+t),r._AddLogEntry("<div style='color:white'>"+t+"</div><br>")},r._WarnDisabled=function(e){},r._WarnEnabled=function(e){var t=r._FormatMessage(e);console.warn("BJS - "+t),r._AddLogEntry("<div style='color:orange'>"+t+"</div><br>")},r._ErrorDisabled=function(e){},r._ErrorEnabled=function(e){r.errorsCount++;var t=r._FormatMessage(e);console.error("BJS - "+t),r._AddLogEntry("<div style='color:red'>"+t+"</div><br>")},Object.defineProperty(r,"LogCache",{get:function(){return r._LogCache},enumerable:!1,configurable:!0}),r.ClearLogCache=function(){r._LogCache="",r.errorsCount=0},Object.defineProperty(r,"LogLevels",{set:function(e){r.Log=(e&r.MessageLogLevel)===r.MessageLogLevel?r._LogEnabled:r._LogDisabled,r.Warn=(e&r.WarningLogLevel)===r.WarningLogLevel?r._WarnEnabled:r._WarnDisabled,r.Error=(e&r.ErrorLogLevel)===r.ErrorLogLevel?r._ErrorEnabled:r._ErrorDisabled},enumerable:!1,configurable:!0}),r.NoneLogLevel=0,r.MessageLogLevel=1,r.WarningLogLevel=2,r.ErrorLogLevel=4,r.AllLogLevel=7,r._LogCache="",r.errorsCount=0,r.Log=r._LogEnabled,r.Warn=r._WarnEnabled,r.Error=r._ErrorEnabled,r);function r(){}},function(e,t,i){"use strict";i.d(t,"b",function(){return s}),i.d(t,"c",function(){return c}),i.d(t,"a",function(){return l});function m(){this.visibleInstances={},this.batchCache=new c,this.instancesBufferSize=2048}function _(){this.instancesCount=0,this.matrixBuffer=null,this.matrixBufferSize=512,this.boundingVectors=[]}function g(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._morphTargetManager=null}var A,n=i(1),r=i(6),d=i(13),v=i(46),b=i(43),P=i(0),p=i(10),f=i(30),x=i(4),S=i(16),y=i(95),o=i(28),R=i(78),T=i(52),E=i(29),C=i(98),O=i(93),M=i(2),h=i(3),I=i(7),D=i(11),L=i(21),N=i(17),a=i(246),F=i(96),s=function(){},c=function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array},l=(A=o.a,Object(n.d)(w,A),w._GetDefaultSideOrientation=function(e){return e||w.FRONTSIDE},Object.defineProperty(w.prototype,"onBeforeRenderObservable",{get:function(){return this._internalMeshDataInfo._onBeforeRenderObservable||(this._internalMeshDataInfo._onBeforeRenderObservable=new r.c),this._internalMeshDataInfo._onBeforeRenderObservable},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onBeforeBindObservable",{get:function(){return this._internalMeshDataInfo._onBeforeBindObservable||(this._internalMeshDataInfo._onBeforeBindObservable=new r.c),this._internalMeshDataInfo._onBeforeBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onAfterRenderObservable",{get:function(){return this._internalMeshDataInfo._onAfterRenderObservable||(this._internalMeshDataInfo._onAfterRenderObservable=new r.c),this._internalMeshDataInfo._onAfterRenderObservable},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onBeforeDrawObservable",{get:function(){return this._internalMeshDataInfo._onBeforeDrawObservable||(this._internalMeshDataInfo._onBeforeDrawObservable=new r.c),this._internalMeshDataInfo._onBeforeDrawObservable},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onBeforeDraw",{set:function(e){this._onBeforeDrawObserver&&this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver),this._onBeforeDrawObserver=this.onBeforeDrawObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"hasInstances",{get:function(){return 0<this.instances.length},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"hasThinInstances",{get:function(){var e;return 0<(null!==(e=this._thinInstanceDataStorage.instancesCount)&&void 0!==e?e:0)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"morphTargetManager",{get:function(){return this._internalMeshDataInfo._morphTargetManager},set:function(e){this._internalMeshDataInfo._morphTargetManager!==e&&(this._internalMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"worldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.instancesData},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"manualUpdateOfWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.manualUpdate},set:function(e){this._instanceDataStorage.manualUpdate=e},enumerable:!1,configurable:!0}),w.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=!(0<this.getTotalVertices())||t&&t.doNotInstantiate?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));n&&(n.parent=e||this.parent,n.position=this.position.clone(),n.scaling=this.scaling.clone(),this.rotationQuaternion?n.rotationQuaternion=this.rotationQuaternion.clone():n.rotation=this.rotation.clone(),i&&i(this,n));for(var r=0,o=this.getChildTransformNodes(!0);r<o.length;r++)o[r].instantiateHierarchy(n,t,i);return n},w.prototype.getClassName=function(){return"Mesh"},Object.defineProperty(w.prototype,"_isMesh",{get:function(){return!0},enumerable:!1,configurable:!0}),w.prototype.toString=function(e){var t,i,n=A.prototype.toString.call(this,e);if(n+=", n vertices: "+this.getTotalVertices(),n+=", parent: "+(this._waitingParentId?this._waitingParentId:this.parent?this.parent.name:"NONE"),this.animations)for(var r=0;r<this.animations.length;r++)n+=", animation[0]: "+this.animations[r].toString(e);return e&&(this._geometry?(t=this.getIndices(),(i=this.getVerticesData(x.b.PositionKind))&&t&&(n+=", flat shading: "+(i.length/3===t.length?"YES":"NO"))):n+=", flat shading: UNKNOWN"),n},w.prototype._unBindEffect=function(){A.prototype._unBindEffect.call(this);for(var e=0,t=this.instances;e<t.length;e++)t[e]._unBindEffect()},Object.defineProperty(w.prototype,"hasLODLevels",{get:function(){return 0<this._internalMeshDataInfo._LODLevels.length},enumerable:!1,configurable:!0}),w.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},w.prototype._sortLODLevels=function(){this._internalMeshDataInfo._LODLevels.sort(function(e,t){return e.distance<t.distance?1:e.distance>t.distance?-1:0})},w.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return I.a.Warn("You cannot use a mesh as LOD level twice"),this;var i=new a.a(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},w.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;i<t._LODLevels.length;i++){var n=t._LODLevels[i];if(n.distance===e)return n.mesh}return null},w.prototype.removeLODLevel=function(e){for(var t=this._internalMeshDataInfo,i=0;i<t._LODLevels.length;i++)t._LODLevels[i].mesh===e&&(t._LODLevels.splice(i,1),e&&(e._masterMesh=null));return this._sortLODLevels(),this},w.prototype.getLOD=function(e,t){var i=this._internalMeshDataInfo;if(!i._LODLevels||0===i._LODLevels.length)return this;var n=(t||this.getBoundingInfo().boundingSphere).centerWorld.subtract(e.globalPosition).length();if(i._LODLevels[i._LODLevels.length-1].distance>n)return this.onLODLevelSelection&&this.onLODLevelSelection(n,this,this),this;for(var r=0;r<i._LODLevels.length;r++){var o=i._LODLevels[r];if(o.distance<n)return o.mesh&&(o.mesh._preActivate(),o.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache)),this.onLODLevelSelection&&this.onLODLevelSelection(n,this,o.mesh),o.mesh}return this.onLODLevelSelection&&this.onLODLevelSelection(n,this,this),this},Object.defineProperty(w.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),w.prototype.getTotalVertices=function(){return null===this._geometry||void 0===this._geometry?0:this._geometry.getTotalVertices()},w.prototype.getVerticesData=function(e,t,i){return this._geometry?this._geometry.getVerticesData(e,t,i):null},w.prototype.getVertexBuffer=function(e){return this._geometry?this._geometry.getVertexBuffer(e):null},w.prototype.isVerticesDataPresent=function(e){return this._geometry?this._geometry.isVerticesDataPresent(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},w.prototype.isVertexBufferUpdatable=function(e){return this._geometry?this._geometry.isVertexBufferUpdatable(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},w.prototype.getVerticesDataKinds=function(){if(this._geometry)return this._geometry.getVerticesDataKinds();var t=new Array;return this._delayInfo&&this._delayInfo.forEach(function(e){t.push(e)}),t},w.prototype.getTotalIndices=function(){return this._geometry?this._geometry.getTotalIndices():0},w.prototype.getIndices=function(e,t){return this._geometry?this._geometry.getIndices(e,t):[]},Object.defineProperty(w.prototype,"isBlocked",{get:function(){return null!==this._masterMesh&&void 0!==this._masterMesh}
1,enumerable:!1,configurable:!0}),w.prototype.isReady=function(e,t){var i,n,r,o,a,s;if(void 0===e&&(e=!1),void 0===t&&(t=!1),this.delayLoadState===M.a.DELAYLOADSTATE_LOADING)return!1;if(!A.prototype.isReady.call(this,e))return!1;if(!this.subMeshes||0===this.subMeshes.length)return!0;if(!e)return!0;var c=this.getEngine(),l=this.getScene(),u=t||c.getCaps().instancedArrays&&(0<this.instances.length||this.hasThinInstances);this.computeWorldMatrix();var h=this.material||l.defaultMaterial;if(h)if(h._storeEffectOnSubMeshes)for(var d=0,p=this.subMeshes;d<p.length;d++){var f=(y=p[d]).getMaterial();if(f)if(f._storeEffectOnSubMeshes){if(!f.isReadyForSubMesh(this,y,u))return!1}else if(!f.isReady(this,u))return!1}else if(!h.isReady(this,u))return!1;for(var m=0,_=this.lightSources;m<_.length;m++){var g=_[m].getShadowGenerator();if(g&&(null===(i=g.getShadowMap())||void 0===i||!i.renderList||null!==(n=g.getShadowMap())&&void 0!==n&&n.renderList&&-1!==(null===(o=null===(r=g.getShadowMap())||void 0===r?void 0:r.renderList)||void 0===o?void 0:o.indexOf(this))))for(var v=0,b=this.subMeshes;v<b.length;v++){var y=b[v];if(!g.isReady(y,u,null!==(s=null===(a=y.getMaterial())||void 0===a?void 0:a.needAlphaBlendingForMesh(this))&&void 0!==s&&s))return!1}}for(var T=0,E=this._internalMeshDataInfo._LODLevels;T<E.length;T++){var S=E[T];if(S.mesh&&!S.mesh.isReady(u))return!1}return!0},Object.defineProperty(w.prototype,"areNormalsFrozen",{get:function(){return this._internalMeshDataInfo._areNormalsFrozen},enumerable:!1,configurable:!0}),w.prototype.freezeNormals=function(){return this._internalMeshDataInfo._areNormalsFrozen=!0,this},w.prototype.unfreezeNormals=function(){return this._internalMeshDataInfo._areNormalsFrozen=!1,this},Object.defineProperty(w.prototype,"overridenInstanceCount",{set:function(e){this._instanceDataStorage.overridenInstanceCount=e},enumerable:!1,configurable:!0}),w.prototype._preActivate=function(){var e=this._internalMeshDataInfo,t=this.getScene().getRenderId();return e._preActivateId===t||(e._preActivateId=t,this._instanceDataStorage.visibleInstances=null),this},w.prototype._preActivateForIntermediateRendering=function(e){return this._instanceDataStorage.visibleInstances&&(this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId=e),this},w.prototype._registerInstanceForRenderId=function(e,t){return this._instanceDataStorage.visibleInstances||(this._instanceDataStorage.visibleInstances={defaultRenderId:t,selfDefaultRenderId:this._renderId}),this._instanceDataStorage.visibleInstances[t]||(this._instanceDataStorage.visibleInstances[t]=new Array),this._instanceDataStorage.visibleInstances[t].push(e),this},w.prototype._afterComputeWorldMatrix=function(){A.prototype._afterComputeWorldMatrix.call(this),this.hasThinInstances&&(this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1))},w.prototype._postActivate=function(){this.edgesShareWithInstances&&this.edgesRenderer&&this.edgesRenderer.isEnabled&&this._renderingGroup&&(this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer),this.edgesRenderer.customInstances.push(this.getWorldMatrix()))},w.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=!1),this._boundingInfo&&this._boundingInfo.isLocked)return this;var t=this.geometry?this.geometry.boundingBias:null;return this._refreshBoundingInfo(this._getPositionData(e),t),this},w.prototype._createGlobalSubMesh=function(e){var t=this.getTotalVertices();if(!t||!this.getIndices())return null;if(this.subMeshes&&0<this.subMeshes.length){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,a=this.subMeshes;o<a.length;o++){var s=a[o];if(s.indexStart+s.indexCount>n){r=!0;break}if(s.verticesStart+s.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new R.a(0,0,t,0,this.getTotalIndices(),this)},w.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<e&&!(t<=n);r++)R.a.CreateFromIndices(0,n,r===e-1?t-n:i,this),n+=i;this.synchronizeInstances()}},w.prototype.setVerticesData=function(e,t,i,n){var r,o;return void 0===i&&(i=!1),this._geometry?this._geometry.setVerticesData(e,t,i,n):((r=new S.a).set(t,e),o=this.getScene(),new y.a(y.a.RandomId(),o,r,i,this)),this},w.prototype.removeVerticesData=function(e){this._geometry&&this._geometry.removeVerticesData(e)},w.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)},w.prototype.setVerticesBuffer=function(e){return this._geometry||(this._geometry=y.a.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e),this},w.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},w.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(x.b.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(x.b.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(x.b.NormalKind);if(!r)return this;S.a.ComputeNormals(i,n,r),this.updateVerticesData(x.b.NormalKind,r,!1,!1)}return this},w.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;var e=this._geometry,t=this._geometry.copy(y.a.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},w.prototype.setIndices=function(e,t,i){var n,r;return void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry?this._geometry.setIndices(e,t,i):((n=new S.a).indices=e,r=this.getScene(),new y.a(y.a.RandomId(),r,n,i,this)),this},w.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry&&this._geometry.updateIndices(e,t,i),this},w.prototype.toLeftHanded=function(){return this._geometry&&this._geometry.toLeftHanded(),this},w.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 E.a.PointFillMode:n=null;break;case E.a.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case E.a.TriangleFillMode:n=this._geometry.getIndexBuffer()}return this._geometry._bind(t,n),this},w.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==E.a.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,i):t==E.a.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,i):n.drawElementsType(t,e.indexStart,e.indexCount,i),this},w.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},w.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},w.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},w.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},w.prototype._getInstancesRenderList=function(e,t){if(void 0===t&&(t=!1),this._instanceDataStorage.
1isFrozen&&this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch;var i,n,r,o=this.getScene(),a=o._isInIntermediateRendering(),s=a?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,c=this._instanceDataStorage.batchCache;return c.mustReturn=!1,c.renderSelf[e]=t||!s&&this.isEnabled()&&this.isVisible,c.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t&&(i=this._instanceDataStorage.visibleInstances,n=o.getRenderId(),r=a?i.intermediateDefaultRenderId:i.defaultRenderId,c.visibleInstances[e]=i[n],!c.visibleInstances[e]&&r&&(c.visibleInstances[e]=i[r])),c.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==c.visibleInstances[e]&&void 0!==c.visibleInstances[e],this._instanceDataStorage.previousBatch=c},w.prototype._renderWithInstances=function(e,t,i,n,r){var o=i.visibleInstances[e._id];if(!o)return this;for(var a=this._instanceDataStorage,s=a.instancesBufferSize,c=a.instancesBuffer,l=16*(o.length+1)*4;a.instancesBufferSize<l;)a.instancesBufferSize*=2;a.instancesData&&s==a.instancesBufferSize||(a.instancesData=new Float32Array(a.instancesBufferSize/4));var u=0,h=0,d=i.renderSelf[e._id],p=!c||s!==a.instancesBufferSize;if(this._instanceDataStorage.manualUpdate||a.isFrozen&&!p)h=(d?1:0)+o.length;else{var f=this._effectiveMesh.getWorldMatrix();if(d&&(f.copyToArray(a.instancesData,u),u+=16,h++),o)for(var m=0;m<o.length;m++)o[m].getWorldMatrix().copyToArray(a.instancesData,u),u+=16,h++}return p?(c&&c.dispose(),c=new x.a(r,a.instancesData,!0,16,!1,!0),a.instancesBuffer=c,this.setVerticesBuffer(c.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(c.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(c.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(c.createVertexBuffer("world3",12,4))):this._instanceDataStorage.isFrozen||c.updateDirectly(a.instancesData,0,h),this._processInstancedBuffers(o,d),this.get
1Scene()._activeIndices.addCount(e.indexCount*h,!1),this._bind(e,n,t),this._draw(e,t,h),r.unbindInstanceAttributes(),this},w.prototype._renderWithThinInstances=function(e,t,i,n){var r,o,a=null!==(o=null===(r=this._thinInstanceDataStorage)||void 0===r?void 0:r.instancesCount)&&void 0!==o?o:0;this.getScene()._activeIndices.addCount(e.indexCount*a,!1),this._bind(e,i,t),this._draw(e,t,a),n.unbindInstanceAttributes()},w.prototype._processInstancedBuffers=function(e,t){},w.prototype._processRendering=function(e,t,i,n,r,o,a,s){var c=this.getScene(),l=c.getEngine();if(o&&t.getRenderingMesh().hasThinInstances)return this._renderWithThinInstances(t,n,i,l),this;if(o)this._renderWithInstances(t,n,r,i,l);else{var u=0;r.renderSelf[t._id]&&(a&&a(!1,e._effectiveMesh.getWorldMatrix(),s),u++,this._draw(t,n,this._instanceDataStorage.overridenInstanceCount));var h=r.visibleInstances[t._id];if(h){var d=h.length;u+=d;for(var p=0;p<d;p++){var f=h[p].getWorldMatrix();a&&a(!0,f,s),this._draw(t,n)}}c._activeIndices.addCount(t.indexCount*u,!1)}return this},w.prototype._rebuild=function(){this._instanceDataStorage.instancesBuffer&&(this._instanceDataStorage.instancesBuffer.dispose(),this._instanceDataStorage.instancesBuffer=null),A.prototype._rebuild.call(this)},w.prototype._freeze=function(){if(this.subMeshes){for(var e=0;e<this.subMeshes.length;e++)this._getInstancesRenderList(e);this._effectiveMaterial=null,this._instanceDataStorage.isFrozen=!0}},w.prototype._unFreeze=function(){this._instanceDataStorage.isFrozen=!1,this._instanceDataStorage.previousBatch=null},w.prototype.render=function(e,t,i){var n=this.getScene();if(this._internalAbstractMeshDataInfo._isActiveIntermediate?this._internalAbstractMeshDataInfo._isActiveIntermediate=!1:this._internalAbstractMeshDataInfo._isActive=!1,this._checkOcclusionQuery())return this;var r=this._getInstancesRenderList(e._id,!!i);if(r.mustReturn)return this;if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeRenderObservable&&this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);var o,a=n.getEngine(),s=r.hardwareInstancedRendering[e._id]||e.getRenderingMesh().hasThinInstances,c=this._instanceDataStorage,l=e.getMaterial();if(!l)return this;if(!c.isFrozen||!this._effectiveMaterial||this._effectiveMaterial!==l){if(l._storeEffectOnSubMeshes){if(!l.isReadyForSubMesh(this,e,s))return this}else if(!l.isReady(this,s))return this;this._effectiveMaterial=l}t&&a.setAlphaMode(this._effectiveMaterial.alphaMode);for(var u=0,h=n._beforeRenderingMeshStage;u<h.length;u++)h[u].action(this,e,r);if(!(o=this._effectiveMaterial._storeEffectOnSubMeshes?e.effect:this._effectiveMaterial.getEffect()))return this;n.prePassRenderer&&n.prePassRenderer.bindAttachmentsForEffect(o);var d,p,f=i||this._effectiveMesh;c.isFrozen||!this._effectiveMaterial.backFaceCulling&&null===this.overrideMaterialSideOrientation?d=c.sideOrientation:(p=f._getWorldMatrixDeterminant(),null==(d=this.overrideMaterialSideOrientation)&&(d=this._effectiveMaterial.sideOrientation),p<0&&(d=d===E.a.ClockWiseSideOrientation?E.a.CounterClockWiseSideOrientation:E.a.ClockWiseSideOrientation),c.sideOrientation=d);var m=this._effectiveMaterial._preBind(o,d);this._effectiveMaterial.forceDepthWrite&&a.setDepthWrite(!0);var _=n.forcePointsCloud?E.a.PointFillMode:n.forceWireframe?E.a.WireFrameFillMode:this._effectiveMaterial.fillMode;this._internalMeshDataInfo._onBeforeBindObservable&&this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this),s||this._bind(e,o,_);var g=f.getWorldMatrix();this._effectiveMaterial._storeEffectOnSubMeshes?this._effectiveMaterial.bindForSubMesh(g,this,e):this._effectiveMaterial.bind(g,this),!this._effectiveMaterial.backFaceCulling&&this._effectiveMaterial.separateCullingPass&&(a.setState(!0,this._effectiveMaterial.zOffset,!1,!m),this._processRendering(this,e,o,_,r,s,this._onBeforeDraw,this._effectiveMaterial),a.setState(!0,this._effectiveMaterial.zOffset,!1,m)),this._processRendering(this,e,o,_,r,s,this._onBeforeDraw,this._effectiveMaterial),this._effectiveMaterial.unbind();for(var v=0,b=n._afterRenderingMeshStage;v<b.length;v++)b[v].action(this,e,r);return this._internalMeshDataInfo._onAfterRenderObservable&&this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this),this},w.prototype._onBeforeDraw=function(e,t,i){e&&i&&i.bindOnlyWorldMatrix(t)},w.prototype.cleanMatrixWeights=function(){this.isVerticesDataPresent(x.b.MatricesWeightsKind)&&(this.isVerticesDataPresent(x.b.MatricesWeightsExtraKind)?this.normalizeSkinWeightsAndExtra():this.normalizeSkinFourWeights())},w.prototype.normalizeSkinFourWeights=function(){for(var e=this.getVerticesData(x.b.MatricesWeightsKind),t=e.length,i=0;i<t;i+=4){var n,r=e[i]+e[i+1]+e[i+2]+e[i+3];0===r?e[i]=1:(n=1/r,e[i]*=n,e[i+1]*=n,e[i+2]*=n,e[i+3]*=n)}this.setVerticesData(x.b.MatricesWeightsKind,e)},w.prototype.normalizeSkinWeightsAndExtra=function(){for(var e=this.getVerticesData(x.b.MatricesWeightsExtraKind),t=this.getVerticesData(x.b.MatricesWeightsKind),i=t.length,n=0;n<i;n+=4){var r,o=t[n]+t[n+1]+t[n+2]+t[n+3];
10===(o+=e[n]+e[n+1]+e[n+2]+e[n+3])?t[n]=1:(r=1/o,t[n]*=r,t[n+1]*=r,t[n+2]*=r,t[n+3]*=r,e[n]*=r,e[n+1]*=r,e[n+2]*=r,e[n+3]*=r)}this.setVerticesData(x.b.MatricesWeightsKind,t),this.setVerticesData(x.b.MatricesWeightsKind,e)},w.prototype.validateSkinning=function(){var e=this.getVerticesData(x.b.MatricesWeightsExtraKind),t=this.getVerticesData(x.b.MatricesWeightsKind);if(null===t||null==this.skeleton)return{skinned:!1,valid:!0,report:"not skinned"};for(var i=t.length,n=0,r=0,o=0,a=0,s=null===e?4:8,c=new Array,l=0;l<=s;l++)c[l]=0;for(l=0;l<i;l+=4){for(var u=t[l],h=u,d=0===h?0:1,p=1;p<s;p++){var f=p<4?t[l+p]:e[l+p-4];u<f&&n++,0!==f&&d++,h+=f,u=f}if(c[d]++,o<d&&(o=d),0===h)r++;else{for(var m=1/h,_=0,p=0;p<s;p++)_+=p<4?Math.abs(t[l+p]-t[l+p]*m):Math.abs(e[l+p-4]-e[l+p-4]*m);.001<_&&a++}}for(var g=this.skeleton.bones.length,v=this.getVerticesData(x.b.MatricesIndicesKind),b=this.getVerticesData(x.b.MatricesIndicesExtraKind),y=0,l=0;l<i;l++)for(p=0;p<s;p++){var T=p<4?v[p]:b[p-4];(g<=T||T<0)&&y++}return{skinned:!0,valid:0===r&&0===a&&0===y,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+a+"\nWeightCounts = ["+c+"]\nNumber of bones = "+g+"\nBad Bone Indices = "+y}},w.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===M.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=M.a.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},w.prototype._queueLoad=function(t){var i=this;t._addPendingData(this);var e=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return d.b.LoadFile(this.delayLoadingFile,function(e){e instanceof ArrayBuffer?i._delayLoadingFunction(e,i):i._delayLoadingFunction(JSON.parse(e),i),i.instances.forEach(function(e){e.refreshBoundingInfo(),e._syncSubMeshes()}),i.delayLoadState=M.a.DELAYLOADSTATE_LOADED,t._removePendingData(i)},function(){},t.offlineProvider,e),this},w.prototype.isInFrustum=function(e){return this.delayLoadState!==M.a.DELAYLOADSTATE_LOADING&&!!A.prototype.isInFrustum.call(this,e)&&(this._checkDelayState(),!0)},w.prototype.setMaterialByID=function(e){for(var t=this.getScene().materials,i=t.length-1;-1<i;i--)if(t[i].id===e)return this.material=t[i],this;var n=this.getScene().multiMaterials;for(i=n.length-1;-1<i;i--)if(n[i].id===e)return this.material=n[i],this;return this},w.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},w.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(x.b.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();for(var i=this.getVerticesData(x.b.PositionKind),n=new Array,r=0;r<i.length;r+=3)P.e.TransformCoordinates(P.e.FromArray(i,r),e).toArray(n,r);if(this.setVerticesData(x.b.PositionKind,n,this.getVertexBuffer(x.b.PositionKind).isUpdatable()),this.isVerticesDataPresent(x.b.NormalKind)){for(i=this.getVerticesData(x.b.NormalKind),n=[],r=0;r<i.length;r+=3)P.e.TransformNormal(P.e.FromArray(i,r),e).normalize().toArray(n,r);this.setVerticesData(x.b.NormalKind,n,this.getVertexBuffer(x.b.NormalKind).isUpdatable())}return e.m[0]*e.m[5]*e.m[10]<0&&this.flipFaces(),this.releaseSubMeshes(),this.subMeshes=t,this},w.prototype.bakeCurrentTransformIntoVertices=function(e){return void 0===e&&(e=!0),this.bakeTransformIntoVertices(this.computeWorldMatrix(!0)),this.resetLocalMatrix(e),this},Object.defineProperty(w.prototype,"_positions",{get:function(){return this._geometry?this._geometry._positions:null},enumerable:!1,configurable:!0}),w.prototype._resetPointsArrayCache=function(){return this._geometry&&this._geometry._resetPointsArrayCache(),this},w.prototype._generatePointsArray=function(){return!!this._geometry&&this._geometry._generatePointsArray()},w.prototype.clone=function(e,t,i,n){return void 0===e&&(e=""),void 0===t&&(t=null),void 0===n&&(n=!0),new w(e,this.getScene(),t,this,i,n)},w.prototype.dispose=function(e,t){void 0===t&&(t=!1),this.morphTargetManager=null,this._geometry&&this._geometry.releaseForMesh(this,!0);var i,n=this._internalMeshDataInfo;if(n._onBeforeDrawObservable&&n._onBeforeDrawObservable.clear(),n._onBeforeBindObservable&&n._onBeforeBindObservable.clear(),n._onBeforeRenderObservable&&n._onBeforeRenderObservable.clear(),n._onAfterRenderObservable&&n._onAfterRenderObservable.clear(),this._scene.useClonedMeshMap){if(n.meshMap)for(var r in n.meshMap)(i=n.meshMap[r])&&(i._internalMeshDataInfo._source=null,n.meshMap[r]=void 0);n._source&&n._source._internalMeshDataInfo.meshMap&&(n._source._internalMeshDataInfo.meshMap[this.uniqueId]=void 0)}else for(var o=0,a=this.getScene().meshes;o<a.length;o++)(i=a[o])._internalMeshDataInfo&&i._internalMeshDataInfo._source&&i._internalMeshDataInfo._source===this&&(i._internalMeshDataInfo._source=null);n._source=null,this._disposeInstanceSpecificData(),this._disposeThinInstanceSpecificData(),A.prototype.dispose.call(this,e,t)},w.prototype._disposeInstanceSpecificData=function(){},w.prototype._disposeThinInstanceSpecificData=function(){},w.prototype.applyDisplacementMap=function(e,o,a,s,c,l,u){var h=this;void 0===u&&(u=!1);var t=this.getScene();
1return d.b.LoadImage(e,function(e){var t=e.width,i=e.height,n=F.a.CreateCanvas(t,i).getContext("2d");n.drawImage(e,0,0);var r=n.getImageData(0,0,t,i).data;h.applyDisplacementMapFromBuffer(r,t,i,o,a,c,l,u),s&&s(h)},function(){},t.offlineProvider),this},w.prototype.applyDisplacementMapFromBuffer=function(e,t,i,n,r,o,a,s){if(void 0===s&&(s=!1),!this.isVerticesDataPresent(x.b.PositionKind)||!this.isVerticesDataPresent(x.b.NormalKind)||!this.isVerticesDataPresent(x.b.UVKind))return I.a.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;var c=this.getVerticesData(x.b.PositionKind,!0,!0),l=this.getVerticesData(x.b.NormalKind),u=this.getVerticesData(x.b.UVKind),h=P.e.Zero(),d=P.e.Zero(),p=P.d.Zero();o=o||P.d.Zero(),a=a||new P.d(1,1);for(var f=0;f<c.length;f+=3){P.e.FromArrayToRef(c,f,h),P.e.FromArrayToRef(l,f,d),P.d.FromArrayToRef(u,f/3*2,p);var m=4*((Math.abs(p.x*a.x+o.x)*t%t|0)+(Math.abs(p.y*a.y+o.y)*i%i|0)*t),_=e[m]/255*.3+e[1+m]/255*.59+e[2+m]/255*.11;d.normalize(),d.scaleInPlace(n+(r-n)*_),(h=h.add(d)).toArray(c,f)}return S.a.ComputeNormals(c,this.getIndices(),l),s?(this.setVerticesData(x.b.PositionKind,c),this.setVerticesData(x.b.NormalKind,l)):(this.updateVerticesData(x.b.PositionKind,c),this.updateVerticesData(x.b.NormalKind,l)),this},w.prototype.convertToFlatShadedMesh=function(){var e,t=this.getVerticesDataKinds(),i={},n={},r={},o=!1;for(d=0;d<t.length;d++){e=t[d];var a=this.getVertexBuffer(e);e!==x.b.NormalKind?(i[e]=a,n[e]=i[e].getData(),r[e]=[]):(o=a.isUpdatable(),t.splice(d,1),d--)}for(var s=this.subMeshes.slice(0),c=this.getIndices(),l=this.getTotalIndices(),u=0;u<l;u++)for(var h=c[u],d=0;d<t.length;d++)for(var p=i[e=t[d]].getStrideSize(),f=0;f<p;f++)r[e].push(n[e][h*p+f]);var m=[],_=r[x.b.PositionKind];for(u=0;u<l;u+=3){c[u]=u,c[u+1]=u+1,c[u+2]=u+2;for(var g=P.e.FromArray(_,3*u),v=P.e.FromArray(_,3*(u+1)),b=P.e.FromArray(_,3*(u+2)),y=g.subtract(v),T=b.subtract(v),E=P.e.Normalize(P.e.Cross(y,T)),S=0;S<3;S++)m.push(E.x),m.push(E.y),m.push(E.z)}for(this.setIndices(c),this.setVerticesData(x.b.NormalKind,m,o),d=0;d<t.length;d++)e=t[d],this.setVerticesData(e,r[e],i[e].isUpdatable());this.releaseSubMeshes();for(var A=0;A<s.length;A++){var C=s[A];R.a.AddToMesh(C.materialIndex,C.indexStart,C.indexCount,C.indexStart,C.indexCount,this)}return this.synchronizeInstances(),this},w.prototype.convertToUnIndexedMesh=function(){var e,t=this.getVerticesDataKinds(),i={},n={},r={};for(h=0;h<t.length;h++){e=t[h];var o=this.getVertexBuffer(e);i[e]=o,n[e]=i[e].getData(),r[e]=[]}for(var a=this.subMeshes.slice(0),s=this.getIndices(),c=this.getTotalIndices(),l=0;l<c;l++)for(var u=s[l],h=0;h<t.length;h++)for(var d=i[e=t[h]].getStrideSize(),p=0;p<d;p++)r[e].push(n[e][u*d+p]);for(l=0;l<c;l+=3)s[l]=l,s[l+1]=l+1,s[l+2]=l+2;for(this.setIndices(s),h=0;h<t.length;h++)e=t[h],this.setVerticesData(e,r[e],i[e].isUpdatable());this.releaseSubMeshes();for(var f=0;f<a.length;f++){var m=a[f];R.a.AddToMesh(m.materialIndex,m.indexStart,m.indexCount,m.indexStart,m.indexCount,this)}return this._unIndexed=!0,this.synchronizeInstances(),this},w.prototype.flipFaces=function(e){void 0===e&&(e=!1);var t,i,n=S.a.ExtractFromMesh(this);if(e&&this.isVerticesDataPresent(x.b.NormalKind)&&n.normals)for(t=0;t<n.normals.length;t++)n.normals[t]*=-1;if(n.indices)for(t=0;t<n.indices.length;t+=3)i=n.indices[t+1],n.indices[t+1]=n.indices[t+2],n.indices[t+2]=i;return n.applyToMesh(this,this.isVertexBufferUpdatable(x.b.PositionKind)),this},w.prototype.increaseVertices=function(e){var t=S.a.ExtractFromMesh(this),i=t.uvs,n=t.indices,r=t.positions,o=t.normals;if(null===n||null===r||null===o||null===i)I.a.Warn("VertexData contains null entries");else{for(var a,s,c=e+1,l=new Array,u=0;u<c+1;u++)l[u]=new Array;for(var h,d=new P.e(0,0,0),p=new P.e(0,0,0),f=new P.d(0,0),m=new Array,_=new Array,g=new Array,v=r.length,b=i.length,u=0;u<n.length;u+=3){_[0]=n[u],_[1]=n[u+1],_[2]=n[u+2];for(var y=0;y<3;y++)if(a=_[y],s=_[(y+1)%3],void 0===g[a]&&void 0===g[s]?(g[a]=new Array,g[s]=new Array):(void 0===g[a]&&(g[a]=new Array),void 0===g[s]&&(g[s]=new Array)),void 0===g[a][s]&&void 0===g[s][a]){g[a][s]=[],d.x=(r[3*s]-r[3*a])/c,d.y=(r[3*s+1]-r[3*a+1])/c,d.z=(r[3*s+2]-r[3*a+2])/c,p.x=(o[3*s]-o[3*a])/c,p.y=(o[3*s+1]-o[3*a+1])/c,p.z=(o[3*s+2]-o[3*a+2])/c,f.x=(i[2*s]-i[2*a])/c,f.y=(i[2*s+1]-i[2*a+1])/c,g[a][s].push(a);for(var T=1;T<c;T++)g[a][s].push(r.length/3),r[v]=r[3*a]+T*d.x,o[v++]=o[3*a]+T*p.x,r[v]=r[3*a+1]+T*d.y,o[v++]=o[3*a+1]+T*p.y,r[v]=r[3*a+2]+T*d.z,o[v++]=o[3*a+2]+T*p.z,i[b++]=i[2*a]+T*f.x,i[b++]=i[2*a+1]+T*f.y;g[a][s].push(s),g[s][a]=new Array,h=g[a][s].length;for(var E=0;E<h;E++)g[s][a][E]=g[a][s][h-1-E]}for(l[0][0]=n[u],l[1][0]=g[n[u]][n[u+1]][1],l[1][1]=g[n[u]][n[u+2]][1],T=2;T<c;T++)for(l[T][0]=g[n[u]][n[u+1]][T],l[T][T]=g[n[u]][n[u+2]][T],d.x=(r[3*l[T][T]]-r[3*l[T][0]])/T,d.y=(r[3*l[T][T]+1]-r[3*l[T][0]+1])/T,d.z=(r[3*l[T][T]+2]-r[3*l[T][0]+2])/T,p.x=(o[3*l[T][T]]-o[3*l[T][0]])/T,p.y=(o[3*l[T][T]+1]-o[3*l[T][0]+1])/T,p.z=(o[3*l[T][T]+2]-o[3*l[T][0]+2])/T,f.x=(i[2*l[T][T]]-i[2*l[T][0]])/T,f.y=(i[2*l[T][T]+1]-i[2*l[T][0]+1])/T,y=1;y<T;y++)l[T][y]=r.length/3,r[v]=r[3*l[T][0]]+y*d.x,o[v++]=o[3*l[T][0]]+y*p.x,r[v]=r[3*l[T][0]+1]+y*d.y,o[v++]=o[3*l[T][0]+1]+y*p.y,r[v]=r[3*l[T][0]+2]+y*d.z,o[v++]=o[3*l[T][0]+2]+y*p.z,i[b++]=i[2*l[T][0]]+y*f.x,i[b++]=i[2*l[T][0]+1]+y*f.y;for(l[c]=g[n[u+1]][n[u+2]],m.push(l[0][0],l[1][0],l[1][1]),T=1;T<c;T++){for(y=0;y<T;y++)m.push(l[T][y],l[T+1][y],l[T+1][y+1]),m.push(l[T][y],l[T+1][y+1],l[T][y+1]);m.push(l[T][y],l[T+1][y],l[T+1][y+1])}}t.indices=m,t.applyToMesh(this,this.isVertexBufferUpdatable(x.b.PositionKind))}},w.prototype.forceSharedVertices=function(){var e=S.a.ExtractFromMesh(this),t=e.uvs,i=e.indices,n=e.positions,r=e.colors;if(void 0===i||void 0===n||null===i||null===n)I.a.Warn("VertexData contains empty entries");else{for(var o,a,s=new Array,c=new Array,l=new Array,u=new Array,h=new Array,d=0,p={},f=0;f<i.length;f+=3){a=[i[f],i[f+1],i[f+2]],h=new Array;for(var m=0;m<3;m++){h[m]="";for(var _=0;_<3;_++)Math.abs(n[3*a[m]+_])<1e-8&&(n[3*a[m]+_]=0),h[m]+=n[3*a[m]+_]+"|"}if(h[0]!=h[1]&&h[0]!=h[2]&&h[1]!=h[2])for(m=0;m<3;m++){if(void 0===(o=p[h[m]])){for(p[h[m]]=d,o=d++,_=0;_<3;_++)s.push(n[3*a[m]+_]);if(null!=r)for(_=0;_<4;_++)u.push(r[4*a[m]+_]);if(null!=t)for(_=0;_<2;_++)l.push(t[2*a[m]+_])}c.push(o)}}var g=new Array;S.a.ComputeNormals(s,c,g),e.positions=s,e.indices=c,e.normals=g,null!=t&&(e.uvs=l),null!=r&&(e.colors=u),e.applyToMesh(this,this.isVertexBufferUpdatable(x.b.PositionKind))}},w._instancedMeshFactory=function(e,t){throw L.a.WarnImport("InstancedMesh")},w._PhysicsImpostorParser=function(e,t,i){throw L.a.WarnImport("PhysicsImpostor")},w.prototype.createInstance=function(e){var t=this.geometry;if(t&&1<t.meshes.length)for(var i=0,n=t.meshes.slice(0);i<n.length;i++){var r=n[i];r!==this&&r.makeGeometryUnique()}return w._instancedMeshFactory(e,this)},w.prototype.synchronizeInstances=function(){this._geometry&&1!==this._geometry.meshes.length&&this.instances.length&&this.makeGeometryUnique();for(var e=0;e<this.instances.length;e++)this.instances[e]._syncSubMeshes();return this},w.prototype.optimizeIndices=function(i){var n=this,r=this.getIndices(),e=this.getVerticesData(x.b.PositionKind);if(!e||!r)return this;for(var o=new Array,t=0;t<e.length;t+=3)o.push(P.e.FromArray(e,t));var a=new Array;return d.a.SyncAsyncForLoop(o.length,40,function(e){for(var t=o.length-1-e,i=o[t],n=0;n<t;++n){var r=o[n];if(i.equals(r)){a[t]=n;break}}},function(){for(var e=0;e<r.length;++e)r[e]=a[r[e]]||r[e];var t=n.subMeshes.slice(0);n.setIndices(r),n.subMeshes=t,i&&i(n)}),this},w.prototype.serialize=function(e){e.name=this.name,e.id=this.id,e.type=this.getClassName(),b.a&&b.a.HasTags(this)&&(e.tags=b.a.GetTags(this)),e.position=this.position.asArray(),this.rotationQuaternion?e.rotationQuaternion=this.rotationQuaternion.asArray():this.rotation&&(e.rotation=this.rotation.asArray()),e.scaling=this.scaling.asArray(),this._postMultiplyPivotMatrix?e.pivotMatrix=this.getPivotMatrix().asArray():e.localMatrix=this.getPivotMatrix().asArray(),e.isEnabled=this.isEnabled(!1),e.isVisible=this.isVisible,e.infiniteDistance=this.infiniteDistance,e.pickable=this.isPickable,e.receiveShadows=this.receiveShadows,e.billboardMode=this.billboardMode,e.visibility=this.visibility,e.checkCollisions=this.checkCollisions,e.isBlocker=this.isBlocker,e.overrideMaterialSideOrientation=this.overrideMaterialSideOrientation,this.parent&&(e.parentId=this.parent.id),e.isUnIndexed=this.isUnIndexed;var t=this._geometry;if(t){var i=t.id;e.geometryId=i,e.subMeshes=[];for(var n=0;n<this.subMeshes.length;n++){var r=this.subMeshes[n];e.subMeshes.push({materialIndex:r.materialIndex,verticesStart:r.verticesStart,verticesCount:r.verticesCount,indexStart:r.indexStart,indexCount:r.indexCount})}}this.material?this.material.doNotSerialize||(e.materialId=this.material.id):this.material=null,this.morphTargetManager&&(e.morphTargetManagerId=this.morphTargetManager.uniqueId),this.skeleton&&(e.skeletonId=this.skeleton.id),this.get
1Scene()._getComponent(N.a.NAME_PHYSICSENGINE)&&(a=this.getPhysicsImpostor())&&(e.physicsMass=a.getParam("mass"),e.physicsFriction=a.getParam("friction"),e.physicsRestitution=a.getParam("mass"),e.physicsImpostor=a.type),this.metadata&&(e.metadata=this.metadata),e.instances=[];for(var o=0;o<this.instances.length;o++){var a,s,c=this.instances[o];c.doNotSerialize||(s={name:c.name,id:c.id,isPickable:c.isPickable,checkCollisions:c.checkCollisions,position:c.position.asArray(),scaling:c.scaling.asArray()},c.parent&&(s.parentId=c.parent.id),c.rotationQuaternion?s.rotationQuaternion=c.rotationQuaternion.asArray():c.rotation&&(s.rotation=c.rotation.asArray()),!this.getScene()._getComponent(N.a.NAME_PHYSICSENGINE)||(a=c.getPhysicsImpostor())&&(s.physicsMass=a.getParam("mass"),s.physicsFriction=a.getParam("friction"),s.physicsRestitution=a.getParam("mass"),s.physicsImpostor=a.type),c.metadata&&(s.metadata=c.metadata),e.instances.push(s),h.a.AppendSerializedAnimations(c,s),s.ranges=c.serializeAnimationRanges())}if(this._thinInstanceDataStorage.instancesCount&&this._thinInstanceDataStorage.matrixData&&(e.thinInstances={instancesCount:this._thinInstanceDataStorage.instancesCount,matrixData:Array.from(this._thinInstanceDataStorage.matrixData),matrixBufferSize:this._thinInstanceDataStorage.matrixBufferSize},this._userThinInstanceBuffersStorage)){var l={data:{},sizes:{},strides:{}};for(var u in this._userThinInstanceBuffersStorage.data)l.data[u]=Array.from(this._userThinInstanceBuffersStorage.data[u]),l.sizes[u]=this._userThinInstanceBuffersStorage.sizes[u],l.strides[u]=this._userThinInstanceBuffersStorage.strides[u];e.thinInstances.userThinInstance=l}h.a.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.layerMask=this.layerMask,e.alphaIndex=this.alphaIndex,e.hasVertexAlpha=this.hasVertexAlpha,e.overlayAlpha=this.overlayAlpha,e.overlayColor=this.overlayColor.asArray(),e.renderOverlay=this.renderOverlay,e.applyFog=this.applyFog,this.actionManager&&(e.actions=this.actionManager.serialize(this.name))},w.prototype._syncGeometryWithMorphTargetManager=function(){if(this.geometry){this._markSubMeshesAsAttributesDirty();var e=this._internalMeshDataInfo._morphTargetManager;if(e&&e.vertexCount){if(e.vertexCount!==this.getTotalVertices())return I.a.Error("Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count."),void(this.morphTargetManager=null);for(var t=0;t<e.numInfluencers;t++){var i=e.getActiveTarget(t),n=i.getPositions();if(!n)return void I.a.Error("Invalid morph target. Target must have positions.");this.geometry.setVerticesData(x.b.PositionKind+t,n,!1,3);var r=i.getNormals();r&&this.geometry.setVerticesData(x.b.NormalKind+t,r,!1,3);var o=i.getTangents();o&&this.geometry.setVerticesData(x.b.TangentKind+t,o,!1,3);var a=i.getUVs();a&&this.geometry.setVerticesData(x.b.UVKind+"_"+t,a,!1,2)}}else for(t=0;this.geometry.isVerticesDataPresent(x.b.PositionKind+t);)this.geometry.removeVerticesData(x.b.PositionKind+t),this.geometry.isVerticesDataPresent(x.b.NormalKind+t)&&this.geometry.removeVerticesData(x.b.NormalKind+t),this.geometry.isVerticesDataPresent(x.b.TangentKind+t)&&this.geometry.removeVerticesData(x.b.TangentKind+t),this.geometry.isVerticesDataPresent(x.b.UVKind+t)&&this.geometry.removeVerticesData(x.b.UVKind+"_"+t),t++}},w.Parse=function(e,t,i){var n;if((n=e.type&&"GroundMesh"===e.type?w._GroundMeshParser(e,t):new w(e.name,t)).id=e.id,b.a&&b.a.AddTagsTo(n,e.tags),n.position=P.e.FromArray(e.position),void 0!==e.metadata&&(n.metadata=e.metadata),e.rotationQuaternion?n.rotationQuaternion=P.b.FromArray(e.rotationQuaternion):e.rotation&&(n.rotation=P.e.FromArray(e.rotation)),n.scaling=P.e.FromArray(e.scaling),e.localMatrix?n.setPreTransformMatrix(P.a.FromArray(e.localMatrix)):e.pivotMatrix&&n.setPivotMatrix(P.a.FromArray(e.pivotMatrix)),n.setEnabled(e.isEnabled),n.isVisible=e.isVisible,n.infiniteDistance=e.infiniteDistance,n.showBoundingBox=e.showBoundingBox,n.showSubMeshesBoundingBox=e.showSubMeshesBoundingBox,void 0!==e.applyFog&&(n.applyFog=e.applyFog),void 0!==e.pickable&&(n.isPickable=e.pickable),void 0!==e.alphaIndex&&(n.alphaIndex=e.alphaIndex),n.receiveShadows=e.receiveShadows,n.billboardMode=e.billboardMode,void 0!==e.visibility&&(n.visibility=e.visibility),n.checkCollisions=e.checkCollisions,n.overrideMaterialSideOrientation=e.overrideMaterialSideOrientation,void 0!==e.isBlocker&&(n.isBlocker=e.isBlocker),n._shouldGenerateFlatShading=e.useFlatShading,e.freezeWorldMatrix&&(n._waitingData.freezeWorldMatrix=e.freezeWorldMatrix),e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.actions&&(n._waitingData.actions=e.actions),void 0!==e.overlayAlpha&&(n.overlayAlpha=e.overlayAlpha),void 0!==e.overlayColor&&(n.overlayColor=p.a.FromArray(e.overlayColor)),void 0!==e.renderOverlay&&(n.renderOverlay=e.renderOverlay),n.isUnIndexed=!!e.isUnIndexed,n.hasVertexAlpha=e.hasVertexAlpha,e.delayLoadingFile?(n.delayLoadState=M.a.DELAYLOADSTATE_NOTLOADED,n.delayLoadingFile=i+e.delayLoadingFile,n._boundingInfo=new T.a(P.e.FromArray(e.boundingBoxMinimum),P.e.FromArray(e.boundingBoxMaximum)),e._binaryInfo&&(n._binaryInfo=e._binaryInfo),n._delayInfo=[],e.hasUVs&&n._delayInfo.push(x.b.UVKind),e.hasUVs2&&n._delayInfo.push(x.b.UV2Kind),e.hasUVs3&&n._delayInfo.push(x.b.UV3Kind),e.hasUVs4&&n._delayInfo.push(x.b.UV4Kind),e.hasUVs5&&n._delayInfo.push(x.b.UV5Kind),e.hasUVs6&&n._delayInfo.push(x.b.UV6Kind),e.hasColors&&n._delayInfo.push(x.b.ColorKind),e.hasMatricesIndices&&n._delayInfo.push(x.b.MatricesIndicesKind),e.hasMatricesWeights&&n._delayInfo.push(x.b.MatricesWeightsKind),n._delayLoadingFunction=y.a._ImportGeometry,O.a.ForceFullSceneLoadingForIncremental&&n._checkDelayState()):y.a._ImportGeometry(e,n),e.materialId?n.setMaterialByID(e.materialId):n.material=null,-1<e.morphTargetManagerId&&(n.morphTargetManager=t.getMorphTargetManagerById(e.morphTargetManagerId)),-1<e.skeletonId&&(n.skeleton=t.getLastSkeletonByID(e.skeletonId),e.numBoneInfluencers&&(n.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var r=0;r<e.animations.length;r++){var o=e.animations[r];(l=D.a.GetClass("BABYLON.Animation"))&&n.animations.push(l.Parse(o))}f.a.ParseAnimationRanges(n,e,t)}if(e.autoAnimate&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),e.layerMask&&!isNaN(e.layerMask)?n.layerMask=Math.abs(parseInt(e.layerMask)):n.layerMask=268435455,e.physicsImpostor&&w._PhysicsImpostorParser(t,n,e),e.lodMeshIds&&(n._waitingData.lods={ids:e.lodMeshIds,distances:e.lodDistances?e.lodDistances:null,coverages:e.lodCoverages?e.lodCoverages:null}),e.instances)for(var a=0;a<e.instances.length;a++){var s=e.instances[a],c=n.createInstance(s.name);if(s.id&&(c.id=s.id),b.a&&(s.tags?b.a.AddTagsTo(c,s.tags):b.a.AddTagsTo(c,e.tags)),c.position=P.e.FromArray(s.position),void 0!==s.metadata&&(c.metadata=s.metadata),s.parentId&&(c._waitingParentId=s.parentId),void 0!==s.isPickable&&null!==s.isPickable&&(c.isPickable=s.isPickable),s.rotationQuaternion?c.rotationQuaternion=P.b.FromArray(s.rotationQuaternion):s.rotation&&(c.rotation=P.e.FromArray(s.rotation)),c.scaling=P.e.FromArray(s.scaling),null!=s.checkCollisions&&null!=s.checkCollisions&&(c.checkCollisions=s.checkCollisions),null!=s.pickable&&null!=s.pickable&&(c.isPickable=s.pickable),null!=s.showBoundingBox&&null!=s.showBoundingBox&&
1(c.showBoundingBox=s.showBoundingBox),null!=s.showSubMeshesBoundingBox&&null!=s.showSubMeshesBoundingBox&&(c.showSubMeshesBoundingBox=s.showSubMeshesBoundingBox),null!=s.alphaIndex&&null!=s.showSubMeshesBoundingBox&&(c.alphaIndex=s.alphaIndex),s.physicsImpostor&&w._PhysicsImpostorParser(t,c,s),s.animations){for(r=0;r<s.animations.length;r++){var l,o=s.animations[r];(l=D.a.GetClass("BABYLON.Animation"))&&c.animations.push(l.Parse(o))}f.a.ParseAnimationRanges(c,s,t),s.autoAnimate&&t.beginAnimation(c,s.autoAnimateFrom,s.autoAnimateTo,s.autoAnimateLoop,s.autoAnimateSpeed||1)}}if(e.thinInstances){var u=e.thinInstances;if(u.matrixData?(n.thinInstanceSetBuffer("matrix",new Float32Array(u.matrixData),16,!1),n._thinInstanceDataStorage.matrixBufferSize=u.matrixBufferSize,n._thinInstanceDataStorage.instancesCount=u.instancesCount):n._thinInstanceDataStorage.matrixBufferSize=u.matrixBufferSize,e.thinInstances.userThinInstance){var h=e.thinInstances.userThinInstance;for(var d in h.data)n.thinInstanceSetBuffer(d,new Float32Array(h.data[d]),h.strides[d],!1),n._userThinInstanceBuffersStorage.sizes[d]=h.sizes[d]}}return n},w.CreateRibbon=function(e,t,i,n,r,o,a,s,c){throw L.a.WarnImport("MeshBuilder")},w.CreateDisc=function(e,t,i,n,r,o){throw void 0===n&&(n=null),L.a.WarnImport("MeshBuilder")},w.CreateBox=function(e,t,i,n,r){throw void 0===i&&(i=null),L.a.WarnImport("MeshBuilder")},w.CreateSphere=function(e,t,i,n,r,o){throw L.a.WarnImport("MeshBuilder")},w.CreateHemisphere=function(e,t,i,n){throw L.a.WarnImport("MeshBuilder")},w.CreateCylinder=function(e,t,i,n,r,o,a,s,c){throw L.a.WarnImport("MeshBuilder")},w.CreateTorus=function(e,t,i,n,r,o,a){throw L.a.WarnImport("MeshBuilder")},w.CreateTorusKnot=function(e,t,i,n,r,o,a,s,c,l){throw L.a.WarnImport("MeshBuilder")},w.CreateLines=function(e,t,i,n,r){throw void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=null),L.a.WarnImport("MeshBuilder")},w.CreateDashedLines=function(e,t,i,n,r,o,a,s){throw void 0===o&&(o=null),L.a.WarnImport("MeshBuilder")},w.CreatePolygon=function(e,t,i,n,r,o,a){throw void 0===a&&(a=earcut),L.a.WarnImport("MeshBuilder")},w.ExtrudePolygon=function(e,t,i,n,r,o,a,s){throw void 0===s&&(s=earcut),L.a.WarnImport("MeshBuilder")},w.ExtrudeShape=function(e,t,i,n,r,o,a,s,c,l){throw void 0===a&&(a=null),L.a.WarnImport("MeshBuilder")},w.ExtrudeShapeCustom=function(e,t,i,n,r,o,a,s,c,l,u,h){throw L.a.WarnImport("MeshBuilder")},w.CreateLathe=function(e,t,i,n,r,o,a){throw L.a.WarnImport("MeshBuilder")},w.CreatePlane=function(e,t,i,n,r){throw L.a.WarnImport("MeshBuilder")},w.CreateGround=function(e,t,i,n,r,o){throw L.a.WarnImport("MeshBuilder")},w.CreateTiledGround=function(e,t,i,n,r,o,a,s,c){throw L.a.WarnImport("MeshBuilder")},w.CreateGroundFromHeightMap=function(e,t,i,n,r,o,a,s,c,l,u){throw L.a.WarnImport("MeshBuilder")},w.CreateTube=function(e,t,i,n,r,o,a,s,c,l){throw L.a.WarnImport("MeshBuilder")},w.CreatePolyhedron=function(e,t,i){throw L.a.WarnImport("MeshBuilder")},w.CreateIcoSphere=function(e,t,i){throw L.a.WarnImport("MeshBuilder")},w.CreateDecal=function(e,t,i,n,r,o){throw L.a.WarnImport("MeshBuilder")},w.prototype.setPositionsForCPUSkinning=function(){var e=this._internalMeshDataInfo;if(!e._sourcePositions){var t=this.getVerticesData(x.b.PositionKind);if(!t)return e._sourcePositions;e._sourcePositions=new Float32Array(t),this.isVertexBufferUpdatable(x.b.PositionKind)||this.setVerticesData(x.b.PositionKind,t,!0)}return e._sourcePositions},w.prototype.setNormalsForCPUSkinning=function(){var e=this._internalMeshDataInfo;if(!e._sourceNormals){var t=this.getVerticesData(x.b.NormalKind);if(!t)return e._sourceNormals;e._sourceNormals=new Float32Array(t),this.isVertexBufferUpdatable(x.b.NormalKind)||this.setVerticesData(x.b.NormalKind,t,!0)}return e._sourceNormals},w.prototype.applySkeleton=function(e){if(!this.geometry)return this;if(this.geometry._softwareSkinningFrameId==this.getScene().getFrameId())return this;if(this.geometry._softwareSkinningFrameId=this.getScene().getFrameId(),!this.isVerticesDataPresent(x.b.PositionKind))return this;if(!this.isVerticesDataPresent(x.b.NormalKind))return this;if(!this.isVerticesDataPresent(x.b.MatricesIndicesKind))return this;if(!this.isVerticesDataPresent(x.b.MatricesWeightsKind))return this;var t,i=this._internalMeshDataInfo;i._sourcePositions||(t=this.subMeshes.slice(),this.setPositionsForCPUSkinning(),this.subMeshes=t),i._sourceNormals||this.setNormalsForCPUSkinning();var n=this.getVerticesData(x.b.PositionKind);if(!n)return this;n instanceof Float32Array||(n=new Float32Array(n));var r=this.getVerticesData(x.b.NormalKind);if(!r)return this;r instanceof Float32Array||(r=new Float32Array(r));var o=this.getVerticesData(x.b.MatricesIndicesKind),a=this.getVerticesData(x.b.MatricesWeightsKind);if(!a||!o)return this;for(var s=4<this.numBoneInfluencers,c=s?this.getVerticesData(x.b.MatricesIndicesExtraKind):null,l=s?this.getVerticesData(x.b.MatricesWeightsExtraKind):null,u=e.getTransformMatrices(this),h=P.e.Zero(),d=new P.a,p=new P.a,f=0,m=0;m<n.length;m+=3,f+=4){for(var _,g=0;g<4;g++)0<(_=a[f+g])&&(P.a.FromFloat32ArrayToRefScaled(u,Math.floor(16*o[f+g]),_,p),d.addToSelf(p));if(s)for(g=0;g<4;g++)0<(_=l[f+g])&&(P.a.FromFloat32ArrayToRefScaled(u,Math.floor(16*c[f+g]),_,p),d.addToSelf(p));P.e.TransformCoordinatesFromFloatsToRef(i._sourcePositions[m],i._sourcePositions[m+1],i._sourcePositions[m+2],d,h),h.toArray(n,m),P.e.TransformNormalFromFloatsToRef(i._sourceNormals[m],i._sourceNormals[m+1],i._sourceNormals[m+2],d,h),h.toArray(r,m),d.reset()}return this.updateVerticesData(x.b.PositionKind,n),this.updateVerticesData(x.b.NormalKind,r),this},w.MinMax=function(e){var i=null,n=null;return e.forEach(function(e){var t=e.getBoundingInfo().boundingBox;i&&n?(i.minimizeInPlace(t.minimumWorld),n.maximizeInPlace(t.maximumWorld)):(i=t.minimumWorld,n=t.maximumWorld)}),i&&n?{min:i,max:n}:{min:P.e.Zero(),max:P.e.Zero()}},w.Center=function(e){var t=e instanceof Array?w.MinMax(e):e;return P.e.Center(t.min,t.max)},w.MergeMeshes=function(e,t,i,n,r,o){var a,s,c;if(void 0===t&&(t=!0),!i)for(var l=0,u=0;u<e.length;u++)if(e[u]&&65536<=(l+=e[u].getTotalVertices()))return I.a.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null;o&&(c=null,r=!1);var h,d=new Array,p=new Array,f=null,m=new Array,_=null;for(u=0;
1u<e.length;u++)if(e[u]){var g=e[u];if(g.isAnInstance)return I.a.Warn("Cannot merge instance meshes."),null;var v=g.computeWorldMatrix(!0);if((h=S.a.ExtractFromMesh(g,!0,!0)).transform(v),f?f.merge(h,i):(f=h,_=g),r&&m.push(g.getTotalIndices()),o)if(g.material){var b=g.material;if(b instanceof C.a){for(s=0;s<b.subMaterials.length;s++)d.indexOf(b.subMaterials[s])<0&&d.push(b.subMaterials[s]);for(a=0;a<g.subMeshes.length;a++)p.push(d.indexOf(b.subMaterials[g.subMeshes[a].materialIndex])),m.push(g.subMeshes[a].indexCount)}else for(d.indexOf(b)<0&&d.push(b),a=0;a<g.subMeshes.length;a++)p.push(d.indexOf(b)),m.push(g.subMeshes[a].indexCount)}else for(a=0;a<g.subMeshes.length;a++)p.push(0),m.push(g.subMeshes[a].indexCount)}if(_=_,n=n||new w(_.name+"_merged",_.getScene()),f.applyToMesh(n),n.checkCollisions=_.checkCollisions,n.overrideMaterialSideOrientation=_.overrideMaterialSideOrientation,t)for(u=0;u<e.length;u++)e[u]&&e[u].dispose();if(r||o){n.releaseSubMeshes();for(var y=u=0;u<m.length;)R.a.CreateFromIndices(0,y,m[u],n),y+=m[u],u++}if(o){for((c=new C.a(_.name+"_merged",_.getScene())).subMaterials=d,a=0;a<n.subMeshes.length;a++)n.subMeshes[a].materialIndex=p[a];n.material=c}else n.material=_.material;return n}
1,w.prototype.addInstance=function(e){e._indexInSourceMeshInstanceArray=this.instances.length,this.instances.push(e)},w.prototype.removeInstance=function(e){var t,i=e._indexInSourceMeshInstanceArray;-1!=i&&(i!==this.instances.length-1&&(t=this.instances[this.instances.length-1],(this.instances[i]=t)._indexInSourceMeshInstanceArray=i),e._indexInSourceMeshInstanceArray=-1,this.instances.pop())},w.FRONTSIDE=S.a.FRONTSIDE,w.BACKSIDE=S.a.BACKSIDE,w.DOUBLESIDE=S.a.DOUBLESIDE,w.DEFAULTSIDE=S.a.DEFAULTSIDE,w.NO_CAP=0,w.CAP_START=1,w.CAP_END=2,w.CAP_ALL=3,w.NO_FLIP=0,w.FLIP_TILE=1,w.ROTATE_TILE=2,w.FLIP_ROW=3,w.ROTATE_ROW=4,w.FLIP_N_ROTATE_TILE=5,w.FLIP_N_ROTATE_ROW=6,w.CENTER=0,w.LEFT=1,w.RIGHT=2,w.TOP=3,w.BOTTOM=4,w._GroundMeshParser=function(e,t){throw L.a.WarnImport("GroundMesh")},w);function w(e,t,i,n,r,o){void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=!0);var a,s,c,l=A.call(this,e,t)||this;if(l._internalMeshDataInfo=new g,l.delayLoadState=M.a.DELAYLOADSTATE_NONE,l.instances=new Array,l._creationDataStorage=null,l._geometry=null,l._instanceDataStorage=new m,l._thinInstanceDataStorage=new _,l._effectiveMaterial=null,l._shouldGenerateFlatShading=!1,l._originalBuilderSideOrientation=w.DEFAULTSIDE,l.overrideMaterialSideOrientation=null,t=l.getScene(),n){if(n._geometry&&n._geometry.applyToMesh(l),v.a.DeepCopy(n,l,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","source","worldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances"],["_poseMatrix"]),l._internalMeshDataInfo._source=n,t.useClonedMeshMap&&(n._internalMeshDataInfo.meshMap||(n._internalMeshDataInfo.meshMap={}),n._internalMeshDataInfo.meshMap[l.uniqueId]=l),l._originalBuilderSideOrientation=n._originalBuilderSideOrientation,l._creationDataStorage=n._creationDataStorage,n._ranges){var u=n._ranges;for(var e in u)u.hasOwnProperty(e)&&u[e]&&l.createAnimationRange(e,u[e].from,u[e].to)}if(n.metadata&&n.metadata.clone?l.metadata=n.metadata.clone():l.metadata=n.metadata,b.a&&b.a.HasTags(n)&&b.a.AddTagsTo(l,b.a.GetTags(n,!0)),l.setEnabled(n.isEnabled()),l.parent=n.parent,l.setPivotMatrix(n.getPivotMatrix()),l.id=e+"."+n.id,l.material=n.material,!r)for(var h=n.getDescendants(!0),d=0;d<h.length;d++){var p=h[d];p.clone&&p.clone(e+"."+p.name,l)}for(n.morphTargetManager&&(l.morphTargetManager=n.morphTargetManager),t.getPhysicsEngine&&(s=t.getPhysicsEngine(),o&&s&&((c=s.getImpostorForPhysicsObject(n))&&(l.physicsImpostor=c.clone(l)))),a=0;a<t.particleSystems.length;a++){var f=t.particleSystems[a];f.emitter===n&&f.clone(f.name,l)}l.refreshBoundingInfo(),l.computeWorldMatrix(!0)}return null!==i&&(l.parent=i),l._instanceDataStorage.hardwareInstancedRendering=l.getEngine().getCaps().instancedArrays,l}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var m,n=i(1),l=i(3),_=i(6),r=i(0),o=i(62),g=i(2),u=i(11),a=i(21),v=i(173),h=i(197),d=i(80),p=i(41),s=(m=o.a,Object(n.d)(b,m),Object.defineProperty(b.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"invertY",{get:function(){return this._invertY},enumerable:!1,configurable:!0}),b.prototype.updateURL=function(e,t,i){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(g.a.MATERIAL_TextureDirtyFlag)),this.name&&!p.a.StartsWith(this.name,"data:")||(this.name=e),this.url=e,this._buffer=t,this.delayLoadState=g.a.DELAYLOADSTATE_NOTLOADED,i&&(this._delayedOnLoad=i),this.delayLoad()},b.prototype.delayLoad=function(){var e;this.delayLoadState!==g.a.DELAYLOADSTATE_NOTLOADED||(e=this.getScene())&&(this.delayLoadState=g.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY),this._texture?this._delayedOnLoad&&(this._texture.isReady?v.a.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,null,this._mimeType),this._deleteBuffer&&delete this._buffer),this._delayedOnLoad=null,this._delayedOnError=null)},b.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,r.e.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,n.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,n.z+=this.wRotationCenter},b.prototype.getTextureMatrix=function(e){var t=this;if(void 0===e&&(e=1),this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===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*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedTextureMatrix||(this._cachedTextureMatrix=r.a.Zero(),this._rowGenerationMatrix=new r.a,this._t0=r.e.Zero(),this._t1=r.e.Zero(),this._t2=r.e.Zero()),r.a.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),r.a.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix);var i=this.getScene();return i&&i.markAllMaterialsAsDirty(g.a.MATERIAL_TextureDirtyFlag,function(e){return e.hasTexture(t)}),this._cachedTextureMatrix},b.prototype.getReflectionTextureMatrix=function(){var t=this,e=this.getScene();if(!e)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!==b.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===e.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=r.a.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=r.a.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case b.PLANAR_MODE:r.a.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case b.PROJECTION_MODE:r.a.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var i=e.getProjectionMatrix();this._cachedProjectionMatrixId=i.updateFlag,i.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:r.a.IdentityToRef(this._cachedTextureMatrix)}return e.markAllMaterialsAsDirty(g.a.MATERIAL_TextureDirtyFlag,function(e){return-1!==e.getActiveTextures().indexOf(t)}),this._cachedTextureMatrix},b.prototype.clone=function(){var e=this;return l.a.Clone(function(){return new b(e._texture?e._texture.url:null,e.getSce
1ne(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture?e._texture._buffer:void 0)},this)},b.prototype.serialize=function(){var e=this.name;b.SerializeBuffers||p.a.StartsWith(this.name,"data:")&&(this.name=""),p.a.StartsWith(this.name,"data:")&&this.url===this.name&&(this.url="");var t=m.prototype.serialize.call(this);return t?(b.SerializeBuffers&&("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)?(t.base64String=this._buffer,t.name=t.name.replace("data:","")):this.url&&p.a.StartsWith(this.url,"data:")&&this._buffer instanceof Uint8Array&&(t.base64String="data:image/png;base64,"+p.a.EncodeArrayBufferToBase64(this._buffer))),t.invertY=this._invertY,t.samplingMode=this.samplingMode,this.name=e,t):null},b.prototype.getClassName=function(){return"Texture"},b.prototype.dispose=function(){m.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},b.Parse=function(a,s,c){if(a.customType){var e=h.a.Instantiate(a.customType).Parse(a,s,c);return a.samplingMode&&e.updateSamplingMode&&e._samplingMode&&e._samplingMode!==a.samplingMode&&e.updateSamplingMode(a.samplingMode),e}if(a.isCube&&!a.isRenderTarget)return b._CubeTextureParser(a,s,c);if(!a.name&&!a.isRenderTarget)return null;var t,i=l.a.Parse(function(){var e,t=!0;if(a.noMipmap&&(t=!1),a.mirrorPlane){var i=b._CreateMirror(a.name,a.renderTargetSize,s,t);return i._waitingRenderList=a.renderList,i.mirrorPlane=d.a.FromArray(a.mirrorPlane),i}if(a.isRenderTarget){var n=null;if(a.isCube){if(s.reflectionProbes)for(var r=0;r<s.reflectionProbes.length;r++){var o=s.reflectionProbes[r];if(o.name===a.name)return o.cubeTexture}}else(n=b._CreateRenderTargetTexture(a.name,a.renderTargetSize,s,t))._waitingRenderList=a.renderList;return n}return a.base64String?b.CreateFromBase64String(a.base64String,a.name,s,!t,a.invertY):(e=void 0,e=a.name&&0<a.name.indexOf("://")?a.name:c+a.name,(p.a.StartsWith(a.url,"data:")||b.UseSerializedUrlIfAny&&a.url)&&(e=a.url),new b(e,s,!t,a.invertY))},a,s);if(i&&i._texture&&(i._texture._cachedWrapU=null,i._texture._cachedWrapV=null,i._texture._cachedWrapR=null),a.samplingMode&&(t=a.samplingMode,i&&i.samplingMode!==t&&i.updateSamplingMode(t)),i&&a.animations)for(var n=0;n<a.animations.length;n++){var r=a.animations[n],o=u.a.GetClass("BABYLON.Animation");o&&i.animations.push(o.Parse(r))}return i},b.CreateFromBase64String=function(e,t,i,n,r,o,a,s,c){return void 0===o&&(o=b.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=null),void 0===s&&(s=null),void 0===c&&(c=g.a.TEXTUREFORMAT_RGBA),new b("data:"+t,i,n,r,o,a,s,e,!1,c)},b.LoadFromDataString=function(e,t,i,n,r,o,a,s,c,l){return void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===a&&(a=b.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=null),void 0===c&&(c=null),void 0===l&&(l=g.a.TEXTUREFORMAT_RGBA),"data:"!==e.substr(0,5)&&(e="data:"+e),new b(e,i,r,o,a,s,c,t,n,l)},b.SerializeBuffers=!0,b._CubeTextureParser=function(e,t,i){throw a.a.WarnImport("CubeTexture")},b._CreateMirror=function(e,t,i,n){throw a.a.WarnImport("MirrorTexture")},b._CreateRenderTargetTexture=function(e,t,i,n){throw a.a.WarnImport("RenderTargetTexture")},b.NEAREST_SAMPLINGMODE=g.a.TEXTURE_NEAREST_SAMPLINGMODE,b.NEAREST_NEAREST_MIPLINEAR=g.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,b.BILINEAR_SAMPLINGMODE=g.a.TEXTURE_BILINEAR_SAMPLINGMODE,b.LINEAR_LINEAR_MIPNEAREST=g.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,b.TRILINEAR_SAMPLINGMODE=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE,b.LINEAR_LINEAR_MIPLINEAR=g.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,b.NEAREST_NEAREST_MIPNEAREST=g.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,b.NEAREST_LINEAR_MIPNEAREST=g.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,b.NEAREST_LINEAR_MIPLINEAR=g.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,b.NEAREST_LINEAR=g.a.TEXTURE_NEAREST_LINEAR,b.NEAREST_NEAREST=g.a.TEXTURE_NEAREST_NEAREST,b.LINEAR_NEAREST_MIPNEAREST=g.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,b.LINEAR_NEAREST_MIPLINEAR=g.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,b.LINEAR_LINEAR=g.a.TEXTURE_LINEAR_LINEAR,b.LINEAR_NEAREST=g.a.TEXTURE_LINEAR_NEAREST,b.EXPLICIT_MODE=g.a.TEXTURE_EXPLICIT_MODE,b.SPHERICAL_MODE=g.a.TEXTURE_SPHERICAL_MODE,b.PLANAR_MODE=g.a.TEXTURE_PLANAR_MODE,b.CUBIC_MODE=g.a.TEXTURE_CUBIC_MODE,b.PROJECTION_MODE=g.a.TEXTURE_PROJECTION_MODE,b.SKYBOX_MODE=g.a.TEXTURE_SKYBOX_MODE,b.INVCUBIC_MODE=g.a.TEXTURE_INVCUBIC_MODE,b.EQUIRECTANGULAR_MODE=g.a.TEXTURE_EQUIRECTANGULAR_MODE,b.FIXED_EQUIRECTANGULAR_MODE=g.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,b.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=g.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,b.CLAMP_ADDRESSMODE=g.a.TEXTURE_CLAMP_ADDRESSMODE,b.WRAP_ADDRESSMODE=g.a.TEXTURE_WRAP_ADDRESSMODE,b.MIRROR_ADDRESSMODE=g.a.TEXTURE_MIRROR_ADDRESSMODE,b.UseSerializedUrlIfAny=!1,Object(n.c)([Object(l.c)()],b.prototype,"url",void 0),Object(n.c)([Object(l.c)()],b.prototype,"uOffset",void 0),Object(n.c)([Object(l.c)()],b.prototype,"vOffset",void 0),Object(n.c)([Object(l.c)()],b.prototype,"uScale",void 0),Object(n.c)([Object(l.c)()],b.prototype,"vScale",void 0),Object(n.c)([Object(l.c)()],b.prototype,"uAng",void 0),Object(n.c)([Object(l.c)()],b.prototype,"vAng",void 0),Object(n.c)([Object(l.c)()],b.prototype,"wAng",void 0),Object(n.c)([Object(l.c)()],b.prototype,"uRotationCenter",void 0),Object(n.c)([Object(l.c)()],b.prototype,"vRotationCenter",void 0),Object(n.c)([Object(l.c)()],b.prototype,"wRotationCenter",void 0),Object(n.c)([Object(l.c)()],b.prototype,"isBlocking",null),b);function b(e,t,i,n,r,o,a,s,c,l,u){void 0===i&&(i=!1),void 0===n&&(n=!0),void 0===r&&(r=b.TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===c&&(c=!1);var h=m.call(this,t)||this;h.url=null,h.uOffset=0,h.vOffset=0,h.uScale=1,h.vScale=1,h.uAng=0,h.vAng=0,h.wAng=0,h.uRotationCenter=.5,h.vRotationCenter=.5,h.wRotationCenter=.5,h.inspectableCustomProperties=null,h._noMipmap=!1,h._invertY=!1,h._rowGenerationMatrix=null,h._cachedTextureMatrix=null,h._projectionModeMatrix=null,h._t0=null,h._t1=null,h._t2
1=null,h._cachedUOffset=-1,h._cachedVOffset=-1,h._cachedUScale=0,h._cachedVScale=0,h._cachedUAng=-1,h._cachedVAng=-1,h._cachedWAng=-1,h._cachedProjectionMatrixId=-1,h._cachedCoordinatesMode=-1,h._initialSamplingMode=b.BILINEAR_SAMPLINGMODE,h._buffer=null,h._deleteBuffer=!1,h._format=null,h._delayedOnLoad=null,h._delayedOnError=null,h.onLoadObservable=new _.c,h._isBlocking=!0,h.name=e||"",h.url=e,h._noMipmap=i,h._invertY=n,h._initialSamplingMode=r,h._buffer=s,h._deleteBuffer=c,h._mimeType=u,l&&(h._format=l);var d=h.getScene(),p=h._getEngine();if(!p)return h;p.onBeforeTextureInitObservable.notifyObservers(h);function f(){h._texture&&(h._texture._invertVScale&&(h.vScale*=-1,h.vOffset+=1),null!==h._texture._cachedWrapU&&(h.wrapU=h._texture._cachedWrapU,h._texture._cachedWrapU=null),null!==h._texture._cachedWrapV&&(h.wrapV=h._texture._cachedWrapV,h._texture._cachedWrapV=null),null!==h._texture._cachedWrapR&&(h.wrapR=h._texture._cachedWrapR,h._texture._cachedWrapR=null)),h.onLoadObservable.hasObservers()&&h.onLoadObservable.notifyObservers(h),o&&o(),!h.isBlocking&&d&&d.resetCachedMaterial()}return h.url?(h._texture=h._getFromCache(h.url,i,r,n),h._texture?h._texture.isReady?v.a.SetImmediate(f):h._texture.onLoadedObservable.add(f):d&&d.useDelayedTextureLoading?(h.delayLoadState=g.a.DELAYLOADSTATE_NOTLOADED,h._delayedOnLoad=f,h._delayedOnError=a):(h._texture=p.createTexture(h.url,i,n,d,r,f,a,h._buffer,void 0,h._format,null,u),c&&delete h._buffer)):(h._delayedOnLoad=f,h._delayedOnError=a),h}l.a._TextureParser=s.Parse},function(e,t,i){"use strict";i.d(t,"a",function(){return s}),i.d(t,"b",function(){return c}),i.d(t,"c",function(){return l});var o=i(14),n=i(32),r=i(50),a=i(11),s=(d.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},d.prototype.getClassName=function(){return"Color3"},d.prototype.getHashCode=function(){var e=255*this.r|0;return 397*(e=397*e^(255*this.g|0))^(255*this.b|0)},d.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},d.prototype.toColor4=function(e){return void 0===e&&(e=1),new c(this.r,this.g,this.b,e)},d.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},d.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},d.prototype.multiply=function(e){return new d(this.r*e.r,this.g*e.g,this.b*e.b)},d.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},d.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},d.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},d.prototype.scale=function(e){return new d(this.r*e,this.g*e,this.b*e)},d.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},d.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},d.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},d.prototype.add=function(e){return new d(this.r+e.r,this.g+e.g,this.b+e.b)},d.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},d.prototype.subtract=function(e){return new d(this.r-e.r,this.g-e.g,this.b-e.b)},d.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},d.prototype.clone=function(){return new d(this.r,this.g,this.b)},d.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},d.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},d.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},d.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)},d.prototype.toLinearSpace=function(){var e=new d;return this.toLinearSpaceToRef(e),e},d.prototype.toHSV=function(){var e=new d;return this.toHSVToRef(e),e},d.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),a=0,s=0,c=r,l=r-o;0!==r&&(s=l/r),r!=o&&(r==t?(a=(i-n)/l,i<n&&(a+=6)):r==i?a=(n-t)/l+2:r==n&&(a=(t-i)/l+4),a*=60),e.r=a,e.g=s,e.b=c},d.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,n.c),e.g=M
1ath.pow(this.g,n.c),e.b=Math.pow(this.b,n.c),this},d.prototype.toGammaSpace=function(){var e=new d;return this.toGammaSpaceToRef(e),e},d.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,n.b),e.g=Math.pow(this.g,n.b),e.b=Math.pow(this.b,n.b),this},d.HSVtoRGBToRef=function(e,t,i,n){var r=i*t,o=e/60,a=r*(1-Math.abs(o%2-1)),s=0,c=0,l=0;0<=o&&o<=1?(s=r,c=a):1<=o&&o<=2?(s=a,c=r):2<=o&&o<=3?(c=r,l=a):3<=o&&o<=4?(c=a,l=r):4<=o&&o<=5?(s=a,l=r):5<=o&&o<=6&&(s=r,l=a);var u=i-r;n.set(s+u,c+u,l+u)},d.FromHexString=function(e){if("#"!==e.substring(0,1)||7!==e.length)return new d(0,0,0);var t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);return d.FromInts(t,i,n)},d.FromArray=function(e,t){return void 0===t&&(t=0),new d(e[t],e[t+1],e[t+2])},d.FromInts=function(e,t,i){return new d(e/255,t/255,i/255)},d.Lerp=function(e,t,i){var n=new d(0,0,0);return d.LerpToRef(e,t,i,n),n},d.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},d.Red=function(){return new d(1,0,0)},d.Green=function(){return new d(0,1,0)},d.Blue=function(){return new d(0,0,1)},d.Black=function(){return new d(0,0,0)},Object.defineProperty(d,"BlackReadOnly",{get:function(){return d._BlackReadOnly},enumerable:!1,configurable:!0}),d.White=function(){return new d(1,1,1)},d.Purple=function(){return new d(.5,0,.5)},d.Magenta=function(){return new d(1,0,1)},d.Yellow=function(){return new d(1,1,0)},d.Gray=function(){return new d(.5,.5,.5)},d.Teal=function(){return new d(0,1,1)},d.Random=function(){return new d(Math.random(),Math.random(),Math.random())},d._BlackReadOnly=d.Black(),d),c=(h.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},h.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},h.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},h.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},h.prototype.add=function(e){return new h(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)},h.prototype.subtract=function(e){return new h(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)},h.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},h.prototype.scale=function(e){return new h(this.r*e,this.g*e,this.b*e,this.a*e)},h.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},h.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},h.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},h.prototype.multiply=function(e){return new h(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)},h.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},h.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},h.prototype.getClassName=function(){return"Color4"},h.prototype.getHashCode=function(){var e=255*this.r|0;return 397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},h.prototype.clone=function(){return new h(this.r,this.g,this.b,this.a)},h.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},h.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},h.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},h.prototype.toHexString=function(e){void 0===e&&(e=!1);var t=255*this.r|0,i=255*this.g|0,n=255*this.b|0;if(e)return"#"+o.a.ToHex(t)+o.a.ToHex(i)+o.a.ToHex(n);var r=255*this.a|0;return"#"+o.a.ToHex(t)+o.a.ToHex(i)+o.a.ToHex(n)+o.a.ToHex(r)},h.prototype.toLinearSpace=function(){var e=new h;return this.toLinearSpaceToRef(e),e},h.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,n.c),e.g=M
1ath.pow(this.g,n.c),e.b=Math.pow(this.b,n.c),e.a=this.a,this},h.prototype.toGammaSpace=function(){var e=new h;return this.toGammaSpaceToRef(e),e},h.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,n.b),e.g=Math.pow(this.g,n.b),e.b=Math.pow(this.b,n.b),e.a=this.a,this},h.FromHexString=function(e){if("#"!==e.substring(0,1)||9!==e.length)return new h(0,0,0,0);var t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16),r=parseInt(e.substring(7,9),16);return h.FromInts(t,i,n,r)},h.Lerp=function(e,t,i){var n=new h(0,0,0,0);return h.LerpToRef(e,t,i,n),n},h.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},h.FromColor3=function(e,t){return void 0===t&&(t=1),new h(e.r,e.g,e.b,t)},h.FromArray=function(e,t){return void 0===t&&(t=0),new h(e[t],e[t+1],e[t+2],e[t+3])},h.FromInts=function(e,t,i,n){return new h(e/255,t/255,i/255,n/255)},h.CheckColors4=function(e,t){if(e.length!==3*t)return e;for(var i=[],n=0;n<e.length;n+=3){var r=n/3*4;i[r]=e[n],i[1+r]=e[n+1],i[2+r]=e[n+2],i[3+r]=1}return i},h),l=(u.Color3=r.a.BuildArray(3,s.Black),u.Color4=r.a.BuildArray(3,function(){return new c(0,0,0,0)}),u);function u(){}function h(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}function d(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}a.a.RegisteredTypes["BABYLON.Color3"]=s,a.a.RegisteredTypes["BABYLON.Color4"]=c},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.GetClass=function(e){return this.RegisteredTypes&&this.RegisteredTypes[e]?this.RegisteredTypes[e]:null},r.RegisteredTypes={},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return m});var c,n=i(1),l=i(6),u=i(44),r=i(22),o=i(21),a=i(31),s=i(2),h=i(242),d=i(67),p=i(122),f=i(7),m=(i(303),i(216),c=a.a,Object(n.d)(_,c),Object.defineProperty(_,"NpmPackage",{get:function(){return a.a.NpmPackage},enumerable:!1,configurable:!0}),Object.defineProperty(_,"Version",{get:function(){return a.a.Version},enumerable:!1,configurable:!0}),Object.defineProperty(_,"Instances",{get:function(){return r.a.Instances},enumerable:!1,configurable:!0}),Object.defineProperty(_,"LastCreatedEngine",{get:function(){return r.a.LastCreatedEngine},enumerable:!1,configurable:!0}),Object.defineProperty(_,"LastCreatedScene",{get:function(){return r.a.LastCreatedScene},enumerable:!1,configurable:!0}),_.MarkAllMaterialsAsDirty=function(e,t){for(var i=0;i<_.Instances.length;i++)for(var n=_.Instances[i],r=0;r<n.scenes.length;r++)n.scenes[r].markAllMaterialsAsDirty(e,t)},_.DefaultLoadingScreenFactory=function(e){throw o.a.WarnImport("LoadingScreen")},Object.defineProperty(_.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!!_._RescalePostProcessFactory},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!1,configurable:!0}),_.prototype.getInputElement=function(){return this._renderingCanvas},_.prototype.getAspectRatio=function(e,t){void 0===t&&(t=!1);var i=e.viewport;return this.getRenderWidth(t)*i.width/(this.getRenderHeight(t)*i.height)},_.prototype.getScreenAspectRatio=function(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)},_.prototype.getRenderingCanvasClientRect=function(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null},_.prototype.getInputElementClientRect=function(){return this._renderingCanvas?this.getInputElement().getBoundingClientRect():null},_.prototype.isDeterministicLockStep=function(){return this._deterministicLockstep},_.prototype.getLockstepMaxSteps=function(){return this._lockstepMaxSteps},_.prototype.getTimeStep=function(){return 1e3*this._timeStep},_.prototype.generateMipMapsForCubemap=function(e,t){var i;void 0===t&&(t=!0),e.generateMipMaps&&(i=this._gl,this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,e,!0),i.generateMipmap(i.TEXTURE_CUBE_MAP),t&&this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null))},_.prototype.setState=function(e,t,i,n){void 0===t&&(t=0),void 0===n&&(n=!1),this._depthCullingState.cull===e&&!i||(this._depthCullingState.cull=e);var r=this.cullBackFaces?this._gl.BACK:this._gl.FRONT;this._depthCullingState.cullFace===r&&!i||(this._depthCullingState.cullFace=r),this.setZOffset(t);var o=n?this._gl.CW:this._gl.CCW;this._depthCullingState.frontFace===o&&!i||(this._depthCullingState.frontFace=o)},_.prototype.setZOffset=function(e){this._depthCullingState.zOffset=e},_.prototype.getZOffset=function(){return this._depthCullingState.zOffset},_.prototype.setDepthBuffer=function(e){this._depthCullingState.depthTest=e},_.prototype.getDepthWrite=function(){return this._depthCullingState.depthMask},_.prototype.setDepthWrite=function(e){this._depthCullingState.depthMask=e},_.prototype.getStencilBuffer=function(){return this._stencilState.stencilTest},_.prototype.setStencilBuffer=function(e){this._stencilState.stencilTest=e},_.prototype.getStencilMask=function(){return this._stencilState.stencilMask},_.prototype.setStencilMask=function(e){this._stencilState.stencilMask=e},_.prototype.getStencilFunction=function(){return this._stencilState.stencilFunc},_.prototype.getStencilFunctionReference=function(){return this._stencilState.stencilFuncRef},_.prototype.getStencilFunctionMask=function(){return this._stencilState.stencilFuncMask},_.prototype.setStencilFunction=function(e){this._stencilState.stencilFunc=e},_.prototype.setStencilFunctionReference=function(e){this._stencilState.stencilFuncRef=e},_.prototype.setStencilFunctionMask=function(e){this._stencilState.stencilFuncMask=e},_.prototype.getStencilOperationFail=function(){return this._stencilState.stencilOpStencilFail},_.prototype.getStencilOperationDepthFail=function(){return this._stencilState.stencilOpDepthFail},_.prototype.getStencilOperationPass=function(){return this._stencilState.stencilOpStencilDepthPass},_.prototype.setStencilOperationFail=function(e){this._stencilState.stencilOpStencilFail=e},_.prototype.setStencilOperationDepthFail=function(e){this._stencilState.stencilOpDepthFail=e},_.prototype.setStencilOperationPass=function(e){this._stencilState.stencilOpStencilDepthPass=e},_.prototype.setDitheringState=function(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)},_.prototype.setRasterizerState=function(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)},_.prototype.getDepthFunction=function(){return this._depthCullingState.depthFunc},_.prototype.setDepthFunction=function(e){this._depthCullingState.depthFunc=e},_.prototype.setDepthFunctionToGreater=function(){this._depthCullingState.depthFunc=this._gl.GREATER},_.prototype.setDepthFunctionToGreaterOrEqual=function(){this._depthCullingState.depthFunc=this._gl.GEQUAL},_.prototype.setDepthFunctionToLess=function(){this._depthCullingState.depthFunc=this._gl.LESS},_.prototype.setDepthFunctionToLessOrEqual=function(){this._depthCullingState.depthFunc=this._gl.LEQUAL},_.prototype.cacheStencilState=function(){this._cachedStencilBuffer=this.getStencilBuffer(),this._cachedStencilFunction=this.getStencilFunction(),this._cachedStencilMask=this.getStencilMask(),this._cachedStencilOperationPass=this.getStencilOperationPass(),this._cachedStencilOperationFail=this.getStencilOperationFail(),this._cachedStencilOperationDepthFail=this.getStencilOperationDepthFail(),this._cachedStencilReference=this.getStencilFunctionReference()},_.prototype.restoreStencilState=function(){this.setStencilFunction(this._cachedStencilFunction),this.setStencilMask(this._cachedStencilMask),this.setStencilBuffer(this._cachedStencilBuffer),this.setStencilOperationPass(this._cachedStencilOperationPass),this.setStencilOperationFail(this._cachedStencilOperationFail),this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail),this.setStencilFunctionReference(this._cachedStencilReference)},_.prototype.setDirectViewport=function(e,t,i,n){var r=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,n),r},_.prototype.scissorClear=function(e,t,i,n,r){this.enableScissor(e,t,i,n),this.clear(r,!0,!0,!0),this.disableScissor()},_.prototype.enableScissor=function(e,t,i,n){var r=this._gl;r.enable(r.SCISSOR_TEST),r.scissor(e,t,i,n)},_.prototype.disableScissor=function(){var e=this._gl;e.disable(e.SCISSOR_TEST)},_.prototype._reportDrawCall=function(){this._drawCalls.addCount(1,!1)},_.prototype.initWebVR=function(){throw o.a.WarnImport("WebVRCamera")},_.prototype._prepareVRComponent=function(){},_.prototype._connectVREvents=function(e,t){},_.prototype._submitVRFrame=function(){},_.prototype.disableVR=function(){},_.prototype.isVRPresenting=function(){return!1},_.prototype._requestVRFrame=function(){},_.prototype._loadFileAsync=function(e,n,r){var o=this;return new Promise(function(t,i){o._loadFile(e,function(e){t(e)},void 0,n,r,function(e,t){i(t)})})},_.prototype.getVertexShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null},_.prototype.getFragmentShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null},_.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))},_.prototype.setTextureFromPostProcess=function(e,t){this._bindTexture(e,t?t._textures.data[t._currentRenderTextureInd]:null)},_.prototype.setTextureFromPostProcessOutput=function(e,t){this._bindTexture(e,t?t._outputTexture:null)},_.prototype._rebuildBuffers=function(){for(var e=0,t=this.scenes;
1e<t.length;e++){var i=t[e];i.resetCachedMaterial(),i._rebuildGeometries(),i._rebuildTextures()}c.prototype._rebuildBuffers.call(this)},_.prototype._renderFrame=function(){for(var e=0;e<this._activeRenderLoops.length;e++)(0,this._activeRenderLoops[e])()},_.prototype._renderLoop=function(){var e;this._contextWasLost||(e=!0,!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e&&(this.beginFrame(),this._renderViews()||this._renderFrame(),this.endFrame())),0<this._activeRenderLoops.length?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},_.prototype._renderViews=function(){return!1},_.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},_.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&_._RequestFullscreen(this._renderingCanvas))},_.prototype.exitFullscreen=function(){this.isFullscreen&&_._ExitFullscreen()},_.prototype.enterPointerlock=function(){this._renderingCanvas&&_._RequestPointerlock(this._renderingCanvas)},_.prototype.exitPointerlock=function(){_._ExitPointerlock()},_.prototype.beginFrame=function(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),c.prototype.beginFrame.call(this)},_.prototype.endFrame=function(){c.prototype.endFrame.call(this),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},_.prototype.resize=function(){this.isVRPresenting()||c.prototype.resize.call(this)},_.prototype.setSize=function(e,t){if(!this._renderingCanvas)return!1;if(!c.prototype.setSize.call(this,e,t))return!1;if(this.scenes){for(var i=0;i<this.scenes.length;i++)for(var n=this.scenes[i],r=0;r<n.cameras.length;r++)n.cameras[r]._currentRenderId=0;this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this)}return!0},_.prototype.updateDynamicVertexBuffer=function(e,t,i,n){this.bindArrayBuffer(e),void 0===i&&(i=0);var r=t.length||t.byteLength;void 0===n||r<=n&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+n)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,n):new Uint8Array(t.buffer,t.byteOffset+i,n),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()},_.prototype._deletePipelineContext=function(e){var t=e;t&&t.program&&t.transformFeedback&&(this.deleteTransformFeedback(t.transformFeedback),t.transformFeedback=null),c.prototype._deletePipelineContext.call(this,e)},_.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),r=r||this._gl,this.onBeforeShaderCompilationObservable.notifyObservers(this);var a=c.prototype.createShaderProgram.call(this,e,t,i,n,r,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),a},_.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o,a=n.createProgram();if(!(e.program=a))throw new Error("Unable to create program");return n.attachShader(a,t),n.attachShader(a,i),1<this.webGLVersion&&r&&(o=this.createTransformFeedback(),this.bindTransformFeedback(o),this.setTranformFeedbackVaryings(a,r),e.transformFeedback=o),n.linkProgram(a),1<this.webGLVersion&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),a},_.prototype._releaseTexture=function(t){c.prototype._releaseTexture.call(this,t),this.scenes.forEach(function(e){e.postProcesses.forEach(function(e){e._outputTexture==t&&(e._outputTexture=null)}),e.cameras.forEach(function(e){e._postProcesses.forEach(function(e){e&&e._outputTexture==t&&(e._outputTexture=null)})})})}
1,_.prototype._rescaleTexture=function(t,e,i,n,r){var o=this;this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);var a=this.createRenderTargetTexture({width:e.width,height:e.height},{generateMipMaps:!1,type:s.a.TEXTURETYPE_UNSIGNED_INT,samplingMode:s.a.TEXTURE_BILINEAR_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1});!this._rescalePostProcess&&_._RescalePostProcessFactory&&(this._rescalePostProcess=_._RescalePostProcessFactory(this)),this._rescalePostProcess.getEffect().executeWhenCompiled(function(){o._rescalePostProcess.onApply=function(e){e._bindTexture("textureSampler",t)},(i||o.scenes[o.scenes.length-1]).postProcessManager.directRender([o._rescalePostProcess],a,!0),o._bindTextureDirectly(o._gl.TEXTURE_2D,e,!0),o._gl.copyTexImage2D(o._gl.TEXTURE_2D,0,n,0,0,e.width,e.height,0),o.unBindFramebuffer(a),o._releaseTexture(a),r&&r()})},_.prototype.getFps=function(){return this._fps},_.prototype.getDeltaTime=function(){return this._deltaTime},_.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},_.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),a=this._getInternalFormat(e.format),s=this._getRGBABufferInternalSizedFormat(e.type,a),c=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(c,e,!0),this._unpackFlipY(e.invertY);var l=r.TEXTURE_2D;e.isCube&&(l=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(l,n,s,a,o,t),this._bindTextureDirectly(c,null,!0)},_.prototype.updateDynamicIndexBuffer=function(e,t,i){var n;void 0===i&&(i=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),n=t instanceof Uint16Array||t instanceof Uint32Array?t:new(e.is32Bits?Uint32Array:Uint16Array)(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,n,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},_.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;if(t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(i.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),1<t&&i.renderbufferStorageMultisample){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),this._bindUnboundFramebuffer(null),t},_.prototype.updateTextureComparisonFunction=function(e,t){var i;1!==this.webGLVersion?(i=this._gl,e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,s.a.LEQUAL),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,s.a.LEQUAL),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t):f.a.Error("WebGL 1 does not support texture comparison.")},_.prototype.createInstancesBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");var i=new p.a(t);return i.capacity=e,this.bindArrayBuffer(i),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),i},_.prototype.deleteInstancesBuffer=function(e){this._gl.deleteBuffer(e)},_.prototype._clientWaitAsync=function(r,o,a){void 0===o&&(o=0),void 0===a&&(a=10);var s=this._gl;return new Promise(function(t,i){var n=function(){var e=s.clientWaitSync(r,o,0);e!=s.WAIT_FAILED?e!=s.TIMEOUT_EXPIRED?t():setTimeout(n,a):i()};n()})},_.prototype._readPixelsAsync=function(e,t,i,n,r,o,a){if(this._webGLVersion<2)throw new Error("_readPixelsAsync only work on WebGL2+");var s=this._gl,c=s.createBuffer();s.bindBuffer(s.PIXEL_PACK_BUFFER,c),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(e,t,i,n,r,o,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null);var l=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);return l?(s.flush(),this._clientWaitAsync(l,0,10).then(function(){return s.deleteSync(l),s.bindBuffer(s.PIXEL_PACK_BUFFER,c),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,a),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),s.deleteBuffer(c),a})):null},_.prototype.dispose=function(){for(this.hideLoadingUI(),this.onNewSceneAddedObservable.clear();this.postProcesses.length;
1)this.postProcesses[0].dispose();for(this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();1===_.Instances.length&&_.audioEngine&&_.audioEngine.dispose(),this.disableVR(),u.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)),u.a.IsDocumentAvailable()&&(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))),c.prototype.dispose.call(this);var e=_.Instances.indexOf(this);0<=e&&_.Instances.splice(e,1),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()},_.prototype._disableTouchAction=function(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.msTouchAction="none")},_.prototype.displayLoadingUI=function(){var e;!u.a.IsWindowObjectExist()||(e=this.loadingScreen)&&e.displayLoadingUI()},_.prototype.hideLoadingUI=function(){var e;!u.a.IsWindowObjectExist()||(e=this._loadingScreen)&&e.hideLoadingUI()},Object.defineProperty(_.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=_.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!1,configurable:!0}),_._RequestPointerlock=function(e){e.requestPointerLock=e.requestPointerLock||e.msRequestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock&&e.requestPointerLock()},_._ExitPointerlock=function(){var e=document;document.exitPointerLock=document.exitPointerLock||e.msExitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock,document.exitPointerLock&&document.exitPointerLock()},_._RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},_._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msCancelFullScreen&&e.msCancelFullScreen()},_.ALPHA_DISABLE=s.a.ALPHA_DISABLE,_.ALPHA_ADD=s.a.ALPHA_ADD,_.ALPHA_COMBINE=s.a.ALPHA_COMBINE,_.ALPHA_SUBTRACT=s.a.ALPHA_SUBTRACT,_.ALPHA_MULTIPLY=s.a.ALPHA_MULTIPLY,_.ALPHA_MAXIMIZED=s.a.ALPHA_MAXIMIZED,_.ALPHA_ONEONE=s.a.ALPHA_ONEONE,_.ALPHA_PREMULTIPLIED=s.a.ALPHA_PREMULTIPLIED,_.ALPHA_PREMULTIPLIED_PORTERDUFF=s.a.ALPHA_PREMULTIPLIED_PORTERDUFF,_.ALPHA_INTERPOLATE=s.a.ALPHA_INTERPOLATE,_.ALPHA_SCREENMODE=s.a.ALPHA_SCREENMODE,_.DELAYLOADSTATE_NONE=s.a.DELAYLOADSTATE_NONE,_.DELAYLOADSTATE_LOADED=s.a.DELAYLOADSTATE_LOADED,_.DELAYLOADSTATE_LOADING=s.a.DELAYLOADSTATE_LOADING,_.DELAYLOADSTATE_NOTLOADED=s.a.DELAYLOADSTATE_NOTLOADED,_.NEVER=s.a.NEVER,_.ALWAYS=s.a.ALWAYS,_.LESS=s.a.LESS,_.EQUAL=s.a.EQUAL,_.LEQUAL=s.a.LEQUAL,_.GREATER=s.a.GREATER,_.GEQUAL=s.a.GEQUAL,_.NOTEQUAL=s.a.NOTEQUAL,_.KEEP=s.a.KEEP,_.REPLACE=s.a.REPLACE,_.INCR=s.a.INCR,_.DECR=s.a.DECR,_.INVERT=s.a.INVERT,_.INCR_WRAP=s.a.INCR_WRAP,_.DECR_WRAP=s.a.DECR_WRAP,_.TEXTURE_CLAMP_ADDRESSMODE=s.a.TEXTURE_CLAMP_ADDRESSMODE,_.TEXTURE_WRAP_ADDRESSMODE=s.a.TEXTURE_WRAP_ADDRESSMODE,_.TEXTURE_MIRROR_ADDRESSMODE=s.a.TEXTURE_MIRROR_ADDRESSMODE,_.TEXTUREFORMAT_ALPHA=s.a.TEXTUREFORMAT_ALPHA,_.TEXTUREFORMAT_LUMINANCE=s.a.TEXTUREFORMAT_LUMINANCE,_.TEXTUREFORMAT_LUMINANCE_ALPHA=s.a.TEXTUREFORMAT_LUMINANCE_ALPHA,_.TEXTUREFORMAT_RGB=s.a.TEXTUREFORMAT_RGB,_.TEXTUREFORMAT_RGBA=s.a.TEXTUREFORMAT_RGBA,_.TEXTUREFORMAT_RED=s.a.TEXTUREFORMAT_RED,_.TEXTUREFORMAT_R=s.a.TEXTUREFORMAT_R,_.TEXTUREFORMAT_RG=s.a.TEXTUREFORMAT_RG,_.TEXTUREFORMAT_RED_INTEGER=s.a.TEXTUREFORMAT_RED_INTEGER,_.TEXTUREFORMAT_R_INTEGER=s.a.TEXTUREFORMAT_R_INTEGER,_.TEXTUREFORMAT_RG_INTEGER=s.a.TEXTUREFORMAT_RG_INTEGER,_.TEXTUREFORMAT_RGB_INTEGER=s.a.TEXTUREFORMAT_RGB_INTEGER,_.TEXTUREFORMAT_RGBA_INTEGER=s.a.TEXTUREFORMAT_RGBA_INTEGER,_.TEXTURETYPE_UNSIGNED_BYTE=s.a.TEXTURETYPE_UNSIGNED_BYTE,_.TEXTURETYPE_UNSIGNED_INT=s.a.TEXTURETYPE_UNSIGNED_INT,_.TEXTURETYPE_FLOAT=s.a.TEXTURETYPE_FLOAT,_.TEXTURETYPE_HALF_FLOAT=s.a.TEXTURETYPE_HALF_FLOAT,_.TEXTURETYPE_BYTE=s.a.TEXTURETYPE_BYTE,_.TEXTURETYPE_SHORT=s.a.TEXTURETYPE_SHORT,_.TEXTURETYPE_UNSIGNED_SHORT=s.a.TEXTURETYPE_UNSIGNED_SHORT,_.TEXTURETYPE_INT=s.a.TEXTURETYPE_INT,_.TEXTURETYPE_UNSIGNED_INTEGER=s.a.TEXTURETYPE_UNSIGNED_INTEGER,_.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=s.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4,_.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=s.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1,_.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=s.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,_.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=s.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,_.TEXTURETYPE_UNSIGNED_INT_24_8=s.a.TEXTURETYPE_UNSIGNED_INT_24_8,_.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=s.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV,_.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=s.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV,_.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=s.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV,_.TEXTURE_NEAREST_SAMPL
1INGMODE=s.a.TEXTURE_NEAREST_SAMPLINGMODE,_.TEXTURE_BILINEAR_SAMPLINGMODE=s.a.TEXTURE_BILINEAR_SAMPLINGMODE,_.TEXTURE_TRILINEAR_SAMPLINGMODE=s.a.TEXTURE_TRILINEAR_SAMPLINGMODE,_.TEXTURE_NEAREST_NEAREST_MIPLINEAR=s.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,_.TEXTURE_LINEAR_LINEAR_MIPNEAREST=s.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,_.TEXTURE_LINEAR_LINEAR_MIPLINEAR=s.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,_.TEXTURE_NEAREST_NEAREST_MIPNEAREST=s.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,_.TEXTURE_NEAREST_LINEAR_MIPNEAREST=s.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,_.TEXTURE_NEAREST_LINEAR_MIPLINEAR=s.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,_.TEXTURE_NEAREST_LINEAR=s.a.TEXTURE_NEAREST_LINEAR,_.TEXTURE_NEAREST_NEAREST=s.a.TEXTURE_NEAREST_NEAREST,_.TEXTURE_LINEAR_NEAREST_MIPNEAREST=s.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,_.TEXTURE_LINEAR_NEAREST_MIPLINEAR=s.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,_.TEXTURE_LINEAR_LINEAR=s.a.TEXTURE_LINEAR_LINEAR,_.TEXTURE_LINEAR_NEAREST=s.a.TEXTURE_LINEAR_NEAREST,_.TEXTURE_EXPLICIT_MODE=s.a.TEXTURE_EXPLICIT_MODE,_.TEXTURE_SPHERICAL_MODE=s.a.TEXTURE_SPHERICAL_MODE,_.TEXTURE_PLANAR_MODE=s.a.TEXTURE_PLANAR_MODE,_.TEXTURE_CUBIC_MODE=s.a.TEXTURE_CUBIC_MODE,_.TEXTURE_PROJECTION_MODE=s.a.TEXTURE_PROJECTION_MODE,_.TEXTURE_SKYBOX_MODE=s.a.TEXTURE_SKYBOX_MODE,_.TEXTURE_INVCUBIC_MODE=s.a.TEXTURE_INVCUBIC_MODE,_.TEXTURE_EQUIRECTANGULAR_MODE=s.a.TEXTURE_EQUIRECTANGULAR_MODE,_.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=s.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,_.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=s.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,_.SCALEMODE_FLOOR=s.a.SCALEMODE_FLOOR,_.SCALEMODE_NEAREST=s.a.SCALEMODE_NEAREST,_.SCALEMODE_CEILING=s.a.SCALEMODE_CEILING,_._RescalePostProcessFactory=null,_);function _(e,t,i,n){void 0===n&&(n=!1);var r,o,a,s=c.call(this,e,t,i,n)||this;return s.enableOfflineSupport=!1,s.disableManifestCheck=!1,s.scenes=new Array,s.onNewSceneAddedObservable=new l.c,s.postProcesses=new Array,s.isPointerLock=!1,s.onResizeObservable=new l.c,s.onCanvasBlurObservable=new l.c,s.onCanvasFocusObservable=new l.c,s.onCanvasPointerOutObservable=new l.c,s.onBeginFrameObservable=new l.c,s.customAnimationFrameRequester=null,s.onEndFrameObservable=new l.c,s.onBeforeShaderCompilationObservable=new l.c,s.onAfterShaderCompilationObservable=new l.c,s._deterministicLockstep=!1,s._lockstepMaxSteps=4,s._timeStep=1/60,s._fps=60,s._deltaTime=0,s._drawCalls=new d.a,s.canvasTabIndex=1,s.disablePerformanceMonitorInBackground=!1,s._performanceMonitor=new h.a,e&&(i=s._creationOptions,_.Instances.push(s),e.getContext&&(r=e,s._onCanvasFocus=function(){s.onCanvasFocusObservable.notifyObservers(s)},s._onCanvasBlur=function(){s.onCanvasBlurObservable.notifyObservers(s)},r.addEventListener("focus",s._onCanvasFocus),r.addEventListener("blur",s._onCanvasBlur),s._onBlur=function(){s.disablePerformanceMonitorInBackground&&s._performanceMonitor.disable(),s._windowIsBackground=!0},s._onFocus=function(){s.disablePerformanceMonitorInBackground&&s._performanceMonitor.enable(),s._windowIsBackground=!1},s._onCanvasPointerOut=function(e){s.onCanvasPointerOutObservable.notifyObservers(e)},r.addEventListener("pointerout",s._onCanvasPointerOut),u.a.IsWindowObjectExist()&&((o=s.getHostWindow()).addEventListener("blur",s._onBlur),o.addEventListener("focus",s._onFocus),a=document,s._onFullscreenChange=function(){void 0!==a.fullscreen?s.isFullscreen=a.fullscreen:void 0!==a.mozFullScreen?s.isFullscreen=a.mozFullScreen:void 0!==a.webkitIsFullScreen?s.isFullscreen=a.webkitIsFullScreen:void 0!==a.msIsFullScreen&&(s.isFullscreen=a.msIsFullScreen),s.isFullscreen&&s._pointerLockRequested&&r&&_._RequestPointerlock(r)},document.addEventListener("fullscreenchange",s._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",s._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",s._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",s._onFullscreenChange,!1),s._onPointerLockChange=function(){s.isPointerLock=a.mozPointerLockElement===r||a.webkitPointerLockElement===r||a.msPointerLockElement===r||a.pointerLockElement===r},document.addEventListener("pointerlockchange",s._onPointerLockChange,!1),document.addEventListener("mspointerlockchange",s._onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",s._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",s._onPointerLockChange,!1),!_.audioEngine&&i.audioEngine&&_.AudioEngineFactory&&(_.audioEngine=_.AudioEngineFactory(s.getRenderingCanvas()))),s._connectVREvents(),s.enableOfflineSupport=void 0!==_.OfflineProviderFactory,i.doNotHandleTouchAction||s._disableTouchAction(),s._deterministicLockstep=!!i.deterministicLockstep,s._lockstepMaxSteps=i.lockstepMaxSteps||
10,s._timeStep=i.timeStep||1/60),s._prepareVRComponent(),i.autoEnableWebVR&&s.initWebVR()),s}},function(e,t,i){"use strict";i.d(t,"b",function(){return _}),i.d(t,"c",function(){return v}),i.d(t,"a",function(){return b});var o=i(6),a=i(44),n=i(7),r=i(46),s=i(72),c=i(21),l=i(55),u=i(22),h=i(68),d=i(241),p=i(173),f=i(197),m=i(191),_=(Object.defineProperty(g,"BaseUrl",{get:function(){return h.a.BaseUrl},set:function(e){h.a.BaseUrl=e},enumerable:!1,configurable:!0}),Object.defineProperty(g,"DefaultRetryStrategy",{get:function(){return h.a.DefaultRetryStrategy},set:function(e){h.a.DefaultRetryStrategy=e},enumerable:!1,configurable:!0}),Object.defineProperty(g,"CorsBehavior",{get:function(){return h.a.CorsBehavior},set:function(e){h.a.CorsBehavior=e},enumerable:!1,configurable:!0}),Object.defineProperty(g,"UseFallbackTexture",{get:function(){return u.a.UseFallbackTexture},set:function(e){u.a.UseFallbackTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(g,"RegisteredExternalClasses",{get:function(){return f.a.RegisteredExternalClasses},set:function(e){f.a.RegisteredExternalClasses=e},enumerable:!1,configurable:!0}),Object.defineProperty(g,"fallbackTexture",{get:function(){return u.a.FallbackTexture},set:function(e){u.a.FallbackTexture=e},enumerable:!1,configurable:!0}),g.FetchToRef=function(e,t,i,n,r,o){var a=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*n%n|0)*i);o.r=r[a]/255,o.g=r[1+a]/255,o.b=r[2+a]/255,o.a=r[3+a]/255},g.Mix=function(e,t,i){return e*(1-i)+t*i},g.Instantiate=function(e){return f.a.Instantiate(e)},g.Slice=function(e,t,i){return e.slice?e.slice(t,i):Array.prototype.slice.call(e,t,i)},g.SetImmediate=function(e){p.a.SetImmediate(e)},g.IsExponentOfTwo=function(e){for(var t=1;(t*=2)<e;);return t===e},g.FloatRound=function(e){return Math.fround?Math.fround(e):g._tmpFloatArray[0]=e},g.GetFilename=function(e){var t=e.lastIndexOf("/");return t<0?e:e.substring(t+1)},g.GetFolderPath=function(e,t){void 0===t&&(t=!1);var i=e.lastIndexOf("/");return i<0?t?e:"":e.substring(0,i+1)},g.ToDegrees=function(e){return 180*e/Math.PI},g.ToRadians=function(e){return e*Math.PI/180},g.MakeArray=function(e,t){return!0===t||void 0!==e&&null!=e?Array.isArray(e)?e:[e]:null},g.GetPointerPrefix=function(e){var t="pointer";return a.a.IsWindowObjectExist()&&!window.PointerEvent&&a.a.IsNavigatorAvailable()&&!navigator.pointerEnabled&&(t="mouse"),!e._badDesktopOS||e._badOS||document&&"ontouchend"in document||(t="mouse"),t},g.SetCorsBehavior=function(e,t){h.a.SetCorsBehavior(e,t)},g.CleanUrl=function(e){return e.replace(/#/gm,"%23")},Object.defineProperty(g,"PreprocessUrl",{get:function(){return h.a.PreprocessUrl},set:function(e){h.a.PreprocessUrl=e},enumerable:!1,configurable:!0}),g.LoadImage=function(e,t,i,n,r){return h.a.LoadImage(e,t,i,n,r)},g.LoadFile=function(e,t,i,n,r,o){return h.a.LoadFile(e,t,i,n,r,o)},g.LoadFileAsync=function(e,n){return void 0===n&&(n=!0),new Promise(function(t,i){h.a.LoadFile(e,function(e){t(e)},void 0,void 0,n,function(e,t){i(t)})})},g.LoadScript=function(t,e,i,n){var r,o;a.a.IsWindowObjectExist()&&(r=document.getElementsByTagName("head")[0],(o=document.createElement("script")).setAttribute("type","text/javascript"),o.setAttribute("src",t),n&&(o.id=n),o.onload=function(){e&&e()},o.onerror=function(e){i&&i("Unable to load script '"+t+"'",e)},r.appendChild(o))},g.LoadScriptAsync=function(t,e){var n=this;return new Promise(function(e,i){n.LoadScript(t,function(){e()},function(e,t){i(t)})})},g.ReadFileAsDataURL=function(e,t,i){var n=new FileReader,r={onCompleteObservable:new o.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},g.ReadFile=function(e,t,i,n,r){return h.a.ReadFile(e,t,i,n,r)},g.FileAsURL=function(e){var t=new Blob([e]);return(window.URL||window.webkitURL).createObjectURL(t)},g.Format=function(e,t){return void 0===t&&(t=2),e.toFixed(t)},g.DeepCopy=function(e,t,i,n){r.a.DeepCopy(e,t,i,n)},g.IsEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},g.RegisterTopRootEvents=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.addEventListener(n.name,n.handler,!1);try{window.parent&&window.parent.addEventListener(n.name,n.handler,!1)}catch(e){}}},g.UnregisterTopRootEvents=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.removeEventListener(n.name,n.handler);try{e.parent&&e.parent.removeEventListener(n.name,n.handler)}catch(e){}}},g.DumpFramebuffer=function(e,t,i,n,r,o){void 0===r&&(r="image/png");for(var a=4*e,s=t/2,c=i.readPixels(0,0,e,t),l=0;l<s;l++)for(var u=0;u<a;u++){var h=u+l*a,d=u+(t-l-1)*a,p=c[h];c[h]=c[d],c[d]=p}g._ScreenshotCanvas||(g._ScreenshotCanvas=document.createElement("canvas")),g._ScreenshotCanvas.width=e,g._ScreenshotCanvas.height=t;var f,m=g._ScreenshotCanvas.getContext("2d");m&&((f=m.createImageData(e,t)).data.set(c),m.putImageData(f,0,0),g.EncodeScreenshotCanvasData(n,r,o))},g.ToBlob=function(e,t,i){void 0===i&&(i="image/png"),e.toBlob||(e.toBlob=function(r,o,a){var s=this;setTimeout(function(){for(var e=atob(s.toDataURL(o,a).split(",")[1]),t=e.length,i=new Uint8Array(t),n=0;n<t;n++)i[n]=e.charCodeAt(n);r(new Blob([i]))})}),e.toBlob(function(e){t(e)},i)},g.EncodeScreenshotCanvasData=function(e,t,a){void 0===t&&(t="image/png"),e?e(g._ScreenshotCanvas.toDataURL(t)):this.ToBlob(g._ScreenshotCanvas,function(e){if("download"in document.createElement("a")){var t,i;a||(i=((t=new Date).getFullYear()+"-"+(t.getMonth()+1)).slice(2)+"-"+t.getDate()+"_"+t.getHours()+"-"+("0"+t.getMinutes()).slice(-2),a="screenshot_"+i+".png"),g.Download(e,a)}else{var n=URL.createObjectURL(e),r=window.open("");if(!r)return;var o=r.document.createElement("img");o.onload=function(){URL.revokeObjectURL(n)},o.src=n,r.document.body.appendChild(o)}},t)},g.Download=function(e,t){var i,n;navigator&&navigator.msSaveBlob?navigator.msSaveBlob(e,t):(i=window.URL.createObjectURL(e),n=document.createElement("a"),document.body.appendChild(n),n.style.display="none",n.href=i,n.download=t,n.addEventListener("click",function(){n.parentElement&&n.parentElement.removeChild(n)}),n.click(),window.URL.revokeObjectURL(i))},g.CreateScreenshot=function(e,t,i,n,r){throw void 0===r&&(r="image/png"),c.a.WarnImport("ScreenshotTools")},g.CreateScreenshotAsync=function(e,t,i,n){throw void 0===n&&(n="image/png"),c.a.WarnImport("ScreenshotTools")},g.CreateScreenshotUsingRenderTarget=function(e,t,i,n,r,o,a,s){throw void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===a&&(a=!1),c.a.WarnImport("ScreenshotTools")},g.CreateScreenshotUsingRenderTargetAsync=function(e,t,i,n,r,o,a){throw void 0===n&&(n="image/png"),void 0===r&&(r=1),void 0===o&&(o=!1),c.a.WarnImport("ScreenshotTools")},g.RandomId=function(){return m.a.RandomId()},g.IsBase64=function(e){return!(e.length<5)&&"data:"===e.substr(0,5)},g.DecodeBase64=function(e){for(var t=atob(e.split(",")[1]),i=t.length,n=new Uint8Array(new ArrayBuffer(i)),r=0;r<i;r++)n[r]=t.charCodeAt(r);return n.buffer},g.GetAbsoluteUrl=function(e){var t=document.createElement("a");return t.href=e,t.href},Object.defineProperty(g,"errorsCount",{get:function(){return n.a.errorsCount}
1,enumerable:!1,configurable:!0}),g.Log=function(e){n.a.Log(e)},g.Warn=function(e){n.a.Warn(e)},g.Error=function(e){n.a.Error(e)},Object.defineProperty(g,"LogCache",{get:function(){return n.a.LogCache},enumerable:!1,configurable:!0}),g.ClearLogCache=function(){n.a.ClearLogCache()},Object.defineProperty(g,"LogLevels",{set:function(e){n.a.LogLevels=e},enumerable:!1,configurable:!0}),Object.defineProperty(g,"PerformanceLogLevel",{set:function(e){return(e&g.PerformanceUserMarkLogLevel)===g.PerformanceUserMarkLogLevel?(g.StartPerformanceCounter=g._StartUserMark,void(g.EndPerformanceCounter=g._EndUserMark)):(e&g.PerformanceConsoleLogLevel)===g.PerformanceConsoleLogLevel?(g.StartPerformanceCounter=g._StartPerformanceConsole,void(g.EndPerformanceCounter=g._EndPerformanceConsole)):(g.StartPerformanceCounter=g._StartPerformanceCounterDisabled,void(g.EndPerformanceCounter=g._EndPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),g._StartPerformanceCounterDisabled=function(e,t){},g._EndPerformanceCounterDisabled=function(e,t){},g._StartUserMark=function(e,t){if(void 0===t&&(t=!0),!g._performance){if(!a.a.IsWindowObjectExist())return;g._performance=window.performance}t&&g._performance.mark&&g._performance.mark(e+"-Begin")},g._EndUserMark=function(e,t){void 0===t&&(t=!0),t&&g._performance.mark&&(g._performance.mark(e+"-End"),g._performance.measure(e,e+"-Begin",e+"-End"))},g._StartPerformanceConsole=function(e,t){void 0===t&&(t=!0),t&&(g._StartUserMark(e,t),console.time&&console.time(e))},g._EndPerformanceConsole=function(e,t){void 0===t&&(t=!0),t&&(g._EndUserMark(e,t),console.timeEnd(e))},Object.defineProperty(g,"Now",{get:function(){return s.a.Now},enumerable:!1,configurable:!0}),g.GetClassName=function(e,t){void 0===t&&(t=!1);var i=null;return i=!t&&e.getClassName?e.getClassName():(e instanceof Object&&(i=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__),i||typeof e)},g.First=function(e,t){for(var i=0,n=e;i<n.length;i++){var r=n[i];if(t(r))return r}return null},g.getFullClassName=function(e,t){void 0===t&&(t=!1);var i,n=null,r=null;return(n=!t&&e.getClassName?e.getClassName():(e instanceof Object&&(n=(i=t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__,r=i.constructor.__bjsmoduleName__),n||typeof e))?(null!=r?r+".":"")+n:null},g.DelayAsync=function(t){return new Promise(function(e){setTimeout(function(){e()},t)})},g.IsSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},g.UseCustomRequestHeaders=!1,g.CustomRequestHeaders=l.a.CustomRequestHeaders,g._tmpFloatArray=new Float32Array(1),g.GetDOMTextContent=a.a.GetDOMTextContent,g.NoneLogLevel=n.a.NoneLogLevel,g.MessageLogLevel=n.a.MessageLogLevel,g.WarningLogLevel=n.a.WarningLogLevel,g.ErrorLogLevel=n.a.ErrorLogLevel,g.AllLogLevel=n.a.AllLogLevel,g.IsWindowObjectExist=a.a.IsWindowObjectExist,g.PerformanceNoneLogLevel=0,g.PerformanceUserMarkLogLevel=1,g.PerformanceConsoleLogLevel=2,g.StartPerformanceCounter=g._StartPerformanceCounterDisabled,g.EndPerformanceCounter=g._EndPerformanceCounterDisabled,g);function g(){}function v(t,i){return function(e){e.__bjsclassName__=t,e.__bjsmoduleName__=null!=i?i:null}}var b=(y.prototype.executeNext=function(){this._done||(this.index+1<this.iterations?(++this.index,this._fn(this)):this.breakLoop())},y.prototype.breakLoop=function(){this._done=!0,this._successCallback()},y.Run=function(e,t,i,n){void 0===n&&(n=0);var r=new y(e,t,i,n);return r.executeNext(),r},y.SyncAsyncForLoop=function(n,r,o,e,a,t){return void 0===t&&(t=0),y.Run(Math.ceil(n/r),function(i){a&&a()?i.breakLoop():setTimeout(function(){for(var e=0;e<r;++e){var t=i.index*r+e;if(n<=t)break;if(o(t),a&&a()){i.breakLoop();break}}i.executeNext()},t)},e)},y);function y(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}u.a.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQD
1BQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z",d.a.Apply()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.WithinEpsilon=function(e,t,i){void 0===i&&(i=1401298e-51);var n=e-t;return-i<=n&&n<=i},r.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},r.Sign=function(e){return 0==(e=+e)||isNaN(e)?e:0<e?1:-1},r.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,Math.max(t,e))},r.Log2=function(e){return Math.log(e)*Math.LOG2E},r.Repeat=function(e,t){return e-Math.floor(e/t)*t},r.Normalize=function(e,t,i){return(e-t)/(i-t)},r.Denormalize=function(e,t,i){return e*(i-t)+t},r.DeltaAngle=function(e,t){var i=r.Repeat(t-e,360);return 180<i&&(i-=360),i},r.PingPong=function(e,t){var i=r.Repeat(e,2*t);return t-Math.abs(i-t)},r.SmoothStep=function(e,t,i){var n=r.Clamp(i);return t*(n=-2*n*n*n+3*n*n)+e*(1-n)},r.MoveTowards=function(e,t,i){return Math.abs(t-e)<=i?t:e+r.Sign(t-e)*i},r.MoveTowardsAngle=function(e,t,i){var n=r.DeltaAngle(e,t);return-i<n&&n<i?t:r.MoveTowards(e,t=e+n,i)},r.Lerp=function(e,t,i){return e+(t-e)*i},r.LerpAngle=function(e,t,i){var n=r.Repeat(t-e,360);
1return 180<n&&(n-=360),e+n*r.Clamp(i)},r.InverseLerp=function(e,t,i){return e!=t?r.Clamp((i-e)/(t-e)):0},r.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o;return e*(2*a-3*o+1)+i*(-2*a+3*o)+t*(a-2*o+r)+n*(a-o)},r.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},r.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},r.PercentToRange=function(e,t,i){return(i-t)*e+t},r.NormalizeRadians=function(e){return e-r.TwoPi*Math.floor((e+Math.PI)/r.TwoPi)},r.TwoPi=2*Math.PI,r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var u=i(7),r=i(18),h=i(22),d=i(4),l=i(63),n=i(10),o=(a.BindEyePosition=function(e,t,i){var n;void 0===i&&(i="vEyePosition"),t._forcedViewPosition?e.setVector3(i,t._forcedViewPosition):(n=(n=t.activeCamera.globalPosition)||t.activeCamera.devicePosition,e.setVector3(i,t._mirroredCameraPosition?t._mirroredCameraPosition:n))},a.PrepareDefinesForMergedUV=function(e,t,i){t._needUVs=!0,t[i]=!0,e.getTextureMatrix().isIdentityAs3x2()?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,0===e.coordinatesIndex?t.MAINUV1=!0:t.MAINUV2=!0):t[i+"DIRECTUV"]=0},a.BindTextureMatrix=function(e,t,i){var n=e.getTextureMatrix();t.updateMatrix(i+"Matrix",n)},a.GetFogState=function(e,t){return t.fogEnabled&&e.applyFog&&t.fogMode!==r.a.FOGMODE_NONE},a.PrepareDefinesForMisc=function(e,t,i,n,r,o,a){a._areMiscDirty&&(a.LOGARITHMICDEPTH=i,a.POINTSIZE=n,a.FOG=r&&this.GetFogState(e,t),a.NONUNIFORMSCALING=e.nonUniformScaling,a.ALPHATEST=o)},a.PrepareDefinesForFrameBoundValues=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=!1);var a=!1,s=null==r?void 0!==e.clipPlane&&null!==e.clipPlane:r,c=null==r?void 0!==e.clipPlane2&&null!==e.clipPlane2:r,l=null==r?void 0!==e.clipPlane3&&null!==e.clipPlane3:r,u=null==r?void 0!==e.clipPlane4&&null!==e.clipPlane4:r,h=null==r?void 0!==e.clipPlane5&&null!==e.clipPlane5:r,d=null==r?void 0!==e.clipPlane6&&null!==e.clipPlane6:r;i.CLIPPLANE!==s&&(i.CLIPPLANE=s,a=!0),i.CLIPPLANE2!==c&&(i.CLIPPLANE2=c,a=!0),i.CLIPPLANE3!==l&&(i.CLIPPLANE3=l,a=!0),i.CLIPPLANE4!==u&&(i.CLIPPLANE4=u,a=!0),i.CLIPPLANE5!==h&&(i.CLIPPLANE5=h,a=!0),i.CLIPPLANE6!==d&&(i.CLIPPLANE6=d,a=!0),i.DEPTHPREPASS!==!t.getColorWrite()&&(i.DEPTHPREPASS=!i.DEPTHPREPASS,a=!0),i.INSTANCES!==n&&(i.INSTANCES=n,a=!0),i.THIN_INSTANCES!==o&&(i.THIN_INSTANCES=o,a=!0),a&&i.markAsUnprocessed()},a.PrepareDefinesForBones=function(e,t){var i;e.useBones&&e.computeBonesUsingShaders&&e.skeleton?(t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers,i=void 0!==t.BONETEXTURE,e.skeleton.isUsingTextureForMatrices&&i?t.BONETEXTURE=!0:(t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!i&&void 0)):(t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0)},a.PrepareDefinesForMorphTargets=function(e,t){var i=e.morphTargetManager;i?(t.MORPHTARGETS_UV=i.supportsUVs&&t.UV1,t.MORPHTARGETS_TANGENT=i.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=i.supportsNormals&&t.NORMAL,t.MORPHTARGETS=0<i.numInfluencers,t.NUM_MORPH_INFLUENCERS=i.numInfluencers):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},a.PrepareDefinesForAttributes=function(e,t,i,n,r,o){return void 0===r&&(r=!1),void 0===o&&(o=!0),!(!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs||(t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(d.b.NormalKind),t._needNormals&&e.isVerticesDataPresent(d.b.TangentKind)&&(t.TANGENT=!0),t._needUVs?(t.UV1=e.isVerticesDataPresent(d.b.UVKind),t.UV2=e.isVerticesDataPresent(d.b.UV2Kind)):(t.UV1=!1,t.UV2=!1),i&&(a=e.useVertexColors&&e.isVerticesDataPresent(d.b.ColorKind),t.VERTEXCOLOR=a,t.VERTEXALPHA=e.hasVertexAlpha&&a&&o),n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),0));var a},a.PrepareDefinesForMultiview=function(e,t){var i;e.activeCamera&&(i=t.MULTIVIEW,t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&1<e.activeCamera.outputRenderTarget.getViewCount(),t.MULTIVIEW!=i&&t.markAsUnprocessed())},a.PrepareDefinesForPrePass=function(e,t,i){var n=t.PREPASS;e.prePassRenderer&&i?(t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount):t.PREPASS=!1,t.PREPASS!=n&&(t.markAsUnprocessed(),t.markAsImageProcessingDirty())},a.PrepareDefinesForLight=function(e,t,i,n,r,o,a){switch(a.needNormals=!0,void 0===r["LIGHT"+n]&&(a.needRebuild=!0),r["LIGHT"+n]=!0,r["SPOTLIGHT"+n]=!1,r["HEMILIGHT"+n]=!1,r["POINTLIGHT"+n]=!1,r["DIRLIGHT"+n]=!1,i.prepareLightSpecificDefines(r,n),r["LIGHT_FALLOFF_PHYSICAL"+n]=!1,r["LIGHT_FALLOFF_GLTF"+n]=!1,r["LIGHT_FALLOFF_STANDARD"+n]=!1,i.falloffType){case l.a.FALLOFF_GLTF:r["LIGHT_FALLOFF_GLTF"+n]=!0;break;case l.a.FALLOFF_PHYSICAL:r["LIGHT_FALLOFF_PHYSICAL"+n]=!0;break;case l.a.FALLOFF_STANDARD:r["LIGHT_FALLOFF_STANDARD"+n]=!0}var s,c;o&&!i.specular.equalsFloats(0,0,0)&&(a.specularEnabled=!0),r["SHADOW"+n]=!1,r["SHADOWCSM"+n]=!1,r["SHADOWCSMDEBUG"+n]=!1,r["SHADOWCSMNUM_CASCADES"+n]=!1,r["SHADOWCSMUSESHADOWMAXZ"+n]=!1,r["SHADOWCSMNOBLEND"+n]=!1,r["SHADOWCSM_RIGHTHANDED"+n]=!1,r["SHADOWPCF"+n]=!1,r["SHADOWPCSS"+n]=!1,r["SHADOWPOISSON"+n]=!1,r["SHADOWESM"+n]=!1,r["SHADOWCUBE"+n]=!1,r["SHADOWLOWQUALITY"+n]=!1,r["SHADOWMEDIUMQUALITY"+n]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&i.shadowEnabled&&(!(s=i.get
1ShadowGenerator())||(c=s.getShadowMap())&&c.renderList&&0<c.renderList.length&&(a.shadowEnabled=!0,s.prepareDefines(r,n))),i.lightmapMode!=l.a.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==l.a.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)},a.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var a=0,s={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var c=0,l=t.lightSources;c<l.length;c++){var u=l[c];if(this.PrepareDefinesForLight(e,t,u,a,i,n,s),++a===r)break}i.SPECULARTERM=s.specularEnabled,i.SHADOWS=s.shadowEnabled;for(var h=a;h<r;h++)void 0!==i["LIGHT"+h]&&(i["LIGHT"+h]=!1,i["HEMILIGHT"+h]=!1,i["POINTLIGHT"+h]=!1,i["DIRLIGHT"+h]=!1,i["SPOTLIGHT"+h]=!1,i["SHADOW"+h]=!1,i["SHADOWCSM"+h]=!1,i["SHADOWCSMDEBUG"+h]=!1,i["SHADOWCSMNUM_CASCADES"+h]=!1,i["SHADOWCSMUSESHADOWMAXZ"+h]=!1,i["SHADOWCSMNOBLEND"+h]=!1,i["SHADOWCSM_RIGHTHANDED"+h]=!1,i["SHADOWPCF"+h]=!1,i["SHADOWPCSS"+h]=!1,i["SHADOWPOISSON"+h]=!1,i["SHADOWESM"+h]=!1,i["SHADOWCUBE"+h]=!1,i["SHADOWLOWQUALITY"+h]=!1,i["SHADOWMEDIUMQUALITY"+h]=!1);var d=e.getEngine().getCaps();return void 0===i.SHADOWFLOAT&&(s.needRebuild=!0),i.SHADOWFLOAT=s.shadowEnabled&&(d.textureFloatRender&&d.textureFloatLinearFiltering||d.textureHalfFloatRender&&d.textureHalfFloatLinearFiltering),i.LIGHTMAPEXCLUDED=s.lightmapMode,s.needRebuild&&i.rebuild(),s.needNormals},a.PrepareUniformsAndSamplersForLight=function(e,t,i,n,r){void 0===r&&(r=null),t.push("vLightData"+e,"vLightDiffuse"+e,"vLightSpecular"+e,"vLightDirection"+e,"vLightFalloff"+e,"vLightGround"+e,"lightMatrix"+e,"shadowsInfo"+e,"depthValues"+e),r&&r.push("Light"+e),i.push("shadowSampler"+e),i.push("depthSampler"+e),t.push("viewFrustumZ"+e,"cascadeBlendFactor"+e,"lightSizeUVCorrection"+e,"depthCorrection"+e,"penumbraDarkness"+e,"frustumLengths"+e),n&&(i.push("projectionLightSampler"+e),t.push("textureProjectionMatrix"+e))},a.PrepareUniformsAndSamplersList=function(e,t,i,n){void 0===n&&(n=4);var r,o=null;e.uniformsNames?(r=e.uniformsNames,o=e.uniformBuffersNames,t=e.samplers,i=e.defines,n=e.maxSimultaneousLights||0):(r=e,t=t||[]);for(var a=0;a<n&&i["LIGHT"+a];a++)this.PrepareUniformsAndSamplersForLight(a,r,t,i["PROJECTEDLIGHTTEXTURE"+a],o);i.NUM_MORPH_INFLUENCERS&&r.push("morphTargetInfluences")},a.HandleFallbacksForShadows=function(e,t,i,n){void 0===i&&(i=4),void 0===n&&(n=0);for(var r=0,o=0;o<i&&e["LIGHT"+o];o++)0<o&&(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++},a.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},a.PrepareAttributesForMorphTargets=function(e,t,i){var n=i.NUM_MORPH_INFLUENCERS;if(0<n&&h.a.LastCreatedEngine)for(var r=h.a.LastCreatedEngine.getCaps().maxVertexAttribs,o=t.morphTargetManager,a=o&&o.supportsNormals&&i.NORMAL,s=o&&o.supportsTangents&&i.TANGENT,c=o&&o.supportsUVs&&i.UV1,l=0;l<n;l++)e.push(d.b.PositionKind+l),a&&e.push(d.b.NormalKind+l),s&&e.push(d.b.TangentKind+l),c&&e.push(d.b.UVKind+"_"+l),e.length>r&&u.a.Error("Cannot add more vertex attributes for mesh "+t.name)},a.PrepareAttributesForBones=function(e,t,i,n){0<i.NUM_BONE_INFLUENCERS&&(n.addCPUSkinningFallback(0,t),e.push(d.b.MatricesIndicesKind),e.push(d.b.MatricesWeightsKind),4<i.NUM_BONE_INFLUENCERS&&(e.push(d.b.MatricesIndicesExtraKind),e.push(d.b.MatricesWeightsExtraKind)))},a.PrepareAttributesForInstances=function(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e)},a.PushAttributesForInstances=function(e){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3")},a.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},a.BindLight=function(e,t,i,n,r,o){void 0===o&&(o=!1),e._bindLight(t,i,n,r,o)},a.BindLights=function(e,t,i,n,r,o){void 0===r&&(r=4),void 0===o&&(o=!1);for(var a=Math.min(t.lightSources.length,r),s=0;s<a;s++){var c=t.lightSources[s];this.BindLight(c,s,e,i,"boolean"==typeof n?n:n.SPECULARTERM,o)}},a.BindFogParameters=function(e,t,i,n){void 0===n&&(n=!1),e.fogEnabled&&t.applyFog&&e.fogMode!==r.a.FOGMODE_NONE&&(i.setFloat4("vFogInfos",e.fogMode,e.fogStart,e.fogEnd,e.fogDensity),n?(e.fogColor.toLinearSpaceToRef(this._tempFogColor),i.setColor3("vFogColor",this._tempFogColor)):i.setColor3("vFogColor",e.fogColor))},a.BindBonesParameters=function(e,t){var i,n,r;t&&e&&(e.computeBonesUsingShaders&&t._bonesComputationForcedToCPU&&(e.computeBonesUsingShaders=!1),e.useBones&&e.computeBonesUsingShaders&&e.skeleton)&&((i=e.skeleton).isUsingTextureForMatrices&&-1<t.getUniformIndex("boneTextureWidth")?(n=i.getTransformMatrixTexture(e),t.setTexture("boneSampler",n
1),t.setFloat("boneTextureWidth",4*(i.bones.length+1))):(r=i.getTransformMatrices(e))&&t.setMatrices("mBones",r))},a.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},a.BindLogDepth=function(e,t,i){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(i.activeCamera.maxZ+1)/Math.LN2))},a.BindClipPlane=function(e,t){var i;t.clipPlane&&(i=t.clipPlane,e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)),t.clipPlane2&&(i=t.clipPlane2,e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)),t.clipPlane3&&(i=t.clipPlane3,e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)),t.clipPlane4&&(i=t.clipPlane4,e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)),t.clipPlane5&&(i=t.clipPlane5,e.setFloat4("vClipPlane5",i.normal.x,i.normal.y,i.normal.z,i.d)),t.clipPlane6&&(i=t.clipPlane6,e.setFloat4("vClipPlane6",i.normal.x,i.normal.y,i.normal.z,i.d))},a._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},a._tempFogColor=n.a.Black(),a);function a(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var te=i(0),_=i(4),s=i(21),g=i(10),n=i(7),r=(v.prototype.set=function(e,t){switch(e.length||n.a.Warn("Setting vertex data kind '"+t+"' with an empty array"),t){case _.b.PositionKind:this.positions=e;break;case _.b.NormalKind:this.normals=e;break;case _.b.TangentKind:this.tangents=e;break;case _.b.UVKind:this.uvs=e;break;case _.b.UV2Kind:this.uvs2=e;break;case _.b.UV3Kind:this.uvs3=e;break;case _.b.UV4Kind:this.uvs4=e;break;case _.b.UV5Kind:this.uvs5=e;break;case _.b.UV6Kind:this.uvs6=e;break;case _.b.ColorKind:this.colors=e;break;case _.b.MatricesIndicesKind:this.matricesIndices=e;break;case _.b.MatricesWeightsKind:this.matricesWeights=e;break;case _.b.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case _.b.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},v.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},v.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},v.prototype.updateMesh=function(e){return this._update(e),this},v.prototype.updateGeometry=function(e){return this._update(e),this},v.prototype._applyTo=function(e,t){return void 0===t&&(t=!1),this.positions&&e.setVerticesData(_.b.PositionKind,this.positions,t),this.normals&&e.setVerticesData(_.b.NormalKind,this.normals,t),this.tangents&&e.setVerticesData(_.b.TangentKind,this.tangents,t),this.uvs&&e.setVerticesData(_.b.UVKind,this.uvs,t),this.uvs2&&e.setVerticesData(_.b.UV2Kind,this.uvs2,t),this.uvs3&&e.setVerticesData(_.b.UV3Kind,this.uvs3,t),this.uvs4&&e.setVerticesData(_.b.UV4Kind,this.uvs4,t),this.uvs5&&e.setVerticesData(_.b.UV5Kind,this.uvs5,t),this.uvs6&&e.setVerticesData(_.b.UV6Kind,this.uvs6,t),this.colors&&e.setVerticesData(_.b.ColorKind,this.colors,t),this.matricesIndices&&e.setVerticesData(_.b.MatricesIndicesKind,this.matricesIndices,t),this.matricesWeights&&e.setVerticesData(_.b.MatricesWeightsKind,this.matricesWeights,t),this.matricesIndicesExtra&&e.setVerticesData(_.b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),this.matricesWeightsExtra&&e.setVerticesData(_.b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),this.indices?e.setIndices(this.indices,null,t):e.setIndices([],null),this},v.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(_.b.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(_.b.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(_.b.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(_.b.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(_.b.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(_.b.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(_.b.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(_.b.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(_.b.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(_.b.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(_.b.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(_.b.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(_.b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(_.b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},v.prototype.transform=function(e){var t=e.m[0]*e.m[5]*e.m[10]<0,i=te.e.Zero();if(this.positions)for(var n=te.e.Zero(),r=0;r<this.positions.length;r+=3)te.e.FromArrayToRef(this.positions,r,n),te.e.TransformCoordinatesToRef(n,e,i),this.positions[r]=i.x,this.positions[r+1]=i.y,this.positions[r+2]=i.z;if(this.normals){var o=te.e.Zero();for(r=0;r<this.normals.length;r+=3)te.e.FromArrayToRef(this.normals,r,o),te.e.TransformNormalToRef(o,e,i),this.normals[r]=i.x,this.normals[r+1]=i.y,this.normals[r+2]=i.z}if(this.tangents){var a=te.f.Zero(),s=te.f.Zero();for(r=0;r<this.tangents.length;r+=4)te.f.FromArrayToRef(this.tangents,r,a),te.f.TransformNormalToRef(a,e,s),this.tangents[r]=s.x,this.tangents[r+1]=s.y,this.tangents[r+2]=s.z,this.tangents[r+3]=s.w}if(t&&this.indices)for(r=0;r<this.indices.length;r+=3){var c=this.indices[r+1];this.indices[r+1]=this.indices[r+2],this.indices[r+2]=c}return this},v.prototype.merge=function(e,t){if(void 0===t&&(t=!1),this._val
1idate(),e._validate(),!this.normals!=!e.normals||!this.tangents!=!e.tangents||!this.uvs!=!e.uvs||!this.uvs2!=!e.uvs2||!this.uvs3!=!e.uvs3||!this.uvs4!=!e.uvs4||!this.uvs5!=!e.uvs5||!this.uvs6!=!e.uvs6||!this.colors!=!e.colors||!this.matricesIndices!=!e.matricesIndices||!this.matricesWeights!=!e.matricesWeights||!this.matricesIndicesExtra!=!e.matricesIndicesExtra||!this.matricesWeightsExtra!=!e.matricesWeightsExtra)throw new Error("Cannot merge vertex data that do not have the same set of attributes");if(e.indices){this.indices||(this.indices=[]);var i=this.positions?this.positions.length/3:0;if(void 0!==this.indices.BYTES_PER_ELEMENT){var n=this.indices.length+e.indices.length,r=new(t||this.indices instanceof Uint32Array?Uint32Array:Uint16Array)(n);r.set(this.indices);for(var o=this.indices.length,a=0;a<e.indices.length;a++)r[o+a]=e.indices[a]+i;this.indices=r}else for(a=0;a<e.indices.length;a++)this.indices.push(e.indices[a]+i)}return this.positions=this._mergeElement(this.positions,e.positions),this.normals=this._mergeElement(this.normals,e.normals),this.tangents=this._mergeElement(this.tangents,e.tangents),this.uvs=this._mergeElement(this.uvs,e.uvs),this.uvs2=this._mergeElement(this.uvs2,e.uvs2),this.uvs3=this._mergeElement(this.uvs3,e.uvs3),this.uvs4=this._mergeElement(this.uvs4,e.uvs4),this.uvs5=this._mergeElement(this.uvs5,e.uvs5),this.uvs6=this._mergeElement(this.uvs6,e.uvs6),this.colors=this._mergeElement(this.colors,e.colors),this.matricesIndices=this._mergeElement(this.matricesIndices,e.matricesIndices),this.matricesWeights=this._mergeElement(this.matricesWeights,e.matricesWeights),this.matricesIndicesExtra=this._mergeElement(this.matricesIndicesExtra,e.matricesIndicesExtra),this.matricesWeightsExtra=this._mergeElement(this.matricesWeightsExtra,e.matricesWeightsExtra),this},v.prototype._mergeElement=function(e,t){if(!e)return t;if(!t)return e;var i=t.length+e.length,n=e instanceof Float32Array,r=t instanceof Float32Array;if(n){var o=new Float32Array(i);return o.set(e),o.set(t,e.length),o}if(r){for(var a=e.slice(0),s=0,i=t.length;s<i;s++)a.push(t[s]);return a}return e.concat(t)},v.prototype._validate=function(){if(!this.positions)throw new Error("Positions are required");function n(e,t){var i=_.b.DeduceStride(e);if(t.length%i!=0)throw new Error("The "+e+"s array count must be a multiple of "+i);return t.length/i}function e(e,t){var i=n(e,t);if(i!==r)throw new Error("The "+e+"s element count ("+i+") does not match the positions count ("+r+")")}var r=n(_.b.PositionKind,this.positions);this.normals&&e(_.b.NormalKind,this.normals),this.tangents&&e(_.b.TangentKind,this.tangents),this.uvs&&e(_.b.UVKind,this.uvs),this.uvs2&&e(_.b.UV2Kind,this.uvs2),this.uvs3&&e(_.b.UV3Kind,this.uvs3),this.uvs4&&e(_.b.UV4Kind,this.uvs4),this.uvs5&&e(_.b.UV5Kind,this.uvs5),this.uvs6&&e(_.b.UV6Kind,this.uvs6),this.colors&&e(_.b.ColorKind,this.colors),this.matricesIndices&&e(_.b.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&e(_.b.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&e(_.b.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&e(_.b.MatricesWeightsExtraKind,this.matricesWeightsExtra)},v.prototype.serialize=function(){var e=this.serialize();return this.positions&&(e.positions=this.positions),this.normals&&(e.normals=this.normals),this.tangents&&(e.tangents=this.tangents),this.uvs&&(e.uvs=this.uvs),this.uvs2&&(e.uvs2=this.uvs2),this.uvs3&&(e.uvs3=this.uvs3),this.uvs4&&(e.uvs4=this.uvs4),this.uvs5&&(e.uvs5=this.uvs5),this.uvs6&&(e.uvs6=this.uvs6),this.colors&&(e.colors=this.colors),this.matricesIndices&&(e.matricesIndices=this.matricesIndices,e.matricesIndices._isExpanded=!0),this.matricesWeights&&(e.matricesWeights=this.matricesWeights),this.matricesIndicesExtra&&(e.matricesIndicesExtra=this.matricesIndicesExtra,e.matricesIndicesExtra._isExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=this.matricesWeightsExtra),e.indices=this.indices,e},v.ExtractFromMesh=function(e,t,i){return v._ExtractFrom(e,t,i)},v.ExtractFromGeometry=function(e,t,i){return v._ExtractFrom(e,t,i)},v._ExtractFrom=function(e,t,i){var n=new v;return e.isVerticesDataPresent(_.b.PositionKind)&&(n.positions=e.getVerticesData(_.b.PositionKind,t,i)),e.isVerticesDataPresent(_.b.NormalKind)&&(n.normals=e.getVerticesData(_.b.NormalKind,t,i)),e.isVerticesDataPresent(_.b.TangentKind)&&(n.tangents=e.getVerticesData(_.b.TangentKind,t,i)),e.isVerticesDataPresent(_.b.UVKind)&&(n.uvs=e.getVerticesData(_.b.UVKind,t,i)),e.isVerticesDataPresent(_.b.UV2Kind)&&(n.uvs2=e.getVerticesData(_.b.UV2Kind,t,i)),e.isVerticesDataPresent(_.b.UV3Kind)&&(n.uvs3=e.getVerticesData(_.b.UV3Kind,t,i)),e.isVerticesDataPresent(_.b.UV4Kind)&&(n.uvs4=e.getVerticesData(_.b.UV4Kind,t,i)),e.isVerticesDataPresent(_.b.UV5Kind)&&(n.uvs5=e.getVerticesData(_.b.UV5Kind,t,i)),e.isVerticesDataPresent(_.b.UV6Kind)&&(n.uvs6=e.getVerticesData(_.b.UV6Kind,t,i)),e.isVerticesDataPresent(_.b.ColorKind)&&(n.colors=e.getVerticesData(_.b.ColorKind,t,i)),e.isVerticesDataPresent(_.b.MatricesIndicesKind)&&(n.matricesIndices=e.getVerticesData(_.b.MatricesIndicesKind,t,i)),e.isVerticesDataPresent(_.b.MatricesWeightsKind)&&(n.matricesWeights=e.getVerticesData(_.b.MatricesWeightsKind,t,i)),e.isVerticesDataPresent(_.b.MatricesIndicesExtraKind)&&(n.matricesIndicesExtra=e.getVerticesData(_.b.MatricesIndicesExtraKind,t,i)),e.isVerticesDataPresent(_.b.MatricesWeightsExtraKind)&&(n.matricesWeightsExtra=e.getVerticesData(_.b.MatricesWeightsExtraKind,t,i)),n.indices=e.getIndices(t,i),n},v.CreateRibbon=function(e){throw s.a.WarnImport("ribbonBuilder")},v.CreateBox=function(e){throw s.a.WarnImport("boxBuilder")},v.CreateTiledBox=function(e){throw s.a.WarnImport("tiledBoxBuilder")},v.CreateTiledPlane=function(e){throw s.a.WarnImport("tiledPlaneBuilder")},v.CreateSphere=function(e){throw s.a.WarnImport("sphereBuilder")},v.CreateCylinder=function(e){throw s.a.WarnImport("cylinderBuilder")},v.CreateTorus=function(e){throw s.a.WarnImport("torusBuilder")},v.CreateLineSystem=function(e){throw s.a.WarnImport("linesBuilder")},v.CreateDashedLines=function(e){throw s.a.WarnImport("linesBuilder")},v.CreateGround=function(e){throw s.a.WarnImport("groundBuilder")},v.CreateTiledGround=function(e){throw s.a.WarnImport("groundBuilder")},v.CreateGroundFromHeightMap=function(e){throw s.a.WarnImport("groundBuilder")},v.CreatePlane=function(e){throw s.a.WarnImport("planeBuilder")},v.CreateDisc=function(e){throw s.a.WarnImport("discBuilder")},v.CreatePolygon=function(e,t,i,n,r,o,a){throw s.a.WarnImport("polygonBuilder")},v.CreateIcoSphere=function(e){throw s.a.WarnImport("icoSphereBuilder")},v.CreatePolyhedron=function(e){throw s.a.WarnImport("polyhedronBuilder")},v.CreateTorusKnot=function(e){throw s.a.WarnImport("torusKnotBuilder")},v.ComputeNormals=function(e,t,i,n){var r,o=0,a=0,s=0,c=0,l=0,u=0,h=0,d=0,p=0,f=0,m=0,_=0,g=0,v=0,b=0,y=0,T=0,E=0,S=0,A=0,C=!1,P=!1,x=!1,R=!1,O=1,M=0,I=null;n&&(C=!!n.facetNormals,P=!!n.facetPositions,x=!!n.facetPartitioning,O=!0===n.useRightHandedSystem?-1:1,M=n.ratio||0,R=!!n.depthSort,I=n.distanceTo,R)&&(void 0===I&&(I=te.e.Zero()),r=n.depthSortedFacets);var D,L,N,F,w,B,U,V,k,G,z,j,W,H,X,Y,K,Q=0,q=0,Z=0,J=0;for(x&&n&&n.bbSize&&(Y=X=H=W=j=z=G=k=V=U=B=w=F=N=L=D=0,K=(K=n.bbSize.x>n.bbSize.y?n.bbSize.x:n.bbSize.y)>n.bbSize.z?K:n.bbSize.z,Q=n.subDiv.X*M/n.bbSize.x,q=n.subDiv.Y*M/n.bbSize.y,Z=n.subDiv.Z*M/n.bbSize.z,J=n.subDiv.max*n.subDiv.max,n.facetPartitioning.length=0),o=0;o<e.length;o++)i[o]=0;for(var $=t.length/3|0,o=0;o<$;o++){var ee,g=1+(_=3*t[3*o]),v=_+2,y=1+(b=3*t[3*o+1]),T=b+2,S=1+(E=3*t[3*o+2]),A=E+2,a=e[_]-e[b],s=e[g]-e[y],c=e[v]-e[T],l=e[E]-e[b],u=e[S]-e[y],d=O*(s*(h=e[A]-e[T])-c*u),p=O*(c*l-a*h),f=O*(a*u-s*l);d/=m=0===(m=Math.sqrt(d*d+p*p+f*f))?1:m,p/=m,f/=m,C&&n&&(n.facetNormals[o].x=d,n.facetNormals[o].y=p,n.facetNormals[o].z=f),P&&n&&(n.facetPositions[o].x=(e[_]+e[b]+e[E])/3,n.facetPositions[o].y=(e[g]+e[y]+e[S])/3,n.facetPositions[o].z=(e[v]+e[T]+e[A])/3),x&&n&&(D=Math.floor((n.facetPositions[o].x-n.bInfo.minimum.x*M)*Q),L=Math.floor((n.facetPositions[o].y-n.bInfo.minimum.y*M)*q),N=Math.floor((n.facetPositions[o].z-n.bInfo.minimum.z*M)*Z),F=Math.floor((e[_]-n.bInfo.minimum.x*M)*Q),w=Math.floor((e[g]-n.bInfo.minimum.y*M)*q),B=Math.floor((e[v]-n.bInfo.minimum.z*M)*Z),U=Math.floor((e[b]-n.bInfo.minimum.x*M)*Q),V=Math.floor((e[y]-n.bInfo.minimum.y*M)*q),k=Math.floor((e[T]-n.bInfo.minimum.z*M)*Z),G=Math.floor((e[E]-n.bInfo.minimum.x*M)*Q),z=Math.floor((e[S]-n.bInfo.minimum.y*M)*q),j=Math.floor((e[A]-n.bInfo.minimum.z*M)*Z),H=F+n.subDiv.max*w+J*B,X=U+n.subDiv.max*V+J*k,Y=G+n.subDiv.max*z+J*j,W=D+n.subDiv.max*L+J*N,n.facetPartitioning[W]=n.facetPartitioning[W]?n.facetPartitioning[W]:new Array,n.facetPartitioning[H]=n.facetPartitioning[H]?n.facetPartitioning[H]:new Array,n.facetPartitioning[X]=n.facetPartitioning[X]?n.facetPartitioning[X]:new Array,n.facetPartitioning[Y]=n.facetPartitioning[Y]?n.facetPartitioning[Y]:new Array,n.facetPartitioning[H].push(o),X!=H&&n.facetPartitioning[X].push(o),Y!=X&&Y!=H&&n.facetPartitioning[Y].push(o),W!=H&&W!=X&&W!=Y&&n.facetPartitioning[W].push(o)),R&&n&&n.facetPositions&&((ee=r[o]).ind=3*o,ee.sqDistance=te.e.DistanceSquared(n.facetPositions[o],I)),i[_]+=d,i[g]+=p,i[v]+=f,i[b]+=d,i[y]+=p,i[T]+=f,i[E]+=d,i[S]+=p,i[A]+=f}for(o=0;o<i.length/3;o++)d=i[3*o],p=i[3*o+1],f=i[3*o+2],d/=m=0===(m=Math.sqrt(d*d+p*p+f*f))?1:m,p/=m,f/=m,i[3*o]=d,i[3*o+1]=p,i[3*o+2]=f},v._ComputeSides=function(e,t,i,n,r,o,a){var s,c=i.length,l=n.length;switch(e=e||v.DEFAULTSIDE){case v.FRONTSIDE:break;case v.BACKSIDE:for(var u,h=0;h<c;h+=3)u=i[h],i[h]=i[h+2],i[h+2]=u;for(s=0;s<l;s++)n[s]=-n[s];break;case v.DOUBLESIDE:for(var d=t.length,p=d/3,f=0;f<d;f++)t[d+f]=t[f];for(h=0;h<c;h+=3)i[h+c]=i[h+2]+p,i[h+1+c]=i[h+1]+p,i[h+2+c]=i[h]+p;for(s=0;s<l;s++)n[l+s]=-n[s];for(var m=r.length,_=0,_=0;_<m;_++)r[_+m]=r[_];for(o=o||new te.f(0,0,1,1),a=a||new te.f(0,0,1,1),h=_=0;h<m/2;h++)r[_]=o.x+(o.z-o.x)*r[_],r[_+1]=o.y+(o.w-o.y)*r[_+1],r[_+m]=a.x+(a.z-a.x)*r[_+m],r[_+m+1]=a.y+(a.w-a.y)*r[_+m+1],_+=2}},v.ImportVertexData=function(e,t){var i=new v,n=e.positions;n&&i.set(n,_.b.PositionKind);var r=e.normals;r&&i.set(r,_.b.NormalKind);var o=e.tangents;o&&i.set(o,_.b.TangentKind);var a=e.uvs;a&&i.set(a,_.b.UVKind);var s=e.uv2s;s&&i.set(s,_.b.UV2Kind);var c=e.uv3s;c&&i.set(c,_.b.UV3Kind);var l=e.uv4s;l&&i.set(l,_.b.UV4Kind);var u=e.uv5s;u&&i.set(u,_.b.UV5Kind);var h=e.uv6s;h&&i.set(h,_.b.UV6Kind);var d=e.colors;d&&i.set(g.b.CheckColors4(d,n.length/3),_.b.ColorKind);var p=e.matricesIndices;p&&i.set(p,_.b.MatricesIndicesKind);var f=e.matricesWeights;f&&i.set(f,_.b.MatricesWeightsKind);var m=e.indices;m&&(i.indices=m),t.setAllVerticesData(i,e.updatable)},v.FRONTSIDE=0,v.BACKSIDE=1,v.DOUBLESIDE=2,v.DEFAULTSIDE=0,v);function v(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1),i.d(t,"b",function(){return a});var n,r=i(1),o=(c.NAME_EFFECTLAYER="EffectLayer",c.NAME_LAYER="Layer",c.NAME_LENSFLARESYSTEM="LensFlareSystem",c.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",c.NAME_PARTICLESYSTEM="ParticleSystem",c.NAME_GAMEPAD="Gamepad",c.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",c.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",c.NAME_PREPASSRENDERER="PrePassRenderer",c.NAME_DEPTHRENDERER="DepthRenderer",c.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",c.NAME_SPRITE="Sprite",c.NAME_OUTLINERENDERER="Outline",c.NAME_PROCEDURALTEXTURE="ProceduralTexture",c.NAME_SHADOWGENERATOR="ShadowGenerator",c.NAME_OCTREE="Octree",c.NAME_PHYSICSENGINE="PhysicsEngine",c.NAME_AUDIO="Audio",c.STEP_ISREADYFORMESH_EFFECTLAYER=0,c.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,c.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,c.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER=0,c.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,c.STEP_BEFORECAMERADRAW_EFFECTLAYER=0,c.STEP_BEFORECAMERADRAW_LAYER=1,c.STEP_BEFORECAMERADRAW_PREPASS=2,c.STEP_BEFORERENDERTARGETDRAW_LAYER=0,c.STEP_BEFORERENDERINGMESH_OUTLINE=0,c.STEP_AFTERRENDERINGMESH_OUTLINE=0,c.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,c.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,c.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,c.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,c.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,c.STEP_AFTERRENDERTARGETDRAW_LAYER=0,c.STEP_AFTERCAMERADRAW_EFFECTLAYER=0,c.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=1,c.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=2,c.STEP_AFTERCAMERADRAW_LAYER=3,c.STEP_AFTERCAMERADRAW_PREPASS=4,c.STEP_AFTERRENDER_AUDIO=0,c.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0,c.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,c.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2,c.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,c.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,c.STEP_BEFORECLEARSTAGE_PREPASS=0,c.STEP_POINTERMOVE_SPRITE=0,c.STEP_POINTERDOWN_SPRITE=0,c.STEP_POINTERUP_SPRITE=0,c),a=(n=Array,Object(r.d)(s,n),s.Create=function(){return Object.create(s.prototype)},s.prototype.registerStep=function(e,t,i){var n=0;for(Number.MAX_VALUE;n<this.length&&!(e<this[n].index);n++);this.splice(n,0,{index:e,component:t,action:i.bind(t)})},s.prototype.clear=function(){this.length=0},s);function s(e){return n.apply(this,e)||this}function c(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return V});var r,o=i(1),v=i(13),n=i(72),a=i(6),s=i(40),c=i(163),l=i(43),u=i(0),d=i(51),h=i(28),b=i(25),p=i(42),f=i(48),m=i(116),_=i(63),g=i(66),y=i(53),T=i(133),E=i(134),S=i(17),A=i(2),C=i(44),P=i(7),x=i(22),R=i(21),O=i(20),M=i(128),I=i(82),D=(Object.defineProperty(z.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!1,configurable:!0}),z),L=(Object.defineProperty(G.prototype,"meshUnderPointer",{get:function(){return this._pointerOverMesh},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"unTranslatedPointer",{get:function(){return new u.d(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"pointerX",{get:function(){return this._pointerX},set:function(e){this._pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"pointerY",{get:function(){return this._pointerY},set:function(e){this._pointerY=e},enumerable:!1,configurable:!0}),G.prototype._updatePointerPosition=function(e){var t=this._scene.getEngine().getInputElementClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},G.prototype._processPointerMove=function(e,t){var i=this._scene,n=i.getEngine(),r=n.getInputElement();if(r){r.tabIndex=n.canvasTabIndex,i.doNotHandleCursors||(r.style.cursor=i.defaultCursor);var o=!!(e&&e.hit&&e.pickedMesh);o?(i.setPointerOverMesh(e.pickedMesh),this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.hasPointerTriggers&&(i.doNotHandleCursors||(this._pointerOverMesh.actionManager.hoverCurs
1or?r.style.cursor=this._pointerOverMesh.actionManager.hoverCursor:r.style.cursor=i.hoverCursor))):i.setPointerOverMesh(null);for(var a,s,c=0,l=i._pointerMoveStage;c<l.length;c++)e=l[c].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,o,r);e&&(a=t.type===this._wheelEventName?O.a.POINTERWHEEL:O.a.POINTERMOVE,i.onPointerMove&&i.onPointerMove(t,e,a),i.onPointerObservable.hasObservers()&&(s=new O.b(a,t,e),this._setRayOnPointerInfo(s),i.onPointerObservable.notifyObservers(s,a)))}},G.prototype._setRayOnPointerInfo=function(e){var t=this._scene;e.pickInfo&&!e.pickInfo._pickingUnavailable&&(e.pickInfo.ray||(e.pickInfo.ray=t.createPickingRay(e.event.offsetX,e.event.offsetY,u.a.Identity(),t.activeCamera)))},G.prototype._checkPrePointerObservable=function(e,t,i){var n=this._scene,r=new O.d(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(r.ray=e.ray),n.onPrePointerObservable.notifyObservers(r,i),!!r.skipOnPointerObservable},G.prototype.simulatePointerMove=function(e,t){var i=new PointerEvent("pointermove",t);this._checkPrePointerObservable(e,i,O.a.POINTERMOVE)||this._processPointerMove(e,i)},G.prototype.simulatePointerDown=function(e,t){var i=new PointerEvent("pointerdown",t);this._checkPrePointerObservable(e,i,O.a.POINTERDOWN)||this._processPointerDown(e,i)},G.prototype._processPointerDown=function(e,t){var i,n,r=this,o=this._scene;if(e&&e.hit&&e.pickedMesh){this._pickedDownMesh=e.pickedMesh;var a=e.pickedMesh._getActionManagerForTrigger();if(a){if(a.hasPickTriggers)switch(a.processTrigger(A.a.ACTION_OnPickDownTrigger,y.a.CreateNew(e.pickedMesh,t)),t.button){case 0:a.processTrigger(A.a.ACTION_OnLeftPickTrigger,y.a.CreateNew(e.pickedMesh,t));break;case 1:a.processTrigger(A.a.ACTION_OnCenterPickTrigger,y.a.CreateNew(e.pickedMesh,t));break;case 2:a.processTrigger(A.a.ACTION_OnRightPickTrigger,y.a.CreateNew(e.pickedMesh,t))}a.hasSpecificTrigger(A.a.ACTION_OnLongPressTrigger)&&window.setTimeout(function(){var e=o.pick(r._unTranslatedPointerX,r._unTranslatedPointerY,function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(A.a.ACTION_OnLongPressTrigger)&&e==r._pickedDownMesh},!1,o.cameraToUseForPointers);e&&e.hit&&e.pickedMesh&&a&&0!==r._totalPointersPressed&&Date.now()-r._startingPointerTime>G.LongPressDelay&&!r._isPointerSwiping()&&(r._startingPointerTime=0,a.processTrigger(A.a.ACTION_OnLongPressTrigger,y.a.CreateNew(e.pickedMesh,t)))},G.LongPressDelay)}}else for(var s=0,c=o._pointerDownStage;s<c.length;s++)e=c[s].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t);e&&(i=O.a.POINTERDOWN,o.onPointerDown&&o.onPointerDown(t,e,i),o.onPointerObservable.hasObservers()&&(n=new O.b(i,t,e),this._setRayOnPointerInfo(n),o.onPointerObservable.notifyObservers(n,i)))},G.prototype._isPointerSwiping=function(){return Math.abs(this._startingPointerPosition.x-this._pointerX)>G.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>G.DragMovementThreshold},G.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent("pointerup",t),r=new D;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,O.a.POINTERUP)||this._processPointerUp(e,n,r)},G.prototype._processPointerUp=function(e,t,i){var n,r,o,a=this._scene;if(e&&e&&e.pickedMesh){this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(a.onPointerPick&&a.onPointerPick(t,e),i.singleClick&&!i.ignore&&a.onPointerObservable.hasObservers())&&(n=O.a.POINTERPICK,r=new O.b(n,t,e),this._setRayOnPointerInfo(r),a.onPointerObservable.notifyObservers(r,n));var s,c=e.pickedMesh._getActionManagerForTrigger();c&&!i.ignore&&(c.processTrigger(A.a.ACTION_OnPickUpTrigger,y.a.CreateNew(e.pickedMesh,t)),!i.hasSwiped&&i.singleClick&&c.processTrigger(A.a.ACTION_OnPickTrigger,y.a.CreateNew(e.pickedMesh,t)),s=e.pickedMesh._getActionManagerForTrigger(A.a.ACTION_OnDoublePickTrigger),i.doubleClick&&s&&s.processTrigger(A.a.ACTION_OnDoublePickTrigger,y.a.CreateNew(e.pickedMesh,t)))}else if(!i.ignore)for(var l=0,u=a._pointerUpStage;l<u.length;l++)e=u[l].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t);!this._pickedDownMesh||this._pickedDownMesh===this._pickedUpMesh||(o=this._pickedDownMesh._getActionManagerForTrigger(A.a.ACTION_OnPickOutTrigger))&&o.processTrigger(A.a.ACTION_OnPickOutTrigger,y.a.CreateNew(this._pickedDownMesh,t));var h=0;a.onPointerObservable.hasObservers()&&(i.ignore||i.hasSwiped||(i.singleClick&&a.onPointerObservable.hasSpecificMask(O.a.POINTERTAP)?h=O.a.POINTERTAP:i.doubleClick&&a.onPointerObservable.hasSpecificMask(O.a.POINTERDOUBLETAP)&&(h=O.a.POINTERDOUBLETAP),!h)||(r=new O.b(h,t,e),this._setRayOnPointerInfo(r),a.onPointerObservable.notifyObservers(r,h)),i.ignore||(h=O.a.POINTERUP,r=new O.b(h,t,e),this._setRayOnPointerInfo(r),a.onPointerObservable.notifyObservers(r,h))),a.onPointerUp&&!i.ignore&&a.onPointerUp(t,e,h)},G.prototype.isPointerCaptured=function(e){return void 0===e&&(e=0),this._pointerCaptures[e]},G.prototype.attachControl=function(e,t,i,n){var h=this;void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===n&&(n=null);var r,o,a,s,c=this._scene;(n=n||c.getEngine().getInputElement())&&(o=c.getEngine(),this._initActionManager=function(e,t){var i;return h._meshPickProceed||(i=c.pick(h._unTranslatedPointerX,h._unTranslatedPointerY,c.pointerDownPredicate,!1,c.cameraToUseForPointers),(h._currentPickResult=i)&&(e=i.hit&&i.pickedMesh?i.pickedMesh._getActionManagerForTrigger():null),h._meshPickProceed=!0),e},this._delayedSimpleClick=function(e,t,i){(Date.now()-h._previousStartingPointerTime>G.DoubleClickDelay&&!h._doubleClickOccured||e!==h._previousButtonPressed)&&(h._doubleClickOccured=!1,t.singleClick=!0,t.ignore=!1,i(t,h._currentPickResult))},this._initClickEvent=function(e,t,i,n){var r=new D,o=h._currentPickResult=null,a=e.hasSpecificMask(O.a.POINTERPICK)||t.hasSpecificMask(O.a.POINTERPICK)||e.hasSpecificMask(O.a.POINTERTAP)||t.hasSpecificMask(O.a.POINTERTAP)||e.hasSpecificMask(O.a.POINTERDOUBLETAP)||t.hasSpecificMask(O.a.POINTERDOUBLETAP);!a&&M.a&&(o=h._initActionManager(o,r))&&(a=o.hasPickTriggers);var s,c,l,u=!1;a&&(s=i.button,r.hasSwiped=h._isPointerSwiping(),r.hasSwiped||((c=!G.ExclusiveDoubleClickMode)||(c=!e.hasSpecificMask(O.a.POINTERDOUBLETAP)&&!t.hasSpecificMask(O.a.POINTERDOUBLETAP))&&!M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(o=h._initActionManager(o,r))&&(c=!o.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),c?(Date.now()-h._previousStartingPointerTime>G.DoubleClickDelay||s!==h._previousButtonPressed)&&(r.singleClick=!0,n(r,h._currentPickResult),u=!0):(h._previousDelayedSimpleClickTimeout=h._delayedSimpleClickTimeout,h._delayedSimpleClickTimeout=window.setTimeout(h._delayedSimpleClick.bind(h,s,r,n),G.DoubleClickDelay)),!(l=e.hasSpecificMask(O.a.POINTERDOUBLETAP)||t.hasSpecificMask(O.a.POINTERDOUBLETAP))&&M.a.HasS
1pecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(o=h._initActionManager(o,r))&&(l=o.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),l&&(s===h._previousButtonPressed&&Date.now()-h._previousStartingPointerTime<G.DoubleClickDelay&&!h._doubleClickOccured?(r.hasSwiped||h._isPointerSwiping()?(h._doubleClickOccured=!1,h._previousStartingPointerTime=h._startingPointerTime,h._previousStartingPointerPosition.x=h._startingPointerPosition.x,h._previousStartingPointerPosition.y=h._startingPointerPosition.y,h._previousButtonPressed=s,G.ExclusiveDoubleClickMode?(h._previousDelayedSimpleClickTimeout&&clearTimeout(h._previousDelayedSimpleClickTimeout),h._previousDelayedSimpleClickTimeout=h._delayedSimpleClickTimeout,n(r,h._previousPickResult)):n(r,h._currentPickResult)):(h._previousStartingPointerTime=0,h._doubleClickOccured=!0,r.doubleClick=!0,r.ignore=!1,G.ExclusiveDoubleClickMode&&h._previousDelayedSimpleClickTimeout&&clearTimeout(h._previousDelayedSimpleClickTimeout),h._previousDelayedSimpleClickTimeout=h._delayedSimpleClickTimeout,n(r,h._currentPickResult)),u=!0):(h._doubleClickOccured=!1,h._previousStartingPointerTime=h._startingPointerTime,h._previousStartingPointerPosition.x=h._startingPointerPosition.x,h._previousStartingPointerPosition.y=h._startingPointerPosition.y,h._previousButtonPressed=s)))),u||n(r,h._currentPickResult)},this._onPointerMove=function(e){var t;h._updatePointerPosition(e),h._checkPrePointerObservable(null,e,e.type===h._wheelEventName?O.a.POINTERWHEEL:O.a.POINTERMOVE)||!c.cameraToUseForPointers&&!c.activeCamera||(c.pointerMovePredicate||(c.pointerMovePredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||c.constantlyUpdateMeshUnderPointer||null!=e._getActionManagerForTrigger())&&(!c.cameraToUseForPointers||0!=(c.cameraToUseForPointers.layerMask&e.layerMask))}),t=c.pick(h._unTranslatedPointerX,h._unTranslatedPointerY,c.pointerMovePredicate,!1,c.cameraToUseForPointers),h._processPointerMove(t,e))},this._onPointerDown=function(e){var t;h._totalPointersPressed++,h._pickedDownMesh=null,h._meshPickProceed=!1,h._updatePointerPosition(e),c.preventDefaultOnPointerDown&&n&&(e.preventDefault(),n.focus()),h._startingPointerPosition.x=h._pointerX,h._startingPointerPosition.y=h._pointerY,h._startingPointerTime=Date.now(),h._checkPrePointerObservable(null,e,O.a.POINTERDOWN)||!c.cameraToUseForPointers&&!c.activeCamera||(h._pointerCaptures[e.pointerId]=!0,c.pointerDownPredicate||(c.pointerDownPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!c.cameraToUseForPointers||0!=(c.cameraToUseForPointers.layerMask&e.layerMask))}),h._pickedDownMesh=null,t=c.pick(h._unTranslatedPointerX,h._unTranslatedPointerY,c.pointerDownPredicate,!1,c.cameraToUseForPointers),h._processPointerDown(t,e))},this._onPointerUp=function(i){0!==h._totalPointersPressed&&(h._totalPointersPressed--,h._pickedUpMesh=null,h._meshPickProceed=!1,h._updatePointerPosition(i),c.preventDefaultOnPointerUp&&n&&(i.preventDefault(),n.focus()),h._initClickEvent(c.onPrePointerObservable,c.onPointerObservable,i,function(e,t){if(c.onPrePointerObservable.hasObservers()&&!e.ignore){if(!e.hasSwiped){if(e.singleClick&&c.onPrePointerObservable.hasSpecificMask(O.a.POINTERTAP)&&h._checkPrePointerObservable(null,i,O.a.POINTERTAP))return;if(e.doubleClick&&c.onPrePointerObservable.hasSpecificMask(O.a.POINTERDOUBLETAP)&&h._checkPrePointerObservable(null,i,O.a.POINTERDOUBLETAP))return}if(h._checkPrePointerObservable(null,i,O.a.POINTERUP))return}h._pointerCaptures[i.pointerId]&&(h._pointerCaptures[i.pointerId]=!1,(c.cameraToUseForPointers||c.activeCamera)&&(c.pointerUpPredicate||(c.pointerUpPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!c.cameraToUseForPointers||0!=(c.cameraToUseForPointers.layerMask&e.layerMask))}),!h._meshPickProceed&&(M.a&&M.a.HasTriggers||c.onPointerObservable.hasObservers())&&h._initActionManager(null,e),t=t||h._currentPickResult,h._processPointerUp(t,i,e),h._previousPickResult=h._currentPickResult))}))},this._onKeyDown=function(e){var t=I.a.KEYDOWN;if(c.onPreKeyboardObservable.hasObservers()){var i=new I.c(t,e);if(c.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnPointerObservable)return}c.onKeyboardObservable.hasObservers()&&(i=new I.b(t,e),c.onKeyboardObservable.notifyObservers(i,t)),c.actionManager&&c.actionManager.processTrigger(A.a.ACTION_OnKeyDownTrigger,y.a.CreateNewFromScene(c,e))},this._onKeyUp=function(e){var t=I.a.KEYUP;if(c.onPreKeyboardObservable.hasObservers()){var i=new I.c(t,e);if(c.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnPointerObservable)return}c.onKeyboardObservable.hasObservers()&&(i=new I.b(t,e),c.onKeyboardObservable.notifyObservers(i,t)),c.actionManager&&c.actionManager.processTrigger(A.a.ACTION_OnKeyUpTrigger,y.a.CreateNewFromScene(c,e))}
1,this._onCanvasFocusObserver=o.onCanvasFocusObservable.add((r=function(){n&&(n.addEventListener("keydown",h._onKeyDown,!1),n.addEventListener("keyup",h._onKeyUp,!1))},document.activeElement===n&&r(),r)),this._onCanvasBlurObserver=o.onCanvasBlurObservable.add(function(){n&&(n.removeEventListener("keydown",h._onKeyDown),n.removeEventListener("keyup",h._onKeyUp))}),a=v.b.GetPointerPrefix(o),i&&(n.addEventListener(a+"move",this._onPointerMove,!1),this._wheelEventName="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",n.addEventListener(this._wheelEventName,this._onPointerMove,!1)),t&&n.addEventListener(a+"down",this._onPointerDown,!1),e&&(s=c.getEngine().getHostWindow())&&s.addEventListener(a+"up",this._onPointerUp,!1))},G.prototype.detachControl=function(){var e=this._scene.getEngine().getInputElement(),t=this._scene.getEngine(),i=v.b.GetPointerPrefix(t);e&&(e.removeEventListener(i+"move",this._onPointerMove),e.removeEventListener(this._wheelEventName,this._onPointerMove),e.removeEventListener(i+"down",this._onPointerDown),window.removeEventListener(i+"up",this._onPointerUp),this._onCanvasBlurObserver&&t.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onCanvasFocusObserver&&t.onCanvasFocusObservable.remove(this._onCanvasFocusObserver),e.removeEventListener("keydown",this._onKeyDown),e.removeEventListener("keyup",this._onKeyUp),this._scene.doNotHandleCursors||(e.style.cursor=this._scene.defaultCursor))},G.prototype.setPointerOverMesh=function(e){var t;this._pointerOverMesh!==e&&(this._pointerOverMesh&&(t=this._pointerOverMesh._getActionManagerForTrigger(A.a.ACTION_OnPointerOutTrigger))&&t.processTrigger(A.a.ACTION_OnPointerOutTrigger,y.a.CreateNew(this._pointerOverMesh)),this._pointerOverMesh=e,this._pointerOverMesh&&(t=this._pointerOverMesh._getActionManagerForTrigger(A.a.ACTION_OnPointerOverTrigger))&&t.processTrigger(A.a.ACTION_OnPointerOverTrigger,y.a.CreateNew(this._pointerOverMesh)))},G.prototype.getPointerOverMesh=function(){return this._pointerOverMesh},G.DragMovementThreshold=10,G.LongPressDelay=500,G.DoubleClickDelay=300,G.ExclusiveDoubleClickMode=!1,G),N=i(67),F=i(10),w=i(124),B=i(301),U=i(68),V=(r=p.a,Object(o.d)(k,r),k.DefaultMaterialFactory=function(e){throw R.a.WarnImport("StandardMaterial")},k.CollisionCoordinatorFactory=function(){throw R.a.WarnImport("DefaultCollisionCoordinator")},Object.defineProperty(k.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"environmentIntensity",{get:function(){return this._environmentIntensity},set:function(e){this._environmentIntensity!==e&&(this._environmentIntensity=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"forceWireframe",{get:function(){return this._forceWireframe},set:function(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"skipFrustumClipping",{get:function(){return this._skipFrustumClipping},set:function(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"forcePointsCloud",{get:function(){return this._forcePointsCloud},set:function(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}
1),Object.defineProperty(k.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"beforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"afterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"beforeCameraRender",{set:function(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"afterCameraRender",{set:function(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"unTranslatedPointer",{get:function(){return this._inputManager.unTranslatedPointer},enumerable:!1,configurable:!0}),Object.defineProperty(k,"DragMovementThreshold",{get:function(){return L.DragMovementThreshold},set:function(e){L.DragMovementThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(k,"LongPressDelay",{get:function(){return L.LongPressDelay},set:function(e){L.LongPressDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(k,"DoubleClickDelay",{get:function(){return L.DoubleClickDelay},set:function(e){L.DoubleClickDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(k,"ExclusiveDoubleClickMode",{get:function(){return L.ExclusiveDoubleClickMode},set:function(e){L.ExclusiveDoubleClickMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"useRightHandedSystem",{get:function(){return this._useRightHandedSystem},set:function(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),k.prototype.setStepId=function(e){this._currentStepId=e},k.prototype.getStepId=function(){return this._currentStepId},k.prototype.getInternalStep=function(){return this._currentInternalStep},Object.defineProperty(k.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"fogMode",{get:function(){return this._fogMode},set:function(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"shadowsEnabled",{get:function(){return this._shadowsEnabled},set:function(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_LightDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"lightsEnabled",{get:function(){return this._lightsEnabled},set:function(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_LightDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"activeCamera",{get:function(){return this._activeCamera},set:function(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"defaultMaterial",{get:function(){return this._defaultMaterial||(this._defaultMaterial=k.DefaultMaterialFactory(this)),this._defaultMaterial},set:function(e){this._defaultMaterial=e},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"texturesEnabled",{get:function(){return this._texturesEnabled},set:function(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_TextureDirtyFlag))}
1,enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"skeletonsEnabled",{get:function(){return this._skeletonsEnabled},set:function(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(A.a.MATERIAL_AttributesDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"collisionCoordinator",{get:function(){return this._collisionCoordinator||(this._collisionCoordinator=k.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"frustumPlanes",{get:function(){return this._frustumPlanes},enumerable:!1,configurable:!0}),k.prototype._registerTransientComponents=function(){if(0<this._transientComponents.length){for(var e=0,t=this._transientComponents;e<t.length;e++)t[e].register();this._transientComponents=[]}},k.prototype._addComponent=function(e){this._components.push(e),this._transientComponents.push(e),e.addFromContainer&&e.serialize&&this._serializableComponents.push(e)},k.prototype._getComponent=function(e){for(var t=0,i=this._components;t<i.length;t++){var n=i[t];if(n.name===e)return n}return null},k.prototype.getClassName=function(){return"Scene"},k.prototype._getDefaultMeshCandidates=function(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates},k.prototype._getDefaultSubMeshCandidates=function(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates},k.prototype.setDefaultCandidateProviders=function(){this.getActiveMeshCandidates=this._getDefaultMeshCandidates.bind(this),this.getActiveSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getIntersectingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getCollidingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this)},Object.defineProperty(k.prototype,"meshUnderPointer",{get:function(){return this._inputManager.meshUnderPointer},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"pointerX",{get:function(){return this._inputManager.pointerX},set:function(e){this._inputManager.pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"pointerY",{get:function(){return this._inputManager.pointerY},set:function(e){this._inputManager.pointerY=e},enumerable:!1,configurable:!0}),k.prototype.getCachedMaterial=function(){return this._cachedMaterial},k.prototype.getCachedEffect=function(){return this._cachedEffect},k.prototype.getCachedVisibility=function(){return this._cachedVisibility},k.prototype.isCachedMaterialInvalid=function(e,t,i){return void 0===i&&(i=1),this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i},k.prototype.getEngine=function(){return this._engine},k.prototype.getTotalVertices=function(){return this._totalVertices.current},Object.defineProperty(k.prototype,"totalVerticesPerfCounter",{get:function(){return this._totalVertices},enumerable:!1,configurable:!0}),k.prototype.getActiveIndices=function(){return this._activeIndices.current},Object.defineProperty(k.prototype,"totalActiveIndicesPerfCounter",{get:function(){return this._activeIndices},enumerable:!1,configurable:!0}),k.prototype.getActiveParticles=function(){return this._activeParticles.current},Object.defineProperty(k.prototype,"activeParticlesPerfCounter",{get:function(){return this._activeParticles},enumerable:!1,configurable:!0}),k.prototype.getActiveBones=function(){return this._activeBones.current},Object.defineProperty(k.prototype,"activeBonesPerfCounter",{get:function(){return this._activeBones},enumerable:!1,configurable:!0}),k.prototype.getActiveMeshes=function(){return this._activeMeshes},k.prototype.getAnimationRatio=function(){return void 0!==this._animationRatio?this._animationRatio:1},k.prototype.getRenderId=function(){return this._renderId},k.prototype.getFrameId=function(){return this._frameId},k.prototype.incrementRenderId=function(){this._renderId++},k.prototype._createUbo=function(){this._sceneUbo=new m.a(this._engine,void 0,!0),this._sceneUbo.addUniform("viewProjection",16),this._sceneUbo.addUniform("view",16)},k.prototype.simulatePointerMove=function(e,t){return this._inputManager.simulatePointerMove(e,t),this},k.prototype.simulatePointerDown=function(e,t){return this._inputManager.simulatePointerDown(e,t),this},k.prototype.simulatePointerUp=function(e,t,i){return this._inputManager.simulatePointerUp(e,t,i),this},k.prototype.isPointerCaptured=function(e){return void 0===e&&(e=0),this._inputManager.isPointerCaptured(e)},k.prototype.attachControl=function(e,t,i){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),this._inputManager.attachControl(e,t,i)},k.prototype.detachControl=function(){this._inputManager.detachControl()},k.prototype.isReady=function(){if(this._isDisposed)return!1;var e,t=this.getEngine();
1if(!t.areAllEffectsReady())return!1;if(0<this._pendingData.length)return!1;for(e=0;e<this.meshes.length;e++){var i=this.meshes[e];if(i.isEnabled()&&i.subMeshes&&0!==i.subMeshes.length){if(!i.isReady(!0))return!1;for(var n=i.hasThinInstances||"InstancedMesh"===i.getClassName()||"InstancedLinesMesh"===i.getClassName()||t.getCaps().instancedArrays&&0<i.instances.length,r=0,o=this._isReadyForMeshStage;r<o.length;r++)if(!o[r].action(i,n))return!1}}for(e=0;e<this.geometries.length;e++)if(this.geometries[e].delayLoadState===A.a.DELAYLOADSTATE_LOADING)return!1;if(this.activeCameras&&0<this.activeCameras.length){for(var a=0,s=this.activeCameras;a<s.length;a++)if(!s[a].isReady(!0))return!1}else if(this.activeCamera&&!this.activeCamera.isReady(!0))return!1;for(var c=0,l=this.particleSystems;c<l.length;c++)if(!l[c].isReady())return!1;return!0},k.prototype.resetCachedMaterial=function(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null},k.prototype.registerBeforeRender=function(e){this.onBeforeRenderObservable.add(e)},k.prototype.unregisterBeforeRender=function(e){this.onBeforeRenderObservable.removeCallback(e)},k.prototype.registerAfterRender=function(e){this.onAfterRenderObservable.add(e)},k.prototype.unregisterAfterRender=function(e){this.onAfterRenderObservable.removeCallback(e)},k.prototype._executeOnceBeforeRender=function(e){var t=this,i=function(){e(),setTimeout(function(){t.unregisterBeforeRender(i)})};this.registerBeforeRender(i)},k.prototype.executeOnceBeforeRender=function(e,t){var i=this;void 0!==t?setTimeout(function(){i._executeOnceBeforeRender(e)},t):this._executeOnceBeforeRender(e)},k.prototype._addPendingData=function(e){this._pendingData.push(e)},k.prototype._removePendingData=function(e){var t=this.isLoading,i=this._pendingData.indexOf(e);-1!==i&&this._pendingData.splice(i,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)},k.prototype.getWaitingItemsCount=function(){return this._pendingData.length},Object.defineProperty(k.prototype,"isLoading",{get:function(){return 0<this._pendingData.length},enumerable:!1,configurable:!0}),k.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout(function(){t._checkIsReady()},150))},k.prototype.whenReadyAsync=function(){var t=this;return new Promise(function(e){t.executeWhenReady(function(){e()})})},k.prototype._checkIsReady=function(){var e=this;return this._registerTransientComponents(),this.isReady()?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):void(this._executeWhenReadyTimeoutId=setTimeout(function(){e._checkIsReady()},150))},Object.defineProperty(k.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!1,configurable:!0}),k.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=n.a.Now},k.prototype.getViewMatrix=function(){return this._viewMatrix},k.prototype.getProjectionMatrix=function(){return this._projectionMatrix},k.prototype.getTransformMatrix=function(){return this._transformMatrix},k.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?w.a.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=w.a.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update()))},k.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},k.prototype.getUniqueId=function(){return B.a.UniqueId},k.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this._blockEntityCollection||(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEac
1h(function(e){i.addMesh(e)}))},k.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(),e.parent||e._removeFromSceneRootNodes()),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(function(e){i.removeMesh(e)}),n},k.prototype.addTransformNode=function(e){this._blockEntityCollection||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))},k.prototype.removeTransformNode=function(e){var t,i=e._indexInSceneTransformNodesArray;return-1!==i&&(i!==this.transformNodes.length-1&&(t=this.transformNodes[this.transformNodes.length-1],(this.transformNodes[i]=t)._indexInSceneTransformNodesArray=i),e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()),this.onTransformNodeRemovedObservable.notifyObservers(e),i},k.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e)),t},k.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},k.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i<n.length;i++)n[i]._removeLightSource(e,!1);this.lights.splice(t,1),this.sortLightsByPriority(),e.parent||e._removeFromSceneRootNodes()}return this.onLightRemovedObservable.notifyObservers(e),t},k.prototype.removeCamera=function(e){var t=this.cameras.indexOf(e);-1!==t&&(this.cameras.splice(t,1),e.parent||e._removeFromSceneRootNodes());var i=this.activeCameras.indexOf(e);return-1!==i&&this.activeCameras.splice(i,1),this.activeCamera===e&&(0<this.cameras.length?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},k.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},k.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},k.prototype.stopAnimation=function(e,t,i){},k.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},k.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),t},k.prototype.removeMaterial=function(e){var t,i=e._indexInSceneMaterialArray;return-1!==i&&i<this.materials.length&&(i!==this.materials.length-1&&(t=this.materials[this.materials.length-1],(this.materials[i]=t)._indexInSceneMaterialArray=i),e._indexInSceneMaterialArray=-1,this.materials.pop()),this.onMaterialRemovedObservable.notifyObservers(e),i},k.prototype.removeActionManager=function(e){var t=this.actionManagers.indexOf(e);return-1!==t&&this.actionManagers.splice(t,1),t},k.prototype.removeTexture=function(e){var t=this.textures.indexOf(e);return-1!==t&&this.textures.splice(t,1),this.onTextureRemovedObservable.notifyObservers(e),t},k.prototype.addLight=function(e){if(!this._blockEntityCollection){this.lights.push(e),this.sortLightsByPriority(),e.parent||e._addToSceneRootNodes();for(var t=0,i=this.meshes;t<i.length;t++){var n=i[t];-1===n.lightSources.indexOf(e)&&(n.lightSources.push(e),n._resyncLightSources())}this.onNewLightAddedObservable.notifyObservers(e)}},k.prototype.sortLightsByPriority=function(){this.requireLightSorting&&this.lights.sort(_.a.CompareLightsPriority)},k.prototype.addCamera=function(e){this._blockEntityCollection||(this.cameras.push(e),this.onNewCameraAddedObservable.notifyObservers(e),e.parent||e._addToSceneRootNodes())},k.prototype.addSkeleton=function(e){this._blockEntityCollection||(this.skeletons.push(e),this.onNewSkeletonAddedObservable.notifyObservers(e))},k.prototype.addParticleSystem=function(e){this._blockEntityCollection||this.particleSystems.push(e)},k.prototype.addAnimation=function(e){this._blockEntityCollection||this.animations.push(e)},k.prototype.addAnimationGroup=function(e){this._blockEntityCollection||this.animationGroups.push(e)},k.prototype.addMultiMaterial=function(e){this._blockEntityCollection||this.multiMaterials.push(e)},k.prototype.addMaterial=function(e){this._blockEntityCollection||(e._indexInSceneMaterialArray=this.materials.length,this.materials.push(e),this.onNewMaterialAddedObservable.notifyObservers(e))},k.prototype.addMorphTargetManager=function(e){this._blockEntityCollection||this.morphTargetManagers.push(e)},k.prototype.addGeometry=function(e){this._blockEntityCollection||(this.geometriesByUniqueId&&(this.geometriesByUniqueId[e.uniqueId]=this.geometries.length),this.geometries.push(e))},k.prototype.addActionManager=function(e){this.actionManagers.push(e)},k.prototype.addTexture=function(e){this._blockEntityCollection||(this.textures.push(e),this.onNewTextureAddedObservable.notifyObservers(e))},k.prototype.switchActiveCamera=function(e,t){void 0===t&&(t=!0);var i=this._engine.getInputElement();i&&(this.activeCamera&&this.activeCamera.detachControl(i),this.activeCamera=e,t&&e.attachControl(i))},k.prototype.setActiveCameraByID=function(e){var t=this.getCameraByID(e);return t?this.activeCamera=t:null},k.prototype.setActiveCameraByName=function(e){var t=this.getCameraByName(e);return t?this.activeCamera=t:null},k.prototype.getAnimationGroupByName=function(e){for(var t=0;t<this.animationGroups.length;t++)if(this.animationGroups[t].name===e)return this.animationGroups[t];return null},k.prototype.getMaterialByUniqueID=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].uniqueId===e)return this.materials[t];return null},k.prototype.getMaterialByID=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].id===e)return this.materials[t];return null},k.prototype.getLastMaterialByID=function(e){for(var t=this.materials.length-1;0<=t;t--)if(this.materials[t].id===e)return this.materials[t];return null},k.prototype.getMaterialByName=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].name===e)return this.materials[t];return null},k.prototype.getTextureByUniqueID=function(e){for(var t=0;t<this.textures.length;t++)if(this.textures[t].uniqueId===e)return this.textures[t];return null},k.prototype.getCameraByID=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].id===e)return this.cameras[t];return null},k.prototype.getCameraByUniqueID=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].uniqueId===e)return this.cameras[t];return null},k.prototype.getCameraByName=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].name===e)return this.cameras[t];return null},k.prototype.getBoneByID=function(e){for(var t=0;t<this.skeletons.length;t++)for(var i=this.skeletons[t],n=0;n<i.bones.length;n++)if(i.bones[n].id===e)return i.bones[n];return null},k.prototype.getBoneByName=function(e){for(var t=0;t<this.skeletons.length;t++)for(var i=this.skeletons[t],n=0;n<i.bones.length;n++)if(i.bones[n].name===e)return i.bones[n];return null},k.prototype.getLightByName=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].name===e)return this.lights[t];return null},k.prototype.getLightByID=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].id===e)return this.lights[t];return null},k.prototype.getLightByUniqueID=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].uniqueId===e)return this.lights[t];return null},k.prototype.getParticleSystemByID=function(e){for(var t=0;t<this.particleSystems.length;t++)if(this.particleSystems[t].id===e)return this.particleSystems[t];return null},k.prototype.getGeometryByID=function(e){for(var t=0;t<this.geometries.length;t++)if(this.geometries[t].id===e)return this.geometries[t];return null},k.prototype._getGeometryByUniqueID=function(e){if(this.geometriesByUniqueId){var t=this.geometriesByUniqueId[e];if(void 0!==t)return this.geometries[t]}else for(var i=0;i<this.geometries.length;i++)if(this.geometries[i].uniqueId===e)return this.geometries[i];return null},k.prototype.pushGeometry=function(e,t){return!(!t&&this._getGeometryByUniqueID(e.uniqueId)||(this.addGeometry(e),this.onNewGeometryAddedObservable.notifyObservers(e),0))},k.prototype.removeGeometry=function(e){var t,i;if(this.geometriesByUniqueId){if(void 0===(t=this.geometriesByUniqueId[e.uniqueId]))return!1}else if((t=this.geometries.indexOf(e))<0)return!1;return t!==this.geometries.length-1&&(i=this.geometries[this.geometries.length-1],this.geometries[t]=i,this.geometriesByUniqueId&&(this.geometriesByUniqueId[i.uniqueId]=t,this.geometriesByUniqueId[e.uniqueId]=void 0)),this.geometries.pop(),this.onGeometryRemovedObservable.notifyObservers(e),!0},k.prototype.getGeometries=function(){return this.geometries},k.prototype.getMeshByID=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].id===e)return this.meshes[t];return null},k.prototype.getMeshesByID=function(t){return this.meshes.filter(function(e){return e.id===t})},k.prototype.getTransformNodeByID=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null},k.prototype.getTransformNodeByUniqueID=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].uniqueId===e)return this.transformNodes[t];return null},k.prototype.getTransformNodesByID=function(t){return this.transformNodes.filter(function(e){return e.id===t})},k.prototype.getMeshByUniqueID=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].uniqueId===e)return this.meshes[t];return null},k.prototype.getLastMeshByID=function(e){for(var t=this.meshes.length-1;0<=t;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},k.prototype.getLastEntryByID=function(e){for(var t=this.meshes.length-1;0<=t;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;0<=t;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;0<=t;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;0<=t;t--)if(this.lights[t].id===e)return this.lights[t];return null},k.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);return r||this.getBoneByID(e)||null},k.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);
1if(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);return r||this.getBoneByName(e)||null},k.prototype.getMeshByName=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].name===e)return this.meshes[t];return null},k.prototype.getTransformNodeByName=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].name===e)return this.transformNodes[t];return null},k.prototype.getLastSkeletonByID=function(e){for(var t=this.skeletons.length-1;0<=t;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},k.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].uniqueId===e)return this.skeletons[t];return null},k.prototype.getSkeletonById=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].id===e)return this.skeletons[t];return null},k.prototype.getSkeletonByName=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].name===e)return this.skeletons[t];return null},k.prototype.getMorphTargetManagerById=function(e){for(var t=0;t<this.morphTargetManagers.length;t++)if(this.morphTargetManagers[t].uniqueId===e)return this.morphTargetManagers[t];return null},k.prototype.getMorphTargetById=function(e){for(var t=0;t<this.morphTargetManagers.length;++t)for(var i=this.morphTargetManagers[t],n=0;n<i.numTargets;++n){var r=i.getTarget(n);if(r.id===e)return r}return null},k.prototype.getMorphTargetByName=function(e){for(var t=0;t<this.morphTargetManagers.length;++t)for(var i=this.morphTargetManagers[t],n=0;n<i.numTargets;++n){var r=i.getTarget(n);if(r.name===e)return r}return null},k.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},Object.defineProperty(k.prototype,"uid",{get:function(){return this._uid||(this._uid=v.b.RandomId()),this._uid},enumerable:!1,configurable:!0}),k.prototype.addExternalData=function(e,t){return this._externalData||(this._externalData=new c.a),this._externalData.add(e,t)},k.prototype.getExternalData=function(e){return this._externalData?this._externalData.get(e):null},k.prototype.getOrAddExternalDataWithFactory=function(e,t){return this._externalData||(this._externalData=new c.a),this._externalData.getOrAddWithFactory(e,t)},k.prototype.removeExternalData=function(e){return this._externalData.remove(e)},k.prototype._evaluateSubMesh=function(e,t,i){if(i.hasInstances||i.isAnInstance||this.dispatchAllSubMeshesOfActiveMeshes||this._skipFrustumClipping||t.alwaysSelectAsActiveMesh||1===t.subMeshes.length||e.isInFrustum(this._frustumPlanes)){for(var n=0,r=this._evaluateSubMeshStage;n<r.length;n++)r[n].action(t,e);var o=e.getMaterial();null!=o&&(o.hasRenderTargetTextures&&null!=o.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(o)&&(this._processedMaterials.push(o),this._renderTargets.concatWithNoDuplicate(o.getRenderTargetTextures())),this._renderingManager.dispatch(e,t,o))}},k.prototype.freeProcessedMaterials=function(){this._processedMaterials.dispose()},Object.defineProperty(k.prototype,"blockfreeActiveMeshesAndRenderingGroups",{get:function(){return this._preventFreeActiveMeshesAndRenderingGroups},set:function(e){this._preventFreeActiveMeshesAndRenderingGroups!==e&&(e&&(this.freeActiveMeshes(),this.freeRenderingGroups()),this._preventFreeActiveMeshesAndRenderingGroups=e)},enumerable:!1,configurable:!0}),k.prototype.freeActiveMeshes=function(){if(!this.blockfreeActiveMeshesAndRenderingGroups&&(this._activeMeshes.dispose(),this.activeCamera&&this.activeCamera._activeMeshes&&this.activeCamera._activeMeshes.dispose(),this.activeCameras))for(var e=0;e<this.activeCameras.length;e++){var t=this.activeCameras[e];t&&t._activeMeshes&&t._activeMeshes.dispose()}},k.prototype.freeRenderingGroups=function(){if(!this.blockfreeActiveMeshesAndRenderingGroups&&(this._renderingManager&&this._renderingManager.freeRenderingGroups(),this.textures))for(var e=0;e<this.textures.length;e++){var t=this.textures[e];t&&t.renderList&&t.freeRenderingGroups()}},k.prototype._isInIntermediateRendering=function(){return this._intermediateRendering},k.prototype.freezeActiveMeshes=function(t){var i=this;return void 0===t&&(t=!1),this.executeWhenReady(function(){if(i.activeCamera){
1i._frustumPlanes||i.setTransformMatrix(i.activeCamera.getViewMatrix(),i.activeCamera.getProjectionMatrix()),i._evaluateActiveMeshes(),i._activeMeshesFrozen=!0,i._skipEvaluateActiveMeshesCompletely=t;for(var e=0;e<i._activeMeshes.length;e++)i._activeMeshes.data[e]._freeze()}}),this},k.prototype.unfreezeActiveMeshes=function(){for(var e=0;e<this.meshes.length;e++){var t=this.meshes[e];t._internalAbstractMeshDataInfo&&(t._internalAbstractMeshDataInfo._isActive=!1)}for(e=0;e<this._activeMeshes.length;e++)this._activeMeshes.data[e]._unFreeze();return this._activeMeshesFrozen=!1,this},k.prototype._evaluateActiveMeshes=function(){if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely)for(var e=this._activeMeshes.length,t=0;t<e;t++)(o=this._activeMeshes.data[t]).computeWorldMatrix();if(this._activeParticleSystems)for(var i=this._activeParticleSystems.length,t=0;t<i;t++)this._activeParticleSystems.data[t].animate()}else if(this.activeCamera){this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this),this.activeCamera._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset();for(var n=0,r=this._beforeEvaluateActiveMeshStage;n<r.length;n++)r[n].action();var o,a,s=this.getActiveMeshCandidates(),c=s.length;for(t=0;t<c;t++)!(o=s.data[t]).isBlocked&&(this._totalVertices.addCount(o.getTotalVertices(),!1),o.isReady()&&o.isEnabled()&&0!==o.scaling.lengthSquared())&&(o.computeWorldMatrix(),o.actionManager&&o.actionManager.hasSpecificTriggers2(A.a.ACTION_OnIntersectionEnterTrigger,A.a.ACTION_OnIntersectionExitTrigger)&&this._meshesForIntersections.pushNoDuplicate(o),null!=(a=this.customLODSelector?this.customLODSelector(o,this.activeCamera):o.getLOD(this.activeCamera))&&(a!==o&&a.billboardMode!==d.a.BILLBOARDMODE_NONE&&a.computeWorldMatrix(),o._preActivate(),o.isVisible&&0<o.visibility&&0!=(o.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||o.alwaysSelectAsActiveMesh||o.isInFrustum(this._frustumPlanes))&&(this._activeMeshes.push(o),this.activeCamera._activeMeshes.push(o),a!==o&&a._activate(this._renderId,!1),o._activate(this._renderId,!1)&&(o.isAnInstance?o._internalAbstractMeshDataInfo._actAsRegularMesh&&(a=o):a._internalAbstractMeshDataInfo._onlyForInstances=!1,a._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(o,a)),o._postActivate())));if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(var l=0;l<this.particleSystems.length;l++){var u,h=this.particleSystems[l];h.isStarted()&&h.emitter&&((u=h.emitter).position&&!u.isEnabled()||(this._activeParticleSystems.push(h),h.animate(),this._renderingManager.dispatchParticles(h)))}this.onAfterParticlesRenderingObservable.notifyObservers(this)}}},k.prototype._activeMesh=function(e,t){this._skeletonsEnabled&&null!==t.skeleton&&void 0!==t.skeleton&&(this._activeSkeletons.pushNoDuplicate(t.skeleton)&&t.skeleton.prepare(),t.computeBonesUsingShaders||this._softwareSkinnedMeshes.pushNoDuplicate(t));for(var i=0,n=this._activeMeshStage;i<n.length;i++)n[i].action(e,t);if(null!=t&&void 0!==t.subMeshes&&null!==t.subMeshes&&0<t.subMeshes.length)for(var r=this.getActiveSubMeshCandidates(t),o=r.length,a=0;a<o;a++){var s=r.data[a];this._evaluateSubMesh(s,t,e)}},k.prototype.updateTransformMatrix=function(e){this.activeCamera&&this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix(e))},k.prototype._bindFrameBuffer=function(){var e;this.activeCamera&&this.activeCamera._multiviewTexture?this.activeCamera._multiviewTexture._bindFrameBuffer():this.activeCamera&&this.activeCamera.outputRenderTarget?this.getEngine().getCaps().multiview&&this.activeCamera.outputRenderTarget&&1<this.activeCamera.outputRenderTarget.getViewCount()?this.activeCamera.outputRenderTarget._bindFrameBuffer():(e=this.activeCamera.outputRenderTarget.getInternalTexture())?this.getEngine().bindFramebuffer(e):P.a.Error("Camera contains invali
1d customDefaultRenderTarget"):this.getEngine().restoreDefaultFramebuffer()},k.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&&1<e.outputRenderTarget.getViewCount()?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;n<this._softwareSkinnedMeshes.length;n++){var r=this._softwareSkinnedMeshes.data[n];r.applySkeleton(r.skeleton)}this.onBeforeRenderTargetsRenderObservable.notifyObservers(this),e.customRenderTargets&&0<e.customRenderTargets.length&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&0<t.customRenderTargets.length&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets);for(var o=0,a=this._gatherActiveCameraRenderTargetsStage;o<a.length;o++)a[o].action(this._renderTargets);var s=!1;if(this.renderTargetsEnabled){if(this._intermediateRendering=!0,0<this._renderTargets.length){v.b.StartPerformanceCounter("Render targets",0<this._renderTargets.length);for(var c=0;c<this._renderTargets.length;c++){var l,u=this._renderTargets.data[c];u._shouldRender()&&(this._renderId++,l=u.activeCamera&&u.activeCamera!==this.activeCamera,u.render(l,this.dumpNextRenderTargets),s=!0)}v.b.EndPerformanceCounter("Render targets",0<this._renderTargets.length),this._renderId++}for(var h=0,d=this._cameraDrawRenderTargetStage;h<d.length;h++)s=d[h].action(this.activeCamera)||s;this._intermediateRendering=!1,this.activeCamera&&this.activeCamera.outputRenderTarget&&(s=!0)}s&&!this.prePass&&this._bindFrameBuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),!this.postProcessManager||e._multiviewTexture||this.prePass||this.postProcessManager._prepareFrame();for(var p=0,f=this._beforeCameraDrawStage;p<f.length;p++)f[p].action(this.activeCamera);this.onBeforeDrawPhaseObservable.notifyObservers(this),this._renderingManager.render(null,null,!0,!0),this.onAfterDrawPhaseObservable.notifyObservers(this);for(var m=0,_=this._afterCameraDrawStage;m<_.length;m++)_[m].action(this.activeCamera);this.postProcessManager&&!e._multiviewTexture&&this.postProcessManager._finalizeFrame(e.isIntermediate),this._renderTargets.reset(),this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}},k.prototype._processSubCameras=function(e){if(e.cameraRigMode===b.a.RIG_MODE_NONE||e.outputRenderTarget&&1<e.outputRenderTarget.getViewCount()&&this.getEngine().getCaps().multiview)return this._renderForCamera(e),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else for(var t=0;t<e._rigCameras.length;t++)this._renderForCamera(e._rigCameras[t],e);this._activeCamera=e,this.setTransformMatrix(this._activeCamera.getViewMatrix(),this._activeCamera.getProjectionMatrix()),this.onAfterRenderCameraObservable.notifyObservers(e)},k.prototype._checkIntersections=function(){for(var e=0;e<this._meshesForIntersections.length;e++){var t=this._meshesForIntersections.data[e];if(t.actionManager)for(var i=0;t.actionManager&&i<t.actionManager.actions.length;i++){var n,r,o,a,s=t.actionManager.actions[i];s.trigger!==A.a.ACTION_OnIntersectionEnterTrigger&&s.trigger!==A.a.ACTION_OnIntersectionExitTrigger||(n=s.getTriggerParameter(),o=(r=n instanceof h.a?n:n.mesh).intersectsMesh(t,n.usePreciseIntersection),a=t._intersectionsInProgress.indexOf(r),o&&-1===a?s.trigger===A.a.ACTION_OnIntersectionEnterTrigger?(s._executeCurrent(y.a.CreateNew(t,void 0,r)),t._intersectionsInProgress.push(r)):s.trigger===A.a.ACTION_OnIntersectionExitTrigger&&t._intersectionsInProgress.push(r):!o&&-1<a&&(s.trigger===A.a.ACTION_OnIntersectionExitTrigger&&s._executeCurrent(y.a.CreateNew(t,void 0,r)),t.actionManager.hasSpecificTrigger(A.a.ACTION_OnIntersectionExitTrigger,function(e){var t=e instanceof h.a?e:e.mesh;return r===t})&&s.trigger!==A.a.ACTION_OnIntersectionExitTrigger||t._intersectionsInProgress.splice(a,1)))}}},k.prototype._advancePhysicsEngineStep=function(e){},k.prototype._animate=function(){},k.prototype.animate=function(){if(this._engine.isDeterministicLockStep()){for(var e=Math.max(k.MinDeltaTime,Math.min(this._engine.getDeltaTime(),k.MaxDeltaTime))+this._timeAccumulator,t=this._engine.getTimeStep(),i=1e3/t/1e3,n=0,r=this._engine.getLockstepMaxSteps(),o=Math.floor(e/t),o=Math.min(o,r);0<e&&n<o;)this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=t*i,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this.physicsEnabled&&this._advancePhysicsEngineStep(t),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,n++,e-=t;this._timeAccumulator=e<0?0:e}else e=this.useConstantAnimationDeltaTime?16:Math.max(k.MinDeltaTime,Math.min(this._engine.getDeltaTime(),k.MaxDeltaTime)),this._animationRatio=.06*e,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this.physicsEnabled&&this._advancePhysicsEngineStep(e)},k.prototype.render=function(e,t){if(void 0===e&&(e=!0),void 0===t&&(t=!1),!this.isDisposed){this.onReadyObservable.hasObservers()&&-1===this._executeWhenReadyTimeoutId&&this._checkIsReady(),this._frameId++,this._registerTransientComponents(),this._activeParticles.fetchNewFrame(),this._totalVertices.fetchNewFrame(),this._activeIndices.fetchNewFrame(),this._activeBones.fetchNewFrame(),this._meshesForIntersections.reset(),this.resetCachedMaterial(),this.onBeforeAnimationsObservable.notifyObservers(this),this.actionManager&&this.actionManager.processTrigger(A.a.ACTION_OnEveryFrameTrigger),t||this.animate();for(var i=0,n=this._beforeCameraUpdateStage;i<n.length;i++)n[i].action();if(e)if(0<this.activeCameras.length)for(var r=0;r<this.activeCameras.length;r++){var o=this.activeCameras[r];if(o.update(),o.cameraRigMode!==b.a.RIG_MODE_NONE)for(var a=0;a<o._rigCameras.length;a++)o._rigCameras[a].update()}else if(this.activeCamera&&(this.activeCamera.update(),this.activeCamera.cameraRigMode!==b.a.RIG_MODE_NONE))for(a=0;a<this.activeCamera._rigCameras.length;a++)this.activeCamera._rigCameras[a].update();this.onBeforeRenderObservable.notifyObservers(this),this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);var s=this.getEngine(),c=this.activeCamera;
1if(this.renderTargetsEnabled){v.b.StartPerformanceCounter("Custom render targets",0<this.customRenderTargets.length),this._intermediateRendering=!0;for(var l=0;l<this.customRenderTargets.length;l++){var u=this.customRenderTargets[l];if(u._shouldRender()){if(this._renderId++,this.activeCamera=u.activeCamera||this.activeCamera,!this.activeCamera)throw new Error("Active camera not set");s.setViewport(this.activeCamera.viewport),this.updateTransformMatrix(),u.render(c!==this.activeCamera,this.dumpNextRenderTargets)}}v.b.EndPerformanceCounter("Custom render targets",0<this.customRenderTargets.length),this._intermediateRendering=!1,this._renderId++}this.activeCamera=c,this._activeCamera&&this._activeCamera.cameraRigMode!==b.a.RIG_MODE_CUSTOM&&!this.prePass&&this._bindFrameBuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var h=0,d=this._beforeClearStage;h<d.length;h++)d[h].action();!this.autoClearDepthAndStencil&&!this.autoClear||this.prePass||this._engine.clear(this.clearColor,this.autoClear||this.forceWireframe||this.forcePointsCloud,this.autoClearDepthAndStencil,this.autoClearDepthAndStencil);for(var p=0,f=this._gatherRenderTargetsStage;p<f.length;p++)f[p].action(this._renderTargets);if(0<this.activeCameras.length)for(r=0;r<this.activeCameras.length;r++)0<r&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[r]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections();for(var m=0,_=this._afterRenderStage;m<_.length;m++)_[m].action();if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(a=0;a<this._toBeDisposed.length;a++){var g=this._toBeDisposed[a];g&&g.dispose()}this._toBeDisposed=[]}this.dumpNextRenderTargets&&(this.dumpNextRenderTargets=!1),this._activeBones.addCount(0,!0),this._activeIndices.addCount(0,!0),this._activeParticles.addCount(0,!0)}},k.prototype.freezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].freeze()},k.prototype.unfreezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].unfreeze()},k.prototype.dispose=function(){this.beforeRender=null,this.afterRender=null,x.a._LastCreatedScene===this&&(x.a._LastCreatedScene=null),this.skeletons=[],this.morphTargetManagers=[],this._transientComponents=[],this._isReadyForMeshStage.clear(),this._beforeEvaluateActiveMeshStage.clear(),this._evaluateSubMeshStage.clear(),this._activeMeshStage.clear(),this._cameraDrawRenderTargetStage.clear(),this._beforeCameraDrawStage.clear(),this._beforeRenderTargetDrawStage.clear(),this._beforeRenderingGroupDrawStage.clear(),this._beforeRenderingMeshStage.clear(),this._afterRenderingMeshStage.clear(),this._afterRenderingGroupDrawStage.clear(),this._afterCameraDrawStage.clear(),this._afterRenderTargetDrawStage.clear(),this._afterRenderStage.clear(),this._beforeCameraUpdateStage.clear(),this._beforeClearStage.clear(),this._gatherRenderTargetsStage.clear(),this._gatherActiveCameraRenderTargetsStage.clear(),this._pointerMoveStage.clear(),this._pointerDownStage.clear(),this._pointerUpStage.clear();for(var e=0,t=this._components;e<t.length;e++)t[e].dispose();this.importedMeshesFiles=new Array,this.stopAllAnimations&&this.stopAllAnimations(),this.resetCachedMaterial(),this.activeCamera&&(this.activeCamera._activeMeshes.dispose(),this.activeCamera=null),this._activeMeshes.dispose(),this._renderingManager.dispose(),this._processedMaterials.dispose(),this._activeParticleSystems.dispose(),this._activeSkeletons.dispose(),this._softwareSkinnedMeshes.dispose(),this._renderTargets.dispose(),this._registeredForLateAnimationBindings.dispose(),this._meshesForIntersections.dispose(),this._toBeDisposed=[];for(var i=0,n=this._activeRequests;i<n.length;i++)n[i].abort();this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.onBeforeRenderingGroupObservable.clear(),this.onAfterRenderingGroupObservable.clear(),this.onMeshImportedObservable.clear(),this.onBeforeCameraRenderObservable.clear(),this.onAfterCameraRenderObservable.clear(),this.onReadyObservable.clear(),this.onNewCameraAddedObservable.clear(),this.onCameraRemovedObservable.clear(),this.onNewLightAddedObservable.clear(),this.onLightRemovedObservable.clear(),this.onNewGeometryAddedObservable.clear(),this.onGeometryRemovedObservable.clear(),this.onNewTransformNodeAddedObservable.clear(),this.onTransformNodeRemovedObservable.clear(),this.onNewMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onNewSkeletonAddedObservable.clear(),this.onSkeletonRemovedObservable.clear(),this.onNewMaterialAddedObservable.clear(),this.onMaterialRemovedObservable.clear(),this.onNewTextureAddedObservable.clear(),this.onTextureRemovedObservable.clear(),this.onPrePointerObservable.clear(),this.onPointerObservable.clear(),this.onPreKeyboardObservable.clear(),this.onKeyboardObservable.clear(),this.onActiveCameraChanged.clear(),this.detachControl();var r,o=this._engine.getInputElement();if(o)for(r=0;r<this.cameras.length;r++)this.cameras[r].detachControl(o);for(;this.animationGroups.length;)this.animationGroups[0].dispose();for(;this.lights.length;)this.lights[0].dispose();for(;this.meshes.length;)this.meshes[0].dispose(!0);for(;this.transformNodes.length;)this.transformNodes[0].dispose(!0);for(;this.cameras.length;)this.cameras[0].dispose();for(this._defaultMaterial&&this._defaultMaterial.dispose();this.multiMaterials.length;)this.multiMaterials[0].dispose();for(;this.materials.length;)this.materials[0].dispose();for(;this.particleSystems.length;)this.particleSystems[0].dispose();for(;this.postProcesses.length;
1)this.postProcesses[0].dispose();for(;this.textures.length;)this.textures[0].dispose();this._sceneUbo.dispose(),this._multiviewSceneUbo&&this._multiviewSceneUbo.dispose(),this.postProcessManager.dispose(),-1<(r=this._engine.scenes.indexOf(this))&&this._engine.scenes.splice(r,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(k.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),k.prototype.clearCachedVertexData=function(){for(var e=0;e<this.meshes.length;e++){var t=this.meshes[e].geometry;if(t)for(var i in t._indices=[],t._vertexBuffers)t._vertexBuffers.hasOwnProperty(i)&&(t._vertexBuffers[i]._buffer._data=null)}},k.prototype.cleanCachedTextureBuffer=function(){for(var e=0,t=this.textures;e<t.length;e++){var i=t[e];i._buffer&&(i._buffer=null)}},k.prototype.getWorldExtends=function(e){var r=new u.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new u.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return e=e||function(){return!0},this.meshes.filter(e).forEach(function(e){var t,i,n;e.computeWorldMatrix(!0),e.subMeshes&&0!==e.subMeshes.length&&!e.infiniteDistance&&(i=(t=e.getBoundingInfo()).boundingBox.minimumWorld,n=t.boundingBox.maximumWorld,u.e.CheckExtends(i,r,o),u.e.CheckExtends(n,r,o))}),{min:r,max:o}},k.prototype.createPickingRay=function(e,t,i,n,r){throw void 0===r&&(r=!1),R.a.WarnImport("Ray")},k.prototype.createPickingRayToRef=function(e,t,i,n,r,o){throw void 0===o&&(o=!1),R.a.WarnImport("Ray")},k.prototype.createPickingRayInCameraSpace=function(e,t,i){throw R.a.WarnImport("Ray")},k.prototype.createPickingRayInCameraSpaceToRef=function(e,t,i,n){throw R.a.WarnImport("Ray")},k.prototype.pick=function(e,t,i,n,r,o){var a=new g.a;return a._pickingUnavailable=!0,a},k.prototype.pickWithBoundingInfo=function(e,t,i,n,r){var o=new g.a;return o._pickingUnavailable=!0,o},k.prototype.pickWithRay=function(e,t,i,n){throw R.a.WarnImport("Ray")},k.prototype.multiPick=function(e,t,i,n,r){throw R.a.WarnImport("Ray")},k.prototype.multiPickWithRay=function(e,t,i){throw R.a.WarnImport("Ray")},k.prototype.setPointerOverMesh=function(e){this._inputManager.setPointerOverMesh(e)},k.prototype.getPointerOverMesh=function(){return this._inputManager.getPointerOverMesh()},k.prototype._rebuildGeometries=function(){for(var e=0,t=this.geometries;e<t.length;e++)t[e]._rebuild();for(var i=0,n=this.meshes;i<n.length;i++)n[i]._rebuild();this.postProcessManager&&this.postProcessManager._rebuild();for(var r=0,o=this._components;r<o.length;r++)o[r].rebuild();for(var a=0,s=this.particleSystems;a<s.length;a++)s[a].rebuild()},k.prototype._rebuildTextures=function(){for(var e=0,t=this.textures;e<t.length;e++)t[e]._rebuild();this.markAllMaterialsAsDirty(A.a.MATERIAL_TextureDirtyFlag)},k.prototype._getByTags=function(e,t,i){if(void 0===t)return e;var n=[];for(var r in i=i||function(e){},e){var o=e[r];l.a&&l.a.MatchesQuery(o,t)&&(n.push(o),i(o))}return n},k.prototype.getMeshesByTags=function(e,t){return this._getByTags(this.meshes,e,t)},k.prototype.getCamerasByTags=function(e,t){return this._getByTags(this.cameras,e,t)},k.prototype.getLightsByTags=function(e,t){return this._getByTags(this.lights,e,t)},k.prototype.getMaterialByTags=function(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))},k.prototype.setRenderingOrder=function(e,t,i,n){void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),this._renderingManager.setRenderingOrder(e,t,i,n)},k.prototype.setRenderingAutoClearDepthStencil=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!0),this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i,n)},k.prototype.getAutoClearDepthStencilSetup=function(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)},Object.defineProperty(k.prototype,"blockMaterialDirtyMechanism",{get:function(){return this._blockMaterialDirtyMechanism},set:function(e){this._blockMaterialDirtyMechanism!==e&&((this._blockMaterialDirtyMechanism=e)||this.markAllMaterialsAsDirty(A.a.MATERIAL_AllDirtyFlag))},enumerable:!1,configurable:!0}),k.prototype.markAllMaterialsAsDirty=function(e,t){if(!this._blockMaterialDirtyMechanism)for(var i=0,n=this.materials;i<n.length;i++){var r=n[i];t&&!t(r)||r.markAsDirty(e)}},k.prototype._loadFile=function(e,t,i,n,r,o){var a=this,s=U.a.LoadFile(e,t,i,n?this.offlineProvider:void 0,r,o);return this._activeRequests.push(s),s.onCompleteObservable.add(function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)}),s},k.prototype._loadFileAsync=function(e,n,r,o){var a=this;return new Promise(function(t,i){a._loadFile(e,function(e){t(e)},n,r,o,function(e,t){i(t)})})},k.prototype._requestFile=function(e,t,i,n,r,o,a){var s=this,c=U.a.RequestFile(e,t,i,n?this.offlineProvider:void 0,r,o,a);return this._activeRequests.push(c),c.onCompleteObservable.add(function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)}),c},k.prototype._requestFileAsync=function(e,n,r,o,a){var s=this;return new Promise(function(t,i){s._requestFile(e,function(e){t(e)},n,r,o,function(e){i(e)},a)})},k.prototype._readFile=function(e,t,i,n,r){var o=this,a=U.a.ReadFile(e,t,i,n,r);return this._activeRequests.push(a),a.onCompleteObservable.add(function(e){o._activeRequests.splice(o._activeRequests.indexOf(e),1)}),a},k.prototype._readFileAsync=function(e,n,r){var o=this;return new Promise(function(t,i){o._readFile(e,function(e){t(e)},n,r,function(e){i(e)})})},k.FOGMODE_NONE=0,k.FOGMODE_EXP=1,k.FOGMODE_EXP2=2,k.FOGMODE_LINEAR=3,k.MinDeltaTime=1,k.MaxDeltaTime=1e3,k);function k(e,t){var i=r.call(this)||this;i._inputManager=new L(i),i.cameraToUseForPointers=null,i._isScene=!0,i._blockEntityCollection=!1,i.autoClear=!0,i.autoClearDepthAndStencil=!0,i.clearColor=new F.b(.2,.2,.3,1),i.ambientColor=new F.a(0,0,0),i._environmentIntensity=1,i._forceWireframe=!1,i._skipFrustumClipping=!1,i._forcePointsCloud=!1,i.animationsEnabled=!0,i._animationPropertiesOverride=null,i.useConstantAnimationDeltaTime=!1,i.constantlyUpdateMeshUnderPointer=!1,i.hoverCurs
1or="pointer",i.defaultCursor="",i.doNotHandleCursors=!1,i.preventDefaultOnPointerDown=!0,i.preventDefaultOnPointerUp=!0,i.metadata=null,i.reservedDataStore=null,i.disableOfflineSupportExceptionRules=new Array,i.onDisposeObservable=new a.c,i._onDisposeObserver=null,i.onBeforeRenderObservable=new a.c,i._onBeforeRenderObserver=null,i.onAfterRenderObservable=new a.c,i.onAfterRenderCameraObservable=new a.c,i._onAfterRenderObserver=null,i.onBeforeAnimationsObservable=new a.c,i.onAfterAnimationsObservable=new a.c,i.onBeforeDrawPhaseObservable=new a.c,i.onAfterDrawPhaseObservable=new a.c,i.onReadyObservable=new a.c,i.onBeforeCameraRenderObservable=new a.c,i._onBeforeCameraRenderObserver=null,i.onAfterCameraRenderObservable=new a.c,i._onAfterCameraRenderObserver=null,i.onBeforeActiveMeshesEvaluationObservable=new a.c,i.onAfterActiveMeshesEvaluationObservable=new a.c,i.onBeforeParticlesRenderingObservable=new a.c,i.onAfterParticlesRenderingObservable=new a.c,i.onDataLoadedObservable=new a.c,i.onNewCameraAddedObservable=new a.c,i.onCameraRemovedObservable=new a.c,i.onNewLightAddedObservable=new a.c,i.onLightRemovedObservable=new a.c,i.onNewGeometryAddedObservable=new a.c,i.onGeometryRemovedObservable=new a.c,i.onNewTransformNodeAddedObservable=new a.c,i.onTransformNodeRemovedObservable=new a.c,i.onNewMeshAddedObservable=new a.c,i.onMeshRemovedObservable=new a.c,i.onNewSkeletonAddedObservable=new a.c,i.onSkeletonRemovedObservable=new a.c,i.onNewMaterialAddedObservable=new a.c,i.onMaterialRemovedObservable=new a.c,i.onNewTextureAddedObservable=new a.c,i.onTextureRemovedObservable=new a.c,i.onBeforeRenderTargetsRenderObservable=new a.c,i.onAfterRenderTargetsRenderObservable=new a.c,i.onBeforeStepObservable=new a.c,i.onAfterStepObservable=new a.c,i.onActiveCameraChanged=new a.c,i.onBeforeRenderingGroupObservable=new a.c,i.onAfterRenderingGroupObservable=new a.c,i.onMeshImportedObservable=new a.c,i.onAnimationFileImportedObservable=new a.c,i._registeredForLateAnimationBindings=new s.b(256),i.onPrePointerObservable=new a.c,i.onPointerObservable=new a.c,i.onPreKeyboardObservable=new a.c,i.onKeyboardObservable=new a.c,i._useRightHandedSystem=!1,i._timeAccumulator=0,i._currentStepId=0,i._currentInternalStep=0,i._fogEnabled=!0,i._fogMode=k.FOGMODE_NONE,i.fogColor=new F.a(.2,.2,.3),i.fogDensity=.1,i.fogStart=0,i.fogEnd=1e3,i.prePass=!1,i._shadowsEnabled=!0,i._lightsEnabled=!0,i.activeCameras=new Array,i._texturesEnabled=!0,i.physicsEnabled=!0,i.particlesEnabled=!0,i.spritesEnabled=!0,i._skeletonsEnabled=!0,i.lensFlaresEnabled=!0,i.collisionsEnabled=!0,i.gravity=new u.e(0,-9.807,0),i.postProcessesEnabled=!0,i.postProcesses=new Array,i.renderTargetsEnabled=!0,i.dumpNextRenderTargets=!1,i.customRenderTargets=new Array,i.importedMeshesFiles=new Array,i.probesEnabled=!0,i._meshesForIntersections=new s.b(256),i.proceduralTexturesEnabled=!0,i._totalVertices=new N.a,i._activeIndices=new N.a,i._activeParticles=new N.a,i._activeBones=new N.a,i._animationTime=0,i.animationTimeScale=1,i._renderId=0,i._frameId=0,i._executeWhenReadyTimeoutId=-1,i._intermediateRendering=!1,i._viewUpdateFlag=-1,i._projectionUpdateFlag=-1,i._toBeDisposed=new Array(256),i._activeRequests=new Array,i._pendingData=new Array,i._isDisposed=!1,i.dispatchAllSubMeshesOfActiveMeshes=!1,i._activeMeshes=new s.a(256),i._processedMaterials=new s.a(256),i._renderTargets=new s.b(256),i._activeParticleSystems=new s.a(256),i._activeSkeletons=new s.b(32),i._softwareSkinnedMeshes=new s.b(32),i._activeAnimatables=new Array,i._transformMatrix=u.a.Zero(),i.requireLightSorting=!1,i._components=[],i._serializableComponents=[],i._transientComponents=[],i._beforeCameraUpdateStage=S.b.Create(),i._beforeClearStage=S.b.Create(),i._gatherRenderTargetsStage=S.b.Create(),i._gatherActiveCameraRenderTargetsStage=S.b.Create(),i._isReadyForMeshStage=S.b.Create(),i._beforeEvaluateActiveMeshStage=S.b.Create(),i._evaluateSubMeshStage=S.b.Create(),i._activeMeshStage=S.b.Create(),i._cameraDrawRenderTargetStage=S.b.Create(),i._beforeCameraDrawStage=S.b.Create(),i._beforeRenderTargetDrawStage=S.b.Create(),i._beforeRenderingGroupDrawStage=S.b.Create(),i._beforeRenderingMeshStage=S.b.Create(),i._afterRenderingMeshStage=S.b.Create(),i._afterRenderingGroupDrawStage=S.b.Create(),i._afterCameraDrawStage=S.b.Create(),i._afterRenderTargetDrawStage=S.b.Create(),i._afterRenderStage=S.b.Create(),i._pointerMoveStage=S.b.Create(),i._pointerDownStage=S.b.Create(),i._pointerUpStage=S.b.Create(),i.geometriesByUniqueId=null,i._defaultMeshCandidates={data:[],length:0},i._defaultSubMeshCandidates={data:[],length:0},i._preventFreeActiveMeshesAndRenderingGroups=!1,i._activeMeshesFrozen=!1,i._skipEvaluateActiveMeshesCompletely=!1,i._allowPostProcessClearColor=!0,i.getDeterministicFrameTime=function(){return i._engine.getTimeStep()},i._blockMaterialDirtyMechanism=!1;var n=Object(o.a)({useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1},t);return i._engine=e||x.a.LastCreatedEngine,n.virtual||(x.a._LastCreatedScene=i)._engine.scenes.push(i),i._uid=null,i._renderingManager=new E.b(i),T.a&&(i.postProcessManager=new T.a(i)),C.a.IsWindowObjectExist()&&i.attachControl(),i._createUbo(),f.a&&(i._imageProcessingConfiguration=new f.a),i.setDefaultCandidateProviders(),n.useGeometryUniqueIdsMap&&(i.geometriesByUniqueId={}),i.useMaterialMeshMap=n.useMaterialMeshMap,i.useClonedMeshMap=n.useClonedMeshMap,t&&t.virtual||i._engine.onNewSceneAddedObservable.notifyObservers(i),i}function G(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.d(0,0),this._previousStartingPointerPosition=new u.d(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._scene=e}function z(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1);var n=i(12),r=i(2),o=(Object.defineProperty(a,"DiffuseTextureEnabled",{get:function(){return this._DiffuseTextureEnabled},set:function(e){this._DiffuseTextureEnabled!==e&&(this._DiffuseTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"DetailTextureEnabled",{get:function(){return this._DetailTextureEnabled},set:function(e){this._DetailTextureEnabled!==e&&(this._DetailTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"AmbientTextureEnabled",{get:function(){return this._AmbientTextureEnabled},set:function(e){this._AmbientTextureEnabled!==e&&(this._AmbientTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"OpacityTextureEnabled",{get:function(){return this._OpacityTextureEnabled},set:function(e){this._OpacityTextureEnabled!==e&&(this._OpacityTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"ReflectionTextureEnabled",{get:function(){return this._ReflectionTextureEnabled},set:function(e){this._ReflectionTextureEnabled!==e&&(this._ReflectionTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"EmissiveTextureEnabled",{get:function(){return this._EmissiveTextureEnabled},set:function(e){this._EmissiveTextureEnabled!==e&&(this._EmissiveTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"SpecularTextureEnabled",{get:function(){return this._SpecularTextureEnabled},set:function(e){this._SpecularTextureEnabled!==e&&(this._SpecularTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"BumpTextureEnabled",{get:function(){return this._BumpTextureEnabled},set:function(e){this._BumpTextureEnabled!==e&&(this._BumpTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"LightmapTextureEnabled",{get:function(){return this._LightmapTextureEnabled},set:function(e){this._LightmapTextureEnabled!==e&&(this._LightmapTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"RefractionTextureEnabled",{get:function(){return this._RefractionTextureEnabled},set:function(e){this._RefractionTextureEnabled!==e&&(this._RefractionTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"ColorGradingTextureEnabled",{get:function(){return this._ColorGradingTextureEnabled},set:function(e){this._ColorGradingTextureEnabled!==e&&(this._ColorGradingTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"FresnelEnabled",{get:function(){return this._FresnelEnabled},set:function(e){this._FresnelEnabled!==e&&(this._FresnelEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_FresnelDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"ClearCoatTextureEnabled",{get:function(){return this._ClearCoatTextureEnabled},set:function(e){this._ClearCoatTextureEnabled!==e&&(this._ClearCoatTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"ClearCoatBumpTextureEnabled",{get:function(){return this._ClearCoatBumpTextureEnabled},set:function(e){this._ClearCoatBumpTextureEnabled!==e&&(this._ClearCoatBumpTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"ClearCoatTintTextureEnabled",{get:function(){return this._ClearCoatTintTextureEnabled},set:function(e){this._ClearCoatTintTextureEnabled!==e&&(this._ClearCoatTintTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))}
1,enumerable:!1,configurable:!0}),Object.defineProperty(a,"SheenTextureEnabled",{get:function(){return this._SheenTextureEnabled},set:function(e){this._SheenTextureEnabled!==e&&(this._SheenTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"AnisotropicTextureEnabled",{get:function(){return this._AnisotropicTextureEnabled},set:function(e){this._AnisotropicTextureEnabled!==e&&(this._AnisotropicTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(a,"ThicknessTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._ThicknessTextureEnabled!==e&&(this._ThicknessTextureEnabled=e,n.a.MarkAllMaterialsAsDirty(r.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),a._DiffuseTextureEnabled=!0,a._DetailTextureEnabled=!0,a._AmbientTextureEnabled=!0,a._OpacityTextureEnabled=!0,a._ReflectionTextureEnabled=!0,a._EmissiveTextureEnabled=!0,a._SpecularTextureEnabled=!0,a._BumpTextureEnabled=!0,a._LightmapTextureEnabled=!0,a._RefractionTextureEnabled=!0,a._ColorGradingTextureEnabled=!0,a._FresnelEnabled=!0,a._ClearCoatTextureEnabled=!0,a._ClearCoatBumpTextureEnabled=!0,a._ClearCoatTintTextureEnabled=!0,a._SheenTextureEnabled=!0,a._AnisotropicTextureEnabled=!0,a._ThicknessTextureEnabled=!0,a);function a(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s}),i.d(t,"c",function(){return c}),i.d(t,"d",function(){return l}),i.d(t,"b",function(){return u});var r,o,n=i(1),a=i(0),s=(p.POINTERDOWN=1,p.POINTERUP=2,p.POINTERMOVE=4,p.POINTERWHEEL=8,p.POINTERPICK=16,p.POINTERTAP=32,p.POINTERDOUBLETAP=64,p),c=function(e,t){this.type=e,this.event=t},l=(o=c,Object(n.d)(d,o),d),u=(r=c,Object(n.d)(h,r),h);function h(e,t,i){var n=r.call(this,e,t)||this;return n.pickInfo=i,n}function d(e,t,i,n){var r=o.call(this,e,t)||this;return r.ray=null,r.skipOnPointerObservable=!1,r.localPosition=new a.d(i,n),r}function p(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.WarnImport=function(e){return e+" needs to be imported before as it contains a side-effect required by your code."},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r,"LastCreatedEngine",{get:function(){return 0===this.Instances.length?null:this.Instances[this.Instances.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(r,"LastCreatedScene",{get:function(){return this._LastCreatedScene},enumerable:!1,configurable:!0}),r.Instances=new Array,r._LastCreatedScene=null,r.UseFallbackTexture=!0,r.FallbackTexture="",r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var m=i(40),_=i(6),g=i(0),v=i(2),b=(i(217),i(12)),n=(i(176),Object.defineProperty(r.prototype,"samples",{get:function(){return this._samples},set:function(e){var t=this;this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach(function(e){e.samples!==t._samples&&t._engine.updateRenderTargetTextureSampleCount(e,t._samples)})},enumerable:!1,configurable:!0}),r.prototype.getEffectName=function(){return this._fragmentUrl},Object.defineProperty(r.prototype,"onActivate",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onSizeChanged",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onApply",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"inputTexture",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!1,configurable:!0}),r.prototype.restoreDefaultInputTexture=function(){this._forcedOutputTexture=null},r.prototype.getCamera=function(){return this._camera},Object.defineProperty(r.prototype,"texelSize",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!1,configurable:!0}),r.prototype.getClassName=function(){return"PostProcess"},r.prototype.getEngine=function(){return this._engine},r.prototype.getEffect=function(){return this._effect},r.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},r.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new m.a(2)),this._shareOutputWithPostProcess=null},r.prototype.updateEffect=function(e,t,i,n,r,o,a,s){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._effect=this._engine.createEffect({vertex:null!=a?a:this._vertexUrl,fragment:null!=s?s:this._fragmentUrl},["position"],t||this._parameters,i||this._samplers,null!==e?e:"",void 0,r,o,n||this._indexParameters)},r.prototype.isReusable=function(){return this._reusable},r.prototype.markTextureDirty=function(){this.width=-1},r.prototype.activate=function(e,t,i){var n=this;void 0===t&&(t=null);var r=(e=e||this._camera).getScene(),o=r.getEngine(),a=o.getCaps().maxTextureSize,s=(t?t.width:this._engine.getRenderWidth(!0))*this._options|0,c=(t?t.height:this._engine.getRenderHeight(!0))*this._options|0,l=e.parent;!l||l.leftCamera!=e&&l.rightCamera!=e||(s/=2);var u,h,d=this._options.width||s,p=this._options.height||c,f=this.renderTargetSamplingMode!==v.a.TEXTURE_NEAREST_LINEAR&&this.renderTargetSamplingMode!==v.a.TEXTURE_NEAREST_NEAREST&&this.renderTargetSamplingMode!==v.a.TEXTURE_LINEAR_LINEAR;if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(!this.adaptScaleToCurrentViewport||(h=o.currentViewport)&&(d*=h.width,p*=h.height),(f||this.alwaysForcePOT)&&(this._options.width||(d=o.needPOTTextures?b.a.GetExponentOfTwo(d,a,this.scaleMode):d),this._options.height||(p=o.needPOTTextures?b.a.GetExponentOfTwo(p,a,this.scaleMode):p)),this.width!==d||this.height!==p){if(0<this._textures.length){for(var m=0;m<this._textures.length;m++)this._engine._releaseTexture(this._textures.data[m]);this._textures.reset()}this.width=d,this.height=p;var _={width:this.width,height:this.height},g={generateMipMaps:f,generateDepthBuffer:i||0===e._postProcesses.indexOf(this),generateStencilBuffer:(i||0===e._postProcesses.indexOf(this))&&this._engine.isStencilEnable,samplingMode:this.renderTargetSamplingMode,type:this._textureType,format:this._textureFormat};this._textures.push(this._engine.createRenderTargetTexture(_,g)),this._reusable&&this._textures.push(this._engine.createRenderTargetTexture(_,g)),this._texelSize.copyFromFloats(1/this.width,1/this.height),this.onSizeChangedObservable.notifyObservers(this)}this._textures.forEach(function(e){e.samples!==n.samples&&n._engine.updateRenderTargetTextureSampleCount(e,n.samples)})}return this._shareOutputWithPostProcess?u=this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture?(u=this._forcedOutputTexture,this.width=this._forcedOutputTexture.width,this.height=this._forcedOutputTexture.height):u=this.inputTexture,this.enablePixelPerfectMode?(this._scaleRatio.copyFromFloats(s/d,c/p),this._engine.bindFramebuffer(u,0,s,c,this.forceFullscreenViewport)):(this._scaleRatio.copyFromFloats(1,1),this._engine.bindFramebuffer(u,0,void 0,void 0,this.forceFullscreenViewport)),this.onActivateObservable.notifyObservers(e),this.autoClear&&this.alphaMode===v.a.ALPHA_DISABLE&&this._engine.clear(this.clearColor?this.clearColor:r.clearColor,r._allowPostProcessClearColor,!0,!0),this._reusable&&(this._currentRenderTextureInd=(this._currentRenderTextureInd+1)%2),u},Object.defineProperty(r.prototype,"isSupported",{get:function(){return this._effect.isSupported}
1,enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"aspectRatio",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.aspectRatio:this._forcedOutputTexture?this._forcedOutputTexture.width/this._forcedOutputTexture.height:this.width/this.height},enumerable:!1,configurable:!0}),r.prototype.isReady=function(){return this._effect&&this._effect.isReady()},r.prototype.apply=function(){return this._effect&&this._effect.isReady()?(this._engine.enableEffect(this._effect),this._engine.setState(!1),this._engine.setDepthBuffer(!1),this._engine.setDepthWrite(!1),this._engine.setAlphaMode(this.alphaMode),this.alphaConstants&&this.getEngine().setAlphaConstants(this.alphaConstants.r,this.alphaConstants.g,this.alphaConstants.b,this.alphaConstants.a),e=this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture?this._forcedOutputTexture:this.inputTexture,this._effect._bindTexture("textureSampler",e),this._effect.setVector2("scale",this._scaleRatio),this.onApplyObservable.notifyObservers(this._effect),this._effect):null;var e},r.prototype._disposeTextures=function(){if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(0<this._textures.length)for(var e=0;e<this._textures.length;e++)this._engine._releaseTexture(this._textures.data[e]);this._textures.dispose()}},r.prototype.dispose=function(e){var t,i;e=e||this._camera,this._disposeTextures(),this._scene&&-1!==(t=this._scene.postProcesses.indexOf(this))&&this._scene.postProcesses.splice(t,1),-1!==(t=this._engine.postProcesses.indexOf(this))&&this._engine.postProcesses.splice(t,1),e&&(e.detachPostProcess(this),0===(t=e._postProcesses.indexOf(this))&&0<e._postProcesses.length&&(i=this._camera._getFirstPostProcess())&&i.markTextureDirty(),this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear())},r);function r(e,t,i,n,r,o,a,s,c,l,u,h,d,p,f){void 0===a&&(a=v.a.TEXTURE_NEAREST_SAMPLINGMODE),void 0===l&&(l=null),void 0===u&&(u=v.a.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h="postprocess"),void 0===p&&(p=!1),void 0===f&&(f=v.a.TEXTUREFORMAT_RGBA),this.name=e,this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.alphaMode=v.a.ALPHA_DISABLE,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=v.a.SCALEMODE_FLOOR,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._textures=new m.a(2),this._currentRenderTextureInd=0,this._scaleRatio=new g.d(1,1),this._texelSize=g.d.Zero(),this.onActivateObservable=new _.c,this.onSizeChangedObservable=new _.c,this.onApplyObservable=new _.c,this.onBeforeRenderObservable=new _.c,this.onAfterRenderObservable=new _.c,null!=o?(this._camera=o,this._scene=o.getScene(),o.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this),this.uniqueId=this._scene.getUniqueId()):s&&(this._engine=s,this._engine.postProcesses.push(this)),this._options=r,this.renderTargetSamplingMode=a||v.a.TEXTURE_NEAREST_SAMPLINGMODE,this._reusable=c||!1,this._textureType=u,this._textureFormat=f,this._samplers=n||[],this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=h,this._parameters=i||[],this._parameters.push("scale"),this._indexParameters=d,p||this.updateEffect(l)}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"a",function(){return a});var n,r,o=i(0);(r=n=n||{})[r.LOCAL=0]="LOCAL",r[r.WORLD=1]="WORLD",r[r.BONE=2]="BONE";var a=(s.X=new o.e(1,0,0),s.Y=new o.e(0,1,0),s.Z=new o.e(0,0,1),s);function s(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return _});var o,n=i(1),l=i(3),a=i(40),s=i(13),c=i(6),f=i(0),u=i(30),r=i(7),h=i(11),d=i(21),p=i(77),m=i(124),_=(o=u.a,Object(n.d)(g,o),Object.defineProperty(g.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),g.prototype.storeState=function(){return this._stateStored=!0,this._storedFov=this.fov,this},g.prototype._restoreStateValues=function(){return!!this._stateStored&&(this.fov=this._storedFov,!0)},g.prototype.restoreState=function(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)},g.prototype.getClassName=function(){return"Camera"},g.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t},Object.defineProperty(g.prototype,"globalPosition",{get:function(){return this._globalPosition}
1,enumerable:!1,configurable:!0}),g.prototype.getActiveMeshes=function(){return this._activeMeshes},g.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},g.prototype.isReady=function(e){if(void 0===e&&(e=!1),e)for(var t=0,i=this._postProcesses;t<i.length;t++){var n=i[t];if(n&&!n.isReady())return!1}return o.prototype.isReady.call(this,e)},g.prototype._initCache=function(){o.prototype._initCache.call(this),this._cache.position=new f.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.upVector=new f.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.mode=void 0,this._cache.minZ=void 0,this._cache.maxZ=void 0,this._cache.fov=void 0,this._cache.fovMode=void 0,this._cache.aspectRatio=void 0,this._cache.orthoLeft=void 0,this._cache.orthoRight=void 0,this._cache.orthoBottom=void 0,this._cache.orthoTop=void 0,this._cache.renderWidth=void 0,this._cache.renderHeight=void 0},g.prototype._updateCache=function(e){e||o.prototype._updateCache.call(this),this._cache.position.copyFrom(this.position),this._cache.upVector.copyFrom(this.upVector)},g.prototype._isSynchronized=function(){return this._isSynchronizedViewMatrix()&&this._isSynchronizedProjectionMatrix()},g.prototype._isSynchronizedViewMatrix=function(){return!!o.prototype._isSynchronized.call(this)&&this._cache.position.equals(this.position)&&this._cache.upVector.equals(this.upVector)&&this.isSynchronizedWithParent()},g.prototype._isSynchronizedProjectionMatrix=function(){var e=this._cache.mode===this.mode&&this._cache.minZ===this.minZ&&this._cache.maxZ===this.maxZ;if(!e)return!1;var t=this.getEngine();return this.mode===g.PERSPECTIVE_CAMERA?this._cache.fov===this.fov&&this._cache.fovMode===this.fovMode&&this._cache.aspectRatio===t.getAspectRatio(this):this._cache.orthoLeft===this.orthoLeft&&this._cache.orthoRight===this.orthoRight&&this._cache.orthoBottom===this.orthoBottom&&this._cache.orthoTop===this.orthoTop&&this._cache.renderWidth===t.getRenderWidth()&&this._cache.renderHeight===t.getRenderHeight()},g.prototype.attachControl=function(e,t){},g.prototype.detachControl=function(e){},g.prototype.update=function(){this._checkInputs(),this.cameraRigMode!==g.RIG_MODE_NONE&&this._updateRigCameras()},g.prototype._checkInputs=function(){this.onAfterCheckInputsObservable.notifyObservers(this)},Object.defineProperty(g.prototype,"rigCameras",{get:function(){return this._rigCameras},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"rigPostProcess",{get:function(){return this._rigPostProcess},enumerable:!1,configurable:!0}),g.prototype._getFirstPostProcess=function(){for(var e=0;e<this._postProcesses.length;e++)if(null!==this._postProcesses[e])return this._postProcesses[e];return null},g.prototype._cascadePostProcessesToRigCams=function(){var e=this._getFirstPostProcess();e&&e.markTextureDirty();for(var t=0,i=this._rigCameras.length;t<i;t++){var n=this._rigCameras[t],r=n._rigPostProcess;r?("pass"===r.getEffectName()&&(n.isIntermediate=0===this._postProcesses.length),n._postProcesses=this._postProcesses.slice(0).concat(r),r.markTextureDirty()):n._postProcesses=this._postProcesses.slice(0)}},g.prototype.attachPostProcess=function(e,t){return void 0===t&&(t=null),!e.isReusable()&&-1<this._postProcesses.indexOf(e)?(r.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))},g.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._cascadePostProcessesToRigCams()},g.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},g.prototype._getViewMatrix=function(){return f.a.Identity()},g.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(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},g.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},g.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},g.prototype.getProjectionMatrix=function(e){var t,i,n,r,o,a,s,c;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 l,u,h,d=this.getEngine(),p=this.getScene();return this.mode===g.PERSPECTIVE_CAMERA?(this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=d.getAspectRatio(this),this.minZ<=0&&(this.minZ=.1),l=d.useReverseDepthBuffer,(p.useRightHandedSystem?l?f.a.PerspectiveFovReverseRHToRef:f.a.PerspectiveFovRHToRef:l?f.a.PerspectiveFovReverseLHToRef:f.a.PerspectiveFovLHToRef)(this.fov,d.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===g.FOVMODE_VERTICAL_FIXED)):(u=d.getRenderWidth()/2,h=d.getRenderHeight()/2,p.useRightHandedSystem?f.a.OrthoOffCenterRHToRef(null!==(t=this.orthoLeft)&&void 0!==t?t:-u,null!==(i=this.orthoRight)&&void 0!==i?i:u,null!==(n=this.orthoBottom)&&void 0!==n?n:-
1h,null!==(r=this.orthoTop)&&void 0!==r?r:h,this.minZ,this.maxZ,this._projectionMatrix):f.a.OrthoOffCenterLHToRef(null!==(o=this.orthoLeft)&&void 0!==o?o:-u,null!==(a=this.orthoRight)&&void 0!==a?a:u,null!==(s=this.orthoBottom)&&void 0!==s?s:-h,null!==(c=this.orthoTop)&&void 0!==c?c:h,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=d.getRenderWidth(),this._cache.renderHeight=d.getRenderHeight()),this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},g.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},g.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?m.a.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=m.a.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},g.prototype.isInFrustum=function(t,e){if(void 0===e&&(e=!1),this._updateFrustumPlanes(),e&&0<this.rigCameras.length){var i=!1;return this.rigCameras.forEach(function(e){e._updateFrustumPlanes(),i=i||t.isInFrustum(e._frustumPlanes)}),i}return t.isInFrustum(this._frustumPlanes)},g.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},g.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),d.a.WarnImport("Ray")},g.prototype.dispose=function(e,t){for(void 0===t&&(t=!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);0<this._rigCameras.length;){var i=this._rigCameras.pop();i&&i.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==g.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var n=this._postProcesses.length;0<=--n;){var r=this._postProcesses[n];r&&r.dispose(this)}for(n=this.customRenderTargets.length;0<=--n;)this.customRenderTargets[n].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),o.prototype.dispose.call(this,e,t)},Object.defineProperty(g.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!1,configurable:!0}),g.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},g.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},g.prototype.setCameraRigMode=function(e,t){if(this.cameraRigMode!==e){for(;0<this._rigCameras.length;){var i=this._rigCameras.pop();i&&i.dispose()}var n,r;switch(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=t.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=s.b.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==g.RIG_MODE_NONE&&((n=this.createRigCamera(this.name+"_L",0))&&(n._isLeftCamera=!0),(r=this.createRigCamera(this.name+"_R",1))&&(r._isRightCamera=!0),n&&r&&(this._rigCameras.push(n),this._rigCameras.push(r))),this.cameraRigMode){case g.RIG_MODE_STEREOSCOPIC_ANAGLYPH:g._setStereoscopicAnaglyphRigMode(this);break;case g.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case g.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case g.RIG_MODE_STEREOSCOPIC_OVERUNDER:case g.RIG_MODE_STEREOSCOPIC_INTERLACED:g._setStereoscopicRigMode(this);break;case g.RIG_MODE_VR:g._setVRRigMode(this,t);break;case g.RIG_MODE_WEBVR:g._setWebVRRigMode(this,t)}this._cascadePostProcessesToRigCams(),this.update()}},g._setStereoscopicRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode"},g._setStereoscopicAnaglyphRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode"},g._setVRRigMode=function(e,t){throw"Import Cameras/RigModes/vrRigMode before using VR rig mode"},g._setWebVRRigMode=function(e,t){throw"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode"},g.prototype._getVRProjectionMatrix=function(){return f.a.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},g.prototype._updateCameraRotationMatrix=function(){},g.prototype._updateWebVRCameraRotationMatrix=function(){},g.prototype._getWebVRProjectionMatrix=function(){return f.a.Identity()},g.prototype._getWebVRViewMatrix=function(){return f.a.Identity()},g.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=s.b.ToRadians(t/.0637))},g.prototype.createRigCamera=function(e,t){return null},g.prototype._updateRigCameras=function(){for(var e=0;e<this._rigCameras.length;e++)this._rigCameras[e].minZ=this.minZ,this._rigCameras[e].maxZ=this.maxZ,this._rigCameras[e].fov=this.fov,this._rigCameras[e].upVector.copyFrom(this.upVector);this.cameraRigMode===g.RIG_MODE_STEREOSCOPIC_ANAGLYPH&&(this._rigCameras[0].viewport=this._rigCameras[1].viewport=this.viewport)},g.prototype._setupInputs=function(){},g.prototype.serialize=function(){var e=l.a.Serialize(this);return e.type=this.getClassName(),this.parent&&(e.parentId=this.parent.id),this.inputs&&this.inputs.serialize(e),l.a.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e},g.prototype.clone=function(e){return l.a.Clone(g.GetConstructorFromName(this.getClassName(),e,this.get
1Scene(),this.interaxialDistance,this.isStereoscopicSideBySide),this)},g.prototype.getDirection=function(e){var t=f.e.Zero();return this.getDirectionToRef(e,t),t},Object.defineProperty(g.prototype,"absoluteRotation",{get:function(){var e=f.b.Zero();return this.getWorldMatrix().decompose(void 0,e),e},enumerable:!1,configurable:!0}),g.prototype.getDirectionToRef=function(e,t){f.e.TransformNormalToRef(e,this.getWorldMatrix(),t)},g.GetConstructorFromName=function(e,t,i,n,r){return void 0===n&&(n=0),void 0===r&&(r=!0),u.a.Construct(e,t,i,{interaxial_distance:n,isStereoscopicSideBySide:r})||function(){return g._createDefaultParsedCamera(t,i)}},g.prototype.computeWorldMatrix=function(){return this.getWorldMatrix()},g.Parse=function(e,t){var i,n=e.type,r=g.GetConstructorFromName(n,e.name,t,e.interaxial_distance,e.isStereoscopicSideBySide),o=l.a.Parse(r,e,t);if(e.parentId&&(o._waitingParentId=e.parentId),o.inputs&&(o.inputs.parse(e),o._setupInputs()),o.setPosition&&(o.position.copyFromFloats(0,0,0),o.setPosition(f.e.FromArray(e.position))),e.target&&o.setTarget&&o.setTarget(f.e.FromArray(e.target)),e.cameraRigMode&&(i=e.interaxial_distance?{interaxialDistance:e.interaxial_distance}:{},o.setCameraRigMode(e.cameraRigMode,i)),e.animations){for(var a=0;a<e.animations.length;a++){var s=e.animations[a],c=h.a.GetClass("BABYLON.Animation");c&&o.animations.push(c.Parse(s))}u.a.ParseAnimationRanges(o,e,t)}return e.autoAnimate&&t.beginAnimation(o,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),o},g._createDefaultParsedCamera=function(e,t){throw d.a.WarnImport("UniversalCamera")},g.PERSPECTIVE_CAMERA=0,g.ORTHOGRAPHIC_CAMERA=1,g.FOVMODE_VERTICAL_FIXED=0,g.FOVMODE_HORIZONTAL_FIXED=1,g.RIG_MODE_NONE=0,g.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,g.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,g.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,g.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,g.RIG_MODE_STEREOSCOPIC_INTERLACED=14,g.RIG_MODE_VR=20,g.RIG_MODE_WEBVR=21,g.RIG_MODE_CUSTOM=22,g.ForceAttachControlToAlwaysPreventDefault=!1,Object(n.c)([Object(l.o)("position")],g.prototype,"_position",void 0),Object(n.c)([Object(l.o)()],g.prototype,"upVector",void 0),Object(n.c)([Object(l.c)()],g.prototype,"orthoLeft",void 0),Object(n.c)([Object(l.c)()],g.prototype,"orthoRight",void 0),Object(n.c)([Object(l.c)()],g.prototype,"orthoBottom",void 0),Object(n.c)([Object(l.c)()],g.prototype,"orthoTop",void 0),Object(n.c)([Object(l.c)()],g.prototype,"fov",void 0),Object(n.c)([Object(l.c)()],g.prototype,"minZ",void 0),Object(n.c)([Object(l.c)()],g.prototype,"maxZ",void 0),Object(n.c)([Object(l.c)()],g.prototype,"inertia",void 0),Object(n.c)([Object(l.c)()],g.prototype,"mode",void 0),Object(n.c)([Object(l.c)()],g.prototype,"layerMask",void 0),Object(n.c)([Object(l.c)()],g.prototype,"fovMode",void 0),Object(n.c)([Object(l.c)()],g.prototype,"cameraRigMode",void 0),Object(n.c)([Object(l.c)()],g.prototype,"interaxialDistance",void 0),Object(n.c)([Object(l.c)()],g.prototype,"isStereoscopicSideBySide",void 0),g);function g(e,t,i,n){void 0===n&&(n=!0);var r=o.call(this,e,i)||this;return r._position=f.e.Zero(),r.upVector=f.e.Up(),r.orthoLeft=null,r.orthoRight=null,r.orthoBottom=null,r.orthoTop=null,r.fov=.8,r.minZ=1,r.maxZ=1e4,r.inertia=.9,r.mode=g.PERSPECTIVE_CAMERA,r.isIntermediate=!1,r.viewport=new p.a(0,0,1,1),r.layerMask=268435455,r.fovMode=g.FOVMODE_VERTICAL_FIXED,r.cameraRigMode=g.RIG_MODE_NONE,r.customRenderTargets=new Array,r.outputRenderTarget=null,r.onViewMatrixChangedObservable=new c.c,r.onProjectionMatrixChangedObservable=new c.c,r.onAfterCheckInputsObservable=new c.c,r.onRestoreStateObservable=new c.c,r.isRigCamera=!1,r._rigCameras=new Array,r._webvrViewMatrix=f.a.Identity(),r._skipRendering=!1,r._projectionMatrix=new f.a,r._postProcesses=new Array,r._activeMeshes=new a.a(256),r._globalPosition=f.e.Zero(),r._computedViewMatrix=f.a.Identity(),r._doNotC
1omputeProjectionMatrix=!1,r._transformMatrix=f.a.Zero(),r._refreshFrustumPlanes=!0,r._isCamera=!0,r._isLeftCamera=!1,r._isRightCamera=!1,r.getScene().addCamera(r),n&&!r.getScene().activeCamera&&(r.getScene().activeCamera=r),r.position=t,r}},function(e,t,i){"use strict";i.d(t,"b",function(){return c}),i.d(t,"a",function(){return l});var S=i(0),d=i(10),o=i(14),n=i(3),r=i(11),g=i(234),a=i(153),s=i(30),h=i(94),p=i(55),c=function(){},l=(A._PrepareAnimation=function(e,t,i,n,r,o,a,s){var c=void 0;if(!isNaN(parseFloat(r))&&isFinite(r)?c=A.ANIMATIONTYPE_FLOAT:r instanceof S.b?c=A.ANIMATIONTYPE_QUATERNION:r instanceof S.e?c=A.ANIMATIONTYPE_VECTOR3:r instanceof S.d?c=A.ANIMATIONTYPE_VECTOR2:r instanceof d.a?c=A.ANIMATIONTYPE_COLOR3:r instanceof d.b?c=A.ANIMATIONTYPE_COLOR4:r instanceof h.a&&(c=A.ANIMATIONTYPE_SIZE),null==c)return null;var l=new A(e,t,i,c,a),u=[{frame:0,value:r},{frame:n,value:o}];return l.setKeys(u),void 0!==s&&l.setEasingFunction(s),l},A.CreateAnimation=function(e,t,i,n){var r=new A(e+"Animation",e,i,t,A.ANIMATIONLOOPMODE_CONSTANT);return r.setEasingFunction(n),r},A.CreateAndStartAnimation=function(e,t,i,n,r,o,a,s,c,l){var u=A._PrepareAnimation(e,i,n,r,o,a,s,c);return u?t.getScene().beginDirectAnimation(t,[u],0,r,1===u.loopMode,1,l):null},A.CreateAndStartHierarchyAnimation=function(e,t,i,n,r,o,a,s,c,l,u){var h=A._PrepareAnimation(e,n,r,o,a,s,c,l);return h?t.getScene().beginDirectHierarchyAnimation(t,i,[h],0,o,1===h.loopMode,1,u):null},A.CreateMergeAndStartAnimation=function(e,t,i,n,r,o,a,s,c,l){var u=A._PrepareAnimation(e,i,n,r,o,a,s,c);return u?(t.animations.push(u),t.getScene().beginAnimation(t,0,r,1===u.loopMode,1,l)):null},A.MakeAnimationAdditive=function(e,t,i,n,r){void 0===t&&(t=0),void 0===n&&(n=!1);var o=e;if(n&&((o=e.clone()).name=r||o.name),!o._keys.length)return o;t=0<=t?t:0;var a,s=0,c=o._keys[0],l=o._keys.length-1,u=o._keys[l],h={referenceValue:c.value,referencePosition:S.c.Vector3[0],referenceQuaternion:S.c.Quaternion[0],referenceScaling:S.c.Vector3[1],keyPosition:S.c.Vector3[2],keyQuaternion:S.c.Quaternion[1],keyScaling:S.c.Vector3[3]},d=!1,p=c.frame,f=u.frame;!i||(a=o.getRange(i))&&(p=a.from,f=a.to);var m=c.frame===p,_=u.frame===f;1===o._keys.length?(b=o._getKeyValue(o._keys[0]),h.referenceValue=b.clone?b.clone():b,d=!0):t<=c.frame?(b=o._getKeyValue(c.value),h.referenceValue=b.clone?b.clone():b,d=!0):t>=u.frame&&(b=o._getKeyValue(u.value),h.referenceValue=b.clone?b.clone():b,d=!0);for(var g=0;!d||!m||!_&&g<o._keys.length-1;){var v,b,y,T=o._keys[g],E=o._keys[g+1];!d&&t>=T.frame&&t<=E.frame&&(b=void 0,b=t===T.frame?o._getKeyValue(T.value):t===E.frame?o._getKeyValue(E.value):(v={key:g,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},o._interpolate(t,v)),h.referenceValue=b.clone?b.clone():b,d=!0),!m&&p>=T.frame&&p<=E.frame&&(s=p===T.frame?g:(p===E.frame||(v={key:g,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},y={frame:p,value:(b=o._interpolate(p,v)).clone?b.clone():b},o._keys.splice(g+1,0,y)),g+1),m=!0),!_&&f>=T.frame&&f<=E.frame&&(l=f===T.frame?g:(f===E.frame||(v={key:g,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},y={frame:f,value:(b=o._interpolate(f,v)).clone?b.clone():b},o._keys.splice(g+1,0,y)),g+1),_=!0),g++}for(o.dataType===A.ANIMATIONTYPE_QUATERNION?h.referenceValue.normalize().conjugateInPlace():o.dataType===A.ANIMATIONTYPE_MATRIX&&(h.referenceValue.decompose(h.referenceScaling,h.referenceQuaternion,h.referencePosition),h.referenceQuaternion.normalize().conjugateInPlace()),g=s;g<=l;g++)if(y=o._keys[g],!g||o.dataType===A.ANIMATIONTYPE_FLOAT||y.value!==c.value)switch(o.dataType){case A.ANIMATIONTYPE_MATRIX:y.value.decompose(h.keyScaling,h.keyQuaternion,h.keyPosition),h.keyPosition.subtractInPlace(h.referencePosition),h.keyScaling.divideInPlace(h.referenceScaling),h.referenceQuaternion.multiplyToRef(h.keyQuaternion,h.keyQuaternion),S.a.ComposeToRef(h.keyScaling,h.keyQuaternion,h.keyPosition,y.value);break;case A.ANIMATIONTYPE_QUATERNION:h.referenceValue.multiplyToRef(y.value,y.value);break;case A.ANIMATIONTYPE_VECTOR2:case A.ANIMATIONTYPE_VECTOR3:case A.ANIMATIONTYPE_COLOR3:case A.ANIMATIONTYPE_COLOR4:y.value.subtractToRef(h.referenceValue,y.value);break;case A.ANIMATIONTYPE_SIZE:y.value.width-=h.referenceValue.width,y.value.height-=h.referenceValue.height;break;default:y.value-=h.referenceValue}return o}
1,A.TransitionTo=function(e,t,i,n,r,o,a,s){if(void 0===s&&(s=null),a<=0)return i[e]=t,s&&s(),null;var c=r*(a/1e3);o.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:c,value:t}]),i.animations||(i.animations=[]),i.animations.push(o);var l=n.beginAnimation(i,0,c,!1);return l.onAnimationEnd=s,l},Object.defineProperty(A.prototype,"runtimeAnimations",{get:function(){return this._runtimeAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasRunningRuntimeAnimations",{get:function(){for(var e=0,t=this._runtimeAnimations;e<t.length;e++)if(!t[e].isStopped)return!0;return!1},enumerable:!1,configurable:!0}),A.prototype.toString=function(e){var t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(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},A.prototype.addEvent=function(e){this._events.push(e),this._events.sort(function(e,t){return e.frame-t.frame})},A.prototype.removeEvents=function(e){for(var t=0;t<this._events.length;t++)this._events[t].frame===e&&(this._events.splice(t,1),t--)},A.prototype.getEvents=function(){return this._events},A.prototype.createRange=function(e,t,i){this._ranges[e]||(this._ranges[e]=new a.a(e,t,i))},A.prototype.deleteRange=function(e,t){void 0===t&&(t=!0);var i=this._ranges[e];if(i){if(t)for(var n=i.from,r=i.to,o=this._keys.length-1;0<=o;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},A.prototype.getRange=function(e){return this._ranges[e]},A.prototype.getKeys=function(){return this._keys},A.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t<i;t++)e<this._keys[t].frame&&(e=this._keys[t].frame);return e},A.prototype.getEasingFunction=function(){return this._easingFunction},A.prototype.setEasingFunction=function(e){this._easingFunction=e},A.prototype.floatInterpolateFunction=function(e,t,i){return o.a.Lerp(e,t,i)},A.prototype.floatInterpolateFunctionWithTangents=function(e,t,i,n,r){return o.a.Hermite(e,t,i,n,r)},A.prototype.quaternionInterpolateFunction=function(e,t,i){return S.b.Slerp(e,t,i)},A.prototype.quaternionInterpolateFunctionWithTangents=function(e,t,i,n,r){return S.b.Hermite(e,t,i,n,r).normalize()},A.prototype.vector3InterpolateFunction=function(e,t,i){return S.e.Lerp(e,t,i)},A.prototype.vector3InterpolateFunctionWithTangents=function(e,t,i,n,r){return S.e.Hermite(e,t,i,n,r)},A.prototype.vector2InterpolateFunction=function(e,t,i){return S.d.Lerp(e,t,i)},A.prototype.vector2InterpolateFunctionWithTangents=function(e,t,i,n,r){return S.d.Hermite(e,t,i,n,r)},A.prototype.sizeInterpolateFunction=function(e,t,i){return h.a.Lerp(e,t,i)},A.prototype.color3InterpolateFunction=function(e,t,i){return d.a.Lerp(e,t,i)},A.prototype.color4InterpolateFunction=function(e,t,i){return d.b.Lerp(e,t,i)},A.prototype._getKeyValue=function(e){return"function"==typeof e?e():e},A.prototype._interpolate=function(e,t){if(t.loopMode===A.ANIMATIONLOOPMODE_CONSTANT&&0<t.repeatCount)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;var i=this._keys;if(1===i.length)return this._getKeyValue(i[0].value);var n=t.key;if(i[n].frame>=e)for(;0<=n-1&&i[n].frame>=e;)n--;for(var r=n;r<i.length;r++){var o=i[r+1];if(o.frame>=e){var a=i[t.key=r],s=this._getKeyValue(a.value);if(a.interpolation===g.a.STEP)return s;var c=this._getKeyValue(o.value),l=void 0!==a.outTangent&&void 0!==o.inTangent,u=o.frame-a.frame,h=(e-a.frame)/u,d=this.getEasingFunction();switch(null!=d&&(h=d.ease(h)),this.dataType){case A.ANIMATIONTYPE_FLOAT:var p=l?this.floatInterpolateFunctionWithTangents(s,a.outTangent*u,c,o.inTangent*u,h):this.floatInterpolateFunction(s,c,h);switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return p;case A.ANIMATIONLOOPMODE_RELATIVE:return t.offsetValue*t.repeatCount+p}break;case A.ANIMATIONTYPE_QUATERNION:var f=l?this.quaternionInterpolateFunctionWithTangents(s,a.outTangent.scale(u),c,o.inTangent.scale(u),h):this.quaternionInterpolateFunction(s,c,h);switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return f;case A.ANIMATIONLOOPMODE_RELATIVE:return f.addInPlace(t.offsetValue.scale(t.repeatCount))}return f;case A.ANIMATIONTYPE_VECTOR3:var m=l?this.vector3InterpolateFunctionWithTangents(s,a.outTangent.scale(u),c,o.inTangent.scale(u),h):this.vector3InterpolateFunction(s,c,h);switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return m;case A.ANIMATIONLOOPMODE_RELATIVE:return m.add(t.offsetValue.scale(t.repeatCount))}case A.ANIMATIONTYPE_VECTOR2:var _=l?this.vector2InterpolateFunctionWithTangents(s,a.outTangent.scale(u),c,o.inTangent.scale(u),h):this.vector2InterpolateFunction(s,c,h);switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return _;case A.ANIMATIONLOOPMODE_RELATIVE:return _.add(t.offsetValue.scale(t.repeatCount))}case A.ANIMATIONTYPE_SIZE:switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(s,c,h);case A.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(s,c,h).add(t.offsetValue.scale(t.repeatCount))}case A.ANIMATIONTYPE_COLOR3:switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return this.color3InterpolateFunction(s,c,h);case A.ANIMATIONLOOPMODE_RELATIVE:return this.color3InterpolateFunction(s,c,h).add(t.offsetValue.scale(t.repeatCount))}case A.ANIMATIONTYPE_COLOR4:switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:return this.color4InterpolateFunction(s,c,h);case A.ANIMATIONLOOPMODE_RELATIVE:return this.color4InterpolateFunction(s,c,h).add(t.offsetValue.scale(t.repeatCount))}case A.ANIMATIONTYPE_MATRIX:switch(t.loopMode){case A.ANIMATIONLOOPMODE_CYCLE:case A.ANIMATIONLOOPMODE_CONSTANT:if(A.AllowMatricesInterpolation)return this.matrixInterpolateFunction(s,c,h,t.workValue);case A.ANIMATIONLOOPMODE_RELATIVE:return s}}break}}return this._getKeyValue(i[i.length-1].value)},A.prototype.matrixInterpolateFunction=function(e,t,i,n){return A.AllowMatrixDecomposeForInterpolation?n?(S.a.DecomposeLerpToRef(e,t,i,n),n):S.a.DecomposeLerp(e,t,i):n?(S.a.LerpToRef(e,t,i,n),n):S.a.Lerp(e,t,i)},A.prototype.clone=function(){var e=new A(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);
1if(e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,this._keys&&e.setKeys(this._keys),this._ranges)for(var t in e._ranges={},this._ranges){var i=this._ranges[t];i&&(e._ranges[t]=i.clone())}return e},A.prototype.setKeys=function(e){this._keys=e.slice(0)},A.prototype.serialize=function(){var e={};e.name=this.name,e.property=this.targetProperty,e.framePerSecond=this.framePerSecond,e.dataType=this.dataType,e.loopBehavior=this.loopMode,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed;var t=this.dataType;e.keys=[];for(var i=this.getKeys(),n=0;n<i.length;n++){var r=i[n],o={};switch(o.frame=r.frame,t){case A.ANIMATIONTYPE_FLOAT:o.values=[r.value];break;case A.ANIMATIONTYPE_QUATERNION:case A.ANIMATIONTYPE_MATRIX:case A.ANIMATIONTYPE_VECTOR3:case A.ANIMATIONTYPE_COLOR3:case A.ANIMATIONTYPE_COLOR4:o.values=r.value.asArray()}e.keys.push(o)}for(var a in e.ranges=[],this._ranges){var s,c=this._ranges[a];c&&((s={}).name=a,s.from=c.from,s.to=c.to,e.ranges.push(s))}return e},A._UniversalLerp=function(e,t,i){var n=e.constructor;return n.Lerp?n.Lerp(e,t,i):n.Slerp?n.Slerp(e,t,i):e.toFixed?e*(1-i)+i*t:t},A.Parse=function(e){var t,i=new A(e.name,e.property,e.framePerSecond,e.dataType,e.loopBehavior),n=e.dataType,r=[];for(e.enableBlending&&(i.enableBlending=e.enableBlending),e.blendingSpeed&&(i.blendingSpeed=e.blendingSpeed),t=0;t<e.keys.length;t++){var o,a,s=e.keys[t];switch(n){case A.ANIMATIONTYPE_FLOAT:u=s.values[0],1<=s.values.length&&(o=s.values[1]),2<=s.values.length&&(a=s.values[2]);break;case A.ANIMATIONTYPE_QUATERNION:var c,l,u=S.b.FromArray(s.values);8<=s.values.length&&((c=S.b.FromArray(s.values.slice(4,8))).equals(S.b.Zero())||(o=c)),12<=s.values.length&&((l=S.b.FromArray(s.values.slice(8,12))).equals(S.b.Zero())||(a=l));break;case A.ANIMATIONTYPE_MATRIX:u=S.a.FromArray(s.values);break;case A.ANIMATIONTYPE_COLOR3:u=d.a.FromArray(s.values);break;case A.ANIMATIONTYPE_COLOR4:u=d.b.FromArray(s.values);break;case A.ANIMATIONTYPE_VECTOR3:default:u=S.e.FromArray(s.values)}var h={};h.frame=s.frame,h.value=u,null!=o&&(h.inTangent=o),null!=a&&(h.outTangent=a),r.push(h)}if(i.setKeys(r),e.ranges)for(t=0;t<e.ranges.length;t++)u=e.ranges[t],i.createRange(u.name,u.from,u.to);return i},A.AppendSerializedAnimations=function(e,t){n.a.AppendSerializedAnimations(e,t)},A.ParseFromFileAsync=function(c,e){var l=this;return new Promise(function(o,a){var s=new p.a;s.addEventListener("readystatechange",function(){if(4==s.readyState)if(200==s.status){var e=JSON.parse(s.responseText);if(e.length){for(var t=new Array,i=0,n=e;i<n.length;i++){var r=n[i];t.push(l.Parse(r))}o(t)}else t=l.Parse(e),c&&(t.name=c),o(t)}else a("Unable to load the animation")}),s.open("GET",e),s.send()})},A.CreateFromSnippetAsync=function(l){var u=this;return new Promise(function(a,s){var c=new p.a;c.addEventListener("readystatechange",function(){if(4==c.readyState)if(200==c.status){var e=JSON.parse(JSON.parse(c.responseText).jsonPayload);if(e.animations){for(var t=JSON.parse(e.animations),i=new Array,n=0,r=t;n<r.length;n++){var o=r[n];i.push(u.Parse(o))}a(i)}else t=JSON.parse(e.animation),(i=u.Parse(t)).snippetId=l,a(i)}else s("Unable to load the snippet "+l)}),c.open("GET",u.SnippetUrl+"/"+l.replace(/#/g,"/")),c.send()})},A.AllowMatricesInterpolation=!1,A.AllowMatrixDecomposeForInterpolation=!0,A.SnippetUrl="https://snippet.babylonjs.com",A.ANIMATIONTYPE_FLOAT=0,A.ANIMATIONTYPE_VECTOR3=1,A.ANIMATIONTYPE_QUATERNION=2,A.ANIMATIONTYPE_MATRIX=3,A.ANIMATIONTYPE_COLOR3=4,A.ANIMATIONTYPE_COLOR4=7,A.ANIMATIONTYPE_VECTOR2=5,A.ANIMATIONTYPE_SIZE=6,A.ANIMATIONLOOPMODE_RELATIVE=0,A.ANIMATIONLOOPMODE_CYCLE=1,A.ANIMATIONLOOPMODE_CONSTANT=2,A);function A(e,t,i,n,r,o){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=n,this.loopMode=r,this.enableBlending=o,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=t.split("."),this.dataType=n,this.loopMode=void 0===r?A.ANIMATIONLOOPMODE_CYCLE:r}r.a.RegisteredTypes["BABYLON.Animation"]=l,s.a._AnimationRangeFactory=function(e,t,i){return new a.a(e,t,i)}},function(e,t,i){"use strict";i.d(t,"b",function(){return a}),i.d(t,"a",function(){return l});var a,n,r=i(6),s=i(154),c=i(2),o=i(21);(n=a=a||{})[n.Unknown=0]="Unknown",n[n.Url=1]="Url",n[n.Temp=2]="Temp",n[n.Raw=3]="Raw",n[n.Dynamic=4]="Dynamic",n[n.RenderTarget=5]="RenderTarget",n[n.MultiRenderTarget=6]="MultiRenderTarget",n[n.Cube=7]="Cube",n[n.CubeRaw=8]="CubeRaw",n[n.CubePrefiltered=9]="CubePrefiltered",n[n.Raw3D=10]="Raw3D",n[n.Raw2DArray=11]="Raw2DArray",n[n.Depth=12]="Depth",n[n.CubeRawRGBD=13]="CubeRawRGBD";var l=(u.prototype.getEngine=function(){return this._engine},Object.defineProperty(u.prototype,"source",{get:function(){return this._source}
1,enumerable:!1,configurable:!0}),u.prototype.incrementReferences=function(){this._references++},u.prototype.updateSize=function(e,t,i){void 0===i&&(i=1),this.width=e,this.height=t,this.depth=i,this.baseWidth=e,this.baseHeight=t,this.baseDepth=i,this._size=e*t*i},u.prototype._rebuild=function(){var t=this;switch(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedAnisotropicFilteringLevel=null,this.source){case a.Temp:return;case a.Url:return void(i=this._engine.createTexture(this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,function(){i._swapAndDie(t),t.isReady=!0},null,this._buffer,void 0,this.format));case a.Raw:return(i=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case a.Raw3D:return(i=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case a.Raw2DArray:return(i=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case a.Dynamic:return(i=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this),void this._engine.updateDynamicTexture(this,this._engine.getRenderingCanvas(),this.invertY,void 0,void 0,!0);case a.RenderTarget:var e,i,n=new s.a;return n.generateDepthBuffer=this._generateDepthBuffer,n.generateMipMaps=this.generateMipMaps,n.generateStencilBuffer=this._generateStencilBuffer,n.samplingMode=this.samplingMode,n.type=this.t
1ype,(i=this.isCube?this._engine.createRenderTargetCubeTexture(this.width,n):(e={width:this.width,height:this.height,layers:this.is2DArray?this.depth:void 0},this._engine.createRenderTargetTexture(e,n)))._swapAndDie(this),void(this.isReady=!0);case a.Depth:var r={bilinearFiltering:this.samplingMode!==c.a.TEXTURE_BILINEAR_SAMPLINGMODE,comparisonFunction:this._comparisonFunction,generateStencil:this._generateStencilBuffer,isCube:this.isCube},o={width:this.width,height:this.height,layers:this.is2DArray?this.depth:void 0};return(i=this._engine.createDepthStencilTexture(o,r))._swapAndDie(this),void(this.isReady=!0);case a.Cube:return void(i=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,function(){i._swapAndDie(t),t.isReady=!0},null,this.format,this._extension));case a.CubeRaw:return(i=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case a.CubeRawRGBD:return i=this._engine.createRawCubeTexture(null,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),void u._UpdateRGBDAsync(i,this._bufferViewArrayArray,this._sphericalPolynomial,this._lodGenerationScale,this._lodGenerationOffset).then(function(){i._swapAndDie(t),t.isReady=!0});case a.CubePrefiltered:return void((i=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,function(e){e&&e._swapAndDie(t),t.isReady=!0},null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial)}},u.prototype._swapAndDie=function(e){e._webGLTexture=this._webGLTexture,e._isRGBD=this._isRGBD,this._framebuffer&&(e._framebuffer=this._framebuffer),this._depthStencilBuffer&&(e._depthStencilBuffer=this._depthStencilBuffer),e._depthStencilTexture=this._depthStencilTexture,this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);var t,i=this._engine.getLoadedTexturesCache();-1!==(t=i.indexOf(this))&&i.splice(t,1),-1===(t=i.indexOf(e))&&i.push(e)},u.prototype.dispose=function(){this._webGLTexture&&(this._references--,0===this._references&&(this._engine._releaseTexture(this),this._webGLTexture=null))},u._UpdateRGBDAsync=function(e,t,i,n,r){throw o.a.WarnImport("environmentTextureTools")},u);function u(e,t,i){void 0===i&&(i=!1),this.isReady=!1,this.isCube=!1,this.is3D=!1,this.is2DArray=!1,this.isMultiview=!1,this.url="",this.samplingMode=-1,this.generateMipMaps=!1,this.samples=0,this.type=-1,this.format=-1,this.onLoadedObservable=new r.c,this.width=0,this.height=0,this.depth=0,this.baseWidth=0,this.baseHeight=0,this.baseDepth=0,this.invertY=!1,this._invertVScale=!1,this._associatedChannel=-1,this._source=a.Unknown,this._buffer=null,this._bufferView=null,this._bufferViewArray=null,this._bufferViewArrayArray=null,this._size=0,this._extension="",this._files=null,this._workingCanvas=null,this._workingContext=null,this._framebuffer=null,this._depthStencilBuffer=null,this._MSAAFramebuffer=null,this._MSAARenderBuffer=null,this._attachments=null,this._textureArray=null,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._isDisabled=!1,this._compression=null,this._generateStencilBuffer=!1,this._generateDepthBuffer=!1,this._comparisonFunction=0,this._sphericalPolynomial=null,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._colorTextureArray=null,this._depthStencilTextureArray=null,this._lodTextureHigh=null,this._lodTextureMid=null,this._lodTextureLow=null,this._isRGBD=!1,this._linearSpecularLOD=!1,this._irradianceTexture=null,this._webGLTexture=null,this._references=1,this._engine=e,this._source=t,i||(this._webGLTexture=e._createTexture())}},function(e,t,i){"use strict";i.d(t,"a",function(){return S});function n(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=g.e.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1}function r(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new n,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1}var s,o=i(1),m=i(13),a=i(6),g=i(0),c=i(12),_=i(4),p=i(16),l=i(51),v=i(66),u=i(52),h=i(2),d=i(243),f=i(21),b=i(192),y=i(10),T=i(32),E=i(24),S=(s=l.a,Object(o.d)(A,s),Object.defineProperty(A,"BILLBOARDMODE_NONE",{get:function(){return l.a.BILLBOARDMODE_NONE}
1,enumerable:!1,configurable:!0}),Object.defineProperty(A,"BILLBOARDMODE_X",{get:function(){return l.a.BILLBOARDMODE_X},enumerable:!1,configurable:!0}),Object.defineProperty(A,"BILLBOARDMODE_Y",{get:function(){return l.a.BILLBOARDMODE_Y},enumerable:!1,configurable:!0}),Object.defineProperty(A,"BILLBOARDMODE_Z",{get:function(){return l.a.BILLBOARDMODE_Z},enumerable:!1,configurable:!0}),Object.defineProperty(A,"BILLBOARDMODE_ALL",{get:function(){return l.a.BILLBOARDMODE_ALL},enumerable:!1,configurable:!0}),Object.defineProperty(A,"BILLBOARDMODE_USE_POSITION",{get:function(){return l.a.BILLBOARDMODE_USE_POSITION},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!1,configurable:!0}),A.prototype._updateNonUniformScalingState=function(e){return!!s.prototype._updateNonUniformScalingState.call(this,e)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(A.prototype,"onCollide",{set:function(e){this._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver),this._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"onCollisionPositionChange",{set:function(e){this._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver),this._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){this._internalAbstractMeshDataInfo._visibility!==e&&(this._internalAbstractMeshDataInfo._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(A.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.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"collisionMask",{get:function(){return this._meshCollisionData._collisionMask},set:function(e){this._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"collisionGroup",{get:function(){return this._meshCollisionData._collisionGroup},set:function(e){this._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"surroundingMeshes",{get:function(){return this._meshCollisionData._surroundingMeshes},set:function(e){this._meshCollisionData._surroundingMeshes=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"_positions",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(A.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:!1,configurable:!0}),A.prototype.getClassName=function(){return"AbstractMesh"},A.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},A.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==l.a.BILLBOARDMODE_NONE?this._masterMesh:s.prototype._getEffectiveParent.call(this)},A.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},A.prototype._rebuild=function(){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var e=0,t=this.subMeshes;e<t.length;e++)t[e]._rebuild()},A.prototype._resyncLightSources=function(){for(var e=this._lightSources.length=0,t=this.getScene().lights;e<t.length;e++){var i=t[e];i.isEnabled()&&i.canAffectMesh(this)&&this._lightSources.push(i)}this._markSubMeshesAsLightDirty()},A.prototype._resyncLightSource=function(e){var t=e.isEnabled()&&e.canAffectMesh(this),i=this._lightSources.indexOf(e),n=!1;if(-1===i){if(!t)return;this._lightSources.push(e)}else{if(t)return;n=!0,this._lightSources.splice(i,1)}this._markSubMeshesAsLightDirty(n)},A.prototype._unBindEffect=function(){for(var e=0,t=this.subMeshes;e<t.length;e++)t[e].setEffect(null)},A.prototype._removeLightSource=function(e,t){var i=this._lightSources.indexOf(e);-1!==i&&(this._lightSources.splice(i,1),this._markSubMeshesAsLightDirty(t))},A.prototype._markSubMeshesAsDirty=function(e){if(this.subMeshes)for(var t=0,i=this.subMeshes;t<i.length;t++){var n=i[t];n._materialDefines&&e(n._materialDefines)}},A.prototype._markSubMeshesAsLightDirty=function(t){void 0===t&&(t=!1),this._markSubMeshesAsDirty(function(e){return e.markAsLightDirty(t)})},A.prototype._markSubMeshesAsAttributesDirty=function(){this._markSubMeshesAsDirty(function(e){return e.markAsAttributesDirty()})},A.prototype._markSubMeshesAsMiscDirty=function(){this._markSubMeshesAsDirty(function(e){return e.markAsMiscDirty()})}
1,Object.defineProperty(A.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"isBlocked",{get:function(){return!1},enumerable:!1,configurable:!0}),A.prototype.getLOD=function(e){return this},A.prototype.getTotalVertices=function(){return 0},A.prototype.getTotalIndices=function(){return 0},A.prototype.getIndices=function(){return null},A.prototype.getVerticesData=function(e){return null},A.prototype.setVerticesData=function(e,t,i,n){return this},A.prototype.updateVerticesData=function(e,t,i,n){return this},A.prototype.setIndices=function(e,t){return this},A.prototype.isVerticesDataPresent=function(e){return!1},A.prototype.getBoundingInfo=function(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfo||this._updateBoundingInfo(),this._boundingInfo)},A.prototype.normalizeToUnitCube=function(e,t,i){return void 0===e&&(e=!0),void 0===t&&(t=!1),s.prototype.normalizeToUnitCube.call(this,e,t,i)},A.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},Object.defineProperty(A.prototype,"useBones",{get:function(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(_.b.MatricesIndicesKind)&&this.isVerticesDataPresent(_.b.MatricesWeightsKind)},enumerable:!1,configurable:!0}),A.prototype._preActivate=function(){},A.prototype._preActivateForIntermediateRendering=function(e){},A.prototype._activate=function(e,t){return this._renderId=e,!0},A.prototype._postActivate=function(){},A.prototype._freeze=function(){},A.prototype._unFreeze=function(){},A.prototype.getWorldMatrix=function(){return this._masterMesh&&this.billboardMode===l.a.BILLBOARDMODE_NONE?this._masterMesh.getWorldMatrix():s.prototype.getWorldMatrix.call(this)},A.prototype._getWorldMatrixDeterminant=function(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():s.prototype._getWorldMatrixDeterminant.call(this)},Object.defineProperty(A.prototype,"isAnInstance",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasInstances",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasThinInstances",{get:function(){return!1},enumerable:!1,configurable:!0}),A.prototype.movePOV=function(e,t,i){return this.position.addInPlace(this.calcMovePOV(e,t,i)),this},A.prototype.calcMovePOV=function(e,t,i){var n=new g.a;(this.rotationQuaternion?this.rotationQuaternion:g.b.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(n);var r=g.e.Zero(),o=this.definedFacingForward?-1:1;return g.e.TransformCoordinatesFromFloatsToRef(e*o,t,i*o,n,r),r},A.prototype.rotatePOV=function(e,t,i){return this.rotation.addInPlace(this.calcRotatePOV(e,t,i)),this},A.prototype.calcRotatePOV=function(e,t,i){var n=this.definedFacingForward?1:-1;return new g.e(e*n,t,i*n)},A.prototype.refreshBoundingInfo=function(e){return void 0===e&&(e=!1),this._boundingInfo&&this._boundingInfo.isLocked||this._refreshBoundingInfo(this._getPositionData(e),null),this},A.prototype._refreshBoundingInfo=function(e,t){var i;if(e&&(i=Object(b.a)(e,0,this.getTotalVertices(),t),this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new u.a(i.minimum,i.maximum)),this.subMeshes)for(var n=0;n<this.subMeshes.length;n++)this.subMeshes[n].refreshBoundingInfo(e);this._updateBoundingInfo()},A.prototype._getPositionData=function(e){var t=this.getVerticesData(_.b.PositionKind);if(t&&e&&this.skeleton){t=m.b.Slice(t),this._generatePointsArray();var i=this.getVerticesData(_.b.MatricesIndicesKind),n=this.getVerticesData(_.b.MatricesWeightsKind);if(n&&i){var r=4<this.numBoneInfluencers,o=r?this.getVerticesData(_.b.MatricesIndicesExtraKind):null,a=r?this.getVerticesData(_.b.MatricesWeightsExtraKind):null;this.skeleton.prepare();for(var s,c,l=this.skeleton.getTransformMatrices(this),u=g.c.Vector3[0],h=g.c.Matrix[0],d=g.c.Matrix[1],p=0,f=0;f<t.length;f+=3,p+=4){for(h.reset(),s=0;s<4;s++)0<(c=n[p+s])&&(g.a.FromFloat32ArrayToRefScaled(l,Math.floor(16*i[p+s]),c,d),h.addToSelf(d));if(r)for(s=0;s<4;s++)0<(c=a[p+s])&&(g.a.FromFloat32ArrayToRefScaled(l,Math.floor(16*o[p+s]),c,d),h.addToSelf(d));g.e.TransformCoordinatesFromFloatsToRef(t[f],t[f+1],t[f+2],h,u),u.toArray(t,f),this._positions&&this._positions[f/3].copyFrom(u)}}}return t},A.prototype._updateBoundingInfo=function(){var e=this._effectiveMesh;return this._boundingInfo?this._boundingInfo.update(e.worldMatrixFromCache):this._boundingInfo=new u.a(this.absolutePosition,this.absolutePosition,e.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(e.worldMatrixFromCache),this},A.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i<t;i++){var n=this.subMeshes[i];(1<t||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},A.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||this._updateBoundingInfo()},Object.defineProperty(A.prototype,"_effectiveMesh",{get:function(){return this.skeleton&&this.skeleton.overrideMesh||this}
1,enumerable:!1,configurable:!0}),A.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},A.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},A.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();n<r.length;n++)if(r[n].intersectsMesh(e,t,!0))return!0;return!1},A.prototype.intersectsPoint=function(e){return!!this._boundingInfo&&this._boundingInfo.intersectsPoint(e)},Object.defineProperty(A.prototype,"checkCollisions",{get:function(){return this._meshCollisionData._checkCollisions},set:function(e){this._meshCollisionData._checkCollisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"collider",{get:function(){return this._meshCollisionData._collider},enumerable:!1,configurable:!0}),A.prototype.moveWithCollisions=function(e){this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._meshCollisionData._oldPositionForCollisions);var t=this.getScene().collisionCoordinator;return this._meshCollisionData._collider||(this._meshCollisionData._collider=t.createCollider()),this._meshCollisionData._collider._radius=this.ellipsoid,t.getNewPosition(this._meshCollisionData._oldPositionForCollisions,e,this._meshCollisionData._collider,3,this,this._onCollisionPositionChange,this.uniqueId),this},A.prototype._collideForSubMesh=function(e,t,i){if(this._generatePointsArray(),!this._positions)return this;if(!e._lastColliderWorldVertices||!e._lastColliderTransformMatrix.equals(t)){e._lastColliderTransformMatrix=t.clone(),e._lastColliderWorldVertices=[],e._trianglePlanes=[];for(var n=e.verticesStart,r=e.verticesStart+e.verticesCount,o=n;o<r;o++)e._lastColliderWorldVertices.push(g.e.TransformCoordinates(this._positions[o],t))}return i._collide(e._trianglePlanes,e._lastColliderWorldVertices,this.getIndices(),e.indexStart,e.indexStart+e.indexCount,e.verticesStart,!!e.getMaterial(),this),this},A.prototype._processCollisionsForSubMeshes=function(e,t){for(var i=this._scene.getCollidingSubMeshCandidates(this,e),n=i.length,r=0;r<n;r++){var o=i.data[r];1<n&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},A.prototype._checkCollision=function(e){if(!this._boundingInfo||!this._boundingInfo._checkCollision(e))return this;var t=g.c.Matrix[0],i=g.c.Matrix[1];return g.a.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},A.prototype._generatePointsArray=function(){return!1},A.prototype.intersects=function(e,t,i,n){void 0===n&&(n=!1);var r=new v.a,o="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,a=this._boundingInfo;if(!(this.subMeshes&&a&&e.intersectsSphere(a.boundingSphere,o)&&e.intersectsBox(a.boundingBox,o)))return r;if(n)return r.hit=!0,r.pickedMesh=this,r.distance=g.e.Distance(e.origin,a.boundingSphere.center),r.subMeshId=0,r;if(!this._generatePointsArray())return r;for(var s=null,c=this._scene.getIntersectingSubMeshCandidates(this,e),l=c.length,u=0;u<l;u++){var h=c.data[u];if(!(1<l)||h.canIntersects(e)){var d=h.intersects(e,this._positions,this.getIndices(),t,i);if(d&&(t||!s||d.distance<s.distance)&&((s=d).subMeshId=u,t))break}}if(s){var p=this.skeleton&&this.skeleton.overrideMesh?this.skeleton.overrideMesh.getWorldMatrix():this.getWorldMatrix(),f=g.c.Vector3[0],m=g.c.Vector3[1];g.e.TransformCoordinatesToRef(e.origin,p,f),e.direction.scaleToRef(s.distance,m);var _=g.e.TransformNormal(m,p).addInPlace(f);return r.hit=!0,r.distance=g.e.Distance(f,_),r.pickedPoint=_,r.pickedMesh=this,r.bu=s.bu||0,r.bv=s.bv||0,r.subMeshFaceId=s.faceId,r.faceId=s.faceId+c.data[s.subMeshId].indexStart/(-1!==this.getClassName().indexOf("LinesMesh")?2:3),r.subMeshId=s.subMeshId,r}return r},A.prototype.clone=function(e,t,i){return null},A.prototype.releaseSubMeshes=function(){if(this.subMeshes)for(;this.subMeshes.length;)this.subMeshes[0].dispose();else this.subMeshes=new Array;return this},A.prototype.dispose=function(e,t){var i,r=this;for(void 0===t&&(t=!1),this._scene.useMaterialMeshMap&&this._material&&this._material.meshMap&&(this._material.meshMap[this.uniqueId]=void 0),this.get
1Scene().freeActiveMeshes(),this.getScene().freeRenderingGroups(),void 0!==this.actionManager&&null!==this.actionManager&&(this.actionManager.dispose(),this.actionManager=null),this._internalAbstractMeshDataInfo._skeleton=null,this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null),i=0;i<this._intersectionsInProgress.length;i++){var n=this._intersectionsInProgress[i],o=n._intersectionsInProgress.indexOf(this);n._intersectionsInProgress.splice(o,1)}this._intersectionsInProgress=[],this.getScene().lights.forEach(function(e){var t=e.includedOnlyMeshes.indexOf(r);-1!==t&&e.includedOnlyMeshes.splice(t,1),-1!==(t=e.excludedMeshes.indexOf(r))&&e.excludedMeshes.splice(t,1);var i,n=e.getShadowGenerator();!n||(i=n.getShadowMap())&&i.renderList&&-1!==(t=i.renderList.indexOf(r))&&i.renderList.splice(t,1)}),"InstancedMesh"===this.getClassName()&&"InstancedLinesMesh"===this.getClassName()||this.releaseSubMeshes();var a=this.getScene().getEngine();if(this._occlusionQuery&&(this.isOcclusionQueryInProgress=!1,a.deleteQuery(this._occlusionQuery),this._occlusionQuery=null),a.wipeCaches(),this.getScene().removeMesh(this),t&&this.material&&("MultiMaterial"===this.material.getClassName()?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!e)for(i=0;i<this.getScene().particleSystems.length;i++)this.getScene().particleSystems[i].emitter===this&&(this.getScene().particleSystems[i].dispose(),i--);this._internalAbstractMeshDataInfo._facetData.facetDataEnabled&&this.disableFacetData(),this.onAfterWorldMatrixUpdateObservable.clear(),this.onCollideObservable.clear(),this.onCollisionPositionChangeObservable.clear(),this.onRebuildObservable.clear(),s.prototype.dispose.call(this,e,t)},A.prototype.addChild=function(e){return e.setParent(this),this},A.prototype.removeChild=function(e){return e.setParent(null),this},A.prototype._initFacetData=function(){var e=this._internalAbstractMeshDataInfo._facetData;e.facetNormals||(e.facetNormals=new Array),e.facetPositions||(e.facetPositions=new Array),e.facetPartitioning||(e.facetPartitioning=new Array),e.facetNb=this.getIndices().length/3|0,e.partitioningSubdivisions=e.partitioningSubdivisions?e.partitioningSubdivisions:10,e.partitioningBBoxRatio=e.partitioningBBoxRatio?e.partitioningBBoxRatio:1.01;for(var t=0;t<e.facetNb;t++)e.facetNormals[t]=g.e.Zero(),e.facetPositions[t]=g.e.Zero();return e.facetDataEnabled=!0,this},A.prototype.updateFacetData=function(){var e=this._internalAbstractMeshDataInfo._facetData;e.facetDataEnabled||this._initFacetData();var t,i=this.getVerticesData(_.b.PositionKind),n=this.getIndices(),r=this.getVerticesData(_.b.NormalKind),o=this.getBoundingInfo();if(e.facetDepthSort&&!e.facetDepthSortEnabled){if(e.facetDepthSortEnabled=!0,n instanceof Uint16Array)e.depthSortedIndices=new Uint16Array(n);else if(n instanceof Uint32Array)e.depthSortedIndices=new Uint32Array(n);else{for(var a=!1,s=0;s<n.length;s++)if(65535<n[s]){a=!0;break}e.depthSortedIndices=new(a?Uint32Array:Uint16Array)(n)}e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},e.facetDepthSortFrom||(t=this.getScene().activeCamera,e.facetDepthSortFrom=t?t.position:g.e.Zero()),e.depthSortedFacets=[];for(var c=0;c<e.facetNb;c++){var l={ind:3*c,sqDistance:0};e.depthSortedFacets.push(l)}e.invertedMatrix=g.a.Identity(),e.facetDepthSortOrigin=g.e.Zero()}e.bbSize.x=o.maximum.x-o.minimum.x>T.a?o.maximum.x-o.minimum.x:T.a,e.bbSize.y=o.maximum.y-o.minimum.y>T.a?o.maximum.y-o.minimum.y:T.a,e.bbSize.z=o.maximum.z-o.minimum.z>T.a?o.maximum.z-o.minimum.z:T.a;var u=(u=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y)>e.bbSize.z?u:e.bbSize.z;if(e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/u),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/u),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/u),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=o,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),g.e.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,p.a.ComputeNormals(i,n,r,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);for(var h=e.depthSortedIndices.length/3|0,c=0;c<h;c++){var d=e.depthSortedFacets[c].ind;e.depthSortedIndices[3*c]=n[d],e.depthSortedIndices[3*c+1]=n[d+1],e.depthSortedIndices[3*c+2]=n[d+2]}this.updateIndices(e.depthSortedIndices,void 0,!0)}return this},A.prototype.getFacetLocalNormals=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetNormals||this.updateFacetData(),e.facetNormals},A.prototype.getFacetLocalPositions=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetPositions||this.updateFacetData(),e.facetPositions},A.prototype.getFacetLocalPartitioning=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetPartitioning||this.updateFacetData(),e.facetPartitioning},A.prototype.getFacetPosition=function(e){var t=g.e.Zero();return this.getFacetPositionToRef(e,t),t},A.prototype.getFacetPositionToRef=function(e,t){var i=this.getFacetLocalPositions()[e],n=this.getWorldMatrix();return g.e.TransformCoordinatesToRef(i,n,t),this},A.prototype.getFacetNormal=function(e){var t=g.e.Zero();return this.getFacetNormalToRef(e,t),t},A.prototype.getFacetNormalToRef=function(e,t){var i=this.getFacetLocalNormals()[e];return g.e.TransformNormalToRef(i,this.getWorldMatrix(),t),this},A.prototype.getFacetsAtLocalCoordinates=function(e,t,i){var n=this.getBoundingInfo(),r=this._internalAbstractMeshDataInfo._facetData,o=Math.floor((e-n.minimum.x*r.partitioningBBoxRatio)*r.subDiv.X*r.partitioningBBoxRatio/r.bbSize.x),a=Math.floor((t-n.minimum.y*r.partitioningBBoxRatio)*r.subDiv.Y*r.partitioningBBoxRatio/r.bbSize.y),s=Math.floor((i-n.minimum.z*r.partitioningBBoxRatio)*r.subDiv.Z*r.partitioningBBoxRatio/r.bbSize.z);return o<0||o>r.subDiv.max||a<0||a>r.subDiv.max||s<0||s>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*a+r.subDiv.max*r.subDiv.max*s]},A.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),s=g.c.Matrix[5];a.invertToRef(s);var c=g.c.Vector3[8];g.e.TransformCoordinatesFromFloatsToRef(e,t,i,s,c);var l=this.getClosestFacetAtLocalCoordinates(c.x,c.y,c.z,n,r,o);return n&&g.e.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),l},A.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=null,s=0,c=0,l=0,u=0,h=0,d=0,p=0,f=0,m=this.getFacetLocalPositions(),_=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;for(var v,b,y,T=Number.MAX_VALUE,E=T,S=0;S<g.length;S++)b=_[v=g[S]],u=(e-(y=m[v]).x)*b.x+(t-y.y)*b.y+(i-y.z)*b.z,(!r||r&&o&&0<=u||r&&!o&&u<=0)&&(u=b.x*y.x+b.y*y.y+b.z*y.z,h=-(b.x*e+b.y*t+b.z*i-u)/(b.x*b.x+b.y*b.y+b.z*b.z),(E=(s=(d=e+b.x*h)-e)*s+(c=(p=t+b.y*h)-t)*c+(l=(f=i+b.z*h)-i)*l)<T&&(T=E,a=v,n&&(n.x=d,n.y=p,n.z=f)));return a},A.prototype.getFacetDataParameters=function(){return this._internalAbstractMeshDataInfo._facetData.facetParameters},A.prototype.disableFacetData=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetDataEnabled&&(e.facetDataEnabled=!1,e.facetPositions=new Array,e.facetNormals=new Array,e.facetPartitioning=new Array,e.facetParameters=null,e.depthSortedIndices=new Uint32Array(0)),this},A.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this},A.prototype.createNormals=function(e){var t=this.getVerticesData(_.b.PositionKind),i=this.getIndices(),n=this.isVerticesDataPresent(_.b.NormalKind)?this.getVerticesData(_.b.NormalKind):[];return p.a.ComputeNormals(t,i,n,{useRightHandedSystem:this.getScene().useRightHandedSystem}),this.setVerticesData(_.b.NormalKind,n,e),this},A.prototype.alignWithNormal=function(e,t){t=t||E.a.Y;var i=g.c.Vector3[0],n=g.c.Vector3[1];return g.e.CrossToRef(t,e,n),g.e.CrossToRef(e,n,i),this.rotationQuaternion?g.b.RotationQuaternionFromAxisToRef(i,e,n,this.rotationQuaternion):g.e.RotationFromAxisToRef(i,e,n,this.rotation),this},A.prototype._checkOcclusionQuery=function(){return!1},A.prototype.disableEdgesRendering=function(){throw f.a.WarnImport("EdgesRenderer")},A.prototype.enableEdgesRendering=function(e,t){throw f.a.WarnImport("EdgesRenderer")},A.prototype.getConnectedParticleSystems=function(){var t=this;return this._scene.particleSystems.filter(function(e){return e.emitter===t})},A.OCCLUSION_TYPE_NONE=0,A.OCCLUSION_TYPE_OPTIMISTIC=1,A.OCCLUSION_TYPE_STRICT=2,A.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0,A.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1,A.CULLINGSTRATEGY_STANDARD=h.a.MESHES_CULLINGSTRATEGY_STANDARD,A.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=h.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,A.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=h.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION,A.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=h.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY,A);function A(e,t){void 0===t&&(t=null);var n=s.call(this,e,t,!1)||this;return n._internalAbstractMeshDataInfo=new r,n.cullingStrategy=A.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,n.onCollideObservable=new a.c,n.onCollisionPositionChangeObservable=new a.c,n.onMaterialChangedObservable=new a.c,n.definedFacingForward=!0,n._occlusionQuery=null,n._renderingGroup=null,n.alphaIndex=Number.MAX_VALUE,n.isVisible=!0,n.isPickable=!0,n.showSubMeshesBoundingBox=!1,n.isBlocker=!1,n.enablePointerMoveEvents=!1,n.renderingGroupId=0,n._material=null,n.outlineColor=y.a.Red(),n.outlineWidth=.02,n.overlayColor=y.a.Red(),n.overlayAlpha=.5,n.useOctreeForRenderingSelection=!0,n.useOctreeForPicking=!0,n.useOctreeForCollisions=!0,n.alwaysSelectAsActiveMesh=!1,n.doNotSyncBoundingInfo=!1,n.actionManager=null,n._meshCollisionData=new d.a,n.ellipsoid=new g.e(.5,1,.5),n.ellipsoidOffset=new g.e(0,0,0),n.edgesWidth=1,n.edgesColor=new y.b(1,0,0,1),n._edgesRenderer=null,n._masterMesh=null,n._boundingInfo=null,n._renderId=0,n._intersectionsInProgress=new Array,n._unIndexed=!1,n._lightSources=new Array,n._waitingData={lods:null,actions:null,freezeWorldMatrix:null},n._bonesTransformMatrices=null,n._transformMatrixTexture=null,n.onRebuildObservable=new a.c,n._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),t.subtractToRef(n._meshCollisionData._oldPositionForCollisions,n._meshCollisionData._diffPositionForCollisions),n._meshCollisionData._diffPositionForCollisions.length()>c.a.CollisionsEpsilon&&n.position.addInPlace(n._meshCollisionData._diffPositionForCollisions),i&&n.onCollideObservable.notifyObservers(i),n.onCollisionPositionChangeObservable.notifyObservers(n.position)},n.getScene().addMesh(n),n._resyncLightSources(),n}},function(e,t,i){"use strict";i.d(t,"a",function(){return h});var n=i(1),r=i(3),o=i(13),a=i(6),s=i(22),d=i(78),c=i(116),l=i(2),u=i(7),p=i(80),h=(Object.defineProperty(f.prototype,"canRenderToMRT",{get:function(){return!1}
1,enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha!==e&&(this._alpha=e,this.markAsDirty(f.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"backFaceCulling",{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(f.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hasRenderTargetTextures",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new a.c),this._onBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onBind",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onUnBindObservable",{get:function(){return this._onUnBindObservable||(this._onUnBindObservable=new a.c),this._onUnBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onEffectCreatedObservable",{get:function(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new a.c),this._onEffectCreatedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"alphaMode",{get:function(){return this._alphaMode},set:function(e){this._alphaMode!==e&&(this._alphaMode=e,this.markAsDirty(f.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"needDepthPrePass",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(f.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"wireframe",{get:function(){switch(this._fillMode){case f.WireFrameFillMode:case f.LineListDrawMode:case f.LineLoopDrawMode:case f.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(e){this.fillMode=e?f.WireFrameFillMode:f.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"pointsCloud",{get:function(){switch(this._fillMode){case f.PointFillMode:case f.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(e){this.fillMode=e?f.PointFillMode:f.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"fillMode",{get:function(){return this._fillMode},set:function(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(f.MiscDirtyFlag))},enumerable:!1,configurable:!0}),f.prototype.toString=function(e){return"Name: "+this.name},f.prototype.getClassName=function(){return"Material"},Object.defineProperty(f.prototype,"isFrozen",{get:function(){return this.checkReadyOnlyOnce},enumerable:!1,configurable:!0}),f.prototype.freeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!0},f.prototype.unfreeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!1},f.prototype.isReady=function(e,t){return!0},f.prototype.isReadyForSubMesh=function(e,t,i){return!1},f.prototype.getEffect=function(){return this._effect},f.prototype.getScene=function(){return this._scene},Object.defineProperty(f.prototype,"transparencyMode",{get:function(){return this._transparencyMode},set:function(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._forceAlphaTest=e===f.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"_disableAlphaBlending",{get:function(){return this._transparencyMode===f.MATERIAL_OPAQUE||this._transparencyMode===f.MATERIAL_ALPHATEST}
1,enumerable:!1,configurable:!0}),f.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&this.alpha<1},f.prototype.needAlphaBlendingForMesh=function(e){return!(this._disableAlphaBlending&&1<=e.visibility)&&(this.needAlphaBlending()||e.visibility<1||e.hasVertexAlpha)},f.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest},f.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},f.prototype.getAlphaTestTexture=function(){return null},f.prototype.markDirty=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){var i=t[e];if(i.subMeshes)for(var n=0,r=i.subMeshes;n<r.length;n++){var o=r[n];o.getMaterial()===this&&o.effect&&(o.effect._wasPreviouslyReady=!1)}}},f.prototype._preBind=function(e,t){void 0===t&&(t=null);var i=this._scene.getEngine(),n=(null==t?this.sideOrientation:t)===f.ClockWiseSideOrientation;return i.enableEffect(e||this._effect),i.setState(this.backFaceCulling,this.zOffset,!1,n),n},f.prototype.bind=function(e,t){},f.prototype.bindForSubMesh=function(e,t,i){},f.prototype.bindOnlyWorldMatrix=function(e){},f.prototype.bindSceneUniformBuffer=function(e,t){t.bindToEffect(e,"Scene")},f.prototype.bindView=function(e){this._useUBO?this.bindSceneUniformBuffer(e,this.getScene().getSceneUniformBuffer()):e.setMatrix("view",this.getScene().getViewMatrix())},f.prototype.bindViewProjection=function(e){this._useUBO?this.bindSceneUniformBuffer(e,this.getScene().getSceneUniformBuffer()):e.setMatrix("viewProjection",this.getScene().getTransformMatrix())},f.prototype._afterBind=function(e){var t;(this._scene._cachedMaterial=this)._scene._cachedVisibility=e?e.visibility:1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite&&(t=this._scene.getEngine(),this._cachedDepthWriteState=t.getDepthWrite(),t.setDepthWrite(!1)),this.disableColorWrite&&(t=this._scene.getEngine(),this._cachedColorWriteState=t.getColorWrite(),t.setColorWrite(!1)),0!==this.depthFunction&&(t=this._scene.getEngine(),this._cachedDepthFunctionState=t.getDepthFunction()||0,t.setDepthFunction(this.depthFunction))},f.prototype.unbind=function(){this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),0!==this.depthFunction&&this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState),this.disableDepthWrite&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState),this.disableColorWrite&&this._scene.getEngine().setColorWrite(this._cachedColorWriteState)},f.prototype.getActiveTextures=function(){return[]},f.prototype.hasTexture=function(e){return!1},f.prototype.clone=function(e){return null},f.prototype.getBindedMeshes=function(){var t=this;if(this.meshMap){var e=new Array;for(var i in this.meshMap){var n=this.meshMap[i];n&&e.push(n)}return e}return this._scene.meshes.filter(function(e){return e.material===t})},f.prototype.forceCompilation=function(r,o,e,a){var s=this,c=Object(n.a)({clipPlane:!1,useInstances:!1},e),l=this.getScene(),u=this.allowShaderHotSwapping;this.allowShaderHotSwapping=!1;var h=function(){var e,t,i,n;s._scene&&s._scene.getEngine()&&(e=l.clipPlane,c.clipPlane&&(l.clipPlane=new p.a(0,0,0,1)),s._storeEffectOnSubMeshes?(t=!0,i=null,r.subMeshes&&((n=new d.a(0,0,0,0,0,r,void 0,!1,!1))._materialDefines&&(n._materialDefines._renderId=-1),s.isReadyForSubMesh(r,n,c.useInstances)||(n.effect&&n.effect.getCompilationError()&&n.effect.allFallbacksProcessed()?i=n.effect.getCompilationError():(t=!1,setTimeout(h,16)))),t&&(s.allowShaderHotSwapping=u,i&&a&&a(i),o&&o(s))):s.isReady()?(s.allowShaderHotSwapping=u,o&&o(s)):setTimeout(h,16),c.clipPlane&&(l.clipPlane=e))};h()},f.prototype.forceCompilationAsync=function(i,n){var r=this;return new Promise(function(e,t){r.forceCompilation(i,function(){e()},n,function(e){t(e)})})},f.prototype.markAsDirty=function(e){this.getScene().blockMaterialDirtyMechanism||(f._DirtyCallbackArray.length=0,e&f.TextureDirtyFlag&&f._DirtyCallbackArray.push(f._TextureDirtyCallBack),e&f.LightDirtyFlag&&f._DirtyCallbackArray.push(f._LightsDirtyCallBack),e&f.FresnelDirtyFlag&&f._DirtyCallbackArray.push(f._FresnelDirtyCallBack),e&f.AttributesDirtyFlag&&f._DirtyCallbackArray.push(f._AttributeDirtyCallBack),e&f.MiscDirtyFlag&&f._DirtyCallbackArray.push(f._MiscDirtyCallBack),f._DirtyCallbackArray.length&&this._markAllSubMeshesAsDirty(f._RunDirtyCallBacks),this.get
1Scene().resetCachedMaterial())},f.prototype._markAllSubMeshesAsDirty=function(e){if(!this.getScene().blockMaterialDirtyMechanism)for(var t=0,i=this.getScene().meshes;t<i.length;t++){var n=i[t];if(n.subMeshes)for(var r=0,o=n.subMeshes;r<o.length;r++){var a=o[r];a.getMaterial()===this&&a._materialDefines&&e(a._materialDefines)}}},f.prototype._markScenePrePassDirty=function(){var e;this.getScene().blockMaterialDirtyMechanism||(e=this.getScene().enablePrePassRenderer())&&e.markAsDirty()},f.prototype._markAllSubMeshesAsAllDirty=function(){this._markAllSubMeshesAsDirty(f._AllDirtyCallBack)},f.prototype._markAllSubMeshesAsImageProcessingDirty=function(){this._markAllSubMeshesAsDirty(f._ImageProcessingDirtyCallBack)},f.prototype._markAllSubMeshesAsTexturesDirty=function(){this._markAllSubMeshesAsDirty(f._TextureDirtyCallBack)},f.prototype._markAllSubMeshesAsFresnelDirty=function(){this._markAllSubMeshesAsDirty(f._FresnelDirtyCallBack)},f.prototype._markAllSubMeshesAsFresnelAndMiscDirty=function(){this._markAllSubMeshesAsDirty(f._FresnelAndMiscDirtyCallBack)},f.prototype._markAllSubMeshesAsLightsDirty=function(){this._markAllSubMeshesAsDirty(f._LightsDirtyCallBack)},f.prototype._markAllSubMeshesAsAttributesDirty=function(){this._markAllSubMeshesAsDirty(f._AttributeDirtyCallBack)},f.prototype._markAllSubMeshesAsMiscDirty=function(){this._markAllSubMeshesAsDirty(f._MiscDirtyCallBack)},f.prototype._markAllSubMeshesAsTexturesAndMiscDirty=function(){this._markAllSubMeshesAsDirty(f._TextureAndMiscDirtyCallBack)},f.prototype.setPrePassRenderer=function(e){return!1},f.prototype.dispose=function(e,t,i){var n,r=this.getScene();if(r.stopAnimation(this),r.freeProcessedMaterials(),r.removeMaterial(this),!0!==i)if(this.meshMap)for(var o in this.meshMap)(n=this.meshMap[o])&&(n.material=null,this.releaseVertexArrayObject(n,e));else for(var a=0,s=r.meshes;a<s.length;a++)(n=s[a]).material!==this||n.sourceMesh||(n.material=null,this.releaseVertexArrayObject(n,e));this._uniformBuffer.dispose(),e&&this._effect&&(this._storeEffectOnSubMeshes||this._effect.dispose(),this._effect=null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear(),this._onEffectCreatedObservable&&this._onEffectCreatedObservable.clear()},f.prototype.releaseVertexArrayObject=function(e,t){if(e.geometry){var i=e.geometry;if(this._storeEffectOnSubMeshes)for(var n=0,r=e.subMeshes;n<r.length;n++){var o=r[n];i._releaseVertexArrayObject(o._materialEffect),t&&o._materialEffect&&o._materialEffect.dispose()}else i._releaseVertexArrayObject(this._effect)}},f.prototype.serialize=function(){return r.a.Serialize(this)},f.Parse=function(e,t,i){if(e.customType){if("BABYLON.PBRMaterial"===e.customType&&e.overloadedAlbedo&&(e.customType="BABYLON.LegacyPBRMaterial",!BABYLON.LegacyPBRMaterial))return u.a.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."),null}else e.customType="BABYLON.StandardMaterial";return o.b.Instantiate(e.customType).Parse(e,t,i)},f.TriangleFillMode=l.a.MATERIAL_TriangleFillMode,f.WireFrameFillMode=l.a.MATERIAL_WireFrameFillMode,f.PointFillMode=l.a.MATERIAL_PointFillMode,f.PointListDrawMode=l.a.MATERIAL_PointListDrawMode,f.LineListDrawMode=l.a.MATERIAL_LineListDrawMode,f.LineLoopDrawMode=l.a.MATERIAL_LineLoopDrawMode,f.LineStripDrawMode=l.a.MATERIAL_LineStripDrawMode,f.TriangleStripDrawMode=l.a.MATERIAL_TriangleStripDrawMode,f.TriangleFanDrawMode=l.a.MATERIAL_TriangleFanDrawMode,f.ClockWiseSideOrientation=l.a.MATERIAL_ClockWiseSideOrientation,f.CounterClockWiseSideOrientation=l.a.MATERIAL_CounterClockWiseSideOrientation,f.TextureDirtyFlag=l.a.MATERIAL_TextureDirtyFlag,f.LightDirtyFlag=l.a.MATERIAL_LightDirtyFlag,f.FresnelDirtyFlag=l.a.MATERIAL_FresnelDirtyFlag,f.AttributesDirtyFlag=l.a.MATERIAL_AttributesDirtyFlag,f.MiscDirtyFlag=l.a.MATERIAL_MiscDirtyFlag,f.AllDirtyFlag=l.a.MATERIAL_AllDirtyFlag,f.MATERIAL_OPAQUE=0,f.MATERIAL_ALPHATEST=1,f.MATERIAL_ALPHABLEND=2,f.MATERIAL_ALPHATESTANDBLEND=3,f.MATERIAL_NORMALBLENDMETHOD_WHITEOUT=0,f.MATERIAL_NORMALBLENDMETHOD_RNM=1,f._AllDirtyCallBack=function(e){return e.markAllAsDirt
1y()},f._ImageProcessingDirtyCallBack=function(e){return e.markAsImageProcessingDirty()},f._TextureDirtyCallBack=function(e){return e.markAsTexturesDirty()},f._FresnelDirtyCallBack=function(e){return e.markAsFresnelDirty()},f._MiscDirtyCallBack=function(e){return e.markAsMiscDirty()},f._LightsDirtyCallBack=function(e){return e.markAsLightDirty()},f._AttributeDirtyCallBack=function(e){return e.markAsAttributesDirty()},f._FresnelAndMiscDirtyCallBack=function(e){f._FresnelDirtyCallBack(e),f._MiscDirtyCallBack(e)},f._TextureAndMiscDirtyCallBack=function(e){f._TextureDirtyCallBack(e),f._MiscDirtyCallBack(e)},f._DirtyCallbackArray=[],f._RunDirtyCallBacks=function(e){for(var t=0,i=f._DirtyCallbackArray;t<i.length;t++)(0,i[t])(e)},Object(n.c)([Object(r.c)()],f.prototype,"id",void 0),Object(n.c)([Object(r.c)()],f.prototype,"uniqueId",void 0),Object(n.c)([Object(r.c)()],f.prototype,"name",void 0),Object(n.c)([Object(r.c)()],f.prototype,"checkReadyOnEveryCall",void 0),Object(n.c)([Object(r.c)()],f.prototype,"checkReadyOnlyOnce",void 0),Object(n.c)([Object(r.c)()],f.prototype,"state",void 0),Object(n.c)([Object(r.c)("alpha")],f.prototype,"_alpha",void 0),Object(n.c)([Object(r.c)("backFaceCulling")],f.prototype,"_backFaceCulling",void 0),Object(n.c)([Object(r.c)()],f.prototype,"sideOrientation",void 0),Object(n.c)([Object(r.c)("alphaMode")],f.prototype,"_alphaMode",void 0),Object(n.c)([Object(r.c)()],f.prototype,"_needDepthPrePass",void 0),Object(n.c)([Object(r.c)()],f.prototype,"disableDepthWrite",void 0),Object(n.c)([Object(r.c)()],f.prototype,"disableColorWrite",void 0),Object(n.c)([Object(r.c)()],f.prototype,"forceDepthWrite",void 0),Object(n.c)([Object(r.c)()],f.prototype,"depthFunction",void 0),Object(n.c)([Object(r.c)()],f.prototype,"separateCullingPass",void 0),Object(n.c)([Object(r.c)("fogEnabled")],f.prototype,"_fogEnabled",void 0),Object(n.c)([Object(r.c)()],f.prototype,"pointSize",void 0),Object(n.c)([Object(r.c)()],f.prototype,"zOffset",void 0),Object(n.c)([Object(r.c)()],f.prototype,"pointsCloud",null),Object(n.c)([Object(r.c)()],f.prototype,"fillMode",null),Object(n.c)([Object(r.c)()],f.prototype,"transparencyMode",null),f);function f(e,t,i){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new a.c,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=l.a.ALPHA_COMBINE,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this._effect=null,this._useUBO=!1,this._fillMode=f.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._forceAlphaTest=!1,this._transparencyMode=null,this.name=e,this.id=e||o.b.RandomId(),this._scene=t||s.a.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.useRightHandedSystem?this.sideOrientation=f.ClockWiseSideOrientation:this.sideOrientation=f.CounterClockWiseSideOrientation,this._uniformBuffer=new c.a(this._scene.getEngine()),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,i||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={})}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(1),h=i(0),r=i(3),o=i(6),a=i(22),s=i(21),c=(l.AddNodeConstructor=function(e,t){this._NodeConstructors[e]=t},l.Construct=function(e,t,i,n){var r=this._NodeConstructors[e];return r?r(t,i,n):null},Object.defineProperty(l.prototype,"doNotSerialize",{get:function(){return!!this._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize},set:function(e){this._doNotSerialize=e},enumerable:!1,configurable:!0}),l.prototype.isDisposed=function(){return this._isDisposed},Object.defineProperty(l.prototype,"parent",{get:function(){return this._parentNode},set:function(e){var t,i;this._parentNode!==e&&(t=this._parentNode,this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children&&(-1!==(i=this._parentNode._children.indexOf(this))&&this._parentNode._children.splice(i,1),e||this._isDisposed||this._addToSceneRootNodes()),this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState())}
1,enumerable:!1,configurable:!0}),l.prototype._addToSceneRootNodes=function(){-1===this._sceneRootNodesIndex&&(this._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))},l.prototype._removeFromSceneRootNodes=function(){var e,t;-1!==this._sceneRootNodesIndex&&(t=(e=this._scene.rootNodes).length-1,e[this._sceneRootNodesIndex]=e[t],e[this._sceneRootNodesIndex]._sceneRootNodesIndex=this._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._sceneRootNodesIndex=-1)},Object.defineProperty(l.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),l.prototype.getClassName=function(){return"Node"},Object.defineProperty(l.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),l.prototype.getScene=function(){return this._scene},l.prototype.getEngine=function(){return this._scene.getEngine()},l.prototype.addBehavior=function(e,t){var i=this;return void 0===t&&(t=!1),-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce(function(){e.attach(i)}):e.attach(this),this._behaviors.push(e)),this},l.prototype.removeBehavior=function(e){var t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this},Object.defineProperty(l.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),l.prototype.getBehaviorByName=function(e){for(var t=0,i=this._behaviors;t<i.length;t++){var n=i[t];if(n.name===e)return n}return null},l.prototype.getWorldMatrix=function(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix},l.prototype._getWorldMatrixDeterminant=function(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant},Object.defineProperty(l.prototype,"worldMatrixFromCache",{get:function(){return this._worldMatrix},enumerable:!1,configurable:!0}),l.prototype._initCache=function(){this._cache={},this._cache.parent=void 0},l.prototype.updateCache=function(e){!e&&this.isSynchronized()||(this._cache.parent=this.parent,this._updateCache())},l.prototype._getActionManagerForTrigger=function(e,t){return void 0===t&&(t=!0),this.parent?this.parent._getActionManagerForTrigger(e,!1):null},l.prototype._updateCache=function(e){},l.prototype._isSynchronized=function(){return!0},l.prototype._markSyncedWithParent=function(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)},l.prototype.isSynchronizedWithParent=function(){return!this._parentNode||this._parentUpdateId===this._parentNode._childUpdateId&&this._parentNode.isSynchronized()},l.prototype.isSynchronized=function(){return this._cache.parent!=this._parentNode?(this._cache.parent=this._parentNode,!1):!(this._parentNode&&!this.isSynchronizedWithParent())&&this._isSynchronized()},l.prototype.isReady=function(e){return void 0===e&&(e=!1),this._isReady},l.prototype.isEnabled=function(e){return void 0===e&&(e=!0),!1===e?this._isEnabled:!!this._isEnabled&&this._isParentEnabled},l.prototype._syncParentEnabledState=function(){this._isParentEnabled=!this._parentNode||this._parentNode.isEnabled(),this._children&&this._children.forEach(function(e){e._syncParentEnabledState()})},l.prototype.setEnabled=function(e){this._isEnabled=e,this._syncParentEnabledState()},l.prototype.isDescendantOf=function(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))},l.prototype._getDescendants=function(e,t,i){if(void 0===t&&(t=!1),this._children)for(var n=0;n<this._children.length;n++){var r=this._children[n];i&&!i(r)||e.push(r),t||r._getDescendants(e,!1,i)}},l.prototype.getDescendants=function(e,t){var i=new Array;return this._getDescendants(i,e,t),i},l.prototype.getChildMeshes=function(e,t){var i=[];return this._getDescendants(i,e,function(e){return(!t||t(e))&&void 0!==e.cullingStrategy}),i},l.prototype.getChildren=function(e,t){return void 0===t&&(t=!0),this.getDescendants(t,e)},l.prototype._setReady=function(e){e!==this._isReady&&(e?(this.onReady&&this.onReady(this),this._isReady=!0):this._isReady=!1)},l.prototype.getAnimationByName=function(e){for(var t=0;t<this.animations.length;t++){var i=this.animations[t];if(i.name===e)return i}return null},l.prototype.createAnimationRange=function(e,t,i){if(!this._ranges[e]){this._ranges[e]=l._AnimationRangeFactory(e,t,i);for(var n=0,r=this.animations.length;n<r;n++)this.animations[n]&&this.animations[n].createRange(e,t,i)}},l.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var i=0,n=this.animations.length;i<n;i++)this.animations[i]&&this.animations[i].deleteRange(e,t);this._ranges[e]=null},l.prototype.getAnimationRange=function(e){return this._ranges[e]||null},l.prototype.getAnimationRanges=function(){var e,t=[];for(e in this._ranges)t.push(this._ranges[e]);return t},l.prototype.beginAnimation=function(e,t,i,n){var r=this.getAnimationRange(e);return r?this._scene.beginAnimation(this,r.from,r.to,t,i,n):null},l.prototype.serializeAnimationRanges=function(){var e=[];for(var t in this._ranges){var i,n=this._ranges[t];
1n&&((i={}).name=t,i.from=n.from,i.to=n.to,e.push(i))}return e},l.prototype.computeWorldMatrix=function(e){return this._worldMatrix||(this._worldMatrix=h.a.Identity()),this._worldMatrix},l.prototype.dispose=function(e,t){if(void 0===t&&(t=!1),this._isDisposed=!0,!e)for(var i=0,n=this.getDescendants(!0);i<n.length;i++)n[i].dispose(e,t);this.parent?this.parent=null:this._removeFromSceneRootNodes(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear();for(var r=0,o=this._behaviors;r<o.length;r++)o[r].detach();this._behaviors=[]},l.ParseAnimationRanges=function(e,t,i){if(t.ranges)for(var n=0;n<t.ranges.length;n++){var r=t.ranges[n];e.createAnimationRange(r.name,r.from,r.to)}},l.prototype.getHierarchyBoundingVectors=function(e,t){var i,n,r;if(void 0===e&&(e=!0),void 0===t&&(t=null),this.getScene().incrementRenderId(),this.computeWorldMatrix(!0),r=this.getBoundingInfo&&this.subMeshes?(n=(i=this.getBoundingInfo()).boundingBox.minimumWorld.clone(),i.boundingBox.maximumWorld.clone()):(n=new h.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),new h.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)),e)for(var o=0,a=this.getDescendants(!1);o<a.length;o++){var s,c,l,u=a[o];u.computeWorldMatrix(!0),t&&!t(u)||!u.getBoundingInfo||0===u.getTotalVertices()||(c=(s=u.getBoundingInfo().boundingBox).minimumWorld,l=s.maximumWorld,h.e.CheckExtends(c,n,r),h.e.CheckExtends(l,n,r))}return{min:n,max:r}},l._AnimationRangeFactory=function(e,t,i){throw s.a.WarnImport("AnimationRange")},l._NodeConstructors={},Object(n.c)([Object(r.c)()],l.prototype,"name",void 0),Object(n.c)([Object(r.c)()],l.prototype,"id",void 0),Object(n.c)([Object(r.c)()],l.prototype,"uniqueId",void 0),Object(n.c)([Object(r.c)()],l.prototype,"state",void 0),Object(n.c)([Object(r.c)()],l.prototype,"metadata",void 0),l);function l(e,t){void 0===t&&(t=null),this.state="",this.metadata=null,this.reservedDataStore=null,this._doNotSerialize=!1,this._isDisposed=!1,this.animations=new Array,this._ranges={},this.onReady=null,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=h.a.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._sceneRootNodesIndex=-1,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new o.c,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||a.a.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});function T(){}var R=i(22),d=i(5),u=i(21),E=i(6),S=i(237),A=i(238),C=i(239),O=i(2),M=i(27),I=i(7),P=i(44),x=i(181),o=i(122),n=i(240),r=i(96),D=i(99),a=(Object.defineProperty(L,"NpmPackage",{get:function(){return"[email protected]"},enumerable:!1,configurable:!0}),Object.defineProperty(L,"Version",{get:function(){return"4.2.0-alpha.26"},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"description",{get:function(){var e="WebGL"+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e},enumerable:!1,configurable:!0}),Object.defineProperty(L,"ShadersRepository",{get:function(){return d.a.ShadersRepository},set:function(e){d.a.ShadersRepository=e},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"supportsUniformBuffers",{get:function(){return 1<this.webGLVersion&&!this.disableUniformBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"_shouldUseHighPrecisionShader",{get:function(){return!(!this._caps.highPrecisionShaderSupported||!this._highPrecisionShadersAllowed)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"framebufferDimensionsObject",{set:function(e){this._framebufferDimensionsObject=e},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,O.a.TEXTUREFORMAT_RGBA,!1,!1,O.a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,O.a.TEXTUREFORMAT_RGBA,!1,!1,O.a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"emptyTexture2DArray",{get:function(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,O.a.TEXTUREFORMAT_RGBA,!1,!1,O.a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture2DArray},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"emptyCubeTexture",{get:function(){var e,t;return this._emptyCubeTexture||(t=[e=new Uint8Array(4),e,e,e,e,e],this._emptyCubeTexture=this.createRawCubeTexture(t,1,O.a.TEXTUREFORMAT_RGBA,O.a.TEXTURETYPE_UNSIGNED_INT,!1,!1,O.a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyCubeTexture},enumerable:!1,configurable:!0}),L.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e<t.length;e++)t[e]._rebuild()},L.prototype._rebuildEffects=function(){for(var e in this._compiledEffects)this._compiledEffects[e]._prepareEffect();d.a.ResetCache()},L.prototype.areAllEffectsReady=function(){for(var e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0},L.prototype._rebuildBuffers=function(){for(var e=0,t=this._uniformBuffers;e<t.length;e++)t[e]._rebuild()},L.prototype._initGLContext=function(){this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:1<this._webGLVersion?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile"),standardDerivatives:1<this._webGLVersion||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:1<this._webGLVersion||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:1<this._webGLVersion||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:1<this._webGLVersion&&this._gl.getExtension("EXT_color_buffer_float"),textureFloat:!!(1<this._webGLVersion||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(1<this._webGLVersion||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRen
1der:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(1<this._webGLVersion||this._gl.getExtension("EXT_shader_texture_lod")),blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1},this._glVersion=this._gl.getParameter(this._gl.VERSION);var e,t,i,n,r,o,a=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=a&&(this._glRenderer=this._gl.getParameter(a.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(a.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor="Unknown vendor"),this._glRenderer||(this._glRenderer="Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=0<this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(1<this._webGLVersion||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),1<this._webGLVersion&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),1<this._webGLVersion)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=this._gl.getParameter(this._gl.MAX_SAMPLES);else{var s=this._gl.getExtension("WEBGL_draw_buffers");if(null!==s){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=s.drawBuffersWEBGL.bind(s),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var c=0;c<16;c++)this._gl["COLOR_ATTACHMENT"+c+"_WEBGL"]=s["COLOR_ATTACHMENT"+c+"_WEBGL"]}}1<this._webGLVersion?this._caps.depthTextureExtension=!0:null!=(e=this._gl.getExtension("WEBGL_depth_texture"))&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL),this.disableVertexArrayObjects?this._caps.vertexArrayObject=!1:1<this._webGLVersion?this._caps.vertexArrayObject=!0:null!=(t=this._gl.getExtension("OES_vertex_array_object"))&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=t.createVertexArrayOES.bind(t),this._gl.bindVertexArray=t.bindVertexArrayOES.bind(t),this._gl.deleteVertexArray=t.deleteVertexArrayOES.bind(t)),1<this._webGLVersion?this._caps.instancedArrays=!0:null!=(i=this._gl.getExtension("ANGLE_instanced_arrays"))?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=i.drawArraysInstancedANGLE.bind(i),this._gl.drawElementsInstanced=i.drawElementsInstancedANGLE.bind(i),this._gl.vertexAttribDivisor=i.vertexAttribDivisorANGLE.bind(i)):this._caps.instancedArrays=!1,this._gl.getShaderPrecisionFormat&&(n=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),r=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT),n&&r&&(this._caps.highPrecisionShaderSupported=0!==n.precision&&0!==r.precision)),1<this._webGLVersion?this._caps.blendMinMax=!0:null!=(o=this._gl.getExtension("EXT_blend_minmax"))&&(this._caps.blendMinMax=!0,this._gl.MAX=o.MAX_EXT,this._gl.MIN=o.MIN_EXT),this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var l=0;l<this._maxSimultaneousTextures;l++)this._nextFreeTextureSlots.push(l)},Object.defineProperty(L.prototype,"webGLVersion",{get:function(){return this._webGLVersion}
1,enumerable:!1,configurable:!0}),L.prototype.getClassName=function(){return"ThinEngine"},Object.defineProperty(L.prototype,"isStencilEnable",{get:function(){return this._isStencilEnable},enumerable:!1,configurable:!0}),L.prototype._prepareWorkingCanvas=function(){var e;this._workingCanvas||(this._workingCanvas=r.a.CreateCanvas(1,1),(e=this._workingCanvas.getContext("2d"))&&(this._workingContext=e))},L.prototype.resetTextureCache=function(){for(var e in this._boundTexturesCache)this._boundTexturesCache.hasOwnProperty(e)&&(this._boundTexturesCache[e]=null);this._currentTextureChannel=-1},L.prototype.getGlInfo=function(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}},L.prototype.setHardwareScalingLevel=function(e){this._hardwareScalingLevel=e,this.resize()},L.prototype.getHardwareScalingLevel=function(){return this._hardwareScalingLevel},L.prototype.getLoadedTexturesCache=function(){return this._internalTexturesCache},L.prototype.getCaps=function(){return this._caps},L.prototype.stopRenderLoop=function(e){var t;e?0<=(t=this._activeRenderLoops.indexOf(e))&&this._activeRenderLoops.splice(t,1):this._activeRenderLoops=[]},L.prototype._renderLoop=function(){if(!this._contextWasLost){var e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t<this._activeRenderLoops.length;t++)(0,this._activeRenderLoops[t])();this.endFrame()}}0<this._activeRenderLoops.length?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},L.prototype.getRenderingCanvas=function(){return this._renderingCanvas},L.prototype.getHostWindow=function(){return P.a.IsWindowObjectExist()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null},L.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth},L.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight},L.prototype._queueNewFrame=function(e,t){return L.QueueNewFrame(e,t)},L.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))},L.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.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GREATER,this._gl.clearDepth(0)):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)},L.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))},L.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),o=e.x||0,a=e.y||0;this._cachedViewport=e,this._viewport(o*n,a*r,n*e.width,r*e.height)},L.prototype.beginFrame=function(){},L.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer()},L.prototype.resize=function(){var e,t=P.a.IsWindowObjectExist()?(e=this._renderingCanvas?this._renderingCanvas.clientWidth||this._renderingCanvas.width:window.innerWidth,this._renderingCanvas?this._renderingCanvas.clientHeight||this._renderingCanvas.height:window.innerHeight):(e=this._renderingCanvas?this._renderingCanvas.width:100,this._renderingCanvas?this._renderingCanvas.height:100);this.setSize(e/this._hardwareScalingLevel,t/this._hardwareScalingLevel)},L.prototype.setSize=function(e,t){return!(!this._renderingCanvas||(e|=0,t|=0,this._renderingCanvas.width===e&&this._renderingCanvas.height===t||(this._renderingCanvas.width=e,this._renderingCanvas.height=t,0)))},L.prototype.bindFramebuffer=function(e,t,i,n,r,o,a){void 0===t&&(t=0),void 0===o&&(o=0),void 0===a&&(a=0),this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer);var s=this._gl;e.is2DArray?s.framebufferTextureLayer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,e._webGLTexture,o,a):e.isCube&&s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+t,e._webGLTexture,o);var c,l=e._depthStencilTexture;l&&(c=l._generateStencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,e.is2DArray?s.framebufferTextureLayer(s.FRAMEBUFFER,c,l._webGLTexture,o,a):e.isCube?s.framebufferTexture2D(s.FRAMEBUFFER,c,s.TEXTURE_CUBE_MAP_POSITIVE_X+t,l._webGLTexture,o):s.framebufferTexture2D(s.FRAMEBUFFER,c,s.TEXTURE_2D,l._webGLTexture,o)),this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,o&&(i/=Math.pow(2,o))),n||(n=e.height,o&&(n/=Math.pow(2,o))),this._viewport(0,0,i,n)),this.wipeCaches()},L.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},L.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl;if(e._MSAAFramebuffer){if(e._textureArray)return void this.unBindMultiColorAttachmentFramebuffer(e._textureArray,t,i);n.bindFramebuffer(n.READ_FRAMEBUFFER,e._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e._framebuffer),n.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,n.COLOR_BUFFER_BIT,n.NEAREST)}!e.generateMipMaps||t||e.isCube||(this._bindTextureDirectly(n.TEXTURE_2D,e,!0),n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null)),i&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),i()),this._bindUnboundFramebuffer(null)},L.prototype.flushFramebuffer=function(){this._gl.flush()},L.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},L.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},L.prototype.createVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)},L.prototype._createVertexBuffer=function(e,t){var i=this._gl.createBuffer();if(!i)throw new Error("Unable to create vertex buffer");var n=new o.a(i);return this.bindArrayBuffer(n),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.STATIC_DRAW),this._resetVertexBufferBinding(),n.references=1,n},L.prototype.createDynamicVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)},L.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},L.prototype.createIndexBuffer=function(e,t){var i=this._gl.createBuffer(),n=new o.a(i);if(!i)throw new Error("Unable to create index buffer");this.bindIndexBuffer(n);var r=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),n.references=1,n.is32Bits=4===r.BYTES_PER_ELEMENT,n},L.prototype._normalizeIndexData=function(e){if(e instanceof Uint16Array)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(var t=0;t<e.length;t++)if(65535<=e[t])return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},L.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},L.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},L.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},L.prototype.bindBuffer=function(e,t){!this._vaoRecordInProgress&&this._currentBoundBuffer[t]===e||(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},L.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},L.prototype._vertexAttribPointer=function(e,t,i,n,r,o,a){var s=this._currentBufferPointers[t],c=!1;s.active?(s.buffer!==e&&(s.buffer=e,c=!0),s.size!==i&&(s.size=i,c=!0),s.type!==n&&(s.type=n,c=!0),s.normalized!==r&&(s.normalized=r,c=!0),s.stride!==o&&(s.stride=o,c=!0),s.offset!==a&&(s.offset=a,c=!0)):(c=!0,s.active=!0,s.index=t,s.size=i,s.type=n,s.normalized=r,s.stride=o,s.offset=a,s.buffer=e),(c||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,n,r,o,a))},L.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},L.prototype._bindVertexBuffersAttributes=function(e,t){var i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var n=0;n<i.length;n++){var r=t.getAttributeLocation(n);if(0<=r){var o=e[i[n]];if(!o)continue;this._gl.enableVertexAttribArray(r),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[r]=!0);var a=o.getBuffer();a&&(this._vertexAttribPointer(a,r,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(r,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(a))))}}},L.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},L.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)},L.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e;var o=(this._cachedEffectForVertexBuffers=r).getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var a,s=0,c=0;c<o;c++)c<i.length&&(0<=(a=r.getAttributeLocation(c))&&(this._gl.enableVertexAttribArray(a),this._vertexAttribArraysEnabled[a]=!0,this._vertexAttribPointer(e,a,i[c],this._gl.FLOAT,!1,n,s)),s+=4*i[c])}this._bindIndexBufferWithCache(t)},L.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},L.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)},L.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t<i;t++){var n=this._currentInstanceBuffers[t];e!=n&&n.references&&(e=n,this.bindArrayBuffer(n));var r=this._currentInstanceLocations[t];this._gl.vertexAttribDivisor(r,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0},L.prototype.releaseVertexArrayObject=function(e){this._gl.deleteVertexArray(e)},L.prototype._releaseBuffer=function(e){return e.references--,0===e.references&&(this._deleteBuffer(e),!0)},L.prototype._deleteBuffer=function(e){this._gl.deleteBuffer(e.underlyingResource)},L.prototype.updateAndBindInstancesBuffer=function(e,t,i){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==i[0].index)this.bindInstancesBuffer(e,i,!0);else for(var n=0;n<4;n++){var r=i[n];this._vertexAttribArraysEnabled[r]||(this._gl.enableVertexAttribArray(r),this._vertexAttribArraysEnabled[r]=!0),this._vertexAttribPointer(e,r,4,this._gl.FLOAT,!1,64,16*n),this._gl.vertexAttribDivisor(r,1),this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(e)}},L.prototype.bindInstancesBuffer=function(e,t,i){void 0===i&&(i=!0),this.bindArrayBuffer(e);var n,r=0;if(i)for(var o=0;o<t.length;o++)r+=4*(n=t[o]).attributeSize;
1for(o=0;o<t.length;o++)void 0===(n=t[o]).index&&(n.index=this._currentEffect.getAttributeLocationByName(n.attributeName)),n.index<0||(this._vertexAttribArraysEnabled[n.index]||(this._gl.enableVertexAttribArray(n.index),this._vertexAttribArraysEnabled[n.index]=!0),this._vertexAttribPointer(e,n.index,n.attributeSize,n.attributeType||this._gl.FLOAT,n.normalized||!1,r,n.offset),this._gl.vertexAttribDivisor(n.index,void 0===n.divisor?1:n.divisor),this._currentInstanceLocations.push(n.index),this._currentInstanceBuffers.push(e))},L.prototype.disableInstanceAttributeByName=function(e){var t;this._currentEffect&&(t=this._currentEffect.getAttributeLocationByName(e),this.disableInstanceAttribute(t))},L.prototype.disableInstanceAttribute=function(e){for(var t,i=!1;-1!==(t=this._currentInstanceLocations.indexOf(e));)this._currentInstanceLocations.splice(t,1),this._currentInstanceBuffers.splice(t,1),i=!0,t=this._currentInstanceLocations.indexOf(e);i&&(this._gl.vertexAttribDivisor(e,0),this.disableAttributeByIndex(e))},L.prototype.disableAttributeByIndex=function(e){this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1},L.prototype.draw=function(e,t,i,n){this.drawElementsType(e?O.a.MATERIAL_TriangleFillMode:O.a.MATERIAL_WireFrameFillMode,t,i,n)},L.prototype.drawPointClouds=function(e,t,i){this.drawArraysType(O.a.MATERIAL_PointFillMode,e,t,i)},L.prototype.drawUnIndexed=function(e,t,i,n){this.drawArraysType(e?O.a.MATERIAL_TriangleFillMode:O.a.MATERIAL_WireFrameFillMode,t,i,n)},L.prototype.drawElementsType=function(e,t,i,n){this.applyStates(),this._reportDrawCall();var r=this._drawMode(e),o=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT,a=this._uintIndicesCurrentlySet?4:2;n?this._gl.drawElementsInstanced(r,i,o,t*a,n):this._gl.drawElements(r,i,o,t*a)},L.prototype.drawArraysType=function(e,t,i,n){this.applyStates(),this._reportDrawCall();var r=this._drawMode(e);n?this._gl.drawArraysInstanced(r,t,i,n):this._gl.drawArrays(r,t,i)},L.prototype._drawMode=function(e){switch(e){case O.a.MATERIAL_TriangleFillMode:return this._gl.TRIANGLES;case O.a.MATERIAL_PointFillMode:return this._gl.POINTS;case O.a.MATERIAL_WireFrameFillMode:return this._gl.LINES;case O.a.MATERIAL_PointListDrawMode:return this._gl.POINTS;case O.a.MATERIAL_LineListDrawMode:return this._gl.LINES;case O.a.MATERIAL_LineLoopDrawMode:return this._gl.LINE_LOOP;case O.a.MATERIAL_LineStripDrawMode:return this._gl.LINE_STRIP;case O.a.MATERIAL_TriangleStripDrawMode:return this._gl.TRIANGLE_STRIP;case O.a.MATERIAL_TriangleFanDrawMode:return this._gl.TRIANGLE_FAN;default:return this._gl.TRIANGLES}},L.prototype._reportDrawCall=function(){},L.prototype._releaseEffect=function(e){this._compiledEffects[e._key]&&(delete this._compiledEffects[e._key],this._deletePipelineContext(e.getPipelineContext()))},L.prototype._deletePipelineContext=function(e){var t=e;t&&t.program&&(t.program.__SPECTOR_rebuildProgram=null,this._gl.deleteProgram(t.program))},L.prototype.createEffect=function(e,t,i,n,r,o,a,s,c){var l=(e.vertexElement||e.vertex||e.vertexToken||e)+"+"+(e.fragmentElement||e.fragment||e.fragmentToken||e)+"@"+(r||t.defines);if(this._compiledEffects[l]){var u=this._compiledEffects[l];return a&&u.isReady()&&a(u),u}var h=new d.a(e,t,i,n,this,r,o,a,s,c);return h._key=l,this._compiledEffects[l]=h},L._ConcatenateShader=function(e,t,i){return void 0===i&&(i=""),i+(t?t+"\n":"")+e},L.prototype._compileShader=function(e,t,i,n){return this._compileRawShader(L._ConcatenateShader(e,i,n),t)},L.prototype._compileRawShader=function(e,t){var i=this._gl,n=i.createShader("vertex"===t?i.VERTEX_SHADER:i.FRAGMENT_SHADER);if(!n)throw new Error("Something went wrong while compile the shader.");return i.shaderSource(n,e),i.compileShader(n),n},L.prototype._getShaderSource=function(e){return this._gl.getShaderSource(e)},L.prototype.createRawShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null),n=n||this._gl;var o=this._compileRawShader(t,"vertex"),a=this._compileRawShader(i,"fragment");return this._createShaderProgram(e,o,a,n,r)},L.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),r=r||this._gl;var a=1<this._webGLVersion?"#version 300 es\n#define WEBGL2 \n":"",s=this._compileShader(t,"vertex",n,a),c=this._compileShader(i,"fragment",n,a);return this._createShaderProgram(e,s,c,r,o)},L.prototype.createPipelineContext=function(){var e=new n.a;return(e.engine=this)._caps.parallelShaderCompile&&(e.isParallelCompiled=!0),e},L.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o=n.createProgram();if(!(e.program=o))throw new Error("Unable to create program");return n.attachShader(o,t),n.attachShader(o,i),n.linkProgram(o),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},L.prototype._finalizePipelineContext=function(e){var t,i,n=e.context,r=e.vertexShader,o=e.fragmentShader,a=e.program;
1if(!n.getProgramParameter(a,n.LINK_STATUS)){if(!this._gl.getShaderParameter(r,this._gl.COMPILE_STATUS)&&(t=this._gl.getShaderInfoLog(r)))throw e.vertexCompilationError=t,new Error("VERTEX SHADER "+t);if(!this._gl.getShaderParameter(o,this._gl.COMPILE_STATUS)&&(t=this._gl.getShaderInfoLog(o)))throw e.fragmentCompilationError=t,new Error("FRAGMENT SHADER "+t);if(i=n.getProgramInfoLog(a))throw e.programLinkError=i,new Error(i)}if(this.validateShaderPrograms&&(n.validateProgram(a),!n.getProgramParameter(a,n.VALIDATE_STATUS)&&(i=n.getProgramInfoLog(a))))throw e.programValidationError=i,new Error(i);n.deleteShader(r),n.deleteShader(o),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},L.prototype._preparePipelineContext=function(e,t,i,n,r,o,a){var s=e;s.program=n?this.createRawShaderProgram(s,t,i,void 0,a):this.createShaderProgram(s,t,i,o,void 0,a),s.program.__SPECTOR_rebuildProgram=r},L.prototype._isRenderingStateCompiled=function(e){var t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)},L.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i;e.isParallelCompiled?(i=e.onCompiled,e.onCompiled=i?function(){i(),t()}:t):t()},L.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r<t.length;r++)i.push(this._gl.getUniformLocation(n.program,t[r]));return i},L.prototype.getAttributes=function(e,t){for(var i=[],n=e,r=0;r<t.length;r++)try{i.push(this._gl.getAttribLocation(n.program,t[r]))}catch(e){i.push(-1)}return i},L.prototype.enableEffect=function(e){e&&e!==this._currentEffect&&(this.bindSamplers(e),(this._currentEffect=e).onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))},L.prototype.setInt=function(e,t){e&&this._gl.uniform1i(e,t)},L.prototype.setIntArray=function(e,t){e&&this._gl.uniform1iv(e,t)},L.prototype.setIntArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2iv(e,t)},L.prototype.setIntArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3iv(e,t)},L.prototype.setIntArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4iv(e,t)},L.prototype.setArray=function(e,t){e&&this._gl.uniform1fv(e,t)},L.prototype.setArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2fv(e,t)},L.prototype.setArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3fv(e,t)},L.prototype.setArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4fv(e,t)}
1,L.prototype.setMatrices=function(e,t){e&&this._gl.uniformMatrix4fv(e,!1,t)},L.prototype.setMatrix3x3=function(e,t){e&&this._gl.uniformMatrix3fv(e,!1,t)},L.prototype.setMatrix2x2=function(e,t){e&&this._gl.uniformMatrix2fv(e,!1,t)},L.prototype.setFloat=function(e,t){e&&this._gl.uniform1f(e,t)},L.prototype.setFloat2=function(e,t,i){e&&this._gl.uniform2f(e,t,i)},L.prototype.setFloat3=function(e,t,i,n){e&&this._gl.uniform3f(e,t,i,n)},L.prototype.setFloat4=function(e,t,i,n,r){e&&this._gl.uniform4f(e,t,i,n,r)},L.prototype.applyStates=function(){var e;this._depthCullingState.apply(this._gl),this._stencilState.apply(this._gl),this._alphaState.apply(this._gl),this._colorWriteChanged&&(this._colorWriteChanged=!1,e=this._colorWrite,this._gl.colorMask(e,e,e,e))},L.prototype.setColorWrite=function(e){e!==this._colorWrite&&(this._colorWriteChanged=!0,this._colorWrite=e)},L.prototype.getColorWrite=function(){return this._colorWrite},Object.defineProperty(L.prototype,"depthCullingState",{get:function(){return this._depthCullingState},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"alphaState",{get:function(){return this._alphaState},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"stencilState",{get:function(){return this._stencilState},enumerable:!1,configurable:!0}),L.prototype.clearInternalTexturesCache=function(){this._internalTexturesCache=[]},L.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames&&!e||(this._currentEffect=null,this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0,this._unbindVertexArrayObject(),e&&(this._currentProgram=null,this.resetTextureCache(),this._stencilState.reset(),this._depthCullingState.reset(),this._depthCullingState.depthFunc=this._gl.LEQUAL,this._alphaState.reset(),this._alphaMode=O.a.ALPHA_ADD,this._alphaEquation=O.a.ALPHA_DISABLE,this._colorWrite=!0,this._colorWriteChanged=!0,this._unpackFlipYCached=null,this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),this._mustWipeVertexAttributes=!0,this.unbindAllAttributes()),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this.bindIndexBuffer(null))},L.prototype._getSamplingParameters=function(e,t){var i=this._gl,n=i.NEAREST,r=i.NEAREST;switch(e){case O.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST:n=i.LINEAR,r=t?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case O.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR:n=i.LINEAR,r=t?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case O.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR:n=i.NEAREST,r=t?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case O.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST:n=i.NEAREST,r=t?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case O.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST:n=i.NEAREST,r=t?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case O.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR:n=i.NEAREST,r=t?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case O.a.TEXTURE_NEAREST_LINEAR:n=i.NEAREST,r=i.LINEAR;break;case O.a.TEXTURE_NEAREST_NEAREST:n=i.NEAREST,r=i.NEAREST;break;case O.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST:n=i.LINEAR,r=t?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case O.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR:n=i.LINEAR,r=t?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case O.a.TEXTURE_LINEAR_LINEAR:n=i.LINEAR,r=i.LINEAR;break;case O.a.TEXTURE_LINEAR_NEAREST:n=i.LINEAR,r=i.NEAREST}return{min:r,mag:n}},L.prototype._createTexture=function(){var e=this._gl.createTexture();if(!e)throw new Error("Unable to create texture");return e},L.prototype.createTexture=function(i,n,e,l,a,r,o,s,t,u,c,h){var d=this;void 0===a&&(a=O.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===t&&(t=null),void 0===u&&(u=null),void 0===c&&(c=null);var p="data:"===(i=i||"").substr(0,5),f="blob:"===i.substr(0,5),m=p&&-1!==i.indexOf(";base64,"),_=t||new M.a(this,M.b.Url),g=i;!this._transformTextureUrl||m||t||s||(i=this._transformTextureUrl(i));for(var v=i.lastIndexOf("."),b=c||(-1<v?i.substring(v).toLowerCase():""),y=null,T=0,E=L._TextureLoaders;T<E.length;T++){var S=E[T];if(S.canLoad(b,h)){y=S;break}}l&&l._addPendingData(_),_.url=i,_.generateMipMaps=!n,_.samplingMode=a,_.invertY=e,this._doNotHandleContextLost||(_._buffer=s);var A,C,P=null;function x(e,t){l&&l._removePendingData(_),i===g?(P&&_.onLoadedObservable.remove(P),R.a.UseFallbackTexture&&d.createTexture(R.a.FallbackTexture,n,_.invertY,l,a,null,o,s,_),o&&o((e||"Unknown error")+(R.a.UseFallbackTexture?" - Fallback texture was used":""),t)):(I.a.Warn("Failed to load "+i+", falling back to "+g),d.createTexture(g,n,_.invertY,l,a,r,o,s,_,u,c,h))}return r&&!t&&(P=_.onLoadedObservable.add(r)),t||this._internalTexturesCache.push(_),y?(A=function(e){y.loadD
1ata(e,_,function(e,t,i,n,r,o){o?x("TextureLoader failed to load data"):d._prepareWebGLTexture(_,l,e,t,_.invertY,!i,n,function(){return r(),!1},a)})},s?s instanceof ArrayBuffer?A(new Uint8Array(s)):ArrayBuffer.isView(s)?A(s):o&&o("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null):this._loadFile(i,function(e){return A(new Uint8Array(e))},void 0,l?l.offlineProvider:void 0,!0,function(e,t){x("Unable to load "+(e&&e.responseURL,t))})):(C=function(c){f&&!d._doNotHandleContextLost&&(_._buffer=c),d._prepareWebGLTexture(_,l,c.width,c.height,_.invertY,n,!1,function(e,t,i){var n=d._gl,r=c.width===e&&c.height===t,o=u?d._getInternalFormat(u):".jpg"===b?n.RGB:n.RGBA;if(r)return n.texImage2D(n.TEXTURE_2D,0,o,o,n.UNSIGNED_BYTE,c),!1;var a=d._caps.maxTextureSize;if(c.width>a||c.height>a||!d._supportsHardwareTextureRescaling)return d._prepareWorkingCanvas(),!(!d._workingCanvas||!d._workingContext||(d._workingCanvas.width=e,d._workingCanvas.height=t,d._workingContext.drawImage(c,0,0,c.width,c.height,0,0,e,t),n.texImage2D(n.TEXTURE_2D,0,o,o,n.UNSIGNED_BYTE,d._workingCanvas),_.width=e,_.height=t,1));var s=new M.a(d,M.b.Temp);return d._bindTextureDirectly(n.TEXTURE_2D,s,!0),n.texImage2D(n.TEXTURE_2D,0,o,o,n.UNSIGNED_BYTE,c),d._rescaleTexture(s,_,l,o,function(){d._releaseTexture(s),d._bindTextureDirectly(n.TEXTURE_2D,_,!0),i()}),!0},a)},!p||m?s&&(s.decoding||s.close)?C(s):L._FileToolsLoadImage(i,C,x,l?l.offlineProvider:null,h):"string"==typeof s||s instanceof ArrayBuffer||ArrayBuffer.isView(s)||s instanceof Blob?L._FileToolsLoadImage(s,C,x,l?l.offlineProvider:null,h):s&&C(s)),_},L._FileToolsLoadImage=function(e,t,i,n,r){throw u.a.WarnImport("FileTools")},L.prototype._rescaleTexture=function(e,t,i,n,r){},L.prototype.createRawTexture=function(e,t,i,n,r,o,a,s,c){throw void 0===s&&(s=null),void 0===c&&(c=O.a.TEXTURETYPE_UNSIGNED_INT),u.a.WarnImport("Engine.RawTexture")},L.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,s){throw void 0===s&&(s=null),u.a.WarnImport("Engine.RawTexture")},L.prototype.createRawTexture3D=function(e,t,i,n,r,o,a,s,c,l){throw void 0===c&&(c=null),void 0===l&&(l=O.a.TEXTURETYPE_UNSIGNED_INT),u.a.WarnImport("Engine.RawTexture")},L.prototype.createRawTexture2DArray=function(e,t,i,n,r,o,a,s,c,l){throw void 0===c&&(c=null),void 0===l&&(l=O.a.TEXTURETYPE_UNSIGNED_INT),u.a.WarnImport("Engine.RawTexture")},L.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},L.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},L.prototype._getTextureTarget=function(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D},L.prototype.updateTextureSamplingMode=function(e,t,i){void 0===i&&(i=!1);var n=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.generateMipMaps||i);this._setTextureParameterInteger(n,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(n,this._gl.TEXTURE_MIN_FILTER,r.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(n)),this._bindTextureDirectly(n,null),t.samplingMode=e},L.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null);var r=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(n),e),e._cachedWrapR=n),this._bindTextureDirectly(r,null)},L.prototype._setupDepthStencilTexture=function(e,t,i,n,r){var o=t.width||t,a=t.height||t,s=t.layers||0;e.baseWidth=o,e.baseHeight=a,e.width=o,e.height=a,e.is2DArray=0<s,e.depth=s,e.isReady=!0,e.samples=1,e.generateMipMaps=!1,e._generateDepthBuffer=!0,e._generateStencilBuffer=i,e.samplingMode=n?O.a.TEXTURE_BILINEAR_SAMPLINGMODE:O.a.TEXTURE_NEAREST_SAMPL
1INGMODE,e.type=O.a.TEXTURETYPE_UNSIGNED_INT,e._comparisonFunction=r;var c=this._gl,l=this._getTextureTarget(e),u=this._getSamplingParameters(e.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===r?(c.texParameteri(l,c.TEXTURE_COMPARE_FUNC,O.a.LEQUAL),c.texParameteri(l,c.TEXTURE_COMPARE_MODE,c.NONE)):(c.texParameteri(l,c.TEXTURE_COMPARE_FUNC,r),c.texParameteri(l,c.TEXTURE_COMPARE_MODE,c.COMPARE_REF_TO_TEXTURE))},L.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var s=this._gl,c=s.TEXTURE_2D;e.isCube&&(c=s.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(c,a,t,i,n,0,r)},L.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var a=this._gl,s=this._getWebGLTextureType(e.type),c=this._getInternalFormat(e.format),l=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,e.format):this._getInternalFormat(r);this._unpackFlipY(e.invertY);var u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+i);var h=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),p=o?e.width:Math.pow(2,Math.max(h-n,0)),f=o?e.height:Math.pow(2,Math.max(d-n,0));a.texImage2D(u,n,l,p,f,0,c,s,t)},L.prototype.updateTextureData=function(e,t,i,n,r,o,a,s){void 0===a&&(a=0),void 0===s&&(s=0);var c=this._gl,l=this._getWebGLTextureType(e.type),u=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);var h=c.TEXTURE_2D;e.isCube&&(h=c.TEXTURE_CUBE_MAP_POSITIVE_X+a),c.texSubImage2D(h,s,i,n,r,o,u,l,t)},L.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)},L.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o,a=this._gl;a&&(o=this._getSamplingParameters(r,!i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,o.mag),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,o.min),i||n||a.generateMipmap(a.TEXTURE_2D),this._bindTextureDirectly(a.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear())},L.prototype._prepareWebGLTexture=function(e,t,i,n,r,o,a,s,c){var l=this;void 0===c&&(c=O.a.TEXTURE_TRILINEAR_SAMPLINGMODE);var u=this.getCaps().maxTextureSize,h=Math.min(u,this.needPOTTextures?L.GetExponentOfTwo(i,u):i),d=Math.min(u,this.needPOTTextures?L.GetExponentOfTwo(n,u):n),p=this._gl;p&&(e._webGLTexture?(this._bindTextureDirectly(p.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===r||!!r),e.baseWidth=i,e.baseHeight=n,e.width=h,e.height=d,e.isReady=!0,s(h,d,function(){l._prepareWebGLTextureContinuation(e,t,o,a,c)})||this._prepareWebGLTextureContinuation(e,t,o,a,c)):t&&t._removePendingData(e))},L.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=this._gl;if(e&&t)return this._getDepthStencilBuffer(i,n,r,o.DEPTH_STENCIL,o.DEPTH24_STENCIL8,o.DEPTH_STENCIL_ATTACHMENT);if(t){var a=o.DEPTH_COMPONENT16;return 1<this._webGLVersion&&(a=o.DEPTH_COMPONENT32F),this._getDepthStencilBuffer(i,n,r,a,a,o.DEPTH_ATTACHMENT)}return e?this._getDepthStencilBuffer(i,n,r,o.STENCIL_INDEX8,o.STENCIL_INDEX8,o.STENCIL_ATTACHMENT):null},L.prototype._releaseFramebufferObjects=function(e){var t=this._gl;e._framebuffer&&(t.deleteFramebuffer(e._framebuffer),e._framebuffer=null),e._depthStencilBuffer&&(t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(t.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(t.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null)},L.prototype._releaseTexture=function(e){this._releaseFramebufferObjects(e),this._deleteTexture(e._webGLTexture),this.unbindAllTextures();var t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()},L.prototype._deleteTexture=function(e){this._gl.deleteTexture(e)},L.prototype._setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},L.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.program);for(var i=e.getSamplers(),n=0;n<i.length;n++){var r=e.getUniform(i[n]);r&&(this._boundUniforms[n]=r)}this._currentEffect=null},L.prototype._activateCurrentTexture=function(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)},L.prototype._bindTextureDirectly=function(e,t,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var r=!1,o=t&&-1<t._associatedChannel;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._associatedChannel=this._activeChannel)):i&&(r=!0,this._activateCurrentTexture()),o&&!i&&this._bindSamplerUniformToChannel
1(t._associatedChannel,this._activeChannel),r},L.prototype._bindTexture=function(e,t){var i;void 0!==e&&(t&&(t._associatedChannel=e),this._activeChannel=e,i=t?this._getTextureTarget(t):this._gl.TEXTURE_2D,this._bindTextureDirectly(i,t))},L.prototype.unbindAllTextures=function(){for(var e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),1<this.webGLVersion&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))},L.prototype.setTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},L.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i&&i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},L.prototype._getTextureWrapMode=function(e){switch(e){case O.a.TEXTURE_WRAP_ADDRESSMODE:return this._gl.REPEAT;case O.a.TEXTURE_CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case O.a.TEXTURE_MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},L.prototype._setTexture=function(e,t,i,n){if(void 0===i&&(i=!1),void 0===n&&(n=!1),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),1<this.webGLVersion&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===O.a.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;var r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture;!i&&r&&(r._associatedChannel=e);var o=!0;this._boundTexturesCache[e]===r&&(i||this._bindSamplerUniformToChannel(r._associatedChannel,e),o=!1),this._activeChannel=e;var a,s=this._getTextureTarget(r);return o&&this._bindTextureDirectly(s,r,i),r&&!r.isMultiview&&(r.isCube&&r._cachedCoordinatesMode!==t.coordinatesMode&&(r._cachedCoordinatesMode=t.coordinatesMode,a=t.coordinatesMode!==O.a.TEXTURE_CUBIC_MODE&&t.coordinatesMode!==O.a.TEXTURE_SKYBOX_MODE?O.a.TEXTURE_WRAP_ADDRESSMODE:O.a.TEXTURE_CLAMP_ADDRESSMODE,t.wrapU=a,t.wrapV=a),r._cachedWrapU!==t.wrapU&&(r._cachedWrapU=t.wrapU,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),r)),r._cachedWrapV!==t.wrapV&&(r._cachedWrapV=t.wrapV,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),r)),r.is3D&&r._cachedWrapR!==t.wrapR&&(r._cachedWrapR=t.wrapR,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),r)),this._setAnisotropicLevel(s,r,t.anisotropicFilteringLevel)),!0},L.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<i.length;n++){var r=i[n].getInternalTexture();r?(this._textureUnits[n]=e+n,r._associatedChannel=e+n):this._textureUnits[n]=-1}this._gl.uniform1iv(t,this._textureUnits);for(var o=0;o<i.length;o++)this._setTexture(this._textureUnits[o],i[o],!0)}},L.prototype._setAnisotropicLevel=function(e,t,i){var n=this._caps.textureAnisotropicFilterExtension;t.samplingMode!==O.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST&&t.samplingMode!==O.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR&&t.samplingMode!==O.a.TEXTURE_LINEAR_LINEAR&&(i=1),n&&t._cachedAnisotropicFilteringLevel!==i&&(this._setTextureParameterFloat(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i,this._caps.maxAnisotropy),t),t._cachedAnisotropicFilteringLevel=i)},L.prototype._setTextureParameterFloat=function(e,t,i,n){this._bindTextureDirectly(e,n,!0,!0),this._gl.texParameterf(e,t,i)},L.prototype._setTextureParameterInteger=function(e,t,i,n){n&&this._bindTextureDirectly(e,n,!0,!0),this._gl.texParameteri(e,t,i)},L.prototype.unbindAllAttributes=function(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(var e=0;e<this._caps.maxVertexAttribs;e++)this.disableAttributeByIndex(e)}else{e=0;for(var t=this._vertexAttribArraysEnabled.length;e<t;e++)e>=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}},L.prototype.releaseEffects=function(){for(var e in this._compiledEffects){var t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}
1this._compiledEffects={}},L.prototype.dispose=function(){this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],P.a.IsWindowObjectExist()&&this._renderingCanvas&&(this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored))),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers=[],this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,d.a.ResetCache();for(var e=0,t=this._activeRequests;e<t.length;e++)t[e].abort()},L.prototype.attachContextLostEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)},L.prototype.attachContextRestoredEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)},L.prototype.getError=function(){return this._gl.getError()},L.prototype._canRenderToFloatFramebuffer=function(){return 1<this._webGLVersion?this._caps.colorBufferFloat:this._canRenderToFramebuffer(O.a.TEXTURETYPE_FLOAT)},L.prototype._canRenderToHalfFloatFramebuffer=function(){return 1<this._webGLVersion?this._caps.colorBufferFloat:this._canRenderToFramebuffer(O.a.TEXTURETYPE_HALF_FLOAT)},L.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,a,s,c=t.checkFramebufferStatus(t.FRAMEBUFFER);for((i=(i=i&&c===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),o=t.RGBA,a=t.UNSIGNED_BYTE,s=new Uint8Array(4),t.readPixels(0,0,1,1,o,a,s),i=i&&t.getError()===t.NO_ERROR),t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},L.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case O.a.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case O.a.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case O.a.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case O.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case O.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case O.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case O.a.TEXTURETYPE_BYTE:return this._gl.BYTE;case O.a.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case O.a.TEXTURETYPE_SHORT:return this._gl.SHORT;case O.a.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case O.a.TEXTURETYPE_INT:return this._gl.INT;case O.a.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case O.a.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case O.a.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case O.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case O.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case O.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case O.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case O.a.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case O.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case O.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case O.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},L.prototype._getInternalFormat=function(e){var t=this._gl.RGBA;switch(e){case O.a.TEXTUREFORMAT_ALPHA:t=this._gl.ALPHA;break;case O.a.TEXTUREFORMAT_LUMINANCE:t=this._gl.LUMINANCE;break;case O.a.TEXTUREFORMAT_LUMINANCE_ALPHA:t=this._gl.LUMINANCE_ALPHA;break;case O.a.TEXTUREFORMAT_RED:t=this._gl.RED;break;case O.a.TEXTUREFORMAT_RG:t=this._gl.RG;break;case O.a.TEXTUREFORMAT_RGB:t=this._gl.RGB;break;case O.a.TEXTUREFORMAT_RGBA:t=this._gl.RGBA}if(1<this._webGLVersion)switch(e){case O.a.TEXTUREFORMAT_RED_INTEGER:t=this._gl.RED_INTEGER;break;case O.a.TEXTUREFORMAT_RG_INTEGER:t=this._gl.RG_INTEGER;break;case O.a.TEXTUREFORMAT_RGB_INTEGER:t=this._gl.RGB_INTEGER;break;case O.a.TEXTUREFORMAT_RGBA_INTEGER:t=this._gl.RGBA_INTEGER}return t},L.prototype._getRGBABufferInternalSizedFormat=function(e,t){if(1===this._webGLVersion){if(void 0!==t)switch(t){case O.a.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case O.a.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case O.a.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;case O.a.TEXTUREFORMAT_RGB:return this._gl.RGB}return this._gl.RGBA}switch(e){case O.a.TEXTURETYPE_BYTE:switch(t){case O.a.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case O.a.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case O.a.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case O.a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case O.a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case O.a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case O.a.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case O.a.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case O.a.TEXTUREFORMAT_RED:return this._gl.R8;case O.a.TEXTUREFORMAT_RG:return this._gl.RG8;case O.a.TEXTUREFORMAT_RGB:return this._gl.RGB8;case O.a.TEXTUREFORMAT_RGBA:return this._gl.RGBA8;case O.a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case O.a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case O.a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case O.a.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;case O.a.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case O.a.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case O.a.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case O.a.TEXTURETYPE_SHORT:switch(t){case O.a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case O.a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case O.a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;case O.a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16I}case O.a.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case O.a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case O.a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case O.a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;case O.a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16UI}case O.a.TEXTURETYPE_INT:switch(t){case O.a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case O.a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case O.a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;case O.a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32I}case O.a.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case O.a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case O.a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case O.a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;case O.a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32UI}case O.a.TEXTURETYPE_FLOAT:switch(t){case O.a.TEXTUREFORMAT_RED:return this._gl.R32F;case O.a.TEXTUREFORMAT_RG:return this._gl.RG32F;case O.a.TEXTUREFORMAT_RGB:return this._gl.RGB32F;case O.a.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA32F}case O.a.TEXTURETYPE_HALF_FLOAT:switch(t){case O.a.TEXTUREFORMAT_RED:return this._gl.R16F;case O.a.TEXTUREFORMAT_RG:return this._gl.RG16F;case O.a.TEXTUREFORMAT_RGB:return this._gl.RGB16F;case O.a.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA16F}case O.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case O.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case O.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case O.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case O.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case O.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case O.a.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case O.a.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return this._gl.RGBA8},L.prototype._getRGBAMultiSampleBufferFormat=function(e){return e===O.a.TEXTURETYPE_FLOAT?this._gl.RGBA32F:e===O.a.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},L.prototype._loadFile=function(e,t,i,n,r,o){var a=this,s=L._FileToolsLoadFile(e,t,i,n,r,o);return this._activeRequests.push(s),s.onCompleteObservable.add(function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)}),s},L._FileToolsLoadFile=function(e,t,i,n,r,o){throw u.a.WarnImport("FileTools")},L.prototype.readPixels=function(e,t,i,n,r){void 0===r&&(r=!0);var o=r?4:3,a=r?this._gl.RGBA:this._gl.RGB,s=new Uint8Array(n*i*o);return this._gl.readPixels(e,t,i,n,a,this._gl.UNSIGNED_BYTE,s),s},L.isSupported=function(){if(null===this._isSupported)try{var e=r.a.CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._isSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._isSupported=!1}return this._isSupported},L.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},L.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},L.NearestPOT=function(e){var t=L.CeilingPOT(e),i=L.FloorPOT(e);return e-i<t-e?i:t},L.GetExponentOfTwo=function(e,t,i){var n;switch(void 0===i&&(i=O.a.SCALEMODE_NEAREST),i){case O.a.SCALEMODE_FLOOR:n=L.FloorPOT(e);break;case O.a.SCALEMODE_NEAREST:n=L.NearestPOT(e);break;case O.a.SCALEMODE_CEILING:default:n=L.CeilingPOT(e)}return Math.min(n,t)},L.QueueNewFrame=function(e,t){return P.a.IsWindowObjectExist()?(t=t||window).requestPostAnimationFrame?t.requestPostAnimationFrame(e):t.requestAnimationFrame?t.requestAnimationFrame(e):t.msRequestAnimationFrame?t.msRequestAnimationFrame(e):t.webkitRequestAnimationFrame?t.webkitRequestAnimationFrame(e):t.mozRequestAnimationFrame?t.mozRequestAnimationFrame(e):t.oRequestAnimationFrame?t.oRequestAnimationFrame(e):window.setTimeout(e,16):"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,16)},L.prototype.getHostDocument=function(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:document},L.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"]}],L._TextureLoaders=[],L.CollisionsEpsilon=.001,L._isSupported=null,
1L);function L(e,t,i,n){var c=this;void 0===n&&(n=!1),this.forcePOTTextures=!1,this.isFullscreen=!1,this.cullBackFaces=!0,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.validateShaderPrograms=!1,this.useReverseDepthBuffer=!1,this.disableUniformBuffers=!1,this._uniformBuffers=new Array,this._webGLVersion=1,this._windowIsBackground=!1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this.onContextLostObservable=new E.c,this.onContextRestoredObservable=new E.c,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this.disableVertexArrayObjects=!1,this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new S.a,this._stencilState=new A.a,this._alphaState=new C.a,this._alphaMode=O.a.ALPHA_ADD,this._alphaEquation=O.a.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._dummyFramebuffer=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._transformTextureUrl=null,this.premultipliedAlpha=!0,this.onBeforeTextureInitObservable=new E.c,this._viewportCached={x:0,y:0,z:0,w:0},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._getDepthStencilBuffer=function(e,t,i,n,r,o){var a=c._gl,s=a.createRenderbuffer();return a.bindRenderbuffer(a.RENDERBUFFER,s),1<i&&a.renderbufferStorageMultisample?a.renderbufferStorageMultisample(a.RENDERBUFFER,i,r,e,t):a.renderbufferStorage(a.RENDERBUFFER,n,e,t),a.framebufferRenderbuffer(a.FRAMEBUFFER,o,a.RENDERBUFFER,s),a.bindRenderbuffer(a.RENDERBUFFER,null),s},this._boundUniforms={};var r=null;if(e){if(i=i||{},D.a.SetMatrixPrecision(!!i.useHighPrecisionMatrix),e.getContext){if(r=e,this._renderingCanvas=r,null!=t&&(i.antialias=t),void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),void 0===i.timeStep&&(i.timeStep=1/60),void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1),void 0===i.audioEngine&&(i.audioEngine=!0),void 0===i.stencil&&(i.stencil=!0),!1===i.premultipliedAlpha&&(this.premultipliedAlpha=!1),void 0===i.xrCompatible&&(i.xrCompatible=!0),this._doNotHandleContextLost=!!i.doNotHandleContextLost,navigator&&navigator.userAgent)for(var o=navigator.userAgent,a=0,s=L.ExceptionList;a<s.length;a++){var l=s[a],u=l.key,h=l.targets;if(new RegExp(u).test(o)){if(l.capture&&l.captureConstraint){var d=l.capture,p=l.captureConstraint,f=new RegExp(d).exec(o);if(f&&0<f.length&&parseInt(f[f.length-1])>=p)continue}for(var m=0,_=h;m<_.length;m++)switch(_[m]){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0}}}if(this._doNotHandleContextLost||(this._onContextLost=function(e){e.preventDefault(),c._contextWasLost=!0,I.a.Warn("WebGL context lost."),c.onContextLostObservable.notifyObservers(c)},this._onContextRestored=function(){setTimeout(function(){c._initGLContext(),c._rebuildEffects(),c._rebuildInternalTextures(),c._rebuildBuffers(),c.wipeCaches(!0),I.a.Warn("WebGL context successfully restored."),c.onContextRestoredObservable.notifyObservers(c),c._contextWasLost=!1},0)},r.addEventListener("webglcontextlost",this._onContextLost,!1),r.addEventListener("webglcontextrestored",this._onContextRestored,!1),i.powerPreference="high-performance"),!i.disableWebGL2Support)try{this._gl=r.getContext("webgl2",i)||r.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2,this._gl.deleteQuery||(this._webGLVersion=1))}catch(e){}if(!this._gl){if(!r)throw new Error("The provided canvas is null or undefined.");try{this._gl=r.getContext("webgl",i)||r.getContext("experimental-webgl",i)}catch(e){throw new Error("WebGL not supported")}}if(!this._gl)throw new Error("WebGL not supported")}else{this._gl=e,this._renderingCanvas=this._gl.canvas,this._gl.renderbufferStorageMultisample&&(this._webGLVersion=2);var g=this._gl.getContextAttributes();g&&(i.stencil=g.stencil)}this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==i.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=i.useHighPrecisionFloats);var v=P.a.IsWindowObjectExist()&&window.devicePixelRatio||1,b=i.limitDeviceRatio||v;this._hardwareScalingLevel=n?1/Math.min(b,v):1,this.resize(),this._isStencilEnable=!!i.stencil,this._initGLContext();for(var y=0;y<this._caps.maxVertexAttribs;y++)this._currentBufferPointers[y]=new T;1<this.webGLVersion&&(this._shaderProcessor=new x.a),this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this._creationOptions=i,console.log("Babylon.js v"+L.Version+" - "+this.description)}}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"c",function(){return r}),i.d(t,"a",function(){return o}
1);var n=1/2.2,r=2.2,o=.001},function(e,t,i){"use strict";var n=i(24);i.d(t,"c",function(){return n.a}),i.d(t,"s",function(){return n.b});var r=i(10);i.d(t,"e",function(){return r.a}),i.d(t,"f",function(){return r.b}),i.d(t,"t",function(){return r.c});var o=i(32);i.d(t,"h",function(){return o.a}),i.d(t,"v",function(){return o.b}),i.d(t,"w",function(){return o.c});var a=i(124);i.d(t,"i",function(){return a.a});var s=i(97);i.d(t,"a",function(){return s.a}),i.d(t,"b",function(){return s.b}),i.d(t,"d",function(){return s.c}),i.d(t,"g",function(){return s.d}),i.d(t,"k",function(){return s.e}),i.d(t,"l",function(){return s.f}),i.d(t,"m",function(){return s.g});var c=i(80);i.d(t,"n",function(){return c.a});var l=i(94);i.d(t,"r",function(){return l.a});var u=i(0);i.d(t,"j",function(){return u.a}),i.d(t,"q",function(){return u.b}),i.d(t,"u",function(){return u.c}),i.d(t,"x",function(){return u.d}),i.d(t,"y",function(){return u.e}),i.d(t,"z",function(){return u.f});var h=i(211);i.d(t,"o",function(){return h.a}),i.d(t,"p",function(){return h.b});var d=i(77);i.d(t,"A",function(){return d.a})},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var a=i(7),n=i(50),o=i(0),r=i(28),s=i(8),c=i(59),u=i(24);s.a._PhysicsImpostorParser=function(e,t,i){return new l(t,i.physicsImpostor,{mass:i.physicsMass,friction:i.physicsFriction,restitution:i.physicsRestitution},e)};var l=(Object.defineProperty(h.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"mass",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.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:!1,configurable:!0}),Object.defineProperty(h.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:!1,configurable:!0}),Object.defineProperty(h.prototype,"pressure",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyPressure&&t.setBodyPressure(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"stiffness",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyStiffness&&t.setBodyStiffness(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"velocityIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"positionIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyPositionIterations&&t.setBodyPositionIterations(this,e)},enumerable:!1,configurable:!0}),h.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))},h.prototype._getPhysicsParent=function(){return this.object.parent instanceof r.a?this.object.parent.physicsImpostor:null},h.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&!this._parent},h.prototype.setScalingUpdated=function(){this.forceUpdate()},h.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(h.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()}
1,enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"parent",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!1,configurable:!0}),h.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},h.prototype.getObjectExtendSize=function(){if(this.object.getBoundingInfo){var e=this.object.rotationQuaternion;this.object.rotationQuaternion=h.IDENTITY_QUATERNION,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);var t=this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2);return this.object.rotationQuaternion=e,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),t}return h.DEFAULT_OBJECT_SIZE},h.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},h.prototype.getParam=function(e){return this._options[e]},h.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},h.prototype.setMass=function(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},h.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):o.e.Zero()},h.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},h.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):o.e.Zero()},h.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},h.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},h.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},h.prototype.unregisterBeforePhysicsStep=function(e){var t=this._onBeforePhysicsStepCallbacks.indexOf(e);-1<t?this._onBeforePhysicsStepCallbacks.splice(t,1):a.a.Warn("Function to remove was not found")},h.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},h.prototype.unregisterAfterPhysicsStep=function(e){var t=this._onAfterPhysicsStepCallbacks.indexOf(e);-1<t?this._onAfterPhysicsStepCallbacks.splice(t,1):a.a.Warn("Function to remove was not found")},h.prototype.registerOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:i})},h.prototype.unregisterOnPhysicsCollide=function(e,n){var r=e instanceof Array?e:[e],o=-1;this._onPhysicsCollideCallbacks.some(function(e,t){if(e.callback!==n||e.otherImpostors.length!==r.length)return!1;var i=e.otherImpostors.every(function(e){return-1<r.indexOf(e)});return i&&(o=t),i})?this._onPhysicsCollideCallbacks.splice(o,1):a.a.Warn("Function to remove was not found")},h.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):o.b.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},h.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},h.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},h.prototype.createJoint=function(e,t,i){var n=new c.e(t,i);return this.addJoint(e,n),this},h.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},h.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},h.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},h.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},h.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},h.prototype.clone=function(e){return e?new h(e,this.type,this._options,this._scene):null},h.prototype.dispose=function(){var t=this;
1this._physicsEngine&&(this._joints.forEach(function(e){t._physicsEngine&&t._physicsEngine.removeJoint(t,e.otherImpostor,e.joint)}),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)},h.prototype.setDeltaPosition=function(e){this._deltaPosition.copyFrom(e)},h.prototype.setDeltaRotation=function(e){this._deltaRotation||(this._deltaRotation=new o.b),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()},h.prototype.getBoxSizeToRef=function(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this},h.prototype.getRadius=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0},h.prototype.syncBoneWithImpostor=function(e,t,i,n,r){var o,a=h._tmpVecs[0],s=this.object;s.rotationQuaternion&&(r?(o=h._tmpQuat,s.rotationQuaternion.multiplyToRef(r,o),e.setRotationQuaternion(o,u.b.WORLD,t)):e.setRotationQuaternion(s.rotationQuaternion,u.b.WORLD,t)),a.x=0,a.y=0,a.z=0,i&&(a.x=i.x,a.y=i.y,a.z=i.z,e.getDirectionToRef(a,t,a),null==n&&(n=i.length()),a.x*=n,a.y*=n,a.z*=n),e.getParent()?(a.addInPlace(s.getAbsolutePosition()),e.setAbsolutePosition(a,t)):(t.setAbsolutePosition(s.getAbsolutePosition()),t.position.x-=a.x,t.position.y-=a.y,t.position.z-=a.z)},h.prototype.syncImpostorWithBone=function(e,t,i,n,r,o){var a,s=this.object;s.rotationQuaternion&&(r?(a=h._tmpQuat,e.getRotationQuaternionToRef(u.b.WORLD,t,a),a.multiplyToRef(r,s.rotationQuaternion)):e.getRotationQuaternionToRef(u.b.WORLD,t,s.rotationQuaternion));var c=h._tmpVecs[0],l=h._tmpVecs[1];o||((o=h._tmpVecs[2]).x=0,o.y=1,o.z=0),e.getDirectionToRef(o,t,l),e.getAbsolutePositionToRef(t,c),null==n&&i&&(n=i.length()),null!=n&&(c.x+=l.x*n,c.y+=l.y*n,c.z+=l.z*n),s.setAbsolutePosition(c)},h.DEFAULT_OBJECT_SIZE=new o.e(1,1,1),h.IDENTITY_QUATERNION=o.b.Identity(),h._tmpVecs=n.a.BuildArray(3,o.e.Zero),h._tmpQuat=o.b.Identity(),h.NoImpostor=0,h.SphereImpostor=1,h.BoxImpostor=2,h.PlaneImpostor=3,h.MeshImpostor=4,h.CapsuleImpostor=6,h.CylinderImpostor=7,h.ParticleImpostor=8,h.HeightmapImpostor=9,h.ConvexHullImpostor=10,h.CustomImpostor=100,h.RopeImpostor=101,h.ClothImpostor=102,h.SoftbodyImpostor=103,h);function h(e,t,i,n){var r=this;void 0===i&&(i={mass:0}),this.object=e,this.type=t,this._options=i,this._scene=n,this._pluginData={},this._bodyUpdateRequired=!1,this._onBeforePhysicsStepCallbacks=new Array,this._onAfterPhysicsStepCallbacks=new Array,this._onPhysicsCollideCallbacks=[],this._deltaPosition=o.e.Zero(),this._isDisposed=!1,this.soft=!1,this.segments=0,this._tmpQuat=new o.b,this._tmpQuat2=new o.b,this.beforeStep=function(){r._physicsEngine&&(r.object.translate(r._deltaPosition,-1),r._deltaRotationConjugated&&r.object.rotationQuaternion&&r.object.rotationQuaternion.multiplyToRef(r._deltaRotationConjugated,r.object.rotationQuaternion),r.object.computeWorldMatrix(!1),r.object.parent&&r.object.rotationQuaternion?(r.getParentsRotation(),r._tmpQuat.multiplyToRef(r.object.rotationQuaternion,r._tmpQuat)):r._tmpQuat.copyFrom(r.object.rotationQuaternion||new o.b),r._options.disableBidirectionalTransformation||r.object.rotationQuaternion&&r._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(r,r.object.getAbsolutePosition(),r._tmpQuat),r._onBeforePhysicsStepCallbacks.forEach(function(e){e(r)}))},this.afterStep=function(){r._physicsEngine&&(r._onAfterPhysicsStepCallbacks.forEach(function(e){e(r)}),r._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(r),r.object.parent&&r.object.rotationQuaternion&&(r.getParentsRotation(),r._tmpQuat.conjugateInPlace(),r._tmpQuat.multiplyToRef(r.object.rotationQuaternion,r.object.rotationQuaternion)),r.object.setAbsolutePosition(r.object.position),r._deltaRotation&&r.object.rotationQuaternion&&r.object.rotationQuaternion.multiplyToRef(r._deltaRotation,r.object.rotationQuaternion),r.object.translate(r._deltaPosition,1))},this.onCollideEvent=null,this.onCollide=function(e){var t;!r._onPhysicsCollideCallbacks.length&&!r.onCollideEvent||!r._physicsEngine||(t=r._physicsEngine.getImpostorWithPhysicsBody(e.body))&&(r.onCollideEvent&&r.onCollideEvent(r,t),r._onPhysicsCollideCallbacks.filter(function(e){return-1!==e.otherImpostors.indexOf(t)}
1).forEach(function(e){e.callback(r,t)}))},this.object?(this.object.parent&&0!==i.mass&&a.a.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur."),!this._scene&&e.getScene&&(this._scene=e.getScene()),this._scene&&(100<this.type&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=o.b.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new o.b),this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,this.soft&&(this._options.mass=0<this._options.mass?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&&a.a.Warn("You must affect impostors to children before affecting impostor to parent.")):a.a.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):a.a.Error("No object was provided. A physics object is obligatory")}},function(e,t,i){"use strict";i.d(t,"b",function(){return C}),i.d(t,"a",function(){return P});var n=i(1),r=i(3),o=i(40),u=i(18),a=i(0),h=i(10),g=i(4),v=i(48),s=i(29),c=i(101),l=i(119),b=i(15),y=i(9),d=i(11),p=i(19),f=i(5);f.a.IncludesShadersStore.defaultFragmentDeclaration="uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif";f.a.IncludesShadersStore.defaultUboDeclaration="layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\nvec4 vDetailInfos;\nmat4 detailMatrix;\n};\nuniform Scene {\nmat4 viewProjection;
1\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n",i(329),i(74),i(157),i(158),i(308),i(219),i(330),i(220),i(159),i(160),i(221),i(222),i(177),i(178),i(201),i(161),i(223),i(331),i(224),i(309),i(225);f.a.ShadersStore.defaultPixelShader="#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef PREPASS\nvarying vec3 vViewPos;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include<fresnelFunction>\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);
1\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n\nvec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\n\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha<alphaCutOff)\ndiscard;\n#endif\n#ifndef ALPHABLEND\n\nalpha=1.0;\n#endif\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor.rgb;\n#else\ncolor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\ngl_FragData[0]=color;\ngl_FragData[1]=vec4(0.0,0.0,0.0,1.0);\ngl_FragData[2]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\ngl_FragData[3]=vec4(0.0,0.0,0.0,1.0);\n#endif\ngl_FragColor=color;\n}\n";f.a.IncludesShadersStore.defaultVertexDeclaration="\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n",i(107),i(108),i(332),i(179),i(226),i(131),i(132),i(145),i(109),i(110),i(310),i(162),i(311),i(227),f.a.IncludesShadersStore.pointCloudVertex="#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif",i(312);f.a.ShadersStore.defaultVertexShader="#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#ifdef PREPASS\nvarying vec3 vViewPos;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;
1\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nvarying vec2 vDetailUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include<instancesVertex>\n#include<bonesVertex>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#ifdef PREPASS\nvViewPos=(view*worldPos).rgb;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nif (vDetailInfos.x == 0.)\n{\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\n}
1\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<bumpVertex>\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include<pointCloudVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";var m,_,T=i(2),E=i(84),S=i(129),A={effect:null,subMesh:null},C=(_=c.a,Object(n.d)(R,_),R.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t<i.length;t++){var n=i[t];this[n]=n===e}},R),P=(m=l.a,Object(n.d)(x,m),Object.defineProperty(x.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),x.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.get
1Scene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){t._markAllSubMeshesAsImageProcessingDirty()})))},Object.defineProperty(x.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"canRenderToMRT",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasRenderTargetTextures",{get:function(){return!!(x.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||!!(x.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},enumerable:!1,configurable:!0}),x.prototype.getClassName=function(){return"StandardMaterial"},Object.defineProperty(x.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth}
1,set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),x.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled)},x.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest||null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&(null==this._transparencyMode||this._transparencyMode===s.a.MATERIAL_ALPHATEST)},x.prototype._shouldUseAlphaFromDiffuseTexture=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture&&this._transparencyMode!==s.a.MATERIAL_OPAQUE},x.prototype.getAlphaTestTexture=function(){return this._diffuseTexture},x.prototype.isReadyForSubMesh=function(e,t,i){if(void 0===i&&(i=!1),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new C);var n=this.getScene(),r=t._materialDefines;if(this._isReadyForSubMesh(t))return!0;var o=n.getEngine();if(r._needNormals=b.a.PrepareDefinesForLights(n,e,r,!0,this._maxSimultaneousLights,this._disableLighting),b.a.PrepareDefinesForMultiview(n,r),b.a.PrepareDefinesForPrePass(n,r,this.canRenderToMRT),r._areTexturesDirty){if(r._needUVs=!1,r.MAINUV1=!1,r.MAINUV2=!1,n.texturesEnabled){if(this._diffuseTexture&&x.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;b.a.PrepareDefinesForMergedUV(this._diffuseTexture,r,"DIFFUSE")}else r.DIFFUSE=!1;if(this._ambientTexture&&x.AmbientTextureEnabled){if(!this._ambientTexture.isReadyOrNotBlocking())return!1;b.a.PrepareDefinesForMergedUV(this._ambientTexture,r,"AMBIENT")}else r.AMBIENT=!1;if(this._opacityTexture&&x.OpacityTextureEnabled){if(!this._opacityTexture.isReadyOrNotBlocking())return!1;b.a.PrepareDefinesForMergedUV(this._opacityTexture,r,"OPACITY"),r.OPACITYRGB=this._opacityTexture.getAlphaFromRGB}else r.OPACITY=!1;if(this._reflectionTexture&&x.ReflectionTextureEnabled){if(!this._reflectionTexture.isReadyOrNotBlocking())return!1;switch(r._needNormals=!0,r.REFLECTION=!0,r.ROUGHNESS=0<this._roughness,r.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,r.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===y.a.INVCUBIC_MODE,r.REFLECTIONMAP_3D=this._reflectionTexture.isCube,r.RGBDREFLECTION=this._reflectionTexture.isRGBD,this._reflectionTexture.coordinatesMode){case y.a.EXPLICIT_MODE:r.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case y.a.PLANAR_MODE:r.setReflectionMode("REFLECTIONMAP_PLANAR");break;case y.a.PROJECTION_MODE:r.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case y.a.SKYBOX_MODE:r.setReflectionMode("REFLECTIONMAP_SKYBOX");break;case y.a.SPHERICAL_MODE:r.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case y.a.EQUIRECTANGULAR_MODE:r.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case y.a.FIXED_EQUIRECTANGULAR_MODE:r.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case y.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:r.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case y.a.CUBIC_MODE:case y.a.INVCUBIC_MODE:default:r.setReflectionMode("REFLECTIONMAP_CUBIC")}r.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else r.REFLECTION=!1;if(this._emissiveTexture&&x.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;b.a.PrepareDefinesForMergedUV(this._emissiveTexture,r,"EMISSIVE")}else r.EMISSIVE=!1;if(this._lightmapTexture&&x.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;b.a.PrepareDefinesForMergedUV(this._lightmapTexture,r,"LIGHTMAP"),r.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,r.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else r.LIGHTMAP=!1;if(this._specularTexture&&x.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;b.a.PrepareDefinesForMergedUV(this._specularTexture,r,"SPECULAR"),r.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else r.SPECULAR=!1;if(n.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&x.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;b.a.PrepareDefinesForMergedUV(this._bumpTexture,r,"BUMP"),r.PARALLAX=this._useParallax,r.PARALLAXOCCLUSION=this._useParallaxOcclusion,r.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else r.BUMP=!1;if(this._refractionTexture&&x.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;r._needUVs=!0,r.REFRACTION=!0,r.REFRACTIONMAP_3D=this._refractionTexture.isCube,r.RGBDRE
1FRACTION=this._refractionTexture.isRGBD}else r.REFRACTION=!1;r.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else r.DIFFUSE=!1,r.AMBIENT=!1,r.OPACITY=!1,r.REFLECTION=!1,r.EMISSIVE=!1,r.LIGHTMAP=!1,r.BUMP=!1,r.REFRACTION=!1;r.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),r.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,r.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,r.SPECULAROVERALPHA=this._useSpecularOverAlpha,r.PREMULTIPLYALPHA=this.alphaMode===T.a.ALPHA_PREMULTIPLIED||this.alphaMode===T.a.ALPHA_PREMULTIPLIED_PORTERDUFF,r.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,r.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(!this.detailMap.isReadyForSubMesh(r,n))return!1;if(r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r),r.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,r.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(r._areFresnelDirty&&(x.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(r.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,r.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,r.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,r.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,r.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,r.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,r._needNormals=!0,r.FRESNEL=!0):r.FRESNEL=!1),b.a.PrepareDefinesForMisc(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,r),b.a.PrepareDefinesForAttributes(e,r,!0,!0,!0),b.a.PrepareDefinesForFrameBoundValues(n,o,r,i,null,t.getRenderingMesh().hasThinInstances),this.detailMap.prepareDefines(r,n),r.isDirty){var a=r._areLightsDisposed;r.markAsProcessed();var s=new E.a;r.REFLECTION&&s.addFallback(0,"REFLECTION"),r.SPECULAR&&s.addFallback(0,"SPECULAR"),r.BUMP&&s.addFallback(0,"BUMP"),r.PARALLAX&&s.addFallback(1,"PARALLAX"),r.PARALLAXOCCLUSION&&s.addFallback(0,"PARALLAXOCCLUSION"),r.SPECULAROVERALPHA&&s.addFallback(0,"SPECULAROVERALPHA"),r.FOG&&s.addFallback(1,"FOG"),r.POINTSIZE&&s.addFallback(0,"POINTSIZE"),r.LOGARITHMICDEPTH&&s.addFallback(0,"LOGARITHMICDEPTH"),b.a.HandleFallbacksForShadows(r,s,this._maxSimultaneousLights),r.SPECULARTERM&&s.addFallback(0,"SPECULARTERM"),r.DIFFUSEFRESNEL&&s.addFallback(1,"DIFFUSEFRESNEL"),r.OPACITYFRESNEL&&s.addFallback(2,"OPACITYFRESNEL"),r.REFLECTIONFRESNEL&&s.addFallback(3,"REFLECTIONFRESNEL"),r.EMISSIVEFRESNEL&&s.addFallback(4,"EMISSIVEFRESNEL"),r.FRESNEL&&s.addFallback(4,"FRESNEL"),r.MULTIVIEW&&s.addFallback(0,"MULTIVIEW");var c=[g.b.PositionKind];r.NORMAL&&c.push(g.b.NormalKind),r.UV1&&c.push(g.b.UVKind),r.UV2&&c.push(g.b.UV2Kind),r.VERTEXCOLOR&&c.push(g.b.ColorKind),b.a.PrepareAttributesForBones(c,e,r,s),b.a.PrepareAttributesForInstances(c,r),b.a.PrepareAttributesForMorphTargets(c,e,r);var l="default",u=["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","vClipPlane5","vClipPlane6","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"],h=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],d=["Material","Scene"];
1S.a.AddUniforms(u),S.a.AddSamplers(h),v.a&&(v.a.PrepareUniforms(u,r),v.a.PrepareSamplers(h,r)),b.a.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:r,maxSimultaneousLights:this._maxSimultaneousLights});var p={};this.customShaderNameResolve&&(l=this.customShaderNameResolve(l,u,d,h,r,c,p));var f=r.toString(),m=t.effect,_=n.getEngine().createEffect(l,{attributes:c,uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:f,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS},processFinalCode:p.processFinalCode,multiTarget:r.PREPASS},o);if(_)if(this._onEffectCreatedObservable&&(A.effect=_,A.subMesh=t,this._onEffectCreatedObservable.notifyObservers(A)),this.allowShaderHotSwapping&&m&&!_.isReady()){if(_=m,this._rebuildInParallel=!0,r.markAsUnprocessed(),a)return!(r._areLightsDisposed=!0)}else this._rebuildInParallel=!1,n.resetCachedMaterial(),t.setEffect(_,r),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},x.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),S.a.PrepareUniformBuffer(e),e.create()},x.prototype.unbind=function(){var e;this._activeEffect&&(e=!1,this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),e=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),e=!0),e&&this._markAllSubMeshesAsTexturesDirty()),m.prototype.unbind.call(this)},x.prototype.bindForSubMesh=function(e,t,i){var n,r,o,a,s,c=this.getScene(),l=i._materialDefines;!l||(n=i.effect)&&(this._activeEffect=n,l.INSTANCES&&!l.THIN_INSTANCES||this.bindOnlyWorldMatrix(e),l.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix)),r=this._mustRebind(c,n,t.visibility),b.a.BindBonesParameters(t,n),o=this._uniformBuffer,r&&(o.bindToEffect(n,"Material"),this.bindViewProjection(n),o.useUbo&&this.isFrozen&&o.isSync||(x.FresnelEnabled&&l.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(o.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),o.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&o.updateColor4("opacityParts",new h.a(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(o.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),o.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(o.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),o.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(o.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),o.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),c.texturesEnabled&&(this._diffuseTexture&&x.DiffuseTextureEnabled&&(o.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),b.a.BindTextureMatrix(this._diffuseTexture,o,"diffuse"),this._diffuseTexture.hasAlpha&&n.setFloat("alphaCutOff",this.alphaCutOff)),this._ambientTexture&&x.AmbientTextureEnabled&&(o.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),b.a.BindTextureMatrix(this._ambientTexture,o,"ambient")),this._opacityTexture&&x.OpacityTextureEnabled&&(o.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),b.a.BindTextureMatrix(this._opacityTexture,o,"opacity")),this._reflectionTexture&&x.ReflectionTextureEnabled&&(o.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),o.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)&&(a=this._reflectionTexture,o.updateVector3("vReflectionPosition",a.boundingBoxPosition),o.updateVector3("vReflectionSize",a.boundingBoxSize)),this._emissiveTexture&&x.EmissiveTextureEnabled&&(o.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),b.a.BindTextureMatrix(this._emissiveTexture,o,"emissive")),this._lightmapTexture&&x.LightmapTextureEnabled&&(o.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),b.a.BindTextureMatrix(this._lightmapTexture,o,"lightmap")),this._specularTexture&&x.SpecularTextureEnabled&&(o.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),b.a.BindTextureMatrix(this._specularTexture,o,"specular")),this._bumpTexture&&c.getEngine().getCaps().standardDerivatives&&x.BumpTextureEnabled&&(o.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),b.a.BindTextureMatrix(this._bumpTexture,o,"bump"),c._mirroredCameraPosition?o.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):o.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&x.RefractionTextureEnabled&&(s=1,this._refractionTexture.isCube||(o.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(s=this._refractionTexture.depth)),o.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,s,this.invertRefractionY?-1:1))),this.pointsCloud&&o.updateFloat("pointSize",this.pointSize),l.SPECULARTERM&&o.updateColor4("vSpecularColor",this.specularColor,this.specularPower),o.updateColor3("vEmissiveColor",x.EmissiveTextureEnabled?this.emissiveColor:h.a.BlackReadOnly),o.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha)),o.updateFloat("visibility",t.visibility),c.texturesEnabled&&(this._diffuseTexture&&x.DiffuseTextureEnabled&&n.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&x.AmbientTextureEnabled&&n.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&x.OpacityTextureEnabled&&n.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&x.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?n.setTexture("reflectionCubeSampler",this._reflectionTexture):n.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&x.EmissiveTextureEnabled&&n.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&x.LightmapTextureEnabled&&n.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&x.SpecularTextureEnabled&&n.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&c.getEngine().getCaps().standardDerivatives&&x.BumpTextureEnabled&&n.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&x.RefractionTextureEnabled)&&(s=1,this._refractionTexture.isCube?n.setTexture("refractionCubeSampler",this._refractionTexture):n.setTexture("refraction2DSampler",this._refractionTexture)),this.detailMap.bindForSubMesh(o,c,this.isFrozen),b.a.BindClipPlane(n,c),c.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),b.a.BindEyePosition(n,c),n.setColor3("vAmbientColor",this._globalAmbientColor)),!r&&this.isFrozen||(c.lightsEnabled&&!this._disableLighting&&b.a.BindLights(c,t,n,l,this._maxSimultaneousLights,this._rebuildInParallel),(c.fogEnabled&&t.applyFog&&c.fogMode!==u.a.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(n),b.a.BindFogParameters(c,t,n),l.NUM_MORPH_INFLUENCERS&&b.a.BindMorphTargetParameters(t,n),this.useLogarithmicDepth&&b.a.BindLogDepth(l,n,c),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),o.update(),this._afterBind(t,this._activeEffect))},x.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&0<this._diffuseTexture.animations.length&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&0<this._ambientTexture.animations.length&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&0<this._reflectionTexture.animations.length&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&0<this._emissiveTexture.animations.length&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&0<this._specularTexture.animations.length&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&0<this._lightmapTexture.animations.length&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&0<this._refractionTexture.animations.length&&e.push(this._refractionTexture),this.detailMap.getAnimatables(e),e},x.prototype.getActiveTextures=function(){var e=m.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),this.detailMap.getActiveTextures(e),e},x.prototype.hasTexture=function(e){return!!m.prototype.hasTexture.call(this,e)||this._diffuseTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._emissiveTexture===e||this._specularTexture===e||this._bumpTexture===e||this._lightmapTexture===e||this._refractionTexture===e||this.detailMap.hasTexture(e)},x.prototype.dispose=function(e,t){var i,n,r,o,a,s,c,l,u;t&&(null===(i=this._diffuseTexture)||void 0===i||i.dispose(),null===(n=this._ambientTexture)||void 0===n||n.dispose(),null===(r=this._opacityTexture)||void 0===r||r.dispose(),null===(o=this._reflectionTexture)||void 0===o||o.dispose(),null===(a=this._emissiveTexture)||void 0===a||a.dispose(),null===(s=this._specularTexture)||void 0===s||s.dispose(),null===(c=this._bumpTexture)||void 0===c||c.dispose(),null===(l=this._lightmapTexture)||void 0===l||l.dispose(),null===(u=this._refractionTexture)||void 0===u||u.dispose()),this.detailMap.dispose(t),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),m.prototype.dispose.call(this,e,t)},x.prototype.clone=function(e){var t=this,i=r.a.Clone(function(){return new x(e,t.getScene())},this);return i.name=e,i.id=e,i},x.prototype.serialize=function(){return r.a.Serialize(this)},x.Parse=function(e,t,i){return r.a.Parse(function(){return new x(e.name,t)},e,t,i)},Object.defineProperty(x,"DiffuseTextureEnabled",{get:function(){return p.a.DiffuseTextureEnabled},set:function(e){p.a.DiffuseTextureEnabled=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(x,"DetailTextureEnabled",{get:function(){return p.a.DetailTextureEnabled},set:function(e){p.a.DetailTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"AmbientTextureEnabled",{get:function(){return p.a.AmbientTextureEnabled},set:function(e){p.a.AmbientTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"OpacityTextureEnabled",{get:function(){return p.a.OpacityTextureEnabled},set:function(e){p.a.OpacityTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"ReflectionTextureEnabled",{get:function(){return p.a.ReflectionTextureEnabled},set:function(e){p.a.ReflectionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"EmissiveTextureEnabled",{get:function(){return p.a.EmissiveTextureEnabled},set:function(e){p.a.EmissiveTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"SpecularTextureEnabled",{get:function(){return p.a.SpecularTextureEnabled},set:function(e){p.a.SpecularTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"BumpTextureEnabled",{get:function(){return p.a.BumpTextureEnabled},set:function(e){p.a.BumpTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"LightmapTextureEnabled",{get:function(){return p.a.LightmapTextureEnabled},set:function(e){p.a.LightmapTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"RefractionTextureEnabled",{get:function(){return p.a.RefractionTextureEnabled},set:function(e){p.a.RefractionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"ColorGradingTextureEnabled",{get:function(){return p.a.ColorGradingTextureEnabled},set:function(e){p.a.ColorGradingTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(x,"FresnelEnabled",{get:function(){return p.a.FresnelEnabled},set:function(e){p.a.FresnelEnabled=e},enumerable:!1,configurable:!0}),Object(n.c)([Object(r.m)("diffuseTexture")],x.prototype,"_diffuseTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],x.prototype,"diffuseTexture",void 0),Object(n.c)([Object(r.m)("ambientTexture")],x.prototype,"_ambientTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"ambientTexture",void 0),Object(n.c)([Object(r.m)("opacityTexture")],x.prototype,"_opacityTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],x.prototype,"opacityTexture",void 0),Object(n.c)([Object(r.m)("reflectionTexture")],x.prototype,"_reflectionTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"reflectionTexture",void 0),Object(n.c)([Object(r.m)("emissiveTexture")],x.prototype,"_emissiveTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"emissiveTexture",void 0),Object(n.c)([Object(r.m)("specularTexture")],x.prototype,"_specularTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"specularTexture",void 0),Object(n.c)([Object(r.m)("bumpTexture")],x.prototype,"_bumpTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"bumpTexture",void 0),Object(n.c)([Object(r.m)("lightmapTexture")],x.prototype,"_lightmapTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"lightmapTexture",void 0),Object(n.c)([Object(r.m)("refractionTexture")],x.prototype,"_refractionTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"refractionTexture",void 0),Object(n.c)([Object(r.e)("ambient")],x.prototype,"ambientColor",void 0),Object(n.c)([Object(r.e)("diffuse")],x.prototype,"diffuseColor",void 0),Object(n.c)([Object(r.e)("specular")],x.prototype,"specularColor",void 0),Object(n.c)([Object(r.e)("emissive")],x.prototype,"emissiveColor",void 0),Object(n.c)([Object(r.c)()],x.prototype,"specularPower",void 0),Object(n.c)([Object(r.c)("useAlphaFromDiffuseTexture")],x.prototype,"_useAlphaFromDiffuseTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],x.prototype,"useAlphaFromDiffuseTexture",void 0),Object(n.c)([Object(r.c)("useEmissiveAsIllumination")],x.prototype,"_useEmissiveAsIllumination",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useEmissiveAsIllumination",void 0),Object(n.c)([Object(r.c)("linkEmissiveWithDiffuse")],x.prototype,"_linkEmissiveWithDiffuse",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"linkEmissiveWithDiffuse",void 0),Object(n.c)([Object(r.c)("useSpecularOverAlpha")],x.prototype,"_useSpecularOverAlpha",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useSpecularOverAlpha",void 0),Object(n.c)([Object(r.c)("useReflectionOverAlpha")],x.prototype,"_useReflectionOverAlpha",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useReflectionOverAlpha",void 0),Object(n.c)([Object(r.c)("disableLighting")],x.prototype,"_disableLighting",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsLightsDirt
1y")],x.prototype,"disableLighting",void 0),Object(n.c)([Object(r.c)("useObjectSpaceNormalMap")],x.prototype,"_useObjectSpaceNormalMap",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useObjectSpaceNormalMap",void 0),Object(n.c)([Object(r.c)("useParallax")],x.prototype,"_useParallax",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useParallax",void 0),Object(n.c)([Object(r.c)("useParallaxOcclusion")],x.prototype,"_useParallaxOcclusion",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useParallaxOcclusion",void 0),Object(n.c)([Object(r.c)()],x.prototype,"parallaxScaleBias",void 0),Object(n.c)([Object(r.c)("roughness")],x.prototype,"_roughness",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"roughness",void 0),Object(n.c)([Object(r.c)()],x.prototype,"indexOfRefraction",void 0),Object(n.c)([Object(r.c)()],x.prototype,"invertRefractionY",void 0),Object(n.c)([Object(r.c)()],x.prototype,"alphaCutOff",void 0),Object(n.c)([Object(r.c)("useLightmapAsShadowmap")],x.prototype,"_useLightmapAsShadowmap",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useLightmapAsShadowmap",void 0),Object(n.c)([Object(r.h)("diffuseFresnelParameters")],x.prototype,"_diffuseFresnelParameters",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],x.prototype,"diffuseFresnelParameters",void 0),Object(n.c)([Object(r.h)("opacityFresnelParameters")],x.prototype,"_opacityFresnelParameters",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsFresnelAndMiscDirty")],x.prototype,"opacityFresnelParameters",void 0),Object(n.c)([Object(r.h)("reflectionFresnelParameters")],x.prototype,"_reflectionFresnelParameters",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],x.prototype,"reflectionFresnelParameters",void 0),Object(n.c)([Object(r.h)("refractionFresnelParameters")],x.prototype,"_refractionFresnelParameters",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],x.prototype,"refractionFresnelParameters",void 0),Object(n.c)([Object(r.h)("emissiveFresnelParameters")],x.prototype,"_emissiveFresnelParameters",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],x.prototype,"emissiveFresnelParameters",void 0),Object(n.c)([Object(r.c)("useReflectionFresnelFromSpecular")],x.prototype,"_useReflectionFresnelFromSpecular",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],x.prototype,"useReflectionFresnelFromSpecular",void 0),Object(n.c)([Object(r.c)("useGlossinessFromSpecularMapAlpha")],x.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"useGlossinessFromSpecularMapAlpha",void 0),Object(n.c)([Object(r.c)("maxSimultaneousLights")],x.prototype,"_maxSimultaneousLights",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsLightsDirty")],x.prototype,"maxSimultaneousLights",void 0),Object(n.c)([Object(r.c)("invertNormalMapX")],x.prototype,"_invertNormalMapX",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"invertNormalMapX",void 0),Object(n.c)([Object(r.c)("invertNormalMapY")],x.prototype,"_invertNormalMapY",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"invertNormalMapY",void 0),Object(n.c)([Object(r.c)("twoSidedLighting")],x.prototype,"_twoSidedLighting",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],x.prototype,"twoSidedLighting",void 0),Object(n.c)([Object(r.c)()],x.prototype,"useLogarithmicDepth",null),x);function x(e,t){var i=m.call(this,e,t)||this;return i._diffuseTexture=null,i._ambientTexture=null,i._opacityTexture=null,i._reflectionTexture=null,i._emissiveTexture=null,i._specularTexture=null,i._bumpTexture=null,i._lightmapTexture=null,i._refractionTexture=null,i.ambientColor=new h.a(0,0,0),i.diffuseColor=new h.a(1,1,1),i.specularColor=new h.a(1,1,1),i.emissiveColor=new h.a(0,0,0),i.specularPower=64,i._useAlphaFromDiffuseTexture=!1,i._useEmissiveAsIllumination=!1,i._linkEmissiveWithDiffuse=!1,i._useSpecularOverAlpha=!1,i._useReflectionOverAlpha=!1,i._disableLighting=!1,i._useObjectSpaceNormalMap=!1,i._useParallax=!1,i._useParallaxOcclusion=!1,i.parallaxScaleBias=.05,i._roughness=0,i.indexOfRefraction=.98,i.invertRefractionY=!0,i.alphaCutOff=.4,i._useLightmapAsShadowmap=!1,i._useReflectionFresnelFromSpecular=!1,i._useGlossinessFromSpecularMapAlpha=!1,i._maxSimultaneousLights=4,i._invertNormalMapX=!1,i._invertNormalMapY=!1,i._twoSidedLighting=!1,i.detailMap=new S.a(i._markAllSubMeshesAsTexturesDirty.bind(i)),i._renderTargets=new o.a(16),i._worldViewProjectionMatrix=a.a.Zero(),i._globalAmbientColor=new h.a(0,0,0),i._rebuildInParallel=!1,i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),x.ReflectionTextureEnabled&&i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),x.RefractionTextureEnabled&&i._refractionTexture&&i._refractionTexture.isRenderTarget&&i._renderTargets.push(i._refractionTexture),i._renderTargets},i}function R(){var e=_.call(this)||this;
1return e.MAINUV1=!1,e.MAINUV2=!1,e.DIFFUSE=!1,e.DIFFUSEDIRECTUV=0,e.DETAIL=!1,e.DETAILDIRECTUV=0,e.DETAIL_NORMALBLENDMETHOD=0,e.AMBIENT=!1,e.AMBIENTDIRECTUV=0,e.OPACITY=!1,e.OPACITYDIRECTUV=0,e.OPACITYRGB=!1,e.REFLECTION=!1,e.EMISSIVE=!1,e.EMISSIVEDIRECTUV=0,e.SPECULAR=!1,e.SPECULARDIRECTUV=0,e.BUMP=!1,e.BUMPDIRECTUV=0,e.PARALLAX=!1,e.PARALLAXOCCLUSION=!1,e.SPECULAROVERALPHA=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.ALPHAFROMDIFFUSE=!1,e.POINTSIZE=!1,e.FOG=!1,e.SPECULARTERM=!1,e.DIFFUSEFRESNEL=!1,e.OPACITYFRESNEL=!1,e.REFLECTIONFRESNEL=!1,e.REFRACTIONFRESNEL=!1,e.EMISSIVEFRESNEL=!1,e.FRESNEL=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE=!1,e.INSTANCES=!1,e.THIN_INSTANCES=!1,e.GLOSSINESS=!1,e.ROUGHNESS=!1,e.EMISSIVEASILLUMINATION=!1,e.LINKEMISSIVEWITHDIFFUSE=!1,e.REFLECTIONFRESNELFROMSPECULAR=!1,e.LIGHTMAP=!1,e.LIGHTMAPDIRECTUV=0,e.OBJECTSPACE_NORMALMAP=!1,e.USELIGHTMAPASSHADOWMAP=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.LOGARITHMICDEPTH=!1,e.REFRACTION=!1,e.REFRACTIONMAP_3D=!1,e.REFLECTIONOVERALPHA=!1,e.TWOSIDEDLIGHTING=!1,e.SHADOWFLOAT=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_UV=!1,e.NUM_MORPH_INFLUENCERS=0,e.NONUNIFORMSCALING=!1,e.PREMULTIPLYALPHA=!1,e.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,e.ALPHABLEND=!0,e.PREPASS=!1,e.SCENE_MRT_COUNT=0,e.RGBDLIGHTMAP=!1,e.RGBDREFLECTION=!1,e.RGBDREFRACTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.MULTIVIEW=!1,e.IS_REFLECTION_LINEAR=!1,e.IS_REFRACTION_LINEAR=!1,e.EXPOSURE=!1,e.rebuild(),e}d.a.RegisteredTypes["BABYLON.StandardMaterial"]=P,u.a.DefaultMaterialFactory=function(e){return new P("default material",e)}},function(e,t,i){"use strict";i.d(t,"b",function(){return p}),i.d(t,"a",function(){return l});var p,n,s=i(13),r=i(6),A=i(113),c=i(18),C=i(12),f=i(22),m=i(7),o=i(2),a=i(93);(n=p=p||{})[n.Clean=0]="Clean",n[n.Stop=1]="Stop",n[n.Sync=2]="Sync",n[n.NoSync=3]="NoSync";var l=(Object.defineProperty(P,"ForceFullSceneLoadingForIncremental",{get:function(){return a.a.ForceFullSceneLoadingForIncremental},set:function(e){a.a.ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(P,"ShowLoadingScreen",{get:function(){return a.a.ShowLoadingScreen},set:function(e){a.a.ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(P,"loggingLevel",{get:function(){return a.a.loggingLevel},set:function(e){a.a.loggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(P,"CleanBoneMatrixWeights",{get:function(){return a.a.CleanBoneMatrixWeights},set:function(e){a.a.CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),P._getDefaultPlugin=function(){return P._registeredPlugins[".babylon"]},P._getPluginForExtension=function(e){return P._registeredPlugins[e]||(m.a.Warn("Unable to find a plugin to load "+e+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type"),P._getDefaultPlugin())},P._getPluginForDirectLoad=function(e){for(var t in P._registeredPlugins){var i=P._registeredPlugins[t].plugin;if(i.canDirectLoad&&i.canDirectLoad(e))return P._registeredPlugins[t]}return P._getDefaultPlugin()},P._getPluginForFilename=function(e){var t=e.indexOf("?");-1!==t&&(e=e.substring(0,t));var i=e.lastIndexOf("."),n=e.substring(i,e.length).toLowerCase();return P._getPluginForExtension(n)},P._getDirectLoad=function(e){return"data:"===e.substr(0,5)?e.substr(5):null},P._loadData=function(i,n,r,o,a,e,t){var s,c,l=P._getDirectLoad(i.name),u=t?P._getPluginForExtension(t):l?P._getPluginForDirectLoad(i.name):P._getPluginForFilename(i.name);if(!(s=void 0!==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.";if(P.OnPluginActivatedObservable.notifyObservers(s),l)return s.directLoad?(c=s.directLoad(n,l)).then?c.then(function(e){r(s,e)}
1).catch(function(e){a("Error in directLoad of _loadData: "+e,e)}):r(s,c):r(s,l),s;function h(e,t){n.isDisposed?a("Scene has been disposed"):r(s,e,t)}var d=u.isBinary,p=null,f=!1,m=s.onDisposeObservable;function _(){var e,t;f||(e=function(e,t){h(e,t?t.responseURL:void 0)},t=function(e){a(e.message,e)},p=s.requestFile?s.requestFile(n,i.url,e,o,d,t):n._requestFile(i.url,e,o,!0,d,t))}m&&m.add(function(){f=!0,p&&(p.abort(),p=null),e()});var g,v=i.file||A.a.FilesToLoad[i.name.toLowerCase()];if(-1===i.rootUrl.indexOf("file:")||-1!==i.rootUrl.indexOf("file:")&&!v){var b=n.getEngine(),y=b.enableOfflineSupport;if(y){for(var T=!1,E=0,S=n.disableOfflineSupportExceptionRules;E<S.length;E++)if(S[E].test(i.url)){T=!0;break}y=!T}y&&C.a.OfflineProviderFactory?n.offlineProvider=C.a.OfflineProviderFactory(i.url,_,b.disableManifestCheck):_()}else v?(g=function(e){a(e.message,e)},p=s.readFile?s.readFile(n,v,h,o,d,g):n._readFile(v,h,o,d,g)):a("Unable to find file named "+i.name);return s},P._getFileInfo=function(e,t){var i=null;if(t)if(t.name)var n=e+t.name,r=t.name,i=t;else{var o=t;if("/"===o.substr(0,1))return s.b.Error("Wrong sceneFilename parameter"),null;n=e+o,r=o}else n=e,r=s.b.GetFilename(e),e=s.b.GetFolderPath(e);return{url:n,rootUrl:e,name:r,file:i}},P.GetPluginForExtension=function(e){return P._getPluginForExtension(e).plugin},P.IsPluginForExtensionAvailable=function(e){return!!P._registeredPlugins[e]},P.RegisterPlugin=function(t){var e,i;"string"==typeof t.extensions?(e=t.extensions,P._registeredPlugins[e.toLowerCase()]={plugin:t,isBinary:!1}
1):(i=t.extensions,Object.keys(i).forEach(function(e){P._registeredPlugins[e.toLowerCase()]={plugin:t,isBinary:i[e].isBinary}}))},P.ImportMesh=function(s,e,t,c,r,i,n,o){if(void 0===t&&(t=""),void 0===c&&(c=f.a.LastCreatedScene),void 0===r&&(r=null),void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=null),!c)return m.a.Error("No scene available to import mesh to"),null;var l=P._getFileInfo(e,t);if(!l)return null;var a={};function u(){c._removePendingData(a)}function h(e,t){var i="Unable to import meshes from "+l.url+": "+e;n?n(c,i,t):m.a.Error(i),u()}function d(e,t,i,n){if(c.importedMeshesFiles.push(l.url),r)try{r(e,t,i,n)}catch(e){h("Error in onSuccess callback: "+e,e)}c._removePendingData(a)}c._addPendingData(a);var p=i?function(e){try{i(e)}catch(e){h("Error in onProgress callback: "+e,e)}}:void 0;return P._loadData(l,c,function(t,e,i){if(t.rewriteRootURL&&(l.rootUrl=t.rewriteRootURL(l.rootUrl,i)),t.importMesh){var n=t,r=new Array,o=new Array,a=new Array;if(!n.importMesh(s,c,e,l.rootUrl,r,o,a,h))return;c.loadingPluginName=t.name,d(r,o,a,[])}else t.importMeshAsync(s,c,e,l.rootUrl,p,l.name).then(function(e){c.loadingPluginName=t.name,d(e.meshes,e.particleSystems,e.skeletons,e.animationGroups)}).catch(function(e){h(e.message,e)})},p,h,u,o)},P.ImportMeshAsync=function(e,t,i,o,a,s){return void 0===i&&(i=""),void 0===o&&(o=f.a.LastCreatedScene),void 0===a&&(a=null),void 0===s&&(s=null),new Promise(function(r,n){P.ImportMesh(e,t,i,o,function(e,t,i,n){r({meshes:e,particleSystems:t,skeletons:i,animationGroups:n})},a,function(e,t,i){n(i||new Error(t))},s)})},P.Load=function(e,t,i,n,r,o,a){return void 0===t&&(t=""),void 0===i&&(i=f.a.LastCreatedEngine),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),i?P.Append(e,t,new c.a(i),n,r,o,a):(s.b.Error("No engine available"),null)},P.LoadAsync=function(e,i,r,o,a){return void 0===i&&(i=""),void 0===r&&(r=f.a.LastCreatedEngine),void 0===o&&(o=null),void 0===a&&(a=null),new Promise(function(t,n){P.Load(e,i,r,function(e){t(e)},o,function(e,t,i){n(i||new Error(t))},a)})},P.Append=function(e,t,n,i,r,o,a){var s=this;if(void 0===t&&(t=""),void 0===n&&(n=f.a.LastCreatedScene),void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),!n)return m.a.Error("No scene available to append to"),null;var c=P._getFileInfo(e,t);if(!c)return null;P.ShowLoadingScreen&&!this._showingLoadingScreen&&(this._showingLoadingScreen=!0,n.getEngine().displayLoadingUI(),n.executeWhenReady(function(){n.getEngine().hideLoadingUI(),s._showingLoadingScreen=!1}));var l={};function u(){n._removePendingData(l)}function h(e,t){var i="Unable to load from "+c.url+(e?": "+e:"");o?o(n,i,t):m.a.Error(i),u()}function d(){if(i)try{i(n)}catch(e){h("Error in onSuccess callback",e)}n._removePendingData(l)}n._addPendingData(l);var p=r?function(e){try{r(e)}catch(e){h("Error in onProgress callback",e)}}:void 0;return P._loadData(c,n,function(e,t){if(e.load){if(!e.load(n,t,c.rootUrl,h))return;n.loadingPluginName=e.name,d()}else e.loadAsync(n,t,c.rootUrl,p,c.name).then(function(){n.loadingPluginName=e.name,d()}).catch(function(e){h(e.message,e)})},p,h,u,a)},P.AppendAsync=function(e,i,r,o,a){return void 0===i&&(i=""),void 0===r&&(r=f.a.LastCreatedScene),void 0===o&&(o=null),void 0===a&&(a=null),new Promise(function(t,n){P.Append(e,i,r,function(e){t(e)},o,function(e,t,i){n(i||new Error(t))},a)})},P.LoadAssetContainer=function(e,t,n,i,r,o,a){if(void 0===t&&(t=""),void 0===n&&(n=f.a.LastCreatedScene),void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),!n)return m.a.Error("No scene available to load asset container to"),null;var s=P._getFileInfo(e,t);if(!s)return null;var c={};function l(){n._removePendingData(c)}function u(e,t){var i="Unable to load assets from "+s.url+(e?": "+e:"");t&&t.message&&(i+=" ("+t.message+")"),o?o(n,i,t):m.a.Error(i),l()}function h(e){if(i)try{i(e)}catch(e){u("Error in onSuccess callback",e)}n._removePendingData(c)}n._addPendingData(c);var d=r?function(e){try{r(e)}catch(e){u("Error in onProgress callback",e)}}:void 0;return P._loadData(s,n,function(t,e){if(t.loadAssetContainer){var i=t.loadAssetContainer(n,e,s.rootUrl,u);if(!i)return;n.loadingPluginName=t.name,h(i)}else t.loadAssetContainerAsync?t.loadAssetContainerAsync(n,e,s.rootUrl,d,s.name).then(function(e){n.loadingPluginName=t.name,h(e)}).catch(function(e){u(e.message,e)}):u("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.")},d,u,l,a)},P.LoadAssetContainerAsync=function(e,i,r,o,a){return void 0===i&&(i=""),void 0===r&&(r=f.a.LastCreatedScene),void 0===o&&(o=null),void 0===a&&(a=null),new Promise(function(t,n){P.LoadAssetContainer(e,i,r,function(e){t(e)},o,function(e,t,i){n(i||new Error(t))},a)})},P.ImportAnimations=function(e,t,i,n,r,o,a,s,c,l){if(void 0===t&&(t=""),void 0===i&&(i=f.a.LastCreatedScene),void 0===n&&(n=!0),void 0===r&&(r=p.Clean),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===c&&(c=null),void 0===l&&(l=null),i){if(n){for(var u=0,h=i.animatables;u<h.length;u++)h[u].reset();
1i.stopAllAnimations(),i.animationGroups.slice().forEach(function(e){e.dispose()}),i.getNodes().forEach(function(e){e.animations&&(e.animations=[])})}else switch(r){case p.Clean:i.animationGroups.slice().forEach(function(e){e.dispose()});break;case p.Stop:i.animationGroups.forEach(function(e){e.stop()});break;case p.Sync:i.animationGroups.forEach(function(e){e.reset(),e.restart()});break;case p.NoSync:break;default:return void m.a.Error("Unknown animation group loading mode value '"+r+"'")}var d=i.animatables.length;this.LoadAssetContainer(e,t,i,function(e){e.mergeAnimationsTo(i,i.animatables.slice(d),o),e.dispose(),i.onAnimationFileImportedObservable.notifyObservers(i),a&&a(i)},s,c,l)}else m.a.Error("No scene available to load animations to")},P.ImportAnimationsAsync=function(e,i,r,o,a,s,t,c,n,l){return void 0===i&&(i=""),void 0===r&&(r=f.a.LastCreatedScene),void 0===o&&(o=!0),void 0===a&&(a=p.Clean),void 0===s&&(s=null),void 0===t&&(t=null),void 0===c&&(c=null),void 0===n&&(n=null),void 0===l&&(l=null),new Promise(function(t,n){P.ImportAnimations(e,i,r,o,a,s,function(e){t(e)},c,function(e,t,i){n(i||new Error(t))},l)})},P.NO_LOGGING=o.a.SCENELOADER_NO_LOGGING,P.MINIMAL_LOGGING=o.a.SCENELOADER_MINIMAL_LOGGING,P.SUMMARY_LOGGING=o.a.SCENELOADER_SUMMARY_LOGGING,P.DETAILED_LOGGING=o.a.SCENELOADER_DETAILED_LOGGING,P.OnPluginActivatedObservable=new r.c,P._registeredPlugins={},P._showingLoadingScreen=!1,P);function P(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s}),i.d(t,"b",function(){return o});var n=i(7),a=i(3),r=i(25),s={},o=(c.prototype.add=function(e){var t=e.getSimpleName();this.attached[t]?n.a.Warn("camera input of type "+t+" already exists on camera"):((this.attached[t]=e).camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedElement&&e.attachControl(this.attachedElement))},c.prototype.remove=function(e){for(var t in this.attached){var i=this.attached[t];i===e&&(i.detachControl(this.attachedElement),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},c.prototype.removeByType=function(e){for(var t in this.attached){var i=this.attached[t];i.getClassName()===e&&(i.detachControl(this.attachedElement),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},c.prototype._addCheckInputs=function(e){var t=this.checkInputs;return function(){t(),e()}},c.prototype.attachInput=function(e){this.attachedElement&&e.attachControl(this.attachedElement,this.noPreventDefault)},c.prototype.attachElement=function(e,t){if(void 0===t&&(t=!1),!this.attachedElement)for(var i in t=!r.a.ForceAttachControlToAlwaysPreventDefault&&t,this.attachedElement=e,this.noPreventDefault=t,this.attached)this.attached[i].attachControl(e,t)},c.prototype.detachElement=function(e,t){if(void 0===t&&(t=!1),this.attachedElement===e){for(var i in this.attached)this.attached[i].detachControl(e),t&&(this.attached[i].camera=null);this.attachedElement=null}},c.prototype.rebuildInputCheck=function(){for(var e in this.checkInputs=function(){},this.attached){var t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}},c.prototype.clear=function(){this.attachedElement&&this.detachElement(this.attachedElement,!0),this.attached={},this.attachedElement=null,this.checkInputs=function(){}},c.prototype.serialize=function(e){var t={};for(var i in this.attached){var n=this.attached[i],r=a.a.Serialize(n);t[n.getClassName()]=r}e.inputsmgr=t},c.prototype.parse=function(e){var t,i,n,r=e.inputsmgr;if(r)for(var o in this.clear(),r)(n=s[o])&&(t=r[o],i=a.a.Parse(function(){return new n},t,null),this.add(i));else for(var o in this.attached)(n=s[this.attached[o].getClassName()])&&(i=a.a.Parse(function(){return new n},e,null),this.remove(this.attached[o]),this.add(i))},c);function c(e){this.attached={},this.camera=e,this.checkInputs=function(){}}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(6),r=i(0),o=i(10),a=i(11),s=(c.prototype._prepare=function(){},c.prototype.getTriggerParameter=function(){return this._triggerParameter},c.prototype._executeCurrent=function(e){if(this._nextActiveAction._condition){var t=this._nextActiveAction._condition,i=this._actionManager.getScene().getRenderId();if(t._evaluationId===i){if(!t._currentResult)return}else{if(t._evaluationId=i,!t.isValid())return void(t._currentResult=!1);t._currentResult=!0}}this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction()},c.prototype.execute=function(e){},c.prototype.skipToNextActiveAction=function(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this},c.prototype.then=function(e){return(this._child=e)._actionManager=this._actionManager,e._prepare(),e},c.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},c.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},c.prototype.serialize=function(e){},c.prototype._serialize=function(e,t){var i={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(i),this._condition){var n=this._condition.seri
1alize();return n.children.push(i),t&&t.children.push(n),n}return t&&t.children.push(i),i},c._SerializeValueAsString=function(e){return"number"==typeof e?e.toString():"boolean"==typeof e?e?"true":"false":e instanceof r.d?e.x+", "+e.y:e instanceof r.e?e.x+", "+e.y+", "+e.z:e instanceof o.a?e.r+", "+e.g+", "+e.b:e instanceof o.b?e.r+", "+e.g+", "+e.b+", "+e.a:e},c._GetTargetProperty=function(e){return{name:"target",targetType:e._isMesh?"MeshProperties":e._isLight?"LightProperties":e._isCamera?"CameraProperties":"SceneProperties",value:e._isScene?"Scene":e.name}},c);function c(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new n.c,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,(this._nextActiveAction=this)._condition=t}a.a.RegisteredTypes["BABYLON.Action"]=s},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var f,n=i(1),m=i(6),_=i(13),g=i(0),v=i(9),r=i(133),b=i(134),y=i(2),o=(i(176),i(200),i(12)),a=(f=v.a,Object(n.d)(s,f),Object.defineProperty(s.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._renderList=e,this._renderList&&this._hookArray(this._renderList)},enumerable:!1,configurable:!0}),s.prototype._hookArray=function(r){var o=this,a=r.push;r.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=0===r.length,n=a.apply(r,e);return i&&o.getScene()&&o.getScene().meshes.forEach(function(e){e._markSubMeshesAsLightDirty()}),n};var n=r.splice;r.splice=function(e,t){var i=n.apply(r,[e,t]);return 0===r.length&&o.getScene().meshes.forEach(function(e){e._markSubMeshesAsLightDirty()}),i}},Object.defineProperty(s.prototype,"onAfterUnbind",{set:function(e){this._onAfterUnbindObserver&&this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=this.onAfterUnbindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onClear",{set:function(e){this._onClearObserver&&this.onClearObservable.remove(this._onClearObserver),this._onClearObserver=this.onClearObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"renderTargetOptions",{get:function(){return this._renderTargetOptions},enumerable:!1,configurable:!0}),s.prototype._onRatioRescale=function(){this._sizeRatio&&this.resize(this._initialSizeParameter)},Object.defineProperty(s.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){var t;this._boundingBoxSize&&this._boundingBoxSize.equals(e)||(this._boundingBoxSize=e,(t=this.getScene())&&t.markAllMaterialsAsDirty(y.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"depthStencilTexture",{get:function(){var e;return(null===(e=this.getInternalTexture())||void 0===e?void 0:e._depthStencilTexture)||null},enumerable:!1,configurable:!0}),s.prototype.createDepthStencilTexture=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=!0),void 0===i&&(i=!1);var n,r=this.getInternalTexture();this.getScene()&&r&&(n=this.getScene().getEngine(),r._depthStencilTexture=n.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:i,isCube:this.isCube}))},s.prototype._processSizeParameter=function(e){var t;e.ratio?(this._sizeRatio=e.ratio,t=this._getEngine(),this._size={width:this._bestReflectionRenderTargetDimension(t.getRenderWidth(),this._sizeRatio),height:this._bestReflectionRenderTargetDimension(t.getRenderHeight(),this._sizeRatio)}):this._size=e},Object.defineProperty(s.prototype,"samples",{get:function(){return this._samples},set:function(e){var t;this._samples===e||(t=this.getScene())&&(this._samples=t.getEngine().updateRenderTargetTextureSampleCount(this._texture,e))}
1,enumerable:!1,configurable:!0}),s.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},Object.defineProperty(s.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),s.prototype.addPostProcess=function(e){if(!this._postProcessManager){var t=this.getScene();if(!t)return;this._postProcessManager=new r.a(t),this._postProcesses=new Array}this._postProcesses.push(e),this._postProcesses[0].autoClear=!1},s.prototype.clearPostProcesses=function(e){if(void 0===e&&(e=!1),this._postProcesses){if(e)for(var t=0,i=this._postProcesses;t<i.length;t++)i[t].dispose();this._postProcesses=[]}},s.prototype.removePostProcess=function(e){var t;!this._postProcesses||-1!==(t=this._postProcesses.indexOf(e))&&(this._postProcesses.splice(t,1),0<this._postProcesses.length&&(this._postProcesses[0].autoClear=!1))},s.prototype._shouldRender=function(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},s.prototype.getRenderSize=function(){return this.getRenderWidth()},s.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},s.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},s.prototype.getRenderLayers=function(){return this._size.layers||0},Object.defineProperty(s.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),s.prototype.scale=function(e){var t=Math.max(1,this.getRenderSize()*e);this.resize(t)},s.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:f.prototype.getReflectionTextureMatrix.call(this)},s.prototype.resize=function(e){var t=this.isCube;this.releaseInternalTexture();var i=this.getScene();i&&(this._processSizeParameter(e),this._texture=t?i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},s.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),n=this.getScene()){var i,n,r=n.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var o=0;o<this._waitingRenderList.length;o++){var a=this._waitingRenderList[o],s=n.getMeshByID(a);s&&this.renderList.push(s)}delete this._waitingRenderList}if(this.renderListPredicate){if(this.renderList?this.renderList.length=0:this.renderList=[],!(n=this.getScene()))return;for(var c=n.meshes,o=0;o<c.length;o++){var l=c[o];this.renderListPredicate(l)&&this.renderList.push(l)}}if(this.onBeforeBindObservable.notifyObservers(this),this.activeCamera?(i=this.activeCamera,r.setViewport(this.activeCamera.viewport,this.getRenderWidth(),this.getRenderHeight()),this.activeCamera!==n.activeCamera&&n.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix(!0))):(i=n.activeCamera)&&r.setViewport(i.viewport,this.getRenderWidth(),this.getRenderHeight()),this._defaultRenderListPrepared=!1,this.is2DArray)for(var u=0;u<this.getRenderLayers();u++)this.renderToTarget(0,e,t,u,i),n.incrementRenderId(),n.resetCachedMaterial();else if(this.isCube)for(var h=0;h<6;h++)this.renderToTarget(h,e,t,void 0,i),n.incrementRenderId(),n.resetCachedMaterial();else this.renderToTarget(0,e,t,void 0,i);this.onAfterUnbindObservable.notifyObservers(this),n.activeCamera&&((1<n.getEngine().scenes.length||this.activeCamera&&this.activeCamera!==n.activeCamera)&&n.setTransformMatrix(n.activeCamera.getViewMatrix(),n.activeCamera.getProjectionMatrix(!0)),r.setViewport(n.activeCamera.viewport)),n.resetCachedMaterial()}},s.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=o.a.NearestPOT(i+16384/(128+i));return Math.min(o.a.FloorPOT(e),n)},s.prototype._prepareRenderingManager=function(e,t,i,n){var r=this.getScene();if(r){this._renderingManager.reset();for(var o=r.getRenderId(),a=0;a<t;a++){var s=e[a];if(s){if(this.customIsReadyFunction){if(!this.customIsReadyFunction(s,this.refreshRate)){this.resetRefreshCounter();continue}}else if(!s.isReady(0===this.refreshRate)){this.resetRefreshCounter();continue}s._preActivateForIntermediateRendering(o);var c=!(!n||!i)&&0==(s.layerMask&i.layerMask);if(s.isEnabled()&&s.isVisible&&s.subMeshes&&!c&&s._activate(o,!0)&&s.subMeshes.length){s.isA
1nInstance?s._internalAbstractMeshDataInfo._actAsRegularMesh||(s=s.sourceMesh):s._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!1,s._internalAbstractMeshDataInfo._isActiveIntermediate=!0;for(var l=0;l<s.subMeshes.length;l++){var u=s.subMeshes[l];this._renderingManager.dispatch(u,s)}}}}for(var h=0;h<r.particleSystems.length;h++){var d=r.particleSystems[h],p=d.emitter;d.isStarted()&&p&&p.position&&p.isEnabled()&&0<=e.indexOf(p)&&this._renderingManager.dispatchParticles(d)}}},s.prototype._bindFrameBuffer=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var i,n=this.getScene();n&&(i=n.getEngine(),this._texture&&i.bindFramebuffer(this._texture,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,0,t))},s.prototype.unbindFrameBuffer=function(e,t){var i=this;this._texture&&e.unBindFramebuffer(this._texture,this.isCube,function(){i.onAfterRenderObservable.notifyObservers(t)})},s.prototype.renderToTarget=function(e,t,i,n,r){void 0===n&&(n=0),void 0===r&&(r=null);var o=this.getScene();if(o){var a=o.getEngine();if(this._texture){this._postProcessManager?this._postProcessManager._prepareFrame(this._texture,this._postProcesses):t&&o.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(e,n),this.is2DArray?this.onBeforeRenderObservable.notifyObservers(n):this.onBeforeRenderObservable.notifyObservers(e);var s=null,c=this.renderList?this.renderList:o.getActiveMeshes().data,l=this.renderList?this.renderList.length:o.getActiveMeshes().length;this.getCustomRenderList&&(s=this.getCustomRenderList(this.is2DArray?n:e,c,l)),s?this._prepareRenderingManager(s,s.length,r,!1):(this._defaultRenderListPrepared||(this._prepareRenderingManager(c,l,r,!this.renderList),this._defaultRenderListPrepared=!0),s=c),this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(a):a.clear(this.clearColor||o.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||o.updateTransformMatrix(!0);for(var u=0,h=o._beforeRenderTargetDrawStage;u<h.length;u++)h[u].action(this);this._renderingManager.render(this.customRenderFunction,s,this.renderParticles,this.renderSprites);for(var d=0,p=o._afterRenderTargetDrawStage;d<p.length;d++)p[d].action(this);this._postProcessManager?this._postProcessManager._finalizeFrame(!1,this._texture,e,this._postProcesses,this.ignoreCameraViewport):t&&o.postProcessManager._finalizeFrame(!1,this._texture,e),this._doNotChangeAspectRatio||o.updateTransformMatrix(!0),i&&_.b.DumpFramebuffer(this.getRenderWidth(),this.getRenderHeight(),a),this.isCube&&5!==e?this.onAfterRenderObservable.notifyObservers(e):(this.isCube&&5===e&&a.generateMipMapsForCubemap(this._texture),this.unbindFrameBuffer(a,e))}}},s.prototype.setRenderingOrder=function(e,t,i,n){void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),this._renderingManager.setRenderingOrder(e,t,i,n)},s.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderingManager.setRenderingAutoClearDepthStencil(e,t),this._renderingManager._useSceneAutoClearSetup=!1},s.prototype.clone=function(){var e=this.getSize(),t=new s(this.name,e,this.getScene(),this._renderTargetOptions.generateMipMaps,this._doNotChangeAspectRatio,this._renderTargetOptions.type,this.isCube,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer,this._renderTargetOptions.generateStencilBuffer);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,this.renderList&&(t.renderList=this.renderList.slice(0)),t},s.prototype.serialize=function(){if(!this.name)return null;var e=f.prototype.serialize.call(this);if(e.renderTargetSize=this.getRenderSize(),e.renderList=[],this.renderList)for(var t=0;t<this.renderList.length;t++)e.renderList.push(this.renderList[t].id);return e},s.prototype.disposeFramebufferObjects=function(){var e=this.getInternalTexture(),t=this.getScene();e&&t&&t.getEngine()._releaseFramebufferObjects(e)},s.prototype.dispose=function(){this.onResizeObservable.clear(),this.onClearObservable.clear(),this.onAfterRenderObservable.clear(),this.onAfterUnbindObservable.clear(),this.onBeforeBindObservable.clear(),this.onBeforeRenderObservable.clear(),this._postProcessManager&&(this._postProcessManager.dispose(),this._postProcessManager=null),this.clearPostProcesses(!0),this._resizeObserver&&(this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.renderList=null;var e=this.getScene();if(e){var t=e.customRenderTargets.indexOf(this);0<=t&&e.customRenderTargets.splice(t,1);for(var i=0,n=e.cameras;i<n.length;i++){var r=n[i];0<=(t=r.customRenderTargets.indexOf(this))&&r.customRenderTargets.splice(t,1)}
1this.depthStencilTexture&&this.getScene().getEngine()._releaseTexture(this.depthStencilTexture),f.prototype.dispose.call(this)}},s.prototype._rebuild=function(){this.refreshRate===s.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=s.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},s.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},s.prototype.getViewCount=function(){return 1},s.REFRESHRATE_RENDER_ONCE=0,s.REFRESHRATE_RENDER_ONEVERYFRAME=1,s.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,s);function s(e,t,i,n,r,o,a,s,c,l,u,h,d){void 0===r&&(r=!0),void 0===o&&(o=y.a.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),void 0===s&&(s=v.a.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=!0),void 0===l&&(l=!1),void 0===u&&(u=!1),void 0===h&&(h=y.a.TEXTUREFORMAT_RGBA),void 0===d&&(d=!1);var p=f.call(this,null,i,!n)||this;return p.isCube=a,p.renderParticles=!0,p.renderSprites=!1,p.coordinatesMode=v.a.PROJECTION_MODE,p.ignoreCameraViewport=!1,p.onBeforeBindObservable=new m.c,p.onAfterUnbindObservable=new m.c,p.onBeforeRenderObservable=new m.c,p.onAfterRenderObservable=new m.c,p.onClearObservable=new m.c,p.onResizeObservable=new m.c,p._currentRefreshId=-1,p._refreshRate=1,p._samples=1,p.boundingBoxPosition=g.e.Zero(),(i=p.getScene())&&(p.renderList=new Array,p.name=e,p.isRenderTarget=!0,p._initialSizeParameter=t,p._processSizeParameter(t),p._resizeObserver=p.getScene().getEngine().onResizeObservable.add(function(){}),p._generateMipMaps=!!n,p._doNotChangeAspectRatio=r,p._renderingManager=new b.b(i),p._renderingManager._useSceneAutoClearSetup=!0,u||(p._renderTargetOptions={generateMipMaps:n,type:o,format:h,samplingMode:s,generateDepthBuffer:c,generateStencilBuffer:l},s===v.a.NEAREST_SAMPLINGMODE&&(p.wrapU=v.a.CLAMP_ADDRESSMODE,p.wrapV=v.a.CLAMP_ADDRESSMODE),d||(a?(p._texture=i.getEngine().createRenderTargetCubeTexture(p.getRenderSize(),p._renderTargetOptions),p.coordinatesMode=v.a.INVCUBIC_MODE,p._textureMatrix=g.a.Identity()):p._texture=i.getEngine().createRenderTargetTexture(p._size,p._renderTargetOptions)))),p}v.a._CreateRenderTargetTexture=function(e,t,i,n){return new a(e,t,i,n)}},function(e,t,i){"use strict";i.d(t,"a",function(){return o}),i.d(t,"b",function(){return a});var n,r=i(1),o=(c.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},c.prototype.forEach=function(e){for(var t=0;t<this.length;t++)e(this.data[t])},c.prototype.sort=function(e){this.data.sort(e)},c.prototype.reset=function(){this.length=0},c.prototype.dispose=function(){this.reset(),this.data&&(this.data.length=0,this.data=[])},c.prototype.concat=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++)this.data[this.length++]=(e.data||e)[t]}},c.prototype.indexOf=function(e){var t=this.data.indexOf(e);return t>=this.length?-1:t},c.prototype.contains=function(e){return-1!==this.indexOf(e)},c._GlobalId=0,c),a=(n=o,Object(r.d)(s,n),s.prototype.push=function(e){n.prototype.push.call(this,e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId},s.prototype.pushNoDuplicate=function(e){return!(e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId||(this.push(e),0))},s.prototype.reset=function(){n.prototype.reset.call(this),this._duplicateId++},s.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++){var i=(e.data||e)[t];this.pushNoDuplicate(i)}}},s);function s(){var e=null!==n&&n.apply(this,arguments)||this;return e._duplicateId=0,e}function c(e){this.length=0,this.data=new Array(e),this._id=c._GlobalId++}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.EndsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},r.StartsWith=function(e,t){return!!e&&0===e.indexOf(t)},r.Decode=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0;i<e.byteLength;i++)t+=String.fromCharCode(e[i]);return t},r.EncodeArrayBufferToBase64=function(e){for(var t,i,n,r,o,a,s,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/=",l="",u=0,h=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e);u<h.length;)r=(t=h[u++])>>2,o=(3&t)<<4|(i=u<h.length?h[u++]:Number.NaN)>>4,a=(15&i)<<2|(n=u<h.length?h[u++]:Number.NaN)>>6,s=63&n,isNaN(i)?a=s=64:isNaN(n)&&(s=64),l+=c.charAt(r)+c.charAt(o)+c.charAt(a)+c.charAt(s);return l},r.PadNumber=function(e,t){for(var i=String(e);i.length<t;)i="0"+i;return i},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.AddParser=function(e,t){this._BabylonFileParsers[e]=t},r.GetParser=function(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null},r.AddIndividualParser=function(e,t){this._IndividualBabylonFileParsers[e]=t},r.GetIndividualParser=function(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null},r.Parse=function(e,t,i,n){for(var r in this._BabylonFileParsers)this._BabylonFileParsers.hasOwnProperty(r)&&this._BabylonFileParsers[r](e,t,i,n)},r.prototype.getNodes=function(){var t=(t=(t=(t=(t=new Array).concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes);return this.skeletons.forEach(function(e){return t=t.concat(e.bones)}),t},r._BabylonFileParsers={},r._IndividualBabylonFileParsers={},r);function r(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this.environmentTexture=null}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(233),r=(o.EnableFor=function(t){t._tags=t._tags||{},t.hasTags=function(){return o.HasTags(t)},t.addTags=function(e){return o.AddTagsTo(t,e)},t.removeTags=function(e){return o.RemoveTagsFrom(t,e)},t.matchesTagsQuery=function(e){return o.MatchesQuery(t,e)}},o.DisableFor=function(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery},o.HasTags=function(e){if(!e._tags)return!1;var t=e._tags;for(var i in t)if(t.hasOwnProperty(i))return!0;return!1},o.GetTags=function(e,t){if(void 0===t&&(t=!0),!e._tags)return null;if(t){var i=[];for(var n in e._tags)e._tags.hasOwnProperty(n)&&!0===e._tags[n]&&i.push(n);return i.join(" ")}return e._tags},o.AddTagsTo=function(n,e){e&&"string"==typeof e&&e.split(" ").forEach(function(e,t,i){o._AddTagTo(n,e)})},o._AddTagTo=function(e,t){""!==(t=t.trim())&&"true"!==t&&"false"!==t&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(o.EnableFor(e),e._tags[t]=!0))},o.RemoveTagsFrom=function(e,t){if(o.HasTags(e)){var i=t.split(" ");for(var n in i)o._RemoveTagFrom(e,i[n])}},o._RemoveTagFrom=function(e,t){delete e._tags[t]},o.MatchesQuery=function(t,e){return void 0===e||(""===e?o.HasTags(t):n.a.Eval(e,function(e){return o.HasTags(t)&&t._tags[e]}))},o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.IsWindowObjectExist=function(){return"undefined"!=typeof window},r.IsNavigatorAvailable=function(){return"undefined"!=typeof navigator},r.IsDocumentAvailable=function(){return"undefined"!=typeof document},r.GetDOMTextContent=function(e){for(var t="",i=e.firstChild;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(50),S=i(0),u=i(66),p=i(165),r=i(18),o=i(25),c=(A.prototype.intersectsBoxMinMax=function(e,t,i){void 0===i&&(i=0);var n,r,o,a,s=A.TmpVector3[0].copyFromFloats(e.x-i,e.y-i,e.z-i),c=A.TmpVector3[1].copyFromFloats(t.x+i,t.y+i,t.z+i),l=0,u=Number.MAX_VALUE;if(Math.abs(this.direction.x)<1e-7){if(this.origin.x<s.x||this.origin.x>c.x)return!1}else if(n=1/this.direction.x,r=(s.x-this.origin.x)*n,(o=(c.x-this.origin.x)*n)==-1/0&&(o=1/0),o<r&&(a=r,r=o,o=a),(l=Math.max(r,l))>(u=Math.min(o,u)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.y<s.y||this.origin.y>c.y)return!1}else if(n=1/this.direction.y,r=(s.y-this.origin.y)*n,(o=(c.y-this.origin.y)*n)==-1/0&&(o=1/0),o<r&&(a=r,r=o,o=a),(l=Math.max(r,l))>(u=Math.min(o,u)))return!1;
1if(Math.abs(this.direction.z)<1e-7){if(this.origin.z<s.z||this.origin.z>c.z)return!1}else if(n=1/this.direction.z,r=(s.z-this.origin.z)*n,(o=(c.z-this.origin.z)*n)==-1/0&&(o=1/0),o<r&&(a=r,r=o,o=a),(l=Math.max(r,l))>(u=Math.min(o,u)))return!1;return!0},A.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},A.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r,a=e.radius+t,s=a*a;if(o<=s)return!0;var c=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(c<0)&&o-c*c<=s},A.prototype.intersectsTriangle=function(e,t,i){var n=A.TmpVector3[0],r=A.TmpVector3[1],o=A.TmpVector3[2],a=A.TmpVector3[3],s=A.TmpVector3[4];t.subtractToRef(e,n),i.subtractToRef(e,r),S.e.CrossToRef(this.direction,r,o);var c=S.e.Dot(n,o);if(0===c)return null;var l=1/c;this.origin.subtractToRef(e,a);var u=S.e.Dot(a,o)*l;if(u<0||1<u)return null;S.e.CrossToRef(a,n,s);var h=S.e.Dot(this.direction,s)*l;if(h<0||1<u+h)return null;var d=S.e.Dot(r,s)*l;return d>this.length?null:new p.a(1-u-h,u,d)},A.prototype.intersectsPlane=function(e){var t,i=S.e.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=S.e.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},A.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return 0<(i=(this.origin.y-t)/this.direction.y)?null:new S.e(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case"x":return 0<(i=(this.origin.x-t)/this.direction.x)?null:new S.e(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case"z":var i;return 0<(i=(this.origin.z-t)/this.direction.z)?null:new S.e(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},A.prototype.intersectsMesh=function(e,t){var i=S.c.Matrix[0];return e.getWorldMatrix().invertToRef(i),this._tmpRay?A.TransformToRef(this,i,this._tmpRay):this._tmpRay=A.Transform(this,i),e.intersects(this._tmpRay,t)},A.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;n<e.length;n++){var r=this.intersectsMesh(e[n],t);r.hit&&i.push(r)}return i.sort(this._comparePickingInfo),i},A.prototype._comparePickingInfo=function(e,t){return e.distance<t.distance?-1:e.distance>t.distance?1:0},A.prototype.intersectionSegment=function(e,t,i){var n=this.origin,r=S.c.Vector3[0],o=S.c.Vector3[1],a=S.c.Vector3[2],s=S.c.Vector3[3];t.subtractToRef(e,r),this.direction.scaleToRef(A.rayl,a),n.addToRef(a,o),e.subtractToRef(n,s);var c,l,u,h,d=S.e.Dot(r,r),p=S.e.Dot(r,a),f=S.e.Dot(a,a),m=S.e.Dot(r,s),_=S.e.Dot(a,s),g=d*f-p*p,v=g,b=g;g<A.smallnum?(l=0,v=1,h=_,b=f):(h=d*_-p*m,(l=p*_-f*m)<0?(l=0,h=_,b=f):v<l&&(l=v,h=_+p,b=f)),h<0?-m<(h=0)?l=0:d<-m?l=v:(l=-m,v=d):b<h&&(h=b,-m+p<0?l=0:d<-m+p?l=v:(l=-m+p,v=d)),c=Math.abs(l)<A.smallnum?0:l/v,u=Math.abs(h)<A.smallnum?0:h/b;var y=S.c.Vector3[4];a.scaleToRef(u,y);var T=S.c.Vector3[5];r.scaleToRef(c,T),T.addInPlace(s);var E=S.c.Vector3[6];return T.subtractToRef(y,E),0<u&&u<=this.length&&E.lengthSquared()<i*i?T.length():-1},A.prototype.update=function(e,t,i,n,r,o,a){return this.unprojectRayToRef(e,t,i,n,r,o,a),this},A.Zero=function(){return new A(S.e.Zero(),S.e.Zero())},A.CreateNew=function(e,t,i,n,r,o,a){return A.Zero().update(e,t,i,n,r,o,a)},A.CreateNewFromTo=function(e,t,i){void 0===i&&(i=S.a.IdentityReadOnly);var n=t.subtract(e),r=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z);return n.normalize(),A.Transform(new A(e,n,r),i)},A.Transform=function(e,t){var i=new A(new S.e(0,0,0),new S.e(0,0,0));return A.TransformToRef(e,t,i),i},A.TransformToRef=function(e,t,i){S.e.TransformCoordinatesToRef(e.origin,t,i.origin),S.e.TransformNormalToRef(e.direction,t,i.direction),i.length=e.length;var n,r=i.direction,o=r.length();0!==o&&1!==o&&(n=1/o,r.x*=n,r.y*=n,r.z*=n,i.length*=o)},A.prototype.unprojectRayToRef=function(e,t,i,n,r,o,a){var s=S.c.Matrix[0];r.multiplyToRef(o,s),s.multiplyToRef(a,s),s.invert();var c=S.c.Vector3[0];c.x=e/i*2-1,c.y=-(t/n*2-1),c.z=-1;var l=S.c.Vector3[1].copyFromFloats(c.x,c.y,1),u=S.c.Vector3[2],h=S.c.Vector3[3];S.e._UnprojectFromInvertedMatrixToRef(c,s,u),S.e._UnprojectFromInvertedMatrixToRef(l,s,h),this.origin.copyFrom(u),h.subtractToRef(u,this.direction),this.direction.normalize()},A.TmpVector3=n.a.BuildArray(6,S.e.Zero),A.smallnum=1e-8,A.rayl=1e9,A);function A(e,t,i){void 0===i&&(i=Number.MAX_VALUE),this.origin=e,this.direction=t,this.length=i}r.a.prototype.createPickingRay=function(e,t,i,n,r){void 0===r&&(r=!1);var o=c.Zero();return this.createPickingRayToRef(e,t,i,o,n,r),o},r.a.prototype.createPickingRayToRef=function(e,t,i,n,r,o){void 0===o&&(o=!1);var a=this.getEngine();if(!r){if(!this.activeCamera)return this;r=this.activeCamera}var s=r.viewport.toGlobal(a.getRenderWidth(),a.getRenderHeight());return e=e/a.getHardwareScalingLevel()-s.x,t=t/a.getHardwareScalingLevel()-(a.getRenderHeight()-s.y-s.height),n.update(e,t,s.width,s.height,i||S.a.IdentityReadOnly,o?S.a.IdentityReadOnly:r.getViewMatrix(),r.getProjectionMatrix()),this},r.a.prototype.createPickingRayInCameraSpace=function(e,t,i){var n=c.Zero();return this.createPickingRayInCameraSpaceToRef(e,t,n,i),n},r.a.prototype.createPickingRayInCameraSpaceToRef=function(e,t,i,n){if(!u.a)return this;var r=this.getEngine();
1if(!n){if(!this.activeCamera)throw new Error("Active camera not set");n=this.activeCamera}var o=n.viewport.toGlobal(r.getRenderWidth(),r.getRenderHeight()),a=S.a.Identity();return e=e/r.getHardwareScalingLevel()-o.x,t=t/r.getHardwareScalingLevel()-(r.getRenderHeight()-o.y-o.height),i.update(e,t,o.width,o.height,a,a,n.getProjectionMatrix()),this},r.a.prototype._internalPick=function(e,t,i,n,r){if(!u.a)return null;for(var o=null,a=0;a<this.meshes.length;a++){var s=this.meshes[a];if(t){if(!t(s))continue}else if(!s.isEnabled()||!s.isVisible||!s.isPickable)continue;var c=e(s.skeleton&&s.skeleton.overrideMesh?s.skeleton.overrideMesh.getWorldMatrix():s.getWorldMatrix()),l=s.intersects(c,i,r,n);if(l&&l.hit&&(i||null==o||!(l.distance>=o.distance))&&(o=l,i))break}return o||new u.a},r.a.prototype._internalMultiPick=function(e,t,i){if(!u.a)return null;for(var n=new Array,r=0;r<this.meshes.length;r++){var o=this.meshes[r];if(t){if(!t(o))continue}else if(!o.isEnabled()||!o.isVisible||!o.isPickable)continue;var a=e(o.getWorldMatrix()),s=o.intersects(a,!1,i);s&&s.hit&&n.push(s)}return n},r.a.prototype.pickWithBoundingInfo=function(t,i,e,n,r){var o=this;if(!u.a)return null;var a=this._internalPick(function(e){return o._tempPickingRay||(o._tempPickingRay=c.Zero()),o.createPickingRayToRef(t,i,e,o._tempPickingRay,r||null),o._tempPickingRay},e,n,!0);return a&&(a.ray=this.createPickingRay(t,i,S.a.Identity(),r||null)),a},r.a.prototype.pick=function(t,i,e,n,r,o){var a=this;if(!u.a)return null;var s=this._internalPick(function(e){return a._tempPickingRay||(a._tempPickingRay=c.Zero()),a.createPickingRayToRef(t,i,e,a._tempPickingRay,r||null),a._tempPickingRay},e,n,!1,o);return s&&(s.ray=this.createPickingRay(t,i,S.a.Identity(),r||null)),s},r.a.prototype.pickWithRay=function(t,e,i,n){var r=this,o=this._internalPick(function(e){return r._pickWithRayInverseMatrix||(r._pickWithRayInverseMatrix=S.a.Identity()),e.invertToRef(r._pickWithRayInverseMatrix),r._cachedRayForTransform||(r._cachedRayForTransform=c.Zero()),c.TransformToRef(t,r._pickWithRayInverseMatrix,r._cachedRayForTransform),r._cachedRayForTransform},e,i,!1,n);return o&&(o.ray=t),o},r.a.prototype.multiPick=function(t,i,e,n,r){var o=this;return this._internalMultiPick(function(e){return o.createPickingRay(t,i,e,n||null)},e,r)},r.a.prototype.multiPickWithRay=function(t,e,i){var n=this;return this._internalMultiPick(function(e){return n._pickWithRayInverseMatrix||(n._pickWithRayInverseMatrix=S.a.Identity()),e.invertToRef(n._pickWithRayInverseMatrix),n._cachedRayForTransform||(n._cachedRayForTransform=c.Zero()),c.TransformToRef(t,n._pickWithRayInverseMatrix,n._cachedRayForTransform),n._cachedRayForTransform},e,i)},o.a.prototype.getForwardRay=function(e,t,i){void 0===e&&(e=100),t=t||this.getWorldMatrix(),i=i||this.position;var n=this._scene.useRightHandedSystem?new S.e(0,0,-1):new S.e(0,0,1),r=S.e.TransformNormal(n,t),o=S.e.Normalize(r);return new c(i,o,e)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});function h(e,t){return!e||e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&"SubMesh"===e.getClassName()?e.clone(t):e.clone?e.clone():null}var d=i(41),p=i(7),n=(r.DeepCopy=function(e,t,i,n){for(var r=0,o=function(e){for(var t=[];Object.getOwnPropertyNames(e).forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),e=Object.getPrototypeOf(e););return t}(e);r<o.length;r++){var a=o[r];if(("_"!==a[0]||n&&-1!==n.indexOf(a))&&!(d.a.EndsWith(a,"Observable")||i&&-1!==i.indexOf(a))){var s=e[a],c=typeof s;if("function"!=c)try{if("object"==c)if(s instanceof Array){if(t[a]=[],0<s.length)if("object"==typeof s[0])for(var l=0;l<s.length;l++){var u=h(s[l],t);-1===t[a].indexOf(u)&&t[a].push(u)}else t[a]=s.slice(0)}else t[a]=h(s,t);else t[a]=s}catch(e){p.a.Warn(e.message)}}}},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(18),r=i(6),c=i(20),o=i(22),a=i(118),s=i(0),l=i(10),u=(h.prototype.getRenderCamera=function(e){if(this._renderCamera)return this._renderCamera;var t=1<this.originalScene.activeCameras.length?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera;return e&&t&&t.isRigCamera?t.rigParent:t},h.prototype.setRenderCamera=function(e){this._renderCamera=e},h.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new a.a("shared gizmo light",new s.e(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=l.a.Gray()),this._sharedGizmoLight},Object.defineProperty(h,"DefaultUtilityLayer",{get:function(){return null==h._DefaultUtilityLayer&&(h._DefaultUtilityLayer=new h(o.a.LastCreatedScene)).originalScene.onDisposeObservable.addOnce(function(){h._DefaultUtilityLayer=null}),h._DefaultUtilityLayer}
1,enumerable:!1,configurable:!0}),Object.defineProperty(h,"DefaultKeepDepthUtilityLayer",{get:function(){return null==h._DefaultKeepDepthUtilityLayer&&((h._DefaultKeepDepthUtilityLayer=new h(o.a.LastCreatedScene)).utilityLayerScene.autoClearDepthAndStencil=!1,h._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function(){h._DefaultKeepDepthUtilityLayer=null})),h._DefaultKeepDepthUtilityLayer},enumerable:!1,configurable:!0}),h.prototype._notifyObservers=function(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new c.b(e.type,e.event,t)),this._lastPointerEvents[i.pointerId]=!0)},h.prototype.render=function(){var e,t;this._updateCamera(),this.utilityLayerScene.activeCamera&&(e=this.utilityLayerScene.activeCamera.getScene(),(t=this.utilityLayerScene.activeCamera)._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))},h.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},h.prototype._updateCamera=function(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()},h._DefaultUtilityLayer=null,h._DefaultKeepDepthUtilityLayer=null,h);function h(a,e){var s=this;void 0===e&&(e=!0),this.originalScene=a,this._pointerCaptures={},this._lastPointerEvents={},this._sharedGizmoLight=null,this._renderCamera=null,this.pickUtilitySceneFirst=!0,this.shouldRender=!0,this.onlyCheckPointerDownEvents=!0,this.processAllEvents=!1,this.onPointerOutObservable=new r.c,this.utilityLayerScene=new n.a(a.getEngine(),{virtual:!0}),this.utilityLayerScene.useRightHandedSystem=a.useRightHandedSystem,this.utilityLayerScene._allowPostProcessClearColor=!1,this.utilityLayerScene.detachControl(),e&&(this._originalPointerObserver=a.onPrePointerObservable.add(function(e,t){if(s.utilityLayerScene.activeCamera&&(s.processAllEvents||e.type===c.a.POINTERMOVE||e.type===c.a.POINTERUP||e.type===c.a.POINTERDOWN||e.type===c.a.POINTERDOUBLETAP)){s.utilityLayerScene.pointerX=a.pointerX,s.utilityLayerScene.pointerY=a.pointerY;var i=e.event;if(a.isPointerCaptured(i.pointerId))s._pointerCaptures[i.pointerId]=!1;else{var n,r,o=e.ray?s.utilityLayerScene.pickWithRay(e.ray):s.utilityLayerScene.pick(a.pointerX,a.pointerY);if(!e.ray&&o&&(e.ray=o.ray),s.utilityLayerScene.onPrePointerObservable.notifyObservers(e),s.onlyCheckPointerDownEvents&&e.type!=c.a.POINTERDOWN)return e.skipOnPointerObservable||s.utilityLayerScene.onPointerObservable.notifyObservers(new c.b(e.type,e.event,o)),void(e.type===c.a.POINTERUP&&s._pointerCaptures[i.pointerId]&&(s._pointerCaptures[i.pointerId]=!1));s.utilityLayerScene.autoClearDepthAndStencil||s.pickUtilitySceneFirst?o&&o.hit&&(e.skipOnPointerObservable||s.utilityLayerScene.onPointerObservable.notifyObservers(new c.b(e.type,e.event,o)),e.skipOnPointerObservable=!0):(n=e.ray?a.pickWithRay(e.ray):a.pick(a.pointerX,a.pointerY),r=e.event,n&&o&&(0===o.distance&&n.pickedMesh?s.mainSceneTrackerPredicate&&s.mainSceneTrackerPredicate(n.pickedMesh)?(s._notifyObservers(e,n,r),e.skipOnPointerObservable=!0):e.type===c.a.POINTERDOWN?s._pointerCaptures[r.pointerId]=!0:s._lastPointerEvents[r.pointerId]&&(s.onPointerOutObservable.notifyObservers(r.pointerId),delete s._lastPointerEvents[r.pointerId]):!s._pointerCaptures[r.pointerId]&&(o.distance<n.distance||0===n.distance)?(s._notifyObservers(e,o,r),e.skipOnPointerObservable||(e.skipOnPointerObservable=0<o.distance)):!s._pointerCaptures[r.pointerId]&&o.distance>n.distance&&(s.mainSceneTrackerPredicate&&s.mainSceneTrackerPredicate(n.pickedMesh)?(s._notifyObservers(e,n,r),e.skipOnPointerObservable=!0):s._lastPointerEvents[r.pointerId]&&(s.onPointerOutObservable.notifyObservers(r.pointerId),delete s._lastPointerEvents[r.pointerId])),e.type===c.a.POINTERUP&&s._pointerCaptures[r.pointerId]&&(s._pointerCaptures[r.pointerId]=!1)))}}}),this._originalPointerObserver&&a.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterCameraRenderObservable.add(function(e){s.shouldRender&&e==s.getRenderCamera()&&s.render()}),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add(function(){s.dispose()}),this._updateCamera()}},function(e,t,i){"use strict";i.d(t,"b",function(){return l}),i.d(t,"a",function(){return d});var n,r=i(1),o=i(3),a=i(6),u=i(13),s=i(10),c=i(101),h=i(193),l=(n=c.a,Object(r.d)(f,n),f),d=(Object.defineProperty(p.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"colorGradingTexture",{get:function(){return this._colorGradingTexture},set:function(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"toneMappingType",{get:function(){return this._toneMappingType},set:function(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),p.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},p.prototype.getClassName=function(){return"ImageProcessingConfiguration"},p.PrepareUniforms=function(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),t.VIGNETTE&&(e.push("vInverseScreenSize"),e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&h.a.PrepareUniforms(e)},p.PrepareSamplers=function(e,t){t.COLORGRADING&&e.push("txColorTransform")},p.prototype.prepareDefines=function(e,t){if(void 0===t&&(t=!1),t!==this.applyByPostProcess||!this._isEnabled)return e.VIGNETTE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.IMAGEPROCESSING=!1,void(e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);switch(e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===p._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,e.TONEMAPPING=this.toneMappingEnabled,this._toneMappingType){case p.TONEMAPPING_ACES:e.TONEMAPPING_ACES=!0;break;default:e.TONEMAPPING_ACES=!1}e.CONTRAST=1!==this.contrast,e.EXPOSURE=1!==this.exposure,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.IMAGEPROCESSING=e.VIGNETTE||e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING},p.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},p.prototype.bind=function(e,t){var i,n,r,o,a,s,c,l;this._colorCurvesEnabled&&this.colorCurves&&h.a.Bind(this.colorCurves,e),this._vignetteEnabled&&(i=1/e.getEngine().getRenderWidth(),n=1/e.getEngine().getRenderHeight(),e.setFloat2("vInverseScreenSize",i,n),r=null!=t?t:n/i,a=(s=Math.tan(.5*this.vignetteCameraFov))*r,o=Math.sqrt(a*s),a=u.b.Mix(a,o,this.vignetteStretch),s=u.b.Mix(s,o,this.vignetteStretch),e.setFloat4("vignetteSettings1",a,s,-a*this.vignetteCentreX,-s*this.vignetteCentreY),c=-2*this.vignetteWeight,e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,c)),e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture&&(e.setTexture("txColorTransform",this.colorGradingTexture),l=this.colorGradingTexture.getSize().height,e.setFloat4("colorTransformSettings",(l-1)/l,.5/l,l,this.colorGradingTexture.level))},p.prototype.clone=function(){return o.a.Clone(function(){return new p},this)},p.prototype.serialize=function(){return o.a.Serialize(this)},p.Parse=function(e){return o.a.Parse(function(){return new p},e,null,null)},Object.defineProperty(p,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY}
1,enumerable:!1,configurable:!0}),Object.defineProperty(p,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!1,configurable:!0}),p.TONEMAPPING_STANDARD=0,p.TONEMAPPING_ACES=1,p._VIGNETTEMODE_MULTIPLY=0,p._VIGNETTEMODE_OPAQUE=1,Object(r.c)([Object(o.g)()],p.prototype,"colorCurves",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_colorCurvesEnabled",void 0),Object(r.c)([Object(o.m)("colorGradingTexture")],p.prototype,"_colorGradingTexture",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_colorGradingEnabled",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_colorGradingWithGreenDepth",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_colorGradingBGR",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_exposure",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_toneMappingEnabled",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_toneMappingType",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_contrast",void 0),Object(r.c)([Object(o.c)()],p.prototype,"vignetteStretch",void 0),Object(r.c)([Object(o.c)()],p.prototype,"vignetteCentreX",void 0),Object(r.c)([Object(o.c)()],p.prototype,"vignetteCentreY",void 0),Object(r.c)([Object(o.c)()],p.prototype,"vignetteWeight",void 0),Object(r.c)([Object(o.f)()],p.prototype,"vignetteColor",void 0),Object(r.c)([Object(o.c)()],p.prototype,"vignetteCameraFov",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_vignetteBlendMode",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_vignetteEnabled",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_applyByPostProcess",void 0),Object(r.c)([Object(o.c)()],p.prototype,"_isEnabled",void 0),p);function p(){this.colorCurves=new h.a,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=p.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCentreX=0,this.vignetteCentreY=0,this.vignetteWeight=1.5,this.vignetteColor=new s.b(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=p.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new a.c}function f(){var e=n.call(this)||this;return e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.rebuild(),e}o.a._ImageProcessingConfigurationParser=d.Parse},function(e,t,i){"use strict";i.d(t,"c",function(){return n}),i.d(t,"b",function(){return d}),i.d(t,"a",function(){return p});var n,r,o=i(1),a=i(6),s=i(0),c=i(45),l=i(22),u=i(57);(r=n=n||{})[r.VIVE=0]="VIVE",r[r.OCULUS=1]="OCULUS",r[r.WINDOWS=2]="WINDOWS",r[r.GEAR_VR=3]="GEAR_VR",r[r.DAYDREAM=4]="DAYDREAM",r[r.GENERIC=5]="GENERIC";var h,d=(m.InitiateController=function(e){for(var t=0,i=this._ControllerFactories;t<i.length;t++){var n=i[t];if(n.canCreate(e))return n.create(e)}if(this._DefaultControllerFactory)return this._DefaultControllerFactory(e);throw"The type of gamepad you are trying to load needs to be imported first or is not supported."},m._ControllerFactories=[],m._DefaultControllerFactory=null,m),p=(h=u.a,Object(o.d)(f,h),f.prototype._disableTrackPosition=function(e){this._trackPosition&&(this._calculatedPosition.copyFrom(e),this._trackPosition=!1)},f.prototype.update=function(){h.prototype.update.call(this),this._updatePoseAndMesh()},f.prototype._updatePoseAndMesh=function(){var e,t,i,n,r,o;this.isXR||(e=this.browserGamepad.pose,this.updateFromDevice(e),!this._trackPosition&&l.a.LastCreatedScene&&l.a.LastCreatedScene.activeCamera&&l.a.LastCreatedScene.activeCamera.devicePosition&&((t=l.a.LastCreatedScene.activeCamera)._computeDevicePosition(),this._deviceToWorld.setTranslation(t.devicePosition),t.deviceRotationQuaternion&&((t=t)._deviceRoomRotationQuaternion.toEulerAnglesToRef(s.c.Vector3[0]),i=Math.atan2(Math.sin(s.c.Vector3[0].y-this._draggedRoomRotation),Math.cos(s.c.Vector3[0].y-this._draggedRoomRotation)),Math.abs(i)>this._maxRotationDistFromHeadset&&(n=i-(i<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset),this._draggedRoomRotation+=n,r=Math.sin(-n),o=Math.cos(-n),this._calculatedPosition.x=this._calculatedPosition.x*o-this._calculatedPosition.z*r,this._calculatedPosition.z=this._calculatedPosition.x*r+this._calculatedPosition.z*o))),s.e.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),s.b.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion)))},f.prototype.updateFromDevice=function(e){var t;!this.isXR&&e&&((this.rawPose=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)),t=this.rawPose,e.orientation&&t.orientation&&4===t.orientation.length&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation)))},f.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 s.b),!this.isXR&&(this._updatePoseAndMesh(),this._pointingPoseNode)){for(var t=[],i=this._pointingPoseNode;i.parent;)t.push(i.parent),i=i.parent;
1t.reverse().forEach(function(e){e.computeWorldMatrix(!0)})}this._meshAttachedObservable.notifyObservers(e)},f.prototype.attachToPoseControlledCamera=function(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)},f.prototype.dispose=function(){this._mesh&&this._mesh.dispose(),this._mesh=null,h.prototype.dispose.call(this)},Object.defineProperty(f.prototype,"mesh",{get:function(){return this._mesh},enumerable:!1,configurable:!0}),f.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this.mesh)return new c.a(s.e.Zero(),new s.e(0,0,1),e);var t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),n=new s.e(0,0,-1),r=s.e.TransformNormal(n,t),o=s.e.Normalize(r);return new c.a(i,o,e)},f.POINTING_POSE="POINTING_POSE",f);function f(e){var t=h.call(this,e.id,e.index,e)||this;return t.isXR=!1,t._deviceRoomPosition=s.e.Zero(),t._deviceRoomRotationQuaternion=new s.b,t.devicePosition=s.e.Zero(),t.deviceRotationQuaternion=new s.b,t.deviceScaleFactor=1,t._trackPosition=!0,t._maxRotationDistFromHeadset=Math.PI/5,t._draggedRoomRotation=0,t._leftHandSystemQuaternion=new s.b,t._deviceToWorld=s.a.Identity(),t._pointingPoseNode=null,t._workingMatrix=s.a.Identity(),t._meshAttachedObservable=new a.c,t.type=u.a.POSE_ENABLED,t.controllerType=n.GENERIC,t.position=s.e.Zero(),t.rotationQuaternion=new s.b,t._calculatedPosition=s.e.Zero(),t._calculatedRotation=new s.b,s.b.RotationYawPitchRollToRef(Math.PI,0,0,t._leftHandSystemQuaternion),t}function m(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.BuildArray=function(e,t){for(var i=[],n=0;n<e;++n)i.push(t());return i},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var o,n=i(1),c=i(3),r=i(6),v=i(0),a=i(30),u=i(24),s=(o=a.a,Object(n.d)(b,o),Object.defineProperty(b.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"preserveParentRotationForBillboard",{get:function(){return this._preserveParentRotationForBillboard},set:function(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"infiniteDistance",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!1,configurable:!0}),b.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(b.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){(this._rotationQuaternion=e)&&this._rotation.setAll(0),this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"forward",{get:function(){return v.e.Normalize(v.e.TransformNormal(this.getScene().useRightHandedSystem?this._forwardInverted:this._forward,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"up",{get:function(){return v.e.Normalize(v.e.TransformNormal(this._up,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"right",{get:function(){return v.e.Normalize(v.e.TransformNormal(this.getScene().useRightHandedSystem?this._rightInverted:this._right,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),b.prototype.updatePoseMatrix=function(e){return this._poseMatrix?this._poseMatrix.copyFrom(e):this._poseMatrix=e.clone(),this},b.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=v.a.Identity()),this._poseMatrix},b.prototype._isSynchronized=function(){var e=this._cache;return!(this.billboardMode!==e.billboardMode||this.billboardMode!==b.BILLBOARDMODE_NONE||e.pivotMatrixUpdated||this.infiniteDistance||this.position._isDirty||this.scaling._isDirty||this._rotationQuaternion&&this._rotationQuaternion._isDirty||this.rotation._isDirty)},b.prototype._initCache=function(){o.prototype._initCache.call(this);var e=this._cache;e.localMatrixUpdated=!1,e.billboardMode=-1,e.infiniteDistance=!1},b.prototype.markAsDirty=function(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Object.defineProperty(b.prototype,"absolutePosition",{get:function(){return this._absolutePosition}
1,enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"absoluteScaling",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"absoluteRotationQuaternion",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion},enumerable:!1,configurable:!0}),b.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},b.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=v.a.Invert(this._pivotMatrix)),this},b.prototype.getPivotMatrix=function(){return this._pivotMatrix},b.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0);n&&i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r<o.length;r++)o[r].instantiateHierarchy(n,t,i);return n},b.prototype.freezeWorldMatrix=function(e){return void 0===e&&(e=null),e?this._worldMatrix=e:(this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0)),this._isDirty=!1,this._isWorldMatrixFrozen=!0,this},b.prototype.unfreezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this},Object.defineProperty(b.prototype,"isWorldMatrixFrozen",{get:function(){return this._isWorldMatrixFrozen},enumerable:!1,configurable:!0}),b.prototype.getAbsolutePosition=function(){return this.computeWorldMatrix(),this._absolutePosition},b.prototype.setAbsolutePosition=function(e){if(!e)return this;var t,i,n,r;if(void 0===e.x){if(arguments.length<3)return this;t=e,i=arguments[1],n=arguments[2]}else t=e.x,i=e.y,n=e.z;return this.parent?(r=v.c.Matrix[0],this.parent.getWorldMatrix().invertToRef(r),v.e.TransformCoordinatesFromFloatsToRef(t,i,n,r,this.position)):(this.position.x=t,this.position.y=i,this.position.z=n),this._absolutePosition.copyFrom(e),this},b.prototype.setPositionWithLocalVector=function(e){return this.computeWorldMatrix(),this.position=v.e.TransformNormal(e,this._localMatrix),this},b.prototype.getPositionExpressedInLocalSpace=function(){this.computeWorldMatrix();var e=v.c.Matrix[0];return this._localMatrix.invertToRef(e),v.e.TransformNormal(this.position,e)},b.prototype.locallyTranslate=function(e){return this.computeWorldMatrix(!0),this.position=v.e.TransformCoordinates(e,this._localMatrix),this},b.prototype.lookAt=function(e,t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=u.b.LOCAL);var o,a,s,c=b._lookAtVectorCache,l=r===u.b.LOCAL?this.position:this.getAbsolutePosition();return e.subtractToRef(l,c),this.setDirection(c,t,i,n),r===u.b.WORLD&&this.parent&&(this.rotationQuaternion?(o=v.c.Matrix[0],this.rotationQuaternion.toRotationMatrix(o),a=v.c.Matrix[1],this.parent.getWorldMatrix().getRotationMatrixToRef(a),a.invert(),o.multiplyToRef(a,o),this.rotationQuaternion.fromRotationMatrix(o)):(s=v.c.Quaternion[0],v.b.FromEulerVectorToRef(this.rotation,s),o=v.c.Matrix[0],s.toRotationMatrix(o),a=v.c.Matrix[1],this.parent.getWorldMatrix().getRotationMatrixToRef(a),a.invert(),o.multiplyToRef(a,o),s.fromRotationMatrix(o),s.toEulerAnglesToRef(this.rotation))),this},b.prototype.getDirection=function(e){var t=v.e.Zero();return this.getDirectionToRef(e,t),t},b.prototype.getDirectionToRef=function(e,t){return v.e.TransformNormalToRef(e,this.getWorldMatrix(),t),this},b.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?v.b.RotationYawPitchRollToRef(r+t,a+i,n,this.rotationQuaternion):(this.rotation.x=a+i,this.rotation.y=r+t,this.rotation.z=n),this},b.prototype.setPivotPoint=function(e,t){void 0===t&&(t=u.b.LOCAL),0==this.getScene().getRenderId()&&this.computeWorldMatrix(!0);var i,n=this.getWorldMatrix();return t==u.b.WORLD&&(i=v.c.Matrix[0],n.invertToRef(i),e=v.e.TransformCoordinates(e,i)),this.setPivotMatrix(v.a.Translation(-e.x,-e.y,-e.z),!0)},b.prototype.getPivotPoint=function(){var e=v.e.Zero();return this.getPivotPointToRef(e),e},b.prototype.getPivotPointToRef=function(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this},b.prototype.getAbsolutePivotPoint=function(){var e=v.e.Zero();return this.getAbsolutePivotPointToRef(e),e},b.prototype.getAbsolutePivotPointToRef=function(e){return this.getPivotPointToRef(e),v.e.TransformCoordinatesToRef(e,this.getWorldMatrix(),e),this},b.prototype.setParent=function(e){if(!e&&!this.parent)return this;var t,i,n=v.c.Quaternion[0],r=v.c.Vector3[0],o=v.c.Vector3[1];return e?(t=v.c.Matrix[0],i=v.c.Matrix[1],this.computeWorldMatrix(!0),e.computeWorldMatrix(!0),e.getWorldMatrix().invertToRef(i),this.getWorldMatrix().multiplyToRef(i,t),t.decompose(o,n,r)):(this.computeWorldMatrix(!0),this.getWorldMatrix().decompose(o,n,r)),this.rotationQuaternion?this.rotationQuaternion.copyFrom(n):n.toEulerAnglesToRef(this.rotation),this.scaling.copyFrom(o),this.position.copyFrom(r),this.parent=e,this},Object.defineProperty(b.prototype,"nonUniformScaling",{get:function(){return this._nonUniformScaling}
1,enumerable:!1,configurable:!0}),b.prototype._updateNonUniformScalingState=function(e){return this._nonUniformScaling!==e&&(this._nonUniformScaling=e,!0)},b.prototype.attachToBone=function(e,t){return this._transformToBoneReferal=t,(this.parent=e).getSkeleton().prepare(),e.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this},b.prototype.detachFromBone=function(){return this.parent&&(this.parent.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,this.parent=null),this},b.prototype.rotate=function(e,t,i){var n,r;return e.normalize(),this.rotationQuaternion||(this.rotationQuaternion=this.rotation.toQuaternion(),this.rotation.setAll(0)),i&&i!==u.b.LOCAL?(this.parent&&(r=v.c.Matrix[0],this.parent.getWorldMatrix().invertToRef(r),e=v.e.TransformNormal(e,r)),(n=v.b.RotationAxisToRef(e,t,b._rotationAxisCache)).multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)):(n=v.b.RotationAxisToRef(e,t,b._rotationAxisCache),this.rotationQuaternion.multiplyToRef(n,this.rotationQuaternion)),this},b.prototype.rotateAround=function(e,t,i){t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=v.b.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.setAll(0));var n=v.c.Vector3[0],r=v.c.Vector3[1],o=v.c.Vector3[2],a=v.c.Quaternion[0],s=v.c.Matrix[0],c=v.c.Matrix[1],l=v.c.Matrix[2],u=v.c.Matrix[3];return e.subtractToRef(this.position,n),v.a.TranslationToRef(n.x,n.y,n.z,s),v.a.TranslationToRef(-n.x,-n.y,-n.z,c),v.a.RotationAxisToRef(t,i,l),c.multiplyToRef(l,u),u.multiplyToRef(s,u),u.decompose(r,a,o),this.position.addInPlace(o),a.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this},b.prototype.translate=function(e,t,i){var n,r=e.scale(t);return i&&i!==u.b.LOCAL?this.setAbsolutePosition(this.getAbsolutePosition().add(r)):(n=this.getPositionExpressedInLocalSpace().add(r),this.setPositionWithLocalVector(n)),this},b.prototype.addRotation=function(e,t,i){var n;this.rotationQuaternion?n=this.rotationQuaternion:(n=v.c.Quaternion[1],v.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,n));var r=v.c.Quaternion[0];return v.b.RotationYawPitchRollToRef(t,e,i,r),n.multiplyInPlace(r),this.rotationQuaternion||n.toEulerAnglesToRef(this.rotation),this},b.prototype._getEffectiveParent=function(){return this.parent},b.prototype.computeWorldMatrix=function(e){if(this._isWorldMatrixFrozen&&!this._isDirty)return this._worldMatrix;var t=this.getScene().getRenderId();if(!this._isDirty&&!e&&this.isSynchronized())return this._currentRenderId=t,this._worldMatrix;var i=this.getScene().activeCamera,n=0!=(this._billboardMode&b.BILLBOARDMODE_USE_POSITION),r=this._billboardMode!==b.BILLBOARDMODE_NONE&&!this.preserveParentRotationForBillboard;r&&i&&n&&(this.lookAt(i.position),(this.billboardMode&b.BILLBOARDMODE_X)!==b.BILLBOARDMODE_X&&(this.rotation.x=0),(this.billboardMode&b.BILLBOARDMODE_Y)!==b.BILLBOARDMODE_Y&&(this.rotation.y=0),(this.billboardMode&b.BILLBOARDMODE_Z)!==b.BILLBOARDMODE_Z&&(this.rotation.z=0)),this._updateCache();var o=this._cache;o.pivotMatrixUpdated=!1,o.billboardMode=this.billboardMode,o.infiniteDistance=this.infiniteDistance,this._currentRenderId=t,this._childUpdateId++,this._isDirty=!1,this._position._isDirty=!1,this._rotation._isDirty=!1,this._scaling._isDirty=!1;var a,s,c,l,u,h,d,p,f,m=this._getEffectiveParent(),_=b._TmpScaling,g=this._position;return this._infiniteDistance&&!this.parent&&i&&(s=i.getWorldMatrix(),c=new v.e(s.m[12],s.m[13],s.m[14]),(g=b._TmpTranslation).copyFromFloats(this._position.x+c.x,this._position.y+c.y,this._position.z+c.z)),_.copyFromFloats(this._scaling.x*this.scalingDeterminant,this._scaling.y*this.scalingDeterminant,this._scaling.z*this.scalingDeterminant),this._rotationQuaternion?(this._rotationQuaternion._isDirty=!1,a=this._rotationQuaternion,this.reIntegrateRotationIntoRotationQuaternion&&this.rotation.lengthSquared()&&(this._rotationQuaternion.multiplyInPlace(v.b.RotationYawPitchRoll(this._rotation.y,this._rotation.x,this._rotation.z)),this._rotation.copyFromFloats(0,0,0))):(a=b._TmpRotation,v.b.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,a)),this._usePivotMatrix?(l=v.c.Matrix[1],v.a.ScalingToRef(_.x,_.y,_.z,l),u=v.c.Matrix[0],a.toRotationMatrix(u),this._pivotMatrix.multiplyToRef(l,v.c.Matrix[4]),v.c.Matrix[4].multiplyToRef(u,this._localMatrix),this._postMultiplyPivotMatrix&&this._localMatrix.multiplyToRef(this._pivotMatrixInverse,this._localMatrix),this._localMatrix.addTranslationFromFloats(g.x,g.y,g.z)):v.a.ComposeToRef(_,a,g,this._localMatrix),m&&m.getWorldMatrix?(e&&m.computeWorldMatrix(),r?(this._transformToBoneReferal?m.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),v.c.Matrix[7]):v.c.Matrix[7].copyFrom(m.getWorldMatrix()),h=v.c.Vector3[5],d=v.c.Vector3[6],v.c.Matrix[7].decompose(d,void 0,h),v.a.ScalingToRef(d.x,d.y,d.z,v.c.Matrix[7]),v.c.Matrix[7].setTranslation(h),this._localMatrix.multiplyToRef(v.c.Matrix[7],this._worldMatrix)):this._transformToBoneReferal?(this._localMatrix.multiplyToRef(m.getWorldMatrix(),v.c.Matrix[6]),v.c.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)):this._localMatrix.multiplyToRef(m.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()):this._worldMatrix.copyFrom(this._localMatrix),r&&i&&this.billboardMode&&!n&&(p=v.c.Vector3[0],this._worldMatrix.getTranslationToRef(p),v.c.Matrix[1].copyFrom(i.getViewMatrix()),v.c.Matrix[1].setTranslationFromFloats(0,0,0),v.c.Matrix[1].invertToRef(v.c.Matrix[0]),(this.billboardMode&b.BILLBOARDMODE_ALL)!==b.BILLBOARDMODE_ALL&&(v.c.Matrix[0].decompose(void 0,v.c.Quaternion[0],void 0),f=v.c.Vector3[1],v.c.Quaternion[0].toEulerAnglesToRef(f),(this.billboardMode&b.BILLBOARDMODE_X)!==b.BILLBOARDMODE_X&&(f.x=0),(this.billboardMode&b.BILLBOARDMODE_Y)!==b.BILLBOARDMODE_Y&&(f.y=0),(this.billboardMode&b.BILLBOARDMODE_Z)!==b.BILLBOARDMODE_Z&&(f.z=0),v.a.RotationYawPitchRollToRef(f.y,f.x,f.z,v.c.Matrix[0])),this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(v.c.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(v.c.Vector3[0])),this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this._scaling.isNonUniformWithinEpsilon(1e-6)?this._updateNonUniformScalingState(!0):m&&m._nonUniformScaling?this._updateNonUniformScalingState(m._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._isAbsoluteSynced=!1,this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=v.a.Invert(this._worldMatrix)),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix},b.prototype.resetLocalMatrix=function(e){if(void 0===e&&(e=!0),this.computeWorldMatrix(),e)for(var t=this.getChildren(),i=0;i<t.length;++i){var n,r,o=t[i];o&&(o.computeWorldMatrix(),n=v.c.Matrix[0],o._localMatrix.multiplyToRef(this._localMatrix,n),r=v.c.Quaternion[0],n.decompose(o.scaling,r,o.position),o.rotationQuaternion?o.rotationQuaternion=r:r.toEulerAnglesToRef(o.rotation))}this.scaling.copyFromFloats(1,1,1),this.position.copyFromFloats(0,0,0),this.rotation.copyFromFloats(0,0,0),this.rotationQuaternion&&(this.rotationQuaternion=v.b.Identity()),this._worldMatrix=v.a.Identity()},b.prototype._afterComputeWorldMatrix=function(){},b.prototype.registerAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.add(e),this},b.prototype.unregisterAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.removeCallback(e),this},b.prototype.getPositionInCameraSpace=function(e){return void 0===e&&(e=null),e=e||this.get
1Scene().activeCamera,v.e.TransformCoordinates(this.getAbsolutePosition(),e.getViewMatrix())},b.prototype.getDistanceToCamera=function(e){return void 0===e&&(e=null),e=e||this.getScene().activeCamera,this.getAbsolutePosition().subtract(e.globalPosition).length()},b.prototype.clone=function(e,t,i){var n=this,r=c.a.Clone(function(){return new b(e,n.getScene())},this);if(r.name=e,r.id=e,t&&(r.parent=t),!i)for(var o=this.getDescendants(!0),a=0;a<o.length;a++){var s=o[a];s.clone&&s.clone(e+"."+s.name,r)}return r},b.prototype.serialize=function(e){var t=c.a.Serialize(this,e);return t.type=this.getClassName(),this.parent&&(t.parentId=this.parent.id),t.localMatrix=this.getPivotMatrix().asArray(),t.isEnabled=this.isEnabled(),this.parent&&(t.parentId=this.parent.id),t},b.Parse=function(e,t,i){var n=c.a.Parse(function(){return new b(e.name,t)},e,t,i);return e.localMatrix?n.setPreTransformMatrix(v.a.FromArray(e.localMatrix)):e.pivotMatrix&&n.setPivotMatrix(v.a.FromArray(e.pivotMatrix)),n.setEnabled(e.isEnabled),e.parentId&&(n._waitingParentId=e.parentId),n},b.prototype.getChildTransformNodes=function(e,t){var i=[];return this._getDescendants(i,e,function(e){return(!t||t(e))&&e instanceof b}),i},b.prototype.dispose=function(e,t){if(void 0===t&&(t=!1),this.get
1Scene().stopAnimation(this),this.getScene().removeTransformNode(this),this.onAfterWorldMatrixUpdateObservable.clear(),e)for(var i=0,n=this.getChildTransformNodes(!0);i<n.length;i++){var r=n[i];r.parent=null,r.computeWorldMatrix(!0)}o.prototype.dispose.call(this,e,t)},b.prototype.normalizeToUnitCube=function(e,t,i){void 0===e&&(e=!0),void 0===t&&(t=!1);var n=null,r=null;t&&(this.rotationQuaternion?(r=this.rotationQuaternion.clone(),this.rotationQuaternion.copyFromFloats(0,0,0,1)):this.rotation&&(n=this.rotation.clone(),this.rotation.copyFromFloats(0,0,0)));var o=this.getHierarchyBoundingVectors(e,i),a=o.max.subtract(o.min),s=Math.max(a.x,a.y,a.z);if(0===s)return this;var c=1/s;return this.scaling.scaleInPlace(c),t&&(this.rotationQuaternion&&r?this.rotationQuaternion.copyFrom(r):this.rotation&&n&&this.rotation.copyFrom(n)),this},b.prototype._syncAbsoluteScalingAndRotation=function(){this._isAbsoluteSynced||(this._worldMatrix.decompose(this._absoluteScaling,this._absoluteRotationQuaternion),this._isAbsoluteSynced=!0)},b.BILLBOARDMODE_NONE=0,b.BILLBOARDMODE_X=1,b.BILLBOARDMODE_Y=2,b.BILLBOARDMODE_Z=4,b.BILLBOARDMODE_ALL=7,b.BILLBOARDMODE_USE_POSITION=128,b._TmpRotation=v.b.Zero(),b._TmpScaling=v.e.Zero(),b._TmpTranslation=v.e.Zero(),b._lookAtVectorCache=new v.e(0,0,0),b._rotationAxisCache=new v.b,Object(n.c)([Object(c.o)("position")],b.prototype,"_position",void 0),Object(n.c)([Object(c.o)("rotation")],b.prototype,"_rotation",void 0),Object(n.c)([Object(c.l)("rotationQuaternion")],b.prototype,"_rotationQuaternion",void 0),Object(n.c)([Object(c.o)("scaling")],b.prototype,"_scaling",void 0),Object(n.c)([Object(c.c)("billboardMode")],b.prototype,"_billboardMode",void 0),Object(n.c)([Object(c.c)()],b.prototype,"scalingDeterminant",void 0),Object(n.c)([Object(c.c)("infiniteDistance")],b.prototype,"_infiniteDistance",void 0),Object(n.c)([Object(c.c)()],b.prototype,"ignoreNonUniformScaling",void 0),Object(n.c)([Object(c.c)()],b.prototype,"reIntegrateRotationIntoRotationQuaternion",void 0),b);function b(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0);var n=o.call(this,e,t)||this;return n._forward=new v.e(0,0,1),n._forwardInverted=new v.e(0,0,-1),n._up=new v.e(0,1,0),n._right=new v.e(1,0,0),n._rightInverted=new v.e(-1,0,0),n._position=v.e.Zero(),n._rotation=v.e.Zero(),n._rotationQuaternion=null,n._scaling=v.e.One(),n._isDirty=!1,n._transformToBoneReferal=null,n._isAbsoluteSynced=!1,n._billboardMode=b.BILLBOARDMODE_NONE,n._preserveParentRotationForBillboard=!1,n.scalingDeterminant=1,n._infiniteDistance=!1,n.ignoreNonUniformScaling=!1,n.reIntegrateRotationIntoRotationQuaternion=!1,n._poseMatrix=null,n._localMatrix=v.a.Zero(),n._usePivotMatrix=!1,n._absolutePosition=v.e.Zero(),n._absoluteScaling=v.e.Zero(),n._absoluteRotationQuaternion=v.b.Identity(),n._pivotMatrix=v.a.Identity(),n._postMultiplyPivotMatrix=!1,n._isWorldMatrixFrozen=!1,n._indexInSceneTransformNodesArray=-1,n.onAfterWorldMatrixUpdateObservable=new r.c,n._nonUniformScaling=!1,i&&n.getScene().addTransformNode(n),n}},function(e,t,i){"use strict";i.d(t,"a",function(){return d});function n(e,t,i){var n=a.e.Dot(t.centerWorld,e),r=Math.abs(a.e.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(a.e.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(a.e.Dot(t.directions[2],e))*t.extendSize.z;i.min=n-r,i.max=n+r}function r(e,t,i){return n(e,t,u),n(e,i,h),!(h.max<u.min||u.max<h.min)}var o=i(50),a=i(0),s=i(2),c=i(155),l=i(164),u={min:0,max:0},h={min:0,max:0},d=(p.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(p.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!1,configurable:!0}),p.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},p.prototype.centerOn=function(e,t){var i=p.TmpVector3[0].copyFrom(e).subtractInPlace(t),n=p.TmpVector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,n,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(i,n,this.boundingBox.getWorldMatrix()),this},p.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},p.prototype.isInFrustum=function(e,t){return void 0===t&&(t=s.a.MESHES_CULLINGSTRATEGY_STANDARD),!(t!==s.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION&&t!==s.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY||!this.boundingSphere.isCenterInFrustum(e))||
1!!this.boundingSphere.isInFrustum(e)&&(!(t!==s.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY&&t!==s.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY)||this.boundingBox.isInFrustum(e))},Object.defineProperty(p.prototype,"diagonalLength",{get:function(){var e=this.boundingBox;return e.maximumWorld.subtractToRef(e.minimumWorld,p.TmpVector3[0]).length()},enumerable:!1,configurable:!0}),p.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},p.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},p.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e)},p.prototype.intersects=function(e,t){if(!l.a.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!c.a.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,n=e.boundingBox;return!!(r(i.directions[0],i,n)&&r(i.directions[1],i,n)&&r(i.directions[2],i,n)&&r(n.directions[0],i,n)&&r(n.directions[1],i,n)&&r(n.directions[2],i,n)&&r(a.e.Cross(i.directions[0],n.directions[0]),i,n)&&r(a.e.Cross(i.directions[0],n.directions[1]),i,n)&&r(a.e.Cross(i.directions[0],n.directions[2]),i,n)&&r(a.e.Cross(i.directions[1],n.directions[0]),i,n)&&r(a.e.Cross(i.directions[1],n.directions[1]),i,n)&&r(a.e.Cross(i.directions[1],n.directions[2]),i,n)&&r(a.e.Cross(i.directions[2],n.directions[0]),i,n)&&r(a.e.Cross(i.directions[2],n.directions[1]),i,n)&&r(a.e.Cross(i.directions[2],n.directions[2]),i,n))},p.TmpVector3=o.a.BuildArray(2,a.e.Zero),p);function p(e,t,i){this._isLocked=!1,this.boundingBox=new c.a(e,t,i),this.boundingSphere=new l.a(e,t,i)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.CreateNew=function(e,t,i){var n=e.getScene();return new r(e,n.pointerX,n.pointerY,n.meshUnderPointer||e,t,i)},r.CreateNewFromSprite=function(e,t,i,n){return new r(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,n)},r.CreateNewFromScene=function(e,t){return new r(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)},r.CreateNewFromPrimitive=function(e,t,i,n){return new r(e,t.x,t.y,null,i,n)},r);function r(e,t,i,n,r,o){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=n,this.sourceEvent=r,this.additionalData=o}},function(e,t,i){"use strict";var n,r,o,a,s,c,l,u,h,d;i.d(t,"a",function(){return n}),i.d(t,"c",function(){return r}),i.d(t,"b",function(){return o}),i.d(t,"e",function(){return a}),i.d(t,"d",function(){return s}),(d=n=n||{})[d.Generic=0]="Generic",d[d.Keyboard=1]="Keyboard",d[d.Mouse=2]="Mouse",d[d.Touch=3]="Touch",d[d.DualShock=4]="DualShock",d[d.Xbox=5]="Xbox",d[d.Switch=6]="Switch",(h=r=r||{})[h.Horizontal=0]="Horizontal",h[h.Vertical=1]="Vertical",h[h.LeftClick=2]="LeftClick",h[h.MiddleClick=3]="MiddleClick",h[h.RightClick=4]="RightClick",h[h.BrowserBack=5]="BrowserBack",h[h.BrowserForward=6]="BrowserForward",(u=o=o||{})[u.Cross=0]="Cross",u[u.Circle=1]="Circle",u[u.Square=2]="Square",u[u.Triangle=3]="Triangle",u[u.L1=4]="L1",u[u.R1=5]="R1",u[u.L2=6]="L2",u[u.R2=7]="R2",u[u.Share=8]="Share",u[u.Options=9]="Options",u[u.L3=10]="L3",u[u.R3=11]="R3",u[u.DPadUp=12]="DPadUp",u[u.DPadDown=13]="DPadDown",u[u.DPadLeft=14]="DPadLeft",u[u.DPadRight=15]="DPadRight",u[u.Home=16]="Home",u[u.TouchPad=17]="TouchPad",u[u.LStickXAxis=18]="LStickXAxis",u[u.LStickYAxis=19]="LStickYAxis",u[u.RStickXAxis=20]="RStickXAxis",u[u.RStickYAxis=21]="RStickYAxis",(l=a=a||{})[l.A=0]="A",l[l.B=1]="B",l[l.X=2]="X",l[l.Y=3]="Y",l[l.LB=4]="LB",l[l.RB=5]="RB",l[l.LT=6]="LT",l[l.RT=7]="RT",l[l.Back=8]="Back",l[l.Start=9]="Start",l[l.LS=10]="LS",l[l.RS=11]="RS",l[l.DPadUp=12]="DPadUp",l[l.DPadDown=13]="DPadDown",l[l.DPadLeft=14]="DPadLeft",l[l.DPadRight=15]="DPadRight",l[l.Home=16]="Home",l[l.LStickXAxis=17]="LStickXAxis",l[l.LStickYAxis=18]="LStickYAxis",l[l.RStickXAxis=19]="RStickXAxis",l[l.RStickYAxis=20]="RStickYAxis",(c=s=s||{})[c.B=0]="B",c[c.A=1]="A",c[c.Y=2]="Y",c[c.X=3]="X",c[c.L=4]="L",c[c.R=5]="R",c[c.ZL=6]="ZL",c[c.ZR=7]="ZR",c[c.Minus=8]="Minus",c[c.Plus=9]="Plus",c[c.LS=10]="LS",c[c.RS=11]="RS",c[c.DPadUp=12]="DPadUp",c[c.DPadDown=13]="DPadDown",c[c.DPadLeft=14]="DPadLeft",c[c.DPadRight=15]="DPadRight",c[c.Home=16]="Home",c[c.Capture=17]="Capture",c[c.LStickXAxis=18]="LStickXAxis",c[c.LStickYAxis=19]="LStickYAxis",c[c.RStickXAxis=20]="RStickXAxis",c[c.RStickYAxis=21]="RStickYAxis"},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype._injectCustomRequestHeaders=function(){for(var e in r.CustomRequestHeaders){var t=r.CustomRequestHeaders[e];t&&this._xhr.setRequestHeader(e,t)}}
1,Object.defineProperty(r.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"status",{get:function(){return this._xhr.status},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"response",{get:function(){return this._xhr.response},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!1,configurable:!0}),r.prototype.addEventListener=function(e,t,i){this._xhr.addEventListener(e,t,i)},r.prototype.removeEventListener=function(e,t,i){this._xhr.removeEventListener(e,t,i)},r.prototype.abort=function(){this._xhr.abort()},r.prototype.send=function(e){r.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(e)},r.prototype.open=function(e,t){for(var i=0,n=r.CustomRequestModifiers;i<n.length;i++)(0,n[i])(this._xhr,t);return t=(t=t.replace("file:http:","http:")).replace("file:https:","https:"),this._xhr.open(e,t,!0)},r.prototype.setRequestHeader=function(e,t){this._xhr.setRequestHeader(e,t)},r.prototype.getResponseHeader=function(e){return this._xhr.getResponseHeader(e)},r.CustomRequestHeaders={},r.CustomRequestModifiers=new Array,r);function r(){this._xhr=new XMLHttpRequest}},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return r});var n=(o.ANCHOR_SYSTEM="xr-anchor-system",o.BACKGROUND_REMOVER="xr-background-remover",o.HIT_TEST="xr-hit-test",o.PHYSICS_CONTROLLERS="xr-physics-controller",o.PLANE_DETECTION="xr-plane-detection",o.POINTER_SELECTION="xr-controller-pointer-selection",o.TELEPORTATION="xr-controller-teleportation",o),r=(c.AddWebXRFeature=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1),this._AvailableFeatures[e]=this._AvailableFeatures[e]||{latest:i},i>this._AvailableFeatures[e].latest&&(this._AvailableFeatures[e].latest=i),n&&(this._AvailableFeatures[e].stable=i),this._AvailableFeatures[e][i]=t},c.ConstructFeature=function(e,t,i,n){void 0===t&&(t=1);var r=this._AvailableFeatures[e][t];if(!r)throw new Error("feature not found");return r(i,n)},c.GetAvailableFeatures=function(){return Object.keys(this._AvailableFeatures)},c.GetAvailableVersions=function(e){return Object.keys(this._AvailableFeatures[e])},c.GetLatestVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].latest||-1},c.GetStableVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].stable||-1},c.prototype.attachFeature=function(e){var t=this._features[e];t&&t.enabled&&!t.featureImplementation.attached&&t.featureImplementation.attach()},c.prototype.detachFeature=function(e){var t=this._features[e];t&&t.featureImplementation.attached&&t.featureImplementation.detach()},c.prototype.disableFeature=function(e){var t="string"==typeof e?e:e.Name,i=this._features[t];return!(!i||!i.enabled||(i.enabled=!1,this.detachFeature(t),i.featureImplementation.dispose(),0))},c.prototype.dispose=function(){var t=this;this.getEnabledFeatures().forEach(function(e){t.disableFeature(e),t._features[e].featureImplementation.dispose()})},c.prototype.enableFeature=function(e,t,i,n){void 0===t&&(t="latest"),void 0===i&&(i={}),void 0===n&&(n=!0);var r="string"==typeof e?e:e.Name,o=0;if("string"==typeof t){if(!t)throw new Error("Error in provided version - "+r+" ("+t+")");if(-1===(o="stable"===t?c.GetStableVersionOfFeature(r):"latest"===t?c.GetLatestVersionOfFeature(r):+t)||isNaN(o))throw new Error("feature not found - "+r+" ("+t+")")}else o=t;
1var a=this._features[r],s=c.ConstructFeature(r,o,this._xrSessionManager,i);if(!s)throw new Error("feature not found - "+r);return a&&this.disableFeature(r),this._features[r]={featureImplementation:s(),enabled:!0,version:o},n?this._xrSessionManager.session&&!a.featureImplementation.attached&&this.attachFeature(r):this._features[r].featureImplementation.disableAutoAttach=!0,this._features[r].featureImplementation},c.prototype.getEnabledFeature=function(e){return this._features[e]&&this._features[e].featureImplementation},c.prototype.getEnabledFeatures=function(){return Object.keys(this._features)},c._AvailableFeatures={},c);function c(e){var i=this;this._xrSessionManager=e,this._features={},this._xrSessionManager.onXRSessionInit.add(function(){i.getEnabledFeatures().forEach(function(e){var t=i._features[e];!t.enabled||t.featureImplementation.attached||t.featureImplementation.disableAutoAttach||i.attachFeature(e)})}),this._xrSessionManager.onXRSessionEnded.add(function(){i.getEnabledFeatures().forEach(function(e){var t=i._features[e];t.enabled&&t.featureImplementation.attached&&i.detachFeature(e)})})}function o(){}},function(e,t,i){"use strict";i.d(t,"c",function(){return a}),i.d(t,"a",function(){return s}),i.d(t,"b",function(){return c});var r,n=i(1),o=i(6),a=function(e,t){this.x=e,this.y=t},s=(Object.defineProperty(u.prototype,"isConnected",{get:function(){return this._isConnected},enumerable:!1,configurable:!0}),u.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},u.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(u.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:!1,configurable:!0}),Object.defineProperty(u.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:!1,configurable:!0}),u.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]})},u.prototype.dispose=function(){},u.GAMEPAD=0,u.GENERIC=1,u.XBOX=2,u.POSE_ENABLED=3,u.DUALSHOCK=4,u),c=(r=s,Object(n.d)(l,r),l.prototype.onbuttondown=function(e){this._onbuttondown=e},l.prototype.onbuttonup=function(e){this._onbuttonup=e},l.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},l.prototype.update=function(){r.prototype.update.call(this);for(var e=0;e<this._buttons.length;e++)this._buttons[e]=this._setButtonValue(this.browserGamepad.buttons[e].value,this._buttons[e],e)},l.prototype.dispose=function(){r.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear()},l);function l(e,t,i){var n=r.call(this,e,t,i)||this;return n.onButtonDownObservable=new o.c,n.onButtonUpObservable=new o.c,n.type=s.GENERIC,n._buttons=new Array(i.buttons.length),n}function u(e,t,i,n,r,o,a){void 0===n&&(n=0),void 0===r&&(r=1),void 0===o&&(o=2),void 0===a&&(a=3),this.id=e,this.index=t,this.browserGamepad=i,this._leftStick={x:0,y:0},this._rightStick={x:0,y:0},this._isConnected=!0,this._invertLeftStickY=!1,this.type=u.GAMEPAD,this._leftStickAxisX=n,this._leftStickAxisY=r,this._rightStickAxisX=o,this._rightStickAxisY=a,2<=this.browserGamepad.axes.length&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),4<=this.browserGamepad.axes.length&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var g=i(0),a=i(8),v=i(16),_=i(139),b=i(4);v.a.CreateLineSystem=function(e){for(var t,i=[],n=[],r=e.lines,o=e.colors,a=[],s=0,c=0;c<r.length;c++)for(var l=r[c],u=0;u<l.length;u++){n.push(l[u].x,l[u].y,l[u].z),o&&(t=o[c],a.push(t[u].r,t[u].g,t[u].b,t[u].a)),0<u&&(i.push(s-1),i.push(s)),s++}var h=new v.a;return h.indices=i,h.positions=n,o&&(h.colors=a),h},v.a.CreateDashedLines=function(e){for(var t,i,n=e.dashSize||3,r=e.gapSize||1,o=e.dashNb||200,a=e.points,s=new Array,c=new Array,l=g.e.Zero(),u=0,h=0,d=0,p=0,f=0,f=0;f<a.length-1;f++)a[f+1].subtractToRef(a[f],l),u+=l.length();for(i=n*(t=u/o)/(n+r),f=0;f<a.length-1;f++){a[f+1].subtractToRef(a[f],l),h=Math.floor(l.length()/t),l.normalize();for(var m=0;m<h;m++)d=t*m,s.push(a[f].x+d*l.x,a[f].y+d*l.y,a[f].z+d*l.z),s.push(a[f].x+(d+i)*l.x,a[f].y+(d+i)*l.y,a[f].z+(d+i)*l.z),c.push(p,p+1),p+=2}var _=new v.a;return _.positions=s,_.indices=c,_},a.a.CreateLines=function(e,t,i,n,r){void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=null);var o={points:t,updatable:n,instance:r};return l.CreateLines(e,o,i)},a.a.CreateDashedLines=function(e,t,i,n,r,o,a,s){void 0===o&&(o=null);var c={points:t,dashSize:i,gapSize:n,dashNb:r,updatable:a,instance:s};return l.CreateDashedLines(e,c,o)};var l=(r.CreateLineSystem=function(e,t,i){var n=t.instance,r=t.lines,o=t.colors;if(n){var a,s,c=n.getVerticesData(b.b.PositionKind);o&&(a=n.getVerticesData(b.b.ColorKind));for(var l=0,u=0,h=0;h<r.length;h++)for(var d=r[h],p=0;p<d.length;p++)c[l]=d[p].x,c[l+1]=d[p].y,c[l+2]=d[p].z,o&&a&&(s=o[h],a[u]=s[p].r,a[u+1]=s[p].g,a[u+2]=s[p].b,a[u+3]=s[p].a,u+=4),l+=3;return n.updateVerticesData(b.b.PositionKind,c,!1,!1),o&&a&&n.updateVerticesData(b.b.ColorKind,a,!1,!1),n}var f=!!o,m=new _.b(e,i,null,void 0,void 0,f,t.useVertexAlpha);return v.a.CreateLineSystem(t).applyToMesh(m,t.updatable),m},r.CreateLines=function(e,t,i){void 0===i&&(i=null);var n=t.colors?[t.colors]:null;return r.CreateLineSystem(e,{lines:[t.points],updatable:t.updatable,instance:t.instance,colors:n,useVertexAlpha:t.useVertexAlpha},i)},r.CreateDashedLines=function(e,t,i){void 0===i&&(i=null);var d=t.points,p=t.instance,n=t.gapSize||1,r=t.dashSize||3;if(p)return p.updateMeshPositions(function(e){for(var t,i=g.e.Zero(),n=e.length/6,r=0,o=0,a=0,s=0,c=0,l=0,c=0;c<d.length-1;c++)d[c+1].subtractToRef(d[c],i),r+=i.length();t=r/n;var u=p._creationDataStorage.dashSize,h=u*t/(u+p._creationDataStorage.gapSize);for(c=0;c<d.length-1;c++)for(d[c+1].subtractToRef(d[c],i),o=Math.floor(i.length()/t),i.normalize(),l=0;l<o&&s<e.length;)a=t*l,e[s]=d[c].x+a*i.x,e[s+1]=d[c].y+a*i.y,e[s+2]=d[c].z+a*i.z,e[s+3]=d[c].x+(a+h)*i.x,e[s+4]=d[c].y+(a+h)*i.y,e[s+5]=d[c].z+(a+h)*i.z,s+=6,l++;for(;s<e.length;)e[s]=d[c].x,e[s+1]=d[c].y,e[s+2]=d[c].z,s+=3},!1),p;var o=new _.b(e,i,null,void 0,void 0,void 0,t.useVertexAlpha);return v.a.CreateDashedLines(t).applyToMesh(o,t.updatable),o._creationDataStorage=new a.b,o._creationDataStorage.dashSize=r,o._creationDataStorage.gapSize=n,o},r);function r(){}},function(e,t,i){"use strict";i.d(t,"e",function(){return c}),i.d(t,"a",function(){return l}),i.d(t,"d",function(){return u}),i.d(t,"c",function(){return h}),i.d(t,"b",function(){return d});var n,r,o,a,s=i(1),c=(Object.defineProperty(g.prototype,"physicsJoint",{get:function(){return this._physicsJoint},set:function(e){this._physicsJoint,this._physicsJoint=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"physicsPlugin",{set:function(e){this._physicsPlugin=e},enumerable:!1,configurable:!0}),g.prototype.executeNativeFunction=function(e){e(this._physicsPlugin.world,this._physicsJoint)},g.DistanceJoint=0,g.HingeJoint=1,g.BallAndSocketJoint=2,g.WheelJoint=3,g.SliderJoint=4,g.PrismaticJoint=5,g.UniversalJoint=6,g.Hinge2Joint=g.WheelJoint,g.PointToPointJoint=8,g.SpringJoint=9,g.LockJoint=10,g),l=(a=c,Object(s.d)(_,a),_.prototype.updateDistance=function(e,t){this._physicsPlugin.updateDistanceJoint(this,e,t)},_),u=(o=c,Object(s.d)(m,o),m.prototype.setMotor=function(e,t){this._physicsPlugin.setMotor(this,e||0,t)},m.prototype.setLimit=function(e,t){this._physicsPlugin.setLimit(this,e,t)},m),h=(r=u,Object(s.d)(f,r),f.prototype.setMotor=function(e,t){this._physicsPlugin.setMotor(this,e||0,t)},f.prototype.setLimit=function(e,t){this._physicsPlugin.setLimit(this,e,t)},f),d=(n=u,Object(s.d)(p,n),p.prototype.setMotor=function(e,t,i){void 0===i&&(i=0),this._physicsPlugin.setMotor(this,e||0,t,i)},p.prototype.setLimit=function(e,t,i){void 0===i&&(i=0),this._physicsPlugin.setLimit(this,e,t,i)},p);function p(e){return n.call(this,c.Hinge2Joint,e)||this}function f(e){return r.call(this,c.HingeJoint,e)||this}function m(e,t){return o.call(this,e,t)||this}function _(e){return a.call(this,c.DistanceJoint,e)||this}function g(e,t){this.type=e,(this.jointData=t).nativeParams=t.nativeParams||{}}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var M=i(0),r=i(8),I=i(16);I.a.CreateSphere=function(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,n=e.diameterY||e.diameter||1,r=e.diameterZ||e.diameter||1,o=(!e.arc||!(e.arc<=0||1<e.arc))&&e.arc||1,a=!(e.slice&&e.slice<=0)&&e.slice||1,s=0===e.sideOrientation?0:e.sideOrientation||I.a.DEFAULTSIDE,c=new M.e(i/2,n/2,r/2),l=2+t,u=2*l,h=[],d=[],p=[],f=[],m=0;m<=l;m++){for(var _=m/l,g=_*Math.PI*a,v=0;v<=u;v++){var b=v/u,y=b*Math.PI*2*o,T=M.a.RotationZ(-g),E=M.a.RotationY(y),S=M.e.TransformCoordinates(M.e.Up(),T),A=M.e.TransformCoordinates(S,E),C=A.multiply(c),P=A.divide(c).normalize();d.push(C.x,C.y,C.z),p.push(P.x,P.y,P.z),f.push(b,_)}if(0<m)for(var x=d.length/3,R=x-2*(1+u);R+u+2<x;R++)h.push(R),h.push(R+1),h.push(R+u+1),h.push(R+u+1),h.push(R+1),h.push(R+u+2)}I.a._ComputeSides(s,d,h,p,f,e.frontUVs,e.backUVs);var O=new I.a;return O.indices=h,O.positions=d,O.normals=p,O.uvs=f,O},r.a.CreateSphere=function(e,t,i,n,r,o){var a={segments:t,diameterX:i,diameterY:i,diameterZ:i,sideOrientation:o,updatable:r};return s.CreateSphere(e,a,n)};var s=(n.CreateSphere=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,I.a.CreateSphere(t).applyToMesh(n,t.updatable),n},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),r=i(23),d=i(9),p=i(2),o=i(5);o.a.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};",i(230);o.a.IncludesShadersStore.kernelBlurFragment="#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";o.a.IncludesShadersStore.kernelBlurFragment2="#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";o.a.ShadersStore.kernelBlurPixelShader="\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}
1\nfloat sampleCoC(const in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r;\nreturn coc;\n}\n#endif\n#include<kernelBlurVaryingDeclaration>[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include<packingFunctions>\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<kernelBlurFragment>[0..varyingCount]\n#include<kernelBlurFragment2>[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}",o.a.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";o.a.ShadersStore.kernelBlurVertexShader="\nattribute vec2 position;\n\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#include<kernelBlurVaryingDeclaration>[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nsampleCenter=(position*madd+madd);\n#include<kernelBlurVertex>[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n}";var E,a=(E=r.a,Object(n.d)(s,E),Object.defineProperty(s.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:!1,configurable:!0}),Object.defineProperty(s.prototype,"packedFloat",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this.blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),s.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)},s.prototype._updateParameters=function(e,t){for(var i=this._kernel,n=(i-1)/2,r=[],o=[],a=0,s=0;s<i;s++){var c=s/(i-1),l=this._gaussianWeight(2*c-1);r[s]=s-n,a+=o[s]=l}for(s=0;s<o.length;s++)o[s]/=a;for(var u=[],h=[],d=[],s=0;s<=n;s+=2){var p,f,m,_=Math.min(s+1,Math.floor(n));s===_?d.push({o:r[s],w:o[s]}):(p=_===n,f=o[s]+o[_]*(p?.5:1),0===(m=r[s]+1/(1+o[s]/o[_]))?(d.push({o:r[s],w:o[s]}),d.push({o:r[s+1],w:o[s+1]})):(d.push({o:m,w:f}),d.push({o:-m,w:f})))}for(s=0;s<d.length;s++)h[s]=d[s].o,u[s]=d[s].w;r=h,o=u;var g=this.getEngine().getCaps().maxVaryingVectors,v=Math.max(g,0)-1,b=Math.min(r.length,v),y="";for(y+=this._staticDefines,-1!=this._staticDefines.indexOf("DOF")&&(y+="#define CENTER_WEIGHT "+this._glslFloat(o[b-1])+"\r\n",b--),s=0;s<b;s++)y+="#define KERNEL_OFFSET"+s+" "+this._glslFloat(r[s])+"\r\n",y+="#define KERNEL_WEIGHT"+s+" "+this._glslFloat(o[s])+"\r\n";var T=0;for(s=v;s<r.length;s++)y+="#define KERNEL_DEP_OFFSET"+T+" "+this._glslFloat(r[s])+"\r\n",y+="#define KERNEL_DEP_WEIGHT"+T+" "+this._glslFloat(o[s])+"\r\n",T++;this.packedFloat&&(y+="#define PACKEDFLOAT 1"),this.blockCompilation=!1,E.prototype.updateEffect.call(this,y,null,null,{varyingCount:b,depCount:T},e,t)},s.prototype._nearestBestKernel=function(e){for(var t=Math.round(e),i=0,n=[t,t-1,t+1,t-2,t+2];i<n.length;i++){var r=n[i];if(r%2!=0&&Math.floor(r/2)%2==0&&0<r)return Math.max(r,3)}return Math.max(t,3)},s.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)},s.prototype._glslFloat=function(e,t){return void 0===t&&(t=8),e.toFixed(t).replace(/0+$/,"")},s);function s(e,t,i,n,r,o,a,s,c,l,u){void 0===o&&(o=d.a.BILINEAR_SAMPLINGMODE),void 0===c&&(c=p.a.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=""),void 0===u&&(u=!1);var h=E.call(this,e,"kernelBlur",["delta","direction","cameraMinMaxZ"],["circleOfConfusionSampler"],n,r,o,a,s,null,c,"kernelBlur",{varyingCount:0,depCount:0},!0)||this;return h.direction=t,h.blockCompilation=u,h._packedFloat=!1,h._staticDefines="",h._staticDefines=l,h.onApplyObservable.add(function(e){h._outputTexture?e.setFloat2("delta",1/h._outputTexture.width*h.direction.x,
11/h._outputTexture.height*h.direction.y):e.setFloat2("delta",1/h.width*h.direction.x,1/h.height*h.direction.y)}),h.kernel=i,h}},function(e,t,i){"use strict";i.d(t,"a",function(){return h});var n=i(1),r=i(3),o=i(6),a=i(0),s=i(22),c=i(2),l=i(191),u=i(94),h=(i(68),Object.defineProperty(d.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag|c.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isCube",{get:function(){return!!this._texture&&this._texture.isCube},set:function(e){this._texture&&(this._texture.isCube=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},set:function(e){this._texture&&(this._texture._isRGBD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"noMipmap",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0}
1,set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"linearSpecularLOD",{get:function(){return!!this._texture&&this._texture._linearSpecularLOD},set:function(e){this._texture&&(this._texture._linearSpecularLOD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"irradianceTexture",{get:function(){return this._texture?this._texture._irradianceTexture:null},set:function(e){this._texture&&(this._texture._irradianceTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"uid",{get:function(){return this._uid||(this._uid=l.a.RandomId()),this._uid},enumerable:!1,configurable:!0}),d.prototype.toString=function(){return this.name},d.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(d.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isBlocking",{get:function(){return!0},enumerable:!1,configurable:!0}),d.prototype.getScene=function(){return this._scene},d.prototype._getEngine=function(){return this._engine},d.prototype.getTextureMatrix=function(){return a.a.IdentityReadOnly},d.prototype.getReflectionTextureMatrix=function(){return a.a.IdentityReadOnly},d.prototype.getInternalTexture=function(){return this._texture},d.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()},d.prototype.isReady=function(){return this.delayLoadState===c.a.DELAYLOADSTATE_NOTLOADED?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady},d.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},d.prototype.getBaseSize=function(){return this.isReady()&&this._texture?this._texture._size?new u.a(this._texture._size,this._texture._size):new u.a(this._texture.baseWidth,this._texture.baseHeight):u.a.Zero()},d.prototype.updateSamplingMode=function(e){var t;!this._texture||(t=this._getEngine())&&t.updateTextureSamplingMode(e,this._texture)},d.prototype.scale=function(e){},Object.defineProperty(d.prototype,"canRescale",{get:function(){return!1},enumerable:!1,configurable:!0}),d.prototype._getFromCache=function(e,t,i,n){var r=this._getEngine();if(!r)return null;for(var o=r.getLoadedTexturesCache(),a=0;a<o.length;a++){var s=o[a];if(!(void 0!==n&&n!==s.invertY||s.url!==e||s.generateMipMaps!==!t||i&&i!==s.samplingMode))return s.incrementReferences(),s}return null},d.prototype._rebuild=function(){},d.prototype.delayLoad=function(){},d.prototype.clone=function(){return null},Object.defineProperty(d.prototype,"textureType",{get:function(){return this._texture&&void 0!==this._texture.type?this._texture.type:c.a.TEXTURETYPE_UNSIGNED_INT},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"textureFormat",{get:function(){return this._texture&&void 0!==this._texture.format?this._texture.format:c.a.TEXTUREFORMAT_RGBA},enumerable:!1,configurable:!0}),d.prototype._markAllSubMeshesAsTexturesDirty=function(){var e=this.getScene();e&&e.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag)},d.prototype.readPixels=function(e,t,i){if(void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),!this._texture)return null;var n=this.getSize(),r=n.width,o=n.height,a=this._getEngine();if(!a)return null;0!=t&&(r/=Math.pow(2,t),o/=Math.pow(2,t),r=Math.round(r),o=Math.round(o));try{return this._texture.isCube?a._readTexturePixels(this._texture,r,o,e,t,i):a._readTexturePixels(this._texture,r,o,-1,t,i)}catch(e){return null}},d.prototype.releaseInternalTexture=function(){this._texture&&(this._texture.dispose(),this._texture=null)},Object.defineProperty(d.prototype,"_lodTextureHigh",{get:function(){return this._texture?this._texture._lodTextureHigh:null}
1,enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"_lodTextureMid",{get:function(){return this._texture?this._texture._lodTextureMid:null},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"_lodTextureLow",{get:function(){return this._texture?this._texture._lodTextureLow:null},enumerable:!1,configurable:!0}),d.prototype.dispose=function(){var e;this._scene&&(this._scene.stopAnimation&&this._scene.stopAnimation(this),this._scene._removePendingData(this),0<=(e=this._scene.textures.indexOf(this))&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null),void 0!==this._texture&&(this.releaseInternalTexture(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._engine=null)},d.prototype.serialize=function(){if(!this.name)return null;var e=r.a.Serialize(this);return r.a.AppendSerializedAnimations(this,e),e},d.WhenAllReady=function(t,i){var n=t.length;if(0!==n)for(var r,o,e=function(){var e;(r=t[a]).isReady()?0==--n&&i():(o=r.onLoadObservable)&&(e=function(){o.removeCallback(e),0==--n&&i()},o.add(e))},a=0;a<t.length;a++)e();else i()},d._isScene=function(e){return"Scene"===e.getClassName()},d.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,Object(n.c)([Object(r.c)()],d.prototype,"uniqueId",void 0),Object(n.c)([Object(r.c)()],d.prototype,"name",void 0),Object(n.c)([Object(r.c)()],d.prototype,"metadata",void 0),Object(n.c)([Object(r.c)("hasAlpha")],d.prototype,"_hasAlpha",void 0),Object(n.c)([Object(r.c)()],d.prototype,"getAlphaFromRGB",void 0),Object(n.c)([Object(r.c)()],d.prototype,"level",void 0),Object(n.c)([Object(r.c)()],d.prototype,"coordinatesIndex",void 0),Object(n.c)([Object(r.c)("coordinatesMode")],d.prototype,"_coordinatesMode",void 0),Object(n.c)([Object(r.c)()],d.prototype,"wrapU",void 0),Object(n.c)([Object(r.c)()],d.prototype,"wrapV",void 0),Object(n.c)([Object(r.c)()],d.prototype,"wrapR",void 0),Object(n.c)([Object(r.c)()],d.prototype,"anisotropicFilteringLevel",void 0),Object(n.c)([Object(r.c)()],d.prototype,"isCube",null),Object(n.c)([Object(r.c)()],d.prototype,"is3D",null),Object(n.c)([Object(r.c)()],d.prototype,"is2DArray",null),Object(n.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],d.prototype,"gammaSpace",void 0),Object(n.c)([Object(r.c)()],d.prototype,"invertZ",void 0),Object(n.c)([Object(r.c)()],d.prototype,"lodLevelInAlpha",void 0),Object(n.c)([Object(r.c)()],d.prototype,"lodGenerationOffset",null),Object(n.c)([Object(r.c)()],d.prototype,"lodGenerationScale",null),Object(n.c)([Object(r.c)()],d.prototype,"linearSpecularLOD",null),Object(n.c)([Object(r.m)()],d.prototype,"irradianceTexture",null),Object(n.c)([Object(r.c)()],d.prototype,"isRenderTarget",void 0),d);function d(e){this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this.getAlphaFromRGB=!1,this.level=1,this.coordinatesIndex=0,this._coordinatesMode=c.a.TEXTURE_EXPLICIT_MODE,this.wrapU=c.a.TEXTURE_WRAP_ADDRESSMODE,this.wrapV=c.a.TEXTURE_WRAP_ADDRESSMODE,this.wrapR=c.a.TEXTURE_WRAP_ADDRESSMODE,this.anisotropicFilteringLevel=d.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this.gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this.isRenderTarget=!1,this._prefiltered=!1,this.animations=new Array,this.onDisposeObservable=new o.c,this._onDisposeObserver=null,this.delayLoadState=c.a.DELAYLOADSTATE_NONE,this._scene=null,this._engine=null,this._texture=null,this._uid=null,this._cachedSize=u.a.Zero(),e?d._isScene(e)?this._scene=e:this._engine=e:this._scene=s.a.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._uid=null}},function(e,t,i){"use strict";i.d(t,"a",function(){return h});var r,n=i(1),s=i(3),o=i(0),l=i(10),c=i(30),a=i(116),u=i(11),h=(r=c.a,Object(n.d)(d,r),Object.defineProperty(d.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()}
1,enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),d.prototype.transferTexturesToEffect=function(e,t){return this},d.prototype._bindLight=function(e,t,i,n,r){void 0===r&&(r=!1);var o,a,s=e.toString(),c=!1;r&&this._uniformBuffer._alreadyBound||(this._uniformBuffer.bindToEffect(i,"Light"+s),this._renderId===t.getRenderId()&&this._uniformBuffer.useUbo||(this._renderId=t.getRenderId(),o=this.getScaledIntensity(),this.transferToEffect(i,s),this.diffuse.scaleToRef(o,l.c.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",l.c.Color3[0],this.range,s),n&&(this.specular.scaleToRef(o,l.c.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",l.c.Color3[1],this.radius,s)),c=!0),this.transferTexturesToEffect(i,s),t.shadowsEnabled&&this.shadowEnabled&&(a=this.getShadowGenerator())&&(a.bindShadowLight(s,i),c=!0),c&&this._uniformBuffer.update())},d.prototype.getClassName=function(){return"Light"},d.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t},d.prototype._syncParentEnabledState=function(){r.prototype._syncParentEnabledState.call(this),this.isDisposed()||this._resyncMeshes()},d.prototype.setEnabled=function(e){r.prototype.setEnabled.call(this,e),this._resyncMeshes()},d.prototype.getShadowGenerator=function(){return this._shadowGenerator},d.prototype.getAbsolutePosition=function(){return o.e.Zero()},d.prototype.canAffectMesh=function(e){return!(e&&(this.includedOnlyMeshes&&0<this.includedOnlyMeshes.length&&-1===this.includedOnlyMeshes.indexOf(e)||this.excludedMeshes&&0<this.excludedMeshes.length&&-1!==this.excludedMeshes.indexOf(e)||0!==this.includeOnlyWithLayerMask&&0==(this.includeOnlyWithLayerMask&e.layerMask)||0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask))},d.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},d.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var i=0,n=this.getScene().meshes;i<n.length;i++)n[i]._removeLightSource(this,!0);this._uniformBuffer.dispose(),this.getScene().removeLight(this),r.prototype.dispose.call(this,e,t)},d.prototype.getTypeID=function(){return 0},d.prototype.getScaledIntensity=function(){return this._photometricScale*this.intensity},d.prototype.clone=function(e,t){void 0===t&&(t=null);
1var i=d.GetConstructorFromName(this.getTypeID(),e,this.getScene());if(!i)return null;var n=s.a.Clone(i,this);return t&&(n.parent=t),n.setEnabled(this.isEnabled()),n},d.prototype.serialize=function(){var t=s.a.Serialize(this);return t.type=this.getTypeID(),this.parent&&(t.parentId=this.parent.id),0<this.excludedMeshes.length&&(t.excludedMeshesIds=[],this.excludedMeshes.forEach(function(e){t.excludedMeshesIds.push(e.id)})),0<this.includedOnlyMeshes.length&&(t.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach(function(e){t.includedOnlyMeshesIds.push(e.id)})),s.a.AppendSerializedAnimations(this,t),t.ranges=this.serializeAnimationRanges(),t},d.GetConstructorFromName=function(e,t,i){return c.a.Construct("Light_Type_"+e,t,i)||null},d.Parse=function(e,t){var i=d.GetConstructorFromName(e.type,e.name,t);if(!i)return null;var n=s.a.Parse(i,e,t);if(e.excludedMeshesIds&&(n._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(n._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.falloffType&&(n.falloffType=e.falloffType),void 0!==e.lightmapMode&&(n.lightmapMode=e.lightmapMode),e.animations){for(var r=0;r<e.animations.length;r++){var o=e.animations[r],a=u.a.GetClass("BABYLON.Animation");a&&n.animations.push(a.Parse(o))}c.a.ParseAnimationRanges(n,e,t)}return e.autoAnimate&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),n},d.prototype._hookArrayForExcluded=function(o){var a=this,s=o.push;o.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=s.apply(o,e),n=0,r=e;n<r.length;n++)r[n]._resyncLightSource(a);return i};var c=o.splice;o.splice=function(e,t){for(var i=c.apply(o,[e,t]),n=0,r=i;n<r.length;n++)r[n]._resyncLightSource(a);return i};for(var e=0,t=o;e<t.length;e++)t[e]._resyncLightSource(this)},d.prototype._hookArrayForIncludedOnly=function(n){var r=this,o=n.push;n.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=o.apply(n,e);return r._resyncMeshes(),i};var a=n.splice;n.splice=function(e,t){var i=a.apply(n,[e,t]);return r._resyncMeshes(),i},this._resyncMeshes()},d.prototype._resyncMeshes=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++)t[e]._resyncLightSource(this)},d.prototype._markMeshesAsLightDirty=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){var i=t[e];-1!==i.lightSources.indexOf(this)&&i._markSubMeshesAsLightDirty()}},d.prototype._computePhotometricScale=function(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()},d.prototype._getPhotometricScale=function(){var e=0,t=this.getTypeID(),i=this.intensityMode;switch(i===d.INTENSITYMODE_AUTOMATIC&&(i=t===d.LIGHTTYPEID_DIRECTIONALLIGHT?d.INTENSITYMODE_ILLUMINANCE:d.INTENSITYMODE_LUMINOUSINTENSITY),t){case d.LIGHTTYPEID_POINTLIGHT:case d.LIGHTTYPEID_SPOTLIGHT:switch(i){case d.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case d.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case d.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case d.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case d.INTENSITYMODE_ILLUMINANCE:e=1;break;case d.INTENSITYMODE_LUMINANCE:var n=this.radius,n=Math.max(n,.001),e=2*Math.PI*(1-Math.cos(n))}break;case d.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e},d.prototype._reorderLightsInScene=function(){var e=this.getScene();
10!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()},d.FALLOFF_DEFAULT=0,d.FALLOFF_PHYSICAL=1,d.FALLOFF_GLTF=2,d.FALLOFF_STANDARD=3,d.LIGHTMAP_DEFAULT=0,d.LIGHTMAP_SPECULAR=1,d.LIGHTMAP_SHADOWSONLY=2,d.INTENSITYMODE_AUTOMATIC=0,d.INTENSITYMODE_LUMINOUSPOWER=1,d.INTENSITYMODE_LUMINOUSINTENSITY=2,d.INTENSITYMODE_ILLUMINANCE=3,d.INTENSITYMODE_LUMINANCE=4,d.LIGHTTYPEID_POINTLIGHT=0,d.LIGHTTYPEID_DIRECTIONALLIGHT=1,d.LIGHTTYPEID_SPOTLIGHT=2,d.LIGHTTYPEID_HEMISPHERICLIGHT=3,Object(n.c)([Object(s.e)()],d.prototype,"diffuse",void 0),Object(n.c)([Object(s.e)()],d.prototype,"specular",void 0),Object(n.c)([Object(s.c)()],d.prototype,"falloffType",void 0),Object(n.c)([Object(s.c)()],d.prototype,"intensity",void 0),Object(n.c)([Object(s.c)()],d.prototype,"range",null),Object(n.c)([Object(s.c)()],d.prototype,"intensityMode",null),Object(n.c)([Object(s.c)()],d.prototype,"radius",null),Object(n.c)([Object(s.c)()],d.prototype,"_renderPriority",void 0),Object(n.c)([Object(s.b)("_reorderLightsInScene")],d.prototype,"renderPriority",void 0),Object(n.c)([Object(s.c)("shadowEnabled")],d.prototype,"_shadowEnabled",void 0),Object(n.c)([Object(s.c)("excludeWithLayerMask")],d.prototype,"_excludeWithLayerMask",void 0),Object(n.c)([Object(s.c)("includeOnlyWithLayerMask")],d.prototype,"_includeOnlyWithLayerMask",void 0),Object(n.c)([Object(s.c)("lightmapMode")],d.prototype,"_lightmapMode",void 0),d);function d(e,t){var i=r.call(this,e,t)||this;return i.diffuse=new l.a(1,1,1),i.specular=new l.a(1,1,1),i.falloffType=d.FALLOFF_DEFAULT,i.intensity=1,i._range=Number.MAX_VALUE,i._inverseSquaredRange=0,i._photometricScale=1,i._intensityMode=d.INTENSITYMODE_AUTOMATIC,i._radius=1e-5,i.renderPriority=0,i._shadowEnabled=!0,i._excludeWithLayerMask=0,i._includeOnlyWithLayerMask=0,i._lightmapMode=0,i._excludedMeshesIds=new Array,i._includedOnlyMeshesIds=new Array,i._isLight=!0,i.getScene().addLight(i),i._uniformBuffer=new a.a(i.getScene().getEngine()),i._buildUniformLayout(),i.includedOnlyMeshes=new Array,i.excludedMeshes=new Array,i._resyncMeshes(),i}},function(e,t,i){"use strict";i.d(t,"a",function(){return T});
1var s=i(1),_=i(70),a=i(6),W=i(0),g=i(14),h=i(4),r=i(28),c=i(29),l=i(15),n=i(48),H=i(9),u=i(90),X=i(152),d=i(22),Y=i(69),o=i(136),p=i(293),v=i(142),f=i(2),ee=i(3),K=i(11),m=i(5),b=(i(177),i(159),i(74),i(160),i(161),"\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include<clipPlaneFragmentDeclaration>\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\nvoid main(void) {\n#include<clipPlaneFragment>\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}");m.a.ShadersStore.particlesPixelShader=b,i(380);var y,Q=i(10),T=(y=o.a,Object(s.d)(E,y),Object.defineProperty(E.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"useRampGradients",{get:function(){return this._useRampGradients},set:function(e){this._useRampGradients!==e&&(this._useRampGradients=e,this._resetEffect())},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"particles",{get:function(){return this._particles},enumerable:!1,configurable:!0}),E.prototype.getActiveCount=function(){return this._particles.length},E.prototype.getClassName=function(){return"ParticleSystem"},E.prototype.isStopping=function(){return this._stopped&&this.isAlive()},E.prototype.getCustomEffect=function(e){var t;return void 0===e&&(e=0),null!==(t=this._customEffect[e])&&void 0!==t?t:this._customEffect[0]},E.prototype.setCustomEffect=function(e,t){void 0===t&&(t=0),this._customEffect[t]=e},Object.defineProperty(E.prototype,"onBeforeDrawParticlesObservable",{get:function(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new a.c),this._onBeforeDrawParticlesObservable},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"vertexShaderName",{get:function(){return"particles"},enumerable:!1,configurable:!0}),E.prototype._addFactorGradient=function(e,t,i,n){var r=new _.c(t,i,n);e.push(r),e.sort(function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})},E.prototype._removeFactorGradient=function(e,t){if(e)for(var i=0,n=0,r=e;n<r.length;n++){if(r[n].gradient===t){e.splice(i,1);break}i++}},E.prototype.addLifeTimeGradient=function(e,t,i){return this._lifeTimeGradients||(this._lifeTimeGradients=[]),this._addFactorGradient(this._lifeTimeGradients,e,t,i),this},E.prototype.removeLifeTimeGradient=function(e){return this._removeFactorGradient(this._lifeTimeGradients,e),this},E.prototype.addSizeGradient=function(e,t,i){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t,i),this},E.prototype.removeSizeGradient=function(e){return this._removeFactorGradient(this._sizeGradients,e),this},E.prototype.addColorRemapGradient=function(e,t,i){return this._colorRemapGradients||(this._colorRemapGradients=[]),this._addFactorGradient(this._colorRemapGradients,e,t,i),this},E.prototype.removeColorRemapGradient=function(e){return this._removeFactorGradient(this._colorRemapGradients,e),this},E.prototype.addAlphaRemapGradient=function(e,t,i){return this._alphaRemapGradients||(this._alphaRemapGradients=[]),this._addFactorGradient(this._alphaRemapGradients,e,t,i),this},E.prototype.removeAlphaRemapGradient=function(e){return this._removeFactorGradient(this._alphaRemapGradients,e),this},E.prototype.addAngularSpeedGradient=function(e,t,i){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t,i),this},E.prototype.removeAngularSpeedGradient=function(e){return this._removeFactorGradient(this._angularSpeedGradients,e),this},E.prototype.addVelocityGradient=function(e,t,i){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t,i),this},E.prototype.removeVelocityGradient=function(e){return this._removeFactorGradient(this._velocityGradients,e),this},E.prototype.addLimitVelocityGradient=function(e,t,i){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t,i),this},E.prototype.removeLimitVelocityGradient=function(e){return this._removeFactorGradient(this._limitVelocityGradients,e),this},E.prototype.addDragGradient=function(e,t,i){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t,i),this},E.prototype.removeDragGradient=function(e){return this._removeFactorGradient(this._dragGradients,e),this},E.prototype.addEmitRateGradient=function(e,t,i){return this._emitRateGradients||(this._emitRateGradients=[]),this._addFactorGradient(this._emitRateGradients,e,t,i),this},E.prototype.removeEmitRateGradient=function(e){return this._removeFactorGradient(this._emitRateGradients,e),this},E.prototype.addStartSizeGradient=function(e,t,i){return this._startSizeGradients||(this._startSizeGradients=[]),this._addFactorGradient(this._startSizeGradients,e,t,i),this},E.prototype.removeStartSizeGradient=function(e){return this._removeFactorGradient(this._startSizeGradients,e),this},E.prototype._createRampGradientTexture=function(){if(this._rampGradients&&this._rampGradients.length&&!this._rampGradientsTexture){for(var n=new Uint8Array(4*this._rawTextureWidth),r=Q.c.Color3[0],o=0;o<this._rawTextureWidth;o++){var e=o/this._rawTextureWidth;_.d.GetCurrentGradient(e,this._rampGradients,function(e,t,i){Q.a.LerpToRef(e.color,t.color,
1i,r),n[4*o]=255*r.r,n[4*o+1]=255*r.g,n[4*o+2]=255*r.b,n[4*o+3]=255})}this._rampGradientsTexture=u.a.CreateRGBATexture(n,this._rawTextureWidth,1,this._scene,!1,!1,H.a.NEAREST_SAMPLINGMODE)}},E.prototype.getRampGradients=function(){return this._rampGradients},E.prototype.forceRefreshGradients=function(){this._syncRampGradientTexture()},E.prototype._syncRampGradientTexture=function(){this._rampGradients&&(this._rampGradients.sort(function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0}),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture())},E.prototype.addRampGradient=function(e,t){this._rampGradients||(this._rampGradients=[]);var i=new _.a(e,t);return this._rampGradients.push(i),this._syncRampGradientTexture(),this},E.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&0<this._rampGradients.length&&this._createRampGradientTexture(),this},E.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new _.b(e,t,i);return this._colorGradients.push(n),this._colorGradients.sort(function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0}),this},E.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,i=0,n=this._colorGradients;i<n.length;i++){if(n[i].gradient===e){this._colorGradients.splice(t,1);break}t++}return this},E.prototype._fetchR=function(e,t,i,n,r){return r[4*(((e=.5*Math.abs(e)+.5)*i%i|0)+((t=.5*Math.abs(t)+.5)*n%n|0)*i)]/255},E.prototype._reset=function(){this._resetEffect()},E.prototype._resetEffect=function(){this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._createVertexBuffers()},E.prototype._createVertexBuffers=function(){this._vertexBufferSize=this._useInstancing?10:12,this._isAnimationSheetEnabled&&(this._vertexBufferSize+=1),this._isBillboardBased&&this.billboardMode!==E.BILLBOARDMODE_STRETCHED||(this._vertexBufferSize+=3),this._useRampGradients&&(this._vertexBufferSize+=4);var e=this._scene.getEngine();this._vertexData=new Float32Array(this._capacity*this._vertexBufferSize*(this._useInstancing?1:4)),this._vertexBuffer=new h.a(e,this._vertexData,!0,this._vertexBufferSize);var t=0,i=this._vertexBuffer.createVertexBuffer(h.b.PositionKind,t,3,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[h.b.PositionKind]=i,t+=3;var n=this._vertexBuffer.createVertexBuffer(h.b.ColorKind,t,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[h.b.ColorKind]=n,t+=4;var r=this._vertexBuffer.createVertexBuffer("angle",t,1,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.angle=r,t+=1;var o,a,s,c,l,u=this._vertexBuffer.createVertexBuffer("size",t,2,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.size=u,t+=2,this._isAnimationSheetEnabled&&(a=this._vertexBuffer.createVertexBuffer("cellIndex",t,1,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.cellIndex=a,t+=1),this._isBillboardBased&&this.billboardMode!==E.BILLBOARDMODE_STRETCHED||(s=this._vertexBuffer.createVertexBuffer("direction",t,3,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.direction=s,t+=3),this._useRampGradients&&(c=this._vertexBuffer.createVertexBuffer("remapData",t,4,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.remapData=c,t+=4),this._useInstancing?(l=new Float32Array([0,0,1,0,1,1,0,1]),this._spriteBuffer=new h.a(e,l,!1,2),o=this._spriteBuffer.createVertexBuffer("offset",0,2)):(o=this._vertexBuffer.createVertexBuffer("offset",t,2,this._vertexBufferSize,this._useInstancing),t+=2),this._vertexBuffers.offset=o},E.prototype._createIndexBuffer=function(){if(!this._useInstancing){for(var e=[],t=0,i=0;i<this._capacity;i++)e.push(t),e.push(t+1),e.push(t+2),e.push(t),e.push(t+2),e.push(t+3),t+=4;this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)}},E.prototype.getCapacity=function(){return this._capacity},E.prototype.isAlive=function(){return this._alive},E.prototype.isStarted=function(){return this._started},E.prototype._prepareSubEmitterInternalArray=function(){var t=this;this._subEmitters=new Array,this.subEmitters&&this.subEmitters.forEac
1h(function(e){e instanceof E?t._subEmitters.push([new v.a(e)]):e instanceof v.a?t._subEmitters.push([e]):e instanceof Array&&t._subEmitters.push(e)})},E.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";if(e)setTimeout(function(){t.start(0)},e);else{if(this._prepareSubEmitterInternalArray(),this._started=!0,this._stopped=!1,this._actualFrame=0,this._subEmitters&&0!=this._subEmitters.length&&(this.activeSubSystems=new Array),this._emitRateGradients&&(0<this._emitRateGradients.length&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),1<this._emitRateGradients.length&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(0<this._startSizeGradients.length&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),1<this._startSizeGradients.length&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){this.emitter instanceof r.a&&this.emitter.computeWorldMatrix(!0);var i=this.noiseTexture;if(i&&i.onGeneratedObservable)i.onGeneratedObservable.addOnce(function(){setTimeout(function(){for(var e=0;e<t.preWarmCycles;e++)t.animate(!0),i.render()})});else for(var n=0;n<this.preWarmCycles;n++)this.animate(!0)}this.beginAnimationOnStart&&this.animations&&0<this.animations.length&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}},E.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped=!0,e&&this._stopSubEmitters()},E.prototype.reset=function(){this._stockParticles=[],this._particles=[]},E.prototype._appendParticleVertex=function(e,t,i,n){var r,o,a=e*this._vertexBufferSize;this._vertexData[a++]=t.position.x+this.worldOffset.x,this._vertexData[a++]=t.position.y+this.worldOffset.y,this._vertexData[a++]=t.position.z+this.worldOffset.z,this._vertexData[a++]=t.color.r,this._vertexData[a++]=t.color.g,this._vertexData[a++]=t.color.b,this._vertexData[a++]=t.color.a,this._vertexData[a++]=t.angle,this._vertexData[a++]=t.scale.x*t.size,this._vertexData[a++]=t.scale.y*t.size,this._isAnimationSheetEnabled&&(this._vertexData[a++]=t.cellIndex),this._isBillboardBased?this.billboardMode===E.BILLBOARDMODE_STRETCHED&&(this._vertexData[a++]=t.direction.x,this._vertexData[a++]=t.direction.y,this._vertexData[a++]=t.direction.z):t._initialDirection?(r=t._initialDirection,this.isLocal&&(W.e.TransformNormalToRef(r,this._emitterWorldMatrix,W.c.Vector3[0]),r=W.c.Vector3[0]),0===r.x&&0===r.z&&(r.x=.001),this._vertexData[a++]=r.x,this._vertexData[a++]=r.y,this._vertexData[a++]=r.z):(o=t.direction,this.isLocal&&(W.e.TransformNormalToRef(o,this._emitterWorldMatrix,W.c.Vector3[0]),o=W.c.Vector3[0]),0===o.x&&0===o.z&&(o.x=.001),this._vertexData[a++]=o.x,this._vertexData[a++]=o.y,this._vertexData[a++]=o.z),this._useRampGradients&&t.remapData&&(this._vertexData[a++]=t.remapData.x,this._vertexData[a++]=t.remapData.y,this._vertexData[a++]=t.remapData.z,this._vertexData[a++]=t.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon)),this._vertexData[a++]=i,this._vertexData[a++]=n)},E.prototype._stopSubEmitters=function(){this.activeSubSystems&&(this.activeSubSystems.forEach(function(e){e.stop(!0)}),this.activeSubSystems=new Array)},E.prototype._removeFromRoot=function(){var e;this._rootParticleSystem&&(-1!==(e=this._rootParticleSystem.activeSubSystems.indexOf(this))&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null)},E.prototype._update=function(e){var c,t,i,r=this;this._alive=0<this._particles.length,this.emitter.position?(t=this.emitter,this._emitterWorldMatrix=t.getWorldMatrix()):(i=this.emitter,this._emitterWorldMatrix=W.a.Translation(i.x,i.y,i.z)),this.updateFunction(this._particles);for(var n,o=function(){if(a._particles.length===a._capacity)return"break";var s;c=a._createParticle(),a._particles.push(c),a.targetStopDuration&&a._lifeTimeGradients&&0<a._lifeTimeGradients.length?(s=g.a.Clamp(a._actualFrame/a.targetStopDuration),_.d.GetCurrentGradient(s,a._lifeTimeGradients,function(e,t){var i=e,n=t,r=i.getFactor(),o=n.getFactor(),a=(s-i.gradient)/(n.gradient-i.gradient);c.lifeTime=g.a.Lerp(r,o,a)})):c.lifeTime=g.a.RandomRange(a.minLifeTime,a.maxLifeTime);var e,t=g.a.RandomRange(a.minEmitPower,a.maxEmitPower);a.startPositionFunction?a.startPositionFunction(a._emitterWorldMatrix,c.position,c,a.isLocal):a.particleEmitterType.startPositionFunction(a._emitterWorldMatrix,c.position,c,a.isLocal),a.isLocal&&(c._localPosition?c._localPosition.copyFrom(c.position):c._localPosition=c.position.clone(),W.e.TransformCoordinatesToRef(c._localPosition,a._emitterWorldMatrix,c.position)),a.startDirectionFunction?a.startDirectionFunction(a._emitterWorldMatrix,c.direction,c,a.isLocal):a.particleEmitterType.startDirectionFunction(a._emitterWorldMatrix,c.direction,c,a.isLocal),0===t?c._initialDirection?c._initialDirection.copyFrom(c.direction):c._initialDirection=c.direction.clone():c._initialDirection=null,c.direction.scaleInPlace(t),a._sizeGradients&&0!==a._sizeGradients.length?(c._currentSizeGradient=a._sizeGradients[0],c._currentSize1=c._currentSizeGradient.getFactor(),c.size=c._currentSize1,1<a._sizeGradients.length?c._currentSize2=a._sizeGradients[1].getFactor():c._currentSize2=c._currentSize1):c.size=g.a.RandomRange(a.minSize,a.maxSize),c.scale.copyFromFloats(g.a.RandomRange(a.minScaleX,a.maxScaleX),g.a.RandomRange(a.minScaleY,a.maxScaleY)),a._startSizeGradients&&a._startSizeGradients[0]&&a.targetStopDuration&&(e=a._actualFrame/a.targetStopDuration,_.d.GetCurrentGradient(e,a._startSizeGradients,function(e,t,i){e!==r._currentStartSizeGradient&&(r._currentStartSize1=r._currentStartSize2,r._currentStartSize2=t.getFactor(),r._currentStartSizeGradient=e);var n=g.a.Lerp(r._currentStartSize1,r._currentStartSize2,i);c.scale.scaleInPlace(n)})),a._angularSpeedGradients&&0!==a._angularSpeedGradients.length?(c._currentAngularSpeedGradient=a._angularSpeedGradients[0],c.angularSpeed=c._currentAngularSpeedGradient.getFactor(),c._currentAngularSpeed1=c.angularSpeed,1<a._angularSpeedGradients.length?c._currentAngularSpeed2=a._angularSpeedGradients[1].getFactor():c._currentAngularSpeed2=c._currentAngularSpeed1):c.angularSpeed=g.a.RandomRange(a.minAngularSpeed,a.maxAngularSpeed),c.angle=g.a.RandomRange(a.minInitialRotation,a.maxInitialRotation),a._velocityGradients&&0<a._velocityGradients.length&&(c._currentVelocityGradient=a._velocityGradients[0],c._currentVelocity1=c._currentVelocityGradient.getFactor(),1<a._velocityGradients.length?c._currentVelocity2=a._velocityGradients[1].getFactor():c._currentVelocity2=c._currentVelocity1),a._limitVelocityGradients&&0<a._limitVelocityGradients.length&&(c._currentLimitVelocityGradient=a._limitVelocityGradients[0],c._currentLimitVelocity1=c._currentLimitVelocityGradient.getFactor(),1<a._limitVelocityGradients.length?c._currentLimitVelocity2=a._limitVelocityGradients[1].getFactor():c._currentLimitVelocity2=c._currentLimitVelocity1),a._dragGradients&&0<a._dragGradients.length&&(c._currentDragGradient=a._dragGradients[0],c._currentDrag1=c._currentDragGradient.getFactor(),1<a._dragGradients.length?c._currentDrag2=a._dragGradients[1].getFactor():c._currentDrag2=c._currentDrag1),a._colorGradients&&0!==a._colorGradients.length?(c._currentColorGradient=a._colorGradients[0],c._currentColorGradient.getColorToRef(c.color),c._currentColor1.copyFrom(c.color),1<a._colorGradients.length?a._colorGradients[1].getColorToRef(c._currentColor2):c._currentColor2.copyFrom(c.color)):(n=g.a.RandomRange(0,1),Q.b.LerpToRef(a.color1,a.color2,n,c.color),a.colorDead.subtractToRef(c.color,a._colorDiff),a._colorDiff.scaleToRef(1/c.lifeTime,c.colorStep)),a._isAnimationSheetEnabled&&(c._initialStartSpriteCellID=a.startSpriteCellID,c._initialEndSpriteCellID=a.endSpriteCellID),c.direction.addInPlace(a._inheritedVelocityOffset),a._useRampGradients&&(c.remapData=new W.f(0,1,0,1)),a.noiseTexture&&(c._randomNoiseCoordinates1?(c._randomNoiseCoordinates1.
1copyFromFloats(Math.random(),Math.random(),Math.random()),c._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(c._randomNoiseCoordinates1=new W.e(Math.random(),Math.random(),Math.random()),c._randomNoiseCoordinates2=new W.e(Math.random(),Math.random(),Math.random()))),c._inheritParticleInfoToSubEmitters()},a=this,s=0;s<e&&"break"!==o();s++);},E._GetAttributeNamesOrOptions=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1);var n=[h.b.PositionKind,h.b.ColorKind,"angle","offset","size"];return e&&n.push("cellIndex"),t||n.push("direction"),i&&n.push("remapData"),n},E._GetEffectCreationOptions=function(e){void 0===e&&(e=!1);var t=["invView","view","projection","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","textureMask","translationPivot","eyePosition"];return e&&t.push("particlesInfos"),t},E.prototype.fillDefines=function(e,t){if(this._scene.clipPlane&&e.push("#define CLIPPLANE"),this._scene.clipPlane2&&e.push("#define CLIPPLANE2"),this._scene.clipPlane3&&e.push("#define CLIPPLANE3"),this._scene.clipPlane4&&e.push("#define CLIPPLANE4"),this._scene.clipPlane5&&e.push("#define CLIPPLANE5"),this._scene.clipPlane6&&e.push("#define CLIPPLANE6"),this._isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),t===E.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this._useRampGradients&&e.push("#define RAMPGRADIENT"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case E.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case E.BILLBOARDMODE_STRETCHED:e.push("#define BILLBOARDSTRETCHED");break;case E.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(this._imageProcessingConfigurationDefines.toString()))},E.prototype.fillUniformsAttributesAndSamplerNames=function(e,t,i){t.push.apply(t,E._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled,this._isBillboardBased&&this.billboardMode!==E.BILLBOARDMODE_STRETCHED,this._useRampGradients)),e.push.apply(e,E._GetEffectCreationOptions(this._isAnimationSheetEnabled)),i.push("diffuseSampler","rampSampler"),this._imageProcessingConfiguration&&(n.a.PrepareUniforms(e,this._imageProcessingConfigurationDefines),n.a.PrepareSamplers(i,this._imageProcessingConfigurationDefines))},E.prototype._getEffect=function(e){var t=this.getCustomEffect(e);if(t)return t;var i=[];this.fillDefines(i,e);var n,r,o,a=i.join("\n");return this._cachedDefines!==a&&(this._cachedDefines=a,n=[],r=[],o=[],this.fillUniformsAttributesAndSamplerNames(r,n,o),this._effect=this._scene.getEngine().createEffect("particles",n,r,o,a)),this._effect},E.prototype.animate=function(e){var t,n,i,r=this;if(void 0===e&&(e=!1),this._started){if(!e){if(!this.isReady())return;if(this._currentRenderId===this._scene.getFrameId())return;this._currentRenderId=this._scene.getFrameId()}if(this._scaledUpdateSpeed=this.updateSpeed*(e?this.preWarmStepOffset:this._scene.getAnimationRatio()),-1<this.manualEmitCount?(t=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0):(n=this.emitRate,this._emitRateGradients&&0<this._emitRateGradients.length&&this.targetStopDuration&&(i=this._actualFrame/this.targetStopDuration,_.d.GetCurrentGradient(i,this._emitRateGradients,function(e,t,i){e!==r._currentEmitRateGradient&&(r._currentEmitRate1=r._currentEmitRate2,r._currentEmitRate2=t.getFactor(),r._currentEmitRateGradient=e),n=g.a.Lerp(r._currentEmitRate1,r._currentEmitRate2,i)})),t=n*this._scaledUpdateSpeed>>0,this._newPartsExcess+=n*this._scaledUpdateSpeed-t),1<this._newPartsExcess&&(t+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?t=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(t),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene._toBeDisposed.push(this))),!e){for(var o=0,a=0;a<this._particles.length;a++){var s=this._particles[a];this._appendParticleVertices(o,s),o+=this._useInstancing?1:4}this._vertexBuffer&&this._vertexBuffer.update(this._vertexData)}0===this.manualEmitCount&&this.disposeOnStop&&this.stop()}},E.prototype._appendParticleVertices=function(e,t){this._appendParticleVertex(e++,t,0,0),this._useInstancing||(this._appendParticleVertex(e++,t,1,0),this._appendParticleVertex(e++,t,1,1
1),this._appendParticleVertex(e++,t,0,1))},E.prototype.rebuild=function(){for(var e in this._createIndexBuffer(),this._vertexBuffer&&this._vertexBuffer._rebuild(),this._vertexBuffers)this._vertexBuffers[e]._rebuild()},E.prototype.isReady=function(){if(!(this.emitter&&this._imageProcessingConfiguration.isReady()&&this.particleTexture&&this.particleTexture.isReady()))return!1;if(this.blendMode!==E.BLENDMODE_MULTIPLYADD){if(!this._getEffect(this.blendMode).isReady())return!1}else{if(!this._getEffect(E.BLENDMODE_MULTIPLY).isReady())return!1;if(!this._getEffect(E.BLENDMODE_ADD).isReady())return!1}return!0},E.prototype._render=function(e){var t=this._getEffect(e),i=this._scene.getEngine();i.enableEffect(t);var n,r,o=this._scene.getViewMatrix();t.setTexture("diffuseSampler",this.particleTexture),t.setMatrix("view",o),t.setMatrix("projection",this._scene.getProjectionMatrix()),this._isAnimationSheetEnabled&&this.particleTexture&&(n=this.particleTexture.getBaseSize(),t.setFloat3("particlesInfos",this.spriteCellWidth/n.width,this.spriteCellHeight/n.height,n.width/this.spriteCellWidth)),t.setVector2("translationPivot",this.translationPivot),t.setFloat4("textureMask",this.textureMask.r,this.textureMask.g,this.textureMask.b,this.textureMask.a),this._isBillboardBased&&(r=this._scene.activeCamera,t.setVector3("eyePosition",r.globalPosition)),this._rampGradientsTexture&&(this._rampGradients&&this._rampGradients.length||(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),t.setTexture("rampSampler",this._rampGradientsTexture));var a,s=t.defines;switch((this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4||this._scene.clipPlane5||this._scene.clipPlane6)&&l.a.BindClipPlane(t,this._scene),0<=s.indexOf("#define BILLBOARDMODE_ALL")&&((a=o.clone()).invert(),t.setMatrix("invView",a)),i.bindBuffers(this._vertexBuffers,this._indexBuffer,t),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(t),e){case E.BLENDMODE_ADD:i.setAlphaMode(f.a.ALPHA_ADD);break;case E.BLENDMODE_ONEONE:i.setAlphaMode(f.a.ALPHA_ONEONE);break;case E.BLENDMODE_STANDARD:i.setAlphaMode(f.a.ALPHA_COMBINE);break;case E.BLENDMODE_MULTIPLY:i.setAlphaMode(f.a.ALPHA_MULTIPLY)}return this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(t),this._useInstancing?i.drawArraysType(c.a.TriangleFanDrawMode,0,4,this._particles.length):i.drawElementsType(c.a.TriangleFillMode,0,6*this._particles.length),this._particles.length},E.prototype.render=function(){if(!this.isReady()||!this._particles.length)return 0;var e=this._scene.getEngine();e.setState(!1),this.forceDepthWrite&&e.setDepthWrite(!0);var t=0;return this.blendMode===E.BLENDMODE_MULTIPLYADD&&(t=this._render(E.BLENDMODE_MULTIPLY)+this._render(E.BLENDMODE_ADD)),t=this._render(this.blendMode),e.unbindInstanceAttributes(),e.setAlphaMode(f.a.ALPHA_DISABLE),t},E.prototype.dispose=function(e){if(void 0===e&&(e=!0),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._removeFromRoot(),this._subEmitters&&this._subEmitters.length){for(var t=0;t<this._subEmitters.length;t++)for(var i=0,n=this._subEmitters[t];i<n.length;i++)n[i].dispose();this._subEmitters=[],this.subEmitters=[]}this._disposeEmitterOnDispose&&this.emitter&&this.emitter.dispose&&this.emitter.dispose(!0),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.clear(),-1<(t=this._scene.particleSystems.indexOf(this))&&this._scene.particleSystems.splice(t,1),this._scene._activeParticleSystems.dispose(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.reset()},E.prototype.clone=function(e,t){var i,n=Object(s.a)({},this._customEffect),r=null;null!=this.customShader&&(i=0<(r=this.customShader).shaderOptions.defines.length?r.shaderOptions.defines.join("\n"):"",n[0]=this._scene.getEngine().createEffe
1ctForParticles(r.shaderPath.fragmentElement,r.shaderOptions.uniforms,r.shaderOptions.samplers,i));var o=this.serialize(),a=E.Parse(o,this._scene,"");return a.name=e,a.customShader=r,a._customEffect=n,void 0===t&&(t=this.emitter),this.noiseTexture&&(a.noiseTexture=this.noiseTexture.clone()),a.emitter=t,this.preventAutoStart||a.start(),a},E.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};if(E._Serialize(t,this,e),t.textureMask=this.textureMask.asArray(),t.customShader=this.customShader,t.preventAutoStart=this.preventAutoStart,this.subEmitters){t.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(var i=0,n=this._subEmitters;i<n.length;i++){for(var r=[],o=0,a=n[i];o<a.length;o++){var s=a[o];r.push(s.serialize())}t.subEmitters.push(r)}}return t},E._Serialize=function(e,t,i){var n,r;e.name=t.name,e.id=t.id,e.capacity=t.getCapacity(),t.emitter.position?(n=t.emitter,e.emitterId=n.id):(r=t.emitter,e.emitter=r.asArray()),t.particleEmitterType&&(e.particleEmitterType=t.particleEmitterType.serialize()),t.particleTexture&&(i?e.texture=t.particleTexture.serialize():(e.textureName=t.particleTexture.name,e.invertY=t.particleTexture._invertY)),e.isLocal=t.isLocal,ee.a.AppendSerializedAnimations(t,e),e.beginAnimationOnStart=t.beginAnimationOnStart,e.beginAnimationFrom=t.beginAnimationFrom,e.beginAnimationTo=t.beginAnimationTo,e.beginAnimationLoop=t.beginAnimationLoop,e.startDelay=t.startDelay,e.renderingGroupId=t.renderingGroupId,e.isBillboardBased=t.isBillboardBased,e.billboardMode=t.billboardMode,e.minAngularSpeed=t.minAngularSpeed,e.maxAngularSpeed=t.maxAngularSpeed,e.minSize=t.minSize,e.maxSize=t.maxSize,e.minScaleX=t.minScaleX,e.maxScaleX=t.maxScaleX,e.minScaleY=t.minScaleY,e.maxScaleY=t.maxScaleY,e.minEmitPower=t.minEmitPower,e.maxEmitPower=t.maxEmitPower,e.minLifeTime=t.minLifeTime,e.maxLifeTime=t.maxLifeTime,e.emitRate=t.emitRate,e.gravity=t.gravity.asArray(),e.noiseStrength=t.noiseStrength.asArray(),e.color1=t.color1.asArray(),e.color2=t.color2.asArray(),e.colorDead=t.colorDead.asArray(),e.updateSpeed=t.updateSpeed,e.targetStopDuration=t.targetStopDuration,e.blendMode=t.blendMode,e.preWarmCycles=t.preWarmCycles,e.preWarmStepOffset=t.preWarmStepOffset,e.minInitialRotation=t.minInitialRotation,e.maxInitialRotation=t.maxInitialRotation,e.startSpriteCellID=t.startSpriteCellID,e.endSpriteCellID=t.endSpriteCellID,e.spriteCellChangeSpeed=t.spriteCellChangeSpeed,e.spriteCellWidth=t.spriteCellWidth,e.spriteCellHeight=t.spriteCellHeight,e.spriteRandomStartCell=t.spriteRandomStartCell,e.isAnimationSheetEnabled=t.isAnimationSheetEnabled;var o=t.getColorGradients();if(o){e.colorGradients=[];for(var a=0,s=o;a<s.length;a++){var c=s[a],l={gradient:c.gradient,color1:c.color1.asArray()};c.color2?l.color2=c.color2.asArray():l.color2=c.color1.asArray(),e.colorGradients.push(l)}}var u=t.getRampGradients();if(u){e.rampGradients=[];for(var h=0,d=u;h<d.length;h++){var p=d[h],l={gradient:p.gradient,color:p.color.asArray()};e.rampGradients.push(l)}e.useRampGradients=t.useRampGradients}var f=t.getColorRemapGradients();if(f){e.colorRemapGradients=[];for(var m=0,_=f;m<_.length;m++){var g=_[m];l={gradient:g.gradient,factor1:g.factor1},void 0!==g.factor2?l.factor2=g.factor2:l.factor2=g.factor1,e.colorRemapGradients.push(l)}}var v=t.getAlphaRemapGradients();if(v){e.alphaRemapGradients=[];for(var b=0,y=v;b<y.length;b++){var T=y[b];l={gradient:T.gradient,factor1:T.factor1},void 0!==T.factor2?l.factor2=T.factor2:l.factor2=T.factor1,e.alphaRemapGradients.push(l)}}var E=t.getSizeGradients();if(E){e.sizeGradients=[];for(var S=0,A=E;S<A.length;S++){var C=A[S];l={gradient:C.gradient,factor1:C.factor1},void 0!==C.factor2?l.factor2=C.factor2:l.factor2=C.factor1,e.sizeGradients.push(l)}}var P=t.getAngularSpeedGradients();if(P){e.angularSpeedGradients=[];for(var x=0,R=P;x<R.length;x++){var O=R[x];l={gradient:O.gradient,factor1:O.factor1},void 0!==O.factor2?l.factor2=O.factor2:l.factor2=O.factor1,e.angularSpeedGradients.push(l)}}var M=t.getVelocityGradients();if(M){e.velocityGradients=[];for(var I=0,D=M;I<D.length;I++){var L=D[I];l={gradient:L.gradient,factor1:L.factor1},void 0!==L.factor2?l.factor2=L.factor2:l.factor2=L.factor1,e.velocityGradients.push(l)}}var N=t.getDragGradients();if(N){e.dragGradients=[];for(var F=0,w=N;F<w.length;F++){var B=w[F];l={gradient:B.gradient,factor1:B.factor1},void 0!==B.factor2?l.factor2=B.factor2:l.factor2=B.factor1,e.dragGradients.push(l)}}var U=t.getEmitRateGradients();if(U){e.emitRateGradients=[];for(var V=0,k=U;V<k.length;V++){var G=k[V];l={gradient:G.gradient,factor1:G.factor1},void 0!==G.factor2?l.factor2=G.factor2:l.factor2=G.factor1,e.emitRateGradients.push(l)}}var z=t.getStartSizeGradients();if(z){e.startSizeGradients=[];for(var j=0,W=z;j<W.length;j++){var H=W[j];l={gradient:H.gradient,factor1:H.factor1},void 0!==H.factor2?l.factor2=H.factor2:l.factor2=H.factor1,e.startSizeGradients.push(l)}}var X=t.getLifeTimeGradients();if(X){e.lifeTimeGradients=[];for(var Y=0,K=X;Y<K.length;Y++){var Q=K[Y];l={gradient:Q.gradient,factor1:Q.factor1},void 0!==Q.factor2?l.factor2=Q.factor2:l.factor2=Q.factor1,e.lifeTimeGradients.push(l)}}var q=t.getLimitVelocityGradients();if(q){e.limitVelocityGradients=[];for(var Z=0,J=q;Z<J.length;Z++){var $=J[Z];l={gradient:$.gradient,factor1:$.factor1},void 0!==$.factor2?l.factor2=$.factor2:l.factor2=$.factor1,e.limitVelocityGradients.push(l)}e.limitVelocityDamping=t.limitVelocityDamping}t.noiseTexture&&(e.noiseTexture=t.noiseTexture.serialize())},E._Parse=function(e,t,i,n){if(e.texture?t.particleTexture=H.a.Parse(e.texture,i,n):e.textureName&&(t.particleTexture=new H.a(n+e.textureName,i,!1,void 0===e.invertY||e.invertY),t.particleTexture.name=e.textureName),e.emitterId||0===e.emitterId||void 0!==e.emitter?e.emitterId?t.emitter=i.getLastMeshByID(e.emitterId):t.emitter=W.e.FromArray(e.emitter):t.emitter=W.e.Zero(),t.isLocal=!!e.isLocal,void 0!==e.renderingGroupId&&(t.renderingGroupId=e.renderingGroupId),void 0!==e.isBillboardBased&&(t.isBillboardBased=e.isBillboardBased),void 0!==e.billboardMode&&(t.billboardMode=e.billboardMode),e.animations){for(var r=0;r<e.animations.length;r++){var o=e.animations[r],a=K.a.GetClass("BABYLON.Animation");a&&t.animations.push(a.Parse(o))}t.beginAnimationOnStart=e.beginAnimationOnStart,t.beginAnimationFrom=e.beginAnimationFrom,t.beginAnimationTo=e.beginAnimationTo,t.beginAnimationLoop=e.beginAnimationLoop}if(e.autoAnimate&&i.beginAnimation(t,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),t.startDelay=0|e.startDelay,t.minAngularSpeed=e.minAngularSpeed,t.maxAngularSpeed=e.maxAngularSpeed,t.minSize=e.minSize,t.maxSize=e.maxSize,e.minScaleX&&(t.minScaleX=e.minScaleX,t.maxScaleX=e.maxScaleX,t.minScaleY=e.minScaleY,t.maxScaleY=e.maxScaleY),void 0!==e.preWarmCycles&&(t.preWarmCycles=e.preWarmCycles,t.preWarmStepOffset=e.preWarmStepOffset),void 0!==e.minInitialRotation&&(t.minInitialRotation=e.minInitialRotation,t.maxInitialRotation=e.maxInitialRotation),t.minLifeTime=e.minLifeTime,t.maxLifeTime=e.maxLifeTime,t.minEmitPower=e.minEmitPower,t.maxEmitPower=e.maxEmitPower,t.emitRate=e.emitRate,t.gravity=W.e.FromArray(e.gravity),e.noiseStrength&&(t.noiseStrength=W.e.FromArray(e.noiseStrength)),t.color1=Q.b.FromArray(e.color1),t.color2=Q.b.FromArray(e.color2),t.colorDead=Q.b.FromArray(e.colorDead),t.updateSpeed=e.updateSpeed,t.targetStopDuration=e.targetStopDuration,t.blendMode=e.blendMode,e.colorGradients)for(var s=0,c=e.colorGradients;s<c.length;s++){var l=c[s];t.addColorGradient(l.gradient,Q.b.FromArray(l.color1),l.color2?Q.b.FromArray(l.color2):void 0)}if(e.rampGradients){for(var u=0,h=e.rampGradients;u<h.length;u++){var d=h[u];t.addRampGradient(d.gradient,Q.a.FromArray(d.color))}t.useRampGradients=e.useRampGradients}if(e.colorRemapGradients)for(var p=0,f=e.colorRemapGradients;p<f.length;p++){var m=f[p];t.addColorRemapGradient(m.gradient,void 0!==m.factor1?m.factor1:m.factor,m.factor2)}if(e.alphaRemapGradients)for(var _=0,g=e.alphaRemapGradients;_<g.length;_++){var v=g[_];
1t.addAlphaRemapGradient(v.gradient,void 0!==v.factor1?v.factor1:v.factor,v.factor2)}if(e.sizeGradients)for(var b=0,y=e.sizeGradients;b<y.length;b++){var T=y[b];t.addSizeGradient(T.gradient,void 0!==T.factor1?T.factor1:T.factor,T.factor2)}if(e.angularSpeedGradients)for(var E=0,S=e.angularSpeedGradients;E<S.length;E++){var A=S[E];t.addAngularSpeedGradient(A.gradient,void 0!==A.factor1?A.factor1:A.factor,A.factor2)}if(e.velocityGradients)for(var C=0,P=e.velocityGradients;C<P.length;C++){var x=P[C];t.addVelocityGradient(x.gradient,void 0!==x.factor1?x.factor1:x.factor,x.factor2)}if(e.dragGradients)for(var R=0,O=e.dragGradients;R<O.length;R++){var M=O[R];t.addDragGradient(M.gradient,void 0!==M.factor1?M.factor1:M.factor,M.factor2)}if(e.emitRateGradients)for(var I=0,D=e.emitRateGradients;I<D.length;I++){var L=D[I];t.addEmitRateGradient(L.gradient,void 0!==L.factor1?L.factor1:L.factor,L.factor2)}if(e.startSizeGradients)for(var N=0,F=e.startSizeGradients;N<F.length;N++){var w=F[N];t.addStartSizeGradient(w.gradient,void 0!==w.factor1?w.factor1:w.factor,w.factor2)}if(e.lifeTimeGradients)for(var B=0,U=e.lifeTimeGradients;B<U.length;B++){var V=U[B];t.addLifeTimeGradient(V.gradient,void 0!==V.factor1?V.factor1:V.factor,V.factor2)}if(e.limitVelocityGradients){for(var k=0,G=e.limitVelocityGradients;k<G.length;k++){var z=G[k];t.addLimitVelocityGradient(z.gradient,void 0!==z.factor1?z.factor1:z.factor,z.factor2)}t.limitVelocityDamping=e.limitVelocityDamping}var j;if(e.noiseTexture&&(t.noiseTexture=X.a.Parse(e.noiseTexture,i,n)),e.particleEmitterType){switch(e.particleEmitterType.type){case"SphereParticleEmitter":j=new Y.SphereParticleEmitter;break;case"SphereDirectedParticleEmitter":j=new Y.SphereDirectedParticleEmitter;break;case"ConeEmitter":case"ConeParticleEmitter":j=new Y.ConeParticleEmitter;break;case"CylinderParticleEmitter":j=new Y.CylinderParticleEmitter;break;case"CylinderDirectedParticleEmitter":j=new Y.CylinderDirectedParticleEmitter;break;case"HemisphericParticleEmitter":j=new Y.HemisphericParticleEmitter;break;case"PointParticleEmitter":j=new Y.PointParticleEmitter;break;case"MeshParticleEmitter":j=new Y.MeshParticleEmitter;break;case"BoxEmitter":case"BoxParticleEmitter":default:j=new Y.BoxParticleEmitter}j.parse(e.particleEmitterType,i)}else(j=new Y.BoxParticleEmitter).parse(e,i);t.particleEmitterType=j,t.startSpriteCellID=e.startSpriteCellID,t.endSpriteCellID=e.endSpriteCellID,t.spriteCellWidth=e.spriteCellWidth,t.spriteCellHeight=e.spriteCellHeight,t.spriteCellChangeSpeed=e.spriteCellChangeSpeed,t.spriteRandomStartCell=e.spriteRandomStartCell},E.Parse=function(e,t,i,n){void 0===n&&(n=!1);var r,o=e.name,a=null,s=null;e.customShader&&(r=0<(s=e.customShader).shaderOptions.defines.length?s.shaderOptions.defines.join("\n"):"",a=t.getEngine().createEffectForParticles(s.shaderPath.fragmentElement,s.shaderOptions.uniforms,s.shaderOptions.samplers,r));var c=new E(o,e.capacity,t,a,e.isAnimationSheetEnabled);if(c.customShader=s,e.id&&(c.id=e.id),e.subEmitters){c.subEmitters=[];for(var l=0,u=e.subEmitters;l<u.length;l++){for(var h=[],d=0,p=u[l];d<p.length;d++){var f=p[d];h.push(v.a.Parse(f,t,i))}c.subEmitters.push(h)}}return E._Parse(e,c,t,i),e.textureMask&&(c.textureMask=Q.b.FromArray(e.textureMask)),e.preventAutoStart&&(c.preventAutoStart=e.preventAutoStart),n||c.preventAutoStart||c.start(),c},E.BILLBOARDMODE_Y=f.a.PARTICLES_BILLBOARDMODE_Y,E.BILLBOARDMODE_ALL=f.a.PARTICLES_BILLBOARDMODE_ALL,E.BILLBOARDMODE_STRETCHED=f.a.PARTICLES_BILLBOARDMODE_STRETCHED,E);function E(e,t,i,n,r,o){void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=.01);var m=y.call(this,e)||this;return m._inheritedVelocityOffset=new W.e,m.onDisposeObservable=new a.c,m._particles=new Array,m._stockParticles=new Array,m._newPartsExcess=0,m._vertexBuffers={},m._scaledColorStep=new Q.b(0,0,0,0),m._colorDiff=new Q.b(0,0,0,0),m._scaledDirection=W.e.Zero(),m._scaledGravity=W.e.Zero(),m._currentRenderId=-1,m._useInstancing=!1,m._started=!1,m._stopped=!1,m._actualFrame=0,m._currentEmitRate1=0,m._currentEmitRate2=0,m._currentStartSize1=0,m._currentStartSize2=0,m._rawTextureWidth=256,m._useRampGradients=!1,m._disposeEmitterOnDispose=!1,m.isLocal=!1,m._onBeforeDrawParticlesObservable=null,m.re
1cycleParticle=function(e){var t=m._particles.pop();t!==e&&t.copyTo(e),m._stockParticles.push(t)},m._createParticle=function(){var i,e;return 0!==m._stockParticles.length?(i=m._stockParticles.pop())._reset():i=new p.a(m),m._subEmitters&&0<m._subEmitters.length&&(e=m._subEmitters[Math.floor(Math.random()*m._subEmitters.length)],i._attachedSubEmitters=[],e.forEach(function(e){var t;e.type===v.b.ATTACHED&&(t=e.clone(),i._attachedSubEmitters.push(t),t.particleSystem.start())})),i},m._emitFromParticle=function(i){var e;m._subEmitters&&0!==m._subEmitters.length&&(e=Math.floor(Math.random()*m._subEmitters.length),m._subEmitters[e].forEach(function(e){var t;e.type===v.b.END&&(t=e.clone(),i._inheritParticleInfoToSubEmitter(t),(t.particleSystem._rootParticleSystem=m).activeSubSystems.push(t.particleSystem),t.particleSystem.start())}))},m._capacity=t,m._epsilon=o,m._isAnimationSheetEnabled=r,m._scene=i||d.a.LastCreatedScene,m.uniqueId=m._scene.getUniqueId(),m._attachImageProcessingConfiguration(null),m._customEffect={0:n},m._scene.particleSystems.push(m),m._useInstancing=m._scene.getEngine().getCaps().instancedArrays,m._createIndexBuffer(),m._createVertexBuffers(),m.particleEmitterType=new Y.BoxParticleEmitter,m.updateFunction=function(u){var h=null,d=null;m.noiseTexture&&(h=m.noiseTexture.getSize(),d=m.noiseTexture.getContent());for(var p,e=function(){p=u[f];var e,t=m._scaledUpdateSpeed,i=p.age;p.age+=t,p.age>p.lifeTime&&(e=p.age-i,t=(p.lifeTime-i)*t/e,p.age=p.lifeTime);var n=p.age/p.lifeTime;m._colorGradients&&0<m._colorGradients.length?_.d.GetCurrentGradient(n,m._colorGradients,function(e,t,i){e!==p._currentColorGradient&&(p._currentColor1.copyFrom(p._currentColor2),t.getColorToRef(p._currentColor2),p._currentColorGradient=e),Q.b.LerpToRef(p._currentColor1,p._currentColor2,i,p.color)}):(p.colorStep.scaleToRef(t,m._scaledColorStep),p.color.addInPlace(m._scaledColorStep),p.color.a<0&&(p.color.a=0)),m._angularSpeedGradients&&0<m._angularSpeedGradients.length&&_.d.GetCurrentGradient(n,m._angularSpeedGradients,function(e,t,i){e!==p._currentAngularSpeedGradient&&(p._currentAngularSpeed1=p._currentAngularSpeed2,p._currentAngularSpeed2=t.getFactor(),p._currentAngularSpeedGradient=e),p.angularSpeed=g.a.Lerp(p._currentAngularSpeed1,p._currentAngularSpeed2,i)}),p.angle+=p.angularSpeed*t;var r,o,a,s,c,l=t;if(m._velocityGradients&&0<m._velocityGradients.length&&_.d.GetCurrentGradient(n,m._velocityGradients,function(e,t,i){e!==p._currentVelocityGradient&&(p._currentVelocity1=p._currentVelocity2,p._currentVelocity2=t.getFactor(),p._currentVelocityGradient=e),l*=g.a.Lerp(p._currentVelocity1,p._currentVelocity2,i)}),p.direction.scaleToRef(l,m._scaledDirection),m._limitVelocityGradients&&0<m._limitVelocityGradients.length&&_.d.GetCurrentGradient(n,m._limitVelocityGradients,function(e,t,i){e!==p._currentLimitVelocityGradient&&(p._currentLimitVelocity1=p._currentLimitVelocity2,p._currentLimitVelocity2=t.getFactor(),p._currentLimitVelocityGradient=e);var n=g.a.Lerp(p._currentLimitVelocity1,p._currentLimitVelocity2,i);p.direction.length()>n&&p.direction.scaleInPlace(m.limitVelocityDamping)}),m._dragGradients&&0<m._dragGradients.length&&_.d.GetCurrentGradient(n,m._dragGradients,function(e,t,i){e!==p._currentDragGradient&&(p._currentDrag1=p._currentDrag2,p._currentDrag2=t.getFactor(),p._currentDragGradient=e);var n=g.a.Lerp(p._currentDrag1,p._currentDrag2,i);m._scaledDirection.scaleInPlace(1-n)}),m.isLocal&&p._localPosition?(p._localPosition.addInPlace(m._scaledDirection),W.e.TransformCoordinatesToRef(p._localPosition,m._emitterWorldMatrix,p.position)):p.position.addInPlace(m._scaledDirection),d&&h&&p._randomNoiseCoordinates1&&(r=m._fetchR(p._randomNoiseCoordinates1.x,p._randomNoiseCoordinates1.y,h.width,h.height,d),o=m._fetchR(p._randomNoiseCoordinates1.z,p._randomNoiseCoordinates2.x,h.width,h.height,d),a=m._fetchR(p._randomNoiseCoordinates2.y,p._randomNoiseCoordinates2.z,h.width,h.height,d),s=W.c.Vector3[0],c=W.c.Vector3[1],s.copyFromFloats((2*r-1)*m.noiseStrength.x,(2*o-1)*m.noiseStrength.y,(2*a-1)*m.noiseStrength.z),s.scaleToRef(t,c),p.direction.addInPlace(c)),m.gravity.scaleToRef(t,m._scaledGravity),p.direction.addInPlace(m._scaledGravity),m._sizeGradients&&0<m._sizeGradients.length&&_.d.GetCurrentGradient(n,m._sizeGradients,function(e,t,i){e!==p._currentSizeGradient&&(p._currentSize1=p._currentSize2,p._currentSize2=t.getFactor(),p._currentSizeGradient=e),p.size=g.a.Lerp(p._currentSize1,p._currentSize2,i)}),m._useRampGradients&&(m._colorRemapGradients&&0<m._colorRemapGradients.length&&_.d.GetCurrentGradient(n,m._colorRemapGradients,function(e,t,i){var n=g.a.Lerp(e.factor1,t.factor1,i),r=g.a.Lerp(e.factor2,t.factor2,i);p.remapData.x=n,p.remapData.y=r-n}),m._alphaRemapGradients&&0<m._alphaRemapGradients.length&&_.d.GetCurrentGradient(n,m._alphaRemapGradients,function(e,t,i){var n=g.a.Lerp(e.factor1,t.factor1,i),r=g.a.Lerp(e.factor2,t.factor2,i);p.remapData.z=n,p.remapData.w=r-n})),m._isAnimationSheetEnabled&&p.updateCellIndex(),p._inheritParticleInfoToSubEmitters(),p.age>=p.lifeTime)return m._emitFromParticle(p),p._attachedSubEmitters&&(p._attachedSubEmitters.forEac
1h(function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()}),p._attachedSubEmitters=null),m.recycleParticle(p),f--,"continue"},f=0;f<u.length;f++)e()},m}v.a._ParseParticleSystem=T.Parse},function(e,t,i){"use strict";i.d(t,"b",function(){return U}),i.d(t,"a",function(){return V});var s=i(1),r=i(3),u=i(7),n=i(40),o=i(150),b=i(18),a=i(0),g=i(4),y=i(10),T=i(19),E=i(15),v=(D.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},D.prototype.isReadyForSubMesh=function(e,t,i,n){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&T.a.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&T.a.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&T.a.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},D.prototype.prepareDefines=function(e,t){this._isEnabled?(e.CLEARCOAT=!0,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&T.a.ClearCoatTextureEnabled?E.a.PrepareDefinesForMergedUV(this._texture,e,"CLEARCOAT_TEXTURE"):e.CLEARCOAT_TEXTURE=!1,this._bumpTexture&&T.a.ClearCoatBumpTextureEnabled?E.a.PrepareDefinesForMergedUV(this._bumpTexture,e,"CLEARCOAT_BUMP"):e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===D._DefaultIndexOfRefraction,this._isTintEnabled?(e.CLEARCOAT_TINT=!0,this._tintTexture&&T.a.ClearCoatTintTextureEnabled?E.a.PrepareDefinesForMergedUV(this._tintTexture,e,"CLEARCOAT_TINT_TEXTURE"):e.CLEARCOAT_TINT_TEXTURE=!1):(e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1))):(e.CLEARCOAT=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1)},D.prototype.bindForSubMesh=function(e,t,i,n,r,o,a){var s,c,l,u;e.useUbo&&r&&e.isSync||(this._texture&&T.a.ClearCoatTextureEnabled&&(e.updateFloat2("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level),E.a.BindTextureMatrix(this._texture,e,"clearCoat")),this._bumpTexture&&i.getCaps().standardDerivatives&&T.a.ClearCoatTextureEnabled&&!n&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),E.a.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",o?1:-1,a?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",o?-1:1,a?-1:1)),this._tintTexture&&T.a.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),E.a.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness),s=1-this._indexOfRefraction,c=1+this._indexOfRefraction,l=Math.pow(-s/c,2),u=1/this._indexOfRefraction,e.updateFloat4("vClearCoatRefractionParams",l,u,s,c),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))),t.texturesEnabled&&(this._texture&&T.a.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._bumpTexture&&i.getCaps().standardDerivatives&&T.a.ClearCoatBumpTextureEnabled&&!n&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&T.a.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))},D.prototype.hasTexture=function(e){return this._texture===e||this._bumpTexture===e||this._tintTexture===e},D.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},D.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&0<this._tintTexture.animations.length&&e.push(this._tintTexture)},D.prototype.dispose=function(e){e&&(this._texture&&this._texture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._tintTexture&&this._tintTexture.dispose())},D.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},D.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},D.AddUniforms=function(e){e.push("vClearCoatTangentSpaceParams","vClearCoatParams","vClearCoatRefractionParams","vClearCoatTintParams","clearCoatColorAtDistance","clearCoatMatrix","clearCoatBumpMatrix","clearCoatTintMatrix","vClearCoatInfos","vClearCoatBumpInfos","vClearCoatTintInfos")},D.AddSamplers=function(e){e.push("clearCoatSampler","clearCoatBumpSampler","clearCoatTintSampler")},D.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)},D.prototype.copyTo=function(e){r.a.Clone(function(){return e},this)},D.prototype.serialize=function(){return r.a.Serialize(this)},D.prototype.parse=function(e,t,i){var n=this;r.a.Parse(function(){return n},e,t,i)},D._DefaultIndexOfRefraction=1.5,Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],D.prototype,"isEnabled",void 0),Object(s.c)([Object(r.c)()],D.prototype,"intensity",void 0),Object(s.c)([Object(r.c)()],D.prototype,"roughness",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],D.prototype,"indexOfRefraction",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],D.prototype,"texture",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],D.prototype,"bumpTexture",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],D.prototype,"isTintEnabled",void 0),Object(s.c)([Object(r.e)()],D.prototype,"tintColor",void 0),Object(s.c)([Object(r.c)()],D.prototype,"tintColorAtDistance",void 0),Object(s.c)([Object(r.c)()],D.prototype,"tintThickness",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],D.prototype,"tintTexture",void 0),D),S=(I.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},I.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&T.a.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},I.prototype.prepareDefines=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!t.isVerticesDataPresent(g.b.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&T.a.AnisotropicTextureEnabled?E.a.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1)},I.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&T.a.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),E.a.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&T.a.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)},I.prototype.hasTexture=function(e){return this._texture===e},I.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},I.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture)},I.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},I.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},I.AddFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i},I.AddUniforms=function(e){e.push("vAnisotropy","vAnisotropyInfos","anisotropyMatrix")},I.PrepareUniformBuffer=function(e){e.addUniform("vAnisotropy",3),e.addUniform("vAnisotropyInfos",2),e.addUniform("anisotropyMatrix",16)},I.AddSamplers=function(e){e.push("anisotropySampler")},I.prototype.copyTo=function(e){r.a.Clone(function(){return e},this)},I.prototype.serialize=function(){return r.a.Serialize(this)},I.prototype.parse=function(e,t,i){var n=this;r.a.Parse(function(){return n},e,t,i)},Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],I.prototype,"isEnabled",void 0),Object(s.c)([Object(r.c)()],I.prototype,"intensity",void 0),Object(s.c)([Object(r.n)()],I.prototype,"direction",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],I.prototype,"texture",void 0),I),c=(M.prototype._markAllSubMeshesAsMiscDirty=function(){this._internalMarkAllSubMeshesAsMiscDirty()},M.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.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=this._useSpecularGlossinessInputEnergyConservation},M.prototype.getClassName=function(){return"PBRBRDFConfiguration"},M.prototype.copyTo=function(e){r.a.Clone(function(){return e},this)},M.prototype.serialize=function(){return r.a.Serialize(this)},M.prototype.parse=function(e,t,i){var n=this;r.a.Parse(function(){return n},e,t,i)},M.DEFAULT_USE_ENERGY_CONSERVATION=!0,M.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,M.DEFAULT_USE_SPHERICAL_HARMONICS=!0,M.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION=!0,Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsMiscDirty")],M.prototype,"useEnergyConservation",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsMiscDirty")],M.prototype,"useSmithVisibilityHeightCorrelated",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsMiscDirty")],M.prototype,"useSphericalHarmonics",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsMiscDirty")],M.prototype,"useSpecularGlossinessInputEnergyConservation",void 0),M),A=(O.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},O.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&T.a.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())},O.prototype.prepareDefines=function(e,t){this._isEnabled?(e.SHEEN=this._isEnabled,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&T.a.SheenTextureEnabled?E.a.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"):e.SHEEN_TEXTURE=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1)},O.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&T.a.SheenTextureEnabled&&(e.updateFloat2("vSheenInfos",this._texture.coordinatesIndex,this._texture.level),E.a.BindTextureMatrix(this._texture,e,"sheen")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&this._texture&&T.a.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture)},O.prototype.hasTexture=function(e){return this._texture===e},O.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},O.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture)},O.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},O.prototype.getClassName=function(){return"PBRSheenConfiguration"},O.AddFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i},O.AddUniforms=function(e){e.push("vSheenColor","vSheenRoughness","vSheenInfos","sheenMatrix")},O.PrepareUniformBuffer=function(e){e.addUniform("vSheenColor",4),e.addUniform("vSheenRoughness",1),e.addUniform("vSheenInfos",2),e.addUniform("sheenMatrix",16)},O.AddSamplers=function(e){e.push("sheenSampler")},O.prototype.copyTo=function(e){r.a.Clone(function(){return e},this)},O.prototype.serialize=function(){return r.a.Serialize(this)},O.prototype.parse=function(e,t,i){var n=this;r.a.Parse(function(){return n},e,t,i)},Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"isEnabled",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"linkSheenWithAlbedo",void 0),Object(s.c)([Object(r.c)()],O.prototype,"intensity",void 0),Object(s.c)([Object(r.e)()],O.prototype,"color",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"texture",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"roughness",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"albedoScaling",void 0),O),C=i(14),P=(Object.defineProperty(R.prototype,"scatteringDiffusionProfile",{get:function(){return this._scene.prePassRenderer?this._scene.prePassRenderer.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null},set:function(e){this._scene.enablePrePassRenderer()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.prePassRenderer.subSurfaceConfiguration.addDiffusionProfile(e))}
1,enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"volumeIndexOfRefraction",{get:function(){return 1<=this._volumeIndexOfRefraction?this._volumeIndexOfRefraction:this._indexOfRefraction},set:function(e){this._volumeIndexOfRefraction=1<=e?e:-1},enumerable:!1,configurable:!0}),R.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},R.prototype._markScenePrePassDirty=function(){this._internalMarkScenePrePassDirty()},R.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&T.a.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&T.a.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0},R.prototype.prepareDefines=function(e,t){var i;e._areTexturesDirty&&(e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_REFRACTION=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(e.SUBSURFACE=!0,e._areTexturesDirty&&t.texturesEnabled&&this._thicknessTexture&&T.a.ThicknessTextureEnabled&&E.a.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),e.SS_MASK_FROM_THICKNESS_TEXTURE=this._useMaskFromThicknessTexture),this._isRefractionEnabled&&t.texturesEnabled)&&(i=this._getRefractionTexture(t))&&T.a.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction)},R.prototype.bindForSubMesh=function(e,t,i,n,r,o){var a,s,c,l=this._getRefractionTexture(t);e.useUbo&&n&&e.isSync||(this._thicknessTexture&&T.a.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),E.a.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),l&&T.a.RefractionTextureEnabled&&(e.updateMatrix("refractionMatrix",l.getReflectionTextureMatrix()),a=1,l.isCube||l.depth&&(a=l.depth),s=l.getSize().width,c=this.volumeIndexOfRefraction,e.updateFloat4("vRefractionInfos",l.level,1/c,a,this._invertRefractionY?-1:1),e.updateFloat3("vRefractionMicrosurfaceInfos",s,l.lodGenerationScale,l.lodGenerationOffset),o&&e.updateFloat2("vRefractionFilteringInfo",s,C.a.Log2(s))),this.isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),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,0)),t.texturesEnabled&&(this._thicknessTexture&&T.a.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),l&&T.a.RefractionTextureEnabled&&(r?e.setTexture("refractionSampler",l):(e.setTexture("refractionSampler",l._lodTextureMid||l),e.setTexture("refractionSamplerLow",l._lodTextureLow||l),e.setTexture("refractionSamplerHigh",l._lodTextureHigh||l))))},R.prototype.unbind=function(e){return!(!this._refractionTexture||!this._refractionTexture.isRenderTarget||(e.setTexture("refractionSampler",null),0))},R.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(R.prototype,"disableAlphaBlending",{get:function(){return this.isRefractionEnabled&&this._linkRefractionWithTransparency}
1,enumerable:!1,configurable:!0}),R.prototype.fillRenderTargetTextures=function(e){T.a.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},R.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},R.prototype.hasRenderTargetTextures=function(){return!!(T.a.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},R.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},R.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&0<this._thicknessTexture.animations.length&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&0<this._refractionTexture.animations.length&&e.push(this._refractionTexture)},R.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},R.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},R.AddFallbacks=function(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i},R.AddUniforms=function(e){e.push("vDiffusionDistance","vTintColor","vSubSurfaceIntensity","vRefractionMicrosurfaceInfos","vRefractionFilteringInfo","vRefractionInfos","vThicknessInfos","vThicknessParam","refractionMatrix","thicknessMatrix","scatteringDiffusionProfile")},R.AddSamplers=function(e){e.push("thicknessSampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")},R.PrepareUniformBuffer=function(e){e.addUniform("vRefractionMicrosurfaceInfos",3),e.addUniform("vRefractionFilteringInfo",2),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.addUniform("scatteringDiffusionProfile",1)},R.prototype.copyTo=function(e){r.a.Clone(function(){return e},this)},R.prototype.serialize=function(){return r.a.Serialize(this)},R.prototype.parse=function(e,t,i){var n=this;r.a.Parse(function(){return n},e,t,i)},Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"isRefractionEnabled",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"isTranslucencyEnabled",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markScenePrePassDirty")],R.prototype,"isScatteringEnabled",void 0),Object(s.c)([Object(r.c)()],R.prototype,"_scatteringDiffusionProfileIndex",void 0),Object(s.c)([Object(r.c)()],R.prototype,"refractionIntensity",void 0),Object(s.c)([Object(r.c)()],R.prototype,"translucencyIntensity",void 0),Object(s.c)([Object(r.c)()],R.prototype,"useAlbedoToTintRefraction",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"thicknessTexture",void 0),Object(s.c)([Object(r.m)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"refractionTexture",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"indexOfRefraction",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"volumeIndexOfRefraction",null),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"invertRefractionY",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"linkRefractionWithTransparency",void 0),Object(s.c)([Object(r.c)()],R.prototype,"minimumThickness",void 0),Object(s.c)([Object(r.c)()],R.prototype,"maximumThickness",void 0),Object(s.c)([Object(r.e)()],R.prototype,"tintColor",void 0),Object(s.c)([Object(r.c)()],R.prototype,"tintColorAtDistance",void 0),Object(s.c)([Object(r.e)()],R.prototype,"diffusionDistance",void 0),Object(s.c)([Object(r.c)(),Object(r.b)("_markAllSubMeshesAsTexturesDirty")],R.prototype,"useMaskFromThicknessTexture",void 0),R),x=i(48),l=i(29),h=i(101),d=i(119),p=i(9),f=i(2),m=(i(203),i(5)),_=(i(329),"uniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec4 vMetallicReflectanceFactors;\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;\n#ifdef REALTIME_FILTERING\nuniform vec2 vReflectionFilteringInfo;\n#endif\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_ROUGHNESS\nuniform float vSheenRoughness;\n#endif\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#ifdef REALTIME_FILTERING\nuniform vec2 vRefractionFilteringInfo;\n#endif\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#ifdef SS_SCATTERING\nuniform float scatteringDiffusionProfile;\n#endif\n#endif");function R(e,t,i){this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isScatteringEnabled=!1,this.isScatteringEnabled=!1,this._scatteringDiffusionProfileIndex=0,this.refractionIntensity=1,this.translucencyIntensity=1,this.useAlbedoToTintRefraction=!1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1.5,this.indexOfRefraction=1.5,this._volumeIndexOfRefraction=-1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.tintColor=y.a.White(),this.tintColorAtDistance=1,this.diffusionDistance=y.a.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e,this._internalMarkScenePrePassDirty=t,this._scene=i}function O(e){this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=y.a.White(),this._texture=null,this.texture=null,this._roughness=null,this.roughness=null,this._albedoScaling=!1,this.albedoScaling=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}function M(e){this._useEnergyConservation=M.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=M.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=M.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=M.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=M.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=M.DEFAULT_USE_SPHERICAL_HARMONICS,this._useSpecularGlossinessInputEnergyConservation=M.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this.useSpecularGlossinessInputEnergyConservation=M.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this._internalMarkAllSubMeshesAsMiscDirty=e}function I(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new a.d(1,
10),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}function D(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=D._DefaultIndexOfRefraction,this.indexOfRefraction=D._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=y.a.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}m.a.IncludesShadersStore.pbrFragmentDeclaration=_;m.a.IncludesShadersStore.pbrUboDeclaration="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 vec2 vReflectionFilteringInfo;\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 vec4 vMetallicReflectanceFactors;\nuniform vec2 vMetallicReflectanceInfos;\nuniform mat4 metallicReflectanceMatrix;\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 float vSheenRoughness;\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec2 vRefractionFilteringInfo;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\nuniform float scatteringDiffusionProfile;\nuniform vec4 vDetailInfos;\nuniform mat4 detailMatrix;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};";m.a.IncludesShadersStore.pbrFragmentExtraDeclaration="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\n#ifdef PREPASS\nvarying vec3 vViewPos;\n#endif\n",i(157),i(158);m.a.IncludesShadersStore.pbrFragmentSamplersDeclaration="#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 METALLIC_REFLECTANCE\n#if METALLIC_REFLECTANCEDIRECTUV == 1\n#define vMetallicReflectanceUV vMainUV1\n#elif METALLIC_REFLECTANCEDIRECTUV == 2\n#define vMetallicReflectanceUV vMainUV2\n#else\nvarying vec2 vMetallicReflectanceUV;\n#endif\nuniform sampler2D metallicReflectanceSampler;\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\n#define vClearCoatUV vMainUV1\n#elif
1CLEARCOAT_TEXTUREDIRECTUV == 2\n#define vClearCoatUV vMainUV2\n#else\nvarying vec2 vClearCoatUV;\n#endif\nuniform sampler2D clearCoatSampler;\n#endif\n#ifdef CLEARCOAT_BUMP\n#if CLEARCOAT_BUMPDIRECTUV == 1\n#define vClearCoatBumpUV vMainUV1\n#elif CLEARCOAT_BUMPDIRECTUV == 2\n#define vClearCoatBumpUV vMainUV2\n#else\nvarying vec2 vClearCoatBumpUV;\n#endif\nuniform sampler2D clearCoatBumpSampler;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\n#define vClearCoatTintUV vMainUV1\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\n#define vClearCoatTintUV vMainUV2\n#else\nvarying vec2 vClearCoatTintUV;\n#endif\nuniform sampler2D clearCoatTintSampler;\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\n#if SHEEN_TEXTUREDIRECTUV == 1\n#define vSheenUV vMainUV1\n#elif SHEEN_TEXTUREDIRECTUV == 2\n#define vSheenUV vMainUV2\n#else\nvarying vec2 vSheenUV;\n#endif\nuniform sampler2D sheenSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\n#define vAnisotropyUV vMainUV1\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\n#define vAnisotropyUV vMainUV2\n#else\nvarying vec2 vAnisotropyUV;\n#endif\nuniform sampler2D anisotropySampler;\n#endif\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;\nuniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D refractionSamplerLow;\nuniform sampler2D 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",i(159),i(177),i(178),i(201),i(74),i(345),i(346);m.a.IncludesShadersStore.pbrHelperFunctions="\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);
1\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",i(160),i(219);m.a.IncludesShadersStore.harmonicsFunctions="#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";m.a.IncludesShadersStore.pbrDirectLightingSetupFunctions="\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}";m.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions="float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}
1\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}",i(347),i(348);m.a.IncludesShadersStore.pbrDirectLightingFunctions="#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}\n#define inline\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);
1\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 smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*smithVisibility;\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 smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*smithVisibility;\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 kelemenVisibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*kelemenVisibility;\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\nfloat fresnel=1.;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\n\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\n\nfloat sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n";m.a.IncludesShadersStore.pbrIBLFunctions="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\
1nfloat lod=log2(cubeMapDimensionPixels)*roughness;\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\n\n\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {\n\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,geometricNormal));\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",i(221),i(222),i(220);m.a.IncludesShadersStore.pbrBlockAlbedoOpacity="struct albedoOpacityOutParams\n{\nvec3 surfaceAlbedo;\nfloat alpha;\n};\n#define pbr_inline\nvoid albedoOpacityBlock(\nconst in vec4 vAlbedoColor,\n#ifdef ALBEDO\nconst in vec4 albedoTexture,\nconst in vec2 albedoInfos,\n#endif\n#ifdef OPACITY\nconst in vec4 opacityMap,\nconst in vec2 vOpacityInfos,\n#endif\n#ifdef DETAIL\nconst in vec4 detailColor,\nconst in vec4 vDetailInfos,\n#endif\nout albedoOpacityOutParams outParams\n)\n{\n\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\n#ifdef GAMMAALBEDO\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\n#else\nsurfaceAlbedo*=albedoTexture.rgb;\n#endif\nsurfaceAlbedo*=albedoInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nsurfaceAlbedo*=vColor.rgb;\n#endif\n#ifdef DETAIL\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);\nsurfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\n\n#ifdef OPACITY\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\nif (alpha<ALPHATESTVALUE)\ndiscard;\n#ifndef ALPHABLEND\n\nalpha=1.0;\n#endif\n#endif\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo;\noutParams.alpha=alpha;\n}\n";m.a.IncludesShadersStore.pbrBlockReflectivity="struct reflectivityOutParams\n{\nfloat microSurface;\nfloat roughness;\nvec3 surfaceReflectivityColor;\n#ifdef METALLICWORKFLOW\nvec3 surfaceAlbedo;\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\nvec3 ambientOcclusionColor;\n#endif\n#if DEBUGMODE>0\nvec4 surfaceMetallicColorMap;\nvec4 surfaceReflectivityColorMap;\nvec2 metallicRoughness;\nvec3 metallicF0;\n#endif\n};\n#define pbr_inline\nvoid reflectivityBlock(\nconst in vec4 vReflectivityColor,\n#ifdef METALLICWORKFLOW\nconst in vec3 surfaceAlbedo,\nconst in vec4 metallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nconst in vec3 reflectivityInfos,\nconst in vec4 surfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\nconst in vec3 ambientOcclusionColorIn,\n#endif\n#ifdef MICROSURFACEMAP\nconst in vec4 microSurfaceTexel,\n#endif\n#ifdef DETAIL\nconst in vec4 detailColor,\nconst in vec4 vDetailInfos,\n#endif\nout reflectivityOutParams outParams\n)\n{\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\n#ifdef REFLECTIVITY\n#if DEBUGMODE>0\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef AOSTOREINMETALMAPRED\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);\noutParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,vReflectivityInfos.z);\n#endif\n#ifdef METALLNESSSTOREINMETALMAPBLUE\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\n#else\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\n#endif\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\n#else\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\n#endif\n#endif\n#endif\n#ifdef DETAIL\nfloat detailRoughness=2.0*mix(0.5,detailColor.b,vDetailInfos.w);\nmetallicRoughness.g=saturate(metallicRoughness.g*detailRoughness);\n#endif\n#ifdef MICROSURFACEMAP\nmetallicRoughness.g*=microSurfaceTexel.r;\n#endif\n#if DEBUGMODE>0\noutParams.metallicRoughness=metallicRoughness;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\n\nmicroSurface=1.0-metallicRoughness.g;\n\nvec3 baseColor=surfaceAlbedo;\n#ifdef FROSTBITE_REFLECTANCE\n\n\n\n\n\n\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\n\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\n#else\nvec3 metallicF0=metallicReflectanceFactors.rgb;\n#if DEBUGMODE>0\noutParams.metallicF0=metallicF0;\n#endif\n\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);\n\nsurfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\n#endif\n#else\n#ifdef REFLECTIVITY\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\n#if DEBUGMODE>0\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;\nmicroSurface*=reflectivityInfos.z;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);
1\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurface*=microSurfaceTexel.r;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\n#endif\n#endif\n#endif\n\nmicroSurface=saturate(microSurface);\n\nfloat roughness=1.-microSurface;\noutParams.microSurface=microSurface;\noutParams.roughness=roughness;\noutParams.surfaceReflectivityColor=surfaceReflectivityColor;\n}\n";m.a.IncludesShadersStore.pbrBlockAmbientOcclusion="struct ambientOcclusionOutParams\n{\nvec3 ambientOcclusionColor;\n#if DEBUGMODE>0\nvec3 ambientOcclusionColorMap;\n#endif\n};\n#define pbr_inline\nvoid ambientOcclusionBlock(\n#ifdef AMBIENT\nconst in vec3 ambientOcclusionColorMap_,\nconst in vec4 vAmbientInfos,\n#endif\nout ambientOcclusionOutParams outParams\n)\n{\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\n#if DEBUGMODE>0\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\n#endif\n#endif\noutParams.ambientOcclusionColor=ambientOcclusionColor;\n}\n";m.a.IncludesShadersStore.pbrBlockAlphaFresnel="#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nstruct alphaFresnelOutParams\n{\nfloat alpha;\n};\n#define pbr_inline\nvoid alphaFresnelBlock(\nconst in vec3 normalW,\nconst in vec3 viewDirectionW,\nconst in float alpha,\nconst in float microSurface,\nout alphaFresnelOutParams outParams\n)\n{\n\n\n\nfloat opacityPerceptual=alpha;\n#ifdef LINEARALPHAFRESNEL\nfloat opacity0=opacityPerceptual;\n#else\nfloat opacity0=opacityPerceptual*opacityPerceptual;\n#endif\nfloat opacity90=fresnelGrazingReflectance(opacity0);\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\n\noutParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\n#ifdef ALPHATEST\nif (outParams.alpha<ALPHATESTVALUE)\ndiscard;\n#ifndef ALPHABLEND\n\noutParams.alpha=1.0;\n#endif\n#endif\n}\n#endif\n#endif\n";m.a.IncludesShadersStore.pbrBlockAnisotropic="#ifdef ANISOTROPIC\nstruct anisotropicOutParams\n{\nfloat anisotropy;\nvec3 anisotropicTangent;\nvec3 anisotropicBitangent;\nvec3 anisotropicNormal;\n#if DEBUGMODE>0\nvec3 anisotropyMapData;\n#endif\n};\n#define pbr_inline\nvoid anisotropicBlock(\nconst in vec3 vAnisotropy,\n#ifdef ANISOTROPIC_TEXTURE\nconst in vec3 anisotropyMapData,\n#endif\nconst in mat3 TBN,\nconst in vec3 normalW,\nconst in vec3 viewDirectionW,\nout anisotropicOutParams outParams\n)\n{\nfloat anisotropy=vAnisotropy.b;\nvec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\n#ifdef ANISOTROPIC_TEXTURE\nanisotropy*=anisotropyMapData.b;\nanisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;\n#if DEBUGMODE>0\noutParams.anisotropyMapData=anisotropyMapData;\n#endif\n#endif\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));\nvec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);\nvec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));\noutParams.anisotropy=anisotropy;\noutParams.anisotropicTangent=anisotropicTangent;\noutParams.anisotropicBitangent=anisotropicBitangent;\noutParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);\n}\n#endif\n";m.a.IncludesShadersStore.pbrBlockReflection="#ifdef REFLECTION\nstruct reflectionOutParams\n{\nvec4 environmentRadiance;\nvec3 environmentIrradiance;\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords;\n#else\nvec2 reflectionCoords;\n#endif\n#ifdef SS_TRANSLUCENCY\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nvec3 irradianceVector;\n#endif\n#endif\n#endif\n};\n#define pbr_inline\nvoid createReflectionCoords(\nconst in vec3 vPositionW,\nconst in vec3 normalW,\n#ifdef ANISOTROPIC\nconst in anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REFLECTIONMAP_3D\nout vec3 reflectionCoords\n#else\nout vec2 reflectionCoords\n#endif\n)\n{\n#ifdef ANISOTROPIC\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\n#else\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nreflectionCoords=reflectionVector;\n#else\nreflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n}\n#define pbr_inline\n#define inline\nvoid sampleReflectionTexture(\nconst in float alphaG,\nconst in vec3 vReflectionMicrosurfaceInfos,\nconst in vec2 vReflectionInfos,\nconst in vec3 vReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nconst in float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nconst in float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSampler,\nconst vec3 reflectionCoords,\n#else\nconst in sampler2D reflectionSampler,\nconst vec2 reflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSamplerLow,\nconst in samplerCube reflectionSamplerHigh,\n#else\nconst in sampler2D reflectionSamplerLow,\nconst in sampler2D reflectionSamplerHigh,\n#endif\n#endif\nout vec4 environmentRadiance\n)\n{\n\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\n\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef LODINREFLECTIONALPHA\n\n\n\n\n\n\n\n\n\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\n#else\nfloat requestedReflectionLOD=reflectionLOD;\n#endif\n#ifdef REALTIME_FILTERING\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\n#else\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#endif\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);\nif (lodReflectionNormalizedDoubled<1.0){\nenvironmentRadiance=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nenvironmentMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nenvironmentRadiance=mix(\nenvironmentMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\n\nenvironmentRadiance.rgb*=vReflectionInfos.x;\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\n}\n#define pbr_inline\n#define inline\nvoid reflectionBlock(\nconst in vec3 vPositionW,\nconst in vec3 normalW,\nconst in float alphaG,\nconst in vec3 vReflectionMicrosurfaceInfos,\nconst in vec2 vReflectionInfos,\nconst in vec3 vReflectionColor,\n#ifdef ANISOTROPIC\nconst in anisotropicOutParams anisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nconst in float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nconst in float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSampler,\n#else\nconst in sampler2D reflectionSampler,\n#endif\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nconst in vec3 vEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nconst in mat4 reflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube irradianceSampler,\n#else\nconst in sampler2D irradianceSampler,\n#endif\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSamplerLow,\nconst in samplerCube reflectionSamplerHigh,\n#else\nconst in sampler2D reflectionSamplerLow,\nconst in sampler2D reflectionSamplerHigh,\n#endif\n#endif\nout reflectionOutParams outParams\n)\n{\n\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=vec3(0.);\n#else\nvec2 reflectionCoords=vec2(0.);\n#endif\ncreateReflectionCoords(\nvPositionW,\nnormalW,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\nreflectionCoords\n);\nsampleReflectionTexture(\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionSampler,\nreflectionCoords,\n#else\nreflectionSampler,\nreflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\nenvironmentRadiance\n);\n\nvec3 environmentIrradiance=vec3(0.,0.,0.);\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradiance;\n#else\n#ifdef ANISOTROPIC\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\n#else\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#if defined(REALTIME_FILTERING)\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\n#else\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\n#endif\n#ifdef SS_TRANSLUCENCY\noutParams.irradianceVector=irradianceVector;\n#endif\n#endif\n#elif defined(USEIRRADIANCEMAP)\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);\nenvironmentIrradiance=environmentIrradiance4.rgb;\n#ifdef RGBDREFLECTION\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#endif\nenvironmentIrradiance*=vReflectionColor.rgb;\noutParams.environmentRadiance=environmentRadiance;\noutParams.environmentIrradiance=environmentIrradiance;\noutParams.reflectionCoords=reflectionCoords;\n}\n#endif\n";m.a.IncludesShadersStore.pbrBlockSheen="#ifdef SHEEN\nstruct sheenOutParams\n{\nfloat sheenIntensity;
1\nvec3 sheenColor;\nfloat sheenRoughness;\n#ifdef SHEEN_LINKWITHALBEDO\nvec3 surfaceAlbedo;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfloat sheenAlbedoScaling;\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nvec3 finalSheenRadianceScaled;\n#endif\n#if DEBUGMODE>0\nvec4 sheenMapData;\nvec3 sheenEnvironmentReflectance;\n#endif\n};\n#define pbr_inline\n#define inline\nvoid sheenBlock(\nconst in vec4 vSheenColor,\n#ifdef SHEEN_ROUGHNESS\nconst in float vSheenRoughness,\n#endif\nconst in float roughness,\n#ifdef SHEEN_TEXTURE\nconst in vec4 sheenMapData,\n#endif\nconst in float reflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nconst in vec3 baseColor,\nconst in vec3 surfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nconst in float NdotV,\nconst in vec3 environmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nconst in vec2 AARoughnessFactors,\nconst in vec3 vReflectionMicrosurfaceInfos,\nconst in vec2 vReflectionInfos,\nconst in vec3 vReflectionColor,\nconst in vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSampler,\nconst in vec3 reflectionCoords,\n#else\nconst in sampler2D reflectionSampler,\nconst in vec2 reflectionCoords,\n#endif\nconst in float NdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSamplerLow,\nconst in samplerCube reflectionSamplerHigh,\n#else\nconst in sampler2D reflectionSamplerLow,\nconst in sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nconst in float seo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nconst in float eho,\n#endif\n#endif\nout sheenOutParams outParams\n)\n{\nfloat sheenIntensity=vSheenColor.a;\n#ifdef SHEEN_TEXTURE\n#if DEBUGMODE>0\noutParams.sheenMapData=sheenMapData;\n#endif\n#endif\n#ifdef SHEEN_LINKWITHALBEDO\nfloat sheenFactor=pow5(1.0-sheenIntensity);\nvec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);\nfloat sheenRoughness=sheenIntensity;\noutParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#else\nvec3 sheenColor=vSheenColor.rgb;\n#ifdef SHEEN_TEXTURE\nsheenColor.rgb*=sheenMapData.rgb;\n#endif\n#ifdef SHEEN_ROUGHNESS\nfloat sheenRoughness=vSheenRoughness;\n#ifdef SHEEN_TEXTURE\nsheenRoughness*=sheenMapData.a;\n#endif\n#else\nfloat sheenRoughness=roughness;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#endif\n\n#if !defined(SHEEN_ALBEDOSCALING)\nsheenIntensity*=(1.-reflectance);\n#endif\n\nsheenColor*=sheenIntensity;\n#endif\n\n#ifdef ENVIRONMENTBRDF\n\n#ifdef SHEEN_ROUGHNESS\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\n#else\nvec3 environmentSheenBrdf=environmentBrdf;\n#endif\n\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\n#ifdef SPECULARAA\n\nsheenAlphaG+=AARoughnessFactors.y;\n#endif\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);\nsampleReflectionTexture(\nsheenAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nsheenRoughness,\n#endif\nreflectionSampler,\nreflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\nenvironmentSheenRadiance\n);\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nsheenEnvironmentReflectance*=seo;\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nsheenEnvironmentReflectance*=eho;\n#endif\n#if DEBUGMODE>0\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\n#endif\noutParams.finalSheenRadianceScaled=\nenvironmentSheenRadiance.rgb *\nsheenEnvironmentReflectance *\nvLightingIntensity.z;\n\n\n\n\n\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\n\n\n\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\n#endif\n\noutParams.sheenIntensity=sheenIntensity;\noutParams.sheenColor=sheenColor;\noutParams.sheenRoughness=sheenRoughness;\n}\n#endif\n";m.a.IncludesShadersStore.pbrBlockClearcoat="struct clearcoatOutParams\n{\nvec3 specularEnvironmentR0;
1\nfloat conservationFactor;\nvec3 clearCoatNormalW;\nvec2 clearCoatAARoughnessFactors;\nfloat clearCoatIntensity;\nfloat clearCoatRoughness;\n#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;\nfloat clearCoatNdotVRefract;\nvec3 clearCoatColor;\nfloat clearCoatThickness;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\n#endif\n#if DEBUGMODE>0\nmat3 TBNClearCoat;\nvec2 clearCoatMapData;\nvec4 clearCoatTintMapData;\nvec4 environmentClearCoatRadiance;\nfloat clearCoatNdotV;\nvec3 clearCoatEnvironmentReflectance;\n#endif\n};\n#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\nconst in vec3 vPositionW,\nconst in vec3 geometricNormalW,\nconst in vec3 viewDirectionW,\nconst in vec2 vClearCoatParams,\nconst in vec3 specularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nconst in vec2 clearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nconst in vec4 vClearCoatTintParams,\nconst in float clearCoatColorAtDistance,\nconst in vec4 vClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nconst in vec4 clearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nconst in vec2 vClearCoatBumpInfos,\nconst in vec4 clearCoatBumpMapData,\nconst in vec2 vClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nconst in mat3 vTBN,\n#else\nconst in vec2 vClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nconst in mat4 normalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nconst in vec3 faceNormal,\n#endif\n#ifdef REFLECTION\nconst in vec3 vReflectionMicrosurfaceInfos,\nconst in vec2 vReflectionInfos,\nconst in vec3 vReflectionColor,\nconst in vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSampler,\n#else\nconst in sampler2D reflectionSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube reflectionSamplerLow,\nconst in samplerCube reflectionSamplerHigh,\n#else\nconst in sampler2D reflectionSamplerLow,\nconst in sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nconst in float ambientMonochrome,\n#endif\n#endif\nout clearcoatOutParams outParams\n)\n{\n\nfloat clearCoatIntensity=vClearCoatParams.x;\nfloat clearCoatRoughness=vClearCoatParams.y;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\nclearCoatRoughness*=clearCoatMapData.y;\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\n#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;\noutParams.clearCoatRoughness=clearCoatRoughness;\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\nfloat clearCoatThickness=vClearCoatTintParams.a;\n#ifdef CLEARCOAT_TINT_TEXTURE\nclearCoatColor*=clearCoatTintMapData.rgb;\nclearCoatThickness*=clearCoatTintMapData.a;\n#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\n#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\noutParams.clearCoatThickness=clearCoatThickness;\n#endif\n\n\n\n\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\n\nvec3 clearCoatNormalW=geometricNormalW;\n#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\n#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\n#else\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,vClearCoatBumpUV,vClearCoatTangentSpaceParams);\n#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz*2.0-1.0);\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\n#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=gl_FrontFacing ? clearCoatNormalW : -clearCoatNormalW;\n#endif\noutParams.clearCoatNormalW=clearCoatNormalW;\n\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\n\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\n\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\n#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\n#endif\n#ifdef CLEARCOAT_TINT\n\nvec3 clearCoatVRefract=-refract(vPositionW,clearCoatNormalW,vClearCoatRefractionParams.y);\n\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\n#endif\n\n#if defined(REFLECTION)\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\n#ifdef SPECULARAA\n\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\n#endif\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nclearCoatReflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\n#else\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\n#endif\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\n#endif\nsampleReflectionTexture(\nclearCoatAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nclearCoatNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nclearCoatRoughness,\n#endif\nreflectionSampler,\nclearCoatReflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\nenvironmentClearCoatRadiance\n);\n#if DEBUGMODE>0\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\n#endif\n\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\n#ifdef RADIANCEOCCLUSION\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\nclearCoatEnvironmentReflectance*=clearCoatSeo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\nclearCoatEnvironmentReflectance*=clearCoatEho;\n#endif\n#endif\n#endif\n#else\n\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\n#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\n#if DEBUGMODE>0\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\n#endif\noutParams.finalClearCoatRadianceScaled=\nenvironmentClearCoatRadiance.rgb *\nclearCoatEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(CLEARCOAT_TINT)\n\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\n#endif\n\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnelIBLClearCoat*=clearCoatIntensity;\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\n#endif\n}\n#endif\n";m.a.IncludesShadersStore.pbrBlockSubSurface="struct subSurfaceOutParams\n{\nvec3 specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nvec3 finalRefraction;\nvec3 surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nfloat alpha;\n#endif\n#ifdef REFLECTION\nfloat refractionFactorForIrradiance;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvec3 transmittance;\n#ifdef REFLECTION\nvec3 refractionIrradiance;\n#endif\n#endif\n#if DEBUGMODE>0\nvec4 thicknessMap;
1\nvec4 environmentRefraction;\nvec3 refractionTransmittance;\n#endif\n};\n#ifdef SUBSURFACE\n#define pbr_inline\n#define inline\nvoid subSurfaceBlock(\nconst in vec3 vSubSurfaceIntensity,\nconst in vec2 vThicknessParam,\nconst in vec4 vTintColor,\nconst in vec3 normalW,\nconst in vec3 specularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nconst in vec4 thicknessMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nconst in mat4 reflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nconst in vec3 irradianceVector_,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nconst in samplerCube irradianceSampler,\n#else\nconst in sampler2D irradianceSampler,\n#endif\n#endif\n#endif\n#endif\n#ifdef SS_REFRACTION\nconst in vec3 vPositionW,\nconst in vec3 viewDirectionW,\nconst in mat4 view,\nconst in vec3 surfaceAlbedo,\nconst in vec4 vRefractionInfos,\nconst in mat4 refractionMatrix,\nconst in vec3 vRefractionMicrosurfaceInfos,\nconst in vec4 vLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nconst in float alpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nconst in float NdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nconst in float roughness,\n#else\nconst in float alphaG,\n#endif\n#ifdef SS_REFRACTIONMAP_3D\nconst in samplerCube refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nconst in samplerCube refractionSamplerLow,\nconst in samplerCube refractionSamplerHigh,\n#endif\n#else\nconst in sampler2D refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nconst in sampler2D refractionSamplerLow,\nconst in sampler2D refractionSamplerHigh,\n#endif\n#endif\n#ifdef ANISOTROPIC\nconst in anisotropicOutParams anisotropicOut,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nconst in vec3 vDiffusionDistance,\n#endif\nout subSurfaceOutParams outParams\n)\n{\noutParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\n\n\n\n#ifdef SS_REFRACTION\nfloat refractionIntensity=vSubSurfaceIntensity.x;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nrefractionIntensity*=(1.0-alpha);\n\noutParams.alpha=1.0;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\n#if DEBUGMODE>0\noutParams.thicknessMap=thicknessMap;\n#endif\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\n#ifdef SS_REFRACTION\nrefractionIntensity*=thicknessMap.g;\n#endif\n#ifdef SS_TRANSLUCENCY\ntranslucencyIntensity*=thicknessMap.b;\n#endif\n#endif\n#else\nfloat thickness=vThicknessParam.y;\n#endif\n\n\n\n#ifdef SS_TRANSLUCENCY\nthickness=maxEps(thickness);\nvec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);\ntransmittance*=translucencyIntensity;\noutParams.transmittance=transmittance;\n#endif\n\n\n\n#ifdef SS_REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef ANISOTROPIC\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\n#else\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#endif\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n\n#ifdef SS_REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nvec3 refractionCoords=refractionVector;\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#elif defined(SS_LINEARSPECULARREFRACTION)\nfloat refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,roughness);\n#else\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\n\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef SS_LODINREFRACTIONALPHA\n\n\n\n\n\n\n\n\n\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\n#ifdef REALTIME_FILTERING\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\n#else\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#endif\n#else\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\nif (lodRefractionNormalizedDoubled<1.0){\nenvironmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);\n} else {\nenvironmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef SS_RGBDREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef SS_GAMMAREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\n\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n\n\n\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\n\n\n\n\n\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\n\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\n\nenvironmentRefraction.rgb*=volumeAlbedo;\n#else\n\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n#ifdef SS_ALBEDOFORREFRACTIONTINT\n\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\n#endif\n\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\n#ifdef REFLECTION\n\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\n\n#endif\n\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\noutParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\n#if DEBUGMODE>0\noutParams.refractionTransmittance=refractionTransmittance;\n#endif\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\n#if DEBUGMODE>0\noutParams.environmentRefraction=environmentRefraction;\n#endif\n#endif\n\n\n\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#else\nvec3 irradianceVector=irradianceVector_;\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP)\n#if defined(REALTIME_FILTERING)\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\n#else\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec3 irradianceCoords=irradianceVector;\n#else\nvec2 irradianceCoords=irradianceVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nirradianceCoords/=irradianceVector.z;\n#endif\nirradianceCoords.y=1.0-irradianceCoords.y;\n#endif\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\n#ifdef RGBDREFLECTION\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\n#endif\n#ifdef GAMMAREFLECTION\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\n#endif\n#else\nvec4 refractionIrradiance=vec4(0.);\n#endif\nrefractionIrradiance.rgb*=transmittance;\noutParams.refractionIrradiance=refractionIrradiance.rgb;\n#endif\n}\n#endif\n",i(161);m.a.IncludesShadersStore.pbrBlockNormalGeometric="vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\nvec3 geometricNormalW=normalW;\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\n#endif\n",i(223);m.a.IncludesShadersStore.pbrBlockNormalFinal="#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n",i(331);m.a.IncludesShadersStore.pbrBlockLightmapInit="#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\n#ifdef GAMMALIGHTMAP\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);
1\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n";m.a.IncludesShadersStore.pbrBlockGeometryInfo="float NdotVUnclamped=dot(normalW,viewDirectionW);\n\nfloat NdotV=absEps(NdotVUnclamped);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\n#ifdef SPECULARAA\n\nalphaG+=AARoughnessFactors.y;\n#endif\n#if defined(ENVIRONMENTBRDF)\n\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\n#ifdef AMBIENTINGRAYSCALE\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\n#else\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\n#endif\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\n#endif\n#endif\n#endif\n#endif\n";m.a.IncludesShadersStore.pbrBlockReflectance0="float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);\nvec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\n#else\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef ALPHAFRESNEL\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\nspecularEnvironmentR90=specularEnvironmentR90*reflectance90;\n#endif\n";m.a.IncludesShadersStore.pbrBlockReflectance="#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\n#ifdef RADIANCEOCCLUSION\nspecularEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nspecularEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#else\n\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n#endif\n#ifdef CLEARCOAT\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\n#endif\n#endif\n";m.a.IncludesShadersStore.pbrBlockDirectLighting="vec3 diffuseBase=vec3(0.,0.,0.);\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#ifdef CLEARCOAT\nvec3 clearCoatBase=vec3(0.,0.,0.);\n#endif\n#ifdef SHEEN\nvec3 sheenBase=vec3(0.,0.,0.);\n#endif\n\npreLightingInfo preInfo;\nlightingInfo info;\nfloat shadow=1.;\n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\nvec3 absorption=vec3(0.);\n#endif\n",i(224);m.a.IncludesShadersStore.pbrBlockFinalLitComponents="\n\n\n\n#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\n#endif\n#endif\n#ifndef METALLICWORKFLOW\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\n#endif\n#endif\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\n#endif\n\n#ifdef REFLECTION\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\n#if defined(CLEARCOAT)\nfinalIrradiance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nfinalIrradiance*=clearcoatOut.absorption;\n#endif\n#endif\n#if defined(SS_REFRACTION)\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\n#endif\n#if defined(SS_TRANSLUCENCY)\nfinalIrradiance+=subSurfaceOut.refractionIrradiance;\n#endif\nfinalIrradiance*=surfaceAlbedo.rgb;\nfinalIrradiance*=vLightingIntensity.z;\nfinalIrradiance*=aoOut.ambientOcclusionColor;\n#endif\n\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;\nfinalSpecular=max(finalSpecular,0.0);\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n\n#ifdef REFLECTION\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;\nfinalRadiance*=subSurfaceOut.specularEnvironmentReflectance;\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;\nfinalSheen=max(finalSheen,0.0);\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;\nfinalClearCoat=max(finalClearCoat,0.0);\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\n#ifdef CLEARCOAT_TINT\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n";m.a.IncludesShadersStore.pbrBlockFinalUnlitComponents="\nvec3 finalDiffuse=diffuseBase;\nfinalDiffuse*=surfaceAlbedo.rgb;\nfinalDiffuse=max(finalDiffuse,0.0);\nfinalDiffuse*=vLightingIntensity.x;\n\nvec3 finalAmbient=vAmbientColor;\nfinalAmbient*=surfaceAlbedo.rgb;\n\nvec3 finalEmissive=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\nfinalEmissive*=vEmissiveInfos.y;\n#endif\nfinalEmissive*=vLightingIntensity.y;\n\n#ifdef AMBIENT\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\n#else\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\n#endif\nfinalAmbient*=aoOut.ambientOcclusionColor;\nfinalDiffuse*=ambientOcclusionForDirectDiffuse;\n";m.a.IncludesShadersStore.pbrBlockFinalColorComposition="vec4 finalColor=vec4(\nfinalAmbient +\nfinalDiffuse +\n#ifndef UNLIT\n#ifdef REFLECTION\nfinalIrradiance +\n#endif\n#ifdef SPECULARTERM\nfinalSpecularScaled +\n#endif\n#ifdef SHEEN\nfinalSheenScaled +\n#endif\n#ifdef CLEARCOAT\nfinalClearCoatScaled +\n#endif\n#ifdef REFLECTION\nfinalRadianceScaled +\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled +\n#endif\n#ifdef CLEARCOAT\nclearcoatOut.finalClearCoatRadianceScaled +\n#endif\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction +\n#endif\n#endif\nfinalEmissive,\nalpha);\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor.rgb;\n#else\nfinalColor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\n\nfinalColor=max(finalColor,0.0);\n",i(309),i(225);m.a.IncludesShadersStore.pbrBlockImageProcessing="#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#else\n\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\nfinalColor.rgb*=finalColor.a;\n#endif\n";
1m.a.IncludesShadersStore.pbrDebug="#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\n\n#if DEBUGMODE == 1\ngl_FragColor.rgb=vPositionW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 2 && defined(NORMAL)\ngl_FragColor.rgb=vNormalW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 3 && defined(BUMP) || DEBUGMODE == 3 && defined(PARALLAX) || DEBUGMODE == 3 && defined(ANISOTROPIC)\n\ngl_FragColor.rgb=TBN[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 4 && defined(BUMP) || DEBUGMODE == 4 && defined(PARALLAX) || DEBUGMODE == 4 && defined(ANISOTROPIC)\n\ngl_FragColor.rgb=TBN[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 5\n\ngl_FragColor.rgb=normalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 6 && defined(MAINUV1)\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\n#elif DEBUGMODE == 7 && defined(MAINUV2)\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\n#elif DEBUGMODE == 8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\n\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\n\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 10 && defined(CLEARCOAT)\n\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 11 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 12 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE == 13 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\n#define DEBUGMODE_NORMALIZE\n\n#elif DEBUGMODE == 20 && defined(ALBEDO)\ngl_FragColor.rgb=albedoTexture.rgb;\n#elif DEBUGMODE == 21 && defined(AMBIENT)\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\n#elif DEBUGMODE == 22 && defined(OPACITY)\ngl_FragColor.rgb=opacityMap.rgb;\n#elif DEBUGMODE == 23 && defined(EMISSIVE)\ngl_FragColor.rgb=emissiveColorTex.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 24 && defined(LIGHTMAP)\ngl_FragColor.rgb=lightmapColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\n#elif DEBUGMODE == 26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\n#elif DEBUGMODE == 28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\n#elif DEBUGMODE == 29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\n#elif DEBUGMODE == 30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\n#elif DEBUGMODE == 31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\n\n#elif DEBUGMODE == 40 && defined(SS_REFRACTION)\n\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 41 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 42 && defined(CLEARCOAT) && defined(REFLECTION)\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\n#define DEBUGMODE_GAMMA\n\n#elif DEBUGMODE == 50\ngl_FragColor.rgb=diffuseBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 51 && defined(SPECULARTERM)\ngl_FragColor.rgb=specularBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 52 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearCoatBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 53 && defined(SHEEN)\ngl_FragColor.rgb=sheenBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 54 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\n#define DEBUGMODE_GAMMA\n\n#elif DEBUGMODE == 60\ngl_FragColor.rgb=surfaceAlbedo.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 61\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 62 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\n#elif DEBUGMODE == 71 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.metallicF0;\n#elif DEBUGMODE == 63\ngl_FragColor.rgb=vec3(roughness);\n#elif DEBUGMODE == 64\ngl_FragColor.rgb=vec3(alphaG);\n#elif DEBUGMODE == 65\ngl_FragColor.rgb=vec3(NdotV);\n#elif DEBUGMODE == 66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 67 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\n#elif DEBUGMODE == 68 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\n#elif DEBUGMODE == 69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\ngl_FragColor.rgb=subSurfaceOut.transmittance;\n#elif DEBUGMODE == 70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\n\n#elif DEBUGMODE == 80 && defined(RADIANCEOCCLUSION)\ngl_FragColor.rgb=vec3(seo);\n#elif DEBUGMODE == 81 && defined(HORIZONOCCLUSION)\ngl_FragColor.rgb=vec3(eho);\n#elif DEBUGMODE == 82 && defined(MS_BRDF_ENERGY_CONSERVATION)\ngl_FragColor.rgb=vec3(energyConservationFactor);\n#elif DEBUGMODE == 83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=specularEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 85 && defined(SHEEN) && defined(REFLECTION)\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE == 86 && defined(ALPHABLEND)\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\n#elif DEBUGMODE == 87\ngl_FragColor.rgb=vec3(alpha);\n#endif\ngl_FragColor.rgb*=vDebugMode.y;\n#ifdef DEBUGMODE_NORMALIZE\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\n#endif\n#ifdef DEBUGMODE_GAMMA\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\n#endif\ngl_FragColor.a=1.0;\n#ifdef PREPASS\ngl_FragData[0]=toLinearSpace(gl_FragColor);\ngl_FragData[1]=vec4(0.,0.,0.,0.);\n#endif\nreturn;\n}\n#endif";m.a.ShadersStore.pbrPixelShader="#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE\n#endif\n\n#include<__decl__pbrFragment>\n#include<pbrFragmentExtraDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<pbrFragmentSamplersDeclaration>\n#include<imageProcessingDeclaration>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n\n#include<helperFunctions>\n#include<subSurfaceScatteringFunctions>\n#include<importanceSampling>\n#include<pbrHelperFunctions>\n#include<imageProcessingFunctions>\n#include<shadowsFragmentFunctions>\n#include<harmonicsFunctions>\n#include<pbrDirectLightingSetupFunctions>\n#include<pbrDirectLightingFalloffFunctions>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\n#include<pbrDirectLightingFunctions>\n#include<pbrIBLFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#ifdef REFLECTION\n#include<reflectionFunction>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#include<pbrBlockAlbedoOpacity>\n#include<pbrBlockReflectivity>\n#include<pbrBlockAmbientOcclusion>\n#include<pbrBlockAlphaFresnel>\n#include<pbrBlockAnisotropic>\n#include<pbrBlockReflection>\n#include<pbrBlockSheen>\n#include<pbrBlockClearcoat>\n#include<pbrBlockSubSurface>\n\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n\n#include<pbrBlockNormalGeometric>\n#include<bumpFragment>\n#include<pbrBlockNormalFinal>\n\nalbedoOpacityOutParams albedoOpacityOut;\n#ifdef ALBEDO\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#endif\nalbedoOpacityBlock(\nvAlbedoColor,\n#ifdef ALBEDO\nalbedoTexture,\nvAlbedoInfos,\n#endif\n#ifdef OPACITY\nopacityMap,\nvOpacityInfos,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\nalbedoOpacityOut\n);\nvec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;\nfloat alpha=albedoOpacityOut.alpha;\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\n#include<depthPrePass>\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\nambientOcclusionOutParams aoOut;\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\n#endif\nambientOcclusionBlock(\n#ifdef AMBIENT\nambientOcclusionColorMap,\nvAmbientInfos,\n#endif\naoOut\n);\n#include<pbrBlockLightmapInit>\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nvec3 baseColor=surfaceAlbedo;\nreflectivityOutParams reflectivityOut;\n#if defined(REFLECTIVITY)\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\n#ifndef METALLICWORKFLOW\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\n#endif\n#endif\n#if defined(MICROSURFACEMAP)\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\n#endif\n#ifdef METALLICWORKFLOW\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\n#ifdef METALLIC_REFLECTANCE\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap;\n#endif\n#endif\nreflectivityBlock(\nvReflectivityColor,\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo,\nmetallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nvReflectivityInfos,\nsurfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor,\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurfaceTexel,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\nreflectivityOut\n);\nfloat microSurface=reflectivityOut.microSurface;\nfloat roughness=reflectivityOut.roughness;\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\n#endif\n\n#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nalphaFresnelOutParams alphaFresnelOut;
1\nalphaFresnelBlock(\nnormalW,\nviewDirectionW,\nalpha,\nmicroSurface,\nalphaFresnelOut\n);\nalpha=alphaFresnelOut.alpha;\n#endif\n#endif\n\n#include<pbrBlockGeometryInfo>\n\n#ifdef ANISOTROPIC\nanisotropicOutParams anisotropicOut;\n#ifdef ANISOTROPIC_TEXTURE\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\n#endif\nanisotropicBlock(\nvAnisotropy,\n#ifdef ANISOTROPIC_TEXTURE\nanisotropyMapData,\n#endif\nTBN,\nnormalW,\nviewDirectionW,\nanisotropicOut\n);\n#endif\n\n#ifdef REFLECTION\nreflectionOutParams reflectionOut;\nreflectionBlock(\nvPositionW,\nnormalW,\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\nreflectionSampler,\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nvEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\nreflectionOut\n);\n#endif\n\n#include<pbrBlockReflectance0>\n\n#ifdef SHEEN\nsheenOutParams sheenOut;\n#ifdef SHEEN_TEXTURE\nvec4 sheenMapData=toLinearSpace(texture2D(sheenSampler,vSheenUV+uvOffset))*vSheenInfos.y;\n#endif\nsheenBlock(\nvSheenColor,\n#ifdef SHEEN_ROUGHNESS\nvSheenRoughness,\n#endif\nroughness,\n#ifdef SHEEN_TEXTURE\nsheenMapData,\n#endif\nreflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nbaseColor,\nsurfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nNdotV,\nenvironmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nAARoughnessFactors,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\nreflectionOut.reflectionCoords,\nNdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nseo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\neho,\n#endif\n#endif\nsheenOut\n);\n#ifdef SHEEN_LINKWITHALBEDO\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\n#endif\n#endif\n\nclearcoatOutParams clearcoatOut;\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\n#endif\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\nvec4 clearCoatTintMapData=toLinearSpace(texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset));\n#endif\n#ifdef CLEARCOAT_BUMP\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\n#endif\nclearcoatBlock(\nvPositionW,\ngeometricNormalW,\nviewDirectionW,\nvClearCoatParams,\nspecularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nvClearCoatTintParams,\nclearCoatColorAtDistance,\nvClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nclearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nvClearCoatBumpInfos,\nclearCoatBumpMapData,\nvClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nvTBN,\n#else\nvClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nnormalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nfaceNormal,\n#endif\n#ifdef REFLECTION\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nambientMonochrome,\n#endif\n#endif\nclearcoatOut\n);\n#else\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\n#endif\n\n#include<pbrBlockReflectance>\n\nsubSurfaceOutParams subSurfaceOut;\n#ifdef SUBSURFACE\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\n#endif\nsubSurfaceBlock(\nvSubSurfaceIntensity,\nvThicknessParam,\nvTintColor,\nnormalW,\nspecularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nthicknessMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nreflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionOut.irradianceVector,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#endif\n#endif\n#ifdef SS_REFRACTION\nvPositionW,\nviewDirectionW,\nview,\nsurfaceAlbedo,\nvRefractionInfos,\nrefractionMatrix,\nvRefractionMicrosurfaceInfos,\nvLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nNdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nroughness,\n#else\nalphaG,\n#endif\nrefractionSampler,\n#ifndef LODBASEDMICROSFURACE\nrefractionSamplerLow,\nrefractionSamplerHigh,\n#endif\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvDiffusionDistance,\n#endif\nsubSurfaceOut\n);\n#ifdef SS_REFRACTION\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha=subSurfaceOut.alpha;\n#endif\n#endif\n#else\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#endif\n\n#include<pbrBlockDirectLighting>\n#include<lightFragment>[0..maxSimultaneousLights]\n\n#include<pbrBlockFinalLitComponents>\n#endif\n#include<pbrBlockFinalUnlitComponents>\n#include<pbrBlockFinalColorComposition>\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#include<pbrBlockImageProcessing>\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\nvec3 sqAlbedo=sqrt(surfaceAlbedo);\n\n#ifdef SS_SCATTERING\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a);\nirradiance/=sqAlbedo;\ngl_FragData[1]=vec4(tagLightingForSSS(irradiance),scatteringDiffusionProfile/255.);\n#else\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\ngl_FragData[1]=vec4(0.0,0.0,0.0,1.0);\n#endif\ngl_FragData[2]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\ngl_FragData[3]=vec4(sqAlbedo,1.0);\n#endif\ngl_FragColor=finalColor;\n#include<pbrDebug>\n}\n";m.a.IncludesShadersStore.pbrVertexDeclaration="uniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef METALLIC_REFLECTANCE\nuniform vec2 vMetallicReflectanceInfos;\nuniform mat4 metallicReflectanceMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\n#endif\n\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\n#endif\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\n#endif\n#endif\n",i(107),i(108),i(332),i(179),i(226),i(131),i(132),i(145),i(109),i(110),i(310),i(162),i(311),i(227),i(312);m.a.ShadersStore.pbrVertexShader="precision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#ifdef PREPASS\nvarying vec3 vViewPos;\n#endif\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nvarying vec2 vAlbedoUV;\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nvarying vec2 vDetailUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nvarying vec2 vReflectivityUV;\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\n#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0\nvarying vec2 vMetallicReflectanceUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\nvarying vec2 vClearCoatUV;\n#endif\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\nvarying vec2 vClearCoatBumpUV;\n#endif\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\nvarying vec2 vClearCoatTintUV;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\nvarying vec2 vSheenUV;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\nvarying vec2 vAnisotropyUV;\n#endif\n#endif\n#ifdef SUBSURFACE\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\nvarying vec2 vThicknessUV;\n#endif\n#endif\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include<harmonicsFunctions>\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include<instancesVertex>\n#include<bonesVertex>
1\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef PREPASS\nvViewPos=(view*worldPos).rgb;\n#endif\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nif (vAlbedoInfos.x == 0.)\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nif (vDetailInfos.x == 0.)\n{\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nif (vReflectivityInfos.x == 0.)\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nif (vMicroSurfaceSamplerInfos.x == 0.)\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0\nif (vMetallicReflectanceInfos.x == 0.)\n{\nvMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\nif (vClearCoatInfos.x == 0.)\n{\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\nif (vClearCoatBumpInfos.x == 0.)\n{\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0
1));\n}\n#endif\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\nif (vClearCoatTintInfos.x == 0.)\n{\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\nif (vSheenInfos.x == 0.)\n{\nvSheenUV=vec2(sheenMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef ANISOTROPIC\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\nif (vAnisotropyInfos.x == 0.)\n{\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n#ifdef SUBSURFACE\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\nif (vThicknessInfos.x == 0.)\n{\nvThicknessUV=vec2(thicknessMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#endif\n\n#include<bumpVertex>\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}";var L,N,F=i(84),w=i(129),B={effect:null,subMesh:null},U=(N=h.a,Object(s.d)(G,N),G.prototype.reset=function(){N.prototype.reset.call(this),this.ALPHATESTVALUE="0.5",this.PBR=!0},G),V=(L=d.a,Object(s.d)(k,L),Object.defineProperty(k.prototype,"realTimeFiltering",{get:function(){return this._realTimeFiltering},set:function(e){this._realTimeFiltering=e,this.markAsDirty(f.a.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"realTimeFilteringQuality",{get:function(){return this._realTimeFilteringQuality},set:function(e){this._realTimeFilteringQuality=e,this.markAsDirty(f.a.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"canRenderToMRT",{get:function(){return!0},enumerable:!1,configurable:!0}),k.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.get
1Scene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){t._markAllSubMeshesAsImageProcessingDirty()})))},Object.defineProperty(k.prototype,"hasRenderTargetTextures",{get:function(){return!!(T.a.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||this.subSurface.hasRenderTargetTextures()},enumerable:!1,configurable:!0}),k.prototype.getClassName=function(){return"PBRBaseMaterial"},Object.defineProperty(k.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"_disableAlphaBlending",{get:function(){return this.subSurface.disableAlphaBlending||this._transparencyMode===k.PBRMATERIAL_OPAQUE||this._transparencyMode===k.PBRMATERIAL_ALPHATEST},enumerable:!1,configurable:!0}),k.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromAlbedoTexture())},k.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest||!this.subSurface.disableAlphaBlending&&null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&(null==this._transparencyMode||this._transparencyMode===k.PBRMATERIAL_ALPHATEST)},k.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==k.PBRMATERIAL_OPAQUE},k.prototype.getAlphaTestTexture=function(){return this._albedoTexture},k.prototype.isReadyForSubMesh=function(e,t,i){if(t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new U);var n=t._materialDefines;if(this._isReadyForSubMesh(t))return!0;var r=this.getScene(),o=r.getEngine();if(n._areTexturesDirty&&r.texturesEnabled){if(this._albedoTexture&&T.a.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&T.a.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&T.a.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&T.a.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&T.a.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&T.a.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(T.a.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._metallicReflectanceTexture&&!this._metallicReflectanceTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&T.a.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&T.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)&&this.detailMap.isReadyForSubMesh(n,r)))return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(g.b.NormalKind)||(e.createNormals(!0),u.a.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));var s=t.effect,c=n._areLightsDisposed,l=this._prepareEffect(e,n,this.onCompiled,this.onError,i,null,t.getRenderingMesh().hasThinInstances);if(l)if(this._onEffectCreatedObservable&&(B.effect=l,B.subMesh=t,this._onEffectCreatedObservable.notifyObservers(B)),this.allowShaderHotSwapping&&s&&!l.isReady()){if
1(l=s,this._rebuildInParallel=!0,n.markAsUnprocessed(),c)return!(n._areLightsDisposed=!0)}else this._rebuildInParallel=!1,r.resetCachedMaterial(),t.setEffect(l,n),this.buildUniformLayout();return!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},k.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},k.prototype._prepareEffect=function(e,t,i,n,r,o,a){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,a),!t.isDirty)return null;t.markAsProcessed();var s=this.getScene().getEngine(),c=new F.a,l=0;t.USESPHERICALINVERTEX&&c.addFallback(l++,"USESPHERICALINVERTEX"),t.FOG&&c.addFallback(l,"FOG"),t.SPECULARAA&&c.addFallback(l,"SPECULARAA"),t.POINTSIZE&&c.addFallback(l,"POINTSIZE"),t.LOGARITHMICDEPTH&&c.addFallback(l,"LOGARITHMICDEPTH"),t.PARALLAX&&c.addFallback(l,"PARALLAX"),t.PARALLAXOCCLUSION&&c.addFallback(l++,"PARALLAXOCCLUSION"),l=S.AddFallbacks(t,c,l),l=S.AddFallbacks(t,c,l),l=P.AddFallbacks(t,c,l),l=A.AddFallbacks(t,c,l),t.ENVIRONMENTBRDF&&c.addFallback(l++,"ENVIRONMENTBRDF"),t.TANGENT&&c.addFallback(l++,"TANGENT"),t.BUMP&&c.addFallback(l++,"BUMP"),l=E.a.HandleFallbacksForShadows(t,c,this._maxSimultaneousLights,l++),t.SPECULARTERM&&c.addFallback(l++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&c.addFallback(l++,"USESPHERICALFROMREFLECTIONMAP"),t.USEIRRADIANCEMAP&&c.addFallback(l++,"USEIRRADIANCEMAP"),t.LIGHTMAP&&c.addFallback(l++,"LIGHTMAP"),t.NORMAL&&c.addFallback(l++,"NORMAL"),t.AMBIENT&&c.addFallback(l++,"AMBIENT"),t.EMISSIVE&&c.addFallback(l++,"EMISSIVE"),t.VERTEXCOLOR&&c.addFallback(l++,"VERTEXCOLOR"),t.MORPHTARGETS&&c.addFallback(l++,"MORPHTARGETS"),t.MULTIVIEW&&c.addFallback(0,"MULTIVIEW");var u=[g.b.PositionKind];t.NORMAL&&u.push(g.b.NormalKind),t.TANGENT&&u.push(g.b.TangentKind),t.UV1&&u.push(g.b.UVKind),t.UV2&&u.push(g.b.UV2Kind),t.VERTEXCOLOR&&u.push(g.b.ColorKind),E.a.PrepareAttributesForBones(u,e,t,c),E.a.PrepareAttributesForInstances(u,t),E.a.PrepareAttributesForMorphTargets(u,e,t);var h="pbr",d=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vAlbedoColor","vReflectivityColor","vMetallicReflectanceFactors","vEmissiveColor","visibility","vReflectionColor","vFogInfos","vFogColor","pointSize","vAlbedoInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vReflectionPosition","vReflectionSize","vEmissiveInfos","vReflectivityInfos","vReflectionFilteringInfo","vMetallicReflectanceInfos","vMicroSurfaceSamplerInfos","vBumpInfos","vLightmapInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","albedoMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","reflectivityMatrix","normalMatrix","microSurfaceSamplerMatrix","bumpMatrix","lightmapMatrix","metallicReflectanceMatrix","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"],p=["albedoSampler","reflectivitySampler","ambientSampler","emissiveSampler","bumpSampler","lightmapSampler","opacitySampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","irradianceSampler","microSurfaceSampler","environmentBrdfSampler","boneSampler","metallicReflectanceSampler"],f=["Material","Scene"];w.a.AddUniforms(d),w.a.AddSamplers(p),P.AddUniforms(d),P.AddSamplers(p),v.AddUniforms(d),v.AddSamplers(p),S.AddUniforms(d),S.AddSamplers(p),A.AddUniforms(d),A.AddSamplers(p),x.a&&(x.a.PrepareUniforms(d,t),x.a.PrepareSamplers(p,t)),E.a.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:f,samplers:p,defines:t,maxSimultaneousLights:this._maxSimultaneousLights});var m={};this.customShaderNameResolve&&(h=this.customShaderNameResolve(h,d,f,p,t,u,m));var _=t.toString();
1return s.createEffect(h,{attributes:u,uniformsNames:d,uniformBuffersNames:f,samplers:p,defines:_,fallbacks:c,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS},processFinalCode:m.processFinalCode,multiTarget:t.PREPASS},s)},k.prototype._prepareDefines=function(e,t,i,n,r){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=!1);var o=this.getScene(),a=o.getEngine();if(E.a.PrepareDefinesForLights(o,e,t,!0,this._maxSimultaneousLights,this._disableLighting),t._needNormals=!0,E.a.PrepareDefinesForMultiview(o,t),E.a.PrepareDefinesForPrePass(o,t,this.canRenderToMRT),t.METALLICWORKFLOW=this.isMetallicWorkflow(),t._areTexturesDirty){if(t._needUVs=!1,o.texturesEnabled){o.getEngine().getCaps().textureLOD&&(t.LODBASEDMICROSFURACE=!0),this._albedoTexture&&T.a.DiffuseTextureEnabled?(E.a.PrepareDefinesForMergedUV(this._albedoTexture,t,"ALBEDO"),t.GAMMAALBEDO=this._albedoTexture.gammaSpace):t.ALBEDO=!1,this._ambientTexture&&T.a.AmbientTextureEnabled?(E.a.PrepareDefinesForMergedUV(this._ambientTexture,t,"AMBIENT"),t.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):t.AMBIENT=!1,this._opacityTexture&&T.a.OpacityTextureEnabled?(E.a.PrepareDefinesForMergedUV(this._opacityTexture,t,"OPACITY"),t.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):t.OPACITY=!1;var s=this._getReflectionTexture();if(s&&T.a.ReflectionTextureEnabled){switch(t.REFLECTION=!0,t.GAMMAREFLECTION=s.gammaSpace,t.RGBDREFLECTION=s.isRGBD,t.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,t.LODINREFLECTIONALPHA=s.lodLevelInAlpha,t.LINEARSPECULARREFLECTION=s.linearSpecularLOD,this.realTimeFiltering&&0<this.realTimeFilteringQuality?(t.NUM_SAMPLES=""+this.realTimeFilteringQuality,1<a.webGLVersion&&(t.NUM_SAMPLES=t.NUM_SAMPLES+"u"),t.REALTIME_FILTERING=!0):t.REALTIME_FILTERING=!1,s.coordinatesMode===p.a.INVCUBIC_MODE&&(t.INVERTCUBICMAP=!0),t.REFLECTIONMAP_3D=s.isCube,t.REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,s.coordinatesMode){case p.a.EXPLICIT_MODE:t.REFLECTIONMAP_EXPLICIT=!0;break;case p.a.PLANAR_MODE:t.REFLECTIONMAP_PLANAR=!0;break;case p.a.PROJECTION_MODE:t.REFLECTIONMAP_PROJECTION=!0;break;case p.a.SKYBOX_MODE:t.REFLECTIONMAP_SKYBOX=!0;break;case p.a.SPHERICAL_MODE:t.REFLECTIONMAP_SPHERICAL=!0;break;case p.a.EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case p.a.FIXED_EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case p.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case p.a.CUBIC_MODE:case p.a.INVCUBIC_MODE:default:t.REFLECTIONMAP_CUBIC=!0,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!!s.boundingBoxSize}s.coordinatesMode!==p.a.SKYBOX_MODE&&(s.irradianceTexture?(t.USEIRRADIANCEMAP=!0,t.USESPHERICALFROMREFLECTIONMAP=!1):s.isCube&&(t.USESPHERICALFROMREFLECTIONMAP=!0,t.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||this.realTimeFiltering||o.getEngine().getCaps().maxVaryingVectors<=8?t.USESPHERICALINVERTEX=!1:t.USESPHERICALINVERTEX=!0))}else t.REFLECTION=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.USESPHERICALFROMREFLECTIONMAP=!1,t.USEIRRADIANCEMAP=!1,t.USESPHERICALINVERTEX=!1,t.REFLECTIONMAP_OPPOSITEZ=!1,t.LODINREFLECTIONALPHA=!1,t.GAMMAREFLECTION=!1,t.RGBDREFLECTION=!1,t.LINEARSPECULARREFLECTION=!1;this._lightmapTexture&&T.a.LightmapTextureEnabled?(E.a.PrepareDefinesForMergedUV(this._lightmapTexture,t,"LIGHTMAP"),t.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,t.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,t.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):t.LIGHTMAP=!1,this._emissiveTexture&&T.a.EmissiveTextureEnabled?E.a.PrepareDefinesForMergedUV(this._emissiveTexture,t,"EMISSIVE"):t.
1EMISSIVE=!1,T.a.SpecularTextureEnabled?(this._metallicTexture?(E.a.PrepareDefinesForMergedUV(this._metallicTexture,t,"REFLECTIVITY"),t.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,t.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,t.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,t.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed):this._reflectivityTexture?(E.a.PrepareDefinesForMergedUV(this._reflectivityTexture,t,"REFLECTIVITY"),t.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,t.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):t.REFLECTIVITY=!1,this._metallicReflectanceTexture?E.a.PrepareDefinesForMergedUV(this._metallicReflectanceTexture,t,"METALLIC_REFLECTANCE"):t.METALLIC_REFLECTANCE=!1,this._microSurfaceTexture?E.a.PrepareDefinesForMergedUV(this._microSurfaceTexture,t,"MICROSURFACEMAP"):t.MICROSURFACEMAP=!1):(t.REFLECTIVITY=!1,t.MICROSURFACEMAP=!1),o.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&T.a.BumpTextureEnabled&&!this._disableBumpMap?(E.a.PrepareDefinesForMergedUV(this._bumpTexture,t,"BUMP"),this._useParallax&&this._albedoTexture&&T.a.DiffuseTextureEnabled?(t.PARALLAX=!0,t.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):t.PARALLAX=!1,t.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):t.BUMP=!1,this._environmentBRDFTexture&&T.a.ReflectionTextureEnabled?(t.ENVIRONMENTBRDF=!0,t.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(t.ENVIRONMENTBRDF=!1,t.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?t.ALPHAFROMALBEDO=!0:t.ALPHAFROMALBEDO=!1}t.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===k.LIGHTFALLOFF_STANDARD?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===k.LIGHTFALLOFF_GLTF?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!0):(t.USEPHYSICALLIGHTFALLOFF=!0,t.USEGLTFLIGHTFALLOFF=!1),t.RADIA
1NCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?t.TWOSIDEDLIGHTING=!0:t.TWOSIDEDLIGHTING=!1,t.SPECULARAA=o.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(t._areTexturesDirty||t._areMiscDirty)&&(t.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),t.PREMULTIPLYALPHA=this.alphaMode===f.a.ALPHA_PREMULTIPLIED||this.alphaMode===f.a.ALPHA_PREMULTIPLIED_PORTERDUFF,t.ALPHABLEND=this.needAlphaBlendingForMesh(e),t.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,t.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),t._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(t),t.FORCENORMALFORWARD=this._forceNormalForward,t.RADIANCEOCCLUSION=this._useRadianceOcclusion,t.HORIZONOCCLUSION=this._useHorizonOcclusion,t._areMiscDirty&&(E.a.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,t),t.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(g.b.NormalKind),t.DEBUGMODE=this._debugMode),this.detailMap.prepareDefines(t,o),this.subSurface.prepareDefines(t,o),this.clearCoat.prepareDefines(t,o),this.anisotropy.prepareDefines(t,e,o),this.brdf.prepareDefines(t),this.sheen.prepareDefines(t,o),E.a.PrepareDefinesForFrameBoundValues(o,a,t,!!i,n,r),E.a.PrepareDefinesForAttributes(e,t,!0,!0,!0,this._transparencyMode!==k.PBRMATERIAL_OPAQUE)},k.prototype.forceCompilation=function(e,t,i){var n=this,r=Object(s.a)({clipPlane:!1,useInstances:!1},i),o=new U,a=this._prepareEffect(e,o,void 0,void 0,r.useInstances,r.clipPlane,e.hasThinInstances);this._onEffectCreatedObservable&&(B.effect=a,B.subMesh=null,this._onEffectCreatedObservable.notifyObservers(B)),a.isReady()?t&&t(this):a.onCompileObservable.add(function(){t&&t(n)})},k.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("vReflectionFilteringInfo",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),e.addUniform("vMetallicReflectanceFactors",4),e.addUniform("vMetallicReflectanceInfos",2),e.addUniform("metallicReflectanceMatrix",16),v.PrepareUniformBuffer(e),S.PrepareUniformBuffer(e),A.PrepareUniformBuffer(e),P.PrepareUniformBuffer(e),w.a.PrepareUniformBuffer(e),e.create()},k.prototype.unbind=function(){var e;this._activeEffect&&(e=!1,this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),e=!0),this.subSurface.unbind(this._activeEffect)&&(e=!0),e&&this._markAllSubMeshesAsTexturesDirty()),L.prototype.unbind.call(this)},k.prototype.bindForSubMesh=function(e,t,i){var n,r,o,a,s,c,l,u,h,d,p,f,m,_,g=this.getScene(),v=i._materialDefines;!v||(n=i.effect)&&(this._activeEffect=n,v.INSTANCES&&!v.THIN_INSTANCES||this.bindOnlyWorldMatrix(e),v.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix)),r=this._mustRebind(g,n,t.visibility),E.a.BindBonesParameters(t,this._activeEffect),o=null,a=this._uniformBuffer,r&&(s=g.getEngine(),a.bindToEffect(n,"Material"),this.bindViewProjection(n),o=this._getReflectionTexture(),a.useUbo&&this.isFrozen&&a.isSync||(g.texturesEnabled&&(this._albedoTexture&&T.a.DiffuseTextureEnabled&&(a.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),E.a.BindTextureMatrix(this._albedoTexture,a,"albedo")),this._ambientTexture&&T.a.AmbientTextureEnabled&&(a.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),E.a.BindTextureMatrix(this._ambientTexture,a,"ambient")),this._opacityTexture&&T.a.OpacityTextureEnabled&&(a.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),E.a.BindTextureMatrix(this._opacityTexture,a,"opacity")),o&&T.a.ReflectionTextureEnabled&&(a.updateMatrix("reflectionMatrix",o.getReflectionTextureMatrix()),a.updateFloat2("vReflectionInfos",o.level,0),o.boundingBoxSize&&(c=o,a.updateVector3("vReflectionPosition",c.boundingBoxPosition),a.updateVector3("vReflectionSize",c.boundingBoxSize)),this.realTimeFiltering&&(l=o.getSize().width,a.updateFloat2("vReflectionFilteringInfo",l,C.a.Log2(l))),v.USEIRRADIANCEMAP||(u=
1o.sphericalPolynomial,v.USESPHERICALFROMREFLECTIONMAP&&u&&(v.SPHERICAL_HARMONICS?(h=u.preScaledHarmonics,this._activeEffect.setVector3("vSphericalL00",h.l00),this._activeEffect.setVector3("vSphericalL1_1",h.l1_1),this._activeEffect.setVector3("vSphericalL10",h.l10),this._activeEffect.setVector3("vSphericalL11",h.l11),this._activeEffect.setVector3("vSphericalL2_2",h.l2_2),this._activeEffect.setVector3("vSphericalL2_1",h.l2_1),this._activeEffect.setVector3("vSphericalL20",h.l20),this._activeEffect.setVector3("vSphericalL21",h.l21),this._activeEffect.setVector3("vSphericalL22",h.l22)):(this._activeEffect.setFloat3("vSphericalX",u.x.x,u.x.y,u.x.z),this._activeEffect.setFloat3("vSphericalY",u.y.x,u.y.y,u.y.z),this._activeEffect.setFloat3("vSphericalZ",u.z.x,u.z.y,u.z.z),this._activeEffect.setFloat3("vSphericalXX_ZZ",u.xx.x-u.zz.x,u.xx.y-u.zz.y,u.xx.z-u.zz.z),this._activeEffect.setFloat3("vSphericalYY_ZZ",u.yy.x-u.zz.x,u.yy.y-u.zz.y,u.yy.z-u.zz.z),this._activeEffect.setFloat3("vSphericalZZ",u.zz.x,u.zz.y,u.zz.z),this._activeEffect.setFloat3("vSphericalXY",u.xy.x,u.xy.y,u.xy.z),this._activeEffect.setFloat3("vSphericalYZ",u.yz.x,u.yz.y,u.yz.z),this._activeEffect.setFloat3("vSphericalZX",u.zx.x,u.zx.y,u.zx.z)))),a.updateFloat3("vReflectionMicrosurfaceInfos",o.getSize().width,o.lodGenerationScale,o.lodGenerationOffset)),this._emissiveTexture&&T.a.EmissiveTextureEnabled&&(a.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),E.a.BindTextureMatrix(this._emissiveTexture,a,"emissive")),this._lightmapTexture&&T.a.LightmapTextureEnabled&&(a.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),E.a.BindTextureMatrix(this._lightmapTexture,a,"lightmap")),T.a.SpecularTextureEnabled&&(this._metallicTexture?(a.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),E.a.BindTextureMatrix(this._metallicTexture,a,"reflectivity")):this._reflectivityTexture&&(a.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),E.a.BindTextureMatrix(this._reflectivityTexture,a,"reflectivity")),this._metallicReflectanceTexture&&(a.updateFloat2("vMetallicReflectanceInfos",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),E.a.BindTextureMatrix(this._metallicReflectanceTexture,a,"metallicReflectance")),this._microSurfaceTexture&&(a.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),E.a.BindTextureMatrix(this._microSurfaceTexture,a,"microSurfaceSampler"))),this._bumpTexture&&s.getCaps().standardDerivatives&&T.a.BumpTextureEnabled&&!this._disableBumpMap&&(a.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),E.a.BindTextureMatrix(this._bumpTexture,a,"bump"),g._mirroredCameraPosition?a.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):a.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))),this.pointsCloud&&a.updateFloat("pointSize",this.pointSize),v.METALLICWORKFLOW?(y.c.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,y.c.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,a.updateColor4("vReflectivityColor",y.c.Color3[0],1),d=this.subSurface.indexOfRefraction,p=Math.pow((d-1)/(d+1),2),this._metallicReflectanceColor.scaleToRef(p*this._metallicF0Factor,y.c.Color3[0]),f=this._metallicF0Factor,a.updateColor4("vMetallicReflectanceFactors",y.c.Color3[0],f)):a.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface),a.updateColor3("vEmissiveColor",T.a.EmissiveTextureEnabled?this._emissiveColor:y.a.BlackReadOnly),a.updateColor3("vReflectionColor",this._reflectionColor),!v.SS_REFRACTION&&this.subSurface.linkRefractionWithTransparency?a.updateColor4("vAlbedoColor",this._albedoColor,1):a.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*g.environmentIntensity,this._lightingInfos.w=this._specularIntensity,a.updateVector4("vLightingIntensity",this._lightingInfos)),a.updateFloat("visibility",t.visibility),g.texturesEnabled&&(this._albedoTexture&&T.a.DiffuseTextureEnabled&&a.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&T.a.AmbientTextureEnabled&&a.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&T.a.OpacityTextureEnabled&&a.setTexture("opacitySampler",this._opacityTexture),o&&T.a.ReflectionTextureEnabled&&(v.LODBASEDMICROSFURACE?a.setTexture("reflectionSampler",o):(a.setTexture("reflectionSampler",o._lodTextureMid||o),a.setTexture("reflectionSamplerLow",o._lodTextureLow||o),a.setTexture("reflectionSamplerHigh",o._lodTextureHigh||o)),v.USEIRRADIANCEMAP&&a.setTexture("irradianceSampler",o.irradianceTexture)),v.ENVIRONMENTBRDF&&a.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&T.a.EmissiveTextureEnabled&&a.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&T.a.LightmapTextureEnabled&&a.setTexture("lightmapSampler",this._lightmapTexture),T.a.SpecularTextureEnabled&&(this._metallicTexture?a.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&a.setTexture("reflectivitySampler",this._reflectivityTexture),this._metallicReflectanceTexture&&a.setTexture("metallicReflectanceSampler",this._metallicReflectanceTexture),this._microSurfaceTexture&&a.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&s.getCaps().standardDerivatives&&T.a.BumpTextureEnabled&&!this._disableBumpMap&&a.setTexture("bumpSampler",this._bumpTexture)),this.detailMap.bindForSubMesh(a,g,this.isFrozen),this.subSurface.bindForSubMesh(a,g,s,this.isFrozen,v.LODBASEDMICROSFURACE,this.realTimeFiltering),this.clearCoat.bindForSubMesh(a,g,s,this._disableBumpMap,this.isFrozen,this._invertNormalMapX,this._invertNormalMapY),this.anisotropy.bindForSubMesh(a,g,this.isFrozen),this.sheen.bindForSubMesh(a,g,this.isFrozen),E.a.BindClipPlane(this._activeEffect,g),g.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor),m=g._forcedViewPosition?g._forcedViewPosition:g._mirroredCameraPosition?g._mirroredCameraPosition:g.activeCamera.globalPosition,_=g.useRightHandedSystem===(null!=g._mirroredCameraPosition),n.setFloat4("vEyePosition",m.x,m.y,m.z,_?-1:1),n.setColor3("vAmbientColor",this._globalAmbientColor),n.setFloat2("vDebugMode",this.debugLimit,this.debugFactor)),!r&&this.isFrozen||(g.lightsEnabled&&!this._disableLighting&&E.a.BindLights(g,t,this._activeEffect,v,this._maxSimultaneousLights,this._rebuildInParallel),(g.fogEnabled&&t.applyFog&&g.fogMode!==b.a.FOGMODE_NONE||o)&&this.bindView(n),E.a.BindFogParameters(g,t,this._activeEffect,!0),v.NUM_MORPH_INFLUENCERS&&E.a.BindMorphTargetParameters(t,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),E.a.BindLogDepth(v,this._activeEffect,g)),a.update(),this._afterBind(t,this._activeEffect))},k.prototype.getAnimatables=function(){var e=[];return this._albedoTexture&&this._albedoTexture.animations&&0<this._albedoTexture.animations.length&&e.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&0<this._ambientTexture.animations.length&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&0<this._reflectionTexture.animations.length&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&0<this._emissiveTexture.animations.length&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&0<this._metallicTexture.animations.length?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&0<this._reflectivityTexture.animations.length&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&0<this._lightmapTexture.animations.length&&e.push(this._lightmapTexture),this.detailMap.getAnimatables(e),this.subSurface.getAnimatables(e),this.clearCoat.getAnimatables(e),this.sheen.getAnimatables(e),this.anisotropy.getAnimatables(e),e},k.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},k.prototype.getActiveTextures=function(){var e=L.prototype.getActiveTextures.call(this);return this._albedoTexture&&e.push(this._albedoTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._reflectivityTexture&&e.push(this._reflectivityTexture),this._metallicTexture&&e.push(this._metallicTexture),this._metallicReflectanceTexture&&e.push(this._metallicReflectanceTexture),this._microSurfaceTexture&&e.push(this._microSurfaceTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this.detailMap.getActiveTextures(e),this.subSurface.getActiveTextures(e),this.clearCoat.getActiveTextures(e),this.sheen.getActiveTextures(e),this.anisotropy.getActiveTextures(e),e},k.prototype.hasTexture=function(e){return!!L.prototype.hasTexture.call(this,e)||this._albedoTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._reflectivityTexture===e||this._metallicTexture===e||this._metallicReflectanceTexture===e||this._microSurfaceTexture===e||this._bumpTexture===e||this._lightmapTexture===e||this.detailMap.hasTexture(e)||this.subSurface.hasTexture(e)||this.clearCoat.hasTexture(e)||this.sheen.hasTexture(e)||this.anisotropy.hasTexture(e)},k.prototype.setPrePassRenderer=function(e){return this.subSurface.isScatteringEnabled&&(e.subSurfaceConfiguration.enabled=!0,e.materialsShouldRenderIrradiance=!0),!0},k.prototype.dispose=function(e,t){var i,n,r,o,a,s,c,l,u,h,d;
1t&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(i=this._albedoTexture)||void 0===i||i.dispose(),null===(n=this._ambientTexture)||void 0===n||n.dispose(),null===(r=this._opacityTexture)||void 0===r||r.dispose(),null===(o=this._reflectionTexture)||void 0===o||o.dispose(),null===(a=this._emissiveTexture)||void 0===a||a.dispose(),null===(s=this._metallicTexture)||void 0===s||s.dispose(),null===(c=this._reflectivityTexture)||void 0===c||c.dispose(),null===(l=this._bumpTexture)||void 0===l||l.dispose(),null===(u=this._lightmapTexture)||void 0===u||u.dispose(),null===(h=this._metallicReflectanceTexture)||void 0===h||h.dispose(),null===(d=this._microSurfaceTexture)||void 0===d||d.dispose()),this.detailMap.dispose(t),this.subSurface.dispose(t),this.clearCoat.dispose(t),this.sheen.dispose(t),this.anisotropy.dispose(t),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),L.prototype.dispose.call(this,e,t)},k.PBRMATERIAL_OPAQUE=l.a.MATERIAL_OPAQUE,k.PBRMATERIAL_ALPHATEST=l.a.MATERIAL_ALPHATEST,k.PBRMATERIAL_ALPHABLEND=l.a.MATERIAL_ALPHABLEND,k.PBRMATERIAL_ALPHATESTANDBLEND=l.a.MATERIAL_ALPHATESTANDBLEND,k.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,k.LIGHTFALLOFF_PHYSICAL=0,k.LIGHTFALLOFF_GLTF=1,k.LIGHTFALLOFF_STANDARD=2,Object(s.c)([Object(r.i)()],k.prototype,"_imageProcessingConfiguration",void 0),Object(s.c)([Object(r.b)("_markAllSubMeshesAsMiscDirty")],k.prototype,"debugMode",void 0),Object(s.c)([Object(r.c)()],k.prototype,"useLogarithmicDepth",null),k);function k(e,t){var i=L.call(this,e,t)||this;return i._directIntensity=1,i._emissiveIntensity=1,i._environmentIntensity=1,i._specularIntensity=1,i._lightingInfos=new a.f(i._directIntensity,i._emissiveIntensity,i._environmentIntensity,i._specularIntensity),i._disableBumpMap=!1,i._albedoTexture=null,i._ambientTexture=null,i._ambientTextureStrength=1,i._ambientTextureImpactOnAnalyticalLights=k.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,i._opacityTexture=null,i._reflectionTexture=null,i._emissiveTexture=null,i._reflectivityTexture=null,i._metallicTexture=null,i._metallic=null,i._roughness=null,i._metallicF0Factor=1,i._metallicReflectanceColor=y.a.White(),i._metallicReflectanceTexture=null,i._microSurfaceTexture=null,i._bumpTexture=null,i._lightmapTexture=null,i._ambientColor=new y.a(0,0,0),i._albedoColor=new y.a(1,1,1),i._reflectivityColor=new y.a(1,1,1),i._reflectionColor=new y.a(1,1,1),i._emissiveColor=new y.a(0,0,0),i._microSurface=.9,i._useLightmapAsShadowmap=!1,i._useHorizonOcclusion=!0,i._useRadianceOcclusion=!0,i._useAlphaFromAlbedoTexture=!1,i._useSpecularOverAlpha=!0,i._useMicroSurfaceFromReflectivityMapAlpha=!1,i._useRoughnessFromMetallicTextureAlpha=!0,i._useRoughnessFromMetallicTextureGreen=!1,i._useMetallnessFromMetallicTextureBlue=!1,i._useAmbientOcclusionFromMetallicTextureRed=!1,i._useAmbientInGrayScale=!1,i._useAutoMicroSurfaceFromReflectivityMap=!1,i._lightFalloff=k.LIGHTFALLOFF_PHYSICAL,i._useRadianceOverAlpha=!0,i._useObjectSpaceNormalMap=!1,i._useParallax=!1,i._useParallaxOcclusion=!1,i._parallaxScaleBias=.05,i._disableLighting=!1,i._maxSimultaneousLights=4,i._invertNormalMapX=!1,i._invertNormalMapY=!1,i._twoSidedLighting=!1,i._alph
1aCutOff=.4,i._forceAlphaTest=!1,i._useAlphaFresnel=!1,i._useLinearAlphaFresnel=!1,i._environmentBRDFTexture=null,i._forceIrradianceInFragment=!1,i._realTimeFiltering=!1,i._realTimeFilteringQuality=f.a.TEXTURE_FILTERING_QUALITY_LOW,i._forceNormalForward=!1,i._enableSpecularAntiAliasing=!1,i._imageProcessingObserver=null,i._renderTargets=new n.a(16),i._globalAmbientColor=new y.a(0,0,0),i._useLogarithmicDepth=!1,i._unlit=!1,i._debugMode=0,i.debugMode=0,i.debugLimit=-1,i.debugFactor=1,i.clearCoat=new v(i._markAllSubMeshesAsTexturesDirty.bind(i)),i.anisotropy=new S(i._markAllSubMeshesAsTexturesDirty.bind(i)),i.brdf=new c(i._markAllSubMeshesAsMiscDirty.bind(i)),i.sheen=new A(i._markAllSubMeshesAsTexturesDirty.bind(i)),i.detailMap=new w.a(i._markAllSubMeshesAsTexturesDirty.bind(i)),i._rebuildInParallel=!1,i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),T.a.ReflectionTextureEnabled&&i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),i.subSurface.fillRenderTargetTextures(i._renderTargets),i._renderTargets},i._environmentBRDFTexture=o.a.GetEnvironmentBRDFTexture(t),i.subSurface=new P(i._markAllSubMeshesAsTexturesDirty.bind(i),i._markScenePrePassDirty.bind(i),t),i}function G(){var e=N.call(this)||this;return e.PBR=!0,e.NUM_SAMPLES="0",e.REALTIME_FILTERING=!1,e.MAINUV1=!1,e.MAINUV2=!1,e.UV1=!1,e.UV2=!1,e.ALBEDO=!1,e.GAMMAALBEDO=!1,e.ALBEDODIRECTUV=0,e.VERTEXCOLOR=!1,e.DETAIL=!1,e.DETAILDIRECTUV=0,e.DETAIL_NORMALBLENDMETHOD=0,e.AMBIENT=!1,e.AMBIENTDIRECTUV=0,e.AMBIENTINGRAYSCALE=!1,e.OPACITY=!1,e.VERTEXALPHA=!1,e.OPACITYDIRECTUV=0,e.OPACITYRGB=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.ALPHABLEND=!1,e.ALPHAFROMALBEDO=!1,e.ALPHATESTVALUE="0.5",e.SPECULAROVERALPHA=!1,e.RADIANCEOVERALPHA=!1,e.ALPHAFRESNEL=!1,e.LINEARALPHAFRESNEL=!1,e.PREMULTIPLYALPHA=!1,e.EMISSIVE=!1,e.EMISSIVEDIRECTUV=0,e.REFLECTIVITY=!1,e.REFLECTIVITYDIRECTUV=0,e.SPECULARTERM=!1,e.MICROSURFACEFROMREFLECTIVITYMAP=!1,e.MICROSURFACEAUTOMATIC=!1,e.LODBASEDMICROSFURACE=!1,e.MICROSURFACEMAP=!1,e.MICROSURFACEMAPDIRECTUV=0,e.METALLICWORKFLOW=!1,e.ROUGHNESSSTOREINMETALMAPALPHA=!1,e.ROUGHNESSSTOREINMETALMAPGREEN=!1,e.METALLNESSSTOREINMETALMAPBLUE=!1,e.AOSTOREINMETALMAPRED=!1,e.METALLIC_REFLECTANCE=!1,e.METALLIC_REFLECTANCEDIRECTUV=0,e.ENVIRONMENTBRDF=!1,e.ENVIRONMENTBRDF_RGBD=!1,e.NORMAL=!1,e.TANGENT=!1,e.BUMP=!1,e.BUMPDIRECTUV=0,e.OBJECTSPACE_NORMALMAP=!1,e.PARALLAX=!1,e.PARALLAXOCCLUSION=!1,e.NORMALXYSCALE=!0,e.LIGHTMAP=!1,e.LIGHTMAPDIRECTUV=0,e.USELIGHTMAPASSHADOWMAP=!1,e.GAMMALIGHTMAP=!1,e.RGBDLIGHTMAP=!1,e.REFLECTION=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.USESPHERICALFROMREFLECTIONMAP=!1,e.USEIRRADIANCEMAP=!1,e.SPHERICAL_HARMONICS=!1,e.USESPHERICALINVERTEX=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.LODINREFLECTIONALPHA=!1,e.GAMMAREFLECTION=!1,e.RGBDREFLECTION=!1,e.LINEARSPECULARREFLECTION=!1,e.RADIANCEOCCLUSION=!1,e.HORIZONOCCLUSION=!1,e.INSTANCES=!1,e.THIN_INSTANCES=!1,e.PREPASS=!1,e.SCENE_MRT_COUNT=0,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE=!1,e.NONUNIFORMSCALING=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_UV=!1,e.NUM_MORPH_INFLUENCERS=0,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.MULTIVIEW=!1,e.USEPHYSICALLIGHTFALLOFF=!1,e.USEGLTFLIGHTFALLOFF=!1,e.TWOSIDEDLIGHTING=!1,e.SHADOWFLOAT=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.POINTSIZE=!1,e.FOG=!1,e.LOGARITHMICDEPTH=!1,e.FORCENORMALFORWARD=!1,e.SPECULARAA=!1,e.CLEARCOAT=!1,e.CLEARCOAT_DEFAULTIOR=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_TEXTUREDIRECTUV=0,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_BUMPDIRECTUV=0,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1,e.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1,e.ANISOTROPIC_TEXTUREDIRECTUV=0,e.BRDF_V_HEIGHT_CORRELATED=!1,e.MS_BRDF_ENERGY_CONSERVATION=!1,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!1,e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTUREDIRECTUV=0,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SUBSURFACE=!1,e.SS_REFRACTION=!1,e.SS_TRANSLUCENCY=!1,e.SS_SCATTERING=!1,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,e.SS_REFRACTIONMAP_3D=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.UNLIT=!1,e.DEBUGMODE=0,e.rebuild(),e}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var m=i(0),_=i(4),n=(r.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(_.b.NormalKind))return null;var i,n,r,o,a,s,c,l,u,h,d,p,f=this.pickedMesh.getIndices();return f?(a=t?(i=this.pickedMesh.getVerticesData(_.b.NormalKind),n=m.e.FromArray(i,3*f[3*this.faceId]),r=m.e.FromArray(i,3*f[3*this.faceId+1]
1),o=m.e.FromArray(i,3*f[3*this.faceId+2]),n=n.scale(this.bu),r=r.scale(this.bv),o=o.scale(1-this.bu-this.bv),new m.e(n.x+r.x+o.x,n.y+r.y+o.y,n.z+r.z+o.z)):(s=this.pickedMesh.getVerticesData(_.b.PositionKind),c=m.e.FromArray(s,3*f[3*this.faceId]),l=m.e.FromArray(s,3*f[3*this.faceId+1]),u=m.e.FromArray(s,3*f[3*this.faceId+2]),h=c.subtract(l),d=u.subtract(l),m.e.Cross(h,d)),e&&(p=this.pickedMesh.getWorldMatrix(),this.pickedMesh.nonUniformScaling&&(m.c.Matrix[0].copyFrom(p),(p=m.c.Matrix[0]).setTranslationFromFloats(0,0,0),p.invert(),p.transposeToRef(m.c.Matrix[1]),p=m.c.Matrix[1]),a=m.e.TransformNormal(a,p)),a.normalize(),a):null},r.prototype.getTextureCoordinates=function(){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(_.b.UVKind))return null;var e=this.pickedMesh.getIndices();if(!e)return null;var t=this.pickedMesh.getVerticesData(_.b.UVKind);if(!t)return null;var i=m.d.FromArray(t,2*e[3*this.faceId]),n=m.d.FromArray(t,2*e[3*this.faceId+1]),r=m.d.FromArray(t,2*e[3*this.faceId+2]),i=i.scale(this.bu),n=n.scale(this.bv),r=r.scale(1-this.bu-this.bv);return new m.d(i.x+n.x+r.x,i.y+n.y+r.y)},r);function r(){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.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.originMesh=null,this.ray=null}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(72),r=(Object.defineProperty(o.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"average",{get:function(){return this._average},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!1,configurable:!0}),o.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},o.prototype.addCount=function(e,t){o.Enabled&&(this._current+=e,t&&this._fetchResult())},o.prototype.beginMonitoring=function(){o.Enabled&&(this._startMonitoringTime=n.a.Now)},o.prototype.endMonitoring=function(e){var t;void 0===e&&(e=!0),o.Enabled&&(e&&this.fetchNewFrame(),t=n.a.Now,this._current=t-this._startMonitoringTime,e&&this._fetchResult())},o.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=n.a.Now;1e3<e-this._lastSecTime&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},o.Enabled=!0,o);function o(){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}},function(e,t,i){"use strict";i.d(t,"b",function(){return m}),i.d(t,"d",function(){return v}),i.d(t,"c",function(){return b}),i.d(t,"a",function(){return y});var n,r,o,a,s=i(1),_=i(55),g=i(44),c=i(6),p=i(113),l=i(236),u=(a=Error,Object(s.d)(C,a),C._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},C),f=i(41),h=i(31),d=i(215),m=(o=u,Object(s.d)(A,o),A),v=(r=u,Object(s.d)(S,r),S),b=(n=u,Object(s.d)(E,n),E),y=(T._CleanUrl=function(e){return e.replace(/#/gm,"%23")},T.SetCorsBehavior=function(e,t){var i;e&&0===e.indexOf("data:")||!T.CorsBehavior||("string"==typeof T.CorsBehavior||this.CorsBehavior instanceof String?t.crossOrigin=T.CorsBehavior:(i=T.CorsBehavior(e))&&(t.crossOrigin=i))},T.LoadImage=function(i,t,n,e,r){var o;void 0===r&&(r="");var a=!1;if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)?"undefined"!=typeof Blob?(o=URL.createObjectURL(new Blob([i],{type:r})),a=!0):o="data:"+r+";base64,"+f.a.EncodeArrayBufferToBase64(i):i instanceof Blob?(o=URL.createObjectURL(i),a=!0):(o=T._CleanUrl(i),o=T.PreprocessUrl(i)),"undefined"==typeof Image)return T.Loa
1dFile(o,function(e){createImageBitmap(new Blob([e],{type:r})).then(function(e){t(e),a&&URL.revokeObjectURL(o)}).catch(function(e){n&&n("Error while trying to load image: "+i,e)})},void 0,e||void 0,!0,function(e,t){n&&n("Error while trying to load image: "+i,t)}),null;var s=new Image;T.SetCorsBehavior(o,s);var c=function(){s.removeEventListener("load",c),s.removeEventListener("error",l),t(s),a&&s.src&&URL.revokeObjectURL(s.src)},l=function(e){var t;s.removeEventListener("load",c),s.removeEventListener("error",l),n&&(t=i.toString(),n("Error while trying to load image: "+(t.length<32?t:t.slice(0,32)+"..."),e)),a&&s.src&&URL.revokeObjectURL(s.src)};function u(){s.src=o}if(s.addEventListener("load",c),s.addEventListener("error",l),"data:"!==o.substr(0,5)&&e&&e.enableTexturesOffline)e.open(function(){e&&e.loadImage(o,s)},u);else{if(-1!==o.indexOf("file:")){var h,d=decodeURIComponent(o.substring(5).toLowerCase());if(p.a.FilesToLoad[d]){try{try{h=URL.createObjectURL(p.a.FilesToLoad[d])}catch(e){h=URL.createObjectURL(p.a.FilesToLoad[d])}s.src=h,a=!0}catch(e){s.src=""}return s}}u()}return s},T.ReadFile=function(t,i,e,n,r){var o=new FileReader,a={onCompleteObservable:new c.c,abort:function(){return o.abort()}};return o.onloadend=function(e){return a.onCompleteObservable.notifyObservers(a)},r&&(o.onerror=function(e){r(new b("Unable to read "+t.name,t))}),o.onload=function(e){i(e.target.result)},e&&(o.onprogress=e),n?o.readAsArrayBuffer(t):o.readAsText(t),a},T.LoadFile=function(e,i,t,n,r,o){if(-1!==e.indexOf("file:")){var a=decodeURIComponent(e.substring(5).toLowerCase());0===a.indexOf("./")&&(a=a.substring(2));var s=p.a.FilesToLoad[a];if(s)return T.ReadFile(s,i,t,r,o?function(e){return o(void 0,new m(e.message,e.file))}:void 0)}return T.RequestFile(e,function(e,t){i(e,t?t.responseURL:void 0)},t,n,r,o?function(e){o(e.request,new m(e.message,e.request))}:void 0)},T.RequestFile=function(e,l,t,i,u,h,d){function n(){var a=new _.a,s=null;m.abort=function(){f=!0,a.readyState!==(XMLHttpRequest.DONE||4)&&a.abort(),null!==s&&(clearTimeout(s),s=null)};var c=function(n){a.open("GET",p),d&&d(a),u&&(a.responseType="arraybuffer"),t&&a.addEventListener("progress",t);var r=function(){a.removeEventListener("loadend",r),m.onCompleteObservable.notifyObservers(m),m.onCompleteObservable.clear()};a.addEventListener("loadend",r);var o=function(){if(!f&&a.readyState===(XMLHttpRequest.DONE||4)){if(a.removeEventListener("readystatechange",o),200<=a.status&&a.status<300||0===a.status&&(!g.a.IsWindowObjectExist()||T.IsFileURL()))return void l(u?a.response:a.responseText,a);var e=T.DefaultRetryStrategy;if(e){var t=e(p,a,n);if(-1!==t)return a.removeEventListener("loadend",r),a=new _.a,void(s=setTimeout(function(){return c(n+1)},t))}var i=new v("Error status: "+a.status+" "+a.statusText+" - Unable to load "+p,a);h&&h(i)}};a.addEventListener("readystatechange",o),a.send()};c(0)}e=T._CleanUrl(e),e=T.PreprocessUrl(e);var r,p=T.BaseUrl+e,f=!1,m={onCompleteObservable:new c.c,abort:function(){return f=!0}};return i&&i.enableSceneOffline?(r=function(e){e&&400<e.status?h&&h(e):n()},i.open(function(){i&&i.loadFile(T.BaseUrl+e,function(e){f||l(e),m.onCompleteObservable.notifyObservers(m)},t?function(e){f||t(e)}:void 0,r,u)},r)):n(),m},T.IsFileURL=function(){return"file:"===location.protocol},T.DefaultRetryStrategy=l.a.ExponentialBackoff(),T.BaseUrl="",T.CorsBehavior="anonymous",T.PreprocessUrl=function(e){return e},T);function T(){}function E(e,t){var i=n.call(this,e)||this;return i.file=t,i.name="ReadFileError",u._setPrototypeOf(i,E.prototype),i}function S(e,t){var i=r.call(this,e)||this;return i.request=t,i.name="RequestFileError",u._setPrototypeOf(i,S.prototype),i}function A(e,t){var i=o.call(this,e)||this;return i.name="LoadFileError",u._setPrototypeOf(i,A.prototype),t instanceof _.a?i.request=t:i.file=t,i}function C(){return null!==a&&a.apply(this,arguments)||this}h.a._FileToolsLoadImage=y.LoadImage.bind(y),h.a._FileToolsLoadFile=y.LoadFile.bind(y),d.a._FileToolsLoadFile=y.LoadFile.bind(y)},function(e,t,i){"use strict";i.r(t);var n=i(291);i.d(t,"BoxParticleEmitter",function(){return n.a});var r=i(364);i.d(t,"ConeParticleEmitter",function(){return r.a});var o=i(365);i.d(t,"CylinderParticleEmitter",function(){return o.b}),i.d(t,"CylinderDirectedParticleEmitter",function(){return o.a});var a=i(366);i.d(t,"HemisphericParticleEmitter",function(){return a.a});var s=i(367);for(var c in s)["BoxParticleEmitter","ConeParticleEmitter","CylinderParticleEmitter","CylinderDirectedParticleEmitter","HemisphericParticleEmitter","default"].indexOf(c)<0&&function(e){i.d(t,e,function(){return s[e]})}(c);var l=i(368);i.d(t,"PointParticleEmitter",function(){return l.a});var u=i(369);i.d(t,"SphereParticleEmitter",function(){return u.b}),i.d(t,"SphereDirectedParticleEmitter",function(){return u.a});var h=i(156);i.d(t,"CustomParticleEmitter",function(){return h.a});var d=i(370);i.d(t,"MeshParticleEmitter",function(){return d.a})},function(e,t,i){"use strict";i.d(t,"b",function(){return r}),i.d(t,"a",function(){return o}
1),i.d(t,"c",function(){return a}),i.d(t,"d",function(){return s});var n=i(10),r=(u.prototype.getColorToRef=function(e){this.color2?n.b.LerpToRef(this.color1,this.color2,Math.random(),e):e.copyFrom(this.color1)},u),o=function(e,t){this.gradient=e,this.color=t},a=(l.prototype.getFactor=function(){return void 0===this.factor2||this.factor2===this.factor1?this.factor1:this.factor1+(this.factor2-this.factor1)*Math.random()},l),s=(c.GetCurrentGradient=function(e,t,i){if(t[0].gradient>e)i(t[0],t[0],1);else{for(var n=0;n<t.length-1;n++){var r=t[n],o=t[n+1];if(e>=r.gradient&&e<=o.gradient)return void i(r,o,(e-r.gradient)/(o.gradient-r.gradient))}var a=t.length-1;i(t[a],t[a],1)}},c);function c(){}function l(e,t,i){this.gradient=e,this.factor1=t,this.factor2=i}function u(e,t,i){this.gradient=e,this.color1=t,this.color2=i}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var o,n=i(1),r=i(3),a=i(0),s=i(12),c=i(92),l=i(117),u=(o=c.a,Object(n.d)(h,o),Object.defineProperty(h.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:!1,configurable:!0}
1),Object.defineProperty(h.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:!1,configurable:!0}),Object.defineProperty(h.prototype,"keysUpward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUpward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.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:!1,configurable:!0}),Object.defineProperty(h.prototype,"keysDownward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDownward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.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:!1,configurable:!0}),Object.defineProperty(h.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:!1,configurable:!0}),h.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},h.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new a.e(0,0,0),this.cameraRotation=new a.d(0,0)},Object.defineProperty(h.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),h.prototype._collideWithWorld=function(e){(this.parent?a.e.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},h.prototype._checkInputs=function(){this._localDirection||(this._localDirection=a.e.Zero(),this._transformedDirection=a.e.Zero()),this.inputs.checkInputs(),o.prototype._checkInputs.call(this)},h.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},h.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):o.prototype._updatePosition.call(this)},h.prototype.dispose=function(){this.inputs.clear(),o.prototype.dispose.call(this)},h.prototype.getClassName=function(){return"FreeCamera"},Object(n.c)([Object(r.o)()],h.prototype,"ellipsoid",void 0),Object(n.c)([Object(r.o)()],h.prototype,"ellipsoidOffset",void 0),Object(n.c)([Object(r.c)()],h.prototype,"checkCollisions",void 0),Object(n.c)([Object(r.c)()],h.prototype,"applyGravity",void 0),h);function h(e,t,i,n){void 0===n&&(n=!0);var r=o.call(this,e,t,i,n)||this;return r.ellipsoid=new a.e(.5,1,.5),r.ellipsoidOffset=new a.e(0,0,0),r.checkCollisions=!1,r.applyGravity=!1,r._needMoveForGravity=!1,r._oldPosition=a.e.Zero(),r._diffPosition=a.e.Zero(),r._newPosition=a.e.Zero(),r._collisionMask=-1,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),r._newPosition.copyFrom(t),r._newPosition.subtractToRef(r._oldPosition,r._diffPosition),r._diffPosition.length()>s.a.CollisionsEpsilon&&(r.position.addInPlace(r._diffPosition),r.onCollide&&i&&r.onCollide(i))},r.inputs=new l.a(r),r.inputs.addKeyboard().addMouse(),r}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(44),r=(Object.defineProperty(o,"Now",{get:function(){return n.a.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()}
1,enumerable:!1,configurable:!0}),o);function o(){}},function(e,t,i){"use strict";var n,r;i.d(t,"a",function(){return n}),(r=n=n||{})[r.ENTERING_XR=0]="ENTERING_XR",r[r.EXITING_XR=1]="EXITING_XR",r[r.IN_XR=2]="IN_XR",r[r.NOT_IN_XR=3]="NOT_IN_XR"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.helperFunctions="const float PI=3.1415926535897932384626433832795;\nconst float HALF_MIN=5.96046448e-08;\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}\nfloat toLinearSpace(float color)\n{\nreturn pow(color,LinearEncodePowerApprox);\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec4 toLinearSpace(vec4 color)\n{\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nvec4 toGammaSpace(vec4 color)\n{\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n}\nfloat toGammaSpace(float color)\n{\nreturn pow(color,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}\n"},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=(o._RemoveAndStorePivotPoint=function(e){e&&0===o._PivotCached&&(e.getPivotPointToRef(o._OldPivotPoint),o._OldPivotPoint.equalsToFloats(0,0,0)||(e.setPivotMatrix(n.a.IdentityReadOnly),o._OldPivotPoint.subtractToRef(e.getPivotPoint(),o._PivotTranslation),o._PivotTmpVector.copyFromFloats(1,1,1),o._PivotTmpVector.subtractInPlace(e.scaling),o._PivotTmpVector.multiplyInPlace(o._PivotTranslation),e.position.addInPlace(o._PivotTmpVector))),o._PivotCached++},o._RestorePivotPoint=function(e){e&&!o._OldPivotPoint.equalsToFloats(0,0,0)&&1===o._PivotCached&&(e.setPivotPoint(o._OldPivotPoint),o._PivotTmpVector.copyFromFloats(1,1,1),o._PivotTmpVector.subtractInPlace(e.scaling),o._PivotTmpVector.multiplyInPlace(o._PivotTranslation),e.position.subtractInPlace(o._PivotTmpVector)),this._PivotCached--},o._PivotCached=0,o._OldPivotPoint=new n.e,o._PivotTranslation=new n.e,o._PivotTmpVector=new n.e,o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var c=i(0),n=i(8),r=i(47),o=(Object.defineProperty(a.prototype,"attachedMesh",{get:function(){return this._attachedMesh},set:function(e){(this._attachedMesh=e)&&(this._attachedNode=e),this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"attachedNode",{get:function(){return this._attachedNode},set:function(e){this._attachedNode=e,this._attachedMesh=null,this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),a.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";this._rootMesh.getChildMeshes().forEach(function(e){e.dispose()}),e.parent=this._rootMesh,this._customMeshSet=!0},a.prototype._attachedNodeChanged=function(e){},a.prototype._update=function(){var e,t,i,n,r,o;this.attachedNode&&(e=this.attachedNode,this.attachedMesh&&(e=this.attachedMesh._effectiveMesh||this.attachedNode),this.updateGizmoPositionToMatchAttachedMesh&&(i=(t=e.getWorldMatrix().getRow(3))?t.toVector3():new c.e(0,0,0),this._rootMesh.position.copyFrom(i)),this.updateGizmoRotationToMatchAttachedMesh?e.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1),this.updateScale?(r=(n=this.gizmoLayer.utilityLayerScene.activeCamera).globalPosition,n.devicePosition&&(r=n.devicePosition),this._rootMesh.position.subtractToRef(r,this._tempVector),o=this._tempVector.length()*this.scaleRatio,this._rootMesh.scaling.set(o,o,o),e._getWorldMatrixDeterminant()<0&&(this._rootMesh.scaling.y*=-1)):this._rootMesh.scaling.setAll(this.scaleRatio))},a.prototype._matrixChanged=function(){var e,t,i,n,r,o,a,s;this._attachedNode&&("Mesh"===this._attachedNode.getClassName()||"AbstractMesh"===this._attachedNode.getClassName()||"TransformNode"===this._attachedNode.getClassName()?(e=this._attachedNode,t=new c.b(0,0,0,1),e.parent?(i=new c.a,n=new c.a,e.parent.getWorldMatrix().invertToRef(i),this._attachedNode._worldMatrix.multiplyToRef(i,n),n.decompose(e.scaling,t,e.position)):this._attachedNode._worldMatrix.decompose(e.scaling,t,e.position),e.rotation=t.toEulerAngles(),e.rotationQuaternion&&(e.rotationQuaternion=t)):"Bone"!==this._attachedNode.getClassName()||(o=(r=this._attachedNode).getParent())&&(a=new c.a,s=new c.a,o.getWorldMatrix().invertToRef(a),r.getWorldMatrix().multiplyToRef(a,s),r.getLocalMatrix().copyFrom(s),r.markAsDirty()))},a.prototype.dispose=function(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},a);function a(e){var t=this;void 0===e&&(e=r.a.DefaultUtilityLayer),this.gizmoLayer=e,this._attachedMesh=null,this._attachedNode=null,this.scaleRatio=1,this._customMeshSet=!1,this.updateGizmoRotationToMatchAttachedMesh=!0,this.updateGizmoPositionToMatchAttachedMesh=!0,this.updateScale=!0,this._interactionsEnabled=!0,this._tempVector=new c.e,this._rootMesh=new n.a("gizmoRootNode",e.utilityLayerScene),this._rootMesh.rotationQuaternion=c.b.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function(){t._update()})}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.toGlobal=function(e,t){return new r(this.x*e,this.y*t,this.width*e,this.height*t)},r.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},r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r);function r(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var r=i(4),u=i(165),o=i(52),c=i(2),a=i(192),n=(Object.defineProperty(h.prototype,"materialDefines",{get:function(){return this._materialDefines},set:function(e){this._materialDefines=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"effect",{get:function(){var e;return null!==(e=this._effectOverride)&&void 0!==e?e:this._materialEffect},enumerable:!1,configurable:!0}),h.prototype.setEffect=function(e,t){void 0===t&&(t=null),this._materialEffect!==e?(this._materialDefines=t,this._materialEffect=e):e||(this._materialDefines=null)},h.AddToMesh=function(e,t,i,n,r,o,a,s){return void 0===s&&(s=!0),new h(e,t,i,n,r,o,a,s)}
1,Object.defineProperty(h.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()},enumerable:!1,configurable:!0}),h.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},h.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},h.prototype.getMesh=function(){return this._mesh},h.prototype.getRenderingMesh=function(){return this._renderingMesh},h.prototype.getReplacementMesh=function(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null},h.prototype.getEffectiveMesh=function(){return(this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null)||this._renderingMesh},h.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null==e)return this._mesh.getScene().defaultMaterial;if(this._IsMultiMaterial(e)){var t=e.getSubMaterial(this.materialIndex);return this._currentMaterial!==t&&(this._currentMaterial=t,this._materialDefines=null),t}return e},h.prototype._IsMultiMaterial=function(e){return void 0!==e.getSubMaterial},h.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=null),this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(!(e=e||this._renderingMesh.getVerticesData(r.b.PositionKind)))return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i,n=this._renderingMesh.getIndices();return i=0===this.indexStart&&this.indexCount===n.length?{minimum:(t=this._renderingMesh.getBoundingInfo()).minimum.clone(),maximum:t.maximum.clone()}:Object(a.b)(e,n,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias),this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new o.a(i.minimum,i.maximum),this},h.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},h.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this},h.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},h.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},h.prototype.render=function(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this},h.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],n=this.indexStart;n<this.indexStart+this.indexCount;n+=3)i.push(e[n],e[n+1],e[n+1],e[n+2],e[n+2],e[n]);this._linesIndexBuffer=t.createIndexBuffer(i),this._linesIndexCount=i.length}return this._linesIndexBuffer},h.prototype.canIntersects=function(e){var t=this.getBoundingInfo();return!!t&&e.intersectsBox(t.boundingBox)},h.prototype.intersects=function(e,t,i,n,r){var o=this.getMaterial();if(!o)return null;var a=3,s=!1;switch(o.fillMode){case c.a.MATERIAL_PointListDrawMode:case c.a.MATERIAL_LineListDrawMode:case c.a.MATERIAL_LineLoopDrawMode:case c.a.MATERIAL_LineStripDrawMode:case c.a.MATERIAL_TriangleFanDrawMode:return null;case c.a.MATERIAL_TriangleStripDrawMode:a=1,s=!0}return"InstancedLinesMesh"===this._mesh.getClassName()||"LinesMesh"===this._mesh.getClassName()?i.length?this._intersectLines(e,t,i,this._mesh.intersectionThreshold,n):this._intersectUnIndexedLines(e,t,i,this._mesh.intersectionThreshold,n):!i.length&&this._mesh._unIndexed?this._intersectUnIndexedTriangles(e,t,i,n,r):this._intersectTriangles(e,t,i,a,s,n,r)},h.prototype._intersectLines=function(e,t,i,n,r){for(var o=null,a=this.indexStart;a<this.indexStart+this.indexCount;a+=2){var s=t[i[a]],c=t[i[a+1]],l=e.intersectionSegment(s,c,n);if(!(l<0)&&(r||!o||l<o.distance)&&((o=new u.a(null,null,l)).faceId=a/2,r))break}return o},h.prototype._intersectUnIndexedLines=function(e,t,i,n,r){for(var o=null,a=this.verticesStart;a<this.verticesStart+this.verticesCount;a+=2){var s=t[a],c=t[a+1],l=e.intersectionSegment(s,c,n);if(!(l<0)&&(r||!o||l<o.distance)&&((o=new u.a(null,null,l)).faceId=a/2,r))break}return o},h.prototype._intersectTriangles=function(e,t,i,n,r,o,a){for(var s=null,c=-1,l=this.indexStart;l<this.indexStart+this.indexCount;l+=n){c++;var u=i[l],h=i[l+1],d=i[l+2];if(r&&4294967295===d)l+=2;else{var p=t[u],f=t[h],m=t[d];if(!a||a(p,f,m,e)){var _=e.intersectsTriangle(p,f,m);if(_){if(_.distance<0)continue;if((o||!s||_.distance<s.distance)&&((s=_).faceId=c,o))break}}}}return s},h.prototype._intersectUnIndexedTriangles=function(e,t,i,n,r){for(var o=null,a=this.verticesStart;a<this.verticesStart+this.verticesCount;a+=3){var s=t[a],c=t[a+1],l=t[a+2];if(!r||r(s,c,l,e)){var u=e.intersectsTriangle(s,c,l);if(u){if(u.distance<0)continue;if((n||!o||u.distance<o.distance)&&((o=u).faceId=a/3,n))break}}}return o},h.prototype._rebuild=function(){this._linesIndexBuffer&&(this._linesIndexBuffer=null)},h.prototype.clone=function(e,t){var i=new h(this.materialIndex,this.verticesStart,this.verticesCount,this.indexStart,this.indexCount,e,t,!1);if(!this.IsGlobal){var n=this.getBoundingInfo();if(!n)return i;i._boundingInfo=new o.a(n.minimum,n.maximum)}return i},h.prototype.dispose=function(){this._linesIndexBuffer&&(this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer),this._linesIndexBuffer=null);var e=this._mesh.subMeshes.indexOf(this);this._mesh.subMeshes.splice(e,1)},h.prototype.getClassName=function(){return"SubMesh"},h.CreateFromIndices=function(e,t,i,n,r){for(var o=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=(r||n).getIndices(),c=t;c<t+i;c++){var l=s[c];l<o&&(o=l),a<l&&(a=l)}return new h(e,o,a-o+1,t,i,n,r)},h);function h(e,t,i,n,r,o,a,s,c){void 0===s&&(s=!0),void 0===c&&(c=!0),this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=n,this.indexCount=r,this._materialDefines=null,this._materialEffect=null,this._effectOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=o,this._renderingMesh=a||o,c&&o.subMeshes.push(this),this._trianglePlanes=[],this._id=o.subMeshes.length-1,s&&(this.refreshBoundingInfo(),o.computeWorldMatrix(!0))}},function(e,t,i){"use strict";i.d(t,"a",function(){return h});var H=i(0),X=i(10),Y=i(8),K=i(16),u=i(18),Q=i(24);K.a.CreateCylinder=function(e){for(var f=e.height||2,m=0===e.diameterTop?0:e.diameterTop||e.diameter||1,_=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1,m=m||1e-5,_=_||1e-5,g=e.tessellation||24,t
1=e.subdivisions||1,i=!!e.hasRings,n=!!e.enclose,r=0===e.cap?0:e.cap||Y.a.CAP_ALL,v=(!e.arc||!(e.arc<=0||1<e.arc))&&e.arc||1,o=0===e.sideOrientation?0:e.sideOrientation||K.a.DEFAULTSIDE,b=e.faceUV||new Array(3),y=e.faceColors,T=2+(1+(1!==v&&n?2:0))*(i?t:1),a=0;a<T;a++)y&&void 0===y[a]&&(y[a]=new X.b(1,1,1,1));for(a=0;a<T;a++)b&&void 0===b[a]&&(b[a]=new H.f(0,0,1,1));for(var s,c,l,u,E=new Array,S=new Array,A=new Array,C=new Array,P=new Array,h=2*Math.PI*v/g,d=(_-m)/2/f,p=H.e.Zero(),x=H.e.Zero(),R=H.e.Zero(),O=H.e.Zero(),M=H.e.Zero(),I=Q.a.Y,D=1,L=1,N=0,F=0,w=0;w<=t;w++)for(l=((c=w/t)*(m-_)+_)/2,D=i&&0!==w&&w!==t?2:1,u=0;u<D;u++){for(i&&(L+=u),n&&(L+=2*u),z=0;z<=g;z++)s=z*h,p.x=Math.cos(-s)*l,p.y=-f/2+c*f,p.z=Math.sin(-s)*l,0===m&&w===t?(x.x=A[A.length-3*(g+1)],x.y=A[A.length-3*(g+1)+1],x.z=A[A.length-3*(g+1)+2]):(x.x=p.x,x.z=p.z,x.y=Math.sqrt(x.x*x.x+x.z*x.z)*d,x.normalize()),0===z&&(R.copyFrom(p),O.copyFrom(x)),S.push(p.x,p.y,p.z),A.push(x.x,x.y,x.z),F=i?N!==L?b[L].y:b[L].w:b[L].y+(b[L].w-b[L].y)*c,C.push(b[L].x+(b[L].z-b[L].x)*z/g,F),y&&P.push(y[L].r,y[L].g,y[L].b,y[L].a);1!==v&&n&&(S.push(p.x,p.y,p.z),S.push(0,p.y,0),S.push(0,p.y,0),S.push(R.x,R.y,R.z),H.e.CrossToRef(I,x,M),M.normalize(),A.push(M.x,M.y,M.z,M.x,M.y,M.z),H.e.CrossToRef(O,I,M),M.normalize(),A.push(M.x,M.y,M.z,M.x,M.y,M.z),F=i?N!==L?b[L+1].y:b[L+1].w:b[L+1].y+(b[L+1].w-b[L+1].y)*c,C.push(b[L+1].x,F),C.push(b[L+1].z,F),F=i?N!==L?b[L+2].y:b[L+2].w:b[L+2].y+(b[L+2].w-b[L+2].y)*c,C.push(b[L+2].x,F),C.push(b[L+2].z,F),y&&(P.push(y[L+1].r,y[L+1].g,y[L+1].b,y[L+1].a),P.push(y[L+1].r,y[L+1].g,y[L+1].b,y[L+1].a),P.push(y[L+2].r,y[L+2].g,y[L+2].b,y[L+2].a),P.push(y[L+2].r,y[L+2].g,y[L+2].b,y[L+2].a))),N!==L&&(N=L)}for(var B=1!==v&&n?g+4:g,L=w=0;L<t;L++){for(var U=0,V=0,k=0,G=0,z=0;z<g;z++)U=w*(B+1)+z,V=(w+1)*(B+1)+z,k=w*(B+1)+(z+1),G=(w+1)*(B+1)+(z+1),E.push(U,V,k),E.push(G,k,V);1!==v&&n&&(E.push(U+2,V+2,k+2),E.push(G+2,k+2,V+2),E.push(U+4,V+4,k+4),E.push(G+4,k+4,V+4)),w=i?w+2:w+1}function j(e){var t=e?m/2:_/2;if(0!=t){var i,n=e?b[T-1]:b[0],r=null;y&&(r=e?y[T-1]:y[0]);var o=S.length/3,a=e?f/2:-f/2,s=new H.e(0,a,0);S.push(s.x,s.y,s.z),A.push(0,e?1:-1,0),C.push(n.x+.5*(n.z-n.x),n.y+.5*(n.w-n.y)),r&&P.push(r.r,r.g,r.b,r.a);for(var c=new H.d(.5,.5),l=0;l<=g;l++){i=2*Math.PI*l*v/g;var u=Math.cos(-i),h=Math.sin(-i),d=new H.e(u*t,a,h*t),p=new H.d(u*c.x+.5,h*c.y+.5);S.push(d.x,d.y,d.z),A.push(0,e?1:-1,0),C.push(n.x+(n.z-n.x)*p.x,n.y+(n.w-n.y)*p.y),r&&P.push(r.r,r.g,r.b,r.a)}for(l=0;l<g;l++)e?(E.push(o),E.push(o+(l+2)),E.push(o+(l+1))):(E.push(o),E.push(o+(l+1)),E.push(o+(l+2)))}}r!==Y.a.CAP_START&&r!==Y.a.CAP_ALL||j(!1),r!==Y.a.CAP_END&&r!==Y.a.CAP_ALL||j(!0),K.a._ComputeSides(o,S,E,A,C,e.frontUVs,e.backUVs);var W=new K.a;return W.indices=E,W.positions=S,W.normals=A,W.uvs=C,y&&(W.colors=P),W},Y.a.CreateCylinder=function(e,t,i,n,r,o,a,s,c){void 0!==a&&a instanceof u.a||(void 0!==a&&(c=s||Y.a.DEFAULTSIDE,s=a),a=o,o=1);var l={height:t,diameterTop:i,diameterBottom:n,tessellation:r,subdivisions:o,sideOrientation:c,updatable:s};return h.CreateCylinder(e,l,a)};var h=(n.CreateCylinder=function(e,t,i){var n=new Y.a(e,i);return t.sideOrientation=Y.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,K.a.CreateCylinder(t).applyToMesh(n,t.updatable),n},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var r=i(0),n=(s.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},s.prototype.clone=function(){return new s(this.normal.x,this.normal.y,this.normal.z,this.d)},s.prototype.getClassName=function(){return"Plane"},s.prototype.getHashCode=function(){var e=this.normal.getHashCode();return 397*e^(0|this.d)},s.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!==e?1/e:0;return this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},s.prototype.transform=function(e){var t=s._TmpMatrix;e.invertToRef(t);var i=t.m,n=this.normal.x,r=this.normal.y,o=this.normal.z,a=this.d;return new s(n*i[0]+r*i[1]+o*i[2]+a*i[3],n*i[4]+r*i[5]+o*i[6]+a*i[7],n*i[8]+r*i[9]+o*i[10]+a*i[11],n*i[12]+r*i[13]+o*i[14]+a*i[15])},s.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},s.prototype.copyFromPoints=function(e,t,i){var n=t.x-e.x,r=t.y-e.y,o=t.z-e.z,a=i.x-e.x,s=i.y-e.y,c=i.z-e.z,l=r*c-o*s,u=o*
1a-n*c,h=n*s-r*a,d=Math.sqrt(l*l+u*u+h*h),p=0!==d?1/d:0;return this.normal.x=l*p,this.normal.y=u*p,this.normal.z=h*p,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},s.prototype.isFrontFacingTo=function(e,t){return r.e.Dot(this.normal,e)<=t},s.prototype.signedDistanceTo=function(e){return r.e.Dot(e,this.normal)+this.d},s.FromArray=function(e){return new s(e[0],e[1],e[2],e[3])},s.FromPoints=function(e,t,i){var n=new s(0,0,0,0);return n.copyFromPoints(e,t,i),n},s.FromPositionAndNormal=function(e,t){var i=new s(0,0,0,0);return t.normalize(),i.normal=t,i.d=-(t.x*e.x+t.y*e.y+t.z*e.z),i},s.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var n=-(t.x*e.x+t.y*e.y+t.z*e.z);return r.e.Dot(i,t)+n},s._TmpMatrix=r.a.Identity(),s);function s(e,t,i,n){this.normal=new r.e(e,t,i),this.d=n}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var o=i(8),a=i(18),n=i(6),s=i(0),c=i(20),l=i(45),u=i(75),r=(i(115),Object.defineProperty(h.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!1,configurable:!0}),h.prototype.init=function(){},h.prototype.attach=function(e,t){var n=this;this._scene=e.getScene(),this.attachedNode=e,h._planeScene||(this._debugMode?h._planeScene=this._scene:((h._planeScene=new a.a(this._scene.getEngine(),{virtual:!0})).detachControl(),this._scene.onDisposeObservable.addOnce(function(){h._planeScene.dispose(),h._planeScene=null}))),this._dragPlane=o.a.CreatePlane("pointerDragPlane",this._debugMode?1:1e4,h._planeScene,!1,o.a.DOUBLESIDE),this.lastDragPosition=new s.e(0,0,0);var r=t||function(e){return n.attachedNode==e||e.isDescendantOf(n.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add(function(e,t){var i;n.enabled&&(e.type==c.a.POINTERDOWN?n.startAndReleaseDragOnPointerEvents&&!n.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&r(e.pickInfo.pickedMesh)&&n._startDrag(e.event.pointerId,e.pickInfo.ray,e.pickInfo.pickedPoint):e.type==c.a.POINTERUP?n.startAndReleaseDragOnPointerEvents&&n.currentDraggingPointerID==e.event.pointerId&&n.releaseDrag():e.type==c.a.POINTERMOVE&&(i=e.event.pointerId,n.currentDraggingPointerID===h._AnyMouseID&&i!==h._AnyMouseID&&"mouse"==e.event.pointerType&&(n._lastPointerRay[n.currentDraggingPointerID]&&(n._lastPointerRay[i]=n._lastPointerRay[n.currentDraggingPointerID],delete n._lastPointerRay[n.currentDraggingPointerID]),n.currentDraggingPointerID=i),n._lastPointerRay[i]||(n._lastPointerRay[i]=new l.a(new s.e,new s.e)),e.pickInfo&&e.pickInfo.ray&&(n._lastPointerRay[i].origin.copyFrom(e.pickInfo.ray.origin),n._lastPointerRay[i].direction.copyFrom(e.pickInfo.ray.direction),n.currentDraggingPointerID==i&&n.dragging&&n._moveDrag(e.pickInfo.ray))))}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(function(){n._moving&&n.moveAttached&&(u.a._RemoveAndStorePivotPoint(n.attachedNode),n._targetPosition.subtractToRef(n.attachedNode.absolutePosition,n._tmpVector),n._tmpVector.scaleInPlace(n.dragDeltaRatio),n.attachedNode.getAbsolutePosition().addToRef(n._tmpVector,n._tmpVector),n.validateDrag(n._tmpVector)&&n.attachedNode.setAbsolutePosition(n._tmpVector),u.a._RestorePivotPoint(n.attachedNode))})},h.prototype.releaseDrag=function(){var e;this.dragging&&(this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID}),this.dragging=!1),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&("ArcRotateCamera"===this._scene.activeCamera.getClassName()?(e=this._scene.activeCamera).attachControl(this._attachedElement,!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton):this._scene.activeCamera.attachControl(this._attachedElement,!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault))},h.prototype.startDrag=function(e,t,i){void 0===e&&(e=h._AnyMouseID),this._startDrag(e,t,i);var n=this._lastPointerRay[e];e===h._AnyMouseID&&(n=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),n&&this._moveDrag(n)},h.prototype._startDrag=function(e,t,i){var n;this._scene.activeCamera&&!this.dragging&&this.attachedNode&&(u.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),(n=this._pickWithRayOnDragPlane(this._startDragRay))&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this.attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedElement?(this._attachedElement=this._scene.activeCamera.inputs.attachedElement,this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement)):this._attachedElement=null)),u.a._RestorePivotPoint(this.attachedNode))},h.prototype._moveDrag=function(e){this._moving=!0;var t,i=this._pickWithRayOnDragPlane(e);i&&(this.updateDragPlane&&this._updateDragPlanePosition(e,i),t=0,this._options.dragAxis?(this.useObjectOrientationForDragging?s.e.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),i.subtractToRef(this.lastDragPosition,this._tmpVector),t=s.e.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(t,this._dragDelta)):(t=this._dragDelta.length(),i.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragOb
1servable.notifyObservers({dragDistance:t,delta:this._dragDelta,dragPlanePoint:i,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerID}),this.lastDragPosition.copyFrom(i))},h.prototype._pickWithRayOnDragPlane=function(e){var t=this;if(!e)return null;var i=Math.acos(s.e.Dot(this._dragPlane.forward,e.direction));if(i>Math.PI/2&&(i=Math.PI-i),0<this.maxDragAngle&&i>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(e.direction),this.attachedNode.absolutePosition.subtractToRef(e.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*s.e.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var n=s.e.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-n,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var r=h._planeScene.pickWithRay(e,function(e){return e==t._dragPlane});return r&&r.hit&&r.pickedMesh&&r.pickedPoint?r.pickedPoint:null},h.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrientationForDragging?s.e.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),e.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),.999<Math.abs(s.e.Dot(this._localAxis,this._pointC))?.999<Math.abs(s.e.Dot(s.e.UpReadOnly,this._pointC))?this._lookAt.copyFrom(s.e.Right()):this._lookAt.copyFrom(s.e.UpReadOnly):(s.e.CrossToRef(this._localAxis,this._pointC,this._lookAt),s.e.CrossToRef(this._localAxis,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.useObjectOrientationForDragging?s.e.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition),this._dragPlane.computeWorldMatrix(!0)},h.prototype.detach=function(){this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this.releaseDrag()},h._AnyMouseID=-2,h);function h(e){this._useAlternatePickedPointAboveMaxDragAngleDragSpeed=-1.1,this.maxDragAngle=0,this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerID=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new n.c,this.onDragStartObservable=new n.c,this.onDragEndObservable=new n.c,this.moveAttached=!0,this.enabled=!0,this.startAndReleaseDragOnPointerEvents=!0,this.detachCameraControls=!0,this.useObjectOrientationForDragging=!0,this.validateDrag=function(e){return!0},this._tmpVector=new s.e(0,0,0),this._alternatePickedPoint=new s.e(0,0,0),this._worldDragAxis=new s.e(0,0,0),this._targetPosition=new s.e(0,0,0),this._attachedElement=null,this._startDragRay=new l.a(new s.e,new s.e),this._lastPointerRay={},this._dragDelta=new s.e,this._pointA=new s.e(0,0,0),this._pointC=new s.e(0,0,0),this._localAxis=new s.e(0,0,0),this._lookAt=new s.e(0,0,0),this._options=e||{};var t=0;if(this._options.dragAxis&&t++,this._options.dragPlaneNormal&&t++,1<t)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1),i.d(t,"b",function(){return a}),i.d(t,"c",function(){return s});var n,r=i(1),o=(l.KEYDOWN=1,l.KEYUP=2,l),a=function(e,t){this.type=e,this.event=t},s=(n=a,Object(r.d)(c,n),c);function c(e,t){var i=n.call(this,e,t)||this;return i.type=e,i.event=t,i.skipOnPointerObservable=!1,i}function l(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n,r=i(1),o=i(6),a=(n=i(49).a,Object(r.d)(s,n),s.prototype.onButtonStateChange=function(e){this._onButtonStateChange=e},Object.defineProperty(s.prototype,"defaultModel",{get:function(){return this._defaultModel},enumerable:!1,configurable:!0}),s.prototype.update=function(){n.prototype.update.call(this);for(var e=0;e<this._buttons.length;e++)this._setButtonValue(this.browserGamepad.buttons[e],this._buttons[e],e);this.leftStick.x===this.pad.x&&this.leftStick.y===this.pad.y||(this.pad.x=this.leftStick.x,this.pad.y=this.leftStick.y,this.onPadValuesChangedObservable.notifyObservers(this.pad))},s.prototype._setButtonValue=function(e,t,i){e=e||{pressed:!1,touched:!1,value:0},t?(this._checkChanges(e,t),this._changes.changed&&(this._onButtonStateChange&&this._onButtonStateChange(this.index,i,e),this._handleButtonChange(i,e,this._changes)),this._buttons[i].pressed=e.pressed,this._buttons[i].touched=e.touched,this._buttons[i].value=e.value<1e-8?0:e.value):this._buttons[i]={pressed:e.pressed,touched:e.touched,value:e.value}},s.prototype._checkChanges=function(e,t){return this._changes.pressChanged=e.pressed!==t.pressed,this._changes.touchChanged=e.touched!==t.touched,this._changes.valueChanged=e.value!==t.value,this._changes.changed=this._changes.pressChanged||this._changes.touchChanged||this._changes.valueChanged,this._changes},s.prototype.dispose=function(){n.prototype.dispose.call(this),this._defaultModel=null,this.onTriggerStateChangedObservable.clear(),this.onMainButtonStateChangedObservable.clear(),this.onSecondaryButtonStateChangedObservable.clear(),this.onPadStateChangedObservable.clear(),this.onPadValuesChangedObservable.clear()},s);function s(e){var t=n.call(this,e)||this;return t.onTriggerStateChangedObservable=new o.c,t.onMainButtonStateChangedObservable=new o.c,t.onSecondaryButtonStateChangedObservable=new o.c,t.onPadStateChangedObservable=new o.c,t.onPadValuesChangedObservable=new o.c,t.pad={x:0,y:0},t._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},t._buttons=new Array(e.buttons.length),t.hand=e.hand,t}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.unBindMesh=function(){this._mesh=null},r.prototype.addFallback=function(e,t){this._defines[e]||(e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},r.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e)},Object.defineProperty(r.prototype,"hasMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!1,configurable:!0}),r.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&0<this._mesh.numBoneInfluencers){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<i.meshes.length;n++){var r=i.meshes[n];if(r.material){if(r.computeBonesUsingShaders&&0!==r.numBoneInfluencers)if(r.material.getEffect()===t)r.computeBonesUsingShaders=!1;else if(r.subMeshes)for(var o=0,a=r.subMeshes;o<a.length;o++)if(a[o].effect===t){r.computeBonesUsingShaders=!1;break}}else!this._mesh.material&&r.computeBonesUsingShaders&&0<r.numBoneInfluencers&&(r.computeBonesUsingShaders=!1)}}else{var s=this._defines[this._currentRank];if(s)for(n=0;n<s.length;n++)e=e.replace("#define "+s[n],"");this._currentRank++}return e},r);function r(){this._defines={},this._currentRank=32,this._maxRank=-1,this._mesh=null}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var l,n=i(1),r=i(7),u=i(9),h=i(2),d=(i(202),i(96)),o=(l=u.a,Object(n.d)(a,l),a.prototype.getClassName=function(){return"DynamicTexture"},Object.defineProperty(a.prototype,"canRescale",{get:function(){return!0}
1,enumerable:!1,configurable:!0}),a.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)},a.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},a.prototype.scaleTo=function(e,t){var i=this.getSize();i.width=e,i.height=t,this._recreate(i)},a.prototype.getContext=function(){return this._context},a.prototype.clear=function(){var e=this.getSize();this._context.fillRect(0,0,e.width,e.height)},a.prototype.update=function(e,t){void 0===t&&(t=!1),this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0)},a.prototype.drawText=function(e,t,i,n,r,o,a,s){void 0===s&&(s=!0);var c,l,u=this.getSize();o&&(this._context.fillStyle=o,this._context.fillRect(0,0,u.width,u.height)),this._context.font=n,null==t&&(c=this._context.measureText(e),t=(u.width-c.width)/2),null==i&&(l=parseInt(n.replace(/\D/g,"")),i=u.height/2+l/3.65),this._context.fillStyle=r||"",this._context.fillText(e,t,i),s&&this.update(a)},a.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize(),i=new a(this.name,t,e,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.wrapU=this.wrapU,i.wrapV=this.wrapV,i},a.prototype.serialize=function(){var e=this.getScene();e&&!e.isReady()&&r.a.Warn("The scene must be ready before serializing the dynamic texture");var t=l.prototype.serialize.call(this);return this._IsCanvasElement(this._canvas)&&(t.base64String=this._canvas.toDataURL()),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t},a.prototype._IsCanvasElement=function(e){return void 0!==e.toDataURL},a.prototype._rebuild=function(){this.update()},a);function a(e,t,i,n,r,o){void 0===i&&(i=null),void 0===r&&(r=h.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=h.a.TEXTUREFORMAT_RGBA);var a=l.call(this,null,i,!n,void 0,r,void 0,void 0,void 0,void 0,o)||this;a.name=e,a.wrapU=u.a.CLAMP_ADDRESSMODE,a.wrapV=u.a.CLAMP_ADDRESSMODE,a._generateMipMaps=n;var s=a._getEngine();if(!s)return a;t.getContext?(a._canvas=t,a._texture=s.createDynamicTexture(t.width,t.height,n,r)):(a._canvas=d.a.CreateCanvas(1,1),t.width||0===t.width?a._texture=s.createDynamicTexture(t.width,t.height,n,r):a._texture=s.createDynamicTexture(t,t,n,r));var c=a.getSize();return a._canvas.width=c.width,a._canvas.height=c.height,a._context=a._canvas.getContext("2d"),a}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var E,n=i(1),s=i(3),S=i(13),A=i(0),r=i(62),C=i(9),P=i(2),c=i(11),o=(i(229),i(41)),x=i(6),a=(E=r.a,Object(n.d)(l,E),Object.defineProperty(l.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){var t;this._boundingBoxSize&&this._boundingBoxSize.equals(e)||(this._boundingBoxSize=e,(t=this.getScene())&&t.markAllMaterialsAsDirty(P.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(A.a.RotationY(this._rotationY))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),l.CreateFromImages=function(e,t,i){var n="";return e.forEach(function(e){return n+=e}),new l(n,t,null,i,e)},l.CreateFromPrefilteredData=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=!0);var r=t.useDelayedTextureLoading;t.useDelayedTextureLoading=!1;var o=new l(e,t,null,!1,null,null,null,void 0,!0,i,n);return t.useDelayedTextureLoading=r,o},l.prototype.getClassName=function(){return"CubeTexture"},l.prototype.updateURL=function(e,t,i,n){var r;void 0===n&&(n=!1),this.url&&(this.releaseInternalTexture(),null===(r=this.getScene())||void 0===r||r.markAllMaterialsAsDirty(P.a.MATERIAL_TextureDirtyFlag)),this.name&&!o.a.StartsWith(this.name,"data:")||(this.name=e),this.url=e,this.delayLoadState=P.a.DELAYLOADSTATE_NOTLOADED,this._prefiltered=n,this._prefiltered&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1),this._forcedExtension=t||null,i&&(this._delayedOnLoad=i),this.delayLoad(t)},l.prototype.delayLoad=function(e){var t,i,n=this;this.delayLoadState!==P.a.DELAYLOADSTATE_NOTLOADED||(this.delayLoadState=P.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture)||(i=this.getScene(),this._prefiltered?this._texture=this._getEngine().createPrefilteredCubeTexture(this.url,i,.8,0,this._delayedOnLoad,void 0,this._format,void 0,this._createPolynomials):this._texture=this._getEngine().createCubeTexture(this.url,i,this._files,this._noMipmap,this._delayedOnLoad,null,this._format,e),null===(t=this._texture)||void 0===t||t.onLoadedObservable.add(function(){return n.onLoadObservable.notifyObservers(n)}))},l.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},l.prototype.setReflectionTextureMatrix=function(e){var t,i=this;e.updateFlag!==this._textureMatrix.updateFlag&&(e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(P.a.MATERIAL_TextureDirtyFlag,function(e){return-1!==e.getActiveTextures().indexOf(i)})),this._textureMatrix=e)},l.Parse=function(t,i,n){var e=s.a.Parse(function(){var e=!1;return t.prefiltered&&(e=t.prefiltered),new l(n+t.name,i,t.extensions,!1,t.files||null,null,null,void 0,e,t.forcedExtension)},t,i);
1if(t.boundingBoxPosition&&(e.boundingBoxPosition=A.e.FromArray(t.boundingBoxPosition)),t.boundingBoxSize&&(e.boundingBoxSize=A.e.FromArray(t.boundingBoxSize)),t.animations)for(var r=0;r<t.animations.length;r++){var o=t.animations[r],a=c.a.GetClass("BABYLON.Animation");a&&e.animations.push(a.Parse(o))}return e},l.prototype.clone=function(){var t=this,i=0,e=s.a.Clone(function(){var e=new l(t.url,t.getScene()||t._getEngine(),t._extensions,t._noMipmap,t._files);return i=e.uniqueId,e},this);return e.uniqueId=i,e},Object(n.c)([Object(s.c)()],l.prototype,"url",void 0),Object(n.c)([Object(s.c)("rotationY")],l.prototype,"rotationY",null),Object(n.c)([Object(s.c)("files")],l.prototype,"_files",void 0),Object(n.c)([Object(s.c)("forcedExtension")],l.prototype,"_forcedExtension",void 0),Object(n.c)([Object(s.c)("extensions")],l.prototype,"_extensions",void 0),Object(n.c)([Object(s.j)("textureMatrix")],l.prototype,"_textureMatrix",void 0),l);function l(e,t,i,n,r,o,a,s,c,l,u,h,d){var p;void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=P.a.TEXTUREFORMAT_RGBA),void 0===c&&(c=!1),void 0===l&&(l=null),void 0===u&&(u=!1),void 0===h&&(h=.8),void 0===d&&(d=0);var f=E.call(this,t)||this;if(f.onLoadObservable=new x.c,f.boundingBoxPosition=A.e.Zero(),f._rotationY=0,f._files=null,f._forcedExtension=null,f._extensions=null,f.name=e,f.url=e,f._noMipmap=n,f.hasAlpha=!1,f._format=s,f.isCube=!0,f._textureMatrix=A.a.Identity(),f._createPolynomials=u,f.coordinatesMode=C.a.CUBIC_MODE,f._extensions=i,f._files=r,f._forcedExtension=l,!e&&!r)return f;var m=e.lastIndexOf("."),_=l||(-1<m?e.substring(m).toLowerCase():""),g=".dds"===_,v=".env"===_;if(v?(f.gammaSpace=!1,f._prefiltered=!1,f.anisotropicFilteringLevel=1):(f._prefiltered=c)&&(f.gammaSpace=!1,f.anisotropicFilteringLevel=1),f._texture=f._getFromCache(e,n),!r&&(v||g||i||(i=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),r=[],i))for(var b=0;b<i.length;b++)r.push(e+i[b]);f._files=r;function y(){f.onLoadObservable.notifyObservers(f),o&&o()}var T;return f._texture?f._texture.isReady?S.b.SetImmediate(y):f._texture.onLoadedObservable.add(y):null!=(T=f.getScene())&&T.useDelayedTextureLoading?f.delayLoadState=P.a.DELAYLOADSTATE_NOTLOADED:(f._texture=c?f._getEngine().createPrefilteredCubeTexture(e,T,h,d,o,a,s,l,f._createPolynomials):f._getEngine().createCubeTexture(e,T,r,n,o,a,f._format,l,!1,h,d),null===(p=f._texture)||void 0===p||p.onLoadedObservable.add(function(){return f.onLoadObservable.notifyObservers(f)})),f}C.a._CubeTextureParser=a.Parse,c.a.RegisteredTypes["BABYLON.CubeTexture"]=a},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"attached",{get:function(){return this._attached},enumerable:!1,configurable:!0}),r.prototype.attach=function(e){var t=this;if(e)this.attached&&this.detach();else if(this.attached)return!1;return this._attached=!0,this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable,function(e){return t._onXRFrame(e)}),!0},r.prototype.detach=function(){return this._attached?(this._attached=!1,this._removeOnDetach.forEach(function(e){e.observable.remove(e.observer)}),!0):!(this.disableAutoAttach=!0)},r.prototype.dispose=function(){this.detach()},r.prototype._addNewAttachObserver=function(e,t){this._removeOnDetach.push({observable:e,observer:e.add(t)})},r);function r(e){this._xrSessionManager=e,this._attached=!1,this._removeOnDetach=[],this.disableAutoAttach=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(210),o=i(13),a=i(276),r=(s.ClearProfilesCache=function(){delete this._ProfilesList,this._ProfileLoadingPromises={}},s.DefaultFallbacks=function(){this.RegisterFallbacksForProfileId("google-daydream",["generic-touchpad"]),this.RegisterFallbacksForProfileId("htc-vive-focus",["generic-trigger-touchpad"]),this.RegisterFallbacksForProfileId("htc-vive",["generic-trigger-squeeze-touchpad"]),this.RegisterFallbacksForProfileId("magicleap-one",["generic-trigger-squeeze-touchpad"]),this.RegisterFallbacksForProfileId("windows-mixed-reality",["generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("microsoft-mixed-reality",["windows-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("oculus-go",["generic-trigger-touchpad"]),this.RegisterFallbacksForProfileId("oculus-touch-v2",["oculus-touch","generic-trigger-squeeze-thumbstick"]),this.RegisterFallbacksForProfileId("oculus-touch",["generic-trigger-squeeze-thumbstick"]),this.RegisterFallbacksForProfileId("samsung-gearvr",["windows-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("samsung-odyssey",["generic-touchpad"]),this.RegisterFallbacksForProfileId("valve-index",["generic-trigger-squeeze-touchpad-thumbstick"])},s.FindFallbackWithProfileId=function(e){var t=this._Fallbacks[e]||[];return t.unshift(e),t},s.GetMotionControllerWithXRInput=function(e,t,i){var n=this,r=[];if(i&&r.push(i),r.push.apply(r,e.profiles||[]),r.length&&!r[0]&&r.pop(),e.gamepad&&e.gamepad.id)switch(e.gamepad.id){case e.gamepad.id.match(/oculus touch/gi)?e.gamepad.id:void 0:r.push("oculus-touch-v2")}var o=r.indexOf("windows-mixed-reality");if(-1!==o&&r.splice(o,0,"microsoft-mixed-reality"),r.length||r.push("generic-trigger"),this.UseOnlineRepository){var a=this.PrioritizeOnlineRepository?this._LoadProfileFromRepository:this._LoadProfilesFromAvailableControllers,s=this.PrioritizeOnlineRepository?this._LoadProfilesFromAvailableControllers:this._LoadProfileFromRepository;return a.call(this,r,e,t).catch(function(){return s.call(n,r,e,t)})}return this._LoadProfilesFromAvailableControllers(r,e,t)},s.RegisterController=function(e,t){this._AvailableControllers[e]=t},s.RegisterFallbacksForProfileId=function(e,t){var i;this._Fallbacks[e]?(i=this._Fallbacks[e]).push.apply(i,t):this._Fallbacks[e]=t},s.UpdateProfilesList=function(){return this._ProfilesList=o.b.LoadFileAsync(this.BaseRepositoryUrl+"/profiles/profilesList.json",!1).then(function(e){return JSON.parse(e.toString())}),this._ProfilesList},s._LoadProfileFromRepository=function(i,t,n){var r=this;return Promise.resolve().then(function(){return r._ProfilesList?r._ProfilesList:r.UpdateProfilesList()}).then(function(e){for(var t=0;t<i.length;++t)if(i[t]&&e[i[t]])return i[t];throw new Error("neither controller "+i[0]+" nor all fallbacks were found in the repository,")}).then(function(e){return r._ProfileLoadingPromises[e]||(r._ProfileLoadingPromises[e]=o.b.LoadFileAsync(r.BaseRepositoryUrl+"/profiles/"+e+"/profile.json",!1).then(function(e){return JSON.parse(e)})),r._ProfileLoadingPromises[e]}).then(function(e){return new a.a(n,t,e,r.BaseRepositoryUrl)})},s._LoadProfilesFromAvailableControllers=function(e,t,i){for(var n=0;n<e.length;++n)if(e[n])for(var r=this.FindFallbackWithProfileId(e[n]),o=0;o<r.length;++o){var a=this._AvailableControllers[r[o]];if(a)return Promise.resolve(a(t,i))}throw new Error("no controller requested was found in the available controllers list")},s._AvailableControllers={},s._Fallbacks={},s._ProfileLoadingPromises={},s.BaseRepositoryUrl="https://immersive-web.github.io/webxr-input-profiles/packages/viewer/dist",s.PrioritizeOnlineRepository=!0,s.UseOnlineRepository=!0,s);function s(){}r.RegisterController(n.a.ProfileId,function(e,t){return new n.a(t,e.gamepad,e.handedness)}),r.DefaultFallbacks()},function(e,t,i){"use strict";i.d(t,"f",function(){return g}),i.d(t,"d",function(){return v}),i.d(t,"a",function(){return b}),i.d(t,"c",function(){return y}),i.d(t,"e",function(){return T}),i.d(t,"g",function(){return E}),i.d(t,"h",function(){return S}),i.d(t,"i",function(){return A}),i.d(t,"j",function(){return C}),i.d(t,"k",function(){return P}),i.d(t,"l",function(){return x}),i.d(t,"m",function(){return R}),i.d(t,"b",function(){return O});var o,n,r,a,s,c,l,u,h,d,p,f,m=i(1),_=i(97),g=(z.prototype.setEasingMode=function(e){var t=Math.min(Math.max(e,0),2);this._easingMode=t},z.prototype.getEasingMode=function(){return this._easingMode},z.prototype.easeInCore=function(e){throw new Error("You must implement this method")},z.prototype.ease=function(e){switch(this._easingMode){case z.EASINGMODE_EASEIN:return this.easeInCore(e);case z.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-e)}return.5<=e?.5*(1-this.easeInCore(2*(1-e)))+.5:.5*this.easeInCore(2*e)},z.EASINGMODE_EASEIN=0,z.EASINGMODE_EASEOUT=1,z.EASINGMODE_EASEINOUT=2,z),v=(f=g,Object(m.d)(G,f),G.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},G),b=(p=g,Object(m.d)(k,p),k.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},k),y=(d=g,Object(m.d)(V,d),V.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,a=e*o,s=Math.log(-a*(1-i)+1)/Math.log(i),c=Math.floor(s),l=c+1,u=(1-Math.pow(i,c))/(r*o),h=.5*(u+(1-Math.pow(i,l))/(r*o)),d=e-h,p=h-u;return-Math.pow(1/i,t-c)/(p*p)*(d-p)*(d+p)},V),T=(h=g,Object(m.d)(U,h),U.prototype.easeInCore=function(e){return e*e*e},U),E=(u=g,Object(m.d)(B,u),B.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.5
1707963267948966)*e)},B),S=(l=g,Object(m.d)(w,l),w.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},w),A=(c=g,Object(m.d)(F,c),F.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},F),C=(s=g,Object(m.d)(N,s),N.prototype.easeInCore=function(e){return e*e},N),P=(a=g,Object(m.d)(L,a),L.prototype.easeInCore=function(e){return e*e*e*e},L),x=(r=g,Object(m.d)(D,r),D.prototype.easeInCore=function(e){return e*e*e*e*e},D),R=(n=g,Object(m.d)(I,n),I.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},I),O=(o=g,Object(m.d)(M,o),M.prototype.easeInCore=function(e){return _.c.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},M);function M(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),void 0===n&&(n=1);var r=o.call(this)||this;return r.x1=e,r.y1=t,r.x2=i,r.y2=n,r}function I(){return null!==n&&n.apply(this,arguments)||this}function D(){return null!==r&&r.apply(this,arguments)||this}function L(){return null!==a&&a.apply(this,arguments)||this}function N(){return null!==s&&s.apply(this,arguments)||this}function F(e){void 0===e&&(e=2);var t=c.call(this)||this;return t.power=e,t}function w(e){void 0===e&&(e=2);var t=l.call(this)||this;return t.exponent=e,t}function B(e,t){void 0===e&&(e=3),void 0===t&&(t=3);var i=u.call(this)||this;return i.oscillations=e,i.springiness=t,i}function U(){return null!==h&&h.apply(this,arguments)||this}function V(e,t){void 0===e&&(e=3),void 0===t&&(t=2);var i=d.call(this)||this;return i.bounces=e,i.bounciness=t,i}function k(e){void 0===e&&(e=1);var t=p.call(this)||this;return t.amplitude=e,t}function G(){return null!==f&&f.apply(this,arguments)||this}function z(){this._easingMode=z.EASINGMODE_EASEIN}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var u,n=i(1),h=i(9),d=i(2),r=(i(130),u=h.a,Object(n.d)(c,u),c.prototype.update=function(e){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},c.CreateLuminanceTexture=function(e,t,i,n,r,o,a){return void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=d.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new c(e,t,i,d.a.TEXTUREFORMAT_LUMINANCE,n,r,o,a)},c.CreateLuminanceAlphaTexture=function(e,t,i,n,r,o,a){return void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=d.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new c(e,t,i,d.a.TEXTUREFORMAT_LUMINANCE_ALPHA,n,r,o,a)},c.CreateAlphaTexture=function(e,t,i,n,r,o,a){return void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=d.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new c(e,t,i,d.a.TEXTUREFORMAT_ALPHA,n,r,o,a)},c.CreateRGBTexture=function(e,t,i,n,r,o,a,s){return void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=d.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===s&&(s=d.a.TEXTURETYPE_UNSIGNED_INT),new c(e,t,i,d.a.TEXTUREFORMAT_RGB,n,r,o,a,s)},c.CreateRGBATexture=function(e,t,i,n,r,o,a,s){return void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=d.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===s&&(s=d.a.TEXTURETYPE_UNSIGNED_INT),new c(e,t,i,d.a.TEXTUREFORMAT_RGBA,n,r,o,a,s)},c.CreateRTexture=function(e,t,i,n,r,o,a,s){return void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=h.a.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=d.a.TEXTURETYPE_FLOAT),new c(e,t,i,d.a.TEXTUREFORMAT_R,n,r,o,a,s)},c);function c(e,t,i,n,r,o,a,s,c){void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=d.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=d.a.TEXTURETYPE_UNSIGNED_INT);var l=u.call(this,null,r,!o,a)||this;return l.format=n,l._texture=r.getEngine().createRawTexture(e,t,i,n,o,a,s,null,c),l.wrapU=h.a.CLAMP_ADDRESSMODE,l.wrapV=h.a.CLAMP_ADDRESSMODE,l}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var R=i(0),O=i(10),r=i(8),M=i(16);M.a.CreateBox=function(e){var t=[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],i=[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],n=[],r=e.width||e.size||1,o=e.height||e.size||1,a=e.depth||e.size||1,s=e.wrap||!1,c=void 0===e.topBaseAt?1:e.topBaseAt,l=void 0===e.bottomBaseAt?0:e.bottomBaseAt,u=[2,0,3,1][c=(c+4)%4],h=[2,0,1,3][l=(l+4)%4],d=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-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(s){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],d=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];
1for(var p=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],f=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],m=[17,18,19,16],_=[22,23,20,21];0<u;)p.unshift(p.pop()),m.unshift(m.pop()),u--;for(;0<h;)f.unshift(f.pop()),_.unshift(_.pop()),h--;p=p.flat(),f=f.flat(),d=d.concat(p).concat(f),t.push(m[0],m[2],m[3],m[0],m[1],m[2]),t.push(_[0],_[2],_[3],_[0],_[1],_[2])}for(var g=[r/2,o/2,a/2],v=d.reduce(function(e,t,i){return e.concat(t*g[i%3])},[]),b=0===e.sideOrientation?0:e.sideOrientation||M.a.DEFAULTSIDE,y=e.faceUV||new Array(6),T=e.faceColors,E=[],S=0;S<6;S++)void 0===y[S]&&(y[S]=new R.f(0,0,1,1)),T&&void 0===T[S]&&(T[S]=new O.b(1,1,1,1));for(var A=0;A<6;A++)if(n.push(y[A].z,y[A].w),n.push(y[A].x,y[A].w),n.push(y[A].x,y[A].y),n.push(y[A].z,y[A].y),T)for(var C=0;C<4;C++)E.push(T[A].r,T[A].g,T[A].b,T[A].a);M.a._ComputeSides(b,v,t,i,n,e.frontUVs,e.backUVs);var P,x=new M.a;return x.indices=t,x.positions=v,x.normals=i,x.uvs=n,T&&(P=b===M.a.DOUBLESIDE?E.concat(E):E,x.colors=P),x},r.a.CreateBox=function(e,t,i,n,r){void 0===i&&(i=null);var o={size:t,sideOrientation:r,updatable:n};return a.CreateBox(e,o,i)};var a=(n.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,M.a.CreateBox(t).applyToMesh(n,t.updatable),n},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var o,n=i(1),r=i(3),a=i(25),s=i(0),c=i(32),l=i(24),u=(o=a.a,Object(n.d)(h,o),h.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},h.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},h.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),o.prototype.storeState.call(this)},h.prototype._restoreStateValues=function(){return!!o.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)},h.prototype._initCache=function(){o.prototype._initCache.call(this),this._cache.lockedTarget=new s.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new s.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new s.b(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},h.prototype._updateCache=function(e){e||o.prototype._updateCache.call(this);var t=this._getLockedTargetPosition();t?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(t):this._cache.lockedTarget=t.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},h.prototype._isSynchronizedViewMatrix=function(){if(!o.prototype._isSynchronizedViewMatrix.call(this))return!1;var e=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(e):!e)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},h.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},h.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=c.a),s.a.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var t=e.subtract(this.position);0<=t.x?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&&s.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},h.prototype.getTarget=function(){return this._currentTarget},h.prototype._decideIfNeedsToMove=function(){return 0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},h.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(s.c.Matrix[0]),s.e.TransformNormalToRef(this.cameraDirection,s.c.Matrix[0],s.c.Vector3[0]),void this.position.addInPlace(s.c.Vector3[0]);this.position.addInPlace(this.cameraDirection)},h.prototype._checkInputs=function(){var e=this.invertRotation?-this.inverseRotationSpeed:1,t=this._decideIfNeedsToMove(),i=0<Math.abs(this.cameraRotation.x)||0<Math.abs(this.cameraRotation.y);t&&this._updatePosition(),i&&(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this.rotation),this.rotation.x+=this.cameraRotation.x*e,this.rotation.y+=this.cameraRotation.y*e,this.noRotationConstraint||(1.570796<this.rotation.x&&(this.rotation.x=1.570796),this.rotation.x<-1.570796&&(this.rotation.x=-1.570796)),this.rotationQuaternion&&this.rotation.lengthSquared()&&s.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)),t&&(Math.abs(this.cameraDirection.x)<this.speed*c.a&&(this.cameraDirection.x=0),Math.abs(this.cameraDirection.y)<this.speed*c.a&&(this.cameraDirection.y=0),Math.abs(this.cameraDirection.z)<this.speed*c.a&&(this.cameraDirection.z=0),this.cameraDirection.scaleInPlace(this.inertia)),i&&(M
1ath.abs(this.cameraRotation.x)<this.speed*c.a&&(this.cameraRotation.x=0),Math.abs(this.cameraRotation.y)<this.speed*c.a&&(this.cameraRotation.y=0),this.cameraRotation.scaleInPlace(this.inertia)),o.prototype._checkInputs.call(this)},h.prototype._updateCameraRotationMatrix=function(){this.rotationQuaternion?this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix):s.a.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this._cameraRotationMatrix)},h.prototype._rotateUpVectorWithCameraRotationMatrix=function(){return s.e.TransformNormalToRef(this._defaultUp,this._cameraRotationMatrix,this.upVector),this},h.prototype._getViewMatrix=function(){return this.lockedTarget&&this.setTarget(this._getLockedTargetPosition()),this._updateCameraRotationMatrix(),this.rotationQuaternion&&this._cachedQuaternionRotationZ!=this.rotationQuaternion.z?(this._rotateUpVectorWithCameraRotationMatrix(),this._cachedQuaternionRotationZ=this.rotationQuaternion.z):this._cachedRotationZ!=this.rotation.z&&(this._rotateUpVectorWithCameraRotationMatrix(),this._cachedRotationZ=this.rotation.z),s.e.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),this.updateUpVectorFromRotation&&(this.rotationQuaternion?l.a.Y.rotateByQuaternionToRef(this.rotationQuaternion,this.upVector):(s.b.FromEulerVectorToRef(this.rotation,this._tmpQuaternion),l.a.Y.rotateByQuaternionToRef(this._tmpQuaternion,this.upVector))),this._computeViewMatrix(this.position,this._currentTarget,this.upVector),this._viewMatrix},h.prototype._computeViewMatrix=function(e,t,i){var n;this.ignoreParentScaling?(this.parent?(n=this.parent.getWorldMatrix(),s.e.TransformCoordinatesToRef(e,n,this._globalPosition),s.e.TransformCoordinatesToRef(t,n,this._tmpTargetVector),s.e.TransformNormalToRef(i,n,this._tmpUpVector),this._markSyncedWithParent()):(this._globalPosition.copyFrom(e),this._tmpTargetVector.copyFrom(t),this._tmpUpVector.copyFrom(i)),this.getScene().useRightHandedSystem?s.a.LookAtRHToRef(this._globalPosition,this._tmpTargetVector,this._tmpUpVector,this._viewMatrix):s.a.LookAtLHToRef(this._globalPosition,this._tmpTargetVector,this._tmpUpVector,this._viewMatrix)):(this.getScene().useRightHandedSystem?s.a.LookAtRHToRef(e,t,i,this._viewMatrix):s.a.LookAtLHToRef(e,t,i,this._viewMatrix),this.parent?(n=this.parent.getWorldMatrix(),this._viewMatrix.invert(),this._viewMatrix.multiplyToRef(n,this._viewMatrix),this._viewMatrix.getTranslationToRef(this._globalPosition),this._viewMatrix.invert(),this._markSyncedWithParent()):this._globalPosition.copyFrom(e))},h.prototype.createRigCamera=function(e,t){if(this.cameraRigMode===a.a.RIG_MODE_NONE)return null;var i=new h(e,this.position.clone(),this.getScene());return i.isRigCamera=!0,(i.rigParent=this).cameraRigMode!==a.a.RIG_MODE_VR&&this.cameraRigMode!==a.a.RIG_MODE_WEBVR||(this.rotationQuaternion||(this.rotationQuaternion=new s.b),i._cameraRigParams={},i.rotationQuaternion=new s.b),i},h.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];switch(this.computeWorldMatrix(),this.cameraRigMode){case a.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case a.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case a.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case a.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case a.a.RIG_MODE_STEREOSCOPIC_INTERLACED:var i=this.cameraRigMode===a.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?1:-1,n=this.cameraRigMode===a.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?-1:1;this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle*i,e),this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle*n,t);break;case a.a.RIG_MODE_VR:e.rotationQuaternion?(e.rotationQuaternion.copyFrom(this.rotationQuaternion),t.rotationQuaternion.copyFrom(this.rotationQuaternion)):(e.rotation.copyFrom(this.rotation),t.rotation.copyFrom(this.rotation)),e.position.copyFrom(this.position),t.position.copyFrom(this.position)}o.prototype._updateRigCameras.call(this)},h.prototype._getRigCamPositionAndTarget=function(e,t){this.getTarget().subtractToRef(this.position,h._TargetFocalPoint),h._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);var i=h._TargetFocalPoint.addInPlace(this.position);s.a.TranslationToRef(-i.x,-i.y,-i.z,h._TargetTransformMatrix),h._TargetTransformMatrix.multiplyToRef(s.a.RotationAxis(t.upVector,e),h._RigCamTransformMatrix),s.a.TranslationToRef(i.x,i.y,i.z,h._TargetTransformMatrix),h._RigCamTransformMatrix.multiplyToRef(h._TargetTransformMatrix,h._RigCamTransformMatrix),s.e.TransformCoordinatesToRef(this.position,h._RigCamTransformMatrix,t.position),t.setTarget(i)},h.prototype.getClassName=function(){return"TargetCamera"},h._RigCamTransformMatrix=new s.a,h._TargetTransformMatrix=new s.a,h._TargetFocalPoint=new s.e,Object(n.c)([Object(r.o)()],h.prototype,"rotation",void 0),Object(n.c)([Object(r.c)()],h.prototype,"speed",void 0),Object(n.c)([Object(r.k)("lockedTargetId")],h.prototype,"lockedTarget",void 0),h);function h(e,t,i,n){void 0===n&&(n=!0);
1var r=o.call(this,e,t,i,n)||this;return r._tmpUpVector=s.e.Zero(),r._tmpTargetVector=s.e.Zero(),r.cameraDirection=new s.e(0,0,0),r.cameraRotation=new s.d(0,0),r.ignoreParentScaling=!1,r.updateUpVectorFromRotation=!1,r._tmpQuaternion=new s.b,r.rotation=new s.e(0,0,0),r.speed=2,r.noRotationConstraint=!1,r.invertRotation=!1,r.inverseRotationSpeed=.2,r.lockedTarget=null,r._currentTarget=s.e.Zero(),r._initialFocalDistance=1,r._viewMatrix=s.a.Zero(),r._camMatrix=s.a.Zero(),r._cameraTransformMatrix=s.a.Zero(),r._cameraRotationMatrix=s.a.Zero(),r._referencePoint=new s.e(0,0,1),r._transformedReferencePoint=s.e.Zero(),r._defaultUp=s.e.Up(),r._cachedRotationZ=0,r._cachedQuaternionRotationZ=0,r}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(2),r=(Object.defineProperty(o,"ForceFullSceneLoadingForIncremental",{get:function(){return o._ForceFullSceneLoadingForIncremental},set:function(e){o._ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"ShowLoadingScreen",{get:function(){return o._ShowLoadingScreen},set:function(e){o._ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"loggingLevel",{get:function(){return o._loggingLevel},set:function(e){o._loggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"CleanBoneMatrixWeights",{get:function(){return o._CleanBoneMatrixWeights},set:function(e){o._CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),o._ForceFullSceneLoadingForIncremental=!1,o._ShowLoadingScreen=!0,o._CleanBoneMatrixWeights=!1,o._loggingLevel=n.a.SCENELOADER_NO_LOGGING,o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.toString=function(){return"{W: "+this.width+", H: "+this.height+"}"},r.prototype.getClassName=function(){return"Size"},r.prototype.getHashCode=function(){var e=0|this.width;return 397*e^(0|this.height)},r.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},r.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},r.prototype.set=function(e,t){return this.copyFromFloats(e,t)},r.prototype.multiplyByFloats=function(e,t){return new r(this.width*e,this.height*t)},r.prototype.clone=function(){return new r(this.width,this.height)},r.prototype.equals=function(e){return!!e&&this.width===e.width&&this.height===e.height},Object.defineProperty(r.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!1,configurable:!0}),r.Zero=function(){return new r(0,0)},r.prototype.add=function(e){return new r(this.width+e.width,this.height+e.height)},r.prototype.subtract=function(e){return new r(this.width-e.width,this.height-e.height)},r.Lerp=function(e,t,i){return new r(e.width+(t.width-e.width)*i,e.height+(t.height-e.height)*i)},r);function r(e,t){this.width=e,this.height=t}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var r=i(0),I=i(10),u=i(16),D=i(4),L=i(78),_=i(93),h=i(52),s=i(2),d=i(13),o=i(43),n=i(192),a=(Object.defineProperty(N.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:!1,configurable:!0}),N.CreateGeometryForMesh=function(e){var t=new N(N.RandomId(),e.getScene());return t.applyToMesh(e),t},Object.defineProperty(N.prototype,"meshes",{get:function(){return this._meshes},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"extend",{get:function(){return this._extend},enumerable:!1,configurable:!0}),N.prototype.getScene=function(){return this._scene},N.prototype.getEngine=function(){return this._engine},N.prototype.isReady=function(){return this.delayLoadState===s.a.DELAYLOADSTATE_LOADED||this.delayLoadState===s.a.DELAYLOADSTATE_NONE},Object.defineProperty(N.prototype,"doNotSerialize",{get:function(){for(var e=0;e<this._meshes.length;e++)if(!this._meshes[e].doNotSerialize)return!1;return!0},enumerable:!1,configurable:!0}),N.prototype._rebuild=function(){for(var e in this._vertexArrayObjects&&(this._vertexArrayObjects={}),0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._vertexBuffers)this._vertexBuffers[e]._rebuild()},N.prototype.setAllVerticesData=function(e,t){e.applyToGeometry(this,t),this.notifyUpdate()},N.prototype.setVerticesData=function(e,t,i,n){void 0===i&&(i=!1);var r=new D.b(this._engine,t,e,i,0===this._meshes.length,n);this.setVerticesBuffer(r)},N.prototype.removeVerticesData=function(e){this._vertexBuffers[e]&&(this._vertexBuffers[e].dispose(),delete this._vertexBuffers[e])},N.prototype.setVerticesBuffer=function(e,t){void 0===t&&(t=null);var i=e.getKind();if(this._vertexBuffers[i]&&this._vertexBuffers[i].dispose(),this._vertexBuffers[i]=e,i===D.b.PositionKind){var n=e.getData();null!=t?this._totalVertices=t:null!=n&&(this._totalVertices=n.length/(e.byteStride/4)),this._updateExtend(n),this._resetPointsArrayCache();for(var r=this._meshes,o=r.length,a=0;a<o;a++){var s=r[a];s._boundingInfo=new h.a(this._extend.minimum,this._extend.maximum),s._createGlobalSubMesh(!1),s.computeWorldMatrix(!0)}}this.notifyUpdate(i),this._vertexArrayObjects&&(this._disposeVertexArrayObjects(),this._vertexArrayObjects={})},N.prototype.updateVerticesDataDirectly=function(e,t,i,n){void 0===n&&(n=!1);var r=this.getVertexBuffer(e);r&&(r.updateDirectly(t,i,n),this.notifyUpdate(e))},N.prototype.updateVerticesData=function(e,t,i){void 0===i&&(i=!1);var n=this.getVertexBuffer(e);n&&(n.update(t),e===D.b.PositionKind&&this._updateBoundingInfo(i,t),this.notifyUpdate(e))},N.prototype._updateBoundingInfo=function(e,t){if(e&&this._updateExtend(t),this._resetPointsArrayCache(),e)for(var i=0,n=this._meshes;i<n.length;i++){var r=n[i];
1r._boundingInfo?r._boundingInfo.reConstruct(this._extend.minimum,this._extend.maximum):r._boundingInfo=new h.a(this._extend.minimum,this._extend.maximum);for(var o=0,a=r.subMeshes;o<a.length;o++)a[o].refreshBoundingInfo()}},N.prototype._bind=function(e,t){var i;e&&(void 0===t&&(t=this._indexBuffer),(i=this.getVertexBuffers())&&(t==this._indexBuffer&&this._vertexArrayObjects?(this._vertexArrayObjects[e.key]||(this._vertexArrayObjects[e.key]=this._engine.recordVertexArrayObject(i,t,e)),this._engine.bindVertexArrayObject(this._vertexArrayObjects[e.key],t)):this._engine.bindBuffers(i,t,e)))},N.prototype.getTotalVertices=function(){return this.isReady()?this._totalVertices:0},N.prototype.getVerticesData=function(e,t,i){var n=this.getVertexBuffer(e);if(!n)return null;var r=n.getData();if(!r)return null;var o=n.getSize()*D.b.GetTypeByteLength(n.type),a=this._totalVertices*n.getSize();if(n.type!==D.b.FLOAT||n.byteStride!==o){var s=[];return n.forEach(a,function(e){return s.push(e)}),s}if((r instanceof Array||r instanceof Float32Array)&&0===n.byteOffset&&r.length===a)return i||t&&1!==this._meshes.length?d.b.Slice(r):r;if(r instanceof Array){var c=n.byteOffset/4;return d.b.Slice(r,c,c+a)}if(r instanceof ArrayBuffer)return new Float32Array(r,n.byteOffset,a);if(c=r.byteOffset+n.byteOffset,i||t&&1!==this._meshes.length){var l=new Float32Array(a),u=new Float32Array(r.buffer,c,a);return l.set(u),l}return new Float32Array(r.buffer,c,a)},N.prototype.isVertexBufferUpdatable=function(e){var t=this._vertexBuffers[e];return!!t&&t.isUpdatable()},N.prototype.getVertexBuffer=function(e){return this.isReady()?this._vertexBuffers[e]:null},N.prototype.getVertexBuffers=function(){return this.isReady()?this._vertexBuffers:null},N.prototype.isVerticesDataPresent=function(e){return this._vertexBuffers?void 0!==this._vertexBuffers[e]:!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},N.prototype.getVerticesDataKinds=function(){var e,t=[];if(!this._vertexBuffers&&this._delayInfo)for(e in this._delayInfo)t.push(e);else for(e in this._vertexBuffers)t.push(e);return t},N.prototype.updateIndices=function(e,t,i){if(void 0===i&&(i=!1),this._indexBuffer)if(this._indexBufferIsUpdatable){var n=e.length!==this._indices.length;if(i||(this._indices=e.slice()),this._engine.updateDynamicIndexBuffer(this._indexBuffer,e,t),n)for(var r=0,o=this._meshes;r<o.length;r++)o[r]._createGlobalSubMesh(!0)}else this.setIndices(e,null,!0)},N.prototype.setIndices=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._disposeVertexArrayObjects(),this._indices=e,this._indexBufferIsUpdatable=i,0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,i)),null!=t&&(this._totalVertices=t);for(var n=0,r=this._meshes;n<r.length;n++)r[n]._createGlobalSubMesh(!0);this.notifyUpdate()},N.prototype.getTotalIndices=function(){return this.isReady()?this._indices.length:0},N.prototype.getIndices=function(e,t){if(!this.isReady())return null;var i=this._indices;if(t||e&&1!==this._meshes.length){for(var n=i.length,r=[],o=0;o<n;o++)r.push(i[o]);return r}return i},N.prototype.getIndexBuffer=function(){return this.isReady()?this._indexBuffer:null},N.prototype._releaseVertexArrayObject=function(e){void 0===e&&(e=null),e&&this._vertexArrayObjects&&this._vertexArrayObjects[e.key]&&(this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]),delete this._vertexArrayObjects[e.key])},N.prototype.releaseForMesh=function(e,t){var i=this._meshes,n=i.indexOf(e);-1!==n&&(i.splice(n,1),e._geometry=null,0===i.length&&t&&this.dispose())},N.prototype.applyToMesh=function(e){var t,i;e._geometry!==this&&((t=e._geometry)&&t.releaseForMesh(e),i=this._meshes,(e._geometry=this)._scene.pushGeometry(this),i.push(e),this.isReady()?this._applyToMesh(e):e._boundingInfo=this._boundingInfo)},N.prototype._updateExtend=function(e){void 0===e&&(e=null),this.useBoundingInfoFromGeometry&&this._boundingInfo?this._extend={minimum:this._boundingInfo.minimum.clone(),maximum:this._boundingInfo.maximum.clone()}:(e=e||this.getVerticesData(D.b.PositionKind),this._extend=Object(n.a)(e,0,this._totalVertices,this.boundingBias,3))},N.prototype._applyToMesh=function(e){var t=this._meshes.length;for(var i in this._vertexBuffers){1===t&&this._vertexBuffers[i].create();var n=this._vertexBuffers[i].getBuffer();n&&(n.references=t),i===D.b.PositionKind&&(this._extend||this._updateExtend(),e._boundingInfo=new h.a(this._extend.minimum,this._extend.maximum),e._createGlobalSubMesh(!1),e._updateBoundingInfo())}1===t&&this._indices&&0<this._indices.length&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=t),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},N.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,i=this._meshes;t<i.length;t++)i[t]._markSubMeshesAsAttributesDirty()},N.prototype.load=function(e,t){this.delayLoadState!==s.a.DELAYLOADSTATE_LOADING&&(this.isReady()?t&&t():(this.delayLoadState=s.a.DELAYLOADSTATE_LOADING,this._queueLoad(e,t)))},N.prototype._queueLoad=function(r,o){var a=this;this.delayLoadingFile&&(r._addPendingData(this),r._loadFile(this.delayLoadingFile,function(e){if(a._delayLoadingFunction){a._delayLoadingFunction(JSON.parse(e),a),a.delayLoadState=s.a.DELAYLOADSTATE_LOADED,a._delayInfo=[],r._removePendingData(a);for(var t=a._meshes,i=t.length,n=0;n<i;n++)a._applyToMesh(t[n]);o&&o()}},void 0,!0))},N.prototype.toLeftHanded=function(){var e=this.getIndices(!1);if(null!=e&&0<e.length){for(var t=0;t<e.length;t+=3){var i=e[t+0];e[t+0]=e[t+2],e[t+2]=i}this.setIndices(e)}var n=this.getVerticesData(D.b.PositionKind,!1);if(null!=n&&0<n.length){for(t=0;t<n.length;t+=3)n[t+2]=-n[t+2];this.setVerticesData(D.b.PositionKind,n,!1)}
1var r=this.getVerticesData(D.b.NormalKind,!1);if(null!=r&&0<r.length){for(t=0;t<r.length;t+=3)r[t+2]=-r[t+2];this.setVerticesData(D.b.NormalKind,r,!1)}},N.prototype._resetPointsArrayCache=function(){this._positions=null},N.prototype._generatePointsArray=function(){if(this._positions)return!0;var e=this.getVerticesData(D.b.PositionKind);if(!e||0===e.length)return!1;this._positions=[];for(var t=0;t<e.length;t+=3)this._positions.push(r.e.FromArray(e,t));return!0},N.prototype.isDisposed=function(){return this._isDisposed},N.prototype._disposeVertexArrayObjects=function(){if(this._vertexArrayObjects){for(var e in this._vertexArrayObjects)this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e]);this._vertexArrayObjects={}}},N.prototype.dispose=function(){for(var e=this._meshes,t=e.length,i=0;i<t;i++)this.releaseForMesh(e[i]);for(var n in this._meshes=[],this._disposeVertexArrayObjects(),this._vertexBuffers)this._vertexBuffers[n].dispose();this._vertexBuffers={},this._totalVertices=0,this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null,this._indices=[],this.delayLoadState=s.a.DELAYLOADSTATE_NONE,this.delayLoadingFile=null,this._delayLoadingFunction=null,this._delayInfo=[],this._boundingInfo=null,this._scene.removeGeometry(this),this._isDisposed=!0},N.prototype.copy=function(e){var t=new u.a;t.indices=[];var i=this.getIndices();if(i)for(var n=0;n<i.length;n++)t.indices.push(i[n]);var r,o=!1,a=!1;for(r in this._vertexBuffers){var s,c=this.getVerticesData(r);!c||(c instanceof Float32Array?t.set(new Float32Array(c),r):t.set(c.slice(0),r),a)||(s=this.getVertexBuffer(r))&&(a=!(o=s.isUpdatable()))}var l=new N(e,this._scene,t,o);for(r in l.delayLoadState=this.delayLoadState,l.delayLoadingFile=this.delayLoadingFile,l._delayLoadingFunction=this._delayLoadingFunction,this._delayInfo)l._delayInfo=l._delayInfo||[],l._delayInfo.push(r);return l._boundingInfo=new h.a(this._extend.minimum,this._extend.maximum),l},N.prototype.serialize=function(){var e={};return e.id=this.id,e.updatable=this._updatable,o.a&&o.a.HasTags(this)&&(e.tags=o.a.GetTags(this)),e},N.prototype.toNumberArray=function(e){return Array.isArray(e)?e:Array.prototype.slice.call(e)},N.prototype.serializeVerticeData=function(){var e=this.serialize();return this.isVerticesDataPresent(D.b.PositionKind)&&(e.positions=this.toNumberArray(this.getVerticesData(D.b.PositionKind)),this.isVertexBufferUpdatable(D.b.PositionKind)&&(e.positions._updatable=!0)),this.isVerticesDataPresent(D.b.NormalKind)&&(e.normals=this.toNumberArray(this.getVerticesData(D.b.NormalKind)),this.isVertexBufferUpdatable(D.b.NormalKind)&&(e.normals._updatable=!0)),this.isVerticesDataPresent(D.b.TangentKind)&&(e.tangets=this.toNumberArray(this.getVerticesData(D.b.TangentKind)),this.isVertexBufferUpdatable(D.b.TangentKind)&&(e.tangets._updatable=!0)),this.isVerticesDataPresent(D.b.UVKind)&&(e.uvs=this.toNumberArray(this.getVerticesData(D.b.UVKind)),this.isVertexBufferUpdatable(D.b.UVKind)&&(e.uvs._updatable=!0)),this.isVerticesDataPresent(D.b.UV2Kind)&&(e.uv2s=this.toNumberArray(this.getVerticesData(D.b.UV2Kind)),this.isVertexBufferUpdatable(D.b.UV2Kind)&&(e.uv2s._updatable=!0)),this.isVerticesDataPresent(D.b.UV3Kind)&&(e.uv3s=this.toNumberArray(this.getVerticesData(D.b.UV3Kind)),this.isVertexBufferUpdatable(D.b.UV3Kind)&&(e.uv3s._updatable=!0)),this.isVerticesDataPresent(D.b.UV4Kind)&&(e.uv4s=this.toNumberArray(this.getVerticesData(D.b.UV4Kind)),this.isVertexBufferUpdatable(D.b.UV4Kind)&&(e.uv4s._updatable=!0)),this.isVerticesDataPresent(D.b.UV5Kind)&&(e.uv5s=this.toNumberArray(this.getVerticesData(D.b.UV5Kind)),this.isVertexBufferUpdatable(D.b.UV5Kind)&&(e.uv5s._updatable=!0)),this.isVerticesDataPresent(D.b.UV6Kind)&&(e.uv6s=this.toNumberArray(this.getVerticesData(D.b.UV6Kind)),this.isVertexBufferUpdatable(D.b.UV6Kind)&&(e.uv6s._updatable=!0)),this.isVerticesDataPresent(D.b.ColorKind)&&(e.colors=this.toNumberArray(this.getVerticesData(D.b.ColorKind)),this.isVertexBufferUpdatable(D.b.ColorKind)&&(e.colors._updatable=!0)),this.isVerticesDataPresent(D.b.MatricesIndicesKind)&&(e.matricesIndices=this.toNumberArray(this.getVerticesData(D.b.MatricesIndicesKind)),e.matricesIndices._isExpanded=!0,this.isVertexBufferUpdatable(D.b.MatricesIndicesKind)&&(e.matricesIndices._updatable=!0)),this.isVerticesDataPresent(D.b.MatricesWeightsKind)&&(e.matricesWeights=this.toNumberArray(this.getVerticesData(D.b.MatricesWeightsKind)),this.isVertexBufferUpdatable(D.b.MatricesWeightsKind)&&(e.matricesWeights._updatable=!0)),e.indices=this.toNumberArray(this.getIndices()),e},N.ExtractFromMesh=function(e,t){var i=e._geometry;return i?i.copy(t):null},N.RandomId=function(){return d.b.RandomId()}
1,N._ImportGeometry=function(e,t){var i=t.getScene(),n=e.geometryId;if(n){var r=i.getGeometryByID(n);r&&r.applyToMesh(t)}else if(e instanceof ArrayBuffer){var o,a,s,c,l,u,h,d,p,f,m,_,g=t._binaryInfo;if(g.positionsAttrDesc&&0<g.positionsAttrDesc.count&&(o=new Float32Array(e,g.positionsAttrDesc.offset,g.positionsAttrDesc.count),t.setVerticesData(D.b.PositionKind,o,!1)),g.normalsAttrDesc&&0<g.normalsAttrDesc.count&&(a=new Float32Array(e,g.normalsAttrDesc.offset,g.normalsAttrDesc.count),t.setVerticesData(D.b.NormalKind,a,!1)),g.tangetsAttrDesc&&0<g.tangetsAttrDesc.count&&(s=new Float32Array(e,g.tangetsAttrDesc.offset,g.tangetsAttrDesc.count),t.setVerticesData(D.b.TangentKind,s,!1)),g.uvsAttrDesc&&0<g.uvsAttrDesc.count&&(c=new Float32Array(e,g.uvsAttrDesc.offset,g.uvsAttrDesc.count),t.setVerticesData(D.b.UVKind,c,!1)),g.uvs2AttrDesc&&0<g.uvs2AttrDesc.count&&(l=new Float32Array(e,g.uvs2AttrDesc.offset,g.uvs2AttrDesc.count),t.setVerticesData(D.b.UV2Kind,l,!1)),g.uvs3AttrDesc&&0<g.uvs3AttrDesc.count&&(u=new Float32Array(e,g.uvs3AttrDesc.offset,g.uvs3AttrDesc.count),t.setVerticesData(D.b.UV3Kind,u,!1)),g.uvs4AttrDesc&&0<g.uvs4AttrDesc.count&&(h=new Float32Array(e,g.uvs4AttrDesc.offset,g.uvs4AttrDesc.count),t.setVerticesData(D.b.UV4Kind,h,!1)),g.uvs5AttrDesc&&0<g.uvs5AttrDesc.count&&(d=new Float32Array(e,g.uvs5AttrDesc.offset,g.uvs5AttrDesc.count),t.setVerticesData(D.b.UV5Kind,d,!1)),g.uvs6AttrDesc&&0<g.uvs6AttrDesc.count&&(p=new Float32Array(e,g.uvs6AttrDesc.offset,g.uvs6AttrDesc.count),t.setVerticesData(D.b.UV6Kind,p,!1)),g.colorsAttrDesc&&0<g.colorsAttrDesc.count&&(f=ne
1w Float32Array(e,g.colorsAttrDesc.offset,g.colorsAttrDesc.count),t.setVerticesData(D.b.ColorKind,f,!1,g.colorsAttrDesc.stride)),g.matricesIndicesAttrDesc&&0<g.matricesIndicesAttrDesc.count){for(var v=new Int32Array(e,g.matricesIndicesAttrDesc.offset,g.matricesIndicesAttrDesc.count),b=[],y=0;y<v.length;y++){var T=v[y];b.push(255&T),b.push((65280&T)>>8),b.push((16711680&T)>>16),b.push(T>>24)}t.setVerticesData(D.b.MatricesIndicesKind,b,!1)}if(g.matricesWeightsAttrDesc&&0<g.matricesWeightsAttrDesc.count&&(m=new Float32Array(e,g.matricesWeightsAttrDesc.offset,g.matricesWeightsAttrDesc.count),t.setVerticesData(D.b.MatricesWeightsKind,m,!1)),g.indicesAttrDesc&&0<g.indicesAttrDesc.count&&(_=new Int32Array(e,g.indicesAttrDesc.offset,g.indicesAttrDesc.count),t.setIndices(_,null)),g.subMeshesAttrDesc&&0<g.subMeshesAttrDesc.count){var E=new Int32Array(e,g.subMeshesAttrDesc.offset,5*g.subMeshesAttrDesc.count);for(t.subMeshes=[],y=0;y<g.subMeshesAttrDesc.count;y++){var S=E[5*y+0],A=E[5*y+1],C=E[5*y+2],P=E[5*y+3],x=E[5*y+4];L.a.AddToMesh(S,A,C,P,x,t)}}}else if(e.positions&&e.normals&&e.indices){if(t.setVerticesData(D.b.PositionKind,e.positions,e.positions._updatable),t.setVerticesData(D.b.NormalKind,e.normals,e.normals._updatable),e.tangents&&t.setVerticesData(D.b.TangentKind,e.tangents,e.tangents._updatable),e.uvs&&t.setVerticesData(D.b.UVKind,e.uvs,e.uvs._updatable),e.uvs2&&t.setVerticesData(D.b.UV2Kind,e.uvs2,e.uvs2._updatable),e.uvs3&&t.setVerticesData(D.b.UV3Kind,e.uvs3,e.uvs3._updatable),e.uvs4&&t.setVerticesData(D.b.UV4Kind,e.uvs4,e.uvs4._updatable),e.uvs5&&t.setVerticesData(D.b.UV5Kind,e.uvs5,e.uvs5._updatable),e.uvs6&&t.setVerticesData(D.b.UV6Kind,e.uvs6,e.uvs6._updatable),e.colors&&t.setVerticesData(D.b.ColorKind,I.b.CheckColors4(e.colors,e.positions.length/3),e.colors._updatable),e.matricesIndices)if(e.matricesIndices._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(D.b.MatricesIndicesKind,e.matricesIndices,e.matricesIndices._updatable);else{for(b=[],y=0;y<e.matricesIndices.length;y++){var R=e.matricesIndices[y];b.push(255&R),b.push((65280&R)>>8),b.push((16711680&R)>>16),b.push(R>>24)}t.setVerticesData(D.b.MatricesIndicesKind,b,e.matricesIndices._updatable)}if(e.matricesIndicesExtra)if(e.matricesIndicesExtra._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(D.b.MatricesIndicesExtraKind,e.matricesIndicesExtra,e.matricesIndicesExtra._updatable);else{for(b=[],y=0;y<e.matricesIndicesExtra.length;y++)R=e.matricesIndicesExtra[y],b.push(255&R),b.push((65280&R)>>8),b.push((16711680&R)>>16),b.push(R>>24);t.setVerticesData(D.b.MatricesIndicesExtraKind,b,e.matricesIndicesExtra._updatable)}e.matricesWeights&&(N._CleanMatricesWeights(e,t),t.setVerticesData(D.b.MatricesWeightsKind,e.matricesWeights,e.matricesWeights._updatable)),e.matricesWeightsExtra&&t.setVerticesData(D.b.MatricesWeightsExtraKind,e.matricesWeightsExtra,e.matricesWeights._updatable),t.setIndices(e.indices,null)}if(e.subMeshes){t.subMeshes=[];for(var O=0;O<e.subMeshes.length;O++){var M=e.subMeshes[O];L.a.AddToMesh(M.materialIndex,M.verticesStart,M.verticesCount,M.indexStart,M.indexCount,t)}}t._shouldGenerateFlatShading&&(t.convertToFlatShadedMesh(),delete t._shouldGenerateFlatShading),t.computeWorldMatrix(!0),i.onMeshImportedObservable.notifyObservers(t)},N._CleanMatricesWeights=function(e,t){if(_.a.CleanBoneMatrixWeights){var i=0;if(-1<e.skeletonId){var n=t.getScene().getLastSkeletonByID(e.skeletonId);if(n){i=n.bones.length;for(var r=t.getVerticesData(D.b.MatricesIndicesKind),o=t.getVerticesData(D.b.MatricesIndicesExtraKind),a=e.matricesWeights,s=e.matricesWeightsExtra,c=e.numBoneInfluencer,l=a.length,u=0;u<l;u+=4){for(var h,d=0,p=-1,f=0;f<4;f++)d+=h=a[u+f],h<.001&&p<0&&(p=f);if(s)for(f=0;f<4;f++)d+=h=s[u+f],h<.001&&p<0&&(p=f+4);if((p<0||c-1<p)&&(p=c-1),.001<d){for(var m=1/d,f=0;f<4;f++)a[u+f]*=m;if(s)for(f=0;f<4;f++)s[u+f]*=m}else 4<=p?(s[u+p-4]=1-d,o[u+p-4]=i):(a[u+p]=1-d,r[u+p]=i)}t.setVerticesData(D.b.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(D.b.MatricesIndicesExtraKind,o)}}}},N.Parse=function(e,t,i){if(t.getGeometryByID(e.id))return null;var n=new N(e.id,t,void 0,e.updatable);return o.a&&o.a.AddTagsTo(n,e.tags),e.delayLoadingFile?(n.delayLoadState=s.a.DELAYLOADSTATE_NOTLOADED,n.delayLoadingFile=i+e.delayLoadingFile,n._boundingInfo=new h.a(r.e.FromArray(e.boundingBoxMinimum),r.e.FromArray(e.boundingBoxMaximum)),n._delayInfo=[],e.hasUVs&&n._delayInfo.push(D.b.UVKind),e.hasUVs2&&n._delayInfo.push(D.b.UV2Kind),e.hasUVs3&&n._delayInfo.push(D.b.UV3Kind),e.hasUVs4&&n._delayInfo.push(D.b.UV4Kind),e.hasUVs5&&n._delayInfo.push(D.b.UV5Kind),e.hasUVs6&&n._delayInfo.push(D.b.UV6Kind),e.hasColors&&n._delayInfo.push(D.b.ColorKind),e.hasMatricesIndices&&n._delayInfo.push(D.b.MatricesIndicesKind),e.hasMatricesWeights&&n._delayInfo.push(D.b.MatricesWeightsKind),n._delayLoadingFunction=u.a.ImportVertexData):u.a.ImportVertexData(e,n),t.pushGeometry(n,!0),n},N);function N(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),this.delayLoadState=s.a.DELAYLOADSTATE_NONE,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this.useBoundingInfoFromGeometry=!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))}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.CreateCanvas=function(e,t){if("undefined"==typeof document)return new OffscreenCanvas(e,t);var i=document.createElement("canvas");return i.width=e,i.height=t,i},r);function r(){}},function(e,t,i){"use strict";i.d(t,"e",function(){return f}),i.d(t,"c",function(){return r}),i.d(t,"a",function(){return u}),i.d(t,"b",function(){return _}),i.d(t,"f",function(){return s}),i.d(t,"g",function(){return c}),i.d(t,"d",function(){return l});var f,n,o=i(14),m=i(0),a=i(32);(n=f=f||{})[n.CW=0]="CW",n[n.CCW=1]="CCW";var r=(v.Interpolate=function(e,t,i,n,r){for(var o=1-3*n+3*t,a=3*n-6*t,s=3*t,c=e,l=0;l<5;l++){var u=c*c;c-=1/(3*o*u+2*a*c+s)*(u*c*o+a*u+s*c-e),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)},v),u=(g.prototype.degrees=function(){return 180*this._radians/Math.PI},g.prototype.radians=function(){return this._radians},g.BetweenTwoPoints=function(e,t){var i=t.subtract(e);
1return new g(Math.atan2(i.y,i.x))},g.FromRadians=function(e){return new g(e)},g.FromDegrees=function(e){return new g(e*Math.PI/180)},g),_=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,a=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new m.d((r*(t.y-i.y)-o*(e.y-t.y))/a,((e.x-t.x)*o-(t.x-i.x)*r)/a),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=u.BetweenTwoPoints(this.centerPoint,this.startPoint);var s=this.startAngle.degrees(),c=u.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),l=u.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();180<c-s&&(c-=360),c-s<-180&&(c+=360),180<l-c&&(l-=360),l-c<-180&&(l+=360),this.orientation=c-s<0?f.CW:f.CCW,this.angle=u.FromDegrees(this.orientation===f.CW?s-l:l-s)},s=(p.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new m.d(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this},p.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],a=new m.d(e,t),s=new m.d(i,n),c=new _(o,a,s),l=c.angle.radians()/r;c.orientation===f.CW&&(l*=-1);for(var u=c.startAngle.radians()+l,h=0;h<r;h++){var d=Math.cos(u)*c.radius+c.centerPoint.x,p=Math.sin(u)*c.radius+c.centerPoint.y;this.addLineTo(d,p),u+=l}return this},p.prototype.close=function(){return this.closed=!0,this},p.prototype.length=function(){var e,t=this._length;return this.closed&&(e=this._points[this._points.length-1],t+=this._points[0].subtract(e).length()),t},p.prototype.getPoints=function(){return this._points},p.prototype.getPointAtLengthPosition=function(e){if(e<0||1<e)return m.d.Zero();for(var t=e*this.length(),i=0,n=0;n<this._points.length;n++){var r=(n+1)%this._points.length,o=this._points[n],a=this._points[r].subtract(o),s=a.length()+i;if(i<=t&&t<=s){var c=a.normalize(),l=t-i;return new m.d(o.x+c.x*l,o.y+c.y*l)}i=s}return m.d.Zero()},p.StartingAt=function(e,t){return new p(e,t)},p),c=(d.prototype.getCurve=function(){return this._curve},d.prototype.getPoints=function(){return this._curve},d.prototype.length=function(){return this._distances[this._distances.length-1]},d.prototype.getTangents=function(){return this._tangents},d.prototype.getNormals=function(){return this._normals},d.prototype.getBinormals=function(){return this._binormals},d.prototype.getDistances=function(){return this._distances},d.prototype.getPointAt=function(e){return this._updatePointAtData(e).point},d.prototype.getTangentAt=function(e,t){return void 0===t&&(t=!1),this._updatePointAtData(e,t),t?m.e.TransformCoordinates(m.e.Forward(),this._pointAtData.interpolationMatrix):this._tangents[this._pointAtData.previousPointArrayIndex]},d.prototype.getNormalAt=function(e,t){return void 0===t&&(t=!1),this._updatePointAtData(e,t),t?m.e.TransformCoordinates(m.e.Right(),this._pointAtData.interpolationMatrix):this._normals[this._pointAtData.previousPointArrayIndex]},d.prototype.getBinormalAt=function(e,t){return void 0===t&&(t=!1),this._updatePointAtData(e,t),t?m.e.TransformCoordinates(m.e.UpReadOnly,this._pointAtData.interpolationMatrix):this._binormals[this._pointAtData.previousPointArrayIndex]},d.prototype.getDistanceAt=function(e){return this.length()*e},d.prototype.getPreviousPointIndexAt=function(e){return this._updatePointAtData(e),this._pointAtData.previousPointArrayIndex},d.prototype.getSubPositionAt=function(e){return this._updatePointAtData(e),this._pointAtData.subPosition},d.prototype.getClosestPositionTo=function(e){for(var t=Number.MAX_VALUE,i=0,n=0;n<this._curve.length-1;n++){var r=this._curve[n+0],o=this._curve[n+1].subtract(r).normalize(),a=this._distances[n+1]-this._distances[n+0],s=Math.min(Math.max(m.e.Dot(o,e.subtract(r).normalize()),0)*m.e.Distance(r,e)/a,1),c=m.e.Distance(r.add(o.scale(s*a)),e);c<t&&(t=c,i=(this._distances[n+0]+a*s)/this.length())}return i},d.prototype.slice=function(e,t){var i;void 0===e&&(e=0),void 0===t&&(t=1),e<0&&(e=1- -1*e%1),t<0&&(t=1- -1*t%1),t<e&&(i=e,e=t,t=i);
1var n=this.getCurve(),r=this.getPointAt(e),o=this.getPreviousPointIndexAt(e),a=this.getPointAt(t),s=this.getPreviousPointIndexAt(t)+1,c=[];return 0!==e&&(o++,c.push(r)),c.push.apply(c,n.slice(o,s)),1===t&&1!==e||c.push(a),new d(c,this.getNormalAt(e),this._raw,this._alignTangentsWithPath)},d.prototype.update=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1);for(var n=0;n<e.length;n++)this._curve[n].x=e[n].x,this._curve[n].y=e[n].y,this._curve[n].z=e[n].z;return this._compute(t,i),this},d.prototype._compute=function(e,t){void 0===t&&(t=!1);var i=this._curve.length;this._tangents[0]=this._getFirstNonNullVector(0),this._raw||this._tangents[0].normalize(),this._tangents[i-1]=this._curve[i-1].subtract(this._curve[i-2]),this._raw||this._tangents[i-1].normalize();var n,r,o,a,s,c=this._tangents[0],l=this._normalVector(c,e);this._normals[0]=l,this._raw||this._normals[0].normalize(),this._binormals[0]=m.e.Cross(c,this._normals[0]),this._raw||this._binormals[0].normalize(),this._distances[0]=0;for(var u=1;u<i;u++)n=this._getLastNonNullVector(u),u<i-1&&(r=this._getFirstNonNullVector(u),this._tangents[u]=t?r:n.add(r),this._tangents[u].normalize()),this._distances[u]=this._distances[u-1]+this._curve[u].subtract(this._curve[u-1]).length(),o=this._tangents[u],s=this._binormals[u-1],this._normals[u]=m.e.Cross(s,o),this._raw||(0===this._normals[u].length()?(a=this._normals[u-1],this._normals[u]=a.clone()):this._normals[u].normalize()),this._binormals[u]=m.e.Cross(o,this._normals[u]),this._raw||this._binormals[u].normalize();this._pointAtData.id=NaN},d.prototype._getFirstNonNullVector=function(e){for(var t=1,i=this._curve[e+t].subtract(this._curve[e]);0===i.length()&&e+t+1<this._curve.length;)t++,i=this._curve[e+t].subtract(this._curve[e]);return i},d.prototype._getLastNonNullVector=function(e){for(var t=1,i=this._curve[e].subtract(this._curve[e-t]);0===i.length()&&t+1<e;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},d.prototype._normalVector=function(e,t){var i,n,r=e.length();return 0===r&&(r=1),null==t?(n=o.a.WithinEpsilon(Math.abs(e.y)/r,1,a.a)?o.a.WithinEpsilon(Math.abs(e.x)/r,1,a.a)?o.a.WithinEpsilon(Math.abs(e.z)/r,1,a.a)?m.e.Zero():new m.e(0,0,1):new m.e(1,0,0):new m.e(0,-1,0),i=m.e.Cross(e,n)):(i=m.e.Cross(e,t),m.e.CrossToRef(i,e,i)),i.normalize(),i},d.prototype._updatePointAtData=function(e,t){if(void 0===t&&(t=!1),this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;var i=this.getPoints();if(e<=0)return this._setPointAtData(0,0,i[0],0,t);if(1<=e)return this._setPointAtData(1,1,i[i.length-1],i.length-1,t);for(var n,r=i[0],o=0,a=e*this.length(),s=1;s<i.length;s++){n=i[s];var c=m.e.Distance(r,n);if((o+=c)===a)return this._setPointAtData(e,1,n,s,t);if(a<o){var l=(o-a)/c,u=r.subtract(n),h=n.add(u.scaleInPlace(l));return this._setPointAtData(e,1-l,h,s-1,t)}r=n}return this._pointAtData},d.prototype._setPointAtData=function(e,t,i,n,r){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=n,(this._pointAtData.interpolateReady=r)&&this._updateInterpolationMatrix(),this._pointAtData},d.prototype._updateInterpolationMatrix=function(){this._pointAtData.interpolationMatrix=m.a.Identity();var e,t,i,n,r,o,a,s,c,l=this._pointAtData.previousPointArrayIndex;l!==this._tangents.length-1&&(e=l+1,t=this._tangents[l].clone(),i=this._normals[l].clone(),n=this._binormals[l].clone(),r=this._tangents[e].clone(),o=this._normals[e].clone(),a=this._binormals[e].clone(),s=m.b.RotationQuaternionFromAxis(i,n,t),c=m.b.RotationQuaternionFromAxis(o,a,r),m.b.Slerp(s,c,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix))},d),l=(h.CreateQuadraticBezier=function(e,t,i,n){n=2<n?n:3;for(var r=new Array,o=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},a=0;a<=n;a++)r.push(new m.e(o(a/n,e.x,t.x,i.x),o(a/n,e.y,t.y,i.y),o(a/n,e.z,t.z,i.z)));return new h(r)},h.CreateCubicBezier=function(e,t,i,n,r){r=3<r?r:4;for(var o=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},s=0;s<=r;s++)o.push(new m.e(a(s/r,e.x,t.x,i.x,n.x),a(s/r,e.y,t.y,i.y,n.y),a(s/r,e.z,t.z,i.z,n.z)));return new h(o)},h.CreateHermiteSpline=function(e,t,i,n,r){for(var o=new Array,a=1/r,s=0;s<=r;s++)o.push(m.e.Hermite(e,t,i,n,s*a));return new h(o)},h.CreateCatmullRomSpline=function(e,t,i){var n=new Array,r=1/t,o=0;if(i){for(var a=e.length,s=0;s<a;s++)for(var c=o=0;c<t;c++)n.push(m.e.CatmullRom(e[s%a],e[(s+1)%a],e[(s+2)%a],e[(s+3)%a],o)),o+=r;n.push(n[0])}else{var l=new Array;for(l.push(e[0].clone()),Array.prototype.push.apply(l,e),l.push(e[e.length-1].clone()),s=0;s<l.length-3;s++)for(c=o=0;c<t;c++)n.push(m.e.CatmullRom(l[s],l[s+1],l[s+2],l[s+3],o)),o+=r;s--,n.push(m.e.CatmullRom(l[s],l[s+1],l[s+2],l[s+3],o))}return new h(n)},h.prototype.getPoints=function(){return this._points},h.prototype.length=function(){return this._length},h.prototype.continue=function(e){for(var t=this._points[this._points.length-1],i=this._points.slice(),n=e.getPoints(),r=1;r<n.length;r++)i.push(n[r].subtract(n[0]).add(t));return new h(i)},h.prototype._computeLength=function(e){for(var t=0,i=1;i<e.length;i++)t+=e[i].subtract(e[i-1]).length();return t},h);function h(e){this._length=0,this._points=e,this._length=this._computeLength(e)}function d(e,t,i,n){void 0===t&&(t=null),void 0===n&&(n=!1),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:m.e.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:m.a.Identity()};for(var r=0;r<e.length;r++)this._curve[r]=e[r].clone();this._raw=i||!1,this._alignTangentsWithPath=n,this._compute(t,n)}function p(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new m.d(e,t))}function g(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}function v(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var a,n=i(1),r=i(29),o=i(43),s=i(11),c=(a=r.a,Object(n.d)(l,a),Object.defineProperty(l.prototype,"subMaterials",{get:function(){return this._subMaterials},set:function(e){this._subMaterials=e,this._hookArray(e)}
1,enumerable:!1,configurable:!0}),l.prototype.getChildren=function(){return this.subMaterials},l.prototype._hookArray=function(n){var r=this,o=n.push;n.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=o.apply(n,e);return r._markAllSubMeshesAsTexturesDirty(),i};var a=n.splice;n.splice=function(e,t){var i=a.apply(n,[e,t]);return r._markAllSubMeshesAsTexturesDirty(),i}},l.prototype.getSubMaterial=function(e){return e<0||e>=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},l.prototype.getActiveTextures=function(){var e;return(e=a.prototype.getActiveTextures.call(this)).concat.apply(e,this.subMaterials.map(function(e){return e?e.getActiveTextures():[]}))},l.prototype.getClassName=function(){return"MultiMaterial"},l.prototype.isReadyForSubMesh=function(e,t,i){for(var n=0;n<this.subMaterials.length;n++){var r=this.subMaterials[n];if(r){if(r._storeEffectOnSubMeshes){if(!r.isReadyForSubMesh(e,t,i))return!1;continue}if(!r.isReady(e))return!1}}return!0},l.prototype.clone=function(e,t){for(var i=new l(e,this.getScene()),n=0;n<this.subMaterials.length;n++){var r=this.subMaterials[n],o=t&&r?r.clone(e+"-"+r.name):this.subMaterials[n];i.subMaterials.push(o)}return i},l.prototype.serialize=function(){var e={};e.name=this.name,e.id=this.id,o.a&&(e.tags=o.a.GetTags(this)),e.materials=[];for(var t=0;t<this.subMaterials.length;t++){var i=this.subMaterials[t];i?e.materials.push(i.id):e.materials.push(null)}return e},l.prototype.dispose=function(e,t,i){var n=this.getScene();if(n){if(i)for(var r=0;r<this.subMaterials.length;r++){var o=this.subMaterials[r];o&&o.dispose(e,t)}0<=(r=n.multiMaterials.indexOf(this))&&n.multiMaterials.splice(r,1),a.prototype.dispose.call(this,e,t)}},l.ParseMultiMaterial=function(e,t){var i=new l(e.name,t);i.id=e.id,o.a&&o.a.AddTagsTo(i,e.tags);for(var n=0;n<e.materials.length;n++){var r=e.materials[n];r?i.subMaterials.push(t.getLastMaterialByID(r)):i.subMaterials.push(null)}return i},l);function l(e,t){var i=a.call(this,e,t,!0)||this;return t.multiMaterials.push(i),i.subMaterials=new Array,i._storeEffectOnSubMeshes=!0,i}s.a.RegisteredTypes["BABYLON.MultiMaterial"]=c},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(o.SetMatrixPrecision=function(e){if(o.MatrixTrackPrecisionChange=!1,e&&!o.MatrixUse64Bits&&o.MatrixTrackedMatrices)for(var t=0;t<o.MatrixTrackedMatrices.length;++t){var i=o.MatrixTrackedMatrices[t],n=i._m;i._m=new Array(16);for(var r=0;r<16;++r)i._m[r]=n[r]}o.MatrixCurrentType=(o.MatrixUse64Bits=e)?Array:Float32Array,o.MatrixTrackedMatrices=null},o.MatrixUse64Bits=!1,o.MatrixTrackPrecisionChange=!0,o.MatrixCurrentType=Float32Array,o.MatrixTrackedMatrices=[],o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var d,n=i(1),p=i(6),f=i(0),a=i(51),s=i(79),m=i(81),r=i(76),_=i(47),g=i(35),v=i(10),o=(d=r.a,Object(n.d)(b,d),b._CreateArrow=function(e,t,i){void 0===i&&(i=1);var n=new a.a("arrow",e),r=s.a.CreateCylinder("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375*(1+(i-1)/4),tessellation:96},e),o=s.a.CreateCylinder("cylinder",{diameterTop:.005*i,height:.275,diameterBottom:.005*i,tessellation:96},e);return o.material=t,r.parent=n,o.parent=n,r.material=t,r.rotation.x=Math.PI/2,r.position.z+=.3,o.position.z+=.1375,o.rotation.x=Math.PI/2,n},b._CreateArrowInstance=function(e,t){for(var i=new a.a("arrow",e),n=0,r=t.getChildMeshes();n<r.length;n++){var o=r[n];o.createInstance(o.name).parent=i}return i},b.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(b.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedMesh=this._parent.attachedMesh,this.attachedNode=this._parent.attachedNode):(this.attachedMesh=null,this.attachedNode=null)},enumerable:!1,configurable:!0}),b.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._arrow&&this._arrow.dispose(),[this._coloredMaterial,this._hoverMaterial].forEach(function(e){e&&e.dispose()}),d.prototype.dispose.call(this)},b);function b(e,t,i,n,r){void 0===t&&(t=v.a.Gray()),void 0===i&&(i=_.a.DefaultUtilityLayer),void 0===n&&(n=null),void 0===r&&(r=1);var o=d.call(this,i)||this;o._pointerObserver=null,o.snapDistance=0,o.onSnapObservable=new p.c,o._isEnabled=!0,o._parent=null,o._parent=n,o._coloredMaterial=new g.a("",i.utilityLayerScene),o._c
1oloredMaterial.diffuseColor=t,o._coloredMaterial.specularColor=t.subtract(new v.a(.1,.1,.1)),o._hoverMaterial=new g.a("",i.utilityLayerScene),o._hoverMaterial.diffuseColor=t.add(new v.a(.3,.3,.3)),o._arrow=b._CreateArrow(i.utilityLayerScene,o._coloredMaterial,r),o._arrow.lookAt(o._rootMesh.position.add(e)),o._arrow.scaling.scaleInPlace(1/3),o._arrow.parent=o._rootMesh;var a=0,s=new f.e,c={snapDistance:0};o.dragBehavior=new m.a({dragAxis:e}),o.dragBehavior.moveAttached=!1,o._rootMesh.addBehavior(o.dragBehavior);var l=new f.e,u=new f.a;o.dragBehavior.onDragObservable.add(function(e){var t;o.attachedNode&&(o.attachedNode.parent?(o.attachedNode.parent.getWorldMatrix().invertToRef(u),u.setTranslationFromFloats(0,0,0),f.e.TransformCoordinatesToRef(e.delta,u,l)):l.copyFrom(e.delta),0==o.snapDistance?(o.attachedNode.getWorldMatrix().addTranslationFromFloats(l.x,l.y,l.z),o.attachedNode.updateCache()):(a+=e.dragDistance,Math.abs(a)>o.snapDistance&&(t=Math.floor(Math.abs(a)/o.snapDistance),a%=o.snapDistance,l.normalizeToRef(s),s.scaleInPlace(o.snapDistance*t),o.attachedNode.getWorldMatrix().addTranslationFromFloats(s.x,s.y,s.z),o.attachedNode.updateCache(),c.snapDistance=o.snapDistance*t,o.onSnapObservable.notifyObservers(c))),o._matrixChanged())}),o._pointerObserver=i.utilityLayerScene.onPointerObservable.add(function(e){var t;o._customMeshSet||(t=e.pickInfo&&-1!=o._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?o._hoverMaterial:o._coloredMaterial,o._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)}))});var h=i._getSharedGizmoLight();return h.includedOnlyMeshes=h.includedOnlyMeshes.concat(o._rootMesh.getChildMeshes(!1)),o}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),r.prototype.markAsProcessed=function(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._areImageProcessingDirty=!1},r.prototype.markAsUnprocessed=function(){this._isDirty=!0},r.prototype.markAllAsDirty=function(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0},r.prototype.markAsImageProcessingDirty=function(){this._areImageProcessingDirty=!0,this._isDirty=!0},r.prototype.markAsLightDirty=function(e){void 0===e&&(e=!1),this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0},r.prototype.markAsAttributesDirty=function(){this._areAttributesDirty=!0,this._isDirty=!0},r.prototype.markAsTexturesDirty=function(){this._areTexturesDirty=!0,this._isDirty=!0},r.prototype.markAsFresnelDirty=function(){this._areFresnelDirty=!0,this._isDirty=!0},r.prototype.markAsMiscDirty=function(){this._areMiscDirty=!0,this._isDirty=!0},r.prototype.rebuild=function(){this._keys&&delete this._keys,this._keys=[];for(var e=0,t=Object.keys(this);e<t.length;e++){var i=t[e];"_"!==i[0]&&this._keys.push(i)}},r.prototype.isEqual=function(e){if(this._keys.length!==e._keys.length)return!1;for(var t=0;t<this._keys.length;t++){var i=this._keys[t];if(this[i]!==e[i])return!1}return!0},r.prototype.cloneTo=function(e){this._keys.length!==e._keys.length&&(e._keys=this._keys.slice(0));for(var t=0;t<this._keys.length;t++){var i=this._keys[t];e[i]=this[i]}},r.prototype.reset=function(){for(var e=0;e<this._keys.length;e++){var t=this._keys[e];switch(typeof this[t]){case"number":this[t]=0;break;case"string":this[t]="";break;default:this[t]=!1}}},r.prototype.toString=function(){for(var e="",t=0;t<this._keys.length;t++){var i=this._keys[t],n=this[i];switch(typeof n){case"number":case"string":e+="#define "+i+" "+n+"\n";break;default:n&&(e+="#define "+i+"\n")}}return e},r);function r(){this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return g});var n=i(1),r=i(3),s=i(6),c=i(0),o=i(30),a=i(8),l=i(247),u=i(248),h=i(249),d=i(25),p=i(92),f=i(146),m=i(32);o.a.AddNodeConstructor("ArcRotateCamera",function(e,t){return function(){return new g(e,0,0,1,c.e.Zero(),t)}});var _,g=(_=p.a,Object(n.d)(v,_),Object.defineProperty(v.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._YToUpMatrix=new c.a,this._upToYMatrix=new c.a,this._upVector=c.e.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!1,configurable:!0}),v.prototype.setMatUp=function(){c.a.RotationAlignToRef(c.e.UpReadOnly,this._upVector,this._YToUpMatrix),c.a.RotationAlignToRef(this._upVector,c.e.UpReadOnly,this._upToYMatrix)},Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.prototype,"useNaturalPinchZoom",{get:function(){var e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom},set:function(e){var t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)},enumerable:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}
1),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.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:!1,configurable:!0}),Object.defineProperty(v.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new u.a,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new h.a,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new l.a,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!1,configurable:!0}),v.prototype._initCache=function(){_.prototype._initCache.call(this),this._cache._target=new c.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=c.d.Zero()},v.prototype._updateCache=function(e){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)},v.prototype._getTargetPosition=function(){var e;return this._targetHost&&this._targetHost.getAbsolutePosition&&(e=this._targetHost.absolutePosition,this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)),this._getLockedTargetPosition()||this._target},v.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),_.prototype.storeState.call(this)},v.prototype._restoreStateValues=function(){return!(!_.prototype._restoreStateValues.call(this)||(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0))},v.prototype._isSynchronizedViewMatrix=function(){return!!_.prototype._isSynchronizedViewMatrix.call(this)&&this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radiu
1s===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset)},v.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}},v.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},v.prototype._checkInputs=function(){var e;this._collisionTriggered||(this.inputs.checkInputs(),0===this.inertialAlphaOffset&&0===this.inertialBetaOffset&&0===this.inertialRadiusOffset||(e=this.inertialAlphaOffset,this.beta<=0&&(e*=-1),this.getScene().useRightHandedSystem&&(e*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(e*=-1),this.alpha+=e,this.beta+=this.inertialBetaOffset,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)<m.a&&(this.inertialAlphaOffset=0),Math.abs(this.inertialBetaOffset)<m.a&&(this.inertialBetaOffset=0),Math.abs(this.inertialRadiusOffset)<this.speed*m.a&&(this.inertialRadiusOffset=0)),0===this.inertialPanningX&&0===this.inertialPanningY||(this._localDirection||(this._localDirection=c.e.Zero(),this._transformedDirection=c.e.Zero()),this._localDirection.copyFromFloats(this.inertialPanningX,this.inertialPanningY,this.inertialPanningY),this._localDirection.multiplyInPlace(this.panningAxis),this._viewMatrix.invertToRef(this._cameraTransformMatrix),c.e.TransformNormalToRef(this._localDirection,this._cameraTransformMatrix,this._transformedDirection),this.panningAxis.y||(this._transformedDirection.y=0),this._targetHost||(this.panningDistanceLimit?(this._transformedDirection.addInPlace(this._target),c.e.DistanceSquared(this._transformedDirection,this.panningOriginTarget)<=this.panningDistanceLimit*this.panningDistanceLimit&&this._target.copyFrom(this._transformedDirection)):this._target.addInPlace(this._transformedDirection)),this.inertialPanningX*=this.panningInertia,this.inertialPanningY*=this.panningInertia,Math.abs(this.inertialPanningX)<this.speed*m.a&&(this.inertialPanningX=0),Math.abs(this.inertialPanningY)<this.speed*m.a&&(this.inertialPanningY=0)),this._checkLimits(),_.prototype._checkInputs.call(this))},v.prototype._checkLimits=function(){null===this.lowerBetaLimit||void 0===this.lowerBetaLimit?this.allowUpsideDown&&this.beta>Math.PI&&(this.beta=this.beta-2*Math.PI):this.beta<this.lowerBetaLimit&&(this.beta=this.lowerBetaLimit),null===this.upperBetaLimit||void 0===this.upperBetaLimit?this.allowUpsideDown&&this.beta<-Math.PI&&(this.beta=this.beta+2*Math.PI):this.beta>this.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alpha<this.lowerAlphaLimit&&(this.alpha=this.lowerAlphaLimit),null!==this.upperAlphaLimit&&this.alpha>this.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radius<this.lowerRadiusLimit&&(this.radius=this.lowerRadiusLimit,this.inertialRadiusOffset=0),null!==this.upperRadiusLimit&&this.radius>this.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},v.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||c.e.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4),0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha),this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},v.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},v.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()},v.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),0===this.radius&&(this.radius=1e-4);var r,o,a=this._getTargetPosition();return 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||c.e.TransformCoordinatesToRef(this._computationVector,this._YToUpMatrix,this._computationVector),a.addToRef(this._computationVector,this._newPosition),this.get
1Scene().collisionsEnabled&&this.checkCollisions?(r=this.getScene().collisionCoordinator,this._collider||(this._collider=r.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,r.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)):(this._position.copyFrom(this._newPosition),o=this.upVector,this.allowUpsideDown&&n<0&&(o=o.negate()),this._computeViewMatrix(this._position,a,o),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)),this._currentTarget=a,this._viewMatrix},v.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=a.a.MinMax(e),n=c.e.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)},v.prototype.focusOn=function(e,t){var i,n,r;void 0===t&&(t=!1),r=void 0===e.min?(i=e||this.getScene().meshes,n=a.a.MinMax(i),c.e.Distance(n.min,n.max)):(n=e).distance,this._target=a.a.Center(n),t||(this.maxZ=2*r)},v.prototype.createRigCamera=function(e,t){var i=0;switch(this.cameraRigMode){case d.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case d.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case d.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case d.a.RIG_MODE_STEREOSCOPIC_INTERLACED:case d.a.RIG_MODE_VR:i=this._cameraRigParams.stereoHalfAngle*(0===t?1:-1);break;case d.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:i=this._cameraRigParams.stereoHalfAngle*(0===t?-1:1)}var n=new v(e,this.alpha+i,this.beta,this.radius,this._target,this.getScene());return n._cameraRigParams={},n.isRigCamera=!0,n.rigParent=this,n.upVector=this.upVector,n},v.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];switch(e.beta=t.beta=this.beta,this.cameraRigMode){case d.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case d.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case d.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case d.a.RIG_MODE_STEREOSCOPIC_INTERLACED:case d.a.RIG_MODE_VR:e.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case d.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:e.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}_.prototype._updateRigCameras.call(this)},v.prototype.dispose=function(){this.inputs.clear(),_.prototype.dispose.call(this)},v.prototype.getClassName=function(){return"ArcRotateCamera"},Object(n.c)([Object(r.c)()],v.prototype,"alpha",void 0),Object(n.c)([Object(r.c)()],v.prototype,"beta",void 0),Object(n.c)([Object(r.c)()],v.prototype,"radius",void 0),Object(n.c)([Object(r.o)("target")],v.prototype,"_target",void 0),Object(n.c)([Object(r.o)("upVector")],v.prototype,"_upVector",void 0),Object(n.c)([Object(r.c)()],v.prototype,"inertialAlphaOffset",void 0),Object(n.c)([Object(r.c)()],v.prototype,"inertialBetaOffset",void 0),Object(n.c)([Object(r.c)()],v.prototype,"inertialRadiusOffset",void 0),Object(n.c)([Object(r.c)()],v.prototype,"lowerAlphaLimit",void 0),Object(n.c)([Object(r.c)()],v.prototype,"upperAlphaLimit",void 0),Object(n.c)([Object(r.c)()],v.prototype,"lowerBetaLimit",void 0),Object(n.c)([Object(r.c)()],v.prototype,"upperBetaLimit",void 0),Object(n.c)([Object(r.c)()],v.prototype,"lowerRadiusLimit",void 0),Object(n.c)([Object(r.c)()],v.prototype,"upperRadiusLimit",void 0),Object(n.c)([Object(r.c)()],v.prototype,"inertialPanningX",void 0),Object(n.c)([Object(r.c)()],v.prototype,"inertialPanningY",void 0),Object(n.c)([Object(r.c)()],v.prototype,"pinchToPanMaxDistance",void 0),Object(n.c)([Object(r.c)()],v.prototype,"panningDistanceLimit",void 0),Object(n.c)([Object(r.o)()],v.prototype,"panningOriginTarget",void 0),Object(n.c)([Object(r.c)()],v.prototype,"panningInertia",void 0),Object(n.c)([Object(r.c)()],v.prototype,"zoomOnFactor",void 0),Object(n.c)([Object(r.c)()],v.prototype,"targetScreenOffset",void 0),Object(n.c)([Object(r.c)()],v.prototype,"allowUpsideDown",void 0),Object(n.c)([Object(r.c)()],v.prototype,"useInputToRestoreState",void 0),v);function v(e,t,i,n,r,o,a){void 0===a&&(a=!0);var l=_.call(this,e,c.e.Zero(),o,a)||this;return l._upVector=c.e.Up(),l.inertialAlphaOffset=0,l.inertialBetaOffset=0,l.inertialRadiusOffset=0,l.lowerAlphaLimit=null,l.upperAlphaLimit=null,l.lowerBetaLim
1it=.01,l.upperBetaLimit=Math.PI-.01,l.lowerRadiusLimit=null,l.upperRadiusLimit=null,l.inertialPanningX=0,l.inertialPanningY=0,l.pinchToPanMaxDistance=20,l.panningDistanceLimit=null,l.panningOriginTarget=c.e.Zero(),l.panningInertia=.9,l.zoomOnFactor=1,l.targetScreenOffset=c.d.Zero(),l.allowUpsideDown=!0,l.useInputToRestoreState=!0,l._viewMatrix=new c.a,l.panningAxis=new c.e(1,1,0),l.onMeshTargetChangedObservable=new s.c,l.checkCollisions=!1,l.collisionRadius=new c.e(.5,.5,.5),l._previousPosition=c.e.Zero(),l._collisionVelocity=c.e.Zero(),l._newPosition=c.e.Zero(),l._computationVector=c.e.Zero(),l._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),i?(l.setPosition(t),l.onCollide&&l.onCollide(i)):l._previousPosition.copyFrom(l._position);var n=Math.cos(l.alpha),r=Math.sin(l.alpha),o=Math.cos(l.beta),a=Math.sin(l.beta);0===a&&(a=1e-4);var s=l._getTargetPosition();l._computationVector.copyFromFloats(l.radius*n*a,l.radius*o,l.radius*r*a),s.addToRef(l._computationVector,l._newPosition),l._position.copyFrom(l._newPosition);var c=l.upVector;l.allowUpsideDown&&l.beta<0&&(c=(c=c.clone()).negate()),l._computeViewMatrix(l._position,s,c),l._viewMatrix.addAtIndex(12,l.targetScreenOffset.x),l._viewMatrix.addAtIndex(13,l.targetScreenOffset.y),l._collisionTriggered=!1},l._target=c.e.Zero(),r&&l.setTarget(r),l.alpha=t,l.beta=i,l.radius=n,l.getViewMatrix(),l.inputs=new f.a(l),l.inputs.addKeyboard().addMouseWheel().addPointers(),l}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=(Object.defineProperty(o.prototype,"aspectRatio",{get:function(){return this.hResolution/(2*this.vResolution)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"aspectRatioFov",{get:function(){return 2*Math.atan(this.postProcessScaleFactor*this.vScreenSize/(2*this.eyeToScreenDistance))},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"leftHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return n.a.Translation(e,0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rightHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return n.a.Translation(-e,0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"leftPreViewMatrix",{get:function(){return n.a.Translation(.5*this.interpupillaryDistance,0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rightPreViewMatrix",{get:function(){return n.a.Translation(-.5*this.interpupillaryDistance,0,0)},enumerable:!1,configurable:!0}),o.GetDefault=function(){var e=new o;return e.hResolution=1280,e.vResolution=800,e.hScreenSize=.149759993,e.vScreenSize=.0935999975,e.vScreenCenter=.0467999987,e.eyeToScreenDistance=.0410000011,e.lensSeparationDistance=.063500002,e.interpupillaryDistance=.064000003,e.distortionK=[1,.219999999,.239999995,0],e.chromaAbCorrection=[.995999992,-.00400000019,1.01400006,0],e.postProcessScaleFactor=1.714605507808412,e.lensCenterOffset=.151976421,e},o);function o(){this.compensateDistortion=!0,this.multiviewEnabled=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var a=i(1),s=i(125),c=i(6),l=i(7),u=i(36),r=i(0),n=i(8),o=(h.prototype.dispose=function(){var t=this;this.getComponentIds().forEach(function(e){return t.getComponent(e).dispose()}),this.rootMesh&&this.rootMesh.dispose()},h.prototype.getAllComponentsOfType=function(t){var i=this;return this.getComponentIds().map(function(e){return i.components[e]}).filter(function(e){return e.type===t})},h.prototype.getComponent=function(e){return this.components[e]},h.prototype.getComponentIds=function(){return Object.keys(this.components)},h.prototype.getComponentOfType=function(e){return this.getAllComponentsOfType(e)[0]||null},h.prototype.getMainComponent=function(){return this.getComponent(this.layout.selectComponentId)},h.prototype.loadModel=function(){return Object(a.b)(this,void 0,void 0,function(){var n,r,o=this;return Object(a.e)(this,function(e){return n=!this._getModelLoadingConstraints(),r=this._getGenericFilenameAndPath(),n?l.a.Warn("Falling back to generic models"):r=this._getFilenameAndPath(),[2,new Promise(function(t,i){u.a.ImportMesh("",r.path,r.filename,o.scene,function(e){n?o._getGenericParentMesh(e):o._setRootMesh(e),o._processLoadedModel(e),o._modelReady=!0,o.onModelLoadedObservable.notifyObservers(o),t(!0)},null,function(e,t){l.a.Log(t),l.a.Warn("Failed to retrieve controller model of type "+o.profileId+" from the remote server: "+r.path+r.filename),i(t)})})]})})},h.prototype.updateFromXRFrame=function(e){var t=this;
1this.getComponentIds().forEach(function(e){return t.getComponent(e).update(t.gamepadObject)}),this.updateModel(e)},Object.defineProperty(h.prototype,"handness",{get:function(){return this.handedness},enumerable:!1,configurable:!0}),h.prototype.pulse=function(e,t,i){return void 0===i&&(i=0),this.gamepadObject.hapticActuators&&this.gamepadObject.hapticActuators[i]?this.gamepadObject.hapticActuators[i].pulse(e,t):Promise.resolve(!1)},h.prototype._getChildByName=function(e,t){return e.getChildren(function(e){return e.name===t},!1)[0]},h.prototype._getImmediateChildByName=function(e,t){return e.getChildren(function(e){return e.name==t},!0)[0]},h.prototype._lerpTransform=function(e,t,i){var n;e.minMesh&&e.maxMesh&&e.minMesh.rotationQuaternion&&e.maxMesh.rotationQuaternion&&e.valueMesh.rotationQuaternion&&(n=i?.5*t+.5:t,r.b.SlerpToRef(e.minMesh.rotationQuaternion,e.maxMesh.rotationQuaternion,n,e.valueMesh.rotationQuaternion),r.e.LerpToRef(e.minMesh.position,e.maxMesh.position,n,e.valueMesh.position))},h.prototype.updateModel=function(e){this._modelReady&&this._updateModel(e)},h.prototype._getGenericFilenameAndPath=function(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}},h.prototype._getGenericParentMesh=function(e){var t=this;this.rootMesh=new n.a(this.profileId+" "+this.handedness,this.scene),e.forEach(function(e){e.parent||(e.isPickable=!1,e.setParent(t.rootMesh))}),this.rootMesh.rotationQuaternion=r.b.FromEulerAngles(0,Math.PI,0)},h);function h(e,t,i,n,r){var o=this;void 0===r&&(r=!1),this.scene=e,this.layout=t,this.gamepadObject=i,this.handedness=n,this._initComponent=function(e){var t,i,n,r;e&&(i=(t=o.layout.components[e]).type,n=t.gamepadIndices.button,r=[],void 0!==t.gamepadIndices.xAxis&&void 0!==t.gamepadIndices.yAxis&&r.push(t.gamepadIndices.xAxis,t.gamepadIndices.yAxis),o.components[e]=new s.a(e,i,n,r))},this._modelReady=!1,this.components={},this.disableAnimation=!1,this.onModelLoadedObservable=new c.c,t.components&&Object.keys(t.components).forEach(this._initComponent)}},function(e,t,i){"use strict";i.d(t,"b",function(){return s}),i.d(t,"a",function(){return h});var n=i(1),l=i(2),r=i(23),o=i(12),a=i(5);a.a.ShadersStore.passPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";a.a.ShadersStore.passCubePixelShader="\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}";var u,c,s=(c=r.a,Object(n.d)(p,c),p),h=(u=r.a,Object(n.d)(d,u),Object.defineProperty(d.prototype,"face",{get:function(){return this._face},set:function(e){if(!(e<0||5<e))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:!1,configurable:!0}),d);function d(e,t,i,n,r,o,a,s){void 0===i&&(i=null),void 0===a&&(a=l.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1);var c=u.call(this,e,"passCube",null,null,t,i,n,r,o,"#define POSITIVEX",a,void 0,null,s)||this;return c._face=0,c}function p(e,t,i,n,r,o,a,s){return void 0===i&&(i=null),void 0===a&&(a=l.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1),c.call(this,e,"pass",null,null,t,i,n,r,o,void 0,a,void 0,null,s)||this}o.a._RescalePostProcessFactory=function(e){return new s("rescale",1,null,l.a.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,l.a.TEXTURETYPE_UNSIGNED_INT)}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});
1var C=i(13),r=i(0),P=i(14),o=i(111),x=i(27),R=i(62),O=i(2),a=i(18),M=i(23),s=i(7),n=(i(200),i(216),i(203),i(5)),c=(i(74),"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<helperFunctions>\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}");n.a.ShadersStore.rgbdEncodePixelShader=c,i(344);var l=(T.GetEnvInfo=function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0,n=0;n<T._MagicBytes.length;n++)if(t.getUint8(i++)!==T._MagicBytes[n])return s.a.Error("Not a babylon environment map"),null;for(var r="",o=0;o=t.getUint8(i++);)r+=String.fromCharCode(o);var a=JSON.parse(r);return a.specular&&(a.specular.specularDataPosition=i,a.specular.lodGenerationScale=a.specular.lodGenerationScale||.8),a},T.CreateEnvTextureAsync=function(m){var _=this,e=m.getInternalTexture();if(!e)return Promise.reject("The cube texture is invalid.");var c=e.getEngine();if(c&&c.premultipliedAlpha)return Promise.reject("Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.");if(m.textureType===O.a.TEXTURETYPE_UNSIGNED_INT)return Promise.reject("The cube texture should allow HDR (Full Float or Half Float).");var l=c.getRenderingCanvas();if(!l)return Promise.reject("Env texture can only be created when the engine is associated to a canvas.");var i=O.a.TEXTURETYPE_FLOAT;if(!c.getCaps().textureFloatRender&&(i=O.a.TEXTURETYPE_HALF_FLOAT,!c.getCaps().textureHalfFloatRender))return Promise.reject("Env texture can only be created when the browser supports half float or full float rendering.");for(var g=e.width,v=new a.a(c),b={},n=[],y=P.a.Log2(e.width),y=Math.round(y),t=function(a){for(var s=Math.pow(2,y-a),e=function(r){var e=m.readPixels(r,a),o=c.createRawTexture(e,s,s,O.a.TEXTUREFORMAT_RGBA,!1,!1,O.a.TEXTURE_NEAREST_SAMPLINGMODE,null,i),t=new Promise(function(i,e){var n=new M.a("rgbdEncode","rgbdEncode",null,null,1,null,O.a.TEXTURE_NEAREST_SAMPLINGMODE,c,!1,void 0,O.a.TEXTURETYPE_UNSIGNED_INT,void 0,null,!1);n.getEffect().executeWhenCompiled(function(){n.onApply=function(e){e._bindTexture("textureSampler",o)};var e=c.getRenderWidth(),t=c.getRenderHeight();c.setSize(s,s),v.postProcessManager.directRender([n],null),C.b.ToBlob(l,function(e){var t=new FileReader;t.onload=function(e){var t=e.target.result;b[6*a+r]=t,i()},t.readAsArrayBuffer(e)}),c.setSize(e,t)})});n.push(t)},t=0;t<6;t++)e(t)},r=0;r<=y;r++)t(r);return Promise.all(n).then(function(){v.dispose();for(var e={version:1,width:g,irradiance:_._CreateEnvTextureIrradiance(m),specular:{mipmaps:[],lodGenerationScale:m.lodGenerationScale}},t=0,i=0;i<=y;i++)for(var n=0;n<6;n++){var r=b[6*i+n].byteLength;e.specular.mipmaps.push({length:r,position:t}),t+=r}for(var o=JSON.stringify(e),a=new ArrayBuffer(o.length+1),s=new Uint8Array(a),c=(i=0,o.length);i<c;i++)s[i]=o.charCodeAt(i);s[o.length]=0;for(var l=T._MagicBytes.length+t+a.byteLength,u=new ArrayBuffer(l),h=new Uint8Array(u),d=new DataView(u),p=0,i=0;i<T._MagicBytes.length;i++)d.setUint8(p++,T._MagicBytes[i]);for(h.set(new Uint8Array(a),p),p+=a.byteLength,i=0;i<=y;i++)for(n=0;n<6;n++){var f=b[6*i+n];h.set(new Uint8Array(f),p),p+=f.byteLength}return u})},T._CreateEnvTextureIrradiance=function(e){var t=e.sphericalPolynomial;return null==t?null:{x:[t.x.x,t.x.y,t.x.z],y:[t.y.x,t.y.y,t.y.z],z:[t.z.x,t.z.y,t.z.z],xx:[t.xx.x,t.xx.y,t.xx.z],yy:[t.yy.x,t.yy.y,t.yy.z],zz:[t.zz.x,t.zz.y,t.zz.z],yz:[t.yz.x,t.yz.y,t.yz.z],zx:[t.zx.x,t.zx.y,t.zx.z],xy:[t.xy.x,t.xy.y,t.xy.z]}},T.CreateImageDataArrayBufferViews=function(e,t){if(1!==t.version)throw new Error('Unsupported babylon environment map version "'+t.version+'"');var i=t.specular,n=P.a.Log2(t.width),n=Math.round(n)+1;if(i.mipmaps.length!==6*n)throw new Error('Unsupported specular mipmaps number "'+i.mipmaps.length+'"');for(var r=new Array(n),o=0;o<n;o++){r[o]=new Array(6);for(var a=0;a<6;a++){var s=i.mipmaps[6*o+a];r[o][a]=new Uint8Array(e.buffer,e.byteOffset+i.specularDataPosition+s.position,s.length)}}return r},T.UploadEnvLevelsAsync=function(e,t,i){if(1!==i.version)throw new Error('Unsupported babylon environment map version "'+i.version+'"');var n=i.specular;if(!n)return Promise.resolve();e._lodGenerationScale=n.lodGenerationScale;var r=T.CreateImageDataArrayBufferViews(t,i);return T.UploadLevelsAsync(e,r)},T._OnImageReadyAsync=function(r,o,a,s,c,l,u,h,d,p,f){return new Promise(function(e,t){var i,n;
1a?(i=o.createTexture(null,!0,!0,null,O.a.TEXTURE_NEAREST_SAMPLINGMODE,null,function(e){t(e)},r),s.getEffect().executeWhenCompiled(function(){s.onApply=function(e){e._bindTexture("textureSampler",i),e.setFloat2("scale",1,1)},o.scenes[0].postProcessManager.directRender([s],p,!0,l,u),o.restoreDefaultFramebuffer(),i.dispose(),URL.revokeObjectURL(c),e()})):(o._uploadImageToTexture(f,r,l,u),h&&(n=d[u])&&o._uploadImageToTexture(n._texture,r,l,0),e())})},T.UploadLevelsAsync=function(s,c){var l=this;if(!C.b.IsExponentOfTwo(s.width))throw new Error("Texture size must be a power of two");var e=Math.round(P.a.Log2(s.width))+1,u=s.getEngine(),h=!1,d=!1,p=null,f=null,m=null,t=u.getCaps();if(s.format=O.a.TEXTUREFORMAT_RGBA,s.type=O.a.TEXTURETYPE_UNSIGNED_INT,s.generateMipMaps=!0,s._cachedAnisotropicFilteringLevel=null,u.updateTextureSamplingMode(O.a.TEXTURE_TRILINEAR_SAMPLINGMODE,s),t.textureLOD?u.webGLVersion<2?h=!1:t.textureHalfFloatRender&&t.textureHalfFloatLinearFiltering?(h=!0,s.type=O.a.TEXTURETYPE_HALF_FLOAT):t.textureFloatRender&&t.textureFloatLinearFiltering&&(h=!0,s.type=O.a.TEXTURETYPE_FLOAT):(d=!(h=!1),m={}),h)p=new M.a("rgbdDecode","rgbdDecode",null,null,1,null,O.a.TEXTURE_TRILINEAR_SAMPLINGMODE,u,!1,void 0,s.type,void 0,null,!1),s._isRGBD=!1,s.invertY=!1,f=u.createRenderTargetCubeTexture(s.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:O.a.TEXTURE_TRILINEAR_SAMPLINGMODE,type:s.type,format:O.a.TEXTUREFORMAT_RGBA});else if(s._isRGBD=!0,s.invertY=!0,d)for(var i=s._lodGenerationScale,n=s._lodGenerationOffset,r=0;r<3;r++){var o=(e-1)*i+n,a=n+(o-n)*(1-r/2),_=Math.round(Math.min(Math.max(a,0),o)),g=new x.a(u,x.b.Temp);g.isCube=!0,g.invertY=!0,g.generateMipMaps=!1,u.updateTextureSamplingMode(O.a.TEXTURE_LINEAR_LINEAR,g);var v=new R.a(null);switch(v.isCube=!0,v._texture=g,m[_]=v,r){case 0:s._lodTextureLow=v;break;case 1:s._lodTextureMid=v;break;case 2:s._lodTextureHigh=v}}for(var b=[],y=function(a){for(var e=function(i){var n,e=c[a][i],t=new Blob([e],{type:"image/png"}),r=URL.createObjectURL(t),o=void 0,o="undefined"==typeof Image?createImageBitmap(t).then(function(e){return l._OnImageReadyAsync(e,u,h,p,r,i,a,d,m,f,s)}):((n=new Image).src=r,new Promise(function(e,t){n.onload=function(){l._OnImageReadyAsync(n,u,h,p,r,i,a,d,m,f,s).then(function(){return e()}).catch(function(e){t(e)})},n.onerror=function(e){t(e)}}));b.push(o)},t=0;t<6;t++)e(t)},r=0;r<c.length;r++)y(r);if(c.length<e){var T=void 0,E=Math.pow(2,e-1-c.length),S=E*E*4;switch(s.type){case O.a.TEXTURETYPE_UNSIGNED_INT:T=new Uint8Array(S);break;case O.a.TEXTURETYPE_HALF_FLOAT:T=new Uint16Array(S);break;case O.a.TEXTURETYPE_FLOAT:T=new Float32Array(S)}for(r=c.length;r<e;r++)for(var A=0;A<6;A++)u._uploadArrayBufferViewToTexture(s,T,A,r)}return Promise.all(b).then(function(){f&&(u._releaseFramebufferObjects(f),u._releaseTexture(s),f._swapAndDie(s)),p&&p.dispose(),d&&(s._lodTextureHigh&&s._lodTextureHigh._texture&&(s._lodTextureHigh._texture.isReady=!0),s._lodTextureMid&&s._lodTextureMid._texture&&(s._lodTextureMid._texture.isReady=!0),s._lodTextureLow&&s._lodTextureLow._texture&&(s._lodTextureLow._texture.isReady=!0))})},T.UploadEnvSpherical=function(e,t){1!==t.version&&s.a.Warn('Unsupported babylon environment map version "'+t.version+'"');var i,n=t.irradiance;n&&(i=new o.b,r.e.FromArrayToRef(n.x,0,i.x),r.e.FromArrayToRef(n.y,0,i.y),r.e.FromArrayToRef(n.z,0,i.z),r.e.FromArrayToRef(n.xx,0,i.xx),r.e.FromArrayToRef(n.yy,0,i.yy),r.e.FromArrayToRef(n.zz,0,i.zz),r.e.FromArrayToRef(n.yz,0,i.yz),r.e.FromArrayToRef(n.zx,0,i.zx),r.e.FromArrayToRef(n.xy,0,i.xy),e._sphericalPolynomial=i)},T._UpdateRGBDAsync=function(e,t,i,n,r){return e._source=x.b.CubeRawRGBD,e._bufferViewArrayArray=t,e._lodGenerationScale=n,e._lodGenerationOffset=r,e._sphericalPolynomial=i,T.UploadLevelsAsync(e,t).then(function(){e.isReady=!0})},T._MagicBytes=[134,22,135,150,246,214,150,54],T);function T(){}x.a._UpdateRGBDAsync=l._UpdateRGBDAsync},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bonesDeclaration="#if NUM_BONE_INFLUENCERS>0\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#endif\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index*4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));
1\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.instancesDeclaration="#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#ifdef THIN_INSTANCES\nuniform mat4 world;\n#endif\n#else\nuniform mat4 world;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.instancesVertex="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#endif\n#else\nmat4 finalWorld=world;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bonesVertex="#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif"},function(e,t,i){"use strict";i.d(t,"a",function(){return c}),i.d(t,"b",function(){return l});function r(e,t){return n[e]*a[e](t)}var o=i(0),n=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],a=[function(e){return 1},function(e){return e.y},function(e){return e.z},function(e){return e.x},function(e){return e.x*e.y},function(e){return e.y*e.z},function(e){return 3*e.z*e.z-1},function(e){return e.x*e.z},function(e){return e.x*e.x-e.y*e.y}],s=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4],c=(h.prototype.addLight=function(e,t,i){var n=new o.e(t.r,t.g,t.b).scale(i);this.l00=this.l00.add(n.scale(r(0,e))),this.l1_1=this.l1_1.add(n.scale(r(1,e))),this.l10=this.l10.add(n.scale(r(2,e))),this.l11=this.l11.add(n.scale(r(3,e))),this.l2_2=this.l2_2.add(n.scale(r(4,e))),this.l2_1=this.l2_1.add(n.scale(r(5,e))),this.l20=this.l20.add(n.scale(r(6,e))),this.l21=this.l21.add(n.scale(r(7,e))),this.l22=this.l22.add(n.scale(r(8,e)))},h.prototype.scaleInPlace=function(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)},h.prototype.convertIncidentRadianceToIrradiance=function(){this.l00.scaleInPlace(s[0]),this.l1_1.scaleInPlace(s[1]),this.l10.scaleInPlace(s[2]),this.l11.scaleInPlace(s[3]),this.l2_2.scaleInPlace(s[4]),this.l2_1.scaleInPlace(s[5]),this.l20.scaleInPlace(s[6]),this.l21.scaleInPlace(s[7]),this.l22.scaleInPlace(s[8])}
1,h.prototype.convertIrradianceToLambertianRadiance=function(){this.scaleInPlace(1/Math.PI)},h.prototype.preScaleForRendering=function(){this.preScaled=!0,this.l00.scaleInPlace(n[0]),this.l1_1.scaleInPlace(n[1]),this.l10.scaleInPlace(n[2]),this.l11.scaleInPlace(n[3]),this.l2_2.scaleInPlace(n[4]),this.l2_1.scaleInPlace(n[5]),this.l20.scaleInPlace(n[6]),this.l21.scaleInPlace(n[7]),this.l22.scaleInPlace(n[8])},h.FromArray=function(e){var t=new h;return o.e.FromArrayToRef(e[0],0,t.l00),o.e.FromArrayToRef(e[1],0,t.l1_1),o.e.FromArrayToRef(e[2],0,t.l10),o.e.FromArrayToRef(e[3],0,t.l11),o.e.FromArrayToRef(e[4],0,t.l2_2),o.e.FromArrayToRef(e[5],0,t.l2_1),o.e.FromArrayToRef(e[6],0,t.l20),o.e.FromArrayToRef(e[7],0,t.l21),o.e.FromArrayToRef(e[8],0,t.l22),t},h.FromPolynomial=function(e){var t=new h;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.l22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.l1_1.scaleInPlace(-1),t.l11.scaleInPlace(-1),t.l2_1.scaleInPlace(-1),t.l21.scaleInPlace(-1),t.scaleInPlace(Math.PI),t},h),l=(Object.defineProperty(u.prototype,"preScaledHarmonics",{get:function(){return this._harmonics||(this._harmonics=c.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics},enumerable:!1,configurable:!0}),u.prototype.addAmbient=function(e){var t=new o.e(e.r,e.g,e.b);this.xx=this.xx.add(t),this.yy=this.yy.add(t),this.zz=this.zz.add(t)},u.prototype.scaleInPlace=function(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)},u.FromHarmonics=function(e){var t=new u;return t._harmonics=e,t.x=e.l11.scale(1.02333).scale(-1),t.y=e.l1_1.scale(1.02333).scale(-1),t.z=e.l10.scale(1.02333),t.xx=e.l00.scale(.886277).subtract(e.l20.scale(.247708)).add(e.l22.scale(.429043)),t.yy=e.l00.scale(.886277).subtract(e.l20.scale(.247708)).subtract(e.l22.scale(.429043)),t.zz=e.l00.scale(.886277).add(e.l20.scale(.495417)),t.yz=e.l2_1.scale(.858086).scale(-1),t.zx=e.l21.scale(.858086).scale(-1),t.xy=e.l2_2.scale(.858086),t.scaleInPlace(1/Math.PI),t},u.FromArray=function(e){var t=new u;return o.e.FromArrayToRef(e[0],0,t.x),o.e.FromArrayToRef(e[1],0,t.y),o.e.FromArrayToRef(e[2],0,t.z),o.e.FromArrayToRef(e[3],0,t.xx),o.e.FromArrayToRef(e[4],0,t.yy),o.e.FromArrayToRef(e[5],0,t.zz),o.e.FromArrayToRef(e[6],0,t.yz),o.e.FromArrayToRef(e[7],0,t.zx),o.e.FromArrayToRef(e[8],0,t.xy),t},u);function u(){this.x=o.e.Zero(),this.y=o.e.Zero(),this.z=o.e.Zero(),this.xx=o.e.Zero(),this.yy=o.e.Zero(),this.zz=o.e.Zero(),this.xy=o.e.Zero(),this.yz=o.e.Zero(),this.zx=o.e.Zero()}function h(){this.preScaled=!1,this.l00=o.e.Zero(),this.l1_1=o.e.Zero(),this.l10=o.e.Zero(),this.l11=o.e.Zero(),this.l2_2=o.e.Zero(),this.l2_1=o.e.Zero(),this.l20=o.e.Zero(),this.l21=o.e.Zero(),this.l22=o.e.Zero()}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var P=i(0),x=i(8),Z=i(4),J=i(16),R=i(52);J.a.CreateRibbon=function(e){var t,i=e.pathArray,n=e.closeArray||!1,r=e.closePath||!1,o=e.invertUV||!1,a=Math.floor(i[0].length/2),s=a<(s=e.offset||a)?a:Math.floor(s),c=0===e.sideOrientation?0:e.sideOrientation||J.a.DEFAULTSIDE,l=e.uvs,u=e.colors,h=[],d=[],p=[],f=[],m=[],_=[],g=[],v=[],b=[],y=[];if(i.length<2){for(var T=[],E=[],S=0;S<i[0].length-s;S++)T.push(i[0][S]),E.push(i[0][S+s]);i=[T,E]}var A,C,P,x,R,O=0,M=r?1:0,I=i[0].length;for(W=0;W<i.length;W++){for(g[W]=0,m[W]=[0],I=I<(C=(A=i[W]).length)?I:C,t=0;t<C;)h.push(A[t].x,A[t].y,A[t].z),0<t&&(P=A[t].subtract(A[t-1]).length()+g[W],m[W].push(P),g[W]=P),t++;r&&(t--,h.push(A[0].x,A[0].y,A[0].z),P=A[t].subtract(A[0]).length()+g[W],m[W].push(P),g[W]=P),b[W]=C+M,y[W]=O,O+=C+M}var D,L,N=null,F=null;for(S=0;S<I+M;S++){for(v[S]=0,_[S]=[0],W=0;W<i.length-1;
1W++)x=i[W],R=i[W+1],P=(F=S===I?(N=x[0],R[0]):(N=x[S],R[S])).subtract(N).length()+v[S],_[S].push(P),v[S]=P;n&&F&&N&&(x=i[W],R=i[0],S===I&&(F=R[0]),P=F.subtract(N).length()+v[S],v[S]=P)}if(l)for(W=0;W<l.length;W++)f.push(l[W].x,l[W].y);else for(W=0;W<i.length;W++)for(S=0;S<I+M;S++)D=0!=g[W]?m[W][S]/g[W]:0,L=0!=v[S]?_[S][W]/v[S]:0,o?f.push(L,D):f.push(D,L);for(var w=0,B=b[W=0]-1,U=b[W+1]-1,V=B<U?B:U,k=y[1]-y[0],G=n?b.length:b.length-1;w<=V&&W<G;)d.push(w,w+k,w+1),d.push(w+k+1,w+1,w+k),(w+=1)===V&&(U=++W==b.length-1?(k=y[0]-y[W],B=b[W]-1,b[0]-1):(k=y[W+1]-y[W],B=b[W]-1,b[W+1]-1),w=y[W],V=B<U?B+w:U+w);if(J.a.ComputeNormals(h,d,p),r)for(var z=0,j=0,W=0;W<i.length;W++)z=3*y[W],j=W+1<i.length?3*(y[W+1]-1):p.length-3,p[z]=.5*(p[z]+p[j]),p[z+1]=.5*(p[z+1]+p[j+1]),p[z+2]=.5*(p[z+2]+p[j+2]),p[j]=p[z],p[j+1]=p[z+1],p[j+2]=p[z+2];J.a._ComputeSides(c,h,d,p,f,e.frontUVs,e.backUVs);var H=null;if(u){H=new Float32Array(4*u.length);for(var X=0;X<u.length;X++)H[4*X]=u[X].r,H[4*X+1]=u[X].g,H[4*X+2]=u[X].b,H[4*X+3]=u[X].a}var Y=new J.a,K=new Float32Array(h),Q=new Float32Array(p),q=new Float32Array(f);return Y.indices=d,Y.positions=K,Y.normals=Q,Y.uvs=q,H&&Y.set(H,Z.b.ColorKind),r&&(Y._idx=y),Y},x.a.CreateRibbon=function(e,t,i,n,r,o,a,s,c){return void 0===i&&(i=!1),void 0===a&&(a=!1),l.CreateRibbon(e,{pathArray:t,closeArray:i,closePath:n,offset:r,updatable:a,sideOrientation:s,instance:c},o)};var l=(n.CreateRibbon=function(e,t,i){void 0===i&&(i=null);var h=t.pathArray,n=t.closeArray,r=t.closePath,o=x.a._GetDefaultSideOrientation(t.sideOrientation),d=t.instance,a=t.updatable;if(d){var p=P.c.Vector3[0].setAll(Number.MAX_VALUE),f=P.c.Vector3[1].setAll(-Number.MAX_VALUE),s=d.getVerticesData(Z.b.PositionKind);if(function(e){for(var t=h[0].length,i=d,n=0,r=i._originalBuilderSideOrientation===x.a.DOUBLESIDE?2:1,o=1;o<=r;++o)for(var a=0;a<h.length;++a){for(var s=h[a],c=s.length,t=t<c?t:c,l=0;l<t;++l){var u=s[l];e[n]=u.x,e[n+1]=u.y,e[n+2]=u.z,p.minimizeInPlaceFromFloats(u.x,u.y,u.z),f.maximizeInPlaceFromFloats(u.x,u.y,u.z),n+=3}i._creationDataStorage&&i._creationDataStorage.closePath&&(u=s[0],e[n]=u.x,e[n+1]=u.y,e[n+2]=u.z,n+=3)}}(s),d._boundingInfo?d._boundingInfo.reConstruct(p,f,d._worldMatrix):d._boundingInfo=new R.a(p,f,d._worldMatrix),d.updateVerticesData(Z.b.PositionKind,s,!1,!1),t.colors){for(var c=d.getVerticesData(Z.b.ColorKind),l=0,u=0;l<t.colors.length;l++,u+=4){var m=t.colors[l];c[u]=m.r,c[u+1]=m.g,c[u+2]=m.b,c[u+3]=m.a}d.updateVerticesData(Z.b.ColorKind,c,!1,!1)}if(t.uvs){for(var _=d.getVerticesData(Z.b.UVKind),g=0;g<t.uvs.length;g++)_[2*g]=t.uvs[g].x,_[2*g+1]=t.uvs[g].y;d.updateVerticesData(Z.b.UVKind,_,!1,!1)}if(!d.areNormalsFrozen||d.isFacetDataEnabled){var v=d.getIndices(),b=d.getVerticesData(Z.b.NormalKind),y=d.isFacetDataEnabled?d.getFacetDataParameters():null;if(J.a.ComputeNormals(s,v,b,y),d._creationDataStorage&&d._creationDataStorage.closePath)for(var T=0,E=0,S=0;S<h.length;S++)T=3*d._creationDataStorage.idx[S],E=S+1<h.length?3*(d._creationDataStorage.idx[S+1]-1):b.length-3,b[T]=.5*(b[T]+b[E]),b[T+1]=.5*(b[T+1]+b[E+1]),b[T+2]=.5*(b[T+2]+b[E+2]),b[E]=b[T],b[E+1]=b[T+1],b[E+2]=b[T+2];d.areNormalsFrozen||d.updateVerticesData(Z.b.NormalKind,b,!1,!1)}return d}var A=new x.a(e,i);A._originalBuilderSideOrientation=o,A._creationDataStorage=new x.b;var C=J.a.CreateRibbon(t);return r&&(A._creationDataStorage.idx=C._idx),A._creationDataStorage.closePath=r,A._creationDataStorage.closeArray=n,C.applyToMesh(A,a),A},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.FilesToLoad={},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var h=i(1),a=i(70),d=i(6),p=i(0),s=i(10),c=i(14),l=i(4),n=i(136),f=i(64),m=i(291),u=i(5),_=i(29),g=i(15),r=i(48),v=i(9),b=i(90),y=i(2),T=i(22),E=i(156);u.a.ShadersStore.gpuUpdateParticlesPixelShader="#version 300 es\nvoid main() {\ndiscard;\n}\n";u.a.ShadersStore.gpuUpdateParticlesVertexShader="#version 300 es\n#define PI 3.14159\nuniform float currentCount;\nuniform float timeDelta;\nuniform float stopFactor;\n#ifndef LOCAL\nuniform mat4 emitterWM;\n#endif\nuniform vec2 lifeTime;
1\nuniform vec2 emitPower;\nuniform vec2 sizeRange;\nuniform vec4 scaleRange;\n#ifndef COLORGRADIENTS\nuniform vec4 color1;\nuniform vec4 color2;\n#endif\nuniform vec3 gravity;\nuniform sampler2D randomSampler;\nuniform sampler2D randomSampler2;\nuniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\nuniform vec3 minEmitBox;\nuniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;\nuniform float radiusRange;\nuniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;\nuniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;\nuniform float height;\nuniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;\nuniform float coneAngle;\nuniform vec2 height;\nuniform float directionRandomizer;\n#endif\n\nin vec3 position;\n#ifdef CUSTOMEMITTER\nin vec3 initialPosition;\n#endif\nin float age;\nin float life;\nin vec4 seed;\nin vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;\nin vec3 noiseCoordinates2;\n#endif\n\nout vec3 outPosition;\n#ifdef CUSTOMEMITTER\nout vec3 outInitialPosition;\n#endif\nout float outAge;\nout float outLife;\nout vec4 outSeed;\nout vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;\nout vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif\n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;\nuniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;\nuniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\n}\nvec4 getRandomVec4(float offset) {\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\n}\nvoid main() {\nfloat newAge=age+timeDelta;\n\nif (newAge>=life && stopFactor != 0.) {\nvec3 newPosition;\nvec3 newDirection;\n\nvec4 randoms=getRandomVec4(seed.x);\n\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\noutAge=newAge-life;\n\noutSeed=seed;\n\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a;\n#ifndef COLORGRADIENTS\n\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n\n#ifndef ANGULARSPEEDGRADIENTS\noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif\n\n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nnewPosition=vec3(0,0,0);\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nnewPosition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\nnewDirection=direction1+(direction2-direction1)*randoms3;
1\n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\nnewDirection=newPosition+directionRandomizer*randoms3;\n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#else\n\nnewDirection=newPosition+directionRandomizer*randoms3;\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat yPos=(randoms2.x-0.5)*height;\nfloat angle=randoms2.y*PI*2.;\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\nfloat xPos=positionRadius*cos(angle);\nfloat zPos=positionRadius*sin(angle);\nnewPosition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#else\n\nangle=angle+((randoms3.x-0.5)*PI);\nnewDirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));\nnewDirection=normalize(newDirection);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nfloat s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.0001;\n#else\nfloat h=randoms2.y*height.y;\n\nh=1.-h*h;\n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\nlRadius=lRadius*h;\nfloat randX=lRadius*sin(s);\nfloat randZ=lRadius*cos(s);\nfloat randY=h*height.x;\nnewPosition=vec3(randX,randY,randZ);\n\nif (abs(cos(coneAngle)) == 1.0) {\nnewDirection=vec3(0.,1.0,0.);\n} else {\nvec3 randoms3=getRandomVec3(seed.z);\nnewDirection=normalize(newPosition+directionRandomizer*randoms3);\n}\n#elif defined(CUSTOMEMITTER)\nnewPosition=initialPosition;\noutInitialPosition=initialPosition;\n#else\n\nnewPosition=vec3(0.,0.,0.);\n\nnewDirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\n#ifdef LOCAL\noutPosition=newPosition;\n#else\noutPosition=(emitterWM*vec4(newPosition,1.)).xyz;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#ifndef BILLBOARD\noutInitialDirection=direction;\n#endif\n#else\n#ifdef LOCAL\nvec3 initial=newDirection;\n#else\nvec3 initial=(emitterWM*vec4(newDirection,0.)).xyz;\n#endif\noutDirection=initial*power;\n#ifndef BILLBOARD\noutInitialDirection=initial;\n#endif\n#endif\n#ifdef ANIMATESHEET\noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif\n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {\nfloat directionScale=timeDelta;\noutAge=newAge;\nfloat ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#if defined(CUSTOMEMITTER)\noutPosition=position+(direction-position)*ageGradient;\noutInitialPosition=initialPosition;\n#else\noutPosition=position+direction*directionScale;\n#endif\noutLife=life;\noutSeed=seed;\n#ifndef COLORGRADIENTS\noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\noutSize.yz=size.yz;\n#else\noutSize=size;\n#endif\n#ifndef BILLBOARD\noutInitialDirection=initialDirection;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#else\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)
1).r;\nfloat currentVelocity=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*limitVelocityDamping;\n}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\noutDirection=outDirection+force*timeDelta;\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\noutAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET\nfloat offsetAge=outAge;\nfloat dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;\noffsetAge+=cellStartOffset;\n#else\nfloat cellStartOffset=0.;\n#endif\nfloat ratio=clamp(mod(cellStartOffset+cellInfos.z*offsetAge,life)/life,0.,1.0);\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}\n}";u.a.IncludesShadersStore.clipPlaneFragmentDeclaration2="#ifdef CLIPPLANE\nin float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nin float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nin float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nin float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nin float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nin float fClipDistance6;\n#endif",i(159),i(74),i(160),i(161);u.a.ShadersStore.gpuRenderParticlesPixelShader="#version 300 es\nuniform sampler2D diffuseSampler;\nin vec2 vUV;\nin vec4 vColor;\nout vec4 outFragColor;\n#include<clipPlaneFragmentDeclaration2>\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\nvoid main() {\n#include<clipPlaneFragment>\nvec4 textureColor=texture(diffuseSampler,vUV);\noutFragColor=textureColor*vColor;\n#ifdef BLENDMULTIPLYMODE\nfloat alpha=vColor.a*textureColor.a;\noutFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\noutFragColor=applyImageProcessing(outFragColor);\n#endif\n#endif\n}\n";u.a.IncludesShadersStore.clipPlaneVertexDeclaration2="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nout float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nout float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nout float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nout float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nout float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nout float fClipDistance6;\n#endif",i(162);u.a.ShadersStore.gpuRenderParticlesVertexShader="#version 300 es\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\nuniform vec3 worldOffset;\n#ifdef LOCAL\nuniform mat4 emitterWM;\n#endif\n\nin vec3 position;\nin float age;\nin float life;\nin vec3 size;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef BILLBOARDSTRETCHED\nin vec3 direction;\n#endif\nin float angle;\n#ifdef ANIMATESHEET\nin float cellIndex;\n#endif\nin vec2 offset;\nin vec2 uv;\nout vec2 vUV;\nout vec4 vColor;\nout vec3 vPositionW;\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration2>\n#ifdef COLORGRADIENTS\nuniform sampler2D colorGradientSampler;\n#else\nuniform vec4 colorDead;\nin vec4 color;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 sheetInfos;\n#endif\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\n#ifdef LOCAL\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\n#else\nreturn (position+worldOffset)+alignedCorner;\n#endif\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;\n#ifdef LOCAL\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\n#else\nreturn (position+worldOffset)+alignedCorner;\n#endif\n}\n#endif\nvoid main() {\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/sheetInfos.z);
1\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\nvec2 uvScale=sheetInfos.xy;\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=uv;\n#endif\nfloat ratio=age/life;\n#ifdef COLORGRADIENTS\nvColor=texture(colorGradientSampler,vec2(ratio,0));\n#else\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\n#endif\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\n#ifdef BILLBOARD\nvec4 rotatedCorner;\nrotatedCorner.w=0.;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=(position+worldOffset)-eyePosition;\nyaxis.y=0.;\nvPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=(position+worldOffset)-eyePosition;\nvPositionW=rotateAlign(toCamera,rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\n#else\n\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\n#ifdef LOCAL\nvec4 viewPosition=view*vec4(((emitterWM*vec4(position,1.0)).xyz+worldOffset),1.0)+rotatedCorner;\n#else\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\n#endif\nvPositionW=(invView*viewPosition).xyz;\n#endif\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=0.;\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nvec3 yaxis=normalize(initialDirection);\nvPositionW=rotate(yaxis,rotatedCorner);\n\nvec4 viewPosition=view*vec4(vPositionW,1.0);\n#endif\ngl_Position=projection*viewPosition;\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n}";var S,o=(S=n.a,Object(h.d)(A,S),Object.defineProperty(A,"IsSupported",{get:function(){return!!T.a.LastCreatedEngine&&1<T.a.LastCreatedEngine.webGLVersion},enumerable:!1,configurable:!0}),A.prototype.getCapacity=function(){return this._capacity},Object.defineProperty(A.prototype,"activeParticleCount",{get:function(){return this._activeCount},set:function(e){this._activeCount=Math.min(e,this._capacity)},enumerable:!1,configurable:!0}),A.prototype.isReady=function(){return this._updateEffect?!!(this.emitter&&this._updateEffect.isReady()&&this._imageProcessingConfiguration.isReady()&&this._getEffect().isReady()&&this.particleTexture&&this.particleTexture.isReady()):(this._recreateUpdateEffect(),this._recreateRenderEffect(),!1)},A.prototype.isStarted=function(){return this._started},A.prototype.isStopped=function(){return this._stopped},A.prototype.isStopping=function(){return!1},A.prototype.getActiveCount=function(){return this._currentActiveCount},A.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&&0<this.animations.length&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},A.prototype.stop=function(){this._stopped=!0},A.prototype.reset=function(){this._releaseBuffers(),this._releaseVAOs(),this._currentActiveCount=0,this._targetIndex=0},A.prototype.getClassName=function(){return"GPUParticleSystem"},A.prototype.getCustomEffect=function(e){var t;return void 0===e&&(e=0),null!==(t=this._customEffect[e])&&void 0!==t?t:this._customEffect[0]},A.prototype.setCustomEffect=function(e,t){void 0===t&&(t=0),this._customEffect[t]=e},Object.defineProperty(A.prototype,"onBeforeDrawParticlesObservable",{get:function(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new d.c),this._onBeforeDrawParticlesObservable}
1,enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"vertexShaderName",{get:function(){return"gpuRenderParticles"},enumerable:!1,configurable:!0}),A.prototype._removeGradientAndTexture=function(e,t,i){return S.prototype._removeGradientAndTexture.call(this,e,t,i),this._releaseBuffers(),this},A.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new a.b(e,t);return this._colorGradients.push(n),this._refreshColorGradient(!0),this._releaseBuffers(),this},A.prototype._refreshColorGradient=function(e){void 0===e&&(e=!1),this._colorGradients&&(e&&this._colorGradients.sort(function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0}),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null))},A.prototype.forceRefreshGradients=function(){this._refreshColorGradient(),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture"),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture"),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture"),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture"),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture"),this.reset()},A.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},A.prototype._addFactorGradient=function(e,t,i){var n=new a.c(t,i);e.push(n),this._releaseBuffers()},A.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture",!0),this._releaseBuffers(),this},A.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},A.prototype._refreshFactorGradient=function(e,t,i){void 0===i&&(i=!1),e&&(i&&e.sort(function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0}),this[t]&&(this[t].dispose(),this[t]=null))},A.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture",!0),this._releaseBuffers(),this},A.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},A.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture",!0),this._releaseBuffers(),this},A.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},A.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture",!0),this._releaseBuffers(),this},A.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},A.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture",!0),this._releaseBuffers(),this},A.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},A.prototype.addEmitRateGradient=function(e,t,i){return this},A.prototype.removeEmitRateGradient=function(e){return this},A.prototype.addStartSizeGradient=function(e,t,i){return this},A.prototype.removeStartSizeGradient=function(e){return this},A.prototype.addColorRemapGradient=function(e,t,i){return this},A.prototype.removeColorRemapGradient=function(){return this}
1,A.prototype.addAlphaRemapGradient=function(e,t,i){return this},A.prototype.removeAlphaRemapGradient=function(){return this},A.prototype.addRampGradient=function(e,t){return this},A.prototype.removeRampGradient=function(){return this},A.prototype.getRampGradients=function(){return null},Object.defineProperty(A.prototype,"useRampGradients",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),A.prototype.addLifeTimeGradient=function(e,t,i){return this},A.prototype.removeLifeTimeGradient=function(e){return this},A.prototype._reset=function(){this._releaseBuffers()},A.prototype._createUpdateVAO=function(e){var t={};t.position=e.createVertexBuffer("position",0,3);var i=3;this.particleEmitterType instanceof E.a&&(t.initialPosition=e.createVertexBuffer("initialPosition",i,3),i+=3),t.age=e.createVertexBuffer("age",i,1),i+=1,t.life=e.createVertexBuffer("life",i,1),i+=1,t.seed=e.createVertexBuffer("seed",i,4),i+=4,t.size=e.createVertexBuffer("size",i,3),i+=3,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},A.prototype._createRenderVAO=function(e,t){var i={};i.position=e.createVertexBuffer("position",0,3,this._attributesStrideSize,!0);var n=3;this.particleEmitterType instanceof E.a&&(n+=3),i.age=e.createVertexBuffer("age",n,1,this._attributesStrideSize,!0),n+=1,i.life=e.createVertexBuffer("life",n,1,this._attributesStrideSize,!0),n+=5,i.size=e.createVertexBuffer("size",n,3,this._attributesStrideSize,!0),n+=3,this._colorGradientsTexture||(i.color=e.createVertexBuffer("color",n,4,this._attributesStrideSize,!0),n+=4),this.billboardMode===f.a.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._getEffect());return this._engine.bindArrayBuffer(null),r},A.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.particleEmitterType instanceof E.a&&(this._attributesStrideSize+=3),this.isBillboardBased||(this._attributesStrideSize+=3),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&--this._attributesStrideSize,this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6);for(var n=this.particleEmitterType instanceof E.a,r=p.c.Vector3[0],o=0;o<this._capacity;o++)i.push(0),i.push(0),i.push(0),n&&(this.particleEmitterType.particlePositionGenerator(o,null,r),i.push(r.x),i.push(r.y),i.push(r.z)),i.push(0),i.push(0),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(0),i.push(0),i.push(0),this._colorGradientsTexture||(i.push(0),i.push(0),i.push(0),i.push(0)),n?(this.particleEmitterType.particleDestinationGenerator(o,null,r),i.push(r.x),i.push(r.y),i.push(r.z)):(i.push(0),i.push(0),i.push(0)),this.isBillboardBased||(i.push(0),i.push(0),i.push(0)),i.push(0),this._angularSpeedGradientsTexture||i.push(0),this._isAnimationSheetEnabled&&(i.push(0),this.spriteRandomStartCell&&i.push(0)),this.noiseTexture&&(i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()));var a=new Float32Array([.5,.5,1,1,-.5,.5,0,1,-.5,-.5,0,0,.5,-.5,1,0]);this._buffer0=new l.a(t,i,!1,this._attributesStrideSize),this._buffer1=new l.a(t,i,!1,this._attributesStrideSize),this._spriteBuffer=new l.a(t,a,!1,4),this._updateVAO=[],this._updateVAO.push(this._createUpdateVAO(this._buffer0)),this._updateVAO.push(this._createUpdateVAO(this._buffer1)),this._renderVAO=[],this._renderVAO.push(this._createRenderVAO(this._buffer1,this._spriteBuffer)),this._renderVAO.push(this._createRenderVAO(this._buffer0,this._spriteBuffer)),this._sourceBuffer=this._buffer0,this._targetBuffer=this._buffer1}},A.prototype._recreateUpdateEffect=function(){var e=this.particleEmitterType?this.particleEmitterType.getEffectDefines():"";this._isBillboardBased&&(e+="\n#define BILLBOARD"),this._colorGradientsTexture&&(e+="\n#define COLORGRADIENTS"),this._sizeGradientsTexture&&(e+="\n#define SIZEGRADIENTS"),this._angularSpeedGradientsTexture&&(e+="\n#define ANGULARSPEEDGRADIENTS"),this._velocityGradientsTexture&&(e+="\n#define VELOCITYGRADIENTS"),this._limitVelocityGradientsTexture&&(e+="\n#define LIMITVELOCITYGRADIENTS"),this._dragGradientsTexture&&(e+="\n#define DRAGGRADIENTS"),this.isAnimationSheetEnabled&&(e+="\n#define ANIMATESHEET",this.spriteRandomStartCell&&(e+="\n#define ANIMATESHEETRANDOMSTART")),this.noiseTexture&&(e+="\n#define NOISE"),this.isLocal&&(e+="\n#define LOCAL"),this._updateEffect&&this._updateEffectOptions.defines===e||(this._updateEffectOptions.transformFeedbackVaryings=["outPosition"],this.particleEmitterType instanceof E.a&&this._updateEffectOptions.transformFeedbackVaryings.push("outInitialPosition"),this._updateEffectOptions.transformFeedbackVaryings.push("outAge"),this._updateEffectOptions.transformFeedbackVaryings.push("outLife"),this._updateEffectOptions.transformFeedbackVaryings.push("outSeed"),this._updateEffectOptions.transformFeedbackVaryings.push("outSize"),this._colorGradientsTexture||this._updateEffectOptions.transformFeedbackVaryings.push("outColor"),this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"),this._isBillboardBased||this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"),this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"),this.isAnimationSheetEnabled&&(this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"),this.spriteRandomStartCell&&this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")),this.noiseTexture&&(this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"),this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")),this._updateEffectOptions.defines=e,this._updateEffect=new u.a("gpuUpdateParticles",this._updateEffectOptions,this._scene.getEngine()))},A.prototype._getEffect=function(){var e;return null!==(e=this.getCustomEffect())&&void 0!==e?e:this._renderEffect},A.prototype.fillDefines=function(e,t){if(void 0===t&&(t=0),this._scene.clipPlane&&e.push("#define CLIPPLANE"),this._scene.clipPlane2&&e.push("#define CLIPPLANE2"),this._scene.clipPlane3&&e.push("#define CLIPPLANE3"),this._scene.clipPlane4&&e.push("#define CLIPPLANE4"),this._scene.clipPlane5&&e.push("#define CLIPPLANE5"),this._scene.clipPlane6&&e.push("#define CLIPPLANE6"),this.blendMode===f.a.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this.isLocal&&e.push("#define LOCAL"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case f.a.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case f.a.BILLBOARDMODE_STRETCHED:e.push("#define BILLBOARDSTRETCHED");break;case f.a.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._colorGradientsTexture&&e.push("#define COLORGRADIENTS"),this.isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(""+this._imageProcessingConfigurationDefines.toString()))},A.prototype.fillUniformsAttributesAndSamplerNames=function(e,t,i){t.push("position","age","life","size","color","offset","uv","direction","initialDirection","angle","cellIndex"),e.push("emitterWM","worldOffset","view","projection","colorDead","invView","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","sheetInfos","translationPivot","eyePosition"),i.push("diffuseSampler","colorGradientSampler"),this._imageProcessingConfiguration&&(r.a.PrepareUniforms(e,this._imageProcessingConfigurationDefines),r.a.PrepareSamplers(i,this._imageProcessingConfigurationDefines))},A.prototype._recreateRenderEffect=function(){var e=this.getCustomEffect();if(e)return e;var t=[];this.fillDefines(t);var i=t.join("\n");if(this._renderEffect&&this._renderEffect.defines===i)return this._renderEffect;var n=[],r=[],o=[];return this.fillUniformsAttributesAndSamplerNames(r,n,o),this._renderEffect=new u.a("gpuRenderParticles",n,r,o,this._scene.getEngine(),i),this._renderEffect},A.prototype.animate=function(e){void 0===e&&(e=!1),this._timeDelta=this.updateSpeed*(e?this.preWarmStepOffset:this._scene.getAnimationRatio()),this._actualFrame+=this._timeDelta,this._stopped||this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()},A.prototype._createFactorGradientTexture=function(e,t){var i=this[t];if(e&&e.length&&!i){for(var n=new Float32Array(this._rawTextureWidth),r=0;r<this._rawTextureWidth;r++){var o=r/this._rawTextureWidth;a.d.GetCurrentGradient(o,e,function(e,t,i){n[r]=c.a.Lerp(e.factor1,t.factor1,i)})}this[t]=b.a.CreateRTexture(n,this._rawTextureWidth,1,this._scene,!1,!1,v.a.NEAREST_SAMPL
1INGMODE)}},A.prototype._createSizeGradientTexture=function(){this._createFactorGradientTexture(this._sizeGradients,"_sizeGradientsTexture")},A.prototype._createAngularSpeedGradientTexture=function(){this._createFactorGradientTexture(this._angularSpeedGradients,"_angularSpeedGradientsTexture")},A.prototype._createVelocityGradientTexture=function(){this._createFactorGradientTexture(this._velocityGradients,"_velocityGradientsTexture")},A.prototype._createLimitVelocityGradientTexture=function(){this._createFactorGradientTexture(this._limitVelocityGradients,"_limitVelocityGradientsTexture")},A.prototype._createDragGradientTexture=function(){this._createFactorGradientTexture(this._dragGradients,"_dragGradientsTexture")},A.prototype._createColorGradientTexture=function(){if(this._colorGradients&&this._colorGradients.length&&!this._colorGradientsTexture){for(var n=new Uint8Array(4*this._rawTextureWidth),r=s.c.Color4[0],o=0;o<this._rawTextureWidth;o++){var e=o/this._rawTextureWidth;a.d.GetCurrentGradient(e,this._colorGradients,function(e,t,i){s.b.LerpToRef(e.color1,t.color1,i,r),n[4*o]=255*r.r,n[4*o+1]=255*r.g,n[4*o+2]=255*r.b,n[4*o+3]=255*r.a})}this._colorGradientsTexture=b.a.CreateRGBATexture(n,this._rawTextureWidth,1,this._scene,!1,!1,v.a.NEAREST_SAMPLINGMODE)}},A.prototype.render=function(e){if(void 0===e&&(e=!1),!this._started)return 0;if(this._createColorGradientTexture(),this._createSizeGradientTexture(),this._createAngularSpeedGradientTexture(),this._createVelocityGradientTexture(),this._createLimitVelocityGradientTexture(),this._createDragGradientTexture(),this._recreateUpdateEffect(),this._recreateRenderEffect(),!this.isReady())return 0;if(!e){if(!this._preWarmDone&&this.preWarmCycles){for(var t=0;t<this.preWarmCycles;t++)this.animate(!0),this.render(!0);this._preWarmDone=!0}if(this._currentRenderId===this._scene.getFrameId())return 0;this._currentRenderId=this._scene.getFrameId()}var i,n,r;if(this._initialize(),this._accumulatedCount+=this.emitRate*this._timeDelta,1<this._accumulatedCount&&(i=0|this._accumulatedCount,this._accumulatedCount-=i,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+i)),!this._currentActiveCount)return 0;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)),r=this.emitter.position?this.emitter.getWorldMatrix():(n=this.emitter,p.a.Translation(n.x,n.y,n.z)),this.isLocal||this._updateEffect.setMatr
1ix("emitterWM",r),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(_.a.PointListDrawMode,0,this._currentActiveCount),this._engine.endTransformFeedback(),this._engine.setRasterizerState(!0),this._engine.bindTransformFeedbackBuffer(null),!e){var o=this._getEffect();this._engine.enableEffect(o);var a,s,c=this._scene.getViewMatrix();o.setMatrix("view",c),o.setMatrix("projection",this._scene.getProjectionMatrix()),o.setTexture("diffuseSampler",this.particleTexture),o.setVector2("translationPivot",this.translationPivot),o.setVector3("worldOffset",this.worldOffset),this.isLocal&&o.setMatrix("emitterWM",r),this._colorGradientsTexture?o.setTexture("colorGradientSampler",this._colorGradientsTexture):o.setDirectColor4("colorDead",this.colorDead),this._isAnimationSheetEnabled&&this.particleTexture&&(a=this.particleTexture.getBaseSize(),o.setFloat3("sheetInfos",this.spriteCellWidth/a.width,this.spriteCellHeight/a.height,a.width/this.spriteCellWidth)),this._isBillboardBased&&(s=this._scene.activeCamera,o.setVector3("eyePosition",s.globalPosition));var l,u=o.defines;switch((this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4||this._scene.clipPlane5||this._scene.clipPlane6)&&g.a.BindClipPlane(o,this._scene),0<=u.indexOf("#define BILLBOARDMODE_ALL")&&((l=c.clone()).invert(),o.setMatrix("invView",l)),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(o),this.blendMode){case f.a.BLENDMODE_ADD:this._engine.setAlphaMode(y.a.ALPHA_ADD);break;case f.a.BLENDMODE_ONEONE:this._engine.setAlphaMode(y.a.ALPHA_ONEONE);break;case f.a.BLENDMODE_STANDARD:this._engine.setAlphaMode(y.a.ALPHA_COMBINE);break;case f.a.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(y.a.ALPHA_MULTIPLY)}this.forceDepthWrite&&this._engine.setDepthWrite(!0),this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex],null),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(o),this._engine.drawArraysType(_.a.TriangleFanDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(y.a.ALPHA_DISABLE)}this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);var h=this._sourceBuffer;return this._sourceBuffer=this._targetBuffer,this._targetBuffer=h,this._currentActiveCount},A.prototype.rebuild=function(){this._initialize(!0)},A.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)},A.prototype._releaseVAOs=function(){if(this._updateVAO){for(var e=0;e<this._updateVAO.length;e++)this._engine.releaseVertexArrayObject(this._updateVAO[e]);for(this._updateVAO=[],e=0;e<this._renderVAO.length;e++)this._engine.releaseVertexArrayObject(this._renderVAO[e]);this._renderVAO=[]}},A.prototype.dispose=function(e){void 0===e&&(e=!0);var t=this._scene.particleSystems.indexOf(this);-1<t&&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()},A.prototype.clone=function(e,t){var i=this.serialize(),n=A.Parse(i,this._scene,""),r=Object(h.a)({},this._customEffect);return n.name=e,n._customEffect=r,void 0===t&&(t=this.emitter),n.emitter=t,n.noiseTexture=this.noiseTexture,n},A.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};return f.a._Serialize(t,this,e),t.activeParticleCount=this.activeParticleCount,t.randomTextureSize=this._randomTextureSize,t},A.Parse=function(e,t,i,n){void 0===n&&(n=!1);var r=new A(e.name,{capacity:e.capacity,randomTextureSize:e.randomTextureSize},t);return e.activeParticleCount&&(r.activeParticleCount=e.activeParticleCount),f.a._Parse(e,r,t,i),e.preventAutoStart&&(r.preventAutoStart=e.preventAutoStart),n||r.preventAutoStart||r.start(),r},A);function A(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null);var o=S.call(this,e)||this;o.layerMask=268435455,o._accumulatedCount=0,o._targetIndex=0,o._currentRenderId=-1,o._started=!1,o._stopped=!1,o._timeDelta=0,o._actualFrame=0,o._rawTextureWidth=256,o.onDisposeObservable=new d.c,o.forceDepthWrite=!1,o._preWarmDone=!1,o.isLocal=!1,o._onBeforeDrawParticlesObservable=null,o._scene=i||T.a.LastCreatedScene,o.uniqueId=o._scene.getUniqueId(),o._customEffect={0:r},o._attachImageProcessingConfiguration(null),o._engine=o._scene.getEngine(),t.randomTextureSize||delete t.randomTextureSize;var a=Object(h.a)({capacity:5e4,randomTextureSize:o._engine.getCaps().maxTextureSize},t),s=t;isFinite(s)&&(a.capacity=s),o._capacity=a.capacity,o._activeCount=a.capacity,o._currentActiveCount=0,o._isAnimationSheetEnabled=n,o._scene.particleSystems.push(o),o._updateEffectOptions={attributes:["position","initialPosition","age","life","seed","size","color","direction","initialDirection","angle","cellIndex","cellStartOffset","noiseCoordinates1","noiseCoordinates2"],uniformsNames:["currentCount","timeDelta","emitterWM","lifeTime","color1","color2","sizeRange","scaleRange","gravity","emitPower","direction1","direction2","minEmitBox","maxEmitBox","radius","directionRandomizer","height","coneAngle","stopFactor","angleRange","radiusRange","cellInfos","noiseStrength","limitVelocityDamping"],uniformBuffersNames:[],samplers:["randomSampler","randomSampler2","sizeGradientSampler","angularSpeedGradientSampler","velocityGradientSampler","limitVelocityGradientSampler","noiseSampler","dragGradientSampler"],defines:"",fallbacks:null,onCompiled:null,onError:null,indexParameters:null,maxSimultaneousLights:0,transformFeedbackVaryings:[]},o.particleEmitterType=new m.a;for(var c=Math.min(o._engine.getCaps().maxTextureSize,a.randomTextureSize),l=[],u=0;u<c;++u)l.push(Math.random()),l.push(Math.random()),l.push(Math.random()),l.push(Math.random());for(o._randomTexture=new b.a(new Float32Array(l),c,1,y.a.TEXTUREFORMAT_RGBA,o._scene,!1,!1,y.a.TEXTURE_NEAREST_SAMPL
1INGMODE,y.a.TEXTURETYPE_FLOAT),o._randomTexture.wrapU=v.a.WRAP_ADDRESSMODE,o._randomTexture.wrapV=v.a.WRAP_ADDRESSMODE,l=[],u=0;u<c;++u)l.push(Math.random()),l.push(Math.random()),l.push(Math.random()),l.push(Math.random());return o._randomTexture2=new b.a(new Float32Array(l),c,1,y.a.TEXTUREFORMAT_RGBA,o._scene,!1,!1,y.a.TEXTURE_NEAREST_SAMPLINGMODE,y.a.TEXTURETYPE_FLOAT),o._randomTexture2.wrapU=v.a.WRAP_ADDRESSMODE,o._randomTexture2.wrapV=v.a.WRAP_ADDRESSMODE,o._randomTextureSize=c,o}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var r=i(8),h=i(16);h.a.CreatePlane=function(e){var t=[],i=[],n=[],r=[],o=e.width||e.size||1,a=e.height||e.size||1,s=0===e.sideOrientation?0:e.sideOrientation||h.a.DEFAULTSIDE,c=o/2,l=a/2;i.push(-c,-l,0),n.push(0,0,-1),r.push(0,0),i.push(c,-l,0),n.push(0,0,-1),r.push(1,0),i.push(c,l,0),n.push(0,0,-1),r.push(1,1),i.push(-c,l,0),n.push(0,0,-1),r.push(0,1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),h.a._ComputeSides(s,i,t,n,r,e.frontUVs,e.backUVs);var u=new h.a;return u.indices=t,u.positions=i,u.normals=n,u.uvs=r,u},r.a.CreatePlane=function(e,t,i,n,r){var o={size:t,width:t,height:t,sideOrientation:r,updatable:n};return a.CreatePlane(e,o,i)};var a=(n.CreatePlane=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,h.a.CreatePlane(t).applyToMesh(n,t.updatable),t.sourcePlane&&(n.translate(t.sourcePlane.normal,-t.sourcePlane.d),n.setDirection(t.sourcePlane.normal.scale(-1))),n},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var a=i(7),n=(i(304),Object.defineProperty(o.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!1,configurable:!0}),o.prototype.isDynamic=function(){return void 0!==this._dynamic},o.prototype.getData=function(){return this._bufferData},o.prototype.getBuffer=function(){return this._buffer},o.prototype._fillAlignment=function(e){var t=e<=2?e:4;if(this._uniformLocationPointer%t!=0){var i=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var n=this._uniformLocationPointer-i,r=0;r<n;r++)this._data.push(0)}},o.prototype.addUniform=function(e,t){if(!this._noUBO&&void 0===this._uniformLocations[e]){var i;if(t instanceof Array)t=(i=t).length;else{t=t,i=[];for(var n=0;n<t;n++)i.push(0)}for(this._fillAlignment(t),this._uniformSizes[e]=t,this._uniformLocations[e]=this._uniformLocationPointer,this._uniformLocationPointer+=t,n=0;n<t;n++)this._data.push(i[n]);this._needSync=!0}},o.prototype.addMatrix=function(e,t){this.addUniform(e,Array.prototype.slice.call(t.toArray()))},o.prototype.addFloat2=function(e,t,i){var n=[t,i];this.addUniform(e,n)},o.prototype.addFloat3=function(e,t,i,n){var r=[t,i,n];this.addUniform(e,r)},o.prototype.addColor3=function(e,t){var i=new Array;t.toArray(i),this.addUniform(e,i)},o.prototype.addColor4=function(e,t,i){var n=new Array;t.toArray(n),n.push(i),this.addUniform(e,n)},o.prototype.addVector3=function(e,t){var i=new Array;t.toArray(i),this.addUniform(e,i)},o.prototype.addMatrix3x3=function(e){this.addUniform(e,12)},o.prototype.addMatrix2x2=function(e){this.addUniform(e,8)},o.prototype.create=function(){this._noUBO||this._buffer||(this._fillAlignment(4),this._bufferData=new Float32Array(this._data),this._rebuild(),this._needSync=!0)},o.prototype._rebuild=function(){!this._noUBO&&this._bufferData&&(this._dynamic?this._buffer=this._engine.createDynamicUniformBuffer(this._bufferData):this._buffer=this._engine.createUniformBuffer(this._bufferData))},o.prototype.update=function(){this._buffer?(this._dynamic||this._needSync)&&(this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._needSync=!1):this.create()},o.prototype.updateUniform=function(e,t,i){var n=this._uniformLocations[e];if(void 0===n){if(this._buffer)return void a.a.Error("Cannot add an uniform after UBO has been created.");this.addUniform(e,i),n=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(o=0;o<i;o++)this._bufferData[n+o]=t[o];else{for(var r=!1,o=0;o<i;o++)16!==i&&this._bufferData[n+o]===t[o]||(r=!0,this._bufferData[n+o]=t[o]);this._needSync=this._needSync||r}},o.prototype._cacheMatrix=function(e,t){var i=this._valueCache[e],n=t.updateFlag;return(void 0===i||i!==n)&&(this._valueCache[e]=n,!0)},o.prototype._updateMatrix3x3ForUniform=function(e,t){for(var i=0;i<3;i++)o._tempBuffer[4*i]=t[3*i],o._tempBuffer[4*i+1]=t[3*i+1],o._tempBuffer[4*i+2]=t[3*i+2],o._tempBuffer[4*i+3]=0;this.updateUniform(e,o._tempBuffer,12)}
1,o.prototype._updateMatrix3x3ForEffect=function(e,t){this._currentEffect.setMatrix3x3(e,t)},o.prototype._updateMatrix2x2ForEffect=function(e,t){this._currentEffect.setMatrix2x2(e,t)},o.prototype._updateMatrix2x2ForUniform=function(e,t){for(var i=0;i<2;i++)o._tempBuffer[4*i]=t[2*i],o._tempBuffer[4*i+1]=t[2*i+1],o._tempBuffer[4*i+2]=0,o._tempBuffer[4*i+3]=0;this.updateUniform(e,o._tempBuffer,8)},o.prototype._updateFloatForEffect=function(e,t){this._currentEffect.setFloat(e,t)},o.prototype._updateFloatForUniform=function(e,t){o._tempBuffer[0]=t,this.updateUniform(e,o._tempBuffer,1)},o.prototype._updateFloat2ForEffect=function(e,t,i,n){void 0===n&&(n=""),this._currentEffect.setFloat2(e+n,t,i)},o.prototype._updateFloat2ForUniform=function(e,t,i){o._tempBuffer[0]=t,o._tempBuffer[1]=i,this.updateUniform(e,o._tempBuffer,2)},o.prototype._updateFloat3ForEffect=function(e,t,i,n,r){void 0===r&&(r=""),this._currentEffect.setFloat3(e+r,t,i,n)},o.prototype._updateFloat3ForUniform=function(e,t,i,n){o._tempBuffer[0]=t,o._tempBuffer[1]=i,o._tempBuffer[2]=n,this.updateUniform(e,o._tempBuffer,3)},o.prototype._updateFloat4ForEffect=function(e,t,i,n,r,o){void 0===o&&(o=""),this._currentEffect.setFloat4(e+o,t,i,n,r)},o.prototype._updateFloat4ForUniform=function(e,t,i,n,r){o._tempBuffer[0]=t,o._tempBuffer[1]=i,o._tempBuffer[2]=n,o._tempBuffer[3]=r,this.updateUniform(e,o._tempBuffer,4)},o.prototype._updateMatrixForEffect=function(e,t){this._currentEffect.setMatrix(e,t)},o.prototype._updateMatrixForUniform=function(e,t){this._cacheMatrix(e,t)&&this.updateUniform(e,t.toArray(),16)},o.prototype._updateVector3ForEffect=function(e,t){this._currentEffect.setVector3(e,t)},o.prototype._updateVector3ForUniform=function(e,t){t.toArray(o._tempBuffer),this.updateUniform(e,o._tempBuffer,3)},o.prototype._updateVector4ForEffect=function(e,t){this._currentEffect.setVector4(e,t)},o.prototype._updateVector4ForUniform=function(e,t){t.toArray(o._tempBuffer),this.updateUniform(e,o._tempBuffer,4)},o.prototype._updateColor3ForEffect=function(e,t,i){void 0===i&&(i=""),this._currentEffect.setColor3(e+i,t)},o.prototype._updateColor3ForUniform=function(e,t){t.toArray(o._tempBuffer),this.updateUniform(e,o._tempBuffer,3)},o.prototype._updateColor4ForEffect=function(e,t,i,n){void 0===n&&(n=""),this._currentEffect.setColor4(e+n,t,i)},o.prototype._updateColor4ForUniform=function(e,t,i){t.toArray(o._tempBuffer),o._tempBuffer[3]=i,this.updateUniform(e,o._tempBuffer,4)},o.prototype.setTexture=function(e,t){this._currentEffect.setTexture(e,t)},o.prototype.updateUniformDirectly=function(e,t){this.updateUniform(e,t,t.length),this.update()},o.prototype.bindToEffect=function(e,t){this._currentEffect=e,!this._noUBO&&this._buffer&&(this._alreadyBound=!0,e.bindUniformBuffer(this._buffer,t))},o.prototype.dispose=function(){var e,t;this._noUBO||(-1!==(t=(e=this._engine._uniformBuffers).indexOf(this))&&(e[t]=e[e.length-1],e.pop()),this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null))},o._MAX_UNIFORM_SIZE=256,o._tempBuffer=new Float32Array(o._MAX_UNIFORM_SIZE),o);function o(e,t,i){this._alreadyBound=!1,this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers,this._dynamic=i,this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformLocationPointer=0,this._needSync=!1,this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform)}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n,r=i(1),o=i(37),a=i(255),s=i(256),c=i(257),l=(n=o.b,Object(r.d)(u,n),u.prototype.addKeyboard=function(){return this.add(new a.a),this},u.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new s.a(e),this.add(this._mouseInput)),this},u.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},u.prototype.addTouch=function(){return this.add(new c.a),this},u.prototype.clear=function(){n.prototype.clear.call(this),this._mouseInput=null},u);function u(e){var t=n.call(this,e)||this;return t._mouseInput=null,t}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(1),r=i(3),o=i(0),a=i(10),s=i(30),c=i(63);s.a.AddNodeConstructor("Light_Type_3",function(e,t){return function(){return new u(e,o.e.Zero(),t)}});var l,u=(l=c.a,Object(n.d)(h,l),h.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},h.prototype.getClassName=function(){return"HemisphericLight"},h.prototype.setDirectionToTarget=function(e){return this.direction=o.e.Normalize(e.subtract(o.e.Zero())),this.direction},h.prototype.getShadowGenerator=function(){return null},h.prototype.transferToEffect=function(e,t){var i=o.e.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this},h.prototype.transferToNodeMaterialEffect=function(e,t){var i=o.e.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this},h.prototype.computeWorldMatrix=function(){return this._worldMatrix||(this._worldMatrix=o.a.Identity()),this._worldMatrix},h.prototype.getTypeID=function(){return c.a.LIGHTTYPEID_HEMISPHERICLIGHT},h.prototype.prepareLightSpecificDefines=function(e,t){e["HEMILIGHT"+t]=!0},Object(n.c)([Object(r.e)()],h.prototype,"groundColor",void 0),Object(n.c)([Object(r.o)()],h.prototype,"direction",void 0),h);function h(e,t,i){var n=l.call(this,e,i)||this;return n.groundColor=new a.a(0,0,0),n.direction=t||o.e.Up(),n}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n,r=i(1),o=i(0),a=(n=i(29).a,Object(r.d)(s,n),s.prototype.getEffect=function(){return this._activeEffect},s.prototype.isReady=function(e,t){return!!e&&(!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},s.prototype._isReadyForSubMesh=function(e){var t=e._materialDefines;return!(this.checkReadyOnEveryCall||!e.effect||!t||t._renderId!==this.getScene().getRenderId())},s.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatr
1ix("world",e)},s.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},s.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},s.prototype._afterBind=function(e,t){void 0===t&&(t=null),n.prototype._afterBind.call(this,e),this.getScene()._cachedEffect=t},s.prototype._mustRebind=function(e,t,i){return void 0===i&&(i=1),e.isCachedMaterialInvalid(this,t,i)},s);function s(e,t){var i=n.call(this,e,t)||this;return i._normalMatrix=new o.a,i._storeEffectOnSubMeshes=!0,i}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var C=i(0),r=i(8),P=i(16);P.a.CreateTorus=function(e){for(var t=[],i=[],n=[],r=[],o=e.diameter||1,a=e.thickness||.5,s=e.tessellation||16,c=0===e.sideOrientation?0:e.sideOrientation||P.a.DEFAULTSIDE,l=s+1,u=0;u<=s;u++)for(var h=u/s,d=u*Math.PI*2/s-Math.PI/2,p=C.a.Translation(o/2,0,0).multiply(C.a.RotationY(d)),f=0;f<=s;f++){var m=1-f/s,_=f*Math.PI*2/s+Math.PI,g=Math.cos(_),v=Math.sin(_),b=(T=new C.e(g,v,0)).scale(a/2),y=new C.d(h,m),b=C.e.TransformCoordinates(b,p),T=C.e.TransformNormal(T,p);i.push(b.x,b.y,b.z),n.push(T.x,T.y,T.z),r.push(y.x,y.y);var E=(u+1)%l,S=(f+1)%l;t.push(u*l+f),t.push(u*l+S),t.push(E*l+f),t.push(u*l+S),t.push(E*l+S),t.push(E*l+f)}P.a._ComputeSides(c,i,t,n,r,e.frontUVs,e.backUVs);var A=new P.a;return A.indices=t,A.positions=i,A.normals=n,A.uvs=r,A},r.a.CreateTorus=function(e,t,i,n,r,o,a){var s={diameter:t,thickness:i,tessellation:n,sideOrientation:a,updatable:o};return c.CreateTorus(e,s,r)};var c=(n.CreateTorus=function(e,t,i){var n=new r.a(e,i);return t.sideOrientation=r.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,P.a.CreateTorus(t).applyToMesh(n,t.updatable),n},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var a,o=i(1),l=i(3),u=i(0),b=i(4),h=i(9),y=i(15),n=i(29),r=i(11),d=i(10),T=i(84),p=i(55),f=i(12),E={effect:null,subMesh:null},s=(a=n.a,Object(o.d)(m,a),Object.defineProperty(m.prototype,"shaderPath",{get:function(){return this._shaderPath},set:function(e){this._shaderPath=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),m.prototype.getClassName=function(){return"ShaderMaterial"},m.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},m.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},m.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},m.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},m.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},m.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},m.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},m.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},m.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},m.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},m.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},m.prototype.setColor4Array=function(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce(function(e,t){return t.toArray(e,e.length),e},[]),this},m.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},m.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},m.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this}
1,m.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},m.prototype.setMatrices=function(e,t){this._checkUniform(e);for(var i=new Float32Array(16*t.length),n=0;n<t.length;n++)t[n].copyToArray(i,16*n);return this._matrixArrays[e]=i,this},m.prototype.setMatrix3x3=function(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this},m.prototype.setMatrix2x2=function(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this},m.prototype.setArray2=function(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this},m.prototype.setArray3=function(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this},m.prototype.setArray4=function(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this},m.prototype._checkCache=function(e,t){return!e||!this._effect||-1!==this._effect.defines.indexOf("#define INSTANCES")===t},m.prototype.isReadyForSubMesh=function(e,t,i){return this.isReady(e,i)},m.prototype.isReady=function(e,t){var i,n;if(this._effect&&this.isFrozen&&this._effect._wasPreviouslyReady)return!0;var r=this.getScene(),o=r.getEngine();if(!this.checkReadyOnEveryCall&&this._renderId===r.getRenderId()&&this._checkCache(e,t))return!0;var a=[],s=[],c=new T.a;o.getCaps().multiview&&r.activeCamera&&r.activeCamera.outputRenderTarget&&1<r.activeCamera.outputRenderTarget.getViewCount()&&(this._multiview=!0,a.push("#define MULTIVIEW"),-1!==this._options.uniforms.indexOf("viewProjection")&&-1===this._options.uniforms.push("viewProjectionR")&&this._options.uniforms.push("viewProjectionR"));for(var l=0;l<this._options.defines.length;l++)a.push(this._options.defines[l]);for(l=0;l<this._options.attributes.length;l++)s.push(this._options.attributes[l]);e&&e.isVerticesDataPresent(b.b.ColorKind)&&(s.push(b.b.ColorKind),a.push("#define VERTEXCOLOR")),t&&(a.push("#define INSTANCES"),y.a.PushAttributesForInstances(s),null!=e&&e.hasThinInstances&&a.push("#define THIN_INSTANCES"));var u,h=0;for(var d in e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton?(s.push(b.b.MatricesIndicesKind),s.push(b.b.MatricesWeightsKind),4<e.numBoneInfluencers&&(s.push(b.b.MatricesIndicesExtraKind),s.push(b.b.MatricesWeightsExtraKind)),u=e.skeleton,h=e.numBoneInfluencers,a.push("#define NUM_BONE_INFLUENCERS "+h),c.addCPUSkinningFallback(0,e),u.isUsingTextureForMatrices?(a.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")):(a.push("#define BonesPerMesh "+(u.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))):a.push("#define NUM_BONE_INFLUENCERS 0"),this._textures)if(!this._textures[d].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&a.push("#define ALPHATEST");var p=this._shaderPath,f=this._options.uniforms,m=this._options.uniformBuffers,_=this._options.samplers;this.customShaderNameResolve&&(f=f.slice(),m=m.slice(),_=_.slice(),p=this.customShaderNameResolve(p,f,m,_,a,s));var g=this._effect,v=a.join("\n");return this._cachedDefines!==v&&(this._cachedDefines=v,this._effect=o.createEffect(p,{attributes:s,uniformsNames:f,uniformBuffersNames:m,samplers:_,defines:v,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:h}},o),this._onEffectCreatedObservable&&(E.effect=this._effect,this._onEffectCreatedObservable.notifyObservers(E))),null!==(n=!(null!==(i=this._effect)&&void 0!==i&&i.isReady()))&&!n&&(g!==this._effect&&r.resetCachedMaterial(),this._renderId=r.getRenderId(),this._effect._wasPreviouslyReady=!0)},m.prototype.bindOnlyWorldMatrix=function(e,t){var i=this.getScene(),n=null!=t?t:this._effect;n&&(-1!==this._options.uniforms.indexOf("world")&&n.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),n.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),n.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))},m.prototype.bindForSubMesh=function(e,t,i){this.bind(e,t,i._effectOverride)},m.prototype.bind=function(e,t,i){this.bindOnlyWorldMatrix(e,i);var n,r=null!=i?i:this._effect;
1if(r&&this.getScene().getCachedMaterial()!==this){for(n in-1!==this._options.uniforms.indexOf("view")&&r.setMatrix("view",this.getScene().getViewMatrix()),-1!==this._options.uniforms.indexOf("projection")&&r.setMatrix("projection",this.getScene().getProjectionMatrix()),-1!==this._options.uniforms.indexOf("viewProjection")&&(r.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._multiview&&r.setMatrix("viewProjectionR",this.getScene()._transformMatrixR)),this.getScene().activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&r.setVector3("cameraPosition",this.getScene().activeCamera.globalPosition),y.a.BindBonesParameters(t,r),this._textures)r.setTexture(n,this._textures[n]);for(n in this._textureArrays)r.setTextureArray(n,this._textureArrays[n]);for(n in this._ints)r.setInt(n,this._ints[n]);for(n in this._floats)r.setFloat(n,this._floats[n]);for(n in this._floatsArrays)r.setArray(n,this._floatsArrays[n]);for(n in this._colors3)r.setColor3(n,this._colors3[n]);for(n in this._colors3Arrays)r.setArray3(n,this._colors3Arrays[n]);for(n in this._colors4){var o=this._colors4[n];r.setFloat4(n,o.r,o.g,o.b,o.a)}for(n in this._colors4Arrays)r.setArray4(n,this._colors4Arrays[n]);for(n in this._vectors2)r.setVector2(n,this._vectors2[n]);for(n in this._vectors3)r.setVector3(n,this._vectors3[n]);for(n in this._vectors4)r.setVector4(n,this._vectors4[n]);for(n in this._matrices)r.setMatrix(n,this._matrices[n]);for(n in this._matrixArrays)r.setMatrices(n,this._matrixArrays[n]);for(n in this._matrices3x3)r.setMatrix3x3(n,this._matrices3x3[n]);for(n in this._matrices2x2)r.setMatrix2x2(n,this._matrices2x2[n]);for(n in this._vectors2Arrays)r.setArray2(n,this._vectors2Arrays[n]);for(n in this._vectors3Arrays)r.setArray3(n,this._vectors3Arrays[n]);for(n in this._vectors4Arrays)r.setArray4(n,this._vectors4Arrays[n])}var a=this._effect;this._effect=r,this._afterBind(t),this._effect=a},m.prototype._afterBind=function(e){a.prototype._afterBind.call(this,e),this.getScene()._cachedEffect=this._effect},m.prototype.getActiveTextures=function(){var e=a.prototype.getActiveTextures.call(this);for(var t in this._textures)e.push(this._textures[t]);for(var t in this._textureArrays)for(var i=this._textureArrays[t],n=0;n<i.length;n++)e.push(i[n]);return e},m.prototype.hasTexture=function(e){if(a.prototype.hasTexture.call(this,e))return!0;for(var t in this._textures)if(this._textures[t]===e)return!0;for(var t in this._textureArrays)for(var i=this._textureArrays[t],n=0;n<i.length;n++)if(i[n]===e)return!0;return!1},m.prototype.clone=function(e){var i=this,t=l.a.Clone(function(){return new m(e,i.getScene(),i._shaderPath,i._options)},this);for(var n in t.name=e,t.id=e,"object"==typeof t._shaderPath&&(t._shaderPath=Object(o.a)({},t._shaderPath)),this._options=Object(o.a)({},this._options),Object.keys(this._options).forEach(function(e){var t=i._options[e];Array.isArray(t)&&(i._options[e]=t.slice(0))}),this._textures)t.setTexture(n,this._textures[n]);for(var n in this._floats)t.setFloat(n,this._floats[n]);for(var n in this._floatsArrays)t.setFloats(n,this._floatsArrays[n]);for(var n in this._colors3)t.setColor3(n,this._colors3[n]);for(var n in this._colors4)t.setColor4(n,this._colors4[n]);for(var n in this._vectors2)t.setVector2(n,this._vectors2[n]);for(var n in this._vectors3)t.setVector3(n,this._vectors3[n]);for(var n in this._vectors4)t.setVector4(n,this._vectors4[n]);for(var n in this._matrices)t.setMatrix(n,this._matrices[n]);for(var n in this._matrices3x3)t.setMatrix3x3(n,this._matrices3x3[n]);for(var n in this._matrices2x2)t.setMatrix2x2(n,this._matrices2x2[n]);return t},m.prototype.dispose=function(e,t,i){if(t){var n;for(n in this._textures)this._textures[n].dispose();for(n in this._textureArrays)for(var r=this._textureArrays[n],o=0;o<r.length;o++)r[o].dispose()}this._textures={},a.prototype.dispose.call(this,e,t,i)},m.prototype.serialize=function(){var e,t=l.a.Serialize(this);for(e in t.customType="BABYLON.ShaderMaterial",t.options=this._options,t.shaderPath=this._shaderPath,t.textures={},this._textures)t.textures[e]=this._textures[e].serialize();for(e in t.textureArrays={},this._textureArrays){t.textureArrays[e]=[];for(var i=this._textureArrays[e],n=0;n<i.length;n++)t.textureArrays[e].push(i[n].serialize())}for(e in t.floats={},this._floats)t.floats[e]=this._floats[e];for(e in t.FloatArrays={},this._floatsArrays)t.FloatArrays[e]=this._floatsArrays[e];for(e in t.colors3={},this._colors3)t.colors3[e]=this._colors3[e].asArray();for(e in t.colors3Arrays={},this._colors3Arrays)t.colors3Arrays[e]=this._colors3Arrays[e];for(e in t.colors4={},this._colors4)t.colors4[e]=this._colors4[e].asArray();for(e in t.colors4Arrays={},this._colors4Arrays)t.colors4Arrays[e]=this._colors4Arrays[e];for(e in t.vectors2={},this._vectors2)t.vectors2[e]=this._vectors2[e].asArray();for(e in t.vectors3={},this._vectors3)t.vectors3[e]=this._vectors3[e].asArray();for(e in t.vectors4={},this._vectors4)t.vectors4[e]=this._vectors4[e].asArray();for(e in t.matrices={},this._matrices)t.matrices[e]=this._matrices[e].asArray();for(e in t.matrixArray={},this._matrixArrays)t.matrixArray[e]=this._matrixArrays[e];for(e in t.matrices3x3={},this._matrices3x3)t.matrices3x3[e]=this._matrices3x3[e];for(e in t.matrices2x2={},this._matrices2x2)t.matrices2x2[e]=this._matrices2x2[e];for(e in t.vectors2Arrays={},this._vectors2Arrays)t.vectors2Arrays[e]=this._vectors2Arrays[e];for(e in t.vectors3Arrays={},this._vectors3Arrays)t.vectors3Arrays[e]=this._vectors3Arrays[e];for(e in t.vectors4Arrays={},this._vectors4Arrays)t.vectors4Arrays[e]=this._vectors4Arrays[e];return t},m.Parse=function(e,t,i){var n,r=l.a.Parse(function(){return new m(e.name,t,e.shaderPath,e.options)},e,t,i);for(n in e.textures)r.setTexture(n,h.a.Parse(e.textures[n],t,i));for(n in e.textureArrays){for(var o=e.textureArrays[n],a=new Array,s=0;s<o.length;s++)a.push(h.a.Parse(o[s],t,i));r.setTextureArray(n,a)}for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.floatsArrays)r.setFloats(n,e.floatsArrays[n]);for(n in e.colors3)r.setColor3(n,d.a.FromArray(e.colors3[n]));for(n in e.colors3Arrays){var c=e.colors3Arrays[n].reduce(function(e,t,i){return i%3==0?e.push([t]):e[e.length-1].push(t),e},[]).map(function(e){return d.a.FromArray(e)});r.setColor3Array(n,c)}for(n in e.colors4)r.setColor4(n,d.b.FromArray(e.colors4[n]));for(n in e.colors4Arrays)c=e.colors4Arrays[n].reduce(function(e,t,i){return i%4==0?e.push([t]):e[e.length-1].push(t),e},[]).map(function(e){return d.b.FromArray(e)}),r.setColor4Array(n,c);for(n in e.vectors2)r.setVector2(n,u.d.FromArray(e.vectors2[n]));for(n in e.vectors3)r.setVector3(n,u.e.FromArray(e.vectors3[n]));for(n in e.vectors4)r.setVector4(n,u.f.FromArray(e.vectors4[n]));
1for(n in e.matrices)r.setMatrix(n,u.a.FromArray(e.matrices[n]));for(n in e.matrixArray)r._matrixArrays[n]=new Float32Array(e.matrixArray[n]);for(n in e.matrices3x3)r.setMatrix3x3(n,e.matrices3x3[n]);for(n in e.matrices2x2)r.setMatrix2x2(n,e.matrices2x2[n]);for(n in e.vectors2Arrays)r.setArray2(n,e.vectors2Arrays[n]);for(n in e.vectors3Arrays)r.setArray3(n,e.vectors3Arrays[n]);for(n in e.vectors4Arrays)r.setArray4(n,e.vectors4Arrays[n]);return r},m.ParseFromFileAsync=function(o,e,a,s){var c=this;return void 0===s&&(s=""),new Promise(function(i,n){var r=new p.a;r.addEventListener("readystatechange",function(){var e,t;4==r.readyState&&(200==r.status?(e=JSON.parse(r.responseText),t=c.Parse(e,a||f.a.LastCreatedScene,s),o&&(t.name=o),i(t)):n("Unable to load the ShaderMaterial"))}),r.open("GET",e),r.send()})},m.CreateFromSnippetAsync=function(a,s,c){var l=this;return void 0===c&&(c=""),new Promise(function(n,r){var o=new p.a;o.addEventListener("readystatechange",function(){var e,t,i;4==o.readyState&&(200==o.status?(e=JSON.parse(JSON.parse(o.responseText).jsonPayload),t=JSON.parse(e.shaderMaterial),(i=l.Parse(t,s||f.a.LastCreatedScene,c)).snippetId=a,n(i)):r("Unable to load the snippet "+a))}),o.open("GET",l.SnippetUrl+"/"+a.replace(/#/g,"/")),o.send()})},m.SnippetUrl="https://snippet.babylonjs.com",m);function m(e,t,i,n){void 0===n&&(n={});var r=a.call(this,e,t)||this;return r._textures={},r._textureArrays={},r._floats={},r._ints={},r._floatsArrays={},r._colors3={},r._colors3Arrays={},r._colors4={},r._colors4Arrays={},r._vectors2={},r._vectors3={},r._vectors4={},r._matrices={},r._matrixArrays={},r._matrices3x3={},r._matrices2x2={},r._vectors2Arrays={},r._vectors3Arrays={},r._vectors4Arrays={},r._cachedWorldViewMatrix=new u.a,r._cachedWorldViewProjectionMatrix=new u.a,r._multiview=!1,r._shaderPath=i,r._options=Object(o.a)({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},n),r}r.a.RegisteredTypes["BABYLON.ShaderMaterial"]=s},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n,r=i(1),o=(n=i(123).a,Object(r.d)(a,n),Object.defineProperty(a.prototype,"underlyingResource",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),a);function a(e){var t=n.call(this)||this;return t._buffer=e,t}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"underlyingResource",{get:function(){return null},enumerable:!1,configurable:!0}),r);function r(){this.references=0,this.capacity=0,this.is32Bits=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(80),r=(o.GetPlanes=function(e){for(var t=[],i=0;i<6;i++)t.push(new n.a(0,0,0,0));return o.GetPlanesToRef(e,t),t},o.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()},o.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()},o.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()},o.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()},o.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()},o.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()},o.GetPlanesToRef=function(e,t){o.GetNearPlaneToRef(e,t[0]),o.GetFarPlaneToRef(e,t[1]),o.GetLeftPlaneToRef(e,t[2]),o.GetRightPlaneToRef(e,t[3]),o.GetTopPlaneToRef(e,t[4]),o.GetBottomPlaneToRef(e,t[5])},o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var r=i(6),n=(Object.defineProperty(o.prototype,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"changes",{get:function(){return this._changes}
1,enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"hasChanges",{get:function(){return this._hasChanges},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"pressed",{get:function(){return this._pressed},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"touched",{get:function(){return this._touched},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"value",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),o.prototype.dispose=function(){this.onAxisValueChangedObservable.clear(),this.onButtonStateChangedObservable.clear()},o.prototype.isAxes=function(){return 0!==this._axesIndices.length},o.prototype.isButton=function(){return-1!==this._buttonIndex},o.prototype.update=function(e){var t=!1,i=!1;if(this._hasChanges=!1,this._changes={},this.isButton()){var n=e.buttons[this._buttonIndex];if(!n)return;this._currentValue!==n.value&&(this.changes.value={current:n.value,previous:this._currentValue},t=!0,this._currentValue=n.value),this._touched!==n.touched&&(this.changes.touched={current:n.touched,previous:this._touched},t=!0,this._touched=n.touched),this._pressed!==n.pressed&&(this.changes.pressed={current:n.pressed,previous:this._pressed},t=!0,this._pressed=n.pressed)}this.isAxes()&&(this._axes.x!==e.axes[this._axesIndices[0]]&&(this.changes.axes={current:{x:e.axes[this._axesIndices[0]],y:this._axes.y},previous:{x:this._axes.x,y:this._axes.y}},this._axes.x=e.axes[this._axesIndices[0]],i=!0),this._axes.y!==e.axes[this._axesIndices[1]]&&(this.changes.axes?this.changes.axes.current.y=e.axes[this._axesIndices[1]]:this.changes.axes={current:{x:this._axes.x,y:e.axes[this._axesIndices[1]]},previous:{x:this._axes.x,y:this._axes.y}},this._axes.y=e.axes[this._axesIndices[1]],i=!0)),t&&(this._hasChanges=!0,this.onButtonStateChangedObservable.notifyObservers(this)),i&&(this._hasChanges=!0,this.onAxisValueChangedObservable.notifyObservers(this._axes))},o.BUTTON_TYPE="button",o.SQUEEZE_TYPE="squeeze",o.THUMBSTICK_TYPE="thumbstick",o.TOUCHPAD_TYPE="touchpad",o.TRIGGER_TYPE="trigger",o);function o(e,t,i,n){void 0===i&&(i=-1),void 0===n&&(n=[]),this.id=e,this.type=t,this._buttonIndex=i,this._axesIndices=n,this._axes={x:0,y:0},this._changes={},this._currentValue=0,this._hasChanges=!1,this._pressed=!1,this._touched=!1,this.onAxisValueChangedObservable=new r.c,this.onButtonStateChangedObservable=new r.c}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(0),r=i(21),o=(a.DefaultPluginFactory=function(){throw r.a.WarnImport("CannonJSPlugin")},a.prototype.setGravity=function(e){this.gravity=e,this._physicsPlugin.setGravity(this.gravity)},a.prototype.setTimeStep=function(e){void 0===e&&(e=1/60),this._physicsPlugin.setTimeStep(e)},a.prototype.getTimeStep=function(){return this._physicsPlugin.getTimeStep()},a.prototype.setSubTimeStep=function(e){void 0===e&&(e=0),this._subTimeStep=e},a.prototype.getSubTimeStep=function(){return this._subTimeStep},a.prototype.dispose=function(){this._impostors.forEach(function(e){e.dispose()}),this._physicsPlugin.dispose()},a.prototype.getPhysicsPluginName=function(){return this._physicsPlugin.name},a.prototype.addImpostor=function(e){e.uniqueId=this._impostors.push(e),e.parent||this._physicsPlugin.generatePhysicsBody(e)},a.prototype.removeImpostor=function(e){var t=this._impostors.indexOf(e);-1<t&&this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e)},a.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)},a.prototype.removeJoint=function(t,i,n){var e=this._joints.filter(function(e){return e.connectedImpostor===i&&e.joint===n&&e.mainImpostor===t});e.length&&this._physicsPlugin.removeJoint(e[0])},a.prototype._step=function(e){var t=this;this._impostors.forEach(function(e){e.isBodyInitRequired()&&t._physicsPlugin.generatePhysicsBody(e)}),.1<e?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},a.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},a.prototype.getImpostors=function(){return this._impostors},a.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t<this._impostors.length;++t)if(this._impostors[t].object===e)return this._impostors[t];return null},a.prototype.getImpostorWithPhysicsBody=function(e){for(var t=0;t<this._impostors.length;++t)if(this._impostors[t].physicsBody===e)return this._impostors[t];return null},a.prototype.raycast=function(e,t){return this._physicsPlugin.raycast(e,t)},a.Epsilon=.001,a);function a(e,t){if(void 0===t&&(t=a.DefaultPluginFactory()),this._physicsPlugin=t,this._impostors=[],this._joints=[],this._subTimeStep=0,!this._physicsPlugin.isSupported())throw new Error("Physics Engine "+this._physicsPlugin.name+" cannot be found. Please make sure it is included.");e=e||new n.e(0,-9.807,0),this.setGravity(e),this.setTimeStep()}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var d=i(0),u=i(4),n=i(2),r=i(9),s=i(187),p=i(15),c=i(10),f=i(35),m=i(169),o=i(21),a=i(5);a.a.IncludesShadersStore.mrtFragmentDeclaration="#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n",i(221),i(222),i(223);a.a.ShadersStore.geometryPixelShader="#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\nprecision highp int;\n#ifdef BUMP\nvarying mat4 vWorldView;\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef REFLECTIVITY\nvarying vec2 vReflectivityUV;\nuniform sampler2D reflectivitySampler;\n#endif\n#ifdef ALPHATEST\nuniform sampler2D diffuseSampler;\n#endif\n#include<mrtFragmentDeclaration>[RENDER_TARGET_COUNT]\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\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\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include<bumpFragment>\ngl_FragData[1]=vec4(normalize(vec3(vWorldView*vec4(normalW,0.0))),1.0
1);\n#else\ngl_FragData[1]=vec4(normalize(vNormalV),1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,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#ifdef REFLECTIVITY\n#ifdef HAS_SPECULAR\n\nvec4 reflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#elif HAS_REFLECTIVITY\n\nvec4 reflectivity=vec4(texture2D(reflectivitySampler,vReflectivityUV).rgb,1.0);\n#else\nvec4 reflectivity=vec4(0.0,0.0,0.0,1.0);\n#endif\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n}",i(107),i(131),i(132),i(108),i(145),i(109),i(110),i(310);a.a.ShadersStore.geometryVertexShader="precision highp float;\nprecision highp int;\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<instancesDeclaration>\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef NEED_UV\nvarying vec2 vUV;\n#ifdef ALPHATEST\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef BUMP\nuniform mat4 bumpMatrix;\nvarying vec2 vBumpUV;\n#endif\n#ifdef REFLECTIVITY\nuniform mat4 reflectivityMatrix;\nvarying vec2 vReflectivityUV;\n#endif\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;\n#ifdef BUMP\nvarying mat4 vWorldView;\n#endif\n#ifdef BUMP\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\n#ifdef BONES_VELOCITY_ENABLED\n#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#include<bonesVertex>\nvec4 pos=vec4(finalWorld*vec4(positionUpdated,1.0));\n#ifdef BUMP\nvWorldView=view*finalWorld;\nvNormalW=normalUpdated;\n#else\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\n#endif\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvPositionW=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,
11.0);\n#ifdef NEED_UV\n#ifdef UV1\n#ifdef ALPHATEST\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#else\nvUV=uv;\n#endif\n#ifdef BUMP\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef UV2\n#ifdef ALPHATEST\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#else\nvUV=uv2;\n#endif\n#ifdef BUMP\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#endif\n#include<bumpVertex>\n}\n";var l=(Object.defineProperty(h.prototype,"renderList",{set:function(e){this._multiRenderTarget.renderList=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isSupported",{get:function(){return this._multiRenderTarget.isSupported},enumerable:!1,configurable:!0}),h.prototype.getTextureIndex=function(e){switch(e){case h.POSITION_TEXTURE_TYPE:return this._positionIndex;case h.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;case h.REFLECTIVITY_TEXTURE_TYPE:return this._reflectivityIndex;default:return-1}},Object.defineProperty(h.prototype,"enablePosition",{get:function(){return this._enablePosition},set:function(e){this._enablePosition=e,this.dispose(),this._createRenderTargets()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"enableVelocity",{get:function(){return this._enableVelocity},set:function(e){(this._enableVelocity=e)||(this._previousTransformationMatrices={}),this.dispose(),this._createRenderTargets()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"enableReflectivity",{get:function(){return this._enableReflectivity},set:function(e){this._enableReflectivity=e,this.dispose(),this._createRenderTargets()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"ratio",{get:function(){return this._ratio},enumerable:!1,configurable:!0}),h.prototype.isReady=function(e,t){var i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;var n,r=[],o=[u.b.PositionKind,u.b.NormalKind],a=e.getMesh();i&&(n=!1,i.needAlphaTesting()&&(r.push("#define ALPHATEST"),n=!0),i.bumpTexture&&f.a.BumpTextureEnabled&&(r.push("#define BUMP"),r.push("#define BUMPDIRECTUV 0"),n=!0),this._enableReflectivity&&(i instanceof f.a&&i.specularTexture?(r.push("#define HAS_SPECULAR"),n=!0):i instanceof m.a&&i.reflectivityTexture&&(r.push("#define HAS_REFLECTIVITY"),n=!0)),n&&(r.push("#define NEED_UV"),a.isVerticesDataPresent(u.b.UVKind)&&(o.push(u.b.UVKind),r.push("#define UV1")),a.isVerticesDataPresent(u.b.UV2Kind)&&(o.push(u.b.UV2Kind),r.push("#define UV2")))),this._enablePosition&&(r.push("#define POSITION"),r.push("#define POSITION_INDEX "+this._positionIndex)),this._enableVelocity&&(r.push("#define VELOCITY"),r.push("#define VELOCITY_INDEX "+this._velocityIndex),-1===this.excludedSkinnedMeshesFromVelocity.indexOf(a)&&r.push("#define BONES_VELOCITY_ENABLED")),this._enableReflectivity&&(r.push("#define REFLECTIVITY"),r.push("#define REFLECTIVITY_INDEX "+this._reflectivityIndex)),a.useBones&&a.computeBonesUsingShaders?(o.push(u.b.MatricesIndicesKind),o.push(u.b.MatricesWeightsKind),4<a.numBoneInfluencers&&(o.push(u.b.MatricesIndicesExtraKind),o.push(u.b.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+a.numBoneInfluencers),r.push("#define BonesPerMesh "+(a.skeleton?a.skeleton.bones.length+1:0))):r.push("#define NUM_BONE_INFLUENCERS 0");var s=a.morphTargetManager,c=0;s&&0<s.numInfluencers&&(c=s.numInfluencers,r.push("#define MORPHTARGETS"),r.push("#define NUM_MORPH_INFLUENCERS "+c),p.a.PrepareAttributesForMorphTargetsInfluencers(o,a,c)),t&&(r.push("#define INSTANCES"),p.a.PushAttributesForInstances(o),e.getRenderingMesh().hasThinInstances&&r.push("#define THIN_INSTANCES")),r.push("#define RENDER_TARGET_COUNT "+this._multiRenderTarget.textures.length);var l=r.join("\n");return this._cachedDefines!==l&&(this._cachedDefines=l,this._effect=this._scene.getEngine().createEffect("geometry",o,["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones","morphTargetInfluences","bumpMatrix","reflectivityMatrix","vTangentSpaceParams","vBumpInfos"],["diffuseSampler","bumpSampler","reflectivitySampler"],l,void 0,void 0,void 0,{buffersCount:this._multiRenderTarget.textures.length-1,maxSimultaneousMorphTargets:c})),this._effect.isReady()},h.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(h.prototype,"samples",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e}
1,enumerable:!1,configurable:!0}),h.prototype.dispose=function(){this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.getGBuffer().dispose()},h.prototype._createRenderTargets=function(){var o,h=this,a=this._scene.getEngine(),e=2;this._enablePosition&&(this._positionIndex=e,e++),this._enableVelocity&&(this._velocityIndex=e,e++),this._enableReflectivity&&(this._reflectivityIndex=e,e++),this._multiRenderTarget=new s.a("gBuffer",{width:a.getRenderWidth()*this._ratio,height:a.getRenderHeight()*this._ratio},e,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:n.a.TEXTURETYPE_FLOAT}),this.isSupported&&(this._multiRenderTarget.wrapU=r.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=r.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add(function(e){e.clear(new c.b(0,0,0,1),!0,!0,!0)}),this._resizeObserver=a.onResizeObservable.add(function(){h._multiRenderTarget&&h._multiRenderTarget.resize({width:a.getRenderWidth()*h._ratio,height:a.getRenderHeight()*h._ratio})}),o=function(e){var t,i,n,r,o,a=e.getRenderingMesh(),s=e.getEffectiveMesh(),c=h._scene,l=c.getEngine(),u=e.getMaterial();u&&(s._internalAbstractMeshDataInfo._isActiveIntermediate=!1,h._enableVelocity&&!h._previousTransformationMatrices[s.uniqueId]&&(h._previousTransformationMatrices[s.uniqueId]={world:d.a.Identity(),viewProjection:c.getTransformMatrix()},a.skeleton)&&(t=a.skeleton.getTransformMatrices(a),h._previousBonesTransformationMatrices[a.uniqueId]=h._copyBonesTransformationMatrices(t,new Float32Array(t.length))),l.setState(u.backFaceCulling,0,!1,c.useRightHandedSystem),(i=a._getInstancesRenderList(e._id,!!e.getReplacementMesh())).mustReturn||(n=l.getCaps().instancedArrays&&(null!==i.visibleInstances[e._id]||a.hasThinInstances),r=s.getWorldMatrix(),h.isReady(e,n)&&(l.enableEffect(h._effect),a._bind(e,h._effect,u.fillMode),h._effect.setMatrix("viewProjection",c.getTransformMatrix()),h._effect.setMatrix("view",c.getViewMatrix()),u&&(!u.needAlphaTesting()||(o=u.getAlphaTestTexture())&&(h._effect.setTexture("diffuseSampler",o),h._effect.setMatrix("diffuseMatrix",o.getTextureMatrix())),u.bumpTexture&&c.getEngine().getCaps().standardDerivatives&&f.a.BumpTextureEnabled&&(h._effect.setFloat3("vBumpInfos",u.bumpTexture.coordinatesIndex,1/u.bumpTexture.level,u.parallaxScaleBias),h._effect.setMatrix("bumpMatrix",u.bumpTexture.getTextureMatrix()),h._effect.setTexture("bumpSampler",u.bumpTexture),h._effect.setFloat2("vTangentSpaceParams",u.invertNormalMapX?-1:1,u.invertNormalMapY?-1:1)),h._enableReflectivity&&(u instanceof f.a&&u.specularTexture?(h._effect.setMatrix("reflectivityMatrix",u.specularTexture.getTextureMatrix()),h._effect.setTexture("reflectivitySampler",u.specularTexture)):u instanceof m.a&&u.reflectivityTexture&&(h._effect.setMatrix("reflectivityMatrix",u.reflectivityTexture.getTextureMatrix()),h._effect.setTexture("reflectivitySampler",u.reflectivityTexture)))),a.useBones&&a.computeBonesUsingShaders&&a.skeleton&&(h._effect.setMatrices("mBones",a.skeleton.getTransformMatrices(a)),h._enableVelocity&&h._effect.setMatrices("mPreviousBones",h._previousBonesTransformationMatrices[a.uniqueId])),p.a.BindMorphTargetParameters(a,h._effect),h._enableVelocity&&(h._effect.setMatrix("previousWorld",h._previousTransformationMatrices[s.uniqueId].world),h._effect.setMatrix("previousViewProjection",h._previousTransformationMatrices[s.uniqueId].viewProjection)),a._processRendering(s,e,h._effect,u.fillMode,i,n,function(e,t){return h._effect.setMatrix("world",t)})),h._enableVelocity&&(h._previousTransformationMatrices[s.uniqueId].world=r.clone(),h._previousTransformationMatrices[s.uniqueId].viewProjection=h._scene.getTransformMatrix().clone(),a.skeleton&&h._copyBonesTransformationMatrices(a.skeleton.getTransformMatrices(a),h._previousBonesTransformationMatrices[s.uniqueId]))))},this._multiRenderTarget.customRenderFunction=function(e,t,i,n){var r;if(n.length){for(a.setColorWrite(!1),r=0;r<n.length;r++)o(n.data[r]);a.setColorWrite(!0)}for(r=0;r<e.length;r++)o(e.data[r]);for(r=0;r<t.length;r++)o(t.data[r]);if(h.renderTransparentMeshes)for(r=0;r<i.length;r++)o(i.data[r])})},h.prototype._copyBonesTransformationMatrices=function(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t},h.POSITION_TEXTURE_TYPE=1,h.VELOCITY_TEXTURE_TYPE=2,h.REFLECTIVITY_TEXTURE_TYPE=3,h._SceneComponentInitialization=function(e){throw o.a.WarnImport("GeometryBufferRendererSceneComponent")},h);function h(e,t){void 0===t&&(t=1),this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this.renderTransparentMeshes=!0,this._resizeObserver=null,this._enablePosition=!1,this._enableVelocity=!1,this._enableReflectivity=!1,this._positionIndex=-1,this._velocityIndex=-1,this._reflectivityIndex=-1,this._scene=e,this._ratio=t,h._SceneComponentInitialization(this._scene),this._createRenderTargets()}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(2),r=(Object.defineProperty(o,"HasTriggers",{get:function(){for(var e in o.Triggers)if(o.Triggers.hasOwnProperty(e))return!0;return!1}
1,enumerable:!1,configurable:!0}),Object.defineProperty(o,"HasPickTriggers",{get:function(){for(var e in o.Triggers)if(o.Triggers.hasOwnProperty(e)){var t=parseInt(e);if(t>=n.a.ACTION_OnPickTrigger&&t<=n.a.ACTION_OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),o.HasSpecificTrigger=function(e){for(var t in o.Triggers)if(o.Triggers.hasOwnProperty(t)&&parseInt(t)===e)return!0;return!1},o.Triggers={},o);function o(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(1),r=i(29),o=i(3),a=i(19),s=i(15),c=(l.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},l.prototype.isReadyForSubMesh=function(e,t){var i=t.getEngine();return!(e._areTexturesDirty&&t.texturesEnabled&&i.getCaps().standardDerivatives&&this._texture&&a.a.DetailTextureEnabled&&!this._texture.isReady())},l.prototype.prepareDefines=function(e,t){var i;this._isEnabled?(e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod,i=t.getEngine(),e._areTexturesDirty&&(i.getCaps().standardDerivatives&&this._texture&&a.a.DetailTextureEnabled&&this._isEnabled?(s.a.PrepareDefinesForMergedUV(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)):e.DETAIL=!1},l.prototype.bindForSubMesh=function(e,t,i){this._isEnabled&&(e.useUbo&&i&&e.isSync||this._texture&&a.a.DetailTextureEnabled&&(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),s.a.BindTextureMatrix(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&a.a.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture))},l.prototype.hasTexture=function(e){return this._texture===e},l.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},l.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture)},l.prototype.dispose=function(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())},l.prototype.getClassName=function(){return"DetailMap"},l.AddUniforms=function(e){e.push("vDetailInfos")},l.AddSamplers=function(e){e.push("detailSampler")},l.PrepareUniformBuffer=function(e){e.addUniform("vDetailInfos",4),e.addUniform("detailMatrix",16)},l.prototype.copyTo=function(e){o.a.Clone(function(){return e},this)},l.prototype.serialize=function(){return o.a.Serialize(this)},l.prototype.parse=function(e,t,i){var n=this;o.a.Parse(function(){return n},e,t,i)},Object(n.c)([Object(o.m)("detailTexture"),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"texture",void 0),Object(n.c)([Object(o.c)()],l.prototype,"diffuseBlendLevel",void 0),Object(n.c)([Object(o.c)()],l.prototype,"roughnessBlendLevel",void 0),Object(n.c)([Object(o.c)()],l.prototype,"bumpLevel",void 0),Object(n.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"normalBlendMethod",void 0),Object(n.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"isEnabled",void 0),l);function l(e){this._texture=null,this.diffuseBlendLevel=.5,this.roughnessBlendLevel=.5,this.bumpLevel=1,this._normalBlendMethod=r.a.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,this._isEnabled=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}},function(e,t,i){"use strict";var m=i(27),p=i(7),f=i(13),E=i(2),n=i(31);function S(e,t,i,n){for(var r=new(n===E.a.TEXTURETYPE_FLOAT?Float32Array:Uint32Array)(t*i*4),o=0;o<t;o++)for(var a=0;a<i;a++){var s=3*(a*t+o),c=4*(a*t+o);r[0+c]=e[0+s],r[1+c]=e[1+s],r[2+c]=e[2+s],r[3+c]=1}return r}function r(f){return function(e,t,i,n,r,o,a,s,c,l){void 0===c&&(c=null),void 0===l&&(l=E.a.TEXTURETYPE_UNSIGNED_INT);var u=f?this._gl.TEXTURE_3D:this._gl.TEXTURE_2D_ARRAY,h=f?m.b.Raw3D:m.b.Raw2DArray,d=new m.a(this,h);d.baseWidth=t,d.baseHeight=i,d.baseDepth=n,d.width=t,d.height=i,d.depth=n,d.format=r,d.type=l,d.generateMipMaps=o,d.samplingMode=s,f?d.is3D=!0:d.is2DArray=!0,this._doNotHandleContextLost||(d._bufferView=e),f?this.updateRawTexture3D(d,e,r,a,c,l):this.updateRawTexture2DArray(d,e,r,a,c,l),this._bindTextureDirectly(u,d,!0);var p=this._getSamplingParameters(s,o);return this._gl.texParameteri(u,this._gl.TEXTURE_MAG_FILTER,p.mag),this._gl.texParameteri(u,this._gl.TEXTURE_MIN_FILTER,p.min),o&&this._gl.generateMipmap(u),this._bindTextureDirectly(u,null),this._internalTexturesCache.push(d),d}}function o(u){return function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=E.a.TEXTURETYPE_UNSIGNED_INT);var a=u?this._gl.TEXTURE_3D:this._gl.TEXTURE_2D_ARRAY,s=this._getWebGLTextureType(o),c=this._getInternalFormat(i),l=this._getRGBABufferInternalSizedFormat(o,i);this._bindTextureDirectly(a,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(a,0,this.getCaps().s3tc[r],e.width,e.height,e.depth,0,t):this._gl.texImage3D(a,0,l,e.width,e.height,e.depth,0,c,s,t),e.generateMipMaps&&this._gl.generateMipmap(a),this._bindTextureDirectly(a,null),e.isReady=!0}}n.a.prototype.updateRawTexture=function(e,t,i,n,r,o){var a,s,c;void 0===r&&(r=null),void 0===o&&(o=E.a.TEXTURETYPE_UNSIGNED_INT),e&&(a=this._getRGBABufferInternalSizedFormat(o,i),s=this._getInternalFormat(i),c=this._getWebGLTextureType(o),this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===n||!!n),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.type=o,e.invertY=n,e._compression=r),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),r&&t?this._gl.compressedTexImage2D(this._gl.TEXTURE_2D,0,this.getCaps().s3tc[r],e.width,e.height,0,t):this._gl.texImage2D(this._gl.TEXTURE_2D,0,a,e.width,e.height,0,s,c,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0)},n.a.prototype.createRawTexture=function(e,t,i,n,r,o,a,s,c){void 0===s&&(s=null),void 0===c&&(c=E.a.TEXTURETYPE_UNSIGNED_INT);var l=new m.a(this,m.b.Raw);
1l.baseWidth=t,l.baseHeight=i,l.width=t,l.height=i,l.format=n,l.generateMipMaps=r,l.samplingMode=a,l.invertY=o,l._compression=s,l.type=c,this._doNotHandleContextLost||(l._bufferView=e),this.updateRawTexture(l,e,n,o,s,c),this._bindTextureDirectly(this._gl.TEXTURE_2D,l,!0);var u=this._getSamplingParameters(a,r);return this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,u.mag),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,u.min),r&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._internalTexturesCache.push(l),l},n.a.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,s){void 0===s&&(s=null);var c=this._gl,l=new m.a(this,m.b.CubeRaw);l.isCube=!0,l.format=i,l.type=n,this._doNotHandleContextLost||(l._bufferViewArray=e);var u=this._getWebGLTextureType(n);this._getInternalFormat(i)===c.RGB&&c.RGBA,u!==c.FLOAT||this._caps.textureFloatLinearFiltering?u!==this._gl.HALF_FLOAT_OES||this._caps.textureHalfFloatLinearFiltering?u!==c.FLOAT||this._caps.textureFloatRender?u!==c.HALF_FLOAT||this._caps.colorBufferFloat||(r=!1,p.a.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")):(r=!1,p.a.Warn("Render to float textures is not supported. Mipmap generation forced to false.")):(r=!1,a=E.a.TEXTURE_NEAREST_SAMPLINGMODE,p.a.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):(r=!1,a=E.a.TEXTURE_NEAREST_SAMPLINGMODE,p.a.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively."));var h=t;l.width=t,l.height=h,!this.needPOTTextures||f.b.IsExponentOfTwo(l.width)&&f.b.IsExponentOfTwo(l.height)||(r=!1),e&&this.updateRawCubeTexture(l,e,i,n,o,s),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,l,!0),e&&r&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);var d=this._getSamplingParameters(a,r);return c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,d.mag),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,d.min),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),this._bindTextureDirectly(c.TEXTURE_CUBE_MAP,null),l.generateMipMaps=r,l},n.a.prototype.updateRawCubeTexture=function(e,t,i,n,r,o,a){void 0===o&&(o=null),void 0===a&&(a=0),e._bufferViewArray=t,e.format=i,e.type=n,e.invertY=r,e._compression=o;var s=this._gl,c=this._getWebGLTextureType(n),l=this._getInternalFormat(i),u=this._getRGBABufferInternalSizedFormat(n),h=!1;l===s.RGB&&(l=s.RGBA,h=!0),this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,e,!0),this._unpackFlipY(void 0===r||!!r),e.width%4!=0&&s.pixelStorei(s.UNPACK_ALIGNMENT,1);for(var d=0;d<6;d++){var p=t[d];o?s.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,a,this.getCaps().s3tc[o],e.width,e.height,0,p):(h&&(p=S(p,e.width,e.height,n)),s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,a,u,e.width,e.height,0,l,c,p))}(!this.needPOTTextures||f.b.IsExponentOfTwo(e.width)&&f.b.IsExponentOfTwo(e.height))&&e.generateMipMaps&&0===a&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),e.isReady=!0},n.a.prototype.createRawCubeTextureFromUrl=function(e,d,t,p,f,i,m,_,g,n,r,v){var b=this;void 0===g&&(g=null),void 0===n&&(n=null),void 0===r&&(r=E.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===v&&(v=!1);var y=this._gl,T=this.createRawCubeTexture(null,t,p,f,!i,v,r,null);return null==d||d._addPendingData(T),T.url=e,this._internalTexturesCache.push(T),this._loadFile(e,function(h){!function(){var e=T.width,t=m(h);if(t){if(_){var i=b._getWebGLTextureType(f),n=b._getInternalFormat(p),r=b._getRGBABufferInternalSizedFormat(f),o=!1;n===y.RGB&&(n=y.RGBA,o=!0),b._bindTextureDirectly(y.TEXTURE_CUBE_MAP,T,!0),b._unpackFlipY(!1);for(var a=_(t),s=0;s<a.length;s++)for(var c=e>>s,l=0;l<6;l++){var u=a[s][l];o&&(u=S(u,c,c,f)),y.texImage2D(l,s,r,c,c,0,n,i,u)}b._bindTextureDirectly(y.TEXTURE_CUBE_MAP,null)}else b.updateRawCubeTexture(T,t,p,f,v);T.isReady=!0,null==d||d._removePendingData(T),g&&g()}}()},void 0,null==d?void 0:d.offlineProvider,!0,function(e,t){null==d||d._removePendingData(T),n&&e&&n(e.status+" "+e.statusText,t)}),T},n.a.prototype.createRawTexture2DArray=r(!1),n.a.prototype.createRawTexture3D=r(!0),n.a.prototype.updateRawTexture2DArray=o(!1),n.a.prototype.updateRawTexture3D=o(!0)},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.morphTargetsVertexGlobalDeclaration="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.morphTargetsVertexDeclaration="#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};
1\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif"},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var h=i(29),n=i(4),d=i(2),r=(o.prototype._prepareBuffers=function(){var e;this._vertexBuffers[n.b.PositionKind]||((e=[]).push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[n.b.PositionKind]=new n.b(this._scene.getEngine(),e,n.b.PositionKind,!1,!1,2),this._buildIndexBuffer())},o.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},o.prototype._rebuild=function(){var e=this._vertexBuffers[n.b.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())},o.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var i=this._scene.activeCamera;return!(!i||!(t=t||i._postProcesses.filter(function(e){return null!=e}))||0===t.length||!this._scene.postProcessesEnabled||(t[0].activate(i,e,null!=t),0))},o.prototype.directRender=function(e,t,i,n,r,o){void 0===t&&(t=null),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=!1);for(var a=this._scene.getEngine(),s=0;s<e.length;s++){s<e.length-1?e[s+1].activate(this._scene.activeCamera,t):t?a.bindFramebuffer(t,n,void 0,void 0,i,r):o||a.restoreDefaultFramebuffer();var c=e[s],l=c.apply();l&&(c.onBeforeRenderObservable.notifyObservers(l),this._prepareBuffers(),a.bindBuffers(this._vertexBuffers,this._indexBuffer,l),a.drawElementsType(h.a.TriangleFillMode,0,6),c.onAfterRenderObservable.notifyObservers(l))}a.setDepthBuffer(!0),a.setDepthWrite(!0)},o.prototype._finalizeFrame=function(e,t,i,n,r){void 0===r&&(r=!1);var o=this._scene.activeCamera;if(o&&0!==(n=n||o._postProcesses.filter(function(e){return null!=e})).length&&this._scene.postProcessesEnabled){for(var a=this._scene.getEngine(),s=0,c=n.length;s<c;s++){var l=n[s];if(s<c-1?l._outputTexture=n[s+1].activate(o,t):t?(a.bindFramebuffer(t,i,void 0,void 0,r),l._outputTexture=t):(a.restoreDefaultFramebuffer(),l._outputTexture=null),e)break;var u=l.apply();u&&(l.onBeforeRenderObservable.notifyObservers(u),this._prepareBuffers(),a.bindBuffers(this._vertexBuffers,this._indexBuffer,u),a.drawElementsType(h.a.TriangleFillMode,0,6),l.onAfterRenderObservable.notifyObservers(u))}a.setDepthBuffer(!0),a.setDepthWrite(!0),a.setAlphaMode(d.a.ALPHA_DISABLE)}},o.prototype.dispose=function(){var e=this._vertexBuffers[n.b.PositionKind];e&&(e.dispose(),this._vertexBuffers[n.b.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null)},o);function o(e){this._vertexBuffers={},this._scene=e}},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o});var n=i(244),r=function(){},o=(f.prototype._clearDepthStencilBuffer=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this._depthStencilBufferAlreadyCleaned||(this._scene.getEngine().clear(null,!1,e,t),this._depthStencilBufferAlreadyCleaned=!0)},f.prototype.render=function(e,t,i,n){var r=this._renderingGroupInfo;if(r.scene=this._scene,r.camera=this._scene.activeCamera,this._scene.spriteManagers&&n)for(var o=0;o<this._scene.spriteManagers.length;o++){var a=this._scene.spriteManagers[o];this.dispatchSprites(a)}for(o=f.MIN_RENDERINGGROUPS;o<f.MAX_RENDERINGGROUPS;o++){this._depthStencilBufferAlreadyCleaned=o===f.MIN_RENDERINGGROUPS;var s=this._renderingGroups[o];if(s){var c,l=Math.pow(2,o);r.renderingGroupId=o,this._scene.onBeforeRenderingGroupObservable.notifyObservers(r,l),f.AUTOCLEAR&&(c=this._useSceneAutoClearSetup?this._scene.getAutoClearDepthStencilSetup(o):this._autoClearDepthStencil[o])&&c.autoClear&&this._clearDepthStencilBuffer(c.depth,c.stencil);for(var u=0,h=this._scene._beforeRenderingGroupDrawStage;u<h.length;u++)h[u].action(o);s.render(e,n,i,t);for(var d=0,p=this._scene._afterRenderingGroupDrawStage;d<p.length;d++)p[d].action(o);this._scene.onAfterRenderingGroupObservable.notifyObservers(r,l)}}},f.prototype.reset=function(){for(var e=f.MIN_RENDERINGGROUPS;e<f.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.prepare()}},f.prototype.dispose=function(){this.freeRenderingGroups(),this._renderingGroups.length=0,this._renderingGroupInfo=null},f.prototype.freeRenderingGroups=function(){for(var e=f.MIN_RENDERINGGROUPS;e<f.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.dispose()}},f.prototype._prepareRenderingGroup=function(e){void 0===this._renderingGroups[e]&&(this._renderingGroups[e]=new n.a(e,this._scene,this._customOpaqueSortCompareFn[e],this._customAlphaTestSortCompareFn[e],this._customTransparentSortCompareFn[e]))},f.prototype.dispatchSprites=function(e){var t=e.renderingGroupId||0;this._prepareRenderingGroup(t),this._renderingGroups[t].dispatchSprites(e)},f.prototype.dispatchParticles=function(e){var t=e.renderingGroupId||0;this._prepareRenderingGroup(t),this._renderingGroups[t].dispatchParticles(e)},f.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh());var n=t.renderingGroupId||0;this._prepareRenderingGroup(n),this._renderingGroups[n].dispatch(e,t,i)},f.prototype.setRenderingOrder=function(e,t,i,n){var r;void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),this._customOpaqueSortCompareFn[e]=t,this._customAlphaTestSortCompareFn[e]=i,this._customTransparentSortCompareFn[e]=n,this._renderingGroups[e]&&((r=this._renderingGroups[e]).opaqueSortCompareFn=this._customOpaqueSortCompareFn[e],r.alphaTestSortCompareFn=this._customAlphaTestSortCompareFn[e],r.transparentSortCompareFn=this._customTransparentSortCompareFn[e])},f.prototype.setRenderingAutoClearDepthStencil=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!0),this._autoClearDepthStencil[e]={autoClear:t,depth:i,stencil:n}},f.prototype.getAutoClearDepthStencilSetup=function(e){return this._autoClearDepthStencil[e]},f.MAX_RENDERINGGROUPS=4,f.MIN_RENDERINGGROUPS=0,f.AUTOCLEAR=!0,f);function f(e){this._useSceneAutoClearSetup=!1,this._renderingGroups=new Array,this._autoClearDepthStencil={},this._customOpaqueSortCompareFn={},this._customAlphaTestSortCompareFn={},this._customTransparentSortCompareFn={},this._renderingGroupInfo=new r,this._scene=e;for(var t=f.MIN_RENDERINGGROUPS;t<f.MAX_RENDERINGGROUPS;t++)this._autoClearDepthStencil[t]={autoClear:!0,depth:!0,stencil:!0}}},function(e,t,i){"use strict";i.d(t,"a",function(){return d});var P=i(0),x=i(10),r=i(8),R=i(16),_=i(207),n=i(13),g=i(22),O=i(32),v=i(96);R.a.CreateGround=function(e){for(var t,i=[],n=[],r=[],o=[],a=e.width||1,s=e.height||1,c=e.subdivisionsX||e.subdivisions||1,l=e.subdivisionsY||e.subdivisions||1,u=0;u<=l;u++)for(t=0;t<=c;t++){var h=new P.e(t*a/c-a/2,0,(l-u)*s/l-s/2),d=new P.e(0,1,0);n.push(h.x,h.y,h.z),r.push(d.x,d.y,d.z),o.push(t/c,1-u/l)}for(u=0;
1u<l;u++)for(t=0;t<c;t++)i.push(t+1+(u+1)*(c+1)),i.push(t+1+u*(c+1)),i.push(t+u*(c+1)),i.push(t+(u+1)*(c+1)),i.push(t+1+(u+1)*(c+1)),i.push(t+u*(c+1));var p=new R.a;return p.indices=i,p.positions=n,p.normals=r,p.uvs=o,p},R.a.CreateTiledGround=function(e){var l,u,t,i,n=void 0!==e.xmin&&null!==e.xmin?e.xmin:-1,r=void 0!==e.zmin&&null!==e.zmin?e.zmin:-1,o=void 0!==e.xmax&&null!==e.xmax?e.xmax:1,a=void 0!==e.zmax&&null!==e.zmax?e.zmax:1,s=e.subdivisions||{w:1,h:1},h=e.precision||{w:1,h:1},d=new Array,p=new Array,f=new Array,m=new Array;s.h=s.h<1?1:s.h,s.w=s.w<1?1:s.w,h.w=h.w<1?1:h.w,h.h=h.h<1?1:h.h;var c=(o-n)/s.w,_=(a-r)/s.h;function g(e,t,i,n){var r=p.length/3,o=h.w+1;for(l=0;l<h.h;l++)for(u=0;u<h.w;u++){var a=[r+u+l*o,r+(u+1)+l*o,r+(u+1)+(l+1)*o,r+u+(l+1)*o];d.push(a[1]),d.push(a[2]),d.push(a[3]),d.push(a[0]),d.push(a[1]),d.push(a[3])}var s=P.e.Zero(),c=new P.e(0,1,0);for(l=0;l<=h.h;l++)for(s.z=l*(n-t)/h.h+t,u=0;u<=h.w;u++)s.x=u*(i-e)/h.w+e,s.y=0,p.push(s.x,s.y,s.z),f.push(c.x,c.y,c.z),m.push(u/h.w,l/h.h)}for(t=0;t<s.h;t++)for(i=0;i<s.w;i++)g(n+i*c,r+t*_,n+(i+1)*c,r+(t+1)*_);var v=new R.a;return v.indices=d,v.positions=p,v.normals=f,v.uvs=m,v},R.a.CreateGroundFromHeightMap=function(e){var t,i,n,r=[],o=[],a=[],s=[],c=e.colorFilter||new x.a(.3,.59,.11),l=e.alphaFilter||0,u=!1;for(e.minHeight>e.maxHeight&&(u=!0,n=e.maxHeight,e.maxHeight=e.minHeight,e.minHeight=n),t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var h=new P.e(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),d=4*(((h.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(h.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),p=e.buffer[d]/255,f=e.buffer[1+d]/255,m=e.buffer[2+d]/255,_=e.buffer[3+d]/255;u&&(p=1-p,f=1-f,m=1-m);var g=p*c.r+f*c.g+m*c.b;h.y=l<=_?e.minHeight+(e.maxHeight-e.minHeight)*g:e.minHeight-O.a,o.push(h.x,h.y,h.z),a.push(0,0,0),s.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t<e.subdivisions;t++)for(i=0;i<e.subdivisions;i++){var v=i+1+(t+1)*(e.subdivisions+1),b=i+1+t*(e.subdivisions+1),y=i+t*(e.subdivisions+1),T=i+(t+1)*(e.subdivisions+1),E=o[3*v+1]>=e.minHeight,S=o[3*b+1]>=e.minHeight,A=o[3*y+1]>=e.minHeight;E&&S&&A&&(r.push(v),r.push(b),r.push(y)),o[3*T+1]>=e.minHeight&&E&&A&&(r.push(T),r.push(v),r.push(y))}R.a.ComputeNormals(o,r,a);var C=new R.a;return C.indices=r,C.positions=o,C.normals=a,C.uvs=s,C},r.a.CreateGround=function(e,t,i,n,r,o){var a={width:t,height:i,subdivisions:n,updatable:o};return d.CreateGround(e,a,r)},r.a.CreateTiledGround=function(e,t,i,n,r,o,a,s,c){var l={xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:o,precision:a,updatable:c};return d.CreateTiledGround(e,l,s)},r.a.CreateGroundFromHeightMap=function(e,t,i,n,r,o,a,s,c,l,u){var h={width:i,height:n,subdivisions:r,minHeight:o,maxHeight:a,updatable:c,onReady:l,alphaFilter:u};return d.CreateGroundFromHeightMap(e,t,h,s)};var d=(o.CreateGround=function(e,t,i){var n=new _.a(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,R.a.CreateGround(t).applyToMesh(n,t.updatable),n._setReady(!0),n},o.CreateTiledGround=function(e,t,i){void 0===i&&(i=null);var n=new r.a(e,i);return R.a.CreateTiledGround(t).applyToMesh(n,t.updatable),n},o.CreateGroundFromHeightMap=function(e,t,i,o){void 0===o&&(o=null);var a=i.width||10,s=i.height||10,c=i.subdivisions||1,l=i.minHeight||0,u=i.maxHeight||1,h=i.colorFilter||new x.a(.3,.59,.11),d=i.alphaFilter||0,p=i.updatable,f=i.onReady;o=o||g.a.LastCreatedScene;var m=new _.a(e,o);return m._subdivisionsX=c,m._subdivisionsY=c,m._width=a,m._height=s,m._maxX=m._width/2,m._maxZ=m._height/2,m._minX=-m._maxX,m._minZ=-m._maxZ,m._setReady(!1),n.b.LoadImage(t,function(e){var t,i=e.width,n=e.height,r=v.a.CreateCanvas(i,n).getContext("2d");if(!r)throw new Error("Unable to get 2d context for CreateGroundFromHeightMap");o.isDisposed||(r.drawImage(e,0,0),t=r.getImageData(0,0,i,n).data,R.a.CreateGroundFromHeightMap({width:a,height:s,subdivisions:c,minHeight:l,maxHeight:u,colorFilter:h,buffer:t,bufferWidth:i,bufferHeight:n,alphaFilter:d}).applyToMesh(m,p),f&&f(m),m._setReady(!0))},function(){},o.offlineProvider),m},o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var a=i(0),n=i(48),s=i(69),r=i(2),o=i(10),c=(Object.defineProperty(l.prototype,"noiseTexture",{get:function(){return this._noiseTexture},set:function(e){this._noiseTexture!==e&&(this._noiseTexture=e,this._reset())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isAnimationSheetEnabled",{get:function(){return this._isAnimationSheetEnabled},set:function(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())},enumerable:!1,configurable:!0}),l.prototype.getScene=function(){return this._scene},l.prototype._hasTargetStopDurationDependantGradient=function(){return this._startSizeGradients&&0<this._startSizeGradients.length||this._emitRateGradients&&0<this._emitRateGradients.length||this._lifeTimeGradients&&0<this._lifeTimeGradients.length},l.prototype.getDragGradients=function(){return this._dragGradients},l.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},l.prototype.getColorGradients=function(){return this._colorGradients},l.prototype.getSizeGradients=function(){return this._sizeGradients},l.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},l.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},l.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},l.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},l.prototype.getVelocityGradients=function(){return this._velocityGradients},l.prototype.getStartSizeGradients=function(){return this._startSizeGradients},l.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(l.prototype,"direction1",{get:function(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:a.e.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"direction2",{get:function(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:a.e.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"minEmitBox",{get:function(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:a.e.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"maxEmitBox",{get:function(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:a.e.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isBillboardBased",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),l.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration=e||this._scene.imageProcessingConfiguration)},l.prototype._reset=function(){},l.prototype._removeGradientAndTexture=function(e,t,i){if(!t)return this;for(var n=0,r=0,o=t;r<o.length;r++){if(o[r].gradient===e){t.splice(n,1);break}n++}return i&&i.dispose(),this},l.prototype.createPointEmitter=function(e,t){var i=new s.PointParticleEmitter;return i.direction1=e,i.direction2=t,this.particleEmitterType=i},l.prototype.createHemisphericEmitter=function(e,t){void 0===e&&(e=1),void 0===t&&(t=1);var i=new s.HemisphericParticleEmitter(e,t);return this.particleEmitterType=i},l.prototype.createSphereEmitter=function(e,t){void 0===e&&(e=1),void 0===t&&(t=1);var i=new s.SphereParticleEmitter(e,t);return this.particleEmitterType=i},l.prototype.createDirectedSphereEmitter=function(e,t,i){void 0===e&&(e=1),void 0===t&&(t=new a.e(0,1,0)),void 0===i&&(i=new a.e(0,1,0));var n=new s.SphereDirectedParticleEmitter(e,t,i);return this.particleEmitterType=n},l.prototype.createCylinderEmitter=function(e,t,i,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=0);var r=new s.CylinderParticleEmitter(e,t,i,n);return this.particleEmitterType=r},l.prototype.createDirectedCylinderEmitter=function(e,t,i,n,r){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=new a.e(0,1,0)),void 0===r&&(r=new a.e(0,1,0));var o=new s.CylinderDirectedParticleEmitter(e,t,i,n,r);return this.particleEmitterType=o},l.prototype.createConeEmitter=function(e,t){void 0===e&&(e=1),void 0===t&&(t=Math.PI/4);var i=new s.ConeParticleEmitter(e,t);return this.particleEmitterType=i},l.prototype.createBoxEmitter=function(e,t,i,n){var r=new s.BoxParticleEmitter;return this.particleEmitterType=r,this.direction1=e,this.direction2=t,this.minEmitBox=i,this.maxEmitBox=n,r},l.BLENDMODE_ONEONE=0,l.BLENDMODE_STANDARD=1,l.BLENDMODE_ADD=2,l.BLENDMODE_MULTIPLY=3,l.BLENDMODE_MULTIPLYADD=4,l);function l(e){this.animations=[],this.renderingGroupId=0,this.emitter=a.e.Zero(),this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this.noiseStrength=new a.e(10,10,10),this.onAnimationEnd=null,this.blendMode=l.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteRandomStartCell=!1,this.translationPivot=new a.d(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new a.e(0,0,0),this.gravity=a.e.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new o.b(1,1,1,1),this.color2=new o.b(1,1,1,1),this.colorDead=new o.b(0,0,0,1),this.textureMask=new o.b(1,1,1,1),this._isSubEmitter=!1,this.billboardMode=r.a.PARTICLES_BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new n.b,this.id=e,this.name=e}},function(e,t,i){"use strict";i.d(t,"a",function(){return S});var n=i(1),r=i(3),o=i(40),f=i(7),a=i(0),m=i(4),_=i(15),s=i(101),c=i(119),g=i(48),v=i(9),b=i(2),l=i(11),y=i(19),u=i(10),h=i(5);h.a.IncludesShadersStore.backgroundFragmentDeclaration=" uniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;\nuniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroun
1dCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif";h.a.IncludesShadersStore.backgroundUboDeclaration="layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vPrimaryColorShadow;\nuniform vec2 vDiffuseInfos;\nuniform vec2 vReflectionInfos;\nuniform mat4 diffuseMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\nuniform float pointSize;\nuniform float shadowLevel;\nuniform float alpha;\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};",i(220),i(159),i(157),i(158),i(74),i(308),i(219),i(160),i(177),i(201),i(161),i(224),i(225);h.a.ShadersStore.backgroundPixelShader="#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n#define RECIPROCAL_PI2 0.15915494\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include<imageProcessingDeclaration>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<helperFunctions>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<imageProcessingFunctions>\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\n\nfloat shadow=1.;\nfloat globalShadow=0.;\nfloat shadowLightCount=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n#ifndef BACKMAT_SHADOWONLY\n\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\n#ifdef REFLECTION\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nfloat reflectionLOD=vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\n\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nreflectionColor=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nreflectionColor=mix(\nreflectionSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\nreflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor.rgb=reflectionColor.bgr;\n#endif\n\nreflectionColor.rgb*=vReflectionInfos.x;\n#endif\n\nvec3 diffuseColor=vec3(1.,1.,1.);\nfloat finalAlpha=alpha;\n#ifdef DIFFUSE\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\n#endif\n\ndiffuseMap.rgb*=vDiffuseInfos.y;\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 colorBase=diffuseColor;\n#else\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,0.0);\n\n#ifdef USERGBCOLOR\nvec3 finalColor=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\n#else\nvec3 mainColor=vPrimaryColor.rgb;\n#endif\nvec3 finalColor=colorBase*mainColor;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 reflectionAmount=vReflectionControl.xxx;\nvec3 reflectionReflectance0=vReflectionControl.yyy;\nvec3 reflectionReflectance90=vReflectionControl.zzz;\nfloat VdotN=dot(normalize(vEyePosition),normalW);\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\nreflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroun
1dCenter)*vReflectionControl.w);\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\nreflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\n#endif\n#ifdef OPACITYFRESNEL\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));\n\nconst float startAngle=0.1;\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\nfinalAlpha*=fadeFactor*fadeFactor;\n#endif\n\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\n#endif\n\nvec4 color=vec4(finalColor,finalAlpha);\n#else\nvec4 color=vec4(vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*alpha);\n#endif\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#else\n\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#ifdef NOISE\ncolor.rgb+=dither(vPositionW.xy,0.5);\ncolor=max(color,0.0);\n#endif\ngl_FragColor=color;\n}\n";h.a.IncludesShadersStore.backgroundVertexDeclaration="uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif",i(107),i(108),i(179),i(226),i(109),i(110),i(162),i(311),i(227);h.a.ShadersStore.backgroundVertexShader="precision highp float;\n#include<__decl__backgroundVertex>\n#include<helperFunctions>\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\nif (fFovMultiplier<=1.0) {\nvDirectionW=normalize(segment);\n} else {\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\n}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";var d,p,T=i(84),E=(p=s.a,Object(n.d)(C,p),C),S=(d=c.a,Object(n.d)(A,d),Object.defineProperty(A.prototype,"_perceptualColor",{get:function(){return this.__perceptualColor},set:function(e){this.__perceptualColor=e,this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsLightsDirt
1y()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"primaryColorShadowLevel",{get:function(){return this._primaryColorShadowLevel},set:function(e){this._primaryColorShadowLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"primaryColorHighlightLevel",{get:function(){return this._primaryColorHighlightLevel},set:function(e){this._primaryColorHighlightLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"reflectionStandardFresnelWeight",{set:function(e){var t=e;t<.5?(t*=2,this.reflectionReflectance0=A.StandardReflectance0*t,this.reflectionReflectance90=A.StandardReflectance90*t):(t=2*t-1,this.reflectionReflectance0=A.StandardReflectance0+(1-A.StandardReflectance0)*t,this.reflectionReflectance90=A.StandardReflectance90+(1-A.StandardReflectance90)*t)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"fovMultiplier",{get:function(){return this._fovMultiplier},set:function(e){isNaN(e)&&(e=1),this._fovMultiplier=Math.max(0,Math.min(2,e))},enumerable:!1,configurable:!0}),A.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.get
1Scene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){t._computePrimaryColorFromPerceptualColor(),t._markAllSubMeshesAsImageProcessingDirty()})))},Object.defineProperty(A.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"cameraColorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasRenderTargetTextures",{get:function(){return!(!this._diffuseTexture||!this._diffuseTexture.isRenderTarget)||!(!this._reflectionTexture||!this._reflectionTexture.isRenderTarget)},enumerable:!1,configurable:!0}),A.prototype.needAlphaTesting=function(){return!0},A.prototype.needAlphaBlending=function(){return this.alpha<1||null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||this._shadowOnly},A.prototype.isReadyForSubMesh=function(e,t,i){var n=this;if(void 0===i&&(i=!1),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new E);var r=this.getScene(),o=t._materialDefines;if(this._isReadyForSubMesh(t))return!0;var a,s,c,l,u,h,d=r.getEngine();if(_.a.PrepareDefinesForLights(r,e,o,!1,this._maxSimultaneousLights),o._needNormals=!0,_.a.PrepareDefinesForMultiview(r,o),o._areTexturesDirty){if(o._needUVs=!1,r.texturesEnabled){if(r.getEngine().getCaps().textureLOD&&(o.TEXTURELODSUPPORT=!0),this._diffuseTexture&&y.a.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;_.a.PrepareDefinesForMergedUV(this._diffuseTexture,o,"DIFFUSE"),o.DIFFUSEHASALPHA=this._diffuseTexture.hasAlpha,o.GAMMADIFFUSE=this._diffuseTexture.gammaSpace,o.OPACITYFRESNEL=this._opacityFresnel}else o.DIFFUSE=!1,o.DIFFUSEHASALPHA=!1,o.GAMMADIFFUSE=!1,o.OPACITYFRESNEL=!1;var p=this._reflectionTexture;if(p&&y.a.ReflectionTextureEnabled){if(!p.isReadyOrNotBlocking())return!1;switch(o.REFLECTION=!0,o.GAMMAREFLECTION=p.gammaSpace,o.RGBDREFLECTION=p.isRGBD,o.REFLECTIONBLUR=0<this._reflectionBlur,o.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!p.invertZ:p.invertZ,o.LODINREFLECTIONALPHA=p.lodLevelInAlpha,o.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,o.REFLECTIONBGR=this.switchToBGR,p.coordinatesMode===v.a.INVCUBIC_MODE&&(o.INVERTCUBICMAP=!0),o.REFLECTIONMAP_3D=p.isCube,p.coordinatesMode){case v.a.EXPLICIT_MODE:o.REFLECTIONMAP_EXPLICIT=!0;break;case v.a.PLANAR_MODE:o.REFLECTIONMAP_PLANAR=!0;break;case v.a.PROJECTION_MODE:o.REFLECTIONMAP_PROJECTION=!0;break;case v.a.SKYBOX_MODE:o.REFLECTIONMAP_SKYBOX=!0;break;case v.a.SPHERICAL_MODE:o.REFLECTIONMAP_SPHERICAL=!0;break;case v.a.EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case v.a.FIXED_EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case v.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case v.a.CUBIC_MODE:case v.a.INVCUBIC_MODE:default:o.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(o.REFLECTIONFRESNEL=!0,o.REFLECTIONFALLOFF=0<this.reflectionFalloffDistance,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_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===b.a.ALPHA_PREMULTIPLIED||this.alphaMode===b.a.ALPHA_PREMULTIPLIED_PORTERDUFF,o.USERGBCOLOR=this._useRGBColor,o.NOISE=this._enableNoise}
1if(o._areLightsDirty&&(o.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel),o.BACKMAT_SHADOWONLY=this._shadowOnly),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o)}return _.a.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),_.a.PrepareDefinesForFrameBoundValues(r,d,o,i,null,t.getRenderingMesh().hasThinInstances),_.a.PrepareDefinesForAttributes(e,o,!1,!0,!1)&&e&&(r.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(m.b.NormalKind)||(e.createNormals(!0),f.a.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),o.isDirty&&(o.markAsProcessed(),r.resetCachedMaterial(),a=new T.a,o.FOG&&a.addFallback(0,"FOG"),o.POINTSIZE&&a.addFallback(1,"POINTSIZE"),o.MULTIVIEW&&a.addFallback(0,"MULTIVIEW"),_.a.HandleFallbacksForShadows(o,a,this._maxSimultaneousLights),s=[m.b.PositionKind],o.NORMAL&&s.push(m.b.NormalKind),o.UV1&&s.push(m.b.UVKind),o.UV2&&s.push(m.b.UV2Kind),_.a.PrepareAttributesForBones(s,e,o,a),_.a.PrepareAttributesForInstances(s,o),c=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","mBones","vPrimaryColor","vPrimaryColorShadow","vReflectionInfos","reflectionMatrix","vReflectionMicrosurfaceInfos","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix"],l=["diffuseSampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh"],u=["Material","Scene"],g.a&&(g.a.PrepareUniforms(c,o),g.a.PrepareSamplers(l,o)),_.a.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:u,samplers:l,defines:o,maxSimultaneousLights:this._maxSimultaneousLights}),h=o.toString(),t.setEffect(r.getEngine().createEffect("background",{attributes:s,uniformsNames:c,uniformBuffersNames:u,samplers:l,defines:h,fallbacks:a,onCompiled:function(e){n.onCompiled&&n.onCompiled(e),n.bindSceneUniformBuffer(e,r.getSceneUniformBuffer())},onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},d),o),this.buildUniformLayout()),!(!t.effect||!t.effect.isReady()||(o._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},A.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())},A.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))},A.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("vBackgroun
1dCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.create()},A.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),d.prototype.unbind.call(this)},A.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},A.prototype.bindForSubMesh=function(e,t,i){var n,r,o,a=this.getScene(),s=i._materialDefines;!s||(n=i.effect)&&(this._activeEffect=n,this.bindOnlyWorldMatrix(e),_.a.BindBonesParameters(t,this._activeEffect),(r=this._mustRebind(a,n,t.visibility))&&(this._uniformBuffer.bindToEffect(n,"Material"),this.bindViewProjection(n),o=this._reflectionTexture,this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(a.texturesEnabled&&(this._diffuseTexture&&y.a.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),_.a.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),o&&y.a.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",o.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",o.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",o.getSize().width,o.lodGenerationScale,o.lodGenerationOffset))),0<this.shadowLevel&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),s.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),a.texturesEnabled&&(this._diffuseTexture&&y.a.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),o&&y.a.ReflectionTextureEnabled&&(s.REFLECTIONBLUR&&s.TEXTURELODSUPPORT||!s.REFLECTIONBLUR?this._uniformBuffer.setTexture("reflectionSampler",o):(this._uniformBuffer.setTexture("reflectionSampler",o._lodTextureMid||o),this._uniformBuffer.setTexture("reflectionSamplerLow",o._lodTextureLow||o),this._uniformBuffer.setTexture("reflectionSamplerHigh",o._lodTextureHigh||o)),s.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroun
1dCenter",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)))),_.a.BindClipPlane(this._activeEffect,a),_.a.BindEyePosition(n,a)),!r&&this.isFrozen||(a.lightsEnabled&&_.a.BindLights(a,t,this._activeEffect,s,this._maxSimultaneousLights,!1),this.bindView(n),_.a.BindFogParameters(a,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect))},A.prototype.hasTexture=function(e){return!!d.prototype.hasTexture.call(this,e)||this._reflectionTexture===e||this._diffuseTexture===e},A.prototype.dispose=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1),t&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),d.prototype.dispose.call(this,e)},A.prototype.clone=function(e){var t=this;return r.a.Clone(function(){return new A(e,t.getScene())},this)},A.prototype.serialize=function(){var e=r.a.Serialize(this);
1return e.customType="BABYLON.BackgroundMaterial",e},A.prototype.getClassName=function(){return"BackgroundMaterial"},A.Parse=function(e,t,i){return r.a.Parse(function(){return new A(e.name,t)},e,t,i)},A.StandardReflectance0=.05,A.StandardReflectance90=.5,Object(n.c)([Object(r.e)()],A.prototype,"_primaryColor",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsLightsDirty")],A.prototype,"primaryColor",void 0),Object(n.c)([Object(r.e)()],A.prototype,"__perceptualColor",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_primaryColorShadowLevel",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_primaryColorHighlightLevel",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsLightsDirty")],A.prototype,"primaryColorHighlightLevel",null),Object(n.c)([Object(r.m)()],A.prototype,"_reflectionTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionTexture",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_reflectionBlur",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionBlur",void 0),Object(n.c)([Object(r.m)()],A.prototype,"_diffuseTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"diffuseTexture",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"shadowLights",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_shadowLevel",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"shadowLevel",void 0),Object(n.c)([Object(r.o)()],A.prototype,"_sceneCenter",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"sceneCenter",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_opacityFresnel",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"opacityFresnel",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_reflectionFresnel",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionFresnel",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_reflectionFalloffDistance",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionFalloffDistance",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_reflectionAmount",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionAmount",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_reflectionReflectance0",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionReflectance0",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_reflectionReflectance90",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"reflectionReflectance90",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_useRGBColor",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"useRGBColor",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_enableNoise",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"enableNoise",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_maxSimultaneousLights",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],A.prototype,"maxSimultaneousLights",void 0),Object(n.c)([Object(r.c)()],A.prototype,"_shadowOnly",void 0),Object(n.c)([Object(r.b)("_markAllSubMeshesAsLightsDirty")],A.prototype,"shadowOnly",void 0),Object(n.c)([Object(r.i)()],A.prototype,"_imageProcessingConfiguration",void 0),A);function A(e,t){var i=d.call(this,e,t)||this;return i.primaryColor=u.a.White(),i._primaryColorShadowLevel=0,i._primaryColorHighlightLevel=0,i.reflectionTexture=null,i.reflectionBlur=0,i.diffuseTexture=null,i._shadowLights=null,i.shadowLights=null,i.shadowLevel=0,i.sceneCenter=a.e.Zero(),i.opacityFresnel=!0,i.reflectionFresnel=!1,i.reflectionFalloffDistance=0,i.reflectionAmount=1,i.reflectionReflectance0=.05,i.reflectionReflectance90=.5,i.useRGBColor=!0,i.enableNoise=!1,i._fovMultiplier=1,i.useEquirectangularFOV=!1,i._maxSimultaneousLights=4,i.maxSimultaneousLights=4,i._shadowOnly=!1,i.shadowOnly=!1,i._imageProcessingObserver=null,i.switchToBGR=!1,i._renderTargets=new o.a(16),i._reflectionControls=a.f.Zero(),i._white=u.a.White(),i._primaryShadowColor=u.a.Black(),i._primaryHighlightColor=u.a.Black(),i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),i._diffuseTexture&&i._diffuseTexture.isRenderTarget&&i._renderTargets.push(i._diffuseTexture),i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),i._renderTargets},i}function C(){var e=p.call(this)||this;
1return e.DIFFUSE=!1,e.DIFFUSEDIRECTUV=0,e.GAMMADIFFUSE=!1,e.DIFFUSEHASALPHA=!1,e.OPACITYFRESNEL=!1,e.REFLECTIONBLUR=!1,e.REFLECTIONFRESNEL=!1,e.REFLECTIONFALLOFF=!1,e.TEXTURELODSUPPORT=!1,e.PREMULTIPLYALPHA=!1,e.USERGBCOLOR=!1,e.USEHIGHLIGHTANDSHADOWCOLORS=!1,e.BACKMAT_SHADOWONLY=!1,e.NOISE=!1,e.REFLECTIONBGR=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.MULTIVIEW=!1,e.REFLECTION=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.LODINREFLECTIONALPHA=!1,e.GAMMAREFLECTION=!1,e.RGBDREFLECTION=!1,e.EQUIRECTANGULAR_RELFECTION_FOV=!1,e.MAINUV1=!1,e.MAINUV2=!1,e.UV1=!1,e.UV2=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SHADOWFLOAT=!1,e.rebuild(),e}
1l.a.RegisteredTypes["BABYLON.BackgroundMaterial"]=S},function(e,t,i){"use strict";i.d(t,"a",function(){return m});var n=i(1),r=i(3),o=i(13),a=i(6),s=i(10),c=i(12),l=i(22),v=i(4),u=i(9),h=i(39),b=i(29),y=i(15),d=i(2),p=i(5);p.a.ShadersStore.glowMapGenerationPixelShader="#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);\n#ifdef GLOW\n\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef HIGHLIGHT\n\nfinalColor.a=albedoTexture.a;\n#endif\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a<ALPHATESTVALUE)\ndiscard;\n#endif\n#ifdef EMISSIVE\ngl_FragColor=texture2D(emissiveSampler,vUVEmissive)*finalColor;\n#else\ngl_FragColor=finalColor;\n#endif\n#ifdef HIGHLIGHT\n\ngl_FragColor.a=glowColor.a;\n#endif\n}",i(107),i(131),i(132),i(108),i(145),i(109),i(110);p.a.ShadersStore.glowMapGenerationVertexShader="\nattribute vec3 position;\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform mat4 opacityMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef VERTEXALPHA\nattribute vec4 color;\nvarying vec4 vColor;\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(positionUpdated,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
1\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef OPACITYUV2\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef VERTEXALPHA\nvColor=color;\n#endif\n}";var f=i(21),T=i(84),m=(Object.defineProperty(_.prototype,"camera",{get:function(){return this._effectLayerOptions.camera},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"renderingGroupId",{get:function(){return this._effectLayerOptions.renderingGroupId},set:function(e){this._effectLayerOptions.renderingGroupId=e},enumerable:!1,configurable:!0}),_.prototype._init=function(e){this._effectLayerOptions=Object(n.a)({mainTextureRatio:.5,alphaBlendingMode:d.a.ALPHA_COMBINE,camera:null,renderingGroupId:-1},e),this._setMainTextureSize(),this._createMainTexture(),this._createTextureAndPostProcesses(),this._mergeEffect=this._createMergeEffect()},_.prototype._generateIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._engine.createIndexBuffer(e)},_.prototype._generateVertexBuffer=function(){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1);var t=new v.b(this._engine,e,v.b.PositionKind,!1,!1,2);this._vertexBuffers[v.b.PositionKind]=t},_.prototype._setMainTextureSize=function(){this._effectLayerOptions.mainTextureFixedSize?(this._mainTextureDesiredSize.width=this._effectLayerOptions.mainTextureFixedSize,this._mainTextureDesiredSize.height=this._effectLayerOptions.mainTextureFixedSize):(this._mainTextureDesiredSize.width=this._engine.getRenderWidth()*this._effectLayerOptions.mainTextureRatio,this._mainTextureDesiredSize.height=this._engine.getRenderHeight()*this._effectLayerOptions.mainTextureRatio,this._mainTextureDesiredSize.width=this._engine.needPOTTextures?c.a.GetExponentOfTwo(this._mainTextureDesiredSize.width,this._maxSize):this._mainTextureDesiredSize.width,this._mainTextureDesiredSize.height=this._engine.needPOTTextures?c.a.GetExponentOfTwo(this._mainTextureDesiredSize.height,this._maxSize):this._mainTextureDesiredSize.height),this._mainTextureDesiredSize.width=Math.floor(this._mainTextureDesiredSize.width),this._mainTextureDesiredSize.height=Math.floor(this._mainTextureDesiredSize.height)},_.prototype._createMainTexture=function(){var s=this;this._mainTexture=new h.a("HighlightLayerMainRTT",{width:this._mainTextureDesiredSize.width,height:this._mainTextureDesiredSize.height},this._scene,!1,!0,d.a.TEXTURETYPE_UNSIGNED_INT),this._mainTexture.activeCamera=this._effectLayerOptions.camera,this._mainTexture.wrapU=u.a.CLAMP_ADDRESSMODE,this._mainTexture.wrapV=u.a.CLAMP_ADDRESSMODE,this._mainTexture.anisotropicFilteringLevel=1,this._mainTexture.updateSamplingMode(u.a.BILINEAR_SAMPLINGMODE),this._mainTexture.renderParticles=!1,this._mainTexture.renderList=null,this._mainTexture.ignoreCameraViewport=!0,this._mainTexture.customRenderFunction=function(e,t,i,n){s.onBeforeRenderMainTextureObservable.notifyObservers(s);var r=s._scene.getEngine();if(n.length){for(r.setColorWrite(!1),a=0;a<n.length;a++)s._renderSubMesh(n.data[a]);r.setColorWrite(!0)}for(a=0;a<e.length;a++)s._renderSubMesh(e.data[a]);for(a=0;a<t.length;a++)s._renderSubMesh(t.data[a]);for(var o=r.getAlphaMode(),a=0;a<i.length;a++)s._renderSubMesh(i.data[a],!0);r.setAlphaMode(o)},this._mainTexture.onClearObservable.add(function(e){e.clear(s.neutralColor,!0,!0,!0)})},_.prototype._addCustomEffectDefines=function(e){},_.prototype._isReady=function(e,t,i){var n=e.getMaterial();if(!n)return!1;if(!n.isReadyForSubMesh(e.getMesh(),e,t))return!1;var r,o,a,s,c=[],l=[v.b.PositionKind],u=e.getMesh(),h=!1,d=!1;n&&(r=n.needAlphaTesting(),a=(o=n.getAlphaTestTexture())&&o.hasAlpha&&(n.useAlphaFromDiffuseTexture||n._useAlphaFromAlbedoTexture),o&&(r||a)&&(c.push("#define DIFFUSE"),u.isVerticesDataPresent(v.b.UV2Kind)&&1===o.coordinatesIndex?(c.push("#define DIFFUSEUV2"),d=!0):u.isVerticesDataPresent(v.b.UVKind)&&(c.push("#define DIFFUSEUV1"),h=!0),r&&(c.push("#define ALPHATEST"),c.push("#define ALPHATESTVALUE 0.4"))),(s=n.opacityTexture)&&(c.push("#define OPACITY"),u.isVerticesDataPresent(v.b.UV2Kind)&&1===s.coordinatesIndex?(c.push("#define OPACITYUV2"),d=!0):u.isVerticesDataPresent(v.b.UVKind)&&(c.push("#define OPACITYUV1"),h=!0))),i&&(c.push("#define EMISSIVE"),u.isVerticesDataPresent(v.b.UV2Kind)&&1===i.coordinatesIndex?(c.push("#define EMISSIVEUV2"),d=!0):u.isVerticesDataPresent(v.b.UVKind)&&(c.push("#define EMISSIVEUV1"),h=!0)),u.isVerticesDataPresent(v.b.ColorKind)&&u.hasVertexAlpha&&(l.push(v.b.ColorKind),c.push("#define VERTEXALPHA")),h&&(l.push(v.b.UVKind),c.push("#define UV1")),d&&(l.push(v.b.UV2Kind),c.push("#define UV2"));var p,f=new T.a;u.useBones&&u.computeBonesUsingShaders?(l.push(v.b.MatricesIndicesKind),l.push(v.b.MatricesWeightsKind),4<u.numBoneInfluencers&&(l.push(v.b.MatricesIndicesExtraKind),l.push(v.b.MatricesWeightsExtraKind)
1),c.push("#define NUM_BONE_INFLUENCERS "+u.numBoneInfluencers),(p=u.skeleton)&&p.isUsingTextureForMatrices?c.push("#define BONETEXTURE"):c.push("#define BonesPerMesh "+(p?p.bones.length+1:0)),0<u.numBoneInfluencers&&f.addCPUSkinningFallback(0,u)):c.push("#define NUM_BONE_INFLUENCERS 0");var m=u.morphTargetManager,_=0;m&&0<m.numInfluencers&&(c.push("#define MORPHTARGETS"),_=m.numInfluencers,c.push("#define NUM_MORPH_INFLUENCERS "+_),y.a.PrepareAttributesForMorphTargetsInfluencers(l,u,_)),t&&(c.push("#define INSTANCES"),y.a.PushAttributesForInstances(l),e.getRenderingMesh().hasThinInstances&&c.push("#define THIN_INSTANCES")),this._addCustomEffectDefines(c);var g=c.join("\n");return this._cachedDefines!==g&&(this._cachedDefines=g,this._effectLayerMapGenerationEffect=this._scene.getEngine().createEffect("glowMapGeneration",l,["world","mBones","viewProjection","glowColor","morphTargetInfluences","boneTextureWidth","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity"],["diffuseSampler","emissiveSampler","opacitySampler","boneSampler"],g,f,void 0,void 0,{maxSimultaneousMorphTargets:_})),this._effectLayerMapGenerationEffect.isReady()},_.prototype.render=function(){var e=this._mergeEffect;if(e.isReady()){for(var t=0;t<this._postProcesses.length;t++)if(!this._postProcesses[t].isReady())return;var i=this._scene.getEngine();this.onBeforeComposeObservable.notifyObservers(this),i.enableEffect(e),i.setState(!1),i.bindBuffers(this._vertexBuffers,this._indexBuffer,e);var n=i.getAlphaMode();i.setAlphaMode(this._effectLayerOptions.alphaBlendingMode),this._internalRender(e),i.setAlphaMode(n),this.onAfterComposeObservable.notifyObservers(this);var r=this._mainTexture.getSize();this._setMainTextureSize(),r.width===this._mainTextureDesiredSize.width&&r.height===this._mainTextureDesiredSize.height||(this.onSizeChangedObservable.notifyObservers(this),this._disposeTextureAndPostProcesses(),this._createMainTexture(),this._createTextureAndPostProcesses())}},_.prototype.hasMesh=function(e){return-1===this.renderingGroupId||e.renderingGroupId===this.renderingGroupId},_.prototype.shouldRender=function(){return this.isEnabled&&this._shouldRender},_.prototype._shouldRenderMesh=function(e){return!0},_.prototype._canRenderMesh=function(e,t){return!t.needAlphaBlendingForMesh(e)},_.prototype._shouldRenderEmissiveTextureForMesh=function(){return!0},_.prototype._renderSubMesh=function(e,t){var i=this;if(void 0===t&&(t=!1),this.shouldRender()){var n=e.getMaterial(),r=e.getMesh(),o=e.getReplacementMesh(),a=e.getRenderingMesh(),s=e.getEffectiveMesh(),c=this._scene,l=c.getEngine();if(s._internalAbstractMeshDataInfo._isActiveIntermediate=!1,n&&this._canRenderMesh(a,n)){l.setState(n.backFaceCulling);var u=a._getInstancesRenderList(e._id,!!o);if(!u.mustReturn&&this._shouldRenderMesh(a)){var h=u.hardwareInstancedRendering[e._id]||a.hasThinInstances;if(this._setEmissiveTextureAndColor(a,e,n),this.onBeforeRenderMeshToEffect.notifyObservers(r),this._useMeshMaterial(a))a.render(e,h,o||void 0);else if(this._isReady(e,h,this._emissiveTextureAndColor.texture)){l.enableEffect(this._effectLayerMapGenerationEffect),a._bind(e,this._effectLayerMapGenerationEffect,b.a.TriangleFillMode),this._effectLayerMapGenerationEffect.setMatrix("viewProjection",c.getTransformMatrix()),this._effectLayerMapGenerationEffect.setFloat4("glowColor",this._emissiveTextureAndColor.color.r,this._emissiveTextureAndColor.color.g,this._emissiveTextureAndColor.color.b,this._emissiveTextureAndColor.color.a);var d=n.needAlphaTesting(),p=n.getAlphaTestTexture(),f=p&&p.hasAlpha&&(n.useAlphaFromDiffuseTexture||n._useAlphaFromAlbedoTexture);p&&(d||f)&&(this._effectLayerMapGenerationEffect.setTexture("diffuseSampler",p),(m=p.getTextureMatrix())&&this._effectLayerMapGenerationEffect.setMatrix("diffuseMatrix",m));var m,_=n.opacityTexture;if(_&&(this._effectLayerMapGenerationEffect.setTexture("opacitySampler",_),this._effectLayerMapGenerationEffect.setFloat("opacityIntensity",_.level),(m=_.getTextureMatrix())&&this._effectLayerMapGenerationEffect.setMatrix("opacityMatrix",m)),this._emissiveTextureAndColor.texture&&(this._effectLayerMapGenerationEffect.setTexture("emissiveSampler",this._emissiveTextureAndColor.texture),this._effectLayerMapGenerationEffect.setMatr
1ix("emissiveMatrix",this._emissiveTextureAndColor.texture.getTextureMatrix())),a.useBones&&a.computeBonesUsingShaders&&a.skeleton){var g=a.skeleton;if(g.isUsingTextureForMatrices){var v=g.getTransformMatrixTexture(a);if(!v)return;this._effectLayerMapGenerationEffect.setTexture("boneSampler",v),this._effectLayerMapGenerationEffect.setFloat("boneTextureWidth",4*(g.bones.length+1))}else this._effectLayerMapGenerationEffect.setMatrices("mBones",g.getTransformMatrices(a))}y.a.BindMorphTargetParameters(a,this._effectLayerMapGenerationEffect),t&&l.setAlphaMode(n.alphaMode),a._processRendering(s,e,this._effectLayerMapGenerationEffect,n.fillMode,u,h,function(e,t){return i._effectLayerMapGenerationEffect.setMatrix("world",t)})}else this._mainTexture.resetRefreshCounter();this.onAfterRenderMeshToEffect.notifyObservers(r)}}}},_.prototype._useMeshMaterial=function(e){return!1},_.prototype._rebuild=function(){var e=this._vertexBuffers[v.b.PositionKind];e&&e._rebuild(),this._generateIndexBuffer()},_.prototype._disposeTextureAndPostProcesses=function(){this._mainTexture.dispose();for(var e=0;e<this._postProcesses.length;e++)this._postProcesses[e]&&this._postProcesses[e].dispose();for(this._postProcesses=[],e=0;e<this._textures.length;e++)this._textures[e]&&this._textures[e].dispose();this._textures=[]},_.prototype.dispose=function(){var e=this._vertexBuffers[v.b.PositionKind];e&&(e.dispose(),this._vertexBuffers[v.b.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._disposeTextureAndPostProcesses();var t=this._scene.effectLayers.indexOf(this,0);-1<t&&this._scene.effectLayers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onBeforeRenderMeshToEffect.clear(),this.onAfterRenderMeshToEffect.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()},_.prototype.getClassName=function(){return"EffectLayer"},_.Parse=function(e,t,i){return o.b.Instantiate(e.customType).Parse(e,t,i)},_._SceneComponentInitialization=function(e){throw f.a.WarnImport("EffectLayerSceneComponent")},Object(n.c)([Object(r.c)()],_.prototype,"name",void 0),Object(n.c)([Object(r.f)()],_.prototype,"neutralColor",void 0),Object(n.c)([Object(r.c)()],_.prototype,"isEnabled",void 0),Object(n.c)([Object(r.d)()],_.prototype,"camera",null),Object(n.c)([Object(r.c)()],_.prototype,"renderingGroupId",null),_);function _(e,t){this._vertexBuffers={},this._maxSize=0,this._mainTextureDesiredSize={width:0,height:0},this._shouldRender=!0,this._postProcesses=[],this._textures=[],this._emissiveTextureAndColor={texture:null,color:new s.b},this.neutralColor=new s.b,this.isEnabled=!0,this.onDisposeObservable=new a.c,this.onBeforeRenderMainTextureObservable=new a.c,this.onBeforeComposeObservable=new a.c,this.onBeforeRenderMeshToEffect=new a.c,this.onAfterRenderMeshToEffect=new a.c,this.onAfterComposeObservable=new a.c,this.onSizeChangedObservable=new a.c,this.name=e,this._scene=t||l.a.LastCreatedScene,_._SceneComponentInitialization(this._scene),this._engine=this._scene.getEngine(),this._maxSize=this._engine.getCaps().maxTextureSize,this._scene.effectLayers.push(this),this._generateIndexBuffer(),this._generateVertexBuffer()}},function(e,t,i){"use strict";i.d(t,"b",function(){return c}),i.d(t,"a",function(){return f});var n,l,r=i(1),u=i(10),h=i(4),o=i(8),a=i(264),s=i(29),d=i(121),p=i(15),c=(i(334),i(335),l=o.a,Object(r.d)(_,l),_.prototype._addClipPlaneDefine=function(e){var t="#define "+e;-1===this._colorShader.options.defines.indexOf(t)&&this._colorShader.options.defines.push(t)},_.prototype._removeClipPlaneDefine=function(e){var t="#define "+e,i=this._colorShader.options.defines.indexOf(t);-1!==i&&this._colorShader.options.defines.splice(i,1)},_.prototype.isReady=function(){var e=this.getScene();return e.clipPlane?this._addClipPlaneDefine("CLIPPLANE"):this._removeClipPlaneDefine("CLIPPLANE"),e.clipPlane2?this._addClipPlaneDefine("CLIPPLANE2"):this._removeClipPlaneDefine("CLIPPLANE2"),e.clipPlane3?this._addClipPlaneDefine("CLIPPLANE3"):this._removeClipPlaneDefine("CLIPPLANE3"),e.clipPlane4?this._addClipPlaneDefine("CLIPPLANE4"):this._removeClipPlaneDefine("CLIPPLANE4"),e.clipPlane5?this._addClipPlaneDefine("CLIPPLANE5"):this._removeClipPlaneDefine("CLIPPLANE5"),e.clipPlane6?this._addClipPlaneDefine("CLIPPLANE6"):this._removeClipPlaneDefine("CLIPPLANE6"),!!this._colorShader.isReady()&&l.prototype.isReady.call(this)},_.prototype.getClassName=function(){return"LinesMesh"},Object.defineProperty(_.prototype,"material",{get:function(){return this._colorShader},set:function(e){}
1,enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"checkCollisions",{get:function(){return!1},enumerable:!1,configurable:!0}),_.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n,r,o,a,s=this._colorShader.getEffect(),c=this.isUnIndexed?null:this._geometry.getIndexBuffer();return this._geometry._bind(s,c),this.useVertexColor||(r=(n=this.color).r,o=n.g,a=n.b,this.color4.set(r,o,a,this.alpha),this._colorShader.setColor4("color",this.color4)),p.a.BindClipPlane(s,this.getScene()),this},_.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var n=this.getScene().getEngine();return this._unIndexed?n.drawArraysType(s.a.LineListDrawMode,e.verticesStart,e.verticesCount,i):n.drawElementsType(s.a.LineListDrawMode,e.indexStart,e.indexCount,i),this},_.prototype.dispose=function(e){this._colorShader.dispose(!1,!1,!0),l.prototype.dispose.call(this,e)},_.prototype.clone=function(e,t,i){return void 0===t&&(t=null),new _(e,this.getScene(),t,this,i)},_.prototype.createInstance=function(e){return new f(e,this)},_),f=(n=a.a,Object(r.d)(m,n),m.prototype.getClassName=function(){return"InstancedLinesMesh"},m);function m(e,t){var i=n.call(this,e,t)||this;return i.intersectionThreshold=t.intersectionThreshold,i}function _(e,t,i,n,r,o,a){void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null);var s=l.call(this,e,t,i,n,r)||this;s.useVertexColor=o,s.useVertexAlpha=a,s.color=new u.a(1,1,1),s.alpha=1,n&&(s.color=n.color.clone(),s.alpha=n.alpha,s.useVertexColor=n.useVertexColor,s.useVertexAlpha=n.useVertexAlpha),s.intersectionThreshold=.1;var c={attributes:[h.b.PositionKind,"world0","world1","world2","world3"],uniforms:["vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","world","viewProjection"],needAlphaBlending:!0,defines:[]};return!1===a&&(c.needAlphaBlending=!1),o?(c.defines.push("#define VERTEXCOLOR"),c.attributes.push(h.b.ColorKind)):(c.uniforms.push("color"),s.color4=new u.b),s._colorShader=new d.a("colorShader",s.getScene(),"color",c),s}},function(e,t,i){"use strict";i.d(t,"a",function(){return a}),i.d(t,"b",function(){return r});var a,n,o=i(1),s=i(0),c=i(163);(n=a=a||{})[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z";var r=(l._GetDefaultOptions=function(){return{puckSize:40,containerSize:60,color:"cyan",puckImage:void 0,containerImage:void 0,position:void 0,alwaysVisible:!1,limitToContainer:!1}},l.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},l.prototype._onPointerDown=function(e){e.preventDefault(),(!0===this._leftJoystick?e.clientX<l.halfWidth:e.clientX>l.halfWidth)&&this._joystickPointerID<0?(this._joystickPointerID=e.pointerId,this._joystickPosition?(this._joystickPointerStartPos=this._joystickPosition.clone(),this._joystickPointerPos=this._joystickPosition.clone(),this._joystickPreviousPointerPos=this._joystickPosition.clone(),this._onPointerMove(e)):(this._joystickPointerStartPos.x=e.clientX,this._joystickPointerStartPos.y=e.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(e.pointerId.toString(),e)):l._globalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(e.pointerId.toString(),{x:e.clientX,y:e.clientY,prevX:e.clientX,prevY:e.clientY}))},l.prototype._onPointerMove=function(e){if(this._joystickPointerID==e.pointerId){var t,i;this.limitToContainer?((i=(t=new s.d(e.clientX-this._joystickPointerStartPos.x,e.clientY-this._joystickPointerStartPos.y)).length())>this.containerSize&&t.scaleInPlace(this.containerSize/i),this._joystickPointerPos.x=this._joystickPointerStartPos.x+t.x,this._joystickPointerPos.y=this._joystickPointerStartPos.y+t.y):(this._joystickPointerPos.x=e.clientX,this._joystickPointerPos.y=e.clientY),this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos),0<l._alwaysVisibleSticks&&(this._leftJoystick?this._joystickPointerPos.x=Math.min(l.halfWidth,this._joystickPointerPos.x):this._joystickPointerPos.x=Math.max(l.halfWidth,this._joystickPointerPos.x));var n=(this.reverseLeftRight?-1:1)*this._deltaJoystickVector.x/this._inversedSensibility;switch(this._axisTargetedByLeftAndRight){case a.X:this.deltaPosition.x=Math.min(1,Math.max(-1,n));break;case a.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,n));break;case a.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,n))}var r=(this.reverseUpDown?1:-1)*this._deltaJoystickVector.y/this._inversedSensibility;switch(this._axisTargetedByUpAndDown){case a.X:this.deltaPosition.x=Math.min(1,Math.max(-1,r));break;case a.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,r));break;case a.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,r))}}else{var o=this._touches.get(e.pointerId.toString());o&&(o.x=e.clientX,o.y=e.clientY)}},l.prototype._onPointerUp=function(e){var t;this._joystickPointerID==e.pointerId?(this._clearPreviousDraw(),this._joystickPointerID=-1,this.pressed=!1):(t=this._touches.get(e.pointerId.toString()))&&l.vjCanvasContext.clearRect(t.prevX-44,t.prevY-44,88,88),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this._touches.remove(e.pointerId.toString())},l.prototype.setJoystickColor=function(e){this._joystickColor=e},Object.defineProperty(l.prototype,"containerSize",{get:function(){return this._joystickContainerSize},set:function(e){this._joystickContainerSize=e,this._clearContainerSize=~~(2.1*this._joystickContainerSize),this._clearContainerSizeOffset=~~(this._clearContainerSize/2)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"puckSize",{get:function(){return this._joystickPuckSize},set:function(e){this._joystickPuckSize=e,this._clearPuckSize=~~(2.1*this._joystickPuckSize),this._clearPuckSizeOffset=~~(this._clearPuckSize/2)},enumerable:!1,configurable:!0}),l.prototype.clearPosition=function(){this.alwaysVisible=!1,delete this._joystickPosition},Object.defineProperty(l.prototype,"alwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this._alwaysVisible!==e&&(e&&this._joystickPosition?(l._alwaysVisibleSticks++,this._alwaysVisible=!0):(l._alwaysVisibleSticks--,this._alwaysVisible=!1))},enumerable:!1,configurable:!0}),l.prototype.setPosition=function(e,t){this._joystickPointerStartPos&&this._clearPreviousDraw(),this._joystickPosition=new s.d(e,t)},l.prototype.setActionOnTouch=function(e){this._action=e},l.prototype.setAxisForLeftRight=function(e){switch(e){case a.X:case a.Y:case a.Z:this._axisTargetedByLeftAndRight=e;break;default:this._axisTargetedByLeftAndRight=a.X}},l.prototype.setAxisForUpDown=function(e){switch(e){case a.X:case a.Y:case a.Z:this._axisTargetedByUpAndDown=e;break;default:this._axisTargetedByUpAndDown=a.Y}},l.prototype._clearPreviousDraw=function(){var e=this._joystickPosition||this._joystickPointerStartPos;l.vjCanvasContext.clearRect(e.x-this._clearContainerSizeOffset,e.y-this._clearContainerSizeOffset,this._clearContainerSize,this._clearContainerSize),l.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x-this._clearPuckSizeOffset,this._joystickPreviousPointerPos.y-this._clearPuckSizeOffset,this._clearPuckSize,this._clearPuckSize)},l.prototype.setContainerImage=function(e){var t=this,i=new Image;i.src=e,i.onload=function(){return t._containerImage=i}},l.prototype.setPuckImage=function(e){var t=this,i=new Image;i.src=e,i.onload=function(){return t._puckImage=i}},l.prototype._drawContainer=function(){var e=this._joystickPosition||this._joystickPointerStartPos;this._clearPreviousDraw(),this._containerImage?l.vjCanvasContext.drawImage(this._containerImage,e.x-this.containerSize,e.y-this.containerSize,2*this.containerSize,2*this.containerSize):(l.vjCanvasContext.beginPath(),l.vjCanvasContext.strokeStyle=this._joystickColor,l.vjCanvasContext.lineWidth=2,l.vjCanvasContext.arc(e.x,e.y,this.containerSize,0,2*Math.PI,!0),l.vjCanvasContext.stroke(),l.vjCanvasContext.closePath(),l.vjCanvasContext.beginPath(),l.vjCanvasContext.lineWidth=6,l.vjCanvasContext.strokeStyle=this._joystickColor,l.vjCanvasContext.arc(e.x,e.y,this.puckSize,0,2*Math.PI,!0),l.vjCanvasContext.stroke(),l.vjCanvasContext.closePath())},l.prototype._drawPuck=function(){this._puckImage?l.vjCanvasContext.drawImage(this._puckImage,this._joystickPointerPos.x-this.puckSize,this._joystickPointerPos.y-this.puckSize,2*this.puckSize,2*this.puckSize):(l.vjCanvasContext.beginPath(),l.vjCanvasContext.strokeStyle=this._joystickColor,l.vjCanvasContext.lineWidth=2,l.vjCanvasContext.arc(this._joystickPointerPos.x,this._joystickPointerPos.y,this.puckSize,0,2*Math.PI,!0),l.vjCanvasContext.stroke(),l.vjCanvasContext.closePath())},l.prototype._drawVirtualJoystick=function(){var i=this;this.alwaysVisible&&this._drawContainer(),this.pressed&&this._touches.forEach(function(e,t){t.pointerId===i._joystickPointerID?(i.alwaysVisible||i._drawContainer(),i._drawPuck(),i._joystickPreviousPointerPos=i._joystickPointerPos.clone()):(l.vjCanvasContext.clearRect(t.prevX-44,t.prevY-44,88,88),l.vjCanvasContext.beginPath(),l.vjCanvasContext.fillStyle="white",l.vjCanvasContext.beginPath(),l.vjCanvasContext.strokeStyle="red",l.vjCanvasContext.lineWidth=6,l.vjCanvasContext.arc(t.x,t.y,40,0,2*Math.PI,!0),l.vjCanvasContext.stroke(),l.vjCanvasContext.closePath(),t.prevX=t.x,t.prevY=t.y)}),requestAnimationFrame(function(){i._drawVirtualJoystick()})},l.prototype.releaseCanvas=function(){l.Canvas&&(l.Canvas.removeEventListener("pointerdown",this._onPointerDownHandlerRef),l.Canvas.removeEventListener("pointermove",this._onPointerMoveHandlerRef),l.Canvas.removeEventListener("pointerup",this._onPointerUpHandlerRef),l.Canvas.removeEventListener("pointerout",this._onPointerUpHandlerRef),window.removeEventListener("resize",this._onResize),document.body.removeChild(l.Canvas),l.Canvas=null)},l._globalJoystickIndex=0,l._alwaysVisibleSticks=0,l);function l(e,t){var i=this,n=Object(o.a)(Object(o.a)({},l._GetDefaultOptions()),t);if(this._leftJoystick=!!e,l._globalJoystickIndex++,this._axisTargetedByLeftAndRight=a.X,this._axisTargetedByUpAndDown=a.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new c.a,this.deltaPosition=s.e.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(e){l.vjCanvasWidth=window.innerWidth,l.vjCanvasHeight=window.innerHeight,l.Canvas&&(l.Canvas.width=l.vjCanvasWidth,l.Canvas.height=l.vjCanvasHeight),l.halfWidth=l.vjCanvasWidth/2},!l.Canvas){window.addEventListener("resize",this._onResize,!1),l.Canvas=document.createElement("canvas"),l.vjCanvasWidth=window.innerWidth,l.vjCanvasHeight=window.innerHeight,l.Canvas.width=window.innerWidth,l.Canvas.height=window.innerHeight,l.Canvas.style.width="100%",l.Canvas.style.height="100%",l.Canvas.style.position="absolute",l.Canvas.style.backgroundColor="transparent",l.Canvas.style.top="0px",l.Canvas.style.left="0px",l.Canvas.style.zIndex="5",l.Canvas.style.msTouchAction="none",l.Canvas.style.touchAction="none",l.Canvas.setAttribute("touch-action","none");var r=l.Canvas.getContext("2d");if(!r)throw new Error("Unable to create canvas for virtual joystick");l.vjCanvasContext=r,l.vjCanvasContext.strokeStyle="#ffffff",l.vjCanvasContext.lineWidth=2,document.body.appendChild(l.Canvas)}l.halfWidth=l.Canvas.width/2,this.pressed=!1,this.limitToContainer=n.limitToContainer,this._joystickColor=n.color,this.containerSize=n.containerSize,this.puckSize=n.puckSize,n.position&&this.setPosition(n.position.x,n.position.y),n.puckImage&&this.setPuckImage(n.puckImage),n.c
1ontainerImage&&this.setContainerImage(n.containerImage),n.alwaysVisible&&l._alwaysVisibleSticks++,this.alwaysVisible=n.alwaysVisible,this._joystickPointerID=-1,this._joystickPointerPos=new s.d(0,0),this._joystickPreviousPointerPos=new s.d(0,0),this._joystickPointerStartPos=new s.d(0,0),this._deltaJoystickVector=new s.d(0,0),this._onPointerDownHandlerRef=function(e){i._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){i._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){i._onPointerUp(e)},l.Canvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),l.Canvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),l.Canvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),l.Canvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),l.Canvas.addEventListener("contextmenu",function(e){e.preventDefault()},!1),requestAnimationFrame(function(){i._drawVirtualJoystick()})}},function(e,t,i){"use strict";i.d(t,"a",function(){return C});var T=i(14),E=i(111),L=i(2),S=i(27),N=i(7),F=i(148),A=i(62),n=(i(229),i(31));function r(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var w=r("DXT1"),B=r("DXT3"),U=r("DXT5"),V=r("DX10"),C=(k.GetDDSInfo=function(e){var t=new Int32Array(e.buffer,e.byteOffset,31),i=new Int32Array(e.buffer,e.byteOffset,35),n=1;131072&t[2]&&(n=Math.max(1,t[7]));var r=t[21],o=r===V?i[32]:0,a=L.a.TEXTURETYPE_UNSIGNED_INT;switch(r){case 113:a=L.a.TEXTURETYPE_HALF_FLOAT;break;case 116:a=L.a.TEXTURETYPE_FLOAT;break;case V:if(10===o){a=L.a.TEXTURETYPE_HALF_FLOAT;break}if(2===o){a=L.a.TEXTURETYPE_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:n,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:131072==(131072&t[20]),isCube:512==(512&t[28]),isCompressed:r===w||r===B||r===U,dxgiFormat:o,textureType:a}},k._ToHalfFloat=function(e){k._FloatView||(k._FloatView=new Float32Array(1),k._Int32View=new Int32Array(k._FloatView.buffer)),k._FloatView[0]=e;var t=k._Int32View[0],i=t>>16&32768,n=t>>12&2047,r=t>>23&255;return r<103?i:142<r?(i|=31744,i|=(255==r?0:1)&&8388607&t):r<113?i|=((n|=2048)>>114-r)+(n>>113-r&1):(i|=r-112<<10|n>>1,i+=1&n)},k._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))},k._GetHalfFloatAsFloatRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Float32Array(n),s=new Uint16Array(r,i),c=0,l=0;l<t;l++)for(var u=0;u<e;u++){var h=4*(u+l*e);a[c]=k._FromHalfFloat(s[h]),a[c+1]=k._FromHalfFloat(s[1+h]),a[c+2]=k._FromHalfFloat(s[2+h]),a[c+3]=k.StoreLODInAlphaChannel?o:k._FromHalfFloat(s[3+h]),c+=4}return a},k._GetHalfFloatRGBAArrayBuffer=function(e,t,i,n,r,o){if(k.StoreLODInAlphaChannel){for(var a=new Uint16Array(n),s=new Uint16Array(r,i),c=0,l=0;l<t;l++)for(var u=0;u<e;u++){var h=4*(u+l*e);a[c]=s[h],a[c+1]=s[1+h],a[c+2]=s[2+h],a[c+3]=k._ToHalfFloat(o),c+=4}return a}return new Uint16Array(r,i,n)},k._GetFloatRGBAArrayBuffer=function(e,t,i,n,r,o){if(k.StoreLODInAlphaChannel){for(var a=new Float32Array(n),s=new Float32Array(r,i),c=0,l=0;l<t;l++)for(var u=0;u<e;u++){var h=4*(u+l*e);a[c]=s[h],a[c+1]=s[1+h],a[c+2]=s[2+h],a[c+3]=o,c+=4}return a}return new Float32Array(r,i,n)},k._GetFloatAsUIntRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Uint8Array(n),s=new Float32Array(r,i),c=0,l=0;l<t;l++)for(var u=0;u<e;u++){var h=4*(u+l*e);a[c]=255*T.a.Clamp(s[h]),a[c+1]=255*T.a.Clamp(s[1+h]),a[c+2]=255*T.a.Clamp(s[2+h]),a[c+3]=k.StoreLODInAlphaChannel?o:255*T.a.Clamp(s[3+h]),c+=4}return a},k._GetHalfFloatAsUIntRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Uint8Array(n),s=new Uint16Array(r,i),c=0,l=0;l<t;l++)for(var u=0;u<e;u++){var h=4*(u+l*e);a[c]=255*T.a.Clamp(k._FromHalfFloat(s[h])),a[c+1]=255*T.a.Clamp(k._FromHalfFloat(s[1+h])),a[c+2]=255*T.a.Clamp(k._FromHalfFloat(s[2+h])),a[c+3]=k.StoreLODInAlphaChannel?o:255*T.a.Clamp(k._FromHalfFloat(s[3+h])),c+=4}return a},k._GetRGBAArrayBuffer=function(e,t,i,n,r,o,a,s,c){for(var l=new Uint8Array(n),u=new Uint8Array(r,i),h=0,d=0;d<t;d++)for(var p=0;p<e;p++){var f=4*(p+d*e);l[h]=u[f+o],l[h+1]=u[f+a],l[h+2]=u[f+s],l[h+3]=u[f+c],h+=4}return l},k._ExtractLongWordOrder=function(e){return 0===e||255===e||-16777216===e?0:1+k._ExtractLongWordOrder(e>>8)},k._GetRGBArrayBuffer=function(e,t,i,n,r,o,a,s){for(var c=new Uint8Array(n),l=new Uint8Array(r,i),u=0,h=0;h<t;h++)for(var d=0;d<e;d++){var p=3*(d+h*e);c[u]=l[p+o],c[u+1]=l[p+a],c[u+2]=l[p+s],u+=3}return c},k._GetLuminanceArrayBuffer=function(e,t,i,n,r){for(var o=new Uint8Array(n),a=new Uint8Array(r,i),s=0,c=0;c<t;c++)for(var l=0;l<e;l++){var u=l+c*e;o[s]=a[u],s++}return o},k.UploadDDSLevels=function(e,t,i,n,r,o,a,s){void 0===a&&(a=-1);var c=null;n.sphericalPolynomial&&(c=new Array);var l,u,h,d,p,f=e.getCaps().s3tc,m=new Int32Array(i.buffer,i.byteOffset,31),_=0,g=0,v=1;if(542327876===m[0])if(n.isFourCC||n.isRGB||n.isLuminance)if(!n.isCompressed||f){var b=m[22],y=m[1]+4,T=!1;if(n.isFourCC)switch(l=m[21]){case w:v=8,g=f.COMPRESSED_RGBA_S3TC_DXT1_EXT;break;case B:v=16,g=f.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case U:v=16,g=f.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;case 113:case 116:T=!0;break;case V:y+=20;var E=!1;switch(n.dxgiFormat){case 10:case 2:E=T=!0;break;case 88:n.isRGB=!0,b=32,E=!(n.isFourCC=!1)}if(E)break;default:return void console.error("Unsupported FourCC code:",String.fromCharCode(255&l,l>>8&255,l>>16&255,l>>24&255))}var S=k._ExtractLongWordOrder(m[23]),A=k._ExtractLongWordOrder(m[24]),C=k._ExtractLongWordOrder(m[25]),P=k._ExtractLongWordOrder(m[26]);T&&(g=e._getRGBABufferInternalSizedFormat(n.textureType)),d=1,131072&m[2]&&!1!==r&&(d=Math.max(1,m[7]
1));for(var x,R,O,M,I,D=s||0;D<o;D++){for(u=m[4],h=m[3],p=0;p<d;++p)-1!==a&&a!==p||(x=-1===a?p:0,!n.isCompressed&&n.isFourCC?(t.format=L.a.TEXTUREFORMAT_RGBA,_=u*h*4,R=null,e._badOS||e._badDesktopOS||!e.getCaps().textureHalfFloat&&!e.getCaps().textureFloat?(128===b?(R=k._GetFloatAsUIntRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x),c&&0==x&&c.push(k._GetFloatRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x))):64===b&&(R=k._GetHalfFloatAsUIntRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x),c&&0==x&&c.push(k._GetHalfFloatAsFloatRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x))),t.type=L.a.TEXTURETYPE_UNSIGNED_INT):128===b?(t.type=L.a.TEXTURETYPE_FLOAT,R=k._GetFloatRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x),c&&0==x&&c.push(R)):64!==b||e.getCaps().textureHalfFloat?(t.type=L.a.TEXTURETYPE_HALF_FLOAT,R=k._GetHalfFloatRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x),c&&0==x&&c.push(k._GetHalfFloatAsFloatRGBAArrayBuffer(u,h,y,_,i.buffer,x))):(t.type=L.a.TEXTURETYPE_FLOAT,R=k._GetHalfFloatAsFloatRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,x),c&&0==x&&c.push(R)),R&&e._uploadDataToTextureDirectly(t,R,D,x)):n.isRGB?(t.type=L.a.TEXTURETYPE_UNSIGNED_INT,I=24===b?(t.format=L.a.TEXTUREFORMAT_RGB,_=u*h*3,k._GetRGBArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,S,A,C)):(t.format=L.a.TEXTUREFORMAT_RGBA,_=u*h*4,k._GetRGBAArrayBuffer(u,h,i.byteOffset+y,_,i.buffer,S,A,C,P)),e._uploadDataToTextureDirectly(t,I,D,x)):n.isLuminance?(O=e._getUnpackAlignement(),M=u,_=Math.floor((u+O-1)/O)*O*(h-1)+M,I=k._GetLuminanceArrayBuffer(u,h,i.byteOffset+y,_,i.buffer),t.format=L.a.TEXTUREFORMAT_LUMINANCE,t.type=L.a.TEXTURETYPE_UNSIGNED_INT,e._uploadDataToTextureDirectly(t,I,D,x)):(_=Math.max(4,u)/4*Math.max(4,h)/4*v,I=new Uint8Array(i.buffer,i.byteOffset+y,_),t.type=L.a.TEXTURETYPE_UNSIGNED_INT,e._uploadCompressedDataToTextureDirectly(t,g,u,h,I,D,x))),y+=b?u*h*(b/8):_,u*=.5,h*=.5,u=Math.max(1,u),h=Math.max(1,h);if(void 0!==s)break}c&&0<c.length?n.sphericalPolynomial=F.a.ConvertCubeMapToSphericalPolynomial({size:m[4],right:c[0],left:c[1],up:c[2],down:c[3],front:c[4],back:c[5],format:L.a.TEXTUREFORMAT_RGBA,type:L.a.TEXTURETYPE_FLOAT,gammaSpace:!1}):n.sphericalPolynomial=void 0}else N.a.Error("Compressed textures are not supported on this platform.");else N.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else N.a.Error("Invalid magic number in DDS header")},k.StoreLODInAlphaChannel=!1,k);function k(){}n.a.prototype.createPrefilteredCubeTexture=function(e,m,_,g,v,t,i,n,b){var y=this;return void 0===v&&(v=null),void 0===t&&(t=null),void 0===n&&(n=null),void 0===b&&(b=!0),this.createCubeTexture(e,m,null,!1,function(e){if(e){var t=e.texture;if(b?e.info.sphericalPolynomial&&(t._sphericalPolynomial=e.info.sphericalPolynomial):t._sphericalPolynomial=new E.b,t._source=S.b.CubePrefiltered,y.getCaps().textureLOD)v&&v(t);else{var i=y._gl,n=e.width;if(n){for(var r=[],o=0;o<3;o++){var a,s,c=1-o/2,l=g,u=T.a.Log2(n)*_+g,h=l+(u-l)*c,d=Math.round(Math.min(Math.max(h,0),u)),p=new S.a(y,S.b.Temp);p.type=t.type,p.format=t.format,p.width=Math.pow(2,Math.max(T.a.Log2(n)-d,0)),p.height=p.width,p.isCube=!0,y._bindTextureDirectly(i.TEXTURE_CUBE_MAP,p,!0),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),e.isDDS?(a=e.info,s=e.data,y._unpackFlipY(a.isCompressed),C.UploadDDSLevels(y,p,s,a,!0,6,d)):N.a.Warn("DDS is the only prefiltered cube map supported so far."),y._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null);var f=new A.a(m);f.isCube=!0,(f._texture=p).isReady=!0,r.push(f)}t._lodTextureHigh=r[2],t._lodTextureMid=r[1],t._lodTextureLow=r[0],v&&v(t)}}}else v&&v(null)},t,i,n,b,_,g)}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"a",function(){return l});var n,r,o=i(0),a=i(28),s=i(8),c=i(21);(r=n=n||{})[r.ATTACHED=0]="ATTACHED",r[r.END=1]="END";var l=(u.prototype.clone=function(){var e=this.particleSystem.emitter;e?e instanceof o.e?e=e.clone():e instanceof a.a&&((e=new s.a("",e.getSce
1ne())).isVisible=!1):e=new o.e;var t=new u(this.particleSystem.clone("",e));return t.particleSystem.name+="Clone",t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem._disposeEmitterOnDispose=!0,t.particleSystem.disposeOnStop=!0,t},u.prototype.serialize=function(){var e={};return e.type=this.type,e.inheritDirection=this.inheritDirection,e.inheritedVelocityAmount=this.inheritedVelocityAmount,e.particleSystem=this.particleSystem.serialize(),e},u._ParseParticleSystem=function(e,t,i){throw c.a.WarnImport("ParseParticle")},u.Parse=function(e,t,i){var n=e.particleSystem,r=new u(u._ParseParticleSystem(n,t,i));return r.type=e.type,r.inheritDirection=e.inheritDirection,r.inheritedVelocityAmount=e.inheritedVelocityAmount,r.particleSystem._isSubEmitter=!0,r},u.prototype.dispose=function(){this.particleSystem.dispose()},u);function u(e){this.particleSystem=e,this.type=n.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,e.emitter&&e.emitter.dispose||(e.emitter=new a.a("SubemitterSystemEmitter",e.getScene())),e.onDisposeObservable.add(function(){e.emitter&&e.emitter.dispose&&e.emitter.dispose()})}},function(e,t,i){"use strict";i.d(t,"c",function(){return r}),i.d(t,"b",function(){return o}),i.d(t,"a",function(){return a}),i.d(t,"d",function(){return s});var u=i(0),h=i(10),d=i(52),n=i(164),p=i(28),r=(l.prototype.copyToRef=function(e){return e.position.copyFrom(this.position),e.rotation.copyFrom(this.rotation),this.rotationQuaternion&&(e.rotationQuaternion?e.rotationQuaternion.copyFrom(this.rotationQuaternion):e.rotationQuaternion=this.rotationQuaternion.clone()),e.scaling.copyFrom(this.scaling),this.color&&(e.color?e.color.copyFrom(this.color):e.color=this.color.clone()),e.uvs.copyFrom(this.uvs),e.velocity.copyFrom(this.velocity),e.pivot.copyFrom(this.pivot),e.translateFromPivot=this.translateFromPivot,e.alive=this.alive,e.isVisible=this.isVisible,e.parentId=this.parentId,e.cullingStrategy=this.cullingStrategy,null!==this.materialIndex&&(e.materialIndex=this.materialIndex),this},Object.defineProperty(l.prototype,"scale",{get:function(){return this.scaling},set:function(e){this.scaling=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"quaternion",{get:function(){return this.rotationQuaternion},set:function(e){this.rotationQuaternion=e},enumerable:!1,configurable:!0}),l.prototype.intersectsMesh=function(e){return!(!this._boundingInfo||!e._boundingInfo)&&(this._sps._bSphereOnly?n.a.Intersects(this._boundingInfo.boundingSphere,e._boundingInfo.boundingSphere):this._boundingInfo.intersects(e._boundingInfo,!1))},l.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},l.prototype.getRotationMatrix=function(e){var t,i;this.rotationQuaternion?t=this.rotationQuaternion:(t=u.c.Quaternion[0],i=this.rotation,u.b.RotationYawPitchRollToRef(i.y,i.x,i.z,t)),t.toRotationMatrix(e)},l),o=function(e,t,i,n,r,o,a,s,c){this._indicesLength=0,this.shapeID=e,this._shape=t,this._indices=i,this._indicesLength=i.length,this._shapeUV=o,this._shapeColors=r,this._normals=n,this._positionFunction=a,this._vertexFunction=s,this._material=c},a=function(e,t,i,n){this.idx=0,this.ind=0,this.indicesLength=0,this.sqDistance=0,this.materialIndex=0,this.idx=e,this.ind=t,this.indicesLength=i,this.materialIndex=n},s=(Object.defineProperty(c.prototype,"x",{get:function(){return this.position.x},set:function(e){this.position.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"y",{get:function(){return this.position.y},set:function(e){this.position.y=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"z",{get:function(){return this.position.z},set:function(e){this.position.z=e},enumerable:!1,configurable:!0}),c);function c(){this.position=u.e.Zero(),this.color=new h.b(1,1,1,1),this.uv=u.d.Zero()}function l(e,t,i,n,r,o,a,s,c,l){void 0===c&&(c=null),void 0===l&&(l=null),this.idx=0,this.id=0,this.color=new h.b(1,1,1,1),this.position=u.e.Zero(),this.rotation=u.e.Zero(),this.scaling=u.e.One(),this.uvs=new u.f(0,0,1,1),this.velocity=u.e.Zero(),this.pivot=u.e.Zero(),this.translateFromPivot=!1,this.alive=!0,this.isVisible=!0,this._pos=0,this._ind=0,this.shapeId=0,this.idxInShape=0,this._stillInvisible=!1,this._rotationMatrix=[1,0,0,0,1,0,0,0,1],this.parentId=null,this.materialIndex=null,this.props=null,this.cullingStrategy=p.a.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,this._globalPosition=u.e.Zero(),this.idx=e,this.id=t,this._pos=i,this._ind=n,this._model=r,this.shapeId=o,this.idxInShape=a,this._sps=s,c&&(this._modelBoundingInfo=c,this._boundingInfo=new d.a(c.minimum,c.maximum)),null!==l&&(this.materialIndex=l)}},function(e,t,i){"use strict";i.r(t),i.d(t,"AxesViewer",function(){return a}),i.d(t,"BoneAxesViewer",function(){return p}),i.d(t,"DebugLayerTab",function(){return n}),i.d(t,"DebugLayer",function(){return y}),i.d(t,"PhysicsViewer",function(){return R}),i.d(t,"RayHelper",function(){return M}),i.d(t,"SkeletonViewer",function(){return I});var n,o,r,u=i(0),l=i(35),h=i(100),d=i(10),a=(Object.defineProperty(b.prototype,"xAxis",{get:function(){return this._xAxis}
1,enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"yAxis",{get:function(){return this._yAxis},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"zAxis",{get:function(){return this._zAxis},enumerable:!1,configurable:!0}),b.prototype.update=function(e,t,i,n){this._xAxis.position.copyFrom(e),this._xAxis.setDirection(t),this._xAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._yAxis.position.copyFrom(e),this._yAxis.setDirection(i),this._yAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._zAxis.position.copyFrom(e),this._zAxis.setDirection(n),this._zAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor)},b.prototype.createInstance=function(){var e=h.a._CreateArrowInstance(this.scene,this._xAxis),t=h.a._CreateArrowInstance(this.scene,this._yAxis),i=h.a._CreateArrowInstance(this.scene,this._zAxis),n=new b(this.scene,this.scaleLines,null,e,t,i);return n._instanced=!0,n},b.prototype.dispose=function(){this._xAxis&&(this._xAxis.dispose(!1,!this._instanced),delete this._xAxis),this._yAxis&&(this._yAxis.dispose(!1,!this._instanced),delete this._yAxis),this._zAxis&&(this._zAxis.dispose(!1,!this._instanced),delete this._zAxis),delete this.scene},b._SetRenderingGroupId=function(e,t){e.getChildMeshes().forEach(function(e){e.renderingGroupId=t})},b),s=i(1),c=i(24),p=(o=a,Object(s.d)(v,o),v.prototype.update=function(){var e;this.mesh&&this.bone&&((e=this.bone)._markAsDirtyAndCompose(),e.getAbsolutePositionToRef(this.mesh,this.pos),e.getDirectionToRef(c.a.X,this.mesh,this.xaxis),e.getDirectionToRef(c.a.Y,this.mesh,this.yaxis),e.getDirectionToRef(c.a.Z,this.mesh,this.zaxis),o.prototype.update.call(this,this.pos,this.xaxis,this.yaxis,this.zaxis))},v.prototype.dispose=function(){this.mesh&&(this.mesh=null,this.bone=null,o.prototype.dispose.call(this))},v),f=i(13),m=i(6),_=i(18),g=i(12);function v(e,t,i,n){void 0===n&&(n=1);var r=o.call(this,e,n)||this;return r.pos=u.e.Zero(),r.xaxis=u.e.Zero(),r.yaxis=u.e.Zero(),r.zaxis=u.e.Zero(),r.mesh=i,r.bone=t,r}function b(e,t,i,n,r,o){var a,s,c;void 0===t&&(t=1),void 0===i&&(i=2),this._scaleLinesFactor=4,this._instanced=!1,this.scaleLines=1,this.scaleLines=t,n||((a=new l.a("",e)).disableLighting=!0,a.emissiveColor=d.a.Red().scale(.5),n=h.a._CreateArrow(e,a)),r||((s=new l.a("",e)).disableLighting=!0,s.emissiveColor=d.a.Green().scale(.5),r=h.a._CreateArrow(e,s)),o||((c=new l.a("",e)).disableLighting=!0,c.emissiveColor=d.a.Blue().scale(.5),o=h.a._CreateArrow(e,c)),this._xAxis=n,this._xAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._yAxis=r,this._yAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._zAxis=o,this._zAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),null!=i&&(b._SetRenderingGroupId(this._xAxis,i),b._SetRenderingGroupId(this._yAxis,i),b._SetRenderingGroupId(this._zAxis,i)),this.scene=e,this.update(new u.e,u.e.Right(),u.e.Up(),u.e.Forward())}Object.defineProperty(_.a.prototype,"debugLayer",{get:function(){return this._debugLayer||(this._debugLayer=new y(this)),this._debugLayer},enumerable:!0,configurable:!0}),(r=n=n||{})[r.Properties=0]="Properties",r[r.Debug=1]="Debug",r[r.Statistics=2]="Statistics",r[r.Tools=3]="Tools",r[r.Settings=4]="Settings";var y=(Object.defineProperty(F.prototype,"onPropertyChangedObservable",{get:function(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector?this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable:(this._onPropertyChangedObservable||(this._onPropertyChangedObservable=new m.c),this._onPropertyChangedObservable)},enumerable:!1,configurable:!0}),F.prototype._createInspector=function(e){if(!this.isVisible()){if(this._onPropertyChangedObservable){for(var t=0,i=this._onPropertyChangedObservable.observers;t<i.length;t++){var n=i[t];this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(n)}this._onPropertyChangedObservable.clear(),this._onPropertyChangedObservable=void 0}var r=Object(s.a)({overlay:!1,showExplorer:!0,showInspector:!0,embedMode:!1,handleResize:!0,enablePopup:!0},e);this.BJSINSPECTOR=this.BJSINSPECTOR||this._getGlobalInspector(),this.BJSINSPECTOR.Inspector.Show(this._scene,r)}},F.prototype.select=function(e,t){this.BJSINSPECTOR&&(t&&("[object String]"==Object.prototype.toString.call(t)?this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(t):this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(t)),this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(e))},F.prototype._getGlobalInspector=function(){return"undefined"!=typeof INSPECTOR?INSPECTOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.Inspector?BABYLON:void 0},F.prototype.isVisible=function(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector.IsVisible},F.prototype.hide=function(){this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector.Hide()},F.prototype.setAsActiveScene=function(){this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector._SetNewScene(this._scene)},F.prototype.show=function(n){var r=this;return new Promise(function(e,t){var i;void 0===r.BJSINSPECTOR?(i=n&&n.inspectorURL?n.inspectorURL:F.InspectorURL,f.b.LoadScript(i,function(){r._createInspector(n),e(r)})):(r._createInspector(n),e(r))})},F.InspectorURL="https://unpkg.com/babylonjs-inspector@"+g.a.Version+"/babylon.inspector.bundle.js",F),T=i(8),E=i(91),S=i(60),A=i(22),C=i(34),P=i(47),x=i(79),R=(N.prototype._updateDebugMeshes=function(){for(var e=this._physicsEnginePlugin,t=0;t<this._numMeshes;t++){var i=this._impostors[t];if(i)if(i.isDisposed)this.hideImpostor(this._impostors[t--]);else{if(i.type===C.a.MeshImpostor)continue;var n=this._meshes[t];n&&e&&e.syncMeshWithImpostor(n,i)}}},N.prototype.showImpostor=function(e,t){if(!this._scene)return null;for(var i=0;i<this._numMeshes;i++)if(this._impostors[i]==e)return null;var n=this._getDebugMesh(e,t);return n&&(this._impostors[this._numMeshes]=e,this._meshes[this._numMeshes]=n,0===this._numMeshes&&(this._renderFunction=this._updateDebugMeshes.bind(this),this._scene.registerBeforeRender(this._renderFunction)),this._numMeshes++),n},N.prototype.hideImpostor=function(e){if(e&&this._scene&&this._utilityLayer){for(var t=!1,i=this._utilityLayer.utilityLayerScene,n=0;n<this._numMeshes;n++)if(this._impostors[n]==e){var r=this._meshes[n];if(!r)continue;i.removeMesh(r),r.dispose();var o=this._debugMeshMeshes.indexOf(r);-1<o&&this._debugMeshMeshes.splice(o,1),this._numMeshes--,0<this._numMeshes?(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)}},N.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new l.a("",e),this._debugMaterial.wireframe=!0,this._debugMaterial.emissiveColor=d.a.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},N.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=E.a.CreateBox("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.rotationQuaternion=u.b.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),this._debugBoxMesh.setEnabled(!1)),this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance")},N.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=S.a.CreateSphere("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=u.b.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),this._debugSphereMesh.setEnabled(!1)),this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance")}
1,N.prototype._getDebugCylinderMesh=function(e){return this._debugCylinderMesh||(this._debugCylinderMesh=x.a.CreateCylinder("physicsBodyCylinderViewMesh",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=u.b.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance")},N.prototype._getDebugMeshMesh=function(e,t){var i=new T.a(e.name,t,null,e);return i.position=u.e.Zero(),i.setParent(e),i.material=this._getDebugMaterial(t),this._debugMeshMeshes.push(i),i},N.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 C.a.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case C.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 C.a.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case C.a.NoImpostor:t&&t.getChildMeshes().filter(function(e){return e.physicsImpostor?1:0}).forEach(function(e){i._getDebugBoxMesh(r).parent=e});break;
1case C.a.CylinderImpostor:n=this._getDebugCylinderMesh(r);var a=e.object.getBoundingInfo();n.scaling.x=a.boundingBox.maximum.x-a.boundingBox.minimum.x,n.scaling.y=a.boundingBox.maximum.y-a.boundingBox.minimum.y,n.scaling.z=a.boundingBox.maximum.z-a.boundingBox.minimum.z}return n},N.prototype.dispose=function(){for(var e=this._numMeshes,t=0;t<e;t++)this.hideImpostor(this._impostors[0]);this._debugBoxMesh&&this._debugBoxMesh.dispose(),this._debugSphereMesh&&this._debugSphereMesh.dispose(),this._debugCylinderMesh&&this._debugCylinderMesh.dispose(),this._debugMaterial&&this._debugMaterial.dispose(),this._impostors.length=0,this._scene=null,this._physicsEnginePlugin=null,this._utilityLayer&&(this._utilityLayer.dispose(),this._utilityLayer=null)},N),O=i(58),M=(L.CreateAndShow=function(e,t,i){var n=new L(e);return n.show(t,i),n},L.prototype.show=function(e,t){var i;!this._renderFunction&&this.ray&&(i=this.ray,this._renderFunction=this._render.bind(this),this._scene=e,this._renderPoints=[i.origin,i.origin.add(i.direction.scale(i.length))],this._renderLine=T.a.CreateLines("ray",this._renderPoints,e,!0),this._renderFunction&&this._scene.registerBeforeRender(this._renderFunction)),t&&this._renderLine&&this._renderLine.color.copyFrom(t)},L.prototype.hide=function(){this._renderFunction&&this._scene&&(this._scene.unregisterBeforeRender(this._renderFunction),this._scene=null,this._renderFunction=null,this._renderLine&&(this._renderLine.dispose(),this._renderLine=null),this._renderPoints=[])},L.prototype._render=function(){var e,t,i=this.ray;i&&(e=this._renderPoints[1],t=Math.min(i.length,1e6),e.copyFrom(i.direction),e.scaleInPlace(t),e.addInPlace(i.origin),T.a.CreateLines("ray",this._renderPoints,this._scene,!0,this._renderLine))},L.prototype.attachToMesh=function(e,t,i,n){this._attachedToMesh=e;var r=this.ray;r&&(r.direction||(r.direction=u.e.Zero()),r.origin||(r.origin=u.e.Zero()),n&&(r.length=n),i=i||u.e.Zero(),t=t||new u.e(0,0,-1),this._meshSpaceDirection?(this._meshSpaceDirection.copyFrom(t),this._meshSpaceOrigin.copyFrom(i)):(this._meshSpaceDirection=t.clone(),this._meshSpaceOrigin=i.clone()),this._updateToMeshFunction||(this._updateToMeshFunction=this._updateToMesh.bind(this),this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction)),this._attachedToMesh.computeWorldMatrix(!0),this._updateToMesh())},L.prototype.detachFromMesh=function(){this._attachedToMesh&&(this._updateToMeshFunction&&this._attachedToMesh.getScene().unregisterBeforeRender(this._updateToMeshFunction),this._attachedToMesh=null,this._updateToMeshFunction=null)},L.prototype._updateToMesh=function(){var e=this.ray;this._attachedToMesh&&e&&(this._attachedToMesh._isDisposed?this.detachFromMesh():(this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection,e.direction),u.e.TransformCoordinatesToRef(this._meshSpaceOrigin,this._attachedToMesh.getWorldMatrix(),e.origin)))},L.prototype.dispose=function(){this.hide(),this.detachFromMesh(),this.ray=null},L),I=(Object.defineProperty(D.prototype,"debugMesh",{get:function(){return this._debugMesh},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._debugMesh&&this._debugMesh.setEnabled(e),e?this._scene.registerBeforeRender(this._renderFunction):this._scene.unregisterBeforeRender(this._renderFunction))},enumerable:!1,configurable:!0}),D.prototype._getBonePosition=function(e,t,i,n,r,o){void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0);var a,s=u.c.Matrix[0],c=t.getParent();s.copyFrom(t.getLocalMatrix()),0===n&&0===r&&0===o||(a=u.c.Matrix[1],u.a.IdentityToRef(a),a.setTranslationFromFloats(n,r,o),a.multiplyToRef(s,s)),c&&s.multiplyToRef(c.getAbsoluteTransform(),s),s.multiplyToRef(i,s),e.x=s.m[12],e.y=s.m[13],e.z=s.m[14]},D.prototype._getLinesForBonesWithLength=function(e,t){for(var i=e.length,n=this.mesh._effectiveMesh.position,r=0;r<i;r++){var o=e[r],a=this._debugLines[r];a||(a=[u.e.Zero(),u.e.Zero()],this._debugLines[r]=a),this._getBonePosition(a[0],o,t),this._getBonePosition(a[1],o,t,0,o.length,0),a[0].subtractInPlace(n),a[1].subtractInPlace(n)}},D.prototype._getLinesForBonesNoLength=function(e,t){for(var i=e.length,n=0,r=this.mesh._effectiveMesh,o=r.position,a=i-1;0<=a;a--){var s,c=e[a],l=c.getParent();l&&((s=this._debugLines[n])||(s=[u.e.Zero(),u.e.Zero()],this._debugLines[n]=s),c.getAbsolutePositionToRef(r,s[0]),l.getAbsolutePositionToRef(r,s[1]),s[0].subtractInPlace(o),s[1].subtractInPlace(o),n++)}},D.prototype.update=function(){var e,t;this._utilityLayer&&(this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms(),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()),t=this._utilityLayer.utilityLayerScene,this._debugMesh?O.a.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:this._debugMesh},t):(this._debugMesh=O.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)},D.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)},D);function D(e,t,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=1),this.skeleton=e,this.mesh=t,this.autoUpdateBonesMatrices=n,this.renderingGroupId=r,this.color=d.a.White(),this._debugLines=new Array,this._isEnabled=!1,this._scene=i,this._utilityLayer=new P.a(this._scene,!1),this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!0,this.update(),this._renderFunction=this.update.bind(this)}function L(e){this.ray=e}function N(e){this._impostors=[],this._meshes=[],this._numMeshes=0,this._debugMeshMeshes=new Array,this._scene=e||A.a.LastCreatedScene;var t=this._scene.getPhysicsEngine();t&&(this._physicsEnginePlugin=t.getPhysicsPlugin()),this._utilityLayer=new P.a(this._scene,!1),this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!0}function F(e){var t=this;this.BJSINSPECTOR=this._getGlobalInspector(),this._scene=e,this._scene.onDisposeObservable.add(function(){t._scene._debugLayer&&t._scene._debugLayer.hide()})}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.morphTargetsVertex="#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];
1\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif"},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n,r=i(1),o=i(254),a=i(252),s=i(253),c=(n=i(37).b,Object(r.d)(l,n),l.prototype.addMouseWheel=function(){return this.add(new s.a),this},l.prototype.addPointers=function(){return this.add(new o.a),this},l.prototype.addKeyboard=function(){return this.add(new a.a),this},l);function l(e){return n.call(this,e)||this}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var l,n=i(1),r=i(3),s=i(48),o=i(23),c=i(22),u=i(2),a=(i(333),i(217),l=o.a,Object(n.d)(h,l),Object.defineProperty(h.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),h.prototype._attachImageProcessingConfiguration=function(e,t){var i,n,r,o,a=this;void 0===t&&(t=!1),e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e?this._imageProcessingConfiguration=e:(o=null,i=this.getEngine(),o=(n=this.getCamera())?n.getScene():i&&i.scenes?(r=i.scenes)[r.length-1]:c.a.LastCreatedScene,this._imageProcessingConfiguration=o?o.imageProcessingConfiguration:new s.a),this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){a._updateParameters()})),t||this._updateParameters())},Object.defineProperty(h.prototype,"isSupported",{get:function(){var e=this.getEffect();return!e||e.isSupported},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"colorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"colorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"colorGradingTexture",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"colorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"exposure",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"toneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"toneMappingType",{get:function(){return this._imageProcessingConfiguration.toneMappingType},set:function(e){this._imageProcessingConfiguration.toneMappingType=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"contrast",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteStretch",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteCentreX",{get:function(){return this.imageProcessingConfiguration.vignetteCentreX},set:function(e){this.imageProcessingConfiguration.vignetteCentreX=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteCentreY",{get:function(){return this.imageProcessingConfiguration.vignetteCentreY},set:function(e){this.imageProcessingConfiguration.vignetteCentreY=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteWeight",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteColor",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteCameraFov",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteBlendMode",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"vignetteEnabled",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fromLinearSpace",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!1,configurable:!0}),h.prototype.getClassName=function(){return"ImageProcessingPostProcess"},h.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"];s.a&&(s.a.PrepareSamplers(i,this._defines),s.a.PrepareUniforms(n,this._defines)),this.updateEffect(e,n,i)},h.prototype.dispose=function(e){l.prototype.dispose.call(this,e),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},Object(n.c)([Object(r.c)()],h.prototype,"_fromLinearSpace",void 0),h);function h(e,t,i,n,r,o,a,s){void 0===i&&(i=null),void 0===a&&(a=u.a.TEXTURETYPE_UNSIGNED_INT);var c=l.call(this,e,"imageProcessing",[],[],t,i,n,r,o,null,a,"postprocess",null,!0)||this;return c._fromLinearSpace=!0,c._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},s?(s.applyByPostProcess=!0,c._attachImageProcessingConfiguration(s,!0),c.fromLinearSpace=!1):(c._attachImageProcessingConfiguration(null,!0),c.imageProcessingConfiguration.applyByPostProcess=!0),c.onApply=function(e){c.imageProcessingConfiguration.bind(e,c.aspectRatio)},c}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});function n(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n}var r=i(0),T=i(14),E=i(111),S=i(2),A=i(32),C=i(10),o=(a.ConvertCubeMapTextureToSphericalPolynomial=function(e){if(!e.isCube)return null;var t,i=e.getSize().width,n=e.readPixels(0),r=e.readPixels(1),o=e.isRenderTarget?(t=e.readPixels(3),e.readPixels(2)):(t=e.readPixels(2),e.readPixels(3)),a=e.readPixels(4),s=e.readPixels(5),c=e.gammaSpace,l=S.a.TEXTUREFORMAT_RGBA,u=S.a.TEXTURETYPE_UNSIGNED_INT;e.textureType!=S.a.TEXTURETYPE_FLOAT&&e.textureType!=S.a.TEXTURETYPE_HALF_FLOAT||(u=S.a.TEXTURETYPE_FLOAT);var h={size:i,right:n,left:r,up:t,down:o,front:a,back:s,format:l,type:u,gammaSpace:c};return this.ConvertCubeMapToSphericalPolynomial(h)},a.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new E.a,i=0,n=2/e.size,r=n,o=.5*n-1,a=0;a<6;a++)for(var s=this.FileFaces[a],c=e[s.name],l=o,u=e.format===S.a.TEXTUREFORMAT_RGBA?4:3,h=0;h<e.size;h++){for(var d=o,p=0;p<e.size;
1p++){var f=s.worldAxisForFileX.scale(d).add(s.worldAxisForFileY.scale(l)).add(s.worldAxisForNormal);f.normalize();var m=Math.pow(1+d*d+l*l,-1.5),_=c[h*e.size*u+p*u],g=c[h*e.size*u+p*u+1],v=c[h*e.size*u+p*u+2];isNaN(_)&&(_=0),isNaN(g)&&(g=0),isNaN(v)&&(v=0),e.type===S.a.TEXTURETYPE_UNSIGNED_INT&&(_/=255,g/=255,v/=255),e.gammaSpace&&(_=Math.pow(T.a.Clamp(_),A.c),g=Math.pow(T.a.Clamp(g),A.c),v=Math.pow(T.a.Clamp(v),A.c)),_=T.a.Clamp(_,0,4096),g=T.a.Clamp(g,0,4096),v=T.a.Clamp(v,0,4096);var b=new C.a(_,g,v);t.addLight(f,b,m),i+=m,d+=n}l+=r}var y=4*Math.PI*6/6/i;return t.scaleInPlace(y),t.convertIncidentRadianceToIrradiance(),t.convertIrradianceToLambertianRadiance(),E.b.FromHarmonics(t)},a.FileFaces=[new n("right",new r.e(1,0,0),new r.e(0,0,-1),new r.e(0,-1,0)),new n("left",new r.e(-1,0,0),new r.e(0,0,1),new r.e(0,-1,0)),new n("up",new r.e(0,1,0),new r.e(1,0,0),new r.e(0,0,1)),new n("down",new r.e(0,-1,0),new r.e(1,0,0),new r.e(0,0,-1)),new n("front",new r.e(0,0,1),new r.e(1,0,0),new r.e(0,-1,0)),new n("back",new r.e(0,0,-1),new r.e(-1,0,0),new r.e(0,-1,0))],a);function a(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n,r=i(1),o=i(3),a=i(0),s=i(63),c=i(24),l=(n=s.a,Object(r.d)(u,n),u.prototype._setPosition=function(e){this._position=e},Object.defineProperty(u.prototype,"position",{get:function(){return this._position},set:function(e){this._setPosition(e)},enumerable:!1,configurable:!0}),u.prototype._setDirection=function(e){this._direction=e},Object.defineProperty(u.prototype,"direction",{get:function(){return this._direction},set:function(e){this._setDirection(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"shadowMinZ",{get:function(){return this._shadowMinZ},set:function(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"shadowMaxZ",{get:function(){return this._shadowMaxZ},set:function(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),u.prototype.computeTransformedInformation=function(){return!(!this.parent||!this.parent.getWorldMatrix||(this.transformedPosition||(this.transformedPosition=a.e.Zero()),a.e.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=a.e.Zero()),a.e.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),0))},u.prototype.getDepthScale=function(){return 50},u.prototype.getShadowDirection=function(e){return this.transformedDirection?this.transformedDirection:this.direction},u.prototype.getAbsolutePosition=function(){return this.transformedPosition?this.transformedPosition:this.position},u.prototype.setDirectionToTarget=function(e){return this.direction=a.e.Normalize(e.subtract(this.position)),this.direction},u.prototype.getRotation=function(){this.direction.normalize();var e=a.e.Cross(this.direction,c.a.Y),t=a.e.Cross(e,this.direction);return a.e.RotationFromAxis(e,t,this.direction)},u.prototype.needCube=function(){return!1},u.prototype.needProjectionMatrixCompute=function(){return this._needProjectionMatrixCompute},u.prototype.forceProjectionMatrixCompute=function(){this._needProjectionMatrixCompute=!0},u.prototype._initCache=function(){n.prototype._initCache.call(this),this._cache.position=a.e.Zero()},u.prototype._isSynchronized=function(){return!!this._cache.position.equals(this.position)},u.prototype.computeWorldMatrix=function(e){return!e&&this.isSynchronized()?this._currentRenderId=this.getScene().getRenderId():(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=a.a.Identity()),a.a.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminantIsDirty=!0),this._worldMatrix},u.prototype.getDepthMinZ=function(e){return void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ},u.prototype.getDepthMaxZ=function(e){return void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ},u.prototype.setShadowProjectionMatrix=function(e,t,i){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,i,e):this._setDefaultShadowProjectionMatrix(e,t,i),this},Object(r.c)([Object(o.o)()],u.prototype,"position",null),Object(r.c)([Object(o.o)()],u.prototype,"direction",null),Object(r.c)([Object(o.c)()],u.prototype,"shadowMinZ",null),Object(r.c)([Object(o.c)()],u.prototype,"shadowMaxZ",null),u);function u(){var e=null!==n&&n.apply(this,arguments)||this;return e._needProjectionMatrixCompute=!0,e}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var a=i(9),s=i(270),n=(r.GetEnvironmentBRDFTexture=function(e){var t,i,n,r,o;return e.environmentBRDFTexture||(t=e.useDelayedTextureLoading,e.useDelayedTextureLoading=!1,i=e._blockEntityCollection,e._blockEntityCollection=!1,n=a.a.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture"+this._instanceNumber++,e,!0,!1,a.a.BILINEAR_SAMPLINGMODE),e._blockEntityCollection=i,-1!==(o=(r=e.getEngine().getLoadedTexturesCache()).indexOf(n.getInternalTexture()))&&r.splice(o,1),n.isRGBD=!0,n.wrapU=a.a.CLAMP_ADDRESSMODE,n.wrapV=a.a.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=n,e.useDelayedTextureLoading=t,s.a.ExpandRGBDTexture(n)),e.environmentBRDFTexture},r._instanceNumber=0,r._environmentBRDFBase64Texture
vendor: 31,353 bytes, line 1
1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg=="
1,r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),l=i(9),r=i(23),u=i(2),o=i(5);o.a.ShadersStore.fxaaPixelShader="uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range<rangeMaxClamped)\n{\ngl_FragColor=rgbyM;\nreturn;\n}\n#endif\nfloat lumaNW=FxaaLuma(texture2D(textureSampler,sampleCoordNW,0.0));\nfloat lumaSE=FxaaLuma(texture2D(textureSampler,sampleCoordSE,0.0));\nfloat lumaNE=FxaaLuma(texture2D(textureSampler,sampleCoordNE,0.0));\nfloat lumaSW=FxaaLuma(texture2D(textureSampler,sampleCoordSW,0.0));\nfloat lumaNS=lumaN+lumaS;\nfloat lumaWE=lumaW+lumaE;\nfloat subpixRcpRange=1.0/range;\nfloat subpixNSWE=lumaNS+lumaWE;\nfloat edgeHorz1=(-2.0*lumaM)+lumaNS;\nfloat edgeVert1=(-2.0*lumaM)+lumaWE;\nfloat lumaNESE=lumaNE+lumaSE;\nfloat lumaNWNE=lumaNW+lumaNE;\nfloat edgeHorz2=(-2.0*lumaE)+lumaNESE;\nfloat edgeVert2=(-2.0*lumaN)+lumaNWNE;\nfloat lumaNWSW=lumaNW+lumaSW;\nfloat lumaSWSE=lumaSW+lumaSE;\nfloat edgeHorz4=(abs(edgeHorz1)*2.0)+abs(edgeHorz2);\nfloat edgeVert4=(abs(edgeVert1)*2.0)+abs(edgeVert2);\nfloat edgeHorz3=(-2.0*lumaW)+lumaNWSW;\nfloat edgeVert3=(-2.0*lumaS)+lumaSWSE;\nfloat edgeHorz=abs(edgeHorz3)+edgeHorz4;\nfloat edgeVert=abs(edgeVert3)+edgeVert4;\nfloat subpixNWSWNESE=lumaNWSW+lumaNESE;\nfloat lengthSign=texelSize.x;\nbool horzSpan=edgeHorz>=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan)\n{\nlumaS=lumaE;\n}\nif (horzSpan)\n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan)\n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN)\n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN)\n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN)\n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP)\n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan)\n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN<dstP;\nfloat dst=min(dstN,dstP);\nbool goodSpan=directionN ? goodSpanN : goodSpanP;\nfloat subpixG=subpixF*subpixF;\nfloat pixelOffset=(dst*(-spanLengthRcp))+0.5;\nfloat subpixH=subpixG*fxaaQualitySubpix;\nfloat pixelOffsetGood=goodSpan ? pixelOffset : 0.0;\nfloat pixelOffsetSubpix=max(pixelOffsetGood,subpixH);\nif (!horzSpan)\n{\nposM.x+=pixelOffsetSubpix*lengthSign;\n}\nif (horzSpan)\n{\nposM.y+=pixelOffsetSubpix*lengthSign;\n}\n#ifdef MALI\nif(range<rangeMaxClamped)\n{\ngl_FragColor=rgbyM;\n}\nelse\n{\ngl_FragColor=texture2D(textureSampler,posM,0.0);\n}\n#else\ngl_FragColor=texture2D(textureSampler,posM,0.0);\n#endif\n}";
1o.a.ShadersStore.fxaaVertexShader="\nattribute vec2 position;\nuniform vec2 texelSize;\n\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=(position*madd+madd);\nsampleCoordS=vUV+vec2( 0.0,1.0)*texelSize;\nsampleCoordE=vUV+vec2( 1.0,0.0)*texelSize;\nsampleCoordN=vUV+vec2( 0.0,-1.0)*texelSize;\nsampleCoordW=vUV+vec2(-1.0,0.0)*texelSize;\nsampleCoordNW=vUV+vec2(-1.0,-1.0)*texelSize;\nsampleCoordSE=vUV+vec2( 1.0,1.0)*texelSize;\nsampleCoordNE=vUV+vec2( 1.0,-1.0)*texelSize;\nsampleCoordSW=vUV+vec2(-1.0,1.0)*texelSize;\ngl_Position=vec4(position,0.0,1.0);\n}";var h,a=(h=r.a,Object(n.d)(s,h),s.prototype._getDefines=function(){var e=this.getEngine();if(!e)return null;var t=e.getGlInfo();return t&&t.renderer&&-1<t.renderer.toLowerCase().indexOf("mali")?"#define MALI 1\n":null},s);function s(e,t,i,n,r,o,a){void 0===i&&(i=null),void 0===a&&(a=u.a.TEXTURETYPE_UNSIGNED_INT);var s=h.call(this,e,"fxaa",["texelSize"],null,t,i,n||l.a.BILINEAR_SAMPLINGMODE,r,o,null,a,"fxaa",void 0,!0)||this,c=s._getDefines();return s.updateEffect(c),s.onApplyObservable.add(function(e){var t=s.texelSize;e.setFloat2("texelSize",t.x,t.y)}),s}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(1),r=i(3),u=i(6),h=i(4),d=i(17),a=i(29),o=i(9),s=i(39),p=i(290),c=(i(176),i(200),"\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}");i(5).a.ShadersStore.proceduralVertexShader=c;var f,l=(f=o.a,Object(n.d)(m,f),m.prototype.getEffect=function(){return this._effect},m.prototype.getContent=function(){return this._contentData&&this._frameId===this._contentUpdateId||(this._contentData=this.readPixels(0,0,this._contentData),this._contentUpdateId=this._frameId),this._contentData},m.prototype._createIndexBuffer=function(){var e=this._fullEngine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},m.prototype._rebuild=function(){var e=this._vertexBuffers[h.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===s.a.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=s.a.REFRESHRATE_RENDER_ONCE)},m.prototype.reset=function(){void 0!==this._effect&&this._effect.dispose()},m.prototype._getDefines=function(){return""},m.prototype.isReady=function(){var e,t=this,i=this._fullEngine;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,[h.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())},m.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},m.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(m.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),m.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,this._frameId++,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},m.prototype.getRenderSize=function(){return this._size},m.prototype.resize=function(e,t){this._fallbackTextureUsed||(this.releaseInternalTexture(),this._texture=this._fullEngine.createRenderTargetTexture(e,t),this._size=e,this._generateMipMaps=t)},m.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},m.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},m.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},m.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},m.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},m.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},m.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},m.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},m.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}
1,m.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},m.prototype.render=function(e){var t=this.getScene();if(t){var i=this._fullEngine;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(a.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(a.a.TriangleFillMode,0,6);i.unBindFramebuffer(this._texture,this.isCube),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}}},m.prototype.clone=function(){var e=this.getSize(),t=new m(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,t},m.prototype.dispose=function(){var e,t,i=this.getScene();i&&(0<=(e=i.proceduralTextures.indexOf(this))&&i.proceduralTextures.splice(e,1),(t=this._vertexBuffers[h.b.PositionKind])&&(t.dispose(),this._vertexBuffers[h.b.PositionKind]=null),this._indexBuffer&&this._fullEngine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),f.prototype.dispose.call(this))},Object(n.c)([Object(r.c)()],m.prototype,"isEnabled",void 0),Object(n.c)([Object(r.c)()],m.prototype,"autoClear",void 0),Object(n.c)([Object(r.c)()],m.prototype,"_generateMipMaps",void 0),Object(n.c)([Object(r.c)()],m.prototype,"_size",void 0),Object(n.c)([Object(r.c)()],m.prototype,"refreshRate",null),m);function m(e,t,i,n,r,o,a){void 0===r&&(r=null),void 0===o&&(o=!0),void 0===a&&(a=!1);var s=f.call(this,null,n,!o)||this;s.isCube=a,s.isEnabled=!0,s.autoClear=!0,s.onGeneratedObservable=new u.c,s._textures={},s._currentRefreshId=-1,s._frameId=-1,s._refreshRate=1,s._vertexBuffers={},s._uniforms=new Array,s._samplers=new Array,s._floats={},s._ints={},s._floatsArrays={},s._colors3={},s._colors4={},s._vectors2={},s._vectors3={},s._matrices={},s._fallbackTextureUsed=!1,s._cachedDefines="",s._contentUpdateId=-1;var c=(n=s.getScene())._getComponent(d.a.NAME_PROCEDURALTEXTURE);c||(c=new p.a(n),n._addComponent(c)),n.proceduralTextures.push(s),s._fullEngine=n.getEngine(),s.name=e,s.isRenderTarget=!0,s._size=t,s._generateMipMaps=o,s.setFragment(i),s._fallbackTexture=r,a?(s._texture=s._fullEngine.createRenderTargetCubeTexture(t,{generateMipMaps:o,generateDepthBuffer:!1,generateStencilBuffer:!1}),s.setFloat("face",0)):s._texture=s._fullEngine.createRenderTargetTexture(t,{generateMipMaps:o,generateDepthBuffer:!1,generateStencilBuffer:!1});var l=[];return l.push(1,1),l.push(-1,1),l.push(-1,-1),l.push(1,-1),s._vertexBuffers[h.b.PositionKind]=new h.b(s._fullEngine,l,h.b.PositionKind,!1,!1,2),s._createIndexBuffer(),s}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.clone=function(){return new r(this.name,this.from,this.to)},r);function r(e,t,i){this.name=e,this.from=t,this.to=i}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(50),u=i(0),p=i(32),r=(c.prototype.reConstruct=function(e,t,i){var n=e.x,r=e.y,o=e.z,a=t.x,s=t.y,c=t.z,l=this.vectors;this.minimum.copyFromFloats(n,r,o),this.maximum.copyFromFloats(a,s,c),l[0].copyFromFloats(n,r,o),l[1].copyFromFloats(a,s,c),l[2].copyFromFloats(a,r,o),l[3].copyFromFloats(n,s,o),l[4].copyFromFloats(n,r,c),l[5].copyFromFloats(a,s,o),l[6].copyFromFloats(n,s,c),l[7].copyFromFloats(a,r,c),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=i||u.a.IdentityReadOnly,this._update(this._worldMatrix)},c.prototype.scale=function(e){var t=c.TmpVector3,i=this.maximum.subtractToRef(this.minimum,t[0]),n=i.length();i.normalizeFromLength(n);var r=n*e,o=i.scaleInPlace(.5*r),a=this.center.subtractToRef(o,t[1]),s=this.center.addToRef(o,t[2]);return this.reConstruct(a,s,this._worldMatrix),this},c.prototype.getWorldMatrix=function(){return this._worldMatrix},c.prototype._update=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=this.directions,r=this.vectorsWorld,o=this.vectors;if(e.isIdentity()){for(t.copyFrom(this.minimum),i.copyFrom(this.maximum),a=0;a<8;++a)r[a].copyFrom(o[a]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),i.setAll(-Number.MAX_VALUE);for(var a=0;a<8;++a){var s=r[a];u.e.TransformCoordinatesToRef(o[a],e,s),t.minimizeInPlace(s),i.maximizeInPlace(s)}i.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),i.addToRef(t,this.centerWorld).scaleInPlace(.5)}u.e.FromArrayToRef(e.m,0,n[0]),u.e.FromArrayToRef(e.m,4,n[1]),u.e.FromArrayToRef(e.m,8,n[2]),this._worldMatrix=e},c.prototype.isInFrustum=function(e){return c.IsInFrustum(this.vectorsWorld,e)},c.prototype.isCompletelyInFrustum=function(e){return c.IsCompletelyInFrustum(this.vectorsWorld,e)},c.prototype.intersectsPoint=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=t.x,r=t.y,o=t.z,a=i.x,s=i.y,c=i.z,l=e.x,u=e.y,h=e.z,d=-p.a;return!(a-l<d||l-n<d||s-u<d||u-r<d||c-h<d||h-o<d)},c.prototype.intersectsSphere=function(e){return c.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)},c.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,a=i.z,s=n.x,c=n.y,l=n.z,u=e.x,h=e.y,d=e.z,p=t.x,f=t.y,m=t.z;return!(s<u||p<r||c<h||f<o||l<d||m<a)},c.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},c.IntersectsSphere=function(e,t,i,n){var r=c.TmpVector3[0];return u.e.ClampToRef(i,e,t,r),u.e.DistanceSquared(i,r)<=n*n},c.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},c.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(0<=r.dotCoordinate(e[o])){n=!1;break}if(n)return!1}return!0},c.TmpVector3=n.a.BuildArray(3,u.e.Zero),c);function c(e,t,i){this.vectors=n.a.BuildArray(8,u.e.Zero),this.center=u.e.Zero(),this.centerWorld=u.e.Zero(),this.extendSize=u.e.Zero(),this.extendSizeWorld=u.e.Zero(),this.directions=n.a.BuildArray(3,u.e.Zero),this.vectorsWorld=n.a.BuildArray(8,u.e.Zero),this.minimumWorld=u.e.Zero(),this.maximumWorld=u.e.Zero(),this.minimum=u.e.Zero(),this.maximum=u.e.Zero(),this.reConstruct(e,t,i)}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(46),a=i(0),r=(o.prototype.startDirectionFunction=function(e,t,i,n){var r,o=a.c.Vector3[0];this.particleDestinationGenerator?(this.particleDestinationGenerator(-1,i,o),r=a.c.Vector3[1],o.subtractToRef(i.position,r),r.scaleToRef(1/i.lifeTime,o)):o.set(0,0,0),n?t.copyFrom(o):a.e.TransformNormalToRef(o,e,t)},o.prototype.startPositionFunction=function(e,t,i,n){var r=a.c.Vector3[0];this.particlePositionGenerator?this.particlePositionGenerator(-1,i,r):r.set(0,0,0),n?t.copyFrom(r):a.e.TransformCoordinatesToRef(r,e,t)},o.prototype.clone=function(){var e=new o;return n.a.DeepCopy(this,e),e},o.prototype.applyToShader=function(e){},o.prototype.getEffectDefines=function(){return"#define CUSTOMEMITTER"},o.prototype.getClassName=function(){return"CustomParticleEmitter"},o.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e},o.prototype.parse=function(e){},o);function o(){this.particlePositionGenerator=function(){},this.particleDestinationGenerator=function(){}}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.lightFragmentDeclaration="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};
1\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.lightUboDeclaration="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.imageProcessingDeclaration="#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.imageProcessingFunctions="#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x;\n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\n\n\n\n\n\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\n\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108,1.10813,-0.07276),\nvec3(-0.07367,-0.00605,1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\n\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\n\ncolor=saturate(color);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}
1\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.clipPlaneFragment="#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nif (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nif (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nif (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nif (fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nif (fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.clipPlaneVertex="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif"},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.copyFrom=function(e){var i=this;this.clear(),e.forEach(function(e,t){return i.add(e,t)})},r.prototype.get=function(e){var t=this._data[e];if(void 0!==t)return t},r.prototype.getOrAddWithFactory=function(e,t){var i=this.get(e);return void 0!==i||(i=t(e))&&this.add(e,i),i},r.prototype.getOrAdd=function(e,t){var i=this.get(e);return void 0!==i?i:(this.add(e,t),t)},r.prototype.contains=function(e){return void 0!==this._data[e]},r.prototype.add=function(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)},r.prototype.set=function(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)},r.prototype.getAndRemove=function(e){var t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null},r.prototype.remove=function(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)},r.prototype.clear=function(){this._data={},this._count=0},Object.defineProperty(r.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),r.prototype.forEach=function(e){for(var t in this._data)e(t,this._data[t])},r.prototype.first=function(e){for(var t in this._data){var i=e(t,this._data[t]);if(i)return i}return null},r);function r(){this._count=0,this._data={}}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(50),r=i(0),o=(a.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=r.e.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.a.IdentityReadOnly)},a.prototype.scale=function(e){var t=this.radius*e,i=a.TmpVector3,n=i[0].setAll(t),r=this.center.subtractToRef(n,i[1]),o=this.center.addToRef(n,i[2]);return this.reConstruct(r,o,this._worldMatrix),this},a.prototype.getWorldMatrix=function(){return this._worldMatrix},a.prototype._update=function(e){var t;e.isIdentity()?(this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius):(r.e.TransformCoordinatesToRef(this.center,e,this.centerWorld),t=a.TmpVector3[0],r.e.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius)},a.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},a.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},a.prototype.intersectsPoint=function(e){var t=r.e.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorld<t)},a.Intersects=function(e,t){var i=r.e.DistanceSquared(e.centerWorld,t.centerWorld),n=e.radiusWorld+t.radiusWorld;return!(n*n<i)},a.TmpVector3=n.a.BuildArray(3,r.e.Zero),a);function a(e,t,i){this.center=r.e.Zero(),this.centerWorld=r.e.Zero(),this.minimum=r.e.Zero(),this.maximum=r.e.Zero(),this.reConstruct(e,t,i)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=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 a});var c,n=i(1),d=i(0),r=i(50),o=i(30),u=i(24),a=(c=o.a,Object(n.d)(p,c),Object.defineProperty(p.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._localMatrix.copyFrom(e),this._needToDecompose=!0}
1,enumerable:!1,configurable:!0}),p.prototype.getClassName=function(){return"Bone"},p.prototype.getSkeleton=function(){return this._skeleton},p.prototype.getParent=function(){return this._parent},p.prototype.getChildren=function(){return this.children},p.prototype.getIndex=function(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index},p.prototype.setParent=function(e,t){var i;void 0===t&&(t=!0),this._parent!==e&&(!this._parent||-1!==(i=this._parent.children.indexOf(this))&&this._parent.children.splice(i,1),this._parent=e,this._parent&&this._parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty())},p.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},p.prototype.getBaseMatrix=function(){return this._baseMatrix},p.prototype.getRestPose=function(){return this._restPose},p.prototype.getWorldMatrix=function(){return this._worldTransform},p.prototype.returnToRest=function(){this.updateMatrix(this._restPose.clone())},p.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},p.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},p.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},p.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(p.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!1,configurable:!0}),p.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=d.e.Zero(),this._localRotation=d.b.Zero(),this._localPosition=d.e.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},p.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,d.a.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},p.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()},p.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<this.children.length;i++)this.children[i]._updateDifferenceMatrix();this._scalingDeterminant=this._absoluteTransform.determinant()<0?-1:1},p.prototype.markAsDirty=function(){this._currentRenderId++,this._childUpdateId++,this._skeleton._markAsDirty()},p.prototype._markAsDirtyAndCompose=function(){this.markAsDirty(),this._needToCompose=!0},p.prototype._markAsDirtyAndDecompose=function(){this.markAsDirty(),this._needToDecompose=!0},p.prototype.translate=function(e,t,i){void 0===t&&(t=u.b.LOCAL);var n,r,o,a=this.getLocalMatrix();t==u.b.LOCAL?(a.addAtIndex(12,e.x),a.addAtIndex(13,e.y),a.addAtIndex(14,e.z)):(n=null,i&&(n=i.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms(),r=p._tmpMats[0],o=p._tmpVecs[0],this._parent?i&&n?(r.copyFrom(this._parent.getAbsoluteTransform()),r.multiplyToRef(n,r)):r.copyFrom(this._parent.getAbsoluteTransform()):d.a.IdentityToRef(r),r.setTranslationFromFloats(0,0,0),r.invert(),d.e.TransformCoordinatesToRef(e,r,o),a.addAtIndex(12,o.x),a.addAtIndex(13,o.y),a.addAtIndex(14,o.z)),this._markAsDirtyAndDecompose()},p.prototype.setPosition=function(e,t,i){void 0===t&&(t=u.b.LOCAL);var n,r,o,a=this.getLocalMatrix();t==u.b.LOCAL?a.setTranslationFromFloats(e.x,e.y,e.z):(n=null,i&&(n=i.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms(),r=p._tmpMats[0],o=p._tmpVecs[0],this._parent?(i&&n?(r.copyFrom(this._parent.getAbsoluteTransform()),r.multiplyToRef(n,r)):r.copyFrom(this._parent.getAbsoluteTransform()),r.invert()):d.a.IdentityToRef(r),d.e.TransformCoordinatesToRef(e,r,o),a.setTranslationFromFloats(o.x,o.y,o.z)),this._markAsDirtyAndDecompose()},p.prototype.setAbsolutePosition=function(e,t){this.setPosition(e,u.b.WORLD,t)},p.prototype.scale=function(e,t,i,n){void 0===n&&(n=!1);var r=this.getLocalMatrix(),o=p._tmpMats[0];d.a.ScalingToRef(e,t,i,o),o.multiplyToRef(r,r),o.invert();for(var a,s=0,c=this.children;s<c.length;s++){var l=(a=c[s]).getLocalMatrix();l.multiplyToRef(o,l),l.multiplyAtIndex(12,e),l.multiplyAtIndex(13,t),l.multiplyAtIndex(14,i),a._markAsDirtyAndDecompose()}if(this._markAsDirtyAndDecompose(),n)for(var u=0,h=this.children;u<h.length;u++)(a=h[u]).scale(e,t,i,n)},p.prototype.setScale=function(e){this._decompose(),this._localScaling.copyFrom(e),this._markAsDirtyAndCompose()},p.prototype.getScale=function(){return this._decompose(),this._localScaling},p.prototype.getScaleToRef=function(e){this._decompose(),e.copyFrom(this._localScaling)},p.prototype.setYawPitchRoll=function(e,t,i,n,r){if(void 0===n&&(n=u.b.LOCAL),n===u.b.LOCAL){var o=p._tmpQuat;return d.b.RotationYawPitchRollToRef(e,t,i,o),void this.setRotationQuaternion(o,n,r)}var a,s=p._tmpMats[0];this._getNegativeRotationToRef(s,r)&&(a=p._tmpMats[1],d.a.RotationYawPitchRollToRef(e,t,i,a),s.multiplyToRef(a,a),this._rotateWithMatrix(a,n,r))},p.prototype.rotate=function(e,t,i,n){void 0===i&&(i=u.b.LOCAL);var r=p._tmpMats[0];r.setTranslationFromFloats(0,0,0),d.a.RotationAxisToRef(e,t,r),this._rotateWithMatrix(r,i,n)},p.prototype.setAxisAngle=function(e,t,i,n){if(void 0===i&&(i=u.b.LOCAL),i===u.b.LOCAL){var r=p._tmpQuat;return d.b.RotationAxisToRef(e,t,r),void this.setRotationQuaternion(r,i,n)}var o,a=p._tmpMats[0];this._getNegativeRotationToRef(a,n)&&(o=p._tmpMats[1],d.a.RotationAxisToRef(e,t,o),a.multiplyToRef(o,o),this._rotateWithMatrix(o,i,n)
1)},p.prototype.setRotation=function(e,t,i){void 0===t&&(t=u.b.LOCAL),this.setYawPitchRoll(e.y,e.x,e.z,t,i)},p.prototype.setRotationQuaternion=function(e,t,i){if(void 0===t&&(t=u.b.LOCAL),t===u.b.LOCAL)return this._decompose(),this._localRotation.copyFrom(e),void this._markAsDirtyAndCompose();var n,r=p._tmpMats[0];this._getNegativeRotationToRef(r,i)&&(n=p._tmpMats[1],d.a.FromQuaternionToRef(e,n),r.multiplyToRef(n,n),this._rotateWithMatrix(n,t,i))},p.prototype.setRotationMatrix=function(e,t,i){if(void 0===t&&(t=u.b.LOCAL),t===u.b.LOCAL){var n=p._tmpQuat;return d.b.FromRotationMatrixToRef(e,n),void this.setRotationQuaternion(n,t,i)}var r,o=p._tmpMats[0];this._getNegativeRotationToRef(o,i)&&((r=p._tmpMats[1]).copyFrom(e),o.multiplyToRef(e,r),this._rotateWithMatrix(r,t,i))},p.prototype._rotateWithMatrix=function(e,t,i){void 0===t&&(t=u.b.LOCAL);var n=this.getLocalMatrix(),r=n.m[12],o=n.m[13],a=n.m[14],s=this.getParent(),c=p._tmpMats[3],l=p._tmpMats[4];s&&t==u.b.WORLD?(i?(c.copyFrom(i.getWorldMatrix()),s.getAbsoluteTransform().multiplyToRef(c,c)):c.copyFrom(s.getAbsoluteTransform()),l.copyFrom(c),l.invert(),n.multiplyToRef(c,n),n.multiplyToRef(e,n),n.multiplyToRef(l,n)):t==u.b.WORLD&&i?(c.copyFrom(i.getWorldMatrix()),l.copyFrom(c),l.invert(),n.multiplyToRef(c,n),n.multiplyToRef(e,n),n.multiplyToRef(l,n)):n.multiplyToRef(e,n),n.setTranslationFromFloats(r,o,a),this.computeAbsoluteTransforms(),this._markAsDirtyAndDecompose()},p.prototype._getNegativeRotationToRef=function(e,t){var i=p._tmpMats[2];return e.copyFrom(this.getAbsoluteTransform()),t&&(e.multiplyToRef(t.getWorldMatrix(),e),d.a.ScalingToRef(t.scaling.x,t.scaling.y,t.scaling.z,i)),e.invert(),!isNaN(e.m[0])&&(i.multiplyAtIndex(0,this._scalingDeterminant),e.multiplyToRef(i,e),!0)},p.prototype.getPosition=function(e,t){void 0===e&&(e=u.b.LOCAL),void 0===t&&(t=null);var i=d.e.Zero();return this.getPositionToRef(e,t,i),i},p.prototype.getPositionToRef=function(e,t,i){var n,r,o;void 0===e&&(e=u.b.LOCAL),e==u.b.LOCAL?(n=this.getLocalMatrix(),i.x=n.m[12],i.y=n.m[13],i.z=n.m[14]):(r=null,t&&(r=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms(),o=p._tmpMats[0],t&&r?(o.copyFrom(this.getAbsoluteTransform()),o.multiplyToRef(r,o)):o=this.getAbsoluteTransform(),i.x=o.m[12],i.y=o.m[13],i.z=o.m[14])},p.prototype.getAbsolutePosition=function(e){void 0===e&&(e=null);var t=d.e.Zero();return this.getPositionToRef(u.b.WORLD,e,t),t},p.prototype.getAbsolutePositionToRef=function(e,t){this.getPositionToRef(u.b.WORLD,e,t)},p.prototype.computeAbsoluteTransforms=function(){var e;this._compose(),this._parent?this._localMatrix.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform):(this._absoluteTransform.copyFrom(this._localMatrix),(e=this._skeleton.getPoseMatrix())&&this._absoluteTransform.multiplyToRef(e,this._absoluteTransform));for(var t=this.children,i=t.length,n=0;n<i;n++)t[n].computeAbsoluteTransforms()},p.prototype.getDirection=function(e,t){void 0===t&&(t=null);var i=d.e.Zero();return this.getDirectionToRef(e,t,i),i},p.prototype.getDirectionToRef=function(e,t,i){void 0===t&&(t=null);var n=null;t&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var r=p._tmpMats[0];r.copyFrom(this.getAbsoluteTransform()),t&&n&&r.multiplyToRef(n,r),d.e.TransformNormalToRef(e,r,i),i.normalize()},p.prototype.getRotation=function(e,t){void 0===e&&(e=u.b.LOCAL),void 0===t&&(t=null);var i=d.e.Zero();return this.getRotationToRef(e,t,i),i},p.prototype.getRotationToRef=function(e,t,i){void 0===e&&(e=u.b.LOCAL),void 0===t&&(t=null);var n=p._tmpQuat;this.getRotationQuaternionToRef(e,t,n),n.toEulerAnglesToRef(i)},p.prototype.getRotationQuaternion=function(e,t){void 0===e&&(e=u.b.LOCAL),void 0===t&&(t=null);var i=d.b.Identity();return this.getRotationQuaternionToRef(e,t,i),i},p.prototype.getRotationQuaternionToRef=function(e,t,i){var n,r;void 0===e&&(e=u.b.LOCAL),void 0===t&&(t=null),e==u.b.LOCAL?(this._decompose(),i.copyFrom(this._localRotation)):(n=p._tmpMats[0],r=this.getAbsoluteTransform(),t?r.multiplyToRef(t.getWorldMatrix(),n):n.copyFrom(r),n.multiplyAtIndex(0,this._scalingDeterminant),n.multiplyAtIndex(1,this._scalingDeterminant),n.multiplyAtIndex(2,this._scalingDeterminant),n.decompose(void 0,i,void 0))},p.prototype.getRotationMatrix=function(e,t){void 0===e&&(e=u.b.LOCAL);var i=d.a.Identity();return this.getRotationMatrixToRef(e,t,i),i},p.prototype.getRotationMatrixToRef=function(e,t,i){var n,r;void 0===e&&(e=u.b.LOCAL),e==u.b.LOCAL?this.getLocalMatrix().getRotationMatrixToRef(i):(n=p._tmpMats[0],r=this.getAbsoluteTransform(),t?r.multiplyToRef(t.getWorldMatrix(),n):n.copyFrom(r),n.multiplyAtIndex(0,this._scalingDeterminant),n.multiplyAtIndex(1,this._scalingDeterminant),n.multiplyAtIndex(2,this._scalingDeterminant),n.getRotationMatrixToRef(i))},p.prototype.getAbsolutePositionFromLocal=function(e,t){void 0===t&&(t=null);var i=d.e.Zero();return this.getAbsolutePositionFromLocalToRef(e,t,i),i},p.prototype.getAbsolutePositionFromLocalToRef=function(e,t,i){void 0===t&&(t=null);var n=null;t&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var r=p._tmpMats[0];t&&n?(r.copyFrom(this.getAbsoluteTransform()),r.multiplyToRef(n,r)):r=this.getAbsoluteTransform(),d.e.TransformCoordinatesToRef(e,r,i)},p.prototype.getLocalPositionFromAbsolute=function(e,t){void 0===t&&(t=null);var i=d.e.Zero();return this.getLocalPositionFromAbsoluteToRef(e,t,i),i},p.prototype.getLocalPositionFromAbsoluteToRef=function(e,t,i){void 0===t&&(t=null);var n=null;t&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var r=p._tmpMats[0];r.copyFrom(this.getAbsoluteTransform()),t&&n&&r.multiplyToRef(n,r),r.invert(),d.e.TransformCoordinatesToRef(e,r,i)},p._tmpVecs=r.a.BuildArray(2,d.e.Zero),p._tmpQuat=d.b.Identity(),p._tmpMats=r.a.BuildArray(5,d.a.Identity),p);function p(e,t,i,n,r,o,a){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null);var s=c.call(this,e,t.getScene())||this;return s.name=e,s.children=new Array,s.animations=new Array,s._index=null,s._absoluteTransform=new d.a,s._invertedAbsoluteTransform=new d.a,s._scalingDeterminant=1,s._worldTransform=new d.a,s._needToDecompose=!0,s._needToCompose=!1,s._linkedTransformNode=null,s._waitingTransformNodeId=null,s._skeleton=t,s._localMatrix=n?n.clone():d.a.Identity(),s._restPose=r||s._localMatrix.clone(),s._baseMatrix=o||s._localMatrix.clone(),s._index=a,t.bone
1s.push(s),s.setParent(i,!1),(o||n)&&s._updateDifferenceMatrix(),s}},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return r}),i.d(t,"c",function(){return h});var n,r,o,a,s=i(1),c=i(6),l=i(57);(a=n=n||{})[a.A=0]="A",a[a.B=1]="B",a[a.X=2]="X",a[a.Y=3]="Y",a[a.LB=4]="LB",a[a.RB=5]="RB",a[a.Back=8]="Back",a[a.Start=9]="Start",a[a.LeftStick=10]="LeftStick",a[a.RightStick=11]="RightStick",(o=r=r||{})[o.Up=12]="Up",o[o.Down=13]="Down",o[o.Left=14]="Left",o[o.Right=15]="Right";var u,h=(u=l.a,Object(s.d)(d,u),d.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},d.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(d.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),d.prototype.onbuttondown=function(e){this._onbuttondown=e},d.prototype.onbuttonup=function(e){this._onbuttonup=e},d.prototype.ondpaddown=function(e){this._ondpaddown=e},d.prototype.ondpadup=function(e){this._ondpadup=e},d.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},d.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(d.prototype,"buttonA",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,n.A)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonB",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,n.B)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonX",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,n.X)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonY",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,n.Y)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonStart",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,n.Start)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonBack",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,n.Back)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonLB",{get:function(){return this._buttonLB},set:function(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,n.LB)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonRB",{get:function(){return this._buttonRB},set:function(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,n.RB)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,n.LeftStick)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,n.RightStick)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,r.Up)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadDown",{get:function(){return this._dPadDown}
1,set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,r.Down)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,r.Left)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,r.Right)},enumerable:!1,configurable:!0}),d.prototype.update=function(){u.prototype.update.call(this),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},d.prototype.dispose=function(){u.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},d);function d(e,t,i,n){void 0===n&&(n=!1);var r=u.call(this,e,t,i,0,1,2,3)||this;return r._leftTrigger=0,r._rightTrigger=0,r.onButtonDownObservable=new c.c,r.onButtonUpObservable=new c.c,r.onPadDownObservable=new c.c,r.onPadUpObservable=new c.c,r._buttonA=0,r._buttonB=0,r._buttonX=0,r._buttonY=0,r._buttonBack=0,r._buttonStart=0,r._buttonLB=0,r._buttonRB=0,r._buttonLeftStick=0,r._buttonRightStick=0,r._dPadUp=0,r._dPadDown=0,r._dPadLeft=0,r._dPadRight=0,r._isXboxOnePad=!1,r.type=l.a.XBOX,r._isXboxOnePad=n,r}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var I=i(0),D=i(10),r=i(8),L=i(16);L.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,
10,-.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,o=(!e.type||!(e.type<0||e.type>=t.length))&&e.type||0,a=e.size,s=e.sizeX||a||1,c=e.sizeY||a||1,l=e.sizeZ||a||1,u=e.custom||t[o],h=u.face.length,d=e.faceUV||new Array(h),p=e.faceColors,f=void 0===e.flat||e.flat,m=0===e.sideOrientation?0:e.sideOrientation||L.a.DEFAULTSIDE,_=new Array,g=new Array,v=new Array,b=new Array,y=new Array,T=0,E=0,S=new Array,A=0,C=0;if(f)for(C=0;C<h;C++)p&&void 0===p[C]&&(p[C]=new D.b(1,1,1,1)),d&&void 0===d[C]&&(d[C]=new I.f(0,0,1,1));if(f)for(C=0;C<h;C++){for(var P=u.face[C].length,x=2*Math.PI/P,R=.5*Math.tan(x/2),O=.5,A=0;A<P;A++)_.push(u.vertex[u.face[C][A]][0]*s,u.vertex[u.face[C][A]][1]*c,u.vertex[u.face[C][A]][2]*l),S.push(T),T++,i=d[C].x+(d[C].z-d[C].x)*(.5+R),n=d[C].y+(d[C].w-d[C].y)*(O-.5),b.push(i,n),r=R*Math.cos(x)-O*Math.sin(x),O=R*Math.sin(x)+O*Math.cos(x),R=r,p&&y.push(p[C].r,p[C].g,p[C].b,p[C].a);for(A=0;A<P-2;A++)g.push(S[0+E],S[A+2+E],S[A+1+E]);E+=P}else{for(A=0;A<u.vertex.length;A++)_.push(u.vertex[A][0]*s,u.vertex[A][1]*c,u.vertex[A][2]*l),b.push(0,0);for(C=0;C<h;C++)for(A=0;A<u.face[C].length-2;A++)g.push(u.face[C][0],u.face[C][A+2],u.face[C][A+1])}L.a.ComputeNormals(_,g,v),L.a._ComputeSides(m,_,g,v,b,e.frontUVs,e.backUVs);var M=new L.a;return M.positions=_,M.indices=g,M.normals=v,M.uvs=b,p&&f&&(M.colors=y),M},r.a.CreatePolyhedron=function(e,t,i){return n.CreatePolyhedron(e,t,i)};var n=(o.CreatePolyhedron=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,L.a.CreatePolyhedron(t).applyToMesh(n,t.updatable),n},o);function o(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n,r=i(1),o=i(3),a=i(150),s=i(10),c=i(65),l=i(11),u=(n=c.a,Object(r.d)(h,n),Object.defineProperty(h.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){(this.subSurface.refractionTexture=e)?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"indexOfRefraction",{get:function(){return this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){(this.subSurface.linkRefractionWithTransparency=e)&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===c.a.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?c.a.LIGHTFALLOFF_PHYSICAL:c.a.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===c.a.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?c.a.LIGHTFALLOFF_GLTF:c.a.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),h.prototype.getClassName=function(){return"PBRMaterial"},h.prototype.clone=function(e){var t=this,i=o.a.Clone(function(){return new h(e,t.getScene())},this);return i.id=e,i.name=e,this.clearCoat.copyTo(i.clearCoat),this.anisotropy.copyTo(i.anisotropy),this.brdf.copyTo(i.brdf),this.sheen.copyTo(i.sheen),this.subSurface.copyTo(i.subSurface),i},h.prototype.serialize=function(){var e=o.a.Serialize(this);return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},h.Parse=function(e,t,i){var n=o.a.Parse(function(){return new h(e.name,t)},e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),n},h.PBRMATERIAL_OPAQUE=c.a.PBRMATERIAL_OPAQUE,h.PBRMATERIAL_ALPHATEST=c.a.PBRMATERIAL_ALPHATEST,h.PBRMATERIAL_ALPHABLEND=c.a.PBRMATERIAL_ALPHABLEND,h.PBRMATERIAL_ALPHATESTANDBLEND=c.a.PBRMATERIAL_ALPHATESTANDBLEND,h.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=c.a.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,Object(r.c)([Object(o.c)(),Ob
1ject(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"directIntensity",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"emissiveIntensity",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"environmentIntensity",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"specularIntensity",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"disableBumpMap",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"albedoTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"ambientTexture",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"ambientTextureStrength",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],h.prototype,"opacityTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"reflectionTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"emissiveTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"reflectivityTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"metallicTexture",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"metallic",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"roughness",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"metallicF0Factor",void 0),Object(r.c)([Object(o.e)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"metallicReflectanceColor",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"metallicReflectanceTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"microSurfaceTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"bumpTexture",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty",null)],h.prototype,"lightmapTexture",void 0),Object(r.c)([Object(o.e)("ambient"),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"ambientColor",void 0),Object(r.c)([Object(o.e)("albedo"),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"albedoColor",void 0),Object(r.c)([Object(o.e)("reflectivity"),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"reflectivityColor",void 0),Object(r.c)([Object(o.e)("reflection"),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"reflectionColor",void 0),Object(r.c)([Object(o.e)("emissive"),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"emissiveColor",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"microSurface",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useLightmapAsShadowmap",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],h.prototype,"useAlphaFromAlbedoTexture",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],h.prototype,"forceAlphaTest",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],h.prototype,"alphaCutOff",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useSpecularOverAlpha",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),Object(r.c)([Object(o.c)(),Ob
1ject(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useRoughnessFromMetallicTextureGreen",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useMetallnessFromMetallicTextureBlue",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useAmbientInGrayScale",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),Object(r.c)([Object(o.c)()],h.prototype,"usePhysicalLightFalloff",null),Object(r.c)([Object(o.c)()],h.prototype,"useGLTFLightFalloff",null),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useRadianceOverAlpha",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useObjectSpaceNormalMap",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useParallax",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useParallaxOcclusion",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"parallaxScaleBias",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsLightsDirty")],h.prototype,"disableLighting",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"forceIrradianceInFragment",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsLightsDirty")],h.prototype,"maxSimultaneousLights",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"invertNormalMapX",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"invertNormalMapY",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"twoSidedLighting",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useAlphaFresnel",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useLinearAlphaFresnel",void 0),Object(r.c)([Object(o.m)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"environmentBRDFTexture",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"forceNormalForward",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"enableSpecularAntiAliasing",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useHorizonOcclusion",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"useRadianceOcclusion",void 0),Object(r.c)([Object(o.c)(),Object(o.b)("_markAllSubMeshesAsMiscDirty")],h.prototype,"unlit",void 0),h);function h(e,t){var i=n.call(this,e,t)||this;return i.directIntensity=1,i.emissiveIntensity=1,i.environmentIntensity=1,i.specularIntensity=1,i.disableBumpMap=!1,i.ambientTextureStrength=1,i.ambientTextureImpactOnAnalyticalLights=h.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,i.metallicF0Factor=1,i.metallicReflectanceColor=s.a.White(),i.ambientColor=new s.a(0,0,0),i.albedoColor=new s.a(1,1,1),i.reflectivityColor=new s.a(1,1,1),i.reflectionColor=new s.a(1,1,1),i.emissiveColor=new s.a(0,0,0),i.microSurface=1,i.useLightmapAsShadowmap=!1,i.useAlphaFromAlbedoTexture=!1,i.forceAlphaTest=!1,i.alphaCutOff=.4,i.useSpecularOverAlpha=!0,i.useMicroSurfaceFromReflectivityMapAlpha=!1,i.useRoughnessFromMetallicTextureAlpha=!0,i.useRoughnessFromMetallicTextureGreen=!1,i.useMetallnessFromMetallicTextureBlue=!1,i.useAmbientOcclusionFromMetallicTextureRed=!1,i.useAmbientInGrayScale=!1,i.useAutoMicroSurfaceFromReflectivityMap=!1,i.useRadianceOverAlpha=!0,i.useObjectSpaceNormalMap=!1,i.useParallax=!1,i.useParallaxOcclusion=!1,i.parallaxScaleBias=.05,i.disableLighting=!1,i.forceIrradianceInFragment=!1,i.maxSimultaneousLights=4,i.invertNormalMapX=!1,i.invertNormalMapY=!1,i.twoSidedLighting=!1,i.useAlphaFresnel=!1,i.useLinearAlphaFresnel=!1,i.environmentBRDFTexture=null,i.forceNormalForward=!1,i.enableSpecularAntiAliasing=!1,i.useHorizonOcclusion=!0,i.useRadianceOcclusion=!0,i.unlit=!1,i._environmentBRDFTexture=a.a.GetEnvironmentBRDFTexture(t),i}l.a.RegisteredTypes["BABYLON.PBRMaterial"]=u},function(e,t,i){"use strict";i.d(t,"a",function(){return p});var x=i(0),R=i(8),S=i(112),A=i(97);R.a.ExtrudeShape=function(e,t,i,n,r,o,a,s,c,l){void 0===a&&(a=null);var u={shape:t,path:i,scale:n,rotation:r,cap:0===o?0:o||R.a.NO_CAP,sideOrientation:c,instance:l,updatable:s};return p.ExtrudeShape(e,u,a)},R.a.ExtrudeShapeCustom=function(e,t,i,n,r,o,a,s,c,l,u,h){var d={shape:t,path:i,scaleFunction:n,rotationFunction:r,ribbonCloseArray:o,ribbonClosePath:a,cap:0===s?0:s||R.a.NO_CAP,sideOrientation:u,instance:h,updatable:l};return p.ExtrudeShapeCustom(e,d,c)};var p=(f.ExtrudeShape=function(e,t,i){void 0===i&&(i=null);var n=t.path,r=t.shape,o=t.scale||1,a=t.rotation||0,s=0===t.cap?0:t.cap||R.a.NO_CAP,c=t.updatable,l=R.a._GetDefaultSideOrientation(t.sideOrientation),u=t.instance||null,h=t.invertUV||!1;
1return f._ExtrudeShapeGeneric(e,r,n,o,a,null,null,!1,!1,s,!1,i,!!c,l,u,h,t.frontUVs||null,t.backUVs||null)},f.ExtrudeShapeCustom=function(e,t,i){void 0===i&&(i=null);var n=t.path,r=t.shape,o=t.scaleFunction||function(){return 1},a=t.rotationFunction||function(){return 0},s=t.ribbonCloseArray||!1,c=t.ribbonClosePath||!1,l=0===t.cap?0:t.cap||R.a.NO_CAP,u=t.updatable,h=R.a._GetDefaultSideOrientation(t.sideOrientation),d=t.instance,p=t.invertUV||!1;return f._ExtrudeShapeGeneric(e,r,n,null,null,o,a,s,c,l,!0,i,!!u,h,d||null,p,t.frontUVs||null,t.backUVs||null)},f._ExtrudeShapeGeneric=function(e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m,_,g){function v(e,t,i,n,r,o,a,s,c,l){for(var u=i.getTangents(),h=i.getNormals(),d=i.getBinormals(),p=i.getDistances(),f=0,m=l&&s?s:function(){return null!==o?o:0},_=l&&a?a:function(){return null!==r?r:1},g=c===R.a.NO_CAP||c===R.a.CAP_END?0:2,v=x.c.Matrix[0],b=0;b<t.length;b++){for(var y=new Array,T=m(b,p[b]),E=_(b,p[b]),S=0;S<e.length;S++){x.a.RotationAxisToRef(u[b],f,v);var A=u[b].scale(e[S].z).add(h[b].scale(e[S].x)).add(d[b].scale(e[S].y)),C=y[S]?y[S]:x.e.Zero();x.e.TransformCoordinatesToRef(A,v,C),C.scaleInPlace(E).addInPlace(t[b]),y[S]=C}n[g]=y,f+=T,g++}function P(e){for(var t=Array(),i=x.e.Zero(),n=0;n<e.length;n++)i.addInPlace(e[n]);for(i.scaleInPlace(1/e.length),n=0;n<e.length;n++)t.push(i);return t}switch(c){case R.a.NO_CAP:break;case R.a.CAP_START:n[0]=P(n[2]),n[1]=n[2];break;case R.a.CAP_END:n[g]=n[g-1],n[g+1]=P(n[g-1]);break;case R.a.CAP_ALL:n[0]=P(n[2]),n[1]=n[2],n[g]=n[g-1],n[g+1]=P(n[g-1])}return n}if(f){var b=f._creationDataStorage,y=b.path3D.update(i),T=v(t,i,b.path3D,b.pathArray,n,r,o,a,b.cap,u);return R.a.CreateRibbon("",T,!1,!1,0,h||void 0,!1,0,f)}T=v(t,i,y=new A.g(i),new Array,n,r,o,a,l=l<0||3<l?0:l,u);var E=S.a.CreateRibbon(e,{pathArray:T,closeArray:s,closePath:c,updatable:d,sideOrientation:p,invertUV:m,frontUVs:_||void 0,backUVs:g||void 0},h);return E._creationDataStorage.pathArray=T,E._creationDataStorage.path3D=y,E._creationDataStorage.cap=l,E},f);function f(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var S=i(7),n=(A.GetTGAHeader=function(e){var t=0;return{id_length:e[t++],colormap_type:e[t++],image_type:e[t++],colormap_index:e[t++]|e[t++]<<8,colormap_length:e[t++]|e[t++]<<8,colormap_size:e[t++],origin:[e[t++]|e[t++]<<8,e[t++]|e[t++]<<8],width:e[t++]|e[t++]<<8,height:e[t++]|e[t++]<<8,pixel_size:e[t++],flags:e[t++]}},A.UploadContent=function(e,t){if(t.length<19)S.a.Error("Unable to load TGA file - Not enough data to contain header");else{var i=18,n=A.GetTGAHeader(t);if(n.id_length+i>t.length)S.a.Error("Unable to load TGA file - Not enough data");else{i+=n.id_length;var r=!1,o=!1,a=!1;switch(n.image_type){case A._TYPE_RLE_INDEXED:r=!0;case A._TYPE_INDEXED:o=!0;break;case A._TYPE_RLE_RGB:r=!0;case A._TYPE_RGB:break;case A._TYPE_RLE_GREY:r=!0;case A._TYPE_GREY:a=!0}var s,c,l,u,h,d,p,f=n.pixel_size>>3,m=n.width*n.height*f;if(o&&(s=t.subarray(i,i+=n.colormap_length*(n.colormap_size>>
13))),r)for(var _,g,v,b=new Uint8Array(m),y=0,T=new Uint8Array(f);i<m&&y<m;)if(g=1+(127&(_=t[i++])),128&_){for(v=0;v<f;++v)T[v]=t[i++];for(v=0;v<g;++v)b.set(T,y+v*f);y+=f*g}else{for(g*=f,v=0;v<g;++v)b[y+v]=t[i++];y+=g}else b=t.subarray(i,i+=o?n.width*n.height:m);switch((n.flags&A._ORIGIN_MASK)>>A._ORIGIN_SHIFT){default:case A._ORIGIN_UL:c=0,u=1,p=n.width,l=0,h=1,d=n.height;break;case A._ORIGIN_BL:c=0,u=1,p=n.width,l=n.height-1,d=h=-1;break;case A._ORIGIN_UR:c=n.width-1,p=u=-1,l=0,h=1,d=n.height;break;case A._ORIGIN_BR:c=n.width-1,p=u=-1,l=n.height-1,d=h=-1}var E=A["_getImageData"+(a?"Grey":"")+n.pixel_size+"bits"](n,s,b,l,h,d,c,u,p);e.getEngine()._uploadDataToTextureDirectly(e,E)}}},A._getImageData8bits=function(e,t,i,n,r,o,a,s,c){for(var l,u,h=i,d=t,p=e.width,f=e.height,m=0,_=new Uint8Array(p*f*4),g=n;g!==o;g+=r)for(u=a;u!==c;u+=s,m++)l=h[m],_[4*(u+p*g)+3]=255,_[4*(u+p*g)+2]=d[3*l+0],_[4*(u+p*g)+1]=d[3*l+1],_[4*(u+p*g)+0]=d[3*l+2];return _},A._getImageData16bits=function(e,t,i,n,r,o,a,s,c){for(var l,u,h=i,d=e.width,p=e.height,f=0,m=new Uint8Array(d*p*4),_=n;_!==o;_+=r)for(u=a;u!==c;u+=s,f+=2){var g=255*((31744&(l=h[f+0]+(h[f+1]<<8)))>>10)/31|0,v=255*((992&l)>>5)/31|0,b=255*(31&l)/31|0;m[4*(u+d*_)+0]=g,m[4*(u+d*_)+1]=v,m[4*(u+d*_)+2]=b,m[4*(u+d*_)+3]=32768&l?0:255}return m},A._getImageData24bits=function(e,t,i,n,r,o,a,s,c){for(var l,u=i,h=e.width,d=e.height,p=0,f=new Uint8Array(h*d*4),m=n;m!==o;m+=r)for(l=a;l!==c;l+=s,p+=3)f[4*(l+h*m)+3]=255,f[4*(l+h*m)+2]=u[p+0],f[4*(l+h*m)+1]=u[p+1],f[4*(l+h*m)+0]=u[p+2];return f},A._getImageData32bits=function(e,t,i,n,r,o,a,s,c){for(var l,u=i,h=e.width,d=e.height,p=0,f=new Uint8Array(h*d*4),m=n;m!==o;m+=r)for(l=a;l!==c;l+=s,p+=4)f[4*(l+h*m)+2]=u[p+0],f[4*(l+h*m)+1]=u[p+1],f[4*(l+h*m)+0]=u[p+2],f[4*(l+h*m)+3]=u[p+3];return f},A._getImageDataGrey8bits=function(e,t,i,n,r,o,a,s,c){for(var l,u,h=i,d=e.width,p=e.height,f=0,m=new Uint8Array(d*p*4),_=n;_!==o;_+=r)for(u=a;u!==c;u+=s,f++)l=h[f],m[4*(u+d*_)+0]=l,m[4*(u+d*_)+1]=l,m[4*(u+d*_)+2]=l,m[4*(u+d*_)+3]=255;return m},A._getImageDataGrey16bits=function(e,t,i,n,r,o,a,s,c){for(var l,u=i,h=e.width,d=e.height,p=0,f=new Uint8Array(h*d*4),m=n;m!==o;m+=r)for(l=a;l!==c;l+=s,p+=2)f[4*(l+h*m)+0]=u[p+0],f[4*(l+h*m)+1]=u[p+0],f[4*(l+h*m)+2]=u[p+0],f[4*(l+h*m)+3]=u[p+1];return f},A._TYPE_INDEXED=1,A._TYPE_RGB=2,A._TYPE_GREY=3,A._TYPE_RLE_INDEXED=9,A._TYPE_RLE_RGB=10,A._TYPE_RLE_GREY=11,A._ORIGIN_MASK=48,A._ORIGIN_SHIFT=4,A._ORIGIN_BL=0,A._ORIGIN_BR=1,A._ORIGIN_UL=2,A._ORIGIN_UR=3,A);function A(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var s=i(10),l=i(4),c=i(9),h=i(39),d=i(15),p=i(2),n=i(5),r=(i(230),"#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nvarying float vDepthMetric;\n#ifdef PACKED\n#include<packingFunctions>\n#endif\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n}");n.a.ShadersStore.depthPixelShader=r,i(351);var o=i(21),a=(f.prototype.isReady=function(e,t){var i=e.getMaterial();if(i.disableDepthWrite)return!1;var n=[],r=[l.b.PositionKind],o=e.getMesh();i&&i.needAlphaTesting()&&i.getAlphaTestTexture()&&(n.push("#define ALPHATEST"),o.isVerticesDataPresent(l.b.UVKind)&&(r.push(l.b.UVKind),n.push("#define UV1")),o.isVerticesDataPresent(l.b.UV2Kind)&&(r.push(l.b.UV2Kind),n.push("#define UV2"))),o.useBones&&o.computeBonesUsingShaders?(r.push(l.b.MatricesIndicesKind),r.push(l.b.MatricesWeightsKind),4<o.numBoneInfluencers&&(r.push(l.b.MatricesIndicesExtraKind),r.push(l.b.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var a=o.morphTargetManager,s=0;a&&0<a.numInfluencers&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),d.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),d.a.PushAttributesForInstances(r),e.getRenderingMesh().hasThinInstances&&n.push("#define THIN_INSTANCES")),this._storeNonLinearDepth&&n.push("#define NONLINEARDEPTH"),this.isPacked&&n.push("#define PACKED");var c=n.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this._scene.getEngine().createEffe
1ct("depth",r,["world","mBones","viewProjection","diffuseMatrix","depthValues","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s})),this._effect.isReady()},f.prototype.getDepthMap=function(){return this._depthMap},f.prototype.dispose=function(){this._depthMap.dispose()},f._SceneComponentInitialization=function(e){throw o.a.WarnImport("DepthRendererSceneComponent")},f);function f(e,t,i,n){var u=this;void 0===t&&(t=p.a.TEXTURETYPE_FLOAT),void 0===i&&(i=null),void 0===n&&(n=!1),this.enabled=!0,this.useOnlyInActiveCamera=!1,this._scene=e,this._storeNonLinearDepth=n,this.isPacked=t===p.a.TEXTURETYPE_UNSIGNED_BYTE,this.isPacked?this._clearColor=new s.b(1,1,1,1):this._clearColor=new s.b(1,0,0,1),f._SceneComponentInitialization(this._scene),this._camera=i;var o=e.getEngine(),r=this.isPacked||1===o.webGLVersion?p.a.TEXTUREFORMAT_RGBA:p.a.TEXTUREFORMAT_R;this._depthMap=new h.a("depthMap",{width:o.getRenderWidth(),height:o.getRenderHeight()},this._scene,!1,!0,t,!1,void 0,void 0,void 0,void 0,r),this._depthMap.wrapU=c.a.CLAMP_ADDRESSMODE,this._depthMap.wrapV=c.a.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add(function(e){e.clear(u._clearColor,!0,!0,!0)});function a(e){var t,i,n,r,o=e.getRenderingMesh(),a=e.getEffectiveMesh(),s=u._scene,c=s.getEngine(),l=e.getMaterial();a._internalAbstractMeshDataInfo._isActiveIntermediate=!1,l&&(c.setState(l.backFaceCulling,0,!1,s.useRightHandedSystem),(t=o._getInstancesRenderList(e._id,!!e.getReplacementMesh())).mustReturn||(i=c.getCaps().instancedArrays&&(null!==t.visibleInstances[e._id]||o.hasThinInstances),n=u._camera||s.activeCamera,u.isReady(e,i)&&n&&(c.enableEffect(u._effect),o._bind(e,u._effect,l.fillMode),u._effect.setMatrix("viewProjection",s.getTransformMatrix()),u._effect.setFloat2("depthValues",n.minZ,n.minZ+n.maxZ),l&&l.needAlphaTesting()&&(r=l.getAlphaTestTexture())&&(u._effect.setTexture("diffuseSampler",r),u._effect.setMatrix("diffuseMatrix",r.getTextureMatrix())),o.useBones&&o.computeBonesUsingShaders&&o.skeleton&&u._effect.setMatrices("mBones",o.skeleton.getTransformMatrices(o)),d.a.BindMorphTargetParameters(o,u._effect),o._processRendering(a,e,u._effect,l.fillMode,t,i,function(e,t){return u._effect.setMatrix("world",t)}))))}this._depthMap.customRenderFunction=function(e,t,i,n){var r;if(n.length){for(o.setColorWrite(!1),r=0;r<n.length;r++)a(n.data[r]);o.setColorWrite(!0)}for(r=0;r<e.length;r++)a(e.data[r]);for(r=0;r<t.length;r++)a(t.data[r])}}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(44),r=(o.SetImmediate=function(e){n.a.IsWindowObjectExist()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},o);function o(){}},function(e,t,i){"use strict";i.d(t,"b",function(){return o}),i.d(t,"a",function(){return h});var n,r,a=i(13),s=i(9),c=i(27),l=i(14),u=i(2),o=function(){};(r=n=n||{})[r.cTFETC1=0]="cTFETC1",r[r.cTFBC1=1]="cTFBC1",r[r.cTFBC4=2]="cTFBC4",r[r.cTFPVRTC1_4_OPAQUE_ONLY=3]="cTFPVRTC1_4_OPAQUE_ONLY",r[r.cTFBC7_M6_OPAQUE_ONLY=4]="cTFBC7_M6_OPAQUE_ONLY",r[r.cTFETC2=5]="cTFETC2",r[r.cTFBC3=6]="cTFBC3",r[r.cTFBC5=7]="cTFBC5";var h=(d.GetInternalFormatFromBasisFormat=function(e){if(e===n.cTFETC1)return 36196;if(e===n.cTFBC1)return 33776;if(e===n.cTFBC3)return 33779;throw"The chosen Basis transcoder format is not currently supported"},d._CreateWorkerAsync=function(){var r=this;return this._WorkerPromise||(this._WorkerPromise=new Promise(function(n){r._Worker?n(r._Worker):a.b.LoadFileAsync(d.WasmModuleURL).then(function(e){var t=URL.createObjectURL(new Blob(["("+function(){var A=null;onmessage=function(e){if("init"===e.data.action)A||(Module={wasmBinary:e.data.wasmBinary},importScripts(e.data.url),A=new Promise(function(e){Module.onRuntimeInitialized=function(){Module.initializeBasis(),e()}})),A.then(function(){postMessage({action:"init"})});else if("transcode"===e.data.action){var t=e.data.config,i=e.data.imageData,n=new Module.BasisFile(i),r=function(e){for(var t=e.getHasAlpha(),i=e.getNumImages(),n=[],r=0;r<i;r++){for(var o={levels:[]},a=e.getNumLevels(r),s=0;s<a;s++){var c={width:e.getImageWidth(r,s),height:e.getImageHeight(r,s)};o.levels.push(c)}n.push(o)}return{hasAlpha:t,images:n}}(n),o=e.data.ignoreSupportedFormats?null:(E=e.data.config,S=null,E.supportedCompressionFormats&&(E.supportedCompressionFormats.etc1?S=0:E.supportedCompressionFormats.s3tc?S=r.hasAlpha?6:1:E.supportedCompressionFormats.pvrtc||E.supportedCompressionFormats.etc2&&(S=5)),S),a=!1;null===o&&(a=!0,o=r.hasAlpha?6:1);var s=!0;n.startTranscoding()||(s=!1);for(var c=[],l=0;l<r.images.length&&s;l++){var u=r.images[l];if(void 0===t.loadSingleImage||t.loadSingleImage===l){var h=u.levels.length;!1===t.loadMipmapLevels&&(h=1);for(var d=0;d<h;d++){var p=u.levels[d],f=(_=l,g=d,v=o,b=a,T=void 0,y=(m=n).getImageTranscodedSizeInBytes(_,g,v),T=new Uint8Array(y),m.transcodeImage(T,_,g,v,1,0)?(b&&(T=function(e,t,i){for(var n=new Uint16Array(4),r=new Uint16Array(t*i),o=t/4,a=i/4,s=0;s<a;s++)for(var c=0;c<o;c++){var l=0+8*(s*o+c);n[0]=e[l]|e[1+l]<<8,n[1]=e[2+l]|e[3+l]<<8,n[2]=(2*(31&n[0])+(31&n[1]))/3|(2*(2016&
1n[0])+(2016&n[1]))/3&2016|(2*(63488&n[0])+(63488&n[1]))/3&63488,n[3]=(2*(31&n[1])+(31&n[0]))/3|(2*(2016&n[1])+(2016&n[0]))/3&2016|(2*(63488&n[1])+(63488&n[0]))/3&63488;for(var u=0;u<4;u++){var h=e[4+l+u],d=(4*s+u)*t+4*c;r[d++]=n[3&h],r[d++]=n[h>>2&3],r[d++]=n[h>>4&3],r[d++]=n[h>>6&3]}}return r}(T,m.getImageWidth(_,g)+3&-4,m.getImageHeight(_,g)+3&-4)),T):null);if(!f){s=!1;break}p.transcodedPixels=f,c.push(p.transcodedPixels.buffer)}}}n.close(),n.delete(),a&&(o=-1),s?postMessage({action:"transcode",success:s,id:e.data.id,fileInfo:r,format:o},c):postMessage({action:"transcode",success:s,id:e.data.id})}var m,_,g,v,b,y,T,E,S}}+")()"],{type:"application/javascript"}));r._Worker=new Worker(t);var i=function(e){"init"===e.data.action&&(r._Worker.removeEventListener("message",i),n(r._Worker))};r._Worker.addEventListener("message",i),r._Worker.postMessage({action:"init",url:d.JSModuleURL,wasmBinary:e})})})),this._WorkerPromise},d.TranscodeAsync=function(e,o){var a=this,s=e instanceof ArrayBuffer?new Uint8Array(e):e;return new Promise(function(n,r){a._CreateWorkerAsync().then(function(){var t=a._actionId++,i=function(e){"transcode"===e.data.action&&e.data.id===t&&(a._Worker.removeEventListener("message",i),e.data.success?n(e.data):r("Transcode is not supported on this device"))};a._Worker.addEventListener("message",i);var e=new Uint8Array(s.byteLength);e.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),a._Worker.postMessage({action:"transcode",id:t,imageData:e,config:o,ignoreSupportedFormats:a._IgnoreSupportedFormats},[e.buffer])})})},d.LoadTextureFromTranscodeResult=function(i,n){for(var t,r=i.getEngine(),e=function(){var e;t=n.fileInfo.images[o].levels[0],i._invertVScale=i.invertY,-1===n.format?(i.type=u.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,i.format=u.a.TEXTUREFORMAT_RGB,r.webGLVersion<2&&(l.a.Log2(t.width)%1!=0||l.a.Log2(t.height)%1!=0)?(e=new c.a(r,c.b.Temp),i._invertVScale=i.invertY,e.type=u.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,e.format=u.a.TEXTUREFORMAT_RGB,e.width=t.width+3&-4,e.height=t.height+3&-4,r._bindTextureDirectly(r._gl.TEXTURE_2D,e,!0),r._uploadDataToTextureDirectly(e,t.transcodedPixels,o,0,u.a.TEXTUREFORMAT_RGB,!0),r._rescaleTexture(e,i,r.scenes[0],r._getInternalFormat(u.a.TEXTUREFORMAT_RGB),function(){r._releaseTexture(e),r._bindTextureDirectly(r._gl.TEXTURE_2D,i,!0)})):(i._invertVScale=!i.invertY,i.width=t.width+3&-4,i.height=t.height+3&-4,r._uploadDataToTextureDirectly(i,t.transcodedPixels,o,0,u.a.TEXTUREFORMAT_RGB,!0))):(i.width=t.width,i.height=t.height,n.fileInfo.images[o].levels.forEach(function(e,t){r._uploadCompressedDataToTextureDirectly(i,d.GetInternalFormatFromBasisFormat(n.format),e.width,e.height,e.transcodedPixels,o,t)}),r.webGLVersion<2&&(l.a.Log2(i.width)%1!=0||l.a.Log2(i.height)%1!=0)&&(a.b.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),i._cachedWrapU=s.a.CLAMP_ADDRESSMODE,i._cachedWrapV=s.a.CLAMP_ADDRESSMODE))},o=0;o<n.fileInfo.images.length;o++)e()},d._IgnoreSupportedFormats=!1,d.JSModuleURL="https://preview.babylonjs.com/basisTranscoder/basis_transcoder.js",d.WasmModuleURL="https://preview.babylonjs.com/basisTranscoder/basis_transcoder.wasm",d._WorkerPromise=null,d._Worker=null,d._actionId=0,d);function d(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return r});var o=i(33),n=(Object.defineProperty(a.prototype,"size",{get:function(){return this.size},set:function(e){this.size=e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"quaternion",{get:function(){return this.rotationQuaternion},set:function(e){this.rotationQuaternion=e},enumerable:!1,configurable:!0}),a.prototype.intersectsMesh=function(e,t){if(!e._boundingInfo)return!1;if(t=t||!1)return e.getBoundingInfo().boundingSphere.intersectsPoint(this.position.add(this._pcs.mesh.position));var i=e.getBoundingInfo().boundingBox.maximumWorld.x,n=e.getBoundingInfo().boundingBox.minimumWorld.x,r=e.getBoundingInfo().boundingBox.maximumWorld.y,o=e.getBoundingInfo().boundingBox.minimumWorld.y,a=e.getBoundingInfo().boundingBox.maximumWorld.z,s=e.getBoundingInfo().boundingBox.minimumWorld.z,c=this.position.x+this._pcs.mesh.position.x,l=this.position.y+this._pcs.mesh.position.y,u=this.position.z+this._pcs.mesh.position.z;return n<=c&&c<=i&&o<=l&&l<=r&&s<=u&&u<=a},a.prototype.getRotationMatrix=function(e){var t,i;this.rotationQuaternion?t=this.rotationQuaternion:(t=o.u.Quaternion[0],i=this.rotation,o.q.RotationYawPitchRollToRef(i.y,i.x,i.z,t)),t.toRotationMatrix(e)},a),r=function(e,t){this.groupID=e,this._positionFunction=t};function a(e,t,i,n,r){this.idx=0,this.color=new o.f(1,1,1,1),this.position=o.y.Zero(),this.rotation=o.y.Zero(),this.uv=new o.x(0,
10),this.velocity=o.y.Zero(),this.pivot=o.y.Zero(),this.translateFromPivot=!1,this._pos=0,this._ind=0,this.groupId=0,this.idxInGroup=0,this._stillInvisible=!1,this._rotationMatrix=[1,0,0,0,1,0,0,0,1],this.parentId=null,this._globalPosition=o.y.Zero(),this.idx=e,this._group=t,this.groupId=i,this.idxInGroup=n,this._pcs=r}},function(e,t,i){"use strict";var u=i(1),f=i(27),m=i(7),_=i(154),g=i(2),n=i(31);n.a.prototype.createRenderTargetTexture=function(e,t){var i=new _.a;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=!!t.generateDepthBuffer,i.generateStencilBuffer=!!t.generateStencilBuffer,i.type=void 0===t.type?g.a.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?g.a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,i.format=void 0===t.format?g.a.TEXTUREFORMAT_RGBA:t.format):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=g.a.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE,i.format=g.a.TEXTUREFORMAT_RGBA),(i.type!==g.a.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==g.a.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=g.a.TEXTURE_NEAREST_SAMPLINGMODE),i.type!==g.a.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=g.a.TEXTURETYPE_UNSIGNED_INT,m.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var n=this._gl,r=new f.a(this,f.b.RenderTarget),o=e.width||e,a=e.height||e,s=e.layers||0,c=this._getSamplingParameters(i.samplingMode,!!i.generateMipMaps),l=0!==s?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D,u=this._getRGBABufferInternalSizedFormat(i.type,i.format),h=this._getInternalFormat(i.format),d=this._getWebGLTextureType(i.type);this._bindTextureDirectly(l,r),0!==s?(r.is2DArray=!0,n.texImage3D(l,0,u,o,a,s,0,h,d,null)):n.texImage2D(l,0,u,o,a,0,h,d,null),n.texParameteri(l,n.TEXTURE_MAG_FILTER,c.mag),n.texParameteri(l,n.TEXTURE_MIN_FILTER,c.min),n.texParameteri(l,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(l,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i.generateMipMaps&&this._gl.generateMipmap(l),this._bindTextureDirectly(l,null);var p=n.createFramebuffer();return this._bindUnboundFramebuffer(p),r._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!i.generateStencilBuffer,i.generateDepthBuffer,o,a),r.is2DArray||n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,r._webGLTexture,0),this._bindUnboundFramebuffer(null),r._framebuffer=p,r.baseWidth=o,r.baseHeight=a,r.width=o,r.height=a,r.depth=s,r.isReady=!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},n.a.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var i=e.width||e;return this._createDepthStencilCubeTexture(i,t)}return this._createDepthStencilTexture(e,t)},n.a.prototype._createDepthStencilTexture=function(e,t){var i=this._gl,n=e.layers||0,r=0!==n?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D,o=new f.a(this,f.b.Depth);if(!this._caps.depthTextureExtension)return m.a.Error("Depth texture is not supported by your browser or hardware."),o;var a=Object(u.a)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t);this._bindTextureDirectly(r,o,!0),this._setupDepthStencilTexture(o,e,a.generateStencil,a.bilinearFiltering,a.comparisonFunction);var s=a.generateStencil?i.UNSIGNED_INT_24_8:i.UNSIGNED_INT,c=a.generateStencil?i.DEPTH_STENCIL:i.DEPTH_COMPONENT,l=c;return 1<this.webGLVersion&&(l=a.generateStencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24),o.is2DArray?i.texImage3D(r,0,l,o.width,o.height,n,0,c,s,null):i.texImage2D(r,0,l,o.width,o.height,0,c,s,null),this._bindTextureDirectly(r,null),o}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.clipPlaneFragmentDeclaration="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.logDepthDeclaration="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.clipPlaneVertexDeclaration="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nvarying float fClipDistance6;\n#endif"},function(e,t,i){"use strict";i.d(t,"b",function(){return o}
1),i.d(t,"a",function(){return a});var l=i(26),n=i(6),r=i(22),o=(i(198),s.prototype.getClassName=function(){return"TargetedAnimation"},s.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},s),a=(Object.defineProperty(u.prototype,"from",{get:function(){return this._from},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"to",{get:function(){return this._to},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isPlaying",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;t<this._animatables.length;t++)this._animatables[t].speedRatio=this._speedRatio}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"loopAnimation",{get:function(){return this._loopAnimation},set:function(e){if(this._loopAnimation!==e){this._loopAnimation=e;for(var t=0;t<this._animatables.length;t++)this._animatables[t].loopAnimation=this._loopAnimation}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isAdditive",{get:function(){return this._isAdditive},set:function(e){if(this._isAdditive!==e){this._isAdditive=e;for(var t=0;t<this._animatables.length;t++)this._animatables[t].isAdditive=this._isAdditive}},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"targetedAnimations",{get:function(){return this._targetedAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"animatables",{get:function(){return this._animatables},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"children",{get:function(){return this._targetedAnimations},enumerable:!1,configurable:!0}),u.prototype.addTargetedAnimation=function(e,t){var i=new o;i.animation=e,i.target=t;var n=e.getKeys();return this._from>n[0].frame&&(this._from=n[0].frame),this._to<n[n.length-1].frame&&(this._to=n[n.length-1].frame),this._targetedAnimations.push(i),i},u.prototype.normalize=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null),null==e&&(e=this._from),null==t&&(t=this._to);for(var i=0;i<this._targetedAnimations.length;i++){var n,r=this._targetedAnimations[i].animation.getKeys(),o=r[0],a=r[r.length-1];o.frame>e&&(n={frame:e,value:o.value,inTangent:o.inTangent,outTangent:o.outTangent,interpolation:o.interpolation},r.splice(0,0,n)),a.frame<t&&(n={frame:t,value:a.value,inTangent:a.outTangent,outTangent:a.outTangent,interpolation:a.interpolation},r.push(n))}return this._from=e,this._to=t,this},u.prototype._processLoop=function(e,t,i){var n=this;e.onAnimationLoop=function(){n.onAnimationLoopObservable.notifyObservers(t),n._animationLoopFlags[i]||(n._animationLoopFlags[i]=!0,n._animationLoopCount++,n._animationLoopCount===n._targetedAnimations.length&&(n.onAnimationGroupLoopObservable.notifyObservers(n),n._animationLoopCount=0,n._animationLoopFlags=[]))}},u.prototype.start=function(i,n,r,o,a){var s=this;if(void 0===i&&(i=!1),void 0===n&&(n=1),this._isStarted||0===this._targetedAnimations.length)return this;this._loopAnimation=i,this._animationLoopCount=0,this._animationLoopFlags=[];for(var e,t=function(){var e=c._targetedAnimations[l],t=c._scene.beginDirectAnimation(e.target,[e.animation],void 0!==r?r:c._from,void 0!==o?o:c._to,i,n,void 0,void 0,void 0!==a?a:c._isAdditive);t.onAnimationEnd=function(){s.onAnimationEndObservable.notifyObservers(e),s._checkAnimationGroupEnded(t)},c._processLoop(t,e,l),c._animatables.push(t)},c=this,l=0;l<this._targetedAnimations.length;l++)t();return this._speedRatio=n,void 0!==r&&void 0!==o&&(r<o&&this._speedRatio<0?(e=o,o=r,r=e):o<r&&0<this._speedRatio&&(this._speedRatio=-n)),this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this},u.prototype.pause=function(){if(!this._isStarted)return this;this._isPaused=!0;for(var e=0;e<this._animatables.length;e++)this._animatables[e].pause();return this.onAnimationGroupPauseObservable.notifyObservers(this),this},u.prototype.play=function(e){return this.isStarted&&this._animatables.length===this._targetedAnimations.length?(void 0!==e&&(this.loopAnimation=e),this.restart()):(this.stop(),this.start(e,this._speedRatio)),this._isPaused=!1,this},u.prototype.reset=function(){if(!this._isStarted)return this;for(var e=0;e<this._animatables.length;e++)this._animatables[e].reset();return this},u.prototype.restart=function(){if(!this._isStarted)return this;for(var e=0;e<this._animatables.length;e++)this._animatables[e].restart();return this.onAnimationGroupPlayObservable.notifyObservers(this),this},u.prototype.stop=function(){if(!this._isStarted)return this;for(var e=this._animatables.slice(),t=0;t<e.length;t++)e[t].stop();return this._isStarted=!1,this},u.prototype.setWeightForAllAnimatables=function(e){for(var t=0;t<this._animatables.length;t++)this._animatables[t].weight=e;return this},u.prototype.syncAllAnimationsWith=function(e){for(var t=0;t<this._animatables.length;t++)this._animatables[t].syncWith(e);return this},u.prototype.goToFrame=function(e){if(!this._isStarted)return this;for(var t=0;t<this._animatables.length;t++)this._animatables[t].goToFrame(e);return this},u.prototype.dispose=function(){this._targetedAnimations=[],this._animatables=[];var e=this._scene.animationGroups.indexOf(this);-1<e&&this._scene.animationGroups.splice(e,1),this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()},u.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);-1<t&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},u.prototype.clone=function(e,t){for(var i=new u(e||this.name,this._scene),n=0,r=this._targetedAnimations;n<r.length;n++){var o=r[n];i.addTargetedAnimation(o.animation.clone(),t?t(o.target):o.target)}return i},u.prototype.serialize=function(){var e={};e.name=this.name,e.from=this.from,e.to=this.to,e.targetedAnimations=[];for(var t=0;t<this.targetedAnimations.length;t++){var i=this.targetedAnimations[t];e.targetedAnimations[t]=i.serialize()}return e},u.Parse=function(e,t){for(var i=new u(e.name,t),n=0;n<e.targetedAnimations.length;n++){var r,o,a=e.targetedAnimations[n],s=l.a.Parse(a.animation),c=a.targetId;"influence"===a.animation.property?(r=t.getMorphTargetById(c))&&i.addTargetedAnimation(s,r):null!=(o=t.getNodeByID(c))&&i.addTargetedAnimation(s,o)}return null!==e.from&&null!==e.to&&i.normalize(e.from,e.to),i},u.MakeAnimationAdditive=function(e,t,i,n,r){void 0===t&&(t=0),void 0===n&&(n=!1);var o=e;n&&(o=e.clone(r||o.name));for(var a=o.targetedAnimations,s=0;s<a.length;s++){var c=a[s];l.a.MakeAnimationAdditive(c.animation,t,i)}return o.isAdditive=!0,o},u.prototype.getClassName=function(){return"AnimationGroup"},u.prototype.toString=function(e){var t="Name: "+this.name;return t+=", type: "+this.getClassName(),e&&(t+=", from: "+this._from,t+=", to: "+this._to,t+=", isStarted: "+this._isStarted,t+=", speedRatio: "+this._speedRatio,t+=", targetedAnimations length: "+this._targetedAnimations.length,t+=", animatables length: "+this._animatables),t},u);function u(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._isAdditive=!1,this.onAnimationEndObservable=new n.c,this.onAnimationLoopObservable=new n.c,this.onAnimationGroupLoopObservable=new n.c,this.onAnimationGroupEndObservable=new n.c,this.onAnimationGroupPauseObservable=new n.c,this.onAnimationGroupPlayObservable=new n.c,this._scene=t||r.a.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}function s(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},r.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},r.prototype.postProcessor=function(e,t,i){var n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e
1=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(1),r=i(71),o=i(0),a=i(30),s=(i(305),i(24));a.a.AddNodeConstructor("DeviceOrientationCamera",function(e,t){return function(){return new l(e,o.e.Zero(),t)}});var c,l=(c=r.a,Object(n.d)(u,c),Object.defineProperty(u.prototype,"disablePointerInputWhenUsingDeviceOrientation",{get:function(){return this._disablePointerInputWhenUsingDeviceOrientation},set:function(e){this._disablePointerInputWhenUsingDeviceOrientation=e},enumerable:!1,configurable:!0}),u.prototype.enableHorizontalDragging=function(e){void 0===e&&(e=1/300),this._dragFactor=e},u.prototype.getClassName=function(){return"DeviceOrientationCamera"},u.prototype._checkInputs=function(){c.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},u.prototype.resetToCurrentRotation=function(t){var i=this;void 0===t&&(t=s.a.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new o.b),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),["x","y","z"].forEach(function(e){t[e]?i._initialQuaternion[e]*=-1:i._initialQuaternion[e]=0}),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))},u);function u(e,t,i){var n=c.call(this,e,t,i)||this;return n._tmpDragQuaternion=new o.b,n._disablePointerInputWhenUsingDeviceOrientation=!0,n._dragFactor=0,n._quaternionCache=new o.b,n.inputs.addDeviceOrientation(),n.inputs._deviceOrientationInput&&n.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function(){n._disablePointerInputWhenUsingDeviceOrientation&&n.inputs._mouseInput&&(n.inputs._mouseInput._allowCameraRotation=!1,n.inputs._mouseInput.onPointerMovedObservable.add(function(e){0!=n._dragFactor&&(n._initialQuaternion||(n._initialQuaternion=new o.b),o.b.FromEulerAnglesToRef(0,e.offsetX*n._dragFactor,0,n._tmpDragQuaternion),n._initialQuaternion.multiplyToRef(n._tmpDragQuaternion,n._initialQuaternion))}))}),n}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(1),a=i(25),r=i(182),s=i(103),o=i(0),c=i(30);i(218),c.a.AddNodeConstructor("VRDeviceOrientationFreeCamera",function(e,t){return function(){return new u(e,o.e.Zero(),t)}});var l,u=(l=r.a,Object(n.d)(h,l),h.prototype.getClassName=function(){return"VRDeviceOrientationFreeCamera"},h);function h(e,t,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=s.a.GetDefault());var o=l.call(this,e,t,i)||this;return r.compensateDistortion=n,o.setCameraRigMode(a.a.RIG_MODE_VR,{vrCameraMetrics:r}),o}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(7),r=i(6),o=i(27),a=i(39),s=i(263),c=(Object.defineProperty(l.prototype,"referenceSpace",{get:function(){return this._referenceSpace},set:function(e){this._referenceSpace=e,this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace)},enumerable:!1,configurable:!0}),l.prototype.dispose=function(){this._sessionEnded||this.exitXRAsync(),this.onXRFrameObservable.clear(),this.onXRSessionEnded.clear(),this.onXRReferenceSpaceChanged.clear(),this.onXRSessionInit.clear()},l.prototype.exitXRAsync=function(){return this.session&&!this._sessionEnded?this.session.end().catch(function(e){n.a.Warn("could not end XR session. It has ended already.")}):Promise.resolve()},l.prototype.getRenderTargetTextureForEye=function(e){return this._rttProvider.getRenderTargetForEye(e)},l.prototype.getWebXRRenderTarget=function(e){var t=this.scene.getEngine();return this._xrNavigator.xr.native?this._xrNavigator.xr.getWebXRRenderTarget(t):((e=e||{}).canvasElement=t.getRenderingCanvas()||void 0,new s.a(this,e))},l.prototype.initializeAsync=function(){return this._xrNavigator=navigator,this._xrNavigator.xr?Promise.resolve():Promise.reject("WebXR not available")},l.prototype.initializeSessionAsync=function(e,t){var i=this;return void 0===e&&(e="immersive-vr"),void 0===t&&(t={}),this._xrNavigator.xr.requestSession(e,t).then(function(e){return i.session=e,i.onXRSessionInit.notifyObservers(e),i._sessionEnded=!1,i.session.addEventListener("end",function(){var e=i.scene.getEngine();i._sessionEnded=!0,i._rttProvider=null,e.framebufferDimensionsObject=null,e.restoreDefaultFramebuffer(),e.customAnimationFrameRequester=null,i.onXRSessionEnded.notifyObservers(null),e._renderLoop()},{once:!0}),i.session})},l.prototype.isSessionSupportedAsync=function(e){return l.IsSessionSupportedAsync(e)},l.prototype.resetReferenceSpace=function(){this.referenceSpace=this.baseReferenceSpace},l.prototype.runXRRenderLoop=function(){var e,i=this,n=this.scene.getEngine();n.customAnimationFrameRequester={requestAnimationFrame:this.session.requestAnimationFrame.bind(this.session),renderFunction:function(e,t){i._sessionEnded||(i.currentFrame=t,i.currentTimestamp=e,t&&(n.framebufferDimensionsObject=i.baseLayer,i.onXRFrameObservable.notifyObservers(t),n._renderLoop(),n.framebufferDimensionsObject=null))}},this._xrNavigator.xr.native?this._rttProvider=this._xrNavigator.xr.getNativeRenderTargetProvider(this.session,this._createRenderTargetTexture.bind(this)):(e=this._createRenderTargetTexture(this.baseLayer.framebufferWidth,this.baseLayer.framebufferHeight,this.baseLayer.framebuffer),this._rttProvider={getRenderTargetForEye:function(){return e}},n.framebufferDimensionsObject=this.baseLayer),window.cancelAnimationFrame&&window.cancelAnimationFrame(n._frameHandler),n._renderLoop()},l.prototype.setReferenceSpaceTypeAsync=function(e){var i=this;return void 0===e&&(e="local-floor"),this.session.requestReferenceSpace(e).then(function(e){return e},function(e){return n.a.Error("XR.requestReferenceSpace failed for the following reason: "),n.a.Error(e),n.a.Log('Defaulting to universally-supported "viewer" reference space type.'),i.session.requestReferenceSpace("viewer").then(function(e){var t=new XRRigidTransform({x:0,y:-i.defaultHeight
1Compensation,z:0});return e.getOffsetReferenceSpace(t)},function(e){throw n.a.Error(e),'XR initialization failed: required "viewer" reference space type not supported.'})}).then(function(t){return i.session.requestReferenceSpace("viewer").then(function(e){return i.viewerReferenceSpace=e,t})}).then(function(e){return i.referenceSpace=i.baseReferenceSpace=e,i.referenceSpace})},l.prototype.updateRenderStateAsync=function(e){return e.baseLayer&&(this.baseLayer=e.baseLayer),this.session.updateRenderState(e)},l.IsSessionSupportedAsync=function(e){if(!navigator.xr)return Promise.resolve(!1);var t=navigator.xr.isSessionSupported||navigator.xr.supportsSession;return t?t.call(navigator.xr,e).then(function(e){var t=void 0===e||e;return Promise.resolve(t)}).catch(function(e){return n.a.Warn(e),Promise.resolve(!1)}):Promise.resolve(!1)},l.prototype._createRenderTargetTexture=function(e,t,i){void 0===i&&(i=null);var n=new o.a(this.scene.getEngine(),o.b.Unknown,!0);n.width=e,n.height=t,n._framebuffer=i;var r=new a.a("XR renderTargetTexture",{width:e,height:t},this.scene,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0);return r._texture=n,r},l);function l(e){this.scene=e,this._sessionEnded=!1,this.baseLayer=null,this.currentTimestamp=-1,this.defaultHeightCompensation=1.7,this.onXRFrameObservable=new r.c,this.onXRReferenceSpaceChanged=new r.c,this.onXRSessionEnded=new r.c,this.onXRSessionInit=new r.c}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var h,n=i(1),d=i(0),r=i(62),p=i(9),_=i(2),g=i(283),v=i(148),o=i(11),f=i(13),b=i(32),a=i(297),s=(i(130),i(203),h=r.a,Object(n.d)(y,h),Object.defineProperty(y.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(d.a.RotationY(this._rotationY))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){var t;this._boundingBoxSize&&this._boundingBoxSize.equals(e)||(this._boundingBoxSize=e,(t=this.getScene())&&t.markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),y.prototype.getClassName=function(){return"HDRCubeTexture"},y.prototype.loadTexture=function(){var e,t,f=this,m=this._getEngine();2<=this._getEngine().webGLVersion&&this._prefilterOnLoad&&(e=this._onLoad,t=new a.a(m),this._onLoad=function(){t.prefilter(f,e)}),this._texture=m.createRawCubeTextureFromUrl(this.url,this.getScene(),this._size,_.a.TEXTUREFORMAT_RGB,m.getCaps().textureFloat?_.a.TEXTURETYPE_FLOAT:_.a.TEXTURETYPE_UNSIGNED_INT,this._noMipmap,function(e){f.lodGenerationOffset=0,f.lodGenerationScale=.8;var t,i=g.a.GetCubeMapTextureData(e,f._size);f._generateHarmonics&&(t=v.a.ConvertCubeMapToSphericalPolynomial(i),f.sphericalPolynomial=t);for(var n,r=[],o=null,a=0;a<6;a++){m.getCaps().textureFloat||(n=new ArrayBuffer(f._size*f._size*3),o=new Uint8Array(n));var s,c,l,u,h,d=i[y._facesMapping[a]];if(f.gammaSpace||o)for(var p=0;p<f._size*f._size;p++)f.gammaSpace&&(d[3*p+0]=Math.pow(d[3*p+0],b.b),d[3*p+1]=Math.pow(d[3*p+1],b.b),d[3*p+2]=Math.pow(d[3*p+2],b.b)),o&&(s=Math.max(255*d[3*p+0],0),c=Math.max(255*d[3*p+1],0),l=Math.max(255*d[3*p+2],0),255<(u=Math.max(Math.max(s,c),l))&&(s*=h=255/u,c*=h,l*=h),o[3*p+0]=s,o[3*p+1]=c,o[3*p+2]=l);o?r.push(o):r.push(d)}return r},null,this._onLoad,this._onError)},y.prototype.clone=function(){var e=new y(this.url,this.getScene()||this._getEngine(),this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e},y.prototype.delayLoad=function(){this.delayLoadState===_.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=_.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this.loadTexture())},y.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},y.prototype.setReflectionTextureMatrix=function(e){var t,i=this;(this._textureMatrix=e).updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(_.a.MATERIAL_TextureDirtyFlag,function(e){return-1!==e.getActiveTextures().indexOf(i)}))},y.Parse=function(e,t,i){var n=null;return e.name&&!e.isRenderTarget&&((n=new y(i+e.name,t,e.size,e.
1noMipmap,e.generateHarmonics,e.useInGammaSpace)).name=e.name,n.hasAlpha=e.hasAlpha,n.level=e.level,n.coordinatesMode=e.coordinatesMode,n.isBlocking=e.isBlocking),n&&(e.boundingBoxPosition&&(n.boundingBoxPosition=d.e.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(n.boundingBoxSize=d.e.FromArray(e.boundingBoxSize)),e.rotationY&&(n.rotationY=e.rotationY)),n},y.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},y._facesMapping=["right","left","up","down","front","back"],y);function y(e,t,i,n,r,o,a,s,c){var l;void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=null),void 0===c&&(c=null);var u=h.call(this,t)||this;return u._generateHarmonics=!0,u._onLoad=null,u._onError=null,u.coordinatesMode=p.a.CUBIC_MODE,u._isBlocking=!0,u._rotationY=0,u.boundingBoxPosition=d.e.Zero(),e&&(u.name=e,u.url=e,u.hasAlpha=!1,u.isCube=!0,u._textureMatrix=d.a.Identity(),u._prefilterOnLoad=a,u._onLoad=s,u._onError=c,u.gammaSpace=o,u._noMipmap=n,u._size=i,u._generateHarmonics=r,u._texture=u._getFromCache(e,u._noMipmap),u._texture?s&&(u._texture.isReady?f.b.SetImmediate(function(){return s()}):u._texture.onLoadedObservable.add(s)):null!==(l=u.getScene())&&void 0!==l&&l.useDelayedTextureLoading?u.delayLoadState=_.a.DELAYLOADSTATE_NOTLOADED:u.loadTexture()),u}o.a.RegisteredTypes["BABYLON.HDRCubeTexture"]=s},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(0),r=i(2),o=(a.ConvertPanoramaToCubemap=function(e,t,i,n){if(!e)throw"ConvertPanoramaToCubemap: input cannot be null";if(e.length!=t*i*3)throw"ConvertPanoramaToCubemap: input size is wrong";return{front:this.CreateCubemapTexture(n,this.FACE_FRONT,e,t,i),back:this.CreateCubemapTexture(n,this.FACE_BACK,e,t,i),left:this.CreateCubemapTexture(n,this.FACE_LEFT,e,t,i),right:this.CreateCubemapTexture(n,this.FACE_RIGHT,e,t,i),up:this.CreateCubemapTexture(n,this.FACE_UP,e,t,i),down:this.CreateCubemapTexture(n,this.FACE_DOWN,e,t,i),size:n,type:r.a.TEXTURETYPE_FLOAT,format:r.a.TEXTUREFORMAT_RGB,gammaSpace:!1}},a.CreateCubemapTexture=function(e,t,i,n,r){for(var o=new ArrayBuffer(e*e*4*3),a=new Float32Array(o),s=t[1].subtract(t[0]).scale(1/e),c=t[3].subtract(t[2]).scale(1/e),l=1/e,u=0,h=0;h<e;h++){for(var d=t[0],p=t[2],f=0;f<e;f++){var m=p.subtract(d).scale(u).add(d);m.normalize();var _=this.CalcProjectionSpherical(m,i,n,r);a[h*e*3+3*f]=_.r,a[h*e*3+3*f+1]=_.g,a[h*e*3+3*f+2]=_.b,d=d.add(s),p=p.add(c)}u+=l}return a},a.CalcProjectionSpherical=function(e,t,i,n){for(var r=Math.atan2(e.z,e.x),o=Math.acos(e.y);r<-Math.PI;)r+=2*Math.PI;for(;r>Math.PI;)r-=2*Math.PI;var a=r/Math.PI,s=o/Math.PI,a=.5*a+.5,c=Math.round(a*i);c<0?c=0:i<=c&&(c=i-1);var l=Math.round(s*n);l<0?l=0:n<=l&&(l=n-1);var u=n-l-1;return{r:t[u*i*3+3*c],g:t[u*i*3+3*c+1],b:t[u*i*3+3*c+2]}},a.FACE_LEFT=[new n.e(-1,-1,-1),new n.e(1,-1,-1),new n.e(-1,1,-1),new n.e(1,1,-1)],a.FACE_RIGHT=[new n.e(1,-1,1),new n.e(-1,-1,1),new n.e(1,1,1),new n.e(-1,1,1)],a.FACE_FRONT=[new n.e(1,-1,-1),new n.e(1,-1,1),new n.e(1,1,-1),new n.e(1,1,1)],a.FACE_BACK=[new n.e(-1,-1,1),new n.e(-1,-1,-1),new n.e(-1,1,1),new n.e(-1,1,-1)],a.FACE_DOWN=[new n.e(1,1,-1),new n.e(1,1,1),new n.e(-1,1,-1),new n.e(-1,1,1)],a.FACE_UP=[new n.e(-1,-1,-1),new n.e(-1,-1,1),new n.e(1,-1,-1),new n.e(1,-1,1)],a);function a(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var f,n=i(1),m=i(9),r=i(39),_=i(2),o=(i(314),f=r.a,Object(n.d)(a,f),Object.defineProperty(a.prototype,"isSupported",{get:function(){return 1<this._getEngine().webGLVersion||this._getEngine().getCaps().drawBuffersExtension},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"textures",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"count",{get:function(){return this._count}
1,enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"depthTexture",{get:function(){return this._textures[this._textures.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"wrapU",{set:function(e){if(this._textures)for(var t=0;t<this._textures.length;t++)this._textures[t].wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"wrapV",{set:function(e){if(this._textures)for(var t=0;t<this._textures.length;t++)this._textures[t].wrapV=e},enumerable:!1,configurable:!0}),a.prototype._rebuild=function(){this.releaseInternalTextures(),this._createInternalTextures();for(var e=0;e<this._internalTextures.length;e++)this._textures[e]._texture=this._internalTextures[e];this._texture=this._internalTextures[0],1!==this.samples&&this._getEngine().updateMultipleRenderTargetTextureSampleCount(this._internalTextures,this.samples)},a.prototype._createInternalTextures=function(){this._internalTextures=this._getEngine().createMultipleRenderTarget(this._size,this._multiRenderTargetOptions)},a.prototype._createTextures=function(){this._textures=[];for(var e=0;e<this._internalTextures.length;e++){var t=new m.a(null,this.getScene());t._texture=this._internalTextures[e],this._textures.push(t)}this._texture=this._internalTextures[0]},Object.defineProperty(a.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=this._getEngine().updateMultipleRenderTargetTextureSampleCount(this._internalTextures,e))},enumerable:!1,configurable:!0}),a.prototype.resize=function(e){this._size=e,this._rebuild()},a.prototype.unbindFrameBuffer=function(e,t){var i=this;e.unBindMultiColorAttachmentFramebuffer(this._internalTextures,this.isCube,function(){i.onAfterRenderObservable.notifyObservers(t)})},a.prototype.dispose=function(){this.releaseInternalTextures(),f.prototype.dispose.call(this)},a.prototype.releaseInternalTextures=function(){if(this._internalTextures)for(var e=this._internalTextures.length-1;0<=e;e--)void 0!==this._internalTextures[e]&&(this._internalTextures[e].dispose(),this._internalTextures.splice(e,1))},a);function a(e,t,i,n,r){var o=this,a=!(!r||!r.generateMipMaps)&&r.generateMipMaps,s=!(!r||!r.generateDepthTexture)&&r.generateDepthTexture,c=!r||void 0===r.doNotChangeAspectRatio||r.doNotChangeAspectRatio;if((o=f.call(this,e,t,n,a,c)||this).isSupported){for(var l=[],u=[],h=0;h<i;h++)r&&r.types&&void 0!==r.types[h]?l.push(r.types[h]):l.push(r&&r.defaultType?r.defaultType:_.a.TEXTURETYPE_UNSIGNED_INT),r&&r.samplingModes&&void 0!==r.samplingModes[h]?u.push(r.samplingModes[h]):u.push(m.a.BILINEAR_SAMPLINGMODE);var d=!r||void 0===r.generateDepthBuffer||r.generateDepthBuffer,p=!(!r||void 0===r.generateStencilBuffer)&&r.generateStencilBuffer;return o._size=t,o._multiRenderTargetOptions={samplingModes:u,generateMipMaps:a,generateDepthBuffer:d,generateStencilBuffer:p,generateDepthTexture:s,types:l,textureCount:i},o._count=i,o._createInternalTextures(),o._createTextures(),o}o.dispose()}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var r=i(8),b=i(16);b.a.CreateDisc=function(e){var t=new Array,i=new Array,n=new Array,r=new Array,o=e.radius||.5,a=e.tessellation||64,s=(!e.arc||!(e.arc<=0||1<e.arc))&&e.arc||1,c=0===e.sideOrientation?0:e.sideOrientation||b.a.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);for(var l=2*Math.PI*s,u=l/a,h=0;h<l;h+=u){var d=Math.cos(h),p=Math.sin(h),f=(d+1)/2,m=(1-p)/2;t.push(o*d,o*p,0),r.push(f,m)}1===s&&(t.push(t[3],t[4],t[5]),r.push(r[2],r[3]));for(var _=t.length/3,g=1;g<_-1;g++)i.push(g+1,0,g);b.a.ComputeNormals(t,i,n),b.a._ComputeSides(c,t,i,n,r,e.frontUVs,e.backUVs);var v=new b.a;return v.indices=i,v.positions=t,v.normals=n,v.uvs=r,v},r.a.CreateDisc=function(e,t,i,n,r,o){void 0===n&&(n=null);var a={radius:t,tessellation:i,sideOrientation:o,updatable:r};return s.CreateDisc(e,a,n)};var s=(n.CreateDisc=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,b.a.CreateDisc(t).applyToMesh(n,t.updatable),n},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(1),r=i(9),o=i(23);i(5).a.ShadersStore.vrMultiviewToSingleviewPixelShader="precision mediump sampler2DArray;\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\nvoid main(void)\n{\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\n}",i(319);var a,s=(a=o.a,Object(n.d)(c,a),c);function c(e,t,i){var n=a.call(this,e,"vrMultiviewToSingleview",["imageIndex"],["multiviewSampler"],i,t,r.a.BILINEAR_SAMPLINGMODE)||this;return n.onSizeChangedObservable.add(function(){}),n.onApplyObservable.add(function(e){t._scene.activeCamera&&t._scene.activeCamera.isLeftCamera?e.setInt("imageIndex",0):e.setInt("imageIndex",1),e.setTexture("multiviewSampler",t._multiviewTexture)}),n}},function(e,t,i){"use strict";i.d(t,"a",function(){return l}),i.d(t,"d",function(){return u}),i.d(t,"b",function(){return h}),i.d(t,"c",function(){return d});var r,n,a,o=i(1),s=i(38),c=i(11),l=(_.prototype.isValid=function(){return!0},_.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},_.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},_.prototype.serialize=function(){},_.prototype._serialize=function(e){return{type:2,children:[],name:e.name,properties:e.properties}},_),u=(a=l,Object(o.d)(m,a),Object.defineProperty(m,"IsEqual",{get:function(){return m._IsEqual}
1,enumerable:!1,configurable:!0}),Object.defineProperty(m,"IsDifferent",{get:function(){return m._IsDifferent},enumerable:!1,configurable:!0}),Object.defineProperty(m,"IsGreater",{get:function(){return m._IsGreater},enumerable:!1,configurable:!0}),Object.defineProperty(m,"IsLesser",{get:function(){return m._IsLesser},enumerable:!1,configurable:!0}),m.prototype.isValid=function(){switch(this.operator){case m.IsGreater:return this._effectiveTarget[this._property]>this.value;case m.IsLesser:return this._effectiveTarget[this._property]<this.value;case m.IsEqual:case m.IsDifferent:var e=this.value.equals?this.value.equals(this._effectiveTarget[this._property]):this.value===this._effectiveTarget[this._property];return this.operator===m.IsEqual?e:!e}return!1},m.prototype.serialize=function(){return this._serialize({name:"ValueCondition",properties:[s.a._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:s.a._SerializeValueAsString(this.value)},{name:"operator",value:m.GetOperatorName(this.operator)}]})},m.GetOperatorName=function(e){switch(e){case m._IsEqual:return"IsEqual";case m._IsDifferent:return"IsDifferent";case m._IsGreater:return"IsGreater";case m._IsLesser:return"IsLesser";default:return""}},m._IsEqual=0,m._IsDifferent=1,m._IsGreater=2,m._IsLesser=3,m),h=(n=l,Object(o.d)(f,n),f.prototype.isValid=function(){return this.predicate()},f),d=(r=l,Object(o.d)(p,r),p.prototype.isValid=function(){return this._target.state===this.value},p.prototype.serialize=function(){return this._serialize({name:"StateCondition",properties:[s.a._GetTargetProperty(this._target),{name:"value",value:this.value}]})},p);function p(e,t,i){var n=r.call(this,e)||this;return n.value=i,n._target=t,n}function f(e,t){var i=n.call(this,e)||this;return i.predicate=t,i}function m(e,t,i,n,r){void 0===r&&(r=m.IsEqual);var o=a.call(this,e)||this;return o.propertyPath=i,o.value=n,o.operator=r,o._target=t,o._effectiveTarget=o._getEffectiveTarget(t,o.propertyPath),o._property=o._getProperty(o.propertyPath),o}function _(e){this._actionManager=e}c.a.RegisteredTypes["BABYLON.ValueCondition"]=u,c.a.RegisteredTypes["BABYLON.PredicateCondition"]=h,c.a.RegisteredTypes["BABYLON.StateCondition"]=d},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.RandomId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},r);function r(){}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"a",function(){return r});var d=i(0);function n(e,t,i,n,r){void 0===r&&(r=null);for(var o=new d.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new d.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),s=i;s<i+n;s++){var c=3*t[s],l=e[c],u=e[1+c],h=e[2+c];o.minimizeInPlaceFromFloats(l,u,h),a.maximizeInPlaceFromFloats(l,u,h)}return r&&(o.x-=o.x*r.x+r.y,o.y-=o.y*r.x+r.y,o.z-=o.z*r.x+r.y,a.x+=a.x*r.x+r.y,a.y+=a.y*r.x+r.y,a.z+=a.z*r.x+r.y),{minimum:o,maximum:a}}function r(e,t,i,n,r){void 0===n&&(n=null);for(var o=new d.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new d.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),s=t,c=t*(r=r||3);s<t+i;s++,c+=r){var l=e[c],u=e[c+1],h=e[c+2];o.minimizeInPlaceFromFloats(l,u,h),a.maximizeInPlaceFromFloats(l,u,h)}return n&&(o.x-=o.x*n.x+n.y,o.y-=o.y*n.x+n.y,o.z-=o.z*n.x+n.y,a.x+=a.x*n.x+n.y,a.y+=a.y*n.x+n.y,a.z+=a.z*n.x+n.y),{minimum:o,maximum:a}}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),r=i(3),o=i(10),a=(Object.defineProperty(d.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0}
1,enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),d.prototype.getClassName=function(){return"ColorCurves"},d.Bind=function(e,t,i,n,r){void 0===i&&(i="vCameraColorCurvePositive"),void 0===n&&(n="vCameraColorCurveNeutral"),void 0===r&&(r="vCameraColorCurveNegative"),e._dirty&&(e._dirty=!1,e.getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e.getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e.getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e.getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(n,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(r,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},d.PrepareUniforms=function(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")},d.prototype.getColorGradingDataToRef=function(e,t,i,n,r){null!=e&&(e=d.clamp(e,0,360),t=d.clamp(t,-100,100),i=d.clamp(i,-100,100),n=d.clamp(n,-100,100),t=d.applyColorGradingSliderNonlinear(t),t*=.5,n=d.applyColorGradingSliderNonlinear(n),t<0&&(t*=-1,e=(e+180)%360),d.fromHSBToRef(e,t,50+.25*n,r),r.scaleToRef(2,r),r.a=1+.01*i)},d.applyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e),t=Math.pow(t,2);return e<0&&(t*=-1),100*t},d.fromHSBToRef=function(e,t,i,n){var r=d.clamp(e,0,360),o=d.clamp(t/100,0,1),a=d.clamp(i/100,0,1);if(0===o)n.r=a,n.g=a,n.b=a;else{r/=60;var s=Math.floor(r),c=r-s,l=a*(1-o),u=a*(1-o*c),h=a*(1-o*(1-c));switch(s){case 0:n.r=a,n.g=h,n.b=l;break;case 1:n.r=u,n.g=a,n.b=l;break;case 2:n.r=l,n.g=a,n.b=h;break;case 3:n.r=l,n.g=u,n.b=a;break;case 4:n.r=h,n.g=l,n.b=a;break;default:n.r=a,n.g=l,n.b=u}}n.a=1},d.clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},d.prototype.clone=function(){return r.a.Clone(function(){return new d},this)},d.prototype.serialize=function(){return r.a.Serialize(this)},d.Parse=function(e){return r.a.Parse(function(){return new d},e,null,null)},Object(n.c)([Object(r.c)()],d.prototype,"_globalHue",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_globalDensity",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_globalSaturation",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_globalExposure",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_highlightsHue",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_highlightsDensity",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_highlightsSaturation",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_highlightsExposure",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_midtonesHue",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_midtonesDensity",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_midtonesSaturation",void 0),Object(n.c)([Object(r.c)()],d.prototype,"_midtonesExposure",void 0),d);function d(){this._dirty=!0,this._tempColor=new o.b(0,0,0,0),this._globalCurve=new o.b(0,0,0,0),this._highlightsCurve=new o.b(0,0,0,0),this._midtonesCurve=new o.b(0,0,0,0),this._shadowsCurve=new o.b(0,0,0,0),this._positiveCurve=new o.b(0,0,0,0),this._negativeCurve=new o.b(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadows
1Hue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}r.a._ColorCurvesParser=a.Parse},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var s=i(7),n=(u.prototype.uploadLevels=function(e,t){switch(this.loadType){case u.COMPRESSED_2D:this._upload2DCompressedLevels(e,t);break;case u.TEX_2D:case u.COMPRESSED_3D:case u.TEX_3D:}},u.prototype._upload2DCompressedLevels=function(e,t){for(var i=u.HEADER_LEN+this.bytesOfKeyValueData,n=this.pixelWidth,r=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){var s=new Int32Array(this.data.buffer,this.data.byteOffset+i,1)[0];i+=4;for(var c=0;c<this.numberOfFaces;c++){var l=new Uint8Array(this.data.buffer,this.data.byteOffset+i,s);e.getEngine()._uploadCompressedDataToTextureDirectly(e,this.glInternalFormat,n,r,l,c,a),i+=s,i+=3-(s+3)%4}n=Math.max(1,.5*n),r=Math.max(1,.5*r)}},u.IsValid=function(e){if(12<=e.byteLength){var t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&49===t[5]&&49===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1},u.HEADER_LEN=64,u.COMPRESSED_2D=0,u.COMPRESSED_3D=1,u.TEX_2D=2,u.TEX_3D=3,u);function u(e,t,i,n){if(this.data=e,this.isInvalid=!1,!u.IsValid(e))return this.isInvalid=!0,void s.a.Error("texture missing KTX identifier");var r=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.data.buffer,this.data.byteOffset+12,13*r),a=67305985===o.getUint32(0,!0);this.glType=o.getUint32(+r,a),this.glTypeSize=o.getUint32(2*r,a),this.glFormat=o.getUint32(3*r,a),this.glInternalFormat=o.getUint32(4*r,a),this.glBaseInternalFormat=o.getUint32(5*r,a),this.pixelWidth=o.getUint32(6*r,a),this.pixelHeight=o.getUint32(7*r,a),this.pixelDepth=o.getUint32(8*r,a),this.numberOfArrayElements=o.getUint32(9*r,a),this.numberOfFaces=o.getUint32(10*r,a),this.numberOfMipmapLevels=o.getUint32(11*r,a),this.bytesOfKeyValueData=o.getUint32(12*r,a),0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===t?this.loadType=u.COMPRESSED_2D:s.a.Error("number of faces expected"+t+", but found "+this.numberOfFaces):s.a.Error("texture arrays not currently supported"):s.a.Error("only 2D textures currently supported")):s.a.Error("only compressed formats currently supported")}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=(Object.defineProperty(o.prototype,"hasHit",{get:function(){return this._hasHit},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"hitDistance",{get:function(){return this._hitDistance},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"hitNormalWorld",{get:function(){return this._hitNormalWorld},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"hitPointWorld",{get:function(){return this._hitPointWorld},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rayFromWorld",{get:function(){return this._rayFromWorld},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rayToWorld",{get:function(){return this._rayToWorld},enumerable:!1,configurable:!0}),o.prototype.setHitData=function(e,t){this._hasHit=!0,this._hitNormalWorld=new n.e(e.x,e.y,e.z),this._hitPointWorld=new n.e(t.x,t.y,t.z)},o.prototype.setHitDistance=function(e){this._hitDistance=e},o.prototype.calculateHitDistance=function(){this._hitDistance=n.e.Distance(this._rayFromWorld,this._hitPointWorld)},o.prototype.reset=function(e,t){void 0===e&&(e=n.e.Zero()),void 0===t&&(t=n.e.Zero()),this._rayFromWorld=e,this._rayToWorld=t,this._hasHit=!1,this._hitDistance=0,this._hitNormalWorld=n.e.Zero(),this._hitPointWorld=n.e.Zero()},o);function o(){this._hasHit=!1,this._hitDistance=0,this._hitNormalWorld=n.e.Zero(),this._hitPointWorld=n.e.Zero(),this._rayFromWorld=n.e.Zero(),this._rayToWorld=n.e.Zero()}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var l=i(10),s=i(60),u=i(114),h=i(22),d=i(64),c=i(35),n=(Object.defineProperty(p.prototype,"emitterNode",{get:function(){return this._emitterNode}
1,enumerable:!1,configurable:!0}),p.prototype.setEmitterAsSphere=function(e,t,i){this._emitterNode&&this._emitterNode.dispose(),this._emitterCreationOptions={kind:"Sphere",options:e,renderingGroupId:t};var n=s.a.CreateSphere("emitterSphere",{diameter:e.diameter,segments:e.segments},i);n.renderingGroupId=t;var r=new c.a("emitterSphereMaterial",i);r.emissiveColor=e.color,n.material=r;for(var o=0,a=this.systems;o<a.length;o++)a[o].emitter=n;this._emitterNode=n},p.prototype.start=function(e){for(var t=0,i=this.systems;t<i.length;t++){var n=i[t];e&&(n.emitter=e),n.start()}},p.prototype.dispose=function(){for(var e=0,t=this.systems;e<t.length;e++)t[e].dispose();this.systems=[],this._emitterNode&&(this._emitterNode.dispose(),this._emitterNode=null)},p.prototype.serialize=function(e){void 0===e&&(e=!1);for(var t={systems:[]},i=0,n=this.systems;i<n.length;i++){var r=n[i];t.systems.push(r.serialize(e))}return this._emitterNode&&(t.emitter=this._emitterCreationOptions),t},p.Parse=function(e,t,i){void 0===i&&(i=!1);var n=new p,r=this.BaseAssetsUrl+"/textures/";t=t||h.a.LastCreatedScene;for(var o=0,a=e.systems;o<a.length;o++){var s=a[o];n.systems.push(i?u.a.Parse(s,t,r,!0):d.a.Parse(s,t,r,!0))}if(e.emitter){var c=e.emitter.options;switch(e.emitter.kind){case"Sphere":n.setEmitterAsSphere({diameter:c.diameter,segments:c.segments,color:l.a.FromArray(c.color)},e.emitter.renderingGroupId,t)}}return n},p.BaseAssetsUrl="https://assets.babylonjs.com/particles",p);function p(){this.systems=new Array}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var a=i(7),s=i(11),n=(r.Instantiate=function(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];var t=s.a.GetClass(e);if(t)return t;a.a.Warn(e+" not found, you may have missed an import.");for(var i=e.split("."),n=window||this,r=0,o=i.length;r<o;r++)n=n[i[r]];return"function"!=typeof n?null:n},r.RegisteredExternalClasses={},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return f});var T=i(26),a=i(235),u=i(6),n=i(18),g=i(0),o=i(72),r=i(166),f=(Object.defineProperty(s.prototype,"syncRoot",{get:function(){return this._syncRoot},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"masterFrame",{get:function(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"weight",{get:function(){return this._weight},set:function(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){for(var t=0;t<this._runtimeAnimations.length;t++)this._runtimeAnimations[t]._prepareForSpeedRatioChange(e);this._speedRatio=e},enumerable:!1,configurable:!0}),s.prototype.syncWith=function(e){var t;return(this._syncRoot=e)&&-1<(t=this._scene._activeAnimatables.indexOf(this))&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this)),this},s.prototype.getAnimations=function(){return this._runtimeAnimations},s.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n<t.length;n++){var r=t[n],o=new a.a(e,r,this._scene,this);o._onLoop=function(){i.onAnimationLoopObservable.notifyObservers(i),i.onAnimationLoop&&i.onAnimationLoop()},this._runtimeAnimations.push(o)}},s.prototype.getAnimationByTargetProperty=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)if(t[i].animation.targetProperty===e)return t[i].animation;return null},s.prototype.getRuntimeAnimationByTargetProperty=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)if(t[i].animation.targetProperty===e)return t[i];return null},s.prototype.reset=function(){for(var e=this._runtimeAnimations,t=0;t<e.length;t++)e[t].reset(!0);this._localDelayOffset=null,this._pausedDelay=null},s.prototype.enableBlending=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)t[i].animation.enableBlending=!0,t[i].animation.blendingSpeed=e},s.prototype.disableBlending=function(){for(var e=this._runtimeAnimations,t=0;t<e.length;t++)e[t].animation.enableBlending=!1},s.prototype.goToFrame=function(e){var t,i,n,r=this._runtimeAnimations;r[0]&&(t=r[0].animation.framePerSecond,i=r[0].currentFrame,n=0===this.speedRatio?0:(e-i)/t*1e3/this.speedRatio,null===this._localDelayOffset&&(this._localDelayOffset=0),this._localDelayOffset-=n);for(var o=0;o<r.length;o++)r[o].goToFrame(e)},s.prototype.pause=function(){this._paused||(this._paused=!0)},s.prototype.restart=function(){this._paused=!1},s.prototype._raiseOnAnimationEnd=function(){this.onAnimationEnd&&this.onAnimationEnd(),this.onAnimationEndObservable.notifyObservers(this)},s.prototype.stop=function(e,t){if(e||t){var i=this._scene._activeAnimatables.indexOf(this);if(-1<i){for(var n=(o=this._runtimeAnimations).length-1;0<=n;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(-1<(n=this._scene._activeAnimatables.indexOf(this))){this._scene._activeAnimatables.splice(n,1);for(var o=this._runtimeAnimations,n=0;n<o.length;n++)o[n].dispose();this._raiseOnAnimationEnd()}},s.prototype.waitAsync=function(){var i=this;return new Promise(function(e,t){i.onAnimationEndObservable.add(function(){e(i)},void 0,void 0,i,!0)})},s.prototype._animate=function(e){if(this._paused)return this.animationStarted=!1,null===this._pausedDelay&&(this._pausedDelay=e),!0;if(null===this._localDelayOffset?(this._localDelayOffset=e,this._pausedDelay=null):null!==this._pausedDelay&&(this._localDelayOffset+=e-this._pausedDelay,this._pausedDelay=null),0===this._weight)return!0;for(var t=!1,i=this._runtimeAnimations,n=0;n<i.length;
1n++)var r=i[n].animate(e-this._localDelayOffset,this.fromFrame,this.toFrame,this.loopAnimation,this._speedRatio,this._weight),t=t||r;if(!(this.animationStarted=t)){if(this.disposeOnEnd)for(n=this._scene._activeAnimatables.indexOf(this),this._scene._activeAnimatables.splice(n,1),n=0;n<i.length;n++)i[n].dispose();this._raiseOnAnimationEnd(),this.disposeOnEnd&&(this.onAnimationEnd=null,this.onAnimationLoop=null,this.onAnimationLoopObservable.clear(),this.onAnimationEndObservable.clear())}return t},s);function s(e,t,i,n,r,o,a,s,c,l){void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=!1),void 0===o&&(o=1),void 0===l&&(l=!1),this.target=t,this.fromFrame=i,this.toFrame=n,this.loopAnimation=r,this.onAnimationEnd=a,this.onAnimationLoop=c,this.isAdditive=l,this._localDelayOffset=null,this._pausedDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this._syncRoot=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new u.c,this.onAnimationLoopObservable=new u.c,this._scene=e,s&&this.appendAnimations(t,s),this._speedRatio=o,e._activeAnimatables.push(this)}n.a.prototype._animate=function(){if(this.animationsEnabled){var e=o.a.Now;if(!this._animationTimeLast){if(0<this._pendingData.length)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;var t=this._activeAnimatables;if(0!==t.length){this._animationTime+=this.deltaTime;for(var i=this._animationTime,n=0;n<t.length;n++){var r=t[n];!r._animate(i)&&r.disposeOnEnd&&n--}this._processLateAnimationBindings()}}},n.a.prototype.beginWeightedAnimation=function(e,t,i,n,r,o,a,s,c,l,u){void 0===n&&(n=1),void 0===o&&(o=1),void 0===u&&(u=!1);var h=this.beginAnimation(e,t,i,r,o,a,s,!1,c,l,u);return h.weight=n,h},n.a.prototype.beginAnimation=function(e,t,i,n,r,o,a,s,c,l,u){void 0===r&&(r=1),void 0===s&&(s=!0),void 0===u&&(u=!1),i<t&&0<r&&(r*=-1),s&&this.stopAnimation(e,void 0,c),a=a||new f(this,e,t,i,n,r,o,void 0,l,u);var h=!c||c(e);if(e.animations&&h&&a.appendAnimations(e,e.animations),e.getAnimatables)for(var d=e.getAnimatables(),p=0;p<d.length;p++)this.beginAnimation(d[p],t,i,n,r,o,a,s,c,l);return a.reset(),a},n.a.prototype.beginHierarchyAnimation=function(e,t,i,n,r,o,a,s,c,l,u,h){void 0===o&&(o=1),void 0===c&&(c=!0),void 0===h&&(h=!1);var d=e.getDescendants(t),p=[];p.push(this.beginAnimation(e,i,n,r,o,a,s,c,l,void 0,h));for(var f=0,m=d;f<m.length;f++){var _=m[f];p.push(this.beginAnimation(_,i,n,r,o,a,s,c,l,void 0,h))}return p},n.a.prototype.beginDirectAnimation=function(e,t,i,n,r,o,a,s,c){return void 0===c&&(c=!1),void 0===o&&(o=1),n<i&&0<o&&(o*=-1),new f(this,e,i,n,r,o,a,t,s,c)},n.a.prototype.beginDirectHierarchyAnimation=function(e,t,i,n,r,o,a,s,c,l){void 0===l&&(l=!1);var u=e.getDescendants(t),h=[];h.push(this.beginDirectAnimation(e,i,n,r,o,a,s,c,l));for(var d=0,p=u;d<p.length;d++){var f=p[d];h.push(this.beginDirectAnimation(f,i,n,r,o,a,s,c,l))}return h},n.a.prototype.getAnimatableByTarget=function(e){for(var t=0;t<this._activeAnimatables.length;t++)if(this._activeAnimatables[t].target===e)return this._activeAnimatables[t];return null},n.a.prototype.getAllAnimatablesByTarget=function(e){for(var t=[],i=0;i<this._activeAnimatables.length;i++)this._activeAnimatables[i].target===e&&t.push(this._activeAnimatables[i]);return t},n.a.prototype.stopAnimation=function(e,t,i){for(var n=0,r=this.getAllAnimatablesByTarget(e);n<r.length;n++)r[n].stop(t,i)},n.a.prototype.stopAllAnimations=function(){if(this._activeAnimatables){for(var e=0;e<this._activeAnimatables.length;e++)this._activeAnimatables[e].stop();this._activeAnimatables=[]}for(var t=0,i=this.animationGroups;t<i.length;t++)i[t].stop()},n.a.prototype._registerTargetForLateAnimationBinding=function(e,t){var i=e.target;this._registeredForLateAnimationBindings.pushNoDuplicate(i),i._lateAnimationHolders||(i._lateAnimationHolders={}),i._lateAnimationHolders[e.targetPath]||(i._lateAnimationHolders[e.targetPath]={totalWeight:0,totalAdditiveWeight:0,animations:[],additiveAnimations:[],originalValue:t}),e.isAdditive?(i._lateAnimationHolders[e.targetPath].additiveAnimations.push(e),i._lateAnimationHolders[e.targetPath].totalAdditiveWeight+=e.weight):(i._lateAnimationHolders[e.targetPath].animations.push(e),i._lateAnimationHolders[e.targetPath].totalWeight+=e.weight)},n.a.prototype._processLateAnimationBindingsForMatrices=function(e){if(0===e.totalWeight&&0===e.totalAdditiveWeight)return e.originalValue;var t=1,i=g.c.Vector3[0],n=g.c.Vector3[1],r=g.c.Quaternion[0],o=0,a=e.animations[0],s=e.originalValue,c=1,l=!1;if(e.totalWeight<1)c=1-e.totalWeight,s.decompose(n,r,i);else{if(o=1,t=e.totalWeight,1==(c=a.weight/t)){if(!e.totalAdditiveWeight)return a.currentValue;l=!0}a.currentValue.decompose(n,r,i)}if(!l){n.scaleInPlace(c),i.scaleInPlace(c),r.scaleInPlace(c);for(var u,h,d,p=o;p<e.animations.length;p++){0!==(f=e.animations[p]).weight&&(c=f.weight/t,u=g.c.Vector3[2],h=g.c.Vector3[3],d=g.c.Quaternion[1],f.currentValue.decompose(h,d,u),h.scaleAndAddToRef(c,n),d.scaleAndAddToRef(c,r),u.scaleAndAddToRef(c,i))}}for(var f,m=0;m<e.additiveAnimations.length;m++){0!==(f=e.additiveAnimations[m]).weight&&(u=g.c.Vector3[2],h=g.c.Vector3[3],d=g.c.Quaternion[1],f.currentValue.decompose(h,d,u),h.multiplyToRef(n,h),g.e.LerpToRef(n,h,f.weight,n),r.multiplyToRef(d,d),g.b.SlerpToRef(r,d,f.weight,r),u.scaleAndAddToRef(f.weight,i))}var _=a?a._animationState.workValue:g.c.Matrix[0].clone();return g.a.ComposeToRef(n,r,i,_),_},n.a.prototype._processLateAnimationBindingsForQuaternions=function(e,t){if(0===e.totalWeight&&0===e.totalAdditiveWeight)return t;var i=e.animations[0],n=e.originalValue,r=t;if(0===e.totalWeight&&0<e.totalAdditiveWeight)r.copyFrom(n);else if(1===e.animations.length){if(g.b.SlerpToRef(n,i.currentValue,Math.min(1,e.totalWeight),r),0===e.totalAdditiveWeight)return r}else if(1<e.animations.length){var o=1,a=void 0,s=void 0;if(e.totalWeight<1){var c=1-e.totalWeight,s=[];(a=[]).push(n),s.push(c)}else{if(2===e.animations.length&&(g.b.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;a=[],s=[],o=e.totalWeight}for(var l=0;l<e.animations.length;l++){var u=e.animations[l];a.push(u.currentValue),s.push(u.weight/o)}for(var h=0,d=0;d<a.length;)d?(h+=s[d],g.b.SlerpToRef(r,a[d],s[d]/h,r),d++):(g.b.SlerpToRef(a[d],a[d+1],s[d+1]/(s[d]+s[d+1]),t),r=t,h=s[d]+s[d+1],d+=2)}for(var p=0;p<e.additiveAnimations.length;p++)0!==(u=e.additiveAnimations[p]).weight&&(r.multiplyToRef(u.currentValue,g.c.Quaternion[0]),g.b.SlerpToRef(r,g.c.Quaternion[0],u.weight,r));return r},n.a.prototype._processLateAnimationBindings=function(){if(this._registeredForLateAnimationBindings.length){for(var e=0;e<this._registeredForLateAnimationBindings.length;e++){var t=this._registeredForLateAnimationBindings.data[e];for(var i in t._lateAnimationHolders){var n=t._lateAnimationHolders[i],r=n.animations[0],o=n.originalValue,a=T.a.AllowMatrixDecomposeForInterpolation&&o.m,s=t[i];if(a)s=this._processLateAnimationBindingsForMatrices(n);else if(void 0!==o.w)s=this._processLateAnimationBindingsForQuaternions(n,s||g.b.Identity());else{var c,l=0,u=1;n.totalWeight<1?s=r&&o.scale?o.scale(1-n.totalWeight):r?o*(1-n.totalWeight):o.clone?o.clone():o:r&&(u=n.totalWeight,s=1!=(c=r.weight/u)?r.currentValue.scale?r.currentValue.scale(c):r.currentValue*c:r.currentValue,l=1);for(var h=l;h<n.animations.length;h++)(p=(d=n.animations[h]).weight/u)&&(d.currentValue.scaleAndAddToRef?d.currentValue.scaleAndAddToRef(p,s):s+=d.currentValue*p);for(var d,p,f=0;f<n.additiveAnimations.length;f++){(p=(d=n.additiveAnimations[f]).weight)&&(d.currentValue.scaleAndAddToRef?d.currentValue.scaleAndAddToRef(p,s):s+=d.currentValue*p)}}t[i]=s}t._lateAnimationHolders={}}this._registeredForLateAnimationBindings.reset()}},r.a.prototype.copyAnimationRange=function(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),0===this.animations.length&&(this.animations.push(new T.a(this.name,"_matrix",e.animations[0].framePerSecond,T.a.ANIMATIONTYPE_MATRIX,0)),this.animations[0].setKeys([]));var o=e.animations[0].getRange(t);if(!o)return!1;for(var a,s,c,l=o.from,u=o.to,h=e.animations[0].getKeys(),d=e.length,p=e.getParent(),f=this.getParent(),m=n&&p&&d&&this.length&&d!==this.length,_=m&&f&&p?f.length/p.length:1,g=n&&!f&&r&&(1!==r.x||1!==r.y||1!==r.z),v=this.animations[0].getKeys(),b=0,y=h.length;b<y;b++)(a=h[b]).frame>=l&&a.frame<=u&&(n?(c=a.value.clone(),m?(s=c.getTranslation(),c.setTranslation(s.scaleInPlace(_))):g&&r?(s=c.getTranslation(),c.setTranslation(s.multiplyInPlace(r))):c=a.value):c=a.value,v.push({frame:a.frame+i,value:c}));return this.animations[0].createRange(t,l+i,u+i),!0}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});
1var n=i(18),r=i(17),o=i(259),a=i(117),s=i(258),c=i(146),l=i(251);Object.defineProperty(n.a.prototype,"gamepadManager",{get:function(){var e;return this._gamepadManager||(this._gamepadManager=new o.a(this),(e=this._getComponent(r.a.NAME_GAMEPAD))||(e=new u(this),this._addComponent(e))),this._gamepadManager},enumerable:!0,configurable:!0}),a.a.prototype.addGamepad=function(){return this.add(new s.a),this},c.a.prototype.addGamepad=function(){return this.add(new l.a),this};var u=(h.prototype.register=function(){this.scene._beforeCameraUpdateStage.registerStep(r.a.STEP_BEFORECAMERAUPDATE_GAMEPAD,this,this._beforeCameraUpdate)},h.prototype.rebuild=function(){},h.prototype.dispose=function(){var e=this.scene._gamepadManager;e&&(e.dispose(),this.scene._gamepadManager=null)},h.prototype._beforeCameraUpdate=function(){var e=this.scene._gamepadManager;e&&e._isMonitoring&&e._checkGamepadsStatus()},h);function h(e){this.name=r.a.NAME_GAMEPAD,this.scene=e}},function(e,t,i){"use strict";var c=i(1),l=i(27),u=i(7),h=i(2);i(31).a.prototype.createRenderTargetCubeTexture=function(e,t){var i=Object(c.a)({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:h.a.TEXTURETYPE_UNSIGNED_INT,samplingMode:h.a.TEXTURE_TRILINEAR_SAMPLINGMODE,format:h.a.TEXTUREFORMAT_RGBA},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(i.type!==h.a.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==h.a.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=h.a.TEXTURE_NEAREST_SAMPLINGMODE);var n=this._gl,r=new l.a(this,l.b.RenderTarget);this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,r,!0);var o=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);i.type!==h.a.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=h.a.TEXTURETYPE_UNSIGNED_INT,u.a.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,o.mag),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,o.min),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);for(var a=0;a<6;a++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var s=n.createFramebuffer();return this._bindUnboundFramebuffer(s),r._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,e,e),i.generateMipMaps&&n.generateMipmap(n.TEXTURE_CUBE_MAP),this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),r._framebuffer=s,r.width=e,r.height=e,r.isReady=!0,r.isCube=!0,r.samples=1,r.generateMipMaps=i.generateMipMaps,r.samplingMode=i.samplingMode,r.type=i.type,r.format=i.format,r._generateDepthBuffer=i.generateDepthBuffer,r._generateStencilBuffer=i.generateStencilBuffer,this._internalTexturesCache.push(r),r}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.fogFragmentDeclaration="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif"},function(e,t,i){"use strict";var o=i(31),a=i(27);o.a.prototype.createDynamicTexture=function(e,t,i,n){var r=new a.a(this,a.b.Dynamic);return r.baseWidth=e,r.baseHeight=t,i&&(e=this.needPOTTextures?o.a.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?o.a.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},o.a.prototype.updateDynamicTexture=function(e,t,i,n,r,o){var a;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),a=r?this._getInternalFormat(r):this._gl.RGBA,this._gl.texImage2D(this._gl.TEXTURE_2D,0,a,a,this._gl.UNSIGNED_BYTE,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),n&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0)}},function(e,t,i){"use strict";var n=i(148),r=i(62);Object.defineProperty(r.a.prototype,"sphericalPolynomial",{get:function(){if(this._texture){if(this._texture._sphericalPolynomial)return this._texture._sphericalPolynomial;if(this._texture.isReady)return this._texture._sphericalPolynomial=n.a.ConvertCubeMapTextureToSphericalPolynomial(this),this._texture._sphericalPolynomial}return null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0})},function(e,t,i){"use strict";i.r(t);var n=i(42);i.d(t,"AbstractScene",function(){return n.a});var r=i(432);i.d(t,"AbstractActionManager",function(){return r.a}),i.d(t,"Action",function(){return r.b}),i.d(t,"ActionEvent",function(){return r.c}),i.d(t,"ActionManager",function(){return r.d}),i.d(t,"Condition",function(){return r.f}),i.d(t,"ValueCondition",function(){return r.u}),i.d(t,"PredicateCondition",function(){return r.m}),i.d(t,"StateCondition",function(){return r.q}),i.d(t,"SwitchBooleanAction",function(){return r.t}),i.d(t,"SetStateAction",function(){return r.o}),i.d(t,"SetValueAction",function(){return r.p}),i.d(t,"IncrementValueAction",function(){return r.i}),i.d(t,"PlayAnimationAction",function(){return r.k}),i.d(t,"StopAnimationAction",function(){return r.r}),i.d(t,"DoNothingAction",function(){return r.g}),i.d(t,"CombineAction",function(){return r.e}),i.d(t,"ExecuteCodeAction",function(){return r.h}),i.d(t,"SetParentAction",function(){return r.n}),i.d(t,"PlaySoundAction",function(){return r.l}),i.d(t,"StopSoundAction",function(){return r.s}),i.d(t,"InterpolateValueAction",function(){return r.j});var o=i(322);for(var a in o)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return o[e]})}(a);var s=i(245);i.d(t,"KeepAssets",function(){return s.c}),i.d(t,"InstantiatedEntries",function(){return s.b}),i.d(t,"AssetContainer",function(){return s.a});var c=i(422);i.d(t,"Analyser",function(){return c.a}),i.d(t,"AudioEngine",function(){return c.b}),i.d(t,"AudioSceneComponent",function(){return c.c}),i.d(t,"Sound",function(){return c.d}),i.d(t,"SoundTrack",function(){return c.e}),i.d(t,"WeightedSound",function(){return c.f});var l=i(326);for(var a in l)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return l[e]})}(a);var u=i(433);
1i.d(t,"Bone",function(){return u.a}),i.d(t,"BoneIKController",function(){return u.b}),i.d(t,"BoneLookController",function(){return u.c}),i.d(t,"Skeleton",function(){return u.d});var h=i(415);i.d(t,"ArcRotateCameraGamepadInput",function(){return h.g}),i.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return h.i}),i.d(t,"ArcRotateCameraMouseWheelInput",function(){return h.j}),i.d(t,"ArcRotateCameraPointersInput",function(){return h.k}),i.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return h.l}),i.d(t,"FlyCameraKeyboardInput",function(){return h.s}),i.d(t,"FlyCameraMouseInput",function(){return h.t}),i.d(t,"FollowCameraKeyboardMoveInput",function(){return h.w}),i.d(t,"FollowCameraMouseWheelInput",function(){return h.x}),i.d(t,"FollowCameraPointersInput",function(){return h.y}),i.d(t,"FreeCameraDeviceOrientationInput",function(){return h.A}),i.d(t,"FreeCameraGamepadInput",function(){return h.B}),i.d(t,"FreeCameraKeyboardMoveInput",function(){return h.D}),i.d(t,"FreeCameraMouseInput",function(){return h.E}),i.d(t,"FreeCameraTouchInput",function(){return h.F}),i.d(t,"FreeCameraVirtualJoystickInput",function(){return h.G}),i.d(t,"CameraInputTypes",function(){return h.n}),i.d(t,"CameraInputsManager",function(){return h.o}),i.d(t,"Camera",function(){return h.m}),i.d(t,"TargetCamera",function(){return h.N}),i.d(t,"FreeCamera",function(){return h.z}),i.d(t,"FreeCameraInputsManager",function(){return h.C}),i.d(t,"TouchCamera",function(){return h.O}),i.d(t,"ArcRotateCamera",function(){return h.f}),i.d(t,"ArcRotateCameraInputsManager",function(){return h.h}),i.d(t,"DeviceOrientationCamera",function(){return h.p}),i.d(t,"FlyCamera",function(){return h.q}),i.d(t,"FlyCameraInputsManager",function(){return h.r}),i.d(t,"FollowCamera",function(){return h.u}),i.d(t,"ArcFollowCamera",function(){return h.e}),i.d(t,"FollowCameraInputsManager",function(){return h.v}),i.d(t,"GamepadCamera",function(){return h.H}),i.d(t,"AnaglyphArcRotateCamera",function(){return h.a}),i.d(t,"AnaglyphFreeCamera",function(){return h.b}),i.d(t,"AnaglyphGamepadCamera",function(){return h.c}),i.d(t,"AnaglyphUniversalCamera",function(){return h.d}),i.d(t,"StereoscopicArcRotateCamera",function(){return h.J}),i.d(t,"StereoscopicFreeCamera",function(){return h.K}),i.d(t,"StereoscopicGamepadCamera",function(){return h.L}),i.d(t,"StereoscopicUniversalCamera",function(){return h.M}),i.d(t,"UniversalCamera",function(){return h.P}),i.d(t,"VirtualJoysticksCamera",function(){return h.V}),i.d(t,"VRCameraMetrics",function(){return h.Q}),i.d(t,"VRDeviceOrientationArcRotateCamera",function(){return h.R}),i.d(t,"VRDeviceOrientationFreeCamera",function(){return h.S}),i.d(t,"VRDeviceOrientationGamepadCamera",function(){return h.T}),i.d(t,"OnAfterEnteringVRObservableEvent",function(){return h.I}),i.d(t,"VRExperienceHelper",function(){return h.U}),i.d(t,"WebVRFreeCamera",function(){return h.W});var d=i(434);i.d(t,"Collider",function(){return d.a}),i.d(t,"DefaultCollisionCoordinator",function(){return d.b}),i.d(t,"PickingInfo",function(){return d.d}),i.d(t,"IntersectionInfo",function(){return d.c}),i.d(t,"_MeshCollisionData",function(){return d.e});var p=i(425);i.d(t,"BoundingBox",function(){return p.a}),i.d(t,"BoundingInfo",function(){return p.b}),i.d(t,"BoundingSphere",function(){return p.c}),i.d(t,"Octree",function(){return p.d}),i.d(t,"OctreeBlock",function(){return p.e}),i.d(t,"OctreeSceneComponent",function(){return p.f}),i.d(t,"Ray",function(){return p.g});var f=i(144);i.d(t,"AxesViewer",function(){return f.AxesViewer}),i.d(t,"BoneAxesViewer",function(){return f.BoneAxesViewer}),i.d(t,"DebugLayerTab",function(){return f.DebugLayerTab}),i.d(t,"DebugLayer",function(){return f.DebugLayer}),i.d(t,"PhysicsViewer",function(){return f.PhysicsViewer}),i.d(t,"RayHelper",function(){return f.RayHelper}),i.d(t,"SkeletonViewer",function(){return f.SkeletonViewer});var m=i(336);for(var a in m)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return m[e]})}(a);var _=i(338);for(var a in _)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return _[e]})}(a);var g=i(439);i.d(t,"KeyboardEventTypes",function(){return g.c}),i.d(t,"KeyboardInfo",function(){return g.d}),i.d(t,"KeyboardInfoPre",function(){return g.e}),i.d(t,"PointerEventTypes",function(){return g.f}),i.d(t,"PointerInfoBase",function(){return g.h}),i.d(t,"PointerInfoPre",function(){return g.i}),i.d(t,"PointerInfo",function(){return g.g}),i.d(t,"ClipboardEventTypes",function(){return g.a}),i.d(t,"ClipboardInfo",function(){return g.b});var v=i(421);i.d(t,"DaydreamController",function(){return v.a}),i.d(t,"GearVRController",function(){return v.h}),i.d(t,"GenericController",function(){return v.i}),i.d(t,"OculusTouchController",function(){return v.k}),i.d(t,"PoseEnabledControllerType",function(){return v.n}),i.d(t,"PoseEnabledControllerHelper",function(){return v.m}),i.d(t,"PoseEnabledController",function(){return v.l}),i.d(t,"ViveController",function(){return v.p}),i.d(t,"WebVRController",function(){return v.q}),i.d(t,"WindowsMotionController",function(){return v.r}),i.d(t,"XRWindowsMotionController",function(){return v.s}),i.d(t,"StickValues",function(){return v.o}),i.d(t,"Gamepad",function(){return v.e}),i.d(t,"GenericPad",function(){return v.j}),i.d(t,"GamepadManager",function(){return v.f}),i.d(t,"GamepadSystemSceneComponent",function(){return v.g}),i.d(t,"Xbox360Button",function(){return v.t}),i.d(t,"Xbox360Dpad",function(){return v.u}),i.d(t,"Xbox360Pad",function(){return v.v}),i.d(t,"DualShockButton",function(){return v.b}),i.d(t,"DualShockDpad",function(){return v.c}),i.d(t,"DualShockPad",function(){return v.d});var b=i(420);i.d(t,"AxisDragGizmo",function(){return b.a}),i.d(t,"AxisScaleGizmo",function(){return b.b}),i.d(t,"BoundingBoxGizmo",function(){return b.c}),i.d(t,"Gizmo",function(){return b.d}),i.d(t,"GizmoManager",function(){return b.e}),i.d(t,"PlaneRotationGizmo",function(){return b.h}),i.d(t,"PositionGizmo",function(){return b.i}),i.d(t,"RotationGizmo",function(){return b.j}),i.d(t,"ScaleGizmo",function(){return b.k}),i.d(t,"LightGizmo",function(){return b.f}),i.d(t,"PlaneDragGizmo",function(){return b.g});var y=i(426);i.d(t,"EnvironmentHelper",function(){return y.a}),i.d(t,"PhotoDome",function(){return y.b}),i.d(t,"_forceSceneHelpersToBundle",function(){return y.d}),i.d(t,"VideoDome",function(){return y.c});var T=i(435);i.d(t,"EngineInstrumentation",function(){return T.a}),i.d(t,"SceneInstrumentation",function(){return T.b}),i.d(t,"_TimeToken",function(){return T.c});var E=i(423);i.d(t,"EffectLayer",function(){return E.a}),i.d(t,"EffectLayerSceneComponent",function(){return E.b}),i.d(t,"GlowLayer",function(){return E.c}),i.d(t,"HighlightLayer",function(){return E.d}),i.d(t,"Layer",function(){return E.e}),i.d(t,"LayerSceneComponent",function(){return E.f});var S=i(424);i.d(t,"LensFlare",function(){return S.a}),i.d(t,"LensFlareSystem",function(){return S.b}),i.d(t,"LensFlareSystemSceneComponent",function(){return S.c});var A=i(418);i.d(t,"Light",function(){return A.d}),i.d(t,"ShadowLight",function(){return A.h}),i.d(t,"ShadowGenerator",function(){return A.f}),i.d(t,"CascadedShadowGenerator",function(){return A.a}),i.d(t,"ShadowGeneratorSceneComponent",function(){return A.g}),i.d(t,"DirectionalLight",function(){return A.b}),i.d(t,"HemisphericLight",function(){return A.c}),i.d(t,"PointLight",function(){return A.e}),i.d(t,"SpotLight",function(){return A.i});var C=i(428);i.d(t,"DefaultLoadingScreen",function(){return C.b}),i.d(t,"_BabylonLoaderRegistered",function(){return C.f}),i.d(t,"BabylonFileLoaderConfiguration",function(){return C.a}),i.d(t,"SceneLoaderAnimationGroupLoadingMode",function(){return C.d}),i.d(t,"SceneLoader",function(){return C.c}),i.d(t,"SceneLoaderFlags",function(){return C.e});var P=i(352);for(var a in P)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return P[e]})}(a);var x=i(372);i.d(t,"Scalar",function(){return x.r}),i.d(t,"Space",function(){return x.t}),i.d(t,"Axis",function(){return x.c}),i.d(t,"Color3",function(){return x.e}),i.d(t,"Color4",function(){return x.f}),i.d(t,"TmpColors",function(){return x.w}),i.d(t,"ToGammaSpace",function(){return x.y}),i.d(t,"ToLinearSpace",function(){return x.z}),i.d(t,"Epsilon",function(){return x.h}),i.d(t,"Frustum",function(){return x.i}),i.d(t,"Orientation",function(){return x.k}),i.d(t,"BezierCurve",function(){return x.d}),i.d(t,"Angle",function(){return x.a}),i.d(t,"Arc2",function(){return x.b}),i.d(t,"Path2",function(){return x.l}),i.d(t,"Path3D",function(){return x.m}),i.d(t,"Curve3",function(){return x.g}),i.d(t,"Plane",function(){return x.n}),i.d(t,"Size",function(){return x.s}),i.d(t,"Vector2",function(){return x.A}),i.d(t,"Vector3",function(){return x.B}),i.d(t,"Vector4",function(){return x.C}),i.d(t,"Quaternion",function(){return x.q}),i.d(t,"Matrix",function(){return x.j}),i.d(t,"TmpVectors",function(){return x.x}),i.d(t,"PositionNormalVertex",function(){return x.p}),i.d(t,"PositionNormalTextureVertex",function(){return x.o}),i.d(t,"Viewport",function(){return x.D}),i.d(t,"SphericalHarmonics",function(){return x.u}),i.d(t,"SphericalPolynomial",function(){return x.v});var R=i(416);i.d(t,"AbstractMesh",function(){return R.a}),i.d(t,"Buffer",function(){return R.c}),i.d(t,"VertexBuffer",function(){return R.R}),i.d(t,"DracoCompression",function(){return R.i}),i.d(t,"CSG",function(){return R.d}),i.d(t,"Geometry",function(){return R.j}),i.d(t,"GroundMesh",function(){return R.l}),i.d(t,"TrailMesh",function(){return R.O}),i.d(t,"InstancedMesh",function(){return R.p}),i.d(t,"LinesMesh",function(){return R.s}),i.d(t,"InstancedLinesMesh",function(){return R.o}),i.d(t,"_CreationDataStorage",function(){return R.U}),i.d(t,"_InstancesBatch",function(){return R.V}),i.d(t,"Mesh",function(){return R.t}),i.d(t,"VertexData",function(){return R.S}),i.d(t,"MeshBuilder",function(){return R.u}),i.d(t,"SimplificationSettings",function(){return R.G}),i.d(t,"SimplificationQueue",function(){return R.F}),i.d(t,"SimplificationType",function(){return R.H}),i.d(t,"QuadraticErrorSimplification",function(){return R.B}),i.d(t,"SimplicationQueueSceneComponent",function(){return R.E}),i.d(t,"Polygon",function(){return R.x}),i.d(t,"PolygonMeshBuilder",function(){return R.z}),i.d(t,"SubMesh",function(){return R.J}),i.d(t,"MeshLODLevel",function(){return R.v}),i.d(t,"TransformNode",function(){return R.P}),i.d(t,"BoxBuilder",function(){return R.b}),i.d(t,"TiledBoxBuilder",function(){return R.K}),i.d(t,"DiscBuilder",function(){return R.h}),i.d(t,"RibbonBuilder",function(){return R.C}),i.d(t,"SphereBuilder",function(){return R.I}),i.d(t,"HemisphereBuilder",function(){return R.m}),i.d(t,"CylinderBuilder",function(){return R.e}),i.d(t,"TorusBuilder",function(){return R.M}),i.d(t,"TorusKnotBuilder",function(){return R.N}),i.d(t,"LinesBuilder",function(){return R.r}),i.d(t,"PolygonBuilder",function(){return R.y}),i.d(t,"ShapeBuilder",function(){return R.D}),i.d(t,"LatheBuilder",function(){return R.q}),i.d(t,"PlaneBuilder",function(){return R.w}),i.d(t,"TiledPlaneBuilder",function(){return R.L}),i.d(t,"GroundBuilder",function(){return R.k}),i.d(t,"TubeBuilder",function(){return R.Q}),i.d(t,"PolyhedronBuilder",function(){return R.A}),i.d(t,"IcoSphereBuilder",function(){return R.n}),i.d(t,"DecalBuilder",function(){return R.g}),i.d(t,"DataBuffer",function(){return R.f}),i.d(t,"WebGLDataBuffer",function(){return R.T});var O=i(373);i.d(t,"MorphTarget",function(){return O.a}),i.d(t,"MorphTargetManager",function(){return O.b});var M=i(374);for(var a in M)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Viewport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return M[e]})}(a);var I=i(30);i.d(t,"Node",function(){return I.a});var D=i(376);for(var a in D)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Viewport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","Node","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return D[e]})}(a);var L=i(379);for(var a in L)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Viewport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","Node","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return L[e]})}(a);var N=i(385);for(var a in N)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Viewport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","Node","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return N[e]})}(a);var F=i(414);i.d(t,"AnaglyphPostProcess",function(){return F.a}),i.d(t,"BlackAndWhitePostProcess",function(){return F.b}),i.d(t,"BloomEffect",function(){return F.c}),i.d(t,"BloomMergePostProcess",function(){return F.d}),i.d(t,"BlurPostProcess",function(){return F.e}),i.d(t,"ChromaticAberrationPostProcess",function(){return F.f}),i.d(t,"CircleOfConfusionPostProcess",function(){return F.g}),i.d(t,"ColorCorrectionPostProcess",function(){return F.h}),i.d(t,"ConvolutionPostProcess",function(){return F.i}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return F.k}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return F.m}),i.d(t,"DepthOfFieldEffect",function(){return F.l}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return F.o}),i.d(t,"DepthOfFieldMergePostProcess",function(){return F.n}),i.d(t,"DisplayPassPostProcess",function(){return F.p}),i.d(t,"ExtractHighlightsPostProcess",function(){return F.q}),i.d(t,"FilterPostProcess",function(){return F.r}),i.d(t,"FxaaPostProcess",function(){return F.s}),i.d(t,"GrainPostProcess",function(){return F.t}),i.d(t,"HighlightsPostProcess",function(){return F.u}),i.d(t,"ImageProcessingPostProcess",function(){return F.v}),i.d(t,"MotionBlurPostProcess",function(){return F.x}),i.d(t,"PassPostProcess",function(){return F.z}),i.d(t,"PassCubePostProcess",function(){return F.y}),i.d(t,"PostProcess",function(){return F.A}),i.d(t,"PostProcessManager",function(){return F.B}),i.d(t,"RefractionPostProcess",function(){return F.G}),i.d(t,"DefaultRenderingPipeline",function(){return F.j}),i.d(t,"LensRenderingPipeline",function(){return F.w}),i.d(t,"SSAO2RenderingPipeline",function(){return F.H}),i.d(t,"SSAORenderingPipeline",function(){return F.I}),i.d(t,"StandardRenderingPipeline",function(){return F.M}),i.d(t,"PostProcessRenderEffect",function(){return F.C}),i.d(t,"PostProcessRenderPipeline",function(){return F.D}),i.d(t,"PostProcessRenderPipelineManager",function(){return F.E}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return F.F}),i.d(t,"SharpenPostProcess",function(){return F.L}),i.d(t,"StereoscopicInterlacePostProcessI",function(){return F.O}),i.d(t,"StereoscopicInterlacePostProcess",function(){return F.N}),i.d(t,"TonemappingOperator",function(){return F.Q}),i.d(t,"TonemapPostProcess",function(){return F.P}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return F.T}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return F.R}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return F.S}),i.d(t,"ScreenSpaceReflectionPostProcess",function(){return F.K}),i.d(t,"ScreenSpaceCurvaturePostProcess",function(){return F.J});var w=i(390);i.d(t,"ReflectionProbe",function(){return w.a});var B=i(417);i.d(t,"BoundingBoxRenderer",function(){return B.a}),i.d(t,"DepthRenderer",function(){return B.b}),i.d(t,"DepthRendererSceneComponent",function(){return B.c}),i.d(t,"EdgesRenderer",function(){return B.d}),i.d(t,"LineEdgesRenderer",function(){return B.g}),i.d(t,"GeometryBufferRenderer",function(){return B.e}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return B.f}),i.d(t,"PrePassRenderer",function(){return B.i}),i.d(t,"PrePassRendererSceneComponent",function(){return B.j}),i.d(t,"OutlineRenderer",function(){return B.h}),i.d(t,"RenderingGroup",function(){return B.k}),i.d(t,"RenderingGroupInfo",function(){return B.l}),i.d(t,"RenderingManager",function(){return B.m}),i.d(t,"UtilityLayerRenderer",function(){return B.n});var U=i(18);i.d(t,"Scene",function(){return U.a});var V=i(17);i.d(t,"SceneComponentConstants",function(){return V.a}),i.d(t,"Stage",function(){return V.b});var k=i(391);for(var a in k)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Viewport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","Node","AnaglyphPostProcess","BlackAndWhitePostProcess","BloomEffect","BloomMergePostProcess","BlurPostProcess","ChromaticAberrationPostProcess","CircleOfConfusionPostProcess","ColorCorrectionPostProcess","ConvolutionPostProcess","DepthOfFieldBlurPostProcess","DepthOfFieldEffectBlurLevel","DepthOfFieldEffect","DepthOfFieldMergePostProcessOptions","DepthOfFieldMergePostProcess","DisplayPassPostProcess","ExtractHighlightsPostProcess","FilterPostProcess","FxaaPostProcess","GrainPostProcess","HighlightsPostProcess","ImageProcessingPostProcess","MotionBlurPostProcess","PassPostProcess","PassCubePostProcess","PostProcess","PostProcessManager","RefractionPostProcess","DefaultRenderingPipeline","LensRenderingPipeline","SSAO2RenderingPipeline","SSAORenderingPipeline","StandardRenderingPipeline","PostProcessRenderEffect","PostProcessRenderPipeline","PostProcessRenderPipelineManager","PostProcessRenderPipelineManagerSceneComponent","SharpenPostProcess","StereoscopicInterlacePostProcessI","StereoscopicInterlacePostProcess","TonemappingOperator","TonemapPostProcess","VolumetricLightScatteringPostProcess","VRDistortionCorrectionPostProcess","VRMultiviewToSingleviewPostProcess","ScreenSpaceReflectionPostProcess","ScreenSpaceCurvaturePostProcess","ReflectionProbe","BoundingBoxRenderer","DepthRenderer","DepthRendererSceneComponent","EdgesRenderer","LineEdgesRenderer","GeometryBufferRenderer","GeometryBufferRendererSceneComponent","PrePassRenderer","PrePassRendererSceneComponent","OutlineRenderer","RenderingGroup","RenderingGroupInfo","RenderingManager","UtilityLayerRenderer","Scene","SceneComponentConstants","Stage","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return k[e]})}(a);var G=i(394);i.d(t,"AlphaState",function(){return G.a}),i.d(t,"DepthCullingState",function(){return G.b}),i.d(t,"StencilState",function(){return G.c});var z=i(395);for(var a in z)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","
1EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Viewport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","Node","AnaglyphPostProcess","BlackAndWhitePostProcess","BloomEffect","BloomMergePostProcess","BlurPostProcess","ChromaticAberrationPostProcess","CircleOfConfusionPostProcess","ColorCorrectionPostProcess","ConvolutionPostProcess","DepthOfFieldBlurPostProcess","DepthOfFieldEffectBlurLevel","DepthOfFieldEffect","DepthOfFieldMergePostProcessOptions","DepthOfFieldMergePostProcess","DisplayPassPostProcess","ExtractHighlightsPostProcess","FilterPostProcess","FxaaPostProcess","GrainPostProcess","HighlightsPostProcess","ImageProcessingPostProcess","MotionBlurPostProcess","PassPostProcess","PassCubePostProcess","PostProcess","PostProcessManager","RefractionPostProcess","DefaultRenderingPipeline","LensRenderingPipeline","SSAO2RenderingPipeline","SSAORenderingPipeline","StandardRenderingPipeline","PostProcessRenderEffect","PostProcessRenderPipeline","PostProcessRenderPipelineManager","PostProcessRenderPipelineManagerSceneComponent","SharpenPostProcess","StereoscopicInterlacePostProcessI","StereoscopicInterlacePostProcess","TonemappingOperator","TonemapPostProcess","VolumetricLightScatteringPostProcess","VRDistortionCorrectionPostProcess","VRMultiviewToSingleviewPostProcess","ScreenSpaceReflectionPostProcess","ScreenSpaceCurvaturePostProcess","ReflectionProbe","BoundingBoxRenderer","DepthRenderer","DepthRendererSceneComponent","EdgesRenderer","LineEdgesRenderer","GeometryBufferRenderer","GeometryBufferRendererSceneComponent","PrePassRenderer","PrePassRendererSceneComponent","OutlineRenderer","RenderingGroup","RenderingGroupInfo","RenderingManager","UtilityLayerRenderer","Scene","SceneComponentConstants","Stage","AlphaState","DepthCullingState","StencilState","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return z[e]})}(a);var j=i(419);i.d(t,"WebXRCamera",function(){return j.e}),i.d(t,"WebXREnterExitUIButton",function(){return j.l}),i.d(t,"WebXREnterExitUIOptions",function(){return j.m}),i.d(t,"WebXREnterExitUI",function(){return j.k}),i.d(t,"WebXRExperienceHelper",function(){return j.n}),i.d(t,"WebXRInput",function(){return j.u}),i.d(t,"WebXRInputSource",function(){return j.v}),i.d(t,"WebXRManagedOutputCanvasOptions",function(){return j.x}),i.d(t,"WebXRManagedOutputCanvas",function(){return j.w}),i.d(t,"WebXRState",function(){return j.F}),i.d(t,"WebXRSessionManager",function(){return j.E}),i.d(t,"WebXRDefaultExperienceOptions",function(){return j.j}),i.d(t,"WebXRDefaultExperience",function(){return j.i}),i.d(t,"WebXRFeatureName",function(){return j.o}),i.d(t,"WebXRFeaturesManager",function(){return j.p}),i.d(t,"WebXRHitTestLegacy",function(){return j.t}),i.d(t,"WebXRAnchorSystem",function(){return j.c}),i.d(t,"WebXRPlaneDetector",function(){return j.C}
1),i.d(t,"WebXRBackgroundRemover",function(){return j.d}),i.d(t,"WebXRMotionControllerTeleportation",function(){return j.A}),i.d(t,"WebXRControllerPointerSelection",function(){return j.h}),i.d(t,"IWebXRControllerPhysicsOptions",function(){return j.a}),i.d(t,"WebXRControllerPhysics",function(){return j.g}),i.d(t,"WebXRHitTest",function(){return j.s}),i.d(t,"WebXRAbstractMotionController",function(){return j.b}),i.d(t,"WebXRControllerComponent",function(){return j.f}),i.d(t,"WebXRGenericTriggerMotionController",function(){return j.q}),i.d(t,"WebXRMicrosoftMixedRealityController",function(){return j.y}),i.d(t,"WebXRMotionControllerManager",function(){return j.z}),i.d(t,"WebXROculusTouchMotionController",function(){return j.B}),i.d(t,"WebXRHTCViveMotionController",function(){return j.r}),i.d(t,"WebXRProfiledMotionController",function(){return j.D});var W=i(412);for(var a in W)["AbstractScene","AbstractActionManager","Action","ActionEvent","ActionManager","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","ExecuteCodeAction","SetParentAction","PlaySoundAction","StopSoundAction","InterpolateValueAction","KeepAssets","InstantiatedEntries","AssetContainer","Analyser","AudioEngine","AudioSceneComponent","Sound","SoundTrack","WeightedSound","Bone","BoneIKController","BoneLookController","Skeleton","ArcRotateCameraGamepadInput","ArcRotateCameraKeyboardMoveInput","ArcRotateCameraMouseWheelInput","ArcRotateCameraPointersInput","ArcRotateCameraVRDeviceOrientationInput","FlyCameraKeyboardInput","FlyCameraMouseInput","FollowCameraKeyboardMoveInput","FollowCameraMouseWheelInput","FollowCameraPointersInput","FreeCameraDeviceOrientationInput","FreeCameraGamepadInput","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","FreeCameraTouchInput","FreeCameraVirtualJoystickInput","CameraInputTypes","CameraInputsManager","Camera","TargetCamera","FreeCamera","FreeCameraInputsManager","TouchCamera","ArcRotateCamera","ArcRotateCameraInputsManager","DeviceOrientationCamera","FlyCamera","FlyCameraInputsManager","FollowCamera","ArcFollowCamera","FollowCameraInputsManager","GamepadCamera","AnaglyphArcRotateCamera","AnaglyphFreeCamera","AnaglyphGamepadCamera","AnaglyphUniversalCamera","StereoscopicArcRotateCamera","StereoscopicFreeCamera","StereoscopicGamepadCamera","StereoscopicUniversalCamera","UniversalCamera","VirtualJoysticksCamera","VRCameraMetrics","VRDeviceOrientationArcRotateCamera","VRDeviceOrientationFreeCamera","VRDeviceOrientationGamepadCamera","OnAfterEnteringVRObservableEvent","VRExperienceHelper","WebVRFreeCamera","Collider","DefaultCollisionCoordinator","PickingInfo","IntersectionInfo","_MeshCollisionData","BoundingBox","BoundingInfo","BoundingSphere","Octree","OctreeBlock","OctreeSceneComponent","Ray","AxesViewer","BoneAxesViewer","DebugLayerTab","DebugLayer","PhysicsViewer","RayHelper","SkeletonViewer","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","PointerEventTypes","PointerInfoBase","PointerInfoPre","PointerInfo","ClipboardEventTypes","ClipboardInfo","DaydreamController","GearVRController","GenericController","OculusTouchController","PoseEnabledControllerType","PoseEnabledControllerHelper","PoseEnabledController","ViveController","WebVRController","WindowsMotionController","XRWindowsMotionController","StickValues","Gamepad","GenericPad","GamepadManager","GamepadSystemSceneComponent","Xbox360Button","Xbox360Dpad","Xbox360Pad","DualShockButton","DualShockDpad","DualShockPad","AxisDragGizmo","AxisScaleGizmo","BoundingBoxGizmo","Gizmo","GizmoManager","PlaneRotationGizmo","PositionGizmo","RotationGizmo","ScaleGizmo","LightGizmo","PlaneDragGizmo","EnvironmentHelper","PhotoDome","_forceSceneHelpersToBundle","VideoDome","EngineInstrumentation","SceneInstrumentation","_TimeToken","EffectLayer","EffectLayerSceneComponent","GlowLayer","HighlightLayer","Layer","LayerSceneComponent","LensFlare","LensFlareSystem","LensFlareSystemSceneComponent","Light","ShadowLight","ShadowGenerator","CascadedShadowGenerator","ShadowGeneratorSceneComponent","DirectionalLight","HemisphericLight","PointLight","SpotLight","DefaultLoadingScreen","_BabylonLoaderRegistered","BabylonFileLoaderConfiguration","SceneLoaderAnimationGroupLoadingMode","SceneLoader","SceneLoaderFlags","Scalar","Space","Axis","Color3","Color4","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","Orientation","BezierCurve","Angle","Arc2","Path2","Path3D","Curve3","Plane","Size","Vector2","Vector3","Vector4","Quaternion","Matrix","TmpVectors","PositionNormalVertex","PositionNormalTextureVertex","Vie
1wport","SphericalHarmonics","SphericalPolynomial","AbstractMesh","Buffer","VertexBuffer","DracoCompression","CSG","Geometry","GroundMesh","TrailMesh","InstancedMesh","LinesMesh","InstancedLinesMesh","_CreationDataStorage","_InstancesBatch","Mesh","VertexData","MeshBuilder","SimplificationSettings","SimplificationQueue","SimplificationType","QuadraticErrorSimplification","SimplicationQueueSceneComponent","Polygon","PolygonMeshBuilder","SubMesh","MeshLODLevel","TransformNode","BoxBuilder","TiledBoxBuilder","DiscBuilder","RibbonBuilder","SphereBuilder","HemisphereBuilder","CylinderBuilder","TorusBuilder","TorusKnotBuilder","LinesBuilder","PolygonBuilder","ShapeBuilder","LatheBuilder","PlaneBuilder","TiledPlaneBuilder","GroundBuilder","TubeBuilder","PolyhedronBuilder","IcoSphereBuilder","DecalBuilder","DataBuffer","WebGLDataBuffer","MorphTarget","MorphTargetManager","Node","AnaglyphPostProcess","BlackAndWhitePostProcess","BloomEffect","BloomMergePostProcess","BlurPostProcess","ChromaticAberrationPostProcess","CircleOfConfusionPostProcess","ColorCorrectionPostProcess","ConvolutionPostProcess","DepthOfFieldBlurPostProcess","DepthOfFieldEffectBlurLevel","DepthOfFieldEffect","DepthOfFieldMergePostProcessOptions","DepthOfFieldMergePostProcess","DisplayPassPostProcess","ExtractHighlightsPostProcess","FilterPostProcess","FxaaPostProcess","GrainPostProcess","HighlightsPostProcess","ImageProcessingPostProcess","MotionBlurPostProcess","PassPostProcess","PassCubePostProcess","PostProcess","PostProcessManager","RefractionPostProcess","DefaultRenderingPipeline","LensRenderingPipeline","SSAO2RenderingPipeline","SSAORenderingPipeline","StandardRenderingPipeline","PostProcessRenderEffect","PostProcessRenderPipeline","PostProcessRenderPipelineManager","PostProcessRenderPipelineManagerSceneComponent","SharpenPostProcess","StereoscopicInterlacePostProcessI","StereoscopicInterlacePostProcess","TonemappingOperator","TonemapPostProcess","VolumetricLightScatteringPostProcess","VRDistortionCorrectionPostProcess","VRMultiviewToSingleviewPostProcess","ScreenSpaceReflectionPostProcess","ScreenSpaceCurvaturePostProcess","ReflectionProbe","BoundingBoxRenderer","DepthRenderer","DepthRendererSceneComponent","EdgesRenderer","LineEdgesRenderer","GeometryBufferRenderer","GeometryBufferRendererSceneComponent","PrePassRenderer","PrePassRendererSceneComponent","OutlineRenderer","RenderingGroup","RenderingGroupInfo","RenderingManager","UtilityLayerRenderer","Scene","SceneComponentConstants","Stage","AlphaState","DepthCullingState","StencilState","WebXRCamera","WebXREnterExitUIButton","WebXREnterExitUIOptions","WebXREnterExitUI","WebXRExperienceHelper","WebXRInput","WebXRInputSource","WebXRManagedOutputCanvasOptions","WebXRManagedOutputCanvas","WebXRState","WebXRSessionManager","WebXRDefaultExperienceOptions","WebXRDefaultExperience","WebXRFeatureName","WebXRFeaturesManager","WebXRHitTestLegacy","WebXRAnchorSystem","WebXRPlaneDetector","WebXRBackgroundRemover","WebXRMotionControllerTeleportation","WebXRControllerPointerSelection","IWebXRControllerPhysicsOptions","WebXRControllerPhysics","WebXRHitTest","WebXRAbstractMotionController","WebXRControllerComponent","WebXRGenericTriggerMotionController","WebXRMicrosoftMixedRealityController","WebXRMotionControllerManager","WebXROculusTouchMotionController","WebXRHTCViveMotionController","WebXRProfiledMotionController","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return W[e]})}(a)},function(e,t,i){"use strict";i.d(t,"a",function(){return p});var n,r=i(1),l=i(0),u=i(10),E=i(190),a=i(38),S=i(232),o=i(22),s=i(7),c=i(46),A=i(11),h=i(128),d=i(2),p=(n=h.a,Object(r.d)(C,n),C.prototype.dispose=function(){for(var e=this._scene.actionManagers.indexOf(this),t=0;t<this.actions.length;t++){var i=this.actions[t];C.Triggers[i.trigger]--,0===C.Triggers[i.trigger]&&delete C.Triggers[i.trigger]}-1<e&&this._scene.actionManagers.splice(e,1)},C.prototype.getScene=function(){return this._scene},C.prototype.hasSpecificTriggers=function(e){for(var t=0;t<this.actions.length;t++){var i=this.actions[t];if(-1<e.indexOf(i.trigger))return!0}return!1},C.prototype.hasSpecificTriggers2=function(e,t){for(var i=0;i<this.actions.length;i++){var n=this.actions[i];if(e==n.trigger||t==n.trigger)return!0}return!1},C.prototype.hasSpecificTrigger=function(e,t){for(var i=0;i<this.actions.length;i++){var n=this.actions[i];if(n.trigger===e){if(!t)return!0;
1if(t(n.getTriggerParameter()))return!0}}return!1},Object.defineProperty(C.prototype,"hasPointerTriggers",{get:function(){for(var e=0;e<this.actions.length;e++){var t=this.actions[e];if(t.trigger>=C.OnPickTrigger&&t.trigger<=C.OnPointerOutTrigger)return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"hasPickTriggers",{get:function(){for(var e=0;e<this.actions.length;e++){var t=this.actions[e];if(t.trigger>=C.OnPickTrigger&&t.trigger<=C.OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),C.prototype.registerAction=function(e){return e.trigger===C.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(s.a.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),C.Triggers[e.trigger]?C.Triggers[e.trigger]++:C.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},C.prototype.unregisterAction=function(e){var t=this.actions.indexOf(e);return-1!==t&&(this.actions.splice(t,1),--C.Triggers[e.trigger],0===C.Triggers[e.trigger]&&delete C.Triggers[e.trigger],delete e._actionManager,!0)},C.prototype.processTrigger=function(e,t){for(var i=0;i<this.actions.length;i++){var n=this.actions[i];if(n.trigger===e){if(t&&(e===C.OnKeyUpTrigger||e===C.OnKeyDownTrigger)){var r=n.getTriggerParameter();if(r&&r!==t.sourceEvent.keyCode){if(!r.toLowerCase)continue;var o=r.toLowerCase();if(o!==t.sourceEvent.key){var a=t.sourceEvent.charCode?t.sourceEvent.charCode:t.sourceEvent.keyCode;if(String.fromCharCode(a).toLowerCase()!==o)continue}}}n._executeCurrent(t)}}},C.prototype._getEffectiveTarget=function(e,t){for(var i=t.split("."),n=0;n<i.length-1;n++)e=e[i[n]];return e},C.prototype._getProperty=function(e){var t=e.split(".");return t[t.length-1]},C.prototype.serialize=function(e){for(var t={children:new Array,name:e,type:3,properties:new Array},i=0;i<this.actions.length;i++){var n,r={type:0,children:new Array,name:C.GetTriggerName(this.actions[i].trigger),properties:new Array},o=this.actions[i].triggerOptions;o&&"number"!=typeof o&&(o.parameter instanceof Node?r.properties.push(a.a._GetTargetProperty(o.parameter)):(n={},c.a.DeepCopy(o.parameter,n,["mesh"]),o.parameter&&o.parameter.mesh&&(n._meshId=o.parameter.mesh.id),r.properties.push({name:"parameter",targetType:null,value:n}))),this.actions[i].serialize(r),t.children.push(r)}return t},C.Parse=function(e,t,v){var b=new C(v);null===t?v.actionManager=b:t.actionManager=b;for(var y=function(e,t,i,n){if(null===n){var r=parseFloat(t);return"true"===t||"false"===t?"true"===t:isNaN(r)?t:r}for(var o=n.split("."),a=t.split(","),s=0;s<o.length;s++)i=i[o[s]];if("boolean"==typeof i)return"true"===a[0];if("string"==typeof i)return a[0];for(var c=new Array,s=0;s<a.length;s++)c.push(parseFloat(a[s]));return i instanceof l.e?l.e.FromArray(c):i instanceof l.f?l.f.FromArray(c):i instanceof u.a?u.a.FromArray(c):i instanceof u.b?u.b.FromArray(c):parseFloat(a[0])},T=function(e,t,i,n,r){if(void 0===r&&(r=null),!e.detached){var o,a=new Array,s=null,c=null,l=e.combine&&0<e.combine.length;if(2===e.type?a.push(b):a.push(t),l){for(var u=new Array,h=0;h<e.combine.length;h++)T(e.combine[h],C.NothingTrigger,i,n,u);a.push(u)}else for(var d=0;d<e.properties.length;d++){var p=e.properties[d].value,f=e.properties[d].name,m=e.properties[d].targetType;"target"===f?p=s=null!==m&&"SceneProperties"===m?v:v.getNodeByName(p):"parent"===f?p=v.getNodeByName(p):"sound"===f?v.getSoundByName&&(p=v.getSoundByName(p)):"propertyPath"!==f?p=2===e.type&&"operator"===f?E.d[p]:y(0,p,s,"value"===f?c:null):c=p,a.push(p)}null===r?a.push(i):a.push(null),"InterpolateValueAction"===e.name&&(o=a[a.length-2],a[a.length-1]=o,a[a.length-2]=i);var _,g=function(e,t){var i=A.a.GetClass("BABYLON."+e);if(i){var n=Object.create(i.prototype);return n.constructor.apply(n,t),n}}(e.name,a);for(g instanceof E.a&&null!==i&&(_=new S.b(t,i),n?n.then(_):b.registerAction(_),n=_),null===r?g instanceof E.a?(i=g,g=n):(i=null,n?n.then(g):b.registerAction(g)):r.push(g),d=0;d<e.children.length;d++)T(e.children[d],t,i,g,null)}},i=0;i<e.children.length;i++)for(var n,r,o=e.children[i],a=0<o.properties.length?(n=o.properties[0].value,(r=null===o.properties[0].targetType?n:v.getMeshByName(n))._meshId&&(r.mesh=v.getMeshByID(r._meshId)),{trigger:C[o.name],parameter:r}):C[o.name],s=0;s<o.children.length;
1s++)o.detached||T(o.children[s],a,null,null)},C.GetTriggerName=function(e){switch(e){case 0:return"NothingTrigger";case 1:return"OnPickTrigger";case 2:return"OnLeftPickTrigger";case 3:return"OnRightPickTrigger";case 4:return"OnCenterPickTrigger";case 5:return"OnPickDownTrigger";case 6:return"OnPickUpTrigger";case 7:return"OnLongPressTrigger";case 8:return"OnPointerOverTrigger";case 9:return"OnPointerOutTrigger";case 10:return"OnEveryFrameTrigger";case 11:return"OnIntersectionEnterTrigger";case 12:return"OnIntersectionExitTrigger";case 13:return"OnKeyDownTrigger";case 14:return"OnKeyUpTrigger";case 15:return"OnPickOutTrigger";default:return""}},C.NothingTrigger=d.a.ACTION_NothingTrigger,C.OnPickTrigger=d.a.ACTION_OnPickTrigger,C.OnLeftPickTrigger=d.a.ACTION_OnLeftPickTrigger,C.OnRightPickTrigger=d.a.ACTION_OnRightPickTrigger,C.OnCenterPickTrigger=d.a.ACTION_OnCenterPickTrigger,C.OnPickDownTrigger=d.a.ACTION_OnPickDownTrigger,C.OnDoublePickTrigger=d.a.ACTION_OnDoublePickTrigger,C.OnPickUpTrigger=d.a.ACTION_OnPickUpTrigger,C.OnPickOutTrigger=d.a.ACTION_OnPickOutTrigger,C.OnLongPressTrigger=d.a.ACTION_OnLongPressTrigger,C.OnPointerOverTrigger=d.a.ACTION_OnPointerOverTrigger,C.OnPointerOutTrigger=d.a.ACTION_OnPointerOutTrigger,C.OnEveryFrameTrigger=d.a.ACTION_OnEveryFrameTrigger,C.OnIntersectionEnterTrigger=d.a.ACTION_OnIntersectionEnterTrigger,C.OnIntersectionExitTrigger=d.a.ACTION_OnIntersectionExitTrigger,C.OnKeyDownTrigger=d.a.ACTION_OnKeyDownTrigger,C.OnKeyUpTrigger=15,C);function C(e){var t=n.call(this)||this;return t._scene=e||o.a.LastCreatedScene,e.actionManagers.push(t),t}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var h=i(166),r=i(6),l=i(0),u=i(90),d=i(26),p=i(153),o=i(22),f=i(2),m=i(7),_=i(46),n=(Object.defineProperty(g.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),g.prototype.getClassName=function(){return"Skeleton"},g.prototype.getChildren=function(){return this.bones.filter(function(e){return!e.getParent()})},g.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix&&e._bonesTransformMatrices?e._bonesTransformMatrices:(this._transformMatrices||this.prepare(),this._transformMatrices)},g.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},g.prototype.getScene=function(){return this._scene},g.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},g.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t<i;t++)if(this.bones[t].name===e)return t;return-1},g.prototype.createAnimationRange=function(e,t,i){if(!this._ranges[e]){this._ranges[e]=new p.a(e,t,i);for(var n=0,r=this.bones.length;n<r;n++)this.bones[n].animations[0]&&this.bones[n].animations[0].createRange(e,t,i)}},g.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var i=0,n=this.bones.length;i<n;i++)this.bones[i].animations[0]&&this.bones[i].animations[0].deleteRange(e,t);this._ranges[e]=null},g.prototype.getAnimationRange=function(e){return this._ranges[e]||null},g.prototype.getAnimationRanges=function(){var e,t=[];for(e in this._ranges)t.push(this._ranges[e]);return t},g.prototype.copyAnimationRange=function(e,t,i){if(void 0===i&&(i=!1),this._ranges[t]||!e.getAnimationRange(t))return!1;for(var n=!0,r=this._getHighestAnimationFrame()+1,o={},a=e.bones,s=0,c=a.length;s<c;s++)o[a[s].name]=a[s];this.bones.length!==a.length&&(m.a.Warn("copyAnimationRange: this rig has "+this.bones.length+" bones, while source as "+a.length),n=!1);var l=i&&this.dimensionsAtRest&&e.dimensionsAtRest?this.dimensionsAtRest.divide(e.dimensionsAtRest):null;for(s=0,c=this.bones.length;s<c;s++)var u=this.bones[s].name,h=o[u],n=h?n&&this.bones[s].copyAnimationRange(h,t,r,i,l):(m.a.Warn("copyAnimationRange: not same rig, missing source bone "+u),!1);var d=e.getAnimationRange(t);return d&&(this._ranges[t]=new p.a(t,d.from+r,d.to+r)),n},g.prototype.returnToRest=function(){for(var e=0;e<this.bones.length;e++)this.bones[e].returnToRest()},g.prototype._getHighestAnimationFrame=function(){for(var e,t=0,i=0,n=this.bones.length;i<n;i++)!this.bones[i].animations[0]||t<(e=this.bones[i].animations[0].getHighestFrame())&&(t=e);return t},g.prototype.beginAnimation=function(e,t,i,n){var r=this.getAnimationRange(e);return r?this._scene.beginAnimation(this,r.from,r.to,t,i,n):null},g.MakeAnimationAdditive=function(e,t,i){void 0===t&&(t=0);var n=e.getAnimationRange(name);if(!n)return null;for(var r=e._scene.getAllAnimatablesByTarget(e),o=null,a=0;a<r.length;a++){var s=r[a];if(s.fromFrame===(null==n?void 0:n.from)&&s.toFrame===(null==n?void 0:n.to)){o=s;break}}for(var c=e.getAnimatables(),a=0;a<c.length;a++){var l=c[a].animations;if(l)for(var u=0;u<l.length;u++)d.a.MakeAnimationAdditive(l[u],t,i)}return o&&(o.isAdditive=!0),e},g.prototype._markAsDirty=function(){this._isDirty=!0}
1,g.prototype._registerMeshWithPoseMatrix=function(e){this._meshesWithPoseMatrix.push(e)},g.prototype._unregisterMeshWithPoseMatrix=function(e){var t=this._meshesWithPoseMatrix.indexOf(e);-1<t&&this._meshesWithPoseMatrix.splice(t,1)},g.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i<this.bones.length;i++){var n=this.bones[i];n._childUpdateId++;var r,o=n.getParent();o?n.getLocalMatrix().multiplyToRef(o.getWorldMatrix(),n.getWorldMatrix()):t?n.getLocalMatrix().multiplyToRef(t,n.getWorldMatrix()):n.getWorldMatrix().copyFrom(n.getLocalMatrix()),-1!==n._index&&(r=null===n._index?i:n._index,n.getInvertedAbsoluteTransform().multiplyToArray(n.getWorldMatrix(),e,16*r))}this._identity.copyToArray(e,16*this.bones.length)},g.prototype.prepare=function(){if(0<this._numBonesWithLinkedTransformNode)for(var e=0,t=this.bones;e<t.length;e++){var i=t[e];i._linkedTransformNode&&(i._linkedTransformNode.computeWorldMatrix(),i._matrix=i._linkedTransformNode._localMatrix,i.markAsDirty())}if(this._isDirty){if(this.needInitialSkinMatrix)for(var n=0;n<this._meshesWithPoseMatrix.length;n++){var r=this._meshesWithPoseMatrix[n],o=r.getPoseMatrix();if(r._bonesTransformMatrices&&r._bonesTransformMatrices.length===16*(this.bones.length+1)||(r._bonesTransformMatrices=new Float32Array(16*(this.bones.length+1))),this._synchronizedWithMesh!==r){this._synchronizedWithMesh=r;for(var a,s=0;s<this.bones.length;s++){var c=this.bones[s];c.getParent()||(c.getBaseMatrix().multiplyToRef(o,l.c.Matrix[1]),c._updateDifferenceMatrix(l.c.Matrix[1]))}this.isUsingTextureForMatrices&&(a=4*(this.bones.length+1),r._transformMatrixTexture&&r._transformMatrixTexture.getSize().width===a||(r._transformMatrixTexture&&r._transformMatrixTexture.dispose(),r._transformMatrixTexture=u.a.CreateRGBATexture(r._bonesTransformMatrices,4*(this.bones.length+1),1,this._scene,!1,!1,f.a.TEXTURE_NEAREST_SAMPLINGMODE,f.a.TEXTURETYPE_FLOAT)))}this._computeTransformMatrices(r._bonesTransformMatrices,o),this.isUsingTextureForMatrices&&r._transformMatrixTexture&&r._transformMatrixTexture.update(r._bonesTransformMatrices)}else this._transformMatrices&&this._transformMatrices.length===16*(this.bones.length+1)||(this._transformMatrices=new Float32Array(16*(this.bones.length+1)),this.isUsingTextureForMatrices&&(this._transformMatrixTexture&&this._transformMatrixTexture.dispose(),this._transformMatrixTexture=u.a.CreateRGBATexture(this._transformMatrices,4*(this.bones.length+1),1,this._scene,!1,!1,f.a.TEXTURE_NEAREST_SAMPLINGMODE,f.a.TEXTURETYPE_FLOAT))),this._computeTransformMatrices(this._transformMatrices,null),this.isUsingTextureForMatrices&&this._transformMatrixTexture&&this._transformMatrixTexture.update(this._transformMatrices);this._isDirty=!1,this._scene._activeBones.addCount(this.bones.length,!1)}},g.prototype.getAnimatables=function(){if(!this._animatables||this._animatables.length!==this.bones.length){this._animatables=[];for(var e=0;e<this.bones.length;e++)this._animatables.push(this.bones[e])}return this._animatables},g.prototype.clone=function(e,t){var i=new g(e,t||e,this._scene);i.needInitialSkinMatrix=this.needInitialSkinMatrix,i.overrideMesh=this.overrideMesh;for(var n=0;n<this.bones.length;n++){var r,o=this.bones[n],a=null,s=o.getParent();s&&(r=this.bones.indexOf(s),a=i.bones[r]);var c=new h.a(o.name,i,a,o.getBaseMatrix().clone(),o.getRestPose().clone());c._index=o._index,o._linkedTransformNode&&c.linkTransformNode(o._linkedTransformNode),_.a.DeepCopy(o.animations,c.animations)}if(this._ranges)for(var l in i._ranges={},this._ranges){var u=this._ranges[l];u&&(i._ranges[l]=u.clone())}return this._isDirty=!0,i},g.prototype.enableBlending=function(t){void 0===t&&(t=.01),this.bones.forEach(function(e){e.animations.forEach(function(e){e.enableBlending=!0,e.blendingSpeed=t})})},g.prototype.dispose=function(){this._meshesWithPoseMatrix=[],this.getScene().stopAnimation(this),this.getScene().removeSkeleton(this),this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)},g.prototype.serialize=function(){var e={};e.name=this.name,e.id=this.id,this.dimensionsAtRest&&(e.dimensionsAtRest=this.dimensionsAtRest.asArray()),e.bones=[],e.needInitialSkinMatrix=this.needInitialSkinMatrix;for(var t=0;t<this.bones.length;t++){var i=this.bones[t],n=i.getParent(),r={parentBoneIndex:n?this.bones.indexOf(n):-1,name:i.name,matrix:i.getBaseMatrix().toArray(),rest:i.getRestPose().toArray()};for(var o in e.bones.push(r),i.length&&(r.length=i.length),i.metadata&&(r.metadata=i.metadata),i.animations&&0<i.animations.length&&(r.animation=i.animations[0].serialize()),e.ranges=[],this._ranges){var a,s=this._ranges[o];s&&((a={}).name=o,a.from=s.from,a.to=s.to,e.ranges.push(a))}}return e},g.Parse=function(e,t){var i,n=new g(e.name,e.id,t);for(e.dimensionsAtRest&&(n.dimensionsAtRest=l.e.FromArray(e.dimensionsAtRest)),n.needInitialSkinMatrix=e.needInitialSkinMatrix,i=0;i<e.bones.length;
1i++){var r=e.bones[i],o=null;-1<r.parentBoneIndex&&(o=n.bones[r.parentBoneIndex]);var a=r.rest?l.a.FromArray(r.rest):null,s=new h.a(r.name,n,o,l.a.FromArray(r.matrix),a);void 0!==r.id&&null!==r.id&&(s.id=r.id),r.length&&(s.length=r.length),r.metadata&&(s.metadata=r.metadata),r.animation&&s.animations.push(d.a.Parse(r.animation)),void 0!==r.linkedTransformNodeId&&null!==r.linkedTransformNodeId&&(n._hasWaitingData=!0,s._waitingTransformNodeId=r.linkedTransformNodeId)}if(e.ranges)for(i=0;i<e.ranges.length;i++){var c=e.ranges[i];n.createAnimationRange(c.name,c.from,c.to)}return n},g.prototype.computeAbsoluteTransforms=function(e){void 0===e&&(e=!1);var t=this._scene.getRenderId();this._lastAbsoluteTransformsUpdateId==t&&!e||(this.bones[0].computeAbsoluteTransforms(),this._lastAbsoluteTransformsUpdateId=t)},g.prototype.getPoseMatrix=function(){var e=null;return 0<this._meshesWithPoseMatrix.length&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},g.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i<this.bones.length;i++)this._sortBones(i,e,t);this.bones=e},g.prototype._sortBones=function(e,t,i){var n,r;i[e]||(i[e]=!0,void 0===(n=this.bones[e])._index&&(n._index=e),(r=n.getParent())&&this._sortBones(this.bones.indexOf(r),t,i
1),t.push(n))},g);function g(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=l.a.Identity(),this._ranges={},this._lastAbsoluteTransformsUpdateId=-1,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new r.c,this.bones=[],this._scene=i||o.a.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;var n=this._scene.getEngine().getCaps();this._canUseTextureForBones=n.textureFloat&&0<n.maxVertexTextureImageUnits}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),E=i(0),S=i(4),r=i(8);r.a._GroundMeshParser=function(e,t){return a.Parse(e,t)};var o,a=(o=r.a,Object(n.d)(s,o),s.prototype.getClassName=function(){return"GroundMesh"},Object.defineProperty(s.prototype,"subdivisions",{get:function(){return Math.min(this._subdivisionsX,this._subdivisionsY)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"subdivisionsX",{get:function(){return this._subdivisionsX},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"subdivisionsY",{get:function(){return this._subdivisionsY},enumerable:!1,configurable:!0}),s.prototype.optimize=function(e,t){void 0===t&&(t=32),this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e),this.createOrUpdateSubmeshesOctree&&this.createOrUpdateSubmeshesOctree(t)},s.prototype.getHeightAtCoordinates=function(e,t){var i=this.getWorldMatrix(),n=E.c.Matrix[5];i.invertToRef(n);var r=E.c.Vector3[8];if(E.e.TransformCoordinatesFromFloatsToRef(e,0,t,n,r),e=r.x,t=r.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var o=this._getFacetAt(e,t),a=-(o.x*e+o.z*t+o.w)/o.y;return E.e.TransformCoordinatesFromFloatsToRef(0,a,0,i,r),r.y},s.prototype.getNormalAtCoordinates=function(e,t){var i=new E.e(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},s.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var n=this.getWorldMatrix(),r=E.c.Matrix[5];n.invertToRef(r);var o=E.c.Vector3[8];if(E.e.TransformCoordinatesFromFloatsToRef(e,0,t,r,o),e=o.x,t=o.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var a=this._getFacetAt(e,t);return E.e.TransformNormalFromFloatsToRef(a.x,a.y,a.z,n,i),this},s.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},s.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 t<r.slope.x*e+r.slope.y?r.facet1:r.facet2},s.prototype._initHeightQuads=function(){var e=this._subdivisionsX,t=this._subdivisionsY;this._heightQuads=new Array;for(var i=0;i<t;i++)for(var n=0;n<e;n++){var r={slope:E.d.Zero(),facet1:new E.f(0,0,0,0),facet2:new E.f(0,0,0,0)};this._heightQuads[i*e+n]=r}return this},s.prototype._computeHeightQuads=function(){var e=this.getVerticesData(S.b.PositionKind);if(!e)return this;for(var t=E.c.Vector3[3],i=E.c.Vector3[2],n=E.c.Vector3[1],r=E.c.Vector3[0],o=E.c.Vector3[4],a=E.c.Vector3[5],s=E.c.Vector3[6],c=E.c.Vector3[7],l=E.c.Vector3[8],u=0,h=0,d=0,p=0,f=0,m=0,_=0,g=this._subdivisionsX,v=this._subdivisionsY,b=0;b<v;b++)for(var y=0;y<g;y++){u=3*y,h=b*(g+1)*3,d=(b+1)*(g+1)*3,t.x=e[h+u],t.y=e[h+u+1],t.z=e[h+u+2],i.x=e[h+u+3],i.y=e[h+u+4],i.z=e[h+u+5],n.x=e[d+u],n.y=e[d+u+1],n.z=e[d+u+2],r.x=e[d+u+3],r.y=e[d+u+4],r.z=e[d+u+5],p=(r.z-t.z)/(r.x-t.x),f=t.z-p*t.x,i.subtractToRef(t,o),n.subtractToRef(t,a),r.subtractToRef(t,s),E.e.CrossToRef(s,a,c),E.e.CrossToRef(o,s,l),c.normalize(),l.normalize(),m=-(c.x*t.x+c.y*t.y+c.z*t.z),_=-(l.x*i.x+l.y*i.y+l.z*i.z);var T=this._heightQuads[b*g+y];T.slope.copyFromFloats(p,f),T.facet1.copyFromFloats(c.x,c.y,c.z,m),T.facet2.copyFromFloats(l.x,l.y,l.z,_)}return this},s.prototype.serialize=function(e){o.prototype.serialize.call(this,e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height},s.Parse=function(e,t){var i=new s(e.name,t);return i._subdivisionsX=e.subdivisionsX||1,i._subdivisionsY=e.subdivisionsY||1,i._minX=e.minX,i._maxX=e.maxX,i._minZ=e.minZ,i._maxZ=e.maxZ,i._width=e.width,i._height=e.height,i},s);function s(e,t){var i=o.call(this,e,t)||this;return i.generateOctree=!1,i}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(b.prototype,"code",{get:function(){return this._sourceCode}
1,enumerable:!1,configurable:!0}),b.prototype.processCode=function(){this.debug&&console.log("Start inlining process (code size="+this._sourceCode.length+")..."),this._collectFunctions(),this._processInlining(this._numMaxIterations),this.debug&&console.log("End of inlining process.")},b.prototype._collectFunctions=function(){for(var e=0;e<this._sourceCode.length;){var t=this._sourceCode.indexOf(this.inlineToken,e);if(t<0)break;var i=this._sourceCode.indexOf("(",t+this.inlineToken.length);if(i<0)this.debug&&console.warn("Could not find the opening parenthesis after the token. startIndex="+e),e=t+this.inlineToken.length;else{var n=b._RegexpFindFunctionNameAndType.exec(this._sourceCode.substring(t+this.inlineToken.length,i));if(n){var r=[n[3],n[4]],o=r[0],a=r[1],s=this._extractBetweenMarkers("(",")",this._sourceCode,i);if(s<0)this.debug&&console.warn("Could not extract the parameters the function '"+a+"' (type="+o+"). funcParamsStartIndex="+i),e=t+this.inlineToken.length;else{var c=this._sourceCode.substring(i+1,s),l=this._skipWhitespaces(this._sourceCode,s+1);if(l!==this._sourceCode.length){var u=this._extractBetweenMarkers("{","}",this._sourceCode,l);if(u<0)this.debug&&console.warn("Could not extract the body of the function '"+a+"' (type="+o+"). funcBodyStartIndex="+l),e=t+this.inlineToken.length;else{for(var h=this._sourceCode.substring(l,u+1),d=this._removeComments(c).split(","),p=[],f=0;f<d.length;++f){var m=d[f].trim(),_=m.lastIndexOf(" ");0<=_&&p.push(m.substring(_+1))}"void"!==o&&p.push("return"),this._functionDescr.push({name:a,type:o,parameters:p,body:h,callIndex:0}),e=u+1;var g=0<t?this._sourceCode.substring(0,t):"",v=u+1<this._sourceCode.length-1?this._sourceCode.substring(u+1):"";this._sourceCode=g+v,e-=u+1-t}}else this.debug&&console.warn("Could not extract the body of the function '"+a+"' (type="+o+"). funcParamsEndIndex="+s),e=t+this.inlineToken.length}}else this.debug&&console.warn("Could not extract the name/type of the function from: "+this._sourceCode.substring(t+this.inlineToken.length,i)),e=t+this.inlineToken.length}}this.debug&&console.log("Collect functions: "+this._functionDescr.length+" functions found. functionDescr=",this._functionDescr)},b.prototype._processInlining=function(e){for(void 0===e&&(e=20);0<=e--&&this._replaceFunctionCallsByCode(););return this.debug&&console.log("numMaxIterations is "+e+" after inlining process"),0<=e},b.prototype._extractBetweenMarkers=function(e,t,i,n){for(var r=n,o=0,a="";r<i.length;){var s,c=i.charAt(r);if(a)c===a?('"'!==a&&"'"!==a||"\\"!==i.charAt(r-1))&&(a=""):"*/"===a&&"*"===c&&r+1<i.length&&("/"===i.charAt(r+1)&&(a=""),""===a&&r++);else switch(c){case e:o++;break;case t:o--;break;case'"':case"'":case"`":a=c;break;case"/":r+1<i.length&&("/"===(s=i.charAt(r+1))?a="\n":"*"===s&&(a="*/"))}if(r++,0===o)break}return 0===o?r-1:-1},b.prototype._skipWhitespaces=function(e,t){for(;t<e.length;){var i=e[t];if(" "!==i&&"\n"!==i&&"\r"!==i&&"\t"!==i&&"\n"!==i&&" "!==i)break;t++}return t},b.prototype._removeComments=function(e){for(var t=0,i="",n=!1,r=[];t<e.length;){var o,a=e.charAt(t);if(i)a===i?'"'===i||"'"===i?("\\"!==e.charAt(t-1)&&(i=""),r.push(a)):(i="",n=!1):"*/"===i&&"*"===a&&t+1<e.length?("/"===e.charAt(t+1)&&(i=""),""===i&&(n=!1,t++)):n||r.push(a);else{switch(a){case'"':case"'":case"`":i=a;break;case"/":t+1<e.length&&("/"===(o=e.charAt(t+1))?(i="\n",n=!0):"*"===o&&(i="*/",n=!0))}n||r.push(a)}t++}return r.join("")},b.prototype._replaceFunctionCallsByCode=function(){for(var e=!1,t=0,i=this._functionDescr;t<i.length;t++)for(var n=i[t],r=n.name,o=n.type,a=n.parameters,s=n.body,c=0;c<this._sourceCode.length;){var l=this._sourceCode.indexOf(r,c);if(l<0)break;var u=this._skipWhitespaces(this._sourceCode,l+r.length);if(u!==this._sourceCode.length&&"("===this._sourceCode.charAt(u)){var h=this._extractBetweenMarkers("(",")",this._sourceCode,u);if(h<0)this.debug&&console.warn("Could not extract the parameters of the function call. Function '"+r+"' (type="+o+"). callParamsStartIndex="+u),c=l+r.length;else{for(var d=this._sourceCode.substring(u+1,h),p=this._removeComments(d).split(","),f=[],m=0;m<p.length;++m){var _=p[m].trim();f.push(_)}var g,v,b,y,T,E="void"!==o?r+"_"+n.callIndex++:null;E&&f.push(E+" ="),f.length===a.length?(c=h+1,g=this._replaceNames(s,a,f),y=0<l?this._sourceCode.substring(0,l):"",v=h+1<this._sourceCode.length-1?this._sourceCode.substring(h+1):"",E?(b=this._findBackward(this._sourceCode,l-1,"\n"),y=this._sourceCode.substring(0,b+1),T=this._sourceCode.substring(b+1,l),this._sourceCode=y+o+" "+E+";\n"+g+"\n"+T+E+v,this.debug&&console.log("Replace function call by code. Function '"+r+"' (type="+o+"). injectDeclarationIndex="+b)):(this._sourceCode=y+g+v,c+=g.length-(h+1-l),this.debug&&console.log("Replace function call by code. Function '"+r+"' (type="+o+"). functionCallIndex="+l)),e=!0):(this.debug&&console.warn("Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '"+r+"' (type="+o+"). function parameters="+a+", call parameters="+f),c=l+r.length)}}else c=l+r.length}return e},b.prototype._findBackward=function(e,t,i){for(;0<=t&&e.charAt(t)!==i;)t--;return t},b.prototype._escapeRegExp=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},b.prototype._replaceNames=function(e,t,i){for(var n=0;n<t.length;++n){var r=new RegExp(this._escapeRegExp(t[n]),"g"),o=i[n];e=e.replace(r,o)}return e},b._RegexpFindFunctionNameAndType=/((\s+?)(\w+)\s+(\w+)\s*?)$/,b);function b(e,t){void 0===t&&(t=20),this.debug=!1,this._sourceCode=e,this._numMaxIterations=t,this._functionDescr=[],this.inlineToken="#define inline"}},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1);var a=i(8),s=i(60);a.a.CreateHemisphere=function(e,t,i,n){var r={segments:t,diameter:i};return o.CreateHemisphere(e,r,n)};var o=(n.CreateHemisphere=function(e,t,i){t.diameter||(t.diameter=1),t.segments||(t.segments=16);var n=s.a.CreateSphere("",{slice:.5,diameter:t.diameter,segments:t.segments},i),r=a.a.CreateDisc("",t.diameter/2,3*t.segments+(4-t.segments),i);r.rotation.x=-Math.PI/2,r.parent=n;var o=a.a.MergeMeshes([r,n],!0);return o.name=e,o},n);function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var r,n=i(1),o=i(104),a=i(8),s=i(0),c=(r=o.a,Object(n.d)(u,r),u.prototype._getFilenameAndPath=function(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}},u.prototype._getModelLoadingConstraints=function(){return!0},u.prototype._processLoadedModel=function(e){},u.prototype._setRootMesh=function(e){var t=this;this.rootMesh=new a.a(this.profileId+" "+this.handedness,this.scene),e.forEach(function(e){e.isPickable=!1,e.parent||e.setParent(t.rootMesh)}),this.rootMesh.rotationQuaternion=s.b.FromEulerAngles(0,Math.PI,0)},u.prototype._updateModel=function(){},u.ProfileId="generic-trigger",u),l={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-right",assetPath:"right.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-none",assetPath:"none.glb"}};function u(e,t,i){var n=r.call(this,e,l[i],t,i)||this;return n.profileId=u.ProfileId,n}},function(e,t,i){"use strict";i.d(t,"b",function(){return r}),i.d(t,"a",function(){return o});var n=i(0),r=(s.prototype.clone=function(){return new s(this.position.clone(),this.normal.clone())},s),o=(a.prototype.clone=function(){return new a(this.position.clone(),this.normal.clone(),this.uv.clone())},a);function a(e,t,i){void 0===e&&(e=n.e.Zero()),void 0===t&&(t=n.e.Up()),void 0===i&&(i=n.d.Zero()),this.position=e,this.normal=t,this.uv=i}function s(e,t){void 0===e&&(e=n.e.Zero()),void 0===t&&(t=n.e.Up()),this.position=e,this.normal=t}},function(e,t,i){"use strict";i.d(t,"a",function(){return l}),i.d(t,"b",function(){return u});var n=i(1),r=i(4),o=i(77),a=i(2),s=i(6),c=i(5),l=(i(217),d.prototype.setViewport=function(e){void 0===e&&(e=this._fullscreenViewport),this.engine.setViewport(e)}
1,d.prototype.bindBuffers=function(e){this.engine.bindBuffers(this._vertexBuffers,this._indexBuffer,e)},d.prototype.applyEffectWrapper=function(e){this.engine.depthCullingState.depthTest=!1,this.engine.stencilState.stencilTest=!1,this.engine.enableEffect(e.effect),this.bindBuffers(e.effect),e.onApplyObservable.notifyObservers({})},d.prototype.restoreStates=function(){this.engine.depthCullingState.depthTest=!0,this.engine.stencilState.stencilTest=!0},d.prototype.draw=function(){this.engine.drawElementsType(a.a.MATERIAL_TriangleFillMode,0,6)},d.prototype.isRenderTargetTexture=function(e){return void 0!==e.renderList},d.prototype.render=function(e,t){var i;void 0===t&&(t=null),e.effect.isReady()&&(this.setViewport(),(i=null===t?null:this.isRenderTargetTexture(t)?t.getInternalTexture():t)&&this.engine.bindFramebuffer(i),this.applyEffectWrapper(e),this.draw(),i&&this.engine.unBindFramebuffer(i),this.restoreStates())},d.prototype.dispose=function(){var e=this._vertexBuffers[r.b.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[r.b.PositionKind]),this._indexBuffer&&this.engine._releaseBuffer(this._indexBuffer)},d._DefaultOptions={positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]},d),u=(h.prototype.dispose=function(){this.effect.dispose()},h);function h(e){var t,i=this;this.onApplyObservable=new s.c;var n=e.uniformNames||[];e.vertexShader?t={fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:(n.push("scale"),t={fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.onApplyObservable.add(function(){i.effect.setFloat2("scale",1,1)}));var r=e.defines?e.defines.join("\n"):"";e.useShaderStore?(t.fragment=t.fragmentSource,t.vertex||(t.vertex=t.vertexSource),delete t.fragmentSource,delete t.vertexSource,this.effect=e.engine.createEffect(t.spectorName,e.attributeNames||["position"],n,e.samplerNames,r,void 0,e.onCompiled)):this.effect=new c.a(t,e.attributeNames||["position"],n,e.samplerNames,e.engine,r,void 0,e.onCompiled)}function d(e,t){var i;void 0===t&&(t=d._DefaultOptions),this.engine=e,this._fullscreenViewport=new o.a(0,0,1,1),t=Object(n.a)(Object(n.a)({},d._DefaultOptions),t),this._vertexBuffers=((i={})[r.b.PositionKind]=new r.b(e,t.positions,r.b.PositionKind,!1,!1,2),i),this._indexBuffer=e.createIndexBuffer(t.indices)}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(40),c=i(7),r=i(22),a=i(284),o=(Object.defineProperty(s.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"vertexCount",{get:function(){return this._vertexCount},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"supportsNormals",{get:function(){return this._supportsNormals&&this.enableNormalMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"supportsTangents",{get:function(){return this._supportsTangents&&this.enableTangentMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"supportsUVs",{get:function(){return this._supportsUVs&&this.enableUVMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"numTargets",{get:function(){return this._targets.length},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"numInfluencers",{get:function(){return this._activeTargets.length},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"influences",{get:function(){return this._influences},enumerable:!1,configurable:!0}),s.prototype.getActiveTarget=function(e){return this._activeTargets.data[e]},s.prototype.getTarget=function(e){return this._targets[e]},s.prototype.addTarget=function(e){var t=this;this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add(function(e){t._syncActiveTargets(e)})),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add(function(){t._syncActiveTargets(!0)})),this._syncActiveTargets(!0)},s.prototype.removeTarget=function(e){var t=this._targets.indexOf(e);0<=t&&(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))},s.prototype.clone=function(){for(var e=new s(this._scene),t=0,i=this._targets;t<i.length;t++){var n=i[t];e.addTarget(n.clone())}return e.enableNormalMorphing=this.enableNormalMorphing,e.enableTangentMorphing=this.enableTangentMorphing,e.enableUVMorphing=this.enableUVMorphing,e},s.prototype.serialize=function(){var e={};e.id=this.uniqueId,e.targets=[];for(var t=0,i=this._targets;t<i.length;t++){var n=i[t];e.targets.push(n.serialize())}return e},s.prototype._syncActiveTargets=function(e){var t=0;this._activeTargets.reset(),this._supportsNormals=!0,this._supportsTangents=!0,this._supportsUVs=!0;for(var i=this._vertexCount=0,n=this._targets;i<n.length;i++){var r=n[i];if(0!==r.influence){this._activeTargets.push(r),this._tempInfluences[t++]=r.influence,this._supportsNormals=this._supportsNormals&&r.hasNormals,this._supportsTangents=this._supportsTangents&&r.hasTangents,this._supportsUVs=this._supportsUVs&&r.hasUVs;var o=r.getPositions();if(o){var a=o.length/3;if(0===this._vertexCount)this._vertexCount=a;else if(this._vertexCount!==a)return void c.a.Error("Incompatible target. Targets must all have the same vertices count.")}}}this._influences&&this._influences.length===t||(this._influences=new Float32Array(t));for(var s=0;s<t;s++)this._influences[s]=this._tempInfluences[s];e&&this.synchronize()},s.prototype.synchronize=function(){if(this._scene)for(var e=0,t=this._scene.meshes;e<t.length;e++){var i=t[e];i.morphTargetManager===this&&i._syncGeometryWithMorphTargetManager()}},s.Parse=function(e,t){var i=new s(t);i._uniqueId=e.id;for(var n=0,r=e.targets;n<r.length;n++){var o=r[n];i.addTarget(a.a.Parse(o))}return i},s);function s(e){void 0===e&&(e=null),this._targets=new Array,this._targetInfluenceChangedObservers=new Array,this._targetDataLayoutChangedObservers=new Array,this._activeTargets=new n.a(16),this._supportsNormals=!1,this._supportsTangents=!1,this._supportsUVs=!1,this._vertexCount=0,this._uniqueId=0,this._tempInfluences=new Array,this.enableNormalMorphing=!0,this.enableTangentMorphing=!0,this.enableUVMorphing=!0,e=e||r.a.LastCreatedScene,this._scene=e,this._scene&&(this._scene.morphTargetManagers.push(this),this._uniqueId=this._scene.getUniqueId())}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(1),o=i(0),a=i(9),r=i(23);i(5).a.ShadersStore.vrDistortionCorrectionPixelShader="\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}";var s,c=(s=r.a,Object(n.d)(l,s),l);function l(e,t,i,n){var r=s.call(this,e,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,
1n.postProcessScaleFactor,t,a.a.BILINEAR_SAMPLINGMODE)||this;return r._isRightEye=i,r._distortionFactors=n.distortionK,r._postProcessScaleFactor=n.postProcessScaleFactor,r._lensCenterOffset=n.lensCenterOffset,r.adaptScaleToCurrentViewport=!0,r.onSizeChangedObservable.add(function(){r._scaleIn=new o.d(2,2/r.aspectRatio),r._scaleFactor=new o.d(1/r._postProcessScaleFactor*.5,1/r._postProcessScaleFactor*.5*r.aspectRatio),r._lensCenter=new o.d(r._isRightEye?.5-.5*r._lensCenterOffset:.5+.5*r._lensCenterOffset,.5)}),r.onApplyObservable.add(function(e){e.setFloat2("LensCenter",r._lensCenter.x,r._lensCenter.y),e.setFloat2("Scale",r._scaleFactor.x,r._scaleFactor.y),e.setFloat2("ScaleIn",r._scaleIn.x,r._scaleIn.y),e.setFloat4("HmdWarpParam",r._distortionFactors[0],r._distortionFactors[1],r._distortionFactors[2],r._distortionFactors[3])}),r}},function(e,t,i){"use strict";i.d(t,"a",function(){return S});var r,n,o,a,s,c,l=i(41),u=(L.prototype.isValid=function(e){return!0},L.prototype.process=function(t,i){var e,n,r="";return this.line&&(e=this.line,(n=i.processor)&&(n.lineProcessor&&(e=n.lineProcessor(e,i.isFragment)),n.attributeProcessor&&l.a.StartsWith(this.line,"attribute")?e=n.attributeProcessor(this.line):n.varyingProcessor&&l.a.StartsWith(this.line,"varying")?e=n.varyingProcessor(this.line,i.isFragment):(n.uniformProcessor||n.uniformBufferProcessor)&&l.a.StartsWith(this.line,"uniform")&&(/uniform (.+) (.+)/.test(this.line)?n.uniformProcessor&&(e=n.uniformProcessor(this.line,i.isFragment)):n.uniformBufferProcessor&&(e=n.uniformBufferProcessor(this.line,i.isFragment),i.lookForClosingBracketForUniformBuffer=!0)),n.endOfUniformBufferProcessor&&i.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(i.lookForClosingBracketForUniformBuffer=!1,e=n.endOfUniformBufferProcessor(this.line,i.isFragment))),r+=e+"\r\n"),this.children.forEach(function(e){r+=e.process(t,i)}),this.additionalDefineKey&&(t[this.additionalDefineKey]=this.additionalDefineValue||"true"),r},L),h=(Object.defineProperty(D.prototype,"currentLine",{get:function(){return this._lines[this.lineIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"canRead",{get:function(){return this.lineIndex<this._lines.length-1},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"lines",{set:function(e){this._lines=[];for(var t=0,i=e;t<i.length;t++){var n=i[t];if("#"!==n[0])for(var r=n.split(";"),o=0;o<r.length;o++){var a=r[o];(a=a.trim())&&this._lines.push(a+(o!==r.length-1?";":""))}else this._lines.push(n)}},enumerable:!1,configurable:!0}),D),d=i(1),p=(c=u,Object(d.d)(I,c),I.prototype.process=function(e,t){for(var i=0;i<this.children.length;i++){var n=this.children[i];if(n.isValid(e))return n.process(e,t)}return""},I),f=(s=u,Object(d.d)(M,s),M.prototype.isValid=function(e){return this.testExpression.isTrue(e)},M),m=(O.prototype.isTrue=function(e){return!0},O.postfixToInfix=function(e){for(var t=[],i=0,n=e;i<n.length;i++){var r,o,a=n[i];void 0===O._OperatorPriority[a]?t.push(a):(r=t[t.length-1],o=t[t.length-2],t.length-=2,t.push("("+o+a+r+")"))}return t[t.length-1]},O.infixToPostfix=function(e){for(var t=[],i=-1,n=function(){""!==(c=c.trim())&&(t.push(c),c="")},r=function(e){i<O._Stack.length-1&&(O._Stack[++i]=e)},o=function(){return O._Stack[i]},a=function(){return-1===i?"!!INVALID EXPRESSION!!":O._Stack[i--]},s=0,c="";s<e.length;){var l=e.charAt(s),u=s<e.length-1?e.substr(s,2):"";if("("===l)c="",r(l);else if(")"===l){for(n();-1!==i&&"("!==o();)t.push(a());a()}else if(1<O._OperatorPriority[u]){for(n();-1!==i&&O._OperatorPriority[o()]>=O._OperatorPriority[u];)t.push(a());r(u),s++}else c+=l;s++}for(n();-1!==i;)"("===o()?a():t.push(a());return t},O._OperatorPriority={")":0,"(":1,"||":2,"&&":3},O._Stack=["","","","","","","","","","","","","","","","","","","",""],O),_=(a=m,Object(d.d)(R,a),R.prototype.isTrue=function(e){var t=void 0!==e[this.define];return this.not&&(t=!t),t},R),g=(o=m,Object(d.d)(x,o),x.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)},x),v=(n=m,Object(d.d)(P,n),P.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)},P),b=(r=m,Object(d.d)(C,r),C.prototype.isTrue=function(e){var t=e[this.define];void 0===t&&(t=this.define);var i=!1,n=parseInt(t),r=parseInt(this.testValue);switch(this.operand){case">":i=r<n;break;case"<":i=n<r;break;case"<=":i=n<=r;break;case">=":i=r<=n;break;case"==":i=n===r}return i},C),y=i(21),T=/defined\s*?\((.+?)\)/g,E=/defined\s*?\[(.+?)\]/g,S=(A.Process=function(e,i,n){var r=this;this._ProcessIncludes(e,i,function(e){var t=r._ProcessShaderConversion(e,i);n(t)})},A._ProcessPrecision=function(e,t){var i=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=i?"precision highp float;\n"+e:"precision mediump float;\n"+e:i||(e=e.replace("precision highp float","precision mediump float")),e},A._ExtractOperation=function(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new _(t[1].trim(),"!"===e[0]);for(var i="",n=0,r=0,o=["==",">=","<=","<",">"];r<o.length&&(i=o[r],!(-1<(n=e.indexOf(i))));r++);if(-1===n)return new _(e);var a=e.substring(0,n).trim(),s=e.substring(n+i.length).trim();return new b(a,i,s)},A._BuildSubExpression=function(e){e=e.replace(T,"defined[$1]");for(var t=[],i=0,n=m.infixToPostfix(e);i<n.length;i++){var r,o,a,s=n[i];"||"!==s&&"&&"!==s?t.push(s):2<=t.length&&(r=t[t.length-1],o=t[t.length-2],t.length-=2,a=new("&&"==s?v:g),"string"==typeof r&&(r=r.replace(E,"defined($1)")),"string"==typeof o&&(o=o.replace(E,"defined($1)")),a.leftOperand="string"==typeof o?this._ExtractOperation(o):o,a.rightOperand="string"==typeof r?this._ExtractOperation(r):r,t.push(a))}var c=t[t.length-1];return"string"==typeof c&&(c=c.replace(E,"defined($1)")),"string"==typeof c?this._ExtractOperation(c):c},A._BuildExpression=function(e,t){var i=new f,n=e.substring(0,t),r=(r=e.substring(t)).substring(0,(r.indexOf("//")+1||r.length+1)-1).trim();
1return i.testExpression="#ifdef"===n?new _(r):"#ifndef"===n?new _(r,!0):this._BuildSubExpression(r),i},A._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var r,o=(n=e.currentLine).substring(0,5).toLowerCase();if("#else"===o){var a=new u;return t.children.push(a),void this._MoveCursor(e,a)}"#elif"===o&&(r=this._BuildExpression(n,5),t.children.push(r),i=r)}},A._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length)switch(n[0]){case"#ifdef":var r=new p;t.children.push(r);var o=this._BuildExpression(i,6);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":r=new p,t.children.push(r),o=this._BuildExpression(i,7),r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#if":r=new p,o=this._BuildExpression(i,3),t.children.push(r),r.children.push(o),this._MoveCursorWithinIf(e,r,o)}else{var a,s=new u;s.line=i,t.children.push(s),"#"===i[0]&&"d"===i[1]&&(a=i.replace(";","").split(" "),s.additionalDefineKey=a[1],3===a.length&&(s.additionalDefineValue=a[2]))}}return!1},A._EvaluatePreProcessors=function(e,t,i){var n=new u,r=new h;return r.lineIndex=-1,r.lines=e.split("\n"),this._MoveCursor(r,n),n.process(t,i)},A._PreparePreProcessors=function(e){for(var t={},i=0,n=e.defines;i<n.length;i++){var r=n[i].replace("#define","").replace(";","").trim().split(" ");t[r[0]]=1<r.length?r[1]:""}return t.GL_ES="true",t.__VERSION__=e.version,t[e.platformName]="true",t},A._ProcessShaderConversion=function(e,t){var i=this._ProcessPrecision(e,t);if(!t.processor)return i;if(-1!==i.indexOf("#version 3"))return i.replace("#version 300 es","");var n=t.defines,r=this._PreparePreProcessors(t);return t.processor.preProcessor&&(i=t.processor.preProcessor(i,n,t.isFragment)),i=this._EvaluatePreProcessors(i,r,t),t.processor.postProcessor&&(i=t.processor.postProcessor(i,n,t.isFragment)),i},A._ProcessIncludes=function(e,t,i){for(var n=this,r=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,o=r.exec(e),a=new String(e),s=!1;null!=o;){var c=o[1];if(-1!==c.indexOf("__decl__")&&(c=c.replace(/__decl__/,""),t.supportsUniformBuffers&&(c=(c=c.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),c+="Declaration"),!t.includesShadersStore[c]){var l=t.shadersRepository+"ShadersInclude/"+c+".fx";return void A._FileToolsLoadFile(l,function(e){t.includesShadersStore[c]=e,n._ProcessIncludes(a,t,i)})}var u=t.includesShadersStore[c];if(o[2])for(var h=o[3].split(","),d=0;d<h.length;d+=2)var p=new RegExp(h[d],"g"),f=h[d+1],u=u.replace(p,f);if(o[4]){var m=o[5];if(-1!==m.indexOf("..")){var _=m.split(".."),g=parseInt(_[0]),v=parseInt(_[1]),b=u.slice(0);u="",isNaN(v)&&(v=t.indexParameters[_[1]]);for(var y=g;y<v;y++)t.supportsUniformBuffers||(b=b.replace(/light\{X\}.(\w*)/g,function(e,t){return t+"{X}"})),u+=b.replace(/\{X\}/g,y.toString())+"\n"}else t.supportsUniformBuffers||(u=u.replace(/light\{X\}.(\w*)/g,function(e,t){return t+"{X}"})),u=u.replace(/\{X\}/g,m)}a=a.replace(o[0],u),s=s||0<=u.indexOf("#include<"),o=r.exec(e)}s?this._ProcessIncludes(a.toString(),t,i):i(a)},A._FileToolsLoadFile=function(e,t,i,n,r,o){throw y.a.WarnImport("FileTools")},A);function A(){}function C(e,t,i){var n=r.call(this)||this;return n.define=e,n.operand=t,n.testValue=i,n}function P(){return null!==n&&n.apply(this,arguments)||this}function x(){return null!==o&&o.apply(this,arguments)||this}function R(e,t){void 0===t&&(t=!1);var i=a.call(this)||this;return i.define=e,i.not=t,i}function O(){}function M(){return null!==s&&s.apply(this,arguments)||this}function I(){return null!==c&&c.apply(this,arguments)||this}function D(){}function L(){this.children=[]}},function(e,t,i){"use strict";i(31).a.prototype._readTexturePixels=function(e,t,i,n,r,o){void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null);var a=this._gl;if(!a)throw new Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){var s=a.createFramebuffer();if(!s)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=s}a.bindFramebuffer(a.FRAMEBUFFER,this._dummyFramebuffer),-1<n?a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+n,e._webGLTexture,r):a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e._webGLTexture,r);var c=void 0!==e.type?this._getWebGLTextureType(e.type):a.UNSIGNED_BYTE;switch(c){case a.UNSIGNED_BYTE:o=o||new Uint8Array(4*t*i),c=a.UNSIGNED_BYTE;break;default:o=o||new Float32Array(4*t*i),c=a.FLOAT}return a.readPixels(0,0,t,i,a.RGBA,c,o),a.bindFramebuffer(a.FRAMEBUFFER,this._currentFramebuffer),o}},function(e,t,i){"use strict";i(5).a.ShadersStore.postprocessVertexShader="\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}"},function(e,t,i){"use strict";var n=i(25),r=i(0),o=i(214),a=i(189),s=i(103),c=i(7),l=i(77);n.a._setVRRigMode=function(e,t){var i=t.vrCameraMetrics||s.a.GetDefault();e._rigCameras[0]._cameraRigParams.vrMetrics=i,e._rigCameras[0].viewport=new l.a(0,0,.5,1),e._rigCameras[0]._cameraRigParams.vrWorkMatrix=new r.a,e._rigCameras[0]._cameraRigParams.vrHMatrix=i.leftHMatrix,e._rigCameras[0]._cameraRigParams.vrPreViewMatrix=i.leftPreViewMatrix,e._rigCameras[0].getProjectionMatrix=e._rigCameras[0]._getVRProjectionMatrix,e._rigCameras[1]._cameraRigParams.vrMetrics=i,e._rigCameras[1].viewport=new l.a(.5,0,.5,1),e._rigCameras[1]._cameraRigParams.vrWorkMatrix=new r.a,e._rigCameras[1]._cameraRigParams.vrHMatrix=i.rightHMatrix,e._rigCameras[1]._cameraRigParams.vrPreViewMatrix=i.rightPreViewMatrix,e._rigCameras[1].getProjectionMatrix=e._rigCameras[1]._getVRProjectionMatrix,i.multiviewEnabled&&(e.getScene().getEngine().getCaps().multiview?(e._useMultiviewToSingleView=!0,e._rigPostProcess=new a.a("VRMultiviewToSingleview",e,i.postProcessScaleFactor)):(c.a.Warn("Multiview is not supported, falling back to standard rendering"),i.multiviewEnabled=!1)),i.compensateDistortion&&(e._rigCameras[0]._rigPostProcess=new o.a("VR_Distort_Compensation_Left",e._rigCameras[0],!1,i),e._rigCameras[1]._rigPostProcess=new o.a("VR_Distort_Compensation_Right",e._rigCameras[1],!0,i))}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.shadowsFragmentFunctions="#ifdef SHADOWS\n#ifndef SHADOWFLOAT\n\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}
1\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\n#define inline\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nreturn depth>shadow ? darkness : 1.0;\n}\n#define inline\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\n#define inline\nfloat computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn esm;\n}\n#define inline\nfloat computeShadowWithCloseESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn esm;\n}\n#ifdef WEBGL2\n#define inline\nfloat computeShadowCSM(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nvec3 uvLayer=vec3(uv.x,uv.y,layer);\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uvLayer));\n#else\nfloat shadow=texture2D(shadowSampler,uvLayer).x;\n#endif\nreturn shadowPixelDepth>
1shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n#endif\n#define inline\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n}\n#define inline\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<shadowPixelDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<shadowPixelDepth) visibility-=0.25;\n#endif\nreturn computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#ifdef WEBGL2\n#define GREATEST_LESS_THAN_ONE 0.99999994\n\n#define inline\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat shadow=texture(shadowSampler,uvDepthLayer);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}
1\n\n\n\n#define inline\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\n#define inline\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n#define inline\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n\n\n\n#define inline\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}
1\n\n\n\n#define inline\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.14688
16,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\n#define inline\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i<searchTapCount; i ++) {\nblockerDepth=texture(depthSampler,vec3(uvDepth.xy+(lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse*PoissonSamplers32[i].xy),layer)).r;\nif (blockerDepth<depthMetric) {\nsumBlockerDepth+=blockerDepth;\nnumBlocker++;\n}\n}\nif (numBlocker<1.0) {\nreturn 1.0;\n}\nelse\n{\nfloat avgBlockerDepth=sumBlockerDepth/numBlocker;\n\nfloat AAOffset=shadowMapSizeInverse*10.;\n\n\nfloat penumbraRatio=((depthMetric-avgBlockerDepth)*depthCorrection+AAOffset);\nvec4 filterRadius=vec4(penumbraRatio*lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse,0.,0.);\nfloat random=getRand(vPositionFromLight.xy);\nfloat rotationAngle=random*3.1415926;\nvec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));\nfloat shadow=0.;\nfor (int i=0; i<pcfTapCount; i++) {\nvec4 offset=vec4(poissonSamplers[i],0.);\n\noffset=vec4(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.,0.);\nshadow+=texture2D(shadowSampler,uvDepthLayer+offset*filterRadius);\n}\nshadow/=float(pcfTapCount);\n\nshadow=mix(shadow,1.,min((depthMetric-avgBlockerDepth)*depthCorrection*penumbraDarkness,1.));\n\nshadow=mix(darkness,1.,shadow);\n\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n\n\n\n\n\n#define inline\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i<searchTapCount; i ++) {\nblockerDepth=texture(depthSampler,uvDepth.xy+(lightSizeUV*shadowMapSizeInverse*PoissonSamplers32[i].xy)).r;\nif (blockerDepth<depthMetric) {\nsumBlockerDepth+=blockerDepth;\nnumBlocker++;\n}\n}\nif (numBlocker<1.0) {\nreturn 1.0;\n}\nelse\n{\nfloat avgBlockerDepth=sumBlockerDepth/numBlocker;\n\nfloat AAOffset=shadowMapSizeInverse*10.;\n\n\nfloat penumbraRatio=((depthMetric-avgBlockerDepth)+AAOffset);\nfloat filterRadius=penumbraRatio*lightSizeUV*shadowMapSizeInverse;\nfloat random=getRand(vPositionFromLight.xy);\nfloat rotationAngle=random*3.1415926;\nvec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));\nfloat shadow=0.;\nfor (int i=0; i<pcfTapCount;
1 i++) {\nvec3 offset=poissonSamplers[i];\n\noffset=vec3(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.);\nshadow+=texture2D(shadowSampler,uvDepth+offset*filterRadius);\n}\nshadow/=float(pcfTapCount);\n\nshadow=mix(shadow,1.,depthMetric-avgBlockerDepth);\n\nshadow=mix(darkness,1.,shadow);\n\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n}\n#define inline\nfloat computeShadowWithPCSS16(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);\n}\n#define inline\nfloat computeShadowWithPCSS32(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);\n}\n#define inline\nfloat computeShadowWithPCSS64(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);\n}\n#define inline\nfloat computeShadowWithCSMPCSS16(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nreturn computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);\n}\n#define inline\nfloat computeShadowWithCSMPCSS32(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nreturn computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);\n}\n#define inline\nfloat computeShadowWithCSMPCSS64(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nreturn computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);\n}\n#endif\n#endif\n"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.reflectionFunction="vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\n\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\n\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\n\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\n\nvec3 intersectPositionWS=vertexPos+origVec*distance;\n\nreturn intersectPositionWS-cubePos;\n}\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(1.0-s,t,0);\n}\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);
1\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\nr=vec3(reflectionMatrix*vec4(r,0));\nfloat lon=atan(r.z,r.x);\nfloat lat=acos(r.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr=vec3(reflectionMatrix*vec4(r,0));\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n}\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=worldPos.xyz-eyePosition;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n}\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\n\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\n\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*(view*worldPos));\n}\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*vec4(positionW,1.));\n}\n#ifdef REFLECTION\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_CUBIC\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\n#else\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bumpFragmentMainFunctions="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{\n\nuv=gl_FrontFacing ? uv : -uv;\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);
1\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\n\ntangent*=tangentSpaceParams.x;\nbitangent*=tangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\n#endif\n"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bumpFragmentFunctions="#if defined(BUMP)\n#if BUMPDIRECTUV == 1\n#define vBumpUV vMainUV1\n#elif BUMPDIRECTUV == 2\n#define vBumpUV vMainUV2\n#else\nvarying vec2 vBumpUV;\n#endif\nuniform sampler2D bumpSampler;\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\n}\n#endif\n#if defined(DETAIL)\n#if DETAILDIRECTUV == 1\n#define vDetailUV vMainUV1\n#elif DETAILDIRECTUV == 2\n#define vDetailUV vMainUV2\n#else\nvarying vec2 vDetailUV;\n#endif\nuniform sampler2D detailSampler;\n#endif\n#if defined(BUMP)\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\n{\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\n}\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;\n\nif (currSampledHeight>currRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bumpFragment="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vDetailUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n\n#if DETAIL_NORMALBLENDMETHOD == 0\ndetailNormal.xy*=vDetailInfos.z;\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD == 1\ndetailNormal.xy*=vDetailInfos.z;\nbumpNormal+=vec3(0.0,0.0,1.0);\ndetailNormal*=vec3(-1.0,-1.0,1.0);\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.lightFragment="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifdef PBR\n\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);
1\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n\n\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\n#endif\n\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#endif\n\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\n\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n\n#ifdef CLEARCOAT\n\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\n#ifdef CLEARCOAT_TINT\n\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\ninfo.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\n\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);
1\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i<SHADOWCSMNUM_CASCADES{X}; i++)\n{\n#ifdef SHADOWCSM_RIGHTHANDED{X}\ndiff{X}=viewFrustumZ{X}[i]+vPositionFromCamera{X}.z;\n#else\ndiff{X}=viewFrustumZ{X}[i]-vPositionFromCamera{X}.z;\n#endif\nif (diff{X}>=0.) {\nindex{X}=i;\nbreak;\n}\n}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{\nindex{X}+=1;\nfloat nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else\ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.fogFragment="#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.fogVertexDeclaration="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.shadowsVertex="#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvPositionFromCamera{X}
1=view*worldPos;\nfor (int i=0; i<SHADOWCSMNUM_CASCADES{X}; i++) {\nvPositionFromLight{X}[i]=lightMatrix{X}[i]*worldPos;\nvDepthMetric{X}[i]=((vPositionFromLight{X}[i].z+light{X}.depthValues.x)/(light{X}.depthValues.y));\n}\n#elif defined(SHADOW{X}) && !defined(SHADOWCUBE{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\nvDepthMetric{X}=((vPositionFromLight{X}.z+light{X}.depthValues.x)/(light{X}.depthValues.y));\n#endif\n#endif"},function(e,t,i){"use strict";var n=i(31),o=i(96);n.a.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.getError(),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=o.a.CreateCanvas(e.width,e.height);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.clearRect(0,0,e.width,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}}}},function(e,t,i){"use strict";var a=i(1),S=i(31),A=i(27),C=i(7),c=i(68);S.a.prototype._createDepthStencilCubeTexture=function(e,t){var i=new A.a(this,A.b.Unknown);if(i.isCube=!0,1===this.webGLVersion)return C.a.Error("Depth cube texture is not supported by WebGL 1."),i;var n=Object(a.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},S.a.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)})},S.a.prototype._cascadeLoadFiles=function(e,t,i,n){void 0===n&&(n=null);for(var r=[],o=r._internalCount=0;o<6;o++)this._partialLoadFile(i[o],o,r,t,n)},S.a.prototype._cascadeLoadImgs=function(e,t,i,n,r){void 0===n&&(n=null);for(var o=[],a=o._internalCount=0;a<6;a++)this._partialLoadImg(i[a],a,o,e,t,n,r)},S.a.prototype._partialLoadImg=function(e,t,i,n,r,o,a){var s;void 0===o&&(o=null),s=c.a.LoadImage(e,function(){s&&(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,a),n&&s&&n._addPendingData(s)},S.a.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)},S.a.prototype.createCubeTexture=function(i,n,r,a,s,o,c,l,u,h,d,e){var p=this;void 0===s&&(s=null),void 0===o&&(o=null),void 0===l&&(l=null),void 0===u&&(u=!1),void 0===h&&(h=0),void 0===d&&(d=0),void 0===e&&(e=null);var f=this._gl,m=e||new A.a(this,A.b.Cube);m.isCube=!0,m.url=i,m.generateMipMaps=!a,m._lodGenerationScale=h,m._lodGenerationOffset=d,this._doNotHandleContextLost||(m._extension=l,m._files=r);var _=i;this._transformTextureUrl&&!e&&(i=this._transformTextureUrl(i));for(var t=i.lastIndexOf("."),g=l||(-1<t?i.substring(t).toLowerCase():""),v=null,b=0,y=S.a._TextureLoaders;b<y.length;b++){var T=y[b];
1if(T.canLoad(g)){v=T;break}}if(v){var E=function(e){p._bindTextureDirectly(f.TEXTURE_CUBE_MAP,m,!0),v.loadCubeData(e,m,u,s,o)};r&&6===r.length?v.supportCascades?this._cascadeLoadFiles(n,function(e){return E(e.map(function(e){return new Uint8Array(e)}))},r,o):o?o("Textures type does not support cascades."):C.a.Warn("Texture loader does not support cascades."):this._loadFile(i,function(e){return E(new Uint8Array(e))},void 0,void 0,!0,function(e,t){i===_?o&&e&&o(e.status+" "+e.statusText,t):(C.a.Warn("Failed to load "+i+", falling back to the "+_),p.createCubeTexture(_,n,r,a,s,o,c,l,u,h,d,m))})}else{if(!r)throw new Error("Cannot load cubemap because files were not defined");this._cascadeLoadImgs(n,function(e){var t=p.needPOTTextures?S.a.GetExponentOfTwo(e[0].width,p._caps.maxCubemapTextureSize):e[0].width,i=t,n=[f.TEXTURE_CUBE_MAP_POSITIVE_X,f.TEXTURE_CUBE_MAP_POSITIVE_Y,f.TEXTURE_CUBE_MAP_POSITIVE_Z,f.TEXTURE_CUBE_MAP_NEGATIVE_X,f.TEXTURE_CUBE_MAP_NEGATIVE_Y,f.TEXTURE_CUBE_MAP_NEGATIVE_Z];p._bindTextureDirectly(f.TEXTURE_CUBE_MAP,m,!0),p._unpackFlipY(!1);for(var r=c?p._getInternalFormat(c):p._gl.RGBA,o=0;o<n.length;o++)if(e[o].width!==t||e[o].height!==i){if(p._prepareWorkingCanvas(),!p._workingCanvas||!p._workingContext)return void C.a.Warn("Cannot create canvas to resize texture.");p._workingCanvas.width=t,p._workingCanvas.height=i,p._workingContext.drawImage(e[o],0,0,e[o].width,e[o].height,0,0,t,i),f.texImage2D(n[o],0,r,r,f.UNSIGNED_BYTE,p._workingCanvas)}else f.texImage2D(n[o],0,r,r,f.UNSIGNED_BYTE,e[o]);a||f.generateMipmap(f.TEXTURE_CUBE_MAP),p._setCubeMapTextureParams(!a),m.width=t,m.height=i,m.isReady=!0,c&&(m.format=c),m.onLoadedObservable.notifyObservers(m),m.onLoadedObservable.clear(),s&&s()},r,o)}return this._internalTexturesCache.push(m),m}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.packingFunctions="vec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}"},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(18),r=i(17),o=i(127);Object.defineProperty(n.a.prototype,"geometryBufferRenderer",{get:function(){this._geometryBufferRenderer},set:function(e){e&&e.isSupported&&(this._geometryBufferRenderer=e)},enumerable:!0,configurable:!0}),n.a.prototype.enableGeometryBufferRenderer=function(e){return void 0===e&&(e=1),this._geometryBufferRenderer||(this._geometryBufferRenderer=new o.a(this,e),this._geometryBufferRenderer.isSupported||(this._geometryBufferRenderer=null)),this._geometryBufferRenderer},n.a.prototype.disableGeometryBufferRenderer=function(){this._geometryBufferRenderer&&(this._geometryBufferRenderer.dispose(),this._geometryBufferRenderer=null)};var a=(s.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(r.a.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER,this,this._gatherRenderTargets)},s.prototype.rebuild=function(){},s.prototype.dispose=function(){},s.prototype._gatherRenderTargets=function(e){this.scene._geometryBufferRenderer&&e.push(this.scene._geometryBufferRenderer.getGBuffer())},s);function s(e){this.name=r.a.NAME_GEOMETRYBUFFERRENDERER,this.scene=e}o.a._SceneComponentInitialization=function(e){var t=e._getComponent(r.a.NAME_GEOMETRYBUFFERRENDERER);t||(t=new a(e),e._addComponent(t))}},function(e,t,i){"use strict";i.d(t,"j",function(){return b}),i.d(t,"g",function(){return y}),i.d(t,"h",function(){return T}),i.d(t,"d",function(){return E}),i.d(t,"e",function(){return S}),i.d(t,"i",function(){return A}),i.d(t,"b",function(){return C}),i.d(t,"a",function(){return P}),i.d(t,"c",function(){return x}),i.d(t,"f",function(){return R});var o,r,a,n,s,c,l,u,h,d,p=i(1),f=i(7),m=i(0),_=i(38),g=i(2),v=i(11),b=(d=_.a,Object(p.d)(U,d),U.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},U.prototype.execute=function(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]},U.prototype.serialize=function(e){return d.prototype._serialize.call(this,{name:"SwitchBooleanAction",properties:[_.a._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath}]},e)},U),y=(h=_.a,Object(p.d)(B,h),B.prototype.execute=function(){this._target.state=this.value},B.prototype.serialize=function(e){return h.prototype._serialize.call(this,{name:"SetStateAction",properties:[_.a._GetTargetProperty(this._target),{name:"value",value:this.value}]},e)},B),T=(u=_.a,Object(p.d)(w,u),w.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},w.prototype.execute=function(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},w.prototype.serialize=function(e){return u.prototype._serialize.call(this,{name:"SetValueAction",properties:[_.a._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:_.a._SerializeValueAsString(this.value)}]},e)},w),E=(l=_.a,Object(p.d)(F,l),F.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),"number"!=typeof this._effectiveTarget[this._property]&&f.a.Warn("Warning: IncrementValueAction can only be used with
1number values")},F.prototype.execute=function(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},F.prototype.serialize=function(e){return l.prototype._serialize.call(this,{name:"IncrementValueAction",properties:[_.a._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:_.a._SerializeValueAsString(this.value)}]},e)},F),S=(c=_.a,Object(p.d)(N,c),N.prototype._prepare=function(){},N.prototype.execute=function(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)},N.prototype.serialize=function(e){return c.prototype._serialize.call(this,{name:"PlayAnimationAction",properties:[_.a._GetTargetProperty(this._target),{name:"from",value:String(this.from)},{name:"to",value:String(this.to)},{name:"loop",value:_.a._SerializeValueAsString(this.loop)||!1}]},e)},N),A=(s=_.a,Object(p.d)(L,s),L.prototype._prepare=function(){},L.prototype.execute=function(){this._actionManager.getScene().stopAnimation(this._target)},L.prototype.serialize=function(e){return s.prototype._serialize.call(this,{name:"StopAnimationAction",properties:[_.a._GetTargetProperty(this._target)]},e)},L),C=(n=_.a,Object(p.d)(D,n),D.prototype.execute=function(){},D.prototype.serialize=function(e){return n.prototype._serialize.call(this,{name:"DoNothingAction",properties:[]},e)},D),P=(a=_.a,Object(p.d)(I,a),I.prototype._prepare=function(){for(var e=0;e<this.children.length;e++)this.children[e]._actionManager=this._actionManager,this.children[e]._prepare()},I.prototype.execute=function(e){for(var t=0;t<this.children.length;t++)this.children[t].execute(e)},I.prototype.serialize=function(e){for(var t=a.prototype._serialize.call(this,{name:"CombineAction",properties:[],combine:[]},e),i=0;i<this.children.length;i++)t.combine.push(this.children[i].serialize(null));return t},I),x=(r=_.a,Object(p.d)(M,r),M.prototype.execute=function(e){this.func(e)},M),R=(o=_.a,Object(p.d)(O,o),O.prototype._prepare=function(){},O.prototype.execute=function(){var e;this._target.parent!==this._parent&&((e=this._parent.getWorldMatrix().clone()).invert(),this._target.position=m.e.TransformCoordinates(this._target.position,e),this._target.parent=this._parent)},O.prototype.serialize=function(e){return o.prototype._serialize.call(this,{name:"SetParentAction",properties:[_.a._GetTargetProperty(this._target),_.a._GetTargetProperty(this._parent)]},e)},O);function O(e,t,i,n){var r=o.call(this,e,n)||this;return r._target=t,r._parent=i,r}function M(e,t,i){var n=r.call(this,e,i)||this;return n.func=t,n}function I(e,t,i){var n=a.call(this,e,i)||this;return n.children=t,n}function D(e,t){return void 0===e&&(e=g.a.ACTION_NothingTrigger),n.call(this,e,t)||this}function L(e,t,i){var n=s.call(this,e,i)||this;return n._target=t,n}function N(e,t,i,n,r,o){var a=c.call(this,e,o)||this;return a.from=i,a.to=n,a.loop=r,a._target=t,a}function F(e,t,i,n,r){var o=l.call(this,e,r)||this;return o.propertyPath=i,o.value=n,o._target=o._effectiveTarget=t,o}function w(e,t,i,n,r){var o=u.call(this,e,r)||this;return o.propertyPath=i,o.value=n,o._target=o._effectiveTarget=t,o}function B(e,t,i,n){var r=h.call(this,e,n)||this;return r.value=i,r._target=t,r}function U(e,t,i,n){var r=d.call(this,e,n)||this;return r.propertyPath=i,r._target=r._effectiveTarget=t,r}v.a.RegisteredTypes["BABYLON.SetParentAction"]=R,v.a.RegisteredTypes["BABYLON.ExecuteCodeAction"]=x,v.a.RegisteredTypes["BABYLON.DoNothingAction"]=C,v.a.RegisteredTypes["BABYLON.StopAnimationAction"]=A,v.a.RegisteredTypes["BABYLON.PlayAnimationAction"]=S,v.a.RegisteredTypes["BABYLON.IncrementValueAction"]=E,v.a.RegisteredTypes["BABYLON.SetValueAction"]=T,v.a.RegisteredTypes["BABYLON.SetStateAction"]=y,v.a.RegisteredTypes["BABYLON.SetParentAction"]=R},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(l.Eval=function(e,t){return"true"===(e=e.match(/\([^\(\)]*\)/g)?e.replace(/\([^\(\)]*\)/g,function(e){return e=e.slice(1,e.length-1),l._HandleParenthesisContent(e,t)}):l._HandleParenthesisContent(e,t))||"false"!==e&&l.Eval(e,t)},l._HandleParenthesisContent=function(e,t){var i;t=t||function(e){return"true"===e};var n=e.split("||");for(var r in n)if(n.hasOwnProperty(r)){var o=l._SimplifyNegation(n[r].trim()),a=o.split("&&");if(1<a.length)for(var s=0;s<a.length;++s){var c=l._SimplifyNegation(a[s].trim());if(!(i="true"!==c&&"false"!==c?"!"===c[0]?!t(c.substring(1)):t(c):"true"===c)){o="false";break}}if(i||"true"===o){i=!0;break}i="true"!==o&&"false"!==o?"!"===o[0]?!t(o.substring(1)):t(o):"true"===o}return i?"true":"false"},l._SimplifyNegation=function(e){return"!true"===(e=(e=e.replace(/^[\s!]+/,function(e){return(e=e.replace(/[\s]/g,function(){return""})).length%2?"!":""})).trim())?e="false":"!false"===e&&(e="true"),e},l);function l(){}},function(e,t,i){"use strict";var n,r;i.d(t,"a",function(){return n}),(r=n=n||{})[r.STEP=1]="STEP"},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1);var h=i(0),n=i(10),E=i(26),r=i(94),S=Object.freeze(new h.b(0,0,0,0)),A=Object.freeze(h.e.Zero()),C=Object.freeze(h.d.Zero()),P=Object.freeze(r.a.Zero()),x=Object.freeze(n.a.Black()),o=(Object.defineProperty(a.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"weight",{get:function(){return this._weight},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"target",{get:function(){return this._currentActiveTarget},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isAdditive",{get:function(){return this._host&&this._host.isAdditive},enumerable:!1,configurable:!0}),a.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(1<i.length){for(var n=e[i[0]],r=1;r<i.length-1;r++)n=n[i[r]];this._targetPath=i[i.length-1],this._activeTargets[t]=n}else this._targetPath=i[0],this._activeTargets[t]=e},Object.defineProperty(a.prototype,"animation",{get:function(){return this._animation},enumerable:!1,configurable:!0}),a.prototype.reset=function(e){if(void 0===e&&(e=!1),e)if(this._target instanceof Array)for(var t=0,i=0,n=this._target;i<n.length;i++){var r=n[i];void 0!==this._originalValue[t]&&this._setValue(r,this._activeTargets[t],this._originalValue[t],-1,t),t++}else void 0!==this._originalValue[0]&&this._setValue(this._target,this._directTarget,this._originalValue[0],-1,0);for(this._offsetsCache={},this._highLimitsCache={},this._currentFrame=0,t=this._blendingFactor=0;t<this._events.length;t++)this._events[t].isDone=!1},a.prototype.isStopped=function(){return this._stopped},a.prototype.dispose=function(){var e=this._animation.runtimeAnimations.indexOf(this);-1<e&&this._animation.runtimeAnimations.splice(e,1)},a.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;i<this._target.length;i++){var n=this._target[i];this._setValue(n,this._activeTargets[i],e,t,i)}else this._setValue(this._target,this._directTarget,e,t,0)},a.prototype._getOriginalValues=function(e){var t;void 0===e&&(e=0);var i=this._activeTargets[e];(t=i.getRestPose&&"_matrix"===this._targetPath?i.getRestPose():i[this._targetPath])&&t.clone?this._originalValue[e]=t.clone():this._originalValue[e]=t},a.prototype._setValue=function(e,t,i,n,r){var o,a;this._currentActiveTarget=t,this._weight=n,this._enableBlending&&this._blendingFactor<=1?(this._originalBlendValue||((o=t[this._targetPath]).clone?this._originalBlendValue=o.clone():this._originalBlendValue=o),this._originalBlendValue.m?E.a.AllowMatrixDecomposeForInterpolation?this._currentValue?h.a.DecomposeLerpToRef(this._originalBlendValue,i,this._blendingFactor,this._currentValue):this._currentValue=h.a.DecomposeLerp(this._originalBlendValue,i,this._blendingFactor):this._currentValue?h.a.LerpToRef(this._originalBlendValue,i,this._blendingFactor,this._currentValue):this._currentValue=h.a.Lerp(this._originalBlendValue,i,this._blendingFactor):this._currentValue=E.a._UniversalLerp(this._originalBlendValue,i,this._blendingFactor),a=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.blendingSpeed:this._animation.blendingSpeed,this._blendingFactor+=a):this._currentValue=i,-1!==n?this._scene._registerTargetForLateAnimationBinding(this,this._originalValue[r]):t[this._targetPath]=this._currentValue,e.markAsDirty&&e.markAsDirty(this._animation.targetProperty)},a.prototype._getCorrectLoopMode=function(){return this._target&&this._target.animationPropertiesOverride?this._target.animationPropertiesOverride.loopMode:this._animation.loopMode},a.prototype.goToFrame=function(e){var t=this._animation.getKeys();e<t[0].frame?e=t[0].frame:e>t[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;n<i.length;n++)i[n].onlyOnce||(i[n].isDone=i[n].frame<e);this._currentFrame=e;var r=this._animation._interpolate(e,this._animationState);this.setValue(r,-1)},a.prototype._prepareForSpeedRatioChange=function(e){var t=this._previousDelay*(this._animation.framePerSecond*e)/1e3;this._ratioOffset=this._previousRatio-t},a.prototype.animate=function(e,t,i,n,r,o){void 0===o&&(o=-1);var a=this._animation,s=a.targetPropertyPath;if(!s||s.length<1)return!(this._stopped=!0);var c=!0;(t<this._minFrame||t>this._maxFrame)&&(t=this._minFrame),(i<this._minFrame||i>this._maxFrame)&&(i=this._maxFrame);var l,u,h,d=i-t,p=e*(a.framePerSecond*r)/1e3+this._ratioOffset,f=0;if(this._previousDelay=e,this._previousRatio=p,!n&&t<=i&&d<=p)c=!1,f=a._getKeyValue(this._maxValue);else if(!n&&i<=t&&p<=d)c=!1,f=a._getKeyValue(this._minValue);else if(this._animationState.loopMode!==E.a.ANIMATIONLOOPMODE_CYCLE){var m=i.toString()+t.toString();if(!this._offsetsCache[m]){this._animationState.repeatCount=0,this._animationState.loopMode=E.a.ANIMATIONLOOPMODE_CYCLE;var _=a._interpolate(t,this._animationState),g=a._interpolate(i,this._animationState);
1switch(this._animationState.loopMode=this._getCorrectLoopMode(),a.dataType){case E.a.ANIMATIONTYPE_FLOAT:this._offsetsCache[m]=g-_;break;case E.a.ANIMATIONTYPE_QUATERNION:this._offsetsCache[m]=g.subtract(_);break;case E.a.ANIMATIONTYPE_VECTOR3:this._offsetsCache[m]=g.subtract(_);case E.a.ANIMATIONTYPE_VECTOR2:this._offsetsCache[m]=g.subtract(_);case E.a.ANIMATIONTYPE_SIZE:this._offsetsCache[m]=g.subtract(_);case E.a.ANIMATIONTYPE_COLOR3:this._offsetsCache[m]=g.subtract(_)}this._highLimitsCache[m]=g}f=this._highLimitsCache[m],l=this._offsetsCache[m]}if(void 0===l)switch(a.dataType){case E.a.ANIMATIONTYPE_FLOAT:l=0;break;case E.a.ANIMATIONTYPE_QUATERNION:l=S;break;case E.a.ANIMATIONTYPE_VECTOR3:l=A;break;case E.a.ANIMATIONTYPE_VECTOR2:l=C;break;case E.a.ANIMATIONTYPE_SIZE:l=P;break;case E.a.ANIMATIONTYPE_COLOR3:l=x}h=this._host&&this._host.syncRoot?t+(i-t)*(((u=this._host.syncRoot).masterFrame-u.fromFrame)/(u.toFrame-u.fromFrame)):c&&0!=d?t+p%d:i;var v=this._events;if((0<d&&this.currentFrame>h||d<0&&this.currentFrame<h)&&(this._onLoop(),v.length))for(var b=0;b<v.length;b++)v[b].onlyOnce||(v[b].isDone=!1);this._currentFrame=h,this._animationState.repeatCount=0==d?0:p/d>>0,this._animationState.highLimitValue=f,this._animationState.offsetValue=l;var y,T=a._interpolate(h,this._animationState);if(this.setValue(T,o),v.length)for(b=0;b<v.length;b++)(0<d&&h>=v[b].frame&&v[b].frame>=t||d<0&&h<=v[b].frame&&v[b].frame<=t)&&((y=v[b]).isDone||(y.onlyOnce&&(v.splice(b,1),b--),y.isDone=!0,y.action(h)));return c||(this._stopped=!0),c},a);function a(e,t,i,n){var r,o=this;if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._ratioOffset=0,this._previousDelay=0,this._previousRatio=0,this._targetIsArray=!1,this._animation=t,this._target=e,this._scene=i,this._host=n,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===E.a.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=h.a.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minValue=this._keys[0].value,this._maxValue=this._keys[this._keys.length-1].value,0!==this._minFrame&&(r={frame:0,value:this._minValue},this._keys.splice(0,0,r)),this._target instanceof Array){for(var a=0,s=0,c=this._target;s<c.length;s++){var l=c[s];this._preparePath(l,a),this._getOriginalValues(a),a++}this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];var u=t.getEvents();u&&0<u.length&&u.forEach(function(e){o._events.push(e._clone())}),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.ExponentialBackoff=function(n,r){return void 0===n&&(n=3),void 0===r&&(r=500),function(e,t,i){return 0!==t.status||n<=i||-1!==e.indexOf("file:")?-1:Math.pow(2,i)*r}},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!1,configurable:!0}),r.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1},r.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,0)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},r);function r(){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,this.reset()}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(2),r=(Object.defineProperty(o.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilFunc",{get:function(){return this._stencilFunc},set:function(e){this._stencilFunc!==e&&(this._stencilFunc=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilFuncRef",{get:function(){return this._stencilFuncRef},set:function(e){this._stencilFuncRef!==e&&(this._stencilFuncRef=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilFuncMask",{get:function(){return this._stencilFuncMask},set:function(e){this._stencilFuncMask!==e&&(this._stencilFuncMask=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilOpStencilFail",{get:function(){return this._stencilOpStencilFail},set:function(e){this._stencilOpStencilFail!==e&&(this._stencilOpStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilOpDepthFail",{get:function(){return this._stencilOpDepthFail},set:function(e){this._stencilOpDepthFail!==e&&(this._stencilOpDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilOpStencilDepthPass",{get:function(){return this._stencilOpStencilDepthPass},set:function(e){this._stencilOpStencilDepthPass!==e&&(this._stencilOpStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilMask",{get:function(){return this._stencilMask},set:function(e){this._stencilMask!==e&&(this._stencilMask=e,this._isStencilMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"stencilTest",{get:function(){return this._stencilTest},set:function(e){this._stencilTest!==e&&(this._stencilTest=e,this._isStencilTestDirty=!0)}
1,enumerable:!1,configurable:!0}),o.prototype.reset=function(){this._stencilTest=!1,this._stencilMask=255,this._stencilFunc=o.ALWAYS,this._stencilFuncRef=1,this._stencilFuncMask=255,this._stencilOpStencilFail=o.KEEP,this._stencilOpDepthFail=o.KEEP,this._stencilOpStencilDepthPass=o.REPLACE,this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},o.prototype.apply=function(e){this.isDirty&&(this._isStencilTestDirty&&(this.stencilTest?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.stencilMask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.stencilFunc,this.stencilFuncRef,this.stencilFuncMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.stencilOpStencilFail,this.stencilOpDepthFail,this.stencilOpStencilDepthPass),this._isStencilOpDirty=!1))},o.ALWAYS=n.a.ALWAYS,o.KEEP=n.a.KEEP,o.REPLACE=n.a.REPLACE,o);function o(){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.reset()}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"alphaBlend",{get:function(){return this._alphaBlend},set:function(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)},enumerable:!1,configurable:!0}),r.prototype.setAlphaBlendConstants=function(e,t,i,n){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===n||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=n,this._isBlendConstantsDirty=!0)},r.prototype.setAlphaBlendFunctionParameters=function(e,t,i,n){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===i&&this._blendFunctionParameters[3]===n||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=i,this._blendFunctionParameters[3]=n,this._isBlendFunctionParametersDirty=!0)},r.prototype.setAlphaEquationParameters=function(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)},r.prototype.reset=function(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},r.prototype.apply=function(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))},r);function r(){this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this.reset()}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"isAsync",{get:function(){return this.isParallelCompiled}
1,enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!1,configurable:!0}),r.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},r.prototype._getVertexShaderCode=function(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null},r.prototype._getFragmentShaderCode=function(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null},r);function r(){this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null}},function(e,t,i){"use strict";var s,n;i.d(t,"a",function(){return a}),(n=s=s||{})[n.Pending=0]="Pending",n[n.Fulfilled=1]="Fulfilled",n[n.Rejected=2]="Rejected";function r(){this.count=0,this.target=0,this.results=[]}var o=(Object.defineProperty(l.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:!1,configurable:!0}),l.prototype.catch=function(e){return this.then(void 0,e)},l.prototype.then=function(e,t){var i=this,n=new l;return n._onFulfilled=e,n._onRejected=t,this._children.push(n),(n._parent=this)._state!==s.Pending&&setTimeout(function(){var e,t;i._state===s.Fulfilled||i._rejectWasConsumed?null!=(e=n._resolve(i._result))&&(void 0!==e._state?(t=e,n._children.push(t),t._parent=n,n=t):n._result=e):n._reject(i._reason)}),n},l.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===s.Fulfilled)for(var n=0,r=this._children;n<r.length;n++)r[n]._resolve(this._result);else if(this._state===s.Rejected)for(var o=0,a=this._children;o<a.length;o++)a[o]._reject(this._reason)},l.prototype._resolve=function(e){try{this._state=s.Fulfilled;var t,i=null;this._onFulfilled&&(i=this._onFulfilled(e)),null!=i&&(e=void 0!==i._state?((t=i)._parent=this,t._moveChildren(this._children),t._result):i),this._result=e;for(var n=0,r=this._children;n<r.length;n++)r[n]._resolve(e);this._children.length=0,delete this._onFulfilled,delete this._onRejected}catch(e){this._reject(e,!0)}},l.prototype._reject=function(e,t){if(void 0===t&&(t=!1),this._state=s.Rejected,this._reason=e,this._onRejected&&!t)try{this._onRejected(e),this._rejectWasConsumed=!0}catch(t){e=t}for(var i=0,n=this._children;i<n.length;i++){var r=n[i];this._rejectWasConsumed?r._resolve(null):r._reject(e)}this._children.length=0,delete this._onFulfilled,delete this._onRejected},l.resolve=function(e){var t=new l;return t._resolve(e),t},l._RegisterForFulfillment=function(e,t,i){e.then(function(e){return t.results[i]=e,t.count++,t.count===t.target&&t.rootPromise._resolve(t.results),null},function(e){t.rootPromise._state!==s.Rejected&&t.rootPromise._reject(e)})},l.all=function(e){var t=new l,i=new r;if(i.target=e.length,i.rootPromise=t,e.length)for(var n=0;n<e.length;n++)l._RegisterForFulfillment(e[n],i,n);else t._resolve([]);return t},l.race=function(e){var t=new l;if(e.length)for(var i=0,n=e;i<n.length;i++)n[i].then(function(e){return t&&(t._resolve(e),t=null),null},function(e){t&&(t._reject(e),t=null)});return t},l),a=(c.Apply=function(e){void 0===e&&(e=!1),!e&&"undefined"!=typeof Promise||(window.Promise=o)},c);function c(){}function l(e){var t=this;if(this._state=s.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)}}},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o});var n=i(72),r=(s.prototype.sampleFrame=function(e){var t;void 0===e&&(e=n.a.Now),this._enabled&&(null!=this._lastFrameTimeMs&&(t=e-this._lastFrameTimeMs,this._rollingFrameTime.add(t)),this._lastFrameTimeMs=e)},Object.defineProperty(s.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance}
1,enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!1,configurable:!0}),s.prototype.enable=function(){this._enabled=!0},s.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(s.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),s.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},s),o=(a.prototype.add=function(e){var t,i;this.isSaturated()?(i=(t=this._samples[this._pos])-this.average,this.average-=i/(this._sampleCount-1),this._m2-=i*(t-this.average)):this._sampleCount++,i=e-this.average,this.average+=i/this._sampleCount,this._m2+=i*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},a.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},a.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},a.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},a.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},a);function a(e){this._samples=new Array(e),this.reset()}function s(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new o(e)}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._surroundingMeshes=null,this._collider=null,this._oldPositionForCollisions=new n.e(0,0,0),this._diffPositionForCollisions=new n.e(0,0,0)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var o=i(40),u=i(0),h=i(2),n=(Object.defineProperty(d.prototype,"opaqueSortCompareFn",{set:function(e){this._opaqueSortCompareFn=e,this._renderOpaque=e?this.renderOpaqueSorted:d.renderUnsorted},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"alphaTestSortCompareFn",{set:function(e){this._alphaTestSortCompareFn=e,this._renderAlphaTest=e?this.renderAlphaTestSorted:d.renderUnsorted},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"transparentSortCompareFn",{set:function(e){this._transparentSortCompareFn=e||d.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!1,configurable:!0}),d.prototype.render=function(e,t,i,n){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var r=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(r.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),r.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var o=r.getStencilBuffer();if(r.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(r.setStencilBuffer(o),this._renderTransparent
1(this._transparentSubMeshes),r.setAlphaMode(h.a.ALPHA_DISABLE)),r.setStencilBuffer(!1),this._edgesRenderers.length){for(var a=0;a<this._edgesRenderers.length;a++)this._edgesRenderers.data[a].render();r.setAlphaMode(h.a.ALPHA_DISABLE)}r.setStencilBuffer(o)}},d.prototype.renderOpaqueSorted=function(e){return d.renderSorted(e,this._opaqueSortCompareFn,this._scene.activeCamera,!1)},d.prototype.renderAlphaTestSorted=function(e){return d.renderSorted(e,this._alphaTestSortCompareFn,this._scene.activeCamera,!1)},d.prototype.renderTransparentSorted=function(e){return d.renderSorted(e,this._transparentSortCompareFn,this._scene.activeCamera,!0)},d.renderSorted=function(e,t,i,n){for(var r=0,o=i?i.globalPosition:d._zeroVector;r<e.length;r++)(l=e.data[r])._alphaIndex=l.getMesh().alphaIndex,l._distanceToCamera=u.e.Distance(l.getBoundingInfo().boundingSphere.centerWorld,o);var a=e.data.slice(0,e.length);for(t&&a.sort(t),r=0;r<a.length;r++){var s,c,l=a[r];n&&(s=l.getMaterial())&&s.needDepthPrePass&&((c=s.getScene().getEngine()).setColorWrite(!1),c.setAlphaMode(h.a.ALPHA_DISABLE),l.render(!1),c.setColorWrite(!0)),l.render(n)}},d.renderUnsorted=function(e){for(var t=0;t<e.length;t++)e.data[t].render(!1)},d.defaultTransparentSortCompare=function(e,t){return e._alphaIndex>t._alphaIndex?1:e._alphaIndex<t._alphaIndex?-1:d.backToFrontSortCompare(e,t)},d.backToFrontSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0},d.frontToBackSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?-1:e._distanceToCamera>t._distanceToCamera?1:0},d.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},d.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},d.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.pushNoDuplicate(t._edgesRenderer))},d.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},d.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},d.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<this._particleSystems.length;i++){var n,r=this._particleSystems.data[i];0!==(t&&t.layerMask&r.layerMask)&&((n=r.emitter).position&&e&&-1===e.indexOf(n)||this._scene._activeParticles.addCount(r.render(),!1))}this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene)}},d.prototype._renderSprites=function(){if(this._scene.spritesEnabled&&0!==this._spriteManagers.length){var e=this._scene.activeCamera;this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);for(var t=0;t<this._spriteManagers.length;t++){var i=this._spriteManagers.data[t];0!==(e&&e.layerMask&i.layerMask)&&i.render()}this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene)}},d._zeroVector=u.e.Zero(),d);function d(e,t,i,n,r){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),this.index=e,this._opaqueSubMeshes=new o.a(256),this._transparentSubMeshes=new o.a(256),this._alphaTestSubMeshes=new o.a(256),this._depthOnlySubMeshes=new o.a(256),this._particleSystems=new o.a(256),this._spriteManagers=new o.a(256),this._edgesRenderers=new o.b(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=n,this.transparentSortCompareFn=r}},function(e,t,i){"use strict";i.d(t,"c",function(){return u}),i.d(t,"b",function(){return g}),i.d(t,"a",function(){return h});var n,r,o=i(1),a=i(42),s=i(8),c=i(7),l=i(22),u=(r=a.a,Object(o.d)(p,r),p),g=function(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]},h=(n=a.a,Object(o.d)(d,n),d.prototype.instantiateModelsToScene=function(l,u){var h=this;function d(e,t){if(p[e.uniqueId]=t.uniqueId,f[t.uniqueId]=t,l&&(t.name=l(e.n
1ame)),t instanceof s.a){var i=t;if(i.morphTargetManager){var n=e.morphTargetManager;i.morphTargetManager=n.clone();for(var r=0;r<n.numTargets;r++){var o=n.getTarget(r),a=i.morphTargetManager.getTarget(r);p[o.uniqueId]=a.uniqueId,f[a.uniqueId]=a}}}}void 0===u&&(u=!1);var p={},f={},c=new g,m=[],_=[],i={doNotInstantiate:!0};return this.transformNodes.forEach(function(e){var t;e.parent||(t=e.instantiateHierarchy(null,i,function(e,t){d(e,t)}))&&c.rootNodes.push(t)}),this.meshes.forEach(function(e){var t;e.parent||(t=e.instantiateHierarchy(null,i,function(e,t){if(d(e,t),t.material){var i=t;if(i.material)if(u){var n=e.material;if(-1===_.indexOf(n)){var r=n.clone(l?l(n.name):"Clone of "+n.name);if(_.push(n),p[n.uniqueId]=r.uniqueId,f[r.uniqueId]=r,"MultiMaterial"===n.getClassName()){for(var o=n,a=0,s=o.subMaterials;a<s.length;a++){var c=s[a];c&&(r=c.clone(l?l(c.name):"Clone of "+c.name),_.push(c),p[c.uniqueId]=r.uniqueId,f[r.uniqueId]=r)}o.subMaterials=o.subMaterials.map(function(e){return e&&f[p[e.uniqueId]]})}}i.material=f[p[n.uniqueId]]}else"MultiMaterial"===i.material.getClassName()?-1===h.scene.multiMaterials.indexOf(i.material)&&h.scene.addMultiMaterial(i.material):-1===h.scene.materials.indexOf(i.material)&&h.scene.addMaterial(i.material)}}))&&c.rootNodes.push(t)}),this.skeletons.forEach(function(e){var t=e.clone(l?l(e.name):"Clone of "+e.name);e.overrideMesh&&(t.overrideMesh=f[p[e.overrideMesh.uniqueId]]);for(var i=0,n=h.meshes;i<n.length;i++){var r=n[i];if(r.skeleton===e&&!r.isAnInstance){if(f[p[r.uniqueId]].skeleton=t,-1!==m.indexOf(t))continue;m.push(t);for(var o=0,a=t.bones;o<a.length;o++){var s=a[o];s._linkedTransformNode&&(s._linkedTransformNode=f[p[s._linkedTransformNode.uniqueId]])}}}c.skeletons.push(t)}),this.animationGroups.forEach(function(e){var t=e.clone(e.name,function(e){return f[p[e.uniqueId]]||e});c.animationGroups.push(t)}),c},d.prototype.addAllToScene=function(){var t=this;this._wasAddedToScene=!0,this.cameras.forEach(function(e){t.scene.addCamera(e)}),this.lights.forEach(function(e){t.scene.addLight(e)}),this.meshes.forEach(function(e){t.scene.addMesh(e)}),this.skeletons.forEach(function(e){t.scene.addSkeleton(e)}),this.animations.forEach(function(e){t.scene.addAnimation(e)}),this.animationGroups.forEach(function(e){t.scene.addAnimationGroup(e)}),this.multiMaterials.forEach(function(e){t.scene.addMultiMaterial(e)}),this.materials.forEach(function(e){t.scene.addMaterial(e)}),this.morphTargetManagers.forEach(function(e){t.scene.addMorphTargetManager(e)}),this.geometries.forEach(function(e){t.scene.addGeometry(e)}),this.transformNodes.forEach(function(e){t.scene.addTransformNode(e)}),this.actionManagers.forEach(function(e){t.scene.addActionManager(e)}),this.textures.forEach(function(e){t.scene.addTexture(e)}),this.reflectionProbes.forEach(function(e){t.scene.addReflectionProbe(e)}),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture);for(var e=0,i=this.scene._serializableComponents;e<i.length;e++)i[e].addFromContainer(this)},d.prototype.removeAllFromScene=function(){var t=this;this._wasAddedToScene=!1,this.cameras.forEach(function(e){t.scene.removeCamera(e)}),this.lights.forEach(function(e){t.scene.removeLight(e)}),this.meshes.forEach(function(e){t.scene.removeMesh(e)}),this.skeletons.forEach(function(e){t.scene.removeSkeleton(e)}),this.animations.forEach(function(e){t.scene.removeAnimation(e)}),this.animationGroups.forEach(function(e){t.scene.removeAnimationGroup(e)}),this.multiMaterials.forEach(function(e){t.scene.removeMultiMaterial(e)}),this.materials.forEach(function(e){t.scene.removeMaterial(e)}),this.morphTargetManagers.forEach(function(e){t.scene.removeMorphTargetManager(e)}),this.geometries.forEach(function(e){t.scene.removeGeometry(e)}),this.transformNodes.forEach(function(e){t.scene.removeTransformNode(e)}),this.actionManagers.forEach(function(e){t.scene.removeActionManager(e)}),this.textures.forEach(function(e){t.scene.removeTexture(e)}),this.reflectionProbes.forEach(function(e){t.scene.removeReflectionProbe(e)}),this.environmentTexture===this.scene.environmentTexture&&(this.scene.environmentTexture=null);for(var e=0,i=this.scene._serializableComponents;e<i.length;e++)i[e].removeFromContainer(this)},d.prototype.dispose=function(){this.cameras.forEach(function(e){e.dispose()}
1),this.cameras=[],this.lights.forEach(function(e){e.dispose()}),this.lights=[],this.meshes.forEach(function(e){e.dispose()}),this.meshes=[],this.skeletons.forEach(function(e){e.dispose()}),this.skeletons=[],this.animationGroups.forEach(function(e){e.dispose()}),this.animationGroups=[],this.multiMaterials.forEach(function(e){e.dispose()}),this.multiMaterials=[],this.materials.forEach(function(e){e.dispose()}),this.materials=[],this.geometries.forEach(function(e){e.dispose()}),this.geometries=[],this.transformNodes.forEach(function(e){e.dispose()}),this.transformNodes=[],this.actionManagers.forEach(function(e){e.dispose()}),this.actionManagers=[],this.textures.forEach(function(e){e.dispose()}),this.textures=[],this.reflectionProbes.forEach(function(e){e.dispose()}),this.reflectionProbes=[],this.environmentTexture&&(this.environmentTexture.dispose(),this.environmentTexture=null);for(var e=0,t=this.scene._serializableComponents;e<t.length;e++)t[e].removeFromContainer(this,!0)},d.prototype._moveAssets=function(e,t,i){if(e)for(var n=0,r=e;n<r.length;n++){var o=r[n],a=!0;if(i)for(var s=0,c=i;s<c.length;s++)if(o===c[s]){a=!1;break}a&&t.push(o)}},d.prototype.moveAllFromScene=function(e){for(var t in this._wasAddedToScene=!1,void 0===e&&(e=new u),this)this.hasOwnProperty(t)&&(this[t]=this[t]||("environmentTexture"===t?null:[]),this._moveAssets(this.scene[t],this[t],e[t]));this.removeAllFromScene()},d.prototype.createRootMesh=function(){var t=new s.a("assetContainerRootMesh",this.scene);return this.meshes.forEach(function(e){e.parent||t.addChild(e)}),this.meshes.unshift(t),t},d.prototype.mergeAnimationsTo=function(r,e,t){if(void 0===r&&(r=l.a.LastCreatedScene),void 0===t&&(t=null),!r)return c.a.Error("No scene available to merge animations to"),[];var a=t||function(e){var t=null,i=e.animations.length?e.animations[0].targetProperty:"",n=e.name.split(".").join("").split("_primitive")[0];switch(i){case"position":case"rotationQuaternion":t=r.getTransformNodeByName(e.name)||r.getTransformNodeByName(n);break;case"influence":t=r.getMorphTargetByName(e.name)||r.getMorphTargetByName(n);break;default:t=r.getNodeByName(e.name)||r.getNodeByName(n)}return t};this.getNodes().forEach(function(e){var o=a(e);if(null!==o){for(var t=function(t){for(var e=0,i=o.animations.filter(function(e){return e.targetProperty===t.targetProperty});e<i.length;e++){var n=i[e],r=o.animations.indexOf(n,0);-1<r&&o.animations.splice(r,1)}},i=0,n=e.animations;i<n.length;i++)t(n[i]);o.animations=o.animations.concat(e.animations)}});var i=new Array;return this.animationGroups.slice().forEach(function(e){i.push(e.clone(e.name,a)),e.animatables.forEach(function(e){e.stop()})}),e.forEach(function(e){var t=a(e.target);t&&(r.beginAnimation(t,e.fromFrame,e.toFrame,e.loopAnimation,e.speedRatio,e.onAnimationEnd?e.onAnimationEnd:void 0,void 0,!0,void 0,e.onAnimationLoop?e.onAnimationLoop:void 0),r.stopAnimation(e.target))}),i},d);function d(e){var t=n.call(this)||this;return t._wasAddedToScene=!1,t.scene=e,t.sounds=[],t.effectLayers=[],t.layers=[],t.lensFlareSystems=[],t.proceduralTextures=[],t.reflectionProbes=[],e.onDisposeObservable.add(function(){t._wasAddedToScene||t.dispose()}),t}function p(){return null!==r&&r.apply(this,arguments)||this}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(e,t){this.distance=e,this.mesh=t}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(20),o=i(72),r=(Object.defineProperty(a.prototype,"name",{get:function(){return"AutoRotation"},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"idleRotationSpeed",{get:function(){return this._idleRotationSpeed},set:function(e){this._idleRotationSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"idleRotationWaitTime",{get:function(){return this._idleRotationWaitTime},set:function(e){this._idleRotationWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"idleRotationSpinupTime",{get:function(){return this._idleRotationSpinupTime},set:function(e){this._idleRotationSpinupTime=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rotationInProgress",{get:function(){return 0<Math.abs(this._cameraRotationSpeed)},enumerable:!1,configurable:!0}),a.prototype.init=function(){},a.prototype.attach=function(e){var r=this;this._attachedCamera=e;var t=this._attachedCamera.getScene();this._onPrePointerObservableObserver=t.onPrePointerObservable.add(function(e){e.type!==n.a.POINTERDOWN?e.type===n.a.POINTERUP&&(r._isPointerDown=!1):r._isPointerDown=!0}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){var e=o.a.Now,t=0;null!=r._lastFrameTime&&(t=e-r._lastFrameTime),r._lastFrameTime=e,r._applyUserInteraction();var i=e-r._lastInteractionTime-r._idleRotationWaitTime,n=Math.max(Math.min(i/r._idleRotationSpinupTime,1),0);r._cameraRotationSpeed=r._idleRotationSpeed*n,r._attachedCamera&&(r._attachedCamera.alpha-=r._cameraRotationSpeed*(t/1e3))})},a.prototype.detach=function(){var e;this._attachedCamera&&(e=this._attachedCamera.getScene(),this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null)},a.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},a.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()},a.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=o.a.Now)},a.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)},a);function a(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(89),r=i(26),o=(Object.defineProperty(a.prototype,"name",{get:function(){return"Bouncing"},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var t,i=this;this._autoTransitionRange!==e&&(this._autoTransitionRange=e,(t=this._attachedCamera)&&(e?this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add(function(e){var t;e&&(e.computeWorldMatrix(!0),t=e.getBoundingInfo().diagonalLength,i.lowerRadiusTransitionRange=.05*t,i.upperRadiusTransitionRange=.05*t)}):this._onMeshTargetChangedObserver&&t.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver)))},enumerable:!1,configurable:!0}),a.prototype.init=function(){},a.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))})},a.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},a.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&this._attachedCamera.radius===e&&!this._radiusIsAnimating},a.prototype._applyBoundRadiusAnimation=function(e){var t,i=this;this._attachedCamera&&(this._radiusBounceTransition||(a.EasingFunction.setEasingMode(a.EasingMode),this._radiusBounceTransition=r.a.CreateAnimation("radius",r.a.ANIMATIONTYPE_FLOAT,60,a.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0,(t=r.a.TransitionTo("radius",this._attachedCamera.radius+e,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,function(){return i._clearAnimationLocks()}))&&this._animatables.push(t))},a.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},a.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},a.EasingFunction=new n.a(.3),a.EasingMode=n.f.EASINGMODE_EASEOUT,a);function a(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.up
1perRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(89),r=i(20),o=i(72),f=i(0),m=i(26),a=(Object.defineProperty(_.prototype,"name",{get:function(){return"Framing"},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!1,configurable:!0}),_.prototype.init=function(){},_.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();_.EasingFunction.setEasingMode(_.EasingMode),this._onPrePointerObservableObserver=i.onPrePointerObservable.add(function(e){e.type!==r.a.POINTERDOWN?e.type===r.a.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0}),this._onMeshTargetChangedObserver=e.onMeshTargetChangedObservable.add(function(e){e&&t.zoomOnMesh(e)}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){t._applyUserInteraction(),t._maintainCameraAboveGround()})},_.prototype.detach=function(){var e;this._attachedCamera&&(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)},_.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)},_.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)},_.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new f.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new f.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;o<e.length;o++){var a=e[o].getHierarchyBoundingVectors(!0);f.e.CheckExtends(a.min,n,r),f.e.CheckExtends(a.max,n,r)}this.zoomOnBoundingInfo(n,r,t,i)},_.prototype.zoomOnBoundingInfo=function(e,t,i,n){var r,o,a,s,c,l,u,h,d,p=this;void 0===i&&(i=!1),void 0===n&&(n=null),this._attachedCamera&&(o=(r=e.y)+(t.y-r)*this._positionScale,a=t.subtract(e).scale(.5),c=i?new f.e(0,o,0):(s=e.add(a),new f.e(s.x,o,s.z)),this._vectorTransition||(this._vectorTransition=m.a.CreateAnimation("target",m.a.ANIMATIONTYPE_VECTOR3,60,_.EasingFunction)),this._betaIsAnimating=!0,(l=m.a.TransitionTo("target",c,this._attachedCamera,this._attachedCamera.getScene(),60,this._vectorTransition,this._framingTime))&&this._animatables.push(l),u=0,this._mode===_.FitFrustumSidesMode?(h=this._calculateLowerRadiusFromModelBoundingSphere(e,t),this.autoCorrectCameraLim
1itsAndSensibility&&(this._attachedCamera.lowerRadiusLimit=a.length()+this._attachedCamera.minZ),u=h):this._mode===_.IgnoreBoundsSizeMode&&(u=this._calculateLowerRadiusFromModelBoundingSphere(e,t),this.autoCorrectCameraLimitsAndSensibility&&null===this._attachedCamera.lowerRadiusLimit&&(this._attachedCamera.lowerRadiusLimit=this._attachedCamera.minZ)),this.autoCorrectCameraLimitsAndSensibility&&(d=t.subtract(e).length(),this._attachedCamera.panningSensibility=5e3/d,this._attachedCamera.wheelPrecision=100/u),this._radiusTransition||(this._radiusTransition=m.a.CreateAnimation("radius",m.a.ANIMATIONTYPE_FLOAT,60,_.EasingFunction)),(l=m.a.TransitionTo("radius",u,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusTransition,this._framingTime,function(){p.stopAllAnimations(),n&&n(),p._attachedCamera&&p._attachedCamera.useInputToRestoreState&&p._attachedCamera.storeState()}))&&this._animatables.push(l))},_.prototype._calculateLowerRadiusFromModelBoundingSphere=function(e,t){var i=t.subtract(e).length(),n=this._getFrustumSlope(),r=.5*i*this._radiusScale,o=r*Math.sqrt(1+1/(n.x*n.x)),a=r*Math.sqrt(1+1/(n.y*n.y)),s=Math.max(o,a),c=this._attachedCamera;return c?(c.lowerRadiusLimit&&this._mode===_.IgnoreBoundsSizeMode&&(s=s<c.lowerRadiusLimit?c.lowerRadiusLimit:s),c.upperRadiusLimit&&(s=s>c.upperRadiusLimit?c.upperRadiusLimit:s),s):0},_.prototype._maintainCameraAboveGround=function(){var e,t,i,n,r=this;this._elevationReturnTime<0||(e=o.a.Now-this._lastInteractionTime,t=.5*Math.PI-this._defaultElevation,i=.5*Math.PI,this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>i&&e>=this._elevationReturnWaitTime&&(this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=m.a.CreateAnimation("beta",m.a.ANIMATIONTYPE_FLOAT,60,_.EasingFunction)),(n=m.a.TransitionTo("beta",t,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,function(){r._clearAnimationLocks(),r.stopAllAnimations()}))&&this._animatables.push(n)))},_.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return f.d.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new f.d(n,i)},_.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},_.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=o.a.Now,this.stopAllAnimations(),this._clearAnimationLocks())},_.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()}
1,Object.defineProperty(_.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:!1,configurable:!0}),_.EasingFunction=new n.h,_.EasingMode=n.f.EASINGMODE_EASEINOUT,_.IgnoreBoundsSizeMode=0,_.FitFrustumSidesMode=1,_);function _(){this._mode=_.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}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(28),r=i(18),u=i(20),h=i(0),o=i(6),d=i(25),p=i(75),a=(Object.defineProperty(f.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!1,configurable:!0}),f.prototype.init=function(){},Object.defineProperty(f.prototype,"_pointerCamera",{get:function(){return this._scene.cameraToUseForPointers?this._scene.cameraToUseForPointers:this._scene.activeCamera},enumerable:!1,configurable:!0}),f.prototype.attach=function(e){var s=this;this._ownerNode=e,this._scene=this._ownerNode.getScene(),f._virtualScene||((f._virtualScene=new r.a(this._scene.getEngine())).detachControl(),this._scene.getEngine().scenes.pop());var c=null,l=new h.e(0,0,0);this._virtualOriginMesh=new n.a("",f._virtualScene),this._virtualOriginMesh.rotationQuaternion=new h.b,this._virtualDragMesh=new n.a("",f._virtualScene),this._virtualDragMesh.rotationQuaternion=new h.b,this._pointerObserver=this._scene.onPointerObservable.add(function(e,t){var i,n,r,o,a;e.type==u.a.POINTERDOWN?!s.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.ray&&(a=e.pickInfo.pickedMesh,s._ownerNode==a||a.isDescendantOf(s._ownerNode))&&(s._pointerCamera&&s._pointerCamera.cameraRigMode==d.a.RIG_MODE_NONE&&e.pickInfo.ray.origin.copyFrom(s._pointerCamera.globalPosition),c=s._ownerNode,p.a._RemoveAndStorePivotPoint(c),l.copyFrom(e.pickInfo.ray.origin),s._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),s._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)),s._virtualOriginMesh.removeChild(s._virtualDragMesh),c.computeWorldMatrix(),s._virtualDragMesh.position.copyFrom(c.absolutePosition),c.rotationQuaternion||(c.rotationQuaternion=h.b.RotationYawPitchRoll(c.rotation.y,c.rotation.x,c.rotation.z)),i=c.parent,c.setParent(null),s._virtualDragMesh.rotationQuaternion.copyFrom(c.rotationQuaternion),c.setParent(i),s._virtualOriginMesh.addChild(s._virtualDragMesh),s._targetPosition.copyFrom(s._virtualDragMesh.absolutePosition),s.dragging=!0,s.currentDraggingPointerID=e.event.pointerId,s.detachCameraControls&&s._pointerCamera&&!s._pointerCamera.leftCamera&&(s._pointerCamera.inputs.attachedElement?(s._attachedElement=s._pointerCamera.inputs.attachedElement,s._pointerCamera.detachControl(s._pointerCamera.inputs.attachedElement)):s._attachedElement=null),p.a._RestorePivotPoint(c),s.onDragStartObservable.notifyObservers({})):e.type==u.a.POINTERUP||e.type==u.a.POINTERDOUBLETAP?s.currentDraggingPointerID==e.event.pointerId&&(s.dragging=!1,s._moving=!1,s.currentDraggingPointerID=-1,c=null,s._virtualOriginMesh.removeChild(s._virtualDragMesh),s.detachCameraControls&&s._attachedElement&&s._pointerCamera&&!s._pointerCamera.leftCamera&&s._pointerCamera.attachControl(s._attachedElement,!0),s.onDragEndObservable.notifyObservers({})):e.type==u.a.POINTERMOVE&&s.currentDraggingPointerID==e.event.pointerId&&s.dragging&&e.pickInfo&&e.pickInfo.ray&&c&&(n=s.zDragFactor,s._pointerCamera&&s._pointerCamera.cameraRigMode==d.a.RIG_MODE_NONE&&(e.pickInfo.ray.origin.copyFrom(s._pointerCamera.globalPosition),n=0),r=e.pickInfo.ray.origin.subtract(l),l.copyFrom(e.pickInfo.ray.origin),o=-h.e.Dot(r,e.pickInfo.ray.direction),s._virtualOriginMesh.addChild(s._virtualDragMesh),s._virtualDragMesh.position.z-=s._virtualDragMesh.position.z<1?o*s.zDragFactor:o*n*s._virtualDragMesh.position.z,s._virtualDragMesh.position.z<0&&(s._virtualDragMesh.position.z=0),s._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),s._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)),s._virtualOriginMesh.removeChild(s._virtualDragMesh),s._targetPosition.copyFrom(s._virtualDragMesh.absolutePosition),c.parent&&h.e.TransformCoordinatesToRef(s._targetPosition,h.a.Invert(c.parent.getWorldMatrix()),s._targetPosition),s._moving||s._startingOrientation.copyFrom(s._virtualDragMesh.rotationQuaternion),s._moving=!0)});var t=new h.b;this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add(function(){var e;s.dragging&&s._moving&&c&&(p.a._RemoveAndStorePivotPoint(c),c.position.addInPlace(s._targetPosition.subtract(c.position).scale(s.dragDeltaRatio)),s.rotateDraggedObject&&(t.copyFrom(s._startingOrientation),t.x=-t.x,t.y=-t.y,t.z=-t.z,s._virtualDragMesh.rotationQuaternion.multiplyToRef(t,t),h.b.RotationYawPitchRollToRef(t.toEulerAngles("xyz").y,0,0,t),t.multiplyToRef(s._startingOrientation,t),(e=c.parent)&&(!e.scaling||e.scaling.isNonUniformWithinEpsilon(.001))||(c.setParent(null),h.b.SlerpToRef(c.rotationQuaternion,t,s.dragDeltaRatio,c.rotationQuaternion),c.setParent(e))),p.a._RestorePivotPoint(c))})},f.prototype.detach=function(){this._scene&&(this.detachCameraControls&&this._attachedElement&&this._pointerCamera&&!this._pointerCamera.leftCamera&&this._pointerCamera.attachControl(this._attachedElement,!0),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()},f);function f(){this._sceneRenderObserver=null,this._targetPosition=new h.e(0,0,0),this._moving=!1,this._startingOrientation=new h.b,this._attachedElement=null,this.zDragFactor=3,this.rotateDraggedObject=!0,this.dragging=!1,this.dragDeltaRatio=.2,this.currentDraggingPointerID=-1,this.detachCameraControls=!0,this.onDragStartObservable=new o.c,this.onDragEndObservable=new o.c}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});
1var n=i(1),r=i(3),o=i(37),a=i(57),s=(Object.defineProperty(c.prototype,"invertYAxis",{get:function(){return 1!==this._yAxisScale},set:function(e){this._yAxisScale=e?-1:1},enumerable:!1,configurable:!0}),c.prototype.attachControl=function(e,t){var i=this,n=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=n.onGamepadConnectedObservable.add(function(e){e.type!==a.a.POSE_ENABLED&&(i.gamepad&&e.type!==a.a.XBOX||(i.gamepad=e))}),this._onGamepadDisconnectedObserver=n.onGamepadDisconnectedObservable.add(function(e){i.gamepad===e&&(i.gamepad=null)}),this.gamepad=n.getGamepadByType(a.a.XBOX)},c.prototype.detachControl=function(e){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},c.prototype.checkInputs=function(){var e,t,i,n,r,o;this.gamepad&&(e=this.camera,(t=this.gamepad.rightStick)&&(0==t.x||0!=(i=t.x/this.gamepadRotationSensibility)&&.005<Math.abs(i)&&(e.inertialAlphaOffset+=i),0==t.y||0!=(n=t.y/this.gamepadRotationSensibility*this._yAxisScale)&&.005<Math.abs(n)&&(e.inertialBetaOffset+=n)),!(r=this.gamepad.leftStick)||0==r.y||0!=(o=r.y/this.gamepadMoveSensibility)&&.005<Math.abs(o)&&(this.camera.inertialRadiusOffset-=o))},c.prototype.getClassName=function(){return"ArcRotateCameraGamepadInput"},c.prototype.getSimpleName=function(){return"gamepad"},Object(n.c)([Object(r.c)()],c.prototype,"gamepadRotationSensibility",void 0),Object(n.c)([Object(r.c)()],c.prototype,"gamepadMoveSensibility",void 0),c);function c(){this.gamepadRotationSensibility=80,this.gamepadMoveSensibility=40,this._yAxisScale=1}o.a.ArcRotateCameraGamepadInput=s},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(1),r=i(3),o=i(37),a=i(82),s=(c.prototype.attachControl=function(e,n){var r=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add(function(){r._keys=[]}),this._onKeyboardObserver=this._scene.onKeyboardObservable.add(function(e){var t,i=e.event;i.metaKey||(e.type===a.a.KEYDOWN?(r._ctrlPressed=i.ctrlKey,r._altPressed=i.altKey,-1===r.keysUp.indexOf(i.keyCode)&&-1===r.keysDown.indexOf(i.keyCode)&&-1===r.keysLeft.indexOf(i.keyCode)&&-1===r.keysRight.indexOf(i.keyCode)&&-1===r.keysReset.indexOf(i.keyCode)||(-1===(t=r._keys.indexOf(i.keyCode))&&r._keys.push(i.keyCode),i.preventDefault&&(n||i.preventDefault()))):-1===r.keysUp.indexOf(i.keyCode)&&-1===r.keysDown.indexOf(i.keyCode)&&-1===r.keysLeft.indexOf(i.keyCode)&&-1===r.keysRight.indexOf(i.keyCode)&&-1===r.keysReset.indexOf(i.keyCode)||(0<=(t=r._keys.indexOf(i.keyCode))&&r._keys.splice(t,1),i.preventDefault&&(n||i.preventDefault())))}
1))},c.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=[]},c.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t];-1!==this.keysLeft.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningX-=1/this.panningSensibility:e.inertialAlphaOffset-=this.angularSpeed:-1!==this.keysUp.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningY+=1/this.panningSensibility:this._altPressed&&this.useAltToZoom?e.inertialRadiusOffset+=1/this.zoomingSensibility:e.inertialBetaOffset-=this.angularSpeed:-1!==this.keysRight.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningX+=1/this.panningSensibility:e.inertialAlphaOffset+=this.angularSpeed:-1!==this.keysDown.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningY-=1/this.panningSensibility:this._altPressed&&this.useAltToZoom?e.inertialRadiusOffset-=1/this.zoomingSensibility:e.inertialBetaOffset+=this.angularSpeed:-1!==this.keysReset.indexOf(i)&&e.useInputToRestoreState&&e.restoreState()}},c.prototype.getClassName=function(){return"ArcRotateCameraKeyboardMoveInput"},c.prototype.getSimpleName=function(){return"keyboard"}
1,Object(n.c)([Object(r.c)()],c.prototype,"keysUp",void 0),Object(n.c)([Object(r.c)()],c.prototype,"keysDown",void 0),Object(n.c)([Object(r.c)()],c.prototype,"keysLeft",void 0),Object(n.c)([Object(r.c)()],c.prototype,"keysRight",void 0),Object(n.c)([Object(r.c)()],c.prototype,"keysReset",void 0),Object(n.c)([Object(r.c)()],c.prototype,"panningSensibility",void 0),Object(n.c)([Object(r.c)()],c.prototype,"zoomingSensibility",void 0),Object(n.c)([Object(r.c)()],c.prototype,"useAltToZoom",void 0),Object(n.c)([Object(r.c)()],c.prototype,"angularSpeed",void 0),c);function c(){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}o.a.ArcRotateCameraKeyboardMoveInput=s},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),r=i(3),o=i(37),u=i(20),h=i(14),a=(s.prototype.computeDeltaFromMouseWheelLegacyEvent=function(e,t){var i=.01*e*this.wheelDeltaPercentage*t;return 0<e?i/(1+this.wheelDeltaPercentage):i*(1+this.wheelDeltaPercentage)},s.prototype.attachControl=function(e,c){var l=this;this._wheel=function(e,t){if(e.type===u.a.POINTERWHEEL){var i=e.event,n=0,r=i.wheelDelta?i.wheelDelta:60*-(i.deltaY||i.detail);if(l.wheelDeltaPercentage){if(0<(n=l.computeDeltaFromMouseWheelLegacyEvent(r,l.camera.radius))){for(var o=l.camera.radius,a=l.camera.inertialRadiusOffset+n,s=0;s<20&&.001<Math.abs(a);s++)o-=a,a*=l.camera.inertia;o=h.a.Clamp(o,0,Number.MAX_VALUE),n=l.computeDeltaFromMouseWheelLegacyEvent(r,o)}}else n=r/(40*l.wheelPrecision);n&&(l.camera.inertialRadiusOffset+=n),i.preventDefault&&(c||i.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,u.a.POINTERWHEEL)},s.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},s.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},s.prototype.getSimpleName=function(){return"mousewheel"},Object(n.c)([Object(r.c)()],s.prototype,"wheelPrecision",void 0),Object(n.c)([Object(r.c)()],s.prototype,"wheelDeltaPercentage",void 0),s);function s(){this.wheelPrecision=3,this.wheelDeltaPercentage=0}o.a.ArcRotateCameraMouseWheelInput=a},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n,r=i(1),o=i(3),a=i(37),s=(n=i(302).a,Object(r.d)(c,n),c.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},c.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)},c.prototype.onDoubleTap=function(e){this.camera.useInputToRestoreState&&this.camera.restoreState()},c.prototype.onMultiTouch=function(e,t,i,n,r,o){var a,s,c,l,u;0===i&&null===r||0===n&&null===o||(a=this.pinchInwards?1:-1,this.multiTouchPanAndZoom?(this.useNaturalPinchZoom?this.camera.radius=this.camera.radius*Math.sqrt(i)/Math.sqrt(n):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*a*(this.angularSensibilityX+this.angularSensibilityY)/2),0!==this.panningSensibility&&r&&o&&(s=o.x-r.x,c=o.y-r.y,this.camera.inertialPanningX+=-s/this.panningSensibility,this.camera.inertialPanningY+=c/this.panningSensibility)):(this._twoFingerActivityCount++,l=Math.sqrt(i),u=Math.sqrt(n),this._isPinching||this._twoFingerActivityCount<20&&Math.abs(u-l)>this.camera.pinchToPanMaxDistance?(this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*a*(this.angularSensibilityX+this.angularSensibilityY)/2),this._isPinching=!0):0!==this.panningSensibility&&this.multiTouchPanning&&o&&r&&(s=o.x-r.x,c=o.y-r.y,this.camera.inertialPanningX+=-s/this.panningSensibility,this.camera.inertialPanningY+=c/this.panningSensibility)))},c.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},c.prototype.onButtonUp=function(e){this._twoFingerActivityCount=0,this._isPinching=!1},c.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},Object(r.c)([Object(o.c)()],c.prototype,"buttons",void 0),Object(r.c)([Object(o.c)()],c.prototype,"angularSensibilityX",void 0),Object(r.c)([Object(o.c)()],c.prototype,"angularSensibilityY",void 0),Object(r.c)([Object(o.c)()],c.prototype,"pinchPrecision",void 0),Object(r.c)([Object(o.c)()],c.prototype,"pinchDeltaPercentage",void 0),Object(r.c)([Object(o.c)()],c.prototype,"useNaturalPinchZoom",void 0),Object(r.c)([Object(o.c)()],c.prototype,"panningSensibility",void 0),Object(r.c)([Object(o.c)()],c.prototype,"multiTouchPanning",void 0),Object(r.c)([Object(o.c)()],c.prototype,"multiTouchPanAndZoom",void 0),c);function c(){var e=null!==n&&n.apply(this,arguments)||this;return e.buttons=[0,1,2],e.angularSensibilityX=1e3,e.angularSensibilityY=1e3,e.pinchPrecision=12,e.pinchDeltaPercentage=0,e.useNaturalPinchZoom=!1,e.panningSensibility=1e3,e.multiTouchPanning=!0,e.multiTouchPanAndZoom=!0,e.pinchInwards=!0,e._isPanClick=!1,e._twoFingerActivityCount=0,e._isPinching=!1,e}
1a.a.ArcRotateCameraPointersInput=s},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(1),r=i(3),o=i(37),a=i(82),s=i(0),c=(l.prototype.attachControl=function(e,n){var r=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add(function(){r._keys=[]}),this._onKeyboardObserver=this._scene.onKeyboardObservable.add(function(e){var t,i=e.event;i.metaKey||(e.type===a.a.KEYDOWN?-1===r.keysUp.indexOf(i.keyCode)&&-1===r.keysDown.indexOf(i.keyCode)&&-1===r.keysLeft.indexOf(i.keyCode)&&-1===r.keysRight.indexOf(i.keyCode)&&-1===r.keysUpward.indexOf(i.keyCode)&&-1===r.keysDownward.indexOf(i.keyCode)||(-1===(t=r._keys.indexOf(i.keyCode))&&r._keys.push(i.keyCode),n||i.preventDefault()):-1===r.keysUp.indexOf(i.keyCode)&&-1===r.keysDown.indexOf(i.keyCode)&&-1===r.keysLeft.indexOf(i.keyCode)&&-1===r.keysRight.indexOf(i.keyCode)&&-1===r.keysUpward.indexOf(i.keyCode)&&-1===r.keysDownward.indexOf(i.keyCode)||(0<=(t=r._keys.indexOf(i.keyCode))&&r._keys.splice(t,1),n||i.preventDefault()))}))},l.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=[]},l.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t],n=e._computeLocalCameraSpeed();-1!==this.keysLeft.indexOf(i)?e._localDirection.copyFromFloats(-n,0,0):-1!==this.keysUp.indexOf(i)?e._localDirection.copyFromFloats(0,0,n):-1!==this.keysRight.indexOf(i)?e._localDirection.copyFromFloats(n,0,0):-1!==this.keysDown.indexOf(i)?e._localDirection.copyFromFloats(0,0,-n):-1!==this.keysUpward.indexOf(i)?e._localDirection.copyFromFloats(0,n,0):-1!==this.keysDownward.indexOf(i)&&e._localDirection.copyFromFloats(0,-n,0),e.getScene().useRightHandedSystem&&(e._localDirection.z*=-1),e.getViewMatrix().invertToRef(e._cameraTransformMatrix),s.e.TransformNormalToRef(e._localDirection,e._cameraTransformMatrix,e._transformedDirection),e.cameraDirection.addInPlace(e._transformedDirection)}},l.prototype.getClassName=function(){return"FreeCameraKeyboardMoveInput"},l.prototype._onLostFocus=function(){this._keys=[]},l.prototype.getSimpleName=function(){return"keyboard"}
1,Object(n.c)([Object(r.c)()],l.prototype,"keysUp",void 0),Object(n.c)([Object(r.c)()],l.prototype,"keysUpward",void 0),Object(n.c)([Object(r.c)()],l.prototype,"keysDown",void 0),Object(n.c)([Object(r.c)()],l.prototype,"keysDownward",void 0),Object(n.c)([Object(r.c)()],l.prototype,"keysLeft",void 0),Object(n.c)([Object(r.c)()],l.prototype,"keysRight",void 0),l);function l(){this.keysUp=[38],this.keysUpward=[33],this.keysDown=[40],this.keysDownward=[34],this.keysLeft=[37],this.keysRight=[39],this._keys=new Array}o.a.FreeCameraKeyboardMoveInput=c},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(1),r=i(6),o=i(3),a=i(37),l=i(20),s=(c.prototype.attachControl=function(o,a){var s=this,c=this.camera.getEngine();this._pointerInput||(this._pointerInput=function(e){var t=e.event;if(!c.isInVRExclusivePointerMode&&(s.touchEnabled||"touch"!==t.pointerType)&&(e.type===l.a.POINTERMOVE||-1!==s.buttons.indexOf(t.button))){var i=t.srcElement||t.target;if(e.type===l.a.POINTERDOWN&&i){try{i.setPointerCapture(t.pointerId)}catch(e){}s.previousPosition={x:t.clientX,y:t.clientY},a||(t.preventDefault(),o.focus())}else if(e.type===l.a.POINTERUP&&i){try{i.releasePointerCapture(t.pointerId)}catch(e){}s.previousPosition=null,a||t.preventDefault()}else if(e.type===l.a.POINTERMOVE){if(!s.previousPosition||c.isPointerLock)return;var n=t.clientX-s.previousPosition.x,r=t.clientY-s.previousPosition.y;s.camera.getScene().useRightHandedSystem&&(n*=-1),s.camera.parent&&s.camera.parent._getWorldMatrixDeterminant()<0&&(n*=-1),s._allowCameraRotation&&(s.camera.cameraRotation.y+=n/s.angularSensibility,s.camera.cameraRotation.x+=r/s.angularSensibility),s.onPointerMovedObservable.notifyObservers({offsetX:n,offsetY:r}),s.previousPosition={x:t.clientX,y:t.clientY},a||t.preventDefault()}}}),this._onMouseMove=function(e){var t,i;c.isPointerLock&&!c.isInVRExclusivePointerMode&&(t=e.movementX||e.mozMovementX||e.webkitMovementX||e.msMovementX||0,s.camera.getScene().useRightHandedSystem&&(t*=-1),s.camera.parent&&s.camera.parent._getWorldMatrixDeterminant()<0&&(t*=-1),s.camera.cameraRotation.y+=t/s.angularSensibility,i=e.movementY||e.mozMovementY||e.webkitMovementY||e.msMovementY||0,s.camera.cameraRotation.x+=i/s.angularSensibility,s.previousPosition=null,a||e.preventDefault())},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,l.a.POINTERDOWN|l.a.POINTERUP|l.a.POINTERMOVE),o.addEventListener("mousemove",this._onMouseMove,!1),o.addEventListener("contextmenu",this.onContextMenu.bind(this),!1)},c.prototype.onContextMenu=function(e){e.preventDefault()},c.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._onMouseMove&&e.removeEventListener("mousemove",this._onMouseMove),this.onContextMenu&&e.removeEventListener("contextmenu",this.onContextMenu),this.onPointerMovedObservable&&this.onPointerMovedObservable.clear(),this._observer=null,this._onMouseMove=null,this.previousPosition=null)},c.prototype.getClassName=function(){return"FreeCameraMouseInput"},c.prototype.getSimpleName=function(){return"mouse"},Object(n.c)([Object(o.c)()],c.prototype,"buttons",void 0),Object(n.c)([Object(o.c)()],c.prototype,"angularSensibility",void 0),c);function c(e){void 0===e&&(e=!0),this.touchEnabled=e,this.buttons=[0,1,2],this.angularSensibility=2e3,this.previousPosition=null,this.onPointerMovedObservable=new r.c,this._allowCameraRotation=!0}a.a.FreeCameraMouseInput=s},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(1),r=i(3),o=i(37),a=i(20),s=i(0),c=(l.prototype.attachControl=function(e,n){var r=this,o=null;void 0===this._pointerInput&&(this._onLostFocus=function(){r._offsetX=null,r._offsetY=null},this._pointerInput=function(e){var t,i=e.event;if("mouse"!==i.pointerType)if(e.type===a.a.POINTERDOWN){if(n||i.preventDefault(),r._pointerPressed.push(i.pointerId),1!==r._pointerPressed.length)return;o={x:i.clientX,y:i.clientY}}else if(e.type===a.a.POINTERUP){if(n||i.preventDefault(),-1===(t=r._pointerPressed.indexOf(i.pointerId)))return;if(r._pointerPressed.splice(t,1),0!=t)return;o=null,r._offsetX=null,r._offsetY=null}else if(e.type===a.a.POINTERMOVE){if(n||i.preventDefault(),!o)return;if(0!=(t=r._pointerPressed.indexOf(i.pointerId)))return;r._offsetX=i.clientX-o.x,r._offsetY=-(i.clientY-o.y)}}),this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,a.a.POINTERDOWN|a.a.POINTERUP|a.a.POINTERMOVE),this._onLostFocus&&e.addEventListener("blur",this._onLostFocus)},l.prototype.detachControl=function(e){this._pointerInput&&e&&(this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null),this._onLostFocus&&(e.removeEventListener("blur",this._onLostFocus),this._onLostFocus=null),this._pointerPressed=[],this._offsetX=null,this._offsetY=null)},l.prototype.checkInputs=function(){var e,t,i;this._offsetX&&this._offsetY&&((e=this.camera).cameraRotation.y+=this._offsetX/this.touchAngularSensibility,1<this._pointerPressed.length?e.cameraRotation.x+=-this._offsetY/this.touchAngularSensibility:(t=e._computeLocalCameraSpeed(),i=new s.e(0,0,t*this._offsetY/this.touchMoveSensibility),s.a.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(s.e.TransformCoordinates(i,e._cameraRotationMatrix))))},l.prototype.getClassName=function(){return"FreeCameraTouchInput"},l.prototype.getSimpleName=function(){return"touch"},Object(n.c)([Object(r.c)()],l.prototype,"touchAngularSensibility",void 0),Object(n.c)([Object(r.c)()],l.prototype,"touchMoveSensibility",void 0),l);function l(){this.touchAngularSensibility=2e5,this.touchMoveSensibility=250,this._offsetX=null,this._offsetY=null,this._pointerPressed=new Array}o.a.FreeCameraTouchInput=c},function(e,t,i){"use strict";i.d(t,"a",function(){return s});
1var n=i(1),r=i(3),o=i(37),c=i(0),a=i(57),s=(Object.defineProperty(l.prototype,"invertYAxis",{get:function(){return 1!==this._yAxisScale},set:function(e){this._yAxisScale=e?-1:1},enumerable:!1,configurable:!0}),l.prototype.attachControl=function(e,t){var i=this,n=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=n.onGamepadConnectedObservable.add(function(e){e.type!==a.a.POSE_ENABLED&&(i.gamepad&&e.type!==a.a.XBOX||(i.gamepad=e))}),this._onGamepadDisconnectedObserver=n.onGamepadDisconnectedObservable.add(function(e){i.gamepad===e&&(i.gamepad=null)}),this.gamepad=n.getGamepadByType(a.a.XBOX)},l.prototype.detachControl=function(e){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},l.prototype.checkInputs=function(){var e,t,i,n,r,o,a,s;this.gamepad&&this.gamepad.leftStick&&(e=this.camera,i=(t=this.gamepad.leftStick).x/this.gamepadMoveSensibility,n=t.y/this.gamepadMoveSensibility,t.x=.005<Math.abs(i)?0+i:0,t.y=.005<Math.abs(n)?0+n:0,(r=this.gamepad.rightStick)?(o=r.x/this.gamepadAngularSensibility,a=r.y/this.gamepadAngularSensibility*this._yAxisScale,r.x=.001<Math.abs(o)?0+o:0,r.y=.001<Math.abs(a)?0+a:0):r={x:0,y:0},e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):c.a.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform),s=50*e._computeLocalCameraSpeed(),this._vector3.copyFromFloats(t.x*s,0,-t.y*s),c.e.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(r.y,r.x),e.cameraRotation.addInPlace(this._vector2))},l.prototype.getClassName=function(){return"FreeCameraGamepadInput"},l.prototype.getSimpleName=function(){return"gamepad"},Object(n.c)([Object(r.c)()],l.prototype,"gamepadAngularSensibility",void 0),Object(n.c)([Object(r.c)()],l.prototype,"gamepadMoveSensibility",void 0),l);function l(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this._yAxisScale=1,this._cameraTransform=c.a.Identity(),this._deltaTransform=c.e.Zero(),this._vector3=c.e.Zero(),this._vector2=c.d.Zero()}o.a.FreeCameraGamepadInput=s},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(6),o=i(44),r=i(49),a=i(167),s=i(57),c=i(12),l=i(260),u=(Object.defineProperty(h.prototype,"gamepads",{get:function(){return this._babylonGamepads},enumerable:!1,configurable:!0}),h.prototype.getGamepadByType=function(e){void 0===e&&(e=s.a.XBOX);for(var t=0,i=this._babylonGamepads;t<i.length;t++){var n=i[t];if(n&&n.type===e)return n}return null},h.prototype.dispose=function(){this._gamepadEventSupported&&(this._onGamepadConnectedEvent&&window.removeEventListener("gamepadconnected",this._onGamepadConnectedEvent),this._onGamepadDisconnectedEvent&&window.removeEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent),this._onGamepadConnectedEvent=null,this._onGamepadDisconnectedEvent=null),this._babylonGamepads.forEach(function(e){e.dispose()}),this.onGamepadConnectedObservable.clear(),this.onGamepadDisconnectedObservable.clear(),this._oneGamepadConnected=!1,this._stopMonitoringGamepads(),this._babylonGamepads=[]},h.prototype._addNewGamepad=function(e){this._oneGamepadConnected||(this._oneGamepadConnected=!0);var t=-1!==e.id.search("054c"),i=-1!==e.id.search("Xbox One"),n=i||-1!==e.id.search("Xbox 360")||-1!==e.id.search("xinput")?new a.c(e.id,e.index,e,i):t?new l.c(e.id,e.index,e):e.pose?r.b.InitiateController(e):new s.b(e.id,e.index,e);return this._babylonGamepads[n.index]=n},h.prototype._startMonitoringGamepads=function(){this._isMonitoring||(this._isMonitoring=!0,this._scene||this._checkGamepadsStatus())},h.prototype._stopMonitoringGamepads=function(){this._isMonitoring=!1},h.prototype._checkGamepadsStatus=function(){var e=this;for(var t in this._updateGamepadObjects(),this._babylonGamepads){var i=this._babylonGamepads[t];i&&i.isConnected&&i.update()}this._isMonitoring&&!this._scene&&c.a.QueueNewFrame(function(){e._checkGamepadsStatus()})},h.prototype._updateGamepadObjects=function(){for(var e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[],t=0;t<e.length;t++){var i,n=e[t];n&&(this._babylonGamepads[n.index]?(this._babylonGamepads[t].browserGamepad=n,this._babylonGamepads[t].isConnected||(this._babylonGamepads[t]._isConnected=!0,this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[t]))):(i=this._addNewGamepad(n),this.onGamepadConnectedObservable.notifyObservers(i)))}},h);function h(e){var t,r=this;this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new n.c,o.a.IsWindowObjectExist()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator.getGamepads||navigator.webkitGetGamepads||navigator.msGetGamepads||navigator.webkitGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new n.c(function(e){for(var t in r._babylonGamepads){var i=r._babylonGamepads[t];i&&i._isConnected&&r.onGamepadConnectedObservable.notifyObserver(e,i)}}),this._onGamepadConnectedEvent=function(e){var t,i=e.gamepad;i.index in r._babylonGamepads&&r._babylonGamepads[i.index].isConnected||(r._babylonGamepads[i.index]?((t=r._babylonGamepads[i.index]).browserGamepad=i,t._isConnected=!0):t=r._addNewGamepad(i),r.onGamepadConnectedObservable.notifyObservers(t),r._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var t=e.gamepad;for(var i in r._babylonGamepads)if(r._babylonGamepads[i].index===t.index){var n=r._babylonGamepads[i];n._isConnected=!1,r.onGamepadDisconnectedObservable.notifyObservers(n),n.dispose&&n.dispose();break}},this._gamepadSupport&&(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported?(t=this._scene?this._scene.getEngine().getHostWindow():window)&&(t.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),t.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1)):this._startMonitoringGamepads())}},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return r}),i.d(t,"c",function(){return h});var n,r,o,a,s=i(1),c=i(6),l=i(57);(a=n=n||{})[a.Cross=0]="Cross",a[a.Circle=1]="Circle",a[a.Square=2]="Square",a[a.Triangle=3]="Triangle",a[a.L1=4]="L1",a[a.R1=5]="R1",a[a.Share=8]="Share",a[a.Options=9]="Options",a[a.LeftStick=10]="LeftStick",a[a.RightStick=11]="RightStick",(o=r=r||{})[o.Up=12]="Up",o[o.Down=13]="Down",o[o.Left=14]="Left",o[o.Right=15]="Right";var u,h=(u=l.a,Object(s.d)(d,u),d.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},d.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(d.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),d.prototype.onbuttondown=function(e){this._onbuttondown=e},d.prototype.onbuttonup=function(e){this._onbuttonup=e},d.prototype.ondpaddown=function(e){this._ondpaddown=e},d.prototype.ondpadup=function(e){this._ondpadup=e},d.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},d.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(d.prototype,"buttonCross",{get:function(){return this._buttonCross},set:function(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,n.Cross)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonCircle",{get:function(){return this._buttonCircle},set:function(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,n.Circle)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonSquare",{get:function(){return this._buttonSquare},set:function(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,n.Square)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonTriangle",{get:function(){return this._buttonTriangle},set:function(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,n.Triangle)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonOptions",{get:function(){return this._buttonOptions},set:function(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,n.Options)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonShare",{get:function(){return this._buttonShare},set:function(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,n.Share)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonL1",{get:function(){return this._buttonL1},set:function(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,n.L1)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonR1",{get:function(){return this._buttonR1},set:function(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,n.R1)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,n.LeftStick)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,n.RightStick)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,r.Up)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,r.Down)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,r.Left)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,r.Right)},enumerable:!1,configurable:!0}),d.prototype.update=function(){u.prototype.update.call(this),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},d.prototype.dispose=function(){u.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},d);function d(e,t,i){var n=u.call(this,e.replace("STANDARD GAMEPAD","SONY PLAYSTATION DUALSHOCK"),t,i,0,1,2,3)||this;return n._leftTrigger=0,n._rightTrigger=0,n.onButtonDownObservable=new c.c,n.onButtonUpObservable=new c.c,n.onPad
1DownObservable=new c.c,n.onPadUpObservable=new c.c,n._buttonCross=0,n._buttonCircle=0,n._buttonSquare=0,n._buttonTriangle=0,n._buttonShare=0,n._buttonOptions=0,n._buttonL1=0,n._buttonR1=0,n._buttonLeftStick=0,n._buttonRightStick=0,n._dPadUp=0,n._dPadDown=0,n._dPadLeft=0,n._dPadRight=0,n.type=l.a.DUALSHOCK,n}},function(e,t,i){"use strict";i.d(t,"a",function(){return F}),i.d(t,"b",function(){return w});var n,s,r=i(1),c=i(7),o=i(6),d=i(71),a=i(92),l=i(182),u=i(183),h=i(262),p=i(20),f=i(0),m=i(10),_=i(57),g=i(49),v=i(83),b=i(167),y=i(8),T=i(45),E=i(48),S=i(35),A=i(85),C=i(147),P=i(89),x=i(26),R=i(103),O=(i(135),i(120),i(79),i(199),i(198),i(24)),M=i(184),I=i(73),D=(k.prototype._getForwardRay=function(e){return new T.a(f.e.Zero(),new f.e(0,0,e))},k.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},k.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},k.prototype._activatePointer=function(){this._activePointer=!0},k.prototype._deactivatePointer=function(){this._activePointer=!1},k.prototype._updatePointerDistance=function(e){void 0===e&&(e=100)},k.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},k._idCounter=0,k),L=(s=D,Object(r.d)(V,s),V.prototype._getForwardRay=function(e){return this.webVRController.getForwardRay(e)},V.prototype._activatePointer=function(){s.prototype._activatePointer.call(this),this._laserPointer.isVisible=!0},V.prototype._deactivatePointer=function(){s.prototype._deactivatePointer.call(this),this._laserPointer.isVisible=!1},V.prototype._setLaserPointerColor=function(e){this._laserPointer.material.emissiveColor=e},V.prototype._setLaserPointerLightingDisabled=function(e){this._laserPointer.material.disableLighting=e},V.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<i.length;r++)if(i[r].name&&0<=i[r].name.indexOf(g.a.POINTING_POSE)){n=i[r],this.webVRController._pointingPoseNode=n;break}this._laserPointer.parent=n},V.prototype._updatePointerDistance=function(e){void 0===e&&(e=100),this._laserPointer.scaling.y=e,this._laserPointer.position.z=-e/2},V.prototype.dispose=function(){s.prototype.dispose.call(this),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)},V),N=(n=D,Object(r.d)(U,n),U.prototype._getForwardRay=function(e){var t=this.getCamera();return t?t.getForwardRay(e):new T.a(f.e.Zero(),f.e.Forward())},U),F=function(){},w=(Object.defineProperty(B.prototype,"onEnteringVR",{get:function(){return this.onEnteringVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onExitingVR",{get:function(){return this.onExitingVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onControllerMeshLoaded",{get:function(){return this.onControllerMeshLoadedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"teleportationTarget",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!1,configurable:!0}),Object.defineProperty(B.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")))}
1,enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"leftControllerGazeTrackerMesh",{get:function(){return this._leftController?this._leftController._gazeTracker:null},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"rightControllerGazeTrackerMesh",{get:function(){return this._rightController?this._rightController._gazeTracker:null},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"displayGaze",{get:function(){return this._displayGaze},set:function(e){(this._displayGaze=e)||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"displayLaserPointer",{get:function(){return this._displayLaserPointer},set:function(e){(this._displayLaserPointer=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:!1,configurable:!0}),Object.defineProperty(B.prototype,"deviceOrientationCamera",{get:function(){return this._deviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"currentVRCamera",{get:function(){return this._webVRready?this._webVRCamera:this._scene.activeCamera},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"webVRCamera",{get:function(){return this._webVRCamera},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"vrDeviceOrientationCamera",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"vrButton",{get:function(){return this._btnVR},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"_teleportationRequestInitiated",{get:function(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated},enumerable:!1,configurable:!0}),B.prototype.completeVRInit=function(t,e){var i,n,r=this;this.xrTestDone=!0,e.createFallbackVRDeviceOrientationFreeCamera&&(e.useMultiview&&(e.vrDeviceOrientationCameraMetrics||(e.vrDeviceOrientationCameraMetrics=R.a.GetDefault()),e.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new u.a("VRDeviceOrientationVRHelper",this._position,this._scene,!0,e.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new h.a("WebVRHelper",this._position,this._scene,e),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new N(function(){return r.currentVRCamera},t),this._useCustomVRButton||(this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR",i=".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"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%2C6
17t-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":"https://cdn.babylonjs.com/Assets/vrButton.png")+"); 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) }",i+=".babylonVRicon.vrdisplaypresenting { display: none; }",(n=document.createElement("style")).appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(n),this.moveButtonToBottomRight()),this._btnVR&&this._btnVR.addEventListener("click",function(){r.isInVRMode?r._scene.getEngine().disableVR():r.enterVR()});var o=this._scene.getEngine().getHostWindow();o&&(o.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,e.createFallbackVRDeviceOrientationFreeCamera?this.displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add(function(e){e.vrDisplay&&r.displayVRButton()}),this._onKeyDown=function(e){27===e.keyCode&&r.isInVRMode&&r.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add(function(){r._hasEnteredVR&&r.exitVROnDoubleTap&&(r.exitVR(),r._fullscreenVRpresenting&&r._scene.getEngine().exitFullscreen())},p.a.POINTERDOUBLETAP,!1),this._onVRDisplayChanged=function(e){return r.onVRDisplayChanged(e)},this._onVrDisplayPresentChange=function(){return r.onVrDisplayPresentChange()},this._onVRRequestPresentStart=function(){r._webVRrequesting=!0,r.updateButtonVisibility()},this._onVRRequestPresentComplete=function(){r._webVRrequesting=!1,r.updateButtonVisibility()},t.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged),t.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),t.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),o.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),t.onDisposeObservable.add(function(){r.dispose()}),this._webVRCamera.onControllerMeshLoadedObservable.add(function(e){return r._onDefaultMeshLoaded(e)}),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this.updateButtonVisibility(),this._circleEase=new P.d,this._circleEase.setEasingMode(P.f.EASINGMODE_EASEINOUT),this._teleportationEasing=this._circleEase,t.onPointerObservable.add(function(e){r._interactionsEnabled&&t.activeCamera===r.vrDeviceOrientationCamera&&"mouse"===e.event.pointerType&&(e.type===p.a.POINTERDOWN?r._cameraGazer._selectionPointerDown():e.type===p.a.POINTERUP&&r._cameraGazer._selectionPointerUp())}),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes}))},B.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){c.a.Warn("Error in your custom logic onControllerMeshLoaded: "+e)}},Object.defineProperty(B.prototype,"isInVRMode",{get:function(){return this.xr&&this.webVROptions.useXR&&this.xr.baseExperience.state===I.a.IN_XR||this._webVRpresenting||this._fullscreenVRpresenting}
1,enumerable:!1,configurable:!0}),B.prototype.onVrDisplayPresentChange=function(){var e,t=this._scene.getEngine().getVRDevice();t?(e=this._webVRpresenting,this._webVRpresenting=t.isPresenting,e&&!this._webVRpresenting&&this.exitVR()):c.a.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?"),this.updateButtonVisibility()},B.prototype.onVRDisplayChanged=function(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this.updateButtonVisibility()},B.prototype.moveButtonToBottomRight=function(){var e;this._inputElement&&!this._useCustomVRButton&&this._btnVR&&(e=this._inputElement.getBoundingClientRect(),this._btnVR.style.top=e.top+e.height-70+"px",this._btnVR.style.left=e.left+e.width-100+"px")},B.prototype.displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},B.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")))},B.prototype.enterVR=function(){var e,t,i,n=this;if(this.xr)this.xr.baseExperience.enterXRAsync("immersive-vr","local-floor",this.xr.renderTarget);else{if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(n){c.a.Warn("Error in your custom logic onEnteringVR: "+n)}this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=f.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera&&(e=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,t=f.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-e,i=this.webVRCamera.rotationQuaternion.toEulerAngles().y,this.webVRCamera.rotationQuaternion=f.b.FromEulerAngles(0,i+t,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(e){n.onAfterEnteringVRObservable.notifyObservers({success:e})}),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(){n.onAfterEnteringVRObservable.notifyObservers({success:!0})})),this._scene.activeCamera&&this._inputElement&&this._scene.activeCamera.attachControl(this._inputElement),this._interactionsEnabled&&this._scene.registerBeforeRender(this.beforeRender),this._displayLaserPointer&&[this._leftController,this._rightController].forEach(function(e){e&&e._activatePointer()}),this._hasEnteredVR=!0)}},B.prototype.exitVR=function(){if(this.xr)this.xr.baseExperience.exitXRAsync();else if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){c.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._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._inputElement&&this._scene.activeCamera.attachControl(this._inputElement),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(B.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)}
1,enumerable:!1,configurable:!0}),B.prototype.enableInteractions=function(){var t=this;if(!this._interactionsEnabled){if(this._interactionsRequested=!0,this.xr)return void(this.xr.baseExperience.state===I.a.IN_XR&&this.xr.pointerSelection.attach());this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=function(e){return e.isVisible&&(e.isPickable||e.name===t._floorMeshName)},this.meshSelectionPredicate=function(){return!0},this._raySelectionPredicate=function(e){return!!(t._isTeleportationFloor(e)||-1===e.name.indexOf("gazeTracker")&&-1===e.name.indexOf("teleportationTarget")&&-1===e.name.indexOf("torusTeleportation"))&&t.raySelectionPredicate(e)},this._interactionsEnabled=!0}},Object.defineProperty(B.prototype,"_noControllerIsActive",{get:function(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)},enumerable:!1,configurable:!0}),B.prototype._isTeleportationFloor=function(e){for(var t=0;t<this._floorMeshesCollection.length;t++)if(this._floorMeshesCollection[t].id===e.id)return!0;return!(!this._floorMeshName||e.name!==this._floorMeshName)},B.prototype.addFloorMesh=function(e){this._floorMeshesCollection&&(-1<this._floorMeshesCollection.indexOf(e)||this._floorMeshesCollection.push(e))},B.prototype.removeFloorMesh=function(e){var t;!this._floorMeshesCollection||-1!==(t=this._floorMeshesCollection.indexOf(e))&&this._floorMeshesCollection.splice(t,1)},B.prototype.enableTeleportation=function(e){var t=this;if(void 0===e&&(e={}),!this._teleportationInitialized){if(this._teleportationRequested=!0,this.enableInteractions(),this.webVROptions.useXR&&(e.floorMeshes||e.floorMeshName)){var i,n=e.floorMeshes||[];if(n.length||(i=this._scene.getMeshByName(e.floorMeshName))&&n.push(i),this.xr)return n.forEach(function(e){t.xr.teleportation.addFloorMesh(e)}),void(this.xr.teleportation.attached||this.xr.teleportation.attach());if(!this.xrTestDone){var r=function(){t.xrTestDone&&(t._scene.unregisterBeforeRender(r),t.xr?t.xr.teleportation.attached||t.xr.teleportation.attach():t.enableTeleportation(e))};return void this._scene.registerBeforeRender(r)}}e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),e.teleportationMode&&(this._teleportationMode=e.teleportationMode),e.teleportationTime&&0<e.teleportationTime&&(this._teleportationTime=e.teleportationTime),e.teleportationSpeed&&0<e.teleportationSpeed&&(this._teleportationSpeed=e.teleportationSpeed),void 0!==e.easingFunction&&(this._teleportationEasing=e.easingFunction),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController);var o=new E.a;o.vignetteColor=new m.b(0,0,0,0),o.vignetteEnabled=!0,this._postProcessMove=new C.a("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,o),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}},B.prototype._enableInteractionOnController=function(i){var n=this;i.webVRController.mesh&&(i._interactionsEnabled=!0,this.isInVRMode&&this._displayLaserPointer&&i._activatePointer(),this.webVROptions.laserToggle&&i.webVRController.onMainButtonStateChangedObservable.add(function(e){n._displayLaserPointer&&1===e.value&&(i._activePointer?i._deactivatePointer():i._activatePointer(),n.displayGaze&&(i._gazeTracker.isVisible=i._activePointer))}),i.webVRController.onTriggerStateChangedObservable.add(function(e){var t=i;n._noControllerIsActive&&(t=n._cameraGazer),t._pointerDownOnMeshAsked?e.value<n._padSensibilityDown&&t._selectionPointerUp():e.value>n._padSensibilityUp&&t._selectionPointerDown()}))},B.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)<this._padSensibilityDown&&(this._teleportActive&&this.teleportCamera(this._haloCenter),t._teleportationRequestInitiated=!1):e.y<-this._padSensibilityUp&&t._dpadPressed&&(t._activatePointer(),t._teleportationRequestInitiated=!0))},B.prototype._checkRotate=function(e,t){t._teleportationRequestInitiated||(t._rotationLeftAsked?e.x>-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.x<this._padSensibilityDown&&(t._rotationRightAsked=!1):e.x>this._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},B.prototype._checkTeleportBackwards=function(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;var i=f.b.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),n=this.currentVRCamera.position;this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(i=this.currentVRCamera.deviceRotationQuaternion,n=this.currentVRCamera.devicePosition),i.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,f.b.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),f.e.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var r=new T.a(n,this._workingVector),o=this._scene.pickWithRay(r,this._raySelectionPredicate);o&&o.pickedPoint&&o.pickedMesh&&this._isTeleportationFloor(o.pickedMesh)&&o.distance<5&&this.teleportCamera(o.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1},B.prototype._enableTeleportationOnController=function(t){var i=this;t.webVRController.mesh&&(t._interactionsEnabled||this._enableInteractionOnController(t),t._interactionsEnabled=!0,t._teleportationEnabled=!0,t.webVRController.controllerType===g.c.VIVE&&(t._dpadPressed=!1,t.webVRController.onPadStateChangedObservable.add(function(e){t._dpadPressed=e.pressed,t._dpadPressed||(t._rotationLeftAsked=!1,t._rotationRightAsked=!1,t._teleportationBackRequestInitiated=!1)})),t.webVRController.onPadValuesChangedObservable.add(function(e){i.teleportationEnabled&&(i._checkTeleportBackwards(e,t),i._checkTeleportWithRay(e,t)),i._checkRotate(e,t)}))},B.prototype._createTeleportationCircles=function(){this._teleportationTarget=y.a.CreateGround("teleportationTarget",2,2,2,this._scene),this._teleportationTarget.isPickable=!1;var e=new A.a("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(
1);var i=new S.a("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;var n=y.a.CreateTorus("torusTeleportation",.75,.1,25,this._scene,!1);n.isPickable=!1,n.parent=this._teleportationTarget;var r=new x.a("animationInnerCircle","position.y",30,x.a.ANIMATIONTYPE_FLOAT,x.a.ANIMATIONLOOPMODE_CYCLE),o=[];o.push({frame:0,value:0}),o.push({frame:30,value:.4}),o.push({frame:60,value:0}),r.setKeys(o);var a=new P.m;a.setEasingMode(P.f.EASINGMODE_EASEINOUT),r.setEasingFunction(a),n.animations=[],n.animations.push(r),this._scene.beginAnimation(n,0,60,!0),this._hideTeleportationTarget()},B.prototype._displayTeleportationTarget=function(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))},B.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},B.prototype._rotateCamera=function(e){var t,i,n,r,o,a,s,c=this;this.currentVRCamera instanceof d.a&&(e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[],t=f.b.FromRotationMatrix(f.a.RotationY(Math.PI/4*this._rotationAngle)),i=new x.a("animationRotation","rotationQuaternion",90,x.a.ANIMATIONTYPE_QUATERNION,x.a.ANIMATIONLOOPMODE_CONSTANT),(n=[]).push({frame:0,value:this.currentVRCamera.rotationQuaternion}),n.push({frame:6,value:t}),i.setKeys(n),i.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(i),this._postProcessMove.animations=[],r=new x.a("animationPP","vignetteWeight",90,x.a.ANIMATIONTYPE_FLOAT,x.a.ANIMATIONLOOPMODE_CONSTANT),(o=[]).push({frame:0,value:0}),o.push({frame:3,value:4}),o.push({frame:6,value:0}),r.setKeys(o),r.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(r),a=new x.a("animationPP2","vignetteStretch",90,x.a.ANIMATIONTYPE_FLOAT,x.a.ANIMATIONLOOPMODE_CONSTANT),(s=[]).push({frame:0,value:0}),s.push({frame:3,value:10}),s.push({frame:6,value:0}),a.setKeys(s),a.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(a),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(){c._webVRCamera.detachPostProcess(c._postProcessMove)}),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1))},B.prototype._moveTeleportationSelectorTo=function(e,t,i){var n,r,o;e.pickedPoint&&(t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint)),(n=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i))&&(r=f.e.Cross(O.a.Y,n),o=f.e.Cross(n,r),f.e.RotationFromAxisToRef(o,n,r,this._teleportationTarget.rotation)),this._teleportationTarget.position.y+=.1)},B.prototype.teleportCamera=function(e){var t,i,n,r,o,a,s,c,l,u,h=this;this.currentVRCamera instanceof d.a&&(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),n=this._teleportationMode==B.TELEPORTATIONMODE_CONSTANTSPEED?(t=90,i=f.e.Distance(this.currentVRCamera.position,this._workingVector),this._teleportationSpeed/i):(t=Math.round(90*this._teleportationTime/1e3),1),this.currentVRCamera.animations=[],r=new x.a("animationCameraTeleportation","position",90,x.a.ANIMATIONTYPE_VECTOR3,x.a.ANIMATIONLOOPMODE_CONSTANT),o=[{frame:0,value:this.currentVRCamera.position},{frame:t,value:this._workingVector}],r.setKeys(o),r.setEasingFunction(this._teleportationEasing),this.currentVRCamera.animations.push(r),this._postProcessMove.animations=[],a=Math.round(t/2),s=new x.a("animationPP","vignetteWeight",90,x.a.ANIMATIONTYPE_FLOAT,x.a.ANIMATIONLOOPMODE_CONSTANT),(c=[]).push({frame:0,value:0}),c.push({frame:a,value:8}),c.push({frame:t,value:0}),s.setKeys(c),this._postProcessMove.animations.push(s),l=new x.a("animationPP2","vignetteStretch",90,x.a.ANIMATIONTYPE_FLOAT,x.a.ANIMATIONLOOPMODE_CONSTANT),(u=[]).push({frame:0,value:0}),u.push({frame:a,value:10}),u.push({frame:t,value:0}),l.setKeys(u),this._postProcessMove.animations.push(l),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,t,!1,n,function(){h._webVRCamera.detachPostProcess(h._postProcessMove)}),this._scene.beginAnimation(this.currentVRCamera,0,t,!1,n,function(){h.onAfterCameraTeleport.notifyObservers(h._workingVector)}),this._hideTeleportationTarget())},B.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(f.e.Dot(e,t.direction))<Math.PI/2&&e.scaleInPlace(-1),e},B.prototype._castRayAndSelectObject=function(e){if(this.currentVRCamera instanceof d.a){var t,i,n,r,o=e._getForwardRay(this._rayLength),a=this._scene.pickWithRay(o,this._raySelectionPredicate);
1if(a&&(e._laserPointer&&(a.originMesh=e._laserPointer.parent),this._scene.simulatePointerMove(a,{pointerId:e._id})),(e._currentHit=a)&&a.pickedPoint?(this._displayGaze&&(t=1,e._gazeTracker.isVisible=!0,e._isActionableMesh&&(t=3),this.updateGazeTrackerScale&&(e._gazeTracker.scaling.x=a.distance*t,e._gazeTracker.scaling.y=a.distance*t,e._gazeTracker.scaling.z=a.distance*t),(i=this._convertNormalToDirectionOfRay(a.getNormal(),o))&&(n=f.e.Cross(O.a.Y,i),r=f.e.Cross(i,n),f.e.RotationFromAxisToRef(r,i,n,e._gazeTracker.rotation)),e._gazeTracker.position.copyFrom(a.pickedPoint),e._gazeTracker.position.x<0?e._gazeTracker.position.x+=.002:e._gazeTracker.position.x-=.002,e._gazeTracker.position.y<0?e._gazeTracker.position.y+=.002:e._gazeTracker.position.y-=.002,e._gazeTracker.position.z<0?e._gazeTracker.position.z+=.002:e._gazeTracker.position.z-=.002),e._updatePointerDistance(a.distance)):(e._updatePointerDistance(),e._gazeTracker.isVisible=!1),a&&a.pickedMesh){if(this._teleportationInitialized&&this._isTeleportationFloor(a.pickedMesh)&&a.pickedPoint)return e._currentMeshSelected&&!this._isTeleportationFloor(e._currentMeshSelected)&&this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,void(e._teleportationRequestInitiated&&this._moveTeleportationSelectorTo(a,e,o));if(a.pickedMesh!==e._currentMeshSelected)if(this.meshSelectionPredicate(a.pickedMesh)){this.onNewMeshPicked.notifyObservers(a),e._currentMeshSelected=a.pickedMesh,a.pickedMesh.isPickable&&a.pickedMesh.actionManager?(this.changeGazeColor(this._pickedGazeColor),this.changeLaserColor(this._pickedLaserColor),e._isActionableMesh=!0):(this.changeGazeColor(this._gazeColor),this.changeLaserColor(this._laserColor),e._isActionableMesh=!1);try{this.onNewMeshSelected.notifyObservers(a.pickedMesh),e.webVRController&&this.onMeshSelectedWithController.notifyObservers({mesh:a.pickedMesh,controller:e.webVRController})}catch(e){c.a.Warn("Error while raising onNewMeshSelected or onMeshSelectedWithController: "+e)}}else this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,this.changeGazeColor(this._gazeColor),this.changeLaserColor(this._laserColor)}else this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,this.changeGazeColor(this._gazeColor),this.changeLaserColor(this._laserColor)}},B.prototype._notifySelectedMeshUnselected=function(e){e&&this.onSelectedMeshUnselected.notifyObservers(e)},B.prototype.setLaserColor=function(e,t){void 0===t&&(t=this._pickedLaserColor),this._laserColor=e,this._pickedLaserColor=t},B.prototype.setLaserLightingState=function(e){void 0===e&&(e=!0),this._leftController&&this._leftController._setLaserPointerLightingDisabled(!e),this._rightController&&this._rightController._setLaserPointerLightingDisabled(!e)},B.prototype.setGazeColor=function(e,t){void 0===t&&(t=this._pickedGazeColor),this._gazeColor=e,this._pickedGazeColor=t},B.prototype.changeLaserColor=function(e){this.updateControllerLaserColor&&(this._leftController&&this._leftController._setLaserPointerColor(e),this._rightController&&this._rightController._setLaserPointerColor(e))},B.prototype.changeGazeColor=function(e){this.updateGazeTrackerColor&&this._cameraGazer._gazeTracker.material&&(this._cameraGazer._gazeTracker.material.emissiveColor=e,this._leftController&&(this._leftController._gazeTracker.material.emissiveColor=e),this._rightController&&(this._rightController._gazeTracker.material.emissiveColor=e))},B.prototype.dispose=function(){this.isInVRMode&&this.exitVR(),this._postProcessMove&&this._postProcessMove.dispose(),this._webVRCamera&&this._webVRCamera.dispose(),this._vrDeviceOrientationCamera&&this._vrDeviceOrientationCamera.dispose(),!this._useCustomVRButton&&this._btnVR&&this._btnVR.parentNode&&document.body.removeChild(this._btnVR),this._deviceOrientationCamera&&this._scene.activeCamera!=this._deviceOrientationCamera&&this._deviceOrientationCamera.dispose(),this._cameraGazer&&this._cameraGazer.dispose(),this._leftController&&this._leftController.dispose(),this._rightController&&this._rightController.dispose(),this._teleportationTarget&&this._teleportationTarget.dispose(),this.xr&&this.xr.dispose(),this._floorMeshesCollection=[],document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),window.removeEventListener("resize",this._onResize),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.onmsfullscreenchange=null,this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChanged),this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart),this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete),window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected),this._scene.unregisterBeforeRender(this.beforeRender)},B.prototype.getClassName=function(){return"VRExperienceHelper"},B.TELEPORTATIONMODE_CONSTANTTIME=0,B.TELEPORTATIONMODE_CONSTANTSPEED=1,B);function B(t,i){var e,n=this;void 0===i&&(i={}),this.webVROptions=i,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new o.c,this.onAfterEnteringVRObservable=new o.c,this.onExitingVRObservable=new o.c,this.onControllerMeshLoadedObservable=new o.c,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._teleportationMode=B.TELEPORTATIONMODE_CONSTANTTIME,this._teleportationTime=122,this._teleportationSpeed=20,this._rotationAllowed=!0,this._teleportBackwardsVector=new f.e(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new f.e(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this._gazeColor=new m.a(.7,.7,.7),this._laserColor=new m.a(.7,.7,.7),this._pickedLaserColor=new m.a(.2,.2,1),this._pickedGazeColor=new m.a(0,0,1),this.onNewMeshSelected=new o.c,this.onMeshSelectedWithController=new o.c,this.onNewMeshPicked=new o.c,this.onBeforeCameraTeleport=new o.c,this.onAfterCameraTeleport=new o.c,this.onSelectedMeshUnselected=new o.c,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.updateControllerLaserColor=!0,this.requestPointerLockOnFullScreen=!0,this.xrTestDone=!1,this._onResize=function(){n.moveButtonToBottomRight(),n._fullscreenVRpresenting&&n._webVRready&&n.exitVR()},this._onFullscreenChange=function(){var e=document;void 0!==e.fullscreen?n._fullscreenVRpresenting=document.fullscreen:void 0!==e.mozFullScreen?n._fullscreenVRpresenting=e.mozFullScreen:void 0!==e.webkitIsFullScreen?n._fullscreenVRpresenting=e.webkitIsFullScreen:void 0!==e.msIsFullScreen?n._fullscreenVRpresenting=e.msIsFullScreen:void 0!==document.msFullscreenElement&&(n._fullscreenVRpresenting=document.msFullscreenElement),!n._fullscreenVRpresenting&&n._inputElement&&(n.exitVR(),!n._useCustomVRButton&&n._btnVR&&(n._btnVR.style.top=n._inputElement.offsetTop+n._inputElement.offsetHeight-70+"px",n._btnVR.style.left=n._inputElement.offsetLeft+n._inputElement.offsetWidth-100+"px",n.updateButtonVisibility()))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this.beforeRender=function(){n._leftController&&n._leftController._activePointer&&n._castRayAndSelectObject(n._leftController),n._rightController&&n._rightController._activePointer&&n._castRayAndSelectObject(n._rightController),n._noControllerIsActive&&(n._scene.getEngine().isPointerLock||n.enableGazeEvenWhenNoPointerLock)?n._castRayAndSelectObject(n._cameraGazer):n._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){var t,i;e.type!==_.a.POSE_ENABLED?(e.leftStick&&e.onleftstickchanged(function(e){n._teleportationInitialized&&n.teleportationEnabled&&(!n._leftController&&!n._rightController||n._leftController&&!n._leftController._activePointer&&n._rightController&&!n._rightController._activePointer)&&(n._checkTeleportWithRay(e,n._cameraGazer),n._checkTeleportBackwards(e,n._cameraGazer))}),e.rightStick&&e.onrightstickchanged(function(e){n._teleportationInitialized&&n._checkRotate(e,n._cameraGazer)}),e.type===_.a.XBOX&&(e.onbuttondown(function(e){n._interactionsEnabled&&e===b.a.A&&n._cameraGazer._selectionPointerDown()}),e.onbuttonup(function(e){n._interactionsEnabled&&e===b.a.A&&n._cameraGazer._selectionPointerUp()}))):(i=new L(t=e,n._scene,n._cameraGazer._gazeTracker),"right"===t.hand||n._leftController&&n._leftController.webVRController!=t?n._rightController=i:n._leftController=i,n._tryEnableInteractionOnController(i))},this._tryEnableInteractionOnController=function(e){n._interactionsRequested&&!e._interactionsEnabled&&n._enableInteractionOnController(e),n._teleportationRequested&&!e._teleportationEnabled&&n._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=function(e){e instanceof v.a&&("left"===e.hand&&null!=n._leftController&&(n._leftController.dispose(),n._leftController=null),"right"===e.hand&&null!=n._rightController&&(n._rightController.dispose(),n._rightController=null))},this._workingVector=f.e.Zero(),this._workingQuaternion=f.b.Identity(),this._workingMatrix=f.a.Identity(),this._scene=t,this._inputElement=t.getEngine().getInputElement(),"getVRDisplays"in navigator||(i.useXR=!0),void 0===i.createFallbackVRDeviceOrientationFreeCamera&&(i.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===i.createDeviceOrientationCamera&&(i.createDeviceOrientationCamera=!0),void 0===i.laserToggle&&(i.laserToggle=!0),void 0===i.defaultHeight&&(i.defaultHeight=1.7),i.useCustomVRButton&&(this._useCustomVRButton=!0,i.customVRButton&&(this._btnVR=i.
1customVRButton)),i.rayLength&&(this._rayLength=i.rayLength),this._defaultHeight=i.defaultHeight,i.positionScale&&(this._rayLength*=i.positionScale,this._defaultHeight*=i.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new f.e(0,this._defaultHeight,0),i.createDeviceOrientationCamera||!this._scene.activeCamera?(this._deviceOrientationCamera=new l.a("deviceOrientationVRHelper",this._position.clone(),t),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof a.a&&this._scene.activeCamera.rotation)&&((e=this._scene.activeCamera).rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(e.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(f.b.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z)),this._deviceOrientationCamera.rotation=e.rotation.clone()),this._scene.activeCamera=this._deviceOrientationCamera,this._inputElement&&this._scene.activeCamera.attachControl(this._inputElement)):this._existingCamera=this._scene.activeCamera,this.webVROptions.useXR&&navigator.xr?M.a.IsSessionSupportedAsync("immersive-vr").then(function(e){e?(c.a.Log("Using WebXR. It is recommended to use the WebXRDefaultExperience directly"),t.createDefaultXRExperienceAsync({floorMeshes:i.floorMeshes||[]}).then(function(e){n.xr=e,n.xrTestDone=!0,n._cameraGazer=new N(function(){return n.xr.baseExperience.camera},t),n.xr.baseExperience.onStateChangedObservable.add(function(e){switch(e){case I.a.ENTERING_XR:n.onEnteringVRObservable.notifyObservers(n),n._interactionsEnabled||n.xr.pointerSelection.detach(),n.xr.pointerSelection.displayLaserPointer=n._displayLaserPointer;break;case I.a.EXITING_XR:n.onExitingVRObservable.notifyObservers(n),n._scene.getEngine().resize();break;case I.a.IN_XR:n._hasEnteredVR=!0;break;case I.a.NOT_IN_XR:n._hasEnteredVR=!1}})})):n.completeVRInit(t,i)}):this.completeVRInit(t,i)}function U(e,t){var i=n.call(this,t)||this;return i.getCamera=e,i}function V(e,t,i){var n=s.call(this,t,i)||this;n.webVRController=e,n._laserPointer=y.a.CreateCylinder("laserPointer",1,.004,2e-4,20,1,t,!1);var r,o,a=new S.a("laserPointerMat",t);return a.emissiveColor=new m.a(.7,.7,.7),a.alpha=.6,n._laserPointer.material=a,n._laserPointer.rotation.x=Math.PI/2,n._laserPointer.position.z=-.5,n._laserPointer.isVisible=!1,n._laserPointer.isPickable=!1,e.mesh||(r=new y.a("preloadControllerMesh",t),(o=new y.a(g.a.POINTING_POSE,t)).rotation.x=-.7,r.addChild(o),e.attachToMesh(r)),n._setLaserPointerParent(e.mesh),n._meshAttachedObserver=e._meshAttachedObservable.add(function(e){n._setLaserPointerParent(e)}),n}function k(e,t){var i;void 0===t&&(t=null),this.scene=e,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=k._idCounter++,t?this._gazeTracker=t.clone("gazeTracker"):(this._gazeTracker=y.a.CreateTorus("gazeTracker",.0035,.0025,20,e,!1),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1,(i=new S.a("targetMat",e)).specularColor=m.a.Black(),i.emissiveColor=new m.a(.7,.7,.7),i.backFaceCulling=!1,this._gazeTracker.material=i)}},function(e,t,i){"use strict";i.d(t,"a",function(){return m});var n=i(1),a=i(6),r=i(71),s=i(25),c=i(0),o=i(57),l=i(49),u=i(30),h=i(118),d=i(7),p=i(189);i(306),i(307),u.a.AddNodeConstructor("WebVRFreeCamera",function(e,t){return function(){return new m(e,c.e.Zero(),t)}}),u.a.AddNodeConstructor("WebVRGamepadCamera",function(e,t){return function(){return new m(e,c.e.Zero(),t)}});var f,m=(f=r.a,Object(n.d)(_,f),_.prototype.deviceDistanceToRoomGround=function(){return this._standingMatrix?(this._standingMatrix.getTranslationToRef(this._workingVector),this._deviceRoomPosition.y+this._workingVector.y):this._defaultHeight||0},_.prototype.useStandingMatrix=function(t){var i=this;void 0===t&&(t=function(e){}),this.getEngine().initWebVRAsync().then(function(e){e.vrDisplay&&e.vrDisplay.stageParameters&&e.vrDisplay.stageParameters.sittingToStandingTransform&&i.webVROptions.trackPosition?(i._standingMatrix=new c.a,c.a.FromFloat32ArrayToRefScaled(e.vrDisplay.stageParameters.sittingToStandingTransform,0,1,i._standingMatrix),i.getScene().useRightHandedSystem||i._standingMatrix&&i._standingMatrix.toggleModelMatrixHandInPlace(),t(!0)):t(!1)})},_.prototype.useStandingMatrixAsync=function(){var e=this;return new Promise(function(t){e.useStandingMatrix(function(e){t(e)})})},_.prototype.dispose=function(){this._detachIfAttached(),this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled),this._updateCacheWhenTrackingDisabledObserver&&this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver),f.prototype.dispose.call(this)},_.prototype.getControllerByName=function(e){for(var t=0,i=this.controllers;t<i.length;t++){var n=i[t];if(n.hand===e)return n}return null},Object.defineProperty(_.prototype,"leftController",{get:function(){return this._leftController||(this._leftController=this.getControllerByName("left")),this._leftController}
1,enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"rightController",{get:function(){return this._rightController||(this._rightController=this.getControllerByName("right")),this._rightController},enumerable:!1,configurable:!0}),_.prototype.getForwardRay=function(e){return void 0===e&&(e=100),this.leftCamera?f.prototype.getForwardRay.call(this,e,this.leftCamera.getWorldMatrix(),this.leftCamera.globalPosition):f.prototype.getForwardRay.call(this,e)},_.prototype._checkInputs=function(){this._vrDevice&&this._vrDevice.isPresenting&&(this._vrDevice.getFrameData(this._frameData),this.updateFromDevice(this._frameData.pose)),f.prototype._checkInputs.call(this)},_.prototype.updateFromDevice=function(e){e&&e.orientation&&4===e.orientation.length&&(this.rawPose=e,this._deviceRoomRotationQuaternion.copyFromFloats(e.orientation[0],e.orientation[1],-e.orientation[2],-e.orientation[3]),this.getScene().useRightHandedSystem&&(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1),this.webVROptions.trackPosition&&this.rawPose.position&&(this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2]),this.get
1Scene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1)),this._poseSet=!0)},_.prototype.attachControl=function(e,t){f.prototype.attachControl.call(this,e,t),this._attached=!0,this._htmlElementAttached=e,t=!s.a.ForceAttachControlToAlwaysPreventDefault&&t,this._vrDevice&&this.getEngine().enableVR(this.webVROptions);var i=this._scene.getEngine().getHostWindow();i&&i.addEventListener("vrdisplaypresentchange",this._detachIfAttached)},_.prototype.detachControl=function(e){this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),f.prototype.detachControl.call(this,e),this._attached=!1,this.getEngine().disableVR(),window.removeEventListener("vrdisplaypresentchange",this._detachIfAttached)},_.prototype.getClassName=function(){return"WebVRFreeCamera"},_.prototype.resetToCurrentRotation=function(){this._vrDevice.resetPose()},_.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];e.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),t.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),e.position.copyFrom(this._deviceRoomPosition),t.position.copyFrom(this._deviceRoomPosition)},_.prototype._correctPositionIfNotTrackPosition=function(e,t){void 0===t&&(t=!1),this.rawPose&&this.rawPose.position&&!this.webVROptions.trackPosition&&(c.a.TranslationToRef(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2],this._tmpMatrix),t||this._tmpMatrix.invert(),this._tmpMatrix.multiplyToRef(e,e))},_.prototype._updateCache=function(e){var t=this;this.rotationQuaternion.equals(this._cache.rotationQuaternion)&&this.position.equals(this._cache.position)||(this.updateCacheCalled||(this.updateCacheCalled=!0,this.update()),this.rotationQuaternion.toRotationMatrix(this._workingMatrix),c.e.TransformCoordinatesToRef(this._deviceRoomPosition,this._workingMatrix,this._workingVector),this.devicePosition.subtractToRef(this._workingVector,this._workingVector),c.a.ComposeToRef(this._oneVector,this.rotationQuaternion,this._workingVector,this._deviceToWorld),this._deviceToWorld.getTranslationToRef(this._workingVector),this._workingVector.addInPlace(this.position),this._workingVector.subtractInPlace(this._cache.position),this._deviceToWorld.setTranslation(this._workingVector),this._deviceToWorld.invertToRef(this._worldToDevice),this.controllers.forEach(function(e){e._deviceToWorld.copyFrom(t._deviceToWorld),t._correctPositionIfNotTrackPosition(e._deviceToWorld),e.update()})),e||f.prototype._updateCache.call(this),this.updateCacheCalled=!1},_.prototype._computeDevicePosition=function(){c.e.TransformCoordinatesToRef(this._deviceRoomPosition,this._deviceToWorld,this.devicePosition)},_.prototype.update=function(){this._computeDevicePosition(),c.a.FromQuaternionToRef(this._deviceRoomRotationQuaternion,this._workingMatrix),this._workingMatrix.multiplyToRef(this._deviceToWorld,this._workingMatrix),c.b.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this._poseSet&&this.onPoseUpdatedFromDeviceObservable.notifyObservers(null),f.prototype.update.call(this)},_.prototype._getViewMatrix=function(){return c.a.Identity()},_.prototype._getWebVRViewMatrix=function(){var e=this._cameraRigParams.parentCamera;e._updateCache();var t=this._cameraRigParams.left?this._cameraRigParams.frameData.leftViewMatrix:this._cameraRigParams.frameData.rightViewMatrix;return c.a.FromArrayToRef(t,0,this._webvrViewMatrix),this.getScene().useRightHandedSystem||this._webvrViewMatrix.toggleModelMatrixHandInPlace(),this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix),c.e.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),1!==e.deviceScaleFactor&&(this._webvrViewMatrix.invert(),e.deviceScaleFactor&&(this._webvrViewMatrix.multiplyAtIndex(12,e.deviceScaleFactor),this._webvrViewMatrix.multiplyAtIndex(13,e.deviceScaleFactor),this._webvrViewMatrix.multiplyAtIndex(14,e.deviceScaleFactor)),this._webvrViewMatrix.invert()),e._correctPositionIfNotTrackPosition(this._webvrViewMatrix,!0),e._worldToDevice.multiplyToRef(this._webvrViewMatrix,this._webvrViewMatrix),this._workingMatrix=this._workingMatrix||c.a.Identity(),this._webvrViewMatrix.invertToRef(this._workingMatrix),this._workingMatrix.multiplyToRef(e.getWorldMatrix(),this._workingMatrix),this._workingMatrix.getTranslationToRef(this._globalPosition),this._markSyncedWithParent(),this._webvrViewMatrix},_.prototype._getWebVRProjectionMatrix=function(){var e=this.parent;e._vrDevice.depthNear=e.minZ,e._vrDevice.depthFar=e.maxZ;var t=this._cameraRigParams.left?this._cameraRigParams.frameData.leftProjectionMatrix:this._cameraRigParams.frameData.rightProjectionMatrix;
1return c.a.FromArrayToRef(t,0,this._projectionMatrix),this.getScene().useRightHandedSystem||this._projectionMatrix.toggleProjectionMatrixHandInPlace(),this._projectionMatrix},_.prototype.initControllers=function(){var r=this;this.controllers=[];var e=this.getScene().gamepadManager;this._onGamepadDisconnectedObserver=e.onGamepadDisconnectedObservable.add(function(e){var t,i;e.type===o.a.POSE_ENABLED&&((t=e).defaultModel&&t.defaultModel.setEnabled(!1),"right"===t.hand&&(r._rightController=null),"left"===t.hand&&(r._leftController=null),-1!==(i=r.controllers.indexOf(t))&&r.controllers.splice(i,1))}),this._onGamepadConnectedObserver=e.onGamepadConnectedObservable.add(function(e){if(e.type===o.a.POSE_ENABLED){var t=e;if(r.webVROptions.trackPosition||(t._disableTrackPosition(new c.e("left"==t.hand?-.15:.15,-.5,.25)),r._updateCacheWhenTrackingDisabledObserver||(r._updateCacheWhenTrackingDisabledObserver=r._scene.onBeforeRenderObservable.add(function(){r._updateCache()}))),t.deviceScaleFactor=r.deviceScaleFactor,t._deviceToWorld.copyFrom(r._deviceToWorld),r._correctPositionIfNotTrackPosition(t._deviceToWorld),r.webVROptions.controllerMeshes&&(t.defaultModel?t.defaultModel.setEnabled(!0):t.initControllerMesh(r.getScene(),function(e){var n;e.scaling.scaleInPlace(r.deviceScaleFactor),r.onControllerMeshLoadedObservable.notifyObservers(t),r.webVROptions.defaultLightingOnControllers&&(r._lightOnControllers||(r._lightOnControllers=new h.a("vrControllersLight",new c.e(0,1,0),r.getScene())),n=function(e,t){var i=e.getChildren();i&&0!==i.length&&i.forEach(function(e){t.includedOnlyMeshes.push(e),n(e,t)})},r._lightOnControllers.includedOnlyMeshes.push(e),n(e,r._lightOnControllers))})),t.attachToPoseControlledCamera(r),-1===r.controllers.indexOf(t)){r.controllers.push(t);for(var i=!1,n=0;n<r.controllers.length;n++)r.controllers[n].controllerType===l.c.VIVE&&(i?r.controllers[n].hand="right":(i=!0,r.controllers[n].hand="left"));2<=r.controllers.length&&r.onControllersAttachedObservable.notifyObservers(r.controllers)}}})},_);function _(e,t,i,n){void 0===n&&(n={});var r=f.call(this,e,t,i)||this;r.webVROptions=n,r._vrDevice=null,r.rawPose=null,r._specsVersion="1.1",r._attached=!1,r._descendants=[],r._deviceRoomPosition=c.e.Zero(),r._deviceRoomRotationQuaternion=c.b.Identity(),r._standingMatrix=null,r.devicePosition=c.e.Zero(),r.deviceRotationQuaternion=c.b.Identity(),r.deviceScaleFactor=1,r._deviceToWorld=c.a.Identity(),r._worldToDevice=c.a.Identity(),r.controllers=[],r.onControllersAttachedObservable=new a.c,r.onControllerMeshLoadedObservable=new a.c,r.onPoseUpdatedFromDeviceObservable=new a.c,r._poseSet=!1,r.rigParenting=!0,r._defaultHeight=void 0,r._htmlElementAttached=null,r._detachIfAttached=function(){var e=r.getEngine().getVRDevice();e&&!e.isPresenting&&r._htmlElementAttached&&r.detachControl(r._htmlElementAttached)},r._workingVector=c.e.Zero(),r._oneVector=c.e.One(),r._workingMatrix=c.a.Identity(),r._tmpMatrix=new c.a,r._cache.position=c.e.Zero(),n.defaultHeight&&(r._defaultHeight=n.defaultHeight,r.position.y=r._defaultHeight),r.minZ=.1,5===arguments.length&&(r.webVROptions=arguments[4]),null==r.webVROptions.trackPosition&&(r.webVROptions.trackPosition=!0),null==r.webVROptions.controllerMeshes&&(r.webVROptions.controllerMeshes=!0),null==r.webVROptions.defaultLightingOnControllers&&(r.webVROptions.defaultLightingOnControllers=!0),r.rotationQuaternion=new c.b,r.webVROptions&&r.webVROptions.positionScale&&(r.deviceScaleFactor=r.webVROptions.positionScale);var o=r.getEngine();return r._onVREnabled=function(e){e&&r.initControllers()},o.onVRRequestPresentComplete.add(r._onVREnabled),o.initWebVR().add(function(e){e.vrDisplay&&r._vrDevice!==e.vrDisplay&&(r._vrDevice=e.vrDisplay,r.setCameraRigMode(s.a.RIG_MODE_WEBVR,{parentCamera:r,vrDisplay:r._vrDevice,frameData:r._frameData,specs:r._specsVersion}),r._attached&&r.getEngine().enableVR(r.webVROptions))}),"undefined"!=typeof VRFrameData&&(r._frameData=new VRFrameData),n.useMultiview&&(r.getScene().getEngine().getCaps().multiview?(r._useMultiviewToSingleView=!0,r._rigPostProcess=new p.a("VRMultiviewToSingleview",r,1)):(d.a.Warn("Multiview is not supported, falling back to standard rendering"),r._useMultiviewToSingleView=!1)),i.onBeforeCameraRenderObservable.add(function(t){t.parent===r&&r.rigParenting&&(r._descendants=r.getDescendants(!0,function(t){var e=r.controllers.some(function(e){return e._mesh===t}),i=-1!==r._rigCameras.indexOf(t);return!e&&!i}
1),r._descendants.forEach(function(e){e.parent=t}))}),i.onAfterCameraRenderObservable.add(function(e){e.parent===r&&r.rigParenting&&r._descendants.forEach(function(e){e.parent=r})}),r}},function(e,t,i){"use strict";i.d(t,"b",function(){return o}),i.d(t,"a",function(){return n});var r=i(6),o=(s.GetDefaults=function(){var e=new s;return e.canvasOptions={antialias:!0,depth:!0,stencil:!1,alpha:!0,multiview:!1,framebufferScaleFactor:1},e.newCanvasCssStyle="position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;",e},s),n=(a.prototype.dispose=function(){this._removeCanvas(),this._setManagedOutputCanvas(null)},a.prototype.initializeXRLayerAsync=function(t){function e(){var e=new XRWebGLLayer(t,i.canvasContext,i._options.canvasOptions);return i.onXRLayerInitObservable.notifyObservers(e),e}var i=this;return this.canvasContext.makeXRCompatible?this.canvasContext.makeXRCompatible().then(function(){return i.xrLayer=e(),i.xrLayer}):(this.xrLayer=e(),Promise.resolve(this.xrLayer))},a.prototype._addCanvas=function(){var t=this;this._canvas&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.appendChild(this._canvas),this.xrLayer?this._setCanvasSize(!0):this.onXRLayerInitObservable.addOnce(function(e){t._setCanvasSize(!0,e)})},a.prototype._removeCanvas=function(){this._canvas&&document.body.contains(this._canvas)&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.removeChild(this._canvas),this._setCanvasSize(!1)},a.prototype._setCanvasSize=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=this.xrLayer),this._canvas&&(e?t&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=t.framebufferWidth+"px",this._canvas.style.height=t.framebufferHeight+"px"):this._engine.setSize(t.framebufferWidth,t.framebufferHeight)):this._originalCanvasSize&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=this._originalCanvasSize.width+"px",this._canvas.style.height=this._originalCanvasSize.height+"px"):this._engine.setSize(this._originalCanvasSize.width,this._originalCanvasSize.height)))},a.prototype._setManagedOutputCanvas=function(e){this._removeCanvas(),e?(this._originalCanvasSize={width:e.offsetWidth,height:e.offsetHeight},this._canvas=e,this.canvasContext=this._canvas.getContext("webgl2"),this.canvasContext||(this.canvasContext=this._canvas.getContext("webgl"))):(this._canvas=null,this.canvasContext=null)},a);function a(e,t){var i,n=this;void 0===t&&(t=o.GetDefaults()),this._options=t,this._canvas=null,this.xrLayer=null,this.onXRLayerInitObservable=new r.c,this._engine=e.scene.getEngine(),t.canvasElement?this._setManagedOutputCanvas(t.canvasElement):((i=document.createElement("canvas")).style.cssText=this._options.newCanvasCssStyle||"position:absolute; bottom:0px;right:0px;",this._setManagedOutputCanvas(i)),e.onXRSessionInit.add(function(){n._addCanvas()}),e.onXRSessionEnded.add(function(){n._removeCanvas()})}function s(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return d});var n=i(1),r=i(0),o=i(7),a=i(28),s=i(8),c=i(46),l=i(51),h=i(4);s.a._instancedMeshFactory=function(e,t){var i=new d(e,t);if(t.instancedBuffers)for(var n in i.instancedBuffers={},t.instancedBuffers)i.instancedBuffers[n]=t.instancedBuffers[n];return i};var u,d=(u=a.a,Object(n.d)(p,u),p.prototype.getClassName=function(){return"InstancedMesh"},Object.defineProperty(p.prototype,"lightSources",{get:function(){return this._sourceMesh._lightSources},enumerable:!1,configurable:!0}),p.prototype._resyncLightSources=function(){},p.prototype._resyncLightSource=function(e){},p.prototype._removeLightSource=function(e,t){},Object.defineProperty(p.prototype,"receiveShadows",{get:function(){return this._sourceMesh.receiveShadows},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"material",{get:function(){return this._sourceMesh.material},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"visibility",{get:function(){return this._sourceMesh.visibility},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"skeleton",{get:function(){return this._sourceMesh.skeleton}
1,enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"renderingGroupId",{get:function(){return this._sourceMesh.renderingGroupId},set:function(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&o.a.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")},enumerable:!1,configurable:!0}),p.prototype.getTotalVertices=function(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0},p.prototype.getTotalIndices=function(){return this._sourceMesh.getTotalIndices()},Object.defineProperty(p.prototype,"sourceMesh",{get:function(){return this._sourceMesh},enumerable:!1,configurable:!0}),p.prototype.createInstance=function(e){return this._sourceMesh.createInstance(e)},p.prototype.isReady=function(e){return void 0===e&&(e=!1),this._sourceMesh.isReady(e,!0)},p.prototype.getVerticesData=function(e,t){return this._sourceMesh.getVerticesData(e,t)},p.prototype.setVerticesData=function(e,t,i,n){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,i,n),this.sourceMesh},p.prototype.updateVerticesData=function(e,t,i,n){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,i,n),this.sourceMesh},p.prototype.setIndices=function(e,t){return void 0===t&&(t=null),this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh},p.prototype.isVerticesDataPresent=function(e){return this._sourceMesh.isVerticesDataPresent(e)},p.prototype.getIndices=function(){return this._sourceMesh.getIndices()},Object.defineProperty(p.prototype,"_positions",{get:function(){return this._sourceMesh._positions},enumerable:!1,configurable:!0}),p.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=!1),this._boundingInfo&&this._boundingInfo.isLocked)return this;var t=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getPositionData(e),t),this},p.prototype._preActivate=function(){return this._currentLOD&&this._currentLOD._preActivate(),this},p.prototype._activate=function(e,t){if(this._sourceMesh.subMeshes||o.a.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(0<this._currentLOD._getWorldMatrixDeterminant()!=0<this._getWorldMatrixDeterminant())return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0}return!1},p.prototype._postActivate=function(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)},p.prototype.getWorldMatrix=function(){if(this._currentLOD&&this._currentLOD.billboardMode!==l.a.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){var e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,r.c.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),r.c.Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(r.c.Vector3[7]),this._currentLOD._masterMesh=e,r.c.Matrix[0]}return u.prototype.getWorldMatrix.call(this)},Object.defineProperty(p.prototype,"isAnInstance",{get:function(){return!0},enumerable:!1,configurable:!0}),p.prototype.getLOD=function(e){if(!e)return this;var t=this.getBoundingInfo();return this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere),this._currentLOD===this.sourceMesh?this.sourceMesh:this._currentLOD},p.prototype._preActivateForIntermediateRendering=function(e){return this.sourceMesh._preActivateForIntermediateRendering(e)},p.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this},p.prototype._generatePointsArray=function(){return this._sourceMesh._generatePointsArray()},p.prototype.clone=function(e,t,i){void 0===t&&(t=null);var n=this._sourceMesh.createInstance(e);if(c.a.DeepCopy(this,n,["name","subMeshes","uniqueId","parent","lightSources","receiveShadows","material","visibility","skeleton","sourceMesh","isAnInstance","facetNb","isFacetDataEnabled","isBlocked","useBones","hasInstances","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances"],[]),this.refreshBoundingInfo(),t&&(n.parent=t),!i)for(var r=0;r<this.getScene().meshes.length;r++){var o=this.getScene().meshes[r];o.parent===this&&o.clone(o.name,n)}return n.computeWorldMatrix(!0),n},p.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._sourceMesh.removeInstance(this),u.prototype.dispose.call(this,e,t)},p);function p(e,t){var i=u.call(this,e,t.getScene())||this;
1i._indexInSourceMeshInstanceArray=-1,t.addInstance(i),i._sourceMesh=t,i._unIndexed=t._unIndexed,i.position.copyFrom(t.position),i.rotation.copyFrom(t.rotation),i.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(i.rotationQuaternion=t.rotationQuaternion.clone()),i.animations=Array.from(t.animations);for(var n=0,r=t.getAnimationRanges();n<r.length;n++){var o=r[n];null!=o&&i.createAnimationRange(o.name,o.from,o.to)}return i.infiniteDistance=t.infiniteDistance,i.setPivotMatrix(t.getPivotMatrix()),i.refreshBoundingInfo(),i._syncSubMeshes(),i}s.a.prototype.edgesShareWithInstances=!1,s.a.prototype.registerInstancedBuffer=function(e,t){if(this.removeVerticesData(e),!this.instancedBuffers){this.instancedBuffers={};for(var i=0,n=this.instances;i<n.length;i++)n[i].instancedBuffers={};this._userInstancedBuffersStorage={data:{},vertexBuffers:{},strides:{},sizes:{}}}this.instancedBuffers[e]=null,this._userInstancedBuffersStorage.strides[e]=t,this._userInstancedBuffersStorage.sizes[e]=32*t,this._userInstancedBuffersStorage.data[e]=new Float32Array(this._userInstancedBuffersStorage.sizes[e]),this._userInstancedBuffersStorage.vertexBuffers[e]=new h.b(this.getEngine(),this._userInstancedBuffersStorage.data[e],e,!0,!1,t,!0),this.setVerticesBuffer(this._userInstancedBuffersStorage.vertexBuffers[e]);for(var r=0,o=this.instances;r<o.length;r++)o[r].instancedBuffers[e]=null},s.a.prototype._processInstancedBuffers=function(e,t){var i=e.length;for(var n in this.instancedBuffers){for(var r=this._userInstancedBuffersStorage.sizes[n],o=this._userInstancedBuffersStorage.strides[n],a=(i+1)*o;r<a;)r*=2;this._userInstancedBuffersStorage.data[n].length!=r&&(this._userInstancedBuffersStorage.data[n]=new Float32Array(r),this._userInstancedBuffersStorage.sizes[n]=r,this._userInstancedBuffersStorage.vertexBuffers[n]&&(this._userInstancedBuffersStorage.vertexBuffers[n].dispose(),this._userInstancedBuffersStorage.vertexBuffers[n]=null));var s=this._userInstancedBuffersStorage.data[n],c=0;t&&((l=this.instancedBuffers[n]).toArray?l.toArray(s,c):l.copyToArray(s,c),c+=o);for(var l,u=0;u<i;u++){(l=e[u].instancedBuffers[n]).toArray?l.toArray(s,c):l.copyToArray(s,c),c+=o}this._userInstancedBuffersStorage.vertexBuffers[n]?this._userInstancedBuffersStorage.vertexBuffers[n].updateDirectly(s,0):(this._userInstancedBuffersStorage.vertexBuffers[n]=new h.b(this.getEngine(),this._userInstancedBuffersStorage.data[n],n,!0,!1,o,!0),this.setVerticesBuffer(this._userInstancedBuffersStorage.vertexBuffers[n]))}},s.a.prototype._disposeInstanceSpecificData=function(){for(this._instanceDataStorage.instancesBuffer&&(this._instanceDataStorage.instancesBuffer.dispose(),this._instanceDataStorage.instancesBuffer=null);this.instances.length;)this.instances[0].dispose();for(var e in this.instancedBuffers)this._userInstancedBuffersStorage.vertexBuffers[e]&&this._userInstancedBuffersStorage.vertexBuffers[e].dispose();this.instancedBuffers={}}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var o=i(54),n=(a.Create=function(e){return"undefined"!=typeof _native&&_native.DeviceInputSystem?new _native.DeviceInputSystem(e):new a(e)},a.prototype.pollInput=function(e,t,i){var n=this._inputs[e][t];if(!n)throw"Unable to find device "+o.a[e];if(this._updateDevice(e,t,i),void 0===n[i])throw"Unable to find input "+i+" for device "+o.a[e]+" in slot "+t;return n[i]},a.prototype.dispose=function(){this._keyboardActive&&(window.removeEventListener("keydown",this._keyboardDownEvent),window.removeEventListener("keyup",this._keyboardUpEvent)),this._pointerActive&&(this._elementToAttachTo.removeEventListener("pointermove",this._pointerMoveEvent),this._elementToAttachTo.removeEventListener("pointerdown",this._pointerDownEvent),this._elementToAttachTo.removeEventListener("pointerup",this._pointerUpEvent)),window.removeEventListener("gamepadconnected",this._gamepadConnectedEvent),window.removeEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)},a.prototype._registerDevice=function(e,t,i){if(this._inputs[e]||(this._inputs[e]=[]),!this._inputs[e][t]){for(var n=new Array(i),r=0;r<i;r++)n[r]=null;this._inputs[e][t]=n,this.onDeviceConnected(e,t)}},a.prototype._unregisterDevice=function(e,t){this._inputs[e][t]&&(delete this._inputs[e][t],this.onDeviceDisconnected(e,t))},a.prototype._handleKeyActions=function(){var i=this;this._keyboardDownEvent=function(e){i._keyboardActive||(i._keyboardActive=!0,i._registerDevice(o.a.Keyboard,0,a._MAX_KEYCODES));var t=i._inputs[o.a.Keyboard][0];t&&(i.onInputChanged&&i.onInputChanged(o.a.Keyboard,0,e.keyCode,t[e.keyCode],1),t[e.keyCode]=1)},this._keyboardUpEvent=function(e){var t=i._inputs[o.a.Keyboard][0];t&&(i.onInputChanged&&i.onInputChanged(o.a.Keyboard,0,e.keyCode,t[e.keyCode],0),t[e.keyCode]=0)},window.addEventListener("keydown",this._keyboardDownEvent),window.addEventListener("keyup",this._keyboardUpEvent)},a.prototype._handlePointerActions=function(){var r=this;this._pointerMoveEvent=function(e){var t="mouse"==e.pointerType?o.a.Mouse:o.a.Touch,i="mouse"==e.pointerType?0:e.pointerId;r._inputs[t]||(r._inputs[t]=[]),r._inputs[t][i]||(r._pointerActive=!0,r._registerDevice(t,i,a._MAX_POINTER_INPUTS));var n=r._inputs[t][i];n&&(r.onInputChanged&&(r.onInputChanged(t,i,0,n[0],e.clientX),r.onInputChanged(t,i,1,n[1],e.clientY)),n[0]=e.clientX,n[1]=e.clientY)},this._pointerDownEvent=function(e){var t="mouse"==e.pointerType?o.a.Mouse:o.a.Touch,i="mouse"==e.pointerType?0:e.pointerId;r._inputs[t]||(r._inputs[t]=[]),r._inputs[t][i]||(r._pointerActive=!0,r._registerDevice(t,i,a._MAX_POINTER_INPUTS));var n=r._inputs[t][i];n&&(r.onInputChanged&&(r.onInputChanged(t,i,0,n[0],e.clientX),r.onInputChanged(t,i,1,n[1],e.clientY),r.onInputChanged(t,i,e.button+2,n[e.button+2],1)),n[0]=e.clientX,n[1]=e.clientY,n[e.button+2]=1)},this._pointerUpEvent=function(e){var t="mouse"==e.pointerType?o.a.Mouse:o.a.Touch,i="mouse"==e.pointerType?0:e.pointerId,n=r._inputs[t][i];n&&(r.onInputChanged&&r.onInputChanged(t,i,e.button+2,n[e.button+2],0),n[e.button+2]=0),"mouse"!=e.pointerType&&r._unregisterDevice(t,i)},this._elementToAttachTo.addEventListener("pointermove",this._pointerMoveEvent),this._elementToAttachTo.addEventListener("pointerdown",this._pointerDownEvent),this._elementToAttachTo.addEventListener("pointerup",this._pointerUpEvent)},a.prototype._handleGamepadActions=function(){var n=this;this._gamepadConnectedEvent=function(e){var t=n._getGamepadDeviceType(e.gamepad.id),i=e.gamepad.index;
1n._registerDevice(t,i,e.gamepad.buttons.length+e.gamepad.axes.length),n._gamepads=n._gamepads||new Array(e.gamepad.index+1),n._gamepads[i]=t},this._gamepadDisconnectedEvent=function(e){var t,i;n._gamepads&&(t=n._getGamepadDeviceType(e.gamepad.id),i=e.gamepad.index,n._unregisterDevice(t,i),delete n._gamepads[i])},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)},a.prototype._updateDevice=function(e,t,i){var n,r=navigator.getGamepads()[t];r&&e==this._gamepads[t]&&(n=this._inputs[e][t],i>=r.buttons.length?n[i]=r.axes[i-r.buttons.length].valueOf():n[i]=r.buttons[i].value)},a.prototype._getGamepadDeviceType=function(e){return-1!==e.indexOf("054c")?o.a.DualShock:-1!==e.indexOf("Xbox One")||-1!==e.search("Xbox 360")||-1!==e.search("xinput")?o.a.Xbox:-1!==e.indexOf("057e")?o.a.Switch:o.a.Generic},a._MAX_KEYCODES=255,a._MAX_POINTER_INPUTS=7,a);function a(e){this.onDeviceConnected=function(){},this.onDeviceDisconnected=function(){},this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._keyboardDownEvent=function(e){},this._keyboardUpEvent=function(e){},this._pointerMoveEvent=function(e){},this._pointerDownEvent=function(e){},this._pointerUpEvent=function(e){},this._gamepadConnectedEvent=function(e){},this._gamepadDisconnectedEvent=function(e){};var t=e.getInputElement();t&&(this._elementToAttachTo=t,this._handleKeyActions(),this._handlePointerActions(),this._handleGamepadActions())}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){this._timeElapsedQueryEnded=!1}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(1),r=i(3),p=i(0),o=i(30),a=i(63),s=i(149);o.a.AddNodeConstructor("Light_Type_1",function(e,t){return function(){return new l(e,p.e.Zero(),t)}});var c,l=(c=s.a,Object(n.d)(u,c),Object.defineProperty(u.prototype,"shadowFrustumSize",{get:function(){return this._shadowFrustumSize},set:function(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"shadowOrthoScale",{get:function(){return this._shadowOrthoScale},set:function(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),u.prototype.getClassName=function(){return"DirectionalLight"},u.prototype.getTypeID=function(){return a.a.LIGHTTYPEID_DIRECTIONALLIGHT},u.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){0<this.shadowFrustumSize?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},u.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&p.a.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e)},u.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=p.e.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=Number.MAX_VALUE,a=Number.MIN_VALUE,s=0;s<i.length;s++){var c=i[s];if(c)for(var l=c.getBoundingInfo().boundingBox,u=0;u<l.vectorsWorld.length;u++)p.e.TransformCoordinatesToRef(l.vectorsWorld[u],t,r),r.x<this._orthoLeft&&(this._orthoLeft=r.x),r.y<this._orthoBottom&&(this._orthoBottom=r.y),r.x>this._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y),this.autoCalcShadowZBounds&&(r.z<o&&(o=r.z),r.z>a&&(a=r.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=o,this._shadowMaxZ=a)}var h=this._orthoRight-this._orthoLeft,d=this._orthoTop-this._orthoBottom;p.a.OrthoOffCenterLHToRef(this._orthoLeft-h*this.shadowOrthoScale,this._orthoRight+h*this.shadowOrthoScale,this._orthoBottom-d*this.shadowOrthoScale,this._orthoTop+d*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e)}},u.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},u.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this},u.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z):e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this},u.prototype.getDepthMinZ=function(e){return 1},u.prototype.getDepthMaxZ=function(e){return 1},u.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},Object(n.c)([Object(r.c)()],u.prototype,"shadowFrustumSize",null),Object(n.c)([Object(r.c)()],u.prototype,"shadowOrthoScale",null),Object(n.c)([Object(r.c)()],u.prototype,"autoUpdateExtends",void 0),Object(n.c)([Object(r.c)()],u.prototype,"autoCalcShadowZBounds",void 0),u);function u(e,t,i){var n=c.call(this,e,i)||this;return n._shadowFrustumSize=0,n._shadowOrthoScale=.1,n.autoUpdateExtends=!0,n.autoCalcShadowZBounds=!1,n._orthoLeft=Number.MAX_VALUE,n._orthoRight=Number.MIN_VALUE,n._orthoTop=Number.MIN_VALUE,n._orthoBottom=Number.MAX_VALUE,n.position=t.scale(-1),n.direction=t,n}},function(e,t,i){"use strict";i.d(t,"a",function(){return h});var n=i(1),r=i(3),s=i(0),o=i(30),a=i(63),c=i(149),l=i(9);o.a.AddNodeConstructor("Light_Type_2",function(e,t){return function(){return new h(e,s.e.Zero(),s.e.Zero(),0,0,t)}});var u,h=(u=c.a,Object(n.d)(d,u),Object.defineProperty(d.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()}
1,enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){var t,i=this;this._projectionTexture===e||(this._projectionTexture=e,this._projectionTextureDirty=!0,!this._projectionTexture||this._projectionTexture.isReady())||(t=this._projectionTexture).onLoadObservable&&t.onLoadObservable.addOnce(function(){i._markMeshesAsLightDirty()})},enumerable:!1,configurable:!0}),d.prototype.getClassName=function(){return"SpotLight"},d.prototype.getTypeID=function(){return a.a.LIGHTTYPEID_SPOTLIGHT},d.prototype._setDirection=function(e){u.prototype._setDirection.call(this,e),this._projectionTextureViewLightDirty=!0},d.prototype._setPosition=function(e){u.prototype._setPosition.call(this,e),this._projectionTextureViewLightDirty=!0},d.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n,r=this.getScene().activeCamera;r&&(this._shadowAngleScale=this._shadowAngleScale||1,n=this._shadowAngleScale*this._angle,s.a.PerspectiveFovLHToRef(n,1,this.getDepthMinZ(r),this.getDepthMaxZ(r),e))},d.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),s.a.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},d.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);s.a.FromValuesToRef(r,0,0,0,0,r,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)},d.prototype._computeProjectionTextureMatrix=function(){var e,t;this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTexture instanceof l.a&&(e=this._projectionTexture.uScale/2,t=this._projectionTexture.vScale/2,s.a.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,.5,0,.5,.5,.5,1,this._projectionTextureScalingMatrix)),this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},d.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},d.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},d.prototype.transferTexturesToEffect=function(e,t){return this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatr
1ix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},d.prototype.transferToEffect=function(e,t){var i=this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),s.e.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),s.e.Normalize(this.direction));return this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightDirection",-i.x,-i.y,-i.z,this._cosHalfAngle,t):this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this},d.prototype.transferToNodeMaterialEffect=function(e,t){var i=this.computeTransformedInformation()?s.e.Normalize(this.transformedDirection):s.e.Normalize(this.direction);return this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),this},d.prototype.dispose=function(){u.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},d.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},Object(n.c)([Object(r.c)()],d.prototype,"angle",null),Object(n.c)([Object(r.c)()],d.prototype,"innerAngle",null),Object(n.c)([Object(r.c)()],d.prototype,"shadowAngleScale",null),Object(n.c)([Object(r.c)()],d.prototype,"exponent",void 0),Object(n.c)([Object(r.c)()],d.prototype,"projectionTextureLightNear",null),Object(n.c)([Object(r.c)()],d.prototype,"projectionTextureLightFar",null),Object(n.c)([Object(r.c)()],d.prototype,"projectionTextureUpDirection",null),Object(n.c)([Object(r.m)("projectedLightTexture")],d.prototype,"_projectionTexture",void 0),d);function d(e,t,i,n,r,o){var a=u.call(this,e,o)||this;return a._innerAngle=0,a._projectionTextureMatrix=s.a.Zero(),a._projectionTextureLightNear=1e-6,a._projectionTextureLightFar=1e3,a._projectionTextureUpDirection=s.e.Up(),a._projectionTextureViewLightDirty=!0,a._projectionTextureProjectionLightDirty=!0,a._projectionTextureDirty=!0,a._projectionTextureViewTargetVector=s.e.Zero(),a._projectionTextureViewLightMatrix=s.a.Zero(),a._projectionTextureProjectionLightMatrix=s.a.Zero(),a._projectionTextureScalingMatrix=s.a.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),a.position=t,a.direction=i,a.angle=n,a.exponent=r,a}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var c,n=i(1),l=i(0),u=i(9),r=i(39),o=i(61),h=i(2),d=i(80),a=(c=r.a,Object(n.d)(s,c),Object.defineProperty(s.prototype,"blurRatio",{get:function(){return this._blurRatio},set:function(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"adaptiveBlurKernel",{set:function(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"blurKernel",{set:function(e){this.blurKernelX=e,this.blurKernelY=e},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"blurKernelX",{get:function(){return this._blurKernelX},set:function(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"blurKernelY",{get:function(){return this._blurKernelY},set:function(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),s.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},s.prototype._onRatioRescale=function(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()},s.prototype._updateGammaSpace=function(){this.gammaSpace=!this.scene.imageProcessingConfiguration.isEnabled||!this.scene.imageProcessingConfiguration.applyByPostProcess},s.prototype._preparePostProcesses=function(){var e,t;this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY?(t=(e=this.getScene().getEngine()).getCaps().textureFloatRen
1der?h.a.TEXTURETYPE_FLOAT:h.a.TEXTURETYPE_HALF_FLOAT,this._blurX=new o.a("horizontal blur",new l.d(1,0),this._blurKernelX,this._blurRatio,null,u.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 o.a("vertical blur",new l.d(0,1),this._blurKernelY,this._blurRatio,null,u.a.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)):(this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null))},s.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize(),i=new s(this.name,t.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(i.renderList=this.renderList.slice(0)),i},s.prototype.serialize=function(){if(!this.name)return null;var e=c.prototype.serialize.call(this);return e.mirrorPlane=this.mirrorPlane.asArray(),e},s.prototype.dispose=function(){c.prototype.dispose.call(this),this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver)},s);function s(e,t,i,n,r,o,a){void 0===r&&(r=h.a.TEXTURETYPE_UNSIGNED_INT),void 0===o&&(o=u.a.BILINEAR_SAMPLINGMODE),void 0===a&&(a=!0);var s=c.call(this,e,t,i,n,!0,r,!1,o,a)||this;return s.scene=i,s.mirrorPlane=new d.a(0,1,0,1),s._transformMatrix=l.a.Zero(),s._mirrorMatrix=l.a.Zero(),s._adaptiveBlurKernel=0,s._blurKernelX=0,s._blurKernelY=0,s._blurRatio=1,s.ignoreCameraViewport=!0,s._updateGammaSpace(),s._imageProcessingConfigChangeObserver=i.imageProcessingConfiguration.onUpdateParameters.add(function(){s._updateGammaSpace}),s.onBeforeRenderObservable.add(function(){l.a.ReflectionToRef(s.mirrorPlane,s._mirrorMatrix),s._savedViewMatrix=i.getViewMatrix(),s._mirrorMatrix.multiplyToRef(s._savedViewMatrix,s._transformMatrix),i.setTransformMatrix(s._transformMatrix,i.getProjectionMatrix()),i.clipPlane=s.mirrorPlane,i.getEngine().cullBackFaces=!1,i._mirroredCameraPosition=l.e.TransformCoordinates(i.activeCamera.globalPosition,s._mirrorMatrix)}),s.onAfterRenderObservable.add(function(){i.setTransformMatrix(s._savedViewMatrix,i.getProjectionMatrix()),i.getEngine().cullBackFaces=!0,i._mirroredCameraPosition=null,i.clipPlane=null}),s}u.a._CreateMirror=function(e,t,i,n){return new a(e,t,i,n)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var a=i(2),s=i(23),n=(i(344),i(176),r.ExpandRGBDTexture=function(i){var n,e,r,o=i._texture;o&&i.isRGBD&&(e=(n=o.getEngine()).getCaps(),r=!1,e.textureHalfFloatRender&&e.textureHalfFloatLinearFiltering?(r=!0,o.type=a.a.TEXTURETYPE_HALF_FLOAT):e.textureFloatRender&&e.textureFloatLinearFiltering&&(r=!0,o.type=a.a.TEXTURETYPE_FLOAT),r&&(o.isReady=!1,o._isRGBD=!1,o.invertY=!1),i.onLoadObservable.addOnce(function(){var e,t;r&&(e=new s.a("rgbdDecode","rgbdDecode",null,null,1,null,a.a.TEXTURE_TRILINEAR_SAMPLINGMODE,n,!1,void 0,o.type,void 0,null,!1),t=n.createRenderTargetTexture(o.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:o.samplingMode,type:o.type,format:a.a.TEXTUREFORMAT_RGBA}),e.getEffect().executeWhenCompiled(function(){e.onApply=function(e){e._bindTexture("textureSampler",o),e.setFloat2("scale",1,1)},i.getScene().postProcessManager.directRender([e],t,!0),n.restoreDefaultFramebuffer(),n._releaseTexture(o),n._releaseFramebufferObjects(t),e&&e.dispose(),t._swapAndDie(o),o.isReady=!0}))}))},r);function r(){}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"a",function(){return r});var o=i(1),a=i(272),s=i(274),c=i(277),l=i(278),u=i(300),h=i(7),n=function(){},r=(d.CreateAsync=function(i,n){void 0===n&&(n={});var r=new d;
1return a.a.CreateAsync(i).then(function(e){if(r.baseExperience=e,n.ignoreNativeCameraTransformation&&(r.baseExperience.camera.compensateOnFirstFrame=!1),r.input=new s.a(e.sessionManager,e.camera,Object(o.a)({controllerOptions:{renderingGroupId:n.renderingGroupId}},n.inputOptions||{})),r.pointerSelection=r.baseExperience.featuresManager.enableFeature(c.a.Name,n.useStablePlugins?"stable":"latest",{xrInput:r.input,renderingGroupId:n.renderingGroupId}),n.disableTeleportation||(r.teleportation=r.baseExperience.featuresManager.enableFeature(u.a.Name,n.useStablePlugins?"stable":"latest",{floorMeshes:n.floorMeshes,xrInput:r.input,renderingGroupId:n.renderingGroupId}),r.teleportation.setSelectionFeature(r.pointerSelection)),r.renderTarget=r.baseExperience.sessionManager.getWebXRRenderTarget(n.outputCanvasOptions),!n.disableDefaultUI){var t=Object(o.a)({renderTarget:r.renderTarget},n.uiOptions||{});return n.optionalFeatures&&("boolean"==typeof n.optionalFeatures?t.optionalFeatures=["hit-test","anchors","planes","hand-tracking"]:t.optionalFeatures=n.optionalFeatures),l.a.CreateAsync(i,r.baseExperience,t).then(function(e){r.enterExitUI=e})}}).then(function(){return r}).catch(function(e){return h.a.Error("Error initializing XR"),h.a.Error(e),r})},d.prototype.dispose=function(){this.baseExperience&&this.baseExperience.dispose(),this.input&&this.input.dispose(),this.enterExitUI&&this.enterExitUI.dispose(),this.renderTarget&&this.renderTarget.dispose()},d);function d(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(6),r=i(184),o=i(273),a=i(73),s=i(56),c=i(7),l=(u.CreateAsync=function(e){var t=new u(e);return t.sessionManager.initializeAsync().then(function(){return t._supported=!0,t}).catch(function(e){throw t._setState(a.a.NOT_IN_XR),t.dispose(),e})},u.prototype.dispose=function(){this.camera.dispose(),this.onStateChangedObservable.clear(),this.onInitialXRPoseSetObservable.clear(),this.sessionManager.dispose(),this._nonVRCamera&&(this.scene.activeCamera=this._nonVRCamera)},u.prototype.enterXRAsync=function(e,t,i,n){var r=this;if(void 0===i&&(i=this.sessionManager.getWebXRRenderTarget()),void 0===n&&(n={}),!this._supported)throw"WebXR not supported in this browser or environment";return this._setState(a.a.ENTERING_XR),"viewer"!==t&&"local"!==t&&(n.optionalFeatures=n.optionalFeatures||[],n.optionalFeatures.push(t)),"immersive-ar"===e&&"unbounded"!==t&&c.a.Warn("We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode"),this.sessionManager.initializeSessionAsync(e,n).then(function(){return r.sessionManager.setReferenceSpaceTypeAsync(t)}).then(function(){return i.initializeXRLayerAsync(r.sessionManager.session)}).then(function(){return r.sessionManager.updateRenderStateAsync({depthFar:r.camera.maxZ,depthNear:r.camera.minZ,baseLayer:i.xrLayer})}).then(function(){return r.sessionManager.runXRRenderLoop(),r._originalSceneAutoClear=r.scene.autoClear,r._nonVRCamera=r.scene.activeCamera,r.scene.activeCamera=r.camera,"immersive-ar"!==e?r._nonXRToXRCamera():(r.scene.autoClear=!1,r.camera.compensateOnFirstFrame=!1),r.sessionManager.onXRSessionEnded.addOnce(function(){r.camera.rigCameras.forEach(function(e){e.outputRenderTarget=null}),r.scene.autoClear=r._originalSceneAutoClear,r.scene.activeCamera=r._nonVRCamera,"immersive-ar"!==e&&r.camera.compensateOnFirstFrame&&(r._nonVRCamera.setPosition?r._nonVRCamera.setPosition(r.camera.position):r._nonVRCamera.position.copyFrom(r.camera.position)),r._setState(a.a.NOT_IN_XR)}),r.sessionManager.onXRFrameObservable.addOnce(function(){r._setState(a.a.IN_XR)}),r.sessionManager}).catch(function(e){throw console.log(e),console.log(e.message),r._setState(a.a.NOT_IN_XR),e})},u.prototype.exitXRAsync=function(){return this.state!==a.a.IN_XR?Promise.resolve():(this._setState(a.a.EXITING_XR),this.sessionManager.exitXRAsync())},u.prototype._nonXRToXRCamera=function(){this.camera.setTransformationFromNonVRCamera(this._nonVRCamera),this.onInitialXRPoseSetObservable.notifyObservers(this.camera)},u.prototype._setState=function(e){this.state!==e&&(this.state=e,this.onStateChangedObservable.notifyObservers(this.state))},u);function u(e){var t=this;this.scene=e,this._nonVRCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this.onInitialXRPoseSetObservable=new n.c,this.onStateChangedObservable=new n.c,this.state=a.a.NOT_IN_XR,this.sessionManager=new r.a(e),this.camera=new o.a("",e,this.sessionManager),this.featuresManager=new s.b(this.sessionManager),e.onDisposeObservable.add(function(){t.exitXRAsync()})}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var r,n=i(1),l=i(0),o=i(25),a=i(71),s=i(92),c=i(77),u=(r=a.a,Object(n.d)(h,r),Object.defineProperty(h.prototype,"realWorldHeight",{get:function(){var e=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);return e&&e.transform?e.transform.position.y:0}
1,enumerable:!1,configurable:!0}),h.prototype._updateForDualEyeDebugging=function(){this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new c.a(0,0,.5,1),this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new c.a(.5,0,.5,1),this.rigCameras[1].outputRenderTarget=null},h.prototype.setTransformationFromNonVRCamera=function(e,t){void 0===e&&(e=this.getScene().activeCamera),void 0===t&&(t=!0),e&&e!==this&&(e.computeWorldMatrix().decompose(void 0,this.rotationQuaternion,this.position),this.position.y=0,l.b.FromEulerAnglesToRef(0,this.rotationQuaternion.toEulerAngles().y,0,this.rotationQuaternion),this._firstFrame=!0,t&&this._xrSessionManager.resetReferenceSpace())},h.prototype.getClassName=function(){return"WebXRCamera"},h.prototype._updateFromXRSession=function(){var e,t,c=this,i=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);i&&(i.transform&&(e=i.transform.position,this._referencedPosition.set(e.x,e.y,e.z),t=i.transform.orientation,this._referenceQuaternion.set(t.x,t.y,t.z,t.w),this._scene.useRightHandedSystem||(this._referencedPosition.z*=-1,this._referenceQuaternion.z*=-1,this._referenceQuaternion.w*=-1),this._firstFrame?(this._firstFrame=!1,this.position.y+=this._referencedPosition.y,this._referenceQuaternion.copyFromFloats(0,0,0,1)):(this.rotationQuaternion.copyFrom(this._referenceQuaternion),this.position.copyFrom(this._referencedPosition))),this.rigCameras.length!==i.views.length&&this._updateNumberOfRigCameras(i.views.length),i.views.forEach(function(e,t){var i=c.rigCameras[t];i.isLeftCamera||i.isRightCamera||("right"===e.eye?i._isRightCamera=!0:"left"===e.eye&&(i._isLeftCamera=!0));var n,r,o,a=e.transform.position,s=e.transform.orientation;i.position.set(a.x,a.y,a.z),i.rotationQuaternion.set(s.x,s.y,s.z,s.w),c._scene.useRightHandedSystem?i.rotationQuaternion.multiplyInPlace(c._rotate180):(i.position.z*=-1,i.rotationQuaternion.z*=-1,i.rotationQuaternion.w*=-1),l.a.FromFloat32ArrayToRefScaled(e.projectionMatrix,0,1,i._projectionMatrix),c._scene.useRightHandedSystem||i._projectionMatrix.toggleProjectionMatrixHandInPlace(),c._xrSessionManager.session.renderState.baseLayer&&(n=c._xrSessionManager.session.renderState.baseLayer.getViewport(e),r=c._xrSessionManager.session.renderState.baseLayer.framebufferWidth,o=c._xrSessionManager.session.renderState.baseLayer.framebufferHeight,i.viewport.width=n.width/r,i.viewport.height=n.height/o,i.viewport.x=n.x/r,i.viewport.y=n.y/o),i.outputRenderTarget=c._xrSessionManager.getRenderTargetTextureForEye(e.eye)}))},h.prototype._updateNumberOfRigCameras=function(e){for(void 0===e&&(e=1);this.rigCameras.length<e;){var t=new s.a("XR-RigCamera: "+this.rigCameras.length,l.e.Zero(),this.get
1Scene());t.minZ=.1,t.rotationQuaternion=new l.b,t.updateUpVectorFromRotation=!0,t.isRigCamera=!0,t.rigParent=this,t.freezeProjectionMatrix(),this.rigCameras.push(t)}for(;this.rigCameras.length>e;){var i=this.rigCameras.pop();i&&i.dispose()}},h.prototype._updateReferenceSpace=function(){this.position.equals(this._referencedPosition)&&this.rotationQuaternion.equals(this._referenceQuaternion)||(this.position.subtractToRef(this._referencedPosition,this._referencedPosition),this._referenceQuaternion.conjugateInPlace(),this._referenceQuaternion.multiplyToRef(this.rotationQuaternion,this._referenceQuaternion),this._updateReferenceSpaceOffset(this._referencedPosition,this._referenceQuaternion.normalize()))},h.prototype._updateReferenceSpaceOffset=function(e,t,i){var n,r,o,a,s;void 0===i&&(i=!1),this._xrSessionManager.referenceSpace&&this._xrSessionManager.currentFrame&&(this._xrInvPositionCache.copyFrom(e),t?this._xrInvQuaternionCache.copyFrom(t):this._xrInvQuaternionCache.copyFromFloats(0,0,0,1),this._scene.useRightHandedSystem||(this._xrInvPositionCache.z*=-1,this._xrInvQuaternionCache.z*=-1,this._xrInvQuaternionCache.w*=-1),this._xrInvPositionCache.negateInPlace(),this._xrInvQuaternionCache.conjugateInPlace(),this._xrInvPositionCache.rotateByQuaternionToRef(this._xrInvQuaternionCache,this._xrInvPositionCache),i&&(this._xrInvPositionCache.y=0),n=new XRRigidTransform({x:this._xrInvPositionCache.x,y:this._xrInvPositionCache.y,z:this._xrInvPositionCache.z},{x:this._xrInvQuaternionCache.x,y:this._xrInvQuaternionCache.y,z:this._xrInvQuaternionCache.z,w:this._xrInvQuaternionCache.w}),r=this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(n),(o=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(r))&&(a=new l.e(o.transform.position.x,o.transform.position.y,o.transform.position.z),this._scene.useRightHandedSystem||(a.z*=-1),this.position.subtractToRef(a,a),this._scene.useRightHandedSystem||(a.z*=-1),a.negateInPlace(),s=new XRRigidTransform({x:a.x,y:a.y,z:a.z}),this._xrSessionManager.referenceSpace=r.getOffsetReferenceSpace(s)))},h);function h(e,t,i){var n=r.call(this,e,l.e.Zero(),t)||this;return n._xrSessionManager=i,n._firstFrame=!1,n._referenceQuaternion=l.b.Identity(),n._referencedPosition=new l.e,n._xrInvPositionCache=new l.e,n._xrInvQuaternionCache=l.b.Identity(),n.compensateOnFirstFrame=!0,n._rotate180=new l.b(0,1,0,0),n.minZ=.1,n.rotationQuaternion=new l.b,n.cameraRigMode=o.a.RIG_MODE_CUSTOM,n.updateUpVectorFromRotation=!0,n._updateNumberOfRigCameras(1),n._xrSessionManager.onXRSessionInit.add(function(){n._referencedPosition.copyFromFloats(0,0,0),n._referenceQuaternion.copyFromFloats(0,0,0,1),n._firstFrame=n.compensateOnFirstFrame}),n._xrSessionManager.onXRFrameObservable.add(function(e){n._firstFrame&&n._updateFromXRSession(),n._updateReferenceSpace(),n._updateFromXRSession()},void 0,!0),n}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var u=i(1),r=i(6),h=i(275),o=i(88),n=(a.prototype._addAndRemoveControllers=function(e,t){for(var i=this,n=this.controllers.map(function(e){return e.inputSource}),r=0,o=e;r<o.length;r++){var a,s=o[r];-1===n.indexOf(s)&&(a=new h.a(this.xrSessionManager.scene,s,Object(u.a)(Object(u.a)({},this.options.controllerOptions||{}),{forceControllerProfile:this.options.forceInputProfile,doNotLoadControllerMesh:this.options.doNotLoadControllerMeshes,disableMotionControllerAnimation:this.options.disableControllerAnimation})),this.controllers.push(a),this.onControllerAddedObservable.notifyObservers(a))}var c=[],l=[];this.controllers.forEach(function(e){-1===t.indexOf(e.inputSource)?c.push(e):l.push(e)}),this.controllers=c,l.forEach(function(e){i.onControllerRemovedObservable.notifyObservers(e),e.dispose()})},a.prototype.dispose=function(){this.controllers.forEach(function(e){e.dispose()}),this.xrSessionManager.onXRFrameObservable.remove(this._frameObserver),this.xrSessionManager.onXRSessionInit.remove(this._sessionInitObserver),this.xrSessionManager.onXRSessionEnded.remove(this._sessionEndedObserver),this.onControllerAddedObservable.clear(),this.onControllerRemovedObservable.clear()},a);function a(e,t,i){var n=this;void 0===i&&(i={}
1),this.xrSessionManager=e,this.xrCamera=t,this.options=i,this.controllers=[],this.onControllerAddedObservable=new r.c,this.onControllerRemovedObservable=new r.c,this._onInputSourcesChange=function(e){n._addAndRemoveControllers(e.added,e.removed)},this._sessionEndedObserver=this.xrSessionManager.onXRSessionEnded.add(function(){n._addAndRemoveControllers([],n.controllers.map(function(e){return e.inputSource}))}),this._sessionInitObserver=this.xrSessionManager.onXRSessionInit.add(function(e){e.addEventListener("inputsourceschange",n._onInputSourcesChange)}),this._frameObserver=this.xrSessionManager.onXRFrameObservable.add(function(t){n.controllers.forEach(function(e){e.updateFromXRFrame(t,n.xrSessionManager.referenceSpace)})}),this.options.customControllersRepositoryURL&&(o.a.BaseRepositoryUrl=this.options.customControllersRepositoryURL),this.options.disableOnlineControllerRepository?o.a.UseOnlineRepository=!1:(o.a.UseOnlineRepository=!0,o.a.UpdateProfilesList())}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var r=i(6),o=i(28),a=i(0),s=i(88),c=i(13),l=0,n=(Object.defineProperty(u.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),u.prototype.dispose=function(){this.grip&&this.grip.dispose(),this.motionController&&this.motionController.dispose(),this.pointer.dispose(),this.onMotionControllerInitObservable.clear(),this.onMeshLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},u.prototype.getWorldPointerRayToRef=function(e,t){void 0===t&&(t=!1);var i=t&&this.grip?this.grip:this.pointer;a.e.TransformNormalToRef(this._tmpVector,i.getWorldMatrix(),e.direction),e.direction.normalize(),e.origin.copyFrom(i.absolutePosition),e.length=1e3},u.prototype.updateFromXRFrame=function(e,t){var i,n,r,o,a=e.getPose(this.inputSource.targetRaySpace,t);a&&(i=a.transform.position,this.pointer.position.set(i.x,i.y,i.z),n=a.transform.orientation,this.pointer.rotationQuaternion.set(n.x,n.y,n.z,n.w),this._scene.useRightHandedSystem||(this.pointer.position.z*=-1,this.pointer.rotationQuaternion.z*=-1,this.pointer.rotationQuaternion.w*=-1)),this.inputSource.gripSpace&&this.grip&&(r=e.getPose(this.inputSource.gripSpace,t))&&(i=r.transform.position,o=r.transform.orientation,this.grip.position.set(i.x,i.y,i.z),this.grip.rotationQuaternion.set(o.x,o.y,o.z,o.w),this._scene.useRightHandedSystem||(this.grip.position.z*=-1,this.grip.rotationQuaternion.z*=-1,this.grip.rotationQuaternion.w*=-1)),this.motionController&&this.motionController.updateFromXRFrame(e)},u);function u(e,t,i){var n=this;void 0===i&&(i={}),this._scene=e,this.inputSource=t,this._options=i,this._tmpVector=new a.e,this.onDisposeObservable=new r.c,this.onMeshLoadedObservable=new r.c,this.onMotionControllerInitObservable=new r.c,this._uniqueId="controller-"+l+++"-"+t.targetRayMode+"-"+t.handedness,this.pointer=new o.a(this._uniqueId+"-pointer",e),this.pointer.rotationQuaternion=new a.b,this.inputSource.gripSpace&&(this.grip=new o.a(this._uniqueId+"-grip",this._scene),this.grip.rotationQuaternion=new a.b),this._tmpVector.set(0,0,this._scene.useRightHandedSystem?-1:1),this.inputSource.gamepad&&s.a.GetMotionControllerWithXRInput(t,e,this._options.forceControllerProfile).then(function(e){n.motionController=e,n.onMotionControllerInitObservable.notifyObservers(e),n._options.doNotLoadControllerMesh||n.motionController.loadModel().then(function(e){e&&n.motionController&&n.motionController.rootMesh&&(n._options.renderingGroupId&&(n.motionController.rootMesh.renderingGroupId=n._options.renderingGroupId,n.motionController.rootMesh.getChildMeshes(!1).forEach(function(e){return e.renderingGroupId=n._options.renderingGroupId})),n.onMeshLoadedObservable.notifyObservers(n.motionController.rootMesh),n.motionController.rootMesh.parent=n.grip||n.pointer,n.motionController.disableAnimation=!!n._options.disableMotionControllerAnimation)})},function(){c.b.Warn("Could not find a matching motion controller for the registered input source")})}},function(e,t,i){"use strict";i.d(t,"a",function(){return f});var o,n=i(1),r=i(104),a=i(36),s=i(8),c=i(24),l=i(10),u=i(125),h=i(60),d=i(35),p=i(7),f=(o=r.a,Object(n.d)(m,o),m.prototype.dispose=function(){var t=this;
1o.prototype.dispose.call(this),Object.keys(this._touchDots).forEach(function(e){t._touchDots[e].dispose()})},m.prototype._getFilenameAndPath=function(){return{filename:this.layout.assetPath,path:this._repositoryUrl+"/profiles/"+this.profileId+"/"}},m.prototype._getModelLoadingConstraints=function(){var e=a.a.IsPluginForExtensionAvailable(".glb");return e||p.a.Warn("glTF / glb loaded was not registered, using generic controller instead"),e},m.prototype._processLoadedModel=function(e){var a=this;this.getComponentIds().forEach(function(r){var o=a.layout.components[r];a._buttonMeshMapping[r]={mainMesh:a._getChildByName(a.rootMesh,o.rootNodeName),states:{}},Object.keys(o.visualResponses).forEach(function(e){var t,i,n=o.visualResponses[e];"transform"===n.valueNodeProperty?a._buttonMeshMapping[r].states[e]={valueMesh:a._getChildByName(a.rootMesh,n.valueNodeName),minMesh:a._getChildByName(a.rootMesh,n.minNodeName),maxMesh:a._getChildByName(a.rootMesh,n.maxNodeName)}:(t=o.type===u.a.TOUCHPAD_TYPE&&o.touchPointNodeName?o.touchPointNodeName:n.valueNodeName,a._buttonMeshMapping[r].states[e]={valueMesh:a._getChildByName(a.rootMesh,t)},o.type!==u.a.TOUCHPAD_TYPE||a._touchDots[e]||((i=h.a.CreateSphere(e+"dot",{diameter:.0015,segments:8},a.scene)).material=new d.a(e+"mat",a.scene),i.material.diffuseColor=l.a.Red(),i.parent=a._buttonMeshMapping[r].states[e].valueMesh,i.isVisible=!1,a._touchDots[e]=i))})})},m.prototype._setRootMesh=function(e){var t;this.rootMesh=new s.a(this.profileId+"-"+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(var i=0;i<e.length;i++){var n=e[i];n.isPickable=!1,n.parent||(t=n)}t&&t.setParent(this.rootMesh),this.scene.useRightHandedSystem||this.rootMesh.rotate(c.a.Y,Math.PI,c.b.WORLD)},m.prototype._updateModel=function(e){var a=this;this.disableAnimation||this.getComponentIds().forEach(function(e){var n,r,o=a.getComponent(e);o.hasChanges&&(n=a._buttonMeshMapping[e],r=a.layout.components[e],Object.keys(r.visualResponses).forEach(function(e){var t=r.visualResponses[e],i=o.value;"xAxis"===t.componentProperty?i=o.axes.x:"yAxis"===t.componentProperty&&(i=o.axes.y),"transform"===t.valueNodeProperty?a._lerpTransform(n.states[e],i,"button"!==t.componentProperty):(n.states[e].valueMesh.isVisible=o.touched||o.pressed,a._touchDots[e]&&(a._touchDots[e].isVisible=o.touched||o.pressed))}))})},m);function m(e,t,i,n){var r=o.call(this,e,i.layouts[t.handedness||"none"],t.gamepad,t.handedness)||this;return r._repositoryUrl=n,r._buttonMeshMapping={},r._touchDots={},r.profileId=i.profileId,r}},function(e,t,i){"use strict";i.d(t,"a",function(){return _});var n,r=i(1),o=i(56),s=i(0),a=i(10),c=i(24),l=i(35),u=i(79),h=i(120),d=i(45),p=i(66),f=i(87),m=i(47),_=(n=f.a,Object(r.d)(g,n),g.prototype.attach=function(){var t=this;return!!n.prototype.attach.call(this)&&(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,function(e){t._detachController(e.uniqueId)}),this._scene.constantlyUpdateMeshUnderPointer=!0)},g.prototype.detach=function(){var t=this;return!!n.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach(function(e){t._detachController(e)}),!0)},g.prototype.getMeshUnderPointer=function(e){return this._controllers[e]?this._controllers[e].meshUnderPointer:null},g.prototype.getXRControllerByPointerId=function(e){for(var t=Object.keys(this._controllers),i=0;i<t.length;++i)if(this._controllers[t[i]].id===e)return this._controllers[t[i]].xrController;return null},g.prototype._onXRFrame=function(e){var a=this;Object.keys(this._controllers).forEach(function(e){var t=a._controllers[e];t.xrController.getWorldPointerRayToRef(t.tmpRay),t.pick=a._scene.pickWithRay(t.tmpRay,a._scene.pointerMovePredicate||a.raySelectionPredicate);var i,n,r,o=t.pick;o&&o.pickedPoint&&o.hit?(a._updatePointerDistance(t.laserPointer,o.distance),t.selectionMesh.position.copyFrom(o.pickedPoint),t.selectionMesh.scaling.x=Math.sqrt(o.distance),t.selectionMesh.scaling.y=Math.sqrt(o.distance),t.selectionMesh.scaling.z=M
1ath.sqrt(o.distance),i=a._convertNormalToDirectionOfRay(o.getNormal(!0),t.tmpRay),t.selectionMesh.position.copyFrom(o.pickedPoint),i&&(n=s.e.Cross(c.a.Y,i),r=s.e.Cross(i,n),s.e.RotationFromAxisToRef(r,i,n,t.selectionMesh.rotation),t.selectionMesh.position.addInPlace(i.scale(.001))),t.selectionMesh.isVisible=a.displaySelectionMesh,t.meshUnderPointer=o.pickedMesh):(t.selectionMesh.isVisible=!1,t.meshUnderPointer=null)})},g.prototype._attachGazeMode=function(e){var t=this,i=this._controllers[e.uniqueId],n=this._options.timeToSelect||3e3,r=this._options.useUtilityLayer?this._options.customUtilityLayerScene||m.a.DefaultUtilityLayer.utilityLayerScene:this._scene,o=new p.a,a=h.a.CreateTorus("selection",{diameter:.0525,thickness:.015,tessellation:20},r);a.isVisible=!1,a.isPickable=!1,a.parent=i.selectionMesh;var s=0,c=!1;i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add(function(){var e;i.pick&&(i.laserPointer.material.alpha=0,a.isVisible=!1,i.pick.hit?t._pickingMoved(o,i.pick)?(c&&(t._options.disablePointerUpOnTouchOut||t._scene.simulatePointerUp(i.pick,{pointerId:i.id})),c=!1,s=0):(n/10<s&&(a.isVisible=!0),(s+=t._scene.getEngine().getDeltaTime())>=n?(t._scene.simulatePointerDown(i.pick,{pointerId:i.id}),c=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,{pointerId:i.id}),a.isVisible=!1):(e=1-s/n,a.scaling.set(e,e,e))):(c=!1,s=0),t._scene.simulatePointerMove(i.pick,{pointerId:i.id}),o=i.pick)}),void 0!==this._options.renderingGroupId&&(a.renderingGroupId=this._options.renderingGroupId),e.onDisposeObservable.addOnce(function(){i.pick&&!t._options.disablePointerUpOnTouchOut&&c&&t._scene.simulatePointerUp(i.pick,{pointerId:i.id}),a.dispose()})},g.prototype._attachScreenRayMode=function(e){var t=this,i=this._controllers[e.uniqueId],n=!1;i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add(function(){!i.pick||t._options.disablePointerUpOnTouchOut&&n||(n?t._scene.simulatePointerMove(i.pick,{pointerId:i.id}):(t._scene.simulatePointerDown(i.pick,{pointerId:i.id}),n=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,{pointerId:i.id})))}),e.onDisposeObservable.addOnce(function(){i.pick&&n&&!t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,{pointerId:i.id})})},g.prototype._attachTrackedPointerRayMode=function(e){var t,i,n,r=this,o=this._controllers[e.uniqueId];if(this._options.forceGazeMode)return this._attachGazeMode(e);o.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add(function(){o.laserPointer.isVisible=r.displayLaserPointer,o.laserPointer.material.disableLighting=r.disablePointerLighting,o.selectionMesh.material.disableLighting=r.disableSelectionMeshLighting,o.pick&&r._scene.simulatePointerMove(o.pick,{pointerId:o.id})}),e.inputSource.gamepad?(t=function(e){r._options.overrideButtonId&&(o.selectionComponent=e.getComponent(r._options.overrideButtonId)),o.selectionComponent||(o.selectionComponent=e.getMainComponent()),o.onButtonChangedObserver=o.selectionComponent.onButtonStateChangedObservable.add(function(e){var t;e.changes.pressed&&(t=e.changes.pressed.current,o.pick&&(t?(r._scene.simulatePointerDown(o.pick,{pointerId:o.id}),o.selectionMesh.material.emissiveColor=r.selectionMeshPickedColor,o.laserPointer.material.emissiveColor=r.laserPointerPickedColor):(r._scene.simulatePointerUp(o.pick,{pointerId:o.id}),o.selectionMesh.material.emissiveColor=r.selectionMeshDefaultColor,o.laserPointer.material.emissiveColor=r.laserPointerDefaultColor)))})},e.motionController?t(e.motionController):e.onMotionControllerInitObservable.add(t)):(i=function(e){e.inputSource===o.xrController.inputSource&&o.pick&&(r._scene.simulatePointerDown(o.pick,{pointerId:o.id}),o.selectionMesh.material.emissiveColor=r.selectionMeshPickedColor,o.laserPointer.material.emissiveColor=r.laserPointerPickedColor)},n=function(e){e.inputSource===o.xrController.inputSource&&o.pick&&(r._scene.simulatePointerUp(o.pick,{pointerId:o.id}),o.selectionMesh.material.emissiveColor=r.selectionMeshDefaultColor,o.laserPointer.material.emissiveColor=r.laserPointerDefaultColor)},o.eventListeners={selectend:n,selectstart:i},this._xrSessionManager.session.addEventListener("selectstart",i),this._xrSessionManager.session.addEventListener("selectend",n))},g.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(s.e.Dot(e,t.direction))<Math.PI/2&&e.scaleInPlace(-1),e},g.prototype._detachController=function(e){var i=this,n=this._controllers[e];n&&(n.selectionComponent&&n.onButtonChangedObserver&&n.selectionComponent.onButtonStateChangedObservable.remove(n.onButtonChangedObserver),n.onFrameObserver&&this._xrSessionManager.onXRFrameObservable.remove(n.onFrameObserver),n.eventListeners&&Object.keys(n.eventListeners).forEac
1h(function(e){var t=n.eventListeners&&n.eventListeners[e];t&&i._xrSessionManager.session.removeEventListener(e,t)}),n.selectionMesh.dispose(),n.laserPointer.dispose(),delete this._controllers[e])},g.prototype._generateNewMeshPair=function(e){var t=this._options.useUtilityLayer?this._options.customUtilityLayerScene||m.a.DefaultUtilityLayer.utilityLayerScene:this._scene,i=u.a.CreateCylinder("laserPointer",{height:1,diameterTop:2e-4,diameterBottom:.004,tessellation:20,subdivisions:1},t);i.parent=e.pointer;var n=new l.a("laserPointerMat",t);n.emissiveColor=this.laserPointerDefaultColor,n.alpha=.7,i.material=n,i.rotation.x=Math.PI/2,this._updatePointerDistance(i,1),i.isPickable=!1;var r=h.a.CreateTorus("gazeTracker",{diameter:.0105,thickness:.0075,tessellation:20},t);r.bakeCurrentTransformIntoVertices(),r.isPickable=!1,r.isVisible=!1;var o=new l.a("targetMat",t);return o.specularColor=a.a.Black(),o.emissiveColor=this.selectionMeshDefaultColor,o.backFaceCulling=!1,r.material=o,void 0!==this._options.renderingGroupId&&(i.renderingGroupId=this._options.renderingGroupId,r.renderingGroupId=this._options.renderingGroupId),{laserPointer:i,selectionMesh:r}},g.prototype._pickingMoved=function(e,t){var i;if(!e.hit||!t.hit)return!0;if(!(e.pickedMesh&&e.pickedPoint&&t.pickedMesh&&t.pickedPoint))return!0;if(e.pickedMesh!==t.pickedMesh)return!0;null===(i=e.pickedPoint)||void 0===i||i.subtractToRef(t.pickedPoint,this._tmpVectorForPickCompare),this._tmpVectorForPickCompare.set(Math.abs(this._tmpVectorForPickCompare.x),Math.abs(this._tmpVectorForPickCompare.y),Math.abs(this._tmpVectorForPickCompare.z));var n=.01*(this._options.gazeModePointerMovedFactor||1)*t.distance,r=this._tmpVectorForPickCompare.length();return console.log(n,r,t.distance),n<r},g.prototype._updatePointerDistance=function(e,t){void 0===t&&(t=100),e.scaling.y=t,this._scene.useRightHandedSystem&&(t*=-1),e.position.z=t/2+.05},Object.defineProperty(g.prototype,"lasterPointerDefaultColor",{get:function(){return this.laserPointerDefaultColor},enumerable:!1,configurable:!0}),g._idCounter=0,g.Name=o.a.POINTER_SELECTION,g.Version=1,g);function g(e,t){var r=n.call(this,e)||this;return r._options=t,r._attachController=function(e){if(!r._controllers[e.uniqueId]){var t=r._generateNewMeshPair(e),i=t.laserPointer,n=t.selectionMesh;switch(r._controllers[e.uniqueId]={xrController:e,laserPointer:i,selectionMesh:n,meshUnderPointer:null,pick:null,tmpRay:new d.a(new s.e,new s.e),id:g._idCounter++},e.inputSource.targetRayMode){case"tracked-pointer":return r._attachTrackedPointerRayMode(e);case"gaze":return r._attachGazeMode(e);case"screen":return r._attachScreenRayMode(e)}}},r._controllers={},r._tmpVectorForPickCompare=new s.e,r.disablePointerLighting=!0,r.disableSelectionMeshLighting=!0,r.displayLaserPointer=!0,r.displaySelectionMesh=!0,r.laserPointerPickedColor=new a.a(.9,.9,.9),r.laserPointerDefaultColor=new a.a(.7,.7,.7),r.selectionMeshDefaultColor=new a.a(.8,.8,.8),r.selectionMeshPickedColor=new a.a(.3,.3,1),r._scene=r._xrSessionManager.scene,r}o.b.AddWebXRFeature(_.Name,function(e,t){return function(){return new _(e,t)}},_.Version,!0)},function(e,t,i){"use strict";i.d(t,"b",function(){return h}),i.d(t,"c",function(){return n}),i.d(t,"a",function(){return r});var s=i(1),l=i(6),c=i(73),u=i(13),h=(o.prototype.update=function(e){},o),n=function(){},r=(d.CreateAsync=function(e,r,o){var t=this,a=new d(e,o),i=a._buttons.map(function(e){return r.sessionManager.isSessionSupportedAsync(e.sessionMode)});return r.onStateChangedObservable.add(function(e){e==c.a.NOT_IN_XR&&a._updateButtons(null)}),Promise.all(i).then(function(e){return e.forEach(function(e,n){e?(a._overlay.appendChild(a._buttons[n].element),a._buttons[n].element.onclick=function(){return Object(s.b)(t,void 0,void 0,function(){var t,i;return Object(s.e)(this,function(e){switch(e.label){case 0:return r.state!=c.a.IN_XR?[3,2]:[4,r.exitXRAsync()];case 1:return e.sent(),a._updateButtons(null),[3,6];case 2:if(r.state!=c.a.NOT_IN_XR)return[3,6];if(!o.renderTarget)return[3,6];e.label=3;case 3:return e.trys.push([3,5,,6]),[4,r.enterXRAsync(a._buttons[n].sessionMode,a._buttons[n].referenceSpaceType,o.renderTarget,{optionalFeatures:o.optionalFeatures,requiredFeatures:o.requiredFeatures})];case 4:return e.sent(),a._updateButtons(a._buttons[n]),[3,6];case 5:return e.sent(),a._updateButtons(null),t=a._buttons[n].element,i=t.title,t.title="Error entering XR session : "+i,t.classList.add("xr-error"),[3,6];case 6:return[2]}})})}):u.b.Warn('Session mode "'+a._buttons[n].sessionMode+'" not supported in browser')}),a})},d.prototype.dispose=function(){var e=this.scene.getEngine().getInputElement();e&&e.parentNode&&e.parentNode.contains(this._overlay)&&e.parentNode.removeChild(this._overlay),this.activeButtonChangedObservable.clear()},d.prototype._updateButtons=function(e){var t=this;this._activeButton=e,this._buttons.forEach(function(e){e.update(t._activeButton)}),this.activeButtonChangedObservable.notifyObservers(this._activeButton)},d);function d(e,t){var i,n,r,o,a,s=this;this.scene=e,this.options=t,this._activeButton=null,this._buttons=[],this.activeButtonChangedObservable=new l.c,this._overlay=document.createElement("div"),this._overlay.style.cssText="z-index:11;position: absolute; right: 20px;bottom: 50px;","undefined"!=typeof window&&window.location&&"http:"===window.location.protocol&&u.b.Warn("WebXR can only be served over HTTPS"),t.customButtons?this._buttons=t.customButtons:(i=t.sessionMode||"immersive-vr",n=t.referenceSpaceType||"local-floor",r=".babylonVRicon { color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"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
1%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":"https://cdn.babylonjs.com/Assets/vrButton.png")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }",r+='.babylonVRicon.vrdisplaypresenting { background-image: none;} .vrdisplaypresenting::after { content: "EXIT"} .xr-error::after { content: "ERROR"}',(o=document.createElement("style")).appendChild(document.createTextNode(r)),document.getElementsByTagName("head")[0].appendChild(o),(a=document.createElement("button")).className="babylonVRicon",a.title=i+" - "+n,this._buttons.push(new h(a,i,n)),this._buttons[this._buttons.length-1].update=function(e){this.element.style.display=null===e||e===this?"":"none",a.className="babylonVRicon"+(e===this?" vrdisplaypresenting":"")},this._updateButtons(null));var c=e.getEngine().getInputElement();c&&c.parentNode&&(c.parentNode.appendChild(this._overlay),e.onDisposeObservable.addOnce(function(){s.dispose()}))}function o(e,t,i){this.element=e,this.sessionMode=t,this.referenceSpaceType=i}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var l,n=i(1),r=i(6),u=i(13),o=i(7),h=i(9),a=(i(228),i(202),l=h.a,Object(n.d)(s,l),Object.defineProperty(s.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new r.c),this._onUserActionRequestedObservable},enumerable:!1,configurable:!0}),s.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e},s.prototype._getVideo=function(e){if(e instanceof HTMLVideoElement)return u.b.SetCorsBehavior(e.currentSrc,e),e;var i=document.createElement("video");return"string"==typeof e?(u.b.SetCorsBehavior(e,i),i.src=e):(u.b.SetCorsBehavior(e[0],i),e.forEach(function(e){var t=document.createElement("source");t.src=e,i.appendChild(t)})),i},s.prototype._rebuild=function(){this.update()},s.prototype.update=function(){this.autoUpdateTexture&&this.updateTexture(!0)},s.prototype.updateTexture=function(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))},s.prototype.updateURL=function(e){this.video.src=e,this._currentSrc=e},s.prototype.clone=function(){return new s(this.name,this._currentSrc,this.getScene(),this._generateMipMaps,this.invertY,this.samplingMode,this._settings)},s.prototype.dispose=function(){l.prototype.dispose.call(this),this._currentSrc=null,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()},s.CreateFromStreamAsync=function(i,e){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=e:"object"==typeof n.srcObject?n.srcObject=e:(window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,n.src=window.URL&&window.URL.createObjectURL(e)),new Promise(function(e){var t=function(){e(new s("video",n,i,!0,!0)),n.removeEventListener("playing",t)};n.addEventListener("playing",t),n.play()})}
1,s.CreateFromWebCamAsync=function(t,e,i){var n,r=this;return void 0===i&&(i=!1),e&&e.deviceId&&(n={exact:e.deviceId}),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({video:e,audio:i}).then(function(e){return r.CreateFromStreamAsync(t,e)}):(navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia&&navigator.getUserMedia({video:{deviceId:n,width:{min:e&&e.minWidth||256,max:e&&e.maxWidth||640},height:{min:e&&e.minHeight||256,max:e&&e.maxHeight||480}},audio:i},function(e){return r.CreateFromStreamAsync(t,e)},function(e){o.a.Error(e.name)}),Promise.reject("No support for userMedia on this device"))},s.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){o.a.Error(e.name)})},s);function s(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=h.a.TRILINEAR_SAMPLINGMODE),void 0===a&&(a={autoPlay:!0,loop:!0,autoUpdateTexture:!0});var s=l.call(this,null,i,!n,r)||this;s._onUserActionRequestedObservable=null,s._stillImageCaptured=!1,s._displayingPosterTexture=!1,s._frameId=-1,s._currentSrc=null,s._createInternalTexture=function(){if(null!=s._texture){if(!s._displayingPosterTexture)return;s._texture.dispose(),s._displayingPosterTexture=!1}var e,t,i,n;!s._getEngine().needPOTTextures||u.b.IsExponentOfTwo(s.video.videoWidth)&&u.b.IsExponentOfTwo(s.video.videoHeight)?(s.wrapU=h.a.WRAP_ADDRESSMODE,s.wrapV=h.a.WRAP_ADDRESSMODE):(s.wrapU=h.a.CLAMP_ADDRESSMODE,s.wrapV=h.a.CLAMP_ADDRESSMODE,s._generateMipMaps=!1),s._texture=s._getEngine().createDynamicTexture(s.video.videoWidth,s.video.videoHeight,s._generateMipMaps,s.samplingMode),s.video.autoplay||s._settings.poster?(s._texture.isReady=!0,s._updateInternalTexture(),s.onLoadObservable.hasObservers()&&s.onLoadObservable.notifyObservers(s)):(e=s.video.onplaying,t=!1,i=s.video.muted,s.video.muted=!0,s.video.onplaying=function(){s.video.muted=i,s.video.onplaying=e,s._texture.isReady=!0,s._updateInternalTexture(),t||s.video.pause(),s.onLoadObservable.hasObservers()&&s.onLoadObservable.notifyObservers(s)},(n=s.video.play())?n.then(function(){}).catch(function(){t=!0,s._onUserActionRequestedObservable&&s._onUserActionRequestedObservable.hasObservers()&&s._onUserActionRequestedObservable.notifyObservers(s)}):(s.video.onplaying=e,s._texture.isReady=!0,s._updateInternalTexture(),s.onLoadObservable.hasObservers()&&s.onLoadObservable.notifyObservers(s)))},s.reset=function(){null!=s._texture&&(s._displayingPosterTexture||(s._texture.dispose(),s._texture=null))},s._updateInternalTexture=function(){var e;null!=s._texture&&s._texture.isReady&&!(s.video.readyState<s.video.HAVE_CURRENT_DATA||s._displayingPosterTexture)&&(e=s.getScene().getFrameId(),s._frameId!==e&&(s._frameId=e,s._getEngine().updateVideoTexture(s._texture,s.video,s._invertY)))},s._generateMipMaps=n,s._initialSamplingMode=o,s.autoUpdateTexture=a.autoUpdateTexture,s._currentSrc=t,s.name=e||s._getName(t),s.video=s._getVideo(t),(s._settings=a).poster&&(s.video.poster=a.poster),void 0!==a.autoPlay&&(s.video.autoplay=a.autoPlay),void 0!==a.loop&&(s.video.loop=a.loop),s.video.setAttribute("playsinline",""),s.video.addEventListener("paused",s._updateInternalTexture),s.video.addEventListener("seeked",s._updateInternalTexture),s.video.addEventListener("emptied",s.reset),s._createInternalTextureOnEvent=a.poster&&!a.autoPlay?"play":"canplay",s.video.addEventListener(s._createInternalTextureOnEvent,s._createInternalTexture);var c=s.video.readyState>=s.video.HAVE_CURRENT_DATA;return!a.poster||a.autoPlay&&c?c&&s._createInternalTexture():(s._texture=s._getEngine().createTexture(a.poster,!1,!s.invertY,i),s._displayingPosterTexture=!0),s}},function(e,t,i){"use strict";i.d(t,"a",function(){return v});var r=i(1),a=i(3),s=i(0),n=i(4),c=i(9),l=i(39),o=i(29),u=i(61),h=i(138),d=i(42),p=i(2),f=i(11),m=i(12),_=i(10);i(349),i(350),i(317),d.a.prototype.getGlowLayerByName=function(e){for(var t=0;t<this.effectLayers.length;t++)if(this.effectLayers[t].name===e&&this.effectLayers[t].getEffectName()===v.EffectName)return this.effectLayers[t];return null};var g,v=(g=h.a,Object(r.d)(b,g),Object.defineProperty(b.prototype,"blurKernelSize",{get:function(){return this._horizontalBlurPostprocess1.kernel},set:function(e){this._horizontalBlurPostprocess1.kernel=e,this._verticalBlurPostprocess1.kernel=e,this._horizontalBlurPostprocess2.kernel=e,this._verticalBlurPostprocess2.kernel=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!1,configurable:!0}),b.prototype.getEffectName=function(){return b.EffectName},b.prototype._createMergeEffect=function(){return this._engine.createEffect("glowMapMerge",[n.b.PositionKind],["offset"],["textureSampler","textureSampler2"],"#define EMISSIVE \n")},b.prototype._createTextureAndPostProcesses=function(){var i=this,e=this._mainTextureDesiredSize.width,t=this._mainTextureDesiredSize.height,e=this._engine.needPOTTextures?m.a.GetExponentOfTwo(e,this._maxSize):e,t=this._engine.needPOTTextures?m.a.GetExponentOfTwo(t,this._maxSize):t,n=this._engine.getCaps().textureHalfFloatRender?p.a.TEXTURETYPE_HALF_FLOAT:p.a.TEXTURETYPE_UNSIGNED_INT;this._blurTexture1=new l.a("GlowLayerBlurRTT",{width:e,height:t},this._scene,!1,!0,n),this._blurTexture1.wrapU=c.a.CLAMP_ADDRESSMODE,this._blurTexture1.wrapV=c.a.CLAMP_ADDRESSMODE,this._blurTexture1.updateSamplingMode(c.a.BILINEAR_SAMPLINGMODE),this._blurTexture1.renderParticles=!1,this._blurTexture1.ignoreCameraViewport=!0;var r=Math.floor(e/2),o=Math.floor(t/2);this._blurTexture2=new l.a("GlowLayerBlurRTT2",{width:r,height:o},this._scene,!1,!0,n),this._blurTexture2.wrapU=c.a.CLAMP_ADDRESSMODE,this._blurTexture2.wrapV=c.a.CLAMP_ADDRESSMODE,this._blurTexture2.updateSamplingMode(c.a.BILINEAR_SAMPLINGMODE),this._blurTexture2.renderParticles=!1,this._blurTexture2.ignoreCameraViewport=!0,this._textures=[this._blurTexture1,this._blurTexture2],this._horizontalBlurPostprocess1=new u.a("GlowLayerHBP1",new s.d(1,0),this._options.blurKernelSize/2,{width:e,height:t},null,c.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess1.width=e,this._horizontalBlurPostprocess1.height=t,this._horizontalBlurPostprocess1.onApplyObservable.add(function(e){e.setTexture("textureSampler",i._mainTexture)}),this._verticalBlurPostprocess1=new u.a("GlowLayerVBP1",new s.d(0,1),this._options.blurKernelSize/2,{width:e,height:t},null,c.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess2=new u.a("GlowLayerHBP2",new s.d(1,0),this._options.blurKernelSize/2,{width:r,height:o},null,c.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess2.width=r,this._horizontalBlurPostprocess2.height=o,this._horizontalBlurPostprocess2.onApplyObservable.add(function(e){e.setTexture("textureSampler",i._blurTexture1)}),this._verticalBlurPostprocess2=new u.a("GlowLayerVBP2",new s.d(0,1),this._options.blurKernelSize/2,{width:r,height:o},null,c.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._postProcesses=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1,this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._postProcesses1=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1],this._postProcesses2=[this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._mainTexture.samples=this._options.mainTextureSamples,this._mainTexture.onAfterUnbindObservable.add(function(){var e,t=i._blurTexture1.getInternalTexture();t&&(i._scene.postProcessManager.directRender(i._postProcesses1,t,!0),(e=i._blurTexture2.getInternalTexture())&&i._scene.postProcessManager.directRender(i._postProcesses2,e,!0),i._engine.unBindFramebuffer(null!=e?e:t,!0))}),this._postProcesses.map(function(e){e.autoClear=!1})},b.prototype.isReady=function(e,t){var i=e.getMaterial(),n=e.getRenderingMesh();if(!i||!n)return!1;var r=i.emissiveTexture;return g.prototype._isReady.call(this,e,t,r)},b.prototype.needStencil=function(){return!1},b.prototype._canRenderMesh=function(e,t){return!0},b.prototype._internalRender=function(e){e.setTexture("textureSampler",this._blurTexture1),e.setTexture("textureSampler2",this._blurTexture2),e.setFloat("offset",this._intensity);var t=this._engine,i=t.getStencilBuffer();t.setStencilBuffer(!1),t.drawElementsType(o.a.TriangleFillMode,0,6),t.setStencilBuffer(i)},b.prototype._setEmissiveTextureAndColor=function(e,t,i){var n=1;this.customEmissiveTextureSelector?this._emissiveTextureAndColor.texture=this.customEmissiveTextureSelector(e,t,i):i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.texture&&(n=this._emissiveTextureAndColor.texture.level)):this._emissiveTextureAndColor.texture=null,this.customEmissiveColorSelector?this.customEmissiveColorSelector(e,t,i,this._emissiveTextureAndColor.color):i.emissiveColor?this._emissiveTextureAndColor.color.set(i.emissiveColor.r*n,i.emissiveColor.g*n,i.emissiveColor.b*n,i.alpha):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a)},b.prototype._shouldRenderMesh=function(e){return this.hasMesh(e)},b.prototype._addCustomEffectDefines=function(e){e.push("#define GLOW")},b.prototype.addExcludedMesh=function(e){-1===this._excludedMeshes.indexOf(e.uniqueId)&&this._excludedMeshes.push(e.uniqueId)},b.prototype.removeExcludedMesh=function(e){var t=this._excludedMeshes.indexOf(e.uniqueId);-1!==t&&this._excludedMeshes.splice(t,1)},b.prototype.addIncludedOnlyMesh=function(e){-1===this._includedOnlyMeshes.indexOf(e.uniqueId)&&this._includedOnlyMeshes.push(e.uniqueId)},b.prototype.removeIncludedOnlyMesh=function(e){var t=this._includedOnlyMeshes.indexOf(e.uniqueId);-1!==t&&this._includedOnlyMeshes.splice(t,1)},b.prototype.hasMesh=function(e){return!!g.prototype.hasMesh.call(this,e)&&(this._includedOnlyMeshes.length?-1!==this._includedOnlyMeshes.indexOf(e.uniqueId):!this._excludedMeshes.length||-1===this._excludedMeshes.indexOf(e.uniqueId))},b.prototype._useMeshMaterial=function(e){return 0!=this._meshesUsingTheirOwnMaterials.length&&-1<this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId)},b.prototype.referenceMeshToUseItsOwnMaterial=function(e){this._meshesUsingTheirOwnMaterials.push(e.uniqueId)},b.prototype.unReferenceMeshFromUsingItsOwnMaterial=function(e){for(var t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);0<=t;)this._meshesUsingTheirOwnMaterials.splice(t,1),t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId)},b.prototype._disposeMesh=function(e){this.removeIncludedOnlyMesh(e),this.removeExcludedMesh(e)},b.prototype.getClassName=function(){return"GlowLayer"},b.prototype.serialize=function(){var e,t,i=a.a.Serialize(this);if(i.customType="BABYLON.GlowLayer",i.includedMeshes=[],this._includedOnlyMeshes.length)for(e=0;e<this._includedOnlyMeshes.length;e++)(t=this._scene.getMeshByUniqueID(this._includedOnlyMeshes[e]))&&i.includedMeshes.push(t.id);if(i.excludedMeshes=[],this._excludedMeshes.length)for(e=0;e<this._excludedMeshes.length;e++)(t=this._scene.getMeshByUniqueID(this._excludedMeshes[e]))&&i.excludedMeshes.push(t.id);return i},b.Parse=function(e,t,i){for(var n,r=a.a.Parse(function(){return new b(e.name,t,e.options)},e,t,i),o=0;o<e.excludedMeshes.length;
1o++)(n=t.getMeshByID(e.excludedMeshes[o]))&&r.addExcludedMesh(n);for(o=0;o<e.includedMeshes.length;o++)(n=t.getMeshByID(e.includedMeshes[o]))&&r.addIncludedOnlyMesh(n);return r},b.EffectName="GlowLayer",b.DefaultBlurKernelSize=32,b.DefaultTextureRatio=.5,Object(r.c)([Object(a.c)()],b.prototype,"blurKernelSize",null),Object(r.c)([Object(a.c)()],b.prototype,"intensity",null),Object(r.c)([Object(a.c)("options")],b.prototype,"_options",void 0),b);function b(e,t,i){var n=g.call(this,e,t)||this;return n._intensity=1,n._includedOnlyMeshes=[],n._excludedMeshes=[],n._meshesUsingTheirOwnMaterials=[],n.neutralColor=new _.b(0,0,0,1),n._options=Object(r.a)({mainTextureRatio:b.DefaultTextureRatio,blurKernelSize:32,mainTextureFixedSize:void 0,camera:null,mainTextureSamples:1,renderingGroupId:-1},i),n._init({alphaBlendingMode:p.a.ALPHA_ADD,camera:n._options.camera,mainTextureFixedSize:n._options.mainTextureFixedSize,mainTextureRatio:n._options.mainTextureRatio,renderingGroupId:n._options.renderingGroupId}),n}f.a.RegisteredTypes["BABYLON.GlowLayer"]=v},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var r,n=i(1),o=i(2),a=i(172),s=(r=i(299).a,Object(n.d)(c,r),Object.defineProperty(c.prototype,"depthRenderer",{get:function(){return this._depthRenderer},enumerable:!1,configurable:!0}),c.prototype.setDepthRenderer=function(e,t,i){void 0===e&&(e=null),void 0===t&&(t=o.a.TEXTURETYPE_HALF_FLOAT),void 0===i&&(i=!0);var n=this._camera.getScene();this._depthRenderer&&(delete n._depthRenderer[this._depthRendererId],this._depthRenderer.dispose(),this._depthRenderer=null),null===e&&(n._depthRenderer||(n._depthRenderer={}),(e=this._depthRenderer=new a.a(n,t,this._camera,!1)).enabled=!1,this._depthRendererId="minmax"+this._camera.id,n._depthRenderer[this._depthRendererId]=e),r.prototype.setSourceTexture.call(this,e.getDepthMap(),!0,t,i)},c.prototype.setSourceTexture=function(e,t,i,n){void 0===i&&(i=o.a.TEXTURETYPE_HALF_FLOAT),void 0===n&&(n=!0),r.prototype.setSourceTexture.call(this,e,t,i,n)},c.prototype.activate=function(){this._depthRenderer&&(this._depthRenderer.enabled=!0),r.prototype.activate.call(this)},c.prototype.deactivate=function(){r.prototype.deactivate.call(this),this._depthRenderer&&(this._depthRenderer.enabled=!1)},c.prototype.dispose=function(e){var t;void 0===e&&(e=!0),r.prototype.dispose.call(this,e),this._depthRenderer&&e&&((t=this._depthRenderer.getDepthMap().getScene())&&delete t._depthRenderer[this._depthRendererId],this._depthRenderer.dispose(),this._depthRenderer=null)},c);function c(e){return r.call(this,e)||this}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(1),r=i(3),o=i(0),a=i(30),s=i(63),c=i(149);a.a.AddNodeConstructor("Light_Type_0",function(e,t){return function(){return new u(e,o.e.Zero(),t)}});var l,u=(l=c.a,Object(n.d)(h,l),Object.defineProperty(h.prototype,"shadowAngle",{get:function(){return this._shadowAngle},set:function(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"direction",{get:function(){return this._direction},set:function(e){var t=this.needCube();this._direction=e,this.needCube()!==t&&this._shadowGenerator&&this._shadowGenerator.recreateShadowMap()},enumerable:!1,configurable:!0}),h.prototype.getClassName=function(){return"PointLight"},h.prototype.getTypeID=function(){return s.a.LIGHTTYPEID_POINTLIGHT},h.prototype.needCube=function(){return!this.direction},h.prototype.getShadowDirection=function(e){if(this.direction)return l.prototype.getShadowDirection.call(this,e);switch(e){case 0:return new o.e(1,0,0);case 1:return new o.e(-1,0,0);case 2:return new o.e(0,-1,0);case 3:return new o.e(0,1,0);case 4:return new o.e(0,0,1);case 5:return new o.e(0,0,-1)}return o.e.Zero()},h.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;n&&o.a.PerspectiveFovLHToRef(this.shadowAngle,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)},h.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},h.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this},h.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z):e.setFloat3(t,this.position.x,this.position.y,this.position.z),this},h.prototype.prepareLightSpecificDefines=function(e,t){e["POINTLIGHT"+t]=!0},Object(n.c)([Object(r.c)()],h.prototype,"shadowAngle",null),h);function h(e,t,i){var n=l.call(this,e,i)||this;return n._shadowAngle=Math.PI/2,n.position=t,n}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var o=i(186),n=(r.Ldexp=function(e,t){return 1023<t?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)},r.Rgbe2float=function(e,t,i,n,r,o){0<r?(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)},r.readStringLine=function(e,t){for(var i="",n="",r=t;r<e.length-t&&"\n"!=(n=String.fromCharCode(e[r]));r++)i+=n;return i},r.RGBE_ReadHeader=function(e){var t,i,n=this.readStringLine(e,0);if("#"!=n[0]||"?"!=n[1])throw"Bad HDR Format.";for(var r=!1,o=!1,a=0;a+=n.length+1,"FORMAT=32-bit_rle_rgbe"==(n=this.readStringLine(e,a))?o=!0:0==n.length&&(r=!0),!r;);if(!o)throw"HDR Bad header format, unsupported FORMAT";a+=n.length+1,n=this.readStringLine(e,a);var s=/^\-Y (.*) \+X (.*)$/g.exec(n);if(!s||s.length<3)throw"HDR Bad header format, no size";if(i=parseInt(s[2]),t=parseInt(s[1]),i<8||32767<i)throw"HDR Bad header format, unsupported size";return{height:t,width:i,dataPosition:a+=n.length+1}},r.GetCubeMapTextureData=function(e,t){var i=new Uint8Array(e),n=this.RGBE_ReadHeader(i),r=this.RGBE_ReadPixels(i,n);return o.a.ConvertPanoramaToCubemap(r,n.width,n.height,t)},r.RGBE_ReadPixels=function(e,t){return this.RGBE_ReadPixels_RLE(e,t)},r.RGBE_ReadPixels_RLE=function(e,t){for(var i,n,r,o,a,s=t.height,c=t.
1width,l=t.dataPosition,u=0,h=0,d=0,p=new ArrayBuffer(4*c),f=new Uint8Array(p),m=new ArrayBuffer(t.width*t.height*4*3),_=new Float32Array(m);0<s;){if(i=e[l++],n=e[l++],r=e[l++],o=e[l++],2!=i||2!=n||128&r||t.width<8||32767<t.width)return this.RGBE_ReadPixels_NOT_RLE(e,t);if((r<<8|o)!=c)throw"HDR Bad header format, wrong scan line width";for(d=u=0;d<4;d++)for(h=(d+1)*c;u<h;)if(i=e[l++],n=e[l++],128<i){if(0==(a=i-128)||h-u<a)throw"HDR Bad Format, bad scanline data (run)";for(;0<a--;)f[u++]=n}else{if(0==(a=i)||h-u<a)throw"HDR Bad Format, bad scanline data (non-run)";if(f[u++]=n,0<--a)for(var g=0;g<a;g++)f[u++]=e[l++]}for(d=0;d<c;d++)i=f[d],n=f[d+c],r=f[d+2*c],o=f[d+3*c],this.Rgbe2float(_,i,n,r,o,(t.height-s)*c*3+3*d);s--}return _},r.RGBE_ReadPixels_NOT_RLE=function(e,t){for(var i,n,r,o,a,s=t.height,c=t.width,l=t.dataPosition,u=new ArrayBuffer(t.width*t.height*4*3),h=new Float32Array(u);0<s;){for(a=0;a<t.width;a++)i=e[l++],n=e[l++],r=e[l++],o=e[l++],this.Rgbe2float(h,i,n,r,o,(t.height-s)*c*3+3*a);s--}return h},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(1),r=i(6),o=i(22),a=i(4),s=i(3),c=i(11),l=(Object.defineProperty(u.prototype,"influence",{get:function(){return this._influence},set:function(e){var t;this._influence!==e&&(t=this._influence,this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!1,configurable:!0}),u.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},u.prototype.getPositions=function(){return this._positions},u.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},u.prototype.getNormals=function(){return this._normals},u.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},u.prototype.getTangents=function(){return this._tangents},u.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},u.prototype.getUVs=function(){return this._uvs},u.prototype.clone=function(){var e=this,t=s.a.Clone(function(){return new u(e.name,e.influence,e._scene)},this);return t._positions=this._positions,t._normals=this._normals,t._tangents=this._tangents,t._uvs=this._uvs,t},u.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&&
1(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),s.a.AppendSerializedAnimations(this,e),e},u.prototype.getClassName=function(){return"MorphTarget"},u.Parse=function(e){var t=new u(e.name,e.influence);if(t.setPositions(e.positions),null!=e.id&&(t.id=e.id),e.normals&&t.setNormals(e.normals),e.tangents&&t.setTangents(e.tangents),e.uvs&&t.setUVs(e.uvs),e.animations)for(var i=0;i<e.animations.length;i++){var n=e.animations[i],r=c.a.GetClass("BABYLON.Animation");r&&t.animations.push(r.Parse(n))}return t},u.FromMesh=function(e,t,i){var n=new u(t=t||e.name,i,e.getScene());return n.setPositions(e.getVerticesData(a.b.PositionKind)),e.isVerticesDataPresent(a.b.NormalKind)&&n.setNormals(e.getVerticesData(a.b.NormalKind)),e.isVerticesDataPresent(a.b.TangentKind)&&n.setTangents(e.getVerticesData(a.b.TangentKind)),e.isVerticesDataPresent(a.b.UVKind)&&n.setUVs(e.getVerticesData(a.b.UVKind)),n},Object(n.c)([Object(s.c)()],u.prototype,"id",void 0),u);function u(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uniqueId=0,this.onInfluenceChanged=new r.c,this._onDataLayoutChanged=new r.c,this._animationPropertiesOverride=null,this._scene=i||o.a.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var P=i(7),x=i(0),R=i(4),O=i(34),a=i(59),n=i(126),r=i(195),o=(s.prototype.setGravity=function(e){this.world.gravity.set(e.x,e.y,e.z)},s.prototype.setTimeStep=function(e){this._fixedTimeStep=e},s.prototype.getTimeStep=function(){return this._fixedTimeStep},s.prototype.executeStep=function(e,t){if(this._firstFrame){this._firstFrame=!1;for(var i=0,n=t;i<n.length;i++){var r=n[i];r.type!=O.a.HeightmapImpostor&&r.type!==O.a.PlaneImpostor&&r.beforeStep()}}this.world.step(this._useDeltaForWorldStep?e:this._fixedTimeStep),this._removeMarkedPhysicsBodiesFromWorld()},s.prototype._removeMarkedPhysicsBodiesFromWorld=function(){var t=this;0<this._physicsBodysToRemoveAfterStep.length&&(this._physicsBodysToRemoveAfterStep.forEach(function(e){t.world.remove(e)}),this._physicsBodysToRemoveAfterStep=[])},s.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)},s.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)},s.prototype.generatePhysicsBody=function(i){if(this._removeMarkedPhysicsBodiesFromWorld(),i.parent)i.physicsBody&&(this.removePhysicsBody(i),i.forceUpdate());else{if(i.isBodyInitRequired()){var e=this._createShape(i),n=i.physicsBody;n&&this.removePhysicsBody(i);var t=this._addMaterial("mat-"+i.uniqueId,i.getParam("friction"),i.getParam("restitution")),r={mass:i.getParam("mass"),material:t},o=i.getParam("nativeOptions");for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a]);i.physicsBody=new this.BJSCANNON.Body(r),i.physicsBody.addEventListener("collide",i.onCollide),this.world.addEventListener("preStep",i.beforeStep),this.world.addEventListener("postStep",i.afterStep),i.physicsBody.addShape(e),this.world.add(i.physicsBody),n&&["force","torque","velocity","angularVelocity"].forEach(function(e){var t=n[e];i.physicsBody[e].set(t.x,t.y,t.z)}),this._processChildMeshes(i)}this._updatePhysicsBodyTransformation(i)}},s.prototype._processChildMeshes=function(o){var a,s=this,e=o.object.getChildMeshes?o.object.getChildMeshes(!0):[],c=o.object.rotationQuaternion;e.length&&(a=function(e,t){var i,n,r;c&&t.rotationQuaternion&&((i=t.getPhysicsImpostor())&&i.parent!==o&&(n=t.position.clone(),r=t.rotationQuaternion.multiply(x.b.Inverse(c)),i.physicsBody&&(s.removePhysicsBody(i),i.physicsBody=null),i.parent=o,i.resetUpdateFlags(),o.physicsBody.addShape(s._createShape(i),new s.BJSCANNON.Vec3(n.x,n.y,n.z),new s.BJSCANNON.Quaternion(r.x,r.y,r.z,r.w)),o.physicsBody.mass+=i.getParam("mass")),c.multiplyInPlace(t.rotationQuaternion),t.getChildMeshes(!0).filter(function(e){return!!e.physicsImpostor}
1).forEach(a.bind(s,t.getAbsolutePosition())))},e.filter(function(e){return!!e.physicsImpostor}).forEach(a.bind(this,o.object.getAbsolutePosition())))},s.prototype.removePhysicsBody=function(e){e.physicsBody.removeEventListener("collide",e.onCollide),this.world.removeEventListener("preStep",e.beforeStep),this.world.removeEventListener("postStep",e.afterStep),-1===this._physicsBodysToRemoveAfterStep.indexOf(e.physicsBody)&&this._physicsBodysToRemoveAfterStep.push(e.physicsBody)},s.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n=e.joint.jointData,r={pivotA:n.mainPivot?(new this.BJSCANNON.Vec3).set(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z):null,pivotB:n.connectedPivot?(new this.BJSCANNON.Vec3).set(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z):null,axisA:n.mainAxis?(new this.BJSCANNON.Vec3).set(n.mainAxis.x,n.mainAxis.y,n.mainAxis.z):null,axisB:n.connectedAxis?(new this.BJSCANNON.Vec3).set(n.connectedAxis.x,n.connectedAxis.y,n.connectedAxis.z):null,maxForce:n.nativeParams.maxForce,collideConnected:!!n.collision};switch(e.joint.type){case a.e.HingeJoint:case a.e.Hinge2Joint:o=new this.BJSCANNON.HingeConstraint(t,i,r);break;case a.e.DistanceJoint:o=new this.BJSCANNON.DistanceConstraint(t,i,n.maxDistance||2);break;case a.e.SpringJoint:var o=new this.BJSCANNON.Spring(t,i,{restLength:n.length,stiffness:n.stiffness,damping:n.damping,localAnchorA:r.pivotA,localAnchorB:r.pivotB});break;case a.e.LockJoint:o=new this.BJSCANNON.LockConstraint(t,i,r);break;case a.e.PointToPointJoint:case a.e.BallAndSocketJoint:default:o=new this.BJSCANNON.PointToPointConstraint(t,r.pivotA,i,r.pivotB,r.maxForce)}o.collideConnected=!!n.collision,e.joint.physicsJoint=o,e.joint.type!==a.e.SpringJoint?this.world.addConstraint(o):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){o.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}},s.prototype.removeJoint=function(e){e.joint.type!==a.e.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)},s.prototype._addMaterial=function(e,t,i){for(var n,r=0;r<this._physicsMaterials.length;r++)if((n=this._physicsMaterials[r]).friction===t&&n.restitution===i)return n;var o=new this.BJSCANNON.Material(e);return o.friction=t,o.restitution=i,this._physicsMaterials.push(o),o},s.prototype._checkWithEpsilon=function(e){return e<n.a.Epsilon?n.a.Epsilon:e},s.prototype._createShape=function(e){var t=e.object,i=e.getObjectExtendSize();switch(e.type){case O.a.SphereImpostor:var n=i.x,r=i.y,o=i.z,a=new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(n),this._checkWithEpsilon(r),this._checkWithEpsilon(o))/2);break;case O.a.CylinderImpostor:var s=e.getParam("nativeOptions"),c=void 0!==(s=s||{}).radiusTop?s.radiusTop:this._checkWithEpsilon(i.x)/2,l=void 0!==s.radiusBottom?s.radiusBottom:this._checkWithEpsilon(i.x)/2,u=void 0!==s.height?s.height:this._checkWithEpsilon(i.y),h=void 0!==s.numSegments?s.numSegments:16;a=new this.BJSCANNON.Cylinder(c,l,u,h);var d=new this.BJSCANNON.Quaternion;d.setFromAxisAngle(new this.BJSCANNON.Vec3(1,0,0),-Math.PI/2);var p=new this.BJSCANNON.Vec3(0,0,0);a.transformAllPoints(p,d);break;case O.a.BoxImpostor:var f=i.scale(.5);a=new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(f.x),this._checkWithEpsilon(f.y),this._checkWithEpsilon(f.z)));break;case O.a.PlaneImpostor:P.a.Warn("Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead"),a=new this.BJSCANNON.Plane;break;case O.a.MeshImpostor:var m=t.getVerticesData?t.getVerticesData(R.b.PositionKind):[],_=t.getIndices?t.getIndices():[];if(!m)return;var g=t.position.clone(),v=t.rotation&&t.rotation.clone(),b=t.rotationQuaternion&&t.rotationQuaternion.clone();t.position.copyFromFloats(0,0,0),t.rotation&&t.rotation.copyFromFloats(0,0,0),t.rotationQuaternion&&t.rotationQuaternion.copyFrom(e.getParentsRotation()),t.rotationQuaternion&&t.parent&&t.rotationQuaternion.conjugateInPlace();for(var y=t.computeWorldMatrix(!0),T=new Array,E=0;E<m.length;E+=3)x.e.TransformCoordinates(x.e.FromArray(m,E),y).toArray(T,E);P.a.Warn("MeshImpostor only collides against spheres."),a=new this.BJSCANNON.Trimesh(T,_),t.position.copyFrom(g),v&&t.rotation&&t.rotation.copyFrom(v),b&&t.rotationQuaternion&&t.rotationQuaternion.copyFrom(b);break;case O.a.HeightmapImpostor:var S=t.position.clone(),A=t.rotation&&t.rotation.clone(),C=t.rotationQuaternion&&t.rotationQuaternion.clone();t.position.copyFromFloats(0,0,0),t.rotation&&t.rotation.copyFromFloats(0,0,0),t.rotationQuaternion&&t.rotationQuaternion.copyFrom(e.getParentsRotation()),t.rotationQuaternion&&t.parent&&t.rotationQuaternion.conjugateInPlace(),t.rotationQuaternion&&t.rotationQuaternion.multiplyInPlace(this._minus90X),a=this._createHeightmap(t),t.position.copyFrom(S),A&&t.rotation&&t.rotation.copyFrom(A),C&&t.rotationQuaternion&&t.rotationQuaternion.copyFrom(C),t.computeWorldMatrix(!0);break;case O.a.ParticleImpostor:a=new this.BJSCANNON.Particle;break;case O.a.NoImpostor:a=new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0,0,0))}return a},s.prototype._createHeightmap=function(e,t){for(var i=e.getVerticesData(R.b.PositionKind),n=e.computeWorldMatrix(!0),r=new Array,o=0;o<i.length;o+=3)x.e.TransformCoordinates(x.e.FromArray(i,o),n).toArray(r,o);i=r;for(var a=new Array,s=t||~~(Math.sqrt(i.length/3)-1),c=e.getBoundingInfo(),l=Math.min(c.boundingBox.extendSizeWorld.x,c.boundingBox.extendSizeWorld.y),u=c.boundingBox.extendSizeWorld.z,h=2*l/s,d=0;d<i.length;d+=3){var p=Math.round(i[d+0]/h+s/2),f=Math.round(-1*(i[d+1]/h-s/2)),m=-i[d+2]+u;a[p]||(a[p]=[]),a[p][f]||(a[p][f]=m),a[p][f]=Math.max(m,a[p][f])}for(p=0;p<=s;++p){if(!a[p]){for(var _=1;!a[(p+_)%s];)_++;a[p]=a[(p+_)%s].slice()}for(f=0;f<=s;++f)if(!a[p][f]){for(var g,_=1;void 0===g;)g=a[p][(f+_++)%s];a[p][f]=g}}var v=new this.BJSCANNON.Heightfield(a,{elementSize:h});return v.minY=u,v},s.prototype._updatePhysicsBodyTransformation=function(e){var t,i,n,r,o,a,s,c,l,u=e.object;u.computeWorldMatrix&&u.computeWorldMatrix(!0),u.getBoundingInfo()&&(t=e.getObjectCenter(),this._tmpDeltaPosition.copyFrom(u.getAbsolutePivotPoint().subtract(t)),this._tmpDeltaPosition.divideInPlace(e.object.scaling),this._tmpPosition.copyFrom(t),(i=u.rotationQuaternion)&&(e.type!==O.a.PlaneImpostor&&e.type!==O.a.HeightmapImpostor||(i=i.multiply(this._minus90X),e.setDeltaRotation(this._plus90X)),e.type===O.a.HeightmapImpostor?(r=(n=u).getBoundingInfo(),o=n.rotationQuaternion,n.rotationQuaternion=this._tmpUnityRotation,n.computeWorldMatrix(!0),a=t.clone(),s=(s=n.getPivotMatrix())?s.clone():x.a.Identity(),c=x.a.Translation(r.boun
1dingBox.extendSizeWorld.x,0,-r.boundingBox.extendSizeWorld.z),n.setPreTransformMatrix(c),n.computeWorldMatrix(!0),l=r.boundingBox.centerWorld.subtract(t).subtract(n.position).negate(),this._tmpPosition.copyFromFloats(l.x,l.y-r.boundingBox.extendSizeWorld.y,l.z),this._tmpDeltaPosition.copyFrom(r.boundingBox.centerWorld.subtract(a)),this._tmpDeltaPosition.y+=r.boundingBox.extendSizeWorld.y,n.rotationQuaternion=o,n.setPreTransformMatrix(s),n.computeWorldMatrix(!0)):e.type===O.a.MeshImpostor&&this._tmpDeltaPosition.copyFromFloats(0,0,0),e.setDeltaPosition(this._tmpDeltaPosition),e.physicsBody.position.set(this._tmpPosition.x,this._tmpPosition.y,this._tmpPosition.z),e.physicsBody.quaternion.set(i.x,i.y,i.z,i.w)))},s.prototype.setTransformationFromPhysicsBody=function(e){var t;e.object.position.set(e.physicsBody.position.x,e.physicsBody.position.y,e.physicsBody.position.z),e.object.rotationQuaternion&&(t=e.physicsBody.quaternion,e.object.rotationQuaternion.set(t.x,t.y,t.z,t.w))},s.prototype.setPhysicsBodyTransformation=function(e,t,i){e.physicsBody.position.set(t.x,t.y,t.z),e.physicsBody.quaternion.set(i.x,i.y,i.z,i.w)},s.prototype.isSupported=function(){return void 0!==this.BJSCANNON},s.prototype.setLinearVelocity=function(e,t){e.physicsBody.velocity.set(t.x,t.y,t.z)},s.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.set(t.x,t.y,t.z)},s.prototype.getLinearVelocity=function(e){var t=e.physicsBody.velocity;return t?new x.e(t.x,t.y,t.z):null},s.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new x.e(t.x,t.y,t.z):null},s.prototype.setBodyMass=function(e,t){e.physicsBody.mass=t,e.physicsBody.updateMassProperties()},s.prototype.getBodyMass=function(e){return e.physicsBody.mass},s.prototype.getBodyFriction=function(e){return e.physicsBody.material.friction},s.prototype.setBodyFriction=function(e,t){e.physicsBody.material.friction=t},s.prototype.getBodyRestitution=function(e){return e.physicsBody.material.restitution},s.prototype.setBodyRestitution=function(e,t){e.physicsBody.material.restitution=t},s.prototype.sleepBody=function(e){e.physicsBody.sleep()},s.prototype.wakeUpBody=function(e){e.physicsBody.wakeUp()},s.prototype.updateDistanceJoint=function(e,t){e.physicsJoint.distance=t},s.prototype.setMotor=function(e,t,i,n){n||(e.physicsJoint.enableMotor(),e.physicsJoint.setMotorSpeed(t),i&&this.setLimit(e,i))},s.prototype.setLimit=function(e,t,i){e.physicsJoint.motorEquation.maxForce=t,e.physicsJoint.motorEquation.minForce=void 0===i?-t:i},s.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.quaternion.x,e.rotationQuaternion.y=i.quaternion.y,e.rotationQuaternion.z=i.quaternion.z,e.rotationQuaternion.w=i.quaternion.w)},s.prototype.getRadius=function(e){return e.physicsBody.shapes[0].boundingSphereRadius},s.prototype.getBoxSizeToRef=function(e,t){var i=e.physicsBody.shapes[0];t.x=2*i.halfExtents.x,t.y=2*i.halfExtents.y,t.z=2*i.halfExtents.z},s.prototype.dispose=function(){},s.prototype._extendNamespace=function(){var h=new this.BJSCANNON.Vec3,d=this.BJSCANNON;this.BJSCANNON.World.prototype.step=function(e,t,i){if(i=i||10,0===(t=t||0))this.internalStep(e),this.time+=e;else{for(var n=Math.floor((this.time+t)/e)-Math.floor(this.time/e),n=Math.min(n,i)||1,r=performance.now(),o=0;o!==n&&(this.internalStep(e),!(performance.now()-r>1e3*e));o++);this.time+=t;for(var a=this.time%e/e,s=h,c=this.bodies,l=0;l!==c.length;l++){var u=c[l];u.type!==d.Body.STATIC&&u.sleepState!==d.Body.SLEEPING?(u.position.vsub(u.previousPosition,s),s.scale(a,s),u.position.vadd(s,u.interpolatedPosition)):(u.interpolatedPosition.set(u.position.x,u.position.y,u.position.z),u.interpolatedQuaternion.set(u.quaternion.x,u.quaternion.y,u.quaternion.z,u.quaternion.w))}}}},s.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},s);function s(e,t,i){void 0===e&&(e=!0),void 0===t&&(t=10),void 0===i&&(i=CANNON),this._useDeltaForWorldStep=e,this.name="CannonJSPlugin",this._physicsMaterials=new Array,this._fixedTimeStep=1/60,this._physicsBodysToRemoveAfterStep=new Array,this._firstFrame=!0,this._minus90X=new x.b(-.7071067811865475,0,0,.7071067811865475),this._plus90X=new x.b(.7071067811865475,0,0,.7071067811865475),this._tmpPosition=x.e.Zero(),this._tmpDeltaPosition=x.e.Zero(),this._tmpUnityRotation=new x.b,this.BJSCANNON=i,this.isSupported()?(this._extendNamespace(),this.world=new this.BJSCANNON.World,this.world.broadphase=new this.BJSCANNON.NaiveBroadphase,this.world.solver.iterations=t,this._cannonRaycastResult=new this.BJSCANNON.RaycastResult,this._raycastResult=new r.a):P.a.Error("CannonJS is not available. Please make sure you included the js file.")}n.a.DefaultPluginFactory=function(){return new o}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var v=i(34),s=i(59),n=i(126),r=i(0),b=i(7),o=i(195),a=(c.prototype.setGravity=function(e){this.world.gravity.set(e.x,e.y,e.z)},c.prototype.setTimeStep=function(e){this.world.timeStep=e},c.prototype.getTimeStep=function(){return this.world.timeStep},c.prototype.executeStep=function(e,t){var i=this;t.forEach(function(e){e.beforeStep()}),this.world.timeStep=this._useDeltaForWorldStep?e:this._fixedTimeStep,this.world.step(),t.forEach(function(e){e.afterStep(),i._tmpImpostorsArray[e.uniqueId]=e});for(var n,r,o=this.world.contacts;null!==o;)o.touching&&!o.body1.sleeping&&!o.body2.sleeping||(n=this._tmpImpostorsArray[+o.body1.name],r=this._tmpImpostorsArray[+o.body2.name],n&&r&&(n.onCollide({body:r.physicsBody}),r.onCollide({body:n.physicsBody}))),o=o.next},c.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))},c.prototype.applyForce=function(e,t,i){b.a.Warn("Oimo doesn't support applying force. Using impule instead."),this.applyImpulse(e,t,i)},c.prototype.generatePhysicsBody=function(p){var f,t,m,_,e,g=this;p.parent?p.physicsBody&&(this.removePhysicsBody(p),p.forceUpdate()):(p.isBodyInitRequired()?(f={name:p.uniqueId,config:[p.getParam("mass")||.001,p.getParam("friction"),p.getParam("restitution")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==p.getParam("mass"),density:p.getParam("mass"),friction:p.getParam("friction"),restitution:p.getParam("restitution"),world:this.world}
1,t=[p],(e=p.object).getChildMeshes&&e.getChildMeshes().forEach(function(e){e.physicsImpostor&&t.push(e.physicsImpostor)}),m=function(e){return Math.max(e,n.a.Epsilon)},_=new r.b,t.forEach(function(e){if(e.object.rotationQuaternion){var t=e.object.rotationQuaternion;_=t.clone(),e.object.rotationQuaternion.set(0,0,0,1),e.object.computeWorldMatrix(!0);var i,n,r=t.toEulerAngles(),o=e.getObjectExtendSize();switch(e===p?(i=p.getObjectCenter(),p.object.getAbsolutePivotPoint().subtractToRef(i,g._tmpPositionVector),g._tmpPositionVector.divideInPlace(p.object.scaling),f.pos.push(i.x),f.pos.push(i.y),f.pos.push(i.z),f.posShape.push(0,0,0),f.rotShape.push(0,0,0)):(n=e.object.position.clone(),f.posShape.push(n.x),f.posShape.push(n.y),f.posShape.push(n.z),f.rotShape.push(57.29577951308232*r.x),f.rotShape.push(57.29577951308232*r.y),f.rotShape.push(57.29577951308232*r.z)),e.object.rotationQuaternion.copyFrom(_),e.type){case v.a.ParticleImpostor:b.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case v.a.SphereImpostor:var a=o.x,s=o.y,c=o.z,l=Math.max(m(a),m(s),m(c))/2;f.type.push("sphere"),f.size.push(l),f.size.push(l),f.size.push(l);break;case v.a.CylinderImpostor:var u=m(o.x)/2,h=m(o.y);f.type.push("cylinder"),f.size.push(u),f.size.push(h),f.size.push(h);break;case v.a.PlaneImpostor:case v.a.BoxImpostor:default:u=m(o.x),h=m(o.y);var d=m(o.z);f.type.push("box"),f.size.push(u),f.size.push(h),f.size.push(d)}e.object.rotationQuaternion=t}}),p.physicsBody=this.world.add(f),p.physicsBody.resetQuaternion(_),p.physicsBody.updatePosition(0)):this._tmpPositionVector.copyFromFloats(0,0,0),p.setDeltaPosition(this._tmpPositionVector))},c.prototype.removePhysicsBody=function(e){this.world.removeRigidBody(e.physicsBody)},c.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o=r.nativeParams||{},a={body1:t,body2:i,axe1:o.axe1||(r.mainAxis?r.mainAxis.asArray():null),axe2:o.axe2||(r.connectedAxis?r.connectedAxis.asArray():null),pos1:o.pos1||(r.mainPivot?r.mainPivot.asArray():null),pos2:o.pos2||(r.connectedPivot?r.connectedPivot.asArray():null),min:o.min,max:o.max,collision:o.collision||r.collision,spring:o.spring,world:this.world};switch(e.joint.type){case s.e.BallAndSocketJoint:n="jointBall";break;case s.e.SpringJoint:b.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead"),a.min=r.length||a.min,a.max=Math.max(a.min,a.max);case s.e.DistanceJoint:n="jointDistance",a.max=r.maxDistance;break;case s.e.PrismaticJoint:n="jointPrisme";break;case s.e.SliderJoint:n="jointSlide";break;case s.e.WheelJoint:n="jointWheel";break;case s.e.HingeJoint:default:n="jointHinge"}a.type=n,e.joint.physicsJoint=this.world.add(a)}},c.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){b.a.Warn(e)}},c.prototype.isSupported=function(){return void 0!==this.BJSOIMO},c.prototype.setTransformationFromPhysicsBody=function(e){if(!e.physicsBody.sleeping){if(e.physicsBody.shapes.next){for(var t=e.physicsBody.shapes;t.next;)t=t.next;e.object.position.set(t.position.x,t.position.y,t.position.z)}else{var i=e.physicsBody.getPosition();e.object.position.set(i.x,i.y,i.z)}var n;e.object.rotationQuaternion&&(n=e.physicsBody.getQuaternion(),e.object.rotationQuaternion.set(n.x,n.y,n.z,n.w))}},c.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody;e.physicsBody.shapes.next||(n.position.set(t.x,t.y,t.z),n.orientation.set(i.x,i.y,i.z,i.w),n.syncShapes(),n.awake())},c.prototype.setLinearVelocity=function(e,t){e.physicsBody.linearVelocity.set(t.x,t.y,t.z)},c.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.set(t.x,t.y,t.z)},c.prototype.getLinearVelocity=function(e){var t=e.physicsBody.linearVelocity;return t?new r.e(t.x,t.y,t.z):null},c.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new r.e(t.x,t.y,t.z):null},c.prototype.setBodyMass=function(e,t){var i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)},c.prototype.getBodyMass=function(e){return e.physicsBody.shapes.density},c.prototype.getBodyFriction=function(e){return e.physicsBody.shapes.friction},c.prototype.setBodyFriction=function(e,t){e.physicsBody.shapes.friction=t},c.prototype.getBodyRestitution=function(e){return e.physicsBody.shapes.restitution},c.prototype.setBodyRestitution=function(e,t){e.physicsBody.shapes.restitution=t},c.prototype.sleepBody=function(e){e.physicsBody.sleep()},c.prototype.wakeUpBody=function(e){e.physicsBody.awake()},c.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)},c.prototype.setMotor=function(e,t,i,n){void 0!==i?b.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)},c.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)},c.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)},c.prototype.getRadius=function(e){return e.physicsBody.shapes.radius},c.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},c.prototype.dispose=function(){this.world.clear()},c.prototype.raycast=function(e,t){return b.a.Warn("raycast is not currently supported by the Oimo physics plugin"),this._raycastResult.reset(e,t),this._raycastResult},c);function c(e,t,i){void 0===e&&(e=!0),void 0===i&&(i=OIMO),this._useDeltaForWorldStep=e,this.name="OimoJSPlugin",this._fixedTimeStep=1/60,this._tmpImpostorsArray=[],this._tmpPositionVector=r.e.Zero(),this.BJSOIMO=i,this.world=new this.BJSOIMO.World({iterations:t}),this.world.clear(),this._raycastResult=new o.a}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var m=i(0),p=i(7),v=i(34),c=i(59),b=i(4),y=i(16),h=i(170),d=i(58),r=i(195),f=i(14),n=(u.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)},u.prototype.setTimeStep=function(e){this._timeStep=e},u.prototype.setFixedTimeStep=function(e){this._fixedTimeStep=e},u.prototype.setMaxSteps=function(e){this._maxSteps=e},u.prototype.getTimeStep=function(){return this._timeStep},u.prototype._isImpostorInContact=function(e){return this._tmpContactCallbackResult=!1,this.world.contactTest(e.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},u.prototype._isImpostorPairInContact=function(e,t){return this._tmpContactCallbackResult=!1,this.world.contactPairTest(e.physicsBody,t.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},u.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(;0<t&&0<e;)e-i<i?(this.world.stepSimulation(e,0),e=0):(e-=i,this.world.stepSimulation(i,0)),t--},u.prototype.executeStep=function(e,t){for(var i=0,n=t;i<n.length;i++){var r=n[i];r.soft||r.beforeStep()}this._stepSimulation(this._useDeltaForWorldStep?e:this._timeStep,this._maxSteps,this._fixedTimeStep);for(var o=0,a=t;o<a.length;o++){var s=a[o];if(s.soft?this._afterSoftStep(s):s.afterStep(),0<s._onPhysicsCollideCallbacks.length&&this._isImpostorInContact(s))for(var c=0,l=s._onPhysicsCollideCallbacks;c<l.length;c++)for(var u=0,h=l[c].otherImpostors;u<h.length;u++){var d=h[u];(s.physicsBody.isActive()||d.physicsBody.isActive())&&this._isImpostorPairInContact(s,d)&&(s.onCollide({body:d.physicsBody}),d.onCollide({body:s.physicsBody}))}}},u.prototype._afterSoftStep=function(e){e.type===v.a.RopeImpostor?this._ropeStep(e):this._softbodyOrClothStep(e)},u.prototype._ropeStep=function(e){for(var t,i,n,r,o=e.physicsBody.get_m_nodes(),a=o.size(),s=new Array,c=0;c<a;c++)i=(t=o.at(c).get_m_x()).x(),n=t.y(),r=t.z(),s.push(new m.e(i,n,r));var l=e.object,u=e.getParam("shape");e._isFromLine?e.object=d.a.CreateLines("lines",{points:s,instance:l}):e.object=h.a.ExtrudeShape("ext",{shape:u,path:s,instance:l})},u.prototype._softbodyOrClothStep=function(e){for(var t,i,n=e.type===v.a.ClothImpostor?1:-1,r=e.object,o=(o=r.getVerticesData(b.b.PositionKind))||[],a=(a=r.getVerticesData(b.b.NormalKind))||[],s=o.length/3,c=e.physicsBody.get_m_nodes(),l=0;l<s;l++){var u,h=(i=(t=c.at(l)).get_m_x()).x(),d=i.y(),p=i.z()*n,f=(u=t.get_m_n()).x(),m=u.y(),_=u.z()*n;o[3*l]=h,o[3*l+1]=d,o[3*l+2]=p,a[3*l]=f,a[3*l+1]=m,a[3*l+2]=_}var g=new y.a;g.positions=o,g.normals=a,g.uvs=r.getVerticesData(b.b.UVKind),g.colors=r.getVerticesData(b.b.ColorKind),r&&r.getIndices&&(g.indices=r.getIndices()),g.applyToMesh(r)},u.prototype.applyImpulse=function(e,t,i){var n,r;e.soft?p.a.Warn("Cannot be applied to a soft body"):(e.physicsBody.activate(),n=this._tmpAmmoVectorA,r=this._tmpAmmoVectorB,e.object&&e.object.getWorldMatrix&&i.subtractInPlace(e.object.getWorldMatrix().getTranslation()),n.setValue(i.x,i.y,i.z),r.setValue(t.x,t.y,t.z),e.physicsBody.applyImpulse(r,n))},u.prototype.applyForce=function(e,t,i){var n,r;e.soft?p.a.Warn("Cannot be applied to a soft body"):(e.physicsBody.activate(),n=this._tmpAmmoVectorA,r=this._tmpAmmoVectorB,e.object&&e.object.getWorldMatrix&&i.subtractInPlace(e.object.getWorldMatrix().getTranslation()),n.setValue(i.x,i.y,i.z),r.setValue(t.x,t.y,t.z),e.physicsBody.applyForce(r,n))},u.prototype.generatePhysicsBody=function(e){var t,i,n,r,o,a,s,c,l;e._pluginData.toDispose=[],e.parent?e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate()):e.isBodyInitRequired()&&(t=this._createShape(e),i=e.getParam("mass"),e._pluginData.mass=i,e.soft?(t.get_m_cfg().set_collisions(17),t.get_m_cfg().set_kDP(e.getParam("damping")),this.bjsAMMO.castObject(t,this.bjsAMMO.btCollisionObject).getCollisionShape().setMargin(e.getParam("margin")),t.setActivationState(u.DISABLE_DEACTIVATION_FLAG),this.world.addSoftBody(t,1,-1),e.physicsBody=t,e._pluginData.toDispose.push(t),this.setBodyPressure(e,0),e.type===v.a.SoftbodyImpostor&&this.setBodyPressure(e,e.getParam("pressure")),this.setBodyStiffness(e,e.getParam("stiffness")),this.setBodyVelocityIterations(e,e.getParam("velocityIterations")),this.setBodyPositionIterations(e,e.getParam("positionIterations"))):(n=new this.bjsAMMO.btVector3(0,0,0),(r=new this.bjsAMMO.btTransform).setIdentity(),0!==i&&t.calculateLocalInertia(i,n),this._tmpAmmoVectorA.setValue(e.object.position.x,e.object.position.y,e.object.position.z),this._tmpAmmoQuaternion.setValue(e.object.rotationQuaternion.x,e.object.rotationQuaternion.y,e.object.rotationQuaternion.z,e.object.rotationQuaternion.w),r.setOrigin(this._tmpAmmoVectorA),r.setRotation(this._tmpAmmoQuaternion),o=new this.bjsAMMO.btDefaultMotionState(r),a=new this.bjsAMMO.btRigidBodyConstructionInfo(i,o,t,n),s=new this.bjsAMMO.btRigidBody(a),0===i&&(s.setCollisionFlags(s.getCollisionFlags()|u.KINEMATIC_FLAG),s.setActivationState(u.DISABLE_DEACTIVATION_FLAG)),e.type!=v.a.NoImpostor||t.getChildShape||s.setCollisionFlags(s.getCollisionFlags()|u.DISABLE_COLLISION_FLAG),c=e.getParam("group"),l=e.getParam("mask"),c&&l?this.world.addRigidBody(s,c,l):this.world.addRigidBody(s),e.physicsBody=s,e._pluginData.toDispose=e._pluginData.toDispose.concat([s,a,o,r,n,t])),this.setBodyRestitution(e,e.getParam("restitution")),this.setBodyFriction(e,e.getParam("friction")))},u.prototype.removePhysicsBody=function(e){var t=this;this.world&&(e.soft?this.world.removeSoftBody(e.physicsBody):this.world.removeRigidBody(e.physicsBody),e._pluginData&&(e._pluginData.toDispose.forEach(function(e){t.bjsAMMO.destroy(e)}),e._pluginData.toDispose=[]))},u.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n=e.joint.jointData;switch(n.mainPivot||(n.mainPivot=new m.e(0,0,0)),n.connectedPivot||(n.connectedPivot=new m.e(0,0,0)),e.joint.type){case c.e.DistanceJoint:var r=n.maxDistance;r&&(n.mainPivot=new m.e(0,-r/2,0),n.connectedPivot=new m.e(0,r/2,0)),s=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z));break;case c.e.HingeJoint:n.mainAxis||(n.mainAxis=new m.e(0,0,0)),n.connectedAxis||(n.connectedAxis=new m.e(0,0,0));var o=new this.bjsAMMO.btVector3(n.mainAxis.x,n.mainAxis.y,n.mainAxis.z),a=new this.bjsAMMO.btVector3(n.connectedAxis.x,n.connectedAxis.y,n.connectedAxis.z),s=new this.bjsAMMO.btHingeConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z),o,a);break;case c.e.BallAndSocketJoint:s=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z));break;default:p.a.Warn("JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint"),s=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z))}this.world.addConstraint(s,!e.joint.jointData.collision),e.joint.physicsJoint=s}},u.prototype.removeJoint=function(e){this.world&&this.world.removeConstraint(e.joint.physicsJoint)},u.prototype._addMeshVerts=function(t,i,e){var n=this,r=0;if(e&&e.getIndices&&e.getWorldMatrix&&e.getChildMeshes){var o=(o=e.getIndices())||[],a=(a=e.getVerticesData(b.b.PositionKind))||[];e.computeWorldMatrix(!1);for(var s=o.length/3,c=0;c<s;c++){for(var l=[],u=0;u<3;u++){var h,d=new m.e(a[3*o[3*c+u]+0],a[3*o[3*c+u]+1],a[3*o[3*c+u]+2]);m.a.ScalingToRef(e.scaling.x,e.scaling.y,e.scaling.z,this._tmpMatrix),d=m.e.TransformCoordinates(d,this._tmpMatrix),(h=0==u?this._tmpAmmoVectorA:1==u?this._tmpAmmoVectorB:this._tmpAmmoVectorC).setValue(d.x,d.y,d.z),l.push(h)}t.addTriangle(l[0],l[1],l[2]),r++}
1e.getChildMeshes().forEach(function(e){r+=n._addMeshVerts(t,i,e)})}return r},u.prototype._softVertexData=function(e){var t=e.object;if(t&&t.getIndices&&t.getWorldMatrix&&t.getChildMeshes){t.getIndices();var i=(i=t.getVerticesData(b.b.PositionKind))||[],n=(n=t.getVerticesData(b.b.NormalKind))||[];t.computeWorldMatrix(!1);for(var r=[],o=[],a=0;a<i.length;a+=3){var s=new m.e(i[a],i[a+1],i[a+2]),c=new m.e(n[a],n[a+1],n[a+2]),s=m.e.TransformCoordinates(s,t.getWorldMatrix()),c=m.e.TransformNormal(c,t.getWorldMatrix());r.push(s.x,s.y,s.z),o.push(c.x,c.y,c.z)}var l=new y.a;return l.positions=r,l.normals=o,l.uvs=t.getVerticesData(b.b.UVKind),l.colors=t.getVerticesData(b.b.ColorKind),t&&t.getIndices&&(l.indices=t.getIndices()),l.applyToMesh(t),t.position=m.e.Zero(),t.rotationQuaternion=null,t.rotation=m.e.Zero(),t.computeWorldMatrix(!0),l}return y.a.ExtractFromMesh(t)},u.prototype._createSoftbody=function(e){var t=e.object;if(t&&t.getIndices){var i=(i=t.getIndices())||[],n=this._softVertexData(e),r=n.positions,o=n.normals;if(null===r||null===o)return new this.bjsAMMO.btCompoundShape;for(var a=[],s=[],c=0;c<r.length;c+=3){var l=new m.e(r[c],r[c+1],r[c+2]),u=new m.e(o[c],o[c+1],o[c+2]);a.push(l.x,l.y,-l.z),s.push(u.x,u.y,-u.z)}for(var h,d=(new this.bjsAMMO.btSoftBodyHelpers).CreateFromTriMesh(this.world.getWorldInfo(),a,t.getIndices(),i.length/3,!0),p=r.length/3,f=d.get_m_nodes(),c=0;c<p;c++)(h=f.at(c).get_m_n()).setX(s[3*c]),h.setY(s[3*c+1]),h.setZ(s[3*c+2]);return d}},u.prototype._createCloth=function(e){var t=e.object;if(t&&t.getIndices){t.getIndices();var i=this._softVertexData(e),n=i.positions,r=i.normals;if(null===n||null===r)return new this.bjsAMMO.btCompoundShape;var o=n.length,a=Math.sqrt(o/3),s=(e.segments=a)-1;return this._tmpAmmoVectorA.setValue(n[0],n[1],n[2]),this._tmpAmmoVectorB.setValue(n[3*s],n[3*s+1],n[3*s+2]),this._tmpAmmoVectorD.setValue(n[o-3],n[o-2],n[o-1]),this._tmpAmmoVectorC.setValue(n[o-3-3*s],n[o-2-3*s],n[o-1-3*s]),(new this.bjsAMMO.btSoftBodyHelpers).CreatePatch(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,this._tmpAmmoVectorC,this._tmpAmmoVectorD,a,a,e.getParam("fixedPoints"),!0)}},u.prototype._createRope=function(e){var t,i,n=this._softVertexData(e),r=n.positions,o=n.normals;if(null===r||null===o)return new this.bjsAMMO.btCompoundShape;if(n.applyToMesh(e.object,!0),e._isFromLine=!0,0===o.map(function(e){return e*e}).reduce(function(e,t){return e+t}))i=(t=r.length)/3-1,this._tmpAmmoVectorA.setValue(r[0],r[1],r[2]),this._tmpAmmoVectorB.setValue(r[t-3],r[t-2],r[t-1]);else{e._isFromLine=!1;var a=e.getParam("path");if(null===e.getParam("shape"))return p.a.Warn("No shape available for extruded mesh"),new this.bjsAMMO.btCompoundShape;if(r.length%(3*a.length)!=0)return p.a.Warn("Path does not match extrusion"),new this.bjsAMMO.btCompoundShape;i=(t=a.length)-1,this._tmpAmmoVectorA.setValue(a[0].x,a[0].y,a[0].z),this._tmpAmmoVectorB.setValue(a[t-1].x,a[t-1].y,a[t-1].z)}e.segments=i;var s=3<(s=e.getParam("fixedPoints"))?3:s,c=(new this.bjsAMMO.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,s);return c.get_m_cfg().set_collisions(17),c},u.prototype._createCustom=function(e){var t=null;return this.onCreateCustomShape&&(t=this.onCreateCustomShape(e)),null==t&&(t=new this.bjsAMMO.btCompoundShape),t},u.prototype._addHullVerts=function(t,i,e){var n=this,r=0;if(e&&e.getIndices&&e.getWorldMatrix&&e.getChildMeshes){var o=(o=e.getIndices())||[],a=(a=e.getVerticesData(b.b.PositionKind))||[];e.computeWorldMatrix(!1);for(var s=o.length/3,c=0;c<s;c++){for(var l=[],u=0;u<3;u++){var h,d=new m.e(a[3*o[3*c+u]+0],a[3*o[3*c+u]+1],a[3*o[3*c+u]+2]);m.a.ScalingToRef(e.scaling.x,e.scaling.y,e.scaling.z,this._tmpMatrix),d=m.e.TransformCoordinates(d,this._tmpMatrix),(h=0==u?this._tmpAmmoVectorA:1==u?this._tmpAmmoVectorB:this._tmpAmmoVectorC).setValue(d.x,d.y,d.z),l.push(h)}t.addPoint(l[0],!0),t.addPoint(l[1],!0),t.addPoint(l[2],!0),r++}e.getChildMeshes().forEach(function(e){r+=n._addHullVerts(t,i,e)})}return r},u.prototype._createShape=function(e,t){var o=this;void 0===t&&(t=!1);var i,n=e.object,r=e.getObjectExtendSize();if(!t){var a,s=e.object.getChildMeshes?e.object.getChildMeshes(!0):[],c=new this.bjsAMMO.btCompoundShape,l=0;
1if(s.forEach(function(e){var t=e.getPhysicsImpostor();if(t){if(t.type==v.a.MeshImpostor)throw"A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)";var i=o._createShape(t),n=e.parent.getWorldMatrix().clone(),r=new m.e;n.decompose(r),o._tmpAmmoTransform.getOrigin().setValue(e.position.x*r.x,e.position.y*r.y,e.position.z*r.z),o._tmpAmmoQuaternion.setValue(e.rotationQuaternion.x,e.rotationQuaternion.y,e.rotationQuaternion.z,e.rotationQuaternion.w),o._tmpAmmoTransform.setRotation(o._tmpAmmoQuaternion),c.addChildShape(o._tmpAmmoTransform,i),t.dispose(),l++}}),0<l)return e.type==v.a.NoImpostor||(a=this._createShape(e,!0))&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),c.addChildShape(this._tmpAmmoTransform,a)),c;this.bjsAMMO.destroy(c),c=null}switch(e.type){case v.a.SphereImpostor:f.a.WithinEpsilon(r.x,r.y,1e-4)&&f.a.WithinEpsilon(r.x,r.z,1e-4)?c=new this.bjsAMMO.btSphereShape(r.x/2):(i=[new this.bjsAMMO.btVector3(0,0,0)],(c=new this.bjsAMMO.btMultiSphereShape(i,[1],1)).setLocalScaling(new this.bjsAMMO.btVector3(r.x/2,r.y/2,r.z/2)));break;case v.a.CapsuleImpostor:c=new this.bjsAMMO.btCapsuleShape(r.x/2,r.y/2);break;case v.a.CylinderImpostor:this._tmpAmmoVectorA.setValue(r.x/2,r.y/2,r.z/2),c=new this.bjsAMMO.btCylinderShape(this._tmpAmmoVectorA);break;case v.a.PlaneImpostor:case v.a.BoxImpostor:this._tmpAmmoVectorA.setValue(r.x/2,r.y/2,r.z/2),c=new this.bjsAMMO.btBoxShape(this._tmpAmmoVectorA);break;case v.a.MeshImpostor:if(0==e.getParam("mass")){var u=new this.bjsAMMO.btTriangleMesh;e._pluginData.toDispose.push(u);var h=this._addMeshVerts(u,n,n);c=0==h?new this.bjsAMMO.btCompoundShape:new this.bjsAMMO.btBvhTriangleMeshShape(u);break}case v.a.ConvexHullImpostor:var d=new this.bjsAMMO.btConvexHullShape;c=0==(h=this._addHullVerts(d,n,n))?(e._pluginData.toDispose.push(d),new this.bjsAMMO.btCompoundShape):d;break;case v.a.NoImpostor:c=new this.bjsAMMO.btSphereShape(r.x/2);break;case v.a.CustomImpostor:c=this._createCustom(e);break;case v.a.SoftbodyImpostor:c=this._createSoftbody(e);break;case v.a.ClothImpostor:c=this._createCloth(e);break;case v.a.RopeImpostor:c=this._createRope(e);break;default:p.a.Warn("The impostor type is not currently supported by the ammo plugin.")}return c},u.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))},u.prototype.setPhysicsBodyTransformation=function(e,t,i){var n,r=e.physicsBody.getWorldTransform();r.getOrigin().x()==t.x&&r.getOrigin().y()==t.y&&r.getOrigin().z()==t.z&&r.getRotation().x()==i.x&&r.getRotation().y()==i.y&&r.getRotation().z()==i.z&&r.getRotation().w()==i.w||(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),r.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(i.x,i.y,i.z,i.w),r.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(r),0==e.mass?(n=e.physicsBody.getMotionState())&&n.setWorldTransform(r):e.physicsBody.activate())},u.prototype.isSupported=function(){return void 0!==this.bjsAMMO},u.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)},u.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)},u.prototype.getLinearVelocity=function(e){var t=e.soft?e.physicsBody.linearVelocity():e.physicsBody.getLinearVelocity();if(!t)return null;var i=new m.e(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),i},u.prototype.getAngularVelocity=function(e){var t=e.soft?e.physicsBody.angularVelocity():e.physicsBody.getAngularVelocity();if(!t)return null;var i=new m.e(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),i},u.prototype.setBodyMass=function(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t},u.prototype.getBodyMass=function(e){return e._pluginData.mass||0},u.prototype.getBodyFriction=function(e){return e._pluginData.friction||0},u.prototype.setBodyFriction=function(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t},u.prototype.getBodyRestitution=function(e){return e._pluginData.restitution||0},u.prototype.setBodyRestitution=function(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t},u.prototype.getBodyPressure=function(e){return e.soft?e._pluginData.pressure||0:(p.a.Warn("Pressure is not a property of a rigid body"),0)},u.prototype.setBodyPressure=function(e,t){e.soft?e.type===v.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")},u.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(p.a.Warn("Stiffness is not a property of a rigid body"),0)},u.prototype.setBodyStiffness=function(e,t){e.soft?(t=1<(t=t<0?0:t)?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")},u.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)},u.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")},u.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)},u.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")},u.prototype.appendAnchor=function(e,t,i,n,r,o){void 0===r&&(r=1),void 0===o&&(o=!1);var a=e.segments,s=Math.round((a-1)*i)+a*(a-1-Math.round((a-1)*n));e.physicsBody.appendAnchor(s,t.physicsBody,o,r)},u.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)},u.prototype.sleepBody=function(e){p.a.Warn("sleepBody is not currently supported by the Ammo physics plugin")},u.prototype.wakeUpBody=function(e){e.physicsBody.activate()},u.prototype.updateDistanceJoint=function(e,t,i){p.a.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin")},u.prototype.setMotor=function(e,t,i,n){e.physicsJoint.enableAngularMotor(!0,t,i
1)},u.prototype.setLimit=function(e,t,i){p.a.Warn("setLimit is not currently supported by the Ammo physics plugin")},u.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())},u.prototype.getRadius=function(e){return e.getObjectExtendSize().x/2},u.prototype.getBoxSizeToRef=function(e,t){var i=e.getObjectExtendSize();t.x=i.x,t.y=i.y,t.z=i.z},u.prototype.dispose=function(){this.bjsAMMO.destroy(this.world),this.bjsAMMO.destroy(this._solver),this.bjsAMMO.destroy(this._overlappingPairCache),this.bjsAMMO.destroy(this._dispatcher),this.bjsAMMO.destroy(this._collisionConfiguration),this.bjsAMMO.destroy(this._tmpAmmoVectorA),this.bjsAMMO.destroy(this._tmpAmmoVectorB),this.bjsAMMO.destroy(this._tmpAmmoVectorC),this.bjsAMMO.destroy(this._tmpAmmoTransform),this.bjsAMMO.destroy(this._tmpAmmoQuaternion),this.bjsAMMO.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null},u.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.bjsAMMO.destroy(i),this.bjsAMMO.destroy(this._tmpAmmoVectorRCA),this.bjsAMMO.destroy(this._tmpAmmoVectorRCB),this._raycastResult},u.DISABLE_COLLISION_FLAG=4,u.KINEMATIC_FLAG=2,u.DISABLE_DEACTIVATION_FLAG=4,u);function u(e,t,i){var n=this;void 0===e&&(e=!0),void 0===t&&(t=Ammo),void 0===i&&(i=null),this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name="AmmoJSPlugin",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new m.b,this._tmpContactCallbackResult=!1,this._tmpMatrix=new m.a,"function"==typeof t?t(this.bjsAMMO):this.bjsAMMO=t,this.isSupported()?(this._collisionConfiguration=new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,this._dispatcher=new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),this._overlappingPairCache=i||new this.bjsAMMO.btDbvtBroadphase,this._solver=new this.bjsAMMO.btSequentialImpulseConstraintSolver,this._softBodySolver=new this.bjsAMMO.btDefaultSoftBodySolver,this.world=new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver),this._tmpAmmoConcreteContactResultCallback=new this.bjsAMMO.ConcreteContactResultCallback,this._tmpAmmoConcreteContactResultCallback.addSingleResult=function(){n._tmpContactCallbackResult=!0},this._raycastResult=new r.a,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.")}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(1),a=i(3),c=i(39),l=i(0),r=i(42),u=i(2);r.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},r.a.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};var o=(Object.defineProperty(s.prototype,"samples",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"refreshRate",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!1,configurable:!0}),s.prototype.getScene=function(){return this._scene},Object.defineProperty(s.prototype,"cubeTexture",{get:function(){return this._renderTargetTexture},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"renderList",{get:function(){return this._renderTargetTexture.renderList},enumerable:!1,configurable:!0}),s.prototype.attachToMesh=function(e){this._attachedMesh=e},s.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},s.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)},s.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},s.prototype.getClassName=function(){return"ReflectionProbe"},s.prototype.serialize=function(){var e=a.a.Serialize(this,this._renderTargetTexture.serialize());return e.isReflectionProbe=!0,e},s.Parse=function(e,t,i){var n=null;if(t.reflectionProbes)for(var r=0;r<t.reflectionProbes.length;r++){var o=t.reflectionProbes[r];if(o.name===e.name){n=o;break}}return(n=a.a.Parse(function(){return n||new s(e.name,e.renderTargetSize,t,e._generateMipMaps)},e,t,i)).cubeTexture._waitingRenderList=e.renderList,e._attachedMesh&&n.attachToMesh(t.getMeshByID(e._attachedMesh)),n},Object(n.c)([Object(a.k)()],s.prototype,"_attachedMesh",void 0),Object(n.c)([Object(a.o)()],s.prototype,"position",void 0),s);function s(e,t,i,n,r){var o=this;void 0===n&&(n=!0),void 0===r&&(r=!1),this.name=e,this._viewMatrix=l.a.Identity(),this._target=l.e.Zero(),this._add=l.e.Zero(),this._invertYAxis=!1,this.position=l.e.Zero(),this._scene=i,this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this);var a,s=u.a.TEXTURETYPE_UNSIGNED_BYTE;r&&((a=this._scene.getEngine().getCaps()).textureHalfFloatRender?s=u.a.TEXTURETYPE_HALF_FLOAT:a.textureFloatRender&&(s=u.a.TEXTURETYPE_FLOAT)),this._renderTargetTexture=new c.a(e,t,i,n,!0,s,!0),this._renderTargetTexture.onBeforeRenderObservable.add(function(e){switch(e){case 0:o._add.copyFromFloats(1,0,0);break;case 1:o._add.copyFromFloats(-1,0,0);break;case 2:o._add.copyFromFloats(0,o._invertYAxis?1:-1,0);break;case 3:o._add.copyFromFloats(0,o._invertYAxis?-1:1,0);break;case 4:o._add.copyFromFloats(0,0,1);break;case 5:o._add.copyFromFloats(0,0,-1)}o._attachedMesh&&o.position.copyFrom(o._attachedMesh.getAbsolutePosition()),o.position.addToRef(o._add,o._target),l.a.LookAtLHToRef(o.position,o._target,l.e.Up(),o._viewMatrix),i.activeCamera&&(o._projectionMatrix=l.a.PerspectiveFovLH(Math.PI/2,1,i.activeCamera.minZ,i.activeCamera.maxZ),i.setTransformMatrix(o._viewMatrix,o._projectionMatrix)),i._forcedViewPosition=o.position}),this._renderTargetTexture.onAfterUnbindObservable.add(function(){i._forcedViewPosition=null,i.updateTransformMatrix(!0)})}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var c,n=i(1),a=i(186),r=i(62),l=i(9),u=i(13),h=(i(130),i(2)),o=(c=r.a,Object(n.d)(s,c),s.prototype.loadImage=function(i,t){var n=this,r=document.createElement("canvas"),o=new Image;o.addEventListener("load",function(){n._width=o.width,n._height=o.height,r.width=n._width,r.height=n._height;var e=r.getContext("2d");e.drawImage(o,0,0);var t=e.getImageData(0,0,o.width,o.height);n._buffer=t.data.buffer,r.remove(),i()}),o.addEventListener("error",function(e){t&&t(n.getClassName()+" could not be loaded",e)}),o.src=this.url},s.prototype.loadTexture=function(){var o=this,e=this.getScene();e&&(this._texture=e.getEngine().createRawCubeTextureFromUrl(this.url,e,this._size,h.a.TEXTUREFORMAT_RGB,e.getEngine().getCaps().textureFloat?h.a.TEXTURETYPE_FLOAT:h.a.TEXTURETYPE_UNSIGNED_INTEGER,this._noMipmap,function(){for(var e=o.getFloat32ArrayFromArrayBuffer(o._buffer),t=a.a.ConvertPanoramaToCubemap(e,o._width,o._height,o._size),i=[],n=0;n<6;n++){var r=t[s._FacesMapping[n]];i.push(r)}return i},null,this._onLoad,this._onError))},s.prototype.getFloat32ArrayFromArrayBuffer=function(e){for(var t=new DataView(e),i=new Float32Array(3*e.byteLength/4),n=0,r=0;r<e.byteLength;r++)(r+1)%4!=0&&(i[n++]=t.getUint8(r)/255);return i},s.prototype.getClassName=function(){return"EquiRectangularCubeTexture"},s.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=new s(this.url,e,this._size,this._noMipmap,this.gammaSpace);return t.level=this.level,t.wrapU=this.wrapU,t.wrapV=this.wrapV,t.coordinatesIndex=this.coordinatesIndex,t.coordinatesMode=this.coordinatesMode,t},s._FacesMapping=["right","left","up","down","front","back"],s);function s(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=null),void 0===a&&(a=null);var s=c.call(this,t)||this;
1if(s._onLoad=null,s._onError=null,s.coordinatesMode=l.a.CUBIC_MODE,!e)throw new Error("Image url is not set");return s.name=e,s.url=e,s._size=i,s._noMipmap=n,s.gammaSpace=r,s._onLoad=o,s._onError=a,s.hasAlpha=!1,s.isCube=!0,s._texture=s._getFromCache(e,s._noMipmap),s._texture?o&&(s._texture.isReady?u.b.SetImmediate(function(){return o()}):s._texture.onLoadedObservable.add(o)):t.useDelayedTextureLoading?s.delayLoadState=h.a.DELAYLOADSTATE_NOTLOADED:s.loadImage(s.loadTexture.bind(s),s._onError),s}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(13),r=i(17),o=(a.prototype.register=function(){this.scene._beforeClearStage.registerStep(r.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},a.prototype.rebuild=function(){},a.prototype.dispose=function(){},a.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){n.b.StartPerformanceCounter("Procedural textures",0<this.scene.proceduralTextures.length);for(var e=0;e<this.scene.proceduralTextures.length;e++){var t=this.scene.proceduralTextures[e];t._shouldRender()&&t.render()}n.b.EndPerformanceCounter("Procedural textures",0<this.scene.proceduralTextures.length)}},a);function a(e){this.name=r.a.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(46),s=i(0),c=i(14),r=(o.prototype.startDirectionFunction=function(e,t,i,n){var r=c.a.RandomRange(this.direction1.x,this.direction2.x),o=c.a.RandomRange(this.direction1.y,this.direction2.y),a=c.a.RandomRange(this.direction1.z,this.direction2.z);if(n)return t.x=r,t.y=o,void(t.z=a);s.e.TransformNormalFromFloatsToRef(r,o,a,e,t)},o.prototype.startPositionFunction=function(e,t,i,n){var r=c.a.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),o=c.a.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),a=c.a.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);if(n)return t.x=r,t.y=o,void(t.z=a);s.e.TransformCoordinatesFromFloatsToRef(r,o,a,e,t)},o.prototype.clone=function(){var e=new o;return n.a.DeepCopy(this,e),e},o.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2),e.setVector3("minEmitBox",this.minEmitBox),e.setVector3("maxEmitBox",this.maxEmitBox)},o.prototype.getEffectDefines=function(){return"#define BOXEMITTER"},o.prototype.getClassName=function(){return"BoxParticleEmitter"},o.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},o.prototype.parse=function(e){s.e.FromArrayToRef(e.direction1,0,this.direction1),s.e.FromArrayToRef(e.direction2,0,this.direction2),s.e.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),s.e.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},o);function o(){this.direction1=new s.e(0,1,0),this.direction2=new s.e(0,1,0),this.minEmitBox=new s.e(-.5,-.5,-.5),this.maxEmitBox=new s.e(.5,.5,.5)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype.dispose=function(){for(var e=0,t=this._workerInfos;e<t.length;e++)t[e].worker.terminate();delete this._workerInfos,delete this._pendingActions},r.prototype.push=function(e){for(var t=0,i=this._workerInfos;t<i.length;t++){var n=i[t];if(!n.active)return void this._execute(n,e)}this._pendingActions.push(e)},r.prototype._execute=function(t,e){var i=this;t.active=!0,e(t.worker,function(){t.active=!1;var e=i._pendingActions.shift();e&&i._execute(t,e)})},r);function r(e){this._pendingActions=new Array,this._workerInfos=e.map(function(e){return{worker:e,active:!1}})}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(10),o=i(14),a=(s.prototype.updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},s.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var i=this._initialEndSpriteCellID-this._initialStartSpriteCellID,n=o.a.Clamp(e*t%this.lifeTime/this.lifeTime);this.cellIndex=this._initialStartSpriteCellID+n*i|0},s.prototype._inheritParticleInfoToSubEmitter=function(e){var t,i;e.particleSystem.emitter.position?((t=e.particleSystem.emitter).position.copyFrom(this.position),e.inheritDirection&&(i=n.c.Vector3[0],this.direction.normalizeToRef(i),t.setDirection(i,0,Math.PI/2))):e.particleSystem.emitter.copyFrom(this.position),this.direction.scaleToRef(e.inheritedVelocityAmount/2,n.c.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(n.c.Vector3[0])},s.prototype._inheritParticleInfoToSubEmitters=function(){var t=this;this._attachedSubEmitters&&0<this._attachedSubEmitters.length&&this._attachedSubEmitters.forEac
1h(function(e){t._inheritParticleInfoToSubEmitter(e)})},s.prototype._reset=function(){this.age=0,this.id=s._Count++,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},s.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),this._localPosition&&(e._localPosition?e._localPosition.copyFrom(this._localPosition):e._localPosition=this._localPosition.clone()),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&&this.remapData?e.remapData.copyFrom(this.remapData):e.remapData=new n.f(0,0,0,0)),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))},s._Count=0,s);function s(e){this.particleSystem=e,this.position=n.e.Zero(),this.direction=n.e.Zero(),this.color=new r.b(0,0,0,0),this.colorStep=new r.b(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new n.d(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new r.b(0,0,0,0),this._currentColor2=new r.b(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=s._Count++,this.particleSystem.isAnimationSheetEnabled&&this.updateCellInfoFromSystem()}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(10),o=i(6),a=(Object.defineProperty(s.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e,this.height=e},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"animationStarted",{get:function(){return this._animationStarted},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"manager",{get:function(){return this._manager},enumerable:!1,configurable:!0}),s.prototype.getClassName=function(){return"Sprite"},Object.defineProperty(s.prototype,"fromIndex",{get:function(){return this._fromIndex},set:function(e){this.playAnimation(e,this._toIndex,this._loopAnimation,this._delay,this._onAnimationEnd)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"toIndex",{get:function(){return this._toIndex},set:function(e){this.playAnimation(this._fromIndex,e,this._loopAnimation,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"loopAnimation",{get:function(){return this._loopAnimation},set:function(e){this.playAnimation(this._fromIndex,this._toIndex,e,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"delay",{get:function(){return Math.max(this._delay,1)},set:function(e){this.playAnimation(this._fromIndex,this._toIndex,this._loopAnimation,e,this._onAnimationEnd)},enumerable:!1,configurable:!0}),s.prototype.playAnimation=function(e,t,i,n,r){void 0===r&&(r=null),this._fromIndex=e,this._toIndex=t,this._loopAnimation=i,this._delay=n||1,this._animationStarted=!0,e<t?this._direction=1:(this._direction=-1,this._toIndex=e,this._fromIndex=t),this.cellIndex=e,this._time=0,this._onAnimationEnd=r},s.prototype.stopAnimation=function(){this._animationStarted=!1},s.prototype._animate=function(e){this._animationStarted&&(this._time+=e,this._time>this._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(0<this._direction&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex<this._fromIndex)&&(this._loopAnimation?this.cellIndex=0<this._direction?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onAnimationEnd&&this._onAnimationEnd(),this.disposeWhenFinishedAnimating&&this.dispose()))))},s.prototype.dispose=function(){for(var e=0;e<this._manager.sprites.length;e++)this._manager.sprites[e]==this&&this._manager.sprites.splice(e,1);this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},s.prototype.serialize=function(){var e={};return e.name=this.name,e.position=this.position.asArray(),e.color=this.color.asArray(),e.width=this.width,e.height=this.height,e.angle=this.angle,e.cellIndex=this.cellIndex,e.cellRef=this.cellRef,e.invertU=this.invertU,e.invertV=this.invertV,e.disposeWhenFinishedAnimating=this.disposeWhenFinishedAnimating,e.isPickable=this.isPickable,e.isVisible=this.isVisible,e.useAlphaForPicking=this.useAlphaForPicking,e.animationStarted=this.animationStarted,e.fromIndex=this.fromIndex,e.toIndex=this.toIndex,e.loopAnimation=this.loopAnimation,e.delay=this.delay,e},s.Parse=function(e,t){var i=new s(e.name,t);return i.position=n.e.FromArray(e.position),i.color=r.b.FromArray(e.color),i.width=e.width,i.height=e.height,i.angle=e.angle,i.cellIndex=e.cellIndex,i.cellRef=e.cellRef,i.invertU=e.invertU,i.invertV=e.invertV,i.disposeWhenFinishedAnimating=e.disposeWhenFinishedAnimating,i.isPickable=e.isPickable,i.isVisible=e.isVisible,i.useAlphaForPicking=e.useAlphaForPicking,i.fromIndex=e.fromIndex,i.toIndex=e.toIndex,i.loopAnimation=e.loopAnimation,i.delay=e.delay,e.animationStarted&&i.playAnimation(i.fromIndex,i.toIndex,i.loopAnimation,i.delay),i},s);function s(e,t){this.name=e,this.color=new r.b(1,1,1,1),this.width=1,this.height=1,this.angle=0,this.invertU=!1,this.invertV=!1,this.animations=new Array,this.isPickable=!1,this.useAlphaForPicking=!1,this.onDisposeObservable=new o.c,this._animationStarted=!1,this._loopAnimation=!1,this._fromIndex=0,this._toIndex=0,this._delay=0,this._direction=1,this._time=0,this._onAnimationEnd=null,this.isVisible=!0,this._manager=t,this._manager.sprites.push(this),this.uniqueId=this._manager.scene.getUniqueId(),this.position=n.e.Zero()}},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(6),r=i(18),o=i(45),c=i(66),a=i(17),s=i(53),l=i(2);r.a.prototype._internalPickSprites=function(e,t,i,n){if(!c.a)return null;var r=null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}if(0<this.spriteManagers.length)for(var o=0;o<this.spriteManagers.length;o++){var a=this.spriteManagers[o];if(a.isPickable){var s=a.intersects(e,n,t,i);if(s&&s.hit&&(i||null==r||!(s.distance>=r.distance))&&(r=s,i))break}}return r||new c.a},r.a.prototype._internalMultiPickSprites=function(e,t,i){if(!c.a)return null;var n=new Array;
1if(!i){if(!this.activeCamera)return null;i=this.activeCamera}if(0<this.spriteManagers.length)for(var r=0;r<this.spriteManagers.length;r++){var o,a=this.spriteManagers[r];!a.isPickable||null!==(o=a.multiIntersects(e,i,t))&&(n=n.concat(o))}return n},r.a.prototype.pickSprite=function(e,t,i,n,r){return this.createPickingRayInCameraSpaceToRef(e,t,this._tempSpritePickingRay,r),this._internalPickSprites(this._tempSpritePickingRay,i,n,r)},r.a.prototype.pickSpriteWithRay=function(e,t,i,n){if(!this._tempSpritePickingRay)return null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}return o.a.TransformToRef(e,n.getViewMatrix(),this._tempSpritePickingRay),this._internalPickSprites(this._tempSpritePickingRay,t,i,n)},r.a.prototype.multiPickSprite=function(e,t,i,n){return this.createPickingRayInCameraSpaceToRef(e,t,this._tempSpritePickingRay,n),this._internalMultiPickSprites(this._tempSpritePickingRay,i,n)},r.a.prototype.multiPickSpriteWithRay=function(e,t,i){if(!this._tempSpritePickingRay)return null;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}return o.a.TransformToRef(e,i.getViewMatrix(),this._tempSpritePickingRay),this._internalMultiPickSprites(this._tempSpritePickingRay,t,i)},r.a.prototype.setPointerOverSprite=function(e){this._pointerOverSprite!==e&&(this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(l.a.ACTION_OnPointerOutTrigger,s.a.CreateNewFromSprite(this._pointerOverSprite,this)),this._pointerOverSprite=e,this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(l.a.ACTION_OnPointerOverTrigger,s.a.CreateNewFromSprite(this._pointerOverSprite,this)))},r.a.prototype.getPointerOverSprite=function(){return this._pointerOverSprite};var u=(h.prototype.register=function(){this.scene._pointerMoveStage.registerStep(a.a.STEP_POINTERMOVE_SPRITE,this,this._pointerMove),this.scene._pointerDownStage.registerStep(a.a.STEP_POINTERDOWN_SPRITE,this,this._pointerDown),this.scene._pointerUpStage.registerStep(a.a.STEP_POINTERUP_SPRITE,this,this._pointerUp)},h.prototype.rebuild=function(){},h.prototype.dispose=function(){this.scene.onBeforeSpritesRenderingObservable.clear(),this.scene.onAfterSpritesRenderingObservable.clear();for(var e=this.scene.spriteManagers;e.length;)e[0].dispose()},h.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},h.prototype._pointerMove=function(e,t,i,n,r){var o=this.scene;return!n&&(i=this._pickSpriteButKeepRay(i,e,t,!1,o.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite?(o.setPointerOverSprite(i.pickedSprite),o.doNotHandleCursors||(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},h.prototype._pointerDown=function(e,t,i,n){var r=this.scene;if(r._pickedDownSprite=null,0<r.spriteManagers.length&&(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(l.a.ACTION_OnLeftPickTrigger,s.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(l.a.ACTION_OnCenterPickTrigger,s.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(l.a.ACTION_OnRightPickTrigger,s.a.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(l.a.ACTION_OnPickDownTrigger,s.a.CreateNewFromSprite(i.pickedSprite,r,n))}return i},h.prototype._pointerUp=function(e,t,i,n){var r,o=this.scene;return 0<o.spriteManagers.length&&(r=o.pickSprite(e,t,this._spritePredicate,!1,o.cameraToUseForPointers||void 0))&&(r.hit&&r.pickedSprite&&r.pickedSprite.actionManager&&(r.pickedSprite.actionManager.processTrigger(l.a.ACTION_OnPickUpTrigger,s.a.CreateNewFromSprite(r.pickedSprite,o,n)),r.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||r.pickedSprite.actionManager.processTrigger(l.a.ACTION_OnPickTrigger,s.a.CreateNewFromSprite(r.pickedSprite,o,n)))),o._pickedDownSprite&&o._pickedDownSprite.actionManager&&o._pickedDownSprite!==r.pickedSprite&&o._pickedDownSprite.actionManager.processTrigger(l.a.ACTION_OnPickOutTrigger,s.a.CreateNewFromSprite(o._pickedDownSprite,o,n))),i},h);function h(e){this.name=a.a.NAME_SPRITE,this.scene=e,this.scene.spriteManagers=new Array,this.scene._tempSpritePickingRay=o.a?o.a.Zero():null,this.scene.onBeforeSpritesRenderingObservable=new n.c,this.scene.onAfterSpritesRenderingObservable=new n.c,this._spritePredicate=function(e){return!!e.actionManager&&e.isPickable&&e.actionManager.hasPointerTriggers}}},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1);var d=i(18),g=i(6),v=i(4),b=i(0),s=i(294),y=i(295),T=i(66),E=i(9),p=i(29),S=i(17),A=i(2),f=i(7),n=i(5),r=(i(201),i(225),"uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include<fogFragment>\ngl_FragColor=color;\n}");n.a.ShadersStore.spritesPixelShader=r,i(226);n.a.ShadersStore.spritesVertexShader="\nattribute vec4 position;\nattribute vec4 options;\nattribute vec2 inverts;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include<fogVertexDeclaration>\nvoid main(void) {\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz;\nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0);\n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));\nvec2 uvPlace=cellInfo.xy;\nvec2 uvSize=cellInfo.zw;\nvUV.x=uvPlace.x+uvSize.x*uvOffset.x;\nvUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}";var C=i(12),l=i(55),o=(Object.defineProperty(u.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"children",{get:function(){return this.sprites},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"capacity",{get:function(){return this._capacity},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"texture",{get:function(){return this._spriteTexture},set:function(e){this._spriteTexture=e,this._spriteTexture.wrapU=E.a.CLAMP_ADDRESSMODE,this._spriteTexture.wrapV=E.a.CLAMP_ADDRESSMODE,this._textureContent=null},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"blendMode",{get:function(){return this._blendMode},set:function(e){this._blendMode=e},enumerable:!1,configurable:!0}),u.prototype.getClassName=function(){return"SpriteManager"},u.prototype._makePacked=function(e,t){var i=this;if(null!==t)try{var n=void 0;if((n="string"==typeof t?JSON.parse(t):t).frames.length){for(var r={},o=0;o<n.frames.length;o++){var a=n.frames[o];if("string"!=typeof Object.keys(a)[0])throw new Error("Invalid JSON Format. Check the frame values and make sure the name is the first parameter.");r[a[Object.keys(a)[0]]]=a}n.frames=r}var s=Reflect.ownKeys(n.frames);this._spriteMap=s,this._packedAndReady=!0,this._cellData=n.frames}catch(e){throw this._fromPacked=!1,this._packedAndReady=!1,new Error("Invalid JSON from string. Spritesheet managed with constant cell size.")}else{for(var c=/\./g,l=void 0;l=c.lastIndex,c.test(e),0<c.lastIndex;);var u=e.substring(0,l-1)+".json",h=new XMLHttpRequest;h.open("GET",u,!0),h.onerror=function(){f.a.Error("JSON ERROR: Unable to load JSON file."),i._fromPacked=!1,i._packedAndReady=!1},h.onload=function(){try{var e=JSON.parse(h.response),t=Reflect.ownKeys(e.frames);i._spriteMap=t,i._packedAndReady=!0,i._cellData=e.frames}catch(e){throw i._fromPacked=!1,i._packedAndReady=!1,new Error("Invalid JSON format. Please check documentation for format specifications.")}},h.send()}},u.prototype._appendSpriteVertex=function(e,t,i,n,r){var o,a,s,c=18*e;0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),this._vertexData[c]=t.position.x,this._vertexData[1+c]=t.position.y,this._vertexData[2+c]=t.position.z,this._vertexData[3+c]=t.angle,this._vertexData[4+c]=t.width,this._vertexData[5+c]=t.height,this._vertexData[6+c]=i,this._vertexData[7+c]=n,this._scene.useRightHandedSystem?this._vertexData[8+c]=t.invertU?0:1:this._vertexData[8+c]=t.invertU?1:0,this._vertexData[9+c]=t.invertV?1:0,this._packedAndReady?(t.cellRef||(t.cellIndex=0),"number"==typeof(o=t.cellIndex)&&isFinite(o)&&Math.floor(o)===o&&(t.cellRef=this._spriteMap[t.cellIndex]),t._xOffset=this._cellData[t.cellRef].frame.x/r.width,t._yOffset=this._cellData[t.cellRef].frame.y/r.height,t._xSize=this._cellData[t.cellRef].frame.w,t._ySize=this._cellData[t.cellRef].frame.h,this._vertexData[10+c]=t._xOffset,this._vertexData[11+c]=t._yOffset,this._vertexData[12+c]=t._xSize/r.width,this._vertexData[13+c]=t._ySize/r.height):(t.cellIndex||(t.cellIndex=0),a=r.width/this.cellWidth,s=t.cellIndex/a>>0,t._xOffset=(t.cellIndex-s*a)*this.cellWidth/r.width,t._yOffset=s*this.cellHeight/r.height,t._xSize=this.cellWidth,t._ySize=this.cellHeight,this._vertexData[10+c]=t._xOffset,this._vertexData[11+c]=t._yOffset,this._vertexData[12+c]=this.cellWidth/r.width,this._vertexData[13+c]=this.cellHeight/r.height),this._vertexData[14+c]=t.color.r,this._vertexData[15+c]=t.color.g,this._vertexData[16+c]=t.color.b,this._vertexData[17+c]=t.color.a},u.prototype._checkTextureAlpha=function(e,t,i,n,r){if(!e.useAlphaForPicking||!this._spriteTexture)return!0;var o=this._spriteTexture.getSize();this._textureContent||(this._textureContent=new Uint8Array(o.width*o.height*4),this._spriteTexture.readPixels(0,0,this._textureContent));var a=b.c.Vector3[0];a.copyFrom(t.direction),a.normalize(),a.scaleInPlace(i),a.addInPlace(t.origin);var s=(a.x-n.x)/(r.x-n.x)-.5,c=1-(a.y-n.y)/(r.y-n.y)-.5,l=e.angle,u=s*Math.cos(l)-c*Math.sin(l)+.5,h=s*Math.sin(l)+c*Math.cos(l)+.5,d=e._xOffset*o.width+u*e._xSize|0,p=e._yOffset*o.height+h*e._ySize|0;return.5<this._textureContent[4*(d+p*o.width)+3]},u.prototype.intersects=function(e,t,i,n){for(var r=Math.min(this._capacity,this.sprites.length),o=b.e.Zero(),a=b.e.Zero(),s=Number.MAX_VALUE,c=null,l=b.c.Vector3[0],u=b.c.Vector3[1],h=t.getViewMatrix(),d=0;d<r;d++){var p=this.sprites[d];if(p){if(i){if(!i(p))continue}else if(!p.isPickable)continue;if(b.e.TransformCoordinatesToRef(p.position,h,u),o.copyFromFloats(u.x-p.width/2,u.y-p.height/2,u.z),a.copyFromFloats(u.x+p.width/2,u.y+p.height/2,u.z),e.intersectsBoxMinMax(o,a)){var f=b.e.Distance(u,e.origin);if(f<s){if(!this._checkTextureAlpha(p,e,f,o,a))continue;if(s=f,c=p,n)break}}}}if(c){var m=new T.a;h.invertToRef(b.c.Matrix[0]),m.hit=!0,m.pickedSprite=c,m.distance=s;var _=b.c.Vector3[2];return _.copyFrom(e.direction),_.normalize(),_.scaleInPlace(s),e.origin.addToRef(_,l),m.pickedPoint=b.e.TransformCoordinates(l,b.c.Matrix[0]),m}return null},u.prototype.multiIntersects=function(e,t,i){for(var n,r=Math.min(this._capacity,this.sprites.length),o=b.e.Zero(),a=b.e.Zero(),s=[],c=b.c.Vector3[0].copyFromFloats(0,0,0),l=b.c.Vector3[1].copyFromFloats(0,0,0),u=t.getViewMatrix(),h=0;h<r;h++){var d=this.sprites[h];if(d){if(i){if(!i(d))continue}else if(!d.isPickable)continue;if(b.e.TransformCoordinatesToRef(d.position,u,l),o.copyFromFloats(l.x-d.width/2,l.y-d.height/2,l.z),a.copyFromFloats(l.x+d.width/2,l.y+d.height/2,l.z),e.intersectsBoxMinMax(o,a)){if(n=b.e.Distance(l,e.origin),!this._checkTextureAlpha(d,e,n,o,a))continue;var p=new T.a;s.push(p),u.invertToRef(b.c.Matrix[0]),p.hit=!0,p.pickedSprite=d,p.distance=n;var f=b.c.Vector3[2];f.copyFrom(e.direction),f.normalize(),f.scaleInPlace(n),e.origin.addToRef(f,c),p.pickedPoint=b.e.TransformCoordinates(c,b.c.Matrix[0])}}}return s},u.prototype.render=function(){if(this._effectBase.isReady()&&this._effectFog.isReady()&&this._spriteTexture&&this._spriteTexture.isReady()&&this.sprites.length&&(!this._fromPacked||this._packedAndReady&&this._spriteMap&&this._cellData)){for(var e,t,i,n,r=this._scene.getEngine(),o=this._spriteTexture.getBaseSize(),a=r.getDeltaTime(),s=Math.min(this._capacity,this.sprites.length),c=0,l=!0,u=0;u<s;u++){var h=this.sprites[u];h&&h.isVisible&&(l=!1,h._animate(a),this._appendSpriteVertex(c++,h,0,0,o),this._appendSpriteVertex(c++,h,1,0,o),this._appendSpriteVertex(c++,h,1,1,o),this._appendSpriteVertex(c++,h,0,1,o))}l||(this._buffer.update(this._vertexData),e=this._effectBase,this._scene.fogEnabled&&this._scene.fogMode!==d.a.FOGMODE_NONE&&this.fogEnabled&&(e=this._effectFog),r.enableEffect(e),t=this._scene.getViewMatrix(),e.setTexture("diffuseSampler",this._spriteTexture),e.setMatr
1ix("view",t),e.setMatrix("projection",this._scene.getProjectionMatrix()),this._scene.fogEnabled&&this._scene.fogMode!==d.a.FOGMODE_NONE&&this.fogEnabled&&(e.setFloat4("vFogInfos",this._scene.fogMode,this._scene.fogStart,this._scene.fogEnd,this._scene.fogDensity),e.setColor3("vFogColor",this._scene.fogColor)),r.bindBuffers(this._vertexBuffers,this._indexBuffer,e),i=r.depthCullingState.cull||!0,n=r.depthCullingState.zOffset,this._scene.useRightHandedSystem&&r.setState(i,n,!1,!1),r.setDepthFunctionToLessOrEqual(),this.disableDepthWrite||(e.setBool("alphaTest",!0),r.setColorWrite(!1),r.drawElementsType(p.a.TriangleFillMode,0,c/4*6),r.setColorWrite(!0),e.setBool("alphaTest",!1)),r.setAlphaMode(this._blendMode),r.drawElementsType(p.a.TriangleFillMode,0,c/4*6),r.setAlphaMode(A.a.ALPHA_DISABLE),this._scene.useRightHandedSystem&&r.setState(i,n,!1,!0))}},u.prototype.dispose=function(){this._buffer&&(this._buffer.dispose(),this._buffer=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._spriteTexture&&(this._spriteTexture.dispose(),this._spriteTexture=null),this._textureContent=null;var e=this._scene.spriteManagers.indexOf(this);this._scene.spriteManagers.splice(e,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},u.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};t.name=this.name,t.capacity=this.capacity,t.cellWidth=this.cellWidth,t.cellHeight=this.cellHeight,this.texture&&(e?t.texture=this.texture.serialize():(t.textureUrl=this.texture.name,t.invertY=this.texture._invertY)),t.sprites=[];for(var i=0,n=this.sprites;i<n.length;i++){var r=n[i];t.sprites.push(r.serialize())}return t},u.Parse=function(e,t,i){var n=new u(e.name,"",e.capacity,{width:e.cellWidth,height:e.cellHeight},t);e.texture?n.texture=E.a.Parse(e.texture,t,i):e.textureName&&(n.texture=new E.a(i+e.textureUrl,t,!1,void 0===e.invertY||e.invertY));for(var r=0,o=e.sprites;r<o.length;r++){var a=o[r];s.a.Parse(a,n)}return n},u.ParseFromFileAsync=function(o,e,a,s){return void 0===s&&(s=""),new Promise(function(i,n){var r=new l.a;r.addEventListener("readystatechange",function(){var e,t;4==r.readyState&&(200==r.status?(e=JSON.parse(r.responseText),t=u.Parse(e,a||C.a.LastCreatedScene,s),o&&(t.name=o),i(t)):n("Unable to load the sprite manager"))}),r.open("GET",e),r.send()})},u.CreateFromSnippetAsync=function(a,s,c){var e=this;return void 0===c&&(c=""),new Promise(function(n,r){var o=new l.a;o.addEventListener("readystatechange",function(){var e,t,i;4==o.readyState&&(200==o.status?(e=JSON.parse(JSON.parse(o.responseText).jsonPayload),t=JSON.parse(e.spriteManager),(i=u.Parse(t,s||C.a.LastCreatedScene,c)).snippetId=a,n(i)):r("Unable to load the snippet "+a))}),o.open("GET",e.SnippetUrl+"/"+a.replace(/#/g,"/")),o.send()})},u.SnippetUrl="https://snippet.babylonjs.com",u);function u(e,t,i,n,r,o,a,s,c){if(void 0===o&&(o=.01),void 0===a&&(a=E.a.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=!1),void 0===c&&(c=null),this.name=e,this.sprites=new Array,this.renderingGroupId=0,this.layerMask=268435455,this.fogEnabled=!0,this.isPickable=!1,this._packedAndReady=!1,this.onDisposeObservable=new g.c,this._vertexBuffers={},this._blendMode=A.a.ALPHA_COMBINE,this.disableDepthWrite=!1,r._getComponent(S.a.NAME_SPRITE)||r._addComponent(new y.a(r)),this._capacity=i,this._fromPacked=s,t&&(this._spriteTexture=new E.a(t,r,!0,!1,a),this._spriteTexture.wrapU=E.a.CLAMP_ADDRESSMODE,this._spriteTexture.wrapV=E.a.CLAMP_ADDRESSMODE),n.width&&n.height)this.cellWidth=n.width,this.cellHeight=n.height;else{if(void 0===n)return;this.cellWidth=n,this.cellHeight=n}this._epsilon=o,this._scene=r||C.a.LastCreatedScene,this._scene.spriteManagers.push(this),this.uniqueId=this.scene.getUniqueId();for(var l=[],u=0,h=0;h<i;h++)l.push(u),l.push(u+1),l.push(u+2),l.push(u),l.push(u+2),l.push(u+3),u+=4;this._indexBuffer=r.getEngine().createIndexBuffer(l),this._vertexData=new Float32Array(18*i*4),this._buffer=new v.a(r.getEngine(),this._vertexData,!0,18);var d=this._buffer.createVertexBuffer(v.b.PositionKind,0,4),p=this._buffer.createVertexBuffer("options",4,4),f=this._buffer.createVertexBuffer("inverts",8,2),m=this._buffer.createVertexBuffer("cellInfo",10,4),_=this._buffer.createVertexBuffer(v.b.ColorKind,14,4);this._vertexBuffers[v.b.PositionKind]=d,this._vertexBuffers.options=p,this._vertexBuffers.inverts=f,this._vertexBuffers.cellInfo=m,this._vertexBuffers[v.b.ColorKind]=_,this._effectBase=this._scene.getEngine().createEffe
1ct("sprites",[v.b.PositionKind,"options","inverts","cellInfo",v.b.ColorKind],["view","projection","textureInfos","alphaTest"],["diffuseSampler"],""),this._effectFog=this._scene.getEngine().createEffect("sprites",[v.b.PositionKind,"options","inverts","cellInfo",v.b.ColorKind],["view","projection","textureInfos","alphaTest","vFogInfos","vFogColor"],["diffuseSampler"],"#define FOG"),this._fromPacked&&this._makePacked(t,c)}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var u=i(33),h=i(14),d=i(2),r=i(212),n=i(5);n.a.ShadersStore.hdrFilteringVertexShader="\nattribute vec2 position;\n\nvarying vec3 direction;\n\nuniform vec3 up;\nuniform vec3 right;\nuniform vec3 front;\nvoid main(void) {\nmat3 view=mat3(up,right,front);\ndirection=view*vec3(position,1.0);\ngl_Position=vec4(position,0.0,1.0);\n}",i(74),i(346),i(347),i(348);n.a.ShadersStore.hdrFilteringPixelShader="#include<helperFunctions>\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nuniform float alphaG;\nuniform samplerCube inputTexture;\nuniform vec2 vFilteringInfo;\nuniform float hdrScale;\nvarying vec3 direction;\nvoid main() {\nvec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);\ngl_FragColor=vec4(color*hdrScale,1.0);\n}";var o=i(7),a=(s.prototype._createRenderTarget=function(e){var t=d.a.TEXTURETYPE_UNSIGNED_BYTE;this._engine.getCaps().textureHalfFloatRender?t=d.a.TEXTURETYPE_HALF_FLOAT:this._engine.getCaps().textureFloatRender&&(t=d.a.TEXTURETYPE_FLOAT);var i=this._engine.createRenderTargetCubeTexture(e,{format:d.a.TEXTUREFORMAT_RGBA,type:t,generateMipMaps:!1,generateDepthBuffer:!1,generateStencilBuffer:!1,samplingMode:d.a.TEXTURE_NEAREST_SAMPLINGMODE});return this._engine.updateTextureWrappingMode(i,d.a.TEXTURE_CLAMP_ADDRESSMODE,d.a.TEXTURE_CLAMP_ADDRESSMODE,d.a.TEXTURE_CLAMP_ADDRESSMODE),this._engine.updateTextureSamplingMode(d.a.TEXTURE_TRILINEAR_SAMPLINGMODE,i,!0),i},s.prototype._prefilterInternal=function(e){var t=e.getSize().width,i=Math.round(h.a.Log2(t))+1,n=this._effectWrapper.effect,r=this._createRenderTarget(t);this._effectRenderer.setViewport();var o=e.getInternalTexture();o&&this._engine.updateTextureSamplingMode(d.a.TEXTURE_TRILINEAR_SAMPLINGMODE,o,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper);var a=[[new u.y(0,0,-1),new u.y(0,-1,0),new u.y(1,0,0)],[new u.y(0,0,1),new u.y(0,-1,0),new u.y(-1,0,0)],[new u.y(1,0,0),new u.y(0,0,1),new u.y(0,1,0)],[new u.y(1,0,0),new u.y(0,0,-1),new u.y(0,-1,0)],[new u.y(1,0,0),new u.y(0,-1,0),new u.y(0,0,1)],[new u.y(-1,0,0),new u.y(0,-1,0),new u.y(0,0,-1)]];n.setFloat("hdrScale",this.hdrScale),n.setFloat2("vFilteringInfo",e.getSize().width,i),n.setTexture("inputTexture",e);for(var s=0;s<6;s++){n.setVector3("up",a[s][0]),n.setVector3("right",a[s][1]),n.setVector3("front",a[s][2]);for(var c=0;c<i;c++){this._engine.bindFramebuffer(r,s,void 0,void 0,!0,c),this._effectRenderer.applyEffectWrapper(this._effectWrapper);var l=Math.pow(2,(c-this._lodGenerationOffset)/this._lodGenerationScale)/t;0===c&&(l=0),n.setFloat("alphaG",l),this._effectRenderer.draw()}}return this._effectRenderer.restoreStates(),this._engine.restoreDefaultFramebuffer(),this._engine._releaseFramebufferObjects(r),this._engine._releaseTexture(e._texture),r._swapAndDie(e._texture),e._prefiltered=!0,e},s.prototype._createEffect=function(e,t){var i=[];return e.gammaSpace&&i.push("#define GAMMA_INPUT"),i.push("#define NUM_SAMPLES "+this.quality+"u"),new r.b({engine:this._engine,name:"hdrFiltering",vertexShader:"hdrFiltering",fragmentShader:"hdrFiltering",samplerNames:["inputTexture"],uniformNames:["vSampleDirections","vWeights","up","right","front","vFilteringInfo","hdrScale","alphaG"],useShaderStore:!0,defines:i,onCompiled:t})},s.prototype.isReady=function(e){return e.isReady()&&this._effectWrapper.effect.isReady()},s.prototype.prefilter=function(t,i){var n=this;if(void 0===i&&(i=null),1!==this._engine.webGLVersion)return new Promise(function(e){n._effectRenderer=new r.a(n._engine),n._effectWrapper=n._createEffect(t),n._effectWrapper.effect.executeWhenCompiled(function(){n._prefilterInternal(t),n._effectRenderer.dispose(),n._effectWrapper.dispose(),e(),i&&i()})});o.a.Warn("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.")},s);function s(e,t){void 0===t&&(t={}),this._lodGenerationOffset=0,this._lodGenerationScale=.8,this.qual
1ity=d.a.TEXTURE_FILTERING_QUALITY_OFFLINE,this.hdrScale=1,this._engine=e,this.hdrScale=t.hdrScale||this.hdrScale,this.quality=t.hdrScale||this.quality}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(1),r=i(23);i(5).a.ShadersStore.anaglyphPixelShader="\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}";var s,o=(s=r.a,Object(n.d)(a,s),a);function a(e,t,i,n,r,o){var a=s.call(this,e,"anaglyph",null,["leftSampler"],t,i[1],n,r,o)||this;return a._passedProcess=i[0]._rigPostProcess,a.onApplyObservable.add(function(e){e.setTextureFromPostProcess("leftSampler",a._passedProcess)}),a}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var p=i(2),f=i(23),n=i(133),r=i(6);i(5).a.ShadersStore.minmaxReduxPixelShader="attribute vec2 vUV;\nuniform sampler2D textureSampler;\n#if defined(INITIAL)\nuniform sampler2D sourceTexture;\nuniform vec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*(texSize-1.0));\nfloat f1=texelFetch(sourceTexture,coord,0).r;\nfloat f2=texelFetch(sourceTexture,coord+ivec2(1,0),0).r;\nfloat f3=texelFetch(sourceTexture,coord+ivec2(1,1),0).r;\nfloat f4=texelFetch(sourceTexture,coord+ivec2(0,1),0).r;\nfloat minz=min(min(min(f1,f2),f3),f4);\n#ifdef DEPTH_REDUX\nfloat maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4);\n#else\nfloat maxz=max(max(max(f1,f2),f3),f4);\n#endif\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(MAIN)\nuniform vec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*(texSize-1.0));\nvec2 f1=texelFetch(textureSampler,coord,0).rg;\nvec2 f2=texelFetch(textureSampler,coord+ivec2(1,0),0).rg;\nvec2 f3=texelFetch(textureSampler,coord+ivec2(1,1),0).rg;\nvec2 f4=texelFetch(textureSampler,coord+ivec2(0,1),0).rg;\nfloat minz=min(min(min(f1.x,f2.x),f3.x),f4.x);\nfloat maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(ONEBEFORELAST)\nuniform ivec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*vec2(texSize-1));\nvec2 f1=texelFetch(textureSampler,coord % texSize,0).rg;\nvec2 f2=texelFetch(textureSampler,(coord+ivec2(1,0)) % texSize,0).rg;\nvec2 f3=texelFetch(textureSampler,(coord+ivec2(1,1)) % texSize,0).rg;\nvec2 f4=texelFetch(textureSampler,(coord+ivec2(0,1)) % texSize,0).rg;\nfloat minz=min(f1.x,f2.x);\nfloat maxz=max(f1.y,f2.y);\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(LAST)\nvoid main(void)\n{\ndiscard;\nglFragColor=vec4(0.);\n}\n#endif\n";var o=(Object.defineProperty(a.prototype,"sourceTexture",{get:function(){return this._sourceTexture},enumerable:!1,configurable:!0}),a.prototype.setSourceTexture=function(e,t,i,n){var r,o,a=this;if(void 0===i&&(i=p.a.TEXTURETYPE_HALF_FLOAT),void 0===n&&(n=!0),e!==this._sourceTexture){this.dispose(!1),this._sourceTexture=e,this._reductionSteps=[],this._forceFullscreenViewport=n;var s=this._camera.getScene(),c=new f.a("Initial reduction phase","minmaxRedux",["texSize"],["sourceTexture"],1,null,p.a.TEXTURE_NEAREST_NEAREST,s.getEngine(),!1,"#define INITIAL"+(t?"\n#define DEPTH_REDUX":""),i,void 0,void 0,void 0,p.a.TEXTUREFORMAT_RG);c.autoClear=!1,c.forceFullscreenViewport=n;var l=this._sourceTexture.getRenderWidth(),u=this._sourceTexture.getRenderHeight();c.onApply=(r=l,o=u,function(e){e.setTexture("sourceTexture",a._sourceTexture),e.setFloatArray2("texSize",new Float32Array([r,o]))}),this._reductionSteps.push(c);for(var h=1;1<l||1<u;){l=Math.max(Math.round(l/2),1),u=Math.max(Math.round(u/2),1);var d=new f.a("Reduction phase "+h,"minmaxRedux",["texSize"],null,{width:l,height:u},null,p.a.TEXTURE_NEAREST_NEAREST,s.getEngine(),!1,"#define "+(1==l&&1==u?"LAST":1==l||1==u?"ONEBEFORELAST":"MAIN"),i,void 0,void 0,void 0,p.a.TEXTUREFORMAT_RG);d.autoClear=!1,d.forceFullscreenViewport=n,d.onApply=function(t,i){return function(e){1==t||1==i?e.setIntArray2("texSize",new Int32Array([t,i])):e.setFloatArray2("texSize",new Float32Array([t,i]))}}
1(l,u),this._reductionSteps.push(d),h++,1==l&&1==u&&d.onAfterRenderObservable.add(function(e,t,i){var n=new Float32Array(4*e*t),r={min:0,max:0};return function(){s.getEngine()._readTexturePixels(i.inputTexture,e,t,-1,0,n),r.min=n[0],r.max=n[1],a.onAfterReductionPerformed.notifyObservers(r)}}(l,u,d))}}},Object.defineProperty(a.prototype,"refreshRate",{get:function(){return this._sourceTexture?this._sourceTexture.refreshRate:-1},set:function(e){this._sourceTexture&&(this._sourceTexture.refreshRate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"activated",{get:function(){return this._activated},enumerable:!1,configurable:!0}),a.prototype.activate=function(){var e=this;!this._onAfterUnbindObserver&&this._sourceTexture&&(this._onAfterUnbindObserver=this._sourceTexture.onAfterUnbindObservable.add(function(){e._reductionSteps[0].activate(e._camera),e._postProcessManager.directRender(e._reductionSteps,e._reductionSteps[0].inputTexture,e._forceFullscreenViewport),e._camera.getScene().getEngine().unBindFramebuffer(e._reductionSteps[0].inputTexture,!1)}),this._activated=!0)},a.prototype.deactivate=function(){this._onAfterUnbindObserver&&this._sourceTexture&&(this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=null,this._activated=!1)},a.prototype.dispose=function(e){if(void 0===e&&(e=!0),e&&this.onAfterReductionPerformed.clear(),this.deactivate(),this._reductionSteps){for(var t=0;t<this._reductionSteps.length;++t)this._reductionSteps[t].dispose();this._reductionSteps=null}this._postProcessManager&&e&&this._postProcessManager.dispose(),this._sourceTexture=null},a);function a(e){this.onAfterReductionPerformed=new r.c,this._forceFullscreenViewport=!0,this._activated=!1,this._camera=e,this._postProcessManager=new n.a(e.getScene())}},function(e,t,i){"use strict";i.d(t,"a",function(){return R});var n,r,o=i(1),a=i(56),s=i(125),d=i(0),c=i(45),h=i(85),p=i(79),f=i(89),m=i(26),_=i(24),g=i(35),v=i(135),b=i(120),l=i(97),u=i(58),y=i(87),T=i(10),E=i(47),S=i(20),A=i(6);function C(n){var e,r=0,o=Date.now();n.observableParameters=null!==(e=n.observableParameters)&&void 0!==e?e:{};var a=n.contextObservable.add(function(e){var t=Date.now(),i={startTime:o,currentTime:t,deltaTime:r=t-o,completeRate:r/n.timeout,payload:e};n.onTick&&n.onTick(i),n.breakCondition&&n.breakCondition()&&(n.contextObservable.remove(a),n.onAborted&&n.onAborted(i)),r>=n.timeout&&(n.contextObservable.remove(a),n.onEnded&&n.onEnded(i))},n.observableParameters.mask,n.observableParameters.insertFirst,n.observableParameters.scope);return a}function P(e){var t,i,r=this;this.onEachCountObservable=new A.c,this.onTimerAbortedObservable=new A.c,this.onTimerEndedObservable=new A.c,this.onStateChangedObservable=new A.c,this._observer=null,this._breakOnNextTick=!1,this._tick=function(e){var t=Date.now();r._timer=t-r._startTime;var i={startTime:r._startTime,currentTime:t,deltaTime:r._timer,completeRate:r._timer/r._timeToEnd,payload:e},n=r._breakOnNextTick||r._breakCondition(i);n||r._timer>=r._timeToEnd?r._stop(i,n):r.onEachCountObservable.notifyObservers(i)},this._setState(n.INIT),this._contextObservable=e.contextObservable,this._observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{},this._breakCondition=null!==(i=e.breakCondition)&&void 0!==i?i:function(){return!1},e.onEnded&&this.onTimerEndedObservable.add(e.onEnded),e.onTick&&this.onEachCountObservable.add(e.onTick),e.onAborted&&this.onTimerAbortedObservable.add(e.onAborted)}(r=n=n||{})[r.INIT=0]="INIT",r[r.STARTED=1]="STARTED",r[r.ENDED=2]="ENDED",Object.defineProperty(P.prototype,"breakCondition",{set:function(e){this._breakCondition=e},enumerable:!1,configurable:!0}),P.prototype.clearObservables=function(){this.onEachCountObservable.clear(),this.onTimerAbortedObservable.clear(),this.onTimerEndedObservable.clear(),this.onStateChangedObservable.clear()},P.prototype.start=function(e){if(void 0===e&&(e=this._timeToEnd),this._state===n.STARTED)throw new Error("Timer already started. Please stop it before starting again");this._timeToEnd=e,this._startTime=Date.now(),this._timer=0,this._observer=this._contextObservable.add(this._tick,this._observableParameters.mask,this._observableParameters.insertFirst,this._observableParameters.scope),this._setState(n.STARTED)},P.prototype.stop=function(){this._state===n.STARTED&&(this._breakOnNextTick=!0)},P.prototype.dispose=function(){this._observer&&this._contextObservable.remove(this._observer),this.clearObservables()},P.prototype._setState=function(e){this._state=e,this.onStateChangedObservable.notifyObservers(this._state)},P.prototype._stop=function(e,t){void 0===t&&(t=!1),this._contextObservable.remove(this._observer),this._setState(n.ENDED),t?this.onTimerAbortedObservable.notifyObservers(e):this.onTimerEndedObservable.notifyObservers(e)};var x,R=(x=y.a,Object(o.d)(O,x),Object.defineProperty(O.prototype,"snapPointsOnly",{get:function(){return!!this._options.snapPointsOnly},set:function(e){this._options.snapPointsOnly=e}
1,enumerable:!1,configurable:!0}),O.prototype.addFloorMesh=function(e){this._floorMeshes.push(e)},O.prototype.addSnapPoint=function(e){this._snapToPositions.push(e)},O.prototype.attach=function(){var t=this;return!!x.prototype.attach.call(this)&&(this._currentTeleportationControllerId="",this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,function(e){t._detachController(e.uniqueId)}),!0)},O.prototype.detach=function(){var t=this;return!(!x.prototype.detach.call(this)||(Object.keys(this._controllers).forEach(function(e){t._detachController(e)}),this._setTargetMeshVisibility(!1),this._currentTeleportationControllerId=""))},O.prototype.dispose=function(){x.prototype.dispose.call(this),this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.dispose(!1,!0)},O.prototype.removeFloorMesh=function(e){var t=this._floorMeshes.indexOf(e);-1!==t&&this._floorMeshes.splice(t,1)},O.prototype.removeFloorMeshByName=function(e){var t=this._xrSessionManager.scene.getMeshByName(e);t&&this.removeFloorMesh(t)},O.prototype.removeSnapPoint=function(e){var t=this._snapToPositions.indexOf(e);if(-1===t)for(var i=0;i<this._snapToPositions.length;++i)if(this._snapToPositions[i].equals(e)){t=i;break}return-1!==t&&(this._snapToPositions.splice(t,1),!0)},O.prototype.setSelectionFeature=function(e){this._selectionFeature=e},O.prototype._onXRFrame=function(e){var i=this,t=this._xrSessionManager.currentFrame,n=this._xrSessionManager.scene;if(this.attach&&t){var r=this._options.teleportationTargetMesh;if(this._currentTeleportationControllerId){if(!r)return;r.rotationQuaternion=r.rotationQuaternion||new d.b;var o,a,s,c,l,u,h=this._controllers[this._currentTeleportationControllerId];h.teleportationState.forward?(d.b.RotationYawPitchRollToRef(h.teleportationState.currentRotation+h.teleportationState.baseRotation,0,0,r.rotationQuaternion),o=!1,h.xrController.getWorldPointerRayToRef(this._tmpRay),(a=n.pickWithRay(this._tmpRay,function(e){var t=i._floorMeshes.indexOf(e);return-1!==t&&i._floorMeshes[t].absolutePosition.y<i._options.xrInput.xrCamera.position.y}))&&a.pickedPoint?(o=!0,this._setTargetMeshPosition(a.pickedPoint),this._setTargetMeshVisibility(!0),this._showParabolicPath(a)):this.parabolicRayEnabled&&(s=h.xrController.pointer.rotationQuaternion.toEulerAngles().x,c=Math.PI/2-Math.abs(s)+1,l=this.parabolicCheckRadius*c,this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(2*l),this._tmpVector),this._tmpVector.y=this._tmpRay.origin.y,this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(l)),this._tmpVector.subtractToRef(this._tmpRay.origin,this._tmpRay.direction),this._tmpRay.direction.normalize(),(u=n.pickWithRay(this._tmpRay,function(e){return-1!==i._floorMeshes.indexOf(e)}))&&u.pickedPoint&&(o=!0,this._setTargetMeshPosition(u.pickedPoint),this._setTargetMeshVisibility(!0),this._showParabolicPath(u))),this._setTargetMeshVisibility(o)):this._setTargetMeshVisibility(!1)}else this._setTargetMeshVisibility(!1)}},O.prototype._createDefaultTargetMesh=function(){this._options.defaultTargetMeshOptions=this._options.defaultTargetMeshOptions||{};var e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||E.a.DefaultUtilityLayer.utilityLayerScene:this._xrSessionManager.scene,t=v.a.CreateGround("teleportationTarget",{width:2,height:2,subdivisions:2},e);t.isPickable=!1;var i=new h.a("teleportationPlaneDynamicTexture",512,e,!0);i.hasAlpha=!0;var n=i.getContext();n.beginPath(),n.arc(256,256,200,0,2*Math.PI,!1),n.fillStyle=this._options.defaultTargetMeshOptions.teleportationFillColor||"#444444",n.fill(),n.lineWidth=10,n.strokeStyle=this._options.defaultTargetMeshOptions.teleportationBorderColor||"#FFFFFF",n.stroke(),n.closePath(),i.update();var r=new g.a("teleportationPlaneMaterial",e);r.diffuseTexture=i,t.material=r;var o,a,s,c=b.a.CreateTorus("torusTeleportation",{diameter:.75,thickness:.1,tessellation:20},e);c.isPickable=!1,c.parent=t,this._options.defaultTargetMeshOptions.disableAnimation||(o=new m.a("animationInnerCircle","position.y",30,m.a.ANIMATIONTYPE_FLOAT,m.a.ANIMATIONLOOPMODE_CYCLE),(a=[]).push({frame:0,value:0}),a.push({frame:30,value:.4}),a.push({frame:60,value:0}),o.setKeys(a),(s=new f.m).setEasingMode(f.f.EASINGMODE_EASEINOUT),o.setEasingFunction(s),c.animations=[],c.animations.push(o),e.beginAnimation(c,0,60,!0));var l,u=p.a.CreateCylinder("cone",{diameterTop:0,tessellation:4},e);u.isPickable=!1,u.scaling.set(.5,.12,.2),u.rotate(_.a.X,Math.PI/2),u.position.z=.6,u.parent=c,this._options.defaultTargetMeshOptions.torusArrowMaterial?(c.material=this._options.defaultTargetMeshOptions.torusArrowMaterial,u.material=this._options.defaultTargetMeshOptions.torusArrowMaterial):((l=new g.a("torusConsMat",e)).disableLighting=!!this._options.defaultTargetMeshOptions.disableLighting,l.disableLighting?l.emissiveColor=new T.a(.3,.3,1):l.diffuseColor=new T.a(.3,.3,1),l.alpha=.9,c.material=l,u.material=l,this._teleportationRingMaterial=l),void 0!==this._options.renderingGroupId&&(t.renderingGroupId=this._options.renderingGroupId,c.renderingGroupId=this._options.renderingGroupId,u.renderingGroupId=this._options.renderingGroupId),this._options.teleportationTargetMesh=t},O.prototype._detachController=function(e){var t=this._controllers[e];t&&(t.teleportationComponent&&(t.onAxisChangedObserver&&t.teleportationComponent.onAxisValueChangedObservable.remove(t.onAxisChangedObserver),t.onButtonChangedObserver&&t.teleportationComponent.onButtonStateChangedObservable.remove(t.onButtonChangedObserver)),delete this._controllers[e])},O.prototype._findClosestSnapPointWithRadius=function(i,e){void 0===e&&(e=this._options.snapToPositionRadius||.8);var n,r=null,o=Number.MAX_VALUE;return this._snapToPositions.length&&(n=e*e,this._snapToPositions.forEach(function(e){var t=d.e.DistanceSquared(e,i);t<=n&&t<o&&(o=t,r=e)})),r},O.prototype._setTargetMeshPosition=function(e){var t;this._options.teleportationTargetMesh&&(t=this._findClosestSnapPointWithRadius(e),this._snappedToPoint=!!t,this.snapPointsOnly&&!this._snappedToPoint&&this._teleportationRingMaterial?this._teleportationRingMaterial.diffuseColor.set(1,.3,.3):this.snapPointsOnly&&this._snappedToPoint&&this._teleportationRingMaterial&&this._teleportationRingMaterial.diffuseColor.set(.3,.3,1),this._options.teleportationTargetMesh.position.copyFrom(t||e),this._options.teleportationTargetMesh.position.y+=.01)},O.prototype._setTargetMeshVisibility=function(t){this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.isVisible!==t&&(this._options.teleportationTargetMesh.isVisible=t,this._options.teleportationTargetMesh.getChildren(void 0,!1).forEac
1h(function(e){e.isVisible=t}),t?this._selectionFeature&&this._selectionFeature.detach():(this._quadraticBezierCurve&&this._quadraticBezierCurve.dispose(),this._selectionFeature&&this._selectionFeature.attach()))},O.prototype._showParabolicPath=function(e){var t,i;e.pickedPoint&&(t=this._controllers[this._currentTeleportationControllerId],i=l.d.CreateQuadraticBezier(t.xrController.pointer.absolutePosition,e.ray.origin,e.pickedPoint,25),this._quadraticBezierCurve&&this._quadraticBezierCurve.dispose(),this._quadraticBezierCurve=u.a.CreateLines("path line",{points:i.getPoints()}),this._quadraticBezierCurve.isPickable=!1)},O.prototype._teleportForward=function(e){var t,i=this._controllers[e];i.teleportationState.forward&&(i.teleportationState.forward=!1,this._currentTeleportationControllerId="",(!this.snapPointsOnly||this._snappedToPoint)&&this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.isVisible)&&(t=this._options.xrInput.xrCamera.realWorldHeight,this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position),this._options.xrInput.xrCamera.position.y+=t,this._options.xrInput.xrCamera.rotationQuaternion.multiplyInPlace(d.b.FromEulerAngles(0,i.teleportationState.currentRotation-(this._xrSessionManager.scene.useRightHandedSystem?Math.PI:0),0)))},O.Name=a.a.TELEPORTATION,O.Version=1,O);function O(e,t){var o=x.call(this,e)||this;return o._options=t,o._controllers={},o._snappedToPoint=!1,o._tmpRay=new c.a(new d.e,new d.e),o._tmpVector=new d.e,o.backwardsMovementEnabled=!0,o.backwardsTeleportationDistance=.7,o.parabolicCheckRadius=5,o.parabolicRayEnabled=!0,o.rotationAngle=Math.PI/8,o.rotationEnabled=!0,o._attachController=function(n){var r;o._controllers[n.uniqueId]||(o._controllers[n.uniqueId]={xrController:n,teleportationState:{forward:!1,backwards:!1,rotating:!1,currentRotation:0,baseRotation:0}},"tracked-pointer"===(r=o._controllers[n.uniqueId]).xrController.inputSource.targetRayMode&&r.xrController.inputSource.gamepad?n.onMotionControllerInitObservable.addOnce(function(){if(n.motionController){var e=n.motionController.getComponentOfType(s.a.THUMBSTICK_TYPE)||n.motionController.getComponentOfType(s.a.TOUCHPAD_TYPE);if(!e||o._options.useMainComponentOnly){var t=n.motionController.getMainComponent();if(!t)return;r.onButtonChangedObserver=t.onButtonStateChangedObservable.add(function(){t.changes.pressed&&(t.changes.pressed.current?(r.teleportationState.forward=!0,o._currentTeleportationControllerId=r.xrController.uniqueId,r.teleportationState.baseRotation=o._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,r.teleportationState.currentRotation=0,C({timeout:o._options.timeToTeleport||3e3,contextObservable:o._xrSessionManager.onXRFrameObservable,breakCondition:function(){return!t.pressed},onEnded:function(){o._currentTeleportationControllerId===r.xrController.uniqueId&&r.teleportationState.forward&&o._teleportForward(n.uniqueId)}})):(r.teleportationState.forward=!1,o._currentTeleportationControllerId=""))})}else r.onAxisChangedObserver=e.onAxisValueChangedObservable.add(function(e){var t,i;e.y<=.7&&r.teleportationState.backwards&&(r.teleportationState.backwards=!1),.7<e.y&&!r.teleportationState.forward&&o.backwardsMovementEnabled&&!o.snapPointsOnly&&!r.teleportationState.backwards&&(r.teleportationState.backwards=!0,o._tmpVector.set(0,0,o.backwardsTeleportationDistance*(o._xrSessionManager.scene.useRightHandedSystem?-1:1)),o._tmpVector.rotateByQuaternionToRef(o._options.xrInput.xrCamera.rotationQuaternion,o._tmpVector),o._tmpVector.addInPlace(o._options.xrInput.xrCamera.position),o._options.xrInput.xrCamera.position.subtractToRef(o._tmpVector,o._tmpVector),o._tmpRay.origin.copyFrom(o._tmpVector),o._tmpRay.direction.set(0,o._xrSessionManager.scene.useRightHandedSystem?1:-1,0),(t=o._xrSessionManager.scene.pickWithRay(o._tmpRay,function(e){return-1!==o._floorMeshes.indexOf(e)}))&&t.pickedPoint&&o._options.xrInput.xrCamera.position.addInPlace(t.pickedPoint)),e.y<-.7&&!o._currentTeleportationControllerId&&!r.teleportationState.rotating&&(r.teleportationState.forward=!0,o._currentTeleportationControllerId=r.xrController.uniqueId,r.teleportationState.baseRotation=o._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y),e.x?r.teleportationState.forward?o._currentTeleportationControllerId===r.xrController.uniqueId&&(o.rotationEnabled?setTimeout(function(){r.teleportationState.currentRotation=Math.atan2(e.x,e.y*(o._xrSessionManager.scene.useRightHandedSystem?1:-1))}):r.teleportationState.currentRotation=0):!r.teleportationState.rotating&&.7<Math.abs(e.x)&&(r.teleportationState.rotating=!0,i=o.rotationAngle*(0<e.x?1:-1)*(o._xrSessionManager.scene.useRightHandedSystem?-1:1),o._options.xrInput.xrCamera.rotationQuaternion.multiplyInPlace(d.b.FromEulerAngles(0,i,0))):r.teleportationState.rotating=!1,0===e.x&&0===e.y&&r.teleportationState.forward&&o._teleportForward(n.uniqueId)})}}):o._xrSessionManager.scene.onPointerObservable.add(function(e){e.type===S.a.POINTERDOWN?(r.teleportationState.forward=!0,o._currentTeleportationControllerId=r.xrController.uniqueId,r.teleportationState.baseRotation=o._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,r.teleportationState.currentRotation=0,C({timeout:o._options.timeToTeleport||3e3,contextObservable:o._xrSessionManager.onXRFrameObservable,onEnded:function(){o._currentTeleportationControllerId===r.xrController.uniqueId&&r.teleportationState.forward&&o._teleportForward(n.uniqueId)}})):e.type===S.a.POINTERUP&&(r.teleportationState.forward=!1,o._currentTeleportationControllerId="")}))},o._options.teleportationTargetMesh||o._createDefaultTargetMesh(),o._floorMeshes=o._options.floorMeshes||[],o._snapToPositions=o._options.snapPositions||[],o._setTargetMeshVisibility(!1),o}a.b.AddWebXRFeature(R.Name,function(e,t){return function(){return new R(e,t)}},R.Version,!0)},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r,"UniqueId",{get:function(){var e=this._UniqueIdCounter;return this._UniqueIdCounter++,e}
1,enumerable:!1,configurable:!0}),r._UniqueIdCounter=0,r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(1),r=i(3),o=i(13),v=i(20),a=(s.prototype.attachControl=function(d,p){var f=this,m=this.camera.getEngine(),_=0,g=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(e,t){var i=e.event,n="touch"===i.pointerType;if(!m.isInVRExclusivePointerMode&&(e.type===v.a.POINTERMOVE||-1!==f.buttons.indexOf(i.button))){var r,o,a,s,c,l=i.srcElement||i.target;if(f._altKey=i.altKey,f._ctrlKey=i.ctrlKey,f._metaKey=i.metaKey,f._shiftKey=i.shiftKey,f._buttonsPressed=i.buttons,m.isPointerLock){var u=i.movementX||i.mozMovementX||i.webkitMovementX||i.msMovementX||0,h=i.movementY||i.mozMovementY||i.webkitMovementY||i.msMovementY||0;f.onTouch(null,u,h),f.pointA=null,f.pointB=null}else if(e.type===v.a.POINTERDOWN&&l){try{l.setPointerCapture(i.pointerId)}catch(e){}null===f.pointA?f.pointA={x:i.clientX,y:i.clientY,pointerId:i.pointerId,type:i.pointerType}:null===f.pointB&&(f.pointB={x:i.clientX,y:i.clientY,pointerId:i.pointerId,type:i.pointerType}),f.onButtonDown(i),p||(i.preventDefault(),d.focus())}else if(e.type===v.a.POINTERDOUBLETAP)f.onDoubleTap(i.pointerType);else if(e.type===v.a.POINTERUP&&l){try{l.releasePointerCapture(i.pointerId)}catch(e){}n||(f.pointB=null),m._badOS?f.pointA=f.pointB=null:f.pointB&&f.pointA&&f.pointA.pointerId==i.pointerId?(f.pointA=f.pointB,f.pointB=null):f.pointA&&f.pointB&&f.pointB.pointerId==i.pointerId?f.pointB=null:f.pointA=f.pointB=null,0===_&&!g||(f.onMultiTouch(f.pointA,f.pointB,_,0,g,null),_=0,g=null),f.onButtonUp(i),p||i.preventDefault()}else e.type===v.a.POINTERMOVE&&(p||i.preventDefault(),f.pointA&&null===f.pointB?(u=i.clientX-f.pointA.x,h=i.clientY-f.pointA.y,f.onTouch(f.pointA,u,h),f.pointA.x=i.clientX,f.pointA.y=i.clientY):f.pointA&&f.pointB&&((r=f.pointA.pointerId===i.pointerId?f.pointA:f.pointB).x=i.clientX,r.y=i.clientY,s=(o=f.pointA.x-f.pointB.x)*o+(a=f.pointA.y-f.pointB.y)*a,c={x:(f.pointA.x+f.pointB.x)/2,y:(f.pointA.y+f.pointB.y)/2,pointerId:i.pointerId,type:e.type},f.onMultiTouch(f.pointA,f.pointB,_,s,g,c),g=c,_=s))}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,v.a.POINTERDOWN|v.a.POINTERUP|v.a.POINTERMOVE),this._onLostFocus=function(){f.pointA=f.pointB=null,_=0,g=null,f.onLostFocus()},d.addEventListener("contextmenu",this.onContextMenu.bind(this),!1);var e=this.camera.getScene().getEngine().getHostWindow();e&&o.b.RegisterTopRootEvents(e,[{name:"blur",handler:this._onLostFocus}])},s.prototype.detachControl=function(e){var t;!this._onLostFocus||(t=this.camera.getScene().getEngine().getHostWindow())&&o.b.UnregisterTopRootEvents(t,[{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},s.prototype.getClassName=function(){return"BaseCameraPointersInput"},s.prototype.getSimpleName=function(){return"pointers"},s.prototype.onDoubleTap=function(e){},s.prototype.onTouch=function(e,t,i){},s.prototype.onMultiTouch=function(e,t,i,n,r,o){},s.prototype.onContextMenu=function(e){e.preventDefault()},s.prototype.onButtonDown=function(e){},s.prototype.onButtonUp=function(e){},s.prototype.onLostFocus=function(){},Object(n.c)([Object(r.c)()],s.prototype,"buttons",void 0),s);function s(){this.buttons=[0,1,2]}},function(e,t,i){"use strict";var n=i(31),r=i(2);n.a.prototype.setAlphaConstants=function(e,t,i,n){this._alphaState.setAlphaBlendConstants(e,t,i,n)},n.a.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case r.a.ALPHA_DISABLE:this._alphaState.alphaBlend=!1;break;case r.a.ALPHA_PREMULTIPLIED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_PREMULTIPLIED_PORTERDUFF:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_COMBINE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_ADD:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_SUBTRACT:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_MULTIPLY:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_MAXIMIZED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_INTERPOLATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_SCREENMODE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_ONEONE_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_ALPHATOCOLOR:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_REVERSEONEMINUS:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE_MINUS_DST_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_SRC_DSTONEMINUSSRCALPHA:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_ONEONE_ONEZERO:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case r.a.ALPHA_EXCLUSION:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0}t||(this.depthCullingState.depthMask=e===r.a.ALPHA_DISABLE),this._alphaMode=e}},n.a.prototype.getAlphaMode=function(){return this._alphaMode},n.a.prototype.setAlphaEquation=function(e){if(this._alphaEquation!==e){switch(e){case r.a.ALPHA_EQUATION_ADD:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD,this._gl.FUNC_ADD);break;case r.a.ALPHA_EQUATION_SUBSTRACT:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT,this._gl.FUNC_SUBTRACT);break;case r.a.ALPHA_EQUATION_REVERSE_SUBTRACT:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT,this._gl.FUNC_REVERSE_SUBTRACT);break;case r.a.ALPHA_EQUATION_MAX:this._alphaState.setAlphaEquationParameters(this._gl.MAX,this._gl.MAX);break;case r.a.ALPHA_EQUATION_MIN:this._alphaState.setAlphaEquationParameters(this._gl.MIN,this._gl.MIN);break;case r.a.ALPHA_EQUATION_DARKEN:this._alphaState.setAlphaEquationParameters(this._gl.MIN,this._gl.FUNC_ADD)}this._alphaEquation=e}},n.a.prototype.getAlphaEquation=function(){return this._alphaEquation}},function(e,t,i){"use strict";var n=i(31),r=i(122);n.a.prototype.createUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");var i=new r.a(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},n.a.prototype.createDynamicUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");var i=new r.a(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},n.a.prototype.updateUniformBuffer=function(e,t,i,n){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===n?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+n)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+n)),this.bindUniformBuffer(null)},n.a.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},n.a.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},n.a.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)}},function(e,t,i){"use strict";i.d(t,"a",function(){return c});
1var n=i(37),r=i(0),o=i(13),a=i(117),s=i(6);a.a.prototype.addDeviceOrientation=function(){return this._deviceOrientationInput||(this._deviceOrientationInput=new c,this.add(this._deviceOrientationInput)),this};var c=(l.WaitForOrientationChangeAsync=function(r){return new Promise(function(e,t){var i=!1,n=function(){window.removeEventListener("deviceorientation",n),i=!0,e()};r&&setTimeout(function(){i||(window.removeEventListener("deviceorientation",n),t("WaitForOrientationChangeAsync timed out"))},r),"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(function(e){"granted"==e?window.addEventListener("deviceorientation",n):o.b.Warn("Permission not granted.")}).catch(function(e){o.b.Error(e)}):window.addEventListener("deviceorientation",n)})},Object.defineProperty(l.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 r.b),this._camera&&this._camera.onDisposeObservable.add(function(){t._onDeviceOrientationChangedObservable.clear()})},enumerable:!1,configurable:!0}),l.prototype.attachControl=function(e,t){var i,n=this,r=this.camera.getScene().getEngine().getHostWindow();r&&(i=function(){r.addEventListener("orientationchange",n._orientationChanged),r.addEventListener("deviceorientation",n._deviceOrientation),n._orientationChanged()},"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(function(e){"granted"===e?i():o.b.Warn("Permission not granted.")}).catch(function(e){o.b.Error(e)}):i())},l.prototype.detachControl=function(e){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation),this._alpha=0},l.prototype.checkInputs=function(){this._alpha&&(r.b.RotationYawPitchRollToRef(o.b.ToRadians(this._alpha),o.b.ToRadians(this._beta),-o.b.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},l.prototype.getClassName=function(){return"FreeCameraDeviceOrientationInput"},l.prototype.getSimpleName=function(){return"deviceOrientation"},l);function l(){var t=this;this._screenOrientationAngle=0,this._screenQuaternion=new r.b,this._alpha=0,this._beta=0,this._gamma=0,this._onDeviceOrientationChangedObservable=new s.c,this._orientationChanged=function(){t._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,t._screenOrientationAngle=-o.b.ToRadians(t._screenOrientationAngle/2),t._screenQuaternion.copyFromFloats(0,Math.sin(t._screenOrientationAngle),0,Math.cos(t._screenOrientationAngle))},this._deviceOrientation=function(e){t._alpha=null!==e.alpha?e.alpha:0,t._beta=null!==e.beta?e.beta:0,t._gamma=null!==e.gamma?e.gamma:0,null!==e.alpha&&t._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTranform=new r.b(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}n.a.FreeCameraDeviceOrientationInput=c},function(e,t,i){"use strict";var n=i(25),r=i(0),o=i(77);n.a._setWebVRRigMode=function(e,t){var i,n;t.vrDisplay&&(i=t.vrDisplay.getEyeParameters("left"),n=t.vrDisplay.getEyeParameters("right"),e._rigCameras[0].viewport=new o.a(0,0,.5,1),e._rigCameras[0].setCameraRigParameter("left",!0),e._rigCameras[0].setCameraRigParameter("specs",t.specs),e._rigCameras[0].setCameraRigParameter("eyeParameters",i),e._rigCameras[0].setCameraRigParameter("frameData",t.frameData),e._rigCameras[0].setCameraRigParameter("parentCamera",t.parentCamera),e._rigCameras[0]._cameraRigParams.vrWorkMatrix=new r.a,e._rigCameras[0].getProjectionMatrix=e._getWebVRProjectionMatrix,(e._rigCameras[0].parent=e)._rigCameras[0]._getViewMatrix=e._getWebVRViewMatrix,e._rigCameras[1].viewport=new o.a(.5,0,.5,1),e._rigCameras[1].setCameraRigParameter("eyeParameters",n),e._rigCameras[1].setCameraRigParameter("specs",t.specs),e._rigCameras[1].setCameraRigParameter("frameData",t.frameData),e._rigCameras[1].setCameraRigParameter("parentCamera",t.parentCamera),e._rigCameras[1]._cameraRigParams.vrWorkMatrix=new r.a,e._rigCameras[1].getProjectionMatrix=e._getWebVRProjectionMatrix,(e._rigCameras[1].parent=e)._rigCameras[1]._getViewMatrix=e._getWebVRViewMatrix)}},function(e,t,i){"use strict";var n=i(1),r=i(12),o=i(94),a=i(6),s=i(13),c=i(44);Object.defineProperty(r.a.prototype,"isInVRExclusivePointerMode",{get:function(){return this._vrExclusivePointerMode},enumerable:!0,configurable:!0}),r.a.prototype._prepareVRComponent=function(){this._vrSupported=!1,this._vrExclusivePointerMode=!1,this.onVRDisplayChangedObservable=new a.c,this.onVRRequestPresentComplete=new a.c,this.onVRRequestPresentStart=new a.c},r.a.prototype.isVRDevicePresent=function(){return!!this._vrDisplay},r.a.prototype.getVRDevice=function(){return this._vrDisplay},r.a.prototype.initWebVR=function(){return this.initWebVRAsync(),this.onVRDisplayChangedObservable},r.a.prototype.initWebVRAsync=function(){function t(){var t={vrDisplay:i._vrDisplay,vrSupported:i._vrSupported};i.onVRDisplayChangedObservable.notifyObservers(t),i._webVRInitPromise=new Promise(function(e){e(t)})}var e,i=this;return this._onVrDisplayConnect||(this._onVrDisplayConnect=function(e){i._vrDisplay=e.display,t()},this._onVrDisplayDisconnect=function(){i._vrDisplay.cancelAnimationFrame(i._frameHandler),i._vrDisplay=void 0,i._frameHandler=r.a.QueueNewFrame(i._boundRenderFunction),t()},this._onVrDisplayPresentChange=function(){i._vrExclusivePointerMode=i._vrDisplay&&i._vrDisplay.isPresenting},(e=this.getHostWindow())&&(e.addEventListener("vrdisplayconnect",this._onVrDisplayConnect),e.addEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),e.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange))),this._webVRInitPromise=this._webVRInitPromise||this._getVRDisplaysAsync(),this._webVRInitPromise.then(t),this._webVRInitPromise},r.a.prototype._getVRDisplaysAsync=function(){var i=this;
1return new Promise(function(t){navigator.getVRDisplays?navigator.getVRDisplays().then(function(e){i._vrSupported=!0,i._vrDisplay=e[0],t({vrDisplay:i._vrDisplay,vrSupported:i._vrSupported})}):(i._vrDisplay=void 0,i._vrSupported=!1,t({vrDisplay:i._vrDisplay,vrSupported:i._vrSupported}))})},r.a.prototype.enableVR=function(e){var t,i=this;this._vrDisplay&&!this._vrDisplay.isPresenting&&(this.onVRRequestPresentStart.notifyObservers(this),t={highRefreshRate:!!this.vrPresentationAttributes&&this.vrPresentationAttributes.highRefreshRate,foveationLevel:this.vrPresentationAttributes?this.vrPresentationAttributes.foveationLevel:1,multiview:(this.getCaps().multiview||this.getCaps().oculusMultiview)&&e.useMultiview},this._vrDisplay.requestPresent([Object(n.a)({source:this.getRenderingCanvas(),attributes:t},t)]).then(function(){i.onVRRequestPresentComplete.notifyObservers(!0),i._onVRFullScreenTriggered()}).catch(function(){i.onVRRequestPresentComplete.notifyObservers(!1)}))},r.a.prototype._onVRFullScreenTriggered=function(){var e;this._vrDisplay&&this._vrDisplay.isPresenting?(this._oldSize=new o.a(this.getRenderWidth(),this.getRenderHeight()),this._oldHardwareScaleFactor=this.getHardwareScalingLevel(),e=this._vrDisplay.getEyeParameters("left"),this.setHardwareScalingLevel(1),this.setSize(2*e.renderWidth,e.renderHeight)):(this.setHardwareScalingLevel(this._oldHardwareScaleFactor),this.setSize(this._oldSize.width,this._oldSize.height))},r.a.prototype.disableVR=function(){var e=this;this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.exitPresent().then(function(){return e._onVRFullScreenTriggered()}).catch(function(){return e._onVRFullScreenTriggered()}),c.a.IsWindowObjectExist()&&(window.removeEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted),window.removeEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted),this._onVrDisplayConnect&&(window.removeEventListener("vrdisplayconnect",this._onVrDisplayConnect),this._onVrDisplayDisconnect&&window.removeEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),this._onVrDisplayPresentChange&&window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._onVrDisplayConnect=null,this._onVrDisplayDisconnect=null))},r.a.prototype._connectVREvents=function(e,t){var i,n=this;this._onVRDisplayPointerRestricted=function(){e&&e.requestPointerLock()},this._onVRDisplayPointerUnrestricted=function(){var e;t?t.exitPointerLock&&t.exitPointerLock():(e=n.getHostWindow()).document&&e.document.exitPointerLock&&e.document.exitPointerLock()},c.a.IsWindowObjectExist()&&((i=this.getHostWindow()).addEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted,!1),i.addEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted,!1))},r.a.prototype._submitVRFrame=function(){if(this._vrDisplay&&this._vrDisplay.isPresenting)try{this._vrDisplay.submitFrame()}catch(e){s.b.Warn("webVR submitFrame has had an unexpected failure: "+e)}},r.a.prototype.isVRPresenting=function(){return this._vrDisplay&&this._vrDisplay.isPresenting},r.a.prototype._requestVRFrame=function(){this._frameHandler=r.a.QueueNewFrame(this._boundRenderFunction,this._vrDisplay)}},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.lightsFragmentFunctions="\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\
1nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.logDepthFragment="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bumpVertex="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.fogVertex="#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.logDepthVertex="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif"},function(e,t,i){"use strict";i.d(t,"a",function(){return a}),i.d(t,"b",function(){return s});var n=i(265),r=i(54),o=i(6),a=(l.prototype.getInput=function(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)},l),s=(c.prototype.getDeviceSource=function(e,t){if(void 0===t){if(void 0===this._firstDevice[e])return null;t=this._firstDevice[e]}return this._devices[e]&&void 0!==this._devices[e][t]?this._devices[e][t]:null},c.prototype.getDeviceSources=function(e){return this._devices[e]},c.prototype.dispose=function(){this._deviceInputSystem.dispose()},c.prototype._addDevice=function(e,t){this._devices[e]||(this._devices[e]=new Array),this._devices[e][t]=new a(this._deviceInputSystem,e,t),this._updateFirstDevices(e)},c.prototype._removeDevice=function(e,t){delete this._devices[e][t],this._updateFirstDevices(e)},c.prototype._updateFirstDevices=function(e){switch(e){case r.a.Keyboard:case r.a.Mouse:this._firstDevice[e]=0;break;case r.a.Touch:case r.a.DualShock:case r.a.Xbox:case r.a.Switch:case r.a.Generic:var t=this._devices[e];delete this._firstDevice[e];for(var i=0;i<t.length;i++)if(t[i]){this._firstDevice[e]=i;break}}},c);function c(e){var a=this;this.onBeforeDeviceConnectedObservable=new o.c,this.onBeforeDeviceDisconnectedObservable=new o.c,this.onAfterDeviceConnectedObservable=new o.c,this.onAfterDeviceDisconnectedObservable=new o.c;var t=Object.keys(r.a).length/2;this._devices=new Array(t),this._firstDevice=new Array(t),this._deviceInputSystem=n.a.Create(e),this._deviceInputSystem.onDeviceConnected=function(e,t){a.onBeforeDeviceConnectedObservable.notifyObservers({deviceType:e,deviceSlot:t}),a._addDevice(e,t),a.onAfterDeviceConnectedObservable.notifyObservers({deviceType:e,deviceSlot:t})},this._deviceInputSystem.onDeviceDisconnected=function(e,t){a.onBeforeDeviceDisconnectedObservable.notifyObservers({deviceType:e,deviceSlot:t}),a._removeDevice(e,t),a.onAfterDeviceDisconnectedObservable.notifyObservers({deviceType:e,deviceSlot:t})},this._deviceInputSystem.onInputChanged||(this._deviceInputSystem.onInputChanged=function(e,t,i,n,r){var o;null===(o=a.getDeviceSource(e,t))||void 0===o||o.onInputChangedObservable.notifyObservers({inputIndex:i,previousState:n,currentState:r})})}function l(e,t,i){void 0===i&&(i=0),this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new o.c,this._deviceInputSystem=e}},function(e,t,i){"use strict";var C=i(27),P=i(7),x=i(2),n=i(31);n.a.prototype.bindAttachments=function(e){this._gl.drawBuffers(e)},n.a.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl,r=e[0]._attachments,o=r.length;if(e[0]._MSAAFramebuffer){n.bindFramebuffer(n.READ_FRAMEBUFFER,e[0]._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e[0]._framebuffer);for(var a=0;a<o;a++){for(var s=e[a],c=0;c<o;c++)r[c]=n.NONE;r[a]=n[1<this.webGLVersion?"COLOR_ATTACHMENT"+a:"COLOR_ATTACHMENT"+a+"_WEBGL"],n.readBuffer(r[a]),n.drawBuffers(r),n.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,n.COLOR_BUFFER_BIT,n.NEAREST)}for(a=0;a<o;a++)r[a]=n[1<this.webGLVersion?"COLOR_ATTACHMENT"+a:"COLOR_ATTACHMENT"+a+"_WEBGL"];n.drawBuffers(r)}for(a=0;a<o;a++)!(s=e[a]).generateMipMaps||t||s.isCube||(this._bindTextureDirectly(n.TEXTURE_2D,s,!0),n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null));i&&(e[0]._MSAAFramebuffer&&this._bindUnboundFramebuffer(e[0]._framebuffer),i()),this._bindUnboundFramebuffer(null)},n.a.prototype.createMultipleRenderTarget=function(e,t){var i=!1,n=!0,r=!1,o=!1,a=1,s=x.a.TEXTURETYPE_UNSIGNED_INT,c=x.a.TEXTURE_TRILINEAR_SAMPLINGMODE,l=new Array,u=new Array;void 0!==t&&(i=void 0!==t.generateMipMaps&&t.generateMipMaps,n=void 0===t.generateDepthBuffer||t.generateDepthBuffer,r=void 0!==t.generateStencilBuffer&&t.generateStencilBuffer,o=void 0!==t.generateDepthTexture&&t.generateDepthTexture,a=t.textureCount||1,t.types&&(l=t.types),t.samplingModes&&(u=t.samplingModes));var h=this._gl,d=h.createFramebuffer();this._bindUnboundFramebuffer(d);for(var p,f=e.width||e,m=e.height||e,_=[],g=[],v=this._setupFramebufferDepthAttachments(r,n,f,m),b=0;b<a;b++){var y=u[b]||c,T=l[b]||s;(T!==x.a.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(T!==x.a.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(y=x.a.TEXTURE_NEAREST_SAMPL
1INGMODE);var E=this._getSamplingParameters(y,i);T!==x.a.TEXTURETYPE_FLOAT||this._caps.textureFloat||(T=x.a.TEXTURETYPE_UNSIGNED_INT,P.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var S=new C.a(this,C.b.MultiRenderTarget),A=h[1<this.webGLVersion?"COLOR_ATTACHMENT"+b:"COLOR_ATTACHMENT"+b+"_WEBGL"];_.push(S),g.push(A),h.activeTexture(h["TEXTURE"+b]),h.bindTexture(h.TEXTURE_2D,S._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,m,0,h.RGBA,this._getWebGLTextureType(T),null),h.framebufferTexture2D(h.DRAW_FRAMEBUFFER,A,h.TEXTURE_2D,S._webGLTexture,0),i&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(h.TEXTURE_2D,null),S._framebuffer=d,S._depthStencilBuffer=v,S.baseWidth=f,S.baseHeight=m,S.width=f,S.height=m,S.isReady=!0,S.samples=1,S.generateMipMaps=i,S.samplingMode=y,S.type=T,S._generateDepthBuffer=n,S._generateStencilBuffer=r,S._attachments=g,S._textureArray=_,this._internalTexturesCache.push(S)}return o&&this._caps.depthTextureExtension&&(p=new C.a(this,C.b.MultiRenderTarget),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,p._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,m,0,h.DEPTH_COMPONENT,h.UNSIGNED_SHORT,null),h.framebufferTexture2D(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.TEXTURE_2D,p._webGLTexture,0),p._framebuffer=d,p.baseWidth=f,p.baseHeight=m,p.width=f,p.height=m,p.isReady=!0,p.samples=1,p.generateMipMaps=i,p.samplingMode=h.NEAREST,p._generateDepthBuffer=n,p._generateStencilBuffer=r,_.push(p),this._internalTexturesCache.push(p)),h.drawBuffers(g),this._bindUnboundFramebuffer(null),this.resetTextureCache(),_},n.a.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e[0].samples===t)return t;var i=e[0]._attachments.length;if(0===i)return 1;var n=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e[0]._depthStencilBuffer&&(n.deleteRenderbuffer(e[0]._depthStencilBuffer),e[0]._depthStencilBuffer=null),e[0]._MSAAFramebuffer&&(n.deleteFramebuffer(e[0]._MSAAFramebuffer),e[0]._MSAAFramebuffer=null);for(var r=0;r<i;r++)e[r]._MSAARenderBuffer&&(n.deleteRenderbuffer(e[r]._MSAARenderBuffer),e[r]._MSAARenderBuffer=null);if(1<t&&n.renderbufferStorageMultisample){var o=n.createFramebuffer();if(!o)throw new Error("Unable to create multi sampled framebuffer");this._bindUnboundFramebuffer(o);for(var a=this._setupFramebufferDepthAttachments(e[0]._generateStencilBuffer,e[0]._generateDepthBuffer,e[0].width,e[0].height,t),s=[],r=0;r<i;r++){var c=e[r],l=n[1<this.webGLVersion?"COLOR_ATTACHMENT"+r:"COLOR_ATTACHMENT"+r+"_WEBGL"],u=n.createRenderbuffer();if(!u)throw new Error("Unable to create multi sampled framebuffer");n.bindRenderbuffer(n.RENDERBUFFER,u),n.renderbufferStorageMultisample(n.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(c.type),c.width,c.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,l,n.RENDERBUFFER,u),c._MSAAFramebuffer=o,c._MSAARenderBuffer=u,c.samples=t,c._depthStencilBuffer=a,n.bindRenderbuffer(n.RENDERBUFFER,null),s.push(l)}n.drawBuffers(s)}else this._bindUnboundFramebuffer(e[0]._framebuffer);return this._bindUnboundFramebuffer(null),t}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var h=i(111),n=i(12),d=i(141),r=i(41),o=(a.prototype.canLoad=function(e){return r.a.EndsWith(e,".dds")},a.prototype.loadCubeData=function(e,t,i,n,r){var o=t.getEngine(),a=!1;if(Array.isArray(e))for(var s=0;s<e.length;s++){var c=e[s],l=d.a.GetDDSInfo(c);t.width=l.width,t.height=l.height,a=(l.isRGB||l.isLuminance||1<l.mipmapCount)&&t.generateMipMaps,o._unpackFlipY(l.isCompressed),d.a.UploadDDSLevels(o,t,c,l,a,6,-1,s),l.isFourCC||1!==l.mipmapCount||o.generateMipMapsForCubemap(t)}else{var u=e;l=d.a.GetDDSInfo(u),t.width=l.width,t.height=l.height,i&&(l.sphericalPolynomial=new h.b),a=(l.isRGB||l.isLuminance||1<l.mipmapCount)&&t.generateMipMaps,o._unpackFlipY(l.isCompressed),d.a.UploadDDSLevels(o,t,u,l,a,6),l.isFourCC||1!==l.mipmapCount||o.generateMipMapsForCubemap(t,!1)}
1o._setCubeMapTextureParams(a),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n({isDDS:!0,width:t.width,info:l,data:e,texture:t})},a.prototype.loadData=function(e,t,i){var n=d.a.GetDDSInfo(e),r=(n.isRGB||n.isLuminance||1<n.mipmapCount)&&t.generateMipMaps&&n.width>>n.mipmapCount-1==1;i(n.width,n.height,r,n.isFourCC,function(){d.a.UploadDDSLevels(t.getEngine(),t,e,n,r,1)})},a);function a(){this.supportCascades=!0}n.a._TextureLoaders.push(new o)},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var a=i(106),n=i(12),r=i(41),o=(s.prototype.canLoad=function(e){return r.a.EndsWith(e,".env")},s.prototype.loadCubeData=function(e,t,i,n,r){var o;Array.isArray(e)||((o=a.a.GetEnvInfo(e))?(t.width=o.width,t.height=o.width,a.a.UploadEnvSpherical(t,o),a.a.UploadEnvLevelsAsync(t,e,o).then(function(){t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()})):r&&r("Can not parse the environment file",null))},s.prototype.loadData=function(e,t,i){throw".env not supported in 2d."},s);function s(){this.supportCascades=!1}n.a._TextureLoaders.push(new o)},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var s=i(25),n=i(17),a=i(138),r=i(42);r.a.AddParser(n.a.NAME_EFFECTLAYER,function(e,t,i,n){if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(var r=0;r<e.effectLayers.length;r++){var o=a.a.Parse(e.effectLayers[r],t,n);i.effectLayers.push(o)}}}),r.a.prototype.removeEffectLayer=function(e){var t=this.effectLayers.indexOf(e);return-1!==t&&this.effectLayers.splice(t,1),t},r.a.prototype.addEffectLayer=function(e){this.effectLayers.push(e)};var o=(c.prototype.register=function(){this.scene._isReadyForMeshStage.registerStep(n.a.STEP_ISREADYFORMESH_EFFECTLAYER,this,this._isReadyForMesh),this.scene._cameraDrawRenderTargetStage.registerStep(n.a.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER,this,this._renderMainTexture),this.scene._beforeCameraDrawStage.registerStep(n.a.STEP_BEFORECAMERADRAW_EFFECTLAYER,this,this._setStencil),this.scene._afterRenderingGroupDrawStage.registerStep(n.a.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW,this,this._drawRenderingGroup),this.scene._afterCameraDrawStage.registerStep(n.a.STEP_AFTERCAMERADRAW_EFFECTLAYER,this,this._setStencilBack),this.scene._afterCameraDrawStage.registerStep(n.a.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW,this,this._drawCamera)},c.prototype.rebuild=function(){for(var e=0,t=this.scene.effectLayers;e<t.length;e++)t[e]._rebuild()},c.prototype.serialize=function(e){e.effectLayers=[];for(var t=0,i=this.scene.effectLayers;t<i.length;t++){var n=i[t];n.serialize&&e.effectLayers.push(n.serialize())}},c.prototype.addFromContainer=function(e){var t=this;e.effectLayers&&e.effectLayers.forEach(function(e){t.scene.addEffectLayer(e)})},c.prototype.removeFromContainer=function(e,t){var i=this;e.effectLayers&&e.effectLayers.forEach(function(e){i.scene.removeEffectLayer(e),t&&e.dispose()})},c.prototype.dispose=function(){for(var e=this.scene.effectLayers;e.length;)e[0].dispose()},c.prototype._isReadyForMesh=function(e,t){for(var i=0,n=this.scene.effectLayers;i<n.length;i++){var r=n[i];if(r.hasMesh(e))for(var o=0,a=e.subMeshes;o<a.length;o++){var s=a[o];if(!r.isReady(s,t))return!1}}return!0},c.prototype._renderMainTexture=function(e){this._renderEffects=!1;var t=this._needStencil=!1,i=this.scene.effectLayers;if(i&&0<i.length){this._previousStencilState=this._engine.getStencilBuffer();for(var n=0,r=i;n<r.length;n++){var o,a=r[n];a.shouldRender()&&(!a.camera||a.camera.cameraRigMode===s.a.RIG_MODE_NONE&&e===a.camera||a.camera.cameraRigMode!==s.a.RIG_MODE_NONE&&-1<a.camera._rigCameras.indexOf(e))&&(this._renderEffects=!0,this._needStencil=this._needStencil||a.needStencil(),(o=a._mainTexture)._shouldRender()&&(this.scene.incrementRenderId(),o.render(!1,!1),t=!0))}this.scene.incrementRenderId()}return t},c.prototype._setStencil=function(){this._needStencil&&this._engine.setStencilBuffer(!0)},c.prototype._setStencilBack=function(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},c.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,i=0;i<t.length;i++){var n=t[i];n.renderingGroupId===e&&n.shouldRender()&&n.render()}this._engine.setDepthBuffer(!0)}},c.prototype._drawCamera=function(){this._renderEffects&&this._draw(-1)},c.prototype._drawRenderingGroup=function(e){!this.scene._isInIntermediateRendering()&&this._renderEffects&&this._draw(e)},c);function c(e){this.name=n.a.NAME_EFFECTLAYER,this._renderEffects=!1,this._needStencil=!1,this._previousStencilState=!1,this.scene=e,this._engine=e.getEngine(),e.effectLayers=new Array}a.a._SceneComponentInitialization=function(e){var t=e._getComponent(n.a.NAME_EFFECTLAYER);t||(t=new o(e),e._addComponent(t))}},function(e,t,i){"use strict";var n=i(8),r=i(114),c=i(42),o=i(12),d=i(64),l=i(17);i(380),c.a.AddParser(l.a.NAME_PARTICLESYSTEM,function(e,t,i,n){var r=c.a.GetIndividualParser(l.a.NAME_PARTICLESYSTEM);if(r&&void 0!==e.particleSystems&&null!==e.particleSystems)for(var o=0,a=e.particleSystems.length;o<a;o++){var s=e.particleSystems[o];
1i.particleSystems.push(r(s,t,n))}}),c.a.AddIndividualParser(l.a.NAME_PARTICLESYSTEM,function(e,t,i){return e.activeParticleCount?r.a.Parse(e,t,i):d.a.Parse(e,t,i)}),o.a.prototype.createEffectForParticles=function(e,t,i,n,r,o,a,s){var c;void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===n&&(n="");var l=[],u=[],h=[];return s?s.fillUniformsAttributesAndSamplerNames(u,l,h):(l=d.a._GetAttributeNamesOrOptions(),u=d.a._GetEffectCreationOptions()),-1===n.indexOf(" BILLBOARD")&&(n+="\n#define BILLBOARD\n"),-1===i.indexOf("diffuseSampler")&&i.push("diffuseSampler"),this.createEffect({vertex:null!==(c=null==s?void 0:s.vertexShaderName)&&void 0!==c?c:"particles",fragmentElement:e},l,u.concat(t),h.concat(i),n,r,o,a)},n.a.prototype.getEmittedParticleSystems=function(){for(var e=new Array,t=0;t<this.getScene().particleSystems.length;t++){var i=this.getScene().particleSystems[t];i.emitter===this&&e.push(i)}return e},n.a.prototype.getHierarchyEmittedParticleSystems=function(){var e=new Array,t=this.getDescendants();t.push(this);for(var i=0;i<this.getScene().particleSystems.length;i++){var n=this.getScene().particleSystems[i],r=n.emitter;r.position&&-1!==t.indexOf(r)&&e.push(n)}return e}},function(e,t,i){"use strict";var r,n=i(25),o=i(12),a=i(18),s=i(27),c=i(0),l=i(116),u=i(1),h=i(39),d=i(2),p=(r=h.a,Object(u.d)(m,r),m.prototype._bindFrameBuffer=function(e){void 0===e&&(e=0),this._texture&&this.getScene().getEngine().bindMultiviewFramebuffer(this._texture)},m.prototype.getViewCount=function(){return 2},m),f=i(124);function m(e,t){void 0===t&&(t=512);var i=r.call(this,"multiview rtt",t,e,!1,!0,s.b.Unknown,!1,void 0,!1,!1,!0,void 0,!0)||this,n=e.getEngine().createMultiviewRenderTargetTexture(i.getRenderWidth(),i.getRenderHeight());return n.isMultiview=!0,n.format=d.a.TEXTUREFORMAT_RGBA,i._texture=n,i.samples=i._getEngine().getCaps().maxSamples||i.samples,i}o.a.prototype.createMultiviewRenderTargetTexture=function(e,t){var i=this._gl;if(!this.getCaps().multiview)throw"Multiview is not supported";var n=new s.a(this,s.b.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},o.a.prototype.bindMultiviewFramebuffer=function(e){var t=this._gl,i=this.getCaps().oculusMultiview||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";this.getCaps().oculusMultiview?(i.framebufferTextureMultisampleMultiviewOVR(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,e._colorTextureArray,0,e.samples,0,2),i.framebufferTextureMultisampleMultiviewOVR(t.DRAW_FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,e._depthStencilTextureArray,0,e.samples,0,2)):(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))},n.a.prototype._useMultiviewToSingleView=!1,n.a.prototype._multiviewTexture=null,n.a.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new p(this.getScene(),{width:e,height:t})):this._multiviewTexture=new p(this.getScene(),{width:e,height:t})},a.a.prototype._transformMatrixR=c.a.Zero(),a.a.prototype._multiviewSceneUbo=null,a.a.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=new l.a(this.getEngine(),void 0,!0),this._multiviewSceneUbo.addUniform("viewProjection",16),this._multiviewSceneUbo.addUniform("viewProjectionR",16),this._multiviewSceneUbo.addUniform("view",16)},a.a.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,c.c.Matrix[0]),f.a.GetRightPlaneToRef(c.c.Matrix[0],this._frustumPlanes[3])),this._multiviewSceneUbo&&(this._multiviewSceneUbo.updateMatrix("viewProjection",this.getTransformMatrix()),this._multiviewSceneUbo.updateMatrix("viewProjectionR",this._transformMatrixR),this._multiviewSceneUbo.updateMatrix("view",this._viewMatrix),this._multiviewSceneUbo.update())},a.a.prototype._renderMultiviewToSingleView=function(e){e._resizeOrCreateMultiviewTexture(e._rigPostProcess&&e._rigPostProcess&&0<e._rigPostProcess.width?e._r
1igPostProcess.width:this.getEngine().getRenderWidth(!0),e._rigPostProcess&&e._rigPostProcess&&0<e._rigPostProcess.height?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<e._rigCameras.length;t++){var i=this.getEngine();this._activeCamera=e._rigCameras[t],i.setViewport(this._activeCamera.viewport),this.postProcessManager&&(this.postProcessManager._prepareFrame(),this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate))}}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var c=i(194),r=(u.prototype.uploadAsync=function(n,r){return u._ModulePromise.then(function(e){var t=new e.module.ktxTexture(n);try{t.needsTranscoding&&t.transcodeBasis(u._TranscodeFormat,0),r.width=r.baseWidth=t.baseWidth,r.height=r.baseHeight=t.baseHeight,r.generateMipMaps=!1;var i=t.glUpload();if(0!==i.error)throw new Error("Failed to upload: "+i.error);r._webGLTexture=i.texture,r.isReady=!0}finally{t.delete()}})},u.prototype._determineTranscodeFormat=function(e,t){if(t.s3tc)return e.BC1_OR_3;if(t.etc2)return e.ETC;throw new Error("No compatible format available")},u.IsValid=function(e){if(12<=e.byteLength){var t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&50===t[5]&&48===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1},u),n=i(12),o=i(41),a=i(7),s=(l.prototype.canLoad=function(e,t){return o.a.EndsWith(e,".ktx")||o.a.EndsWith(e,".ktx2")||"image/ktx"===t||"image/ktx2"===t},l.prototype.loadCubeData=function(e,t,i,n,r){var o,a,s;Array.isArray(e)||(t._invertVScale=!t.invertY,o=t.getEngine(),s=1<(a=new c.a(e,6)).numberOfMipmapLevels&&t.generateMipMaps,o._unpackFlipY(!0),a.uploadLevels(t,t.generateMipMaps),t.width=a.pixelWidth,t.height=a.pixelHeight,o._setCubeMapTextureParams(s),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n())},l.prototype.loadData=function(e,t,i){var n;c.a.IsValid(e)?(t._invertVScale=!t.invertY,n=new c.a(e,1),i(n.pixelWidth,n.pixelHeight,t.generateMipMaps,!0,function(){n.uploadLevels(t,t.generateMipMaps)},n.isInvalid)):r.IsValid(e)?new r(t.getEngine()).uploadAsync(e,t).then(function(){i(t.width,t.height,!1,!0,function(){},!1)},function(e){a.a.Warn("Failed to load KTX2 texture data: "+e.message),i(0,0,!1,!1,function(){},!0)}):(a.a.Error("texture missing KTX identifier"),i(0,0,!1,!1,function(){},!0))},l);function l(){this.supportCascades=!1}function u(i){var n=this;u._ModulePromise||(u._ModulePromise=new Promise(function(t){LIBKTX({preinitializedWebGLContext:i._gl}).then(function(e){e.GL.makeContextCurrent(e.GL.registerContext(i._gl,{majorVersion:i._webGLVersion})),u._TranscodeFormat=n._determineTranscodeFormat(e.TranscodeTarget,i.getCaps()),t({module:e})})}))}n.a._TextureLoaders.unshift(new s)},function(e,t){var i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";i.r(t);var n=i(198);i.d(t,"Animatable",function(){return n.a});var r=i(26);i.d(t,"_IAnimationState",function(){return r.b}),i.d(t,"Animation",function(){return r.a});var o=i(180);i.d(t,"TargetedAnimation",function(){return o.b}),i.d(t,"AnimationGroup",function(){return o.a});var a=i(323);i.d(t,"AnimationPropertiesOverride",function(){return a.a});var s=i(89);i.d(t,"EasingFunction",function(){return s.f}),i.d(t,"CircleEase",function(){return s.d}),i.d(t,"BackEase",function(){return s.a}),i.d(t,"BounceEase",function(){return s.c}),i.d(t,"CubicEase",function(){return s.e}),i.d(t,"ElasticEase",function(){return s.g}),i.d(t,"ExponentialEase",function(){return s.h}),i.d(t,"PowerEase",function(){return s.i}),i.d(t,"QuadraticEase",function(){return s.j}),i.d(t,"QuarticEase",function(){return s.k}),i.d(t,"QuinticEase",function(){return s.l}),i.d(t,"SineEase",function(){return s.m}),i.d(t,"BezierCurveEase",function(){return s.b});var c=i(235);i.d(t,"RuntimeAnimation",function(){return c.a});var l=i(324);i.d(t,"AnimationEvent",function(){return l.a});var u=i(234);i.d(t,"AnimationKeyInterpolation",function(){return u.a});var h=i(153);i.d(t,"AnimationRange",function(){return h.a});var d=i(325);for(var p in d)["Animatable","_IAnimationState","Animation","TargetedAnimation","AnimationGroup","AnimationPropertiesOverride","
1EasingFunction","CircleEase","BackEase","BounceEase","CubicEase","ElasticEase","ExponentialEase","PowerEase","QuadraticEase","QuarticEase","QuinticEase","SineEase","BezierCurveEase","RuntimeAnimation","AnimationEvent","AnimationKeyInterpolation","AnimationRange","default"].indexOf(p)<0&&function(e){i.d(t,e,function(){return d[e]})}(p)},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(26),r=function(){this.enableBlending=!1,this.blendingSpeed=.01,this.loopMode=n.a.ANIMATIONLOOPMODE_CYCLE}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r.prototype._clone=function(){return new r(this.frame,this.action,this.onlyOnce)},r);function r(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}},function(e,t){},function(e,t,i){"use strict";i.r(t);var n=i(327);for(var r in n)"default"!==r&&function(e){i.d(t,e,function(){return n[e]})}(r);var o=i(328);i.d(t,"AutoRotationBehavior",function(){return o.a}),i.d(t,"BouncingBehavior",function(){return o.b}),i.d(t,"FramingBehavior",function(){return o.c});var a=i(429);i.d(t,"AttachToBoxBehavior",function(){return a.a}),i.d(t,"FadeInOutBehavior",function(){return a.b}),i.d(t,"MultiPointerScaleBehavior",function(){return a.c}),i.d(t,"PointerDragBehavior",function(){return a.d}),i.d(t,"SixDofDragBehavior",function(){return a.e})},function(e,t){},function(e,t,i){"use strict";var n=i(247);i.d(t,"a",function(){return n.a});var r=i(248);i.d(t,"b",function(){return r.a});var o=i(249);i.d(t,"c",function(){return o.a})},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.prePassDeclaration="#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out vec4 glFragData[{X}];\nvec4 gl_FragColor;\n#endif\n"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.fresnelFunction="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.depthPrePass="#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.bumpVertexDeclaration="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#endif\n"},function(e,t,i){"use strict";var n=i(5),r=(i(159),i(74),i(160),"imageProcessingPixelShader");n.a.ShadersStore[r]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\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}"},function(e,t,i){"use strict";var n=i(5),r=(i(177),i(161),"colorPixelShader");n.a.ShadersStore[r]="#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\n#include<clipPlaneFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}"},function(e,t,i){"use strict";var n=i(5),r=(i(107),i(179),i(108),i(109),i(110),i(162),"colorVertexShader");n.a.ShadersStore[r]="\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<clipPlaneVertexDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include<clipPlaneVertex>\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}"},function(e,t,i){"use strict";i.r(t);var n=i(265);i.d(t,"DeviceInputSystem",function(){return n.a});var r=i(54);
1i.d(t,"DeviceType",function(){return r.a}),i.d(t,"PointerInput",function(){return r.c}),i.d(t,"DualShockInput",function(){return r.b}),i.d(t,"XboxInput",function(){return r.e}),i.d(t,"SwitchInput",function(){return r.d});var o=i(337);for(var a in o)["DeviceInputSystem","DeviceType","PointerInput","DualShockInput","XboxInput","SwitchInput","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return o[e]})}(a);var s=i(313);i.d(t,"DeviceSource",function(){return s.a}),i.d(t,"DeviceSourceManager",function(){return s.b})},function(e,t){},function(e,t,i){"use strict";i.r(t);var n=i(2);i.d(t,"Constants",function(){return n.a});var r=i(339);for(var o in r)["Constants","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return r[e]})}(o);var a=i(340);for(var o in a)["Constants","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return a[e]})}(o);var s=i(31);i.d(t,"ThinEngine",function(){return s.a});var c=i(12);i.d(t,"Engine",function(){return c.a});var l=i(22);i.d(t,"EngineStore",function(){return l.a});var u=i(341);i.d(t,"NullEngineOptions",function(){return u.b}),i.d(t,"NullEngine",function(){return u.a});var h=i(427);i.d(t,"_OcclusionDataStorage",function(){return h.b}),i.d(t,"_forceTransformFeedbackToBundle",function(){return h.c}),i.d(t,"EngineView",function(){return h.a});var d=i(342);for(var o in d)["Constants","ThinEngine","Engine","EngineStore","NullEngineOptions","NullEngine","_OcclusionDataStorage","_forceTransformFeedbackToBundle","EngineView","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return d[e]})}(o);var p=i(240);i.d(t,"WebGLPipelineContext",function(){return p.a});var f=i(181);i.d(t,"WebGL2ShaderProcessor",function(){return f.a});var m=i(343);i.d(t,"NativeEngine",function(){return m.a});var _=i(208);i.d(t,"ShaderCodeInliner",function(){return _.a});var g=i(99);i.d(t,"PerformanceConfigurator",function(){return g.a})},function(e,t){},function(e,t){},function(e,h,d){"use strict";(function(n){d.d(h,"b",function(){return l}),d.d(h,"a",function(){return t});var r,e=d(1),o=d(7),a=d(12),s=d(154),f=d(27),m=d(2),i=d(123),c=d(99),l=function(){this.renderWidth=512,this.renderHeight=256,this.textureSize=512,this.deterministicLockstep=!1,this.lockstepMaxSteps=4},t=(r=a.a,Object(e.d)(u,r),u.prototype.isDeterministicLockStep=function(){return this._options.deterministicLockstep},u.prototype.getLockstepMaxSteps=function(){return this._options.lockstepMaxSteps},u.prototype.getHardwareScalingLevel=function(){return 1},u.prototype.createVertexBuffer=function(e){var t=new i.a;return t.references=1,t},u.prototype.createIndexBuffer=function(e){var t=new i.a;return t.references=1,t},u.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1)},u.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._options.renderWidth},u.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._options.renderHeight},u.prototype.setViewport=function(e,t,i){this._cachedViewport=e},u.prototype.createShaderProgram=function(e,t,i,n,r){return{__SPECTOR_rebuildProgram:null}},u.prototype.getUniforms=function(e,t){return[]},u.prototype.getAttributes=function(e,t){return[]},u.prototype.bindSamplers=function(e){this._currentEffect=null},u.prototype.enableEffect=function(e){(this._currentEffect=e).onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e)},u.prototype.setState=function(e,t,i,n){void 0===t&&(t=0),void 0===n&&(n=!1)},u.prototype.setIntArray=function(e,t){},u.prototype.setIntArray2=function(e,t){},u.prototype.setIntArray3=function(e,t){},u.prototype.setIntArray4=function(e,t){},u.prototype.setFloatArray=function(e,t){},u.prototype.setFloatArray2=function(e,t){},u.prototype.setFloatArray3=function(e,t){},u.prototype.setFloatArray4=function(e,t){},u.prototype.setArray=function(e,t){},u.prototype.setArray2=function(e,t){},u.prototype.setArray3=function(e,t){},u.prototype.setArray4=function(e,t){}
1,u.prototype.setMatrices=function(e,t){},u.prototype.setMatrix3x3=function(e,t){},u.prototype.setMatrix2x2=function(e,t){},u.prototype.setFloat=function(e,t){},u.prototype.setFloat2=function(e,t,i){},u.prototype.setFloat3=function(e,t,i,n){},u.prototype.setBool=function(e,t){},u.prototype.setFloat4=function(e,t,i,n,r){},u.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this.alphaState.alphaBlend=e!==m.a.ALPHA_DISABLE,t||this.setDepthWrite(e===m.a.ALPHA_DISABLE),this._alphaMode=e)},u.prototype.bindBuffers=function(e,t,i){},u.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)},u.prototype.draw=function(e,t,i,n){},u.prototype.drawElementsType=function(e,t,i,n){},u.prototype.drawArraysType=function(e,t,i,n){},u.prototype._createTexture=function(){return{}},u.prototype._releaseTexture=function(e){},u.prototype.createTexture=function(e,t,i,n,r,o,a,s,c,l,u,h){void 0===r&&(r=m.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===c&&(c=null),void 0===l&&(l=null),void 0===u&&(u=null);var d=new f.a(this,f.b.Url),p=String(e);return d.url=p,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,l&&(d.format=l),d.isReady=!0,o&&o(),this._internalTexturesCache.push(d),d},u.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?m.a.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?m.a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=m.a.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=m.a.TEXTURE_TRILINEAR_SAMPLINGMODE);var n=new f.a(this,f.b.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},u.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},u.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)},u.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},u.prototype.createDynamicVertexBuffer=function(e){var t=new i.a;return t.references=1,t.capacity=1,t},u.prototype.updateDynamicTexture=function(e,t,i,n,r){void 0===n&&(n=!1)},u.prototype.areAllEffectsReady=function(){return!0},u.prototype.getError=function(){return 0},u.prototype._getUnpackAlignement=function(){return 1},u.prototype._unpackFlipY=function(e){},u.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0)},u.prototype.updateDynamicVertexBuffer=function(e,t,i,n){},u.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},u.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},u.prototype._deleteBuffer=function(e){},u.prototype.releaseEffects=function(){},u.prototype.displayLoadingUI=function(){},u.prototype.hideLoadingUI=function(){},u.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0)},u.prototype._uploadDataToTextureDirectly=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},u.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},u.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},u);function u(e){void 0===e&&(e=new l);var t=r.call(this,null)||this;a.a.Instances.push(t),void 0===e.deterministicLockstep&&(e.deterministicLockstep=!1),void 0===e.lockstepMaxSteps&&(e.lockstepMaxSteps=4),t._options=e,c.a.SetMatrixPrecision(!!e.useHighPrecisionMatrix),t._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:512,maxCubemapTextureSize:512,maxRenderTextureSize:512,maxVertexAttribs:16,maxVaryingVectors:16,maxFragmentUniformVectors:16,maxVertexUniformVectors:16,standardDerivatives:!1,astc:null,pvrtc:null,etc1:null,etc2:null,maxAnisotropy:0,uintIndices:!1,fragmentDepthSupported:!1,highPrecisionShaderSupported:!0,colorBufferFloat:!1,textureFloat:!1,textureFloatLinearFiltering:!1,textureFloatRen
1der:!1,textureHalfFloat:!1,textureHalfFloatLinearFiltering:!1,textureHalfFloatRender:!1,textureLOD:!1,drawBuffersExtension:!1,depthTextureExtension:!1,vertexArrayObject:!1,instancedArrays:!1,canUseTimestampForTimerQuery:!1,maxMSAASamples:1,blendMinMax:!1},o.a.Log("Babylon.js v"+a.a.Version+" - Null engine");var i="undefined"!=typeof self?self:void 0!==n?n:window;return"undefined"==typeof URL&&(i.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(i.Blob=function(){}),t}}).call(this,d(321))},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return T});var n,r,o,a=i(1),C=i(12),P=i(27),_=i(9),s=i(123),x=i(13),g=i(106),c=i(154),R=i(7),O=i(2),l=i(31),M=i(22),u=i(208),h=i(181),d=(F.prototype._getVertexShaderCode=function(){return null},F.prototype._getFragmentShaderCode=function(){return null},F.prototype._handlesSpectorRebuildCallback=function(e){throw new Error("Not implemented")},F),p=(o=s.a,Object(a.d)(N,o),N),f=(L.MINPOINT_MAGPOINT_MIPPOINT=L.POINT=0,L.MINLINEAR_MAGLINEAR_MIPPOINT=L.BILINEAR=1,L.MINLINEAR_MAGLINEAR_MIPLINEAR=L.TRILINEAR=2,L.ANISOTROPIC=3,L.POINT_COMPARE=4,L.TRILINEAR_COMPARE=5,L.MINLINEAR_MAGPOINT_MIPLINEAR=L.MINBILINEAR_MAGPOINT=6,L.MINPOINT_MAGPOINT_MIPLINEAR=7,L.MINPOINT_MAGLINEAR_MIPPOINT=8,L.MINPOINT_MAGLINEAR_MIPLINEAR=9,L.MINLINEAR_MAGPOINT_MIPPOINT=10,L),m=(D.CLEAR_COLOR=1,D.CLEAR_DEPTH=2,D.CLEAR_STENCIL=4,D),v=(I.WRAP=0,I.MIRROR=1,I.CLAMP=2,I.BORDER=3,I.MIRROR_ONCE=4,I),b=(A.RGBA8=0,A.RGBA32F=1,A),y=(r=P.a,Object(a.d)(S,r),S.prototype.getInternalTexture=function(){return this},S.prototype.getViewCount=function(){return 1},S),T=(n=C.a,Object(a.d)(E,n),E.prototype.getHardwareScalingLevel=function(){return 1},E.prototype.dispose=function(){n.prototype.dispose.call(this),this._native.dispose()},E.prototype._queueNewFrame=function(e,t){return t.requestAnimationFrame&&t!==window?t.requestAnimationFrame(e):this._native.requestAnimationFrame(e),0},E.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._currentFramebuffer&&this._native.unbindFramebuffer(this._currentFramebuffer),e&&this._native.bindFramebuffer(e),this._currentFramebuffer=e)},E.prototype.getHostDocument=function(){return null},E.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1);var r=0;t&&e&&(this._native.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),r|=m.CLEAR_COLOR),i&&(this._native.clearDepth(1),r|=m.CLEAR_DEPTH),n&&(this._native.clearStencil(0),r|=m.CLEAR_STENCIL),this._native.clear(r)},E.prototype.createIndexBuffer=function(e,t){var i=this._normalizeIndexData(e),n=new p;if(n.references=1,n.is32Bits=4===i.BYTES_PER_ELEMENT,n.nativeIndexBuffer=this._native.createIndexBuffer(i,null!=t&&t),n.nativeVertexBuffer===this.INVALID_HANDLE)throw new Error("Could not create a native index buffer.");return n},E.prototype.createVertexBuffer=function(e,t){var i=new p;if(i.references=1,i.nativeVertexBuffer=this._native.createVertexBuffer(ArrayBuffer.isView(e)?e:new Float32Array(e),null!=t&&t),i.nativeVertexBuffer===this.INVALID_HANDLE)throw new Error("Could not create a native vertex buffer.");return i},E.prototype.recordVertexArrayObject=function(e,t,i){var n=this._native.createVertexArray();t&&this._native.recordIndexBuffer(n,t.nativeIndexBuffer);for(var r=i.getAttributesNames(),o=0;o<r.length;o++){var a,s,c=i.getAttributeLocation(o);
10<=c&&(!(a=e[r[o]])||(s=a.getBuffer())&&this._native.recordVertexBuffer(n,s.nativeVertexBuffer,c,a.byteOffset,a.byteStride,a.getSize(),a.type,a.normalized))}return n},E.prototype.bindVertexArrayObject=function(e){this._native.bindVertexArray(e)},E.prototype.releaseVertexArrayObject=function(e){this._native.deleteVertexArray(e)},E.prototype.getAttributes=function(e,t){return this._native.getAttributes(e.nativeProgram,t)},E.prototype.drawElementsType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._native.drawIndexed(e,t,i)},E.prototype.drawArraysType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._native.draw(e,t,i)},E.prototype.createPipelineContext=function(){return new d},E.prototype._preparePipelineContext=function(e,t,i,n,r,o,a){e.nativeProgram=n?this.createRawShaderProgram(e,t,i,void 0,a):this.createShaderProgram(e,t,i,o,void 0,a)},E.prototype._isRenderingStateCompiled=function(e){return!0},E.prototype._executeWhenRenderingStateIsCompiled=function(e,t){t()},E.prototype.createRawShaderProgram=function(e,t,i,n,r){throw void 0===r&&(r=null),new Error("Not Supported")},E.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),this.onBeforeShaderCompilationObservable.notifyObservers(this);var a=new u.a(t);a.processCode(),t=a.code;var s=new u.a(i);s.processCode(),i=s.code,t=l.a._ConcatenateShader(t,n),i=l.a._ConcatenateShader(i,n);var c=this._native.createProgram(t,i);return this.onAfterShaderCompilationObservable.notifyObservers(this),c},E.prototype._setProgram=function(e){this._currentProgram!==e&&(this._native.setProgram(e),this._currentProgram=e)},E.prototype._releaseEffect=function(e){},E.prototype._deletePipelineContext=function(e){},E.prototype.getUniforms=function(e,t){return this._native.getUniforms(e.nativeProgram,t)},E.prototype.bindUniformBlock=function(e,t,i){throw new Error("Not Implemented")},E.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.nativeProgram);for(var i=e.getSamplers(),n=0;n<i.length;n++){var r=e.getUniform(i[n]);r&&(this._boundUniforms[n]=r)}this._currentEffect=null}
1,E.prototype.setMatrix=function(e,t){e&&this._native.setMatrix(e,t.toArray())},E.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._native.getRenderWidth()},E.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._native.getRenderHeight()},E.prototype.setViewport=function(e,t,i){this._cachedViewport=e,this._native.setViewPort(e.x,e.y,e.width,e.height)},E.prototype.setState=function(e,t,i,n){void 0===t&&(t=0),void 0===n&&(n=!1),this._native.setState(e,t,n)},E.prototype.setZOffset=function(e){this._native.setZOffset(e)},E.prototype.getZOffset=function(){return this._native.getZOffset()},E.prototype.setDepthBuffer=function(e){this._native.setDepthTest(e)},E.prototype.getDepthWrite=function(){return this._native.getDepthWrite()},E.prototype.setDepthWrite=function(e){this._native.setDepthWrite(e)},E.prototype.setColorWrite=function(e){this._native.setColorWrite(e),this._colorWrite=e},E.prototype.getColorWrite=function(){return this._colorWrite},E.prototype.setAlphaConstants=function(e,t,i,n){throw new Error("Setting alpha blend constant color not yet implemented.")},E.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this._native.setBlendMode(e),t||this.setDepthWrite(e===O.a.ALPHA_DISABLE),this._alphaMode=e)},E.prototype.getAlphaMode=function(){return this._alphaMode},E.prototype.setInt=function(e,t){e&&this._native.setInt(e,t)},E.prototype.setIntArray=function(e,t){e&&this._native.setIntArray(e,t)},E.prototype.setIntArray2=function(e,t){e&&this._native.setIntArray2(e,t)},E.prototype.setIntArray3=function(e,t){e&&this._native.setIntArray3(e,t)},E.prototype.setIntArray4=function(e,t){e&&this._native.setIntArray4(e,t)},E.prototype.setFloatArray=function(e,t){e&&this._native.setFloatArray(e,t)},E.prototype.setFloatArray2=function(e,t){e&&this._native.setFloatArray2(e,t)},E.prototype.setFloatArray3=function(e,t){e&&this._native.setFloatArray3(e,t)},E.prototype.setFloatArray4=function(e,t){e&&this._native.setFloatArray4(e,t)},E.prototype.setArray=function(e,t){e&&this._native.setFloatArray(e,t)},E.prototype.setArray2=function(e,t){e&&this._native.setFloatArray2(e,t)},E.prototype.setArray3=function(e,t){e&&this._native.setFloatArray3(e,t)},E.prototype.setArray4=function(e,t){e&&this._native.setFloatArray4(e,t)}
1,E.prototype.setMatrices=function(e,t){e&&this._native.setMatrices(e,t)},E.prototype.setMatrix3x3=function(e,t){e&&this._native.setMatrix3x3(e,t)},E.prototype.setMatrix2x2=function(e,t){e&&this._native.setMatrix2x2(e,t)},E.prototype.setFloat=function(e,t){e&&this._native.setFloat(e,t)},E.prototype.setFloat2=function(e,t,i){e&&this._native.setFloat2(e,t,i)},E.prototype.setFloat3=function(e,t,i,n){e&&this._native.setFloat3(e,t,i,n)},E.prototype.setFloat4=function(e,t,i,n,r){e&&this._native.setFloat4(e,t,i,n,r)},E.prototype.setColor3=function(e,t){e&&this._native.setFloat3(e,t.r,t.g,t.b)},E.prototype.setColor4=function(e,t,i){e&&this._native.setFloat4(e,t.r,t.g,t.b,i)},E.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)},E.prototype._createTexture=function(){return this._native.createTexture()},E.prototype._deleteTexture=function(e){this._native.deleteTexture(e)},E.prototype.createTexture=function(n,r,i,o,a,s,c,l,e,u,h,d){var p=this;void 0===a&&(a=O.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===s&&(s=null),void 0===c&&(c=null),void 0===l&&(l=null),void 0===e&&(e=null),void 0===u&&(u=null),void 0===h&&(h=null);var t="data:"===(n=n||"").substr(0,5),f=t&&-1!==n.indexOf(";base64,"),m=e||new P.a(this,P.b.Url),_=n;!this._transformTextureUrl||f||e||l||(n=this._transformTextureUrl(n));for(var g=n.lastIndexOf("."),v=h||(-1<g?n.substring(g).toLowerCase():""),b=null,y=0,T=C.a._TextureLoaders;y<T.length;y++){var E=T[y];if(E.canLoad(v)){b=E;break}}o&&o._addPendingData(m),m.url=n,m.generateMipMaps=!r,m.samplingMode=a,m.invertY=i,this.doNotHandleContextLost||(m._buffer=l);var S=null;if(s&&!e&&(S=m.onLoadedObservable.add(s)),e||this._internalTexturesCache.push(m),b)throw new Error("Loading textures from IInternalTextureLoader not yet implemented.");function A(e){var t=m._webGLTexture;
1t?p._native.loadTexture(t,e,!r,i,function(){m.baseWidth=p._native.getTextureWidth(t),m.baseHeight=p._native.getTextureHeight(t),m.width=m.baseWidth,m.height=m.baseHeight,m.isReady=!0;var e=p._getSamplingFilter(a);p._native.setTextureSampling(t,e),o&&o._removePendingData(m),m.onLoadedObservable.notifyObservers(m),m.onLoadedObservable.clear()},function(){throw new Error("Could not load a native texture.")}):o&&o._removePendingData(m)}if(t)if(l instanceof ArrayBuffer)A(new Uint8Array(l));else if(ArrayBuffer.isView(l))A(l);else{if("string"!=typeof l)throw new Error("Unsupported buffer type");A(new Uint8Array(x.b.DecodeBase64(l)))}else f?A(new Uint8Array(x.b.DecodeBase64(n))):this._loadFile(n,function(e){return A(new Uint8Array(e))},void 0,void 0,!0,function(e,t){var i;i="Unable to load "+(e&&e.responseURL,t),o&&o._removePendingData(m),n===_?(S&&m.onLoadedObservable.remove(S),M.a.UseFallbackTexture&&p.createTexture(M.a.FallbackTexture,r,m.invertY,o,a,null,c,l,m),c&&c((i||"Unknown error")+(M.a.UseFallbackTexture?" - Fallback texture was used":""),void 0)):(R.a.Warn("Failed to load "+n+", falling back to "+_),p.createTexture(_,r,m.invertY,o,a,s,c,l,m,u,h,d))});return m},E.prototype.createCubeTexture=function(e,t,i,n,r,o,a,s,c,l,u,h){var d=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=!1),void 0===l&&(l=0),void 0===u&&(u=0),void 0===h&&(h=null);var p=h||new P.a(this,P.b.Cube);p.isCube=!0,p.url=e,p.generateMipMaps=!n,p._lodGenerationScale=l,p._lodGenerationOffset=u,this._doNotHandleContextLost||(p._extension=s,p._files=i);var f=e.lastIndexOf(".");if(".env"===(s||(-1<f?e.substring(f).toLowerCase():""))){if(i&&6===i.length)throw new Error("Multi-file loading not allowed on env files.");this._loadFile(e,function(e){return function(e){var t=g.a.GetEnvInfo(e);if(p.width=t.width,p.height=t.width,g.a.UploadEnvSpherical(p,t),1!==t.version)throw new Error('Unsupported babylon environment map version "'+t.version+'"');var i=t.specular;if(!i)throw new Error("Nothing else parsed so far");p._lodGenerationScale=i.lodGenerationScale;var n=g.a.CreateImageDataArrayBufferViews(e,t);p.format=O.a.TEXTUREFORMAT_RGBA,p.type=O.a.TEXTURETYPE_UNSIGNED_INT,p.generateMipMaps=!0,p.getEngine().updateTextureSamplingMode(_.a.TRILINEAR_SAMPLINGMODE,p),p._isRGBD=!0,p.invertY=!0,d._native.loadCubeTextureWithMips(p._webGLTexture,n,function(){p.isReady=!0,r&&r()},function(){throw new Error("Could not load a native cube texture.")})}(new Uint8Array(e))},void 0,void 0,!0,function(e,t){o&&e&&o(e.status+" "+e.statusText,t)})}else{if(!i||6!==i.length)throw new Error("Cannot load cubemap because 6 files were not defined");var m=[i[0],i[3],i[1],i[4],i[2],i[5]];Promise.all(m.map(function(e){return x.b.LoadFileAsync(e).then(function(e){return new Uint8Array(e)})})).then(function(i){return new Promise(function(e,t){d._native.loadCubeTexture(p._webGLTexture,i,!n,e,t)})}).then(function(){p.isReady=!0,r&&r()},function(e){o&&o("Failed to load cubemap: "+e.message,e)})}return this._internalTexturesCache.push(p),p},E.prototype._getSamplingFilter=function(e){switch(e){case O.a.TEXTURE_BILINEAR_SAMPLINGMODE:return f.MINLINEAR_MAGLINEAR_MIPPOINT;case O.a.TEXTURE_TRILINEAR_SAMPLINGMODE:return f.MINLINEAR_MAGLINEAR_MIPLINEAR;case O.a.TEXTURE_NEAREST_SAMPLINGMODE:return f.MINPOINT_MAGPOINT_MIPLINEAR;case O.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST:return f.MINPOINT_MAGPOINT_MIPPOINT;case O.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST:return f.MINLINEAR_MAGPOINT_MIPPOINT;case O.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR:case O.a.TEXTURE_NEAREST_LINEAR:return f.MINLINEAR_MAGPOINT_MIPLINEAR;case O.a.TEXTURE_NEAREST_NEAREST:return f.MINPOINT_MAGPOINT_MIPPOINT;case O.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST:return f.MINPOINT_MAGLINEAR_MIPPOINT;case O.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR:return f.MINPOINT_MAGLINEAR_MIPLINEAR;case O.a.TEXTURE_LINEAR_LINEAR:return f.MINLINEAR_MAGLINEAR_MIPLINEAR;case O.a.TEXTURE_LINEAR_NEAREST:return f.MINPOINT_MAGLINEAR_MIPLINEAR;default:throw new Error("Unexpected sampling mode: "+e+".")}},E._GetNativeTextureFormat=function(e,t){if(e==O.a.TEXTUREFORMAT_RGBA&&t==O.a.TEXTURETYPE_UNSIGNED_INT)return b.RGBA8;if(e==O.a.TEXTUREFORMAT_RGBA&&t==O.a.TEXTURETYPE_FLOAT)return b.RGBA32F;throw new Error("Unexpected texture format or type: format "+e+", type "+t+".")},E.prototype.createRenderTargetTexture=function(e,t){var i=new c.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?O.a.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?O.a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,i.format=void 0===t.format?O.a.TEXTUREFORMAT_RGBA:t.format):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=O.a.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=O.a.TEXTURE_TRILINEAR_SAMPLINGMODE,i.format=O.a.TEXTUREFORMAT_RGBA),(i.type!==O.a.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==O.a.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=O.a.TEXTURE_NEAREST_SAMPL
1INGMODE);var n=new y(this,P.b.RenderTarget),r=e.width||e,o=e.height||e;i.type!==O.a.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=O.a.TEXTURETYPE_UNSIGNED_INT,R.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var a=this._native.createFramebuffer(n._webGLTexture,r,o,E._GetNativeTextureFormat(i.format,i.type),i.samplingMode,!!i.generateStencilBuffer,i.generateDepthBuffer,!!i.generateMipMaps);return n._framebuffer=a,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.format=i.format,n._generateDepthBuffer=i.generateDepthBuffer,n._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(n),n},E.prototype.updateTextureSamplingMode=function(e,t){var i;t._webGLTexture&&(i=this._getSamplingFilter(e),this._native.setTextureSampling(t._webGLTexture,i)),t.samplingMode=e},E.prototype.bindFramebuffer=function(e,t,i,n,r){if(t)throw new Error("Cuboid frame buffers are not yet supported in NativeEngine.");if(i||n)throw new Error("Required width/height for frame buffers not yet supported in NativeEngine.");if(r)throw new Error("forceFullscreenViewport for frame buffers not yet supported in NativeEngine.");this._bindUnboundFramebuffer(e._framebuffer)},E.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),t&&R.a.Warn("Disabling mipmap generation not yet supported in NativeEngine. Ignoring."),i&&i(),this._bindUnboundFramebuffer(null)},E.prototype.createDynamicVertexBuffer=function(e){return this.createVertexBuffer(e,!0)},E.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0);var n=e,r=this._normalizeIndexData(t);n.is32Bits=4===r.BYTES_PER_ELEMENT,this._native.updateDynamicIndexBuffer(n.nativeIndexBuffer,r,i)},E.prototype.updateDynamicVertexBuffer=function(e,t,i,n){var r=e,o=ArrayBuffer.isView(t)?t:new Float32Array(t);this._native.updateDynamicVertexBuffer(r.nativeVertexBuffer,o,null!=i?i:0,null!=n?n:o.byteLength)},E.prototype._setTexture=function(e,t,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var r,o=this._boundUniforms[e];if(!o)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._native.setTexture(o,null)),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===O.a.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,this._activeChannel=e,!(!r||!r._webGLTexture||(this._native.setTextureWrapMode(r._webGLTexture,this._getAddressMode(t.wrapU),this._getAddressMode(t.wrapV),this._getAddressMode(t.wrapR)),this._updateAnisotropicLevel(t),this._native.setTexture(o,r._webGLTexture),0))},E.prototype._updateAnisotropicLevel=function(e){var t=e.getInternalTexture(),i=e.anisotropicFilteringLevel;t&&t._webGLTexture&&t._cachedAnisotropicFilteringLevel!==i&&(this._native.setTextureAnisotropicLevel(t._webGLTexture,i),t._cachedAnisotropicFilteringLevel=i)},E.prototype._getAddressMode=function(e){switch(e){case O.a.TEXTURE_WRAP_ADDRESSMODE:return v.WRAP;case O.a.TEXTURE_CLAMP_ADDRESSMODE:return v.CLAMP;case O.a.TEXTURE_MIRROR_ADDRESSMODE:return v.MIRROR;default:throw new Error("Unexpected wrap mode: "+e+".")}},E.prototype._bindTexture=function(e,t){throw new Error("_bindTexture not implemented.")},E.prototype._deleteBuffer=function(e){e.nativeIndexBuffer&&(this._native.deleteIndexBuffer(e.nativeIndexBuffer),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._native.deleteVertexBuffer(e.nativeVertexBuffer),delete e.nativeVertexBuffer)},E.prototype.releaseEffects=function(){},E.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){throw void 0===o&&(o=0),void 0===a&&(a=0),new Error("_uploadCompressedDataToTextureDirectly not implemented.")},E.prototype._uploadDataToTextureDirectly=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadDataToTextureDirectly not implemented.")},E.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},E.prototype._uploadImageToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},E);function E(){var e=n.call(this,null)||this;return e._native=new _native.Engine,e.INVALID_HANDLE=65535,e._webGLVersion=2,e.disableUniformBuffers=!0,e._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:512,maxCubemapTextureSize:512,maxRenderTextureSize:512,maxVertexAttribs:16,maxVaryingVectors:16,maxFragmentUniformVectors:16,maxVertexUniformVectors:16,standardDerivatives:!0,astc:null,pvrtc:null,etc1:null,etc2:null,maxAnisotropy:16,uintIndices:!0,fragmentDepthSupported:!1,highPrecisionShaderSupported:!0,colorBufferFloat:!1,textureFloat:!1,textureFloatLinearFiltering:!1,textureFloatRen
1der:!1,textureHalfFloat:!1,textureHalfFloatLinearFiltering:!1,textureHalfFloatRender:!1,textureLOD:!0,drawBuffersExtension:!1,depthTextureExtension:!1,vertexArrayObject:!0,instancedArrays:!1,canUseTimestampForTimerQuery:!1,blendMinMax:!1,maxMSAASamples:1},x.b.Log("Babylon Native (v"+C.a.Version+") launched"),"undefined"==typeof URL&&(window.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(window.Blob=function(){}),e._shaderProcessor=new h.a,e}function S(){return null!==r&&r.apply(this,arguments)||this}function A(){}function I(){}function D(){}function L(){}function N(){return null!==o&&o.apply(this,arguments)||this}function F(){this.isAsync=!1,this.isReady=!1}},function(e,t,i){"use strict";var n=i(5),r=(i(74),"rgbdDecodePixelShader");n.a.ShadersStore[r]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<helperFunctions>\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.subSurfaceScatteringFunctions="vec3 tagLightingForSSS(vec3 color) {\ncolor.b=max(color.b,HALF_MIN);\nreturn color;\n}\nbool testLightingForSSS(vec3 color)\n{\nreturn color.b>0.;\n}"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.importanceSampling="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 hemisphereCosSample(vec2 u) {\n\nfloat phi=2.*PI*u.x;\nfloat cosTheta2=1.-u.y;\nfloat cosTheta=sqrt(cosTheta2);\nfloat sinTheta=sqrt(1.-cosTheta2);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {\n\nfloat phi=2.*PI*u.x;\n\nfloat cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));\nfloat cosTheta=sqrt(cosTheta2);\nfloat sinTheta=sqrt(1.-cosTheta2);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {\n\nfloat phi=2.*PI*u.x;\nfloat sinTheta=pow(u.y,a/(2.*a+1.));\nfloat cosTheta=sqrt(1.-sinTheta*sinTheta);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.pbrBRDFFunctions="\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\n\n\n\n#ifdef MS_BRDF_ENERGY_CONSERVATION\n\n\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\n\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\n#endif\nreturn reflectance;\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\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(ENVIRONMENTBRDF)\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\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\n\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;
1\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\n#endif\n\n\n\n\n\n\n\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\
1n\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"},function(e,t,i){"use strict";i(5).a.IncludesShadersStore.hdrFilteringFunctions="#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\n#ifdef WEBGL2\n\n\nfloat radicalInverse_VdC(uint bits)\n{\nbits=(bits << 16u) | (bits >> 16u);\nbits=((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\nbits=((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\nbits=((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\nbits=((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\nreturn float(bits)*2.3283064365386963e-10;\n}\nvec2 hammersley(uint i,uint N)\n{\nreturn vec2(float(i)/float(N),radicalInverse_VdC(i));\n}\n#else\nfloat vanDerCorpus(int n,int base)\n{\nfloat invBase=1.0/float(base);\nfloat denom=1.0;\nfloat result=0.0;\nfor(int i=0; i<32; ++i)\n{\nif(n>0)\n{\ndenom=mod(float(n),2.0);\nresult+=denom*invBase;\ninvBase=invBase/2.0;\nn=int(float(n)/2.0);\n}\n}\nreturn result;\n}\nvec2 hammersley(int i,int N)\n{\nreturn vec2(float(i)/float(N),vanDerCorpus(i,2));\n}\n#endif\nfloat log4(float x) {\nreturn log2(x)/2.;\n}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);\nconst float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;\nconst float K=4.;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#define inline\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{\nvec3 n=normalize(inputN);\nvec3 result=vec3(0.0);\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\ntangent=normalize(cross(tangent,n));\nvec3 bitangent=cross(n,tangent);\nmat3 tbn=mat3(tangent,bitangent,n);\nfloat maxLevel=filteringInfo.y;\nfloat dim0=filteringInfo.x;\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\n#ifdef WEBGL2\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{\nvec2 Xi=hammersley(i,NUM_SAMPLES);\nvec3 Ls=hemisphereCosSample(Xi);\nLs=normalize(Ls);\nvec3 Ns=vec3(0.,0.,1.);\nfloat NoL=dot(Ns,Ls);\nif (NoL>0.) {\nfloat pdf_inversed=PI/NoL;\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\nfloat mipLevel=clamp(l,0.0,maxLevel);\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c;\n}\n}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\nreturn result;\n}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{\nvec3 n=normalize(inputN);\nif (alphaG == 0.) {\nvec3 c=textureCube(inputTexture,n).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;\n}\nvec3 result=vec3(0.);\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\ntangent=normalize(cross(tangent,n));\nvec3 bitangent=cross(n,tangent);\nmat3 tbn=mat3(tangent,bitangent,n);\nfloat maxLevel=filteringInfo.y;\nfloat dim0=filteringInfo.x;\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\nfloat weight=0.;\n#ifdef WEBGL2\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{\nvec2 Xi=hammersley(i,NUM_SAMPLES);\nvec3 H=hemisphereImportanceSampleDggx(Xi,alphaG);\nfloat NoV=1.;\nfloat NoH=H.z;\nfloat NoH2=H.z*H.z;\nfloat NoL=2.*NoH2-1.;\nvec3 L=vec3(2.*NoH*H.x,2.*NoH*H.y,NoL);\nL=normalize(L);\nif (NoL>0.) {\nfloat pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alph
1aG);\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\nfloat mipLevel=clamp(float(l),0.0,maxLevel);\nweight+=NoL;\nvec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;\n}\n}\nresult=result/weight;\nreturn result;\n}\n#endif\n#endif"},function(e,t,i){"use strict";i(5).a.ShadersStore.glowMapMergePixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\n\nuniform float offset;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);\nbaseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);\nbaseColor.a=alpha;\nbaseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\ngl_FragColor=baseColor;\n}"},function(e,t,i){"use strict";i(5).a.ShadersStore.glowMapMergeVertexShader="\nattribute vec2 position;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}"},function(e,t,i){"use strict";var n=i(5),r=(i(107),i(131),i(132),i(108),i(145),i(109),i(110),"depthVertexShader");n.a.ShadersStore[r]="\nattribute vec3 position;\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n"},function(e,t,i){"use strict";i.r(t);var n=i(353);i.d(t,"BackgroundMaterial",function(){return n.a});var r=i(193);i.d(t,"ColorCurves",function(){return r.a});var o=i(354);for(var a in o)["BackgroundMaterial","ColorCurves","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return o[e]})}(a);var s=i(84);i.d(t,"EffectFallbacks",function(){return s.a});var c=i(5);i.d(t,"Effect",function(){return c.a});var l=i(355);i.d(t,"FresnelParameters",function(){return l.a});var u=i(48);i.d(t,"ImageProcessingConfigurationDefines",function(){return u.b}),i.d(t,"ImageProcessingConfiguration",function(){return u.a});var h=i(29);i.d(t,"Material",function(){return h.a});var d=i(101);i.d(t,"MaterialDefines",function(){return d.a});var p=i(15);i.d(t,"MaterialHelper",function(){return p.a});var f=i(98);i.d(t,"MultiMaterial",function(){return f.a});var m=i(430);i.d(t,"PBRMaterialDefines",function(){return m.d}),i.d(t,"PBRBaseMaterial",function(){return m.a}),i.d(t,"PBRBaseSimpleMaterial",function(){return m.b}),i.d(t,"PBRMaterial",function(){return m.c}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return m.e}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return m.f});var _=i(119);i.d(t,"PushMaterial",function(){return _.a});var g=i(121);i.d(t,"ShaderMaterial",function(){return g.a});var v=i(35);i.d(t,"StandardMaterialDefines",function(){return v.b}),i.d(t,"StandardMaterial",function(){return v.a});var b=i(356);for(var a in b)["BackgroundMaterial","ColorCurves","EffectFallbacks","Effect","FresnelParameters","ImageProcessingConfigurationDefines","ImageProcessingConfiguration","Material","MaterialDefines","MaterialHelper","MultiMaterial","PBRMaterialDefines","PBRBaseMaterial","PBRBaseSimpleMaterial","PBRMaterial","PBRMetallicRoughnessMaterial","PBRSpecularGlossinessMaterial","PushMaterial","ShaderMaterial","StandardMaterialDefines","StandardMaterial","default"].indexOf(a)<0&&function(e){i.d(t,e,function(){return b[e]})}(a);var y=i(116);i.d(t,"UniformBuffer",function(){return y.a});var T=i(19);i.d(t,"MaterialFlags",function(){return T.a});var E=i(413);i.d(t,"NodeMaterialBlockTargets",function(){return E.R}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return E.Q}),i.d(t,"NodeMaterialBlockConnectionPointMode",function(){return E.P}),i.d(t,"NodeMaterialSystemValues",function(){return E.Y}),i.d(t,"NodeMaterialModes",function(){return E.W}),i.d(t,"NodeMaterialConnectionPointCompatibilityStates",function(){return E.T}),i.d(t,"NodeMaterialConnectionPointDirection",function(){return E.U}),i.d(t,"NodeMaterialConnectionPoint",function(){return E.S}),i.d(t,"NodeMaterialBlock",function(){return E.O}),i.d(t,"NodeMaterialDefines",function(){return E.V}),i.d(t,"NodeMaterial",function(){return E.N}),i.d(t,"VertexOutputBlock",function(){return E.Jb}),i.d(t,"BonesBlock",function(){return E.f}),i.d(t,"InstancesBlock",function(){return E.B}),i.d(t,"MorphTargetsBlock",function(){return E.J}),i.d(t,"LightInformationBlock",function(){return E.F}),i.d(t,"FragmentOutputBlock",function(){return E.u}),i.d(t,"ImageProcessingBlock",function(){return E.z}),i.d(t,"PerturbNormalBlock",function(){return E.gb}),i.d(t,"DiscardBlock",function(){return E.o}),i.d(t,"FrontFacingBlock",function(){return E.w}),i.d(t,"DerivativeBlock",function(){return E.m}),i.d(t,"FragCoordBlock",function(){return E.t}),i.d(t,"ScreenSizeBlock",function(){return E.wb}),i.d(t,"FogBlock",function(){return E.s}),i.d(t,"LightBlock",function(){return E.E}),i.d(t,"TextureBlock",function(){return E.Db}),i.d(t,"ReflectionTextureBlock",function(){return E.ob}),i.d(t,"CurrentScreenBlock",function(){return E.l}),i.d(t,"InputBlock",function(){return E.A}),i.d(t,"AnimatedInputBlockTypes",function(){return E.c}),i.d(t,"MultiplyBlock",function(){return E.K}),i.d(t,"AddBlock",function(){return E.a}),i.d(t,"ScaleBlock",function(){return E.vb}),i.d(t,"ClampBlock",function(){return E.g}),i.d(t,"CrossBlock",function(){return E.k}),i.d(t,"DotBlock",function(){return E.r}),i.d(t,"TransformBlock",function(){return E.Eb}),i.d(t,"RemapBlock",function(){return E.sb}),i.d(t,"NormalizeBlock",function(){return E.ab}),i.d(t,"TrigonometryBlockOperations",function(){return E.Gb}),i.d(t,"TrigonometryBlock",function(){return E.Fb}),i.d(t,"ColorMergerBlock",function(){return E.i}),i.d(t,"VectorMergerBlock",function(){return E.Hb}),i.d(t,"ColorSplitterBlock",function(){return E.j}),i.d(t,"VectorSplitterBlock",function(){return E.Ib}),i.d(t,"LerpBlock",function(){return E.D}
1),i.d(t,"DivideBlock",function(){return E.q}),i.d(t,"SubtractBlock",function(){return E.Cb}),i.d(t,"StepBlock",function(){return E.Ab}),i.d(t,"OneMinusBlock",function(){return E.bb}),i.d(t,"ViewDirectionBlock",function(){return E.Kb}),i.d(t,"FresnelBlock",function(){return E.v}),i.d(t,"MaxBlock",function(){return E.G}),i.d(t,"MinBlock",function(){return E.H}),i.d(t,"DistanceBlock",function(){return E.p}),i.d(t,"LengthBlock",function(){return E.C}),i.d(t,"NegateBlock",function(){return E.M}),i.d(t,"PowBlock",function(){return E.ib}),i.d(t,"RandomNumberBlock",function(){return E.kb}),i.d(t,"ArcTan2Block",function(){return E.e}),i.d(t,"SmoothStepBlock",function(){return E.zb}),i.d(t,"ReciprocalBlock",function(){return E.lb}),i.d(t,"ReplaceColorBlock",function(){return E.tb}),i.d(t,"PosterizeBlock",function(){return E.hb}),i.d(t,"WaveBlockKind",function(){return E.Mb}),i.d(t,"WaveBlock",function(){return E.Lb}),i.d(t,"GradientBlockColorStep",function(){return E.y}),i.d(t,"GradientBlock",function(){return E.x}),i.d(t,"NLerpBlock",function(){return E.L}),i.d(t,"WorleyNoise3DBlock",function(){return E.Nb}),i.d(t,"SimplexPerlin3DBlock",function(){return E.yb}),i.d(t,"NormalBlendBlock",function(){return E.Z}),i.d(t,"Rotate2dBlock",function(){return E.ub}),i.d(t,"ReflectBlock",function(){return E.mb}),i.d(t,"RefractBlock",function(){return E.qb}),i.d(t,"DesaturateBlock",function(){return E.n}),i.d(t,"PBRMetallicRoughnessBlock",function(){return E.cb}),i.d(t,"SheenBlock",function(){return E.xb}),i.d(t,"AmbientOcclusionBlock",function(){return E.b}),i.d(t,"ReflectivityBlock",function(){return E.pb}),i.d(t,"AnisotropyBlock",function(){return E.d}),i.d(t,"ReflectionBlock",function(){return E.nb}),i.d(t,"ClearCoatBlock",function(){return E.h}),i.d(t,"RefractionBlock",function(){return E.rb}),i.d(t,"SubSurfaceBlock",function(){return E.Bb}),i.d(t,"ParticleTextureBlock",function(){return E.fb}),i.d(t,"ParticleRampGradientBlock",function(){return E.eb}),i.d(t,"ParticleBlendMultiplyBlock",function(){return E.db}),i.d(t,"ModBlock",function(){return E.I}),i.d(t,"NodeMaterialOptimizer",function(){return E.X}),i.d(t,"PropertyTypeForEdition",function(){return E.jb}),i.d(t,"editableInPropertyPage",function(){return E.Ob});var S=i(212);i.d(t,"EffectRenderer",function(){return S.a}),i.d(t,"EffectWrapper",function(){return S.b});var A=i(371);i.d(t,"ShadowDepthWrapper",function(){return A.a})},function(e,t,i){"use strict";var n=i(137);i.d(t,"a",function(){return n.a})},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var n=i(46),r=i(10),o=i(12),a=i(3),s=i(2),c=(Object.defineProperty(l.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,o.a.MarkAllMaterialsAsDirty(s.a.MATERIAL_FresnelDirtyFlag|s.a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),l.prototype.clone=function(){var e=new l;return n.a.DeepCopy(this,e),e},l.prototype.equals=function(e){return e&&this.bias===e.bias&&this.power===e.power&&this.leftColor.equals(e.leftColor)&&this.rightColor.equals(e.rightColor)&&this.isEnabled===e.isEnabled},l.prototype.serialize=function(){return{isEnabled:this.isEnabled,leftColor:this.leftColor.asArray(),rightColor:this.rightColor.asArray(),bias:this.bias,power:this.power}},l.Parse=function(e){return new l({isEnabled:e.isEnabled,leftColor:r.a.FromArray(e.leftColor),rightColor:r.a.FromArray(e.rightColor),bias:e.bias,power:e.power||1})},l);function l(e){void 0===e&&(e={}),this._isEnabled=!0,this.bias=void 0===e.bias?0:e.bias,this.power=void 0===e.power?1:e.power,this.leftColor=e.leftColor||r.a.White(),this.rightColor=e.rightColor||r.a.Black(),!1===e.isEnabled&&(this.isEnabled=!1)}a.a._FresnelParametersParser=c.Parse},function(e,t,i){"use strict";i.r(t);var n=i(62);i.d(t,"BaseTexture",function(){return n.a}),i(203);var r=i(357);i.d(t,"ColorGradingTexture",function(){return r.a});var o=i(86);i.d(t,"CubeTexture",function(){return o.a});var a=i(85);i.d(t,"DynamicTexture",function(){return a.a});var s=i(289);i.d(t,"EquiRectangularCubeTexture",function(){return s.a});var c=i(297);i.d(t,"HDRFiltering",function(){return c.a});var l=i(185);i.d(t,"HDRCubeTexture",function(){return l.a});var u=i(358);i.d(t,"HtmlElementTexture",function(){return u.a});var h=i(27);i.d(t,"InternalTextureSource",function(){return h.b}),i.d(t,"InternalTexture",function(){return h.a});var d=i(359);for(var p in d)["BaseTexture","ColorGradingTexture","CubeTexture","DynamicTexture","EquiRectangularCubeTexture","HDRFiltering","HDRCubeTexture","HtmlElementTexture","InternalTextureSource","InternalTexture","default"].indexOf(p)<0&&function(e){i.d(t,e,function(){return d[e]})}(p);var f=i(437);i.d(t,"_DDSTextureLoader",function(){return f.b}),i.d(t,"_ENVTextureLoader",function(){return f.c}),i.d(t,"_KTXTextureLoader",function(){return f.d}),i.d(t,"_TGATextureLoader",function(){return f.e}),i.d(t,"_BasisTextureLoader",function(){return f.a});var m=i(269);i.d(t,"MirrorTexture",function(){return m.a});var _=i(187);i.d(t,"MultiRenderTarget",function(){return _.a});var g=i(438);i.d(t,"TexturePacker",function(){return g.a}),i.d(t,"TexturePackerFrame",function(){return g.b});var v=i(431);i.d(t,"CustomProceduralTexture",function(){return v.a}),i.d(t,"NoiseProceduralTexture",function(){return v.b}),i.d(t,"ProceduralTexture",function(){return v.c}),i.d(t,"ProceduralTextureSceneComponent",function(){return v.d});var b=i(360);i.d(t,"RawCubeTexture",function(){return b.a});var y=i(90);i.d(t,"RawTexture",function(){return y.a});var T=i(361);i.d(t,"RawTexture2DArray",function(){return T.a});var E=i(362);i.d(t,"RawTexture3D",function(){return E.a});var S=i(363);i.d(t,"RefractionTexture",function(){return S.a});var A=i(39);i.d(t,"RenderTargetTexture",function(){return A.a});var C=i(9);i.d(t,"Texture",function(){return C.a});var P=i(279);i.d(t,"VideoTexture",function(){return P.a})},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var o,n=i(1),a=i(0),r=i(62),y=i(2),s=i(11),c=(i(130),o=r.a,Object(n.d)(T,o),T.prototype._triggerOnLoad=function(){this._onLoad&&this._onLoad()},T.prototype.getTextureMatrix=function(){return this._textureMatrix},T.prototype.load3dlTexture=function(){var g=this,v=this._getEngine(),b=1===v.webGLVersion?v.createRawTexture(null,1,1,y.a.TEXTUREFORMAT_RGBA,!1,!1,y.a.TEXTURE_BILINEAR_SAMPLINGMODE,null,y.a.TEXTURETYPE_UNSIGNED_INT):v.createRawTexture3D(null,1,1,1,y.a.TEXTUREFORMAT_RGBA,!1,!1,y.a.TEXTURE_BILINEAR_SAMPLINGMODE,null,y.a.TEXTURETYPE_UNSIGNED_INT);function e(e){if("string"==typeof e){for(var t,i=null,n=null,r=e.split("\n"),o=0,a=0,s=0,c=0,l=0,u=0;u<r.length;u++){var h,d,p,f,m,_=r[u];T._noneEmptyLineRegex.test(_)&&0!==_.indexOf("#")&&(h=_.split(" "),0!==o?0!=o&&(d=Math.max(parseInt(h[0]),0),p=Math.max(parseInt(h[1]),0),f=Math.max(parseInt(h[2]),0),l=Math.max(d,l),l=Math.max(p,l),l=Math.max(f,l),m=4*(a+c*o+s*o*o),n&&(n[0+m]=d,n[1+m]=p,n[2+m]=f),++s%o!=0||++c%o==(s=0)&&(a++,c=0)):(o=h.length,i=new Uint8Array(o*o*o*4),n=new Float32Array(o*o*o*4)))}if(n&&i)for(u=0;
1u<n.length;u++)0<u&&(u+1)%4==0?i[u]=255:(t=n[u],i[u]=t/l*255);b.is3D?(b.updateSize(o,o,o),v.updateRawTexture3D(b,i,y.a.TEXTUREFORMAT_RGBA,!1)):(b.updateSize(o*o,o),v.updateRawTexture(b,i,y.a.TEXTUREFORMAT_RGBA,!1)),b.isReady=!0,g._triggerOnLoad()}}this._texture=b,this._texture.isReady=!1,this.isCube=!1,this.is3D=1<v.webGLVersion,this.wrapU=y.a.TEXTURE_CLAMP_ADDRESSMODE,this.wrapV=y.a.TEXTURE_CLAMP_ADDRESSMODE,this.wrapR=y.a.TEXTURE_CLAMP_ADDRESSMODE,this.anisotropicFilteringLevel=1;var t=this.getScene();return t?t._loadFile(this.url,e):v._loadFile(this.url,e),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()||this._getEngine());return e.level=this.level,e},T.prototype.delayLoad=function(){this.delayLoadState===y.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=y.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this.loadTexture())},T.Parse=function(e,t){var i=null;return e.name&&!e.isRenderTarget&&((i=new T(e.name,t)).name=e.name,i.level=e.level),i},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);function T(e,t,i){void 0===i&&(i=null);var n,r=o.call(this,t)||this;return e&&(r._textureMatrix=a.a.Identity(),r.name=e,r.url=e,r._onLoad=i,r._texture=r._getFromCache(e,!0),r._texture?r._triggerOnLoad():(n=r.getScene())&&n.useDelayedTextureLoading?r.delayLoadState=y.a.DELAYLOADSTATE_NOTLOADED:r.loadTexture()),r}s.a.RegisteredTypes["BABYLON.ColorGradingTexture"]=c},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var r,o=i(1),n=i(62),a=i(2),s=i(0),c=(i(202),i(228),r=n.a,Object(o.d)(l,r),l.prototype._createInternalTexture=function(){var e=0,t=0,t=this._isVideo?(e=this.element.videoWidth,this.element.videoHeight):(e=this.element.width,this.element.height),i=this._getEngine();i&&(this._texture=i.createDynamicTexture(e,t,this._generateMipMaps,this._samplingMode)),this.update()},l.prototype.getTextureMatrix=function(){return this._textureMatrix},l.prototype.update=function(e){void 0===e&&(e=null);var t=this._getEngine();if(null!=this._texture&&null!=t)if(this._isVideo){var i=this.element;if(i.readyState<i.HAVE_CURRENT_DATA)return;t.updateVideoTexture(this._texture,i,null===e||e)}else{var n=this.element;t.updateDynamicTexture(this._texture,n,null===e||e,!1)}},l.DefaultOptions={generateMipMaps:!1,samplingMode:a.a.TEXTURE_BILINEAR_SAMPLINGMODE,engine:null,scene:null},l);function l(e,t,i){var n=r.call(this,i.scene||i.engine)||this;return t&&(i.engine||i.scene)&&(i=Object(o.a)(Object(o.a)({},l.DefaultOptions),i),n._generateMipMaps=i.generateMipMaps,n._samplingMode=i.samplingMode,n._textureMatrix=s.a.Identity(),n.name=e,n.element=t,n._isVideo=t instanceof HTMLVideoElement,n.anisotropicFilteringLevel=1,n._createInternalTexture()),n}},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return c});var u,n=i(1),r=i(3),o=i(106),a=i(27),s=i(86),h=i(2),c=(i(130),u=s.a,Object(n.d)(l,u),l.prototype.update=function(e,t,i,n,r){void 0===r&&(r=null),this._texture.getEngine().updateRawCubeTexture(this._texture,e,t,i,n,r)},l.prototype.updateRGBDAsync=function(e,t,i,n){return void 0===t&&(t=null),void 0===i&&(i=.8),void 0===n&&(n=0),l._UpdateRGBDAsync(this._texture,e,t,i,n)},l.prototype.clone=function(){var n=this;return r.a.Clone(function(){var e=n.getScene(),t=n._texture,i=new l(e,t._bufferViewArray,t.width,t.format,t.type,t.generateMipMaps,t.invertY,t.samplingMode,t._compression);return t.source===a.b.CubeRawRGBD&&i.updateRGBDAsync(t._bufferViewArrayArray,t._sphericalPolynomial,t._lodGenerationScale,t._lodGenerationOffset),i},this)},l._UpdateRGBDAsync=function(e,t,i,n,r){return e._source=a.b.CubeRawRGBD,e._bufferViewArrayArray=t,e._lodGenerationScale=n,e._lodGenerationOffset=r,e._sphericalPolynomial=i,o.a.UploadLevelsAsync(e,t).then(function(){e.isReady=!0})},l);function l(e,t,i,n,r,o,a,s,c){void 0===n&&(n=h.a.TEXTUREFORMAT_RGBA),void 0===r&&(r=h.a.TEXTURETYPE_UNSIGNED_INT),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=h.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=null);var l=u.call(this,"",e)||this;return l._texture=e.getEngine().createRawCubeTexture(t,i,n,r,o,a,s,c),l}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var h,n=i(1),d=i(9),p=i(2),r=(i(130),h=d.a,Object(n.d)(o,h),o.prototype.update=function(e){this._texture&&this._getEngine().updateRawTexture2DArray(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},o);function o(e,t,i,n,r,o,a,s,c,l){void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===c&&(c=d.a.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=p.a.TEXTURETYPE_UNSIGNED_INT);var u=h.call(this,null,o,!a,s)||this;return u.format=r,u._texture=o.getEngine().createRawTexture2DArray(e,t,i,n,r,a,s,c,null,l),u.is2DArray=!0,u}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var h,n=i(1),d=i(9),p=i(2),r=(i(130),h=d.a,Object(n.d)(o,h),o.prototype.update=function(e){this._texture&&this._getEngine().updateRawTexture3D(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},o);function o(e,t,i,n,r,o,a,s,c,l){void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===c&&(c=d.a.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=p.a.TEXTURETYPE_UNSIGNED_INT);var u=h.call(this,null,o,!a,s)||this;return u.format=r,u._texture=o.getEngine().createRawTexture3D(e,t,i,n,r,a,s,c,null,l),u.is3D=!0,u}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var o,n=i(1),a=i(80),r=(o=i(39).a,Object(n.d)(s,o),s.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize(),i=new s(this.name,t.width,e,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.refractionPlane=this.refractionPlane.clone(),this.renderList&&(i.renderList=this.renderList.slice(0)),i.depth=this.depth,i},s.prototype.serialize=function(){if(!this.name)return null;var e=o.prototype.serialize.call(this);return e.mirrorPlane=this.refractionPlane.asArray(),e.depth=this.depth,e},s);
1function s(e,t,i,n){var r=o.call(this,e,t,i,n,!0)||this;return r.refractionPlane=new a.a(0,1,0,1),r.depth=2,r.onBeforeRenderObservable.add(function(){i.clipPlane=r.refractionPlane}),r.onAfterRenderObservable.add(function(){i.clipPlane=null}),r}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(46),u=i(0),h=i(14),r=(Object.defineProperty(o.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!1,configurable:!0}),o.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},o.prototype.startDirectionFunction=function(e,t,i,n){n?u.c.Vector3[0].copyFrom(i._localPosition).normalize():i.position.subtractToRef(e.getTranslation(),u.c.Vector3[0]).normalize();var r=h.a.RandomRange(0,this.directionRandomizer),o=h.a.RandomRange(0,this.directionRandomizer),a=h.a.RandomRange(0,this.directionRandomizer);t.x=u.c.Vector3[0].x+r,t.y=u.c.Vector3[0].y+o,t.z=u.c.Vector3[0].z+a,t.normalize()},o.prototype.startPositionFunction=function(e,t,i,n){var r=h.a.RandomRange(0,2*Math.PI),o=this.emitFromSpawnPointOnly?1e-4:1-(o=h.a.RandomRange(0,this.heightRange))*o,a=this._radius-h.a.RandomRange(0,this._radius*this.radiusRange),s=(a*=o)*Math.sin(r),c=a*Math.cos(r),l=o*this._height;if(n)return t.x=s,t.y=l,void(t.z=c);u.e.TransformCoordinatesFromFloatsToRef(s,l,c,e,t)},o.prototype.clone=function(){var e=new o(this._radius,this._angle,this.directionRandomizer);return n.a.DeepCopy(this,e),e},o.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)},o.prototype.getEffectDefines=function(){var e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e},o.prototype.getClassName=function(){return"ConeParticleEmitter"},o.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e.radiusRange=this.radiusRange,e.heightRange=this.heightRange,e.emitFromSpawnPointOnly=this.emitFromSpawnPointOnly,e},o.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer,this.radiusRange=void 0!==e.radiusRange?e.radiusRange:1,this.heightRange=void 0!==e.radiusRange?e.heightRange:1,this.emitFromSpawnPointOnly=void 0!==e.emitFromSpawnPointOnly&&e.emitFromSpawnPointOnly},o);function o(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}},function(e,t,i){"use strict";i.d(t,"b",function(){return o}),i.d(t,"a",function(){return s});var a,n=i(1),u=i(0),h=i(14),r=i(46),o=(l.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=h.a.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),a=Math.atan2(r.x,r.z);a+=h.a.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,r.y=o,r.x=Math.sin(a),r.z=Math.cos(a),r.normalize(),n?t.copyFrom(r):u.e.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},l.prototype.startPositionFunction=function(e,t,i,n){var r=h.a.RandomRange(-this.height/2,this.height/2),o=h.a.RandomRange(0,2*Math.PI),a=h.a.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(a)*this.radius,c=s*Math.cos(o),l=s*Math.sin(o);n?t.copyFromFloats(c,r,l):u.e.TransformCoordinatesFromFloatsToRef(c,r,l,e,t)},l.prototype.clone=function(){var e=new l(this.radius,this.directionRandomizer);return r.a.DeepCopy(this,e),e},l.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},l.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER"},l.prototype.getClassName=function(){return"CylinderParticleEmitter"},l.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},l.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiu
1sRange,this.directionRandomizer=e.directionRandomizer},l),s=(a=o,Object(n.d)(c,a),c.prototype.startDirectionFunction=function(e,t,i){var n=h.a.RandomRange(this.direction1.x,this.direction2.x),r=h.a.RandomRange(this.direction1.y,this.direction2.y),o=h.a.RandomRange(this.direction1.z,this.direction2.z);u.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},c.prototype.clone=function(){var e=new c(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return r.a.DeepCopy(this,e),e},c.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)},c.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"},c.prototype.getClassName=function(){return"CylinderDirectedParticleEmitter"},c.prototype.serialize=function(){var e=a.prototype.serialize.call(this);return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},c.prototype.parse=function(e){a.prototype.parse.call(this,e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)},c);function c(e,t,i,n,r){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=new u.e(0,1,0)),void 0===r&&(r=new u.e(0,1,0));var o=a.call(this,e,t,i)||this;return o.direction1=n,o.direction2=r,o}function l(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}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(46),h=i(0),d=i(14),r=(o.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=d.a.RandomRange(0,this.directionRandomizer),a=d.a.RandomRange(0,this.directionRandomizer),s=d.a.RandomRange(0,this.directionRandomizer);r.x+=o,r.y+=a,r.z+=s,r.normalize(),n?t.copyFrom(r):h.e.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},o.prototype.startPositionFunction=function(e,t,i,n){var r=this.radius-d.a.RandomRange(0,this.radius*this.radiusRange),o=d.a.RandomRange(0,1),a=d.a.RandomRange(0,2*Math.PI),s=Math.acos(2*o-1),c=r*Math.cos(a)*Math.sin(s),l=r*Math.cos(s),u=r*Math.sin(a)*Math.sin(s);n?t.copyFromFloats(c,Math.abs(l),u):h.e.TransformCoordinatesFromFloatsToRef(c,Math.abs(l),u,e,t)},o.prototype.clone=function(){var e=new o(this.radius,this.directionRandomizer);return n.a.DeepCopy(this,e),e},o.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},o.prototype.getEffectDefines=function(){return"#define HEMISPHERICEMITTER"},o.prototype.getClassName=function(){return"HemisphericParticleEmitter"},o.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},o.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},o);function o(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}},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(46),s=i(0),c=i(14),r=(o.prototype.startDirectionFunction=function(e,t,i,n){var r=c.a.RandomRange(this.direction1.x,this.direction2.x),o=c.a.RandomRange(this.direction1.y,this.direction2.y),a=c.a.RandomRange(this.direction1.z,this.direction2.z);n?t.copyFromFloats(r,o,a):s.e.TransformNormalFromFloatsToRef(r,o,a,e,t)},o.prototype.startPositionFunction=function(e,t,i,n){n?t.copyFromFloats(0,0,0):s.e.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},o.prototype.clone=function(){var e=new o;return n.a.DeepCopy(this,e),e},o.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},o.prototype.getEffectDefines=function(){return"#define POINTEMITTER"},o.prototype.getClassName=function(){return"PointParticleEmitter"},o.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},o.prototype.parse=function(e){s.e.FromArrayToRef(e.direction1,0,this.direction1),s.e.FromArrayToRef(e.direction2,0,this.direction2)},o);function o(){this.direction1=new s.e(0,1,0),this.direction2=new s.e(0,1,0)}},function(e,t,i){"use strict";i.d(t,"b",function(){return a}),i.d(t,"a",function(){return s});var r,n=i(1),h=i(0),d=i(14),o=i(46),a=(l.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=d.a.RandomRange(0,this.directionRandomizer),a=d.a.RandomRange(0,this.directionRandomizer),s=d.a.RandomRange(0,this.directionRandomizer);r.x+=o,r.y+=a,r.z+=s,r.normalize(),n?t.copyFrom(r):h.e.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},l.prototype.startPositionFunction=function(e,t,i,n){var r=this.radius-d.a.RandomRange(0,this.radius*this.radiusRange),o=d.a.RandomRange(0,1),a=d.a.RandomRange(0,2*Math.PI),s=Math.acos(2*o-1),c=r*Math.cos(a)*Math.sin(s),l=r*Math.cos(s),u=r*Math.sin(a)*Math.sin(s);n?t.copyFromFloats(c,l,u):h.e.TransformCoordinatesFromFloatsToRef(c,l,u,e,t)},l.prototype.clone=function(){var e=new l(this.radius,this.directionRandomizer);return o.a.DeepCopy(this,e),e},l.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},l.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER"},l.prototype.getClassName=function(){return"SphereParticleEmitter"},l.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},l.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiu
1sRange,this.directionRandomizer=e.directionRandomizer},l),s=(r=a,Object(n.d)(c,r),c.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),o=d.a.RandomRange(this.direction1.z,this.direction2.z);h.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},c.prototype.clone=function(){var e=new c(this.radius,this.direction1,this.direction2);return o.a.DeepCopy(this,e),e},c.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},c.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"},c.prototype.getClassName=function(){return"SphereDirectedParticleEmitter"},c.prototype.serialize=function(){var e=r.prototype.serialize.call(this);return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},c.prototype.parse=function(e){r.prototype.parse.call(this,e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)},c);function c(e,t,i){void 0===e&&(e=1),void 0===t&&(t=new h.e(0,1,0)),void 0===i&&(i=new h.e(0,1,0));var n=r.call(this,e)||this;return n.direction1=t,n.direction2=i,n}function l(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}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(46),m=i(0),s=i(14),r=i(4),o=(Object.defineProperty(a.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&((this._mesh=e)?(this._indices=e.getIndices(),this._positions=e.getVerticesData(r.b.PositionKind),this._normals=e.getVerticesData(r.b.NormalKind)):(this._indices=null,this._positions=null,this._normals=null))},enumerable:!1,configurable:!0}),a.prototype.startDirectionFunction=function(e,t,i,n){var r,o,a;this.useMeshNormalsForDirection&&this._normals?m.e.TransformNormalToRef(this._storedNormal,e,t):(r=s.a.RandomRange(this.direction1.x,this.direction2.x),o=s.a.RandomRange(this.direction1.y,this.direction2.y),a=s.a.RandomRange(this.direction1.z,this.direction2.z),n?t.copyFromFloats(r,o,a):m.e.TransformNormalFromFloatsToRef(r,o,a,e,t))},a.prototype.startPositionFunction=function(e,t,i,n){var r,o,a,s,c,l,u,h,d,p,f;this._indices&&this._positions&&(r=3*Math.random()*(this._indices.length/3)|0,s=1-(o=Math.random())-(a=Math.random()*(1-o)),c=this._indices[r],l=this._indices[1+r],u=this._indices[2+r],h=m.c.Vector3[0],d=m.c.Vector3[1],p=m.c.Vector3[2],f=m.c.Vector3[3],m.e.FromArrayToRef(this._positions,3*c,h),m.e.FromArrayToRef(this._positions,3*l,d),m.e.FromArrayToRef(this._positions,3*u,p),f.x=o*h.x+a*d.x+s*p.x,f.y=o*h.y+a*d.y+s*p.y,f.z=o*h.z+a*d.z+s*p.z,n?t.copyFromFloats(f.x,f.y,f.z):m.e.TransformCoordinatesFromFloatsToRef(f.x,f.y,f.z,e,t),this.useMeshNormalsForDirection&&this._normals&&(m.e.FromArrayToRef(this._normals,3*c,h),m.e.FromArrayToRef(this._normals,3*l,d),m.e.FromArrayToRef(this._normals,3*u,p),this._storedNormal.x=o*h.x+a*d.x+s*p.x,this._storedNormal.y=o*h.y+a*d.y+s*p.y,this._storedNormal.z=o*h.z+a*d.z+s*p.z))},a.prototype.clone=function(){var e=new a(this.mesh);return n.a.DeepCopy(this,e),e},a.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},a.prototype.getEffectDefines=function(){return""},a.prototype.getClassName=function(){return"MeshParticleEmitter"},a.prototype.serialize=function(){var e,t={};return t.type=this.getClassName(),t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t.meshId=null===(e=this.mesh)||void 0===e?void 0:e.id,t.useMeshNormalsForDirection=this.useMeshNormalsForDirection,t},a.prototype.parse=function(e,t){m.e.FromArrayToRef(e.direction1,0,this.direction1),m.e.FromArrayToRef(e.direction2,0,this.direction2),e.meshId&&(this.mesh=t.getLastMeshByID(e.meshId)),this.useMeshNormalsForDirection=e.useMeshNormalsForDirection},a);function a(e){void 0===e&&(e=null),this._indices=null,this._positions=null,this._normals=null,this._storedNormal=m.e.Zero(),this._mesh=null,this.direction1=new m.e(0,1,0),this.direction2=new m.e(0,1,0),this.useMeshNormalsForDirection=!0,this.mesh=e}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var g=i(5),v=i(191),o=(a.prototype.get=function(e,t){var i=this.mm.get(e);if(void 0!==i)return i.get(t)},a.prototype.set=function(e,t,i){var n=this.mm.get(e);void 0===n&&this.mm.set(e,n=new Map),n.set(t,i)},a),n=(Object.defineProperty(r.prototype,"standalone",{get:function(){var e,t;return null!==(t=null===(e=this._options)||void 0===e?void 0:e.standalone)&&void 0!==t&&t}
1,enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"baseMaterial",{get:function(){return this._baseMaterial},enumerable:!1,configurable:!0}),r.prototype.getEffect=function(e,t){var i,n,r,o,a,s;return null!==(s=null!==(r=null===(n=null===(i=this._subMeshToDepthEffect.mm.get(e))||void 0===i?void 0:i.get(t))||void 0===n?void 0:n.depthEffect)&&void 0!==r?r:null===(a=null===(o=this._subMeshToDepthEffect.mm.get(null))||void 0===o?void 0:o.get(t))||void 0===a?void 0:a.depthEffect)&&void 0!==s?s:null},r.prototype.isReadyForSubMesh=function(e,t,i,n){var r,o;return this.standalone&&this._baseMaterial.isReadyForSubMesh(e.getMesh(),e,n),null!==(o=null===(r=this._makeEffect(e,t,i))||void 0===r?void 0:r.isReady())&&void 0!==o&&o},r.prototype.dispose=function(){this._baseMaterial.onEffectCreatedObservable.remove(this._onEffectCreatedObserver),this._onEffectCreatedObserver=null;for(var e=this._meshes.entries(),t=e.next();!0!==t.done;t=e.next()){var i=t.value,n=i[0],r=i[1];n.onDisposeObservable.remove(r)}},r.prototype._makeEffect=function(e,t,i){var n,r=null!==(n=this._subMeshToEffect.get(e))&&void 0!==n?n:this._subMeshToEffect.get(null);if(!r)return null;var o=this._subMeshToDepthEffect.get(e,i);o||(o={depthEffect:null,depthDefines:"",token:v.a.RandomId()},this._subMeshToDepthEffect.set(e,i,o));var a=t.join("\n");if(o.depthEffect&&a===o.depthDefines)return o.depthEffect;o.depthDefines=a;var s=r.vertexSourceCode,c=r.fragmentSourceCode,l=this._options&&this._options.remappedVariables?"#include<shadowMapVertexNormalBias>("+this._options.remappedVariables.join(",")+")":g.a.IncludesShadersStore.shadowMapVertexNormalBias,u=this._options&&this._options.remappedVariables?"#include<shadowMapVertexMetric>("+this._options.remappedVariables.join(",")+")":g.a.IncludesShadersStore.shadowMapVertexMetric,h=this._options&&this._options.remappedVariables?"#include<shadowMapFragmentSoftTransparentShadow>("+this._options.remappedVariables.join(",")+")":g.a.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow,d=g.a.IncludesShadersStore.shadowMapFragment,s=(s=-1!==(s=(s=s.replace(/void\s+?main/g,g.a.IncludesShadersStore.shadowMapVertexDeclaration+"\r\nvoid main")).replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g,l)).indexOf("#define SHADOWDEPTH_METRIC")?s.replace(/#define SHADOWDEPTH_METRIC/g,u):s.replace(/}\s*$/g,u+"\r\n}")).replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g,""),p=0<=c.indexOf("#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW")||0<=c.indexOf("#define CUSTOM_FRAGMENT_BEFORE_FOG"),f=-1!==c.indexOf("#define SHADOWDEPTH_FRAGMENT"),m="";p?c=c.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g,h):m=h+"\r\n",c=c.replace(/void\s+?main/g,g.a.IncludesShadersStore.shadowMapFragmentDeclaration+"\r\nvoid main"),f?c=c.replace(/#define SHADOWDEPTH_FRAGMENT/g,d):m+=d+"\r\n",m&&(c=c.replace(/}\s*$/g,m+"}")),c=c.replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g,"");var _=r.getUniformNames().slice();return _.push("biasAndScaleSM","depthValuesSM","lightDataSM","softTransparentShadowSM"),o.depthEffect=this._scene.getEngine().createEffect({vertexSource:s,fragmentSource:c,vertexToken:o.token,fragmentToken:o.token},{attributes:r.getAttributesNames(),uniformsNames:_,uniformBuffersNames:r.getUniformBuffersNames(),samplers:r.getSamplers(),defines:a+"\n"+r.defines,indexParameters:r.getIndexParameters()},this._scene.getEngine()),o.depthEffect},r);function r(e,t,i){var r=this;this._baseMaterial=e,this._scene=t,this._options=i,this._subMeshToEffect=new Map,this._subMeshToDepthEffect=new o,this._meshes=new Map;var n="NodeMaterial"===e.getClassName()?"u_":"";this._matriceNames={world:n+"world",view:n+"view",projection:n+"projection",viewProjection:n+"viewProjection",worldView:n+"worldView",worldViewProjection:n+"worldViewProjection"},this._onEffectCreatedObserver=this._baseMaterial.onEffectCreatedObservable.add(function(e){var t,i=null===(t=e.subMesh)||void 0===t?void 0:t.getMesh();i&&!r._meshes.has(i)&&r._meshes.set(i,i.onDisposeObservable.add(function(e){for(var t=r._subMeshToEffect.keys(),i=t.next();!0!==i.done;i=t.next()){var n=i.value;(null==n?void 0:n.getMesh())===e&&(r._subMeshToEffect.delete(n),r._subMeshToDepthEffect.mm.delete(n))}})),r._subMeshToEffect.set(e.subMesh,e.effect),r._subMeshToDepthEffect.mm.delete(e.subMesh)})}function a(){this.mm=new Map}},function(e,t,i){"use strict";var n=i(14);i.d(t,"r",function(){return n.a});var r=i(33);i.d(t,"a",function(){return r.a}),i.d(t,"b",function(){return r.b}),i.d(t,"c",function(){return r.c}),i.d(t,"d",function(){return r.d}),i.d(t,"e",function(){return r.e}),i.d(t,"f",function(){return r.f}),i.d(t,"g",function(){return r.g}),i.d(t,"h",function(){return r.h}),i.d(t,"i",function(){return r.i}),i.d(t,"j",function(){return r.j}),i.d(t,"k",function(){return r.k}),i.d(t,"l",function(){return r.l}),i.d(t,"m",function(){return r.m}),i.d(t,"n",function(){return r.n}),i.d(t,"o",function(){return r.o}),i.d(t,"p",function(){return r.p}),i.d(t,"q",function(){return r.q}),i.d(t,"s",function(){return r.r}),i.d(t,"t",function(){return r.s}),i.d(t,"w",function(){return r.t}),i.d(t,"x",function(){return r.u}),i.d(t,"y",function(){return r.v}),i.d(t,"z",function(){return r.w}),i.d(t,"A",function(){return r.x}),i.d(t,"B",function(){return r.y}),i.d(t,"C",function(){return r.z}),i.d(t,"D",function(){return r.A});var o=i(111);i.d(t,"u",function(){return o.a}),i.d(t,"v",function(){return o.b})},function(e,t,i){"use strict";var n=i(284);i.d(t,"a",function(){return n.a});var r=i(213);i.d(t,"b",function(){return r.a})},function(e,t,i){"use strict";i.r(t);var n=i(375);for(var r in n)"default"!==r&&function(e){i.d(t,e,function(){return n[e]})}(r);var o=i(440);i.d(t,"RecastJSPlugin",function(){return o.b}),i.d(t,"RecastJSCrowd",function(){return o.a})},function(e,t){},function(e,t,i){"use strict";i.r(t);
1var n=i(377);i.d(t,"Database",function(){return n.a});var r=i(378);for(var o in r)["Database","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return r[e]})}(o)},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var r=i(13),h=i(7),o=i(171),n=i(12),d=i(55);n.a.OfflineProviderFactory=function(e,t,i){return void 0===i&&(i=!1),new a(e,t,i)};var a=(Object.defineProperty(p.prototype,"enableSceneOffline",{get:function(){return this._enableSceneOffline},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"enableTexturesOffline",{get:function(){return this._enableTexturesOffline},enumerable:!1,configurable:!0}),p.prototype._checkManifestFile=function(){function t(){i._enableSceneOffline=!1,i._enableTexturesOffline=!1,i._callbackManifestChecked(!1)}var i=this,n=!1,e=this._currentSceneUrl+".manifest",r=new d.a;navigator.onLine&&(n=!0,e=e+(null==e.match(/\?/)?"?":"&")+Date.now()),r.open("GET",e),r.addEventListener("load",function(){if(200===r.status||p._ValidateXHRData(r,1))try{var e=JSON.parse(r.response);i._enableSceneOffline=e.enableSceneOffline,i._enableTexturesOffline=e.enableTexturesOffline&&p.IsUASupportingBlobStorage,e.version&&!isNaN(parseInt(e.version))&&(i._manifestVersionFound=e.version),i._callbackManifestChecked&&i._callbackManifestChecked(!0)}catch(e){t()}else t()},!1),r.addEventListener("error",function(){var e;n?(n=!1,e=i._currentSceneUrl+".manifest",r.open("GET",e),r.send()):t()},!1);try{r.send()}catch(e){h.a.Error("Error on XHR send request."),this._callbackManifestChecked(!1)}},p.prototype.open=function(e,t){function i(){r._isSupported=!1,t&&t()}var n,r=this;this._idbFactory&&(this._enableSceneOffline||this._enableTexturesOffline)?this._db?e&&e():(this._hasReachedQuota=!1,this._isSupported=!0,(n=this._idbFactory.open("babylonjs",1)).onerror=function(){i()},n.onblocked=function(){h.a.Error("IDB request blocked. Please reload the page."),i()},n.onsuccess=function(){r._db=n.result,e()},n.onupgradeneeded=function(e){if(r._db=e.target.result,r._db)try{r._db.createObjectStore("scenes",{keyPath:"sceneUrl"}),r._db.createObjectStore("versions",{keyPath:"sceneUrl"}),r._db.createObjectStore("textures",{keyPath:"textureUrl"})}catch(e){h.a.Error("Error while creating object stores. Exception: "+e.message),i()}}):(this._isSupported=!1,t&&t())},p.prototype.loadImage=function(e,t){function i(){n._hasReachedQuota||null===n._db?t.src=e:n._saveImageIntoDBAsync(r,t)}var n=this,r=p._ReturnFullUrlLocation(e);this._mustUpdateRessources?i():this._loadImageFromDBAsync(r,t,i)},p.prototype._loadImageFromDBAsync=function(t,i,n){var r,e,o;this._isSupported&&null!==this._db?((e=this._db.transaction(["textures"])).onabort=function(){i.src=t},e.oncomplete=function(){var e;r?(e=(window.URL||window.webkitURL).createObjectURL(r.data),i.onerror=function(){h.a.Error("Error loading image from blob URL: "+e+" switching back to web url: "+t),i.src=t},i.src=e):n()},(o=e.objectStore("textures").get(t)).onsuccess=function(e){r=e.target.result},o.onerror=function(){h.a.Error("Error loading texture "+t+" from DB."),i.src=t}):(h.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),i.src=t)},p.prototype._saveImageIntoDBAsync=function(n,r){var o,a,s,c=this;this._isSupported?(o=function(){var t;if(a){var i=window.URL||window.webkitURL;try{t=i.createObjectURL(a)}catch(e){t=i.createObjectURL(a)}}t&&(r.src=t)},p.IsUASupportingBlobStorage?((s=new d.a).open("GET",n),s.responseType="blob",s.addEventListener("load",function(){if(200===s.status&&c._db){a=s.response;var e=c._db.transaction(["textures"],"readwrite");e.onabort=function(e){try{var t=(e.srcElement||e.target).error;t&&"QuotaExceededError"===t.name&&(c._hasReachedQuota=!0)}catch(e){}o()},e.oncomplete=function(){o()};var t={textureUrl:n,data:a};try{var i=e.objectStore("textures").put(t);i.onsuccess=function(){},i.onerror=function(){o()}}catch(e){25===e.code&&(p.IsUASupportingBlobStorage=!1,c._enableTexturesOffline=!1),r.src=n}}else r.src=n},!1),s.addEventListener("error",function(){h.a.Error("Error in XHR request in BABYLON.Database."),r.src=n},!1),s.send()):r.src=n):(h.a.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),r.src=n)},p.prototype._checkVersionFromDB=function(e,t){var i=this;this._loadVersionFromDBAsync(e,t,function(){i._saveVersionIntoDBAsync(e,t)})},p.prototype._loadVersionFromDBAsync=function(e,t,i){var n,r=this;if(this._isSupported&&this._db)try{var o=this._db.transaction(["versions"]);o.oncomplete=function(){n&&r._manifestVersionFound===n.data?t(n.data):(r._mustUpdateRessources=!0,i())},o.onabort=function(){t(-1)};var a=o.objectStore("versions").get(e);a.onsuccess=function(e){n=e.target.result},a.onerror=function(){h.a.Error("Error loading version for scene "+e+" from DB."),t(-1)}}catch(e){h.a.Error("Error while accessing 'versions' object store (READ OP). Exception: "+e.message),t(-1)}else h.a.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),t(-1)},p.prototype._saveVersionIntoDBAsync=function(e,i){var n=this;if(this._isSupported&&!this._hasReachedQuota&&this._db)try{var t=this._db.transaction(["versions"],"readwrite");t.onabort=function(e){try{var t=e.srcElement.error;t&&"QuotaExceededError"===t.name&&(n._hasReachedQuota=!0)}catch(e){}i(-1)},t.oncomplete=function(){i(n._manifestVersionFound)};var r={sceneUrl:e,data:this._manifestVersionFound},o=t.objectStore("versions").put(r);o.onsuccess=function(){},o.onerror=function(){h.a.Error("Error in DB add version request in BABYLON.Database.")}}catch(e){h.a.Error("Error while accessing 'versions' object store (WRITE OP). Exception: "+e.message),i(-1)}else i(-1)},p.prototype.loadFile=function(e,t,i,n,r){function o(){a._saveFileAsync(s,t,i,r,n)}var a=this,s=p._ReturnFullUrlLocation(e);this._checkVersionFromDB(s,function(e){-1!==e?a._mustUpdateRessources?a._saveFileAsync(s,t,i,r,n):a._loadFileAsync(s,t,o):n&&n()})},p.prototype._loadFileAsync=function(e,t,i){var n,r,o,a;
1this._isSupported&&this._db?(r=-1!==e.indexOf(".babylon")?"scenes":"textures",(o=this._db.transaction([r])).oncomplete=function(){n?t(n.data):i()},o.onabort=function(){i()},(a=o.objectStore(r).get(e)).onsuccess=function(e){n=e.target.result},a.onerror=function(){h.a.Error("Error loading file "+e+" from DB."),i()}):(h.a.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),t())},p.prototype._saveFileAsync=function(n,r,e,o,a){var s,c,l,u=this;this._isSupported?(s=-1!==n.indexOf(".babylon")?"scenes":"textures",(l=new d.a).open("GET",n+"?"+Date.now()),o&&(l.responseType="arraybuffer"),e&&(l.onprogress=e),l.addEventListener("load",function(){if(200===l.status||l.status<400&&p._ValidateXHRData(l,o?6:1))if(c=o?l.response:l.responseText,!u._hasReachedQuota&&u._db){var e,t=u._db.transaction([s],"readwrite");t.onabort=function(e){try{var t=e.srcElement.error;t&&"QuotaExceededError"===t.name&&(u._hasReachedQuota=!0)}catch(e){}r(c)},t.oncomplete=function(){r(c)},e="scenes"==s?{sceneUrl:n,data:c,version:u._manifestVersionFound}:{textureUrl:n,data:c};try{var i=t.objectStore(s).put(e);i.onsuccess=function(){},i.onerror=function(){h.a.Error("Error in DB add file request in BABYLON.Database.")}}catch(e){r(c)}}else r(c);else 400<=l.status&&a?a(l):r()},!1),l.addEventListener("error",function(){h.a.Error("error on XHR request."),r()},!1),l.send()):(h.a.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),r())},p._ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&0<e.responseText.length)return!0;if(1===t)return!1}if(2&t){var i=o.a.GetTGAHeader(e.response);if(i.width&&i.height&&0<i.width&&0<i.height)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},p.IsUASupportingBlobStorage=!0,p.IDBStorageEnabled=!1,p._ParseURL=function(e){var t=(document.createElement("a").href=e).substring(0,e.lastIndexOf("#")),i=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(i,0))},p._ReturnFullUrlLocation=function(e){return-1===e.indexOf("http:/")&&-1===e.indexOf("https:/")&&"undefined"!=typeof window?p._ParseURL(window.location.href)+e:e},p);function p(e,t,i){var n=this;void 0===i&&(i=!1),this._idbFactory="undefined"!=typeof window?window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB:indexedDB,this._callbackManifestChecked=t,this._currentSceneUrl=p._ReturnFullUrlLocation(e),this._db=null,this._enableSceneOffline=!1,this._enableTexturesOffline=!1,this._manifestVersionFound=0,this._mustUpdateRessources=!1,this._hasReachedQuota=!1,p.IDBStorageEnabled?i?(this._enableSceneOffline=!0,this._enableTexturesOffline=!0,this._manifestVersionFound=1,r.b.SetImmediate(function(){n._callbackManifestChecked(!0)})):this._checkManifestFile():this._callbackManifestChecked(!0)}},function(e,t){},function(e,t,i){"use strict";i.r(t);var n=i(136);i.d(t,"BaseParticleSystem",function(){return n.a});var r=i(69);for(var o in r)["BaseParticleSystem","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return r[e]})}(o);var a=i(114);i.d(t,"GPUParticleSystem",function(){return a.a});var s=i(381);for(var o in s)["BaseParticleSystem","GPUParticleSystem","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return s[e]})}(o);var c=i(293);i.d(t,"Particle",function(){return c.a});var l=i(382);i.d(t,"ParticleHelper",function(){return l.a});var u=i(64);i.d(t,"ParticleSystem",function(){return u.a}),i(318);var h=i(196);i.d(t,"ParticleSystemSet",function(){return h.a});var d=i(143);i.d(t,"SolidParticle",function(){return d.c}),i.d(t,"ModelShape",function(){return d.b}),i.d(t,"DepthSortedParticle",function(){return d.a}),i.d(t,"SolidParticleVertex",function(){return d.d});var p=i(383);i.d(t,"SolidParticleSystem",function(){return p.a});var f=i(175);i.d(t,"CloudPoint",function(){return f.a}),i.d(t,"PointsGroup",function(){return f.b});var m=i(384);i.d(t,"PointColor",function(){return m.a}),i.d(t,"PointsCloudSystem",function(){return m.b});var _=i(142);i.d(t,"SubEmitterType",function(){return _.b}),i.d(t,"SubEmitter",function(){return _.a})},function(e,t,i){"use strict";
1var n=i(5),r=(i(179),i(162),"particlesVertexShader");n.a.ShadersStore[r]="\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;\nvarying vec3 vPositionW;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration>\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.;\nvPositionW=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(vPositionW,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;\nvPositionW=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(vPositionW,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;\nvPositionW=(invView*vec4(viewPos,1)).xyz;\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);\nvPositionW=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(vPositionW,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) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n}"},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var a=i(13),o=i(10),s=i(9),c=i(22),u=i(114),l=i(196),h=i(64),d=i(55),n=(p.CreateDefault=function(e,t,i,n){var r;return void 0===t&&(t=500),void 0===n&&(n=!1),(r=n?new u.a("default system",{capacity:t},i):new h.a("default system",t,i)).emitter=e,r.particleTexture=new s.a("https://www.babylonjs.com/assets/Flare.png",r.getScene()),r.createConeEmitter(.1,Math.PI/4),r.color1=new o.b(1,1,1,1),r.color2=new o.b(1,1,1,1),r.colorDead=new o.b(1,1,1,0),r.minSize=.1,r.maxSize=.1,r.minEmitPower=2,r.maxEmitPower=2,r.updateSpeed=1/60,r.emitRate=30,r},p.CreateAsync=function(t,n,r){void 0===r&&(r=!1),n=n||c.a.LastCreatedScene;var o={};return n._addPendingData(o),new Promise(function(i,e){if(r&&!u.a.IsSupported)return n._removePendingData(o),e("Particle system with GPU is not supported.");a.b.LoadFile(p.BaseAssetsUrl+"/systems/"+t+".json",function(e){n._removePendingData(o);var t=JSON.parse(e.toString());return i(l.a.Parse(t,n,r))},void 0,void 0,void 0,function(){return n._removePendingData(o),e("An error occured while the creation of your particle system. Check if your type '"+t+"' exists.")})})},p.ExportSet=function(e){for(var t=new l.a,i=0,n=e;i<n.length;i++){var r=n[i];t.systems.push(r)}return t},p.ParseFromFileAsync=function(o,e,a,s,c){return void 0===s&&(s=!1),void 0===c&&(c=""),new Promise(function(i,n){var r=new d.a;r.addEventListener("readystatechange",function(){var e,t;4==r.readyState&&(200==r.status?(e=JSON.parse(r.responseText),t=void 0,t=s?u.a.Parse(e,a,c):h.a.Parse(e,a,c),o&&(t.name=o),i(t)):n("Unable to load the particle system"))}),r.open("GET",e),r.send()})},p.CreateFromSnippetAsync=function(a,s,c,l){var e=this;return void 0===c&&(c=!1),void 0===l&&(l=""),new Promise(function(n,r){var o=new d.a;o.addEventListener("readystatechange",function(){var e,t,i;4==o.readyState&&(200==o.status?(e=JSON.parse(JSON.parse(o.responseText).jsonPayload),t=JSON.parse(e.particleSystem),i=void 0,(i=c?u.a.Parse(t,s,l):h.a.Parse(t,s,l)).snippetId=a,n(i)):r("Unable to load the snippet "+a))}),o.open("GET",e.SnippetUrl+"/"+a.replace(/#/g,"/")),o.send()})},p.BaseAssetsUrl=l.a.BaseAssetsUrl,p.SnippetUrl="https://snippet.babylonjs.com",p);function p(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var Ke=i(0),n=i(10),Qe=i(4),qe=i(16),l=i(8),u=i(188),r=i(22),k=i(143),Ze=i(52),Je=i(24),d=i(78),o=i(35),a=i(98),s=(c.prototype.buildMesh=function(){if(!this._isNotBuilt&&this.mesh)return this.mesh;var e,t;0!==this.nbParticles||this.mesh||(e=u.a.CreateDisc("",{radius:1,tessellation:3},this._scene),this.addShape(e,1),e.dispose()),this._indices32=new(this._needs32Bits?Uint32Array:Uint16Array)(this._indices),this._positions32=new Float32Array(this._positions),this._uvs32=new Float32Array(this._uvs),this._colors32=new Float32Array(this._colors),this.mesh||(t=new l.a(this.name,this._scene),this.mesh=t),!this._updatable&&this._multimaterialEnabled&&this._sortParticlesByMaterial(),this.recomputeNormals&&qe.a.ComputeNormals(this._positions32,this._indices32,this._normals),this._normals32=new Float32Array(this._normals),this._fixedNormal32=new Float32Array(this._normals),this._mustUnrotateFixedNormals&&this._unrotateFixedNormals();var i,n=new qe.a;if(n.indices=this._depthSort?this._indices:this._indices32,n.set(this._positions32,Qe.b.PositionKind),n.set(this._normals32,Qe.b.NormalKind),0<this._uvs32.length&&n.set(this._uvs32,Qe.b.UVKind),0<this._colors32.length&&n.set(this._colors32,Qe.b.ColorKind),n.applyToMesh(this.mesh,this._updatable),this.mesh.isPickable=this._pickable,this._pickable)for(var r=0,o=0;o<this.nbParticles;o++)for(var a=this.particles[o],s=a._model._indicesLength,c=0;c<s;c++)0==c%3&&(i={idx:a.idx,faceId:r},this.pickedParticles[r]=i,r++);return this._multimaterialEnabled&&this.setMultiMaterial(this._materials),this._expandable||(this._depthSort||this._multimaterialEnabled||(this._indices=null),this._positions=null,this._normals=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0)),this._isNotBuilt=!1,this.recomputeNormals=!1,this.mesh},c.prototype.digest=function(e,t){var i=t&&t.facetNb||1,n=t&&t.number||0,r=t&&t.delta||0,o=e.getVerticesData(Qe.b.PositionKind),a=e.getIndices(),s=e.getVerticesData(Qe.b.UVKind),c=e.getVerticesData(Qe.b.ColorKind),l=e.getVerticesData(Qe.b.NormalKind),u=t&&t.storage?t.storage:null,h=0,d=a.length/3;n?(n=d<n?d:n,i=Math.round(d/n),r=0):i=d<i?d:i;for(var p=[],f=[],m=[],_=[],g=[],v=Ke.e.Zero(),b=i;h<d;){h>d-(i=b+Math.floor((1+r)*Math.random()))&&(i=d-h),p.length=0,f.length=0,m.length=0,_.length=0;for(var y=g.length=0,T=3*h;T<3*(h+i);T++){m.push(y);var E,S,A=a[T],C=3*A;
1p.push(o[C],o[1+C],o[2+C]),f.push(l[C],l[1+C],l[2+C]),s&&(E=2*A,_.push(s[E],s[1+E])),c&&(S=4*A,g.push(c[S],c[1+S],c[2+S],c[3+S])),y++}var P=this.nbParticles,x=this._posToShape(p),R=this._uvsToShapeUV(_),O=Array.from(m),M=Array.from(g),I=Array.from(f);for(v.copyFromFloats(0,0,0),F=0;F<x.length;F++)v.addInPlace(x[F]);v.scaleInPlace(1/x.length);for(var D,L=new Ke.e(1/0,1/0,1/0),N=new Ke.e(-1/0,-1/0,-1/0),F=0;F<x.length;F++)x[F].subtractInPlace(v),L.minimizeInPlaceFromFloats(x[F].x,x[F].y,x[F].z),N.maximizeInPlaceFromFloats(x[F].x,x[F].y,x[F].z);this._particlesIntersect&&(D=new Ze.a(L,N));var w=null;this._useModelMaterial&&(w=e.material?e.material:this._setDefaultMaterial());var B=new k.b(this._shapeCounter,x,O,I,M,R,null,null,w),U=this._positions.length,V=this._indices.length;this._meshBuilder(this._index,V,x,this._positions,O,this._indices,_,this._uvs,M,this._colors,I,this._normals,P,0,null,B),this._addParticle(P,this._lastParticleId,U,V,B,this._shapeCounter,0,D,u),this.particles[this.nbParticles].position.addInPlace(v),u||(this._index+=x.length,P++,this.nbParticles++,this._lastParticleId++),this._shapeCounter++,h+=i}return this._isNotBuilt=!0,this},c.prototype._unrotateFixedNormals=function(){for(var e=0,t=0,i=Ke.c.Vector3[0],n=Ke.c.Quaternion[0],r=Ke.c.Matrix[0],o=0;o<this.particles.length;o++){var a,s=this.particles[o],c=s._model._shape;s.rotationQuaternion?s.rotationQuaternion.conjugateToRef(n):(a=s.rotation,Ke.b.RotationYawPitchRollToRef(a.y,a.x,a.z,n),n.conjugateInPlace()),n.toRotationMatrix(r);for(var l=0;l<c.length;l++)t=e+3*l,Ke.e.TransformNormalFromFloatsToRef(this._normals32[t],this._normals32[t+1],this._normals32[t+2],r,i),i.toArray(this._fixedNormal32,t);e=t+3}},c.prototype._resetCopy=function(){var e=this._copy;e.position.setAll(0),e.rotation.setAll(0),e.rotationQuaternion=null,e.scaling.setAll(1),e.uvs.copyFromFloats(0,0,1,1),e.color=null,e.translateFromPivot=!1,e.shapeId=0,e.materialIndex=null},c.prototype._meshBuilder=function(e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m){var _=0,g=0,v=0;this._resetCopy();var b,y,T,E=this._copy,S=!(!f||!f.storage);if(E.idx=d,E.idxInShape=p,E.shapeId=m.shapeID,this._useModelMaterial&&(b=m._material.uniqueId,(y=this._materialIndexesById).hasOwnProperty(b)||(y[b]=this._materials.length,this._materials.push(m._material)),T=y[b],E.materialIndex=T),f&&f.positionFunction&&(f.positionFunction(E,d,p),this._mustUnrotateFixedNormals=!0),S)return E;var A=Ke.c.Matrix[0],C=this._tmpVertex,P=C.position,x=C.color,R=C.uv,O=Ke.c.Vector3[1],M=Ke.c.Vector3[2],I=Ke.c.Vector3[3];Ke.a.IdentityToRef(A),E.getRotationMatrix(A),E.pivot.multiplyToRef(E.scaling,I),E.translateFromPivot?M.setAll(0):M.copyFrom(I);for(var D,L,N,F=f&&f.vertexFunction,w=0;w<i.length;w++)P.copyFrom(i[w]),E.color&&x.copyFrom(E.color),a&&R.copyFromFloats(a[_],a[_+1]),F&&f.vertexFunction(E,C,w),P.multiplyInPlace(E.scaling).subtractInPlace(I),Ke.e.TransformCoordinatesToRef(P,A,O),O.addInPlace(M).addInPlace(E.position),n.push(O.x,O.y,O.z),a&&(D=E.uvs,s.push((D.z-D.x)*R.x+D.x,(D.w-D.y)*R.y+D.y),_+=2),E.color?this._color.copyFrom(x):(L=this._color,c&&void 0!==c[g]?(L.r=c[g],L.g=c[g+1],L.b=c[g+2],L.a=c[g+3]):(L.r=1,L.g=1,L.b=1,L.a=1)),l.push(this._color.r,this._color.g,this._color.b,this._color.a),g+=4,!this.recomputeNormals&&u&&(Ke.e.TransformNormalFromFloatsToRef(u[v],u[v+1],u[v+2],A,P),h.push(P.x,P.y,P.z),v+=3);for(w=0;w<r.length;w++){var B=e+r[w];o.push(B),65535<B&&(this._needs32Bits=!0)}return(this._depthSort||this._multimaterialEnabled)&&(N=null!==E.materialIndex?E.materialIndex:0,this.depthSortedParticles.push(new k.a(d,t,r.length,N))),E},c.prototype._posToShape=function(e){for(var t=[],i=0;i<e.length;i+=3)t.push(Ke.e.FromArray(e,i));return t},c.prototype._uvsToShapeUV=function(e){var t=[];if(e)for(var i=0;i<e.length;i++)t.push(e[i]);return t},c.prototype._addParticle=function(e,t,i,n,r,o,a,s,c){void 0===s&&(s=null),void 0===c&&(c=null);var l=new k.c(e,t,i,n,r,o,a,this,s);return(c||this.particles).push(l),l},c.prototype.addShape=function(e,t,i){var n=e.getVerticesData(Qe.b.PositionKind),r=e.getIndices(),o=e.getVerticesData(Qe.b.UVKind),a=e.getVerticesData(Qe.b.ColorKind),s=e.getVerticesData(Qe.b.NormalKind);this.recomputeNormals=!s;var c=Array.from(r),l=Array.from(s),u=a?Array.from(a):[],h=i&&i.storage?i.storage:null,d=null;this._particlesIntersect&&(d=e.getBoundingInfo());var p=this._posToShape(n),f=this._uvsToShapeUV(o),m=i?i.positionFunction:null,_=i?i.vertexFunction:null,g=null;this._useModelMaterial&&(g=e.material?e.material:this._setDefaultMaterial());for(var v=new k.b(this._shapeCounter,p,c,l,u,f,m,_,g),b=0;b<t;
1b++)this._insertNewParticle(this.nbParticles,b,v,p,r,o,a,s,d,h,i);return this._shapeCounter++,this._isNotBuilt=!0,this._shapeCounter-1},c.prototype._rebuildParticle=function(e,t){void 0===t&&(t=!1),this._resetCopy();var i=this._copy;e._model._positionFunction&&e._model._positionFunction(i,e.idx,e.idxInShape);var n=Ke.c.Matrix[0],r=Ke.c.Vector3[0],o=Ke.c.Vector3[1],a=Ke.c.Vector3[2],s=Ke.c.Vector3[3];i.getRotationMatrix(n),e.pivot.multiplyToRef(e.scaling,s),i.translateFromPivot?a.copyFromFloats(0,0,0):a.copyFrom(s);for(var c=e._model._shape,l=0;l<c.length;l++)r.copyFrom(c[l]),e._model._vertexFunction&&e._model._vertexFunction(i,r,l),r.multiplyInPlace(i.scaling).subtractInPlace(s),Ke.e.TransformCoordinatesToRef(r,n,o),o.addInPlace(a).addInPlace(i.position).toArray(this._positions32,e._pos+3*l);t&&(e.position.setAll(0),e.rotation.setAll(0),e.rotationQuaternion=null,e.scaling.setAll(1),e.uvs.setAll(0),e.pivot.setAll(0),e.translateFromPivot=!1,e.parentId=null)},c.prototype.rebuildMesh=function(e){void 0===e&&(e=!1);for(var t=0;t<this.particles.length;t++)this._rebuildParticle(this.particles[t],e);return this.mesh.updateVerticesData(Qe.b.PositionKind,this._positions32,!1,!1),this},c.prototype.removeParticles=function(e,t){var i=t-e+1;if(!this._expandable||i<=0||i>=this.nbParticles||!this._updatable)return[];var n=this.particles,r=this.nbParticles;if(t<r-1)for(var o=t+1,a=n[o]._pos-n[e]._pos,s=n[o]._ind-n[e]._ind,c=o;c<r;c++){var l=n[c];l._pos-=a,l._ind-=s}var u=n.splice(e,i);this._positions.length=0,this._indices.length=0,this._colors.length=0,this._uvs.length=0,this._normals.length=0,this._index=0,this._idxOfId.length=0,(this._depthSort||this._multimaterialEnabled)&&(this.depthSortedParticles=[]);for(var h=0,d=n.length,p=0;p<d;p++){var f=n[p],m=f._model,_=m._shape,g=m._indices,v=m._normals,b=m._shapeColors,y=m._shapeUV;f.idx=p,this._idxOfId[f.id]=p,this._meshBuilder(this._index,h,_,this._positions,g,this._indices,y,this._uvs,b,this._colors,v,this._normals,f.idx,f.idxInShape,null,m),this._index+=_.length,h+=g.length}return this.nbParticles-=i,this._isNotBuilt=!0,u},c.prototype.insertParticlesFromArray=function(e){if(!this._expandable)return this;for(var t=0,i=e[0].shapeId,n=e.length,r=0;r<n;r++){var o=e[r],a=o._model,s=a._shape,c=a._indices,l=a._shapeUV,u=a._shapeColors,h=a._normals,d=!h;this.recomputeNormals=d||this.recomputeNormals;var p=o._boundingInfo,f=this._insertNewParticle(this.nbParticles,t,a,s,c,l,u,h,p,null,null);o.copyToRef(f),t++,i!=o.shapeId&&(i=o.shapeId,t=0)}return this._isNotBuilt=!0,this},c.prototype._insertNewParticle=function(e,t,i,n,r,o,a,s,c,l,u){var h=this._positions.length,d=this._indices.length,p=this._meshBuilder(this._index,d,n,this._positions,r,this._indices,o,this._uvs,a,this._colors,s,this._normals,e,t,u,i),f=null;return this._updatable&&((f=this._addParticle(this.nbParticles,this._lastParticleId,h,d,i,this._shapeCounter,t,c,l)).position.copyFrom(p.position),f.rotation.copyFrom(p.rotation),p.rotationQuaternion&&(f.rotationQuaternion?f.rotationQuaternion.copyFrom(p.rotationQuaternion):f.rotationQuaternion=p.rotationQuaternion.clone()),p.color&&(f.color?f.color.copyFrom(p.color):f.color=p.color.clone()),f.scaling.copyFrom(p.scaling),f.uvs.copyFrom(p.uvs),null!==p.materialIndex&&(f.materialIndex=p.materialIndex),this.expandable&&(this._idxOfId[f.id]=f.idx)),l||(this._index+=n.length,this.nbParticles++,this._lastParticleId++),f},c.prototype.setParticles=function(e,t,i){if(void 0===e&&(e=0),void 0===t&&(t=this.nbParticles-1),void 0===i&&(i=!0),!this._updatable||this._isNotBuilt)return this;this.beforeUpdateParticles(e,t,i);var n,r,o=Ke.c.Matrix[0],a=Ke.c.Matrix[1],s=this.mesh,c=this._colors32,l=this._positions32,u=this._normals32,h=this._uvs32,d=this._indices32,p=this._indices,f=this._fixedNormal32,m=Ke.c.Vector3,_=m[5].copyFromFloats(1,0,0),g=m[6].copyFromFloats(0,1,0),v=m[7].copyFromFloats(0,0,1),b=m[8].setAll(Number.MAX_VALUE),y=m[9].setAll(-Number.MAX_VALUE),T=m[10].setAll(0),E=this._tmpVertex,S=E.position,A=E.color,C=E.uv;(this.billboard||this._depthSort)&&(this.mesh.computeWorldMatrix(!0),this.mesh._worldMatrix.invertToRef(a)),this.billboard&&(n=m[0],this._camera.getDirectionToRef(Je.a.Z,n),Ke.e.TransformNormalToRef(n,a,v),v.normalize(),r=this._camera.getViewMatrix(!0),Ke.e.TransformNormalFromFloatsToRef(r.m[1],r.m[5],r.m[9],a,g),Ke.e.CrossToRef(g,v,_),g.normalize(),_.normalize()),this._depthSort&&Ke.e.TransformCoordinatesToRef(this._camera.globalPosition,a,T),Ke.a.IdentityToRef(o);var P,x=0,R=0,O=0,M=0,I=0,D=0,L=0;this.mesh.isFacetDataEnabled&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,!this._computeBoundingBox||0==e&&t==this.nbParticles-1||(P=this.mesh._boundingInfo)&&(b.copyFrom(P.minimum),y.copyFrom(P.maximum));for(var N=(R=this.particles[e]._pos)/3|0,M=4*N,D=2*N,F=e;F<=t;F++){var w=this.particles[F];this.updateParticle(w);var B,U=w._model._shape,V=w._model._shapeUV,k=w._rotationMatrix,G=w.position,z=w.rotation,j=w.scaling,W=w._globalPosition;if(this._depthSort&&this._depthSortParticles&&((B=this.depthSortedParticles[F]).idx=w.idx,B.ind=w._ind,B.indicesLength=w._model._indicesLength,B.sqDistance=Ke.e.DistanceSquared(w.position,T)),!w.alive||w._stillInvisible&&!w.isVisible)R+=3*(L=U.length),M+=4*L,D+=2*L;else{if(w.isVisible){w._stillInvisible=!1;var H,X,Y,K,Q=m[12];w.pivot.multiplyToRef(j,Q),this.billboard&&(z.x=0,z.y=0),(this._computeParticleRotation||this.billboard)&&w.getRotationMatrix(o),null!==w.parentId?(H=this.getParticleById(w.parentId))?(X=H._rotationMatrix,Y=H._globalPosition,ne=G.x*X[1]+G.y*X[4]+G.z*X[7],ie=G.x*X[0]+G.y*X[3]+G.z*X[6],re=G.x*X[2]+G.y*X[5]+G.z*X[8],W.x=Y.x+ie,W.y=Y.y+ne,W.z=Y.z+re,(this._computeParticleRotation||this.billboard)&&(K=o.m,k[0]=K[0]*X[0]+K[1]*X[3]+K[2]*X[6],k[1]=K[0]*X[1]+K[1]*X[4]+K[2]*X[7],k[2]=K[0]*X[2]+K[1]*X[5
1]+K[2]*X[8],k[3]=K[4]*X[0]+K[5]*X[3]+K[6]*X[6],k[4]=K[4]*X[1]+K[5]*X[4]+K[6]*X[7],k[5]=K[4]*X[2]+K[5]*X[5]+K[6]*X[8],k[6]=K[8]*X[0]+K[9]*X[3]+K[10]*X[6],k[7]=K[8]*X[1]+K[9]*X[4]+K[10]*X[7],k[8]=K[8]*X[2]+K[9]*X[5]+K[10]*X[8])):w.parentId=null:(W.x=G.x,W.y=G.y,W.z=G.z,(this._computeParticleRotation||this.billboard)&&(K=o.m,k[0]=K[0],k[1]=K[1],k[2]=K[2],k[3]=K[4],k[4]=K[5],k[5]=K[6],k[6]=K[8],k[7]=K[9],k[8]=K[10]));var q=m[11];for(w.translateFromPivot?q.setAll(0):q.copyFrom(Q),L=0;L<U.length;L++){x=R+3*L,O=M+4*L,I=D+2*L;var Z=2*L,J=1+Z;S.copyFrom(U[L]),this._computeParticleColor&&w.color&&A.copyFrom(w.color),this._computeParticleTexture&&C.copyFromFloats(V[Z],V[J]),this._computeParticleVertex&&this.updateParticleVertex(w,E,L);var $=S.x*j.x-Q.x,ee=S.y*j.y-Q.y,te=S.z*j.z-Q.z,ie=$*k[0]+ee*k[3]+te*k[6],ne=$*k[1]+ee*k[4]+te*k[7],re=$*k[2]+ee*k[5]+te*k[8];ie+=q.x,ne+=q.y,re+=q.z;var oe,ae,se,ce,le,ue,he,de,pe=l[x]=W.x+_.x*ie+g.x*ne+v.x*re,fe=l[x+1]=W.y+_.y*ie+g.y*ne+v.y*re,me=l[x+2]=W.z+_.z*ie+g.z*ne+v.z*re;this._computeBoundingBox&&(b.minimizeInPlaceFromFloats(pe,fe,me),y.maximizeInPlaceFromFloats(pe,fe,me)),this._computeParticleVertex||(oe=f[x],ae=f[x+1],se=f[x+2],ce=oe*k[0]+ae*k[3]+se*k[6],le=oe*k[1]+ae*k[4]+se*k[7],ue=oe*k[2]+ae*k[5]+se*k[8],u[x]=_.x*ce+g.x*le+v.x*ue,u[x+1]=_.y*ce+g.y*le+v.y*ue,u[x+2]=_.z*ce+g.z*le+v.z*ue),this._computeParticleColor&&w.color&&((he=this._colors32)[O]=A.r,he[O+1]=A.g,he[O+2]=A.b,he[O+3]=A.a),this._computeParticleTexture&&(de=w.uvs,h[I]=C.x*(de.z-de.x)+de.x,h[I+1]=C.y*(de.w-de.y)+de.y)}}else for(w._stillInvisible=!0,L=0;L<U.length;L++){var _e,O=M+4*L,I=D+2*L;l[x=R+3*L]=l[x+1]=l[x+2]=0,u[x]=u[x+1]=u[x+2]=0,this._computeParticleColor&&w.color&&(_e=w.color,c[O]=_e.r,c[O+1]=_e.g,c[O+2]=_e.b,c[O+3]=_e.a),this._computeParticleTexture&&(de=w.uvs,h[I]=V[2*L]*(de.z-de.x)+de.x,h[I+1]=V[2*L+1]*(de.w-de.y)+de.y)}if(this._particlesIntersect){var ge=w._boundingInfo,ve=ge.boundingBox,be=ge.boundingSphere,ye=w._modelBoundingInfo;if(!this._bSphereOnly){var Te=ye.boundingBox.vectors,Ee=m[1],Se=m[2];Ee.setAll(Number.MAX_VALUE),Se.setAll(-Number.MAX_VALUE);for(var Ae=0;Ae<8;Ae++){var Ce=Te[Ae].x*j.x,Pe=Te[Ae].y*j.y,xe=Te[Ae].z*j.z,Re=(ie=Ce*k[0]+Pe*k[3]+xe*k[6],ne=Ce*k[1]+Pe*k[4]+xe*k[7],re=Ce*k[2]+Pe*k[5]+xe*k[8],G.x+_.x*ie+g.x*ne+v.x*re),Oe=G.y+_.y*ie+g.y*ne+v.y*re,Me=G.z+_.z*ie+g.z*ne+v.z*re;Ee.minimizeInPlaceFromFloats(Re,Oe,Me),Se.maximizeInPlaceFromFloats(Re,Oe,Me)}ve.reConstruct(Ee,Se,s._worldMatrix)}var Ie=ye.minimum.multiplyToRef(j,m[1]),De=ye.maximum.multiplyToRef(j,m[2]),Le=De.addToRef(Ie,m[3]).scaleInPlace(.5).addInPlace(W),Ne=De.subtractToRef(Ie,m[4]).scaleInPlace(.5*this._bSphereRadiusFactor),Fe=Le.subtractToRef(Ne,m[1]),we=Le.addToRef(Ne,m[2]);be.reConstruct(Fe,we,s._worldMatrix)}R=x+3,M=O+4,D=I+2}}if(i){if(this._computeParticleColor&&s.updateVerticesData(Qe.b.ColorKind,c,!1,!1),this._computeParticleTexture&&s.updateVerticesData(Qe.b.UVKind,h,!1,!1),s.updateVerticesData(Qe.b.PositionKind,l,!1,!1),!s.areNormalsFrozen||s.isFacetDataEnabled){if(this._computeParticleVertex||s.isFacetDataEnabled){var Be=s.isFacetDataEnabled?s.getFacetDataParameters():null;qe.a.ComputeNormals(l,d,u,Be);for(var Ue=0;Ue<u.length;Ue++)f[Ue]=u[Ue]}s.areNormalsFrozen||s.updateVerticesData(Qe.b.NormalKind,u,!1,!1)}if(this._depthSort&&this._depthSortParticles){var Ve=this.depthSortedParticles;Ve.sort(this._depthSortFunction);for(var ke=Ve.length,Ge=0,ze=0,je=0;je<ke;je++)for(var We,He=Ve[je],Xe=He.indicesLength,Ye=He.ind,Ue=0;Ue<Xe;Ue++)d[Ge]=p[Ye+Ue],Ge++,!this._pickable||0==Ue%3&&((We=this.pickedParticles[ze]).idx=He.idx,We.faceId=ze,ze++);s.updateIndices(d)}}return this._computeBoundingBox&&(s._boundingInfo?s._boundingInfo.reConstruct(b,y,s._worldMatrix):s._boundingInfo=new Ze.a(b,y,s._worldMatrix)),this._autoUpdateSubMeshes&&this.computeSubMeshes(),this.afterUpdateParticles(e,t,i),this},c.prototype.dispose=function(){this.mesh.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._normals32=null,this._fixedNormal32=null,this._uvs32=null,this._colors32=null,this.pickedParticles=null,this.pickedBySubMesh=null,this._materials=null,this._materialIndexes=null,this._indicesByMaterial=null,this._idxOfId=null},c.prototype.pickedParticle=function(e){if(e.hit){var t=e.subMeshId,i=e.faceId,n=this.pickedBySubMesh;if(n[t]&&n[t][i])return n[t][i]}return null},c.prototype.getParticleById=function(e){var t=this.particles[e];if(t&&t.id==e)return t;var i=this.particles,n=this._idxOfId[e];if(void 0!==n)return i[n];for(var r=0,o=this.nbParticles;r<o;){var a=i[r];if(a.id==e)return a;r++}return null},c.prototype.getParticlesByShapeId=function(e){var t=[];return this.getParticlesByShapeIdToRef(e,t),t},c.prototype.getParticlesByShapeIdToRef=function(e,t){for(var i=t.length=0;i<this.nbParticles;i++){var n=this.particles[i];n.shapeId==e&&t.push(n)}return this},c.prototype.computeSubMeshes=function(){if(!this.mesh||!this._multimaterialEnabled)return this;var e=this.depthSortedParticles;if(0<this.particles.length)for(var t=0;t<this.particles.length;t++){var i=this.particles[t];i.materialIndex||(i.materialIndex=0);var n=e[t];n.materialIndex=i.materialIndex,n.ind=i._ind,n.indicesLength=i._model._indicesLength,n.idx=i.idx}this._sortParticlesByMaterial();var r=this._indicesByMaterial,o=this._materialIndexes,a=this.mesh;a.subMeshes=[];for(var s=a.getTotalVertices(),c=0;c<o.length;c++){var l=r[c],u=r[c+1]-l,h=o[c];new d.a(h,0,s,l,u,a)}return this},c.prototype._sortParticlesByMaterial=function(){var e=[0];this._indicesByMaterial=e;var t=[];this._materialIndexes=t;var i=this.depthSortedParticles;i.sort(this._materialSortFunction);var n=i.length,r=this._indices32,o=this._indices,a=0,s=0,c=0,l=i[0].materialIndex;t.push(l),this._pickable&&(this.pickedBySubMesh=[[]],this.pickedParticles=this.pickedBySubMesh[0]);for(var u=0;u<n;u++){var h=i[u],d=h.indicesLength,p=h.ind;h.materialIndex!==l&&(l=h.materialIndex,e.push(c),t.push(l),this._pickable&&(a++,this.pickedBySubMesh[a]=[],s=0));for(var f,m=0,_=0;_<d;_++)r[c]=o[p+_],!this._pickable||0==_%3&&((f=this.pickedBySubMesh[a][s])?(f.idx=h.idx,f.faceId=m):this.pickedBySubMesh[a][s]={idx:h.idx,faceId:m},s++,m++),c++}return e.push(r.length),this._updatable&&this.mesh.updateIndices(r),this},c.prototype._setMaterialIndexesById=function(){this._materialIndexesById={};for(var e=0;e<this._materials.length;e++){var t=this._materials[e].uniqueId;this._materialIndexesById[t]=e}},c.prototype._filterUniqueMaterialId=function(e){return e.filter(function(e,t,i){return i.indexOf(e)===t})},c.prototype._setDefaultMaterial=function(){return this._defaultMaterial||(this._defaultMaterial=new o.a(this.name+"DefaultMaterial",this._scene)),this._defaultMaterial},c.prototype.refreshVisibleSize=function(){return this._isVisibilityBoxLocked||this.mesh.refreshBoundingInfo(),this},c.prototype.setVisibilityBox=function(e){var t=e/2;
1this.mesh._boundingInfo=new Ze.a(new Ke.e(-t,-t,-t),new Ke.e(t,t,t))},Object.defineProperty(c.prototype,"isAlwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isVisibilityBoxLocked",{get:function(){return this._isVisibilityBoxLocked},set:function(e){this._isVisibilityBoxLocked=e,this.mesh.getBoundingInfo().isLocked=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"computeParticleRotation",{get:function(){return this._computeParticleRotation},set:function(e){this._computeParticleRotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"computeParticleColor",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"computeParticleTexture",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"computeParticleVertex",{get:function(){return this._computeParticleVertex},set:function(e){this._computeParticleVertex=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"computeBoundingBox",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"depthSortParticles",{get:function(){return this._depthSortParticles},set:function(e){this._depthSortParticles=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"expandable",{get:function(){return this._expandable},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"multimaterialEnabled",{get:function(){return this._multimaterialEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"useModelMaterial",{get:function(){return this._useModelMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"materials",{get:function(){return this._materials},enumerable:!1,configurable:!0}),c.prototype.setMultiMaterial=function(e){this._materials=this._filterUniqueMaterialId(e),this._setMaterialIndexesById(),this._multimaterial&&this._multimaterial.dispose(),this._multimaterial=new a.a(this.name+"MultiMaterial",this._scene);for(var t=0;t<this._materials.length;t++)this._multimaterial.subMaterials.push(this._materials[t]);this.computeSubMeshes(),this.mesh.material=this._multimaterial},Object.defineProperty(c.prototype,"multimaterial",{get:function(){return this._multimaterial},set:function(e){this._multimaterial=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"autoUpdateSubMeshes",{get:function(){return this._autoUpdateSubMeshes},set:function(e){this._autoUpdateSubMeshes=e},enumerable:!1,configurable:!0}),c.prototype.initParticles=function(){},c.prototype.recycleParticle=function(e){return e},c.prototype.updateParticle=function(e){return e},c.prototype.updateParticleVertex=function(e,t,i){return this},c.prototype.beforeUpdateParticles=function(e,t,i){},c.prototype.afterUpdateParticles=function(e,t,i){},c);function c(e,t,i){this.particles=new Array,this.nbParticles=0,this.billboard=!1,this.recomputeNormals=!1,this.counter=0,this.vars={},this._bSphereOnly=!1,this._bSphereRadiusFactor=1,this._positions=new Array,this._indices=new Array,this._normals=new Array,this._colors=new Array,this._uvs=new Array,this._index=0,this._updatable=!0,this._pickable=!1,this._isVisibilityBoxLocked=!1,this._alwaysVisible=!1,this._depthSort=!1,this._expandable=!1,this._shapeCounter=0,this._copy=new k.c(0,0,0,0,null,0,0,this),this._color=new n.b(0,0,0,0),this._computeParticleColor=!0,this._computeParticleTexture=!0,this._computeParticleRotation=!0,this._computeParticleVertex=!1,this._computeBoundingBox=!1,this._depthSortParticles=!0,this._mustUnrotateFixedNormals=!1,this._particlesIntersect=!1,this._needs32Bits=!1,this._isNotBuilt=!0,this._lastParticleId=0,this._idxOfId=[],this._multimaterialEnabled=!1,this._useModelMaterial=!1,this._depthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},this._materialSortFunction=function(e,t){return e.materialIndex-t.materialIndex},this._autoUpdateSubMeshes=!1,this.name=e,this._scene=t||r.a.LastCreatedScene,this._camera=t.activeCamera,this._pickable=!!i&&i.isPickable,this._depthSort=!!i&&i.enableDepthSort,this._multimaterialEnabled=!!i&&i.enableMultiMaterial,this._useModelMaterial=!!i&&i.useModelMaterial,this._multimaterialEnabled=!!this._useModelMaterial||this._multimaterialEnabled,this._expandable=!!i&&i.expandable,this._particlesIntersect=!!i&&i.particleIntersection,this._bSphereOnly=!!i&&i.boundingSphereOnly,this._bSphereRadiusFactor=i&&i.bSphereRadiusFactor?i.bSphereRadiusFactor:1,i&&void 0!==i.updatable?this._updatable=i.updatable:this._updatable=!0,this._pickable&&(this.pickedBySubMesh=[[]],this.pickedParticles=this.pickedBySubMesh[0]),(this._depthSort||this._multimaterialEnabled)&&(this.depthSortedParticles=[]),this._multimaterialEnabled&&(this._multimaterial=new a.a(this.name+"MultiMaterial",this._scene),this._materials=[],this._materialIndexesById={}),this._tmpVertex=new k.d}},function(e,t,i){"use strict";i.d(t,"a",function(){return l}),i.d(t,"b",function(){return d});var l,n,we=i(33),Be=i(0),s=i(7),Ue=i(4),r=i(16),o=i(8),a=i(22),u=i(175),X=i(52),Ve=i(45),c=i(35),h=i(62),ke=i(14);(n=l=l||{})[n.Color=2]="Color",n[n.UV=1]="UV",n[n.Random=0]="Random",n[n.Stated=3]="Stated";var d=(p.prototype.buildMeshAsync=function(){var e=this;return Promise.all(this._promises).then(function(){return e._isReady=!0,e._buildMesh()})},p.prototype._buildMesh=function(){0===this.nbParticles&&this.addPoints(1),this._positions32=new Float32Array(this._positions),this._uvs32=new Float32Array(this._uvs),this._colors32=new Float32Array(this._colors);var e=new r.a;
1e.set(this._positions32,Ue.b.PositionKind),0<this._uvs32.length&&e.set(this._uvs32,Ue.b.UVKind);var t=0;0<this._colors32.length&&(t=1,e.set(this._colors32,Ue.b.ColorKind));var i=new o.a(this.name,this._scene);e.applyToMesh(i,this._updatable),this.mesh=i,this._positions=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0);var n=new c.a("point cloud material",this._scene);return n.emissiveColor=new we.e(t,t,t),n.disableLighting=!0,n.pointsCloud=!0,n.pointSize=this._size,i.material=n,new Promise(function(e){return e(i)})},p.prototype._addParticle=function(e,t,i,n){var r=new u.a(e,t,i,n,this);return this.particles.push(r),r},p.prototype._randomUnitVector=function(e){e.position=new Be.e(Math.random(),Math.random(),Math.random()),e.color=new we.f(1,1,1,1)},p.prototype._getColorIndicesForCoord=function(e,t,i,n){var r=e._groupImageData,o=i*(4*n)+4*t,a=[o,1+o,2+o,3+o],s=a[1],c=a[2],l=a[3],u=r[a[0]],h=r[s],d=r[c],p=r[l];return new we.f(u/255,h/255,d/255,p)},p.prototype._setPointsColorOrUV=function(e,t,i,n,r,o,a){i&&e.updateFacetData();var s=2*e.getBoundingInfo().boundingSphere.radius,c=e.getVerticesData(Ue.b.PositionKind),l=e.getIndices(),u=e.getVerticesData(Ue.b.UVKind),h=e.getVerticesData(Ue.b.ColorKind),d=Be.e.Zero();e.computeWorldMatrix();var p=e.getWorldMatrix();if(!p.isIdentity())for(var f=0;f<c.length/3;f++)Be.e.TransformCoordinatesFromFloatsToRef(c[3*f],c[3*f+1],c[3*f+2],p,d),c[3*f]=d.x,c[3*f+1]=d.y,c[3*f+2]=d.z;var m,_,g=0,v=0,b=0,y=0,T=0,E=0,S=0,A=0,C=0,P=0,x=0,R=0,O=0,M=0,I=Be.e.Zero(),D=Be.e.Zero(),L=Be.e.Zero(),N=Be.e.Zero(),F=Be.e.Zero(),w=0,B=0,U=0,V=0,k=0,G=0,z=Be.d.Zero(),j=Be.d.Zero(),W=Be.d.Zero(),H=Be.d.Zero(),X=Be.d.Zero(),Y=0,K=0,Q=0,q=0,Z=0,J=0,$=0,ee=0,te=0,ie=0,ne=0,re=0,oe=Be.f.Zero(),ae=Be.f.Zero(),se=Be.f.Zero(),ce=Be.f.Zero(),le=Be.f.Zero(),ue=0,he=0;a=a||0;for(var de,pe=new Be.f(0,0,0,0),fe=Be.e.Zero(),me=Be.e.Zero(),_e=Be.e.Zero(),ge=0,ve=Be.e.Zero(),be=0,ye=0,Te=new Ve.a(Be.e.Zero(),new Be.e(1,0,0)),Ee=Be.e.Zero(),v=0;v<l.length/3;v++){var Se,Ae,Ce,Pe,xe,Re,Oe,Me,b=l[3*v],y=l[3*v+1],T=l[3*v+2],E=c[3*b],S=c[3*b+1],A=c[3*b+2],C=c[3*y],P=c[3*y+1],x=c[3*y+2],R=c[3*T],O=c[3*T+1],M=c[3*T+2];I.set(E,S,A),D.set(C,P,x),L.set(R,O,M),D.subtractToRef(I,N),L.subtractToRef(D,F),u&&(w=u[2*b],B=u[2*b+1],U=u[2*y],V=u[2*y+1],k=u[2*T],G=u[2*T+1],z.set(w,B),j.set(U,V),W.set(k,G),j.subtractToRef(z,H),W.subtractToRef(j,X)),h&&n&&(Y=h[4*b],K=h[4*b+1],Q=h[4*b+2],q=h[4*b+3],Z=h[4*y],J=h[4*y+1],$=h[4*y+2],ee=h[4*y+3],te=h[4*T],ie=h[4*T+1],ne=h[4*T+2],re=h[4*T+3],oe.set(Y,K,Q,q),ae.set(Z,J,$,ee),se.set(te,ie,ne,re),ae.subtractToRef(oe,ce),se.subtractToRef(ae,le));for(var Ie,De,Le=new we.e(0,0,0),Ne=new we.e(0,0,0),Fe=0;Fe<t._groupDensity[v];Fe++)g=this.particles.length,this._addParticle(g,t,this._groupCounter,v+Fe),De=this.particles[g],ue=ke.a.RandomRange(0,1),he=ke.a.RandomRange(0,1),m=I.add(N.scale(ue)).add(F.scale(ue*he)),i&&(fe=e.getFacetNormal(v).normalize().scale(-1),me=N.clone().normalize(),_e=Be.e.Cross(fe,me),ge=ke.a.RandomRange(0,2*Math.PI),ve=me.scale(Math.cos(ge)).add(_e.scale(Math.sin(ge))),ge=ke.a.RandomRange(.1,Math.PI/2),Ee=ve.scale(Math.cos(ge)).add(fe.scale(Math.sin(ge))),Te.origin=m.add(Ee.scale(1e-5)),Te.direction=Ee,Te.length=s,(de=Te.intersectsMesh(e)).hit&&(ye=de.pickedPoint.subtract(m).length(),be=ke.a.RandomRange(0,1)*ye,m.addInPlace(Ee.scale(be)))),De.position=m.clone(),this._positions.push(De.position.x,De.position.y,De.position.z),void 0!==n?u&&(_=z.add(H.scale(ue)).add(X.scale(ue*he)),n?r&&null!==t._groupImageData?(Se=t._groupImgWidth,Ae=t._groupImgHeight,Ie=this._getColorIndicesForCoord(t,Math.round(_.x*Se),Math.round(_.y*Ae),Se),De.color=Ie,this._colors.push(Ie.r,Ie.g,Ie.b,Ie.a)):(pe=h?oe.add(ce.scale(ue)).add(le.scale(ue*he)):oe.set(Math.random(),Math.random(),Math.random(),1),De.color=new we.f(pe.x,pe.y,pe.z,pe.w),this._colors.push(pe.x,pe.y,pe.z,pe.w)):(De.uv=_.clone(),this._uvs.push(De.uv.x,De.uv.y))):(o?(Le.set(o.r,o.g,o.b),Ce=ke.a.RandomRange(-a,a),Pe=ke.a.RandomRange(-a,a),xe=(Me=Le.toHSV()).r,(Re=Me.g+Ce)<0&&(Re=0),1<Re&&(Re=1),(Oe=Me.b+Pe)<0&&(Oe=0),1<Oe&&(Oe=1),we.e.HSVtoRGBToRef(xe,Re,Oe,Ne),pe.set(Ne.r,Ne.g,Ne.b,1)):pe=oe.set(Math.random(),Math.random(),Math.random(),1),De.color=new we.f(pe.x,pe.
1y,pe.z,pe.w),this._colors.push(pe.x,pe.y,pe.z,pe.w))}},p.prototype._colorFromTexture=function(e,i,n){var r=this;if(null===e.material)return s.a.Warn(e.name+"has no material."),i._groupImageData=null,void this._setPointsColorOrUV(e,i,n,!0,!1);var o=e.material.getActiveTextures();if(0===o.length)return s.a.Warn(e.name+"has no useable texture."),i._groupImageData=null,void this._setPointsColorOrUV(e,i,n,!0,!1);var a=e.clone();a.setEnabled(!1),this._promises.push(new Promise(function(t){h.a.WhenAllReady(o,function(){var e=i._textureNb;return e<0&&(e=0),e>o.length-1&&(e=o.length-1),i._groupImageData=o[e].readPixels(),i._groupImgWidth=o[e].getSize().width,i._groupImgHeight=o[e].getSize().height,r._setPointsColorOrUV(a,i,n,!0,!0),a.dispose(),t()})}))},p.prototype._calculateDensity=function(e,t,i){for(var n,r,o,a,s,c,l,u,h,d,p,f,m,_,g,v,b,y=new Array,T=Be.e.Zero(),E=Be.e.Zero(),S=Be.e.Zero(),A=Be.e.Zero(),C=Be.e.Zero(),P=Be.e.Zero(),x=new Array,R=0,O=i.length/3,M=0;M<O;M++)n=i[3*M],r=i[3*M+1],o=i[3*M+2],a=t[3*n],s=t[3*n+1],c=t[3*n+2],l=t[3*r],u=t[3*r+1],h=t[3*r+2],d=t[3*o],p=t[3*o+1],f=t[3*o+2],T.set(a,s,c),E.set(l,u,h),S.set(d,p,f),E.subtractToRef(T,A),S.subtractToRef(E,C),S.subtractToRef(T,P),v=((m=A.length())+(_=C.length())+(g=P.length()))/2,R+=b=Math.sqrt(v*(v-m)*(v-_)*(v-g)),x[M]=b;for(var I=0,M=0;M<O;M++)y[M]=Math.floor(e*x[M]/R),I+=y[M];var D=e-I,L=Math.floor(D/O),N=D%O;for(0<L&&(y=y.map(function(e){return e+L})),M=0;M<N;M++)y[M]+=1;return y},p.prototype.addPoints=function(e,t){void 0===t&&(t=this._randomUnitVector);for(var i,n=new u.b(this._groupCounter,t),r=this.nbParticles,o=0;o<e;o++)i=this._addParticle(r,n,this._groupCounter,o),n&&n._positionFunction&&n._positionFunction(i,r,o),this._positions.push(i.position.x,i.position.y,i.position.z),i.color&&this._colors.push(i.color.r,i.color.g,i.color.b,i.color.a),i.uv&&this._uvs.push(i.uv.x,i.uv.y),r++;return this.nbParticles+=e,this._groupCounter++,this._groupCounter},p.prototype.addSurfacePoints=function(e,t,i,n,r){var o=i||l.Random;(isNaN(o)||o<0||3<o)&&(o=l.Random);var a=e.getVerticesData(Ue.b.PositionKind),s=e.getIndices();this._groups.push(this._groupCounter);var c=new u.b(this._groupCounter,null);switch(c._groupDensity=this._calculateDensity(t,a,s),o===l.Color?c._textureNb=n||0:n=n||new we.f(1,1,1,1),o){case l.Color:this._colorFromTexture(e,c,!1);break;case l.UV:this._setPointsColorOrUV(e,c,!1,!1,!1);break;case l.Random:this._setPointsColorOrUV(e,c,!1);break;case l.Stated:this._setPointsColorOrUV(e,c,!1,void 0,void 0,n,r)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},p.prototype.addVolumePoints=function(e,t,i,n,r){var o=i||l.Random;(isNaN(o)||o<0||3<o)&&(o=l.Random);var a=e.getVerticesData(Ue.b.PositionKind),s=e.getIndices();this._groups.push(this._groupCounter);var c=new u.b(this._groupCounter,null);switch(c._groupDensity=this._calculateDensity(t,a,s),o===l.Color?c._textureNb=n||0:n=n||new we.f(1,1,1,1),o){case l.Color:this._colorFromTexture(e,c,!0);break;case l.UV:this._setPointsColorOrUV(e,c,!0,!1,!1);break;case l.Random:this._setPointsColorOrUV(e,c,!0);break;case l.Stated:this._setPointsColorOrUV(e,c,!0,void 0,void 0,n,r)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},p.prototype.setParticles=function(e,t,i){if(void 0===e&&(e=0),void 0===t&&(t=this.nbParticles-1),void 0===i&&(i=!0),!this._updatable||!this._isReady)return this;this.beforeUpdateParticles(e,t,i);var n=Be.c.Matrix[0],r=this.mesh,o=this._colors32,a=this._positions32,s=this._uvs32,c=Be.c.Vector3,l=c[5].copyFromFloats(1,0,0),u=c[6].copyFromFloats(0,1,0),h=c[7].copyFromFloats(0,0,1),d=c[8].setAll(Number.MAX_VALUE),p=c[9].setAll(-Number.MAX_VALUE);Be.a.IdentityToRef(n);var f,m=0;this.mesh.isFacetDataEnabled&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,!this._computeBoundingBox||0==e&&t==this.nbParticles-1||(f=this.mesh._boundingInfo)&&(d.copyFrom(f.minimum),p.copyFrom(f.maximum));for(var _=m=0,g=0,v=0,b=e;b<=t;b++){var y=this.particles[b],_=3*(m=y.idx),g=4*m,v=2*m;this.updateParticle(y);var T,E,S,A,C,P,x,R=y._rotationMatrix,O=y.position,M=y._globalPosition;this._computeParticleRotation&&y.getRotationMatrix(n),null!==y.parentId?(E=(T=this.particles[y.parentId])._rotationMatrix,S=T._globalPosition,A=O.x*E[1]+O.y*E[4]+O.z*E[7],C=O.x*E[0]+O.y*E[3]+O.z*E[6],P=O.x*E[2]+O.y*E[5]+O.z*E[8],M.x=S.x+C,M.y=S.y+A,M.z=S.z+P,this._computeParticleRotation&&(x=n.m,R[0]=x[0]*E[0]+x[1]*E[3]+x[2]*E[6],R[1]=x[0]*E[1]+x[1]*E[4]+x[2]*E[7],R[2]=x[0]*E[2]+x[1]*E[5]+x[2]*E[8],R[3]=x[4]*E[0]+x[5]*E[3]+x[6]*E[6],R[4]=x[4]*E[1]+x[5]*E[4]+x[6]*E[7],R[5]=x[4]*E[2]+x[5]*E[5]+x[6]*E[8],R[6]=x[8]*E[0]+x[9]*E[3]+x[10]*E[6],R[7]=x[8]*E[1]+x[9]*E[4]+x[10]*E[7],R[8]=x[8]*E[2]+x[9]*E[5]+x[10]*E[8])):(M.x=0,M.y=0,M.z=0,this._computeParticleRotation&&(x=n.m,R[0]=x[0],R[1]=x[1],R[2]=x[2],R[3]=x[4],R[4]=x[5],R[5]=x[
16],R[6]=x[8],R[7]=x[9],R[8]=x[10]));var I=c[11];y.translateFromPivot?I.setAll(0):I.copyFrom(y.pivot);var D=c[0];D.copyFrom(y.position);var L=D.x-y.pivot.x,N=D.y-y.pivot.y,F=D.z-y.pivot.z,w=L*R[0]+N*R[3]+F*R[6],B=L*R[1]+N*R[4]+F*R[7],U=L*R[2]+N*R[5]+F*R[8];w+=I.x,B+=I.y,U+=I.z;var V,k,G,z,j=a[_]=M.x+l.x*w+u.x*B+h.x*U,W=a[_+1]=M.y+l.y*w+u.y*B+h.y*U,H=a[_+2]=M.z+l.z*w+u.z*B+h.z*U;this._computeBoundingBox&&(d.minimizeInPlaceFromFloats(j,W,H),p.maximizeInPlaceFromFloats(j,W,H)),this._computeParticleColor&&y.color&&(V=y.color,(k=this._colors32)[g]=V.r,k[g+1]=V.g,k[g+2]=V.b,k[g+3]=V.a),this._computeParticleTexture&&y.uv&&(G=y.uv,(z=this._uvs32)[v]=G.x,z[v+1]=G.y)}return i&&(this._computeParticleColor&&r.updateVerticesData(Ue.b.ColorKind,o,!1,!1),this._computeParticleTexture&&r.updateVerticesData(Ue.b.UVKind,s,!1,!1),r.updateVerticesData(Ue.b.PositionKind,a,!1,!1)),this._computeBoundingBox&&(r._boundingInfo?r._boundingInfo.reConstruct(d,p,r._worldMatrix):r._boundingInfo=new X.a(d,p,r._worldMatrix)),this.afterUpdateParticles(e,t,i),this},p.prototype.dispose=function(){this.mesh.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._uvs32=null,this._colors32=null},p.prototype.refreshVisibleSize=function(){return this._isVisibilityBoxLocked||this.mesh.refreshBoundingInfo(),this},p.prototype.setVisibilityBox=function(e){var t=e/2;this.mesh._boundingInfo=new X.a(new Be.e(-t,-t,-t),new Be.e(t,t,t))},Object.defineProperty(p.prototype,"isAlwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"computeParticleRotation",{set:function(e){this._computeParticleRotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"computeParticleColor",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"computeParticleTexture",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"computeBoundingBox",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!1,configurable:!0}),p.prototype.initParticles=function(){},p.prototype.recycleParticle=function(e){return e},p.prototype.updateParticle=function(e){return e},p.prototype.beforeUpdateParticles=function(e,t,i){},p.prototype.afterUpdateParticles=function(e,t,i){},p);function p(e,t,i,n){this.particles=new Array,this.nbParticles=0,this.counter=0,this.vars={},this._promises=[],this._positions=new Array,this._indices=new Array,this._normals=new Array,this._colors=new Array,this._uvs=new Array,this._updatable=!0,this._isVisibilityBoxLocked=!1,this._alwaysVisible=!1,this._groups=new Array,this._groupCounter=0,this._computeParticleColor=!0,this._computeParticleTexture=!0,this._computeParticleRotation=!0,this._computeBoundingBox=!1,this._isReady=!1,this.name=e,this._size=t,this._scene=i||a.a.LastCreatedScene,n&&void 0!==n.updatable?this._updatable=n.updatable:this._updatable=!0}},function(e,t,i){"use strict";i.r(t);var n=i(386);for(var r in n)"default"!==r&&function(e){i.d(t,e,function(){return n[e]})}(r);var o=i(126);i.d(t,"PhysicsEngine",function(){return o.a});var a=i(387);i.d(t,"PhysicsEngineSceneComponent",function(){return a.a});var s=i(388);i.d(t,"PhysicsHelper",function(){return s.a}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return s.b}),i.d(t,"PhysicsUpdraftEventOptions",function(){return s.d}),i.d(t,"PhysicsVortexEventOptions",function(){return s.f}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return s.c}),i.d(t,"PhysicsUpdraftMode",function(){return s.e});var c=i(34);i.d(t,"PhysicsImpostor",function(){return c.a});var l=i(59);i.d(t,"PhysicsJoint",function(){return l.e}),i.d(t,"DistanceJoint",function(){return l.a}),i.d(t,"MotorEnabledJoint",function(){return l.d}),i.d(t,"HingeJoint",function(){return l.c}),i.d(t,"Hinge2Joint",function(){return l.b});var u=i(389);i.d(t,"CannonJSPlugin",function(){return u.b}),i.d(t,"AmmoJSPlugin",function(){return u.a}),i.d(t,"OimoJSPlugin",function(){return u.c})},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(7),r=i(6),o=i(28),a=i(17),s=i(18),c=i(126),l=i(59);s.a.prototype.getPhysicsEngine=function(){return this._physicsEngine},s.a.prototype.enablePhysics=function(e,t){if(void 0===e&&(e=null),this._physicsEngine)return!0;var i=this._getComponent(a.a.NAME_PHYSICSENGINE);i||(i=new u(this),this._addComponent(i));try{return this._physicsEngine=new c.a(e,t),!(this._physicsTimeAccumulator=0)}catch(e){return n.a.Error(e.message),!1}},s.a.prototype.disablePhysicsEngine=function(){this._physicsEngine&&(this._physicsEngine.dispose(),this._physicsEngine=null)},s.a.prototype.isPhysicsEnabled=function(){return void 0!==this._physicsEngine},s.a.prototype.deleteCompoundImpostor=function(e){var t=e.parts[0].mesh;t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)},s.a.prototype._advancePhysicsEngineStep=function(e){if(this._physicsEngine){var t=this._physicsEngine.getSubTimeStep();if(0<t)for(this._physicsTimeAccumulator+=e;this._physicsTimeAccumulator>t;)this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(t/1e3),this.onAfterPhysicsObservable.notifyObservers(this),this._physicsTimeAccumulator-=t;else this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(e/1e3),this.onAfterPhysicsObservable.notifyObservers(this)}},Object.defineProperty(o.a.prototype,"physicsImpostor",{get:function(){return this._physicsImpostor},set:function(e){var t=this;this._physicsImpostor!==e&&(this._disposePhysicsObserver&&this.onDisposeObservable.remove(this._disposePhysicsObserver),(this._physicsImpostor=e)&&(this._disposePhysicsObserver=this.onDisposeObservable.add(function(){t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)})))},enumerable:!0,configurable:!0}),o.a.prototype.getPhysicsImpostor=function(){return this.physicsImpostor},o.a.prototype.applyImpulse=function(e,t){return this.physicsImpostor&&this.physicsImpostor.applyImpulse(e,t),this},o.a.prototype.setPhysicsLinkWith=function(e,t,i,n){return this.physicsImpostor&&e.physicsImpostor&&this.physicsImpostor.createJoint(e.physicsImpostor,l.e.HingeJoint,{mainPivot:t,connectedPivot:i,nativeParams:n}),this};var u=(h.prototype.register=function(){},h.prototype.rebuild=function(){},h.prototype.dispose=function(){this.scene.onBeforePhysicsObservable.clear(),this.scene.onAfterPhysicsObservable.clear(),this.scene._physicsEngine&&this.scene.disablePhysicsEngine()},h);function h(e){var t=this;this.name=a.a.NAME_PHYSICSENGINE,this.scene=e,this.scene.onBeforePhysicsObservable=new r.c,this.scene.onAfterPhysicsObservable=new r.c,this.scene.getDeterministicFrameTime=function(){return t.scene._physicsEngine?1e3*t.scene._physicsEngine.getTimeStep():1e3/60}}},function(e,t,i){"use strict";i.d(t,"a",function(){return h}),i.d(t,"b",function(){return v}),i.d(t,"d",function(){return b}),i.d(t,"f",function(){return y}),i.d(t,"c",function(){return a}),i.d(t,"e",function(){return o}
1);var a,o,n,r,s=i(1),c=i(7),d=i(0),l=i(60),u=i(79),p=i(45),h=(C.prototype.applyRadialExplosionImpulse=function(i,e,t,n){if(!this._physicsEngine)return c.a.Warn("Physics engine not enabled. Please enable the physics before you call this method."),null;var r=this._physicsEngine.getImpostors();if(0===r.length)return null;"number"==typeof e&&(((e=new v).radius=e).strength=t||e.strength,e.falloff=n||e.falloff);var o=new f(this._scene,e),a=Array();return r.forEach(function(e){var t=o.getImpostorHitData(e,i);t&&(e.applyImpulse(t.force,t.contactPoint),a.push({impostor:e,hitData:t}))}),o.triggerAffectedImpostorsCallback(a),o.dispose(!1),o},C.prototype.applyRadialExplosionForce=function(i,e,t,n){if(!this._physicsEngine)return c.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;var r=this._physicsEngine.getImpostors();if(0===r.length)return null;"number"==typeof e&&(((e=new v).radius=e).strength=t||e.strength,e.falloff=n||e.falloff);var o=new f(this._scene,e),a=Array();return r.forEach(function(e){var t=o.getImpostorHitData(e,i);t&&(e.applyForce(t.force,t.contactPoint),a.push({impostor:e,hitData:t}))}),o.triggerAffectedImpostorsCallback(a),o.dispose(!1),o},C.prototype.gravitationalField=function(e,t,i,n){if(!this._physicsEngine)return c.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(0===this._physicsEngine.getImpostors().length)return null;"number"==typeof t&&(((t=new v).radius=t).strength=i||t.strength,t.falloff=n||t.falloff);var r=new m(this,this._scene,e,t);return r.dispose(!1),r},C.prototype.updraft=function(e,t,i,n,r){if(!this._physicsEngine)return c.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(0===this._physicsEngine.getImpostors().length)return null;"number"==typeof t&&(((t=new b).radius=t).strength=i||t.strength,t.height=n||t.height,t.updraftMode=r||t.updraftMode);var o=new _(this._scene,e,t);return o.dispose(!1),o},C.prototype.vortex=function(e,t,i,n){if(!this._physicsEngine)return c.a.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(0===this._physicsEngine.getImpostors().length)return null;"number"==typeof t&&(((t=new y).radius=t).strength=i||t.strength,t.height=n||t.height);var r=new g(this._scene,e,t);return r.dispose(!1),r},C),f=(A.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},A.prototype.getImpostorHitData=function(e,t){if(0===e.mass)return null;if(!this._intersectsWithSphere(e,t,this._options.radius))return null;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return null;var i=e.getObjectCenter().subtract(t),n=new p.a(t,i,this._options.radius).intersectsMesh(e.object).pickedPoint;if(!n)return null;var r=d.e.Distance(t,n);if(r>this._options.radius)return null;var o=this._options.falloff===a.Constant?this._options.strength:this._options.strength*(1-r/this._options.radius);return{force:i.multiplyByFloats(o,o,o),contactPoint:n,distanceFromOrigin:r}},A.prototype.triggerAffectedImpostorsCallback=function(e){this._options.affectedImpostorsCallback&&this._options.affectedImpostorsCallback(e)},A.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout(function(){t._dataFetched||t._sphere.dispose()},0)},A.prototype._prepareSphere=function(){this._sphere||(this._sphere=l.a.CreateSphere("radialExplosionEventSphere",this._options.sphere,this._scene),this._sphere.isVisible=!1)},A.prototype._intersectsWithSphere=function(e,t,i){var n=e.object;return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling=new d.e(2*i,2*i,2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(n,!0)},A),m=(S.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},S.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},S.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},S.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout(function(){t._dataFetched||t._sphere.dispose()},0)},S.prototype._tick=function(){var e;this._sphere?this._physicsHelper.applyRadialExplosionForce(this._origin,this._options):(e=this._physicsHelper.applyRadialExplosionForce(this._origin,this._options))&&(this._sphere=e.getData().sphere.clone("radialExplosionEventSphereClone"))},S),_=(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(),i=this._options.updraftMode===o.Perpendicular?this._originDirection:t.subtract(this._originTop),n=d.e.Distance(this._origin,t),r=-1*this._options.strength;return{force:i.multiplyByFloats(r,r,r),contactPoint:t,distanceFromOrigin:n}},E.prototype._tick=function(){var i=this;
1this._physicsEngine.getImpostors().forEach(function(e){var t=i.getImpostorHitData(e);t&&e.applyForce(t.force,t.contactPoint)})},E.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=u.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),g=(T.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},T.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},T.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},T.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._cylinder.dispose():setTimeout(function(){t._dataFetched||t._cylinder.dispose()},0)},T.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 d.e(this._origin.x,t.y,this._origin.z),n=t.subtract(i),r=new p.a(i,n,this._options.radius).intersectsMesh(e.object),o=r.pickedPoint;if(!o)return null;var a,s,c,l,u=r.distance/this._options.radius,h=o.normalize();return u>this._options.centripetalForceThreshold&&(h=h.negate()),l=u>this._options.centripetalForceThreshold?(s=h.x*this._options.centripetalForceMultiplier,c=h.y*this._options.updraftForceMultiplier,h.z*this._options.centripetalForceMultiplier):(s=((a=d.e.Cross(i,t).normalize()).x+h.x)*this._options.centrifugalForceMultiplier,c=this._originTop.y*this._options.updraftForceMultiplier,(a.z+h.z)*this._options.centrifugalForceMultiplier),{force:new d.e(s,c,l).multiplyByFloats(this._options.strength,this._options.strength,this._options.strength),contactPoint:t,distanceFromOrigin:u}},T.prototype._tick=function(){var i=this;this._physicsEngine.getImpostors().forEach(function(e){var t=i.getImpostorHitData(e);t&&e.applyForce(t.force,t.contactPoint)})},T.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=u.a.CreateCylinder("vortexEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},T.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},T),v=function(){this.radius=5,this.strength=10,this.falloff=a.Constant,this.sphere={segments:32,diameter:1}},b=function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=o.Center},y=function(){this.radius=5,this.strength=10,this.height=10,this.centripetalForceThreshold=.7,this.centripetalForceMultiplier=5,this.centrifugalForceMultiplier=.5,this.updraftForceMultiplier=.02};function T(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=d.e.Zero(),this._cylinderPosition=d.e.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=Object(s.a)(Object(s.a)({},new y),this._options),this._origin.addToRef(new d.e(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new d.e(0,this._options.height,0),this._originTop),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}function E(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=d.e.Zero(),this._originDirection=d.e.Zero(),this._cylinderPosition=d.e.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=Object(s.a)(Object(s.a)({},new b),this._options),this._origin.addToRef(new d.e(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new d.e(0,this._options.height,0),this._originTop),this._options.updraftMode===o.Perpendicular&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}function S(e,t,i,n){this._physicsHelper=e,this._scene=t,this._origin=i,this._options=n,this._dataFetched=!1,this._options=Object(s.a)(Object(s.a)({},new v),this._options),this._tickCallback=this._tick.bind(this),this._options.strength=-1*this._options.strength}function A(e,t){this._scene=e,this._options=t,this._dataFetched=!1,this._options=Object(s.a)(Object(s.a)({},new v),this._options)}function C(e){this._scene=e,this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine||c.a.Warn("Physics engine not enabled. Please enable the physics before you can use the methods.")}(r=a=a||{})[r.Constant=0]="Constant",r[r.Linear=1]="Linear",(n=o=o||{})[n.Center=0]="Center",n[n.Perpendicular=1]="Perpendicular"},function(e,t,i){"use strict";var n=i(285);i.d(t,"b",function(){return n.a});var r=i(287);i.d(t,"a",function(){return r.a});var o=i(286);i.d(t,"c",function(){return o.a})},function(e,t,i){"use strict";var n=i(288);i.d(t,"a",function(){return n.a})},function(e,t,i){"use strict";i.r(t);var n=i(294);i.d(t,"Sprite",function(){return n.a});var r=i(392);for(var o in r)["Sprite","default"].indexOf(o)<0&&function(e){i.d(t,e,function(){return r[e]})}(o);var a=i(296);i.d(t,"SpriteManager",function(){return a.a});var s=i(436);i.d(t,"SpriteMap",function(){return s.a});var c=i(393);i.d(t,"SpritePackedManager",function(){return c.a});var l=i(295);i.d(t,"SpriteSceneComponent",function(){return l.a})},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return o}
1);var c,n=i(1),r=i(296),l=i(9),o=(c=r.a,Object(n.d)(a,c),a);function a(e,t,i,n,r,o,a){void 0===r&&(r=null),void 0===o&&(o=.01),void 0===a&&(a=l.a.TRILINEAR_SAMPLINGMODE);var s=c.call(this,e,t,i,64,n,o,a,!0,r)||this;return s.name=e,s}},function(e,t,i){"use strict";var n=i(239);i.d(t,"a",function(){return n.a});var r=i(237);i.d(t,"b",function(){return r.a});var o=i(238);i.d(t,"c",function(){return o.a})},function(e,t,i){"use strict";i.r(t);var n=i(233);i.d(t,"AndOrNotEvaluator",function(){return n.a});var r=i(396);i.d(t,"AssetTaskState",function(){return r.b}),i.d(t,"AbstractAssetTask",function(){return r.a}),i.d(t,"AssetsProgressEvent",function(){return r.d}),i.d(t,"MeshAssetTask",function(){return r.j}),i.d(t,"TextFileAssetTask",function(){return r.k}),i.d(t,"BinaryFileAssetTask",function(){return r.e}),i.d(t,"ImageAssetTask",function(){return r.i}),i.d(t,"TextureAssetTask",function(){return r.l}),i.d(t,"CubeTextureAssetTask",function(){return r.f}),i.d(t,"HDRCubeTextureAssetTask",function(){return r.h}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return r.g}),i.d(t,"AssetsManager",function(){return r.c});var o=i(174);i.d(t,"BasisTranscodeConfiguration",function(){return o.b}),i.d(t,"BasisTools",function(){return o.a});var a=i(141);i.d(t,"DDSTools",function(){return a.a});var s=i(3);i.d(t,"expandToProperty",function(){return s.b}),i.d(t,"serialize",function(){return s.c}),i.d(t,"serializeAsTexture",function(){return s.m}),i.d(t,"serializeAsColor3",function(){return s.e}),i.d(t,"serializeAsFresnelParameters",function(){return s.h}),i.d(t,"serializeAsVector2",function(){return s.n}),i.d(t,"serializeAsVector3",function(){return s.o}),i.d(t,"serializeAsMeshReference",function(){return s.k}),i.d(t,"serializeAsColorCurves",function(){return s.g}),i.d(t,"serializeAsColor4",function(){return s.f}),i.d(t,"serializeAsImageProcessingConfiguration",function(){return s.i}),i.d(t,"serializeAsQuaternion",function(){return s.l}),i.d(t,"serializeAsMatrix",function(){return s.j}),i.d(t,"serializeAsCameraReference",function(){return s.d}),i.d(t,"SerializationHelper",function(){return s.a});var c=i(397);i.d(t,"Deferred",function(){return c.a});var l=i(106);i.d(t,"EnvironmentTextureTools",function(){return l.a});var u=i(398);i.d(t,"MeshExploder",function(){return u.a});var h=i(399);i.d(t,"FilesInput",function(){return h.a});var d=i(400);i.d(t,"CubeMapToSphericalPolynomialTools",function(){return d.a}),i.d(t,"HDRTools",function(){return d.b}),i.d(t,"PanoramaToCubeMapTools",function(){return d.c});var p=i(194);i.d(t,"KhronosTextureContainer",function(){return p.a});var f=i(6);i.d(t,"EventState",function(){return f.a}),i.d(t,"Observer",function(){return f.d}),i.d(t,"MultiObserver",function(){return f.b}),i.d(t,"Observable",function(){return f.c});var m=i(242);i.d(t,"PerformanceMonitor",function(){return m.a}),i.d(t,"RollingAverage",function(){return m.b});var _=i(241);i.d(t,"PromisePolyfill",function(){return _.a});var g=i(401);i.d(t,"SceneOptimization",function(){return g.h}),i.d(t,"TextureOptimization",function(){return g.l}),i.d(t,"HardwareScalingOptimization",function(){return g.b}),i.d(t,"ShadowsOptimization",function(){return g.k}),i.d(t,"PostProcessesOptimization",function(){return g.f}),i.d(t,"LensFlaresOptimization",function(){return g.c}),i.d(t,"CustomOptimization",function(){return g.a}),i.d(t,"ParticlesOptimization",function(){return g.e}),i.d(t,"RenderTargetsOptimization",function(){return g.g}),i.d(t,"MergeMeshesOptimization",function(){return g.d}),i.d(t,"SceneOptimizerOptions",function(){return g.j}),i.d(t,"SceneOptimizer",function(){return g.i});var v=i(402);i.d(t,"SceneSerializer",function(){return v.a});var b=i(40);i.d(t,"SmartArray",function(){return b.a}),i.d(t,"SmartArrayNoDuplicate",function(){return b.b});var y=i(163);i.d(t,"StringDictionary",function(){return y.a});var T=i(43);i.d(t,"Tags",function(){return T.a});var E=i(403);i.d(t,"TextureTools",function(){return E.a});var S=i(171);i.d(t,"TGATools",function(){return S.a});var A=i(13);i.d(t,"Tools",function(){return A.b}),i.d(t,"className",function(){return A.c}),i.d(t,"AsyncLoop",function(){return A.a});var C=i(404);
1i.d(t,"VideoRecorder",function(){return C.a});var P=i(140);i.d(t,"JoystickAxis",function(){return P.a}),i.d(t,"VirtualJoystick",function(){return P.b});var x=i(292);i.d(t,"WorkerPool",function(){return x.a});var R=i(7);i.d(t,"Logger",function(){return R.a});var O=i(11);i.d(t,"_TypeStore",function(){return O.a});var M=i(113);i.d(t,"FilesInputStore",function(){return M.a});var I=i(46);i.d(t,"DeepCopier",function(){return I.a});var D=i(75);i.d(t,"PivotTools",function(){return D.a});var L=i(72);i.d(t,"PrecisionDate",function(){return L.a});var N=i(405);i.d(t,"ScreenshotTools",function(){return N.a});var F=i(55);i.d(t,"WebRequest",function(){return F.a});var w=i(406);i.d(t,"InspectableType",function(){return w.a});var B=i(150);i.d(t,"BRDFTextureTools",function(){return B.a});var U=i(270);i.d(t,"RGBDTextureTools",function(){return U.a});var V=i(70);i.d(t,"ColorGradient",function(){return V.b}),i.d(t,"Color3Gradient",function(){return V.a}),i.d(t,"FactorGradient",function(){return V.c}),i.d(t,"GradientHelper",function(){return V.d});var k=i(67);i.d(t,"PerfCounter",function(){return k.a});var G=i(407);for(var z in G)["AndOrNotEvaluator","AssetTaskState","AbstractAssetTask","AssetsProgressEvent","MeshAssetTask","TextFileAssetTask","BinaryFileAssetTask","ImageAssetTask","TextureAssetTask","CubeTextureAssetTask","HDRCubeTextureAssetTask","EquiRectangularCubeTextureAssetTask","AssetsManager","BasisTranscodeConfiguration","BasisTools","DDSTools","expandToProperty","serialize","serializeAsTexture","serializeAsColor3","serializeAsFresnelParameters","serializeAsVector2","serializeAsVector3","serializeAsMeshReference","serializeAsColorCurves","serializeAsColor4","serializeAsImageProcessingConfiguration","serializeAsQuaternion","serializeAsMatrix","serializeAsCameraReference","SerializationHelper","Deferred","EnvironmentTextureTools","MeshExploder","FilesInput","CubeMapToSphericalPolynomialTools","HDRTools","PanoramaToCubeMapTools","KhronosTextureContainer","EventState","Observer","MultiObserver","Observable","PerformanceMonitor","RollingAverage","PromisePolyfill","SceneOptimization","TextureOptimization","HardwareScalingOptimization","ShadowsOptimization","PostProcessesOptimization","LensFlaresOptimization","CustomOptimization","ParticlesOptimization","RenderTargetsOptimization","MergeMeshesOptimization","SceneOptimizerOptions","SceneOptimizer","SceneSerializer","SmartArray","SmartArrayNoDuplicate","StringDictionary","Tags","TextureTools","TGATools","Tools","className","AsyncLoop","VideoRecorder","JoystickAxis","VirtualJoystick","WorkerPool","Logger","_TypeStore","FilesInputStore","DeepCopier","PivotTools","PrecisionDate","ScreenshotTools","WebRequest","InspectableType","BRDFTextureTools","RGBDTextureTools","ColorGradient","Color3Gradient","FactorGradient","GradientHelper","PerfCounter","default"].indexOf(z)<0&&function(e){i.d(t,e,function(){return G[e]})}(z);var j=i(408);for(var z in j)["AndOrNotEvaluator","AssetTaskState","AbstractAssetTask","AssetsProgressEvent","MeshAssetTask","TextFileAssetTask","BinaryFileAssetTask","ImageAssetTask","TextureAssetTask","CubeTextureAssetTask","HDRCubeTextureAssetTask","EquiRectangularCubeTextureAssetTask","AssetsManager","BasisTranscodeConfiguration","BasisTools","DDSTools","expandToProperty","serialize","serializeAsTexture","serializeAsColor3","serializeAsFresnelParameters","serializeAsVector2","serializeAsVector3","serializeAsMeshReference","serializeAsColorCurves","serializeAsColor4","serializeAsImageProcessingConfiguration","serializeAsQuaternion","serializeAsMatrix","serializeAsCameraReference","SerializationHelper","Deferred","EnvironmentTextureTools","MeshExploder","FilesInput","CubeMapToSphericalPolynomialTools","HDRTools","PanoramaToCubeMapTools","KhronosTextureContainer","EventState","Observer","MultiObserver","Observable","PerformanceMonitor","RollingAverage","PromisePolyfill","SceneOptimization","TextureOptimization","HardwareScalingOptimization","ShadowsOptimization","PostProcessesOptimization","LensFlaresOptimization","CustomOptimization","ParticlesOptimization","RenderTargetsOptimization","MergeMeshesOptimization","SceneOptimizerOptions","SceneOptimizer","SceneSerializer","SmartArray","SmartArrayNoDuplicate","StringDictionary","Tags","TextureTools","TGATools","Tools","className","AsyncLoop","VideoRecorder","JoystickAxis","VirtualJoystick","WorkerPool","Logger","_TypeStore","FilesInputStore","DeepCopier","PivotTools","PrecisionDate","ScreenshotTools","WebRequest","InspectableType","BRDFTextureTools","RGBDTextureTools","ColorGradient","Color3Gradient","FactorGradient","GradientHelper","PerfCounter","default"].indexOf(z)<0&&function(e){i.d(t,e,function(){return j[e]})}(z);var W=i(236);i.d(t,"RetryStrategy",function(){return W.a});var H=i(409);for(var z in H)["AndOrNotEvaluator","AssetTaskState","AbstractAssetTask","AssetsProgressEvent","MeshAssetTask","TextFileAssetTask","BinaryFileAssetTask","ImageAssetTask","TextureAssetTask","CubeTextureAssetTask","HDRCubeTextureAssetTask","EquiRectangularCubeTextureAssetTask","AssetsManager","BasisTranscodeConfiguration","BasisTools","DDSTools","expandToProperty","serialize","serializeAsTexture","serializeAsColor3","serializeAsFresnelParameters","serializeAsVector2","serializeAsVector3","serializeAsMeshReference","serializeAsColorCurves","serializeAsColor4","serializeAsImageProcessingConfiguration","serializeAsQuaternion","serializeAsMatrix","serializeAsCameraReference","SerializationHelper","Deferred","EnvironmentTextureTools","MeshExploder","FilesInput","CubeMapToSphericalPolynomialTools","HDRTools","PanoramaToCubeMapTools","KhronosTextureContainer","EventState","Observer","MultiObserver","Observable","PerformanceMonitor","RollingAverage","PromisePolyfill","SceneOptimization","TextureOptimization","HardwareScalingOptimization","ShadowsOptimization","PostProcessesOptimization","LensFlaresOptimization","CustomOptimization","ParticlesOptimization","RenderTargetsOptimization","MergeMeshesOptimization","SceneOptimizerOptions","SceneOptimizer","SceneSerializer","SmartArray","SmartArrayNoDuplicate","StringDictionary","Tags","TextureTools","TGATools","Tools","className","AsyncLoop","VideoRecorder","JoystickAxis","VirtualJoystick","WorkerPool","Logger","_TypeStore","FilesInputStore","DeepCopier","PivotTools","PrecisionDate","ScreenshotTools","WebRequest","InspectableType","BRDFTextureTools","RGBDTextureTools","ColorGradient","Color3Gradient","FactorGradient","GradientHelper","PerfCounter","RetryStrategy","default"].indexOf(z)<0&&function(e){i.d(t,e,function(){return H[e]})}(z);var X=i(96);i.d(t,"CanvasGenerator",function(){return X.a});var Y=i(68);i.d(t,"LoadFileError",function(){return Y.b}),i.d(t,"RequestFileError",function(){return Y.d}),i.d(t,"ReadFileError",function(){return Y.c}),i.d(t,"FileTools",function(){return Y.a});var K=i(41);i.d(t,"StringTools",function(){return K.a});var Q=i(410);i.d(t,"DataReader",function(){return Q.a});var q=i(299);i.d(t,"MinMaxReducer",function(){return q.a});var Z=i(281);i.d(t,"DepthReducer",function(){return Z.a});var J=i(411);i.d(t,"DataStorage",function(){return J.a})},function(e,t,i){"use strict";i.d(t,"b",function(){return o}
1),i.d(t,"a",function(){return E}),i.d(t,"d",function(){return S}),i.d(t,"j",function(){return A}),i.d(t,"k",function(){return C}),i.d(t,"e",function(){return P}),i.d(t,"i",function(){return x}),i.d(t,"l",function(){return R}),i.d(t,"f",function(){return O}),i.d(t,"h",function(){return M}),i.d(t,"g",function(){return I}),i.d(t,"c",function(){return D});var o,n,r=i(1),a=i(36),s=i(13),c=i(6),l=i(9),u=i(86),h=i(185),d=i(289),p=i(7);(n=o=o||{})[n.INIT=0]="INIT",n[n.RUNNING=1]="RUNNING",n[n.DONE=2]="DONE",n[n.ERROR=3]="ERROR";var f,m,_,g,v,b,y,T,E=(Object.defineProperty(z.prototype,"isCompleted",{get:function(){return this._isCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"taskState",{get:function(){return this._taskState},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"errorObject",{get:function(){return this._errorObject},enumerable:!1,configurable:!0}),z.prototype._setErrorObject=function(e,t){this._errorObject||(this._errorObject={message:e,exception:t})},z.prototype.run=function(e,t,i){var n=this;this._taskState=o.RUNNING,this.runTask(e,function(){n.onDoneCallback(t,i)},function(e,t){n.onErrorCallback(i,e,t)})},z.prototype.runTask=function(e,t,i){throw new Error("runTask is not implemented")},z.prototype.reset=function(){this._taskState=o.INIT},z.prototype.onErrorCallback=function(e,t,i){this._taskState=o.ERROR,this._errorObject={message:t,exception:i},this.onError&&this.onError(this,t,i),e()},z.prototype.onDoneCallback=function(e,t){try{this._taskState=o.DONE,this._isCompleted=!0,this.onSuccess&&this.onSuccess(this),e()}catch(e){this.onErrorCallback(t,"Task is done, error executing success callback(s)",e)}},z),S=function(e,t,i){this.remainingCount=e,this.totalCount=t,this.task=i},A=(T=E,Object(r.d)(G,T),G.prototype.runTask=function(e,r,n){var o=this;a.a.ImportMesh(this.meshesNames,this.rootUrl,this.sceneFilename,e,function(e,t,i,n){o.loadedMeshes=e,o.loadedParticleSystems=t,o.loadedSkeletons=i,o.loadedAnimationGroups=n,r()},null,function(e,t,i){n(t,i)})},G),C=(y=E,Object(r.d)(k,y),k.prototype.runTask=function(e,t,i){var n=this;e._loadFile(this.url,function(e){n.text=e,t()},void 0,!1,!1,function(e,t){e&&i(e.status+" "+e.statusText,t)})},k),P=(b=E,Object(r.d)(V,b),V.prototype.runTask=function(e,t,i){var n=this;e._loadFile(this.url,function(e){n.data=e,t()},void 0,!0,!0,function(e,t){e&&i(e.status+" "+e.statusText,t)})},V),x=(v=E,Object(r.d)(U,v),U.prototype.runTask=function(e,t,i){var n=this,r=new Image;s.b.SetCorsBehavior(this.url,r),r.onload=function(){n.image=r,t()},r.onerror=function(e){i("Error loading image",e)},r.src=this.url},U),R=(g=E,Object(r.d)(B,g),B.prototype.runTask=function(e,t,i){this.texture=new l.a(this.url,e,this.noMipmap,this.invertY,this.samplingMode,function(){t()},function(e,t){i(e,t)})},B),O=(_=E,Object(r.d)(w,_),w.prototype.runTask=function(e,t,i){this.texture=new u.a(this.url,e,this.extensions,this.noMipmap,this.files,function(){t()},function(e,t){i(e,t)})},w),M=(m=E,Object(r.d)(F,m),F.prototype.runTask=function(e,t,i){this.texture=new h.a(this.url,e,this.size,this.noMipmap,this.generateHarmonics,this.gammaSpace,this.reserved,function(){t()},function(e,t){i(e,t)})},F),I=(f=E,Object(r.d)(N,f),N.prototype.runTask=function(e,t,i){this.texture=new d.a(this.url,e,this.size,this.noMipmap,this.gammaSpace,function(){t()},function(e,t){i(e,t)})},N),D=(L.prototype.addMeshTask=function(e,t,i,n){var r=new A(e,t,i,n);return this._tasks.push(r),r},L.prototype.addTextFileTask=function(e,t){var i=new C(e,t);return this._tasks.push(i),i},L.prototype.addBinaryFileTask=function(e,t){var i=new P(e,t);return this._tasks.push(i),i},L.prototype.addImageTask=function(e,t){var i=new x(e,t);return this._tasks.push(i),i},L.prototype.addTextureTask=function(e,t,i,n,r){void 0===r&&(r=l.a.TRILINEAR_SAMPLINGMODE);var o=new R(e,t,i,n,r);return this._tasks.push(o),o},L.prototype.addCubeTextureTask=function(e,t,i,n,r){var o=new O(e,t,i,n,r);return this._tasks.push(o),o},L.prototype.addHDRCubeTextureTask=function(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1);var s=new M(e,t,i,n,r,o,a);return this._tasks.push(s),s},L.prototype.addEquiRectangularCubeTextureAssetTask=function(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o=new I(e,t,i,n,r);return this._tasks.push(o),o},L.prototype.removeTask=function(e){var t=this._tasks.indexOf(e);-1<t&&this._tasks.splice(t,1)},L.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new S(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){p.a.Error("Error running progress callbacks."),console.log(e)}if(0===this._waitingTasksCount){try{var t=this._tasks.slice();this.onFinish&&this.onFinish(t);for(var i,n=0,r=t;n<r.length;n++)(e=r[n]).taskState!==o.DONE||-1<(i=this._tasks.indexOf(e))&&this._tasks.splice(i,1);this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){p.a.Error("Error running tasks-done callbacks."),console.log(e)}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}},L.prototype._runTask=function(i){function t(e,t){i._setErrorObject(e,t),n.onTaskError&&n.onTaskError(i),n.onTaskErrorObservable.notifyObservers(i),n._decreaseWaitingTasksCount(i)}var n=this;i.run(this._scene,function(){try{n.onTaskSuccess&&n.onTaskSuccess(i),n.onTaskSuccessObservable.notifyObservers(i),n._decreaseWaitingTasksCount(i)}catch(e){t("Error executing task success callbacks",e)}},t)},L.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},L.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<this._tasks.length;e++){var t=this._tasks[e];t.taskState===o.INIT&&this._runTask(t)}return this},L.prototype.loadAsync=function(){var e=this;return new Promise(function(t,i){e._isLoading?t():(e.onTasksDoneObservable.addOnce(function(e){e&&e.length?
1i(e):t()}),e.load())})},L);function L(e){this._isLoading=!1,this._tasks=new Array,this._waitingTasksCount=0,this._totalTasksCount=0,this.onTaskSuccessObservable=new c.c,this.onTaskErrorObservable=new c.c,this.onTasksDoneObservable=new c.c,this.onProgressObservable=new c.c,this.useDefaultLoadingScreen=!0,this.autoHideLoadingUI=!0,this._scene=e}function N(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o=f.call(this,e)||this;return o.name=e,o.url=t,o.size=i,o.noMipmap=n,o.gammaSpace=r,o}function F(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1);var s=m.call(this,e)||this;return s.name=e,s.url=t,s.size=i,s.noMipmap=n,s.generateHarmonics=r,s.gammaSpace=o,s.reserved=a,s}function w(e,t,i,n,r){var o=_.call(this,e)||this;return o.name=e,o.url=t,o.extensions=i,o.noMipmap=n,o.files=r,o}function B(e,t,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=l.a.TRILINEAR_SAMPLINGMODE);var o=g.call(this,e)||this;return o.name=e,o.url=t,o.noMipmap=i,o.invertY=n,o.samplingMode=r,o}function U(e,t){var i=v.call(this,e)||this;return i.name=e,i.url=t,i}function V(e,t){var i=b.call(this,e)||this;return i.name=e,i.url=t,i}function k(e,t){var i=y.call(this,e)||this;return i.name=e,i.url=t,i}function G(e,t,i,n){var r=T.call(this,e)||this;return r.name=e,r.meshesNames=t,r.rootUrl=i,r.sceneFilename=n,r}function z(e){this.name=e,this._isCompleted=!1,this._taskState=o.INIT}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(Object.defineProperty(r.prototype,"resolve",{get:function(){return this._resolve},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"reject",{get:function(){return this._reject},enumerable:!1,configurable:!0}),r);function r(){var i=this;this.promise=new Promise(function(e,t){i._resolve=e,i._reject=t})}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var s=i(0),n=(r.prototype._setCenterMesh=function(){for(var e,t,i,n=s.e.Zero(),r=s.e.Zero(),o=Number.MAX_VALUE,a=0;a<this._meshes.length;a++)this._meshes[a]&&(t=(e=this._meshes[a]).getBoundingInfo())&&r.addInPlace(t.boundingBox.centerWorld);for(n=r.scale(1/this._meshes.length),a=0;a<this._meshes.length;a++)this._meshes[a]&&(!(t=(e=this._meshes[a]).getBoundingInfo())||(i=t.boundingBox.centerWorld.subtract(n).lengthSquared())<o&&(this._centerMesh=e,o=i))},r.prototype.getClassName=function(){return"MeshExploder"},r.prototype.getMeshes=function(){var e=this._meshes.slice();return e.unshift(this._centerMesh),e},r.prototype.explode=function(e){void 0===e&&(e=1);for(var t=0;t<this._meshes.length;t++)this._meshes[t]&&this._meshesOrigins[t]&&this._toCenterVectors[t]&&(this._toCenterVectors[t].scaleToRef(e,this._scaledDirection),this._meshesOrigins[t].addToRef(this._scaledDirection,this._newPosition),this._meshes[t].setAbsolutePosition(this._newPosition));this._centerMesh.setAbsolutePosition(this._centerPosition)},r);function r(e,t){this._meshesOrigins=[],this._toCenterVectors=[],this._scaledDirection=s.e.Zero(),this._newPosition=s.e.Zero(),this._centerPosition=s.e.Zero(),this._meshes=e.slice(),t?this._centerMesh=t:this._setCenterMesh();var i=this._meshes.indexOf(this._centerMesh);0<=i&&this._meshes.splice(i,1),this._centerPosition=this._centerMesh.getAbsolutePosition().clone();for(var n,r=0;r<this._meshes.length;r++){this._meshes[r]&&(n=this._meshes[r],this._meshesOrigins[r]=n.getAbsolutePosition().clone(),this._toCenterVectors[r]=s.e.Zero(),n._boundingInfo&&this._centerMesh._boundingInfo&&n._boundingInfo.boundingBox.centerWorld.subtractToRef(this._centerMesh._boundingInfo.boundingBox.centerWorld,this._toCenterVectors[r]))}}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var r=i(36),n=i(7),o=i(113),a=(Object.defineProperty(s,"FilesToLoad",{get:function(){return o.a.FilesToLoad},enumerable:!1,configurable:!0}),s.prototype.monitorElementForDragNDrop=function(e){var t=this;e&&(this._elementToMonitor=e,this._dragEnterHandler=function(e){t.drag(e)},this._dragOverHandler=function(e){t.drag(e)},this._dropHandler=function(e){t.drop(e)},this._elementToMonitor.addEventListener("dragenter",this._dragEnterHandler,!1),this._elementToMonitor.addEventListener("dragover",this._dragOverHandler,!1),this._elementToMonitor.addEventListener("drop",this._dropHandler,!1))},Object.defineProperty(s.prototype,"filesToLoad",{get:function(){return this._filesToLoad}
1,enumerable:!1,configurable:!0}),s.prototype.dispose=function(){this._elementToMonitor&&(this._elementToMonitor.removeEventListener("dragenter",this._dragEnterHandler),this._elementToMonitor.removeEventListener("dragover",this._dragOverHandler),this._elementToMonitor.removeEventListener("drop",this._dropHandler))},s.prototype.renderFunction=function(){var e;this._additionalRenderLoopLogicCallback&&this._additionalRenderLoopLogicCallback(),this._currentScene&&(!this._textureLoadingCallback||0<(e=this._currentScene.getWaitingItemsCount())&&this._textureLoadingCallback(e),this._currentScene.render())},s.prototype.drag=function(e){e.stopPropagation(),e.preventDefault()},s.prototype.drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},s.prototype._traverseFolder=function(e,r,o,a){var s=this,t=e.createReader(),c=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");t.readEntries(function(e){o.count+=e.length;for(var t=0,i=e;t<i.length;t++){var n=i[t];n.isFile?n.file(function(e){e.correctName=c+e.name,r.push(e),0==--o.count&&a()}):n.isDirectory&&s._traverseFolder(n,r,o,a)}--o.count&&a()})},s.prototype._processFiles=function(e){for(var t=0;t<e.length;t++){var i=e[t].correctName.toLowerCase(),n=i.split(".").pop();this.onProcessFileCallback(e[t],i,n)&&(r.a.IsPluginForExtensionAvailable("."+n)&&(this._sceneFileToLoad=e[t]),s.FilesToLoad[i]=e[t])}},s.prototype.loadFiles=function(e){var t=this;if(e&&e.dataTransfer&&e.dataTransfer.files&&(this._filesToLoad=e.dataTransfer.files),e&&e.target&&e.target.files&&(this._filesToLoad=e.target.files),this._filesToLoad&&0!==this._filesToLoad.length&&(this._startingProcessingFilesCallback&&this._startingProcessingFilesCallback(this._filesToLoad),this._filesToLoad&&0<this._filesToLoad.length)){for(var i=new Array,n=[],r=e.dataTransfer?e.dataTransfer.items:null,o=0;o<this._filesToLoad.length;o++){var a,s=this._filesToLoad[o],c=s.name.toLowerCase(),l=void 0;s.correctName=c,r&&((a=r[o]).getAsEntry?l=a.getAsEntry():a.webkitGetAsEntry&&(l=a.webkitGetAsEntry())),l&&l.isDirectory?n.push(l):i.push(s)}if(0===n.length)this._processFiles(i),this._processReload();else for(var u={count:n.length},h=0,d=n;h<d.length;h++){var p=d[h];this._traverseFolder(p,i,u,function(){t._processFiles(i),0===u.count&&t._processReload()})}}},s.prototype._processReload=function(){this._onReloadCallback?this._onReloadCallback(this._sceneFileToLoad):this.reload()},s.prototype.reload=function(){var t=this;this._sceneFileToLoad?(this._currentScene&&(0<n.a.errorsCount&&n.a.ClearLogCache(),this._engine.stopRenderLoop()),r.a.ShowLoadingScreen=!1,this._engine.displayLoadingUI(),r.a.LoadAsync("file:",this._sceneFileToLoad,this._engine,function(e){t._progressCallback&&t._progressCallback(e)}).then(function(e){t._currentScene&&t._currentScene.dispose(),t._currentScene=e,t._sceneLoadedCallback&&t._sceneLoadedCallback(t._sceneFileToLoad,t._currentScene),t._currentScene.executeWhenReady(function(){t._engine.hideLoadingUI(),t._engine.runRenderLoop(function(){t.renderFunction()})})}).catch(function(e){t._engine.hideLoadingUI(),t._errorCallback&&t._errorCallback(t._sceneFileToLoad,t._currentScene,e.message)})):n.a.Error("Please provide a valid .babylon file.")},s);function s(e,t,i,n,r,o,a,s,c){this.onProcessFileCallback=function(){return!0},this._engine=e,this._currentScene=t,this._sceneLoadedCallback=i,this._progressCallback=n,this._additionalRenderLoopLogicCallback=r,this._textureLoadingCallback=o,this._startingProcessingFilesCallback=a,this._onReloadCallback=s,this._errorCallback=c}},function(e,t,i){"use strict";var n=i(148);i.d(t,"a",function(){return n.a});var r=i(283);i.d(t,"b",function(){return r.a});var o=i(186);i.d(t,"c",function(){return o.a})},function(e,t,i){"use strict";i.d(t,"h",function(){return _}),i.d(t,"l",function(){return g}),i.d(t,"b",function(){return v}),i.d(t,"k",function(){return b}),i.d(t,"f",function(){return y}),i.d(t,"c",function(){return T}),i.d(t,"a",function(){return E}),i.d(t,"e",function(){return S}),i.d(t,"g",function(){return A}),i.d(t,"d",function(){return C}),i.d(t,"j",function(){return P}),i.d(t,"i",function(){return x});var n,r,o,a,s,c,l,u,h,d=i(1),p=i(22),f=i(8),m=i(6),_=(V.prototype.getDescription=function(){return""},V.prototype.apply=function(e,t){return!0},V),g=(h=_,Object(d.d)(U,h),U.prototype.getDescription=function(){return"Reducing render target texture size to "+this.maximumSize},U.prototype.apply=function(e,t){for(var i=!0,n=0;n<e.textures.length;n++){var r,o=e.textures[n];o.canRescale&&!o.getContext&&(r=o.getSize(),Math.max(r.width,r.height)>this.maximumSize&&(o.scale(this.step),i=!1))}return i},U),v=(u=_,Object(d.d)(B,u),B.prototype.getDescription=function(){return"Setting hardware scaling level to "+this._currentScale},B.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},B),b=(l=_,Object(d.d)(w,l),w.prototype.getDescription=function(){return"Turning shadows on/off"},w.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},w),y=(c=_,Object(d.d)(F,c),F.prototype.getDescription=function(){return"Turning post-processes on/off"},F.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},F),T=(s=_,Object(d.d)(N,s),N.prototype.getDescription=function(){return"Turning lens flares on/off"},N.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},N),E=(a=_,Object(d.d)(L,a),L.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"},L.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},L),S=(o=_,Object(d.d)(D,o),D.prototype.getDescription=function(){return"Turning particles on/off"},D.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},D),A=(r=_,Object(d.d)(I,r),I.prototype.getDescription=function(){return"Turning render targets off"},I.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0}
1,I),C=(n=_,Object(d.d)(M,n),Object.defineProperty(M,"UpdateSelectionTree",{get:function(){return M._UpdateSelectionTree},set:function(e){M._UpdateSelectionTree=e},enumerable:!1,configurable:!0}),M.prototype.getDescription=function(){return"Merging similar meshes together"},M.prototype.apply=function(e,t,i){for(var n=e.meshes.slice(0),r=n.length,o=0;o<r;o++){var a=new Array,s=n[o];if(this._canBeMerged(s)){a.push(s);for(var c=o+1;c<r;c++){var l=n[c];this._canBeMerged(l)&&l.material===s.material&&l.checkCollisions===s.checkCollisions&&(a.push(l),r--,n.splice(c,1),c--)}a.length<2||f.a.MergeMeshes(a,void 0,!0)}}var u=e;return u.createOrUpdateSelectionOctree&&(null!=i?i&&u.createOrUpdateSelectionOctree():M.UpdateSelectionTree&&u.createOrUpdateSelectionOctree()),!0},M._UpdateSelectionTree=!1,M),P=(O.prototype.addOptimization=function(e){return this.optimizations.push(e),this},O.prototype.addCustomOptimization=function(e,t,i){void 0===i&&(i=0);var n=new E(i);return n.onApply=e,n.onGetDescription=t,this.optimizations.push(n),this},O.LowDegradationAllowed=function(e){var t=new O(e),i=0;return t.addOptimization(new C(i)),t.addOptimization(new b(i)),t.addOptimization(new T(i)),i++,t.addOptimization(new y(i)),t.addOptimization(new S(i)),i++,t.addOptimization(new g(i,1024)),t},O.ModerateDegradationAllowed=function(e){var t=new O(e),i=0;return t.addOptimization(new C(i)),t.addOptimization(new b(i)),t.addOptimization(new T(i)),i++,t.addOptimization(new y(i)),t.addOptimization(new S(i)),i++,t.addOptimization(new g(i,512)),i++,t.addOptimization(new A(i)),i++,t.addOptimization(new v(i,2)),t},O.HighDegradationAllowed=function(e){var t=new O(e),i=0;return t.addOptimization(new C(i)),t.addOptimization(new b(i)),t.addOptimization(new T(i)),i++,t.addOptimization(new y(i)),t.addOptimization(new S(i)),i++,t.addOptimization(new g(i,256)),i++,t.addOptimization(new A(i)),i++,t.addOptimization(new v(i,4)),t},O),x=(Object.defineProperty(R.prototype,"isInImprovementMode",{get:function(){return this._improvementMode},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"currentPriorityLevel",{get:function(){return this._currentPriorityLevel},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"currentFrameRate",{get:function(){return this._currentFrameRate},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"targetFrameRate",{get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate=e},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"trackerDuration",{get:function(){return this._trackerDuration},set:function(e){this._trackerDuration=e},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"optimizations",{get:function(){return this._options.optimizations},enumerable:!1,configurable:!0}),R.prototype.stop=function(){this._isRunning=!1},R.prototype.reset=function(){this._currentPriorityLevel=0},R.prototype.start=function(){var e=this;this._isRunning||(this._isRunning=!0,this._scene.executeWhenReady(function(){setTimeout(function(){e._checkCurrentState()},e._trackerDuration)}))},R.prototype._checkCurrentState=function(){var e=this;if(this._isRunning){var t=this._scene,i=this._options;if(this._currentFrameRate=Math.round(t.getEngine().getFps()),this._improvementMode&&this._currentFrameRate<=this._targetFrameRate||!this._improvementMode&&this._currentFrameRate>=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var n=!0,r=!0,o=0;o<i.optimizations.length;o++){var a=i.optimizations[o];a.priority===this._currentPriorityLevel&&(r=!1,n=n&&a.apply(t,this),this.onNewOptimizationAppliedObservable.notifyObservers(a))}if(r)return this._isRunning=!1,void this.onFailureObservable.notifyObservers(this);n&&this._currentPriorityLevel++,t.executeWhenReady(function(){setTimeout(function(){e._checkCurrentState()},e._trackerDuration)})}},R.prototype.dispose=function(){this.stop(),this.onSuccessObservable.clear(),this.onFailureObservable.clear(),this.onNewOptimizationAppliedObservable.clear(),this._sceneDisposeObserver&&this._scene.onDisposeObservable.remove(this._sceneDisposeObserver)},R.OptimizeAsync=function(e,t,i,n){var r=new R(e,t||P.ModerateDegradationAllowed(),!1);return i&&r.onSuccessObservable.add(function(){i()}),n&&r.onFailureObservable.add(function(){n()}),r.start(),r},R);function R(e,t,i,n){var r=this;if(void 0===i&&(i=!0),void 0===n&&(n=!1),this._isRunning=!1,this._currentPriorityLevel=0,this._targetFrameRate=60,this._trackerDuration=2e3,this._currentFrameRate=0,this._improvementMode=!1,this.onSuccessObservable=new m.c,this.onNewOptimizationAppliedObservable=new m.c,this.onFailureObservable=new m.c,this._options=t||new P,this._options.targetFrameRate&&(this._targetFrameRate=this._options.targetFrameRate),this._options.trackerDuration&&(this._trackerDuration=this._options.trackerDuration),i)for(var o=0,a=0,s=this._options.optimizations;a<s.length;a++)s[a].priority=o++;this._improvementMode=n,this._scene=e||p.a.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add(function(){r._sceneDisposeObserver=null,r.dis
1pose()})}function O(e,t){void 0===e&&(e=60),void 0===t&&(t=2e3),this.targetFrameRate=e,this.trackerDuration=t,this.optimizations=new Array}function M(){var e=null!==n&&n.apply(this,arguments)||this;return e._canBeMerged=function(e){if(!(e instanceof f.a))return!1;var t=e;return!(t.isDisposed()||!t.isVisible||!t.isEnabled()||0<t.instances.length||t.skeleton||t.hasLODLevels)},e}function I(){return null!==r&&r.apply(this,arguments)||this}function D(){return null!==o&&o.apply(this,arguments)||this}function L(){return null!==a&&a.apply(this,arguments)||this}function N(){return null!==s&&s.apply(this,arguments)||this}function F(){return null!==c&&c.apply(this,arguments)||this}function w(){return null!==l&&l.apply(this,arguments)||this}function B(e,t,i){void 0===e&&(e=0),void 0===t&&(t=2),void 0===i&&(i=.25);var n=u.call(this,e)||this;return n.priority=e,n.maximumScale=t,n.step=i,n._currentScale=-1,n._directionOffset=1,n}function U(e,t,i){void 0===e&&(e=0),void 0===t&&(t=1024),void 0===i&&(i=.5);var n=h.call(this,e)||this;return n.priority=e,n.maximumSize=t,n.step=i,n}function V(e){void 0===e&&(e=0),this.priority=e}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});function y(e,t){C[e.id]||e.doNotSerialize||(t.vertexData.push(e.serializeVerticeData()),C[e.id]=!0)}function T(e,t){var i={},n=e._geometry;return n&&(e.getScene().getGeometryByID(n.id)||y(n,t.geometries)),e.serialize&&e.serialize(i),i}var E=i(8),S=i(2),a=i(98),A=i(3),C=[],n=(P.ClearCache=function(){C=[]},P.Serialize=function(e){var t,i,n,r={};P.ClearCache(),r.useDelayedTextureLoading=e.useDelayedTextureLoading,r.autoClear=e.autoClear,r.clearColor=e.clearColor.asArray(),r.ambientColor=e.ambientColor.asArray(),r.gravity=e.gravity.asArray(),r.collisionsEnabled=e.collisionsEnabled,e.fogMode&&0!==e.fogMode&&(r.fogMode=e.fogMode,r.fogColor=e.fogColor.asArray(),r.fogStart=e.fogStart,r.fogEnd=e.fogEnd,r.fogDensity=e.fogDensity),e.isPhysicsEnabled()&&(n=e.getPhysicsEngine())&&(r.physicsEnabled=!0,r.physicsGravity=n.gravity.asArray(),r.physicsEngine=n.getPhysicsPluginName()),e.metadata&&(r.metadata=e.metadata),r.morphTargetManagers=[];for(var o=0,a=e.meshes;o<a.length;o++){var s=(f=a[o]).morphTargetManager;s&&r.morphTargetManagers.push(s.serialize())}for(r.lights=[],_=0;_<e.lights.length;_++)(t=e.lights[_]).doNotSerialize||r.lights.push(t.serialize());for(r.cameras=[],_=0;_<e.cameras.length;_++){var c=e.cameras[_];c.doNotSerialize||r.cameras.push(c.serialize())}if(e.activeCamera&&(r.activeCameraID=e.activeCamera.id),A.a.AppendSerializedAnimations(e,r),e.animationGroups&&0<e.animationGroups.length){r.animationGroups=[];for(var l=0;l<e.animationGroups.length;l++){var u=e.animationGroups[l];r.animationGroups.push(u.serialize())}}if(e.reflectionProbes&&0<e.reflectionProbes.length)for(r.reflectionProbes=[],_=0;_<e.reflectionProbes.length;_++){var h=e.reflectionProbes[_];r.reflectionProbes.push(h.serialize())}for(r.materials=[],r.multiMaterials=[],_=0;_<e.materials.length;_++)(i=e.materials[_]).doNotSerialize||r.materials.push(i.serialize());for(r.multiMaterials=[],_=0;_<e.multiMaterials.length;_++){var d=e.multiMaterials[_];r.multiMaterials.push(d.serialize())}for(e.environmentTexture&&(r.environmentTexture=e.environmentTexture.name),r.environmentIntensity=e.environmentIntensity,r.skeletons=[],_=0;_<e.skeletons.length;_++){var p=e.skeletons[_];p.doNotSerialize||r.skeletons.push(p.serialize())}for(r.transformNodes=[],_=0;_<e.transformNodes.length;_++)e.transformNodes[_].doNotSerialize||r.transformNodes.push(e.transformNodes[_].serialize());r.geometries={},r.geometries.boxes=[],r.geometries.spheres=[],r.geometries.cylinders=[],r.geometries.toruses=[],r.geometries.grounds=[],r.geometries.planes=[],r.geometries.torusKnots=[],r.geometries.vertexData=[],C=[];for(var f,m=e.getGeometries(),_=0;_<m.length;_++){var g=m[_];g.isReady()&&y(g,r.geometries)}for(r.meshes=[],_=0;_<e.meshes.length;_++)(f=e.meshes[_])instanceof E.a&&(f.doNotSerialize||f.delayLoadState!==S.a.DELAYLOADSTATE_LOADED&&f.delayLoadState!==S.a.DELAYLOADSTATE_NONE||r.meshes.push(T(f,r)));for(r.particleSystems=[],_=0;_<e.particleSystems.length;_++)r.particleSystems.push(e.particleSystems[_].serialize(!1));e.actionManager&&(r.actions=e.actionManager.serialize("scene"));for(var v=0,b=e._serializableComponents;v<b.length;v++)b[v].serialize(r);return r}
1,P.SerializeMesh=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n={};if(P.ClearCache(),t=t instanceof Array?t:[t],e||i)for(var r=0;r<t.length;++r)i&&t[r].getDescendants().forEach(function(e){e instanceof E.a&&t.indexOf(e)<0&&!e.doNotSerialize&&t.push(e)}),e&&t[r].parent&&t.indexOf(t[r].parent)<0&&!t[r].parent.doNotSerialize&&t.push(t[r].parent);return t.forEach(function(e){!function(t,e){if(t.delayLoadState===S.a.DELAYLOADSTATE_LOADED||t.delayLoadState===S.a.DELAYLOADSTATE_NONE){if(t.material&&!t.material.doNotSerialize)if(t.material instanceof a.a){if(e.multiMaterials=e.multiMaterials||[],e.materials=e.materials||[],!e.multiMaterials.some(function(e){return e.id===t.material.id})){e.multiMaterials.push(t.material.serialize());for(var i=function(t){t&&(e.materials.some(function(e){return e.id===t.id})||e.materials.push(t.serialize()))},n=0,r=t.material.subMaterials;n<r.length;n++)i(r[n])}}else e.materials=e.materials||[],e.materials.some(function(e){return e.id===t.material.id})||e.materials.push(t.material.serialize());var o=t._geometry;o&&(e.geometries||(e.geometries={},e.geometries.boxes=[],e.geometries.spheres=[],e.geometries.cylinders=[],e.geometries.toruses=[],e.geometries.grounds=[],e.geometries.planes=[],e.geometries.torusKnots=[],e.geometries.vertexData=[]),y(o,e.geometries)),t.skeleton&&!t.skeleton.doNotSerialize&&(e.skeletons=e.skeletons||[],e.skeletons.push(t.skeleton.serialize())),e.meshes=e.meshes||[],e.meshes.push(T(t,e))}}(e,n)}),n},P);function P(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var c=i(9),l=i(39),u=i(105),h=i(2),n=(r.CreateResizedCopy=function(t,e,i,n){void 0===n&&(n=!0);var r=t.getScene(),o=r.getEngine(),a=new l.a("resized"+t.name,{width:e,height:i},r,!t.noMipmap,!0,t._texture.type,!1,t.samplingMode,!1);a.wrapU=t.wrapU,a.wrapV=t.wrapV,a.uOffset=t.uOffset,a.vOffset=t.vOffset,a.uScale=t.uScale,a.vScale=t.vScale,a.uAng=t.uAng,a.vAng=t.vAng,a.wAng=t.wAng,a.coordinatesIndex=t.coordinatesIndex,a.level=t.level,a.anisotropicFilteringLevel=t.anisotropicFilteringLevel,a._texture.isReady=!1,t.wrapU=c.a.CLAMP_ADDRESSMODE,t.wrapV=c.a.CLAMP_ADDRESSMODE;var s=new u.b("pass",1,null,n?c.a.BILINEAR_SAMPLINGMODE:c.a.NEAREST_SAMPLINGMODE,o,!1,h.a.TEXTURETYPE_UNSIGNED_INT);return s.getEffect().executeWhenCompiled(function(){s.onApply=function(e){e.setTexture("textureSampler",t)};var e=a.getInternalTexture();e&&(r.postProcessManager.directRender([s],e),o.unBindFramebuffer(e),a.disposeFramebufferObjects(),s.dispose(),e.isReady=!0)}),a},r);function r(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var s=i(1),n=i(13),r=(c.IsSupported=function(e){var t=e.getRenderingCanvas();return!!t&&"function"==typeof t.captureStream},Object.defineProperty(c.prototype,"isRecording",{get:function(){return!!this._canvas&&this._canvas.isRecording},enumerable:!1,configurable:!0}),c.prototype.stopRecording=function(){this._canvas&&this._mediaRecorder&&this.isRecording&&(this._canvas.isRecording=!1,this._mediaRecorder.stop())},c.prototype.startRecording=function(e,t){var i=this;if(void 0===e&&(e="babylonjs.webm"),void 0===t&&(t=7),!this._canvas||!this._mediaRecorder)throw"Recorder has already been disposed";if(this.isRecording)throw"Recording already in progress";return 0<t&&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})},c.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},c.prototype._handleDataAvailable=function(e){0<e.data.size&&this._recordedChunks.push(e.data)},c.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},c.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&n.b.Download(e,this._fileName)},c._defaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},c);function c(e,t){if(void 0===t&&(t=null),!c.IsSupported(e))throw"Your browser does not support recording so far.";var i=e.getRenderingCanvas();if(!i)throw"The babylon engine must have a canvas to be recorded";this._canvas=i,this._canvas.isRecording=!1,this._options=Object(s.a)(Object(s.a)({},c._defaultOptions),t);var n=this._canvas.captureStream(this._options.fps);if(this._options.audioTracks)for(var r=0,o=this._options.audioTracks;r<o.length;r++){var a=o[r];n.addTrack(a)}this._mediaRecorder=new MediaRecorder(n,{mimeType:this._options.mimeType}),this._mediaRecorder.ondataavailable=this._handleDataAvailable.bind(this),this._mediaRecorder.onerror=this._handleError.bind(this),this._mediaRecorder.onstop=this._handleStop.bind(this)}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var y=i(9),T=i(39),E=i(151),S=i(2),A=i(7),C=i(13),n=(P.CreateScreenshot=function(e,t,i,n,r){void 0===r&&(r="image/png");var o,a,s,c,l,u,h,d=P._getScreenshotSize(e,t,i),p=d.height,f=d.width;p&&f?(C.b._ScreenshotCanvas||(C.b._ScreenshotCanvas=document.createElement("canvas")),C.b._ScreenshotCanvas.width=f,C.b._ScreenshotCanvas.height=p,o=C.b._ScreenshotCanvas.getContext("2d"),p<(c=(s=f)/(a=e.getRenderWidth()/e.getRenderHeight()))&&(s=(c=p)*a),l=Math.max(0,f-s)/2,u=Math.max(0,p-c)/2,h=e.getRenderingCanvas(),o&&h&&o.drawImage(h,l,u,s,c),C.b.EncodeScreenshotCanvasData(n,r)):A.a.Error("Invalid 'size' parameter !")},P.CreateScreenshotAsync=function(e,n,r,o){return void 0===o&&(o="image/png"),new Promise(function(t,i){P.CreateScreenshot(e,n,r,function(e){void 0!==e?t(e):i(new Error("Data is undefined"))},o)})},P.CreateScreenshotUsingRenderTarget=function(e,t,i,n,r,o,a,s,c){void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===a&&(a=!1),void 0===c&&(c=!1);var l,u,h,d,p,f,m,_=P._getScreenshotSize(e,t,i),g=_.height,v=_.width,b={width:v,height:g};
1g&&v?(l=t.getScene(),u=null,l.activeCamera!==t&&(u=l.activeCamera,l.activeCamera=t),(h=e.getRenderingCanvas())?(d={width:h.width,height:h.height},e.setSize(v,g),l.render(),(p=new T.a("screenShot",b,l,!1,!1,S.a.TEXTURETYPE_UNSIGNED_INT,!1,y.a.NEAREST_SAMPLINGMODE)).renderList=null,p.samples=o,p.renderSprites=c,p.onAfterRenderObservable.add(function(){C.b.DumpFramebuffer(v,g,e,n,r,s)}),f=function(){l.incrementRenderId(),l.resetCachedMaterial(),p.render(!0),p.dispose(),u&&(l.activeCamera=u),e.setSize(d.width,d.height),t.getProjectionMatrix(!0)},a?(m=new E.a("antialiasing",1,l.activeCamera),p.addPostProcess(m),m.getEffect().isReady()?f():m.getEffect().onCompiled=function(){f()}):f()):A.a.Error("No rendering canvas found !")):A.a.Error("Invalid 'size' parameter !")},P.CreateScreenshotUsingRenderTargetAsync=function(e,n,r,o,a,s,c,l){return void 0===o&&(o="image/png"),void 0===a&&(a=1),void 0===s&&(s=!1),void 0===l&&(l=!1),new Promise(function(t,i){P.CreateScreenshotUsingRenderTarget(e,n,r,function(e){void 0!==e?t(e):i(new Error("Data is undefined"))},o,a,s,c,l)})},P._getScreenshotSize=function(e,t,i){var n,r=0,o=0;return"object"==typeof i?(n=i.precision?Math.abs(i.precision):1,i.width&&i.height?(r=i.height*n,o=i.width*n):i.width&&!i.height?(o=i.width*n,r=Math.round(o/e.getAspectRatio(t))):i.height&&!i.width?(r=i.height*n,o=Math.round(r*e.getAspectRatio(t))):(o=Math.round(e.getRenderWidth()*n),r=Math.round(o/e.getAspectRatio(t)))):isNaN(i)||(o=r=i),o=o&&Math.floor(o),{height:0|(r=r&&Math.floor(r)),width:0|o}},P);function P(){}C.b.CreateScreenshot=n.CreateScreenshot,C.b.CreateScreenshotAsync=n.CreateScreenshotAsync,C.b.CreateScreenshotUsingRenderTarget=n.CreateScreenshotUsingRenderTarget,C.b.CreateScreenshotUsingRenderTargetAsync=n.CreateScreenshotUsingRenderTargetAsync},function(e,t,i){"use strict";var n,r;i.d(t,"a",function(){return n}),(r=n=n||{})[r.Checkbox=0]="Checkbox",r[r.Slider=1]="Slider",r[r.Vector3=2]="Vector3",r[r.Quaternion=3]="Quaternion",r[r.Color3=4]="Color3",r[r.String=5]="String"},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(41),r=(o.prototype.loadAsync=function(e){var t=this;return delete this._dataView,delete this._dataByteOffset,this.buffer.readAsync(this.byteOffset,e).then(function(e){t._dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),t._dataByteOffset=0})},o.prototype.readUint32=function(){var e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e},o.prototype.readUint8Array=function(e){var t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t},o.prototype.readString=function(e){return n.a.Decode(this.readUint8Array(e))},o.prototype.skipBytes=function(e){this._dataByteOffset+=e,this.byteOffset+=e},o);function o(e){this.byteOffset=0,this.buffer=e}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=(r._GetStorage=function(){try{return localStorage.setItem("test",""),localStorage.removeItem("test"),localStorage}catch(e){var i={};return{getItem:function(e){var t=i[e];return void 0===t?null:t},setItem:function(e,t){i[e]=t}}}},r.ReadString=function(e,t){var i=this._Storage.getItem(e);return null!==i?i:t},r.WriteString=function(e,t){this._Storage.setItem(e,t)},r.ReadBoolean=function(e,t){var i=this._Storage.getItem(e);return null!==i?"true"===i:t},r.WriteBoolean=function(e,t){this._Storage.setItem(e,t?"true":"false")},r.ReadNumber=function(e,t){var i=this._Storage.getItem(e);return null!==i?parseFloat(i):t},r.WriteNumber=function(e,t){this._Storage.setItem(e,t.toString())},r._Storage=r._GetStorage(),r);function r(){}},function(e,t){},function(e,t,i){"use strict";var me,c,r,a,A,n,o,s,l,u;i.d(t,"R",function(){return me}),i.d(t,"Q",function(){return c}),i.d(t,"P",function(){return r}),i.d(t,"Y",function(){return a}),i.d(t,"W",function(){return A}),i.d(t,"T",function(){return h}),i.d(t,"U",function(){return d}),i.d(t,"S",function(){return g}),i.d(t,"O",function(){return b}),i.d(t,"V",function(){return ze}),i.d(t,"N",function(){return je}),i.d(t,"Jb",function(){return z}),i.d(t,"f",function(){return Ye}),i.d(t,"B",function(){return qe}),i.d(t,"J",function(){return $e}),i.d(t,"F",function(){return nt}),i.d(t,"u",function(){return H}),i.d(t,"z",function(){return at}),i.d(t,"gb",function(){return lt}),i.d(t,"o",function(){return dt}),i.d(t,"w",function(){return mt}),i.d(t,"m",function(){return vt}),i.d(t,"t",function(){return Tt}),i.d(t,"wb",function(){return At}),i.d(t,"s",function(){return xt}),i.d(t,"E",function(){return Mt}),i.d(t,"Db",function(){return Lt}),i.d(t,"ob",function(){return kt}),i.d(t,"l",function(){return ae}),i.d(t,"A",function(){return te}),i.d(t,"c",function(){return Y}),i.d(t,"K",function(){return De}),i.d(t,"a",function(){return jt}),i.d(t,"vb",function(){return Xt}),i.d(t,"g",function(){return Qt}),i.d(t,"k",function(){return Jt}),i.d(t,"r",function(){return ti}),i.d(t,"Eb",function(){return F}),i.d(t,"sb",function(){return Oe}),i.d(t,"ab",function(){return ai}),i.d(t,"Gb",function(){return ni}),i.d(t,"Fb",function(){return li}),i.d(t,"i",function(){return di}),i.d(t,"Hb",function(){return Ce}),i.d(t,"j",function(){return we}),i.d(t,"Ib",function(){return mi}),i.d(t,"D",function(){return vi}),i.d(t,"q",function(){return Ti}),i.d(t,"Cb",function(){return Ai}),i.d(t,"Ab",function(){return xi}),i.d(t,"bb",function(){return Mi}),i.d(t,"Kb",function(){return Li}
1),i.d(t,"v",function(){return wi}),i.d(t,"G",function(){return Vi}),i.d(t,"H",function(){return zi}),i.d(t,"p",function(){return Hi}),i.d(t,"C",function(){return Ki}),i.d(t,"M",function(){return Zi}),i.d(t,"ib",function(){return en}),i.d(t,"kb",function(){return rn}),i.d(t,"e",function(){return sn}),i.d(t,"zb",function(){return un}),i.d(t,"lb",function(){return pn}),i.d(t,"tb",function(){return _n}),i.d(t,"hb",function(){return Tn}),i.d(t,"Mb",function(){return vn}),i.d(t,"Lb",function(){return An}),i.d(t,"y",function(){return xn}),i.d(t,"x",function(){return Rn}),i.d(t,"L",function(){return In}),i.d(t,"Nb",function(){return Nn}),i.d(t,"yb",function(){return Bn}),i.d(t,"Z",function(){return kn}),i.d(t,"ub",function(){return jn}),i.d(t,"mb",function(){return Xn}),i.d(t,"qb",function(){return Qn}),i.d(t,"n",function(){return Jn}),i.d(t,"cb",function(){return Lr}),i.d(t,"xb",function(){return cr}),i.d(t,"b",function(){return rr}),i.d(t,"pb",function(){return hr}),i.d(t,"d",function(){return _r}),i.d(t,"nb",function(){return yr}),i.d(t,"h",function(){return Sr}),i.d(t,"rb",function(){return Pr}),i.d(t,"Bb",function(){return Or}),i.d(t,"fb",function(){return le}),i.d(t,"eb",function(){return de}),i.d(t,"db",function(){return _e}),i.d(t,"I",function(){return wr}),i.d(t,"X",function(){return Ur}),i.d(t,"jb",function(){return ve}),i.d(t,"Ob",function(){return xe}),(u=me=me||{})[u.Vertex=1]="Vertex",u[u.Fragment=2]="Fragment",u[u.Neutral=4]="Neutral",u[u.VertexAndFragment=3]="VertexAndFragment",(l=c=c||{})[l.Float=1]="Float",l[l.Int=2]="Int",l[l.Vector2=4]="Vector2",l[l.Vector3=8]="Vector3",l[l.Vector4=16]="Vector4",l[l.Color3=32]="Color3",l[l.Color4=64]="Color4",l[l.Matrix=128]="Matrix",l[l.Object=256]="Object",l[l.AutoDetect=1024]="AutoDetect",l[l.BasedOnInput=2048]="BasedOnInput",(s=r=r||{})[s.Uniform=0]="Uniform",s[s.Attribute=1]="Attribute",s[s.Varying=2]="Varying",s[s.Undefined=3]="Undefined",(o=a=a||{})[o.World=1]="World",o[o.View=2]="View",o[o.Projection=3]="Projection",o[o.ViewProjection=4]="ViewProjection",o[o.WorldView=5]="WorldView",o[o.WorldViewProjection=6]="WorldViewProjection",o[o.CameraPosition=7]="CameraPosition",o[o.FogColor=8]="FogColor",o[o.DeltaTime=9]="DeltaTime",(n=A=A||{})[n.Material=0]="Material",n[n.PostProcess=1]="PostProcess",n[n.Particle=2]="Particle";var h,d,p,f,m=i(6);(f=h=h||{})[f.Compatible=0]="Compatible",f[f.TypeIncompatible=1]="TypeIncompatible",f[f.TargetIncompatible=2]="TargetIncompatible",(p=d=d||{})[p.Input=0]="Input",p[p.Output=1]="Output";var _,g=(Object.defineProperty(k.prototype,"direction",{get:function(){return this._direction},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"associatedVariableName",{get:function(){return this._ownerBlock.isInput?this._ownerBlock.associatedVariableName:this._enforceAssociatedVariableName&&this._associatedVariableName||!this._connectedPoint?this._associatedVariableName:this._connectedPoint.associatedVariableName},set:function(e){this._associatedVariableName=e},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"innerType",{get:function(){return this._linkedConnectionSource&&this._linkedConnectionSource.isConnected?this.type:this._type},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"type",{get:function(){if(this._type===c.AutoDetect){if(this._ownerBlock.isInput)return this._ownerBlock.type;if(this._connectedPoint)return this._connectedPoint.type;if(this._linkedConnectionSource&&this._linkedConnectionSource.isConnected)return this._linkedConnectionSource.type}return this._type===c.BasedOnInput&&this._typeConnectionSource?this._typeConnectionSource.type:this._type},set:function(e){this._type=e},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"target",{get:function(){return this._prioritizeVertex&&this._ownerBlock&&this._target===me.VertexAndFragment?this._ownerBlock.target===me.Fragment?me.Fragment:me.Vertex:this._target},set:function(e){this._target=e},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isConnected",{get:function(){return null!==this.connectedPoint||this.hasEndpoints}
1,enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isConnectedToInputBlock",{get:function(){return null!==this.connectedPoint&&this.connectedPoint.ownerBlock.isInput},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"connectInputBlock",{get:function(){return this.isConnectedToInputBlock?this.connectedPoint.ownerBlock:null},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"connectedPoint",{get:function(){return this._connectedPoint},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"ownerBlock",{get:function(){return this._ownerBlock},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"sourceBlock",{get:function(){return this._connectedPoint?this._connectedPoint.ownerBlock:null},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"connectedBlocks",{get:function(){return 0===this._endpoints.length?[]:this._endpoints.map(function(e){return e.ownerBlock})},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"endpoints",{get:function(){return this._endpoints},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasEndpoints",{get:function(){return this._endpoints&&0<this._endpoints.length},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isConnectedInVertexShader",{get:function(){if(this.target===me.Vertex)return!0;if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e<t.length;e++){var i=t[e];if(i.ownerBlock.target===me.Vertex)return!0;if(i.target===me.Vertex)return!0;if((i.ownerBlock.target===me.Neutral||i.ownerBlock.target===me.VertexAndFragment)&&i.ownerBlock.outputs.some(function(e){return e.isConnectedInVertexShader}))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isConnectedInFragmentShader",{get:function(){if(this.target===me.Fragment)return!0;if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e<t.length;e++){var i=t[e];if(i.ownerBlock.target===me.Fragment)return!0;if((i.ownerBlock.target===me.Neutral||i.ownerBlock.target===me.VertexAndFragment)&&i.ownerBlock.outputs.some(function(e){return e.isConnectedInFragmentShader}))return!0}return!1},enumerable:!1,configurable:!0}),k.prototype.createCustomInputBlock=function(){return null},k.prototype.getClassName=function(){return"NodeMaterialConnectionPoint"},k.prototype.canConnectTo=function(e){return this.checkCompatibilityState(e)===h.Compatible},k.prototype.checkCompatibilityState=function(e){if(this._ownerBlock.target===me.Fragment){var t=e.ownerBlock;if(t.target===me.Vertex)return h.TargetIncompatible;for(var i=0,n=t.outputs;i<n.length;i++)if(n[i].isConnectedInVertexShader)return h.TargetIncompatible}if(this.type===e.type||e.innerType===c.AutoDetect)return e.excludedConnectionPointTypes&&-1!==e.excludedConnectionPointTypes.indexOf(this.type)?1:h.Compatible;switch(this.type){case c.Vector3:if(e.type===c.Color3)return h.Compatible;break;case c.Vector4:if(e.type===c.Color4)return h.Compatible;break;case c.Color3:if(e.type===c.Vector3)return h.Compatible;break;case c.Color4:if(e.type===c.Vector4)return h.Compatible}return e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)?h.Compatible:h.TypeIncompatible},k.prototype.connectTo=function(e,t){if(void 0===t&&(t=!1),!t&&!this.canConnectTo(e))throw"Cannot connect these two connectors.";return this._endpoints.push(e),(e._connectedPoint=this)._enforceAssociatedVariableName=!1,this.onConnectionObservable.notifyObservers(e),e.onConnectionObservable.notifyObservers(this),this},k.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t||(this._endpoints.splice(t,1),e._connectedPoint=null,this._enforceAssociatedVariableName=!1,e._enforceAssociatedVariableName=!1),this},k.prototype.serialize=function(e){void 0===e&&(e=!0);var t={};return t.name=this.name,t.displayName=this.displayName,e&&this.connectedPoint&&(t.inputName=this.name,t.targetBlockId=this.connectedPoint.ownerBlock.uniqueId,t.targetConnectionName=this.connectedPoint.name),this.isExposedOnFrame&&(t.isExposedOnFrame=this.isExposedOnFrame),t},k.prototype.dispose=function(){this.onConnectionObservable.clear()},k),v=i(301),y=i(11),b=(Object.defineProperty(V.prototype,"name",{get:function(){return this._name},set:function(e){this.validateBlockName(e)&&(this._name=e)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUnique",{get:function(){return this._isUnique},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isFinalMerger",{get:function(){return this._isFinalMerger},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isInput",{get:function(){return this._isInput},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"target",{get:function(){return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"inputs",{get:function(){return this._inputs},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"outputs",{get:function(){return this._outputs},enumerable:!1,configurable:!0}),V.prototype.getInputByName=function(t){var e=this._inputs.filter(function(e){return e.name===t});return e.length?e[0]:null},V.prototype.getOutputByName=function(t){var e=this._outputs.filter(function(e){return e.name===t});return e.length?e[0]:null},V.prototype.initialize=function(e){},V.prototype.bind=function(e,t,i,n){},V.prototype._declareOutput=function(e,t){return t._getGLType(e.type)+" "+e.associatedVariableName},V.prototype._writeVariable=function(e){return e.connectedPoint?""+e.associatedVariableName:"0."},V.prototype._writeFloat=function(e){var t=e.toString();return-1===t.indexOf(".")&&(t+=".0"),""+t},V.prototype.getClassName=function(){return"NodeMaterialBlock"},V.prototype.registerInput=function(e,t,i,n,r){return void 0===i&&(i=!1),(r=null!=r?r:new g(e,this,d.Input)).type=t,r.isOptional=i,n&&(r.target=n),this._inputs.push(r),this},V.prototype.registerOutput=function(e,t,i,n){return(n=null!=n?n:new g(e,this,d.Output)).type=t,i&&(n.target=i),this._outputs.push(n),this},V.prototype.getFirstAvailableInput=function(e){void 0===e&&(e=null);for(var t=0,i=this._inputs;t<i.length;t++){var n=i[t];if(!(n.connectedPoint||e&&e.type!==n.type&&n.type!==c.AutoDetect))return n}return null},V.prototype.getFirstAvailableOutput=function(e){void 0===e&&(e=null);for(var t=0,i=this._outputs;t<i.length;t++){var n=i[t];if(!e||!e.target||e.target===me.Neutral||0!=(e.target&n.target))return n}return null},V.prototype.getSiblingOutput=function(e){var t=this._outputs.indexOf(e);return-1===t||t>=this._outputs.length?null:this._outputs[t+1]},V.prototype.connectTo=function(e,t){if(0!==this._outputs.length){for(var i=t&&t.output?this.getOutputByName(t.output):this.getFirstAvailableOutput(e),n=!0;n;){var r=t&&t.input?e.getInputByName(t.input):e.getFirstAvailableInput(i);if(i&&r&&i.canConnectTo(r))i.connectTo(r),n=!1;else{if(!i)throw"Unable to find a compatible match";i=this.getSiblingOutput(i)}}return this}},V.prototype._buildBlock=function(e){},V.prototype.updateUniformsAndSamples=function(e,t,i,n){},V.prototype.provideFallbacks=function(e,t){},V.prototype.initializeDefines=function(e,t,i,n){void 0===n&&(n=!1)},V.prototype.prepareDefines=function(e,t,i,n,r){void 0===n&&(n=!1)},V.prototype.autoConfigure=function(e){},V.prototype.replaceRepeatableContent=function(e,t,i,n){},V.prototype.isReady=function(e,t,i,n){return void 0===n&&(n=!1),!0},V.prototype._linkConnectionTypes=function(e,t){this._inputs[e]._linkedConnectionSource=this._inputs[t],this._inputs[t]._linkedConnectionSource=this._inputs[e]},V.prototype._processBuild=function(e,t,i,n){e.build(t,n);var r,o=null!=t._vertexState,a=e._buildTarget===me.Vertex&&e.target!==me.VertexAndFragment;o&&(0==(e.target&e._buildTarget)||0==(e.target&i.target)||this.target!==me.VertexAndFragment&&a)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute&&!e._noContextSwitch)&&(r=i.connectedPoint,t._vertexState._emitVaryingFromString("v_"+r.associatedVariableName,t._getGLType(r.type))&&(t._vertexState.compilationString+="v_"+r.associatedVariableName+" = "+r.associatedVariableName+";\r\n"),i.associatedVariableName="v_"+r.associatedVariableName,i._enforceAssociatedVariableName=!0)},V.prototype.validateBlockName=function(e){for(var t=0,i=["position","normal","tangent","particle_positionw","uv","uv2","position2d","particle_uv","matricesIndices","matricesWeights","world0","world1","world2","world3","particle_c
1olor","particle_texturemask"];t<i.length;t++)if(e===i[t])return!1;return!0},V.prototype.build=function(e,t){if(this._buildId===e.sharedData.buildId)return!0;if(!this.isInput)for(var i=0,n=this._outputs;i<n.length;i++)(s=n[i]).associatedVariableName||(s.associatedVariableName=e._getFreeVariableName(s.name));for(var r=0,o=this._inputs;r<o.length;r++){var a=o[r];if(a.connectedPoint){if(this.target!==me.Neutral){if(0==(a.target&this.target))continue;if(0==(a.target&e.target))continue}(d=a.connectedPoint.ownerBlock)&&d!==this&&this._processBuild(d,e,a,t)}else a.isOptional||e.sharedData.checks.notConnectedNonOptionalInputs.push(a)}if(this._buildId===e.sharedData.buildId)return!0;if(e.sharedData.verbose&&console.log((e.target===me.Vertex?"Vertex shader":"Fragment shader")+": Building "+this.name+" ["+this.getClassName()+"]"),this.isFinalMerger)switch(e.target){case me.Vertex:e.sharedData.checks.emitVertex=!0;break;case me.Fragment:e.sharedData.checks.emitFragment=!0}!this.isInput&&e.sharedData.emitComments&&(e.compilationString+="\r\n//"+this.name+"\r\n"),this._buildBlock(e),this._buildId=e.sharedData.buildId,this._buildTarget=e.target;for(var s,c=0,l=this._outputs;c<l.length;c++)if(0!=((s=l[c]).target&e.target))for(var u=0,h=s.endpoints;u<h.length;u++){var d,p=h[u];(d=p.ownerBlock)&&0!=(d.target&e.target)&&-1!==t.indexOf(d)&&this._processBuild(d,e,p,t)}return!1},V.prototype._inputRename=function(e){return e},V.prototype._outputRename=function(e){return e},V.prototype._dumpPropertiesCode=function(){return""},V.prototype._dumpCode=function(e,t){var i;t.push(this);var n=this.name.replace(/[^A-Za-z_]+/g,"");if(this._codeVariableName=n||this.getClassName()+"_"+this.uniqueId,-1!==e.indexOf(this._codeVariableName))for(var r=0;r++,this._codeVariableName=n+r,-1!==e.indexOf(this._codeVariableName););e.push(this._codeVariableName),i="\r\n// "+this.getClassName()+"\r\n",this.comments&&(i+="// "+this.comments+"\r\n"),i+="var "+this._codeVariableName+" = new BABYLON."+this.getClassName()+'("'+this.name+'");\r\n',i+=this._dumpPropertiesCode();for(var o=0,a=this.inputs;o<a.length;o++){var s,c=a[o];c.isConnected&&(s=c.connectedPoint.ownerBlock,-1===t.indexOf(s)&&(i+=s._dumpCode(e,t)))}for(var l=0,u=this.outputs;l<u.length;l++){var h=u[l];if(h.hasEndpoints)for(var d=0,p=h.endpoints;d<p.length;d++)(s=p[d].ownerBlock)&&-1===t.indexOf(s)&&(i+=s._dumpCode(e,t))}return i},V.prototype._dumpCodeForOutputConnections=function(e){var t="";if(-1!==e.indexOf(this))return t;e.push(this);for(var i=0,n=this.inputs;i<n.length;i++){var r,o,a=n[i];a.isConnected&&(t+=(o=(r=a.connectedPoint).ownerBlock)._dumpCodeForOutputConnections(e),t+=o._codeVariableName+"."+o._outputRename(r.name)+".connectTo("+this._codeVariableName+"."+this._inputRename(a.name)+");\r\n")}return t},V.prototype.clone=function(e,t){void 0===t&&(t="");var i=this.serialize(),n=y.a.GetClass(i.customType);if(n){var r=new n;return r._deserialize(i,e,t),r}return null},V.prototype.serialize=function(){var e={};e.customType="BABYLON."+this.getClassName(),e.id=this.uniqueId,e.name=this.name,e.comments=this.comments,e.inputs=[],e.outputs=[];for(var t=0,i=this.inputs;t<i.length;t++){var n=i[t];e.inputs.push(n.serialize())}for(var r=0,o=this.outputs;r<o.length;r++){var a=o[r];e.outputs.push(a.serialize(!1))}return e},V.prototype._deserialize=function(e,t,i){this.name=e.name,this.comments=e.comments,this._deserializePortDisplayNamesAndExposedOnFrame(e)},V.prototype._deserializePortDisplayNamesAndExposedOnFrame=function(e){var i=this,t=e.inputs,n=e.outputs;t&&t.forEach(function(e,t){e.displayName&&(i.inputs[t].displayName=e.displayName),e.isExposedOnFrame&&(i.inputs[t].isExposedOnFrame=e.isExposedOnFrame)}),n&&n.forEach(function(e,t){e.displayName&&(i.outputs[t].displayName=e.displayName),e.isExposedOnFrame&&(i.outputs[t].isExposedOnFrame=e.isExposedOnFrame)})},V.prototype.dispose=function(){for(var e=0,t=this.inputs;e<t.length;e++)t[e].dispose();for(var i=0,n=this.outputs;i<n.length;i++)n[i].dispose()},V),T=i(1),E=i(119),S=i(28),C=i(0),P=i(10),x=i(12),R=i(5),O=i(41),M=(U.prototype.finalize=function(e){var t=e.sharedData.emitComments,i=this.target===me.Fragment;this.compilationString="\r\n"+(t?"//Entry point\r\n":"")+"void main(void) {\r\n"+this.compilationString,this._constantDeclaration&&(this.compilationString="\r\n"+(t?"//Constants\r\n":"")+this._constantDeclaration+"\r\n"+this.compilationString);var n="";for(var r in this.functions)n+=this.functions[r]+"\r\n";for(var o in this.compilationString="\r\n"+n+"\r\n"+this.compilationString,!i&&this._varyingTransfer&&(this.compilationString=this.compilationString+"\r\n"+this._varyingTransfer),this._injectAtEnd&&(this.compilationString=this.compilationString+"\r\n"+this._injectAtEnd),this.compilationString=this.compilationString+"\r\n}",this.sharedData.varyingDeclaration&&(this.compilationString="\r\n"+(t?"//Varyings\r\n":"")+this.sharedData.varyingDeclaration+"\r\n"+this.compilationString),this._samplerDeclaration&&(this.compilationString="\r\n"+(t?"//Samplers\r\n":"")+this._samplerDeclaration+"\r\n"+this.compilationString),this._uniformDeclaration&&(this.compilationString="\r\n"+(t?"//Uniforms\r\n":"")+this._uniformDeclaration+"\r\n"+this.compilationString),this._attributeDeclaration&&!i&&(this.compilationString="\r\n"+(t?"//Attributes\r\n":"")+this._attributeDeclaration+"\r\n"+this.compilationString),this.extensions){var a=this.extensions[o];this.compilationString="\r\n"+a+"\r\n"+this.compilationString}this._builtCompilationString=this.compilationString},Object.defineProperty(U.prototype,"_repeatableContentAnchor",{get:function(){return"###___ANCHOR"+this._repeatableContentAnchorIndex+++"___###"}
1,enumerable:!1,configurable:!0}),U.prototype._getFreeVariableName=function(e){return e=e.replace(/[^a-zA-Z_]+/g,""),void 0===this.sharedData.variableNames[e]?(this.sharedData.variableNames[e]=0,"output"===e||"texture"===e?e+this.sharedData.variableNames[e]:e):(this.sharedData.variableNames[e]++,e+this.sharedData.variableNames[e])},U.prototype._getFreeDefineName=function(e){return void 0===this.sharedData.defineNames[e]?this.sharedData.defineNames[e]=0:this.sharedData.defineNames[e]++,e+this.sharedData.defineNames[e]},U.prototype._excludeVariableName=function(e){this.sharedData.variableNames[e]=0},U.prototype._emit2DSampler=function(e){this._samplerDeclaration+="uniform sampler2D "+e+";\r\n",this.samplers.push(e)},U.prototype._getGLType=function(e){switch(e){case c.Float:return"float";case c.Int:return"int";case c.Vector2:return"vec2";case c.Color3:case c.Vector3:return"vec3";case c.Color4:case c.Vector4:return"vec4";case c.Matrix:return"mat4"}return""},U.prototype._emitExtension=function(e,t,i){void 0===i&&(i=""),this.extensions[e]||(i&&(t="#if "+i+"\r\n"+t+"\r\n#endif"),this.extensions[e]=t)},U.prototype._emitFunction=function(e,t,i){this.functions[e]||(this.sharedData.emitComments&&(t=i+"\r\n"+t),this.functions[e]=t)},U.prototype._emitCodeFromInclude=function(e,t,i){if(i&&i.repeatKey)return"#include<"+e+">[0.."+i.repeatKey+"]\r\n";var n=R.a.IncludesShadersStore[e]+"\r\n";if(this.sharedData.emitComments&&(n=t+"\r\n"+n),!i)return n;if(i.replaceStrings)for(var r=0;r<i.replaceStrings.length;r++)var o=i.replaceStrings[r],n=n.replace(o.search,o.replace);return n},U.prototype._emitFunctionFromInclude=function(e,t,i,n){void 0===n&&(n="");var r=e+n;if(!this.functions[r]){if(!i||!(i.removeAttributes||i.removeUniforms||i.removeVaryings||i.removeIfDef||i.replaceStrings))return i&&i.repeatKey?this.functions[r]="#include<"+e+">[0.."+i.repeatKey+"]\r\n":this.functions[r]="#include<"+e+">\r\n",void(this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]));if(this.functions[r]=R.a.IncludesShadersStore[e],this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]),i.removeIfDef&&(this.functions[r]=this.functions[r].replace(/^\s*?#ifdef.+$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#endif.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#else.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#elif.*$/gm,"")),i.removeAttributes&&(this.functions[r]=this.functions[r].replace(/^\s*?attribute.+$/gm,"")),i.removeUniforms&&(this.functions[r]=this.functions[r].replace(/^\s*?uniform.+$/gm,"")),i.removeVaryings&&(this.functions[r]=this.functions[r].replace(/^\s*?varying.+$/gm,"")),i.replaceStrings)for(var o=0;o<i.replaceStrings.length;o++){var a=i.replaceStrings[o];this.functions[r]=this.functions[r].replace(a.search,a.replace)}}},U.prototype._registerTempVariable=function(e){return-1===this.sharedData.temps.indexOf(e)&&(this.sharedData.temps.push(e),!0)},U.prototype._emitVaryingFromString=function(e,t,i,n){return void 0===i&&(i=""),void 0===n&&(n=!1),-1===this.sharedData.varyings.indexOf(e)&&(this.sharedData.varyings.push(e),i&&(O.a.StartsWith(i,"defined(")?this.sharedData.varyingDeclaration+="#if "+i+"\r\n":this.sharedData.varyingDeclaration+=(n?"#ifndef":"#ifdef")+" "+i+"\r\n"),this.sharedData.varyingDeclaration+="varying "+t+" "+e+";\r\n",i&&(this.sharedData.varyingDeclaration+="#endif\r\n"),!0)},U.prototype._emitUniformFromString=function(e,t,i,n){void 0===i&&(i=""),void 0===n&&(n=!1),-1===this.uniforms.indexOf(e)&&(this.uniforms.push(e),i&&(O.a.StartsWith(i,"defined(")?this._uniformDeclaration+="#if "+i+"\r\n":this._uniformDeclaration+=(n?"#ifndef":"#ifdef")+" "+i+"\r\n"),this._uniformDeclaration+="uniform "+t+" "+e+";\r\n",i&&(this._uniformDeclaration+="#endif\r\n"))},U.prototype._emitFloat=function(e){return e.toString()===e.toFixed(0)?e+".0":e.toString()},U),I=(B.prototype.emitErrors=function(){var e="";this.checks.emitVertex||this.allowEmptyVertexProgram||(e+="NodeMaterial does not have a vertex output. You need to at least add a block that generates a glPosition value.\r\n"),this.checks.emitFragment||(e+="NodeMaterial does not have a fragment output. You need to at least add a block that generates a glFragColor value.\r\n");for(var t=0,i=this.checks.notConnectedNonOptionalInputs;t<i.length;t++){var n=i[t];e+="input "+n.name+" from block "+n.ownerBlock.name+"["+n.ownerBlock.getClassName()+"] is not connected and is not optional.\r\n"}if(e)throw"Build of NodeMaterial failed:\r\n"+e},B),D=i(101),L=i(4),N=i(13),F=(_=b,Object(T.d)(w,_),w.prototype.getClassName=function(){return"TransformBlock"},Object.defineProperty(w.prototype,"vector",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"transform",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),w.prototype._buildBlock=function(e){_.prototype._buildBlock.call(this,e);var t=this.vector,i=this.transform;if(t.connectedPoint){if(0===this.complementW){var n="//"+this.name;e._emitFunctionFromInclude("helperFunctions",n),e.sharedData.blocksWithDefines.push(this);var r=e._getFreeVariableName(i.associatedVariableName+"_NUS");switch(e.compilationString+="mat3 "+r+" = mat3("+i.associatedVariableName+");\r\n",e.compilationString+="#ifdef NONUNIFORMSCALING\r\n",e.compilationString+=r+" = transposeMat3(inverseMat3("+r+"));\r\n",e.compilationString+="#endif\r\n",t.connectedPoint.type){case c.Vector2:e.compilationString+=this._declareOutput(this.output,e)+" = vec4("+r+" * vec3("+t.associatedVariableName+", "+this._writeFloat(this.complementZ)+"), "+this._writeFloat(this.complementW)+");\r\n";break;case c.Vector3:case c.Color3:e.compilationString+=this._declareOutput(this.output,e)+" = vec4("+r+" * "+t.associatedVariableName+", "+this._writeFloat(this.complementW)+");\r\n";break;default:e.compilationString+=this._declareOutput(this.output,e)+" = vec4("+r+" * "+t.associatedVariableName+".xyz, "+this._writeFloat(this.complementW)+");\r\n"}}else switch(r=i.associatedVariableName,t.connectedPoint.type){case c.Vector2:e.compilationString+=this._declareOutput(this.output,e)+" = "+r+" * vec4("+t.associatedVariableName+", "+this._writeFloat(this.complementZ)+", "+this._writeFloat(this.complementW)+");\r\n";break;case c.Vector3:case c.Color3:e.compilationString+=this._declareOutput(this.output,e)+" = "+r+" * vec4("+t.associatedVariableName+", "+this._writeFloat(this.complementW)+");\r\n";break;default:e.compilationString+=this._declareOutput(this.output,e)+" = "+r+" * "+t.associatedVariableName+";\r\n"}this.xyz.hasEndpoints&&(e.compilationString+=this._declareOutput(this.xyz,e)+" = "+this.output.associatedVariableName+".xyz;\r\n")}return this},w.prototype.prepareDefines=function(e,t,i,n,r){void 0===n&&(n=!1),e.nonUniformScaling&&i.setValue("NONUNIFORMSCALING",!0)},w.prototype.serialize=function(){var e=_.prototype.serialize.call(this);return e.complementZ=this.complementZ,e.complementW=this.complementW,e},w.prototype._deserialize=function(e,t,i){_.prototype._deserialize.call(this,e,t,i),this.complementZ=void 0!==e.complementZ?e.complementZ:0,this.complementW=void 0!==e.complementW?e.complementW:1},w.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".complementZ = "+this.complementZ+";\r\n"+this._codeVariableName+".complementW = "+this.complementW+";\r\n"},w);function w(e){var i=_.call(this,e,me.Vertex)||this;return i.complementW=1,i.complementZ=0,i.registerInput("vector",c.AutoDetect),i.registerInput("transform",c.Matrix),i.registerOutput("output",c.Vector4),i.registerOutput("xyz",c.Vector3),i._inputs[0].onConnectionObservable.add(function(e){var t;e.ownerBlock.isInput&&("normal"!==(t=e.ownerBlock).name&&"tangent"!==t.name||(i.complementW=0))}),i}function B(){this.temps=new Array,this.varyings=new Array,this.varyingDeclaration="",this.inputBlocks=new Array,this.textureBlocks=new Array,this.bindableBlocks=new Array,this.blocksWithFallbacks=new Array,this.blocksWithDefines=new Array,this.repeatableContentBlocks=new Array,this.dynamicUniformBlocks=new Array,this.blockingBlocks=new Array,this.animatedInputs=new Array,this.variableNames={},this.defineNames={},this.hints={needWorldViewMatrix:!1,needWorldViewProjectionMatrix:!1,needAlphaBlending:!1,needAlphaTesting:!1},this.checks={emitVertex:!1,emitFragment:!1,notConnectedNonOptionalInputs:new Array},this.allowEmptyVertexProgram=!1,this.variableNames.position=0,this.variableNames.normal=0,this.variableNames.tangent=0,this.variableNames.uv=0,this.variableNames.uv2=0,this.variableNames.uv3=0,this.variableNames.uv4=0,this.variableNames.uv4=0,this.variableNames.uv5=0,this.variableNames.uv6=0,this.variableNames.color=0,this.variableNames.matricesIndices=0,this.variableNames.matricesWeights=0,this.variableNames.matricesIndicesExtra=0,this.variableNames.matricesWeightsExtra=0,this.variableNames.diffuseBase=0,this.variableNames.specularBase=0,this.variableNames.worldPos=0,this.variableNames.shadow=0,this.variableNames.vTBN=0,this.defineNames.MAINUV0=0,this.defineNames.MAINUV1=0,this.defineNames.MAINUV2=0,this.defineNames.MAINUV3=0,this.defineNames.MAINUV4=0,this.defineNames.MAINUV5=0,this.defineNames.MAINUV6=0,this.defineNames.MAINUV7=0}function U(){this.supportUniformBuffers=!1,this.attributes=new Array,this.uniforms=new Array,this.constants=new Array,this.samplers=new Array,this.functions={},this.extensions={},this.counters={},this._attributeDeclaration="",this._uniformDeclaration="",this._constantDeclaration="",this._samplerDeclaration="",this._varyingTransfer="",this._injectAtEnd="",this._repeatableContentAnchorIndex=0,this._builtCompilationString="",this.compilationString=""}function V(e,t,i,n){void 0===t&&(t=me.Vertex),void 0===i&&(i=!1),void 0===n&&(n=!1),this._isFinalMerger=!1,this._isInput=!1,this._name="",this._isUnique=!1,this.inputsAreExclusive=!1,this._codeVariableName="",this._inputs=new Array,this._outputs=new Array,this.comments="",this._target=t,this._isFinalMerger=i,this._isInput=n,this._name=e,this.uniqueId=v.a.UniqueId}function k(e,t,i){this._connectedPoint=null,this._endpoints=new Array,this._typeConnectionSource=null,this._linkedConnectionSource=null,this._type=c.Float,this._enforceAssociatedVariableName=!1,this.needDualDirectionValidation=!1,this.acceptedConnectionPointTypes=new Array,this.excludedConnectionPointTypes=new Array,this.onConnectionObservable=new m.c,this.isExposedOnFrame=!1,this._prioritizeVertex=!1,this._target=me.VertexAndFragment,this._ownerBlock=t,this.name=e,this._direction=i}y.a.RegisteredTypes["BABYLON.TransformBlock"]=F;var G,z=(G=b,Object(T.d)(j,G),j.prototype.getClassName=function(){return"VertexOutputBlock"},Object.defineProperty(j.prototype,"vector",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),j.prototype._buildBlock=function(e){G.prototype._buildBlock.call(this,e);var t=this.vector;return e.compilationString+="gl_Position = "+t.associatedVariableName+";\r\n",this},j);function j(e){var t=G.call(this,e,me.Vertex,!0)||this;return t.registerInput("vector",c.Vector4),t}y.a.RegisteredTypes["BABYLON.VertexOutputBlock"]=z;var W,H=(W=b,Object(T.d)(X,W),X.prototype.getClassName=function(){return"FragmentOutputBlock"},Object.defineProperty(X.prototype,"rgba",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rgb",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"a",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),X.prototype._buildBlock=function(e){W.prototype._buildBlock.call(this,e);var t,i=this.rgba,n=this.rgb,r=this.a;return e.sharedData.hints.needAlphaBlending=i.isConnected||r.isConnected,i.connectedPoint?r.isConnected?e.compilationString+="gl_FragColor = vec4("+i.associatedVariableName+".rgb, "+r.associatedVariableName+");\r\n":e.compilationString+="gl_FragColor = "+i.associatedVariableName+";\r\n":n.connectedPoint?(t="1.0",r.connectedPoint&&(t=r.associatedVariableName),n.connectedPoint.type===c.Float?e.compilationString+="gl_FragColor = vec4("+n.associatedVariableName+", "+n.associatedVariableName+", "+n.associatedVariableName+", "+t+");\r\n":e.compilationString+="gl_FragColor = vec4("+n.associatedVariableName+", "+t+");\r\n"):e.sharedData.checks.notConnectedNonOptionalInputs.push(i),this},X);function X(e){var t=W.call(this,e,me.Fragment,!0)||this;return t.registerInput("rgba",c.Color4,!0),t.registerInput("rgb",c.Color3,!0),t.registerInput("a",c.Float,!0),t.rgb.acceptedConnectionPointTypes.push(c.Float),t}y.a.RegisteredTypes["BABYLON.FragmentOutputBlock"]=H;var Y,K,Q=i(33);(K=Y=Y||{})[K.None=0]="None",K[K.Time=1]="Time";var q,Z=i(15),J={position2d:"position",particle_uv:"vUV",particle_color:"vColor",particle_texturemask:"textureMask",particle_positionw:"vPositionW"},$={particle_uv:!0,particle_color:!0,particle_texturemask:!0,particle_positionw:!0},ee={particle_texturemask:!0},te=(q=b,Object(T.d)(ie,q),Object.defineProperty(ie.prototype,"type",{get:function(){if(this._type===c.AutoDetect){if(this.isUniform&&null!=this.value){if(!isNaN(this.value))return this._type=c.Float,this._type;switch(this.value.getClassName()){case"Vector2":return this._type=c.Vector2,this._type;case"Vector3":return this._type=c.Vector3,this._type;case"Vector4":return this._type=c.Vector4,this._type;case"Color3":return this._type=c.Color3,this._type;case"Color4":return this._type=c.Color4,this._type;case"Matrix":return this._type=c.Matrix,this._type}}if(this.isAttribute)switch(this.name){case"position":case"normal":case"tangent":case"particle_positionw":return this._type=c.Vector3,this._type;case"uv":case"uv2":case"position2d":case"particle_uv":return this._type=c.Vector2,this._type;case"matricesIndices":case"matricesWeights":case"world0":case"world1":case"world2":case"world3":return this._type=c.Vector4,this._type;case"color":case"particle_color":case"particle_texturemask":return this._type=c.Color4,this._type}if(this.isSystemValue)switch(this._systemValue){case a.World:case a.WorldView:case a.WorldViewProjection:case a.View:case a.ViewProjection:case a.Projection:return this._type=c.Matrix,this._type;case a.CameraPosition:return this._type=c.Vector3,this._type;case a.FogColor:return this._type=c.Color3,this._type;case a.DeltaTime:return this._type=c.Float,this._type}}return this._type},enumerable:!1,configurable:!0}),ie.prototype.validateBlockName=function(e){return!!this.isAttribute||q.prototype.validateBlockName.call(this,e)},Object.defineProperty(ie.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ie.prototype.setAsAttribute=function(e){return this._mode=r.Attribute,e&&(this.name=e),this},ie.prototype.setAsSystemValue=function(e){return this.systemValue=e,this},Object.defineProperty(ie.prototype,"value",{get:function(){return this._storedValue},set:function(e){this.type===c.Float&&(this.isBoolean?e=e?1:0:this.min!==this.max&&(e=Math.max(this.min,e),e=Math.min(this.max,e))),this._storedValue=e,this._mode=r.Uniform,this.onValueChangedObservable.notifyObservers(this)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"valueCallback",{get:function(){return this._valueCallback},set:function(e){this._valueCallback=e,this._mode=r.Uniform},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"associatedVariableName",{get:function(){return this._associatedVariableName},set:function(e){this._associatedVariableName=e},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"animationType",{get:function(){return this._animationType},set:function(e){this._animationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"isUndefined",{get:function(){return this._mode===r.Undefined},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"isUniform",{get:function(){return this._mode===r.Uniform},set:function(e){this._mode=e?r.Uniform:r.Undefined,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"isAttribute",{get:function(){return this._mode===r.Attribute},set:function(e){this._mode=e?r.Attribute:r.Undefined,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"isVarying",{get:function(){return this._mode===r.Varying},set:function(e){this._mode=e?r.Varying:r.Undefined,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"isSystemValue",{get:function(){return null!=this._systemValue},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"systemValue",{get:function(){return this._systemValue},set:function(e){this._mode=r.Uniform,this.associatedVariableName="",this._systemValue=e},enumerable:!1,configurable:!0}),ie.prototype.getClassName=function(){return"InputBlock"},ie.prototype.animate=function(e){switch(this._animationType){case Y.Time:this.type===c.Float&&(this.value+=.01*e.getAnimationRatio())}},ie.prototype._emitDefine=function(e){return"!"===e[0]?"#ifndef "+e.substring(1)+"\r\n":"#ifdef "+e+"\r\n"},ie.prototype.initialize=function(e){this.associatedVariableName=""},ie.prototype.setDefaultValue=function(){switch(this.type){case c.Float:this.value=0;break;case c.Vector2:this.value=C.d.Zero();break;case c.Vector3:this.value=C.e.Zero();break;case c.Vector4:this.value=C.f.Zero();break;case c.Color3:this.value=Q.e.White();break;case c.Color4:this.value=new Q.f(1,1,1,1);break;case c.Matrix:this.value=C.a.Identity()}},ie.prototype._emitConstant=function(e){switch(this.type){case c.Float:return""+e._emitFloat(this.value);case c.Vector2:return"vec2("+this.value.x+", "+this.value.y+")";case c.Vector3:return"vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")";case c.Vector4:return"vec4("+this.value.x+", "+this.value.y+", "+this.value.z+", "+this.value.w+")";case c.Color3:return"vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")";case c.Color4:return"vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")"}return""},Object.defineProperty(ie.prototype,"_noContextSwitch",{get:function(){return $[this.name]},enumerable:!1,configurable:!0}),ie.prototype._emit=function(e,t){var i;if(this.isUniform){if(this.associatedVariableName||(this.associatedVariableName=e._getFreeVariableName("u_"+this.name)),this.isConstant){if(-1!==e.constants.indexOf(this.associatedVariableName))return;return e.constants.push(this.associatedVariableName),void(e._constantDeclaration+=this._declareOutput(this.output,e)+" = "+this._emitConstant(e)+";\r\n")}if(-1!==e.uniforms.indexOf(this.associatedVariableName))return;e.uniforms.push(this.associatedVariableName),t&&(e._uniformDeclaration+=this._emitDefine(t)),e._uniformDeclaration+="uniform "+e._getGLType(this.type)+" "+this.associatedVariableName+";\r\n",t&&(e._uniformDeclaration+="#endif\r\n");var n=e.sharedData.hints;if(null!==this._systemValue&&void 0!==this._systemValue)switch(this._systemValue){case a.WorldView:n.needWorldViewMatrix=!0;break;case a.WorldViewProjection:n.needWorldViewProjectionMatrix=!0}else this._animationType!==Y.None&&e.sharedData.animatedInputs.push(this)}else if(this.isAttribute){if(this.associatedVariableName=null!==(i=J[this.name])&&void 0!==i?i:this.name,this.target===me.Vertex&&e._vertexState)return void($[this.name]?ee[this.name]?e._emitUniformFromString(this.associatedVariableName,e._getGLType(this.type),t):e._emitVaryingFromString(this.associatedVariableName,e._getGLType(this.type),t):this._emit(e._vertexState,t));if(-1!==e.attributes.indexOf(this.associatedVariableName))return;e.attributes.push(this.associatedVariableName),$[this.name]?ee[this.name]?e._emitUniformFromString(this.associatedVariableName,e._getGLType(this.type),t):e._emitVaryingFromString(this.associatedVariableName,e._getGLType(this.type),t):(t&&(e._attributeDeclaration+=this._emitDefine(t)),e._attributeDeclaration+="attribute "+e._getGLType(this.type)+" "+this.associatedVariableName+";\r\n",t&&(e._attributeDeclaration+="#endif\r\n"))}},ie.prototype._transmitWorld=function(e,t,i,n){if(this._systemValue){var r=this.associatedVariableName;
1switch(this._systemValue){case a.World:e.setMatrix(r,t);break;case a.WorldView:e.setMatrix(r,i);break;case a.WorldViewProjection:e.setMatrix(r,n)}}},ie.prototype._transmit=function(e,t){if(!this.isAttribute){var i=this.associatedVariableName;if(this._systemValue)switch(this._systemValue){case a.World:case a.WorldView:case a.WorldViewProjection:return;case a.View:e.setMatrix(i,t.getViewMatrix());break;case a.Projection:e.setMatrix(i,t.getProjectionMatrix());break;case a.ViewProjection:e.setMatrix(i,t.getTransformMatrix());break;case a.CameraPosition:Z.a.BindEyePosition(e,t,i);break;case a.FogColor:e.setColor3(i,t.fogColor);break;case a.DeltaTime:e.setFloat(i,t.deltaTime/1e3)}else{var n=this._valueCallback?this._valueCallback():this._storedValue;if(null!==n)switch(this.type){case c.Float:e.setFloat(i,n);break;case c.Int:e.setInt(i,n);break;case c.Color3:e.setColor3(i,n);break;case c.Color4:e.setDirectColor4(i,n);break;case c.Vector2:e.setVector2(i,n);break;case c.Vector3:e.setVector3(i,n);break;case c.Vector4:e.setVector4(i,n);break;case c.Matrix:e.setMatrix(i,n)}}}},ie.prototype._buildBlock=function(e){q.prototype._buildBlock.call(this,e),(this.isUniform||this.isSystemValue)&&e.sharedData.inputBlocks.push(this),this._emit(e)},ie.prototype._dumpPropertiesCode=function(){var e=this._codeVariableName;if(this.isAttribute)return e+'.setAsAttribute("'+this.name+'");\r\n';if(this.isSystemValue)return e+".setAsSystemValue(BABYLON.NodeMaterialSystemValues."+a[this._systemValue]+");\r\n";if(this.isUniform){var t=[],i="";switch(this.type){case c.Float:i=""+this.value;break;case c.Vector2:i="new BABYLON.Vector2("+this.value.x+", "+this.value.y+")";break;case c.Vector3:i="new BABYLON.Vector3("+this.value.x+", "+this.value.y+", "+this.value.z+")";break;case c.Vector4:i="new BABYLON.Vector4("+this.value.x+", "+this.value.y+", "+this.value.z+", "+this.value.w+")";break;case c.Color3:i="new BABYLON.Color3("+this.value.r+", "+this.value.g+", "+this.value.b+")";break;case c.Color4:i="new BABYLON.Color4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")";break;case c.Matrix:i="BABYLON.Matrix.FromArray(["+this.value.m+"])"}return t.push(e+".value = "+i),this.type===c.Float&&t.push(e+".min = "+this.min,e+".max = "+this.max,e+".isBoolean = "+this.isBoolean,e+".matrixMode = "+this.matrixMode,e+".animationType = BABYLON.AnimatedInputBlockTypes."+Y[this.animationType]),t.push(e+".isConstant = "+this.isConstant,e+".visibleInInspector = "+this.visibleInInspector),t.push(""),t.join(";\r\n")}return""},ie.prototype.dispose=function(){this.onValueChangedObservable.clear(),q.prototype.dispose.call(this)},ie.prototype.serialize=function(){var e=q.prototype.serialize.call(this);return e.type=this.type,e.mode=this._mode,e.systemValue=this._systemValue,e.animationType=this._animationType,e.visibleInInspector=this.visibleInInspector,e.min=this.min,e.max=this.max,e.isBoolean=this.isBoolean,e.matrixMode=this.matrixMode,e.isConstant=this.isConstant,e.groupInInspector=this.groupInInspector,null!=this._storedValue&&this._mode===r.Uniform&&(this._storedValue.asArray?(e.valueType="BABYLON."+this._storedValue.getClassName(),e.value=this._storedValue.asArray()):(e.valueType="number",e.value=this._storedValue)),e},ie.prototype._deserialize=function(e,t,i){var n;this._mode=e.mode,q.prototype._deserialize.call(this,e,t,i),this._type=e.type,this._systemValue=e.systemValue||e.wellKnownValue,this._animationType=e.animationType,this.visibleInInspector=e.visibleInInspector,this.min=e.min||0,this.max=e.max||0,this.isBoolean=!!e.isBoolean,this.matrixMode=e.matrixMode||0,this.isConstant=!!e.isConstant,this.groupInInspector=e.groupInInspector||"",e.valueType&&("number"===e.valueType?this._storedValue=e.value:(n=y.a.GetClass(e.valueType))&&(this._storedValue=n.FromArray(e.value)))},ie);function ie(e,t,i){void 0===t&&(t=me.Vertex),void 0===i&&(i=c.AutoDetect);var n=q.call(this,e,t,!1,!0)||this;return n._mode=r.Undefined,n._animationType=Y.None,n.min=0,n.max=0,n.isBoolean=!1,n.matrixMode=0,n._systemValue=null,n.visibleInInspector=!1,n.isConstant=!1,n.groupInInspector="",n.onValueChangedObservable=new m.c,n._type=i,n.setDefaultValue(),n.registerOutput("output",i),n}y.a.RegisteredTypes["BABYLON.InputBlock"]=te;
1var ne,re=i(3),oe=i(9),ae=(ne=b,Object(T.d)(se,ne),se.prototype.getClassName=function(){return"CurrentScreenBlock"},Object.defineProperty(se.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),se.prototype.initialize=function(e){e._excludeVariableName("textureSampler")},Object.defineProperty(se.prototype,"target",{get:function(){if(!this.uv.isConnected)return me.VertexAndFragment;if(this.uv.sourceBlock.isInput)return me.VertexAndFragment;for(var e=this.uv.connectedPoint;e;){if(e.target===me.Fragment)return me.Fragment;if(e.target===me.Vertex)return me.VertexAndFragment;if(e.target===me.Neutral||e.target===me.VertexAndFragment)for(var t=e.ownerBlock,e=null,i=0,n=t.inputs;i<n.length;i++){var r=n[i];if(r.connectedPoint){e=r.connectedPoint;break}}}return me.VertexAndFragment},enumerable:!1,configurable:!0}),se.prototype.prepareDefines=function(e,t,i){i.setValue(this._linearDefineName,this.convertToGammaSpace,!0),i.setValue(this._gammaDefineName,this.convertToLinearSpace,!0)},se.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},se.prototype._injectVertexCode=function(e){var t=this.uv;if(t.connectedPoint.ownerBlock.isInput&&(t.connectedPoint.ownerBlock.isAttribute||e._emitUniformFromString(t.associatedVariableName,"vec2")),this._mainUVName="vMain"+t.associatedVariableName,e._emitVaryingFromString(this._mainUVName,"vec2"),e.compilationString+=this._mainUVName+" = "+t.associatedVariableName+".xy;\r\n",this._outputs.some(function(e){return e.isConnectedInVertexShader})){this._writeTextureRead(e,!0);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name,!0)}}},se.prototype._writeTextureRead=function(e,t){void 0===t&&(t=!1);var i=this.uv;if(t){if(e.target===me.Fragment)return;e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+i.associatedVariableName+");\r\n"}else this.uv.ownerBlock.target!==me.Fragment?e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+this._mainUVName+");\r\n":e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+i.associatedVariableName+");\r\n"},se.prototype._writeOutput=function(e,t,i,n){if(void 0===n&&(n=!1),n){if(e.target===me.Fragment)return;e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+";\r\n"}else this.uv.ownerBlock.target!==me.Fragment?(e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+";\r\n",e.compilationString+="#ifdef "+this._linearDefineName+"\r\n",e.compilationString+=t.associatedVariableName+" = toGammaSpace("+t.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#ifdef "+this._gammaDefineName+"\r\n",e.compilationString+=t.associatedVariableName+" = toLinearSpace("+t.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n"):e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+";\r\n"},se.prototype._buildBlock=function(e){if(ne.prototype._buildBlock.call(this,e),e.target===me.Vertex&&(this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e._emit2DSampler(this._samplerName),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this)),e.target===me.Fragment){if(this._outputs.some(function(e){return e.isConnectedInFragmentShader})){e._emit2DSampler(this._samplerName),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");var t="//"+this.name;e._emitFunctionFromInclude("helperFunctions",t),this._writeTextureRead(e);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name)}
1return this}}else this._injectVertexCode(e)},se.prototype.serialize=function(){var e=ne.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,this.texture&&(e.texture=this.texture.serialize()),e},se.prototype._deserialize=function(e,t,i){ne.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=oe.a.Parse(e.texture,t,i))},se);function se(e){var t=ne.call(this,e,me.VertexAndFragment)||this;return t._samplerName="textureSampler",t.convertToGammaSpace=!1,t.convertToLinearSpace=!1,t._isUnique=!0,t.registerInput("uv",c.Vector2,!1,me.VertexAndFragment),t.registerOutput("rgba",c.Color4,me.Neutral),t.registerOutput("rgb",c.Color3,me.Neutral),t.registerOutput("r",c.Float,me.Neutral),t.registerOutput("g",c.Float,me.Neutral),t.registerOutput("b",c.Float,me.Neutral),t.registerOutput("a",c.Float,me.Neutral),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[0]._prioritizeVertex=!0,t}y.a.RegisteredTypes["BABYLON.CurrentScreenBlock"]=ae;var ce,le=(ce=b,Object(T.d)(ue,ce),ue.prototype.getClassName=function(){return"ParticleTextureBlock"},Object.defineProperty(ue.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(ue.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),ue.prototype.initialize=function(e){e._excludeVariableName("diffuseSampler")},ue.prototype.autoConfigure=function(e){var t;this.uv.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"particle_uv"===e.name}))||(t=new te("uv")).setAsAttribute("particle_uv"),t.output.connectTo(this.uv))},ue.prototype.prepareDefines=function(e,t,i){i.setValue(this._linearDefineName,this.convertToGammaSpace,!0),i.setValue(this._gammaDefineName,this.convertToLinearSpace,!0)},ue.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},ue.prototype._writeOutput=function(e,t,i){e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+";\r\n",e.compilationString+="#ifdef "+this._linearDefineName+"\r\n",e.compilationString+=t.associatedVariableName+" = toGammaSpace("+t.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#ifdef "+this._gammaDefineName+"\r\n",e.compilationString+=t.associatedVariableName+" = toLinearSpace("+t.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n"},ue.prototype._buildBlock=function(e){if(ce.prototype._buildBlock.call(this,e),e.target!==me.Vertex){this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e._emit2DSampler(this._samplerName),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");var t="//"+this.name;e._emitFunctionFromInclude("helperFunctions",t),e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+this.uv.associatedVariableName+");\r\n";for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name)}return this}},ue.prototype.serialize=function(){var e=ce.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace
1=this.convertToLinearSpace,this.texture&&(e.texture=this.texture.serialize()),e},ue.prototype._deserialize=function(e,t,i){ce.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=oe.a.Parse(e.texture,t,i))},ue);function ue(e){var t=ce.call(this,e,me.Fragment)||this;return t._samplerName="diffuseSampler",t.convertToGammaSpace=!1,t.convertToLinearSpace=!1,t._isUnique=!0,t.registerInput("uv",c.Vector2,!1,me.VertexAndFragment),t.registerOutput("rgba",c.Color4,me.Neutral),t.registerOutput("rgb",c.Color3,me.Neutral),t.registerOutput("r",c.Float,me.Neutral),t.registerOutput("g",c.Float,me.Neutral),t.registerOutput("b",c.Float,me.Neutral),t.registerOutput("a",c.Float,me.Neutral),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t}y.a.RegisteredTypes["BABYLON.ParticleTextureBlock"]=le;var he,de=(he=b,Object(T.d)(pe,he),pe.prototype.getClassName=function(){return"ParticleRampGradientBlock"},Object.defineProperty(pe.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(pe.prototype,"rampColor",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),pe.prototype.initialize=function(e){e._excludeVariableName("remapRanges"),e._excludeVariableName("rampSampler"),e._excludeVariableName("baseColor"),e._excludeVariableName("alpha"),e._excludeVariableName("remappedColorIndex"),e._excludeVariableName("rampColor"),e._excludeVariableName("finalAlpha")},pe.prototype._buildBlock=function(e){if(he.prototype._buildBlock.call(this,e),e.target!==me.Vertex)return e._emit2DSampler("rampSampler"),e._emitVaryingFromString("remapRanges","vec4","RAMPGRADIENT"),e.compilationString+="\n #ifdef RAMPGRADIENT\n vec4 baseColor = "+this.color.associatedVariableName+";\n float alpha = "+this.color.associatedVariableName+".a;\n\n float remappedColorIndex = clamp((alpha - remapRanges.x) / remapRanges.y, 0.0, 1.0);\n\n vec4 rampColor = texture2D(rampSampler, vec2(1.0 - remappedColorIndex, 0.));\n baseColor.rgb *= rampColor.rgb;\n\n // Remapped alpha\n float finalAlpha = baseColor.a;\n baseColor.a = clamp((alpha * rampColor.a - remapRanges.z) / remapRanges.w, 0.0, 1.0);\n\n "+this._declareOutput(this.rampColor,e)+" = baseColor;\n #else\n "+this._declareOutput(this.rampColor,e)+" = "+this.color.associatedVariableName+";\n #endif\n ",this},pe);function pe(e){var t=he.call(this,e,me.Fragment)||this;return t._isUnique=!0,t.registerInput("color",c.Color4,!1,me.Fragment),t.registerOutput("rampColor",c.Color4,me.Fragment),t}y.a.RegisteredTypes["BABYLON.ParticleRampGradientBlock"]=de;var fe,_e=(fe=b,Object(T.d)(ge,fe),ge.prototype.getClassName=function(){return"ParticleBlendMultiplyBlock"},Object.defineProperty(ge.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"alphaTexture",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"alphaColor",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"blendColor",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ge.prototype.initialize=function(e){e._excludeVariableName("sourceAlpha")},ge.prototype._buildBlock=function(e){if(fe.prototype._buildBlock.call(this,e),e.target!==me.Vertex)return e.compilationString+="\n #ifdef BLENDMULTIPLYMODE\n "+this._declareOutput(this.blendColor,e)+";\n float sourceAlpha = "+this.alphaColor.associatedVariableName+" * "+this.alphaTexture.associatedVariableName+";\n "+this.blendColor.associatedVariableName+".rgb = "+this.color.associatedVariableName+".rgb * sourceAlpha + vec3(1.0) * (1.0 - sourceAlpha);\n "+this.blendColor.associatedVariableName+".a = "+this.color.associatedVariableName+".a;\n #else\n "+this._declareOutput(this.blendColor,e)+" = "+this.color.associatedVariableName+";\n #endif\n ",this},ge);function ge(e){var t=fe.call(this,e,me.Fragment)||this;return t._isUnique=!0,t.registerInput("color",c.Color4,!1,me.Fragment),t.registerInput("alphaTexture",c.Float,!1,me.Fragment),t.registerInput("alphaColor",c.Float,!1,me.Fragment),t.registerOutput("blendColor",c.Color4,me.Fragment),t}y.a.RegisteredTypes["BABYLON.ParticleBlendMultiplyBlock"]=_e;var ve,be,ye,Te=i(84),Ee=i(55),Se=i(23),Ae=i(2),Ce=(be=b,Object(T.d)(Pe,be),Pe.prototype.getClassName=function(){return"VectorMergerBlock"},Object.defineProperty(Pe.prototype,"xyzIn",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"xyIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"x",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"y",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"z",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"w",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"xyzw",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"xyzOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"xyOut",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"xy",{get:function(){return this.xyOut},enumerable:!1,configurable:!0}),Object.defineProperty(Pe.prototype,"xyz",{get:function(){return this.xyzOut},enumerable:!1,configurable:!0}),Pe.prototype._buildBlock=function(e){be.prototype._buildBlock.call(this,e);var t=this.x,i=this.y,n=this.z,r=this.w,o=this.xyIn,a=this.xyzIn,s=this._outputs[0],c=this._outputs[1],l=this._outputs[2];return o.isConnected?s.hasEndpoints?e.compilationString+=this._declareOutput(s,e)+" = vec4("+o.associatedVariableName+", "+(n.isConnected?this._writeVariable(n):"0.0")+", "+(r.isConnected?this._writeVariable(r):"0.0")+");\r\n":c.hasEndpoints?e.compilationString+=this._declareOutput(c,e)+" = vec3("+o.associatedVariableName+", "+(n.isConnected?this._writeVariable(n):"0.0")+");\r\n":l.hasEndpoints&&(e.compilationString+=this._declareOutput(l,e)+" = "+o.associatedVariableName+";\r\n"):a.isConnected?s.hasEndpoints?e.compilationString+=this._declareOutput(s,e)+" = vec4("+a.associatedVariableName+", "+(r.isConnected?this._writeVariable(r):"0.0")+");\r\n":c.hasEndpoints?e.compilationString+=this._declareOutput(c,e)+" = "+a.associatedVariableName+";\r\n":l.hasEndpoints&&(e.compilationString+=this._declareOutput(l,e)+" = "+a.associatedVariableName+".xy;\r\n"):s.hasEndpoints?e.compilationString+=this._declareOutput(s,e)+" = vec4("+(t.isConnected?this._writeVariable(t):"0.0")+", "+(i.isConnected?this._writeVariable(i):"0.0")+", "+(n.isConnected?this._writeVariable(n):"0.0")+", "+(r.isConnected?this._writeVariable(r):"0.0")+");\r\n":c.hasEndpoints?e.compilationString+=this._declareOutput(c,e)+" = vec3("+(t.isConnected?this._writeVariable(t):"0.0")+", "+(i.isConnected?this._writeVariable(i):"0.0")+", "+(n.isConnected?this._writeVariable(n):"0.0")+");\r\n":l.hasEndpoints&&(e.compilationString+=this._declareOutput(l,e)+" = vec2("+(t.isConnected?this._writeVariable(t):"0.0")+", "+(i.isConnected?this._writeVariable(i):"0.0")+");\r\n"),this},Pe);function Pe(e){var t=be.call(this,e,me.Neutral)||this;return t.registerInput("xyz ",c.Vector3,!0),t.registerInput("xy ",c.Vector2,!0),t.registerInput("x",c.Float,!0),t.registerInput("y",c.Float,!0),t.registerInput("z",c.Float,!0),t.registerInput("w",c.Float,!0),t.registerOutput("xyzw",c.Vector4),t.registerOutput("xyz",c.Vector3),t.registerOutput("xy",c.Vector2),t}function xe(n,r,o,a){return void 0===r&&(r=ve.Boolean),void 0===o&&(o="PROPERTIES"),function(e,t){var i=e._propStore;i||(i=[],e._propStore=i),i.push({propertyName:t,displayName:n,type:r,groupName:o,options:null!=a?a:{}})}}y.a.RegisteredTypes["BABYLON.VectorMergerBlock"]=Ce,(ye=ve=ve||{})[ye.Boolean=0]="Boolean",ye[ye.Float=1]="Float",ye[ye.Vector2=2]="Vector2",ye[ye.List=3]="List";var Re,Oe=(Re=b,Object(T.d)(Me,Re),Me.prototype.getClassName=function(){return"RemapBlock"},Object.defineProperty(Me.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Me.prototype,"sourceMin",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Me.prototype,"sourceMax",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Me.prototype,"targetMin",{get:function(){return this._inputs[3]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Me.prototype,"targetMax",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Me.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Me.prototype._buildBlock=function(e){Re.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.sourceMin.isConnected?this.sourceMin.associatedVariableName:this._writeFloat(this.sourceRange.x),n=this.sourceMax.isConnected?this.sourceMax.associatedVariableName:this._writeFloat(this.sourceRange.y),r=this.targetMin.isConnected?this.targetMin.associatedVariableName:this._writeFloat(this.targetRange.x),o=this.targetMax.isConnected?this.targetMax.associatedVariableName:this._writeFloat(this.targetRange.y);return e.compilationString+=this._declareOutput(t,e)+" = "+r+" + ("+this._inputs[0].associatedVariableName+" - "+i+") * ("+o+" - "+r+") / ("+n+" - "+i+");\r\n",this},Me.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".sourceRange = new BABYLON.Vector2("+this.sourceRange.x+", "+this.sourceRange.y+");\r\n"+this._codeVariableName+".targetRange = new BABYLON.Vector2("+this.targetRange.x+", "+this.targetRange.y+");\r\n"},Me.prototype.serialize=function(){var e=Re.prototype.serialize.call(this);return e.sourceRange=this.sourceRange.asArray(),e.targetRange=this.targetRange.asArray(),e},Me.prototype._deserialize=function(e,t,i){Re.prototype._deserialize.call(this,e,t,i),this.sourceRange=C.d.FromArray(e.sourceRange),this.targetRange=C.d.FromArray(e.targetRange)},Object(T.c)([xe("From",ve.Vector2)],Me.prototype,"sourceRange",void 0),Object(T.c)([xe("To",ve.Vector2)],Me.prototype,"targetRange",void 0),Me);function Me(e){var t=Re.call(this,e,me.Neutral)||this;return t.sourceRange=new C.d(-1,1),t.targetRange=new C.d(0,1),t.registerInput("input",c.AutoDetect),t.registerInput("sourceMin",c.Float,!0),t.registerInput("sourceMax",c.Float,!0),t.registerInput("targetMin",c.Float,!0),t.registerInput("targetMax",c.Float,!0),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t}y.a.RegisteredTypes["BABYLON.RemapBlock"]=Oe;var Ie,De=(Ie=b,Object(T.d)(Le,Ie),Le.prototype.getClassName=function(){return"MultiplyBlock"},Object.defineProperty(Le.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Le.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Le.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Le.prototype._buildBlock=function(e){Ie.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = "+this.left.associatedVariableName+" * "+this.right.associatedVariableName+";\r\n",this},Le);function Le(e){var t=Ie.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.MultiplyBlock"]=De;var Ne,Fe=i(136),we=(Ne=b,Object(T.d)(Be,Ne),Be.prototype.getClassName=function(){return"ColorSplitterBlock"},Object.defineProperty(Be.prototype,"rgba",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"rgbIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"rgbOut",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"r",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"g",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"b",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"a",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Be.prototype._inputRename=function(e){return"rgb "===e?"rgbIn":e}
1,Be.prototype._outputRename=function(e){return"rgb"===e?"rgbOut":e},Be.prototype._buildBlock=function(e){Ne.prototype._buildBlock.call(this,e);var t=this.rgba.isConnected?this.rgba:this.rgbIn;if(t.isConnected){var i=this._outputs[0],n=this._outputs[1],r=this._outputs[2],o=this._outputs[3],a=this._outputs[4];return i.hasEndpoints&&(e.compilationString+=this._declareOutput(i,e)+" = "+t.associatedVariableName+".rgb;\r\n"),n.hasEndpoints&&(e.compilationString+=this._declareOutput(n,e)+" = "+t.associatedVariableName+".r;\r\n"),r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+" = "+t.associatedVariableName+".g;\r\n"),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+" = "+t.associatedVariableName+".b;\r\n"),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = "+t.associatedVariableName+".a;\r\n"),this}},Be);function Be(e){var t=Ne.call(this,e,me.Neutral)||this;return t.registerInput("rgba",c.Color4,!0),t.registerInput("rgb ",c.Color3,!0),t.registerOutput("rgb",c.Color3),t.registerOutput("r",c.Float),t.registerOutput("g",c.Float),t.registerOutput("b",c.Float),t.registerOutput("a",c.Float),t.inputsAreExclusive=!0,t}y.a.RegisteredTypes["BABYLON.ColorSplitterBlock"]=we;var Ue,Ve,ke=i(173),Ge={effect:null,subMesh:null},ze=(Ve=D.a,Object(T.d)(He,Ve),He.prototype.setValue=function(e,t,i){void 0===i&&(i=!1),void 0===this[e]&&this._keys.push(e),i&&this[e]!==t&&this.markAsUnprocessed(),this[e]=t},He),je=(Ue=E.a,Object(T.d)(We,Ue),We.prototype._getGlobalNodeMaterialEditor=function(){return"undefined"!=typeof NODEEDITOR?NODEEDITOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.NodeEditor?BABYLON:void 0},Object.defineProperty(We.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"mode",{get:function(){return this._mode},enumerable:!1,configurable:!0}),We.prototype.getClassName=function(){return"NodeMaterial"},We.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.get
1Scene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){t._markAllSubMeshesAsImageProcessingDirty()})))},We.prototype.getBlockByName=function(e){for(var t=null,i=0,n=this.attachedBlocks;i<n.length;i++){var r=n[i];if(r.name===e){if(t)return N.b.Warn("More than one block was found with the name `"+e+"`"),t;t=r}}return t},We.prototype.getBlockByPredicate=function(e){for(var t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];if(e(n))return n}return null},We.prototype.getInputBlockByPredicate=function(e){for(var t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];if(n.isInput&&e(n))return n}return null},We.prototype.getInputBlocks=function(){for(var e=[],t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];n.isInput&&e.push(n)}return e},We.prototype.registerOptimizer=function(e){if(!(-1<this._optimizers.indexOf(e)))return this._optimizers.push(e),this},We.prototype.unregisterOptimizer=function(e){var t=this._optimizers.indexOf(e);if(-1!==t)return this._optimizers.splice(t,1),this},We.prototype.addOutputNode=function(e){if(null===e.target)throw"This node is not meant to be an output node. You may want to explicitly set its target value.";return 0!=(e.target&me.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&me.Fragment)&&this._addFragmentOutputNode(e),this},We.prototype.removeOutputNode=function(e){return null===e.target||(0!=(e.target&me.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&me.Fragment)&&this._removeFragmentOutputNode(e)),this},We.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=me.Vertex,this._vertexOutputNodes.push(e),this},We.prototype._removeVertexOutputNode=function(e){var t=this._vertexOutputNodes.indexOf(e);if(-1!==t)return this._vertexOutputNodes.splice(t,1),this},We.prototype._addFragmentOutputNode=function(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=me.Fragment,this._fragmentOutputNodes.push(e),this},We.prototype._removeFragmentOutputNode=function(e){var t=this._fragmentOutputNodes.indexOf(e);if(-1!==t)return this._fragmentOutputNodes.splice(t,1),this},We.prototype.needAlphaBlending=function(){return!this.ignoreAlpha&&(this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)},We.prototype.needAlphaTesting=function(){return this._sharedData&&this._sharedData.hints.needAlphaTesting},We.prototype._initializeBlock=function(e,t,i){if(e.initialize(t),e.autoConfigure(this),e._preparationId=this._buildId,-1===this.attachedBlocks.indexOf(e)){if(e.isUnique)for(var n=e.getClassName(),r=0,o=this.attachedBlocks;r<o.length;r++)if(o[r].getClassName()===n)throw"Cannot have multiple blocks of type "+n+" in the same NodeMaterial";this.attachedBlocks.push(e)}for(var a=0,s=e.inputs;a<s.length;a++){var c=s[a];c.associatedVariableName="";var l,u=c.connectedPoint;!u||(l=u.ownerBlock)!==e&&((l.target===me.VertexAndFragment||t.target===me.Fragment&&l.target===me.Vertex&&l._preparationId!==this._buildId)&&i.push(l),this._initializeBlock(l,t,i))}for(var h=0,d=e.outputs;h<d.length;h++)d[h].associatedVariableName=""},We.prototype._resetDualBlocks=function(e,t){e.target===me.VertexAndFragment&&(e.buildId=t);for(var i=0,n=e.inputs;i<n.length;i++){var r,o=n[i].connectedPoint;!o||(r=o.ownerBlock)!==e&&this._resetDualBlocks(r,t)}},We.prototype.removeBlock=function(e){var t=this.attachedBlocks.indexOf(e);-1<t&&this.attachedBlocks.splice(t,1),e.isFinalMerger&&this.removeOutputNode(e)},We.prototype.build=function(e){void 0===e&&(e=!1),this._buildWasSuccessful=!1;var t=this.getScene().getEngine(),i=this._mode===A.Particle;if(0===this._vertexOutputNodes.length&&!i)throw"You must define at least one vertexOutputNode";if(0===this._fragmentOutputNodes.length)throw"You must define at least one fragmentOutputNode";this._vertexCompilationState=new M,this._vertexCompilationState.supportUniformBuffers=t.supportsUniformBuffers,this._vertexCompilationState.target=me.Vertex,this._fragmentCompilationState=new M,this._fragmentCompilationState.supportUniformBuffers=t.supportsUniformBuffers,this._fragmentCompilationState.target=me.Fragment,this._sharedData=new I,this._vertexCompilationState.sharedData=this._sharedData,this._fragmentCompilationState.sharedData=this._sharedData,this._sharedData.buildId=this._buildId,this._sharedData.emitComments=this._options.emitComments,this._sharedData.verbose=e,this._sharedData.scene=this.getScene(),this._sharedData.allowEmptyVertexProgram=i;for(var n=[],r=[],o=0,a=this._vertexOutputNodes;o<a.length;o++){var s=a[o];n.push(s),this._initializeBlock(s,this._vertexCompilationState,r)}for(var c=0,l=this._fragmentOutputNodes;c<l.length;c++){var u=l[c];r.push(u),this._initializeBlock(u,this._fragmentCompilationState,n)}this.optimize();for(var h=0,d=n;h<d.length;h++)(s=d[h]).build(this._vertexCompilationState,n);this._fragmentCompilationState.uniforms=this._vertexCompilationState.uniforms.slice(0),this._fragmentCompilationState._uniformDeclaration=this._vertexCompilationState._uniformDeclaration,this._fragmentCompilationState._constantDeclaration=this._vertexCompilationState._constantDeclaration,this._fragmentCompilationState._vertexState=this._vertexCompilationState;for(var p=0,f=r;p<f.length;p++)u=f[p],this._resetDualBlocks(u,this._buildId-1);for(var m=0,_=r;m<_.length;m++)(u=_[m]).build(this._fragmentCompilationState,r);this._vertexCompilationState.finalize(this._vertexCompilationState),this._fragmentCompilationState.finalize(this._fragmentCompilationState),this._buildId=We._BuildIdGenerator++,this._sharedData.emitErrors(),e&&(console.log("Vertex shader:"),console.log(this._vertexCompilationState.compilationString),console.log("Fragment shader:"),console.log(this._fragmentCompilationState.compilationString)),this._buildWasSuccessful=!0,this.onBuildObservable.notifyObservers(this);for(var g=0,v=this.getScene().meshes;g<v.length;g++){var b=v[g];if(b.subMeshes)for(var y=0,T=b.subMeshes;y<T.length;y++){var E,S=T[y];S.getMaterial()===this&&S._materialDefines&&((E=S._materialDefines).markAllAsDirt
1y(),E.reset())}}},We.prototype.optimize=function(){for(var e=0,t=this._optimizers;e<t.length;e++)t[e].optimize(this._vertexOutputNodes,this._fragmentOutputNodes)},We.prototype._prepareDefinesForAttributes=function(e,t){var i=t.NORMAL,n=t.TANGENT,r=t.UV1;t.NORMAL=e.isVerticesDataPresent(L.b.NormalKind),t.TANGENT=e.isVerticesDataPresent(L.b.TangentKind),t.UV1=e.isVerticesDataPresent(L.b.UVKind),i===t.NORMAL&&n===t.TANGENT&&r===t.UV1||t.markAsAttributesDirty()},We.prototype.createPostProcess=function(e,t,i,n,r,o,a){return void 0===t&&(t=1),void 0===i&&(i=Ae.a.TEXTURE_NEAREST_SAMPLINGMODE),void 0===o&&(o=Ae.a.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=Ae.a.TEXTUREFORMAT_RGBA),this._createEffectOrPostProcess(null,e,t,i,n,r,o,a)},We.prototype.createEffectForPostProcess=function(e){this._createEffectOrPostProcess(e)},We.prototype._createEffectOrPostProcess=function(l,e,t,i,n,r,o,a){var u=this;void 0===t&&(t=1),void 0===i&&(i=Ae.a.TEXTURE_NEAREST_SAMPLINGMODE),void 0===o&&(o=Ae.a.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=Ae.a.TEXTUREFORMAT_RGBA);var h=this.name+this._buildId,d=new ze,p=new S.a(h+"PostProcess",this.getScene()),f=this._buildId;return this._processDefines(p,d),R.a.RegisterShader(h,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString),l?l.updateEffect(d.toString(),this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,{maxSimultaneousLights:this.maxSimultaneousLights},void 0,void 0,h,h):l=new Se.a(this.name+"PostProcess",h,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,t,e,i,n,r,d.toString(),o,h,{maxSimultaneousLights:this.maxSimultaneousLights},!1,a),l.nodeMaterialSource=this,l.onApplyObservable.add(function(e){if(f!==u._buildId&&(delete R.a.ShadersStore[h+"VertexShader"],delete R.a.ShadersStore[h+"PixelShader"],h=u.name+u._buildId,d.markAsUnprocessed(),f=u._buildId),u._processDefines(p,d)&&(R.a.RegisterShader(h,u._fragmentCompilationState._builtCompilationString,u._vertexCompilationState._builtCompilationString),ke.a.SetImmediate(function(){return l.updateEffect(d.toString(),u._fragmentCompilationState.uniforms,u._fragmentCompilationState.samplers,{maxSimultaneousLights:u.maxSimultaneousLights},void 0,void 0,h,h)})),u._sharedData.animatedInputs){var t=u.getScene(),i=t.getFrameId();if(u._animationFrame!==i){for(var n=0,r=u._sharedData.animatedInputs;n<r.length;n++)r[n].animate(t);u._animationFrame=i}}for(var o=0,a=u._sharedData.bindableBlocks;o<a.length;o++)a[o].bind(e,u);for(var s=0,c=u._sharedData.inputBlocks;s<c.length;s++)c[s]._transmit(e,u.getScene())}),l},We.prototype._createEffectForParticles=function(h,d,p,f,e,m,_){var g=this,v=this.name+this._buildId+"_"+d;m=m||new ze,(_=_||this.getScene().getMeshByName(this.name+"Particle"))||(_=new S.a(this.name+"Particle",this.getScene()));var t,b=this._buildId,y=[],T="";e||(t=this._processDefines(_,m),R.a.RegisterShader(v,this._fragmentCompilationState._builtCompilationString),h.fillDefines(y,d),T=y.join("\n"),e=this.getScene().getEngine().createEffectForParticles(v,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,m.toString()+"\n"+T,null==t?void 0:t.fallbacks,p,f,h),h.setCustomEffect(e,d)),e.onBindObservable.add(function(e){b!==g._buildId&&(delete R.a.ShadersStore[v+"PixelShader"],v=g.name+g._buildId+"_"+d,m.markAsUnprocessed(),b=g._buildId),y.length=0,h.fillDefines(y,d);var t=y.join("\n");t!==T&&(m.markAsUnprocessed(),T=t);var i=g._processDefines(_,m);if(i)return R.a.RegisterShader(v,g._fragmentCompilationState._builtCompilationString),e=g.getScene().getEngine().createEffectForParticles(v,g._fragmentCompilationState.uniforms,g._fragmentCompilationState.samplers,m.toString()+"\n"+T,null==i?void 0:i.fallbacks,p,f,h),h.setCustomEffect(e,d),void g._createEffectForParticles(h,d,p,f,e,m,_);if(g._sharedData.animatedInputs){var n=g.getScene(),r=n.getFrameId();if(g._animationFrame!==r){for(var o=0,a=g._sharedData.animatedInputs;o<a.length;o++)a[o].animate(n);g._animationFrame=r}}for(var s=0,c=g._sharedData.bindableBlocks;s<c.length;s++)c[s].bind(e,g);for(var l=0,u=g._sharedData.inputBlocks;l<u.length;l++)u[l]._transmit(e,g.getScene())})}
1,We.prototype.createEffectForParticles=function(e,t,i){this._createEffectForParticles(e,Fe.a.BLENDMODE_ONEONE,t,i),this._createEffectForParticles(e,Fe.a.BLENDMODE_MULTIPLY,t,i)},We.prototype._processDefines=function(t,i,n,r){var o=this;void 0===n&&(n=!1);var e,a,s,c,l,u=null;return this._sharedData.blocksWithDefines.forEach(function(e){e.initializeDefines(t,o,i,n)}),this._sharedData.blocksWithDefines.forEach(function(e){e.prepareDefines(t,o,i,n,r)}),i.isDirty&&(e=i._areLightsDisposed,i.markAsProcessed(),this._vertexCompilationState.compilationString=this._vertexCompilationState._builtCompilationString,this._fragmentCompilationState.compilationString=this._fragmentCompilationState._builtCompilationString,this._sharedData.repeatableContentBlocks.forEach(function(e){e.replaceRepeatableContent(o._vertexCompilationState,o._fragmentCompilationState,t,i)}),a=[],this._sharedData.dynamicUniformBlocks.forEach(function(e){e.updateUniformsAndSamples(o._vertexCompilationState,o,i,a)}),s=this._vertexCompilationState.uniforms,this._fragmentCompilationState.uniforms.forEac
1h(function(e){-1===s.indexOf(e)&&s.push(e)}),c=this._vertexCompilationState.samplers,this._fragmentCompilationState.samplers.forEach(function(e){-1===c.indexOf(e)&&c.push(e)}),l=new Te.a,this._sharedData.blocksWithFallbacks.forEach(function(e){e.provideFallbacks(t,l)}),u={lightDisposed:e,uniformBuffers:a,mergedUniforms:s,mergedSamplers:c,fallbacks:l}),u},We.prototype.isReadyForSubMesh=function(t,e,i){var n=this;if(void 0===i&&(i=!1),!this._buildWasSuccessful)return!1;var r=this.getScene();if(this._sharedData.animatedInputs){var o=r.getFrameId();if(this._animationFrame!==o){for(var a=0,s=this._sharedData.animatedInputs;a<s.length;a++)s[a].animate(r);this._animationFrame=o}}if(e.effect&&this.isFrozen&&e.effect._wasPreviouslyReady)return!0;e._materialDefines||(e._materialDefines=new ze);var c=e._materialDefines;if(this._isReadyForSubMesh(e))return!0;var l=r.getEngine();if(this._prepareDefinesForAttributes(t,c),this._sharedData.blockingBlocks.some(function(e){return!e.isReady(t,n,c,i)}))return!1;var u=this._processDefines(t,c,i,e);if(u){var h=e.effect,d=c.toString(),p=l.createEffect({vertex:"nodeMaterial"+this._buildId,fragment:"nodeMaterial"+this._buildId,vertexSource:this._vertexCompilationState.compilationString,fragmentSource:this._fragmentCompilationState.compilationString},{attributes:this._vertexCompilationState.attributes,uniformsNames:u.mergedUniforms,uniformBuffersNames:u.uniformBuffers,samplers:u.mergedSamplers,defines:d,fallbacks:u.fallbacks,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights,maxSimultaneousMorphTargets:c.NUM_MORPH_INFLUENCERS}},l);if(p)if(this._onEffectCreatedObservable&&(Ge.effect=p,Ge.subMesh=e,this._onEffectCreatedObservable.notifyObservers(Ge)),this.allowShaderHotSwapping&&h&&!p.isReady()){if(p=h,c.markAsUnprocessed(),u.lightDisposed)return!(c._areLightsDisposed=!0)}else r.resetCachedMaterial(),e.setEffect(p,c)}return!(!e.effect||!e.effect.isReady()||(c._renderId=r.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},Object.defineProperty(We.prototype,"compiledShaders",{get:function(){return"// Vertex shader\r\n"+this._vertexCompilationState.compilationString+"\r\n\r\n// Fragment shader\r\n"+this._fragmentCompilationState.compilationString},enumerable:!1,configurable:!0}),We.prototype.bindOnlyWorldMatrix=function(e){var t=this.getScene();if(this._activeEffect){var i=this._sharedData.hints;i.needWorldViewMatrix&&e.multiplyToRef(t.getViewMatrix(),this._cachedWorldViewMatrix),i.needWorldViewProjectionMatrix&&e.multiplyToRef(t.getTransformMatrix(),this._cachedWorldViewProjectionMatrix);for(var n=0,r=this._sharedData.inputBlocks;n<r.length;n++)r[n]._transmitWorld(this._activeEffect,e,this._cachedWorldViewMatrix,this._cachedWorldViewProjectionMatrix)}},We.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this._mustRebind(n,r,t.visibility)){var o=this._sharedData;if(r&&n.getCachedEffect()!==r){for(var a=0,s=o.bindableBlocks;a<s.length;a++)s[a].bind(r,this,t,i);for(var c=0,l=o.inputBlocks;c<l.length;c++)l[c]._transmit(r,n)}}this._afterBind(t,this._activeEffect)}},We.prototype.getActiveTextures=function(){var e=Ue.prototype.getActiveTextures.call(this);return this._sharedData&&e.push.apply(e,this._sharedData.textureBlocks.filter(function(e){return e.texture}).map(function(e){return e.texture})),e},We.prototype.getTextureBlocks=function(){return this._sharedData?this._sharedData.textureBlocks:[]},We.prototype.hasTexture=function(e){if(Ue.prototype.hasTexture.call(this,e))return!0;if(!this._sharedData)return!1;for(var t=0,i=this._sharedData.textureBlocks;t<i.length;t++)if(i[t].texture===e)return!0;return!1},We.prototype.dispose=function(e,t,i){if(t)for(var n=0,r=this._sharedData.textureBlocks.filter(function(e){return e.texture}).map(function(e){return e.texture});n<r.length;n++)r[n].dispose();for(var o=0,a=this.attachedBlocks;o<a.length;o++)a[o].dispose();this.onBuildObservable.clear(),Ue.prototype.dispose.call(this,e,t,i)},We.prototype._createNodeEditor=function(){this.BJSNODEMATERIALEDITOR=this.BJSNODEMATERIALEDITOR||this._getGlobalNodeMaterialEditor(),this.BJSNODEMATERIALEDITOR.NodeEditor.Show({nodeMaterial:this})},We.prototype.edit=function(n){var r=this;return new Promise(function(e,t){var i;void 0===r.BJSNODEMATERIALEDITOR?(i=n&&n.editorURL?n.editorURL:We.EditorURL,N.b.LoadScript(i,function(){r._createNodeEditor(),e()})):(r._createNodeEditor(),e())})},We.prototype.clear=function(){this._vertexOutputNodes=[],this._fragmentOutputNodes=[],this.attachedBlocks=[]},We.prototype.setToDefault=function(){this.clear(),this.editorData=null;var e=new te("Position");e.setAsAttribute("position");var t=new te("World");
1t.setAsSystemValue(BABYLON.NodeMaterialSystemValues.World);var i=new F("WorldPos");e.connectTo(i),t.connectTo(i);var n=new te("ViewProjection");n.setAsSystemValue(BABYLON.NodeMaterialSystemValues.ViewProjection);var r=new F("WorldPos * ViewProjectionTransform");i.connectTo(r),n.connectTo(r);var o=new z("VertexOutput");r.connectTo(o);var a=new te("color");a.value=new P.b(.8,.8,.8,1);var s=new H("FragmentOutput");a.connectTo(s),this.addOutputNode(o),this.addOutputNode(s),this._mode=A.Material},We.prototype.setToDefaultPostProcess=function(){this.clear(),this.editorData=null;var e=new te("Position");e.setAsAttribute("position2d");var t=new te("Constant1");t.isConstant=!0,t.value=1;var i=new Ce("Position3D");e.connectTo(i),t.connectTo(i,{input:"w"});var n=new z("VertexOutput");i.connectTo(n);var r=new te("scale");r.visibleInInspector=!0,r.value=new C.d(1,1);var o=new Oe("uv0");e.connectTo(o);var a=new De("uv");o.connectTo(a),r.connectTo(a);var s=new ae("CurrentScreen");a.connectTo(s),s.texture=new oe.a("https://assets.babylonjs.com/nme/currentScreenPostProcess.png",this.getScene());var c=new H("FragmentOutput");s.connectTo(c,{output:"rgba"}),this.addOutputNode(n),this.addOutputNode(c),this._mode=A.PostProcess},We.prototype.setToDefaultParticle=function(){this.clear(),this.editorData=null;var e=new te("uv");e.setAsAttribute("particle_uv");var t=new le("ParticleTexture");e.connectTo(t);var i=new te("Color");i.setAsAttribute("particle_color");var n=new De("Texture * Color");t.connectTo(n),i.connectTo(n);var r=new de("ParticleRampGradient");n.connectTo(r);var o=new we("ColorSplitter");i.connectTo(o);var a=new _e("ParticleBlendMultiply");r.connectTo(a),t.connectTo(a,{output:"a"}),o.connectTo(a,{output:"a"});var s=new H("FragmentOutput");a.connectTo(s),this.addOutputNode(s),this._mode=A.Particle},We.prototype.loadAsync=function(e){var i=this;return this.getScene()._loadFileAsync(e).then(function(e){var t=JSON.parse(e);i.loadFromSerialization(t,"")})},We.prototype._gatherBlocks=function(e,t){if(-1===t.indexOf(e)){t.push(e);for(var i=0,n=e.inputs;i<n.length;i++){var r,o=n[i].connectedPoint;!o||(r=o.ownerBlock)!==e&&this._gatherBlocks(r,t)}}},We.prototype.generateCode=function(){for(var e=[],t=[],i=[],n=0,r=this._vertexOutputNodes;n<r.length;n++){var o=r[n];this._gatherBlocks(o,t)}for(var a=[],s=0,c=this._fragmentOutputNodes;s<c.length;s++)o=c[s],this._gatherBlocks(o,a);for(var l='var nodeMaterial = new BABYLON.NodeMaterial("'+(this.name||"node material")+'");\r\n',u=0,h=t;u<h.length;u++)(y=h[u]).isInput&&-1===e.indexOf(y)&&(l+=y._dumpCode(i,e));for(var d=0,p=a;d<p.length;d++)(y=p[d]).isInput&&-1===e.indexOf(y)&&(l+=y._dumpCode(i,e));e=[],l+="\r\n// Connections\r\n";for(var f=0,m=this._vertexOutputNodes;f<m.length;f++)l+=(y=m[f])._dumpCodeForOutputConnections(e);for(var _=0,g=this._fragmentOutputNodes;_<g.length;_++)l+=(y=g[_])._dumpCodeForOutputConnections(e);l+="\r\n// Output nodes\r\n";for(var v=0,b=this._vertexOutputNodes;v<b.length;v++)l+="nodeMaterial.addOutputNode("+(y=b[v])._codeVariableName+");\r\n";for(var y,T=0,E=this._fragmentOutputNodes;T<E.length;T++)l+="nodeMaterial.addOutputNode("+(y=E[T])._codeVariableName+");\r\n";return l+"nodeMaterial.build();\r\n"},We.prototype.serialize=function(e){var t=e?{}:re.a.Serialize(this);t.editorData=JSON.parse(JSON.stringify(this.editorData));var i=[];if(e)i=e;else{t.customType="BABYLON.NodeMaterial",t.outputNodes=[];for(var n=0,r=this._vertexOutputNodes;n<r.length;n++){var o=r[n];this._gatherBlocks(o,i),t.outputNodes.push(o.uniqueId)}for(var a=0,s=this._fragmentOutputNodes;a<s.length;a++)o=s[a],this._gatherBlocks(o,i),-1===t.outputNodes.indexOf(o.uniqueId)&&t.outputNodes.push(o.uniqueId)}t.blocks=[];for(var c=0,l=i;c<l.length;c++){var u=l[c];t.blocks.push(u.serialize())}if(!e)for(var h=0,d=this.attachedBlocks;h<d.length;h++)u=d[h],-1===i.indexOf(u)&&t.blocks.push(u.serialize());return t},We.prototype._restoreConnections=function(e,t,i){for(var n=0,r=e.outputs;n<r.length;n++)for(var o=r[n],a=0,s=t.blocks;a<s.length;a++)for(var c=s[a],l=i[c.id],u=0,h=c.inputs;u<h.length;u++){var d=h[u];if(i[d.targetBlockId]===e&&d.targetConnectionName===o.name){var p=l.getInputByName(d.inputName);if(!p||p.isConnected)continue;o.connectTo(p,!0),this._restoreConnections(l,t,i)}}},We.prototype.loadFromSerialization=function(e,t,i){var n;void 0===t&&(t=""),void 0===i&&(i=!1),i||this.clear();for(var r={},o=0,a=e.blocks;o<a.length;o++){var s=a[o],c=y.a.GetClass(s.customType);
1c&&((l=new c)._deserialize(s,this.getScene(),t),r[s.id]=l,this.attachedBlocks.push(l))}if(!i){for(var l,u=0;u<e.blocks.length;u++)(l=r[e.blocks[u].id]).inputs.length||this._restoreConnections(l,e,r);for(var h=0,d=e.outputNodes;h<d.length;h++){var p=d[h];this.addOutputNode(r[p])}}if(e.locations||e.editorData&&e.editorData.locations){for(var f=e.locations||e.editorData.locations,m=0,_=f;m<_.length;m++){var g=_[m];r[g.blockId]&&(g.blockId=r[g.blockId].uniqueId)}e.locations?this.editorData={locations:f}:(this.editorData=e.editorData,this.editorData.locations=f);var v=[];for(var b in r)v[b]=r[b].uniqueId;this.editorData.map=v}i||(this._mode=null!==(n=e.mode)&&void 0!==n?n:A.Material)},We.prototype.clone=function(e){var t=this,i=this.serialize(),n=re.a.Clone(function(){return new We(e,t.getScene(),t.options)},this);return n.id=e,n.name=e,n.loadFromSerialization(i),n.build(),n},We.Parse=function(e,t,i){void 0===i&&(i="");var n=re.a.Parse(function(){return new We(e.name,t)},e,t,i);return n.loadFromSerialization(e,i),n.build(),n},We.ParseFromFileAsync=function(e,i,t){var n=new We(e,t);return new Promise(function(e,t){return n.loadAsync(i).then(function(){return e(n)}).catch(t)})},We.ParseFromSnippetAsync=function(o,a,s,c){var e=this;return void 0===s&&(s=""),new Promise(function(i,n){var r=new Ee.a;r.addEventListener("readystatechange",function(){if(4==r.readyState)if(200==r.status){var e=JSON.parse(JSON.parse(r.responseText).jsonPayload),t=JSON.parse(e.nodeMaterial);c||((c=re.a.Parse(function(){return new We(o,a)},t,a,s)).uniqueId=a.getUniqueId()),c.loadFromSerialization(t),c.snippetId=o;try{c.build(),i(c)}catch(e){n(e)}}else n("Unable to load the snippet "+o)}),r.open("GET",e.SnippetUrl+"/"+o.replace(/#/g,"/")),r.send()})},We.CreateDefault=function(e,t){var i=new We(e,t);return i.setToDefault(),i.build(),i},We._BuildIdGenerator=0,We.EditorURL="https://unpkg.com/babylonjs-node-editor@"+x.a.Version+"/babylon.nodeEditor.js",We.SnippetUrl="https://snippet.babylonjs.com",We.IgnoreTexturesAtLoadTime=!1,Object(T.c)([Object(re.c)("mode")],We.prototype,"_mode",void 0),We);function We(e,t,i){void 0===i&&(i={});var n=Ue.call(this,e,t||x.a.LastCreatedScene)||this;return n._buildId=We._BuildIdGenerator++,n._buildWasSuccessful=!1,n._cachedWorldViewMatrix=new C.a,n._cachedWorldViewProjectionMatrix=new C.a,n._optimizers=new Array,n._animationFrame=-1,n.BJSNODEMATERIALEDITOR=n._getGlobalNodeMaterialEditor(),n.editorData=null,n.ignoreAlpha=!1,n.maxSimultaneousLights=4,n.onBuildObservable=new m.c,n._vertexOutputNodes=new Array,n._fragmentOutputNodes=new Array,n.attachedBlocks=new Array,n._mode=A.Material,n._options=Object(T.a)({emitComments:!1},i),n._attachImageProcessingConfiguration(null),n}function He(){var e=Ve.call(this)||this;return e.NORMAL=!1,e.TANGENT=!1,e.UV1=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_UV=!1,e.NUM_MORPH_INFLUENCERS=0,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.BUMPDIRECTUV=0,e.rebuild(),e}y.a.RegisteredTypes["BABYLON.NodeMaterial"]=je,i(107),i(110);var Xe,Ye=(Xe=b,Object(T.d)(Ke,Xe),Ke.prototype.initialize=function(e){e._excludeVariableName("boneSampler"),e._excludeVariableName("boneTextureWidth"),e._excludeVariableName("mBones"),e._excludeVariableName("BonesPerMesh")},Ke.prototype.getClassName=function(){return"BonesBlock"},Object.defineProperty(Ke.prototype,"matricesIndices",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ke.prototype,"matricesWeights",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ke.prototype,"matricesIndicesExtra",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Ke.prototype,"matricesWeightsExtra",{get:function(){return this._inputs[3]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Ke.prototype,"world",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Ke.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ke.prototype.autoConfigure=function(e){var t,i,n;this.matricesIndices.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"matricesIndices"===e.name}))||(t=new te("matricesIndices")).setAsAttribute("matricesIndices"),t.output.connectTo(this.matricesIndices)),this.matricesWeights.isConnected||((i=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"matricesWeights"===e.name}))||(i=new te("matricesWeights")).setAsAttribute("matricesWeights"),i.output.connectTo(this.matricesWeights)),this.world.isConnected||((n=e.getInputBlockByPredicate(function(e){return e.systemValue===a.World}))||(n=new te("world")).setAsSystemValue(a.World),n.output.connectTo(this.world))},Ke.prototype.provideFallbacks=function(e,t){e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton&&t.addCPUSkinningFallback(0,e)},Ke.prototype.bind=function(e,t,i){Z.a.BindBonesParameters(i,e)},Ke.prototype.prepareDefines=function(e,t,i){i._areAttributesDirty&&Z.a.PrepareDefinesForBones(e,i)},Ke.prototype._buildBlock=function(e){Xe.prototype._buildBlock.call(this,e),e.sharedData.blocksWithFallbacks.push(this),e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.uniforms.push("boneTextureWidth"),e.uniforms.push("mBones"),e.samplers.push("boneSampler");var t="//"+this.name;e._emitFunctionFromInclude("bonesDeclaration",t,{removeAttributes:!0,removeUniforms:!1,removeVaryings:!0,removeIfDef:!1});var i=e._getFreeVariableName("influence");e.compilationString+=e._emitCodeFromInclude("bonesVertex",t,{replaceStrings:[{search:/finalWorld=finalWorld\*influence;/,replace:""},{search:/influence/gm,replace:i}]});var n=this._outputs[0],r=this.world;return e.compilationString+="#if NUM_BONE_INFLUENCERS>0\r\n",e.compilationString+=this._declareOutput(n,e)+" = "+r.associatedVariableName+" * "+i+";\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(n,e)+" = "+r.associatedVariableName+";\r\n",e.compilationString+="#endif\r\n",this},Ke);function Ke(e){var t=Xe.call(this,e,me.Vertex)||this;return t.registerInput("matricesIndices",c.Vector4),t.registerInput("matricesWeights",c.Vector4),t.registerInput("matricesIndicesExtra",c.Vector4,!0),t.registerInput("matricesWeightsExtra",c.Vector4,!0),t.registerInput("world",c.Matrix),t.registerOutput("output",c.Matrix),t}y.a.RegisteredTypes["BABYLON.BonesBlock"]=Ye;var Qe,qe=(Qe=b,Object(T.d)(Ze,Qe),Ze.prototype.getClassName=function(){return"InstancesBlock"},Object.defineProperty(Ze.prototype,"world0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ze.prototype,"world1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ze.prototype,"world2",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Ze.prototype,"world3",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Ze.prototype,"world",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Ze.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ze.prototype,"instanceID",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Ze.prototype.autoConfigure=function(e){var t,i,n,r,o;this.world0.connectedPoint||((t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"world0"===e.name}))||(t=new te("world0")).setAsAttribute("world0"),t.output.connectTo(this.world0)),this.world1.connectedPoint||((i=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"world1"===e.name}))||(i=new te("world1")).setAsAttribute("world1"),i.output.connectTo(this.world1)),this.world2.connectedPoint||((n=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"world2"===e.name}))||(n=new te("world2")).setAsAttribute("world2"),n.output.connectTo(this.world2)),this.world3.connectedPoint||((r=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"world3"===e.name}))||(r=new te("world3")).setAsAttribute("world3"),r.output.connectTo(this.world3)),this.world.connectedPoint||((o=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"world"===e.name}
1))||(o=new te("world")).setAsSystemValue(a.World),o.output.connectTo(this.world)),this.world.define="!INSTANCES || THIN_INSTANCES"},Ze.prototype.prepareDefines=function(e,t,i,n,r){void 0===n&&(n=!1);var o=!1;i.INSTANCES!==n&&(i.setValue("INSTANCES",n),o=!0),r&&i.THIN_INSTANCES!==!(null==r||!r.getRenderingMesh().hasThinInstances)&&(i.setValue("THIN_INSTANCES",!(null==r||!r.getRenderingMesh().hasThinInstances)),o=!0),o&&i.markAsUnprocessed()},Ze.prototype._buildBlock=function(e){Qe.prototype._buildBlock.call(this,e),e.sharedData.blocksWithDefines.push(this);var t=this._outputs[0],i=this._outputs[1],n=this.world0,r=this.world1,o=this.world2,a=this.world3;return e.compilationString+="#ifdef INSTANCES\r\n",e.compilationString+=this._declareOutput(t,e)+" = mat4("+n.associatedVariableName+", "+r.associatedVariableName+", "+o.associatedVariableName+", "+a.associatedVariableName+");\r\n",e.compilationString+="#ifdef THIN_INSTANCES\r\n",e.compilationString+=t.associatedVariableName+" = "+this.world.associatedVariableName+" * "+t.associatedVariableName+";\r\n",e.compilationString+="#endif\r\n",e.compilationString+=this._declareOutput(i,e)+" = float(gl_InstanceID);\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(t,e)+" = "+this.world.associatedVariableName+";\r\n",e.compilationString+=this._declareOutput(i,e)+" = 0.0;\r\n",e.compilationString+="#endif\r\n",this},Ze);function Ze(e){var t=Qe.call(this,e,me.Vertex)||this;return t.registerInput("world0",c.Vector4),t.registerInput("world1",c.Vector4),t.registerInput("world2",c.Vector4),t.registerInput("world3",c.Vector4),t.registerInput("world",c.Matrix,!0),t.registerOutput("output",c.Matrix),t.registerOutput("instanceID",c.Float),t}y.a.RegisteredTypes["BABYLON.InstancesBlock"]=qe,i(132),i(131);var Je,$e=(Je=b,Object(T.d)(et,Je),et.prototype.getClassName=function(){return"MorphTargetsBlock"},Object.defineProperty(et.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"tangent",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"positionOutput",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"normalOutput",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"tangentOutput",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"uvOutput",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),et.prototype.initialize=function(e){e._excludeVariableName("morphTargetInfluences")},et.prototype.autoConfigure=function(e){var t,i,n,r;this.position.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"position"===e.name}))||(t=new te("position")).setAsAttribute(),t.output.connectTo(this.position)),this.normal.isConnected||((i=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"normal"===e.name}))||(i=new te("normal")).setAsAttribute("normal"),i.output.connectTo(this.normal)),this.tangent.isConnected||((n=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"tangent"===e.name}))||(n=new te("tangent")).setAsAttribute("tangent"),n.output.connectTo(this.tangent)),this.uv.isConnected||((r=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"uv"===e.name}))||(r=new te("uv")).setAsAttribute("uv"),r.output.connectTo(this.uv))},et.prototype.prepareDefines=function(e,t,i){i._areAttributesDirty&&Z.a.PrepareDefinesForMorphTargets(e,i)},et.prototype.bind=function(e,t,i){i&&i.morphTargetManager&&0<i.morphTargetManager.numInfluencers&&Z.a.BindMorphTargetParameters(i,e)},et.prototype.replaceRepeatableContent=function(e,t,i,n){for(var r=this.position,o=this.normal,a=this.tangent,s=this.uv,c=this.positionOutput,l=this.normalOutput,u=this.tangentOutput,h=this.uvOutput,d=e,p=n.NUM_MORPH_INFLUENCERS,f=i.morphTargetManager,m=f&&f.supportsNormals&&n.NORMAL,_=f&&f.supportsTangents&&n.TANGENT,g=f&&f.supportsUVs&&n.UV1,v="",b=0;b<p;b++)v+="#ifdef MORPHTARGETS\r\n",v+=c.associatedVariableName+" += (position"+b+" - "+r.associatedVariableName+") * morphTargetInfluences["+b+"];\r\n",m&&(v+="#ifdef MORPHTARGETS_NORMAL\r\n",v+=l.associatedVariableName+" += (normal"+b+" - "+o.associatedVariableName+") * morphTargetInfluences["+b+"];\r\n",v+="#endif\r\n"),_&&(v+="#ifdef MORPHTARGETS_TANGENT\r\n",v+=u.associatedVariableName+".xyz += (tangent"+b+" - "+a.associatedVariableName+".xyz) * morphTargetInfluences["+b+"];
1\r\n",v+="#endif\r\n"),g&&(v+="#ifdef MORPHTARGETS_UV\r\n",v+=h.associatedVariableName+".xy += (uv_"+b+" - "+s.associatedVariableName+".xy) * morphTargetInfluences["+b+"];\r\n",v+="#endif\r\n"),v+="#endif\r\n";if(d.compilationString=d.compilationString.replace(this._repeatableContentAnchor,v),0<p)for(b=0;b<p;b++)d.attributes.push(L.b.PositionKind+b),m&&d.attributes.push(L.b.NormalKind+b),_&&d.attributes.push(L.b.TangentKind+b),g&&d.attributes.push(L.b.UVKind+"_"+b)},et.prototype._buildBlock=function(e){Je.prototype._buildBlock.call(this,e),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),e.sharedData.repeatableContentBlocks.push(this);var t=this.position,i=this.normal,n=this.tangent,r=this.uv,o=this.positionOutput,a=this.normalOutput,s=this.tangentOutput,c=this.uvOutput,l="//"+this.name;return e.uniforms.push("morphTargetInfluences"),e._emitFunctionFromInclude("morphTargetsVertexGlobalDeclaration",l),e._emitFunctionFromInclude("morphTargetsVertexDeclaration",l,{repeatKey:"maxSimultaneousMorphTargets"}),e.compilationString+=this._declareOutput(o,e)+" = "+t.associatedVariableName+";\r\n",e.compilationString+="#ifdef NORMAL\r\n",e.compilationString+=this._declareOutput(a,e)+" = "+i.associatedVariableName+";\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(a,e)+" = vec3(0., 0., 0.);\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#ifdef TANGENT\r\n",e.compilationString+=this._declareOutput(s,e)+" = "+n.associatedVariableName+";\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(s,e)+" = vec3(0., 0., 0.);\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#ifdef UV1\r\n",e.compilationString+=this._declareOutput(c,e)+" = "+r.associatedVariableName+";\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(c,e)+" = vec2(0., 0.);\r\n",e.compilationString+="#endif\r\n",this._repeatableContentAnchor=e._repeatableContentAnchor,e.compilationString+=this._repeatableContentAnchor,this},et);function et(e){var t=Je.call(this,e,me.Vertex)||this;return t.registerInput("position",c.Vector3),t.registerInput("normal",c.Vector3),t.registerInput("tangent",c.Vector3),t.registerInput("uv",c.Vector2),t.registerOutput("positionOutput",c.Vector3),t.registerOutput("normalOutput",c.Vector3),t.registerOutput("tangentOutput",c.Vector3),t.registerOutput("uvOutput",c.Vector2),t}y.a.RegisteredTypes["BABYLON.MorphTargetsBlock"]=$e;var tt,it=i(282),nt=(tt=b,Object(T.d)(rt,tt),rt.prototype.getClassName=function(){return"LightInformationBlock"},Object.defineProperty(rt.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"direction",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"color",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"intensity",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),rt.prototype.bind=function(e,t,i){if(i){this.light&&this.light.isDisposed&&(this.light=null);var n=this.light,r=t.getScene();if(!n&&r.lights.length&&(n=r.lights[0]),!n||!n.isEnabled)return e.setFloat3(this._lightDataUniformName,0,0,0),void e.setFloat4(this._lightColorUniformName,0,0,0,0);n.transferToNodeMaterialEffect(e,this._lightDataUniformName),e.setColor4(this._lightColorUniformName,n.diffuse,n.intensity)}},rt.prototype.prepareDefines=function(e,t,i){var n;i._areLightsDirty&&(n=this.light,i.setValue(this._lightTypeDefineName,!!(n&&n instanceof it.a)))},rt.prototype._buildBlock=function(e){tt.prototype._buildBlock.call(this,e),e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this);var t=this.direction,i=this.color,n=this.intensity;return this._lightDataUniformName=e._getFreeVariableName("lightData"),this._lightColorUniformName=e._getFreeVariableName("lightColor"),this._lightTypeDefineName=e._getFreeDefineName("LIGHTPOINTTYPE"),e._emitUniformFromString(this._lightDataUniformName,"vec3"),e._emitUniformFromString(this._lightColorUniformName,"vec4"),e.compilationString+="#ifdef "+this._lightTypeDefineName+"\r\n",e.compilationString+=this._declareOutput(t,e)+" = normalize("+this.worldPosition.associatedVariableName+".xyz - "+this._lightDataUniformName+");\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(t,e)+" = "+this._lightDataUniformName+";\r\n",e.compilationString+="#endif\r\n",e.compilationString+=this._declareOutput(i,e)+" = "+this._lightColorUniformName+".rgb;\r\n",e.compilationString+=this._declareOutput(n,e)+" = "+this._lightColorUniformName+".a;\r\n",this},rt.prototype.serialize=function(){var e=tt.prototype.serialize.call(this);return this.light&&(e.lightId=this.light.id),e},rt.prototype._deserialize=function(e,t,i){tt.prototype._deserialize.call(this,e,t,i),e.lightId&&(this.light=t.getLightByID(e.lightId))},rt);function rt(e){var t=tt.call(this,e,me.Vertex)||this;return t.registerInput("worldPosition",c.Vector4,!1,me.Vertex),t.registerOutput("direction",c.Vector3),t.registerOutput("color",c.Color3),t.registerOutput("intensity",c.Float),t}y.a.RegisteredTypes["BABYLON.LightInformationBlock"]=nt,i(74),i(159),i(160);var ot,at=(ot=b,Object(T.d)(st,ot),st.prototype.getClassName=function(){return"ImageProcessingBlock"},Object.defineProperty(st.prototype,"color",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(st.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),st.prototype.initialize=function(e){e._excludeVariableName("exposureLinear"),e._excludeVariableName("contrast"),e._excludeVariableName("vInverseScreenSize"),e._excludeVariableName("vignetteSettings1"),e._excludeVariableName("vignetteSettings2"),e._excludeVariableName("vCameraColorCurveNegative"),e._excludeVariableName("vCameraColorCurveNeutral"),e._excludeVariableName("vCameraColorCurvePositive"),e._excludeVariableName("txColorTransform"),e._excludeVariableName("colorTransformSettings")},st.prototype.isReady=function(e,t,i){return!(i._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())},st.prototype.prepareDefines=function(e,t,i){i._areImageProcessingDirty&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.prepareDefines(i)},st.prototype.bind=function(e,t,i){i&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e)},st.prototype._buildBlock=function(e){ot.prototype._buildBlock.call(this,e),e.sharedData.blocksWithDefines.push(this),e.sharedData.blockingBlocks.push(this),e.sharedData.bindableBlocks.push(this),e.uniforms.push("exposureLinear"),e.uniforms.push("contrast"),e.uniforms.push("vInverseScreenSize"),e.uniforms.push("vignetteSettings1"),e.uniforms.push("vignetteSettings2"),e.uniforms.push("vCameraColorCurveNegative"),e.uniforms.push("vCameraColorCurveNeutral"),e.uniforms.push("vCameraColorCurvePositive"),e.uniforms.push("txColorTransform"),e.uniforms.push("colorTransformSettings");var t=this.color,i=this._outputs[0],n="//"+this.name;return e._emitFunctionFromInclude("helperFunctions",n),e._emitFunctionFromInclude("imageProcessingDeclaration",n),e._emitFunctionFromInclude("imageProcessingFunctions",n),t.connectedPoint.type===c.Color4||t.connectedPoint.type===c.Vector4?e.compilationString+=this._declareOutput(i,e)+" = "+t.associatedVariableName+";\r\n":e.compilationString+=this._declareOutput(i,e)+" = vec4("+t.associatedVariableName+", 1.0);\r\n",e.compilationString+="#ifdef IMAGEPROCESSINGPOSTPROCESS\r\n",e.compilationString+=i.associatedVariableName+".rgb = toLinearSpace("+t.associatedVariableName+".rgb);\r\n",e.compilationString+="#else\r\n",e.compilationString+="#ifdef IMAGEPROCESSING\r\n",e.compilationString+=i.associatedVariableName+".rgb = toLinearSpace("+t.associatedVariableName+".rgb);\r\n",e.compilationString+=i.associatedVariableName+" = applyImageProcessing("+i.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#endif\r\n",this},st);function st(e){var t=ot.call(this,e,me.Fragment)||this;return t.registerInput("color",c.Color4),t.registerOutput("output",c.Color4),t._inputs[0].acceptedConnectionPointTypes.push(c.Color3),t}y.a.RegisteredTypes["BABYLON.ImageProcessingBlock"]=at,i(221),i(222),i(223);var ct,lt=(ct=b,Object(T.d)(ut,ct),ut.prototype.getClassName=function(){return"PerturbNormalBlock"},Object.defineProperty(ut.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ut.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ut.prototype,"worldTangent",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ut.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(ut.prototype,"normalMapColor",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(ut.prototype,"strength",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(ut.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ut.prototype.prepareDefines=function(e,t,i){i.setValue("BUMP",!0)},ut.prototype.bind=function(e,t,i){t.getScene()._mirroredCameraPosition?e.setFloat2(this._tangentSpaceParameterName,this.invertX?1:-1,this.invertY?1:-1):e.setFloat2(this._tangentSpaceParameterName,this.invertX?-1:1,this.invertY?-1:1)},ut.prototype.autoConfigure=function(e){var t,i;this.uv.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"uv"===e.name}))||(t=new te("uv")).setAsAttribute(),t.output.connectTo(this.uv)),this.strength.isConnected||((i=new te("strength")).value=1,i.output.connectTo(this.strength))},ut.prototype._buildBlock=function(e){ct.prototype._buildBlock.call(this,e);var t="//"+this.name,i=this.uv,n=this.worldPosition,r=this.worldNormal,o=this.worldTangent;e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._tangentSpaceParameterName=e._getFreeDefineName("tangentSpaceParameter"),e._emitUniformFromString(this._tangentSpaceParameterName,"vec2");var a=this.strength.isConnectedToInputBlock&&this.strength.connectInputBlock.isConstant?""+e._emitFloat(1/this.strength.connectInputBlock.value):"1.0 / "+this.strength.associatedVariableName;e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var s={search:/defined\(TANGENT\)/g,replace:o.isConnected?"defined(TANGENT)":"defined(IGNORE)"};return o.isConnected&&(e.compilationString+="vec3 tbnNormal = normalize("+r.associatedVariableName+".xyz);\r\n",e.compilationString+="vec3 tbnTangent = normalize("+o.associatedVariableName+".xyz);\r\n",e.compilationString+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r\n",e.compilationString+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),e._emitFunctionFromInclude("bumpFragmentMainFunctions",t,{replaceStrings:[s]}),e._emitFunctionFromInclude("bumpFragmentFunctions",t,{replaceStrings:[{search:/vBumpInfos.y/g,replace:a},{search:/vTangentSpaceParams/g,replace:this._tangentSpaceParameterName},{search:/vPositionW/g,replace:n.associatedVariableName+".xyz"}]}),e.compilationString+=this._declareOutput(this.output,e)+" = vec4(0.);\r\n",e.compilationString+=e._emitCodeFromInclude("bumpFragment",t,{replaceStrings:[{search:/perturbNormal\(TBN,vBumpUV\+uvOffset\)/g,replace:"perturbN
1ormal(TBN, "+this.normalMapColor.associatedVariableName+")"},{search:/vBumpInfos.y/g,replace:a},{search:/vBumpUV/g,replace:i.associatedVariableName},{search:/vPositionW/g,replace:n.associatedVariableName+".xyz"},{search:/normalW=/g,replace:this.output.associatedVariableName+".xyz = "},{search:/mat3\(normalMatrix\)\*normalW/g,replace:"mat3(normalMatrix) * "+this.output.associatedVariableName+".xyz"},{search:/normalW/g,replace:r.associatedVariableName+".xyz"},s]}),this},ut.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".invertX = "+this.invertX+";\r\n"+this._codeVariableName+".invertY = "+this.invertY+";\r\n"},ut.prototype.serialize=function(){var e=ct.prototype.serialize.call(this);return e.invertX=this.invertX,e.invertY=this.invertY,e},ut.prototype._deserialize=function(e,t,i){ct.prototype._deserialize.call(this,e,t,i),this.invertX=e.invertX,this.invertY=e.invertY},Object(T.c)([xe("Invert X axis",ve.Boolean,"PROPERTIES",{notifiers:{update:!1}})],ut.prototype,"invertX",void 0),Object(T.c)([xe("Invert Y axis",ve.Boolean,"PROPERTIES",{notifiers:{update:!1}})],ut.prototype,"invertY",void 0),ut);function ut(e){var t=ct.call(this,e,me.Fragment)||this;return t._tangentSpaceParameterName="",t.invertX=!1,t.invertY=!1,t.registerInput("worldPosition",c.Vector4,!1),t.registerInput("worldNormal",c.Vector4,!1),t.registerInput("worldTangent",c.Vector4,!0),t.registerInput("uv",c.Vector2,!1),t.registerInput("normalMapColor",c.Color3,!1),t.registerInput("strength",c.Float,!1),t.registerOutput("output",c.Vector4),t}y.a.RegisteredTypes["BABYLON.PerturbNormalBlock"]=lt;var ht,dt=(ht=b,Object(T.d)(pt,ht),pt.prototype.getClassName=function(){return"DiscardBlock"},Object.defineProperty(pt.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(pt.prototype,"cutoff",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),pt.prototype._buildBlock=function(e){return ht.prototype._buildBlock.call(this,e),e.sharedData.hints.needAlphaTesting=!0,e.compilationString+="if ("+this.value.associatedVariableName+" < "+this.cutoff.associatedVariableName+") discard;\r\n",this},pt);function pt(e){var t=ht.call(this,e,me.Fragment,!0)||this;return t.registerInput("value",c.Float,!0),t.registerInput("cutoff",c.Float,!0),t}y.a.RegisteredTypes["BABYLON.DiscardBlock"]=dt;var ft,mt=(ft=b,Object(T.d)(_t,ft),_t.prototype.getClassName=function(){return"FrontFacingBlock"},Object.defineProperty(_t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),_t.prototype._buildBlock=function(e){if(ft.prototype._buildBlock.call(this,e),e.target===me.Vertex)throw"FrontFacingBlock must only be used in a fragment shader";var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = gl_FrontFacing ? 1.0 : 0.0;\r\n",this},_t);function _t(e){var t=ft.call(this,e,me.Fragment)||this;return t.registerOutput("output",c.Float,me.Fragment),t}y.a.RegisteredTypes["BABYLON.FrontFacingBlock"]=mt;var gt,vt=(gt=b,Object(T.d)(bt,gt),bt.prototype.getClassName=function(){return"DerivativeBlock"},Object.defineProperty(bt.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(bt.prototype,"dx",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(bt.prototype,"dy",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),bt.prototype._buildBlock=function(e){gt.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._outputs[1];return e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),t.hasEndpoints&&(e.compilationString+=this._declareOutput(t,e)+" = dFdx("+this.input.associatedVariableName+");\r\n"),i.hasEndpoints&&(e.compilationString+=this._declareOutput(i,e)+" = dFdy("+this.input.associatedVariableName+");\r\n"),this},bt);function bt(e){var t=gt.call(this,e,me.Fragment)||this;return t.registerInput("input",c.AutoDetect,!1),t.registerOutput("dx",c.BasedOnInput),t.registerOutput("dy",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._outputs[1]._typeConnectionSource=t._inputs[0],t}y.a.RegisteredTypes["BABYLON.DerivativeBlock"]=vt;var yt,Tt=(yt=b,Object(T.d)(Et,yt),Et.prototype.getClassName=function(){return"FragCoordBlock"},Object.defineProperty(Et.prototype,"xy",{get:function(){return this._outputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Et.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Et.prototype,"xyzw",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Et.prototype,"x",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Et.prototype,"y",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Et.prototype,"z",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Et.prototype,"output",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Et.prototype.writeOutputs=function(e){for(var t="",i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&(t+=this._declareOutput(r,e)+" = gl_FragCoord."+r.name+";\r\n")}return t},Et.prototype._buildBlock=function(e){if(yt.prototype._buildBlock.call(this,e),e.target===me.Vertex)throw"FragCoordBlock must only be used in a fragment shader";return e.compilationString+=this.writeOutputs(e),this},Et);function Et(e){var t=yt.call(this,e,me.Fragment)||this;return t.registerOutput("xy",c.Vector2,me.Fragment),t.registerOutput("xyz",c.Vector3,me.Fragment),t.registerOutput("xyzw",c.Vector4,me.Fragment),t.registerOutput("x",c.Float,me.Fragment),t.registerOutput("y",c.Float,me.Fragment),t.registerOutput("z",c.Float,me.Fragment),t.registerOutput("w",c.Float,me.Fragment),t}y.a.RegisteredTypes["BABYLON.FragCoordBlock"]=Tt;var St,At=(St=b,Object(T.d)(Ct,St),Ct.prototype.getClassName=function(){return"ScreenSizeBlock"},Object.defineProperty(Ct.prototype,"xy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ct.prototype,"x",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ct.prototype,"y",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Ct.prototype.bind=function(e,t,i){var n=this._scene.getEngine();e.setFloat2(this._varName,n.getRenderWidth(),n.getRenderWidth())},Ct.prototype.writeOutputs=function(e,t){for(var i="",n=0,r=this._outputs;n<r.length;n++){var o=r[n];o.hasEndpoints&&(i+=this._declareOutput(o,e)+" = "+t+"."+o.name+";\r\n")}return i},Ct.prototype._buildBlock=function(e){if(St.prototype._buildBlock.call(this,e),this._scene=e.sharedData.scene,e.target===me.Vertex)throw"ScreenSizeBlock must only be used in a fragment shader";return e.sharedData.bindableBlocks.push(this),this._varName=e._getFreeVariableName("screenSize"),e._emitUniformFromString(this._varName,"vec2"),e.compilationString+=this.writeOutputs(e,this._varName),this},Ct);function Ct(e){var t=St.call(this,e,me.Fragment)||this;return t.registerOutput("xy",c.Vector2,me.Fragment),t.registerOutput("x",c.Float,me.Fragment),t.registerOutput("y",c.Float,me.Fragment),t}y.a.RegisteredTypes["BABYLON.ScreenSizeBlock"]=At,i(201);var Pt,xt=(Pt=b,Object(T.d)(Rt,Pt),Rt.prototype.getClassName=function(){return"FogBlock"},Object.defineProperty(Rt.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Rt.prototype,"view",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Rt.prototype,"input",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Rt.prototype,"fogColor",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Rt.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Rt.prototype.autoConfigure=function(e){var t,i;this.view.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.systemValue===a.View}))||(t=new te("view")).setAsSystemValue(a.View),t.output.connectTo(this.view)),this.fogColor.isConnected||((i=e.getInputBlockByPredicate(function(e){return e.systemValue===a.FogColor}))||(i=new te("fogColor",void 0,c.Color3)).setAsSystemValue(a.FogColor),i.output.connectTo(this.fogColor))},Rt.prototype.prepareDefines=function(e,t,i){var n=e.getScene();i.setValue("FOG",t.fogEnabled&&Z.a.GetFogState(e,n))},Rt.prototype.bind=function(e,t,i){var n;i&&(n=i.getScene(),e.setFloat4(this._fogParameters,n.fogMode,n.fogStart,n.fogEnd,n.fogDensity))},Rt.prototype._buildBlock=function(e){var t,i,n,r,o,a;return Pt.prototype._buildBlock.call(this,e),e.target===me.Fragment?(e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),e._emitFunctionFromInclude("fogFragmentDeclaration","//"+this.name,{removeUniforms:!0,removeVaryings:!0,removeIfDef:!1,replaceStrings:[{search:/float CalcFogFactor\(\)/,replace:"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)"}]}),t=e._getFreeVariableName("fog"),i=this.input,n=this.fogColor,this._fogParameters=e._getFreeVariableName("fogParameters"),r=this._outputs[0],e._emitUniformFromString(this._fogParameters,"vec4"),e.compilationString+="#ifdef FOG\r\n",e.compilationString+="float "+t+" = CalcFogFactor("+this._fogDistanceName+", "+this._fogParameters+");\r\n",e.compilationString+=this._declareOutput(r,e)+" = "+t+" * "+i.associatedVariableName+".rgb + (1.0 - "+t+") * "+n.associatedVariableName+".rgb;\r\n",e.compilationString+="#else\r\n"+this._declareOutput(r,e)+" = "+i.associatedVariableName+".rgb;\r\n",e.compilationString+="#endif\r\n"):(o=this.worldPosition,a=this.view,this._fogDistanceName=e._getFreeVariableName("vFogDistance"),e._emitVaryingFromString(this._fogDistanceName,"vec3"),e.compilationString+=this._fogDistanceName+" = ("+a.associatedVariableName+" * "+o.associatedVariableName+").xyz;\r\n"),this},Rt);function Rt(e){var t=Pt.call(this,e,me.VertexAndFragment,!0)||this;return t.registerInput("worldPosition",c.Vector4,!1,me.Vertex),t.registerInput("view",c.Matrix,!1,me.Vertex),t.registerInput("input",c.Color3,!1,me.Fragment),t.registerInput("fogColor",c.Color3,!1,me.Fragment),t.registerOutput("output",c.Color3,me.Fragment),t.input.acceptedConnectionPointTypes.push(c.Color4),t.fogColor.acceptedConnectionPointTypes.push(c.Color4),t}y.a.RegisteredTypes["BABYLON.FogBlock"]=xt,i(157),i(158),i(224),i(308),i(219),i(227);var Ot,Mt=(Ot=b,Object(T.d)(It,Ot),It.prototype.getClassName=function(){return"LightBlock"},Object.defineProperty(It.prototype,"worldPosition",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"cameraPosition",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"glossiness",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"glossPower",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"diffuseColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"specularColor",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"diffuseOutput",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"specularOutput",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"shadow",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),It.prototype.autoConfigure=function(e){var t;this.cameraPosition.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.systemValue===a.CameraPosition}))||(t=new te("cameraPosition")).setAsSystemValue(a.CameraPosition),t.output.connectTo(this.cameraPosition))},It.prototype.prepareDefines=function(e,t,i){var n,r;i._areLightsDirty&&(n=e.getScene(),this.light?(r={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1},Z.a.PrepareDefinesForLight(n,e,this.light,this._lightId,i,!0,r),r.needRebuild&&i.rebuild()):Z.a.PrepareDefinesForLights(n,e,i,!0,t.maxSimultaneousLights))},It.prototype.updateUniformsAndSamples=function(e,t,i,n){for(var r=0;r<t.maxSimultaneousLights&&i["LIGHT"+r];r++)Z.a.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i["PROJECTEDLIGHTTEXTURE"+r],n)},It.prototype.bind=function(e,t,i){var n;i&&(n=i.getScene(),this.light?Z.a.BindLight(this.light,this._lightId,n,e,!0):Z.a.BindLights(n,i,e,!0,t.maxSimultaneousLights))},It.prototype._injectVertexCode=function(e){var t=this.worldPosition,i="//"+this.name;this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",i,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var n="v_"+t.associatedVariableName;e._emitVaryingFromString(n,"vec4")&&(e.compilationString+=n+" = "+t.associatedVariableName+";\r\n"),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:t.associatedVariableName}]}):(e.compilationString+="vec4 worldPos = "+t.associatedVariableName+";\r\n",e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{repeatKey:"maxSimultaneousLights"}))},It.prototype._buildBlock=function(e){if(Ot.prototype._buildBlock.call(this,e),e.target===me.Fragment){e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this);var t="//"+this.name,i=this.worldPosition;e._emitFunctionFromInclude("helperFunctions",t),e._emitFunctionFromInclude("lightsFragmentFunctions",t,{replaceStrings:[{search:/vPositionW/g,replace:"v_"+i.associatedVariableName+".xyz"}]}),e._emitFunctionFromInclude("shadowsFragmentFunctions",t,{replaceStrings:[{search:/vPositionW/g,replace:"v_"+i.associatedVariableName+".xyz"}]}),this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{repeatKey:"maxSimultaneousLights"}),0===this._lightId&&(e._registerTempVariable("viewDirectionW")&&(e.compilationString+="vec3 viewDirectionW = normalize("+this.cameraPosition.associatedVariableName+" - v_"+i.associatedVariableName+".xyz);\r\n"),e.compilationString+="lightingInfo info;\r\n",e.compilationString+="float shadow = 1.;\r\n",e.compilationString+="float glossiness = "+(this.glossiness.isConnected?this.glossiness.associatedVariableName:"1.0")+" * "+(this.glossPower.isConnected?this.glossPower.associatedVariableName:"1024.0")+";\r\n",e.compilationString+="vec3 diffuseBase = vec3(0., 0., 0.);\r\n",e.compilationString+="vec3 specularBase = vec3(0., 0., 0.);\r\n",e.compilationString+="vec3 normalW = "+this.worldNormal.associatedVariableName+".xyz;\r\n"),this.light?e.compilationString+=e._emitCodeFromInclude("lightFragment",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):e.compilationString+=e._emitCodeFromInclude("lightFragment",t,{repeatKey:"maxSimultaneousLights"});var n=this.diffuseOutput,r=this.specularOutput;return e.compilationString+=this._declareOutput(n,e)+" = diffuseBase"+(this.diffuseColor.isConnected?" * "+this.diffuseColor.associatedVariableName:"")+";\r\n",r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+" = specularBase"+(this.specularColor.isConnected?" * "+this.specularColor.associatedVariableName:"")+";\r\n"),this.shadow.hasEndpoints&&(e.compilationString+=this._declareOutput(this.shadow,e)+" = shadow;\r\n"),this}this._injectVertexCode(e)},It.prototype.serialize=function(){var e=Ot.prototype.serialize.call(this);return this.light&&(e.lightId=this.light.id),e},It.prototype._deserialize=function(e,t,i){Ot.prototype._deserialize.call(this,e,t,i),e.lightId&&(this.light=t.getLightByID(e.lightId))},It);function It(e){var t=Ot.call(this,e,me.VertexAndFragment)||this;return t._isUnique=!0,t.registerInput("worldPosition",c.Vector4,!1,me.Vertex),t.registerInput("worldNormal",c.Vector4,!1,me.Fragment),t.registerInput("cameraPosition",c.Vector3,!1,me.Fragment),t.registerInput("glossiness",c.Float,!0,me.Fragment),t.registerInput("glossPower",c.Float,!0,me.Fragment),t.registerInput("diffuseColor",c.Color3,!0,me.Fragment),t.registerInput("specularColor",c.Color3,!0,me.Fragment),t.registerOutput("diffuseOutput",c.Color3,me.Fragment),t.registerOutput("specularOutput",c.Color3,me.Fragment),t.registerOutput("shadow",c.Float,me.Fragment),t}y.a.RegisteredTypes["BABYLON.LightBlock"]=Mt;var Dt,Lt=(Dt=b,Object(T.d)(Nt,Dt),Nt.prototype.getClassName=function(){return"TextureBlock"},Object.defineProperty(Nt.prototype,"uv",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Nt.prototype,"target",{get:function(){if(!this.uv.isConnected)return me.VertexAndFragment;if(this.uv.sourceBlock.isInput)return me.VertexAndFragment;for(var e=this.uv.connectedPoint;e;){if(e.target===me.Fragment)return me.Fragment;if(e.target===me.Vertex)return me.VertexAndFragment;if(e.target===me.Neutral||e.target===me.VertexAndFragment)for(var t=e.ownerBlock,e=null,i=0,n=t.inputs;i<n.length;i++){var r=n[i];if(r.connectedPoint){e=r.connectedPoint;break}}}return me.VertexAndFragment},enumerable:!1,configurable:!0}),Nt.prototype.autoConfigure=function(e){var t,i;this.uv.isConnected||(e.mode===A.PostProcess?(t=e.getBlockByPredicate(function(e){return"uv"===e.name}))&&t.connectTo(this):(i=e.mode===A.Particle?"particle_uv":"uv",(t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&e.name===i}))||(t=new te("uv")).setAsAttribute(i),t.output.connectTo(this.uv)))},Nt.prototype.initializeDefines=function(e,t,i,n){void 0===n&&(n=!1),i._areTexturesDirty&&i.setValue(this._mainUVDefineName,!1)},Nt.prototype.prepareDefines=function(e,t,i){if(i._areTexturesDirty){if(!this.texture||!this.texture.getTextureMatrix)return i.setValue(this._defineName,!1),void i.setValue(this._mainUVDefineName,!0);i.setValue(this._linearDefineName,this.convertToGammaSpace),i.setValue(this._gammaDefineName,this.convertToLinearSpace),this._isMixed&&(this.texture.getTextureMatrix().isIdentityAs3x2()?(i.setValue(this._defineName,!1),i.setValue(this._mainUVDefineName,!0)):i.setValue(this._defineName,!0))}},Nt.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},Nt.prototype.bind=function(e,t,i){this.texture&&(this._isMixed&&(e.setFloat(this._textureInfoName,this.texture.level),e.setMatrix(this._textureTransformName,this.texture.getTextureMatrix())),e.setTexture(this._samplerName,this.texture))},Object.defineProperty(Nt.prototype,"_isMixed",{get:function(){return this.target!==me.Fragment},enumerable:!1,configurable:!0}),Nt.prototype._injectVertexCode=function(e){var t=this.uv;if(this._defineName=e._getFreeDefineName("UVTRANSFORM"),this._mainUVDefineName="VMAIN"+t.associatedVariableName.toUpperCase(),t.connectedPoint.ownerBlock.isInput&&(t.connectedPoint.ownerBlock.isAttribute||e._emitUniformFromString(t.associatedVariableName,"vec2")),this._mainUVName="vMain"+t.associatedVariableName,this._transformedUVName=e._getFreeVariableName("transformedUV"),this._textureTransformName=e._getFreeVariableName("textureTransform"),this._textureInfoName=e._getFreeVariableName("textureInfoName"),e._emitVaryingFromString(this._transformedUVName,"vec2",this._defineName),e._emitVaryingFromString(this._mainUVName,"vec2",this._mainUVDefineName),e._emitUniformFromString(this._textureTransformName,"mat4",this._defineName),e.compilationString+="#ifdef "+this._defineName+"\r\n",e.compilationString+=this._transformedUVName+" = vec2("+this._textureTransformName+" * vec4("+t.associatedVariableName+".xy, 1.0, 0.0));\r\n",e.compilationString+="#elif defined("+this._mainUVDefineName+")\r\n",e.compilationString+=this._mainUVName+" = "+t.associatedVariableName+".xy;\r\n",e.compilationString+="#endif\r\n",this._outputs.some(function(e){return e.isConnectedInVertexShader})){this._writeTextureRead(e,!0);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name,!0)}}},Nt.prototype._writeTextureRead=function(e,t){void 0===t&&(t=!1);var i=this.uv;if(t){if(e.target===me.Fragment)return;e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+i.associatedVariableName+");\r\n"}else this.uv.ownerBlock.target===me.Fragment||this._fragmentOnly?e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+i.associatedVariableName+");\r\n":(e.compilationString+="#ifdef "+this._defineName+"\r\n",e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+this._transformedUVName+");\r\n",e.compilationString+="#elif defined("+this._mainUVDefineName+")\r\n",e.compilationString+="vec4 "+this._tempTextureRead+" = texture2D("+this._samplerName+", "+this._mainUVName+");\r\n",e.compilationString+="#endif\r\n")},Nt.prototype._writeOutput=function(e,t,i,n){if(void 0===n&&(n=!1),n){if(e.target===me.Fragment)return;e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+";\r\n"}else{var r;this.uv.ownerBlock.target!==me.Fragment?(r=" * "+this._textureInfoName,e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+r+";\r\n","a"!==i&&(e.compilationString+="#ifdef "+this._linearDefineName+"\r\n",e.compilationString+=t.associatedVariableName+" = toGammaSpace("+t.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#ifdef "+this._gammaDefineName+"\r\n",e.compilationString+=t.associatedVariableName+" = toLinearSpace("+t.associatedVariableName+");\r\n",e.compilationString+="#endif\r\n")):e.compilationString+=this._declareOutput(t,e)+" = "+this._tempTextureRead+"."+i+";\r\n"}},Nt.prototype._buildBlock=function(e){if(Dt.prototype._buildBlock.call(this,e),e.target!==me.Vertex&&!this._fragmentOnly||(this._tempTextureRead=e._getFreeVariableName("tempTextureRead")),(!this._isMixed&&e.target===me.Fragment||this._isMixed&&e.target===me.Vertex)&&(this._samplerName=e._getFreeVariableName(this.name+"Sampler"),e._emit2DSampler(this._samplerName),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this)),e.target===me.Fragment){if(this._outputs.some(function(e){return e.isConnectedInFragmentShader})){this._isMixed&&e._emit2DSampler(this._samplerName),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");var t="//"+this.name;e._emitFunctionFromInclude("helperFunctions",t),this._isMixed&&e._emitUniformFromString(this._textureInfoName,"float"),this._writeTextureRead(e);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name)}
1return this}}else this._injectVertexCode(e)},Nt.prototype._dumpPropertiesCode=function(){if(!this.texture)return"";var e=this._codeVariableName+'.texture = new BABYLON.Texture("'+this.texture.name+'", null);\r\n';return e+=this._codeVariableName+".texture.wrapU = "+this.texture.wrapU+";\r\n",e+=this._codeVariableName+".texture.wrapV = "+this.texture.wrapV+";\r\n",e+=this._codeVariableName+".texture.uAng = "+this.texture.uAng+";\r\n",e+=this._codeVariableName+".texture.vAng = "+this.texture.vAng+";\r\n",e+=this._codeVariableName+".texture.wAng = "+this.texture.wAng+";\r\n",e+=this._codeVariableName+".texture.uOffset = "+this.texture.uOffset+";\r\n",e+=this._codeVariableName+".texture.vOffset = "+this.texture.vOffset+";\r\n",e+=this._codeVariableName+".texture.uScale = "+this.texture.uScale+";\r\n",e+=this._codeVariableName+".texture.vScale = "+this.texture.vScale+";\r\n",(e+=this._codeVariableName+".convertToGammaSpace = "+this.convertToGammaSpace+";\r\n")+this._codeVariableName+".convertToLinearSpace = "+this.convertToLinearSpace+";\r\n"},Nt.prototype.serialize=function(){var e=Dt.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,e.fragmentOnly=this._fragmentOnly,this.texture&&(e.texture=this.texture.serialize()),e},Nt.prototype._deserialize=function(e,t,i){Dt.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,this._fragmentOnly=!!e.fragmentOnly,e.texture&&!je.IgnoreTexturesAtLoadTime&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=oe.a.Parse(e.texture,t,i))},Nt);function Nt(e,t){void 0===t&&(t=!1);var i=Dt.call(this,e,me.VertexAndFragment)||this;return i.convertToGammaSpace=!1,i.convertToLinearSpace=!1,i._fragmentOnly=t,i.registerInput("uv",c.Vector2,!1,me.VertexAndFragment),i.registerOutput("rgba",c.Color4,me.Neutral),i.registerOutput("rgb",c.Color3,me.Neutral),i.registerOutput("r",c.Float,me.Neutral),i.registerOutput("g",c.Float,me.Neutral),i.registerOutput("b",c.Float,me.Neutral),i.registerOutput("a",c.Float,me.Neutral),i._inputs[0].acceptedConnectionPointTypes.push(c.Vector3),i._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),i._inputs[0]._prioritizeVertex=!t,i}y.a.RegisteredTypes["BABYLON.TextureBlock"]=Lt,i(220);var Ft,wt=i(86),Bt=(Ft=b,Object(T.d)(Ut,Ft),Ut.prototype.getClassName=function(){return"ReflectionTextureBaseBlock"},Ut.prototype._getTexture=function(){return this.texture},Ut.prototype.autoConfigure=function(e){var t,i,n;this.position.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.isAttribute&&"position"===e.name}))||(t=new te("position")).setAsAttribute(),t.output.connectTo(this.position)),this.world.isConnected||((i=e.getInputBlockByPredicate(function(e){return e.systemValue===a.World}))||(i=new te("world")).setAsSystemValue(a.World),i.output.connectTo(this.world)),this.view.isConnected||((n=e.getInputBlockByPredicate(function(e){return e.systemValue===a.View}))||(n=new te("view")).setAsSystemValue(a.View),n.output.connectTo(this.view))},Ut.prototype.prepareDefines=function(e,t,i){var n;!i._areTexturesDirty||(n=this._getTexture())&&n.getTextureMatrix&&(i.setValue(this._define3DName,n.isCube,!0),i.setValue(this._defineLocalCubicName,!!n.boundingBoxSize,!0),i.setValue(this._defineExplicitName,n.coordinatesMode===Ae.a.TEXTURE_EXPLICIT_MODE,!0),i.setValue(this._defineSkyboxName,n.coordinatesMode===Ae.a.TEXTURE_SKYBOX_MODE,!0),i.setValue(this._defineCubicName,n.coordinatesMode===Ae.a.TEXTURE_CUBIC_MODE,!0),i.setValue(this._defineSphericalName,n.coordinatesMode===Ae.a.TEXTURE_SPHERICAL_MODE,!0),i.setValue(this._definePlanarName,n.coordinatesMode===Ae.a.TEXTURE_PLANAR_MODE,!0),i.setValue(this._defineProjectionName,n.coordinatesMode===Ae.a.TEXTURE_PROJECTION_MODE,!0),i.setValue(this._defineEquirectangularName,n.coordinatesMode===Ae.a.TEXTURE_EQUIRECTANGULAR_MODE,!0),i.setValue(this._defineEquirectangularFixedName,n.coordinatesMode===Ae.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,!0),i.setValue(this._defineMirroredEquirectangularFixedName,n.coordinatesMode===Ae.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,!0))},Ut.prototype.isReady=function(){var e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())},Ut.prototype.bind=function(e,t,i){var n=this._getTexture();
1i&&n&&(e.setMatrix(this._reflectionMatrixName,n.getReflectionTextureMatrix()),n.isCube?e.setTexture(this._cubeSamplerName,n):e.setTexture(this._2DSamplerName,n))},Ut.prototype.handleVertexSide=function(e){this._define3DName=e._getFreeDefineName("REFLECTIONMAP_3D"),this._defineCubicName=e._getFreeDefineName("REFLECTIONMAP_CUBIC"),this._defineSphericalName=e._getFreeDefineName("REFLECTIONMAP_SPHERICAL"),this._definePlanarName=e._getFreeDefineName("REFLECTIONMAP_PLANAR"),this._defineProjectionName=e._getFreeDefineName("REFLECTIONMAP_PROJECTION"),this._defineExplicitName=e._getFreeDefineName("REFLECTIONMAP_EXPLICIT"),this._defineEquirectangularName=e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR"),this._defineLocalCubicName=e._getFreeDefineName("USE_LOCAL_REFLECTIONMAP_CUBIC"),this._defineMirroredEquirectangularFixedName=e._getFreeDefineName("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"),this._defineEquirectangularFixedName=e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR_FIXED"),this._defineSkyboxName=e._getFreeDefineName("REFLECTIONMAP_SKYBOX"),this._defineOppositeZ=e._getFreeDefineName("REFLECTIONMAP_OPPOSITEZ"),this._reflectionMatrixName=e._getFreeVariableName("reflectionMatrix"),e._emitUniformFromString(this._reflectionMatrixName,"mat4");var t="",i="v_"+this.worldPosition.associatedVariableName;return e._emitVaryingFromString(i,"vec4")&&(t+=i+" = "+this.worldPosition.associatedVariableName+";\r\n"),this._positionUVWName=e._getFreeVariableName("positionUVW"),this._directionWName=e._getFreeVariableName("directionW"),e._emitVaryingFromString(this._positionUVWName,"vec3",this._defineSkyboxName)&&(t+="#ifdef "+this._defineSkyboxName+"\r\n",t+=this._positionUVWName+" = "+this.position.associatedVariableName+".xyz;\r\n",t+="#endif\r\n"),e._emitVaryingFromString(this._directionWName,"vec3","defined("+this._defineEquirectangularFixedName+") || defined("+this._defineMirroredEquirectangularFixedName+")")&&(t+="#if defined("+this._defineEquirectangularFixedName+") || defined("+this._defineMirroredEquirectangularFixedName+")\r\n",t+=this._directionWName+" = normalize(vec3("+this.world.associatedVariableName+" * vec4("+this.position.associatedVariableName+".xyz, 0.0)));\r\n",t+="#endif\r\n"),t},Ut.prototype.handleFragmentSideInits=function(e){e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),e._samplerDeclaration+="#ifdef "+this._define3DName+"\r\n",e._samplerDeclaration+="uniform samplerCube "+this._cubeSamplerName+";\r\n",e._samplerDeclaration+="#else\r\n",e._samplerDeclaration+="uniform sampler2D "+this._2DSamplerName+";\r\n",e._samplerDeclaration+="#endif\r\n",e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this);var t="//"+this.name;e._emitFunction("ReciprocalPI","#define RECIPROCAL_PI2 0.15915494",""),e._emitFunctionFromInclude("reflectionFunction",t,{replaceStrings:[{search:/vec3 computeReflectionCoords/g,replace:"void DUMMYFUNC"}]}),this._reflectionColorName=e._getFreeVariableName("reflectionColor"),this._reflectionVectorName=e._getFreeVariableName("reflectionUVW"),this._reflectionCoordsName=e._getFreeVariableName("reflectionCoords")},Ut.prototype.handleFragmentSideCodeReflectionCoords=function(e,t,i){void 0===i&&(i=!1),t=t||"v_"+this.worldPosition.associatedVariableName;var n=this._reflectionMatrixName,r="normalize("+this._directionWName+")",o=""+this._positionUVWName,a=""+this.cameraPosition.associatedVariableName,s=""+this.view.associatedVariableName;e+=".xyz";var c="\n #ifdef "+this._defineMirroredEquirectangularFixedName+"\n vec3 "+this._reflectionVectorName+" = computeMirroredFixedEquirectangularCoords("+t+", "+e+", "+r+");\n #endif\n\n #ifdef "+this._defineEquirectangularFixedName+"\n vec3 "+this._reflectionVectorName+" = computeFixedEquirectangularCoords("+t+", "+e+", "+r+");\n #endif\n\n #ifdef "+this._defineEquirectangularName+"\n vec3 "+this._reflectionVectorName+" = computeEquirectangularCoords("+t+", "+e+", "+a+".xyz, "+n+");\n #endif\n\n #ifdef "+this._defineSphericalName+"\n vec3 "+this._reflectionVectorName+" = computeSphericalCoords("+t+", "+e+", "+s+", "+n+");\n #endif\n\n #ifdef "+this._definePlanarName+"\n vec3 "+this._reflectionVectorName+" = computePlanarCoords("+t+", "+e+", "+a+".xyz, "+n+");\n #endif\n\n #ifdef "+this._defineCubicName+"\n #ifdef "+this._defineLocalCubicName+"\n vec3 "+this._reflectionVectorName+" = computeCubicLocalCoords("+t+", "+e+", "+a+".xyz, "+n+", vReflectionSize, vReflectionPosition);\n #else\n vec3 "+this._reflectionVectorName+" = computeCubicCoords("+t+", "+e+", "+a+".xyz, "+n+");\n #endif\n #endif\n\n #ifdef "+this._defineProjectionName+"\n vec3 "+this._reflectionVectorName+" = computeProjectionCoords("+t+", "+s+", "+n+");\n #endif\n\n #ifdef "+this._defineSkyboxName+"\n vec3 "+this._reflectionVectorName+" = computeSkyBoxCoords("+o+", "+n+");\n #endif\n\n #ifdef "+this._defineExplicitName+"\n vec3 "+this._reflectionVectorName+" = vec3(0, 0, 0);\n #endif\n\n #ifdef "+this._defineOppositeZ+"\n "+this._reflectionVectorName+".z *= -1.0;\n #endif\r\n";
1return i||(c+="\n #ifdef "+this._define3DName+"\n vec3 "+this._reflectionCoordsName+" = "+this._reflectionVectorName+";\n #else\n vec2 "+this._reflectionCoordsName+" = "+this._reflectionVectorName+".xy;\n #ifdef "+this._defineProjectionName+"\n "+this._reflectionCoordsName+" /= "+this._reflectionVectorName+".z;\n #endif\n "+this._reflectionCoordsName+".y = 1.0 - "+this._reflectionCoordsName+".y;\n #endif\r\n"),c},Ut.prototype.handleFragmentSideCodeReflectionColor=function(e,t){void 0===t&&(t=".rgb");var i="vec"+(0===t.length?"4":t.length-1)+" "+this._reflectionColorName+";\n #ifdef "+this._define3DName+"\r\n";return i+=e?this._reflectionColorName+" = textureCubeLodEXT("+this._cubeSamplerName+", "+this._reflectionVectorName+", "+e+")"+t+";\r\n":this._reflectionColorName+" = textureCube("+this._cubeSamplerName+", "+this._reflectionVectorName+")"+t+";\r\n",i+="\n #else\r\n",(i+=e?this._reflectionColorName+" = texture2DLodEXT("+this._2DSamplerName+", "+this._reflectionCoordsName+", "+e+")"+t+";\r\n":this._reflectionColorName+" = texture2D("+this._2DSamplerName+", "+this._reflectionCoordsName+")"+t+";\r\n")+"#endif\r\n"},Ut.prototype.writeOutputs=function(e,t){var i="";if(e.target===me.Fragment)for(var n=0,r=this._outputs;n<r.length;n++){var o=r[n];o.hasEndpoints&&(i+=this._declareOutput(o,e)+" = "+t+"."+o.name+";\r\n")}return i},Ut.prototype._buildBlock=function(e){return Ft.prototype._buildBlock.call(this,e),this},Ut.prototype._dumpPropertiesCode=function(){return this.texture?(e=this.texture.isCube?this._codeVariableName+'.texture = new BABYLON.CubeTexture("'+this.texture.name+'");\r\n':this._codeVariableName+'.texture = new BABYLON.Texture("'+this.texture.name+'");\r\n',e+=this._codeVariableName+".texture.coordinatesMode = "+this.texture.coordinatesMode+";\r\n"):"";var e},Ut.prototype.serialize=function(){var e=Ft.prototype.serialize.call(this);return this.texture&&(e.texture=this.texture.serialize()),e},Ut.prototype._deserialize=function(e,t,i){Ft.prototype._deserialize.call(this,e,t,i),e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,e.texture.isCube?this.texture=wt.a.Parse(e.texture,t,i):this.texture=oe.a.Parse(e.texture,t,i))},Ut);function Ut(e){return Ft.call(this,e,me.VertexAndFragment)||this}y.a.RegisteredTypes["BABYLON.ReflectionTextureBaseBlock"]=Bt;var Vt,kt=(Vt=Bt,Object(T.d)(Gt,Vt),Gt.prototype.getClassName=function(){return"ReflectionTextureBlock"},Object.defineProperty(Gt.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"worldPosition",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"worldNormal",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"world",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"cameraPosition",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"view",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"rgb",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"rgba",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Gt.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Gt.prototype.autoConfigure=function(e){var t;Vt.prototype.autoConfigure.call(this,e),this.cameraPosition.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.systemValue===a.CameraPosition}
1))||(t=new te("cameraPosition")).setAsSystemValue(a.CameraPosition),t.output.connectTo(this.cameraPosition))},Gt.prototype._buildBlock=function(e){if(Vt.prototype._buildBlock.call(this,e),!this.texture)return e.compilationString+=this.writeOutputs(e,"vec3(0.)"),this;if(e.target!==me.Fragment)return e.compilationString+=this.handleVertexSide(e),this;this.handleFragmentSideInits(e);var t=e._getFreeVariableName("normalWUnit");return e.compilationString+="vec4 "+t+" = normalize("+this.worldNormal.associatedVariableName+");\r\n",e.compilationString+=this.handleFragmentSideCodeReflectionCoords(t),e.compilationString+=this.handleFragmentSideCodeReflectionColor(void 0,""),e.compilationString+=this.writeOutputs(e,this._reflectionColorName),this},Gt);function Gt(e){var t=Vt.call(this,e)||this;return t.registerInput("position",c.Vector3,!1,me.Vertex),t.registerInput("worldPosition",c.Vector4,!1,me.Vertex),t.registerInput("worldNormal",c.Vector4,!1,me.Fragment),t.registerInput("world",c.Matrix,!1,me.Vertex),t.registerInput("cameraPosition",c.Vector3,!1,me.Fragment),t.registerInput("view",c.Matrix,!1,me.Fragment),t.registerOutput("rgb",c.Color3,me.Fragment),t.registerOutput("rgba",c.Color4,me.Fragment),t.registerOutput("r",c.Float,me.Fragment),t.registerOutput("g",c.Float,me.Fragment),t.registerOutput("b",c.Float,me.Fragment),t.registerOutput("a",c.Float,me.Fragment),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t}y.a.RegisteredTypes["BABYLON.ReflectionTextureBlock"]=kt;var zt,jt=(zt=b,Object(T.d)(Wt,zt),Wt.prototype.getClassName=function(){return"AddBlock"},Object.defineProperty(Wt.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Wt.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Wt.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Wt.prototype._buildBlock=function(e){zt.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = "+this.left.associatedVariableName+" + "+this.right.associatedVariableName+";\r\n",this},Wt);function Wt(e){var t=zt.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.AddBlock"]=jt;var Ht,Xt=(Ht=b,Object(T.d)(Yt,Ht),Yt.prototype.getClassName=function(){return"ScaleBlock"},Object.defineProperty(Yt.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Yt.prototype,"factor",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Yt.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Yt.prototype._buildBlock=function(e){Ht.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = "+this.input.associatedVariableName+" * "+this.factor.associatedVariableName+";\r\n",this},Yt);function Yt(e){var t=Ht.call(this,e,me.Neutral)||this;return t.registerInput("input",c.AutoDetect),t.registerInput("factor",c.Float),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t}y.a.RegisteredTypes["BABYLON.ScaleBlock"]=Xt;var Kt,Qt=(Kt=b,Object(T.d)(qt,Kt),qt.prototype.getClassName=function(){return"ClampBlock"},Object.defineProperty(qt.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(qt.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),qt.prototype._buildBlock=function(e){Kt.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = clamp("+this.value.associatedVariableName+", "+this._writeFloat(this.minimum)+", "+this._writeFloat(this.maximum)+");\r\n",this},qt.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".minimum = "+this.minimum+";\r\n"+this._codeVariableName+".maximum = "+this.maximum+";\r\n"},qt.prototype.serialize=function(){var e=Kt.prototype.serialize.call(this);return e.minimum=this.minimum,e.maximum=this.maximum,e},qt.prototype._deserialize=function(e,t,i){Kt.prototype._deserialize.call(this,e,t,i),this.minimum=e.minimum,this.maximum=e.maximum},Object(T.c)([xe("Minimum",ve.Float)],qt.prototype,"minimum",void 0),Object(T.c)([xe("Maximum",ve.Float)],qt.prototype,"maximum",void 0),qt);function qt(e){var t=Kt.call(this,e,me.Neutral)||this;return t.minimum=0,t.maximum=1,t.registerInput("value",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t}y.a.RegisteredTypes["BABYLON.ClampBlock"]=Qt;var Zt,Jt=(Zt=b,Object(T.d)($t,Zt),$t.prototype.getClassName=function(){return"CrossBlock"},Object.defineProperty($t.prototype,"left",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty($t.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty($t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),$t.prototype._buildBlock=function(e){Zt.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = cross("+this.left.associatedVariableName+".xyz, "+this.right.associatedVariableName+".xyz);\r\n",this},$t);function $t(e){var t=Zt.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.Vector3),t._linkConnectionTypes(0,1),t._inputs[0].excludedConnectionPointTypes.push(c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t._inputs[0].excludedConnectionPointTypes.push(c.Vector2),t._inputs[1].excludedConnectionPointTypes.push(c.Float),t._inputs[1].excludedConnectionPointTypes.push(c.Matrix),t._inputs[1].excludedConnectionPointTypes.push(c.Vector2),t}y.a.RegisteredTypes["BABYLON.CrossBlock"]=Jt;var ei,ti=(ei=b,Object(T.d)(ii,ei),ii.prototype.getClassName=function(){return"DotBlock"},Object.defineProperty(ii.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ii.prototype._buildBlock=function(e){ei.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = dot("+this.left.associatedVariableName+", "+this.right.associatedVariableName+");\r\n",this},ii);function ii(e){var t=ei.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.Float),t._linkConnectionTypes(0,1),t._inputs[0].excludedConnectionPointTypes.push(c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t._inputs[1].excludedConnectionPointTypes.push(c.Float),t._inputs[1].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.DotBlock"]=ti;var ni,ri,oi,ai=(ri=b,Object(T.d)(si,ri),si.prototype.getClassName=function(){return"NormalizeBlock"},Object.defineProperty(si.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(si.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),si.prototype._buildBlock=function(e){ri.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._inputs[0];return e.compilationString+=this._declareOutput(t,e)+" = normalize("+i.associatedVariableName+");\r\n",this},si);function si(e){var t=ri.call(this,e,me.Neutral)||this;return t.registerInput("input",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._inputs[0].excludedConnectionPointTypes.push(c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.NormalizeBlock"]=ai,(oi=ni=ni||{})[oi.Cos=0]="Cos",oi[oi.Sin=1]="Sin",oi[oi.Abs=2]="Abs",oi[oi.Exp=3]="Exp",oi[oi.Exp2=4]="Exp2",oi[oi.Round=5]="Round",oi[oi.Floor=6]="Floor",oi[oi.Ceiling=7]="Ceiling",oi[oi.Sqrt=8]="Sqrt",oi[oi.Log=9]="Log",oi[oi.Tan=10]="Tan",oi[oi.ArcTan=11]="ArcTan",oi[oi.ArcCos=12]="ArcCos",oi[oi.ArcSin=13]="ArcSin",oi[oi.Fract=14]="Fract",oi[oi.Sign=15]="Sign",oi[oi.Radians=16]="Radians",oi[oi.Degrees=17]="Degrees";var ci,li=(ci=b,Object(T.d)(ui,ci),ui.prototype.getClassName=function(){return"TrigonometryBlock"},Object.defineProperty(ui.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ui.prototype._buildBlock=function(e){ci.prototype._buildBlock.call(this,e);var t=this._outputs[0],i="";switch(this.operation){case ni.Cos:i="cos";break;case ni.Sin:i="sin";break;case ni.Abs:i="abs";break;case ni.Exp:i="exp";break;case ni.Exp2:i="exp2";break;case ni.Round:i="round";break;case ni.Floor:i="floor";break;case ni.Ceiling:i="ceil";break;case ni.Sqrt:i="sqrt";break;case ni.Log:i="log";break;case ni.Tan:i="tan";break;case ni.ArcTan:i="atan";break;case ni.ArcCos:i="acos";break;case ni.ArcSin:i="asin";break;case ni.Fract:i="fract";break;case ni.Sign:i="sign";break;case ni.Radians:i="radians";break;case ni.Degrees:i="degrees"}return e.compilationString+=this._declareOutput(t,e)+" = "+i+"("+this.input.associatedVariableName+");\r\n",this},ui.prototype.serialize=function(){var e=ci.prototype.serialize.call(this);return e.operation=this.operation,e},ui.prototype._deserialize=function(e,t,i){ci.prototype._deserialize.call(this,e,t,i),this.operation=e.operation},ui.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".operation = BABYLON.TrigonometryBlockOperations."+ni[this.operation]+";\r\n"},ui);function ui(e){var t=ci.call(this,e,me.Neutral)||this;return t.operation=ni.Cos,t.registerInput("input",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t}y.a.RegisteredTypes["BABYLON.TrigonometryBlock"]=li;var hi,di=(hi=b,Object(T.d)(pi,hi),pi.prototype.getClassName=function(){return"ColorMergerBlock"},Object.defineProperty(pi.prototype,"rgbIn",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"r",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"g",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"b",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"a",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"rgbOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"rgb",{get:function(){return this.rgbOut},enumerable:!1,configurable:!0}),pi.prototype._buildBlock=function(e){hi.prototype._buildBlock.call(this,e);var t=this.r,i=this.g,n=this.b,r=this.a,o=this.rgbIn,a=this._outputs[0],s=this._outputs[1];return o.isConnected?a.hasEndpoints?e.compilationString+=this._declareOutput(a,e)+" = vec4("+o.associatedVariableName+", "+(r.isConnected?this._writeVariable(r):"0.0")+");\r\n":s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = "+o.associatedVariableName+";\r\n"):a.hasEndpoints?e.compilationString+=this._declareOutput(a,e)+" = vec4("+(t.isConnected?this._writeVariable(t):"0.0")+", "+(i.isConnected?this._writeVariable(i):"0.0")+", "+(n.isConnected?this._writeVariable(n):"0.0")+", "+(r.isConnected?this._writeVariable(r):"0.0")+");\r\n":s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = vec3("+(t.isConnected?this._writeVariable(t):"0.0")+", "+(i.isConnected?this._writeVariable(i):"0.0")+", "+(n.isConnected?this._writeVariable(n):"0.0")+");\r\n"),this},pi);function pi(e){var t=hi.call(this,e,me.Neutral)||this;return t.registerInput("rgb ",c.Color3,!0),t.registerInput("r",c.Float,!0),t.registerInput("g",c.Float,!0),t.registerInput("b",c.Float,!0),t.registerInput("a",c.Float,!0),t.registerOutput("rgba",c.Color4),t.registerOutput("rgb",c.Color3),t}y.a.RegisteredTypes["BABYLON.ColorMergerBlock"]=di;var fi,mi=(fi=b,Object(T.d)(_i,fi),_i.prototype.getClassName=function(){return"VectorSplitterBlock"},Object.defineProperty(_i.prototype,"xyzw",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"xyzIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"xyIn",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"xyzOut",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"xyOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"x",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"y",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"z",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(_i.prototype,"w",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),_i.prototype._inputRename=function(e){switch(e){case"xy ":return"xyIn";case"xyz ":return"xyzIn";default:return e}},_i.prototype._outputRename=function(e){switch(e){case"xy":return"xyOut";case"xyz":return"xyzOut";default:return e}},_i.prototype._buildBlock=function(e){fi.prototype._buildBlock.call(this,e);var t=this.xyzw.isConnected?this.xyzw:this.xyzIn.isConnected?this.xyzIn:this.xyIn,i=this._outputs[0],n=this._outputs[1],r=this._outputs[2],o=this._outputs[3],a=this._outputs[4],s=this._outputs[5];return i.hasEndpoints&&(t===this.xyIn?e.compilationString+=this._declareOutput(i,e)+" = vec3("+t.associatedVariableName+", 0.0);\r\n":e.compilationString+=this._declareOutput(i,e)+" = "+t.associatedVariableName+".xyz;\r\n"),n.hasEndpoints&&(e.compilationString+=this._declareOutput(n,e)+" = "+t.associatedVariableName+".xy;\r\n"),r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+" = "+t.associatedVariableName+".x;\r\n"),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+" = "+t.associatedVariableName+".y;\r\n"),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = "+t.associatedVariableName+".z;\r\n"),s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = "+t.associatedVariableName+".w;\r\n"),this},_i);function _i(e){var t=fi.call(this,e,me.Neutral)||this;return t.registerInput("xyzw",c.Vector4,!0),t.registerInput("xyz ",c.Vector3,!0),t.registerInput("xy ",c.Vector2,!0),t.registerOutput("xyz",c.Vector3),t.registerOutput("xy",c.Vector2),t.registerOutput("x",c.Float),t.registerOutput("y",c.Float),t.registerOutput("z",c.Float),t.registerOutput("w",c.Float),t.input
1sAreExclusive=!0,t}y.a.RegisteredTypes["BABYLON.VectorSplitterBlock"]=mi;var gi,vi=(gi=b,Object(T.d)(bi,gi),bi.prototype.getClassName=function(){return"LerpBlock"},Object.defineProperty(bi.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(bi.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(bi.prototype,"gradient",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(bi.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),bi.prototype._buildBlock=function(e){gi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = mix("+this.left.associatedVariableName+" , "+this.right.associatedVariableName+", "+this.gradient.associatedVariableName+");\r\n",this},bi);function bi(e){var t=gi.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerInput("gradient",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t._linkConnectionTypes(1,2),t._inputs[2].acceptedConnectionPointTypes.push(c.Float),t}y.a.RegisteredTypes["BABYLON.LerpBlock"]=vi;var yi,Ti=(yi=b,Object(T.d)(Ei,yi),Ei.prototype.getClassName=function(){return"DivideBlock"},Object.defineProperty(Ei.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ei.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ei.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ei.prototype._buildBlock=function(e){yi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = "+this.left.associatedVariableName+" / "+this.right.associatedVariableName+";\r\n",this},Ei);function Ei(e){var t=yi.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.DivideBlock"]=Ti;var Si,Ai=(Si=b,Object(T.d)(Ci,Si),Ci.prototype.getClassName=function(){return"SubtractBlock"},Object.defineProperty(Ci.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ci.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ci.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ci.prototype._buildBlock=function(e){Si.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = "+this.left.associatedVariableName+" - "+this.right.associatedVariableName+";\r\n",this},Ci);function Ci(e){var t=Si.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.SubtractBlock"]=Ai;var Pi,xi=(Pi=b,Object(T.d)(Ri,Pi),Ri.prototype.getClassName=function(){return"StepBlock"},Object.defineProperty(Ri.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ri.prototype,"edge",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ri.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ri.prototype._buildBlock=function(e){Pi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = step("+this.edge.associatedVariableName+", "+this.value.associatedVariableName+");\r\n",this},Ri);function Ri(e){var t=Pi.call(this,e,me.Neutral)||this;return t.registerInput("value",c.Float),t.registerInput("edge",c.Float),t.registerOutput("output",c.Float),t}y.a.RegisteredTypes["BABYLON.StepBlock"]=xi;var Oi,Mi=(Oi=b,Object(T.d)(Ii,Oi),Ii.prototype.getClassName=function(){return"OneMinusBlock"},Object.defineProperty(Ii.prototype,"input",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Ii.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ii.prototype._buildBlock=function(e){Oi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = 1. - "+this.input.associatedVariableName+";\r\n",this},Ii);function Ii(e){var t=Oi.call(this,e,me.Neutral)||this;return t.registerInput("input",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._outputs[0].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.OneMinusBlock"]=Mi,y.a.RegisteredTypes["BABYLON.OppositeBlock"]=Mi;var Di,Li=(Di=b,Object(T.d)(Ni,Di),Ni.prototype.getClassName=function(){return"ViewDirectionBlock"},Object.defineProperty(Ni.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ni.prototype,"cameraPosition",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ni.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ni.prototype.autoConfigure=function(e){var t;this.cameraPosition.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.systemValue===a.CameraPosition}))||(t=new te("cameraPosition")).setAsSystemValue(a.CameraPosition),t.output.connectTo(this.cameraPosition))},Ni.prototype._buildBlock=function(e){Di.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = normalize("+this.cameraPosition.associatedVariableName+" - "+this.worldPosition.associatedVariableName+".xyz);\r\n",this},Ni);function Ni(e){var t=Di.call(this,e,me.Neutral)||this;return t.registerInput("worldPosition",c.Vector4),t.registerInput("cameraPosition",c.Vector3),t.registerOutput("output",c.Vector3),t}y.a.RegisteredTypes["BABYLON.ViewDirectionBlock"]=Li,i(330);var Fi,wi=(Fi=b,Object(T.d)(Bi,Fi),Bi.prototype.getClassName=function(){return"FresnelBlock"},Object.defineProperty(Bi.prototype,"worldNormal",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"viewDirection",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"bias",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"power",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"fresnel",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Bi.prototype.autoConfigure=function(e){var t,i,n;this.viewDirection.isConnected||((t=new Li("View direction")).output.connectTo(this.viewDirection),t.autoConfigure(e)),this.bias.isConnected||((i=new te("bias")).value=0,i.output.connectTo(this.bias)),this.power.isConnected||((n=new te("power")).value=1,n.output.connectTo(this.power))},Bi.prototype._buildBlock=function(e){Fi.prototype._buildBlock.call(this,e);var t="//"+this.name;return e._emitFunctionFromInclude("fresnelFunction",t,{removeIfDef:!0}),e.compilationString+=this._declareOutput(this.fresnel,e)+" = computeFresnelTerm("+this.viewDirection.associatedVariableName+".xyz, "+this.worldNormal.associatedVariableName+".xyz, "+this.bias.associatedVariableName+", "+this.power.associatedVariableName+");\r\n",this},Bi);function Bi(e){var t=Fi.call(this,e,me.Neutral)||this;return t.registerInput("worldNormal",c.Vector4),t.registerInput("viewDirection",c.Vector3),t.registerInput("bias",c.Float),t.registerInput("power",c.Float),t.registerOutput("fresnel",c.Float),t}y.a.RegisteredTypes["BABYLON.FresnelBlock"]=wi;var Ui,Vi=(Ui=b,Object(T.d)(ki,Ui),ki.prototype.getClassName=function(){return"MaxBlock"},Object.defineProperty(ki.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ki.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ki.prototype,"output",{get:function(){return this._outputs[0]}
1,enumerable:!1,configurable:!0}),ki.prototype._buildBlock=function(e){Ui.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = max("+this.left.associatedVariableName+", "+this.right.associatedVariableName+");\r\n",this},ki);function ki(e){var t=Ui.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.MaxBlock"]=Vi;var Gi,zi=(Gi=b,Object(T.d)(ji,Gi),ji.prototype.getClassName=function(){return"MinBlock"},Object.defineProperty(ji.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ji.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ji.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ji.prototype._buildBlock=function(e){Gi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = min("+this.left.associatedVariableName+", "+this.right.associatedVariableName+");\r\n",this},ji);function ji(e){var t=Gi.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.MinBlock"]=zi;var Wi,Hi=(Wi=b,Object(T.d)(Xi,Wi),Xi.prototype.getClassName=function(){return"DistanceBlock"},Object.defineProperty(Xi.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Xi.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Xi.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Xi.prototype._buildBlock=function(e){Wi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = length("+this.left.associatedVariableName+" - "+this.right.associatedVariableName+");\r\n",this},Xi);function Xi(e){var t=Wi.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.Float),t._linkConnectionTypes(0,1),t._inputs[0].excludedConnectionPointTypes.push(c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t._inputs[1].excludedConnectionPointTypes.push(c.Float),t._inputs[1].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.DistanceBlock"]=Hi;var Yi,Ki=(Yi=b,Object(T.d)(Qi,Yi),Qi.prototype.getClassName=function(){return"LengthBlock"},Object.defineProperty(Qi.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Qi.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Qi.prototype._buildBlock=function(e){Yi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = length("+this.value.associatedVariableName+");\r\n",this},Qi);function Qi(e){var t=Yi.call(this,e,me.Neutral)||this;return t.registerInput("value",c.AutoDetect),t.registerOutput("output",c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.LengthBlock"]=Ki;var qi,Zi=(qi=b,Object(T.d)(Ji,qi),Ji.prototype.getClassName=function(){return"NegateBlock"},Object.defineProperty(Ji.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ji.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ji.prototype._buildBlock=function(e){qi.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = -1.0 * "+this.value.associatedVariableName+";\r\n",this},Ji);function Ji(e){var t=qi.call(this,e,me.Neutral)||this;return t.registerInput("value",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t}y.a.RegisteredTypes["BABYLON.NegateBlock"]=Zi;var $i,en=($i=b,Object(T.d)(tn,$i),tn.prototype.getClassName=function(){return"PowBlock"},Object.defineProperty(tn.prototype,"value",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(tn.prototype,"power",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(tn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),tn.prototype._buildBlock=function(e){$i.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = pow("+this.value.associatedVariableName+", "+this.power.associatedVariableName+");\r\n",this},tn);function tn(e){var t=$i.call(this,e,me.Neutral)||this;return t.registerInput("value",c.Float),t.registerInput("power",c.Float),t.registerOutput("output",c.Float),t}y.a.RegisteredTypes["BABYLON.PowBlock"]=en;var nn,rn=(nn=b,Object(T.d)(on,nn),on.prototype.getClassName=function(){return"RandomNumberBlock"},Object.defineProperty(on.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(on.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),on.prototype._buildBlock=function(e){nn.prototype._buildBlock.call(this,e);var t=this._outputs[0],i="//"+this.name;return e._emitFunctionFromInclude("helperFunctions",i),e.compilationString+=this._declareOutput(t,e)+" = getRand("+this.seed.associatedVariableName+".xy);\r\n",this},on);function on(e){var t=nn.call(this,e,me.Neutral)||this;return t.registerInput("seed",c.Vector2),t.registerOutput("output",c.Float),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[0].acceptedConnectionPointTypes.push(c.Color3),t._inputs[0].acceptedConnectionPointTypes.push(c.Color4),t}y.a.RegisteredTypes["BABYLON.RandomNumberBlock"]=rn;var an,sn=(an=b,Object(T.d)(cn,an),cn.prototype.getClassName=function(){return"ArcTan2Block"},Object.defineProperty(cn.prototype,"x",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(cn.prototype,"y",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(cn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),cn.prototype._buildBlock=function(e){an.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = atan("+this.x.associatedVariableName+", "+this.y.associatedVariableName+");\r\n",this},cn);function cn(e){var t=an.call(this,e,me.Neutral)||this;return t.registerInput("x",c.Float),t.registerInput("y",c.Float),t.registerOutput("output",c.Float),t}y.a.RegisteredTypes["BABYLON.ArcTan2Block"]=sn;var ln,un=(ln=b,Object(T.d)(hn,ln),hn.prototype.getClassName=function(){return"SmoothStepBlock"},Object.defineProperty(hn.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(hn.prototype,"edge0",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(hn.prototype,"edge1",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(hn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),hn.prototype._buildBlock=function(e){ln.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = smoothstep("+this.edge0.associatedVariableName+", "+this.edge1.associatedVariableName+", "+this.value.associatedVariableName+");\r\n",this},hn);function hn(e){var t=ln.call(this,e,me.Neutral)||this;return t.registerInput("value",c.Float),t.registerInput("edge0",c.Float),t.registerInput("edge1",c.Float),t.registerOutput("output",c.Float),t}y.a.RegisteredTypes["BABYLON.SmoothStepBlock"]=un;var dn,pn=(dn=b,Object(T.d)(fn,dn),fn.prototype.getClassName=function(){return"ReciprocalBlock"},Object.defineProperty(fn.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(fn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),fn.prototype._buildBlock=function(e){dn.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = 1. / "+this.input.associatedVariableName+";\r\n",this},fn);function fn(e){var t=dn.call(this,e,me.Neutral)||this;return t.registerInput("input",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._outputs[0].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.ReciprocalBlock"]=pn;var mn,_n=(mn=b,Object(T.d)(gn,mn),gn.prototype.getClassName=function(){return"ReplaceColorBlock"},Object.defineProperty(gn.prototype,"value",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(gn.prototype,"reference",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(gn.prototype,"distance",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(gn.prototype,"replacement",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(gn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),gn.prototype._buildBlock=function(e){mn.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+";\r\n",e.compilationString+="if (length("+this.value.associatedVariableName+" - "+this.reference.associatedVariableName+") < "+this.distance.associatedVariableName+") {\r\n",e.compilationString+=t.associatedVariableName+" = "+this.replacement.associatedVariableName+";\r\n",e.compilationString+="} else {\r\n",e.compilationString+=t.associatedVariableName+" = "+this.value.associatedVariableName+";\r\n",e.compilationString+="}\r\n",this},gn);function gn(e){var t=mn.call(this,e,me.Neutral)||this;return t.registerInput("value",c.AutoDetect),t.registerInput("reference",c.AutoDetect),t.registerInput("distance",c.Float),t.registerInput("replacement",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t._linkConnectionTypes(0,3),t._inputs[0].excludedConnectionPointTypes.push(c.Float),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t._inputs[1].excludedConnectionPointTypes.push(c.Float),t._inputs[1].excludedConnectionPointTypes.push(c.Matrix),t._inputs[3].excludedConnectionPointTypes.push(c.Float),t._inputs[3].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.ReplaceColorBlock"]=_n;var vn,bn,yn,Tn=(bn=b,Object(T.d)(En,bn),En.prototype.getClassName=function(){return"PosterizeBlock"},Object.defineProperty(En.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"steps",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),En.prototype._buildBlock=function(e){bn.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = floor("+this.value.associatedVariableName+" / (1.0 / "+this.steps.associatedVariableName+")) * (1.0 / "+this.steps.associatedVariableName+");\r\n",this},En);function En(e){var t=bn.call(this,e,me.Neutral)||this;return t.registerInput("value",c.AutoDetect),t.registerInput("steps",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t._inputs[1].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.PosterizeBlock"]=Tn,(yn=vn=vn||{})[yn.SawTooth=0]="SawTooth",yn[yn.Square=1]="Square",yn[yn.Triangle=2]="Triangle";var Sn,An=(Sn=b,Object(T.d)(Cn,Sn),Cn.prototype.getClassName=function(){return"WaveBlock"},Object.defineProperty(Cn.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Cn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Cn.prototype._buildBlock=function(e){Sn.prototype._buildBlock.call(this,e);var t=this._outputs[0];switch(this.kind){case vn.SawTooth:e.compilationString+=this._declareOutput(t,e)+" = "+this.input.associatedVariableName+" - floor(0.5 + "+this.input.associatedVariableName+");\r\n";break;case vn.Square:e.compilationString+=this._declareOutput(t,e)+" = 1.0 - 2.0 * round(fract("+this.input.associatedVariableName+"));\r\n";break;case vn.Triangle:e.compilationString+=this._declareOutput(t,e)+" = 2.0 * abs(2.0 * ("+this.input.associatedVariableName+" - floor(0.5 + "+this.input.associatedVariableName+"))) - 1.0;\r\n"}return this},Cn.prototype.serialize=function(){var e=Sn.prototype.serialize.call(this);return e.kind=this.kind,e},Cn.prototype._deserialize=function(e,t,i){Sn.prototype._deserialize.call(this,e,t,i),this.kind=e.kind},Cn);function Cn(e){var t=Sn.call(this,e,me.Neutral)||this;return t.kind=vn.SawTooth,t.registerInput("input",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._inputs[0].excludedConnectionPointTypes.push(c.Matrix),t}y.a.RegisteredTypes["BABYLON.WaveBlock"]=An;var Pn,xn=function(e,t){this.step=e,this.color=t},Rn=(Pn=b,Object(T.d)(On,Pn),On.prototype.getClassName=function(){return"GradientBlock"},Object.defineProperty(On.prototype,"gradient",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(On.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),On.prototype._writeColorConstant=function(e){var t=this.colorSteps[e];return"vec3("+t.color.r+", "+t.color.g+", "+t.color.b+")"},On.prototype._buildBlock=function(e){Pn.prototype._buildBlock.call(this,e);var t=this._outputs[0];if(this.colorSteps.length&&this.gradient.connectedPoint){var i=e._getFreeVariableName("gradientTempColor"),n=e._getFreeVariableName("gradientTempPosition");e.compilationString+="vec3 "+i+" = "+this._writeColorConstant(0)+";\r\n",e.compilationString+="float "+n+";\r\n";var r=this.gradient.associatedVariableName;this.gradient.connectedPoint.type!==c.Float&&(r+=".x");for(var o=1;o<this.colorSteps.length;o++){var a=this.colorSteps[o],s=this.colorSteps[o-1];e.compilationString+=n+" = clamp(("+r+" - "+e._emitFloat(s.step)+") / ("+e._emitFloat(a.step)+" - "+e._emitFloat(s.step)+"), 0.0, 1.0) * step("+e._emitFloat(o)+", "+e._emitFloat(this.colorSteps.length-1)+");\r\n",e.compilationString+=i+" = mix("+i+", "+this._writeColorConstant(o)+", "+n+");\r\n"}return e.compilationString+=this._declareOutput(t,e)+" = "+i+";\r\n",this}e.compilationString+=this._declareOutput(t,e)+" = vec3(0., 0., 0.);\r\n"},On.prototype.serialize=function(){var e=Pn.prototype.serialize.call(this);return e.colorSteps=this.colorSteps,e},On.prototype._deserialize=function(e,t,i){Pn.prototype._deserialize.call(this,e,t,i),this.colorSteps=[];for(var n=0,r=e.colorSteps;n<r.length;n++){var o=r[n];this.colorSteps.push(new xn(o.step,new P.a(o.color.r,o.color.g,o.color.b)))}},On.prototype._dumpPropertiesCode=function(){for(var e="",t=0,i=this.colorSteps;t<i.length;t++){var n=i[t];e+=this._codeVariableName+".colorSteps.push(new BABYLON.GradientBlockColorStep("+n.step+", new BABYLON.Color3("+n.color.r+", "+n.color.g+", "+n.color.b+")));\r\n"}return e},On);function On(e){var t=Pn.call(this,e,me.Neutral)||this;return t.colorSteps=[new xn(0,P.a.Black()),new xn(1,P.a.White())],t.registerInput("gradient",c.Float),t.registerOutput("output",c.Color3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector2),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[0].acceptedConnectionPointTypes.push(c.Color3),t._inputs[0].acceptedConnectionPointTypes.push(c.Color4),t}y.a.RegisteredTypes["BABYLON.GradientBlock"]=Rn;var Mn,In=(Mn=b,Object(T.d)(Dn,Mn),Dn.prototype.getClassName=function(){return"NLerpBlock"},Object.defineProperty(Dn.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Dn.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Dn.prototype,"gradient",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Dn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Dn.prototype._buildBlock=function(e){Mn.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = normalize(mix("+this.left.associatedVariableName+" , "+this.right.associatedVariableName+", "+this.gradient.associatedVariableName+"));\r\n",this},Dn);function Dn(e){var t=Mn.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerInput("gradient",c.Float),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.NLerpBlock"]=In;var Ln,Nn=(Ln=b,Object(T.d)(Fn,Ln),Fn.prototype.getClassName=function(){return"WorleyNoise3DBlock"},Object.defineProperty(Fn.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Fn.prototype,"jitter",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Fn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Fn.prototype._buildBlock=function(e){if(Ln.prototype._buildBlock.call(this,e),this.seed.isConnected&&this._outputs[0].hasEndpoints)return e._emitFunction("worley3D","vec3 permute(vec3 x){\r\n return mod((34.0 * x + 1.0) * x, 289.0);\r\n}\r\n\r\nvec3 dist(vec3 x, vec3 y, vec3 z, bool manhattanDistance){\r\n return manhattanDistance ? abs(x) + abs(y) + abs(z) : (x * x + y * y + z * z);\r\n}\r\n\r\nvec2 worley(vec3 P, float jitter, bool manhattanDistance){\r\n float K = 0.142857142857; // 1/7\r\n float Ko = 0.428571428571; // 1/2-K/2\r\n float K2 = 0.020408163265306; // 1/(7*7)\r\n float Kz = 0.166666666667; // 1/6\r\n float Kzo = 0.416666666667; // 1/2-1/6*2\r\n\r\n vec3 Pi = mod(floor(P), 289.0);\r\n vec3 Pf = fract(P) - 0.5;\r\n\r\n vec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\r\n vec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\r\n vec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\r\n\r\n vec3 p = permute(Pi.x + vec3(-1.0, 0.0, 1.0));\r\n vec3 p1 = permute(p + Pi.y - 1.0);\r\n vec3 p2 = permute(p + Pi.y);\r\n vec3 p3 = permute(p + Pi.y + 1.0);\r\n\r\n vec3 p11 = permute(p1 + Pi.z - 1.0);\r\n vec3 p12 = permute(p1 + Pi.z);\r\n vec3 p13 = permute(p1 + Pi.z + 1.0);\r\n\r\n vec3 p21 = permute(p2 + Pi.z - 1.0);\r\n vec3 p22 = permute(p2 + Pi.z);\r\n vec3 p23 = permute(p2 + Pi.z + 1.0);\r\n\r\n vec3 p31 = permute(p3 + Pi.z - 1.0);\r\n vec3 p32 = permute(p3 + Pi.z);\r\n vec3 p33 = permute(p3 + Pi.z + 1.0);\r\n\r\n vec3 ox11 = fract(p11*K) - Ko;\r\n vec3 oy11 = mod(floor(p11*K), 7.0)*K - Ko;\r\n vec3 oz11 = floor(p11*K2)*Kz - Kzo; // p11 < 289 guaranteed\r\n\r\n vec3 ox12 = fract(p12*K) - Ko;\r\n vec3 oy12 = mod(floor(p12*K), 7.0)*K - Ko;\r\n vec3 oz12 = floor(p12*K2)*Kz - Kzo;\r\n\r\n vec3 ox13 = fract(p13*K) - Ko;\r\n vec3 oy13 = mod(floor(p13*K), 7.0)*K - Ko;\r\n vec3 oz13 = floor(p13*K2)*Kz - Kzo;\r\n\r\n vec3 ox21 = fract(p21*K) - Ko;\r\n vec3 oy21 = mod(floor(p21*K), 7.0)*K - Ko;\r\n vec3 oz21 = floor(p21*K2)*Kz - Kzo;\r\n\r\n vec3 ox22 = fract(p22*K) - Ko;\r\n vec3 oy22 = mod(floor(p22*K), 7.0)*K - Ko;\r\n vec3 oz22 = floor(p22*K2)*Kz - Kzo;\r\n\r\n vec3 ox23 = fract(p23*K) - Ko;\r\n vec3 oy23 = mod(floor(p23*K), 7.0)*K - Ko;\r\n vec3 oz23 = floor(p23*K2)*Kz - Kzo;\r\n\r\n vec3 ox31 = fract(p31*K) - Ko;\r\n vec3 oy31 = mod(floor(p31*K), 7.0)*K - Ko;\r\n vec3 oz31 = floor(p31*K2)*Kz - Kzo;\r\n\r\n vec3 ox32 = fract(p32*K) - Ko;\r\n vec3 oy32 = mod(floor(p32*K), 7.0)*K - Ko;\r\n vec3 oz32 = floor(p32*K2)*Kz - Kzo;\r\n\r\n vec3 ox33 = fract(p33*K) - Ko;\r\n vec3 oy33 = mod(floor(p33*K), 7.0)*K - Ko;\r\n vec3 oz33 = floor(p33*K2)*Kz - Kzo;\r\n\r\n vec3 dx11 = Pfx + jitter*ox11;\r\n vec3 dy11 = Pfy.x + jitter*oy11;\r\n vec3 dz11 = Pfz.x + jitter*oz11;\r\n\r\n vec3 dx12 = Pfx + jitter*ox12;\r\n vec3 dy12 = Pfy.x + jitter*oy12;\r\n vec3 dz12 = Pfz.y + jitter*oz12;\r\n\r\n vec3 dx13 = Pfx + jitter*ox13;\r\n vec3 dy13 = Pfy.x + jitter*oy13;\r\n vec3 dz13 = Pfz.z + jitter*oz13;\r\n\r\n vec3 dx21 = Pfx + jitter*ox21;\r\n vec3 dy21 = Pfy.y + jitter*oy21;\r\n vec3 dz21 = Pfz.x + jitter*oz21;\r\n\r\n vec3 dx22 = Pfx + jitter*ox22;\r\n vec3 dy22 = Pfy.y + jitter*oy22;\r\n vec3 dz22 = Pfz.y + jitter*oz22;\r\n\r\n vec3 dx23 = Pfx + jitter*ox23;\r\n vec3 dy23 = Pfy.y + jitter*oy23;\r\n vec3 dz23 = Pfz.z + jitter*oz23;\r\n\r\n vec3 dx31 = Pfx + jitter*ox31;\r\n vec3 dy31 = Pfy.z + jitter*oy31;\r\n vec3 dz31 = Pfz.x + jitter*oz31;\r\n\r\n vec3 dx32 = Pfx + jitter*ox32;\r\n vec3 dy32 = Pfy.z + jitter*oy32;\r\n vec3 dz32 = Pfz.y + jitter*oz32;\r\n\r\n vec3 dx33 = Pfx + jitter*ox33;\r\n vec3 dy33 = Pfy.z + jitter*oy33;\r\n vec3 dz33 = Pfz.z + jitter*oz33;\r\n\r\n vec3 d11 = dist(dx11, dy11, dz11, manhattanDistance);\r\n vec3 d12 =dist(dx12, dy12, dz12, manhattanDistance);\r\n vec3 d13 = dist(dx13, dy13, dz13, manhattanDistance);\r\n vec3 d21 = dist(dx21, dy21, dz21, manhattanDistance);\r\n vec3 d22 = dist(dx22, dy22, dz22, manhattanDistance);\r\n vec3 d23 = dist(dx23, dy23, dz23, manhattanDistance);\r\n vec3 d31 = dist(dx31, dy31, dz31, manhattanDistance);\r\n vec3 d32 = dist(dx32, dy32, dz32, manhattanDistance);\r\n vec3 d33 = dist(dx33, dy33, dz33, manhattanDistance);\r\n\r\n vec3 d1a = min(d11, d12);\r\n d12 = max(d11, d12);\r\n d11 = min(d1a, d13); // Smallest now not in d12 or d13\r\n d13 = max(d1a, d13);\r\n d12 = min(d12, d13); // 2nd smallest now not in d13\r\n vec3 d2a = min(d21, d22);\r\n d22 = max(d21, d22);\r\n d21 = min(d2a, d23); // Smallest now not in d22 or d23\r\n d23 = max(d2a, d23);\r\n d22 = min(d22, d23); // 2nd smallest now not in d23\r\n vec3 d3a = min(d31, d32);\r\n d32 = max(d31, d32);\r\n d31 = min(d3a, d33); // Smallest now not in d32 or d33\r\n d33 = max(d3a, d33);\r\n d32 = min(d32, d33); // 2nd smallest now not in d33\r\n vec3 da = min(d11, d21);\r\n d21 = max(d11, d21);\r\n d11 = min(da, d31); // Smallest now in d11\r\n d31 = max(da, d31); // 2nd smallest now not in d31\r\n d11.xy = (d11.x < d11.y) ? d11.xy : d11.yx;\r\n d11.xz = (d11.x < d11.z) ? d11.xz : d11.zx; // d11.x now smallest\r\n d12 = min(d12, d21); // 2nd smallest now not in d21\r\n d12 = min(d12, d22); // nor in d22\r\n d12 = min(d12, d31); // nor in d31\r\n d12 = min(d12, d32); // nor in d32\r\n d11.yz = min(d11.yz,d12.xy); // nor in d12.yz\r\n d11.y = min(d11.y,d12.z); // Only two more to go\r\n d11.y = min(d11.y,d11.z); // Done! (Phew!)\r\n return sqrt(d11.xy); // F1, F2\r\n}\r\n\r\n","// Worley3D"),e.compilationString+=this._declareOutput(this._outputs[0],e)+" = worley("+this.seed.associatedVariableName+", "+this.jitter.associatedVariableName+", "+this.manhattanDistance+");\r\n",this},Fn.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".manhattanDistance = "+this.manhattanDistance+";\r\n"},Fn.prototype.serialize=function(){var e=Ln.prototype.serialize.call(this);return e.manhattanDistance=this.manhattanDistance,e},Fn.prototype._deserialize=function(e,t,i){Ln.prototype._deserialize.call(this,e,t,i),this.manhattanDistance=e.manhattanDistance},Object(T.c)([xe("Use Manhattan Distance",ve.Boolean,"PROPERTIES",{notifiers:{update:!1}})],Fn.prototype,"manhattanDistance",void 0),Fn);function Fn(e){var t=Ln.call(this,e,me.Neutral)||this;return t.manhattanDistance=!1,t.registerInput("seed",c.Vector3),t.registerInput("jitter",c.Float),t.registerOutput("output",c.Vector2),t}y.a.RegisteredTypes["BABYLON.WorleyNoise3DBlock"]=Nn;var wn,Bn=(wn=b,Object(T.d)(Un,wn),Un.prototype.getClassName=function(){return"SimplexPerlin3DBlock"},Object.defineProperty(Un.prototype,"seed",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Un.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Un.prototype._buildBlock=function(e){if(wn.prototype._buildBlock.call(this,e),this.seed.isConnected&&this._outputs[0].hasEndpoints)return e._emitFunction("SimplexPerlin3D","const float SKEWFACTOR = 1.0/3.0;\r\nconst float UNSKEWFACTOR = 1.0/6.0;\r\nconst float SIMPLEX_CORNER_POS = 0.5;\r\nconst float SIMPLEX_TETRAHADRON_HEIGHT = 0.70710678118654752440084436210485;\r\nfloat SimplexPerlin3D( vec3 P ){\r\n P *= SIMPLEX_TETRAHADRON_HEIGHT;\r\n vec3 Pi = floor( P + dot( P, vec3( SKEWFACTOR) ) ); vec3 x0 = P - Pi + dot(Pi, vec3( UNSKEWFACTOR ) );\r\n vec3 g = step(x0.yzx, x0.xyz);\r\n vec3 l = 1.0 - g;\r\n vec3 Pi_1 = min( g.xyz, l.zxy );\r\n vec3 Pi_2 = max( g.xyz, l.zxy );\r\n vec3 x1 = x0 - Pi_1 + UNSKEWFACTOR;\r\n vec3 x2 = x0 - Pi_2 + SKEWFACTOR;\r\n vec3 x3 = x0 - SIMPLEX_CORNER_POS;\r\n vec4 v1234_x = vec4( x0.x, x1.x, x2.x, x3.x );\r\n vec4 v1234_y = vec4( x0.y, x1.y, x2.y, x3.y );\r\n vec4 v1234_z = vec4( x0.z, x1.z, x2.z, x3.z );\r\n Pi.xyz = Pi.xyz - floor(Pi.xyz * ( 1.0 / 69.0 )) * 69.0;\r\n vec3 Pi_inc1 = step( Pi, vec3( 69.0 - 1.5 ) ) * ( Pi + 1.0 );\r\n vec4 Pt = vec4( Pi.xy, Pi_inc1.xy ) + vec2( 50.0, 161.0 ).xyxy;\r\n Pt *= Pt;\r\n vec4 V1xy_V2xy = mix( Pt.xyxy, Pt.zwzw, vec4( Pi_1.xy, Pi_2.xy ) );\r\n Pt = vec4( Pt.x, V1xy_V2xy.xz, Pt.z ) * vec4( Pt.y, V1xy_V2xy.yw, Pt.w );\r\n const vec3 SOMELARGEFLOATS = vec3( 635.298681, 682.357502, 668.926525 );\r\n const vec3 ZINC = vec3( 48.500388, 65.294118, 63.934599 );\r\n vec3 lowz_mods = vec3( 1.0 / ( SOMELARGEFLOATS.xyz + Pi.zzz * ZINC.xyz ) );\r\n vec3 highz_mods = vec3( 1.0 / ( SOMELARGEFLOATS.xyz + Pi_inc1.zzz * ZINC.xyz ) );\r\n Pi_1 = ( Pi_1.z < 0.5 ) ? lowz_mods : highz_mods;\r\n Pi_2 = ( Pi_2.z < 0.5 ) ? lowz_mods : highz_mods;\r\n vec4 hash_0 = fract( Pt * vec4( lowz_mods.x, Pi_1.x, Pi_2.x, highz_mods.x ) ) - 0.49999;\r\n vec4 hash_1 = fract( Pt * vec4( lowz_mods.y, Pi_1.y, Pi_2.y, highz_mods.y ) ) - 0.49999;\r\n vec4 hash_2 = fract( Pt * vec4( lowz_mods.z, Pi_1.z, Pi_2.z, highz_mods.z ) ) - 0.49999;\r\n vec4 grad_results = inversesqrt( hash_0 * hash_0 + hash_1 * hash_1 + hash_2 * hash_2 ) * ( hash_0 * v1234_x + hash_1 * v1234_y + hash_2 * v1234_z );\r\n const float FINAL_NORMALIZATION = 37.837227241611314102871574478976;\r\n vec4 kernel_weights = v1234_x * v1234_x + v1234_y * v1234_y + v1234_z * v1234_z;\r\n kernel_weights = max(0.5 - kernel_weights, 0.0);\r\n kernel_weights = kernel_weights*kernel_weights*kernel_weights;\r\n return dot( kernel_weights, grad_results ) * FINAL_NORMALIZATION;\r\n}\r\n","// SimplexPerlin3D"),e.compilationString+=this._declareOutput(this._outputs[0],e)+" = SimplexPerlin3D("+this.seed.associatedVariableName+");\r\n",this},Un);function Un(e){var t=wn.call(this,e,me.Neutral)||this;return t.registerInput("seed",c.Vector3),t.registerOutput("output",c.Float),t}y.a.RegisteredTypes["BABYLON.SimplexPerlin3DBlock"]=Bn;var Vn,kn=(Vn=b,Object(T.d)(Gn,Vn),Gn.prototype.getClassName=function(){return"NormalBlendBlock"},Object.defineProperty(Gn.prototype,"normalMap0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Gn.prototype,"normalMap1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Gn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Gn.prototype._buildBlock=function(e){Vn.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._inputs[0],n=this._inputs[1],r=e._getFreeVariableName("stepR"),o=e._getFreeVariableName("stepG");return e.compilationString+="float "+r+" = step(0.5, "+i.associatedVariableName+".r);\r\n",e.compilationString+="float "+o+" = step(0.5, "+i.associatedVariableName+".g);\r\n",e.compilationString+=this._declareOutput(t,e)+";\r\n",e.compilationString+=t.associatedVariableName+".r = (1.0 - "+r+") * "+i.associatedVariableName+".r * "+n.associatedVariableName+".r * 2.0 + "+r+" * (1.0 - "+i.associatedVariableName+".r) * (1.0 - "+n.associatedVariableName+".r) * 2.0;\r\n",e.compilationString+=t.associatedVariableName+".g = (1.0 - "+o+") * "+i.associatedVariableName+".g * "+n.associatedVariableName+".g * 2.0 + "+o+" * (1.0 - "+i.associatedVariableName+".g) * (1.0 - "+n.associatedVariableName+".g) * 2.0;\r\n",e.compilationString+=t.associatedVariableName+".b = "+i.associatedVariableName+".b * "+n.associatedVariableName+".b;\r\n",this}
1,Gn);function Gn(e){var t=Vn.call(this,e,me.Neutral)||this;return t.registerInput("normalMap0",c.Vector3),t.registerInput("normalMap1",c.Vector3),t.registerOutput("output",c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Color3),t._inputs[0].acceptedConnectionPointTypes.push(c.Color4),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[1].acceptedConnectionPointTypes.push(c.Color3),t._inputs[1].acceptedConnectionPointTypes.push(c.Color4),t._inputs[1].acceptedConnectionPointTypes.push(c.Vector4),t}y.a.RegisteredTypes["BABYLON.NormalBlendBlock"]=kn;var zn,jn=(zn=b,Object(T.d)(Wn,zn),Wn.prototype.getClassName=function(){return"Rotate2dBlock"},Object.defineProperty(Wn.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Wn.prototype,"angle",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Wn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Wn.prototype.autoConfigure=function(e){var t;this.angle.isConnected||((t=new te("angle")).value=0,t.output.connectTo(this.angle))},Wn.prototype._buildBlock=function(e){zn.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.angle,n=this.input;return e.compilationString+=this._declareOutput(t,e)+" = vec2(cos("+i.associatedVariableName+") * "+n.associatedVariableName+".x - sin("+i.associatedVariableName+") * "+n.associatedVariableName+".y, sin("+i.associatedVariableName+") * "+n.associatedVariableName+".x + cos("+i.associatedVariableName+") * "+n.associatedVariableName+".y);\r\n",this},Wn);function Wn(e){var t=zn.call(this,e,me.Neutral)||this;return t.registerInput("input",c.Vector2),t.registerInput("angle",c.Float),t.registerOutput("output",c.Vector2),t}y.a.RegisteredTypes["BABYLON.Rotate2dBlock"]=jn;var Hn,Xn=(Hn=b,Object(T.d)(Yn,Hn),Yn.prototype.getClassName=function(){return"ReflectBlock"},Object.defineProperty(Yn.prototype,"incident",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Yn.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Yn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Yn.prototype._buildBlock=function(e){Hn.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = reflect("+this.incident.associatedVariableName+".xyz, "+this.normal.associatedVariableName+".xyz);\r\n",this},Yn);function Yn(e){var t=Hn.call(this,e,me.Neutral)||this;return t.registerInput("incident",c.Vector3),t.registerInput("normal",c.Vector3),t.registerOutput("output",c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[0].acceptedConnectionPointTypes.push(c.Color3),t._inputs[0].acceptedConnectionPointTypes.push(c.Color4),t._inputs[1].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[1].acceptedConnectionPointTypes.push(c.Color3),t._inputs[1].acceptedConnectionPointTypes.push(c.Color4),t}y.a.RegisteredTypes["BABYLON.ReflectBlock"]=Xn;var Kn,Qn=(Kn=b,Object(T.d)(qn,Kn),qn.prototype.getClassName=function(){return"RefractBlock"},Object.defineProperty(qn.prototype,"incident",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(qn.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(qn.prototype,"ior",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(qn.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),qn.prototype._buildBlock=function(e){Kn.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = refract("+this.incident.associatedVariableName+".xyz, "+this.normal.associatedVariableName+".xyz, "+this.ior.associatedVariableName+");\r\n",this},qn);function qn(e){var t=Kn.call(this,e,me.Neutral)||this;return t.registerInput("incident",c.Vector3),t.registerInput("normal",c.Vector3),t.registerInput("ior",c.Float),t.registerOutput("output",c.Vector3),t._inputs[0].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[0].acceptedConnectionPointTypes.push(c.Color3),t._inputs[0].acceptedConnectionPointTypes.push(c.Color4),t._inputs[1].acceptedConnectionPointTypes.push(c.Vector4),t._inputs[1].acceptedConnectionPointTypes.push(c.Color3),t._inputs[1].acceptedConnectionPointTypes.push(c.Color4),t}y.a.RegisteredTypes["BABYLON.RefractBlock"]=Qn;var Zn,Jn=(Zn=b,Object(T.d)($n,Zn),$n.prototype.getClassName=function(){return"DesaturateBlock"},Object.defineProperty($n.prototype,"color",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty($n.prototype,"level",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty($n.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),$n.prototype._buildBlock=function(e){Zn.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.color.associatedVariableName,n=e._getFreeVariableName("colorMin"),r=e._getFreeVariableName("colorMax"),o=e._getFreeVariableName("colorMerge");return e.compilationString+="float "+n+" = min(min("+i+".x, "+i+".y), "+i+".z);\r\n",e.compilationString+="float "+r+" = max(max("+i+".x, "+i+".y), "+i+".z);\r\n",e.compilationString+="float "+o+" = 0.5 * ("+n+" + "+r+");\r\n",e.compilationString+=this._declareOutput(t,e)+" = mix("+i+", vec3("+o+", "+o+", "+o+"), "+this.level.associatedVariableName+");\r\n",this},$n);function $n(e){var t=Zn.call(this,e,me.Neutral)||this;return t.registerInput("color",c.Color3),t.registerInput("level",c.Float),t.registerOutput("output",c.Color3),t}y.a.RegisteredTypes["BABYLON.DesaturateBlock"]=Jn;var er,tr,ir=i(65),nr=(tr=g,Object(T.d)(ar,tr),ar.prototype.checkCompatibilityState=function(e){return e instanceof ar&&e.name===this._nameForCheking?h.Compatible:h.TypeIncompatible},ar.prototype.createCustomInputBlock=function(){return[new this._blockType(this._blockName),this.name]},ar),rr=(er=b,Object(T.d)(or,er),or.prototype.initialize=function(e){e._excludeVariableName("aoOut")},or.prototype.getClassName=function(){return"AmbientOcclusionBlock"},Object.defineProperty(or.prototype,"texture",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(or.prototype,"intensity",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(or.prototype,"directLightIntensity",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(or.prototype,"ambientOcclusion",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),or.GetCode=function(e){return"ambientOcclusionOutParams aoOut;\r\nambientOcclusionBlock(\n #ifdef AMBIENT\n "+(null!=e&&e.texture.isConnected?e.texture.associatedVariableName:"vec3(0.)")+",\n vec4(0., 1.0, "+(null!=e&&e.intensity.isConnected?e.intensity.associatedVariableName:"1.")+", 0.),\n #endif\n aoOut\n );\r\n"},or.prototype.prepareDefines=function(e,t,i){er.prototype.prepareDefines.call(this,e,t,i),i.setValue("AMBIENT",this.texture.isConnected,!0),i.setValue("AMBIENTINGRAYSCALE",this.useAmbientInGrayScale,!0)},or.prototype._buildBlock=function(e){return e.target===me.Fragment&&e.sharedData.blocksWithDefines.push(this),this},or.prototype._dumpPropertiesCode=function(){return this._codeVariableName+".useAmbientInGrayScale = "+this.useAmbientInGrayScale+";\r\n"},or.prototype.serialize=function(){var e=er.prototype.serialize.call(this);return e.useAmbientInGrayScale=this.useAmbientInGrayScale,e},or.prototype._deserialize=function(e,t,i){er.prototype._deserialize.call(this,e,t,i),this.useAmbientInGrayScale=e.useAmbientInGrayScale},Object(T.c)([xe("Ambient in gray scale",ve.Boolean,"AMBIENT",{notifiers:{update:!0}})],or.prototype,"useAmbientInGrayScale",void 0),or);function or(e){var t=er.call(this,e,me.Fragment)||this;return t.useAmbientInGrayScale=!1,t._isUnique=!0,t.registerInput("texture",c.Color3,!0,me.Fragment),t.registerInput("intensity",c.Float,!0,me.Fragment),t.registerInput("directLightIntensity",c.Float,!0,me.Fragment),t.registerOutput("ambientOcclusion",c.Object,me.Fragment,new nr("ambientOcclusion",t,d.Output,or,"AOBlock")),t}function ar(e,t,i,n,r,o){var a=tr.call(this,e,t,i)||this;return a._blockType=n,a._blockName=r,a._nameForCheking=o,a._nameForCheking||(a._nameForCheking=e),a.needDualDirectionValidation=!0,a}y.a.RegisteredTypes["BABYLON.AmbientOcclusionBlock"]=rr;var sr,cr=(sr=b,Object(T.d)(lr,sr),lr.prototype.initialize=function(e){e._excludeVariableName("sheenOut"),e._excludeVariableName("sheenMapData"),e._excludeVariableName("vSheenColor"),e._excludeVariableName("vSheenRoughness")},lr.prototype.getClassName=function(){return"SheenBlock"},Object.defineProperty(lr.prototype,"intensity",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(lr.prototype,"color",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(lr.prototype,"roughness",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(lr.prototype,"sheen",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),lr.prototype.prepareDefines=function(e,t,i){sr.prototype.prepareDefines.call(this,e,t,i),i.setValue("SHEEN",!0),i.setValue("SHEEN_LINKWITHALBEDO",this.linkSheenWithAlbedo,!0),i.setValue("SHEEN_ROUGHNESS",this.roughness.isConnected,!0),i.setValue("SHEEN_ALBEDOSCALING",this.albedoScaling,!0)},lr.prototype.getCode=function(e){return"#ifdef SHEEN\n sheenOutParams sheenOut;\n\n vec4 vSheenColor = vec4("+(this.color.isConnected?this.color.associatedVariableName:"vec3(1.)")+", "+(this.intensity.isConnected?this.intensity.associatedVariableName:"1.")+");\n\n sheenBlock(\n vSheenColor,\n #ifdef SHEEN_ROUGHNESS\n "+(this.roughness.isConnected?this.roughness.associatedVariableName:"0.")+",\n #endif\n roughness,\n #ifdef SHEEN_TEXTURE\n vec4(0.),\n #endif\n reflectance,\n #ifdef SHEEN_LINKWITHALBEDO\n baseColor,\n surfaceAlbedo,\n #endif\n #ifdef ENVIRONMENTBRDF\n NdotV,\n environmentBrdf,\n #endif\n #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\n AARoughnessFactors,\n "+(null==e?void 0:e._vReflectionMicrosurfaceInfosName)+",\n "+(null==e?void 0:e._vReflectionInfosName)+",\n "+(null==e?void 0:e.reflectionColor)+",\n vLightingIntensity,\n #ifdef "+(null==e?void 0:e._define3DName)+"\n "+(null==e?void 0:e._cubeSamplerName)+",\n #else\n "+(null==e?void 0:e._2DSamplerName)+",\n #endif\n reflectionOut.reflectionCoords,\n NdotVUnclamped,\n #ifndef LODBASEDMICROSFURACE\n #ifdef "+(null==e?void 0:e._define3DName)+"\n "+(null==e?void 0:e._cubeSamplerName)+",\n "+(null==e?void 0:e._cubeSamplerName)+",\n #else\n "+(null==e?void 0:e._2DSamplerName)+",\n "+(null==e?void 0:e._2DSamplerName)+",\n #endif\n #endif\n #if !defined("+(null==e?void 0:e._defineSkyboxName)+") && defined(RADIANCEOCCLUSION)\n seo,\n #endif\n #if !defined("+(null==e?void 0:e._defineSkyboxName)+") && defined(HORIZONOCCLUSION) && defined(BUMP) && defined("+(null==e?void 0:e._define3DName)+")\n eho,\n #endif\n #endif\n sheenOut\n );\n\n #ifdef SHEEN_LINKWITHALBEDO\n surfaceAlbedo = sheenOut.surfaceAlbedo;\n #endif\n #endif\r\n"},lr.prototype._buildBlock=function(e){return e.target===me.Fragment&&e.sharedData.blocksWithDefines.push(this),this},lr.prototype._dumpPropertiesCode=function(){var e=sr.prototype._dumpPropertiesCode.call(this);return(e+=this._codeVariableName+".albedoScaling = "+this.albedoScaling+";\r\n")+this._codeVariableName+".linkSheenWithAlbedo = "+this.linkSheenWithAlbedo+";\r\n"},lr.prototype.serialize=function(){var e=sr.prototype.serialize.call(this);return e.albedoScaling=this.albedoScaling,e.linkSheenWithAlbedo=this.linkSheenWithAlbedo,e},lr.prototype._deserialize=function(e,t,i){sr.prototype._deserialize.call(this,e,t,i),this.albedoScaling=e.albedoScaling,this.linkSheenWithAlbedo=e.linkSheenWithAlbedo},Object(T.c)([xe("Albedo scaling",ve.Boolean,"PROPERTIES",{notifiers:{update:!0}})],lr.prototype,"albedoScaling",void 0),Object(T.c)([xe("Link sheen with albedo",ve.Boolean,"PROPERTIES",{notifiers:{update:!0}})],lr.prototype,"linkSheenWithAlbedo",void 0),lr);function lr(e){var t=sr.call(this,e,me.Fragment)||this;return t.albedoScaling=!1,t.linkSheenWithAlbedo=!1,t._isUnique=!0,t.registerInput("intensity",c.Float,!0,me.Fragment),t.registerInput("color",c.Color3,!0,me.Fragment),t.registerInput("roughness",c.Float,!0,me.Fragment),t.registerOutput("sheen",c.Object,me.Fragment,new nr("sheen",t,d.Output,lr,"SheenBlock")),t}y.a.RegisteredTypes["BABYLON.SheenBlock"]=cr;var ur,hr=(ur=b,Object(T.d)(dr,ur),dr.prototype.initialize=function(e){e._excludeVariableName("baseColor"),e._excludeVariableName("reflectivityOut"),e._excludeVariableName("microSurface"),e._excludeVariableName("roughness")},dr.prototype.getClassName=function(){return"ReflectivityBlock"},Object.defineProperty(dr.prototype,"metallic",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"roughness",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"texture",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"reflectivity",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),dr.prototype.bind=function(e,t,i,n){var r,o,a;ur.prototype.bind.call(this,e,t,i);var s=null!==(a=null===(o=null===(r=this.indexOfRefractionConnectionPoint)||void 0===r?void 0:r.connectInputBlock)||void 0===o?void 0:o.value)&&void 0!==a?a:1.5,c=Math.pow((s-1)/(s+1),2);this._metallicReflectanceColor.scaleToRef(c*this._metallicF0Factor,P.c.Color3[0]);var l=this._metallicF0Factor;e.setColor4(this._vMetallicReflectanceFactorsName,P.c.Color3[0],l)},dr.prototype.getCode=function(e,t){var i,n=this.texture.isConnected?null===(i=this.texture.connectedPoint)||void 0===i?void 0:i.associatedVariableName:null;return this._vMetallicReflectanceFactorsName=e._getFreeVariableName("vMetallicReflectanceFactors"),e._emitUniformFromString(this._vMetallicReflectanceFactorsName,"vec4"),"vec3 baseColor = surfaceAlbedo;\n reflectivityOutParams reflectivityOut;\n\n reflectivityBlock(\n vec4("+this.metallic.associatedVariableName+", "+this.roughness.associatedVariableName+", 0., 0.),\n #ifdef METALLICWORKFLOW\n surfaceAlbedo,\n "+this._vMetallicReflectanceFactorsName+",\n #endif\n #ifdef REFLECTIVITY\n vec3(0., 0., "+t+"),\n "+n+",\n #endif\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n aoOut.ambientOcclusionColor,\n #endif\n #ifdef MICROSURFACEMAP\n microSurfaceTexel, <== not handled!\n #endif\n reflectivityOut\n );\n\n float microSurface = reflectivityOut.microSurface;\n float roughness = reflectivityOut.roughness;\n\n #ifdef METALLICWORKFLOW\n surfaceAlbedo = reflectivityOut.surfaceAlbedo;\n #endif\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;\n #endif\r\n"},dr.prototype.prepareDefines=function(e,t,i){ur.prototype.prepareDefines.call(this,e,t,i),i.setValue("REFLECTIVITY",this.texture.isConnected,!0),i.setValue("AOSTOREINMETALMAPRED",this.useAmbientOcclusionFromMetallicTextureRed,!0),i.setValue("METALLNESSSTOREINMETALMAPBLUE",this.useMetallnessFromMetallicTextureBlue,!0),i.setValue("ROUGHNESSSTOREINMETALMAPALPHA",this.useRoughnessFromMetallicTextureAlpha,!0),i.setValue("ROUGHNESSSTOREINMETALMAPGREEN",!this.useRoughnessFromMetallicTextureAlpha&&this.useRoughnessFromMetallicTextureGreen,!0)},dr.prototype._buildBlock=function(e){return e.target===me.Fragment&&(e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this)),this},dr.prototype._dumpPropertiesCode=function(){var e="";return e+=this._codeVariableName+".useAmbientOcclusionFromMetallicTextureRed = "+this.useAmbientOcclusionFromMetallicTextureRed+";\r\n",e+=this._codeVariableName+".useMetallnessFromMetallicTextureBlue = "+this.useMetallnessFromMetallicTextureBlue+";\r\n",(e+=this._codeVariableName+".useRoughnessFromMetallicTextureAlpha = "+this.useRoughnessFromMetallicTextureAlpha+";\r\n")+this._codeVariableName+".useRoughnessFromMetallicTextureGreen = "+this.useRoughnessFromMetallicTextureGreen+";\r\n"},dr.prototype.serialize=function(){var e=ur.prototype.serialize.call(this);return e.useAmbientOcclusionFromMetallicTextureRed=this.useAmbientOcclusionFromMetallicTextureRed,e.useMetallnessFromMetallicTextureBlue=this.useMetallnessFromMetallicTextureBlue,e.useRoughnessFromMetallicTextureAlpha=this.useRoughnessFromMetallicTextureAlpha,e.useRoughnessFromMetallicTextureGreen=this.useRoughnessFromMetallicTextureGreen,e},dr.prototype._deserialize=function(e,t,i){ur.prototype._deserialize.call(this,e,t,i),this.useAmbientOcclusionFromMetallicTextureRed=e.useAmbientOcclusionFromMetallicTextureRed,this.useMetallnessFromMetallicTextureBlue=e.useMetallnessFromMetallicTextureBlue,this.useRoughnessFromMetallicTextureAlpha=e.useRoughnessFromMetallicTextureAlpha,this.useRoughnessFromMetallicTextureGreen=e.useRoughnessFromMetallicTextureGreen},Object(T.c)([xe("AO from red channel",ve.Boolean,"METALLIC WORKFLOW",{notifiers:{update:!0}})],dr.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),Object(T.c)([xe("Metallness from blue channel",ve.Boolean,"METALLIC WORKFLOW",{notifiers:{update:!0}})],dr.prototype,"useMetallnessFromMetallicTextureBlue",void 0),Object(T.c)([xe("Roughness from alpha channel",ve.Boolean,"METALLIC WORKFLOW",{notifiers:{update:!0}})],dr.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),Object(T.c)([xe("Roughness from green channel",ve.Boolean,"METALLIC WORKFLOW",{notifiers:{update:!0}})],dr.prototype,"useRoughnessFromMetallicTextureGreen",void 0),dr);function dr(e){var t=ur.call(this,e,me.Fragment)||this;return t._metallicReflectanceColor=P.a.White(),t._metallicF0Factor=1,t.useAmbientOcclusionFromMetallicTextureRed=!1,t.useMetallnessFromMetallicTextureBlue=!0,t.useRoughnessFromMetallicTextureAlpha=!1,t.useRoughnessFromMetallicTextureGreen=!0,t._isUnique=!0,t.registerInput("metallic",c.Float,!1,me.Fragment),t.registerInput("roughness",c.Float,!1,me.Fragment),t.registerInput("texture",c.Color4,!0,me.Fragment),t.registerOutput("reflectivity",c.Object,me.Fragment,new nr("reflectivity",t,d.Output,dr,"ReflectivityBlock")),t}y.a.RegisteredTypes["BABYLON.ReflectivityBlock"]=hr;var pr,fr=i(150),mr=i(19),_r=(pr=b,Object(T.d)(gr,pr),gr.prototype.initialize=function(e){e._excludeVariableName("anisotropicOut"),e._excludeVariableName("TBN")},gr.prototype.getClassName=function(){return"AnisotropyBlock"},Object.defineProperty(gr.prototype,"intensity",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(gr.prototype,"direction",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(gr.prototype,"texture",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(gr.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(gr.prototype,"worldTangent",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(gr.prototype,"anisotropy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),gr.prototype._generateTBNSpace=function(e){var t="",i="//"+this.name,n=this.uv,r=this.worldPositionConnectionPoint,o=this.worldNormalConnectionPoint,a=this.worldTangent;n.isConnected||console.error("You must connect the 'uv' input of the Anisotropy block!"),e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var s={search:/defined\(TANGENT\)/g,replace:a.isConnected?"defined(TANGENT)":"defined(IGNORE)"};return a.isConnected&&(t+="vec3 tbnNormal = normalize("+o.associatedVariableName+".xyz);\r\n",t+="vec3 tbnTangent = normalize("+a.associatedVariableName+".xyz);\r\n",t+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r\n",t+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),t+="\n #if defined("+(a.isConnected?"TANGENT":"IGNORE")+") && defined(NORMAL)\n mat3 TBN = vTBN;\n #else\n mat3 TBN = cotangent_frame("+o.associatedVariableName+".xyz, v_"+r.associatedVariableName+".xyz, "+(n.isConnected?n.associatedVariableName:"vec2(0.)")+", vec2(1., 1.));\n #endif\r\n",e._emitFunctionFromInclude("bumpFragmentMainFunctions",i,{replaceStrings:[s]}),t},gr.prototype.getCode=function(e,t){void 0===t&&(t=!1);var i="";t&&(i+=this._generateTBNSpace(e));var n=this.intensity.isConnected?this.intensity.associatedVariableName:"1.0";return i+("anisotropicOutParams anisotropicOut;\n anisotropicBlock(\n vec3("+(this.direction.isConnected?this.direction.associatedVariableName:"vec2(1., 0.)")+", "+n+"),\n #ifdef ANISOTROPIC_TEXTURE\n "+(this.texture.isConnected?this.texture.associatedVariableName:"vec3(0.)"))+",\n #endif\n TBN,\n normalW,\n viewDirectionW,\n anisotropicOut\n );\r\n"},gr.prototype.prepareDefines=function(e,t,i){pr.prototype.prepareDefines.call(this,e,t,i),i.setValue("ANISOTROPIC",!0),i.setValue("ANISOTROPIC_TEXTURE",this.texture.isConnected,!0)},gr.prototype._buildBlock=function(e){return e.target===me.Fragment&&e.sharedData.blocksWithDefines.push(this),this},gr);function gr(e){var t=pr.call(this,e,me.Fragment)||this;return t._isUnique=!0,t.registerInput("intensity",c.Float,!0,me.Fragment),t.registerInput("direction",c.Vector2,!0,me.Fragment),t.registerInput("texture",c.Color3,!0,me.Fragment),t.registerInput("uv",c.Vector2,!0),t.registerInput("worldTangent",c.Vector4,!0),t.registerOutput("anisotropy",c.Object,me.Fragment,new nr("anisotropy",t,d.Output,gr,"AnisotropyBlock")),t}y.a.RegisteredTypes["BABYLON.AnisotropyBlock"]=_r;var vr,br=i(14),yr=(vr=Bt,Object(T.d)(Tr,vr),Tr.prototype.getClassName=function(){return"ReflectionBlock"},Object.defineProperty(Tr.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"worldPosition",{get:function(){return this.worldPositionConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"worldNormal",{get:function(){return this.worldNormalConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"world",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"cameraPosition",{get:function(){return this.cameraPositionConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"view",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"color",{get:function(){return this._inputs[3]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"reflection",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"hasTexture",{get:function(){return!!this._getTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"reflectionColor",{get:function(){return this.color.isConnected?this.color.associatedVariableName:"vec3(1., 1., 1.)"},enumerable:!1,configurable:!0}),Tr.prototype._getTexture=function(){return this.texture?this.texture:this._scene.environmentTexture},Tr.prototype.prepareDefines=function(e,t,i){vr.prototype.prepareDefines.call(this,e,t,i);var n=this._getTexture(),r=n&&n.getTextureMatrix;i.setValue("REFLECTION",r,!0),r&&(i.setValue(this._defineLODReflectionAlpha,n.lodLevelInAlpha,!0),i.setValue(this._defineLinearSpecularReflection,n.linearSpecularLOD,!0),i.setValue(this._defineOppositeZ,this._scene.useRightHandedSystem?!n.invertZ:n.invertZ,!0),i.setValue("SPHERICAL_HARMONICS",this.useSphericalHarmonics,!0),i.setValue("GAMMAREFLECTION",n.gammaSpace,!0),i.setValue("RGBDREFLECTION",n.isRGBD,!0),n&&n.coordinatesMode!==oe.a.SKYBOX_MODE&&n.isCube&&(i.setValue("USESPHERICALFROMREFLECTIONMAP",!0),i.setValue("USEIRRADIANCEMAP",!1),this.forceIrradianceInFragment||this._scene.getEngine().getCaps().maxVaryingVectors<=8?i.setValue("USESPHERICALINVERTEX",!1):i.setValue("USESPHERICALINVERTEX",!0)))},Tr.prototype.bind=function(e,t,i,n){vr.prototype.bind.call(this,e,t,i);var r,o,a,s,c=this._getTexture();c&&n&&(c.isCube?e.setTexture(this._cubeSamplerName,c):e.setTexture(this._2DSamplerName,c),r=c.getSize().width,e.setFloat3(this._vReflectionMicrosurfaceInfosName,r,c.lodGenerationScale,c.lodGenerationOffset),e.setFloat2(this._vReflectionFilteringInfoName,r,br.a.Log2(r)),o=n._materialDefines,a=c.sphericalPolynomial,o.USESPHERICALFROMREFLECTIONMAP&&a&&(o.SPHERICAL_HARMONICS?(s=a.preScaledHarmonics,e.setVector3("vSphericalL00",s.l00),e.setVector3("vSphericalL1_1",s.l1_1),e.setVector3("vSphericalL10",s.l10),e.setVector3("vSphericalL11",s.l11),e.setVector3("vSphericalL2_2",s.l2_2),e.setVector3("vSphericalL2_1",s.l2_1),e.setVector3("vSphericalL20",s.l20),e.setVector3("vSphericalL21",s.l21),e.setVector3("vSphericalL22",s.l22)):(e.setFloat3("vSphericalX",a.x.x,a.x.y,a.x.z),e.setFloat3("vSphericalY",a.y.x,a.y.y,a.y.z),e.setFloat3("vSphericalZ",a.z.x,a.z.y,a.z.z),e.setFloat3("vSphericalXX_ZZ",a.xx.x-a.zz.x,a.xx.y-a.zz.y,a.xx.z-a.zz.z),e.setFloat3("vSphericalYY_ZZ",a.yy.x-a.zz.x,a.yy.y-a.zz.y,a.yy.z-a.zz.z),e.setFloat3("vSphericalZZ",a.zz.x,a.zz.y,a.zz.z),e.setFloat3("vSphericalXY",a.xy.x,a.xy.y,a.xy.z),e.setFloat3("vSphericalYZ",a.yz.x,a.yz.y,a.yz.z),e.setFloat3("vSphericalZX",a.zx.x,a.zx.y,a.zx.z))))},Tr.prototype.handleVertexSide=function(e){var t=vr.prototype.handleVertexSide.call(this,e);e._emitFunctionFromInclude("harmonicsFunctions","//"+this.name,{replaceStrings:[{search:/uniform vec3 vSphericalL00;[\s\S]*?uniform vec3 vSphericalL22;/g,replace:""},{search:/uniform vec3 vSphericalX;[\s\S]*?uniform vec3 vSphericalZX;/g,replace:""}]});var i=e._getFreeVariableName("reflectionVector");return this._vEnvironmentIrradianceName=e._getFreeVariableName("vEnvironmentIrradiance"),e._emitVaryingFromString(this._vEnvironmentIrradianceName,"vec3","defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)"),e._emitUniformFromString("vSphericalL00","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL1_1","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL10","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL11","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL2_2","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL2_1","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL20","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL21","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL22","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalX","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalY","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalXX_ZZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalYY_ZZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalZZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalXY","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalYZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalZX","vec3","SPHERICAL_HARMONICS",!0),t+("#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n vec3 "+i+" = vec3("+this._reflectionMatrixName+" * vec4(normalize("+this.worldNormal.associatedVariableName+").xyz, 0)).xyz;\n #ifdef "+this._defineOppositeZ+"\n "+i+".z *= -1.0;\n #endif\n "+this._vEnvironmentIrradianceName)+" = computeEnvironmentIrradiance("+i+");\n #endif\r\n"},Tr.prototype.getCode=function(e,t){var i="";this.handleFragmentSideInits(e),e._emitFunctionFromInclude("harmonicsFunctions","//"+this.name,{replaceStrings:[{search:/uniform vec3 vSphericalL00;[\s\S]*?uniform vec3 vSphericalL22;/g,replace:""},{search:/uniform vec3 vSphericalX;[\s\S]*?uniform vec3 vSphericalZX;/g,replace:""}]}),e._emitFunction("sampleReflection","\n #ifdef "+this._define3DName+"\n #define sampleReflection(s, c) textureCube(s, c)\n #else\n #define sampleReflection(s, c) texture2D(s, c)\n #endif\r\n","//"+this.name),e._emitFunction("sampleReflectionLod","\n #ifdef "+this._define3DName+"\n #define sampleReflectionLod(s, c, l) textureCubeLodEXT(s, c, l)\n #else\n #define sampleReflectionLod(s, c, l) texture2DLodEXT(s, c, l)\n #endif\r\n","//"+this.name);var n="\n vec3 computeReflectionCoordsPBR(vec4 worldPos, vec3 worldNormal) {\n "+this.handleFragmentSideCodeReflectionCoords("worldNormal","worldPos",!0)+"\n return "+this._reflectionVectorName+";\n }\r\n";
1return e._emitFunction("computeReflectionCoordsPBR",n,"//"+this.name),this._vReflectionMicrosurfaceInfosName=e._getFreeVariableName("vReflectionMicrosurfaceInfos"),e._emitUniformFromString(this._vReflectionMicrosurfaceInfosName,"vec3"),this._vReflectionInfosName=e._getFreeVariableName("vReflectionInfos"),this._vReflectionFilteringInfoName=e._getFreeVariableName("vReflectionFilteringInfo"),e._emitUniformFromString(this._vReflectionFilteringInfoName,"vec2"),i+("#ifdef REFLECTION\n vec2 "+this._vReflectionInfosName+" = vec2(1., 0.);\n\n reflectionOutParams reflectionOut;\n\n reflectionBlock(\n v_"+this.worldPosition.associatedVariableName+".xyz,\n "+t+",\n alphaG,\n "+this._vReflectionMicrosurfaceInfosName+",\n "+this._vReflectionInfosName+",\n "+this.reflectionColor+",\n #ifdef ANISOTROPIC\n anisotropicOut,\n #endif\n #if defined("+this._defineLODReflectionAlpha+") && !defined("+this._defineSkyboxName+")\n NdotVUnclamped,\n #endif\n #ifdef "+this._defineLinearSpecularReflection+"\n roughness,\n #endif\n #ifdef "+this._define3DName+"\n "+this._cubeSamplerName+",\n #else\n "+this._2DSamplerName+",\n #endif\n #if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n "+this._vEnvironmentIrradianceName+",\n #endif\n #ifdef USESPHERICALFROMREFLECTIONMAP\n #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\n "+this._reflectionMatrixName+",\n #endif\n #endif\n #ifdef USEIRRADIANCEMAP\n irradianceSampler, // ** not handled **\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef "+this._define3DName+"\n "+this._cubeSamplerName+",\n "+this._cubeSamplerName+",\n #else\n "+this._2DSamplerName+",\n "+this._2DSamplerName)+",\n #endif\n #endif\n reflectionOut\n );\n #endif\r\n"},Tr.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,e.target!==me.Fragment&&(this._defineLODReflectionAlpha=e._getFreeDefineName("LODINREFLECTIONALPHA"),this._defineLinearSpecularReflection=e._getFreeDefineName("LINEARSPECULARREFLECTION")),this},Tr.prototype._dumpPropertiesCode=function(){var e=vr.prototype._dumpPropertiesCode.call(this);return(e+=this._codeVariableName+".useSphericalHarmonics = "+this.useSphericalHarmonics+";\r\n")+this._codeVariableName+".forceIrradianceInFragment = "+this.forceIrradianceInFragment+";\r\n"},Tr.prototype.serialize=function(){var e=vr.prototype.serialize.call(this);return e.useSphericalHarmonics=this.useSphericalHarmonics,e.forceIrradianceInFragment=this.forceIrradianceInFragment,e},Tr.prototype._deserialize=function(e,t,i){vr.prototype._deserialize.call(this,e,t,i),this.useSphericalHarmonics=e.useSphericalHarmonics,this.forceIrradianceInFragment=e.forceIrradianceInFragment},Object(T.c)([xe("Spherical Harmonics",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Tr.prototype,"useSphericalHarmonics",void 0),Object(T.c)([xe("Force irradiance in fragment",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Tr.prototype,"forceIrradianceInFragment",void 0),Tr);function Tr(e){var t=vr.call(this,e)||this;return t.useSphericalHarmonics=!0,t.forceIrradianceInFragment=!1,t._isUnique=!0,t.registerInput("position",c.Vector3,!1,me.Vertex),t.registerInput("world",c.Matrix,!1,me.Vertex),t.registerInput("view",c.Matrix,!1,me.Fragment),t.registerInput("color",c.Color3,!0,me.Fragment),t.registerOutput("reflection",c.Object,me.Fragment,new nr("reflection",t,d.Output,Tr,"ReflectionBlock")),t}y.a.RegisteredTypes["BABYLON.ReflectionBlock"]=yr;var Er,Sr=(Er=b,Object(T.d)(Ar,Er),Ar.prototype.initialize=function(e){e._excludeVariableName("clearcoatOut"),e._excludeVariableName("vClearCoatParams"),e._excludeVariableName("vClearCoatTintParams"),e._excludeVariableName("vClearCoatRefractionParams"),e._excludeVariableName("vClearCoatTangentSpaceParams")},Ar.prototype.getClassName=function(){return"ClearCoatBlock"},Object.defineProperty(Ar.prototype,"intensity",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"roughness",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"ior",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"texture",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"bumpTexture",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"uv",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"tintColor",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"tintAtDistance",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"tintThickness",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"worldTangent",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype,"clearcoat",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Ar.prototype.autoConfigure=function(e){var t;this.intensity.isConnected||((t=new te("ClearCoat intensity",me.Fragment,c.Float)).value=1,t.output.connectTo(this.intensity))},Ar.prototype.prepareDefines=function(e,t,i){Er.prototype.prepareDefines.call(this,e,t,i),i.setValue("CLEARCOAT",!0),i.setValue("CLEARCOAT_TEXTURE",this.texture.isConnected,!0),i.setValue("CLEARCOAT_TINT",this.tintColor.isConnected||this.tintThickness.isConnected||this.tintAtDistance.isConnected,!0),i.setValue("CLEARCOAT_BUMP",this.bumpTexture.isConnected,!0),i.setValue("CLEARCOAT_DEFAULTIOR",!!this.ior.isConnected&&1.5===this.ior.connectInputBlock.value,!0)},Ar.prototype.bind=function(e,t,i,n){var r,o;Er.prototype.bind.call(this,e,t,i);var a=null!==(o=null===(r=this.ior.connectInputBlock)||void 0===r?void 0:r.value)&&void 0!==o?o:1.5,s=1-a,c=1+a,l=Math.pow(-s/c,2),u=1/a;e.setFloat4("vClearCoatRefractionParams",l,u,s,c);var h=this.clearcoat.hasEndpoints?this.clearcoat.endpoints[0].ownerBlock:null,d=null!=h&&h.perturbedNormal.isConnected?h.perturbedNormal.connectedPoint.ownerBlock:null;this._scene._mirroredCameraPosition?e.setFloat2("vClearCoatTangentSpaceParams",null!=d&&d.invertX?1:-1,null!=d&&d.invertY?1:-1):e.setFloat2("vClearCoatTangentSpaceParams",null!=d&&d.invertX?-1:1,null!=d&&d.invertY?-1:1)},Ar.prototype._generateTBNSpace=function(e,t,i){var n="",r="//"+this.name,o=this.worldTangent;e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var a={search:/defined\(TANGENT\)/g,replace:o.isConnected?"defined(TANGENT)":"defined(IGNORE)"};return o.isConnected&&(n+="vec3 tbnNormal = normalize("+i+".xyz);\r\n",n+="vec3 tbnTangent = normalize("+o.associatedVariableName+".xyz);\r\n",n+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r\n",n+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),e._emitFunctionFromInclude("bumpFragmentMainFunctions",r,{replaceStrings:[a]}),n},Ar.GetCode=function(e,t,i,n,r,o,a){var s="",c=null!=t&&t.intensity.isConnected?t.intensity.associatedVariableName:"1.",l=null!=t&&t.roughness.isConnected?t.roughness.associatedVariableName:"0.",u=null!=t&&t.texture.isConnected?t.texture.associatedVariableName:"vec2(0.)",h=null!=t&&t.bumpTexture.isConnected?t.bumpTexture.associatedVariableName:"vec4(0.)",d=null!=t&&t.uv.isConnected?t.uv.associatedVariableName:"vec2(0.)",p=null!=t&&t.tintColor.isConnected?t.tintColor.associatedVariableName:"vec3(1.)",f=null!=t&&t.tintThickness.isConnected?t.tintThickness.associatedVariableName:"1.",m=null!=t&&t.tintAtDistance.isConnected?t.tintAtDistance.associatedVariableName:"1.";return t&&(e._emitUniformFromString("vClearCoatRefractionParams","vec4"),e._emitUniformFromString("vClearCoatTangentSpaceParams","vec2")),r&&t&&(s+=t._generateTBNSpace(e,n,a),o=t.worldTangent.isConnected),s+("clearcoatOutParams clearcoatOut;\n\n #ifdef CLEARCOAT\n vec2 vClearCoatParams = vec2("+c+", "+l+");\n vec4 vClearCoatTintParams = vec4("+p+", "+f+");\n\n clearcoatBlock(\n "+n+".xyz,\n geometricNormalW,\n viewDirectionW,\n vClearCoatParams,\
1n specularEnvironmentR0,\n #ifdef CLEARCOAT_TEXTURE\n "+u+".rg,\n #endif\n #ifdef CLEARCOAT_TINT\n vClearCoatTintParams,\n "+m+",\n vClearCoatRefractionParams,\n #ifdef CLEARCOAT_TINT_TEXTURE\n vec4(0.),\n #endif\n #endif\n #ifdef CLEARCOAT_BUMP\n vec2(0., 1.),\n "+h+",\n "+d+",\n #if defined("+(o?"TANGENT":"IGNORE")+") && defined(NORMAL)\n vTBN,\n #else\n vClearCoatTangentSpaceParams,\n #endif\n #ifdef OBJECTSPACE_NORMALMAP\n normalMatrix,\n #endif\n #endif\n #if defined(FORCENORMALFORWARD) && defined(NORMAL)\n faceNormal,\n #endif\n #ifdef REFLECTION\n "+(null==i?void 0:i._vReflectionMicrosurfaceInfosName)+",\n "+(null==i?void 0:i._vReflectionInfosName)+",\n "+(null==i?void 0:i.reflectionColor)+",\n vLightingIntensity,\n #ifdef "+(null==i?void 0:i._define3DName)+"\n "+(null==i?void 0:i._cubeSamplerName)+",\n #else\n "+(null==i?void 0:i._2DSamplerName)+",\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef "+(null==i?void 0:i._define3DName)+"\n "+(null==i?void 0:i._cubeSamplerName)+",\n "+(null==i?void 0:i._cubeSamplerName)+",\n #else\n "+(null==i?void 0:i._2DSamplerName)+",\n "+(null==i?void 0:i._2DSamplerName)+",\n #endif\n #endif\n #endif\n #if defined(ENVIRONMENTBRDF) && !defined("+(null==i?void 0:i._defineSkyboxName))+")\n #ifdef RADIANCEOCCLUSION\n ambientMonochrome,\n #endif\n #endif\n clearcoatOut\n );\n #else\n clearcoatOut.specularEnvironmentR0 = specularEnvironmentR0;\n #endif\r\n"},Ar.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,e.target===me.Fragment&&(e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this)),this},Ar);function Ar(e){var t=Er.call(this,e,me.Fragment)||this;return t._isUnique=!0,t.registerInput("intensity",c.Float,!1,me.Fragment),t.registerInput("roughness",c.Float,!0,me.Fragment),t.registerInput("ior",c.Float,!0,me.Fragment),t.registerInput("texture",c.Color3,!0,me.Fragment),t.registerInput("bumpTexture",c.Color4,!0,me.Fragment),t.registerInput("uv",c.Vector2,!0,me.Fragment),t.registerInput("tintColor",c.Color3,!0,me.Fragment),t.registerInput("tintAtDistance",c.Float,!0,me.Fragment),t.registerInput("tintThickness",c.Float,!0,me.Fragment),t.registerInput("worldTangent",c.Vector4,!0),t.registerOutput("clearcoat",c.Object,me.Fragment,new nr("clearcoat",t,d.Output,Ar,"ClearCoatBlock")),t}y.a.RegisteredTypes["BABYLON.ClearCoatBlock"]=Sr;var Cr,Pr=(Cr=b,Object(T.d)(xr,Cr),xr.prototype.getClassName=function(){return"RefractionBlock"},Object.defineProperty(xr.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(xr.prototype,"indexOfRefraction",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(xr.prototype,"tintAtDistance",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(xr.prototype,"view",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(xr.prototype,"refraction",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(xr.prototype,"hasTexture",{get:function(){return!!this._getTexture()},enumerable:!1,configurable:!0}),xr.prototype._getTexture=function(){return this.texture?this.texture:this._scene.environmentTexture},xr.prototype.autoConfigure=function(e){var t,i;this.intensity.isConnected||((t=new te("Refraction intensity",me.Fragment,c.Float)).value=1,t.output.connectTo(this.intensity)),this.view.isConnected||((i=e.getInputBlockByPredicate(function(e){return e.systemValue===a.View}
1))||(i=new te("view")).setAsSystemValue(a.View),i.output.connectTo(this.view))},xr.prototype.prepareDefines=function(e,t,i){Cr.prototype.prepareDefines.call(this,e,t,i);var n=this._getTexture(),r=n&&n.getTextureMatrix;i.setValue("SS_REFRACTION",r,!0),r&&(i.setValue(this._define3DName,n.isCube,!0),i.setValue(this._defineLODRefractionAlpha,n.lodLevelInAlpha,!0),i.setValue(this._defineLinearSpecularRefraction,n.linearSpecularLOD,!0),i.setValue(this._defineOppositeZ,this._scene.useRightHandedSystem?!n.invertZ:n.invertZ,!0),i.setValue("SS_LINKREFRACTIONTOTRANSPARENCY",this.linkRefractionWithTransparency,!0),i.setValue("SS_GAMMAREFRACTION",n.gammaSpace,!0),i.setValue("SS_RGBDREFRACTION",n.isRGBD,!0))},xr.prototype.isReady=function(){var e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())},xr.prototype.bind=function(e,t,i,n){var r,o;Cr.prototype.bind.call(this,e,t,i);var a,s,c=this._getTexture();c&&(c.isCube?e.setTexture(this._cubeSamplerName,c):e.setTexture(this._2DSamplerName,c),e.setMatrix(this._refractionMatrixName,c.getReflectionTextureMatrix()),a=1,c.isCube||c.depth&&(a=c.depth),s=null!==(o=null===(r=this.indexOfRefraction.connectInputBlock)||void 0===r?void 0:r.value)&&void 0!==o?o:1.5,e.setFloat4(this._vRefractionInfosName,c.level,1/s,a,this.invertRefractionY?-1:1),e.setFloat3(this._vRefractionMicrosurfaceInfosName,c.getSize().width,c.lodGenerationScale,c.lodGenerationOffset))},xr.prototype.getCode=function(e){return e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),this._define3DName=e._getFreeDefineName("SS_REFRACTIONMAP_3D"),e._samplerDeclaration+="#ifdef "+this._define3DName+"\r\n",e._samplerDeclaration+="uniform samplerCube "+this._cubeSamplerName+";\r\n",e._samplerDeclaration+="#else\r\n",e._samplerDeclaration+="uniform sampler2D "+this._2DSamplerName+";\r\n",e._samplerDeclaration+="#endif\r\n",e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._defineLODRefractionAlpha=e._getFreeDefineName("SS_LODINREFRACTIONALPHA"),this._defineLinearSpecularRefraction=e._getFreeDefineName("SS_LINEARSPECULARREFRACTION"),this._defineOppositeZ=e._getFreeDefineName("SS_REFRACTIONMAP_OPPOSITEZ"),this._refractionMatrixName=e._getFreeVariableName("refractionMatrix"),e._emitUniformFromString(this._refractionMatrixName,"mat4"),e._emitFunction("sampleRefraction","\n #ifdef "+this._define3DName+"\n #define sampleRefraction(s, c) textureCube(s, c)\n #else\n #define sampleRefraction(s, c) texture2D(s, c)\n #endif\r\n","//"+this.name),e._emitFunction("sampleRefractionLod","\n #ifdef "+this._define3DName+"\n #define sampleRefractionLod(s, c, l) textureCubeLodEXT(s, c, l)\n #else\n #define sampleRefractionLod(s, c, l) texture2DLodEXT(s, c, l)\n #endif\r\n","//"+this.name),this._vRefractionMicrosurfaceInfosName=e._getFreeVariableName("vRefractionMicrosurfaceInfos"),e._emitUniformFromString(this._vRefractionMicrosurfaceInfosName,"vec3"),this._vRefractionInfosName=e._getFreeVariableName("vRefractionInfos"),e._emitUniformFromString(this._vRefractionInfosName,"vec4"),""},xr.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,this},xr.prototype._dumpPropertiesCode=function(){var e=Cr.prototype._dumpPropertiesCode.call(this);return this.texture&&(e=this.texture.isCube?this._codeVariableName+'.texture = new BABYLON.CubeTexture("'+this.texture.name+'");\r\n':this._codeVariableName+'.texture = new BABYLON.Texture("'+this.texture.name+'");\r\n',e+=this._codeVariableName+".texture.coordinatesMode = "+this.texture.coordinatesMode+";\r\n"),(e+=this._codeVariableName+".linkRefractionWithTransparency = "+this.linkRefractionWithTransparency+";\r\n")+this._codeVariableName+".invertRefractionY = "+this.invertRefractionY+";\r\n"},xr.prototype.serialize=function(){var e=Cr.prototype.serialize.call(this);return this.texture&&(e.texture=this.texture.serialize()),e.linkRefractionWithTransparency=this.linkRefractionWithTransparency,e.invertRefractionY=this.invertRefractionY,e},xr.prototype._deserialize=function(e,t,i){Cr.prototype._deserialize.call(this,e,t,i),e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,e.texture.isCube?this.texture=wt.a.Parse(e.texture,t,i):this.texture=oe.a.Parse(e.texture,t,i)),this.linkRefractionWithTransparency=e.linkRefractionWithTransparency,this.invertRefractionY=e.invertRefractionY},Object(T.c)([xe("Link refraction to transparency",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],xr.prototype,"linkRefractionWithTransparency",void 0),Object(T.c)([xe("Invert refraction Y",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],xr.prototype,"invertRefractionY",void 0),xr);function xr(e){var t=Cr.call(this,e,me.Fragment)||this;return t.linkRefractionWithTransparency=!1,t.invertRefractionY=!1,t._isUnique=!0,t.registerInput("intensity",c.Float,!1,me.Fragment),t.registerInput("indexOfRefraction",c.Float,!0,me.Fragment),t.registerInput("tintAtDistance",c.Float,!0,me.Fragment),t.registerInput("view",c.Matrix,!1,me.Fragment),t.registerOutput("refraction",c.Object,me.Fragment,new nr("refraction",t,d.Output,xr,"RefractionBlock")),t}y.a.RegisteredTypes["BABYLON.RefractionBlock"]=Pr;var Rr,Or=(Rr=b,Object(T.d)(Mr,Rr),Mr.prototype.initialize=function(e){e._excludeVariableName("subSurfaceOut"),e._excludeVariableName("vThicknessParam"),e._excludeVariableName("vTintColor"),e._excludeVariableName("vSubSurfaceIntensity")},Mr.prototype.getClassName=function(){return"SubSurfaceBlock"},Object.defineProperty(Mr.prototype,"minThickness",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"maxThickness",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"thicknessTexture",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"tintColor",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"translucencyIntensity",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"translucencyDiffusionDistance",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"refraction",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(Mr.prototype,"subsurface",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Mr.prototype.autoConfigure=function(e){var t;this.minThickness.isConnected||((t=new te("SubSurface min thickness",me.Fragment,c.Float)).value=0,t.output.connectTo(this.minThickness))},Mr.prototype.prepareDefines=function(e,t,i){Rr.prototype.prepareDefines.call(this,e,t,i);var n=this.translucencyDiffusionDistance.isConnected||this.translucencyIntensity.isConnected;i.setValue("SUBSURFACE",n||this.refraction.isConnected,!0),i.setValue("SS_TRANSLUCENCY",n,!0),i.setValue("SS_THICKNESSANDMASK_TEXTURE",this.thicknessTexture.isConnected,!0),i.setValue("SS_MASK_FROM_THICKNESS_TEXTURE",this.useMaskFromThicknessTexture,!0)},Mr.GetCode=function(e,t,i,n){var r,o,a,s,c,l,u,h,d,p,f,m,_,g,v,b="",y=null!=t&&t.minThickness.isConnected?t.minThickness.associatedVariableName:"0.",T=null!=t&&t.maxThickness.isConnected?t.maxThickness.associatedVariableName:"1.",E=null!=t&&t.thicknessTexture.isConnected?t.thicknessTexture.associatedVariableName:"vec4(0.)",S=null!=t&&t.tintColor.isConnected?t.tintColor.associatedVariableName:"vec3(1.)",A=null!=t&&t.translucencyIntensity.isConnected?null==t?void 0:t.translucencyIntensity.associatedVariableName:"1.",C=null!=t&&t.translucencyDiffusionDistance.isConnected?null==t?void 0:t.translucencyDiffusionDistance.associatedVariableName:"vec3(1.)",P=null!=t&&t.refraction.isConnected?null===(r=null==t?void 0:t.refraction.connectedPoint)||void 0===r?void 0:r.ownerBlock:null,x=null!=P&&P.tintAtDistance.isConnected?P.tintAtDistance.associatedVariableName:"1.",R=null!=P&&P.intensity.isConnected?P.intensity.associatedVariableName:"1.",O=null!=P&&P.view.isConnected?P.view.associatedVariableName:"";return(b+=null!==(o=null==P?void 0:P.getCode(e))&&void 0!==o?o:"")+("subSurfaceOutParams subSurfaceOut;\n\n #ifdef SUBSURFACE\n vec2 vThicknessParam = vec2("+y+", "+T+" - "+y+");\n vec4 vTintColor = vec4("+S+", "+x+");\n vec3 vSubSurfaceIntensity = vec3("+R+", "+A+", 0.);\n\n subSurfaceBlock(\n vSubSurfaceIntensity,\n vThicknessParam,\n vTintColor,\n normalW,\n specularEnvironmentReflectance,\n #ifdef SS_THICKNESSANDMASK_TEXTURE\n "+E+",\n #endif\n #ifdef REFLECTION\n #ifdef SS_TRANSLUCENCY\n "+(null==i?void 0:i._reflectionMatrixName)+",\n #ifdef USESPHERICALFROMREFLECTIONMAP\n #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\n reflectionOut.irradianceVector,\n #endif\n #endif\n #ifdef USEIRRADIANCEMAP\n irradianceSampler,\n #endif\n #endif\n #endif\n #ifdef SS_REFRACTION\n "+n+".xyz,\n viewDirectionW,\n "+O+",\n surfaceAlbedo,\n "+(null!==(a=null==P?void 0:P._vRefractionInfosName)&&void 0!==a?a:"")+",\n "+(null!==(s=null==P?void 0:P._refractionMatrixName)&&void 0!==s?s:"")+",\n "+(null!==(c=null==P?void 0:P._vRefractionMicrosurfaceInfosName)&&void 0!==c?c:"")+",\n vLightingIntensity,\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n alpha,\
1n #endif\n #ifdef "+(null!==(l=null==P?void 0:P._defineLODRefractionAlpha)&&void 0!==l?l:"IGNORE")+"\n NdotVUnclamped,\n #endif\n #ifdef "+(null!==(u=null==P?void 0:P._defineLinearSpecularRefraction)&&void 0!==u?u:"IGNORE")+"\n roughness,\n #else\n alphaG,\n #endif\n #ifdef "+(null!==(h=null==P?void 0:P._define3DName)&&void 0!==h?h:"IGNORE")+"\n "+(null!==(d=null==P?void 0:P._cubeSamplerName)&&void 0!==d?d:"")+",\n #else\n "+(null!==(p=null==P?void 0:P._2DSamplerName)&&void 0!==p?p:"")+",\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef "+(null!==(f=null==P?void 0:P._define3DName)&&void 0!==f?f:"IGNORE")+"\n "+(null!==(m=null==P?void 0:P._cubeSamplerName)&&void 0!==m?m:"")+",\n "+(null!==(_=null==P?void 0:P._cubeSamplerName)&&void 0!==_?_:"")+",\n #else\n "+(null!==(g=null==P?void 0:P._2DSamplerName)&&void 0!==g?g:"")+",\n "+(null!==(v=null==P?void 0:P._2DSamplerName)&&void 0!==v?v:""))+",\n #endif\n #endif\n #ifdef ANISOTROPIC\n anisotropicOut,\n #endif\n #endif\n #ifdef SS_TRANSLUCENCY\n "+C+",\n #endif\n subSurfaceOut\n );\n\n #ifdef SS_REFRACTION\n surfaceAlbedo = subSurfaceOut.surfaceAlbedo;\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n alpha = subSurfaceOut.alpha;\n #endif\n #endif\n #else\n subSurfaceOut.specularEnvironmentReflectance = specularEnvironmentReflectance;\n #endif\r\n"},Mr.prototype._buildBlock=function(e){return e.target===me.Fragment&&e.sharedData.blocksWithDefines.push(this),this},Object(T.c)([xe("Mask from thickness texture",ve.Boolean,"PROPERTIES",{notifiers:{update:!0}})],Mr.prototype,"useMaskFromThicknessTexture",void 0),Mr);function Mr(e){var t=Rr.call(this,e,me.Fragment)||this;return t.useMaskFromThicknessTexture=!1,t._isUnique=!0,t.registerInput("minThickness",c.Float,!1,me.Fragment),t.registerInput("maxThickness",c.Float,!0,me.Fragment),t.registerInput("thicknessTexture",c.Color4,!0,me.Fragment),t.registerInput("tintColor",c.Color3,!0,me.Fragment),t.registerInput("translucencyIntensity",c.Float,!0,me.Fragment),t.registerInput("translucencyDiffusionDistance",c.Color3,!0,me.Fragment),t.registerInput("refraction",c.Object,!0,me.Fragment,new nr("refraction",t,d.Input,Pr,"RefractionBlock")),t.registerOutput("subsurface",c.Object,me.Fragment,new nr("subsurface",t,d.Output,Mr,"SubSurfaceBlock")),t}y.a.RegisteredTypes["BABYLON.SubSurfaceBlock"]=Or;var Ir,Dr={ambient:["finalAmbient",""],diffuse:["finalDiffuse",""],specular:["finalSpecularScaled","!defined(UNLIT) && defined(SPECULARTERM)"],sheenDir:["finalSheenScaled","!defined(UNLIT) && defined(SHEEN)"],clearcoatDir:["finalClearCoatScaled","!defined(UNLIT) && defined(CLEARCOAT)"],diffuseInd:["finalIrradiance","!defined(UNLIT) && defined(REFLECTION)"],specularInd:["finalRadianceScaled","!defined(UNLIT) && defined(REFLECTION)"],sheenInd:["sheenOut.finalSheenRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(SHEEN) && defined(ENVIRONMENTBRDF)"],clearcoatInd:["clearcoatOut.finalClearCoatRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(CLEARCOAT)"],refraction:["subSurfaceOut.finalRefraction","!defined(UNLIT) && defined(SS_REFRACTION)"],lighting:["finalColor.rgb",""],shadow:["shadow",""],alpha:["alpha",""]},Lr=(Ir=b,Object(T.d)(Nr,Ir),Nr.prototype.initialize=function(e){e._excludeVariableName("vLightingIntensity"),e._excludeVariableName("geometricNormalW"),e._excludeVariableName("normalW"),e._excludeVariableName("faceNormal"),e._excludeVariableName("albedoOpacityOut"),e._excludeVariableName("surfaceAlbedo"),e._excludeVariableName("alpha"),e._excludeVariableName("NdotVUnclamped"),e._excludeVariableName("NdotV"),e._excludeVariableName("alphaG"),e._excludeVariableName("AARoughnessFactors"),e._excludeVariableName("environmentBrdf"),e._excludeVariableName("ambientMonochrome"),e._excludeVariableName("seo"),e._excludeVariableName("eho"),e._excludeVariableName("environmentRadiance"),e._excludeVariableName("irradianceVector"),e._excludeVariableName("environmentIrradiance"),e._excludeVariableName("diffuseBase"),e._excludeVariableName("specularBase"),e._excludeVariableName("preInfo"),e._excludeVariableName("info"),e._excludeVariableName("shadow"),e._excludeVariableName("finalDiffuse"),e._excludeVariableName("finalAmbient"),e._excludeVariableName("ambientOcclusionForDirectDiffuse"),e._excludeVariableName("finalColor"),e._excludeVariableName("vClipSpacePosition"),e._excludeVariableName("vDebugMode")},Nr.prototype.getClassName=function(){return"PBRMetallicRoughnessBlock"},Object.defineProperty(Nr.prototype,"worldPosition",{get:function(){return this._inputs[0]}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"perturbedNormal",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"cameraPosition",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"baseColor",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"opacityTexture",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"ambientColor",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"reflectivity",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"ambientOcclusion",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"reflection",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"sheen",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"clearcoat",{get:function(){return this._inputs[11]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"subsurface",{get:function(){return this._inputs[12]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"anisotropy",{get:function(){return this._inputs[13]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"ambient",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"diffuse",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"specular",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"sheenDir",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"clearcoatDir",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"diffuseIndirect",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"specularIndirect",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"sheenIndirect",{get:function(){return this._outputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"clearcoatIndirect",{get:function(){return this._outputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"refraction",{get:function(){return this._outputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"lighting",{get:function(){return this._outputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"shadow",{get:function(){return this._outputs[11]},enumerable:!1,configurable:!0}),Object.defineProperty(Nr.prototype,"alpha",{get:function(){return this._outputs[12]},enumerable:!1,configurable:!0}),Nr.prototype.autoConfigure=function(e){var t;this.cameraPosition.isConnected||((t=e.getInputBlockByPredicate(function(e){return e.systemValue===a.CameraPosition}))||(t=new te("cameraPosition")).setAsSystemValue(a.CameraPosition),t.output.connectTo(this.cameraPosition))},Nr.prototype.prepareDefines=function(e,t,i){var n,r;i.setValue("PBR",!0),i.setValue("METALLICWORKFLOW",!0),i.setValue("DEBUGMODE",this.debugMode,!0),i.setValue("NORMALXYSCALE",!0),i.setValue("BUMP",this.perturbedNormal.isConnected,!0),i.setValue("LODBASEDMICROSFURACE",this._scene.getEngine().getCaps().textureLOD),i.setValue("OPACITY",this.opacityTexture.isConnected,!0),this.lightFalloff===ir.a.LIGHTFALLOFF_STANDARD?(i.setValue("USEPHYSICALLIGHTFALLOFF",!1),i.setValue("USEGLTFLIGHTFALLOFF",!1)):this.lightFalloff===ir.a.LIGHTFALLOFF_GLTF?(i.setValue("USEPHYSICALLIGHTFALLOFF",!1),i.setValue("USEGLTFLIGHTFALLOFF",!0)):(i.setValue("USEPHYSICALLIGHTFA
1LLOFF",!0),i.setValue("USEGLTFLIGHTFALLOFF",!1)),i.setValue("ALPHABLEND",this.useAlphaBlending,!0),i.setValue("ALPHAFROMALBEDO",this.useAlphaFromAlbedoTexture,!0),i.setValue("ALPHATEST",this.useAlphaTest,!0),i.setValue("ALPHATESTVALUE",this.alphaTestCutoff,!0),i.setValue("OPACITYRGB",this.opacityRGB,!0),i.setValue("RADIANCEOVERALPHA",this.useRadianceOverAlpha,!0),i.setValue("SPECULAROVERALPHA",this.useSpecularOverAlpha,!0),i.setValue("SPECULARAA",this._scene.getEngine().getCaps().standardDerivatives&&this.enableSpecularAntiAliasing,!0),i.setValue("REALTIME_FILTERING",this.realTimeFiltering,!0),i.setValue("NUM_SAMPLES",""+this.realTimeFilteringQuality,!0),1<this._scene.getEngine().webGLVersion&&i.setValue("NUM_SAMPLES",this.realTimeFilteringQuality+"u",!0),i.setValue("BRDF_V_HEIGHT_CORRELATED",!0),i.setValue("MS_BRDF_ENERGY_CONSERVATION",this.useEnergyConservation,!0),i.setValue("RADIANCEOCCLUSION",this.useRadianceOcclusion,!0),i.setValue("HORIZONOCCLUSION",this.useHorizonOcclusion,!0),i.setValue("UNLIT",this.unlit,!0),i.setValue("FORCENORMALFORWARD",this.forceNormalForward,!0),this._environmentBRDFTexture&&mr.a.ReflectionTextureEnabled?(i.setValue("ENVIRONMENTBRDF",!0),i.setValue("ENVIRONMENTBRDF_RGBD",this._environmentBRDFTexture.isRGBD,!0)):(i.setValue("ENVIRONMENTBRDF",!1),i.setValue("ENVIRONMENTBRDF_RGBD",!1)),i._areLightsDirty&&(n=e.getScene(),this.light?(r={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1},Z.a.PrepareDefinesForLight(n,e,this.light,this._lightId,i,!0,r),r.needRebuild&&i.rebuild()):(Z.a.PrepareDefinesForLights(n,e,i,!0,t.maxSimultaneousLights),i._needNormals=!0,Z.a.PrepareDefinesForMultiview(n,i)))},Nr.prototype.updateUniformsAndSamples=function(e,t,i,n){Z.a.PrepareUniformsAndSamplersList({uniformsNames:e.uniforms,uniformBuffersNames:n,samplers:e.samplers,defines:i,maxSimultaneousLights:t.maxSimultaneousLights})},Nr.prototype.bind=function(e,t,i){var n,r,o;i&&(n=i.getScene(),this.light?Z.a.BindLight(this.light,this._lightId,n,e,!0):Z.a.BindLights(n,i,e,!0,t.maxSimultaneousLights),e.setTexture(this._environmentBrdfSamplerName,this._environmentBRDFTexture),e.setFloat2("vDebugMode",this.debugLimit,this.debugFactor),(r=this._scene.ambientColor)&&e.setColor3("ambientFromScene",r),o=n.useRightHandedSystem===(null!=n._mirroredCameraPosition),e.setFloat(this._invertNormalName,o?-1:1),e.setFloat4("vLightingIntensity",this.directIntensity,1,this.environmentIntensity*this._scene.environmentIntensity,this.specularIntensity))},Nr.prototype._injectVertexCode=function(e){var t,i,n=this.worldPosition,r="//"+this.name;this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",r,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var o="v_"+n.associatedVariableName;e._emitVaryingFromString(o,"vec4")&&(e.compilationString+=o+" = "+n.associatedVariableName+";\r\n");var a=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;e.compilationString+=null!==(i=null==a?void 0:a.handleVertexSide(e))&&void 0!==i?i:"",e._emitUniformFromString("vDebugMode","vec2","defined(IGNORE) || DEBUGMODE > 0"),e._emitUniformFromString("ambientFromScene","vec3"),e._emitVaryingFromString("vClipSpacePosition","vec4","defined(IGNORE) || DEBUGMODE > 0")&&(e._injectAtEnd+="#if DEBUGMODE > 0\r\n",e._injectAtEnd+="vClipSpacePosition = gl_Position;\r\n",e._injectAtEnd+="#endif\r\n"),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:n.associatedVariableName}]}):(e.compilationString+="vec4 worldPos = "+n.associatedVariableName+";\r\n",e.compilationString+=e._emitCodeFromInclude("shadowsVertex",r,{repeatKey:"maxSimultaneousLights"}))},Nr.prototype.getAlbedoOpacityCode=function(){return"albedoOpacityOutParams albedoOpacityOut;\r\nalbedoOpacityBlock(\n "+(this.baseColor.isConnected?this.baseColor.associatedVariableName:"vec4(1., 1., 1., 1.)")+",\n #ifdef ALBEDO\n vec4(1.),\n vec2(1., 1.),\n #endif\n #ifdef OPACITY\n "+(this.opacityTexture.isConnected?this.opacityTexture.associatedVariableName:"")+",\n vec2(1., 1.),\n #endif\n albedoOpacityOut\n );\n\n vec3 surfaceAlbedo = albedoOpacityOut.surfaceAlbedo;\n float alpha = albedoOpacityOut.alpha;\r\n"},Nr.prototype._buildBlock=function(e){var t,i,n,r,o,a,s,c,l,u,h,d,p,f,m,_,g,v,b,y,T,E,S,A,C,P,x,R,O,M,I,D,L,N,F,w,B,U,V,k,G,z,j,W;Ir.prototype._buildBlock.call(this,e),this._scene=e.sharedData.scene,this._environmentBRDFTexture||(this._environmentBRDFTexture=fr.a.GetEnvironmentBRDFTexture(this._scene));var H=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;if(H&&(H.worldPositionConnectionPoint=this.worldPosition,H.cameraPositionConnectionPoint=this.cameraPosition,H.worldNormalConnectionPoint=this.worldNormal),e.target!==me.Fragment)return this._injectVertexCode(e),this;e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this);var X="//"+this.name,Y="v_"+this.worldPosition.associatedVariableName,K=this.perturbedNormal;this._environmentBrdfSamplerName=e._getFreeVariableName("environmentBrdfSampler"),e._emit2DSampler(this._environmentBrdfSamplerName),e.sharedData.hints.needAlphaBlending=e.sharedData.hints.needAlphaBlending||this.useAlphaBlending,e.sharedData.hints.needAlphaTesting=e.sharedData.hints.needAlphaTesting||this.useAlphaTest,e._emitExtension("lod","#extension GL_EXT_shader_texture_lod : enable","defined(LODBASEDMICROSFURACE)"),this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",X,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",X,{repeatKey:"maxSimultaneousLights"}),e._emitFunctionFromInclude("helperFunctions",X),e._emitFunctionFromInclude("importanceSampling",X),e._emitFunctionFromInclude("pbrHelperFunctions",X),e._emitFunctionFromInclude("imageProcessingFunctions",X),e._emitFunctionFromInclude("shadowsFragmentFunctions",X,{replaceStrings:[{search:/vPositionW/g,replace:Y+".xyz"}]}),e._emitFunctionFromInclude("pbrDirectLightingSetupFunctions",X,{replaceStrings:[{search:/vPositionW/g,replace:Y+".xyz"}]}),e._emitFunctionFromInclude("pbrDirectLightingFalloffFunctions",X),e._emitFunctionFromInclude("pbrBRDFFunctions",X),e._emitFunctionFromInclude("hdrFilteringFunctions",X),e._emitFunctionFromInclude("pbrDirectLightingFunctions",X,{replaceStrings:[{search:/vPositionW/g,replace:Y+".xyz"}]}),e._emitFunctionFromInclude("pbrIBLFunctions",X),e._emitFunctionFromInclude("pbrBlockAlbedoOpacity",X),e._emitFunctionFromInclude("pbrBlockReflectivity",X),e._emitFunctionFromInclude("pbrBlockAmbientOcclusion",X),e._emitFunctionFromInclude("pbrBlockAlphaFresnel",X),e._emitFunctionFromInclude("pbrBlockAnisotropic",X),e._emitUniformFromString("vLightingIntensity","vec4"),this._vNormalWName=e._getFreeVariableName("vNormalW"),e.compilationString+="vec4 "+this._vNormalWName+" = normalize("+this.worldNormal.associatedVariableName+");\r\n",e._registerTempVariable("viewDirectionW")&&(e.compilationString+="vec3 viewDirectionW = normalize("+this.cameraPosition.associatedVariableName+" - "+Y+".xyz);\r\n"),e.compilationString+="vec3 geometricNormalW = "+this._vNormalWName+".xyz;\r\n",e.compilationString+="vec3 normalW = "+(K.isConnected?"normalize("+K.associatedVariableName+".xyz)":"geometricNormalW")+";\r\n",this._invertNormalName=e._getFreeVariableName("invertNormal"),e._emitUniformFromString(this._invertNormalName,"float"),e.compilationString+=e._emitCodeFromInclude("pbrBlockNormalFinal",X,{replaceStrings:[{search:/vPositionW/g,replace:Y+".xyz"},{search:/vEyePosition.w/g,replace:this._invertNormalName}]}),e.compilationString+=this.getAlbedoOpacityCode(),e.compilationString+=e._emitCodeFromInclude("depthPrePass",X);var Q=null===(i=this.ambientOcclusion.connectedPoint)||void 0===i?void 0:i.ownerBlock;e.compilationString+=rr.GetCode(Q),e.compilationString+=e._emitCodeFromInclude("pbrBlockLightmapInit",X),e.compilationString+="#ifdef UNLIT\n vec3 diffuseBase = vec3(1., 1., 1.);\n #else\r\n";var q=this.subsurface.isConnected?null===(n=this.subsurface.connectedPoint)||void 0===n?void 0:n.ownerBlock:null,Z=this.subsurface.isConnected?null===(o=(null===(r=this.subsurface.connectedPoint)||void 0===r?void 0:r.ownerBlock).refraction.connectedPoint)||void 0===o?void 0:o.ownerBlock:null,J=null!==(s=null===(a=this.reflectivity.connectedPoint)||void 0===a?void 0:a.ownerBlock)&&void 0!==s?s:null;J&&(J.indexOfRefractionConnectionPoint=null!==(c=null==Z?void 0:Z.indexOfRefraction)&&void 0!==c?c:null);
1var $=null!=Q&&Q.intensity.isConnected?Q.intensity.associatedVariableName:"1.";e.compilationString+=null!==(l=null==J?void 0:J.getCode(e,$))&&void 0!==l?l:"",e.compilationString+=e._emitCodeFromInclude("pbrBlockGeometryInfo",X,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(u=null==H?void 0:H._defineSkyboxName)&&void 0!==u?u:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(h=null==H?void 0:H._define3DName)&&void 0!==h?h:"REFLECTIONMAP_3D"}]});var ee=this.anisotropy.isConnected?null===(d=this.anisotropy.connectedPoint)||void 0===d?void 0:d.ownerBlock:null;ee&&(ee.worldPositionConnectionPoint=this.worldPosition,ee.worldNormalConnectionPoint=this.worldNormal,e.compilationString+=ee.getCode(e,!this.perturbedNormal.isConnected)),H&&H.hasTexture&&(e.compilationString+=H.getCode(e,ee?"anisotropicOut.anisotropicNormal":"normalW")),e._emitFunctionFromInclude("pbrBlockReflection",X,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(p=null==H?void 0:H._define3DName)&&void 0!==p?p:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(f=null==H?void 0:H._defineOppositeZ)&&void 0!==f?f:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(m=null==H?void 0:H._defineProjectionName)&&void 0!==m?m:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(_=null==H?void 0:H._defineSkyboxName)&&void 0!==_?_:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(g=null==H?void 0:H._defineLODReflectionAlpha)&&void 0!==g?g:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(v=null==H?void 0:H._defineLinearSpecularReflection)&&void 0!==v?v:"LINEARSPECULARREFLECTION"},{search:/vReflectionFilteringInfo/g,replace:null!==(b=null==H?void 0:H._vReflectionFilteringInfoName)&&void 0!==b?b:"vReflectionFilteringInfo"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockReflectance0",X,{replaceStrings:[{search:/metallicReflectanceFactors/g,replace:null!==(y=null==J?void 0:J._vMetallicReflectanceFactorsName)&&void 0!==y?y:"metallicReflectanceFactors"}]});var te=this.sheen.isConnected?null===(T=this.sheen.connectedPoint)||void 0===T?void 0:T.ownerBlock:null;te&&(e.compilationString+=te.getCode(H)),e._emitFunctionFromInclude("pbrBlockSheen",X,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(E=null==H?void 0:H._define3DName)&&void 0!==E?E:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(S=null==H?void 0:H._defineSkyboxName)&&void 0!==S?S:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(A=null==H?void 0:H._defineLODReflectionAlpha)&&void 0!==A?A:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(C=null==H?void 0:H._defineLinearSpecularReflection)&&void 0!==C?C:"LINEARSPECULARREFLECTION"}]});var ie=this.clearcoat.isConnected?null===(P=this.clearcoat.connectedPoint)||void 0===P?void 0:P.ownerBlock:null,ne=!this.perturbedNormal.isConnected&&!this.anisotropy.isConnected,re=this.perturbedNormal.isConnected&&(null===(x=this.perturbedNormal.connectedPoint)||void 0===x?void 0:x.ownerBlock).worldTangent.isConnected,oe=this.anisotropy.isConnected&&(null===(R=this.anisotropy.connectedPoint)||void 0===R?void 0:R.ownerBlock).worldTangent.isConnected,ae=re||!this.perturbedNormal.isConnected&&oe;e.compilationString+=Sr.GetCode(e,ie,H,Y,ne,ae,this.worldNormal.associatedVariableName),ne&&(ae=null!==(O=null==ie?void 0:ie.worldTangent.isConnected)&&void 0!==O&&O),e._emitFunctionFromInclude("pbrBlockClearcoat",X,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(M=null==H?void 0:H._define3DName)&&void 0!==M?M:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(I=null==H?void 0:H._defineOppositeZ)&&void 0!==I?I:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(D=null==H?void 0:H._defineProjectionName)&&void 0!==D?D:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(L=null==H?void 0:H._defineSkyboxName)&&void 0!==L?L:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(N=null==H?void 0:H._defineLODReflectionAlpha)&&void 0!==N?N:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(F=null==H?void 0:H._defineLinearSpecularReflection)&&void 0!==F?F:"LINEARSPECULARREFLECTION"},{search:/defined\(TANGENT\)/g,replace:ae?"defined(TANGENT)":"defined(IGNORE)"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockReflectance",X,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(w=null==H?void 0:H._defineSkyboxName)&&void 0!==w?w:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(B=null==H?void 0:H._define3DName)&&void 0!==B?B:"REFLECTIONMAP_3D"}]}),e.compilationString+=Or.GetCode(e,q,H,Y),e._emitFunctionFromInclude("pbrBlockSubSurface",X,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(U=null==H?void 0:H._define3DName)&&void 0!==U?U:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(V=null==H?void 0:H._defineOppositeZ)&&void 0!==V?V:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(k=null==H?void 0:H._defineProjectionName)&&void 0!==k?k:"REFLECTIONMAP_PROJECTION"},{search:/SS_REFRACTIONMAP_3D/g,replace:null!==(G=null==Z?void 0:Z._define3DName)&&void 0!==G?G:"SS_REFRACTIONMAP_3D"},{search:/SS_LODINREFRACTIONALPHA/g,replace:null!==(z=null==Z?void 0:Z._defineLODRefractionAlpha)&&void 0!==z?z:"SS_LODINREFRACTIONALPHA"},{search:/SS_LINEARSPECULARREFRACTION/g,replace:null!==(j=null==Z?void 0:Z._defineLinearSpecularRefraction)&&void 0!==j?j:"SS_LINEARSPECULARREFRACTION"},{search:/SS_REFRACTIONMAP_OPPOSITEZ/g,replace:null!==(W=null==Z?void 0:Z._defineOppositeZ)&&void 0!==W?W:"SS_REFRACTIONMAP_OPPOSITEZ"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockDirectLighting",X),this.light?e.compilationString+=e._emitCodeFromInclude("lightFragment",X,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):e.compilationString+=e._emitCodeFromInclude("lightFragment",X,{repeatKey:"maxSimultaneousLights"}),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalLitComponents",X),e.compilationString+="#endif\r\n";var se=this.ambientColor.isConnected?this.ambientColor.associatedVariableName:"vec3(0., 0., 0.)",ce=null!=
1Q&&Q.directLightIntensity.isConnected?Q.directLightIntensity.associatedVariableName:ir.a.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString();null!=Q&&Q.directLightIntensity.isConnected||-1!==ce.indexOf(".")||(ce+="."),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalUnlitComponents",X,{replaceStrings:[{search:/vec3 finalEmissive[\s\S]*?finalEmissive\*=vLightingIntensity\.y;/g,replace:""},{search:/vAmbientColor/g,replace:se+" * ambientFromScene"},{search:/vAmbientInfos\.w/g,replace:ce}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalColorComposition",X,{replaceStrings:[{search:/finalEmissive/g,replace:"vec3(0.)"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockImageProcessing",X,{replaceStrings:[{search:/visibility/g,replace:"1."}]}),e.compilationString+=e._emitCodeFromInclude("pbrDebug",X,{replaceStrings:[{search:/vNormalW/g,replace:this._vNormalWName},{search:/vPositionW/g,replace:Y},{search:/albedoTexture\.rgb;/g,replace:"vec3(1.);\r\ngl_FragColor.rgb = toGammaSpace(gl_FragColor.rgb);\r\n"},{search:/opacityMap/g,replace:this.opacityTexture.associatedVariableName}]});for(var le=0,ue=this._outputs;le<ue.length;le++){var he,de,pe,fe=ue[le];fe.hasEndpoints&&((he=Dr[fe.name])?(de=he[0],(pe=he[1])&&(e.compilationString+="#if "+pe+"\r\n"),e.compilationString+=this._declareOutput(fe,e)+" = "+de+";\r\n",pe&&(e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(fe,e)+" = vec3(0.);\r\n",e.compilationString+="#endif\r\n")):console.error("There's no remapping for the "+fe.name+" end point! No code generated"))}return this},Nr.prototype._dumpPropertiesCode=function(){var e="";return e+=this._codeVariableName+".lightFalloff = "+this.lightFalloff+";\r\n",e+=this._codeVariableName+".useAlphaFromAlbedoTexture = "+this.useAlphaFromAlbedoTexture+";\r\n",e+=this._codeVariableName+".useAlphaTest = "+this.useAlphaTest+";\r\n",e+=this._codeVariableName+".alphaTestCutoff = "+this.alphaTestCutoff+";\r\n",e+=this._codeVariableName+".useAlphaBlending = "+this.useAlphaBlending+";\r\n",e+=this._codeVariableName+".opacityRGB = "+this.opacityRGB+";\r\n",e+=this._codeVariableName+".useRadianceOverAlpha = "+this.useRadianceOverAlpha+";\r\n",e+=this._codeVariableName+".useSpecularOverAlpha = "+this.useSpecularOverAlpha+";\r\n",e+=this._codeVariableName+".enableSpecularAntiAliasing = "+this.enableSpecularAntiAliasing+";\r\n",e+=this._codeVariableName+".realTimeFiltering = "+this.realTimeFiltering+";\r\n",e+=this._codeVariableName+".realTimeFilteringQuality = "+this.realTimeFilteringQuality+";\r\n",e+=this._codeVariableName+".useEnergyConservation = "+this.useEnergyConservation+";\r\n",e+=this._codeVariableName+".useRadianceOcclusion = "+this.useRadianceOcclusion+";\r\n",e+=this._codeVariableName+".useHorizonOcclusion = "+this.useHorizonOcclusion+";\r\n",e+=this._codeVariableName+".unlit = "+this.unlit+";\r\n",e+=this._codeVariableName+".forceNormalForward = "+this.forceNormalForward+";\r\n",e+=this._codeVariableName+".debugMode = "+this.debugMode+";\r\n",(e+=this._codeVariableName+".debugLimit = "+this.debugLimit+";\r\n")+this._codeVariableName+".debugFactor = "+this.debugFactor+";\r\n"},Nr.prototype.serialize=function(){var e=Ir.prototype.serialize.call(this);return this.light&&(e.lightId=this.light.id),e.lightFalloff=this.lightFalloff,e.useAlphaFromAlbedoTexture=this.useAlphaFromAlbedoTexture,e.useAlphaTest=this.useAlphaTest,e.alphaTestCutoff=this.alphaTestCutoff,e.useAlphaBlending=this.useAlphaBlending,e.opacityRGB=this.opacityRGB,e.useRadianceOverAlpha=this.useRadianceOverAlpha,e.useSpecularOverAlpha=this.useSpecularOverAlpha,e.enableSpecularAntiAliasing=this.enableSpecularAntiAliasing,e.realTimeFiltering=this.realTimeFiltering,e.realTimeFilteringQuality=this.realTimeFilteringQuality,e.useEnergyConservation=this.useEnergyConservation,e.useRadianceOcclusion=this.useRadianceOcclusion,e.useHorizonOcclusion=this.useHorizonOcclusion,e.unlit=this.unlit,e.forceNormalForward=this.forceNormalForward,e.debugMode=this.debugMode,e.debugLimit=this.debugLimit,e.debugFactor=this.debugFactor,e},Nr.prototype._deserialize=function(e,t,i){var n,r;Ir.prototype._deserialize.call(this,e,t,i),e.lightId&&(this.light=t.getLightByID(e.lightId)),this.lightFalloff=null!==(n=e.lightFalloff)&&void 0!==n?n:0,this.useAlphaFromAlbedoTexture=e.useAlphaFromAlbedoTexture,this.useAlphaTest=e.useAlphaTest,this.alphaTestCutoff=e.alphaTestCutoff,this.useAlphaBlending=e.useAlphaBlending,this.opacityRGB=e.opacityRGB,this.useRadianceOverAlpha=e.useRadianceOverAlpha,this.useSpecularOverAlpha=e.useSpecularOverAlpha,this.enableSpecularAntiAliasing=e.enableSpecularAntiAliasing,this.realTimeFiltering=!!e.realTimeFiltering,this.realTimeFilteringQuality=null!==(r=e.realTimeFilteringQuality)&&void 0!==r?r:Ae.a.TEXTURE_FILTERING_QUALITY_LOW,this.useEnergyConservation=e.useEnergyConservation,this.useRadianceOcclusion=e.useRadianceOcclusion,this.useHorizonOcclusion=e.useHorizonOcclusion,this.unlit=e.unlit,this.forceNormalForward=!!e.forceNormalForward,this.debugMode=e.debugMode,this.debugLimit=e.debugLimit,this.debugFactor=e.debugFactor},Object(T.c)([xe("Direct lights",ve.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}}
1)],Nr.prototype,"directIntensity",void 0),Object(T.c)([xe("Environment lights",ve.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],Nr.prototype,"environmentIntensity",void 0),Object(T.c)([xe("Specular highlights",ve.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],Nr.prototype,"specularIntensity",void 0),Object(T.c)([xe("Light falloff",ve.List,"LIGHTING & COLORS",{notifiers:{update:!0},options:[{label:"Physical",value:ir.a.LIGHTFALLOFF_PHYSICAL},{label:"GLTF",value:ir.a.LIGHTFALLOFF_GLTF},{label:"Standard",value:ir.a.LIGHTFALLOFF_STANDARD}]})],Nr.prototype,"lightFalloff",void 0),Object(T.c)([xe("Alpha from albedo",ve.Boolean,"TRANSPARENCY",{notifiers:{update:!0}})],Nr.prototype,"useAlphaFromAlbedoTexture",void 0),Object(T.c)([xe("Alpha Testing",ve.Boolean,"TRANSPARENCY")],Nr.prototype,"useAlphaTest",void 0),Object(T.c)([xe("Alpha CutOff",ve.Float,"TRANSPARENCY",{min:0,max:1,notifiers:{update:!0}})],Nr.prototype,"alphaTestCutoff",void 0),Object(T.c)([xe("Alpha blending",ve.Boolean,"TRANSPARENCY")],Nr.prototype,"useAlphaBlending",void 0),Object(T.c)([xe("Get alpha from opacity texture RGB",ve.Boolean,"TRANSPARENCY",{notifiers:{update:!0}})],Nr.prototype,"opacityRGB",void 0),Object(T.c)([xe("Radiance over alpha",ve.Boolean,"RENDERING",{notifiers:{update:!0}})],Nr.prototype,"useRadianceOverAlpha",void 0),Object(T.c)([xe("Specular over alpha",ve.Boolean,"RENDERING",{notifiers:{update:!0}})],Nr.prototype,"useSpecularOverAlpha",void 0),Object(T.c)([xe("Specular anti-aliasing",ve.Boolean,"RENDERING",{notifiers:{update:!0}})],Nr.prototype,"enableSpecularAntiAliasing",void 0),Object(T.c)([xe("Realtime filtering",ve.Boolean,"RENDERING",{notifiers:{update:!0}})],Nr.prototype,"realTimeFiltering",void 0),Object(T.c)([xe("Realtime filtering quality",ve.List,"RENDERING",{notifiers:{update:!0},options:[{label:"Low",value:Ae.a.TEXTURE_FILTERING_QUALITY_LOW},{label:"Medium",value:Ae.a.TEXTURE_FILTERING_QUALITY_MEDIUM},{label:"High",value:Ae.a.TEXTURE_FILTERING_QUALITY_HIGH}]})],Nr.prototype,"realTimeFilteringQuality",void 0),Object(T.c)([xe("Energy Conservation",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Nr.prototype,"useEnergyConservation",void 0),Object(T.c)([xe("Radiance occlusion",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Nr.prototype,"useRadianceOcclusion",void 0),Object(T.c)([xe("Horizon occlusion",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Nr.prototype,"useHorizonOcclusion",void 0),Object(T.c)([xe("Unlit",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Nr.prototype,"unlit",void 0),Object(T.c)([xe("Force normal forward",ve.Boolean,"ADVANCED",{notifiers:{update:!0}})],Nr.prototype,"forceNormalForward",void 0),Object(T.c)([xe("Debug mode",ve.List,"DEBUG",{notifiers:{update:!0},options:[{label:"None",value:0},{label:"Normalized position",value:1},{label:"Normals",value:2},{label:"Tangents",value:3},{label:"Bitangents",value:4},{label:"Bump Normals",value:5},{label:"ClearCoat Normals",value:8},{label:"ClearCoat Tangents",value:9},{label:"ClearCoat Bitangents",value:10},{label:"Anisotropic Normals",value:11},{label:"Anisotropic Tangents",value:12},{label:"Anisotropic Bitangents",value:13},{label:"Albedo Map",value:20},{label:"Ambient Map",value:21},{label:"Opacity Map",value:22},{label:"Metallic Map",value:25},{label:"Reflectivity Map",value:26},{label:"ClearCoat Map",value:27},{label:"ClearCoat Tint Map",value:28},{label:"Sheen Map",value:29},{label:"Anisotropic Map",value:30},{label:"Thickness Map",value:31},{label:"Env Refraction",value:40},{label:"Env Reflection",value:41},{label:"Env Clear Coat",value:42},{label:"Direct Diffuse",value:50},{label:"Direct Specular",value:51},{label:"Direct Clear Coat",value:52},{label:"Direct Sheen",value:53},{label:"Env Irradiance",value:54},{label:"Surface Albedo",value:60},{label:"Reflectance 0",value:61},{label:"Metallic",value:62},{label:"Metallic F0",value:71},{label:"Roughness",value:63},{label:"AlphaG",value:64},{label:"NdotV",value:65},{label:"ClearCoat Color",value:66},{label:"ClearCoat Roughness",value:67},{label:"ClearCoat NdotV",value:68},{label:"Transmittance",value:69},{label:"Refraction Transmittance",value:70},{label:"SEO",value:80},{label:"EHO",value:81},{label:"Energy Factor",value:82},{label:"Specular Reflectance",value:83},{label:"Clear Coat Reflectance",value:84},{label:"Sheen Reflectance",value:85},{label:"Luminance Over Alpha",value:86},{label:"Alpha",value:87}]})],Nr.prototype,"debugMode",void 0),Object(T.c)([xe("Split position",ve.Float,"DEBUG",{min:-1,max:1,notifiers:{update:!0}})],Nr.prototype,"debugLimit",void 0),Object(T.c)([xe("Output factor",ve.Float,"DEBUG",{min:0,max:5,notifiers:{update:!0}})],Nr.prototype,"debugFactor",void 0),Nr);function Nr(e){var t=Ir.call(this,e,me.VertexAndFragment)||this;return t._environmentBRDFTexture=null,t.directIntensity=1,t.environmentIntensity=1,t.specularIntensity=1,t.lightFalloff=0,t.useAlphaFromAlbedoTexture=!1,t.useAlphaTest=!1,t.alphaTestCutoff=.5,t.useAlphaBlending=!1,t.opacityRGB=!1,t.useRadianceOverAlpha=!0,t.useSpecularOverAlpha=!0,t.enableSpecularAntiAliasing=!1,t.realTimeFiltering=!1,t.realTimeFilteringQuality=Ae.a.TEXTURE_FILTERING_QUALITY_LOW,t.useEnergyConservation=!0,t.useRadianceOcclusion=!0,t.useHorizonOcclusion=!0,t.unlit=!1,t.forceNormalForward=!1,t.debugMode=0,t.debugLimit=0,t.debugFactor=1,t._isUnique=!0,t.registerInput("worldPosition",c.Vector4,!1,me.Vertex),t.registerInput("worldNormal",c.Vector4,!1,me.Fragment),t.registerInput("perturbedNormal",c.Vector4,!0,me.Fragment),t.registerInput("cameraPosition",c.Vector3,!1,me.Fragment),t.registerInput("baseColor",c.Color4,!0,me.Fragment),t.registerInput("opacityTexture",c.Color4,!0,me.Fragment),t.registerInput("ambientColor",c.Color3,!0,me.Fragment),t.registerInput("reflectivity",c.Object,!1,me.Fragment,new nr("reflectivity",t,d.Input,hr,"ReflectivityBlock")),t.registerInput("ambientOcclusion",c.Object,!0,me.Fragment,new nr("ambientOcclusion",t,d.Input,rr,"AOBlock")),t.registerInput("reflection",c.Object,!0,me.Fragment,new nr("reflection",t,d.Input,yr,"ReflectionBlock")),t.registerInput("sheen",c.Object,!0,me.Fragment,new nr("sheen",t,d.Input,cr,"SheenBlock")),t.registerInput("clearcoat",c.Object,!0,me.Fragment,new nr("clearcoat",t,d.Input,Sr,"ClearCoatBlock")),t.registerInput("subsurface",c.Object,!0,me.Fragment,new nr("subsurface",t,d.Input,Or,"SubSurfaceBlock")),t.registerInput("anisotropy",c.Object,!0,me.Fragment,new nr("anisotropy",t,d.Input,_r,"AnisotropyBlock")),t.registerOutput("ambient",c.Color3,me.Fragment),t.registerOutput("diffuse",c.Color3,me.Fragment),t.registerOutput("specular",c.Color3,me.Fragment),t.registerOutput("sheenDir",c.Color3,me.Fragment),t.registerOutput("clearcoatDir",c.Color3,me.Fragment),t.registerOutput("diffuseInd",c.
1Color3,me.Fragment),t.registerOutput("specularInd",c.Color3,me.Fragment),t.registerOutput("sheenInd",c.Color3,me.Fragment),t.registerOutput("clearcoatInd",c.Color3,me.Fragment),t.registerOutput("refraction",c.Color3,me.Fragment),t.registerOutput("lighting",c.Color3,me.Fragment),t.registerOutput("shadow",c.Float,me.Fragment),t.registerOutput("alpha",c.Float,me.Fragment),t}y.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessBlock"]=Lr;var Fr,wr=(Fr=b,Object(T.d)(Br,Fr),Br.prototype.getClassName=function(){return"ModBlock"},Object.defineProperty(Br.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Br.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Br.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Br.prototype._buildBlock=function(e){Fr.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = mod("+this.left.associatedVariableName+", "+this.right.associatedVariableName+");\r\n",this},Br);function Br(e){var t=Fr.call(this,e,me.Neutral)||this;return t.registerInput("left",c.AutoDetect),t.registerInput("right",c.AutoDetect),t.registerOutput("output",c.BasedOnInput),t._outputs[0]._typeConnectionSource=t._inputs[0],t._linkConnectionTypes(0,1),t}y.a.RegisteredTypes["BABYLON.ModBlock"]=wr;var Ur=(Vr.prototype.optimize=function(e,t){},Vr);function Vr(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return n.a}),i.d(t,"b",function(){return a}),i.d(t,"c",function(){return C}),i.d(t,"d",function(){return E}),i.d(t,"e",function(){return v.a}),i.d(t,"f",function(){return O}),i.d(t,"g",function(){return L}),i.d(t,"h",function(){return w}),i.d(t,"i",function(){return k}),i.d(t,"k",function(){return G}),i.d(t,"m",function(){return W}),i.d(t,"l",function(){return Z}),i.d(t,"o",function(){return Y}),i.d(t,"n",function(){return K}),i.d(t,"p",function(){return ee}),i.d(t,"q",function(){return g}),i.d(t,"r",function(){return ne}),i.d(t,"s",function(){return re.a}),i.d(t,"t",function(){return se}),i.d(t,"u",function(){return ue}),i.d(t,"v",function(){return he.a}),i.d(t,"x",function(){return _e}),i.d(t,"z",function(){return ge.b}),i.d(t,"y",function(){return ge.a}),i.d(t,"A",function(){return l.a}),i.d(t,"B",function(){return ve.a}),i.d(t,"G",function(){return Te}),i.d(t,"j",function(){return Ue}),i.d(t,"w",function(){return je}),i.d(t,"H",function(){return Xe}),i.d(t,"I",function(){return Qe}),i.d(t,"M",function(){return nt}),i.d(t,"C",function(){return u}),i.d(t,"D",function(){return xe}),i.d(t,"E",function(){return Ie}),i.d(t,"F",function(){return Be}),i.d(t,"L",function(){return Pe}),i.d(t,"O",function(){return lt}),i.d(t,"N",function(){return ut}),i.d(t,"Q",function(){return st}),i.d(t,"P",function(){return ft}),i.d(t,"T",function(){return xt}),i.d(t,"R",function(){return Rt.a}),i.d(t,"S",function(){return Ot.a}),i.d(t,"K",function(){return $e}),i.d(t,"J",function(){return Dt});var n=i(298),r=i(1),l=i(23),o=i(5);o.a.ShadersStore.blackAndWhitePixelShader="\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}";var s,a=(s=l.a,Object(r.d)(m,s),m),c=i(13),u=(Object.defineProperty(p.prototype,"isSupported",{get:function(){for(var e in this._postProcesses)if(this._postProcesses.hasOwnProperty(e))for(var t=this._postProcesses[e],i=0;i<t.length;i++)if(!t[i].isSupported)return!1;return!0},enumerable:!1,configurable:!0}),p.prototype._update=function(){},p.prototype._attachCameras=function(e){var i=this,t=c.b.MakeArray(e||this._cameras);if(t)for(var n=0;n<t.length;n++){var r,o,a,s=t[n];s&&(r=s.name,a=this._singleInstance?0:r,this._postProcesses[a]||(o=this._getPostProcesses())&&(this._postProcesses[a]=Array.isArray(o)?o:[o]),this._indicesForCamera[r]||(this._indicesForCamera[r]=[]),this._postProcesses[a].forEac
1h(function(e){var t=s.attachPostProcess(e);i._indicesForCamera[r].push(t)}),this._cameras[r]||(this._cameras[r]=s))}},p.prototype._detachCameras=function(e){var t=c.b.MakeArray(e||this._cameras);if(t)for(var i=0;i<t.length;i++){var n=t[i],r=n.name,o=this._postProcesses[this._singleInstance?0:r];o&&o.forEach(function(e){n.detachPostProcess(e)}),this._cameras[r]&&(this._cameras[r]=null)}},p.prototype._enable=function(e){var t=this,i=c.b.MakeArray(e||this._cameras);if(i)for(var n=0;n<i.length;n++)for(var r=i[n],o=r.name,a=0;a<this._indicesForCamera[o].length;a++)void 0!==r._postProcesses[this._indicesForCamera[o][a]]&&null!==r._postProcesses[this._indicesForCamera[o][a]]||this._postProcesses[this._singleInstance?0:o].forEach(function(e){i[n].attachPostProcess(e,t._indicesForCamera[o][a])})},p.prototype._disable=function(e){var t=c.b.MakeArray(e||this._cameras);if(t)for(var i=0;i<t.length;i++){var n=t[i],r=n.name;this._postProcesses[this._singleInstance?0:r].forEach(function(e){n.detachPostProcess(e)})}},p.prototype.getPostProcesses=function(e){return this._singleInstance?this._postProcesses[0]:e?this._postProcesses[e.name]:null},p),h=i(32),f=i(2),d=(i(74),"#include<helperFunctions>\n\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float threshold;\nuniform float exposure;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nfloat luma=getLuminance(gl_FragColor.rgb*exposure);\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\n}");function p(e,t,i,n){this._name=t,this._singleInstance=n||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}function m(e,t,i,n,r,o){var a=s.call(this,e,"blackAndWhite",["degree"],null,t,i,n,r,o)||this;return a.degree=1,a.onApplyObservable.add(function(e){e.setFloat("degree",a.degree)}),a}o.a.ShadersStore.extractHighlightsPixelShader=d;var _,g=(_=l.a,Object(r.d)(b,_),b),v=i(61);function b(e,t,i,n,r,o,a,s){void 0===a&&(a=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1);var c=_.call(this,e,"extractHighlights",["threshold","exposure"],null,t,i,n,r,o,null,a,void 0,null,s)||this;return c.threshold=.9,c._exposure=1,c._inputPostProcess=null,c.onApplyObservable.add(function(e){c._inputPostProcess&&e.setTextureFromPostProcess("textureSampler",c._inputPostProcess),e.setFloat("threshold",Math.pow(c.threshold,h.b)),e.setFloat("exposure",c._exposure)}),c}o.a.ShadersStore.bloomMergePixelShader="uniform sampler2D textureSampler;\nuniform sampler2D bloomBlur;\nvarying vec2 vUV;\nuniform float bloomWeight;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight);\n}\n";var y,T,E=(T=l.a,Object(r.d)(x,T),x),S=i(0),A=i(9),C=(y=u,Object(r.d)(P,y),Object.defineProperty(P.prototype,"threshold",{get:function(){return this._downscale.threshold},set:function(e){this._downscale.threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"weight",{get:function(){return this._merge.weight},set:function(e){this._merge.weight=e},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"kernel",{get:function(){return this._blurX.kernel/this.bloomScale},set:function(e){this._blurX.kernel=e*this.bloomScale,this._blurY.kernel=e*this.bloomScale},enumerable:!1,configurable:!0}),P.prototype.disposeEffects=function(e){for(var t=0;t<this._effects.length;t++)this._effects[t].dispose(e)},P.prototype._updateEffects=function(){for(var e=0;e<this._effects.length;e++)this._effects[e].updateEffect()},P.prototype._isReady=function(){for(var e=0;e<this._effects.length;e++)if(!this._effects[e].isReady())return!1;return!0},P);function P(e,t,i,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var a=y.call(this,e.getEngine(),"bloom",function(){return a._effects},!0)||this;return a.bloomScale=t,a._effects=[],a._downscale=new g("highlights",1,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,o),a._blurX=new v.a("horizontal blur",new S.d(1,0),10,t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,void 0,o),a._blurX.alwaysForcePOT=!0,a._blurX.autoClear=!1,a._blurY=new v.a("vertical blur",new S.d(0,1),10,t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,void 0,o),a._blurY.alwaysForcePOT=!0,a._blurY.autoClear=!1,a.kernel=n,a._effects=[a._downscale,a._blurX,a._blurY],a._merge=new E("bloomMerge",a._downscale,a._blurY,i,t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,o),a._merge.autoClear=!1,a._effects.push(a._merge),a}function x(e,t,i,n,r,o,a,s,c,l,u){void 0===l&&(l=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=!1);var h=T.call(this,e,"bloomMerge",["bloomWeight"],["circleOfConfusionSampler","blurStep0","blurStep1","blurStep2","bloomBlur"],r,o,a,s,c,null,l,void 0,null,!0)||this;return h.weight=n,h.onApplyObservable.add(function(e){e.setTextureFromPostProcess("textureSampler",t),e.setTextureFromPostProcessOutput("bloomBlur",i),e.setFloat("bloomWeight",h.weight)}),u||h.updateEffect(),h}o.a.ShadersStore.chromaticAberrationPixelShader="\nuniform sampler2D textureSampler;\n\nuniform float chromatic_aberration;\nuniform float radialIntensity;\nuniform vec2 direction;\nuniform vec2 centerPosition;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\nvec2 directionOfEffect=direction;\nif(directionOfEffect.x == 0. && directionOfEffect.y == 0.){\ndirectionOfEffect=normalize(centered_screen_pos);\n}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\n\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\n\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\ngl_FragColor=original;\n}";var R,O=(R=l.a,Object(r.d)(I,R),I),M=i(7);function I(e,t,i,n,r,o,a,s,c,l){void 0===c&&(c=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=!1);var u=R.call(this,e,"chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],n,r,o,a,s,null,c,void 0,null,l)||this;return u.aberrationAmount=30,u.radialIntensity=0,u.direction=new S.d(.707,.707),u.centerPosition=new S.d(.5,.5),u.onApplyObservable.add(function(e){e.setFloat("chromatic_aberration",u.aberrationAmount),e.setFloat("screen_width",t),e.setFloat("screen_height",i),e.setFloat("radialIntensity",u.radialIntensity),e.setFloat2("direction",u.direction.x,u.direction.y),e.setFloat2("centerPosition",u.centerPosition.x,u.centerPosition.y)}),u}o.a.ShadersStore.circleOfConfusionPixelShader="\nuniform sampler2D depthSampler;\n\nvarying vec2 vUV;\n\nuniform vec2 cameraMinMaxZ;\n\nuniform float focusDistance;\nuniform float cocPrecalculation;\nvoid main(void)\n{\nfloat depth=texture2D(depthSampler,vUV).r;\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0;
1\nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\ncoc=clamp(coc,0.0,1.0);\ngl_FragColor=vec4(coc,depth,coc,1.0);\n}\n";var D,L=(D=l.a,Object(r.d)(N,D),Object.defineProperty(N.prototype,"depthTexture",{set:function(e){this._depthTexture=e},enumerable:!1,configurable:!0}),N);function N(e,t,i,n,r,o,a,s,c){void 0===s&&(s=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=D.call(this,e,"circleOfConfusion",["cameraMinMaxZ","focusDistance","cocPrecalculation"],["depthSampler"],i,n,r,o,a,null,s,void 0,null,c)||this;return l.lensSize=50,l.fStop=1.4,l.focusDistance=2e3,l.focalLength=50,l._depthTexture=null,l._depthTexture=t,l.onApplyObservable.add(function(e){var t;l._depthTexture?(e.setTexture("depthSampler",l._depthTexture),t=l.lensSize/l.fStop*l.focalLength/(l.focusDistance-l.focalLength),e.setFloat("focusDistance",l.focusDistance),e.setFloat("cocPrecalculation",t),e.setFloat2("cameraMinMaxZ",l._depthTexture.activeCamera.minZ,l._depthTexture.activeCamera.maxZ)):M.a.Warn("No depth texture set on CircleOfConfusionPostProcess")}),l}o.a.ShadersStore.colorCorrectionPixelShader="\nuniform sampler2D textureSampler;\nuniform sampler2D colorTable;\n\nvarying vec2 vUV;\n\nconst float SLICE_COUNT=16.0;\n\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\nfloat sliceSize=1.0/width;\nfloat slicePixelSize=sliceSize/width;\nfloat sliceInnerSize=slicePixelSize*(width-1.0);\nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}";var F,w=(F=l.a,Object(r.d)(B,F),B);function B(e,t,i,n,r,o,a){var s=F.call(this,e,"colorCorrection",null,["colorTable"],i,n,r,o,a)||this;return s._colorTableTexture=new A.a(t,n.getScene(),!0,!1,A.a.TRILINEAR_SAMPLINGMODE),s._colorTableTexture.anisotropicFilteringLevel=1,s._colorTableTexture.wrapU=A.a.CLAMP_ADDRESSMODE,s._colorTableTexture.wrapV=A.a.CLAMP_ADDRESSMODE,s.onApply=function(e){e.setTexture("colorTable",s._colorTableTexture)},s}o.a.ShadersStore.convolutionPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}";var U,V,k=(V=l.a,Object(r.d)(j,V),j.EdgeDetect0Kernel=[1,0,-1,0,0,0,-1,0,1],j.EdgeDetect1Kernel=[0,1,0,1,-4,1,0,1,0],j.EdgeDetect2Kernel=[-1,-1,-1,-1,8,-1,-1,-1,-1],j.SharpenKernel=[0,-1,0,-1,5,-1,0,-1,0],j.EmbossKernel=[-2,-1,0,-1,1,1,0,1,2],j.GaussianKernel=[0,1,0,1,1,1,0,1,0],j),G=(U=v.a,Object(r.d)(z,U),z);function z(e,t,i,n,r,o,a,s,c,l,u,h,d){void 0===s&&(s=null),void 0===c&&(c=A.a.BILINEAR_SAMPLINGMODE),void 0===h&&(h=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===d&&(d=!1);var p=U.call(this,e,i,n,r,o,c=f.a.TEXTURE_BILINEAR_SAMPLINGMODE,l,u,h=f.a.TEXTURETYPE_UNSIGNED_INT,"#define DOF 1\r\n",d)||this;return p.direction=i,p.onApplyObservable.add(function(e){null!=s&&e.setTextureFromPostProcess("textureSampler",s),e.setTextureFromPostProcessOutput("circleOfConfusionSampler",a),t.activeCamera&&e.setFloat2("cameraMinMaxZ",t.activeCamera.minZ,t.activeCamera.maxZ)}),p}function j(e,t,i,n,r,o,a,s){void 0===s&&(s=f.a.TEXTURETYPE_UNSIGNED_INT);var c=V.call(this,e,"convolution",["kernel","screenSize"],null,i,n,r,o,a,null,s)||this;return c.kernel=t,c.onApply=function(e){e.setFloat2("screenSize",c.width,c.height),e.setArray("kernel",c.kernel)},c}o.a.ShadersStore.depthOfFieldMergePixelShader="uniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform sampler2D circleOfConfusionSampler;\nuniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;
1\n#endif\nvoid main(void)\n{\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\n#if BLUR_LEVEL == 0\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred0=texture2D(blurStep0,vUV);\ngl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL == 1\nif(coc<0.5){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(original,blurred1,coc/0.5);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\n}\n#endif\n#if BLUR_LEVEL == 2\nif(coc<0.33){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(original,blurred2,coc/0.33);\n}else if(coc<0.66){\nvec4 blurred1=texture2D(blurStep1,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\n}\n#endif\n}\n";var W,H,X,Y=function(){},K=(H=l.a,Object(r.d)(Q,H),Q.prototype.updateEffect=function(e,t,i,n,r,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),e||(e="",e+="#define BLUR_LEVEL "+(this.blurSteps.length-1)+"\n"),H.prototype.updateEffect.call(this,e,t,i,n,r,o)},Q);function Q(e,t,n,r,i,o,a,s,c,l,u){void 0===l&&(l=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=!1);var h=H.call(this,e,"depthOfFieldMerge",[],["circleOfConfusionSampler","blurStep0","blurStep1","blurStep2"],i,o,a,s,c,null,l,void 0,null,!0)||this;return h.blurSteps=r,h.onApplyObservable.add(function(i){i.setTextureFromPostProcess("textureSampler",t),i.setTextureFromPostProcessOutput("circleOfConfusionSampler",n
1),r.forEach(function(e,t){i.setTextureFromPostProcessOutput("blurStep"+(r.length-t-1),e)})}),u||h.updateEffect(),h}(X=W=W||{})[X.Low=0]="Low",X[X.Medium=1]="Medium",X[X.High=2]="High";var q,Z=(q=u,Object(r.d)(J,q),Object.defineProperty(J.prototype,"focalLength",{get:function(){return this._circleOfConfusion.focalLength},set:function(e){this._circleOfConfusion.focalLength=e},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"fStop",{get:function(){return this._circleOfConfusion.fStop},set:function(e){this._circleOfConfusion.fStop=e},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"focusDistance",{get:function(){return this._circleOfConfusion.focusDistance},set:function(e){this._circleOfConfusion.focusDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"lensSize",{get:function(){return this._circleOfConfusion.lensSize},set:function(e){this._circleOfConfusion.lensSize=e},enumerable:!1,configurable:!0}),J.prototype.getClassName=function(){return"DepthOfFieldEffect"},Object.defineProperty(J.prototype,"depthTexture",{set:function(e){this._circleOfConfusion.depthTexture=e},enumerable:!1,configurable:!0}),J.prototype.disposeEffects=function(e){for(var t=0;t<this._effects.length;t++)this._effects[t].dispose(e)},J.prototype._updateEffects=function(){for(var e=0;e<this._effects.length;e++)this._effects[e].updateEffect()},J.prototype._isReady=function(){for(var e=0;e<this._effects.length;e++)if(!this._effects[e].isReady())return!1;return!0},J);function J(e,t,i,n,r){void 0===i&&(i=W.Low),void 0===n&&(n=0),void 0===r&&(r=!1);var o=q.call(this,e.getEngine(),"depth of field",function(){return o._effects},!0)||this;o._effects=[],o._circleOfConfusion=new L("circleOfConfusion",t,1,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,r),o._depthOfFieldBlurY=[],o._depthOfFieldBlurX=[];var a=1,s=15;switch(i){case W.High:a=3,s=51;break;case W.Medium:a=2,s=31;break;default:s=15,a=1}for(var c=s/Math.pow(2,a-1),l=1,u=0;u<a;u++){var h=new G("verticle blur",e,new S.d(0,1),c,l,null,o._circleOfConfusion,0==u?o._circleOfConfusion:null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,r);h.autoClear=!1,l=.75/Math.pow(2,u);var d=new G("horizontal blur",e,new S.d(1,0),c,l,null,o._circleOfConfusion,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,r);d.autoClear=!1,o._depthOfFieldBlurY.push(h),o._depthOfFieldBlurX.push(d)}for(o._effects=[o._circleOfConfusion],u=0;u<o._depthOfFieldBlurX.length;u++)o._effects.push(o._depthOfFieldBlurY[u]),o._effects.push(o._depthOfFieldBlurX[u]);return o._dofMerge=new K("dofMerge",o._circleOfConfusion,o._circleOfConfusion,o._depthOfFieldBlurX,l,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,r),o._dofMerge.autoClear=!1,o._effects.push(o._dofMerge),o}o.a.ShadersStore.displayPassPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}";var $,ee=($=l.a,Object(r.d)(te,$),te);function te(e,t,i,n,r,o){return $.call(this,e,"displayPass",["passSampler"],["passSampler"],t,i,n,r,o)||this}o.a.ShadersStore.filterPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}";var ie,ne=(ie=l.a,Object(r.d)(oe,ie),oe),re=i(151);function oe(e,t,i,n,r,o,a){var s=ie.call(this,e,"filter",["kernelMatrix"],null,i,n,r,o,a)||this;return s.kernelMatrix=t,s.onApply=function(e){e.setMatrix("kernelMatrix",s.kernelMatrix)},s}o.a.ShadersStore.grainPixelShader="#include<helperFunctions>\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}";var ae,se=(ae=l.a,Object(r.d)(ce,ae),ce);function ce(e,t,i,n,r,o,a,s){void 0===a&&(a=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1);var c=ae.call(this,e,"grain",["intensity","animatedSeed"],[],t,i,n,r,o,null,a,void 0,null,s)||this;return c.intensity=30,c.animated=!1,c.onApplyObservable.add(function(e){e.setFloat("intensity",c.intensity),e.setFloat("animatedSeed",c.animated?Math.random()+1:1)}),c}o.a.ShadersStore.highlightsPixelShader="\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);
1\n\n\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a);\n}";var le,ue=(le=l.a,Object(r.d)(fe,le),fe),he=i(147),de=i(127),pe=(i(198),i(231),"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D velocitySampler;\nuniform float motionStrength;\nuniform float motionScale;\nuniform vec2 screenSize;\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\nvec2 texelSize=1.0/screenSize;\nvec2 velocityColor=texture2D(velocitySampler,vUV).rg*2.0-1.0;\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0));\nvelocity*=motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\nvelocity=normalize(velocity)*texelSize;\nfloat hlim=float(-samplesCount)*0.5+0.5;\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i<int(SAMPLES); ++i)\n{\nif (i>=samplesCount)\nbreak;\nvec2 offset=vUV+velocity*(hlim+float(i));\nresult+=texture2D(textureSampler,offset);\n}\ngl_FragColor=result/float(samplesCount);\ngl_FragColor.a=1.0;\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n");function fe(e,t,i,n,r,o,a){return void 0===a&&(a=f.a.TEXTURETYPE_UNSIGNED_INT),le.call(this,e,"highlights",null,null,t,i,n,r,o,null,a)||this}o.a.ShadersStore.motionBlurPixelShader=pe;var me,_e=(me=l.a,Object(r.d)(be,me),Object.defineProperty(be.prototype,"motionBlurSamples",{get:function(){return this._motionBlurSamples},set:function(e){this._motionBlurSamples=e,this._geometryBufferRenderer&&this.updateEffect("#define GEOMETRY_SUPPORTED\n#define SAMPLES "+e.toFixed(1))},enumerable:!1,configurable:!0}),be.prototype.excludeSkinnedMesh=function(e){this._geometryBufferRenderer&&e.skeleton&&this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.push(e)},be.prototype.removeExcludedSkinnedMesh=function(e){var t;this._geometryBufferRenderer&&e.skeleton&&-1!==(t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.indexOf(e))&&this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.splice(t,1)},be.prototype.dispose=function(e){this._geometryBufferRenderer&&(this._geometryBufferRenderer._previousTransformationMatrices={},this._geometryBufferRenderer._previousBonesTransformationMatrices={},this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity=[]),me.prototype.dispose.call(this,e)},be),ge=i(105),ve=i(133);function be(e,i,t,n,r,o,a,s,c){void 0===s&&(s=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=me.call(this,e,"motionBlur",["motionStrength","motionScale","screenSize"],["velocitySampler"],t,n,r,o,a,"#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0",s,void 0,null,c)||this;return l.motionStrength=1,l._motionBlurSamples=32,l._geometryBufferRenderer=i.enableGeometryBufferRenderer(),l._geometryBufferRenderer?(l._geometryBufferRenderer.enableVelocity=!0,l.onApply=function(e){var t;e.setVector2("screenSize",new S.d(l.width,l.height)),e.setFloat("motionScale",i.getAnimationRatio()),e.setFloat("motionStrength",l.motionStrength),l._geometryBufferRenderer&&(t=l._geometryBufferRenderer.getTextureIndex(de.a.VELOCITY_TEXTURE_TYPE),e.setTexture("velocitySampler",l._geometryBufferRenderer.getGBuffer().textures[t]))}):(M.a.Warn("Multiple Render Target support needed to compute object based motion blur"),l.updateEffect()),l}o.a.ShadersStore.refractionPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\n\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}";var ye,Te=(ye=l.a,Object(r.d)(Ae,ye),Object.defineProperty(Ae.prototype,"refractionTexture",{get:function(){return this._refTexture},set:function(e){this._refTexture&&this._ownRefractionTexture&&this._refTexture.dispose(),this._refTexture=e,this._ownRefractionTexture=!1},enumerable:!1,configurable:!0}),Ae.prototype.dispose=function(e){this._refTexture&&this._ownRefractionTexture&&(this._refTexture.dispose(),this._refTexture=null),ye.prototype.dispose.call(this,e)},Ae),Ee=i(3),Se=i(280);function Ae(e,t,i,n,r,o,a,s,c,l){var u=ye.call(this,e,"refraction",["baseColor","depth","colorLevel"],["refractionSampler"],o,a,s,c,l)||this;return u.color=i,u.depth=n,u.colorLevel=r,u._ownRefractionTexture=!0,u.onActivateObservable.add(function(e){u._refTexture=u._refTexture||new A.a(t,e.getSce
1ne())}),u.onApplyObservable.add(function(e){e.setColor3("baseColor",u.color),e.setFloat("depth",u.depth),e.setFloat("colorLevel",u.colorLevel),e.setTexture("refractionSampler",u._refTexture)}),u}o.a.ShadersStore.sharpenPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 sharpnessAmounts;\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 color=texture2D(textureSampler,vUV);\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\n}";var Ce,Pe=(Ce=l.a,Object(r.d)(Fe,Ce),Fe),xe=(Object.defineProperty(Ne.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(Ne.prototype,"cameras",{get:function(){return this._cameras},enumerable:!1,configurable:!0}),Ne.prototype.getClassName=function(){return"PostProcessRenderPipeline"},Object.defineProperty(Ne.prototype,"isSupported",{get:function(){for(var e in this._renderEffects)if(this._renderEffects.hasOwnProperty(e)&&!this._renderEffects[e].isSupported)return!1;return!0},enumerable:!1,configurable:!0}),Ne.prototype.addEffect=function(e){this._renderEffects[e._name]=e},Ne.prototype._rebuild=function(){},Ne.prototype._enableEffect=function(e,t){var i=this._renderEffects[e];i&&i._enable(c.b.MakeArray(t||this._cameras))},Ne.prototype._disableEffect=function(e,t){var i=this._renderEffects[e];i&&i._disable(c.b.MakeArray(t||this._cameras))},Ne.prototype._attachCameras=function(e,t){var i=c.b.MakeArray(e||this._cameras);if(i){for(var n=[],r=0;r<i.length;r++){var o,a=i[r];a&&(o=a.name,-1===this._cameras.indexOf(a)?this._cameras[o]=a:t&&n.push(r))}for(r=0;r<n.length;r++)e.splice(n[r],1);for(var s in this._renderEffects)this._renderEffects.hasOwnProperty(s)&&this._renderEffects[s]._attachCameras(i)}},Ne.prototype._detachCameras=function(e){var t=c.b.MakeArray(e||this._cameras);if(t){for(var i in this._renderEffects)this._renderEffects.hasOwnProperty(i)&&this._renderEffects[i]._detachCameras(t);for(var n=0;n<t.length;n++)this._cameras.splice(this._cameras.indexOf(t[n]),1)}},Ne.prototype._update=function(){for(var e in this._renderEffects)this._renderEffects.hasOwnProperty(e)&&this._renderEffects[e]._update();for(var t,i=0;i<this._cameras.length;i++)this._cameras[i]&&(t=this._cameras[i].name,this._renderEffectsForIsolatedPass[t]&&this._renderEffectsForIsolatedPass[t]._update())},Ne.prototype._reset=function(){this._renderEffects={},this._renderEffectsForIsolatedPass=new Array},Ne.prototype._enableMSAAOnFirstPostProcess=function(e){if(1===this.engine.webGLVersion)return!1;var t,i=Object.keys(this._renderEffects);return 0<i.length&&(t=this._renderEffects[i[0]].getPostProcesses())&&(t[0].samples=e),!0},Ne.prototype.setPrePassRenderer=function(e){return!1},Ne.prototype.dispose=function(){},Object(r.c)([Object(Ee.c)()],Ne.prototype,"_name",void 0),Ne),Re=i(11),Oe=i(22),Me=i(17),Ie=(Object.defineProperty(Le.prototype,"supportedPipelines",{get:function(){var e,t=[];for(var i in this._renderPipelines)!this._renderPipelines.hasOwnProperty(i)||(e=this._renderPipelines[i]).isSupported&&t.push(e);return t},enumerable:!1,configurable:!0}),Le.prototype.addPipeline=function(e){this._renderPipelines[e._name]=e},Le.prototype.attachCamerasToRenderPipeline=function(e,t,i){void 0===i&&(i=!1);var n=this._renderPipelines[e];n&&n._attachCameras(t,i)},Le.prototype.detachCamerasFromRenderPipeline=function(e,t){var i=this._renderPipelines[e];i&&i._detachCameras(t)},Le.prototype.enableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._enableEffect(t,i)},Le.prototype.disableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._disableEffect(t,i)},Le.prototype.update=function(){for(var e in this._renderPipelines){var t;this._renderPipelines.hasOwnProperty(e)&&((t=this._renderPipelines[e]).isSupported?t._update():(t.dispose(),delete this._renderPipelines[e]))}},Le.prototype._rebuild=function(){for(var e in this._renderPipelines)this._renderPipelines.hasOwnProperty(e)&&this._renderPipelines[e]._rebuild()},Le.prototype.dispose=function(){for(var e in this._renderPipelines)this._renderPipelines.hasOwnProperty(e)&&this._renderPipelines[e].dispose()},Le),De=i(18);function Le(){this._renderPipelines={}}function Ne(e,t){this.engine=e,this._name=t,this._renderEffects={},this._renderEffectsForIsolatedPass=new Array,this._cameras=[]}function Fe(e,t,i,n,r,o,a,s){void 0===a&&(a=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1);var c=Ce.call(this,e,"sharpen",["sharpnessAmounts","screenSize"],null,t,i,n,r,o,null,a,void 0,null,s)||this;return c.colorAmount=1,c.edgeAmount=.3,c.onApply=function(e){e.setFloat2("screenSize",c.width,c.height),e.setFloat2("sharpnessAmounts",c.edgeAmount,c.colorAmount)},c}Object.defineProperty(De.a.prototype,"postProcessRenderPipelineManager",{get:function(){var e;return this._postProcessRenderPipelineManager||((e=this._getComponent(Me.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER))||(e=new Be(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Ie),this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var we,Be=(ke.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Me.a.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)},ke.prototype.rebuild=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()},ke.prototype.dispose=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()},ke.prototype._gatherRenderTargets=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update(
1)},ke),Ue=(we=xe,Object(r.d)(Ve,we),Object.defineProperty(Ve.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"sharpenEnabled",{get:function(){return this._sharpenEnabled},set:function(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"bloomKernel",{get:function(){return this._bloomKernel},set:function(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"bloomWeight",{get:function(){return this._bloomWeight},set:function(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"bloomThreshold",{get:function(){return this._bloomThreshold},set:function(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"bloomScale",{get:function(){return this._bloomScale},set:function(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"bloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Ve.prototype._rebuildBloom=function(){var e=this.bloom;this.bloom=new C(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(var t=0;t<this._cameras.length;t++)e.disposeEffects(this._cameras[t])},Object.defineProperty(Ve.prototype,"depthOfFieldEnabled",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"depthOfFieldBlurLevel",{get:function(){return this._depthOfFieldBlurLevel},set:function(e){if(this._depthOfFieldBlurLevel!==e){this._depthOfFieldBlurLevel=e;var t=this.depthOfField;this.depthOfField=new Z(this._scene,null,this._depthOfFieldBlurLevel,this._defaultPipelineTextureType,!1),this.depthOfField.focalLength=t.focalLength,this.depthOfField.focusDistance=t.focusDistance,this.depthOfField.fStop=t.fStop,this.depthOfField.lensSize=t.lensSize;for(var i=0;i<this._cameras.length;i++)t.disposeEffects(this._cameras[i]);this._buildPipeline()}},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"imageProcessingEnabled",{get:function(){return this._imageProcessingEnabled},set:function(e){this._imageProcessingEnabled!==e&&(this._scene.imageProcessingConfiguration.isEnabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"glowLayerEnabled",{get:function(){return null!=this._glowLayer},set:function(e){e&&!this._glowLayer?this._glowLayer=new Se.a("",this._scene):!e&&this._glowLayer&&(this._glowLayer.dispose(),this._glowLayer=null)},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"glowLayer",{get:function(){return this._glowLayer},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"chromaticAberrationEnabled",{get:function(){return this._chromaticAberrationEnabled},set:function(e){this._chromaticAberrationEnabled!==e&&(this._chromaticAberrationEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Ve.prototype,"grainEnabled",{get:function(){return this._grainEnabled},set:function(e){this._grainEnabled!==e&&(this._grainEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Ve.prototype.getClassName=function(){return"DefaultRenderingPipeline"},Ve.prototype.prepare=function(){var e=this._buildAllowed;this._buildAllowed=!0,this._buildPipeline(),this._buildAllowed=e},Ve.prototype._setAutoClearAndTextureSharing=function(e,t){void 0===t&&(t=!1),this._hasCleared?e.autoClear=!1:(e.autoClear=!0,this._scene.autoClear=!1,this._hasCleared=!0),t||(this._prevPrevPostProcess?e.shareOutputWith(this._prevPrevPostProcess):e.useOwnOutput(),this._prevPostProcess&&(this._prevPrevPostProcess=this._prevPostProcess),this._prevPostProcess=e)},Ve.prototype._buildPipeline=function(){var t=this;if(this._buildAllowed){this._scene.autoClear=!0;var e=this._scene.getEngine();if(this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._prevPostProcess=null,this._prevPrevPostProcess=null,this._hasCleared=!1,this.depthOfFieldEnabled){if(1<this._cameras.length){for(var i=0,n=this._cameras;i<n.length;i++){var r=n[i];(o=this._scene.enableDepthRenderer(r)).useOnlyInActiveCamera=!0}this._depthOfFieldSceneObserver=this._scene.onAfterRenderTargetsRenderObservable.add(function(e){-1<t._cameras.indexOf(e.activeCamera)&&(t.depthOfField.depthTexture=e.enableDepthRenderer(e.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 he.a("imageProcessing",1,null,A.a.BILINEAR_SAMPLINGMODE,e,!1,this._defaultPipelineTextureType),this._hdr?(this.addEffect(new u(e,this.ImageProcessingPostProcessId,function(){return t.imageProcessing},!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1,this.cameras&&0!==this.cameras.length||(this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.imageProcessing.getEffect()||this.imageProcessing._updateParameters()),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 re.a("fxaa",1,null,A.a.BILINEAR_SAMPLINGMODE,e,!1,this._defaultPipelineTextureType),this.addEffect(new u(e,this.FxaaPostProcessId,function(){return t.fxaa},!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),this._scene.activeCameras&&1<this._scene.activeCameras.length&&(this._scene.autoClear=!0),!this._enableMSAAOnFirstPostProcess(this.samples)&&1<this.samples&&M.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")}},Ve.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t<this._cameras.length;t++){var i=this._cameras[t];this.imageProcessing&&this.imageProcessing.dispose(i),this.fxaa&&this.fxaa.dispose(i),e&&(this.sharpen&&this.sharpen.dispose(i),this.depthOfField&&(this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver),this.depthOfField.disposeEffects(i)),this.bloom&&this.bloom.disposeEffects(i),this.chromaticAberration&&this.chromaticAberration.dispose(i),this.grain&&this.grain.dispose(i),this._glowLayer&&this._glowLayer.dispose())}this.imageProcessing=null,this.fxaa=null,e&&(this.sharpen=null,this._sharpenEffect=null,this.depthOfField=null,this.bloom=null,this.chromaticAberration=null,this._chromaticAberrationEffect=null,this.grain=null,this._grainEffect=null,this._glowLayer=null)},Ve.prototype.addCamera=function(e){this._camerasToBeAttached.push(e),this._buildPipeline()},Ve.prototype.removeCamera=function(e){var t=this._camerasToBeAttached.indexOf(e);this._camerasToBeAttached.splice(t,1),this._buildPipeline()},Ve.prototype.dispose=function(){this._disposePostProcesses(!0),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._scene.autoClear=!0,this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver),we.prototype.dispose.call(this)},Ve.prototype.serialize=function(){var e=Ee.a.Serialize(this);return e.customType="DefaultRenderingPipeline",e},Ve.Parse=function(e,t,i){return Ee.a.Parse(function(){return new Ve(e._name,e._name._hdr,t)},e,t,i)},Object(r.c)([Object(Ee.c)()],Ve.prototype,"sharpenEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"bloomKernel",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"_bloomWeight",void 0),Object(r.c)([Object(Ee.c)()],Ve.prototype,"_bloomThreshold",void 0),Object(r.c)([Object(Ee.c)()],Ve.prototype,"_hdr",void 0),Object(r.c)([Object(Ee.c)()],Ve.prototype,"bloomWeight",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"bloomThreshold",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"bloomScale",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"bloomEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"depthOfFieldEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"depthOfFieldBlurLevel",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"fxaaEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"samples",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"imageProcessingEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"glowLayerEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"chromaticAberrationEnabled",null),Object(r.c)([Object(Ee.c)()],Ve.prototype,"grainEnabled",null),Ve);function Ve(e,t,i,n,r){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===i&&(i=Oe.a.LastCreatedScene),void 0===r&&(r=!0);var o=we.call(this,i.getEngine(),e)||this;o._camerasToBeAttached=[],o.SharpenPostProcessId="SharpenPostProcessEffect",o.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",o.FxaaPostProcessId="FxaaPostProcessEffect",o.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",o.GrainPostProcessId="GrainPostProcessEffect",o._glowLayer=null,o.animations=[],o._imageProcessingConfigurationObserver=null,o._sharpenEnabled=!1,o._bloomEnabled=!1,o._depthOfFieldEnabled=!1,o._depthOfFieldBlurLevel=W.Low,o._fxaaEnabled=!1,o._imageProcessingEnabled=!0,o._bloomScale=.5,o._chromaticAberrationEnabled=!1,o._grainEnabled=!1,o._buildAllowed=!0,o._resizeObserver=null,o._hardwareScaleLevel=1,o._bloomKernel=64,o._bloomWeight=.15,o._bloomThreshold=.9,o._samples=1,o._hasCleared=!1,o._prevPostProcess=null,o._prevPrevPostProcess=null,o._depthOfFieldSceneObserver=null,o._cameras=n||i.cameras,o._cameras=o._cameras.slice(),o._camerasToBeAttached=o._cameras.slice(),o._buildAllowed=r,o._scene=i;var a=o._scene.getEngine().getCaps();
1o._hdr=t&&(a.textureHalfFloatRender||a.textureFloatRender),o._hdr?a.textureHalfFloatRender?o._defaultPipelineTextureType=f.a.TEXTURETYPE_HALF_FLOAT:a.textureFloatRender&&(o._defaultPipelineTextureType=f.a.TEXTURETYPE_FLOAT):o._defaultPipelineTextureType=f.a.TEXTURETYPE_UNSIGNED_INT,i.postProcessRenderPipelineManager.addPipeline(o);var s=o._scene.getEngine();return o.sharpen=new Pe("sharpen",1,null,A.a.BILINEAR_SAMPLINGMODE,s,!1,o._defaultPipelineTextureType,!0),o._sharpenEffect=new u(s,o.SharpenPostProcessId,function(){return o.sharpen},!0),o.depthOfField=new Z(o._scene,null,o._depthOfFieldBlurLevel,o._defaultPipelineTextureType,!0),o.bloom=new C(o._scene,o._bloomScale,o._bloomWeight,o.bloomKernel,o._defaultPipelineTextureType,!0),o.chromaticAberration=new O("ChromaticAberration",s.getRenderWidth(),s.getRenderHeight(),1,null,A.a.BILINEAR_SAMPLINGMODE,s,!1,o._defaultPipelineTextureType,!0),o._chromaticAberrationEffect=new u(s,o.ChromaticAberrationPostProcessId,function(){return o.chromaticAberration},!0),o.grain=new se("Grain",1,null,A.a.BILINEAR_SAMPLINGMODE,s,!1,o._defaultPipelineTextureType,!0),o._grainEffect=new u(s,o.GrainPostProcessId,function(){return o.grain},!0),o._resizeObserver=s.onResizeObservable.add(function(){o._hardwareScaleLevel=s.getHardwareScalingLevel(),o.bloomKernel=o.bloomKernel}),o._imageProcessingConfigurationObserver=o._scene.imageProcessingConfiguration.onUpdateParameters.add(function(){o.bloom._downscale._exposure=o._scene.imageProcessingConfiguration.exposure,o.imageProcessingEnabled!==o._scene.imageProcessingConfiguration.isEnabled&&(o._imageProcessingEnabled=o._scene.imageProcessingConfiguration.isEnabled,o._buildPipeline())}),o._buildPipeline(),o}function ke(e){this.name=Me.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}Re.a.RegisteredTypes["BABYLON.DefaultRenderingPipeline"]=Ue;var Ge=i(85);o.a.ShadersStore.lensHighlightsPixelShader="\nuniform sampler2D textureSampler;\n\nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\n\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\n\nif (gain == -1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\n\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h
1)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n\n}";o.a.ShadersStore.depthOfFieldPixelShader="\n\n\n\n\nuniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\n\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\n\nuniform float screen_distance;\nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\n\nuniform float near;\nuniform float far;\n\nvarying vec2 vUV;\n\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1\n\nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\n\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\n\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion == 0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);
1\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\n\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\n\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\n\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\n\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nif (size == 0.0) { return col; }\n\n\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight;\n\nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\n\n\n\n\nreturn col;\n}\nvoid main(void)\n{\n\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV);\nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height);\nfloat depth=texture2D(depthSampler,distorted_coords).r;\nfloat distance=near+(far-near)*depth;\nvec4 color=texture2D(textureSampler,vUV);\n\n\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\n\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\n\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\n\nfloat blur_amount=max(edge_blur_amount,coc);\n\nif (blur_amount == 0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\n\ngl_FragColor=getBlurColor(blur_amount*1.7);\n\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\n\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\n\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;
1\n}\n}\n";var ze,je=(ze=xe,Object(r.d)(We,ze),We.prototype.getClassName=function(){return"LensRenderingPipeline"},Object.defineProperty(We.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"edgeBlur",{get:function(){return this._edgeBlur},set:function(e){this.setEdgeBlur(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"grainAmount",{get:function(){return this._grainAmount},set:function(e){this.setGrainAmount(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"chromaticAberration",{get:function(){return this._chromaticAberration},set:function(e){this.setChromaticAberration(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"dofAperture",{get:function(){return this._dofAperture},set:function(e){this.setAperture(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"edgeDistortion",{get:function(){return this._distortion},set:function(e){this.setEdgeDistortion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"dofDistortion",{get:function(){return this._dofDistance},set:function(e){this.setFocusDistance(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"darkenOutOfFocus",{get:function(){return this._dofDarken},set:function(e){this.setDarkenOutOfFocus(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"blurNoise",{get:function(){return this._blurNoise},set:function(e){this._blurNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"pentagonBokeh",{get:function(){return this._pentagonBokehIsEnabled},set:function(e){e?this.enablePentagonBokeh():this.disablePentagonBokeh()},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"highlightsGain",{get:function(){return this._highlightsGain},set:function(e){this.setHighlightsGain(e)},enumerable:!1,configurable:!0}),Object.defineProperty(We.prototype,"highlightsThreshold",{get:function(){return this._highlightsThreshold},set:function(e){this.setHighlightsThreshold(e)},enumerable:!1,configurable:!0}),We.prototype.setEdgeBlur=function(e){this._edgeBlur=e},We.prototype.disableEdgeBlur=function(){this._edgeBlur=0},We.prototype.setGrainAmount=function(e){this._grainAmount=e},We.prototype.disableGrain=function(){this._grainAmount=0},We.prototype.setChromaticAberration=function(e){this._chromaticAberration=e},We.prototype.disableChromaticAberration=function(){this._chromaticAberration=0},We.prototype.setEdgeDistortion=function(e){this._distortion=e},We.prototype.disableEdgeDistortion=function(){this._distortion=0},We.prototype.setFocusDistance=function(e){this._dofDistance=e},We.prototype.disableDepthOfField=function(){this._dofDistance=-1},We.prototype.setAperture=function(e){this._dofAperture=e},We.prototype.setDarkenOutOfFocus=function(e){this._dofDarken=e},We.prototype.enablePentagonBokeh=function(){this._highlightsPostProcess.updateEffect("#define PENTAGON\n"),this._pentagonBokehIsEnabled=!0},We.prototype.disablePentagonBokeh=function(){this._pentagonBokehIsEnabled=!1,this._highlightsPostProcess.updateEffect()},We.prototype.enableNoiseBlur=function(){this._blurNoise=!0},We.prototype.disableNoiseBlur=function(){this._blurNoise=!1},We.prototype.setHighlightsGain=function(e){this._highlightsGain=e},We.prototype.setHighlightsThreshold=function(e){-1===this._highlightsGain&&(this._highlightsGain=1),this._highlightsThreshold=e},We.prototype.disableHighlights=function(){this._highlightsGain=-1},We.prototype.dispose=function(e){void 0===e&&(e=!1),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),this._chromaticAberrationPostProcess=null,this._highlightsPostProcess=null,this._depthOfFieldPostProcess=null,this._grainTexture.dispose(),e&&this._scene.disableDepthRenderer()},We.prototype._createChromaticAberrationPostProcess=function(e){var t=this;this._chromaticAberrationPostProcess=new l.a("LensChromaticAberration","chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],e,null,A.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._chromaticAberrationPostProcess.onApply=function(e){e.setFloat("chromatic_aberration",t._chromaticAberration),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("radialIntensity",1),e.setFloat2("direction",17,17),e.setFloat2("centerPosition",.5,.5)}},We.prototype._createHighlightsPostProcess=function(e){var t=this;this._highlightsPostProcess=new l.a("LensHighlights","lensHighlights",["gain","threshold","screen_width","screen_height"],[],e,null,A.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,this._dofPentagon?"#define PENTAGON\n":""),this._highlightsPostProcess.onApply=function(e){e.setFloat("gain",t._highlightsGain),e.setFloat("threshold",t._highlightsThreshold),e.setTextureFromPostProcess("textureSampler",t._chromaticAberrationPostProcess),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight())}},We.prototype._createDepthOfFieldPostProcess=function(e){var t=this;this._depthOfFieldPostProcess=new l.a("LensDepthOfField","depthOfField",["grain_amount","blur_noise","screen_width","screen_height","distortion","dof_enabled","screen_distance","aperture","darken","edge_blur","highlights","near","far"],["depthSampler","grainSampler","highlightsSampler"],e,
1null,A.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._depthOfFieldPostProcess.onApply=function(e){e.setTexture("depthSampler",t._depthTexture),e.setTexture("grainSampler",t._grainTexture),e.setTextureFromPostProcess("textureSampler",t._highlightsPostProcess),e.setTextureFromPostProcess("highlightsSampler",t._depthOfFieldPostProcess),e.setFloat("grain_amount",t._grainAmount),e.setBool("blur_noise",t._blurNoise),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("distortion",t._distortion),e.setBool("dof_enabled",-1!==t._dofDistance),e.setFloat("screen_distance",1/(.1-1/t._dofDistance)),e.setFloat("aperture",t._dofAperture),e.setFloat("darken",t._dofDarken),e.setFloat("edge_blur",t._edgeBlur),e.setBool("highlights",-1!==t._highlightsGain),t._scene.activeCamera&&(e.setFloat("near",t._scene.activeCamera.minZ),e.setFloat("far",t._scene.activeCamera.maxZ))}},We.prototype._createGrainTexture=function(){this._grainTexture=new Ge.a("LensNoiseTexture",512,this._scene,!1,A.a.BILINEAR_SAMPLINGMODE),this._grainTexture.wrapU=A.a.WRAP_ADDRESSMODE,this._grainTexture.wrapV=A.a.WRAP_ADDRESSMODE;for(var e,t=this._grainTexture.getContext(),i=0;i<512;i++)for(var n=0;n<512;n++)e=Math.floor(255*(Math.random()*(.58-.42)+.42)),t.fillStyle="rgb("+e+", "+e+", "+e+")",t.fillRect(i,n,1,1);this._grainTexture.update(!1)},We);function We(e,t,i,n,r){void 0===n&&(n=1);var o=ze.call(this,i.getEngine(),e)||this;return o.LensChromaticAberrationEffect="LensChromaticAberrationEffect",o.HighlightsEnhancingEffect="HighlightsEnhancingEffect",o.LensDepthOfFieldEffect="LensDepthOfFieldEffect",o._pentagonBokehIsEnabled=!1,o._scene=i,o._depthTexture=i.enableDepthRenderer().getDepthMap(),t.grain_texture?o._grainTexture=t.grain_texture:o._createGrainTexture(),o._edgeBlur=t.edge_blur?t.edge_blur:0,o._grainAmount=t.grain_amount?t.grain_amount:0,o._chromaticAberration=t.chromatic_aberration?t.chromatic_aberration:0,o._distortion=t.distortion?t.distortion:0,o._highlightsGain=void 0!==t.dof_gain?t.dof_gain:-1,o._highlightsThreshold=t.dof_threshold?t.dof_threshold:1,o._dofDistance=void 0!==t.dof_focus_distance?t.dof_focus_distance:-1,o._dofAperture=t.dof_aperture?t.dof_aperture:1,o._dofDarken=t.dof_darken?t.dof_darken:0,o._dofPentagon=void 0===t.dof_pentagon||t.dof_pe
1ntagon,o._blurNoise=void 0===t.blur_noise||t.blur_noise,o._createChromaticAberrationPostProcess(n),o._createHighlightsPostProcess(n),o._createDepthOfFieldPostProcess(n/4),o.addEffect(new u(i.getEngine(),o.LensChromaticAberrationEffect,function(){return o._chromaticAberrationPostProcess},!0)),o.addEffect(new u(i.getEngine(),o.HighlightsEnhancingEffect,function(){return o._highlightsPostProcess},!0)),o.addEffect(new u(i.getEngine(),o.LensDepthOfFieldEffect,function(){return o._depthOfFieldPostProcess},!0)),-1===o._highlightsGain&&o._disableEffect(o.HighlightsEnhancingEffect,null),i.postProcessRenderPipelineManager.addPipeline(o),r&&i.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,r),o}o.a.ShadersStore.ssao2PixelShader="\nprecision highp float;\nuniform sampler2D textureSampler;\nuniform float near;\nuniform float far;\nuniform float radius;\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);\nvarying vec2 vUV;\nfloat perspectiveDepthToViewZ( const in float invClipZ,const in float near,const in float far ) {\nreturn ( near*far )/( ( far-near )*invClipZ-far );\n}\nfloat viewZToPerspectiveDepth( const in float viewZ,const in float near,const in float far ) {\nreturn ( near*far/viewZ+far)/( far-near );\n}\nfloat viewZToOrthographicDepth( const in float viewZ,const in float near,const in float far ) {\nreturn ( viewZ+near )/( near-far );\n}\n#ifdef SSAO\nuniform sampler2D randomSampler;\n#ifndef GEOMETRYBUFFER\nuniform sampler2D depthNormalSampler;\n#else\nuniform sampler2D depthSampler;\nuniform sampler2D normalSampler;\n#endif\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float base;\nuniform float xViewport;\nuniform float yViewport;\nuniform float maxZ;\nuniform float minZAspect;\nuniform vec2 texelSize;\nuniform mat4 projection;\nvoid main()\n{\nvec3 random=texture2D(randomSampler,vUV*randTextureTiles).rgb;\n#ifndef GEOMETRYBUFFER\nfloat depth=texture2D(depthNormalSampler,vUV).r;\n#else\nfloat depth=texture2D(depthSampler,vUV).r;\n#endif\nfloat depthSign=depth/abs(depth);\ndepth=depth*depthSign;\n#ifndef GEOMETRYBUFFER\nvec3 normal=texture2D(depthNormalSampler,vUV).gba;\n#else\nvec3 normal=texture2D(normalSampler,vUV).rgb;\n#endif\nfloat occlusion=0.0;\nfloat correctedRadius=min(radius,minZAspect*depth/near);\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\nvec3 origin=vViewRay*depth;\nvec3 rvec=random*2.0-1.0;\nrvec.z=0.0;\n\nfloat dotProduct=dot(rvec,normal);\nrvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\nvec3 bitangent=cross(normal,tangent);\nmat3 tbn=mat3(tangent,bitangent,normal);\nfloat difference;\nfor (int i=0; i<SAMPLES; ++i) {\n\nvec3 samplePosition=scales[(i+int(random.x*16.0)) % 16]*tbn*sampleSphere[(i+int(random.y*16.0)) % 16];\nsamplePosition=samplePosition*correctedRadius+origin;\n\nvec4 offset=vec4(samplePosition,1.0);\noffset=projection*offset;\noffset.xyz/=offset.w;\noffset.xy=offset.xy*0.5+0.5;\nif (offset.x<0.0 || offset.y<0.0 || offset.x>1.0 || offset.y>1.0) {\ncontinue;\n}\n\n#ifndef GEOMETRYBUFFER\nfloat sampleDepth=abs(texture2D(depthNormalSampler,offset.xy).r);\n#else\nfloat sampleDepth=abs(texture2D(depthSampler,offset.xy).r);\n#endif\n\ndifference=depthSign*samplePosition.z-sampleDepth;\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\n}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor=vec4(vec3(result),1.0);\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthNormalSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.3846153846)*direction;\nvec2 off2=vec2(3.2307692308)*direction;\ncolor+=texture2D(image,uv)*0.2270270270;\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\nreturn color;\n}\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);
1\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\ncolor+=texture2D(image,uv)*0.1964825501511404;\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\nreturn color;\n}\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\nfloat compareDepth=abs(texture2D(depthNormalSampler,uv).r);\nfloat sampleDepth;\nfloat weight;\nfloat weightSum=30.0;\ncolor+=texture2D(image,uv)*30.0;\nsampleDepth=abs(texture2D(depthNormalSampler,uv+(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthNormalSampler,uv-(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthNormalSampler,uv+(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthNormalSampler,uv-(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthNormalSampler,uv+(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\nsampleDepth=abs(texture2D(depthNormalSampler,uv-(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\nreturn color/weightSum;\n}\nvoid main()\n{\n#if EXPENSIVE\nfloat compareDepth=abs(texture2D(depthNormalSampler,vUV).r);\nfloat texelsize=1.0/outSize;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; i<SAMPLES; ++i)\n{\n#ifdef BILATERAL_BLUR_H\nvec2 direction=vec2(1.0,0.0);\nvec2 sampleOffset=vec2(texelsize*samplerOffsets[i],0.0);\n#else\nvec2 direction=vec2(0.0,1.0);\nvec2 sampleOffset=vec2(0.0,texelsize*samplerOffsets[i]);\n#endif\nvec2 samplePos=vUV+sampleOffset;\nfloat sampleDepth=abs(texture2D(depthNormalSampler,samplePos).r);\nfloat weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30000.0);\nresult+=texture2D(textureSampler,samplePos).r*weight;\nweightSum+=weight;\n}\nresult/=weightSum;\ngl_FragColor.rgb=vec3(result);\ngl_FragColor.a=1.0;\n#else\nvec4 color;\n#ifdef BILATERAL_BLUR_H\nvec2 direction=vec2(1.0,0.0);\ncolor=blur13Bilateral(textureSampler,vUV,outSize,direction);\n#else\nvec2 direction=vec2(0.0,1.0);\ncolor=blur13Bilateral(textureSampler,vUV,outSize,direction);\n#endif\ngl_FragColor.rgb=vec3(color.r);\ngl_FragColor.a=1.0;\n#endif\n}\n#endif\n";o.a.ShadersStore.ssaoCombinePixelShader="uniform sampler2D textureSampler;\nuniform sampler2D originalColor;\nuniform vec4 viewport;\nvarying vec2 vUV;\nvoid main(void) {\nvec4 ssaoColor=texture2D(textureSampler,viewport.xy+vUV*viewport.zw);\nvec4 sceneColor=texture2D(originalColor,vUV);\ngl_FragColor=sceneColor*ssaoColor;\n}\n";var He,Xe=(He=xe,Object(r.d)(Ye,He),Object.defineProperty(Ye.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples=e,this._ssaoPostProcess.updateEffect(this._getDefinesForSSAO()),this._sampleSphere=this._generateHemisphere()},enumerable:!1,configurable:!0}),Object.defineProperty(Ye.prototype,"textureSamples",{get:function(){return this._textureSamples},set:function(e){this._textureSamples=e,this._originalColorPostProcess.samples=e,this._blurHPostProcess.samples=e,this._blurVPostProcess.samples=e,this._ssaoPostProcess.samples=e,this._ssaoCombinePostProcess.samples=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Ye.prototype,"expensiveBlur",{get:function(){return this._expensiveBlur},set:function(e){this._blurHPostProcess.updateEffect("#define BILATERAL_BLUR\n#define BILATERAL_BLUR_H\n#define SAMPLES 16\n#define EXPENSIVE "+(e?"1":"0")+"\n",null,["textureSampler","depthNormalSampler"]),this._blurVPostProcess.updateEffect("#define BILATERAL_BLUR\n#define SAMPLES 16\n#define EXPENSIVE "+(e?"1":"0")+"\n",null,["textureSampler","depthNormalSampler"]),this._expensiveBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(Ye,"IsSupported",{get:function(){var e=Oe.a.LastCreatedEngine;return!!e&&2<=e.webGLVersion},enumerable:!1,configurable:!0}),Object.defineProperty(Ye.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Ye.prototype.getClassName=function(){return"SSAO2RenderingPipeline"},Ye.prototype.dispose=function(e){void 0===e&&(e=!1);for(var t=0;t<this._scene.cameras.length;t++){var i=this._scene.cameras[t];this._originalColorPostProcess.dispose(i),this._ssaoPostProcess.dispose(i),this._blurHPostProcess.dispose(i),this._blurVPostProcess.dispose(i),this._ssaoCombinePostProcess.dispose(i)}this._randomTexture.dispose(),e&&this._scene.disableGeometryBufferRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),He.prototype.dispose.call(this)},Ye.prototype._createBlurPostProcess=function(e,t){var i=this;this._samplerOffsets=[];for(var n=this.expensiveBlur,r=-8;r<8;r++)this._samplerOffsets.push(2*r+.5);this._blurHPostProcess=new l.a("BlurH","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthNormalSampler"],e,null,A.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_H\n#define SAMPLES 16\n#define EXPENSIVE "+(n?"1":"0")+"\n"),this._blurHPostProcess.onApply=function(e){i._scene.activeCamera&&(e.setFloat("outSize",0<i._ssaoCombinePostProcess.width?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),i._forceGeometryBuffer?e.setTexture("depthNormalSampler",i._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]):e.setTexture("depthNormalSampler",i._prePassRenderer.prePassRT.textures[f.a.PREPASS_DEPTHNORMAL_INDEX]),e.setArray("samplerOffsets",i._samplerOffsets))},this._blurVPostProcess=new l.a("BlurV","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthNormalSampler"],t,null,A.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",0<i._ssaoCombinePostProcess.height?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),i._forceGeometryBuffer?e.setTexture("depthNormalSampler",i._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]):e.setTexture("depthNormalSampler",i._prePassRenderer.prePassRT.textures[f.a.PREPASS_DEPTHNORMAL_INDEX]),e.setArray("samplerOffsets",i._samplerOffsets))},this._blurHPostProcess.samples=this.textureSamples,this._blurVPostProcess.samples=this.textureSamples},Ye.prototype._rebuild=function(){He.prototype._rebuild.call(this)},Ye.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]},Ye.prototype._hammersley=function(e,t){return[e/t,this._radicalInverse_VdC(e)]},Ye.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 S.e(Math.cos(i)*r,Math.sin(i)*r,n)},Ye.prototype._generateHemisphere=function(){for(var e,t,i=this.samples,n=[],r=0;r<i;)t=i<16?this._hemisphereSample_uniform(Math.random(),Math.random()):(e=this._hammersley(r,
1i),this._hemisphereSample_uniform(e[0],e[1])),n.push(t.x,t.y,t.z),r++;return n},Ye.prototype._getDefinesForSSAO=function(){var e="#define SAMPLES "+this.samples+"\n#define SSAO";return this._forceGeometryBuffer&&(e+="\n#define GEOMETRYBUFFER"),e},Ye.prototype._createSSAOPostProcess=function(e){var t=this;this._sampleSphere=this._generateHemisphere();var i=this._getDefinesForSSAO(),n=this._forceGeometryBuffer?["randomSampler","depthSampler","normalSampler"]:["randomSampler","depthNormalSampler"];this._ssaoPostProcess=new l.a("ssao2","ssao2",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","base","range","projection","near","far","texelSize","xViewport","yViewport","maxZ","minZAspect"],n,e,null,A.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,i),this._ssaoPostProcess.onApply=function(e){t._scene.activeCamera&&(e.setArray3("sampleSphere",t._sampleSphere),e.setFloat("randTextureTiles",32),e.setFloat("samplesFactor",1/t.samples),e.setFloat("totalStrength",t.totalStrength),e.setFloat2("texelSize",1/t._ssaoPostProcess.width,1/t._ssaoPostProcess.height),e.setFloat("radius",t.radius),e.setFloat("maxZ",t.maxZ),e.setFloat("minZAspect",t.minZAspect),e.setFloat("base",t.base),e.setFloat("near",t._scene.activeCamera.minZ),e.setFloat("far",t._scene.activeCamera.maxZ),e.setFloat("xViewport",Math.tan(t._scene.activeCamera.fov/2)*t._scene.getEngine().getAspectRatio(t._scene.activeCamera,!0)),e.setFloat("yViewport",Math.tan(t._scene.activeCamera.fov/2)),e.setMatrix("projection",t._scene.getProjectionMatrix()),t._forceGeometryBuffer?(e.setTexture("depthSampler",t._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]),e.setTexture("normalSampler",t._scene.enableGeometryBufferRenderer().getGBuffer().textures[1])):e.setTexture("depthNormalSampler",t._prePassRenderer.prePassRT.textures[f.a.PREPASS_DEPTHNORMAL_INDEX]),e.setTexture("randomSampler",t._randomTexture))},this._ssaoPostProcess.samples=this.textureSamples},Ye.prototype._createSSAOCombinePostProcess=function(e){var i=this;this._ssaoCombinePostProcess=new l.a("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,A.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._ssaoCombinePostProcess.onApply=function(e){var t=i._scene.activeCamera.viewport;e.setVector4("viewport",S.c.Vector4[0].copyFromFloats(t.x,t.y,t.width,t.height)),e.setTextureFromPostProcess("originalColor",i._originalColorPostProcess)},this._ssaoCombinePostProcess.samples=this.textureSamples},Ye.prototype._createRandomTexture=function(){this._randomTexture=new Ge.a("SSAORandomTexture",128,this._scene,!1,A.a.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=A.a.WRAP_ADDRESSMODE,this._randomTexture.wrapV=A.a.WRAP_ADDRESSMODE;for(var e=this._randomTexture.getContext(),t=function(e,t){return Math.random()*(t-e)+e},i=S.e.Zero(),n=0;n<128;n++)for(var r=0;r<128;r++)i.x=t(0,1),i.y=t(0,1),i.z=0,i.normalize(),i.scaleInPlace(255),i.x=Math.floor(i.x),i.y=Math.floor(i.y),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(n,r,1,1);this._randomTexture.update(!1)},Ye.prototype.serialize=function(){var e=Ee.a.Serialize(this);return e.customType="SSAO2RenderingPipeline",e},Ye.Parse=function(e,t,i){return Ee.a.Parse(function(){return new Ye(e._name,t,e._ratio)},e,t,i)},Ye.prototype.setPrePassRenderer=function(e){return e.materialsShouldRenderGeometry=e.materialsShouldRenderGeometry||!0,!0},Object(r.c)([Object(Ee.c)()],Ye.prototype,"totalStrength",void 0),Object(r.c)([Object(Ee.c)()],Ye.prototype,"maxZ",void 0),Object(r.c)([Object(Ee.c)()],Ye.prototype,"minZAspect",void 0),Object(r.c)([Object(Ee.c)("samples")],Ye.prototype,"_samples",void 0),Object(r.c)([Object(Ee.c)("textureSamples")],Ye.prototype,"_textureSamples",void 0),Object(r.c)([Object(Ee.c)()],Ye.prototype,"_ratio",void 0),Object(r.c)([Object(Ee.c)("expensiveBlur")],Ye.prototype,"_expensiveBlur",void 0),Object(r.c)([Object(Ee.c)()],Ye.prototype,"radius",void 0),Object(r.c)([Object(Ee.c)()],Ye.prototype,"base",void 0),Ye);function Ye(e,t,i,n,r){void 0===r&&(r=!1);var o=He.call(this,t.getEngine(),e)||this;if(o.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",o.SSAORenderEffect="SSAORenderEffect",o.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",o.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",o.SSAOCombineRenderEffect="SSAOCombineRenderEffect",o.totalStrength=1,o.maxZ=100,o.minZAspect=.2,o._samples=8,o._textureSamples=1,o._forceGeometryBuffer=!1,o._expensiveBlur=!0,o.radius=2,o.base=0,o._bits=new Uint32Array(1),o._scene=t,o._ratio=i,o._forceGeometryBuffer=r,!o.isSupported)return M.a.Error("SSAO 2 needs WebGL 2 support."),o;var a=o._ratio.ssaoRatio||i,s=o._ratio.blurRatio||i;return o._forceGeometryBuffer?t.enableGeometryBufferRenderer():(o._prePassRenderer=t.enablePrePassRenderer(),o._prePassRenderer.markAsDirty()),o._createRandomTexture(),o._originalColorPostProcess=new ge.b("SSAOOriginalSceneColor",1,null,A.a.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),o._originalColorPostProcess.samples=o.textureSamples,o._createSSAOPostProcess(1),o._createBlurPostProcess(a,s),o._createSSAOCombinePostProcess(s),o.addEffect(new u(t.getEngine(),o.SSAOOriginalSceneColorEffect,function(){return o._originalColorPostProcess},!0)),o.addEffect(new u(t.getEngine(),o.SSAORenderEffect,function(){return o._ssaoPostProcess},!0)),o.addEffect(new u(t.getEngine(),o.SSAOBlurHRenderEffect,function(){return o._blurHPostProcess},!0)),o.addEffect(new u(t.getEngine(),o.SSAOBlurVRenderEffect,function(){return o._blurVPostProcess},!0)),o.addEffect(new u(t.getEngine(),o.SSAOCombineRenderEffect,function(){return o._ssaoCombinePostProcess},!0)),t.postProcessRenderPipelineManager.addPipeline(o),n&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n),o}Re.a.RegisteredTypes["BABYLON.SSAO2RenderingPipeline"]=Xe;o.a.ShadersStore.ssaoPixelShader="\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);
1\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; i<SAMPLES; i++)\n{\nray=radiusDepth*reflect(sampleSphere[i],random);\nhemiRay=position+sign(dot(ray,normal))*ray;\nocclusionDepth=texture2D(textureSampler,clamp(hemiRay.xy,vec2(0.001,0.001),vec2(0.999,0.999))).r;\ndifference=depth-occlusionDepth;\nocclusion+=step(fallOff,difference)*(1.0-smoothstep(fallOff,area,difference));\n}\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor.r=result;\ngl_FragColor.g=result;\ngl_FragColor.b=result;\ngl_FragColor.a=1.0;\n}\n#endif\n";var Ke,Qe=(Ke=xe,Object(r.d)(Ze,Ke),Object.defineProperty(Ze.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Ze.prototype.getClassName=function(){return"SSAORenderingPipeline"},Ze.prototype.dispose=function(e){void 0===e&&(e=!1);for(var t=0;t<this._scene.cameras.length;t++){var i=this._scene.cameras[t];this._originalColorPostProcess.dispose(i),this._ssaoPostProcess.dispose(i),this._blurHPostProcess.dispose(i),this._blurVPostProcess.dispose(i),this._ssaoCombinePostProcess.dispose(i)}this._randomTexture.dispose(),e&&this._scene.disableDepthRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),Ke.prototype.dispose.call(this)},Ze.prototype._createBlurPostProcess=function(e){var t=this;this._blurHPostProcess=new v.a("BlurH",new S.d(1,0),16,e,null,A.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,f.a.TEXTURETYPE_UNSIGNED_INT),this._blurVPostProcess=new v.a("BlurV",new S.d(0,1),16,e,null,A.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,f.a.TEXTURETYPE_UNSIGNED_INT),this._blurHPostProcess.onActivateObservable.add(function(){var e=t._blurHPostProcess.width/t._scene.getEngine().getRenderWidth();t._blurHPostProcess.kernel=16*e}),this._blurVPostProcess.onActivateObservable.add(function(){var e=t._blurVPostProcess.height/t._scene.getEngine().getRenderHeight();t._blurVPostProcess.kernel=16*e})},Ze.prototype._rebuild=function(){this._firstUpdate=!0,Ke.prototype._rebuild.call(this)},Ze.prototype._createSSAOPostProcess=function(e){var t=this,i=[.5381,.1856,-.4319,.1379,.2486,.443,.3371,.5679,-.0057,-.6999,-.0451,-.0019,.0689,-.1598,-.8547,.056,.0069,-.1843,-.0146,.1402,.0762,.01,-.1924,-.0344,-.3577,-.5301,-.4358,-.3169,.1063,.0158,.0103,-.5869,.0046,-.0897,-.494,.3287,.7119,-.0154,-.0918,-.0533,.0596,-.5411,.0352,-.0631,.546,-.4776,.2847,-.0271];this._ssaoPostProcess=new l.a("ssao","ssao",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","area","fallOff","base","range","viewport"],["randomSampler"],e,null,A.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define SAMPLES 16\n#define SSAO"),this._ssaoPostProcess.onApply=function(e){t._firstUpdate&&(e.setArray3("sampleSphere",i),e.setFloat("samplesFactor",1/16),e.setFloat("randTextureTiles",4)),e.setFloat("totalStrength",t.totalStrength),e.setFloat("radius",t.radius),e.setFloat("area",t.area),e.setFloat("fallOff",t.fallOff),e.setFloat("base",t.base),e.setTexture("textureSampler",t._depthTexture),e.setTexture("randomSampler",t._randomTexture)}},Ze.prototype._createSSAOCombinePostProcess=function(e){var t=this;this._ssaoCombinePostProcess=new l.a("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,A.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._ssaoCombinePostProcess.onApply=function(e){e.setVector4("viewport",S.c.Vector4[0].copyFromFloats(0,0,1,1)),e.setTextureFromPostProcess("originalColor",t._originalColorPostProcess)}},Ze.prototype._createRandomTexture=function(){this._randomTexture=new Ge.a("SSAORandomTexture",512,this._scene,!1,A.a.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=A.a.WRAP_ADDRESSMODE,this._randomTexture.wrapV=A.a.WRAP_ADDRESSMODE;for(var e=this._randomTexture.getContext(),t=function(e,t){return Math.random()*(t-e)+e},i=S.e.Zero(),n=0;n<512;n++)for(var r=0;r<512;r++)i.x=Math.floor(255*t(-1,1)),i.y=Math.floor(255*t(-1,1)),i.z=Math.floor(255*t(-1,1)),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(n,r,1,1);this._randomTexture.update(!1)},Object(r.c)([Object(Ee.c)()],Ze.prototype,"totalStrength",void 0),Object(r.c)([Object(Ee.c)()],Ze.prototype,"radius",void 0),Object(r.c)([Object(Ee.c)()],Ze.prototype,"area",void 0),Object(r.c)([Object(Ee.c)()],Ze.prototype,"fallOff",void 0),Object(r.c)([Object(Ee.c)()],Ze.prototype,"base",void 0),Ze),qe=i(14);function Ze(e,t,i,n){var r=Ke.call(this,t.getEngine(),e)||this;r.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",r.SSAORenderEffect="SSAORenderEffect",r.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",r.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",r.SSAOCombineRenderEffect="SSAOCombineRenderEffect",r.totalStrength=1,r.radius=1e-4,r.area=.0075,r.fallOff=1e-6,r.base=.5,r._firstUpdate=!0,r._scene=t,r._createRandomTexture(),r._depthTexture=t.enableDepthRenderer().getDepthMap();var o=i.ssaoRatio||i,a=i.combineRatio||i;return r._originalColorPostProcess=new ge.b("SSAOOriginalSceneColor",a,null,A.a.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),r._createSSAOPostProcess(o),r._createBlurPostProcess(o),r._createSSAOCombinePostProcess(a),r.addEffect(new u(t.getEngine(),r.SSAOOriginalSceneColorEffect,function(){return r._originalColorPostProcess},!0)),r.addEffect(new u(t.getEngine(),r.SSAORenderEffect,function(){return r._ssaoPostProcess},!0)),r.addEffect(new u(t.getEngine(),r.SSAOBlurHRenderEffect,function(){return r._blurHPostProcess},!0)),r.addEffect(new u(t.getEngine(),r.SSAOBlurVRenderEffect,function(){return r._blurVPostProcess},!0)),r.addEffect(new u(t.getEngine(),r.SSAOCombineRenderEffect,function(){return r._ssaoCombinePostProcess},!0)),t.postProcessRenderPipelineManager.addPipeline(r),n&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n),r}o.a.ShadersStore.screenSpaceReflectionPixelShader="\n\nuniform sampler2D textureSampler;\nuniform sampler2D normalSampler;\nuniform sampler2D positionSampler;\nuniform sampler2D reflectivitySampler;\nuniform mat4 view;\nuniform mat4 projection;\nuniform float step;\nuniform float strength;\nuniform float threshold;\nuniform float roughnessFactor;\nuniform float reflectionSpecularFalloffExponent;
1\n\nvarying vec2 vUV;\n\nstruct ReflectionInfo {\nvec3 color;\nvec4 coords;\n};\n\nvec3 fresnelSchlick(float cosTheta,vec3 F0)\n{\nreturn F0+(1.0-F0)*pow(1.0-cosTheta,5.0);\n}\n\nReflectionInfo smoothReflectionInfo(vec3 dir,vec3 hitCoord)\n{\nReflectionInfo info;\ninfo.color=vec3(0.0);\nvec4 projectedCoord;\nfloat sampledDepth;\nfor(int i=0; i<SMOOTH_STEPS; i++)\n{\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\nsampledDepth=(view*texture2D(positionSampler,projectedCoord.xy)).z;\nfloat depth=sampledDepth-hitCoord.z;\ndir*=0.5;\nif(depth>0.0)\nhitCoord-=dir;\nelse\nhitCoord+=dir;\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\n}\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\n\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,1.0);\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.color/=float(SMOOTH_STEPS+1);\nreturn info;\n}\n\nReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)\n{\nReflectionInfo info;\nvec4 projectedCoord;\nfloat sampledDepth;\ndir*=step;\nfor(int i=0; i<REFLECTION_SAMPLES; i++)\n{\nhitCoord+=dir;\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\nsampledDepth=(view*texture2D(positionSampler,projectedCoord.xy)).z;\nfloat depth=sampledDepth-hitCoord.z;\nif(((depth-dir.z)<threshold) && depth<=0.0)\n{\n#ifdef ENABLE_SMOOTH_REFLECTIONS\nreturn smoothReflectionInfo(dir,hitCoord);\n#else\ninfo.color=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,0.0);\nreturn info;\n#endif\n}\n}\ninfo.color=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,0.0);\nreturn info;\n}\nvec3 hash(vec3 a)\n{\na=fract(a*0.8);\na+=dot(a,a.yxz+19.19);\nreturn fract((a.xxy+a.yxx)*a.zyx);\n}\nvoid main()\n{\n#ifdef SSR_SUPPORTED\n\nvec4 albedoFull=texture2D(textureSampler,vUV);\nvec3 albedo=albedoFull.rgb;\nfloat spec=texture2D(reflectivitySampler,vUV).r;\nif (spec == 0.0) {\ngl_FragColor=albedoFull;\nreturn;\n}\n\nvec3 normal=(texture2D(normalSampler,vUV)).xyz;\nvec3 position=(view*texture2D(positionSampler,vUV)).xyz;\nvec3 reflected=normalize(reflect(normalize(position),normalize(normal)));\nfloat roughness=1.0-texture2D(reflectivitySampler,vUV).a;\nvec3 jitt=mix(vec3(0.0),hash(position),roughness)*roughnessFactor;\nReflectionInfo info=getReflectionInfo(jitt+reflected,position);\n\nvec2 dCoords=smoothstep(0.2,0.6,abs(vec2(0.5,0.5)-info.coords.xy));\nfloat screenEdgefactor=clamp(1.0-(dCoords.x+dCoords.y),0.0,1.0);\n\nvec3 F0=vec3(0.04);\nF0=mix(F0,albedo,spec);\nvec3 fresnel=fresnelSchlick(max(dot(normalize(normal),normalize(position)),0.0),F0);\n\nfloat reflectionMultiplier=clamp(pow(spec*strength,reflectionSpecularFalloffExponent)*screenEdgefactor*reflected.z,0.0,0.9);\nfloat albedoMultiplier=1.0-reflectionMultiplier;\nvec3 SSR=info.color*fresnel;\ngl_FragColor=vec4((albedo*albedoMultiplier)+(SSR*reflectionMultiplier),albedoFull.a);\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n";var Je,$e=(Je=l.a,Object(r.d)(tt,Je),Object.defineProperty(tt.prototype,"enableSmoothReflections",{get:function(){return this._enableSmoothReflections},set:function(e){e!==this._enableSmoothReflections&&(this._enableSmoothReflections=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(tt.prototype,"reflectionSamples",{get:function(){return this._reflectionSamples},set:function(e){e!==this._reflectionSamples&&(this._reflectionSamples=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(tt.prototype,"smoothSteps",{get:function(){return this._smoothSteps},set:function(e){e!==this._smoothSteps&&(this._smoothSteps=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),tt.prototype._updateEffectDefines=function(){var e=[];this._geometryBufferRenderer&&e.push("#define SSR_SUPPORTED"),this._enableSmoothReflections&&e.push("#define ENABLE_SMOOTH_REFLECTIONS"),e.push("#define REFLECTION_SAMPLES "+(this._reflectionSamples>>0)),e.push("#define SMOOTH_STEPS "+(this._smoothSteps>>0)),this.updateEffect(e.join("\n"))},Object(r.c)([Object(Ee.c)()],tt.prototype,"threshold",void 0),Object(r.c)([Object(Ee.c)()],tt.prototype,"strength",void 0),Object(r.c)([Object(Ee.c)()],tt.prototype,"reflectionSpecularFalloffExponent",void 0),Object(r.c)([Object(Ee.c)()],tt.prototype,"step",void 0),Object(r.c)([Object(Ee.c)()],tt.prototype,"roughnessFactor",void 0),Object(r.c)([Object(Ee.c)()],tt.prototype,"enableSmoothReflections",null),Object(r.c)([Object(Ee.c)()],tt.prototype,"reflectionSamples",null),Object(r.c)([Object(Ee.c)()],tt.prototype,"smoothSteps",null),tt),et=(i(230),"uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=color;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nuniform sampler2D lensSampler;\nuniform float exposure;
1\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\ncolour*=exposure;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\ncolour+=colour*texture2D(lensSampler,vUV).rgb;\nvec4 finalColor=vec4(colour.rgb,1.0)+texture2D(otherSampler,vUV);\ngl_FragColor=finalColor;\n}\n#endif\n#if defined(VLS)\n#define PI 3.1415926535897932384626433832795\nuniform mat4 shadowViewProjection;\nuniform mat4 lightWorld;\nuniform vec3 cameraPosition;\nuniform vec3 sunDirection;\nuniform vec3 sunColor;\nuniform vec2 depthValues;\nuniform float scatteringCoefficient;\nuniform float scatteringPower;\nuniform sampler2D shadowMapSampler;\nuniform sampler2D positionSampler;\nfloat computeScattering(float lightDotView)\n{\nfloat result=1.0-scatteringCoefficient*scatteringCoefficient;\nresult/=(4.0*PI*pow(1.0+scatteringCoefficient*scatteringCoefficient-(2.0*scatteringCoefficient)*lightDotView,1.5));\nreturn result;\n}\nvoid main(void)\n{\n\nvec3 worldPos=texture2D(positionSampler,vUV).rgb;\nvec3 startPosition=cameraPosition;\nvec3 rayVector=worldPos-startPosition;\nfloat rayLength=length(rayVector);\nvec3 rayDirection=rayVector/rayLength;\nfloat stepLength=rayLength/NB_STEPS;\nvec3 stepL=rayDirection*stepLength;\nvec3 currentPosition=startPosition;\nvec3 accumFog=vec3(0.0);\nfor (int i=0; i<int(NB_STEPS); i++)\n{\nvec4 worldInShadowCameraSpace=shadowViewProjection*vec4(currentPosition,1.0);\nfloat depthMetric=(worldInShadowCameraSpace.z+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depthMetric,0.0,1.0);\nworldInShadowCameraSpace.xyz/=worldInShadowCameraSpace.w;\nworldInShadowCameraSpace.xyz=0.5*worldInShadowCameraSpace.xyz+vec3(0.5);\nfloat shadowMapValue=texture2D(shadowMapSampler,worldInShadowCameraSpace.xy).r;\nif (shadowMapValue>shadowPixelDepth)\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\ncurrentPosition+=stepL;\n}\naccumFog/=NB_STEPS;\nvec3 color=accumFog*scatteringPower;\ngl_FragColor=vec4(color*exp(color) ,1.0);\n}\n#endif\n#if defined(VLSMERGE)\nuniform sampler2D originalSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\n}\n#endif\n#if defined(LUMINANCE)\nuniform vec2 lumOffsets[4];\nvoid main()\n{\nfloat average=0.0;\nvec4 color=vec4(0.0);\nfloat maximum=-1e20;\nvec3 weight=vec3(0.299,0.587,0.114);\nfor (int i=0; i<4; i++)\n{\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\n\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\n\n#ifdef WEIGHTED_AVERAGE\nfloat GreyValue=dot(color.rgb,weight);\n#endif\n#ifdef BRIGHTNESS\nfloat GreyValue=max(color.r,max(color.g,color.b));\n#endif\n#ifdef HSL_COMPONENT\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\n#endif\n#ifdef MAGNITUDE\nfloat GreyValue=length(color.rgb);\n#endif\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(LUMINANCE_DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLER\n#include<packingFunctions>\n#endif\nvoid main()\n{\nvec4 color=vec4(0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++)\n{\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifdef FINAL_DOWN_SAMPLER\ngl_FragColor=pack(average);\n#else\ngl_FragColor=vec4(average,average,0.0,1.0);\n#endif\n}\n#endif\n#if defined(HDR)\nuniform sampler2D textureAdderSampler;\nuniform float averageLuminance;\nvoid main()\n{\nvec4 color=texture2D(textureAdderSampler,vUV);\n#ifndef AUTO_EXPOSURE\nvec4 adjustedColor=color/averageLuminance;\ncolor=adjustedColor;\ncolor.a=1.0;\n#endif\ngl_FragColor=color;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.
10\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i<GHOSTS; ++i)\n{\nvec2 offset=fract(uv+ghostDir*ghostIndice);\nfloat weight=length(vec2(0.5)-offset)/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,offset,normalize(ghostDir),distortion)*weight*strength;\nghostIndice+=1.0;\n}\nvec2 haloVec=normalize(ghostDir)*haloWidth;\nfloat weight=length(vec2(0.5)-fract(uv+haloVec))/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,fract(uv+haloVec),normalize(ghostDir),distortion)*weight*strength;\nresult*=texture2D(lensColorSampler,vec2(length(vec2(0.5)-uv)/length(vec2(0.5))));\ngl_FragColor=result;\n}\n#endif\n#if defined(LENS_FLARE_COMPOSE)\nuniform sampler2D otherSampler;\nuniform sampler2D lensDirtSampler;\nuniform sampler2D lensStarSampler;\nuniform mat4 lensStarMatrix;\nvoid main(void)\n{\nvec2 lensFlareCoords=(lensStarMatrix*vec4(vUV,1.0,1.0)).xy;\nvec4 lensMod=texture2D(lensDirtSampler,vUV);\nlensMod+=texture2D(lensStarSampler,vUV);\nvec4 result=texture2D(textureSampler,vUV)*lensMod;\ngl_FragColor=texture2D(otherSampler,vUV)+result;\n}\n#endif\n#if defined(DEPTH_OF_FIELD)\nuniform sampler2D otherSampler;\nuniform sampler2D depthSampler;\nuniform float distance;\nvoid main(void)\n{\nvec4 sharp=texture2D(otherSampler,vUV);\nvec4 blur=texture2D(textureSampler,vUV);\nfloat dist=clamp(texture2D(depthSampler,vUV).r*distance,0.0,1.0);\nfloat factor=0.0;\nif (dist<0.05)\nfactor=1.0;\nelse if (dist<0.1)\nfactor=20.0*(0.1-dist);\nelse if (dist<0.5)\nfactor=0.0;\nelse\nfactor=2.0*(dist-0.5);\nfactor=clamp(factor,0.0,0.90);\ngl_FragColor=mix(sharp,blur,factor);\n}\n#endif\n#if defined(MOTION_BLUR)\nuniform mat4 inverseViewProjection;\nuniform mat4 prevViewProjection;\nuniform vec2 screenSize;\nuniform float motionScale;\nuniform float motionStrength;\nuniform sampler2D depthSampler;\nvoid main(void)\n{\nvec2 texelSize=1.0/screenSize;\nfloat depth=texture2D(depthSampler,vUV).r;\nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);\ncpos=cpos*inverseViewProjection;\nvec4 ppos=cpos*prevViewProjection;\nppos.xyz/=ppos.w;\nppos.xy=ppos.xy*0.5+0.5;\nvec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint nSamples=int(clamp(speed,1.0,MAX_MOTION_SAMPLES));\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i<int(MAX_MOTION_SAMPLES); ++i) {\nif (i>=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\nresult+=texture2D(textureSampler,offset1);\n}\ngl_FragColor=result/float(nSamples);\n}\n#endif\n");function tt(e,a,t,i,n,r,o,s,c){void 0===s&&(s=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=Je.call(this,e,"screenSpaceReflection",["projection","view","threshold","reflectionSpecularFalloffExponent","strength","step","roughnessFactor"],["textureSampler","normalSampler","positionSampler","reflectivitySampler"],t,i,n,r,o,"#define SSR_SUPPORTED\n#define REFLECTION_SAMPLES 64\n#define SMOOTH_STEPS 5\n",s,void 0,null,c)||this;l.threshold=1.2,l.strength=1,l.reflectionSpecularFalloffExponent=3,l.step=1,l.roughnessFactor=.2,l._enableSmoothReflections=!1,l._reflectionSamples=64,l._smoothSteps=5;var u=a.enableGeometryBufferRenderer();return u&&u.isSupported&&(u.enablePosition=!0,u.enableReflectivity=!0,l._geometryBufferRenderer=u),l._updateEffectDefines(),l.onApply=function(e){var t,i,n,r,o;u&&(t=u.getTextureIndex(de.a.POSITION_TEXTURE_TYPE),i=u.getTextureIndex(de.a.REFLECTIVITY_TEXTURE_TYPE),e.setTexture("normalSampler",u.getGBuffer().textures[1]),e.setTexture("positionSampler",u.getGBuffer().textures[t]),e.setTexture("reflectivitySampler",u.getGBuffer().textures[i]),(n=a.activeCamera)&&(r=n.getViewMatrix(),o=n.getProjectionMatrix(),e.setMatrix("projection",o),e.setMatrix("view",r),e.setFloat("threshold",l.threshold),e.setFloat("reflectionSpecularFalloffExponent",l.reflectionSpecularFalloffExponent),e.setFloat("strength",l.strength),e.setFloat("step",l.step),e.setFloat("roughnessFactor",l.roughnessFactor)))},l}o.a.ShadersStore.standardPixelShader=et;var it,nt=(it=xe,Object(r.d)(rt,it),Object.defineProperty(rt.prototype,"exposure",{get:function(){return this._fixedExposure},set:function(e){this._fixedExposure=e,this._currentExposure=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"hdrAutoExposure",{get:function(){return this._hdrAutoExposure},set:function(e){var t;this._hdrAutoExposure=e,this.hdrPostProcess&&(t=["#define HDR"],e&&t.push("#define AUTO_EXPOSURE"),this.hdrPostProcess.updateEffect(t.join("\n")))},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"motionStrength",{get:function(){return this._motionStrength},set:function(e){this._motionStrength=e,this._isObjectBasedMotionBlur&&this.motionBlurPostProcess&&(this.motionBlurPostProcess.motionStrength=e)},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"objectBasedMotionBlur",{get:function(){return this._isObjectBasedMotionBlur},set:function(e){var t=this._isObjectBasedMotionBlur!==e;this._isObjectBasedMotionBlur=e,t&&this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"BloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"DepthOfFieldEnabled",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"LensFlareEnabled",{get:function(){return this._lensFlareEnabled},set:function(e){this._lensFlareEnabled!==e&&(this._lensFlareEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"HDREnabled",{get:function(){return this._hdrEnabled},set:function(e){this._hdrEnabled!==e&&(this._hdrEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"VLSEnabled",{get:function(){return this._vlsEnabled},set:function(e){if(this._vlsEnabled!==e){if(e&&!this._scene.enableGeometryBufferRenderer())return void M.a.Warn("Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline");this._vlsEnabled=e,this._buildPipeline()}},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"MotionBlurEnabled",{get:function(){return this._motionBlurEnabled},set:function(e){this._motionBlurEnabled!==e&&(this._motionBlurEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"screenSpaceReflectionsEnabled",{get:function(){return this._screenSpaceReflectionsEnabled},set:function(e){this._screenSpaceReflectionsEnabled!==e&&(this._screenSpaceReflectionsEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"volumetricLightStepsCount",{get:function(){return this._volumetricLightStepsCount},set:function(e){this.volumetricLightPostProcess&&this.volumetricLightPostProcess.updateEffect("#define VLS\n#define NB_STEPS "+e.toFixed(1)),this._volumetricLightStepsCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"motionBlurSamples",{get:function(){return this._motionBlurSamples},set:function(e){this.motionBlurPostProcess&&(this._isObjectBasedMotionBlur?this.motionBlurPostProcess.motionBlurSamples=e:this.motionBlurPostProcess.updateEffect("#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+e.toFixed(1))),this._motionBlurSamples=e},enumerable:!1,configurable:!0}),Object.defineProperty(rt.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!1,configurable:!0}),rt.prototype._buildPipeline=function(){var e=this,t=this._ratio,i=this._scene;this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._screenSpaceReflectionsEnabled&&(this.screenSpaceReflectionPostProcess=new $e("HDRPass",i,t,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,this._floatTextureType),this.screenSpaceReflectionPostProcess.onApplyObservable.add(function(){e._currentDepthOfFieldSource=e.screenSpaceReflectionPostProcess}),this.addEffect(new u(i.getEngine(),"HDRScreenSpaceReflections",function(){return e.screenSpaceReflectionPostProcess},!0))),this._basePostProcess?this.originalPostProcess=this._basePostProcess:this.originalPostProcess=new l.a("HDRPass","standard",[],[],t,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",this._floatTextureType),this.originalPostProcess.autoClear=!this.screenSpaceReflectionPostProcess,this.originalPostProcess.onApplyObservable.add(function(){e._currentDepthOfFieldSource=e.originalPostProcess}),this.addEffect(new u(i.getEngine(),"HDRPassPostProcess",function(){return e.originalPostProcess},!0)),this._bloomEnabled&&(this._createDownSampleX4PostProcess(i,t/4),this._createBrightPassPostProcess(i,t/4),this._createBlurPostProcesses(i,t/4,1),this._createTextureAdderPostProcess(i,t),this.textureAdderFinalPostProcess=new l.a("HDRDepthOfFieldSource","standard",[],[],t,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(i.getEngine(),"HDRBaseDepthOfFieldSource",function(){return e.textureAdderFinalPostProcess}
1,!0))),this._vlsEnabled&&(this._createVolumetricLightPostProcess(i,t),this.volumetricLightFinalPostProcess=new l.a("HDRVLSFinal","standard",[],[],t,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(i.getEngine(),"HDRVLSFinal",function(){return e.volumetricLightFinalPostProcess},!0))),this._lensFlareEnabled&&(this._createLensFlarePostProcess(i,t),this.lensFlareFinalPostProcess=new l.a("HDRPostLensFlareDepthOfFieldSource","standard",[],[],t,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(i.getEngine(),"HDRPostLensFlareDepthOfFieldSource",function(){return e.lensFlareFinalPostProcess},!0))),this._hdrEnabled&&(this._createLuminancePostProcesses(i,this._floatTextureType),this._createHdrPostProcess(i,t),this.hdrFinalPostProcess=new l.a("HDRPostHDReDepthOfFieldSource","standard",[],[],t,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(i.getEngine(),"HDRPostHDReDepthOfFieldSource",function(){return e.hdrFinalPostProcess},!0))),this._depthOfFieldEnabled&&(this._createBlurPostProcesses(i,t/2,3,"depthOfFieldBlurWidth"),this._createDepthOfFieldPostProcess(i,t)),this._motionBlurEnabled&&this._createMotionBlurPostProcess(i,t),this._fxaaEnabled&&(this.fxaaPostProcess=new re.a("fxaa",1,null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(i.getEngine(),"HDRFxaa",function(){return e.fxaaPostProcess},!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),!this._enableMSAAOnFirstPostProcess(this._samples)&&1<this._samples&&M.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")},rt.prototype._createDownSampleX4PostProcess=function(e,t){var a=this,s=new Array(32);this.downSampleX4PostProcess=new l.a("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",this._floatTextureType),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,i=a.downSampleX4PostProcess.width,n=a.downSampleX4PostProcess.height,r=-2;r<2;r++)for(var o=-2;o<2;o++)s[t]=(r+.5)*(1/i),s[t+1]=(o+.5)*(1/n),t+=2;e.setArray2("dsOffsets",s)},this.addEffect(new u(e.getEngine(),"HDRDownSampleX4",function(){return a.downSampleX4PostProcess},!0))},rt.prototype._createBrightPassPostProcess=function(e,t){var n=this,r=new Array(8);this.brightPassPostProcess=new l.a("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",this._floatTextureType),this.brightPassPostProcess.onApply=function(e){var t=1/n.brightPassPostProcess.width,i=1/n.brightPassPostProcess.height;r[0]=-.5*t,r[1]=.5*i,r[2]=.5*t,r[3]=.5*i,r[4]=-.5*t,r[5]=-.5*i,r[6]=.5*t,r[7]=-.5*i,e.setArray2("dsOffsets",r),e.setFloat("brightThreshold",n.brightThreshold)},this.addEffect(new u(e.getEngine(),"HDRBrightPass",function(){return n.brightPassPostProcess},!0))},rt.prototype._createBlurPostProcesses=function(e,t,i,n){var r=this;void 0===n&&(n="blurWidth");var o=e.getEngine(),a=new v.a("HDRBlurH_"+i,new S.d(1,0),this[n],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType),s=new v.a("HDRBlurV_"+i,new S.d(0,1),this[n],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType);a.onActivateObservable.add(function(){var e=a.width/o.getRenderWidth();a.kernel=r[n]*e}),s.onActivateObservable.add(function(){var e=s.height/o.getRenderHeight();s.kernel=r.horizontalBlur?64*e:r[n]*e}),this.addEffect(new u(e.getEngine(),"HDRBlurH"+i,function(){return a},!0)),this.addEffect(new u(e.getEngine(),"HDRBlurV"+i,function(){return s},!0)),this.blurHPostProcesses.push(a),this.blurVPostProcesses.push(s)},rt.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new l.a("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",this._floatTextureType),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._vlsEnabled?
1i._currentDepthOfFieldSource:i.originalPostProcess),e.setTexture("lensSampler",i.lensTexture),e.setFloat("exposure",i._currentExposure),i._currentDepthOfFieldSource=i.textureAdderFinalPostProcess},this.addEffect(new u(e.getEngine(),"HDRTextureAdder",function(){return i.textureAdderPostProcess},!0))},rt.prototype._createVolumetricLightPostProcess=function(e,t){var i=this,n=e.enableGeometryBufferRenderer();n.enablePosition=!0;var r=n.getGBuffer();this.volumetricLightPostProcess=new l.a("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var o=S.d.Zero();this.volumetricLightPostProcess.onApply=function(e){var t;i.sourceLight&&i.sourceLight.getShadowGenerator()&&i._scene.activeCamera&&(t=i.sourceLight.getShadowGenerator(),e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",r.textures[2]),e.setColor3("sunColor",i.sourceLight.diffuse),e.setVector3("sunDirection",i.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",i._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",i.volumetricLightCoefficient),e.setFloat("scatteringPower",i.volumetricLightPower),o.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),o.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2("depthValues",o))},this.addEffect(new u(e.getEngine(),"HDRVLS",function(){return i.volumetricLightPostProcess},!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new l.a("HDRVLSMerge","standard",[],["originalSampler"],t,null,A.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 u(e.getEngine(),"HDRVLSMerge",function(){return i.volumetricLightMergePostProces},!0))},rt.prototype._createLuminancePostProcesses=function(i,e){var s=this,t=Math.pow(3,rt.LuminanceSteps);this.luminancePostProcess=new l.a("HDRLuminance","standard",["lumOffsets"],[],{width:t,height:t},null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define LUMINANCE",e);var n=[];this.luminancePostProcess.onApply=function(e){var t=1/s.luminancePostProcess.width,i=1/s.luminancePostProcess.height;n[0]=-.5*t,n[1]=.5*i,n[2]=.5*t,n[3]=.5*i,n[4]=-.5*t,n[5]=-.5*i,n[6]=.5*t,n[7]=-.5*i,e.setArray2("lumOffsets",n)},this.addEffect(new u(i.getEngine(),"HDRLuminance",function(){return s.luminancePostProcess},!0));for(var r=rt.LuminanceSteps-1;0<=r;r--){t=Math.pow(3,r);var o="#define LUMINANCE_DOWN_SAMPLE\n";0===r&&(o+="#define FINAL_DOWN_SAMPLER");var a=new l.a("HDRLuminanceDownSample"+r,"standard",["dsOffsets","halfDestPixelSize"],[],{width:t,height:t},null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,o,e);this.luminanceDownSamplePostProcesses.push(a)}var c=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach(function(r,o){var a=new Array(18);r.onApply=function(e){if(c){for(var t=0,i=-1;i<2;i++)for(var n=-1;n<2;n++)a[t]=i/c.width,a[t+1]=n/c.height,t+=2;e.setArray2("dsOffsets",a),e.setFloat("halfDestPixelSize",.5/c.width),c=o===s.luminanceDownSamplePostProcesses.length-1?s.luminancePostProcess:r}},o===s.luminanceDownSamplePostProcesses.length-1&&(r.onAfterRender=function(){var e=i.getEngine().readPixels(0,0,1,1),t=new S.f(1/16581375,1/65025,1/255,1);s._hdrCurrentLuminance=(e[0]*t.x+e[1]*t.y+e[2]*t.z+e[3]*t.w)/100}),s.addEffect(new u(i.getEngine(),"HDRLuminanceDownSample"+o,function(){return r},!0))})},rt.prototype._createHdrPostProcess=function(i,e){var n=this,t=["#define HDR"];this._hdrAutoExposure&&t.push("#define AUTO_EXPOSURE"),this.hdrPostProcess=new l.a("HDR","standard",["averageLuminance"],["textureAdderSampler"],e,
1null,A.a.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,t.join("\n"),f.a.TEXTURETYPE_UNSIGNED_INT);var r=1,o=0,a=0;this.hdrPostProcess.onApply=function(e){var t;e.setTextureFromPostProcess("textureAdderSampler",n._currentDepthOfFieldSource),o+=i.getEngine().getDeltaTime(),r<0?r=n._hdrCurrentLuminance:(t=(a-o)/1e3,n._hdrCurrentLuminance<r+n.hdrDecreaseRate*t?r+=n.hdrDecreaseRate*t:n._hdrCurrentLuminance>r-n.hdrIncreaseRate*t?r-=n.hdrIncreaseRate*t:r=n._hdrCurrentLuminance),n.hdrAutoExposure?n._currentExposure=n._fixedExposure/r:(r=qe.a.Clamp(r,n.hdrMinimumLuminance,1e20),e.setFloat("averageLuminance",r)),a=o,n._currentDepthOfFieldSource=n.hdrFinalPostProcess},this.addEffect(new u(i.getEngine(),"HDR",function(){return n.hdrPostProcess},!0))},rt.prototype._createLensFlarePostProcess=function(e,t){var a=this;this.lensFlarePostProcess=new l.a("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(e.getEngine(),"HDRLensFlare",function(){return a.lensFlarePostProcess},!0)),this._createBlurPostProcesses(e,t/4,2,"lensFlareBlurWidth"),this.lensFlareComposePostProcess=new l.a("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",f.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new u(e.getEngine(),"HDRLensFlareCompose",function(){return a.lensFlareComposePostProcess},!0));var i=new S.d(0,0);this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess("textureSampler",a._bloomEnabled?a.blurHPostProcesses[0]:a.originalPostProcess),e.setTexture("lensColorSampler",a.lensColorTexture),e.setFloat("strength",a.lensFlareStrength),e.setFloat("ghostDispersal",a.lensFlareGhostDispersal),e.setFloat("haloWidth",a.lensFlareHaloWidth),i.x=a.lensFlarePostProcess.width,i.y=a.lensFlarePostProcess.height,e.setVector2("resolution",i),e.setFloat("distortionStrength",a.lensFlareDistortionStrength)};var s=S.a.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),c=S.a.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){var t,i,n,r,o;a._scene.activeCamera&&(e.setTextureFromPostProcess("otherSampler",a.lensFlarePostProcess),e.setTexture("lensDirtSampler",a.lensFlareDirtTexture),e.setTexture("lensStarSampler",a.lensStarTexture),t=a._scene.activeCamera.getViewMatrix().getRow(0),i=a._scene.activeCamera.getViewMatrix().getRow(2),n=S.e.Dot(t.toVector3(),new S.e(1,0,0))+S.e.Dot(i.toVector3(),new S.e(0,0,1)),n*=4,r=S.a.FromValues(.5*Math.cos(n),-Math.sin(n),0,0,Math.sin(n),.5*Math.cos(n),0,0,0,0,1,0,0,0,0,1),o=c.multiply(r).multiply(s),e.setMatrix("lensStarMatrix",o),a._currentDepthOfFieldSource=a.lensFlareFinalPostProcess)}},rt.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new l.a("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,A.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",f.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 u(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},rt.prototype._createMotionBlurPostProcess=function(t,e){var i,n,r,o,a,s,c=this;this._isObjectBasedMotionBlur?((i=new _e("HDRMotionBlur",t,e,null,A.a.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,f.a.TEXTURETYPE_UNSIGNED_INT)).motionStrength=this.motionStrength,i.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=i):(this.motionBlurPostProcess=new l.a("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],e,null,A.a.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),f.a.TEXTURETYPE_UNSIGNED_INT),n=0,r=S.a.Identity(),o=S.a.Identity(),a=S.a.Identity(),s=S.d.Zero(),this.motionBlurPostProcess.onApply=function(e){(a=t.getProjectionMatrix().multiply(t.getViewMatrix())).invertToRef(o),e.setMatr
1ix("inverseViewProjection",o),e.setMatrix("prevViewProjection",r),r=a,s.x=c.motionBlurPostProcess.width,s.y=c.motionBlurPostProcess.height,e.setVector2("screenSize",s),n=t.getEngine().getFps()/60,e.setFloat("motionScale",n),e.setFloat("motionStrength",c.motionStrength),e.setTexture("depthSampler",c._getDepthTexture())}),this.addEffect(new u(t.getEngine(),"HDRMotionBlur",function(){return c.motionBlurPostProcess},!0))},rt.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},rt.prototype._disposePostProcesses=function(){for(var e=0;e<this._cameras.length;e++){var t=this._cameras[e];this.originalPostProcess&&this.originalPostProcess.dispose(t),this.screenSpaceReflectionPostProcess&&this.screenSpaceReflectionPostProcess.dispose(t),this.downSampleX4PostProcess&&this.downSampleX4PostProcess.dispose(t),this.brightPassPostProcess&&this.brightPassPostProcess.dispose(t),this.textureAdderPostProcess&&this.textureAdderPostProcess.dispose(t),this.volumetricLightPostProcess&&this.volumetricLightPostProcess.dispose(t),this.volumetricLightSmoothXPostProcess&&this.volumetricLightSmoothXPostProcess.dispose(t),this.volumetricLightSmoothYPostProcess&&this.volumetricLightSmoothYPostProcess.dispose(t),this.volumetricLightMergePostProces&&this.volumetricLightMergePostProces.dispose(t),this.volumetricLightFinalPostProcess&&this.volumetricLightFinalPostProcess.dispose(t),this.lensFlarePostProcess&&this.lensFlarePostProcess.dispose(t),this.lensFlareComposePostProcess&&this.lensFlareComposePostProcess.dispose(t);for(var i=0;i<this.luminanceDownSamplePostProcesses.length;i++)this.luminanceDownSamplePostProcesses[i].dispose(t);for(this.luminancePostProcess&&this.luminancePostProcess.dispose(t),this.hdrPostProcess&&this.hdrPostProcess.dispose(t),this.hdrFinalPostProcess&&this.hdrFinalPostProcess.dispose(t),this.depthOfFieldPostProcess&&this.depthOfFieldPostProcess.dispose(t),this.motionBlurPostProcess&&this.motionBlurPostProcess.dispose(t),this.fxaaPostProcess&&this.fxaaPostProcess.dispose(t),i=0;i<this.blurHPostProcesses.length;i++)this.blurHPostProcesses[i].dispose(t);for(i=0;i<this.blurVPostProcesses.length;i++)this.blurVPostProcesses[i].dispose(t)}this.originalPostProcess=null,this.downSampleX4PostProcess=null,this.brightPassPostProcess=null,this.textureAdderPostProcess=null,this.textureAdderFinalPostProcess=null,this.volumetricLightPostProcess=null,this.volumetricLightSmoothXPostProcess=null,this.volumetricLightSmoothYPostProcess=null,this.volumetricLightMergePostProces=null,this.volumetricLightFinalPostProcess=null,this.lensFlarePostProcess=null,this.lensFlareComposePostProcess=null,this.luminancePostProcess=null,this.hdrPostProcess=null,this.hdrFinalPostProcess=null,this.depthOfFieldPostProcess=null,this.motionBlurPostProcess=null,this.fxaaPostProcess=null,this.screenSpaceReflectionPostProcess=null,this.luminanceDownSamplePostProcesses=[],this.blurHPostProcesses=[],this.blurVPostProcesses=[]},rt.prototype.dispose=function(){this._disposePostProcesses(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),it.prototype.dispose.call(this)},rt.prototype.serialize=function(){var e=Ee.a.Serialize(this);return this.sourceLight&&(e.sourceLightId=this.sourceLight.id),this.screenSpaceReflectionPostProcess&&(e.screenSpaceReflectionPostProcess=Ee.a.Serialize(this.screenSpaceReflectionPostProcess)),e.customType="StandardRenderingPipeline",e},rt.Parse=function(e,t,i){var n=Ee.a.Parse(function(){return new rt(e._name,t,e._ratio)},e,t,i);return e.sourceLightId&&(n.sourceLight=t.getLightByID(e.sourceLightId)),e.screenSpaceReflectionPostProcess&&Ee.a.Parse(function(){return n.screenSpaceReflectionPostProcess},e.screenSpaceReflectionPostProcess,t,i),n},rt.LuminanceSteps=6,Object(r.c)([Object(Ee.c)()],rt.prototype,"brightThreshold",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"blurWidth",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"horizontalBlur",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"exposure",null),Object(r.c)([Object(Ee.m)("lensTexture")],rt.prototype,"lensTexture",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"volumetricLightCoefficient",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"volumetricLightPower",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"volumetricLightBlurScale",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"hdrMinimumLuminance",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"hdrDecreaseRate",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"hdrIncreaseRate",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"hdrAutoExposure",null),Object(r.c)([Object(Ee.m)("lensColorTexture")],rt.prototype,"lensColorTexture",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"lensFlareStrength",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"lensFlareGhostDispersal",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"lensFlareHaloWidth",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"lensFlareDistortionStrength",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"lensFlareBlurWidth",void 0),Object(r.c)([Object(Ee.m)("lensStarTexture")],rt.prototype,"lensStarTexture",void 0),Object(r.c)([Object(Ee.m)("lensFlareDirtTexture")],rt.prototype,"lensFlareDirtTexture",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"depthOfFieldDistance",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"depthOfFieldBlurWidth",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"motionStrength",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"objectBasedMotionBlur",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"_ratio",void 0),Object(r.c)([Object(Ee.c)()],rt.prototype,"BloomEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"DepthOfFieldEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"LensFlareEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"HDREnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"VLSEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"MotionBlurEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"fxaaEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"screenSpaceReflectionsEnabled",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"volumetricLightStepsCount",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"motionBlurSamples",null),Object(r.c)([Object(Ee.c)()],rt.prototype,"samples",null),rt);function rt(e,t,i,n,r){void 0===n&&(n=null);var o=it.call(this,t.getEngine(),e)||this;return o.downSampleX4PostProcess=null,o.brightPassPostProcess=null,o.blurHPostProcesses=[],o.blurVPostProcesses=[],o.textureAdderPostProcess=null,o.volumetricLightPostProcess=null,o.volumetricLightSmoothXPostProcess=null,o.volumetricLightSmoothYPostProcess=null,o.volumetricLightMergePostProces=null,o.volumetricLightFinalPostProcess=null,o.luminancePostProcess=null,o.luminanceDownSamplePostProcesses=[],o.hdrPostProcess=null,o.textureAdderFinalPostProcess=null,o.lensFlareFinalPostProcess=null,o.hdrFinalPostProcess=null,o.lensFlarePostProcess=null,o.lensFlareComposePostProcess=null,o.motionBlurPostProcess=null,o.depthOfFieldPostProcess=null,o.fxaaPostProcess=null,o.screenSpaceReflectionPostProcess=null,o.brightThreshold=1,o.blurWidth=512,o.horizontalBlur=!1,o.lensTexture=null,o.volumetricLightCoefficient=.2,o.volumetricLightPower=4,o.volumetricLightBlurScale=64,o.sourceLight=null,o.hdrMinimumLuminance=1,o.hdrDecreaseRate=.5,o.hdrIncreaseRate=.5,o.lensColorTexture=null,o.lensFlareStrength=20,o.lensFlareGhostDispersal=1.4,o.lensFlareHaloWidth=.7,o.lensFlareDistortionStrength=16,o.lensFlareBlurWidth=512,o.lensStarTexture=null,o.lensFlareDirtTexture=null,o.depthOfFieldDistance=10,o.depthOfFieldBlurWidth=64,o.animations=[],o._currentDepthOfFieldSource=null,o._fixedExposure=1,o._currentExposure=1,o._hdrAutoExposure=!1,o._hdrCurrentLuminance=1,o._motionStrength=1,o._isObjectBasedMotionBlur=!1,o._camerasToBeAttached=[],o._bloomEnabled=!1,o._depthOfFieldEnabled=!1,o._vlsEnabled=!1,o._lensFlareEnabled=!1,o._hdrEnabled=!1,o._motionBlurEnabled=!1,o._fxaaEnabled=!1,o._screenSpaceReflectionsEnabled=!1,o._motionBlurSamples=64,o._volumetricLightStepsCount=50,o._samples=1,o._cameras=r||t.cameras,o._cameras=o._cameras.slice(),o._camerasToBeAttached=o._cameras.slice(),o._scene=t,o._basePostProcess=n,o._ratio=i,o._floatTextureType=t.getEngine().getCaps().textureFloatRen
1der?f.a.TEXTURETYPE_FLOAT:f.a.TEXTURETYPE_HALF_FLOAT,t.postProcessRenderPipelineManager.addPipeline(o),o._buildPipeline(),o}Re.a.RegisteredTypes["BABYLON.StandardRenderingPipeline"]=nt;o.a.ShadersStore.stereoscopicInterlacePixelShader="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 useCamA;\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\nuseCamA=!useCamB;\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\n#ifdef IS_STEREOSCOPIC_INTERLACED\nfloat rowNum=floor(vUV.y/stepSize.y);\nuseCamA=mod(rowNum,2.0) == 1.0;\nuseCamB=mod(rowNum,2.0) == 0.0;\ntexCoord1=vec2(vUV.x,vUV.y);\ntexCoord2=vec2(vUV.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\nuseCamA=!useCamB;\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#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else if (useCamA){\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}else {\ndiscard;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}\n";var ot,at,st,ct,lt=(at=l.a,Object(r.d)(dt,at),dt),ut=(ot=l.a,Object(r.d)(ht,ot),ht);function ht(e,t,i,n,r,o){var a=ot.call(this,e,"stereoscopicInterlace",["stepSize"],["camASampler"],1,t[1],n,r,o,i?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return a._passedProcess=t[0]._rigPostProcess,a._stepSize=new S.d(1/a.width,1/a.height),a.onSizeChangedObservable.add(function(){a._stepSize=new S.d(1/a.width,1/a.height)}),a.onApplyObservable.add(function(e){e.setTextureFromPostProcess("camASampler",a._passedProcess),e.setFloat2("stepSize",a._stepSize.x,a._stepSize.y)}),a}function dt(e,t,i,n,r,o,a){var s=at.call(this,e,"stereoscopicInterlace",["stepSize"],["camASampler"],1,t[1],r,o,a,n?"#define IS_STEREOSCOPIC_INTERLACED 1":i?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return s._passedProcess=t[0]._rigPostProcess,s._stepSize=new S.d(1/s.width,1/s.height),s.onSizeChangedObservable.add(function(){s._stepSize=new S.d(1/s.width,1/s.height)}),s.onApplyObservable.add(function(e){e.setTextureFromPostProcess("camASampler",s._passedProcess),e.setFloat2("stepSize",s._stepSize.x,s._stepSize.y)}),s}o.a.ShadersStore.tonemapPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb);\nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm);\ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}",(ct=st=st||{})[ct.Hable=0]="Hable",ct[ct.Reinhard=1]="Reinhard",ct[ct.HejiDawson=2]="HejiDawson",ct[ct.Photographic=3]="Photographic";var pt,ft=(pt=l.a,Object(r.d)(St,pt),St),mt=i(4),_t=i(28),gt=i(8),vt=i(29),bt=i(15),yt=i(35),Tt=i(39),Et=(i(115),i(351),"uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\nvoid main(void) {\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i<NUM_SAMPLES;
1 i++) {\ntc-=deltaTexCoord;\nvec4 dataSample=texture2D(lightScatteringSampler,tc)*0.4;\ndataSample*=illuminationDecay*weight;\ncolor+=dataSample;\nilluminationDecay*=decay;\n}\nvec4 realColor=texture2D(textureSampler,vUV);\ngl_FragColor=((vec4((vec3(color.r,color.g,color.b)*exposure),1))+(realColor*(1.5-0.4)));\n}\n");function St(e,t,i,n,r,o,a){void 0===r&&(r=f.a.TEXTURE_BILINEAR_SAMPLINGMODE),void 0===a&&(a=f.a.TEXTURETYPE_UNSIGNED_INT);var s=pt.call(this,e,"tonemap",["_ExposureAdjustment"],null,1,n,r,o,!0,null,a)||this;s._operator=t,s.exposureAdjustment=i;var c="#define ";return s._operator===st.Hable?c+="HABLE_TONEMAPPING":s._operator===st.Reinhard?c+="REINHARD_TONEMAPPING":s._operator===st.HejiDawson?c+="OPTIMIZED_HEJIDAWSON_TONEMAPPING":s._operator===st.Photographic&&(c+="PHOTOGRAPHIC_TONEMAPPING"),s.updateEffect(c),s.onApply=function(e){e.setFloat("_ExposureAdjustment",s.exposureAdjustment)},s}o.a.ShadersStore.volumetricLightScatteringPixelShader=Et,i(107),i(131),i(132),i(108),i(145),i(109),i(110);o.a.ShadersStore.volumetricLightScatteringPassVertexShader="\nattribute vec3 position;\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#if (defined(ALPHATEST) || defined(NEED_UV)) && defined(UV1)\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n";o.a.ShadersStore.volumetricLightScatteringPassPixelShader="#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\n#endif\n#if defined(ALPHATEST)\nuniform sampler2D diffuseSampler;\n#endif\nvoid main(void)\n{\n#if defined(ALPHATEST)\nvec4 diffuseColor=texture2D(diffuseSampler,vUV);\nif (diffuseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\n}\n";var At,Ct=i(10),Pt=i(77),xt=(At=l.a,Object(r.d)(Mt,At),Object.defineProperty(Mt.prototype,"useDiffuseColor",{get:function(){return M.a.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead"),!1},set:function(e){M.a.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead")},enumerable:!1,configurable:!0}),Mt.prototype.getClassName=function(){return"VolumetricLightScatteringPostProcess"},Mt.prototype._isReady=function(e,t){var i=e.getMesh();if(i===this.mesh&&i.material)return i.material.isReady(i);var n=[],r=[mt.b.PositionKind],o=e.getMaterial();o&&(o.needAlphaTesting()&&n.push("#define ALPHATEST"),i.isVerticesDataPresent(mt.b.UVKind)&&(r.push(mt.b.UVKind),n.push("#define UV1")),i.isVerticesDataPresent(mt.b.UV2Kind)&&(r.push(mt.b.UV2Kind),n.push("#define UV2"))),i.useBones&&i.computeBonesUsingShaders?(r.push(mt.b.MatricesIndicesKind),r.push(mt.b.MatricesWeightsKind),n.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),n.push("#define BonesPerMesh "+(i.skeleton?i.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0"),t&&(n.push("#define INSTANCES"),bt.a.PushAttributesForInstances(r),e.getRenderingMesh().hasThinInstances&&n.push("#define THIN_INSTANCES"));var a=n.join("\n");return this._cachedDefines!==a&&(this._cachedDefines=a,this._volumetricLightScatteringPass=i.getScene().getEngine().createEffect("volumetricLightScatteringPass",r,["world","mBones","viewProjection","diffuseMatrix"],["diffuseSampler"],a,void 0,void 0,void 0,{maxSimultaneousMorphTargets:i.numBoneInfluencers})),this._volumetricLightScatteringPass.isReady()},Mt.prototype.setCustomMeshPosition=function(e){this.customMeshPosition=e},Mt.prototype.getCustomMeshPosition=function(){return this.customMeshPosition},Mt.prototype.dispose=function(e){var t=e.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);
1-1!==t&&e.getScene().customRenderTargets.splice(t,1),this._volumetricLightScatteringRTT.dispose(),At.prototype.dispose.call(this,e)},Mt.prototype.getPass=function(){return this._volumetricLightScatteringRTT},Mt.prototype._meshExcluded=function(e){return 0<this.excludedMeshes.length&&-1!==this.excludedMeshes.indexOf(e)},Mt.prototype._createPass=function(l,e){var u=this,t=l.getEngine();this._volumetricLightScatteringRTT=new Tt.a("volumetricLightScatteringMap",{width:t.getRenderWidth()*e,height:t.getRenderHeight()*e},l,!1,!0,f.a.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=A.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=A.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;var i=this.getCamera();function h(e){var t,i,n,r,o,a,s,c=e.getRenderingMesh(),l=e.getEffectiveMesh();u._meshExcluded(c)||(l._internalAbstractMeshDataInfo._isActiveIntermediate=!1,(t=e.getMaterial())&&((n=(i=c.getScene()).getEngine()).setState(t.backFaceCulling),(r=c._getInstancesRenderList(e._id,!!e.getReplacementMesh())).mustReturn||(o=n.getCaps().instancedArrays&&(null!==r.visibleInstances[e._id]||c.hasThinInstances),u._isReady(e,o)&&(a=u._volumetricLightScatteringPass,c===u.mesh&&(a=e.effect?e.effect:t.getEffect()),n.enableEffect(a),c._bind(e,a,t.fillMode),c===u.mesh?t.bind(l.getWorldMatrix(),c):(u._volumetricLightScatteringPass.setMatrix("viewProjection",i.getTransformMatrix()),t&&t.needAlphaTesting()&&(s=t.getAlphaTestTexture(),u._volumetricLightScatteringPass.setTexture("diffuseSampler",s),s&&u._volumetricLightScatteringPass.setMatrix("diffuseMatrix",s.getTextureMatrix())),c.useBones&&c.computeBonesUsingShaders&&c.skeleton&&u._volumetricLightScatteringPass.setMatrices("mBones",c.skeleton.getTransformMatrices(c))),c._processRendering(l,e,u._volumetricLightScatteringPass,vt.a.TriangleFillMode,r,o,function(e,t){return a.setMatrix("world",t)})))))}i?i.customRenderTargets.push(this._volumetricLightScatteringRTT):l.customRenderTargets.push(this._volumetricLightScatteringRTT);var n,r=new Ct.b(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function(){n=l.clearColor,l.clearColor=r}),this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function(){l.clearColor=n}),this._volumetricLightScatteringRTT.customRenderFunction=function(e,t,i,n){var r,o=l.getEngine();if(n.length){for(o.setColorWrite(!1),r=0;r<n.length;r++)h(n.data[r]);o.setColorWrite(!0)}for(r=0;r<e.length;r++)h(e.data[r]);for(r=0;r<t.length;r++)h(t.data[r]);if(i.length){for(r=0;r<i.length;r++){var a=i.data[r],s=a.getBoundingInfo();s&&l.activeCamera&&(a._alphaIndex=a.getMesh().alphaIndex,a._distanceToCamera=s.boundingSphere.centerWorld.subtract(l.activeCamera.position).length())}var c=i.data.slice(0,i.length);for(c.sort(function(e,t){return e._alphaIndex>t._alphaIndex?1:e._alphaIndex<t._alphaIndex?-1:e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0}),o.setAlphaMode(f.a.ALPHA_COMBINE),r=0;r<c.length;r++)h(c[r]);o.setAlphaMode(f.a.ALPHA_DISABLE)}}},Mt.prototype._updateMeshScreenCoordinates=function(e){var t=e.getTransformMatrix(),i=this.useCustomMeshPosition?this.customMeshPosition:this.attachedNode?this.attachedNode.position:this.mesh.parent?this.mesh.getAbsolutePosition():this.mesh.position,n=S.e.Project(i,S.a.Identity(),t,this._viewPort);this._screenCoordinates.x=n.x/this._viewPort.width,this._screenCoordinates.y=n.y/this._viewPort.height,this.invert&&(this._screenCoordinates.y=1-this._screenCoordinates.y)},Mt.CreateDefaultMesh=function(e,t){var i=gt.a.CreatePlane(e,1,t);i.billboardMode=_t.a.BILLBOARDMODE_ALL;var n=new yt.a(e+"Material",t);return n.emissiveColor=new Ct.a(1,1,1),i.material=n,i},Object(r.c)([Object(Ee.o)()],Mt.prototype,"customMeshPosition",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"useCustomMeshPosition",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"invert",void 0),Object(r.c)([Object(Ee.k)()],Mt.prototype,"mesh",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"excludedMeshes",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"exposure",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"decay",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"weight",void 0),Object(r.c)([Object(Ee.c)()],Mt.prototype,"density",void 0),Mt),Rt=i(214),Ot=i(189);function Mt(e,t,i,n,r,o,a,s,c){void 0===r&&(r=100),void 0===o&&(o=A.a.BILINEAR_SAMPLINGMODE);var l=At.call(this,e,"volumetricLightScattering",["decay","exposure","weight","meshPositionOnScreen","density"],["lightScatteringSampler"],t.postProcessRatio||t,i,o,a,s,"#define NUM_SAMPLES "+r)||this;return l._screenCoordinates=S.d.Zero(),l.customMeshPosition=S.e.Zero(),l.useCustomMeshPosition=!1,l.invert=!0,l.excludedMeshes=new Array,l.exposure=.3,l.decay=.96815,l.weight=.58767,l.density=.926,a=(c=null===i?c:i.getScene()).getEngine(),l._viewPort=new Pt.a(0,0,1,1).toGlobal(a.getRenderWidth(),a.getRenderHeight()),l.mesh=null!==n?n:Mt.CreateDefaultMesh("VolumetricLightScatteringMesh",c),l._createPass(c,t.passRatio||t),l.onActivate=function(e){l.isSupported||l.dispose(e),l.onActivate=null},l.onApplyObservable.add(function(e){l._updateMeshScreenCoordinates(c),e.setTexture("lightScatteringSampler",l._volumetricLightScatteringRTT),e.setFloat("exposure",l.exposure),e.setFloat("decay",l.decay),e.setFloat("weight",l.weight),e.setFloat("density",l.density),e.setVector2("meshPositionOnScreen",l._screenCoordinates)}),l}o.a.ShadersStore.screenSpaceCurvaturePixelShader="\n\nprecision highp float;\n\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D normalSampler;\nuniform float curvature_ridge;\nuniform float curvature_valley;\n#ifndef CURVATURE_OFFSET\n#define CURVATURE_OFFSET 1\n#endif\nfloat curvature_soft_clamp(float curvature,float control)\n{\nif (curvature<0.5/control)\nreturn curvature*(1.0-curvature*control);\nreturn 0.25/control;\n}\nfloat calculate_curvature(ivec2 texel,float ridge,float valley)\n{\nvec2 normal_up=texelFetchOffset(normalSampler,texel,0,ivec2(0,CURVATURE_OFFSET)).rb;\nvec2 normal_down=texelFetchOffset(normalSampler,texel,0,ivec2(0,-CURVATURE_OFFSET)).rb;\nvec2 normal_left=texelFetchOffset(normalSampler,texel,0,ivec2(-CURVATURE_OFFSET,0)).rb;\nvec2 normal_right=texelFetchOffset(normalSampler,texel,0,ivec2( CURVATURE_OFFSET,0)).rb;\nfloat normal_diff=((normal_up.g-normal_down.g)+(normal_right.r-normal_left.r));\nif (normal_diff<0.0)\nreturn -2.0*curvature_soft_clamp(-normal_diff,valley);\nreturn 2.0*curvature_soft_clamp(normal_diff,ridge);\n}\nvoid main(void)\n{\nivec2 texel=ivec2(gl_FragCoord.xy);\nvec4 baseColor=texture2D(textureSampler,vUV);\nfloat curvature=calculate_curvature(texel,curvature_ridge,curvature_valley);\nbaseColor.rgb*=curvature+1.0;\ngl_FragColor=baseColor;\n}";var It,Dt=(It=l.a,Object(r.d)(Lt,It),Object.defineProperty(Lt,"IsSupported",{get:function(){var e=Oe.a.LastCreatedEngine;return!!e&&(1<e.webGLVersion||e.getCaps().drawBuffersExtension)}
1,enumerable:!1,configurable:!0}),Lt);function Lt(e,t,i,n,r,o,a,s,c){void 0===s&&(s=f.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=It.call(this,e,"screenSpaceCurvature",["curvature_ridge","curvature_valley"],["textureSampler","normalSampler"],i,n,r,o,a,void 0,s,void 0,null,c)||this;return l.ridge=1,l.valley=1,l._geometryBufferRenderer=t.enableGeometryBufferRenderer(),l._geometryBufferRenderer?l.onApply=function(e){e.setFloat("curvature_ridge",.5/Math.max(l.ridge*l.ridge,1e-4)),e.setFloat("curvature_valley",.7/Math.max(l.valley*l.valley,1e-4));var t=l._geometryBufferRenderer.getGBuffer().textures[1];e.setTexture("normalSampler",t)}:M.a.Error("Multiple Render Target support needed for screen space curvature post process. Please use IsSupported test first."),l}},function(e,t,i){"use strict";i.d(t,"g",function(){return n.a}),i.d(t,"i",function(){return r.a}),i.d(t,"j",function(){return o.a}),i.d(t,"k",function(){return a.a}),i.d(t,"l",function(){return l}),i.d(t,"s",function(){return _}),i.d(t,"t",function(){return y}),i.d(t,"w",function(){return E}),i.d(t,"x",function(){return A}),i.d(t,"y",function(){return x}),i.d(t,"A",function(){return O.a}),i.d(t,"B",function(){return M.a}),i.d(t,"D",function(){return I.a}),i.d(t,"E",function(){return D.a}),i.d(t,"F",function(){return L.a}),i.d(t,"G",function(){return w}),i.d(t,"n",function(){return s.a}),i.d(t,"o",function(){return s.b}),i.d(t,"m",function(){return U.a}),i.d(t,"N",function(){return V.a}),i.d(t,"z",function(){return k.a}),i.d(t,"C",function(){return F.a}),i.d(t,"O",function(){return X}),i.d(t,"f",function(){return Y.a}),i.d(t,"h",function(){return c.a}),i.d(t,"p",function(){return K.a}),i.d(t,"q",function(){return Z}),i.d(t,"r",function(){return q}),i.d(t,"u",function(){return oe}),i.d(t,"e",function(){return ae}),i.d(t,"v",function(){return J}),i.d(t,"H",function(){return pe}),i.d(t,"a",function(){return ve}),i.d(t,"b",function(){return Te}),i.d(t,"c",function(){return Ae}),i.d(t,"d",function(){return xe}),i.d(t,"J",function(){return Ie}),i.d(t,"K",function(){return Ne}),i.d(t,"L",function(){return Be}),i.d(t,"M",function(){return ke}),i.d(t,"P",function(){return ue}),i.d(t,"V",function(){return je}),i.d(t,"Q",function(){return We.a}),i.d(t,"R",function(){return Ye}),i.d(t,"S",function(){return Ke.a}),i.d(t,"T",function(){return Ze}),i.d(t,"I",function(){return Je.a}),i.d(t,"U",function(){return Je.b}),i.d(t,"W",function(){return $e.a});var n=i(251),r=i(252),o=i(253),a=i(254),s=i(37),c=i(146),p=i(13);c.a.prototype.addVRDeviceOrientation=function(){return this.add(new l),this};var l=(u.prototype.attachControl=function(e,t){var i=this;this.camera.attachControl(e,t);var n=this.camera.getScene().getEngine().getHostWindow();n&&("undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(function(e){"granted"===e?n.addEventListener("deviceorientation",i._deviceOrientationHandler):p.b.Warn("Permission not granted.")}).catch(function(e){p.b.Error(e)}):n.addEventListener("deviceorientation",this._deviceOrientationHandler))},u.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},u.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)},u.prototype.detachControl=function(e){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)},u.prototype.getClassName=function(){return"ArcRotateCameraVRDeviceOrientationInput"},u.prototype.getSimpleName=function(){return"VRDeviceOrientation"},u);function u(){this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}s.a.ArcRotateCameraVRDeviceOrientationInput=l;var h=i(1),d=i(3),f=i(82),m=i(0),_=(g.prototype.attachControl=function(e,n){var r=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add(function(){r._keys=[]}),this._onKeyboardObserver=this._scene.onKeyboardObservable.add(function(e){var t,i=e.event;e.type===f.a.KEYDOWN?-1===r.keysForward.indexOf(i.keyCode)&&-1===r.keysBackward.indexOf(i.keyCode)&&-1===r.keysUp.indexOf(i.keyCode)&&-1===r.keysDown.indexOf(i.keyCode)&&-1===r.keysLeft.indexOf(i.keyCode)&&-1===r.keysRight.indexOf(i.keyCode)||(-1===(t=r._keys.indexOf(i.keyCode))&&r._keys.push(i.keyCode),n||i.preventDefault()):-1===r.keysForward.indexOf(i.keyCode)&&-1===r.keysBackward.indexOf(i.keyCode)&&-1===r.keysUp.indexOf(i.keyCode)&&-1===r.keysDown.indexOf(i.keyCode)&&-1===r.keysLeft.indexOf(i.keyCode)&&-1===r.keysRight.indexOf(i.keyCode)||(0<=(t=r._keys.indexOf(i.keyCode))&&r._keys.splice(t,1),n||i.preventDefault())}))},g.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=[]},g.prototype.getClassName=function(){return"FlyCameraKeyboardInput"},g.prototype._onLostFocus=function(e){this._keys=[]},g.prototype.getSimpleName=function(){return"keyboard"},g.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t],n=e._computeLocalCameraSpeed();-1!==this.keysForward.indexOf(i)?e._localDirection.copyFromFloats(0,0,n):-1!==this.keysBackward.indexOf(i)?e._localDirection.copyFromFloats(0,0,-n):-1!==this.keysUp.indexOf(i)?e._localDirection.copyFromFloats(0,n,0):-1!==this.keysDown.indexOf(i)?e._localDirection.copyFromFloats(0,-n,0):-1!==this.keysRight.indexOf(i)?e._localDirection.copyFromFloats(n,0,0):-1!==this.keysLeft.indexOf(i)&&e._localDirection.copyFromFloats(-n,0,0),e.getSce
1ne().useRightHandedSystem&&(e._localDirection.z*=-1),e.getViewMatrix().invertToRef(e._cameraTransformMatrix),m.e.TransformNormalToRef(e._localDirection,e._cameraTransformMatrix,e._transformedDirection),e.cameraDirection.addInPlace(e._transformedDirection)}},Object(h.c)([Object(d.c)()],g.prototype,"keysForward",void 0),Object(h.c)([Object(d.c)()],g.prototype,"keysBackward",void 0),Object(h.c)([Object(d.c)()],g.prototype,"keysUp",void 0),Object(h.c)([Object(d.c)()],g.prototype,"keysDown",void 0),Object(h.c)([Object(d.c)()],g.prototype,"keysRight",void 0),Object(h.c)([Object(d.c)()],g.prototype,"keysLeft",void 0),g);function g(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}s.a.FlyCameraKeyboardInput=_;var v=i(20),b=i(24),y=(T.prototype.attachControl=function(e,t){var i=this;this.element=e,this.noPreventDefault=t,this._observer=this.camera.getScene().onPointerObservable.add(function(e,t){i._pointerInput(e,t)},v.a.POINTERDOWN|v.a.POINTERUP|v.a.POINTERMOVE),this._rollObserver=this.camera.getScene().onBeforeRenderObservable.add(function(){i.camera.rollCorrect&&i.camera.restoreRoll(i.camera.rollCorrect)}),this._mousemoveCallback=function(e){i._onMouseMove(e)},e.addEventListener("mousemove",this._mousemoveCallback,!1)},T.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver),this._mousemoveCallback&&e.removeEventListener("mousemove",this._mousemoveCallback),this._observer=null,this._rollObserver=null,this.previousPosition=null,this.noPreventDefault=void 0)},T.prototype.getClassName=function(){return"FlyCameraMouseInput"},T.prototype.getSimpleName=function(){return"mouse"},T.prototype._pointerInput=function(e,t){var i=e.event,n=this.camera.getEngine();if(!n.isInVRExclusivePointerMode&&(this.touchEnabled||"touch"!==i.pointerType)&&(e.type===v.a.POINTERMOVE||-1!==this.buttons.indexOf(i.button))){var r=i.srcElement||i.target;if(e.type===v.a.POINTERDOWN&&r){try{r.setPointerCapture(i.pointerId)}catch(i){}this.previousPosition={x:i.clientX,y:i.clientY},this.activeButton=i.button,this.noPreventDefault||(i.preventDefault(),this.element.focus())}else if(e.type===v.a.POINTERUP&&r){try{r.releasePointerCapture(i.pointerId)}catch(i){}this.activeButton=-1,this.previousPosition=null,this.noPreventDefault||i.preventDefault()}else if(e.type===v.a.POINTERMOVE){if(!this.previousPosition||n.isPointerLock)return;var o=i.clientX-this.previousPosition.x,a=i.clientY-this.previousPosition.y;this.rotateCamera(o,a),this.previousPosition={x:i.clientX,y:i.clientY},this.noPreventDefault||i.preventDefault()}}},T.prototype._onMouseMove=function(e){var t,i,n=this.camera.getEngine();n.isPointerLock&&!n.isInVRExclusivePointerMode&&(t=e.movementX||e.mozMovementX||e.webkitMovementX||e.msMovementX||0,i=e.movementY||e.mozMovementY||e.webkitMovementY||e.msMovementY||0,this.rotateCamera(t,i),this.previousPosition=null,this.noPreventDefault||e.preventDefault())},T.prototype.rotateCamera=function(e,t){var i=this,n=this.camera;this.camera.getScene().useRightHandedSystem&&(e*=-1),n.parent&&n.parent._getWorldMatrixDeterminant()<0&&(e*=-1);var r,o,a,s=e/this.angularSensibility,c=t/this.angularSensibility,l=m.b.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z);this.buttonsPitch.some(function(e){return e===i.activeButton})&&(a=m.b.RotationAxis(b.a.X,c),l.multiplyInPlace(a)),this.buttonsYaw.some(function(e){return e===i.activeButton})&&(a=m.b.RotationAxis(b.a.Y,s),l.multiplyInPlace(a),r=n.bankedTurnLimit+n._trackRoll,n.bankedTurn&&-r<n.rotation.z&&n.rotation.z<r&&(o=n.bankedTurnMultiplier*-s,a=m.b.RotationAxis(b.a.Z,o),l.multiplyInPlace(a))),this.buttonsRoll.some(function(e){return e===i.activeButton})&&(a=m.b.RotationAxis(b.a.Z,-s),n._trackRoll-=s,l.multiplyInPlace(a)),l.toEulerAnglesToRef(n.rotation)},Object(h.c)([Object(d.c)()],T.prototype,"buttons",void 0),Object(h.c)([Object(d.c)()],T.prototype,"angularSensibility",void 0),T);function T(e){void 0===e&&(e=!0),this.buttons=[0,1,2],this.buttonsYaw=[-1,0,1],this.buttonsPitch=[-1,0,1],this.buttonsRoll=[2],this.activeButton=-1,this.angularSensibility=1e3,this.previousPosition=null}s.a.FlyCameraMouseInput=y;var E=(S.prototype.attachControl=function(e,n){var r=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add(function(){r._keys=[]}),this._onKeyboardObserver=this._scene.onKeyboardObservable.add(function(e){var t,i=e.event;i.metaKey||(e.type===f.a.KEYDOWN?(r._ctrlPressed=i.ctrlKey,r._altPressed=i.altKey,r._shiftPressed=i.shiftKey,-1===r.keysHeightOffsetIncr.indexOf(i.keyCode)&&-1===r.keysHeightOffsetDecr.indexOf(i.keyCode)&&-1===r.keysRotationOffsetIncr.indexOf(i.keyCode)&&-1===r.keysRotationOffsetDecr.indexOf(i.keyCode)&&-1===r.keysRadiusIncr.indexOf(i.keyCode)&&-1===r.keysRadiusDecr.indexOf(i.keyCode)||(-1===(t=r._keys.indexOf(i.keyCode))&&r._keys.push(i.keyCode),i.preventDefault&&(n||i.preventDefault()))):-1===r.keysHeightOffsetIncr.indexOf(i.keyCode)&&-1===r.keysHeightOffsetDecr.indexOf(i.keyCode)&&-1===r.keysRotationOffsetIncr.indexOf(i.keyCode)&&-1===r.keysRotationOffsetDecr.indexOf(i.keyCode)&&-1===r.keysRadiusIncr.indexOf(i.keyCode)&&-1===r.keysRadiusDecr.indexOf(i.keyCode)||(0<=(t=r._keys.indexOf(i.keyCode))&&r._keys.splice(t,1),i.preventDefault&&(n||i.preventDefault())))}
1))},S.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=[]},S.prototype.checkInputs=function(){var t=this;this._onKeyboardObserver&&this._keys.forEach(function(e){-1!==t.keysHeightOffsetIncr.indexOf(e)&&t._modifierHeightOffset()?t.camera.heightOffset+=t.heightSensibility:-1!==t.keysHeightOffsetDecr.indexOf(e)&&t._modifierHeightOffset()?t.camera.heightOffset-=t.heightSensibility:-1!==t.keysRotationOffsetIncr.indexOf(e)&&t._modifierRotationOffset()?(t.camera.rotationOffset+=t.rotationSensibility,t.camera.rotationOffset%=360):-1!==t.keysRotationOffsetDecr.indexOf(e)&&t._modifierRotationOffset()?(t.camera.rotationOffset-=t.rotationSensibility,t.camera.rotationOffset%=360):-1!==t.keysRadiusIncr.indexOf(e)&&t._modifierRadius()?t.camera.radius+=t.radiusSensibility:-1!==t.keysRadiusDecr.indexOf(e)&&t._modifierRadius()&&(t.camera.radius-=t.radiusSensibility)})},S.prototype.getClassName=function(){return"FollowCameraKeyboardMoveInput"},S.prototype.getSimpleName=function(){return"keyboard"},S.prototype._modifierHeightOffset=function(){return this.keysHeightOffsetModifierAlt===this._altPressed&&this.keysHeightOffsetModifierCtrl===this._ctrlPressed&&this.keysHeightOffsetModifierShift===this._shiftPressed},S.prototype._modifierRotationOffset=function(){return this.keysRotationOffsetModifierAlt===this._altPressed&&this.keysRotationOffsetModifierCtrl===this._ctrlPressed&&this.keysRotationOffsetModifierShift===this._shiftPressed},S.prototype._modifierRadius=function(){return this.keysRadiusModifierAlt===this._altPressed&&this.keysRadiusModifierCtrl===this._ctrlPressed&&this.keysRadiusModifierShift===this._shiftPressed},Object(h.c)([Object(d.c)()],S.prototype,"keysHeightOffsetIncr",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysHeightOffsetDecr",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysHeightOffsetModifierAlt",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysHeightOffsetModifierCtrl",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysHeightOffsetModifierShift",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRotationOffsetIncr",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRotationOffsetDecr",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRotationOffsetModifierAlt",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRotationOffsetModifierCtrl",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRotationOffsetModifierShift",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRadiusIncr",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRadiusDecr",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRadiusModifierAlt",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRadiusModifierCtrl",void 0),Object(h.c)([Object(d.c)()],S.prototype,"keysRadiusModifierShift",void 0),Object(h.c)([Object(d.c)()],S.prototype,"heightSensibility",void 0),Object(h.c)([Object(d.c)()],S.prototype,"rotationSensibility",void 0),Object(h.c)([Object(d.c)()],S.prototype,"radiusSensibility",void 0),S);function S(){this.keysHeightOffsetIncr=[38],this.keysHeightOffsetDecr=[40],this.keysHeightOffsetModifierAlt=!1,this.keysHeightOffsetModifierCtrl=!1,this.keysHeightOffsetModifierShift=!1,this.keysRotationOffsetIncr=[37],this.keysRotationOffsetDecr=[39],this.keysRotationOffsetModifierAlt=!1,this.keysRotationOffsetModifierCtrl=!1,this.keysRotationOffsetModifierShift=!1,this.keysRadiusIncr=[40],this.keysRadiusDecr=[38],this.keysRadiusModifierAlt=!0,this.keysRadiusModifierCtrl=!1,this.keysRadiusModifierShift=!1,this.heightSensibility=1,this.rotationSensibility=1,this.radiusSensibility=1,this._keys=new Array}s.a.FollowCameraKeyboardMoveInput=E;var A=(C.prototype.attachControl=function(e,o){var a=this;this._wheel=function(e,t){var i,n,r;e.type===v.a.POINTERWHEEL&&(i=e.event,n=0,r=Math.max(-1,Math.min(1,i.deltaY||i.wheelDelta||-i.detail)),a.wheelDeltaPercentage?(console.assert(a.axisControlRadius+a.axisControlHeight+a.axisControlRotation<=1,"wheelDeltaPercentage only usable when mouse wheel controlls ONE axis. Currently enabled: axisControlRadius: "+a.axisControlRadius+", axisControlHeightOffset: "+a.axisControlHeight+", axisControlRotationOffset: "+a.axisControlRotation),a.axisControlRadius?n=.01*r*a.wheelDeltaPercentage*a.camera.radius:a.axisControlHeight?n=.01*r*a.wheelDeltaPercentage*a.camera.heightOffset:a.axisControlRotation&&(n=.01*r*a.wheelDeltaPercentage*a.camera.rotationOffset)):n=r*a.wheelPrecision,n&&(a.axisControlRadius?a.camera.radius+=n:a.axisControlHeight?a.camera.heightOffset-=n:a.axisControlRotation&&(a.camera.rotationOffset-=n)),i.preventDefault&&(o||i.preventDefault()))},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,v.a.POINTERWHEEL)},C.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},C.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},C.prototype.getSimpleName=function(){return"mousewheel"},Object(h.c)([Object(d.c)()],C.prototype,"axisControlRadius",void 0),Object(h.c)([Object(d.c)()],C.prototype,"axisControlHeight",void 0),Object(h.c)([Object(d.c)()],C.prototype,"axisControlRotation",void 0),Object(h.c)([Object(d.c)()],C.prototype,"wheelPrecision",void 0),Object(h.c)([Object(d.c)()],C.prototype,"wheelDeltaPercentage",void 0),C);function C(){this.axisControlRadius=!0,this.axisControlHeight=!1,this.axisControlRotation=!1,this.wheelPrecision=3,this.wheelDeltaPercentage=0}s.a.FollowCameraMouseWheelInput=A;var P,x=(P=i(302).a,Object(h.d)(R,P),R.prototype.getClassName=function(){return"FollowCameraPointersInput"},R.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)},R.prototype.onMultiTouch=function(e,t,i,n,r,o){var a;0===i&&null===r||0===n&&null===o||(a=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2),this.pinchDeltaPercentage?(a*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=a*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=a*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=a*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=a),this.axisPinchControlHeight&&(this.camera.heightOffset+=a),this.axisPinchControlRadius&&(this.camera.radius-=a)))},R.prototype._warning=function(){var e;this.warningEnable&&this._warningCounter++%100==0&&(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))},Object(h.c)([Object(d.c)()],R.prototype,"angularSensibilityX",void 0),Object(h.c)([Object(d.c)()],R.prototype,"angularSensibilityY",void 0),Object(h.c)([Object(d.c)()],R.prototype,"pinchPrecision",void 0),Object(h.c)([Object(d.c)()],R.prototype,"pinchDeltaPercentage",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisXControlRadius",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisXControlHeight",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisXControlRotation",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisYControlRadius",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisYControlHeight",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisYControlRotation",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisPinchControlRadius",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisPinchControlHeight",void 0),Object(h.c)([Object(d.c)()],R.prototype,"axisPinchControlRotation",void 0),R);function R(){var e=null!==P&&P.apply(this,arguments)||this;return e.angularSensibilityX=1,e.angularSensibilityY=1,e.pinchPrecision=1e4,e.pinchDeltaPercentage=0,e.axisXControlRadius=!1,e.axisXControlHeight=!1,e.axisXControlRotation=!0,e.axisYControlRadius=!1,e.axisYControlHeight=!0,e.axisYControlRotation=!1,e.axisPinchControlRadius=!0,e.axisPinchControlHeight=!1,e.axisPinchControlRotation=!1,e.warningEnable=!0,e._warningCounter=0,e}
1s.a.FollowCameraPointersInput=x;var O=i(305),M=i(258),I=i(255),D=i(256),L=i(257),N=i(140),F=i(117);F.a.prototype.addVirtualJoystick=function(){return this.add(new w),this};var w=(B.prototype.getLeftJoystick=function(){return this._leftjoystick},B.prototype.getRightJoystick=function(){return this._rightjoystick},B.prototype.checkInputs=function(){var e,t,i,n;this._leftjoystick&&(t=50*(e=this.camera)._computeLocalCameraSpeed(),i=m.a.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),n=m.e.TransformCoordinates(new m.e(this._leftjoystick.deltaPosition.x*t,this._leftjoystick.deltaPosition.y*t,this._leftjoystick.deltaPosition.z*t),i),e.cameraDirection=e.cameraDirection.add(n),e.cameraRotation=e.cameraRotation.addVector3(this._rightjoystick.deltaPosition),this._leftjoystick.pressed||(this._leftjoystick.deltaPosition=this._leftjoystick.deltaPosition.scale(.9)),this._rightjoystick.pressed||(this._rightjoystick.deltaPosition=this._rightjoystick.deltaPosition.scale(.9)))},B.prototype.attachControl=function(e,t){this._leftjoystick=new N.b(!0),this._leftjoystick.setAxisForUpDown(N.a.Z),this._leftjoystick.setAxisForLeftRight(N.a.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new N.b(!1),this._rightjoystick.setAxisForUpDown(N.a.X),this._rightjoystick.setAxisForLeftRight(N.a.Y),this._rightjoystick.reverseUpDown=!0,this._rightjoystick.setJoystickSensibility(.05),this._rightjoystick.setJoystickColor("yellow")},B.prototype.detachControl=function(e){this._leftjoystick.releaseCanvas(),this._rightjoystick.releaseCanvas()},B.prototype.getClassName=function(){return"FreeCameraVirtualJoystickInput"},B.prototype.getSimpleName=function(){return"virtualJoystick"},B);function B(){}s.a.FreeCameraVirtualJoystickInput=w;var U=i(25),V=i(92),k=i(71),G=i(30);G.a.AddNodeConstructor("TouchCamera",function(e,t){return function(){return new X(e,m.e.Zero(),t)}});var z,j,W,H,X=(H=k.a,Object(h.d)(ie,H),Object.defineProperty(ie.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:!1,configurable:!0}),Object.defineProperty(ie.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:!1,configurable:!0}),ie.prototype.getClassName=function(){return"TouchCamera"},ie.prototype._setupInputs=function(){var e=this.inputs.attached.mouse;e&&(e.touchEnabled=!1)},ie),Y=i(102),K=i(182),Q=i(12),q=(W=s.b,Object(h.d)(te,W),te.prototype.addKeyboard=function(){return this.add(new _),this},te.prototype.addMouse=function(e){return void 0===e&&(e=!0),this.add(new y(e)),this},te),Z=(j=V.a,Object(h.d)(ee,j),Object.defineProperty(ee.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:!1,configurable:!0}),Object.defineProperty(ee.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:!1,configurable:!0}),Object.defineProperty(ee.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:!1,configurable:!0}
1),Object.defineProperty(ee.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:!1,configurable:!0}),Object.defineProperty(ee.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:!1,configurable:!0}),Object.defineProperty(ee.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:!1,configurable:!0}),Object.defineProperty(ee.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:!1,configurable:!0}),ee.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},ee.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new m.e(0,0,0)},Object.defineProperty(ee.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),ee.prototype._collideWithWorld=function(e){(this.parent?m.e.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},ee.prototype._checkInputs=function(){this._localDirection||(this._localDirection=m.e.Zero(),this._transformedDirection=m.e.Zero()),this.inputs.checkInputs(),j.prototype._checkInputs.call(this)},ee.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},ee.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):j.prototype._updatePosition.call(this)},ee.prototype.restoreRoll=function(e){var t=this._trackRoll,i=t-this.rotation.z;.001<=Math.abs(i)&&(this.rotation.z+=i/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))},ee.prototype.dispose=function(){this.inputs.clear(),j.prototype.dispose.call(this)},ee.prototype.getClassName=function(){return"FlyCamera"},Object(h.c)([Object(d.o)()],ee.prototype,"ellipsoid",void 0),Object(h.c)([Object(d.o)()],ee.prototype,"ellipsoidOffset",void 0),Object(h.c)([Object(d.c)()],ee.prototype,"checkCollisions",void 0),Object(h.c)([Object(d.c)()],ee.prototype,"applyGravity",void 0),ee),J=(z=s.b,Object(h.d)($,z),$.prototype.addKeyboard=function(){return this.add(new E),this},$.prototype.addMouseWheel=function(){return this.add(new A),this},$.prototype.addPointers=function(){return this.add(new x),this},$.prototype.addVRDeviceOrientation=function(){return console.warn("DeviceOrientation support not yet implemented for FollowCamera."),this},$);function $(e){return z.call(this,e)||this}function ee(e,t,i,n){void 0===n&&(n=!0);var r=j.call(this,e,t,i,n)||this;return r.ellipsoid=new m.e(1,1,1),r.ellipsoidOffset=new m.e(0,0,0),r.checkCollisions=!1,r.applyGravity=!1,r.cameraDirection=m.e.Zero(),r._trackRoll=0,r.rollCorrect=100,r.bankedTurn=!1,r.bankedTurnLimit=Math.PI/2,r.bankedTurnMultiplier=1,r._needMoveForGravity=!1,r._oldPosition=m.e.Zero(),r._diffPosition=m.e.Zero(),r._newPosition=m.e.Zero(),r._collisionMask=-1,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),r._newPosition.copyFrom(t),r._newPosition.subtractToRef(r._oldPosition,r._diffPosition),r._diffPosition.length()>Q.a.CollisionsEpsilon&&(r.position.addInPlace(r._diffPosition),r.onCollide&&i&&r.onCollide(i))},r.inputs=new q(r),r.inputs.addKeyboard().addMouse(),r}function te(e){return W.call(this,e)||this}function ie(e,t,i){var n=H.call(this,e,t,i)||this;return n.inputs.addTouch(),n._setupInputs(),n}G.a.AddNodeConstructor("FollowCamera",function(e,t){return function(){return new oe(e,m.e.Zero(),t)}}),G.a.AddNodeConstructor("ArcFollowCamera",function(e,t){return function(){return new ae(e,0,0,1,null,t)}});var ne,re,oe=(re=V.a,Object(h.d)(ce,re),ce.prototype._follow=function(e){var t,i,n,r,o,a,s,c,l,u,h,d;e&&(i=e.rotationQuaternion?(t=new m.a,e.rotationQuaternion.toRotationMatrix(t),Math.atan2(t.m[8],t.m[10])):e.rotation.y,n=p.b.ToRadians(this.rotationOffset)+i,o=(r=e.getAbsolutePosition()).x+Math.sin(n)*this.radius,a=r.z+Math.cos(n)*this.radius,s=o-this.position.x,c=r.y+this.heightOffset-this.position.y,l=a-this.position.z,u=s*this.cameraAcceleration*2,h=c*this.cameraAcceleration,d=l*this.cameraAcceleration*2,(u>this.maxCameraSpeed||u<-this.maxCameraSpeed)&&(u=u<1?-this.maxCameraSpeed:this.maxCameraSpeed),(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),this.position=new m.e(this.position.x+u,this.position.y+h,this.position.z+d),this.setTarget(r))},ce.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t),this._reset=function(){}},ce.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},ce.prototype._checkInputs=function(){this.inputs.checkInputs(),this._checkLimits(),re.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},ce.prototype._checkLimits=function(){null!==this.lowerRadiusLimit&&this.radius<this.lowerRadiusLimit&&(this.radius=this.lowerRadiusLimit),null!==this.upperRadiusLimit&&this.radius>this.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHe
1ightOffsetLimit&&this.heightOffset<this.lowerHeightOffsetLimit&&(this.heightOffset=this.lowerHeightOffsetLimit),null!==this.upperHeightOffsetLimit&&this.heightOffset>this.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffset<this.lowerRotationOffsetLimit&&(this.rotationOffset=this.lowerRotationOffsetLimit),null!==this.upperRotationOffsetLimit&&this.rotationOffset>this.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)},ce.prototype.getClassName=function(){return"FollowCamera"},Object(h.c)([Object(d.c)()],ce.prototype,"radius",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"lowerRadiusLimit",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"upperRadiusLimit",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"rotationOffset",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"lowerRotationOffsetLimit",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"upperRotationOffsetLimit",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"heightOffset",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"lowerHeightOffsetLimit",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"upperHeightOffsetLimit",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"cameraAcceleration",void 0),Object(h.c)([Object(d.c)()],ce.prototype,"maxCameraSpeed",void 0),Object(h.c)([Object(d.k)("lockedTargetId")],ce.prototype,"lockedTarget",void 0),ce),ae=(ne
1=V.a,Object(h.d)(se,ne),se.prototype._follow=function(){var e;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),e=this.target.getAbsolutePosition(),this.position=e.add(this._cartesianCoordinates),this.setTarget(e))},se.prototype._checkInputs=function(){ne.prototype._checkInputs.call(this),this._follow()},se.prototype.getClassName=function(){return"ArcFollowCamera"},se);function se(e,t,i,n,r,o){var a=ne.call(this,e,m.e.Zero(),o)||this;return a.alpha=t,a.beta=i,a.radius=n,a.target=r,a._cartesianCoordinates=m.e.Zero(),a._follow(),a}function ce(e,t,i,n){void 0===n&&(n=null);var r=re.call(this,e,t,i)||this;return r.radius=12,r.lowerRadiusLimit=null,r.upperRadiusLimit=null,r.rotationOffset=0,r.lowerRotationOffsetLimit=null,r.upperRotationOffsetLimit=null,r.heightOffset=4,r.lowerHeightOffsetLimit=null,r.upperHeightOffsetLimit=null,r.cameraAcceleration=.05,r.maxCameraSpeed=20,r.lockedTarget=n,r.inputs=new J(r),r.inputs.addKeyboard().addMouseWheel().addPointers(),r}i(199),G.a.AddNodeConstructor("FreeCamera",function(e,t){return function(){return new ue(e,m.e.Zero(),t)}});var le,ue=(le=X,Object(h.d)(he,le),Object.defineProperty(he.prototype,"gamepadAngularSensibility",{get:function(){var e=this.inputs.attached.gamepad;return e?e.gamepadAngularSensibility:0},set:function(e){var t=this.inputs.attached.gamepad;t&&(t.gamepadAngularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"gamepadMoveSensibility",{get:function(){var e=this.inputs.attached.gamepad;return e?e.gamepadMoveSensibility:0},set:function(e){var t=this.inputs.attached.gamepad;t&&(t.gamepadMoveSensibility=e)},enumerable:!1,configurable:!0}),he.prototype.getClassName=function(){return"UniversalCamera"},he);function he(e,t,i){var n=le.call(this,e,t,i)||this;return n.inputs.addGamepad(),n}U.a._createDefaultParsedCamera=function(e,t){return new ue(e,m.e.Zero(),t)},G.a.AddNodeConstructor("GamepadCamera",function(e,t){return function(){return new pe(e,m.e.Zero(),t)}});var de,pe=(de=ue,Object(h.d)(_e,de),_e.prototype.getClassName=function(){return"GamepadCamera"},_e),fe=i(105),me=i(298);function _e(e,t,i){return de.call(this,e,t,i)||this}U.a._setStereoscopicAnaglyphRigMode=function(e){e._rigCameras[0]._rigPostProcess=new fe.b(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new me.a(e.name+"_anaglyph",1,e._rigCameras)},G.a.AddNodeConstructor("AnaglyphArcRotateCamera",function(e,t,i){return function(){return new ve(e,0,0,1,m.e.Zero(),i.interaxial_distance,t)}});var ge,ve=(ge=Y.a,Object(h.d)(be,ge),be.prototype.getClassName=function(){return"AnaglyphArcRotateCamera"},be);function be(e,t,i,n,r,o,a){var s=ge.call(this,e,t,i,n,r,a)||this;return s.interaxialDistance=o,s.setCameraRigMode(U.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:o}),s}G.a.AddNodeConstructor("AnaglyphFreeCamera",function(e,t,i){return function(){return new Te(e,m.e.Zero(),i.interaxial_distance,t)}});var ye,Te=(ye=k.a,Object(h.d)(Ee,ye),Ee.prototype.getClassName=function(){return"AnaglyphFreeCamera"},Ee);function Ee(e,t,i,n){var r=ye.call(this,e,t,n)||this;return r.interaxialDistance=i,r.setCameraRigMode(U.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),r}G.a.AddNodeConstructor("AnaglyphGamepadCamera",function(e,t,i){return function(){return new Ae(e,m.e.Zero(),i.interaxial_distance,t)}});var Se,Ae=(Se=pe,Object(h.d)(Ce,Se),Ce.prototype.getClassName=function(){return"AnaglyphGamepadCamera"},Ce);function Ce(e,t,i,n){var r=Se.call(this,e,t,n)||this;return r.interaxialDistance=i,r.setCameraRigMode(U.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),r}G.a.AddNodeConstructor("AnaglyphUniversalCamera",function(e,t,i){return function(){return new xe(e,m.e.Zero(),i.interaxial_distance,t)}});var Pe,xe=(Pe=ue,Object(h.d)(Oe,Pe),Oe.prototype.getClassName=function(){return"AnaglyphUniversalCamera"},Oe),Re=i(77);function Oe(e,t,i,n){var r=Pe.call(this,e,t,n)||this;return r.interaxialDistance=i,r.setCameraRigMode(U.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),r}U.a._setStereoscopicRigMode=function(e){var t=e.cameraRigMode===U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED,i=e.cameraRigMode===U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e._rigCameras[i?1:0].viewport=new Re.a(0,0,t?.5:1,t?1:.5),e._rigCameras[i?0:1].viewport=new Re.a(t?.5:0,t?0:.5,t?.5:1,t?1:.5)},G.a.AddNodeConstructor("StereoscopicArcRotateCamera",function(e,t,i){return function(){return new Ie(e,0,0,1,m.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var Me,Ie=(Me=Y.a,Object(h.d)(De,Me),De.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},De);function De(e,t,i,n,r,o,a,s){var c=Me.call(this,e,t,i,n,r,s)||this;return c.interaxialDistance=o,c.isStereoscopicSideBySide=a,c.setCameraRigMode(a?U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:U.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:o}),c}G.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new Ne(e,m.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var Le,Ne=(Le=k.a,Object(h.d)(Fe,Le),Fe.prototype.getClassName=function(){return"StereoscopicFreeCamera"},Fe);function Fe(e,t,i,n,r){var o=Le.call(this,e,t,r)||this;return o.interaxialDistance=i,o.isStereoscopicSideBySide=n,o.setCameraRigMode(n?U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:U.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),o}G.a.AddNodeConstructor("StereoscopicGamepadCamera",function(e,t,i){return function(){return new Be(e,m.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var we,Be=(we=pe,Object(h.d)(Ue,we),Ue.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},Ue);function Ue(e,t,i,n,r){var o=we.call(this,e,t,r)||this;return o.interaxialDistance=i,o.isStereoscopicSideBySide=n,o.setCameraRigMode(n?U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:U.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),o}G.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new ke(e,m.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var Ve,ke=(Ve=ue,Object(h.d)(Ge,Ve),Ge.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},Ge);function Ge(e,t,i,n,r){var o=Ve.call(this,e,t,r)||this;return o.interaxialDistance=i,o.isStereoscopicSideBySide=n,o.setCameraRigMode(n?U.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:U.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),o}G.a.AddNodeConstructor("VirtualJoysticksCamera",function(e,t){return function(){return new je(e,m.e.Zero(),t)}});var ze,je=(ze=k.a,Object(h.d)(He,ze),He.prototype.getClassName=function(){return"VirtualJoysticksCamera"},He),We=i(103);function He(e,t,i){var n=ze.call(this,e,t,i)||this;return n.inputs.addVirtualJoystick(),n}i(218),G.a.AddNodeConstructor("VRDeviceOrientationFreeCamera",function(e,t){return function(){return new Ye(e,0,0,1,m.e.Zero(),t)}});var Xe,Ye=(Xe=Y.a,Object(h.d)(Qe,Xe),Qe.prototype.getClassName=function(){return"VRDeviceOrientationArcRotateCamera"},Qe),Ke=i(183);function Qe(e,t,i,n,r,o,a,s){void 0===a&&(a=!0),void 0===s&&(s=We.a.GetDefault());var c=Xe.call(this,e,t,i,n,r,o)||this;return s.compensateDistortion=a,c.setCameraRigMode(U.a.RIG_MODE_VR,{vrCameraMetrics:s}),c.inputs.addVRDeviceOrientation(),c}G.a.AddNodeConstructor("VRDeviceOrientationGamepadCamera",function(e,t){return function(){return new Ze(e,m.e.Zero(),t)}});var qe,Ze=(qe=Ke.a,Object(h.d)(et,qe),et.prototype.getClassName=function(){return"VRDeviceOrientationGamepadCamera"},et),Je=i(261),$e=i(262);function et(e,t,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=We.a.GetDefault());var o=qe.call(this,e,t,i,n,r)||this;return o.inputs.addGamepad(),o}i(306)},function(e,t,i){"use strict";i.d(t,"a",function(){return l.a}),i.d(t,"c",function(){return F.a}),i.d(t,"R",function(){return F.b}),i.d(t,"i",function(){return n}),i.d(t,"d",function(){return d}),i.d(t,"j",function(){return p.a}),i.d(t,"l",function(){return f.a}),i.d(t,"O",function(){return _}),i.d(t,"p",function(){return g.a}),i.d(t,"s",function(){return v.b}),i.d(t,"o",function(){return v.a}),i.d(t,"U",function(){return X.b}),i.d(t,"V",function(){return X.c}),i.d(t,"t",function(){return X.a}),i.d(t,"S",function(){return H.a}),i.d(t,"u",function(){return Se}),i.d(t,"G",function(){return Ce}),i.d(t,"F",function(){return Pe}),i.d(t,"H",function(){return ye}),i.d(t,"B",function(){return Ne}),i.d(t,"E",function(){return ke}),i.d(t,"x",function(){return Z}),i.d(t,"z",function(){return J}),i.d(t,"J",function(){return w.a}),i.d(t,"v",function(){return Ge.a}),i.d(t,"P",function(){return ze.a}),i.d(t,"b",function(){return T.a}),i.d(t,"K",function(){return D}),i.d(t,"h",function(){return b.a}),i.d(t,"C",function(){return y.a}),i.d(t,"I",function(){return L.a}),i.d(t,"m",function(){return je.a}),i.d(t,"e",function(){return N.a}),i.d(t,"M",function(){return B.a}),i.d(t,"N",function(){return k}),i.d(t,"r",function(){return G.a}),i.d(t,"y",function(){return oe}),i.d(t,"D",function(){return ae.a}),i.d(t,"q",function(){return ce}),i.d(t,"w",function(){return le.a}),i.d(t,"L",function(){return he}),i.d(t,"k",function(){return de.a}),i.d(t,"Q",function(){return fe}),i.d(t,"A",function(){return me.a}),i.d(t,"n",function(){return ge}),i.d(t,"g",function(){return Ee}),i.d(t,"f",function(){return We.a}),i.d(t,"T",function(){return He.a});var l=i(28),F=i(4),a=i(13),o=i(292),H=i(16);function u(s,e,t,i,c){var n=new s.DecoderBuffer;n.Init(e,e.byteLength);var l,r,u=new s.Decoder;try{var o=u.GetEncodedGeometryType(n);switch(o){case s.TRIANGULAR_MESH:l=new s.Mesh,r=u.DecodeBufferToMesh(n,l);break;case s.POINT_CLOUD:l=new s.PointCloud,r=u.DecodeBufferToPointCloud(n,l);break;
1default:throw new Error("Invalid geometry type "+o)}if(!r.ok()||!l.ptr)throw new Error(r.error_msg());var h=l.num_points();if(o===s.TRIANGULAR_MESH){var a=l.num_faces(),d=new s.DracoInt32Array;try{for(var p=new Uint32Array(3*a),f=0;f<a;f++){u.GetFaceFromMesh(l,f,d);var m=3*f;p[0+m]=d.GetValue(0),p[1+m]=d.GetValue(1),p[2+m]=d.GetValue(2)}i(p)}finally{s.destroy(d)}}var _=function(e,t){var i=new s.DracoFloat32Array;try{u.GetAttributeFloatForAllPoints(l,t,i);var n=t.num_components();if(n)if("color"===e&&3===n){for(var r=new Float32Array(4*h),o=0,a=0;o<r.length;o+=4,a+=n)r[o+0]=i.GetValue(a+0),r[o+1]=i.GetValue(a+1),r[o+2]=i.GetValue(a+2),r[o+3]=1;c(e,r)}else{for(r=new Float32Array(h*n),o=0;o<r.length;o++)r[o]=i.GetValue(o);c(e,r)}}finally{s.destroy(i)}};if(t)for(var g in t){var v=t[g];_(g,u.GetAttributeByUniqueId(l,v))}else{var b={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"};for(var g in b)-1!==(v=u.GetAttributeId(l,s[b[g]]))&&_(g,u.GetAttribute(l,v))}}finally{l&&s.destroy(l),s.destroy(u),s.destroy(n)}}function c(e){return"object"!=typeof document||"string"!=typeof e?e:a.b.GetAbsoluteUrl(e)}var h,n=(Object.defineProperty(x,"DecoderAvailable",{get:function(){var e=x.Configuration.decoder;return!!(e.wasmUrl&&e.wasmBinaryUrl&&"object"==typeof WebAssembly||e.fallbackUrl)},enumerable:!1,configurable:!0}),x.GetDefaultNumWorkers=function(){return"object"==typeof navigator&&navigator.hardwareConcurrency?Math.min(Math.floor(.5*navigator.hardwareConcurrency),4):1},Object.defineProperty(x,"Default",{get:function(){return x._Default||(x._Default=new x),x._Default},enumerable:!1,configurable:!0}),x.prototype.dispose=function(){this._workerPoolPromise&&this._workerPoolPromise.then(function(e){e.dispose()}),delete this._workerPoolPromise,delete this._decoderModulePromise},x.prototype.whenReadyAsync=function(){return this._workerPoolPromise?this._workerPoolPromise.then(function(){}):this._decoderModulePromise?this._decoderModulePromise.then(function(){}):Promise.resolve()},x.prototype.decodeMeshAsync=function(e,c){var l=e instanceof ArrayBuffer?new Uint8Array(e):e;if(this._workerPoolPromise)return this._workerPoolPromise.then(function(e){return new Promise(function(a,s){e.push(function(t,i){var n=new H.a,r=function(e){t.removeEventListener("error",r),t.removeEventListener("message",o),s(e),i()},o=function(e){"done"===e.data?(t.removeEventListener("error",r),t.removeEventListener("message",o),a(n),i()):"indices"===e.data.id?n.indices=e.data.value:n.set(e.data.value,e.data.id)};t.addEventListener("error",r),t.addEventListener("message",o);var e=new Uint8Array(l.byteLength);e.set(new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),t.postMessage({id:"decodeMesh",dataView:e,attributes:c},[e.buffer])})})});if(this._decoderModulePromise)return this._decoderModulePromise.then(function(e){var i=new H.a;return u(e.module,l,c,function(e){i.indices=e},function(e,t){i.set(t,e)}),i});throw new Error("Draco decoder module is not available")},x.Configuration={decoder:{wasmUrl:"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",wasmBinaryUrl:"https://preview.babylonjs.com/draco_decoder_gltf.wasm",fallbackUrl:"https://preview.babylonjs.com/draco_decoder_gltf.js"}},x.DefaultNumWorkers=x.GetDefaultNumWorkers(),x._Default=null,x),z=i(0),w=i(78),X=i(8),j=i(10),R=0,O=(P.prototype.clone=function(){var e,t;return new P(this.pos.clone(),this.normal.clone(),null===(e=this.uv)||void 0===e?void 0:e.clone(),null===(t=this.vertColor)||void 0===t?void 0:t.clone())},P.prototype.flip=function(){this.normal=this.normal.scale(-1)},P.prototype.interpolate=function(e,t){return new P(z.e.Lerp(this.pos,e.pos,t),z.e.Lerp(this.normal,e.normal,t),this.uv&&e.uv?z.d.Lerp(this.uv,e.uv,t):void 0,this.vertColor&&e.vertColor?j.b.Lerp(this.vertColor,e.vertColor,t):void 0)},P),r=(C.FromPoints=function(e,t,i){var n=i.subtract(e),r=t.subtract(e);if(0===n.lengthSquared()||0===r.lengthSquared())return null;var o=z.e.Normalize(z.e.Cross(n,r));return new C(o,z.e.Dot(o,e))},C.prototype.clone=function(){return new C(this.normal.clone(),this.w)},C.prototype.flip=function(){this.normal.scaleInPlace(-1),this.w=-this.w},C.prototype.splitPolygon=function(e,t,i,n,r){var o,a=0,s=[];for(d=0;d<e.vertices.length;d++){var c=(o=z.e.Dot(this.normal,e.vertices[d].pos)-this.w)<-C.EPSILON?2:C.EPSILON<o?1:0;a|=c,s.push(c)}switch(a){case 0:(0<z.e.Dot(this.normal,e.plane.normal)?t:i).push(e);break;case 1:n.push(e);break;case 2:r.push(e);break;case 3:for(var l,u=[],h=[],d=0;d<e.vertices.length;d++){var p,f=(d+1)%e.vertices.length,m=s[d],_=s[f],g=e.vertices[d],v=e.vertices[f];2!==m&&u.push(g),1!==m&&h.push(2!==m?g.clone():g),3==(m|_)&&(o=(this.w-z.e.Dot(this.normal,g.pos))/z.e.Dot(this.normal,v.pos.subtract(g.pos)),p=g.interpolate(v,o),u.push(p),h.push(p.clone()))}3<=u.length&&(l=new M(u,e.shared)).plane&&n.push(l),3<=h.length&&(l=new M(h,e.shared)).plane&&r.push(l)}},C.EPSILON=1e-5,C),M=(A.prototype.clone=function(){return new A(this.vertices.map(function(e){return e.clone()}),this.shared)},A.prototype.flip=function(){this.vertices.reverse().map(function(e){e.flip()}),this.plane.flip()},A),s=(S.prototype.clone=function(){var e=new S;return e.plane=this.plane&&this.plane.clone(),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e.polygons=this.polygons.map(function(e){return e.clone()}),e},S.prototype.invert=function(){for(var e=0;e<this.polygons.length;e++)this.polygons[e].flip();this.plane&&this.plane.flip(),this.front&&this.front.invert(),this.back&&this.back.invert();var t=this.front;this.front=this.back,this.back=t},S.prototype.clipPolygons=function(e){if(!this.plane)return e.slice();for(var t=new Array,i=new Array,n=0;n<e.length;n++)this.plane.splitPolygon(e[n],t,i,t,i);return this.front&&(t=this.front.clipPolygons(t)),i=this.back?this.back.clipPolygons(i):[],t.concat(i)},S.prototype.clipTo=function(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)},S.prototype.allPolygons=function(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e},S.prototype.build=function(e){if(e.length){this.plane||(this.plane=e[0].plane.clone());for(var t=new Array,i=new Array,n=0;n<e.length;n++)this.plane.splitPolygon(e[n],this.polygons,this.polygons,t,i);t.length&&(this.front||(this.front=new S),this.front.build(t)),i.length&&(this.back||(this.back=new S),this.back.build(i))}},S),d=(I.FromMesh=function(e){var t,i,n,r,o,a,s=void 0,c=void 0,l=new Array,u=null;if(!(e instanceof X.a))throw"BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh";e.computeWorldMatrix(!0),n=e.getWorldMatrix(),r=e.position.clone(),o=e.rotation.clone(),e.rotationQuaternion&&(u=e.rotationQuaternion.clone()),a=e.scaling.clone();for(var h=e.getIndices(),d=e.getVerticesData(F.b.PositionKind),p=e.getVerticesData(F.b.NormalKind),f=e.getVerticesData(F.b.UVKind),m=e.getVerticesData(F.b.ColorKind),_=e.subMeshes,g=0,v=_.length;g<v;g++)for(var b=_[g].indexStart,y=_[g].indexCount+_[g].indexStart;b<y;b+=3){i=[];for(var T=0;T<3;T++){var E=new z.e(p[3*h[b+T]],p[3*h[b+T]+1],p[3*h[b+T]+2]);f&&(s=new z.d(f[2*h[b+T]],f[2*h[b+T]+1])),m&&(c=new j.b(m[4*h[b+T]],m[4*h[b+T]+1],m[4*h[b+T]+2],m[4*h[b+T]+3]));var S=new z.e(d[3*h[b+T]],d[3*h[b+T]+1],d[3*h[b+T]+2]),A=z.e.TransformCoordinates(S,n),C=z.e.TransformNormal(E,n),P=new O(A,C,s,c);i.push(P)}(t=new M(i,{subMeshId:g,meshId:R,materialIndex:_[g].materialIndex})).plane&&l.push(t)}var x=I.FromPolygons(l);return x.matrix=n,x.position=r,x.rotation=o,x.scaling=a,x.rotationQuaternion=u,R++,x},I.FromPolygons=function(e){var t=new I;return t.polygons=e,t},I.prototype.clone=function(){var e=new I;return e.polygons=this.polygons.map(function(e){return e.clone()}),e.copyTransformAttributes(this),e},I.prototype.union=function(e){var t=new s(this.clone().polygons),i=new s(e.clone().polygons);return t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),I.FromPolygons(t.allPolygons()).copyTransformAttributes(this)},I.prototype.unionInPlace=function(e){var t=new s(this.polygons),i=new s(e.polygons);t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),this.polygons=t.allPolygons()},I.prototype.subtract=function(e){var t=new s(this.clone().polygons),i=new s(e.clone().polygons);return t.invert(),t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),t.invert(),I.FromPolygons(t.allPolygons()).copyTransformAttributes(this)},I.prototype.subtractInPlace=function(e){var t=new s(this.polygons),i=new s(e.polygons);t.invert(),t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),t.invert(),this.polygons=t.allPolygons()},I.prototype.intersect=function(e){var t=new s(this.clone().polygons),i=new s(e.clone().polygons);return t.invert(),i.clipTo(t),i.invert(),t.clipTo(i),i.clipTo(t),t.build(i.allPolygons()),t.invert(),I.FromPolygons(t.allPolygons()).copyTransformAttributes(this)},I.prototype.intersectInPlace=function(e){var t=new s(this.polygons),i=new s(e.polygons);t.invert(),i.clipTo(t),i.invert(),t.clipTo(i),i.clipTo(t),t.build(i.allPolygons()),t.invert(),this.polygons=t.allPolygons()},I.prototype.inverse=function(){var e=this.clone();return e.inverseInPlace(),e},I.prototype.inverseInPlace=function(){this.polygons.map(function(e){e.flip()})},I.prototype.copyTransformAttributes=function(e){return this.matrix=e.matrix,this.position=e.position,this.rotation=e.rotation,this.scaling=e.scaling,this.rotationQuaternion=e.rotationQuaternion,this},I.prototype.buildMeshGeometry=function(e,t,i){var n=this.matrix.clone();n.invert();var r,o,a=new X.a(e,t),s=[],c=[],l=[],u=null,h=null,d=z.e.Zero(),p=z.e.Zero(),f=z.d.Zero(),m=new j.b(0,0,0,0),_=this.polygons,g=[0,0,0],v={},b=0,y={};i&&_.sort(function(e,t){return e.shared.meshId===t.shared.meshId?e.shared.subMeshId-t.shared.subMeshId:e.shared.meshId-t.shared.meshId});for(var T=0,E=_.length;T<E;T++){y[(r=_[T]).shared.meshId]||(y[r.shared.meshId]={}),y[r.shared.meshId][r.shared.subMeshId]||(y[r.shared.meshId][r.shared.subMeshId]={indexStart:1/0,indexEnd:-1/0,materialIndex:r.
1shared.materialIndex}),o=y[r.shared.meshId][r.shared.subMeshId];for(var S=2,A=r.vertices.length;S<A;S++){g[0]=0,g[1]=S-1,g[2]=S;for(var C=0;C<3;C++){d.copyFrom(r.vertices[g[C]].pos),p.copyFrom(r.vertices[g[C]].normal),r.vertices[g[C]].uv&&(u=u||[],f.copyFrom(r.vertices[g[C]].uv)),r.vertices[g[C]].vertColor&&(h=h||[],m.copyFrom(r.vertices[g[C]].vertColor));var P=z.e.TransformCoordinates(d,n),x=z.e.TransformNormal(p,n),R=v[P.x+","+P.y+","+P.z],O=!1;u&&u[2*R]!==f.x&&u[2*R+1]!==f.y&&(O=!0);var M=!1;h&&h[4*R]!==m.r&&h[4*R+1]!==m.g&&h[4*R+2]!==m.b&&h[4*R+3]!==m.a&&(M=!0),(void 0===R||l[3*R]!==x.x||l[3*R+1]!==x.y||l[3*R+2]!==x.z||O||M)&&(s.push(P.x,P.y,P.z),u&&u.push(f.x,f.y),l.push(p.x,p.y,p.z),h&&h.push(m.r,m.g,m.b,m.a),R=v[P.x+","+P.y+","+P.z]=s.length/3-1),c.push(R),o.indexStart=Math.min(b,o.indexStart),o.indexEnd=Math.max(b,o.indexEnd),b++}}}if(a.setVerticesData(F.b.PositionKind,s),a.setVerticesData(F.b.NormalKind,l),u&&a.setVerticesData(F.b.UVKind,u),h&&a.setVerticesData(F.b.ColorKind,h),a.setIndices(c,null),i){var I,D=0;for(var L in a.subMeshes=new Array,y){for(var N in I=-1,y[L])o=y[L][N],w.a.CreateFromIndices(o.materialIndex+D,o.indexStart,o.indexEnd-o.indexStart+1,a),I=Math.max(o.materialIndex,I);D+=++I}}return a},I.prototype.toMesh=function(e,t,i,n){void 0===t&&(t=null);var r=this.buildMeshGeometry(e,i,n);return r.material=t,r.position.copyFrom(this.position),r.rotation.copyFrom(this.rotation),this.rotationQuaternion&&(r.rotationQuaternion=this.rotationQuaternion.clone()),r.scaling.copyFrom(this.scaling),r.computeWorldMatrix(!0),r},I),p=i(95),f=i(207),m=i(1),_=(h=X.a,Object(m.d)(E,h),E.prototype.getClassName=function(){return"TrailMesh"},E.prototype._createMesh=function(){for(var e=new H.a,t=[],i=[],n=[],r=z.e.Zero(),r=this._generator instanceof l.a&&this._generator._boundingInfo?this._generator._boundingInfo.boundingBox.centerWorld:this._generator.position,o=2*Math.PI/this._sectionPolygonPointsCount,a=0;a<this._sectionPolygonPointsCount;a++)t.push(r.x+Math.cos(a*o)*this._diameter,r.y+Math.sin(a*o)*this._diameter,r.z);for(a=1;a<=this._length;a++){for(var s=0;s<this._sectionPolygonPointsCount;s++)t.push(r.x+Math.cos(s*o)*this._diameter,r.y+Math.sin(s*o)*this._diameter,r.z);for(var c=t.length/3-2*this._sectionPolygonPointsCount,s=0;s<this._sectionPolygonPointsCount-1;s++)n.push(c+s,c+s+this._sectionPolygonPointsCount,c+s+this._sectionPolygonPointsCount+1),n.push(c+s,c+s+this._sectionPolygonPointsCount+1,c+s+1);n.push(c+this._sectionPolygonPointsCount-1,c+this._sectionPolygonPointsCount-1+this._sectionPolygonPointsCount,c+this._sectionPolygonPointsCount),n.push(c+this._sectionPolygonPointsCount-1,c+this._sectionPolygonPointsCount,c)}H.a.ComputeNormals(t,n,i),e.positions=t,e.normals=i,e.indices=n,e.applyToMesh(this,!0),this._autoStart&&this.start()},E.prototype.start=function(){var e=this;this._running||(this._running=!0,this._beforeRenderObserver=this.getScene().onBeforeRenderObservable.add(function(){e.update()}))},E.prototype.stop=function(){this._beforeRenderObserver&&this._running&&(this._running=!1,this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver))},E.prototype.update=function(){var e=this.getVerticesData(F.b.PositionKind),t=this.getVerticesData(F.b.NormalKind),i=this._generator.getWorldMatrix();if(e&&t){for(var n=3*this._sectionPolygonPointsCount;n<e.length;n++)e[n-3*this._sectionPolygonPointsCount]=e[n]-t[n]/this._length*this._diameter;for(n=3*this._sectionPolygonPointsCount;n<t.length;n++)t[n-3*this._sectionPolygonPointsCount]=t[n];for(var r=e.length-3*this._sectionPolygonPointsCount,o=2*Math.PI/this._sectionPolygonPointsCount,n=0;n<this._sectionPolygonPointsCount;n++)this._sectionVectors[n].copyFromFloats(Math.cos(n*o)*this._diameter,Math.sin(n*o)*this._diameter,0),this._sectionNormalVectors[n].copyFromFloats(Math.cos(n*o),Math.sin(n*o),0),z.e.TransformCoordinatesToRef(this._sectionVectors[n],i,this._sectionVectors[n]),z.e.TransformNormalToRef(this._sectionNormalVectors[n],i,this._sectionNormalVectors[n]);for(n=0;n<this._sectionPolygonPointsCount;n++)e[r+3*n]=this._sectionVectors[n].x,e[r+3*n+1]=this._sectionVectors[n].y,e[r+3*n+2]=this._sectionVectors[n].z,t[r+3*n]=this._sectionNormalVectors[n].x,t[r+3*n+1]=this._sectionNormalVectors[n].y,t[r+3*n+2]=this._sectionNormalVectors[n].z;this.updateVerticesData(F.b.PositionKind,e,!0,!1),this.updateVerticesData(F.b.NormalKind,t,!0,!1)}},E.prototype.clone=function(e,t){return void 0===e&&(e=""),new E(e,void 0===t?this._generator:t,this.get
1Scene(),this._diameter,this._length,this._autoStart)},E.prototype.serialize=function(e){h.prototype.serialize.call(this,e)},E.Parse=function(e,t){return new E(e.name,e._generator,t,e._diameter,e._length,e._autoStart)},E),g=i(264),v=i(139),y=i(112),b=i(188),T=i(91);function E(e,t,i,n,r,o){void 0===n&&(n=1),void 0===r&&(r=60),void 0===o&&(o=!0);var a=h.call(this,e,i)||this;a._sectionPolygonPointsCount=4,a._running=!1,a._autoStart=o,a._generator=t,a._diameter=n,a._length=r,a._sectionVectors=[],a._sectionNormalVectors=[];for(var s=0;s<a._sectionPolygonPointsCount;s++)a._sectionVectors[s]=z.e.Zero(),a._sectionNormalVectors[s]=z.e.Zero();return a._createMesh(),a}function I(){this.polygons=new Array}function S(e){this.plane=null,this.front=null,this.back=null,this.polygons=new Array,e&&this.build(e)}function A(e,t){this.vertices=e,this.shared=t,this.plane=r.FromPoints(e[0].pos,e[1].pos,e[2].pos)}function C(e,t){this.normal=e,this.w=t}function P(e,t,i,n){this.pos=e,this.normal=t,this.uv=i,this.vertColor=n}function x(r){void 0===r&&(r=x.DefaultNumWorkers);var e=x.Configuration.decoder,s=e.wasmUrl&&e.wasmBinaryUrl&&"object"==typeof WebAssembly?{url:e.wasmUrl,wasmBinaryPromise:a.b.LoadFileAsync(c(e.wasmBinaryUrl))}:{url:e.fallbackUrl,wasmBinaryPromise:Promise.resolve(void 0)};r&&"function"==typeof Worker?this._workerPoolPromise=s.wasmBinaryPromise.then(function(e){for(var t=u+"("+function(){var n;onmessage=function(e){var t=e.data;switch(t.id){case"init":var i=t.decoder;i.url&&(importScripts(i.url),n=DracoDecoderModule({wasmBinary:i.wasmBinary})),postMessage("done");break;case"decodeMesh":if(!n)throw new Error("Draco decoder module is not available");n.then(function(e){u(e,t.dataView,t.attributes,function(e){postMessage({id:"indices",value:e},[e.buffer])},function(e,t){postMessage({id:e,value:t},[t.buffer])}),postMessage("done")})}}}+")()",a=URL.createObjectURL(new Blob([t],{type:"application/javascript"})),i=new Array(r),n=0;n<i.length;n++)i[n]=new Promise(function(t,i){var n=new Worker(a),r=function(e){n.removeEventListener("error",r),n.removeEventListener("message",o),i(e)},o=function(e){"done"===e.data&&(n.removeEventListener("error",r),n.removeEventListener("message",o),t(n))};n.addEventListener("error",r),n.addEventListener("message",o),n.postMessage({id:"init",decoder:{url:c(s.url),wasmBinary:e}})});return Promise.all(i).then(function(e){return new o.a(e)})}):this._decoderModulePromise=s.wasmBinaryPromise.then(function(t){if(!s.url)throw new Error("Draco decoder module is not available");return a.b.LoadScriptAsync(s.url).then(function(){return e=t,new Promise(function(t){DracoDecoderModule({wasmBinary:e}).then(function(e){t({module:e})})});var e})})}H.a.CreateTiledBox=function(e){for(var t=e.faceUV||new Array(6),i=e.faceColors,n=e.pattern||X.a.NO_FLIP,r=e.width||e.size||1,o=e.height||e.size||1,a=e.depth||e.size||1,s=e.tileWidth||e.tileSize||1,c=e.tileHeight||e.tileSize||1,l=e.alignHorizontal||0,u=e.alignVertical||0,h=0===e.sideOrientation?0:e.sideOrientation||H.a.DEFAULTSIDE,d=0;d<6;d++)void 0===t[d]&&(t[d]=new z.f(0,0,1,1)),i&&void 0===i[d]&&(i[d]=new j.b(1,1,1,1));for(var p=r/2,f=o/2,m=a/2,_=[],d=0;d<2;d++)_[d]=H.a.CreateTiledPlane({pattern:n,tileWidth:s,tileHeight:c,width:r,height:o,alignVertical:u,alignHorizontal:l,sideOrientation:h});for(d=2;d<4;d++)_[d]=H.a.CreateTiledPlane({pattern:n,tileWidth:s,tileHeight:c,width:a,height:o,alignVertical:u,alignHorizontal:l,sideOrientation:h});var g=u;for(u===X.a.BOTTOM?g=X.a.TOP:u===X.a.TOP&&(g=X.a.BOTTOM),d=4;d<6;d++)_[d]=H.a.CreateTiledPlane({pattern:n,tileWidth:s,tileHeight:c,width:r,height:a,alignVertical:g,alignHorizontal:l,sideOrientation:h});var v=[],b=[],y=[],T=[],E=[],S=[],A=[],C=[],P=0,x=0,R=0;for(d=0;d<6;d++){P=_[d].positions.length,S[d]=[],A[d]=[];for(var O=0;O<P/3;O++)S[d].push(new z.e(_[d].positions[3*O],_[d].positions[3*O+1],_[d].positions[3*O+2])),A[d].push(new z.e(_[d].normals[3*O],_[d].normals[3*O+1],_[d].normals[3*O+2]));x=_[d].uvs.length,C[d]=[];for(var M=0;M<x;M+=2)C[d][M]=t[d].x+(t[d].z-t[d].x)*_[d].uvs[M],C[d][M+1]=t[d].y+(t[d].w-t[d].y)*_[d].uvs[M+1];if(y=y.concat(C[d]),T=T.concat(_[d].indices.map(function(e){return e+R}
1)),R+=S[d].length,i)for(var I=0;I<4;I++)E.push(i[d].r,i[d].g,i[d].b,i[d].a)}var D=new z.e(0,0,m),L=z.a.RotationY(Math.PI),v=S[0].map(function(e){return z.e.TransformNormal(e,L).add(D)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[]),b=A[0].map(function(e){return z.e.TransformNormal(e,L)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[]);v=v.concat(S[1].map(function(e){return e.subtract(D)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[])),b=b.concat(A[1].map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[]));var N=new z.e(p,0,0),F=z.a.RotationY(-Math.PI/2);v=v.concat(S[2].map(function(e){return z.e.TransformNormal(e,F).add(N)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[])),b=b.concat(A[2].map(function(e){return z.e.TransformNormal(e,F)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[]));var w=z.a.RotationY(Math.PI/2);v=v.concat(S[3].map(function(e){return z.e.TransformNormal(e,w).subtract(N)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[])),b=b.concat(A[3].map(function(e){return z.e.TransformNormal(e,w)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[]));var B=new z.e(0,f,0),U=z.a.RotationX(Math.PI/2);v=v.concat(S[4].map(function(e){return z.e.TransformNormal(e,U).add(B)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[])),b=b.concat(A[4].map(function(e){return z.e.TransformNormal(e,U)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[]));var V=z.a.RotationX(-Math.PI/2);v=v.concat(S[5].map(function(e){return z.e.TransformNormal(e,V).subtract(B)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[])),b=b.concat(A[5].map(function(e){return z.e.TransformNormal(e,V)}).map(function(e){return[e.x,e.y,e.z]}).reduce(function(e,t){return e.concat(t)},[])),H.a._ComputeSides(h,v,T,b,y);var k,G=new H.a;return G.indices=T,G.positions=v,G.normals=b,G.uvs=y,i&&(k=h===H.a.DOUBLESIDE?E.concat(E):E,G.colors=k),G};var D=(U.CreateTiledBox=function(e,t,i){void 0===i&&(i=null);var n=new X.a(e,i);return t.sideOrientation=X.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,H.a.CreateTiledBox(t).applyToMesh(n,t.updatable),n},U),L=i(60),N=i(79),B=i(120);function U(){}H.a.CreateTorusKnot=function(e){for(var t,i=new Array,n=new Array,r=new Array,o=new Array,c=e.radius||2,a=e.tube||.5,s=e.radialSegments||32,l=e.tubularSegments||32,u=e.p||2,h=e.q||3,d=0===e.sideOrientation?0:e.sideOrientation||H.a.DEFAULTSIDE,p=function(e){var t=Math.cos(e),i=Math.sin(e),n=h/u*e,r=Math.cos(n),o=c*(2+r)*.5*t,a=c*(2+r)*i*.5,s=c*Math.sin(n)*.5;return new z.e(o,a,s)},f=0;f<=s;f++){var m=f%s/s*2*u*Math.PI,_=p(m),g=p(.01+m),v=g.subtract(_),b=g.add(_),y=z.e.Cross(v,b),b=z.e.Cross(y,v);for(y.normalize(),b.normalize(),t=0;t<l;t++){var T=t%l/l*2*Math.PI,E=-a*Math.cos(T),S=a*Math.sin(T);n.push(_.x+E*b.x+S*y.x),n.push(_.y+E*b.y+S*y.y),n.push(_.z+E*b.z+S*y.z),o.push(f/s),o.push(t/l)}}for(f=0;f<s;f++)for(t=0;t<l;t++){var A=(t+1)%l,C=f*l+t,P=(f+1)*l+t,x=(f+1)*l+A,R=f*l+A;i.push(R),i.push(P),i.push(C),i.push(R),i.push(x),i.push(P)}H.a.ComputeNormals(n,i,r),H.a._ComputeSides(d,n,i,r,o,e.frontUVs,e.backUVs);var O=new H.a;return O.indices=i,O.positions=n,O.normals=r,O.uvs=o,O},X.a.CreateTorusKnot=function(e,t,i,n,r,o,a,s,c,l){var u={radius:t,tube:i,radialSegments:n,tubularSegments:r,p:o,q:a,sideOrientation:l,updatable:c};return k.CreateTorusKnot(e,u,s)};var V,k=(re.CreateTorusKnot=function(e,t,i){var n=new X.a(e,i);return t.sideOrientation=X.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,H.a.CreateTorusKnot(t).applyToMesh(n,t.updatable),n},re),G=i(58),W=i(7),Y=i(12),K=i(97),Q=(V=z.d,Object(m.d)(ne,V),ne),q=(ie.prototype.add=function(e){var i=this,n=new Array;return e.forEach(function(e){var t;0!==n.length&&e.equalsWithEpsilon(n[0])||(t=new Q(e,i.elements.length),n.push(t),i.elements.push(t))}),n},ie.prototype.computeBounds=function(){var t=new z.d(this.elements[0].x,this.elements[0].y),i=new z.d(this.elements[0].x,this.elements[0].y);
1return this.elements.forEach(function(e){e.x<t.x?t.x=e.x:e.x>i.x&&(i.x=e.x),e.y<t.y?t.y=e.y:e.y>i.y&&(i.y=e.y)}),{min:t,max:i,width:i.x-t.x,height:i.y-t.y}},ie),Z=(te.Rectangle=function(e,t,i,n){return[new z.d(e,t),new z.d(i,t),new z.d(i,n),new z.d(e,n)]},te.Circle=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=32);for(var r=new Array,o=0,a=2*Math.PI/n,s=0;s<n;s++)r.push(new z.d(t+Math.cos(o)*e,i+Math.sin(o)*e)),o-=a;return r},te.Parse=function(e){for(var t=e.split(/[^-+eE\.\d]+/).map(parseFloat).filter(function(e){return!isNaN(e)}),i=[],n=0;n<(2147483646&t.length);n+=2)i.push(new z.d(t[n],t[n+1]));return i},te.StartingAt=function(e,t){return K.f.StartingAt(e,t)},te),J=(ee.prototype._addToepoint=function(e){for(var t=0,i=e;t<i.length;t++){var n=i[t];this._epoints.push(n.x,n.y)}},ee.prototype.addHole=function(e){this._points.add(e);var t=new q;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this},ee.prototype.build=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=0);var i=new X.a(this._name,this._scene),n=this.buildVertexData(t);return i.setVerticesData(F.b.PositionKind,n.positions,e),i.setVerticesData(F.b.NormalKind,n.normals,e),i.setVerticesData(F.b.UVKind,n.uvs,e),i.setIndices(n.indices),i},ee.prototype.buildVertexData=function(t){var i=this;void 0===t&&(t=0);var e=new H.a,n=new Array,r=new Array,o=new Array,a=this._points.computeBounds();this._points.elements.forEach(function(e){n.push(0,1,0),r.push(e.x,0,e.y),o.push((e.x-a.min.x)/a.width,(e.y-a.min.y)/a.height)});for(var s=new Array,c=this.bjsEarcut(this._epoints,this._eholes,2),l=0;l<c.length;l++)s.push(c[l]);if(0<t){var u=r.length/3;this._points.elements.forEach(function(e){n.push(0,-1,0),r.push(e.x,-t,e.y),o.push(1-(e.x-a.min.x)/a.width,1-(e.y-a.min.y)/a.height)});for(var h=s.length,l=0;l<h;l+=3){var d=s[l+0],p=s[l+1],f=s[l+2];s.push(f+u),s.push(p+u),s.push(d+u)}this.addSide(r,n,o,s,a,this._outlinepoints,t,!1),this._holes.forEach(function(e){i.addSide(r,n,o,s,a,e,t,!0)})}return e.indices=s,e.positions=r,e.normals=n,e.uvs=o,e},ee.prototype.addSide=function(e,t,i,n,r,o,a,s){for(var c=e.length/3,l=0,u=0;u<o.elements.length;u++){var h=o.elements[u],d=u+1>o.elements.length-1?o.elements[0]:o.elements[u+1];e.push(h.x,0,h.y),e.push(h.x,-a,h.y),e.push(d.x,0,d.y),e.push(d.x,-a,d.y);var p=new z.e(h.x,0,h.y),f=new z.e(d.x,0,d.y).subtract(p),m=new z.e(0,1,0),_=(_=z.e.Cross(f,m)).normalize();i.push(l/r.width,0),i.push(l/r.width,1),l+=f.length(),i.push(l/r.width,0),i.push(l/r.width,1),s?(t.push(_.x,_.y,_.z),t.push(_.x,_.y,_.z),t.push(_.x,_.y,_.z),t.push(_.x,_.y,_.z),n.push(c),n.push(c+2),n.push(c+1),n.push(c+1),n.push(c+2),n.push(c+3)):(t.push(-_.x,-_.y,-_.z),t.push(-_.x,-_.y,-_.z),t.push(-_.x,-_.y,-_.z),t.push(-_.x,-_.y,-_.z),n.push(c),n.push(c+1),n.push(c+2),n.push(c+1),n.push(c+3),n.push(c+2)),c+=4}},ee),$=i(22);function ee(e,t,i,n){var r;void 0===n&&(n=earcut),this._points=new q,this._outlinepoints=new q,this._holes=new Array,this._epoints=new Array,this._eholes=new Array,this.bjsEarcut=n,this._name=e,this._scene=i||Y.a.LastCreatedScene,r=t instanceof K.f?t.getPoints():t,this._addToepoint(r),this._points.add(r),this._outlinepoints.add(r),void 0===this.bjsEarcut&&W.a.Warn("Earcut was not found, the polygon will not be built.")}function te(){}function ie(){this.elements=new Array}function ne(e,t){var i=V.call(this,e.x,e.y)||this;return i.index=t,i}function re(){}H.a.CreatePolygon=function(e,t,i,n,r,o,a){for(var s=i||new Array(3),c=n,l=[],u=a||!1,h=0;h<3;h++)void 0===s[h]&&(s[h]=new z.f(0,0,1,1)),c&&void 0===c[h]&&(c[h]=new j.b(1,1,1,1));var d=e.getVerticesData(F.b.PositionKind),p=e.getVerticesData(F.b.NormalKind),f=e.getVerticesData(F.b.UVKind),m=e.getIndices(),_=d.length/9,g=0,v=0,b=0,y=0,T=[0];if(u)for(var E=_;E<d.length/3;E+=4)v=d[3*(E+2)]-d[3*E],b=d[3*(E+2)+2]-d[3*E+2],y+=Math.sqrt(v*v+b*b),T.push(y);for(var S=E=0,A=0;A<p.length;A+=3)Math.abs(p[A+1])<.001&&(S=1),Math.abs(p[A+1]-1)<.001&&(S=0),Math.abs(p[A+1]+1)<.001&&(S=2),E=A/3,1===S?(g=E-_,f[2*E]=g%4<1.5?u?s[S].x+(s[S].z-s[S].x)*T[Math.floor(g/4)]/y:s[S].x:u?s[S].x+(s[S].z-s[S].x)*T[Math.floor(g/4)+1]/y:s[S].z,f[2*E+1]=g%2==0?s[S].w:s[S].y):(f[2*E]=(1-f[2*E])*s[S].x+f[2*E]*s[S].z,f[2*E+1]=(1-f[2*E+1])*s[S].y+f[2*E+1]*s[S].w),c&&l.push(c[S].r,c[S].g,c[S].b,c[S].a);H.a._ComputeSides(t,d,m,p,f,r,o);
1var C,P=new H.a;return P.indices=m,P.positions=d,P.normals=p,P.uvs=f,c&&(C=t===H.a.DOUBLESIDE?l.concat(l):l,P.colors=C),P},X.a.CreatePolygon=function(e,t,i,n,r,o,a){void 0===a&&(a=earcut);var s={shape:t,holes:n,updatable:r,sideOrientation:o};return oe.CreatePolygon(e,s,i,a)},X.a.ExtrudePolygon=function(e,t,i,n,r,o,a,s){void 0===s&&(s=earcut);var c={shape:t,holes:r,depth:i,updatable:o,sideOrientation:a};return oe.ExtrudePolygon(e,c,n,s)};var oe=(se.CreatePolygon=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=earcut),t.sideOrientation=X.a._GetDefaultSideOrientation(t.sideOrientation);for(var r=t.shape,o=t.holes||[],a=t.depth||0,s=[],c=[],l=0;l<r.length;l++)s[l]=new z.d(r[l].x,r[l].z);s[0].equalsWithEpsilon(s[s.length-1],1e-8)&&s.pop();for(var u=new J(e,s,i||$.a.LastCreatedScene,n),h=0;h<o.length;h++){c=[];for(var d=0;d<o[h].length;d++)c.push(new z.d(o[h][d].x,o[h][d].z));u.addHole(c)}var p=u.build(t.updatable,a);return p._originalBuilderSideOrientation=t.sideOrientation,H.a.CreatePolygon(p,t.sideOrientation,t.faceUV,t.faceColors,t.frontUVs,t.backUVs,t.wrap).applyToMesh(p,t.updatable),p},se.ExtrudePolygon=function(e,t,i,n){return void 0===i&&(i=null),void 0===n&&(n=earcut),se.CreatePolygon(e,t,i,n)},se),ae=i(170);function se(){}X.a.CreateLathe=function(e,t,i,n,r,o,a){var s={shape:t,radius:i,tessellation:n,sideOrientation:a,updatable:o};return ce.CreateLathe(e,s,r)};var ce=(ue.CreateLathe=function(e,t,i){void 0===i&&(i=null);for(var n,r=!t.arc||t.arc<=0||1<t.arc?1:t.arc,o=void 0===t.closed||t.closed,a=t.shape,s=t.radius||1,c=t.tessellation||64,l=t.clip||0,u=t.updatable,h=X.a._GetDefaultSideOrientation(t.sideOrientation),d=t.cap||X.a.NO_CAP,p=2*Math.PI,f=new Array,m=t.invertUV||!1,_=0,g=0,v=p/c*r,b=new Array,_=0;_<=c-l;_++){for(b=[],d!=X.a.CAP_START&&d!=X.a.CAP_ALL||(b.push(new z.e(0,a[0].y,0)),b.push(new z.e(Math.cos(_*v)*a[0].x*s,a[0].y,Math.sin(_*v)*a[0].x*s))),g=0;g<a.length;g++)n=new z.e(Math.cos(_*v)*a[g].x*s,a[g].y,Math.sin(_*v)*a[g].x*s),b.push(n);d!=X.a.CAP_END&&d!=X.a.CAP_ALL||(b.push(new z.e(Math.cos(_*v)*a[a.length-1].x*s,a[a.length-1].y,Math.sin(_*v)*a[a.length-1].x*s)),b.push(new z.e(0,a[a.length-1].y,0))),f.push(b)}return y.a.CreateRibbon(e,{pathArray:f,closeArray:o,sideOrientation:h,updatable:u,invertUV:m,frontUVs:t.frontUVs,backUVs:t.backUVs},i)},ue),le=i(115);function ue(){}H.a.CreateTiledPlane=function(e){var t=e.pattern||X.a.NO_FLIP,i=e.tileWidth||e.tileSize||1,n=e.tileHeight||e.tileSize||1,r=e.alignHorizontal||0,o=e.alignVertical||0,a=e.width||e.size||1,s=Math.floor(a/i),c=a-s*i,l=e.height||e.size||1,u=Math.floor(l/n),h=l-u*n,d=i*s/2,p=n*u/2,f=0,m=0,_=0,g=0,v=0,b=0;if(0<c||0<h){switch(_=-d,g=-p,v=d,b=p,r){case X.a.CENTER:_-=c/=2,v+=c;break;case X.a.LEFT:v+=c,f=-c/2;break;case X.a.RIGHT:_-=c,f=c/2}switch(o){case X.a.CENTER:g-=h/=2,b+=h;break;case X.a.BOTTOM:b+=h,m=-h/2;break;case X.a.TOP:g-=h,m=h/2}}var y=[],T=[],E=[];E[0]=[0,0,1,0,1,1,0,1],E[1]=[0,0,1,0,1,1,0,1],t!==X.a.ROTATE_TILE&&t!==X.a.ROTATE_ROW||(E[1]=[1,1,0,1,0,0,1,0]),t!==X.a.FLIP_TILE&&t!==X.a.FLIP_ROW||(E[1]=[1,0,0,0,0,1,1,1]),t!==X.a.FLIP_N_ROTATE_TILE&&t!==X.a.FLIP_N_ROTATE_ROW||(E[1]=[0,1,1,1,1,0,0,0]);for(var S=[],A=[],C=[],P=0,x=0;x<u;x++)for(var R=0;R<s;R++)y.push(R*i-d+f,x*n-p+m,0),y.push((R+1)*i-d+f,x*n-p+m,0),y.push((R+1)*i-d+f,(x+1)*n-p+m,0),y.push(R*i-d+f,(x+1)*n-p+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),S=t===X.a.FLIP_TILE||t===X.a.ROTATE_TILE||t===X.a.FLIP_N_ROTATE_TILE?S.concat(E[(R%2+x%2)%2]):t===X.a.FLIP_ROW||t===X.a.ROTATE_ROW||t===X.a.FLIP_N_ROTATE_ROW?S.concat(E[x%2]):S.concat(E[0]),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1),P+=4;if(0<c||0<h){var O=0<h&&(o===X.a.CENTER||o===X.a.TOP),M=0<h&&(o===X.a.CENTER||o===X.a.BOTTOM),I=0<c&&(r===X.a.CENTER||r===X.a.RIGHT),D=0<c&&(r===X.a.CENTER||r===X.a.LEFT),L=[];if(O&&I&&(y.push(_+f,g+m,0),y.push(-d+f,g+m,0),y.push(-d+f,g+h+m,0),y.push(_+f,g+h+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,L=[F=1-c/i,w=1-h/n,B=1,w,B,U=1,F,U],t===X.a.ROTATE_ROW&&(L=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),t===X.a.FLIP_ROW&&(L=[1-F,w,1-B,w,1-B,U,1-F,U]),t===X.a.FLIP_N_ROTATE_ROW&&(L=[F,1-w,B,1-w,B,1-U,F,1-U]),S=S.concat(L),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),O&&D&&(y.push(d+f,g+m,0),y.push(v+f,g+m,0),y.push(v+f,g+h+m,0),y.push(d+f,g+h+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,L=[F=0,w=1-h/n,B=c/i,w,B,U=1,F,U],(t===X.a.ROTATE_ROW||t===X.a.ROTATE_TILE&&s%2==0)&&(L=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),(t===X.a.FLIP_ROW||t===X.a.FLIP_TILE&&s%2==0)&&(L=[1-F,w,1-B,w,1-B,U,1-F,U]),(t===X.a.FLIP_N_ROTATE_ROW||t===X.a.FLIP_N_ROTATE_TILE&&s%2==0)&&(L=[F,1-w,B,1-w,B,1-U,F,1-U]),S=S.concat(L),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),M&&I&&(y.push(_+f,p+m,0),y.push(-d+f,p+m,0),y.push(-d+f,b+m,0),y.push(_+f,b+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,L=[F=1-c/i,w=0,B=1,w,B,U=h/n,F,U],(t===X.a.ROTATE_ROW&&u%2==1||t===X.a.ROTATE_TILE&&u%1==0)&&(L=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),(t===X.a.FLIP_ROW&&u%2==1||t===X.a.FLIP_TILE&&u%2==0)&&(L=[1-F,w,1-B,w,1-B,U,1-F,U]),(t===X.a.FLIP_N_ROTATE_ROW&&u%2==1||t===X.a.FLIP_N_ROTATE_TILE&&u%2==0)&&(L=[F,1-w,B,1-w,B,1-U,F,1-U]),S=S.concat(L),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),M&&D&&(y.push(d+f,p+m,0),y.push(v+f,p+m,0),y.push(v+f,b+m,0),y.push(d+f,b+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,L=[F=0,w=0,B=c/i,w,B,U=h/n,F,U],(t===X.a.ROTATE_ROW&&u%2==1||t===X.a.ROTATE_TILE&&(u+s)%2==1)&&(L=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),(t===X.a.FLIP_ROW&&u%2==1||t===X.a.FLIP_TILE&&(u+s)%2==1)&&(L=[1-F,w,1-B,w,1-B,U,1-F,U]),(t===X.a.FLIP_N_ROTATE_ROW&&u%2==1||t===X.a.FLIP_N_ROTATE_TILE&&(u+s)%2==1)&&(L=[F,1-w,B,1-w,B,1-U,F,1-U]),S=S.concat(L),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),O){var N=[],F=0,w=1-h/n,B=1,U=1;for(N[0]=[F,w,B,w,B,U,F,U],N[1]=[F,w,B,w,B,U,F,U],t!==X.a.ROTATE_TILE&&t!==X.a.ROTATE_ROW||(N[1]=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),t!==X.a.FLIP_TILE&&t!==X.a.FLIP_ROW||(N[1]=[1-F,w,1-B,w,1-B,U,1-F,U]),t!==X.a.FLIP_N_ROTATE_TILE&&t!==X.a.FLIP_N_ROTATE_ROW||(N[1]=[F,1-w,B,1-w,B,1-U,F,1-U]),R=0;R<s;R++)y.push(R*i-d+f,g+m,0),y.push((R+1)*i-d+f,g+m,0),y.push((R+1)*i-d+f,g+h+m,0),y.push(R*i-d+f,g+h+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,S=t===X.a.FLIP_TILE||t===X.a.ROTATE_TILE||t===X.a.FLIP_N_ROTATE_TILE?S.concat(N[(R+1)%2]):t===X.a.FLIP_ROW||t===X.a.ROTATE_ROW||t===X.a.FLIP_N_ROTATE_ROW?S.concat(N[1]):S.concat(N[0]),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(M){var V=[];for(B=1,U=h/n,V[w=F=0]=[F,w,B,w,B,U,F,U],V[1]=[F,w,B,w,B,U,F,U],t!==X.a.ROTATE_TILE&&t!==X.a.ROTATE_ROW||(V[1]=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),t!==X.a.FLIP_TILE&&t!==X.a.FLIP_ROW||(V[1]=[1-F,w,1-B,w,1-B,U,1-F,U]),t!==X.a.FLIP_N_ROTATE_TILE&&t!==X.a.FLIP_N_ROTATE_ROW||(V[1]=[F,1-w,B,1-w,B,1-U,F,1-U]),R=0;R<s;R++)y.push(R*i-d+f,b-h+m,0),y.push((R+1)*i-d+f,b-h+m,0),y.push((R+1)*i-d+f,b+m,0),y.push(R*i-d+f,b+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,S=t===X.a.FLIP_TILE||t===X.a.ROTATE_TILE||t===X.a.FLIP_N_ROTATE_TILE?S.concat(V[(R+u)%2]):t===X.a.FLIP_ROW||t===X.a.ROTATE_ROW||t===X.a.FLIP_N_ROTATE_ROW?S.concat(V[u%2]):S.concat(V[0]),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(I){var k=[];for(F=1-c/i,U=B=1,k[w=0]=[F,w,B,w,B,U,F,U],k[1]=[F,w,B,w,B,U,F,U],t!==X.a.ROTATE_TILE&&t!==X.a.ROTATE_ROW||(k[1]=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),t!==X.a.FLIP_TILE&&t!==X.a.FLIP_ROW||(k[1]=[1-F,w,1-B,w,1-B,U,1-F,U]),t!==X.a.FLIP_N_ROTATE_TILE&&t!==X.a.FLIP_N_ROTATE_ROW||(k[1]=[F,1-w,B,1-w,B,1-U,F,1-U]),x=0;x<u;x++)y.push(_+f,x*n-p+m,0),y.push(_+c+f,x*n-p+m,0),y.push(_+c+f,(x+1)*n-p+m,0),y.push(_+f,(x+1)*n-p+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,S=t===X.a.FLIP_TILE||t===X.a.ROTATE_TILE||t===X.a.FLIP_N_ROTATE_TILE?S.concat(k[(x+1)%2]):t===X.a.FLIP_ROW||t===X.a.ROTATE_ROW||t===X.a.FLIP_N_ROTATE_ROW?S.concat(k[x%2]):S.concat(k[0]),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(D){var G=[];for(B=c/n,U=1,G[w=F=0]=[F,w,B,w,B,U,F,U],G[1]=[F,w,B,w,B,U,F,U],t!==X.a.ROTATE_TILE&&t!==X.a.ROTATE_ROW||(G[1]=[1-F,1-w,1-B,1-w,1-B,1-U,1-F,1-U]),t!==X.a.FLIP_TILE&&t!==X.a.FLIP_ROW||(G[1]=[1-F,w,1-B,w,1-B,U,1-F,U]),t!==X.a.FLIP_N_ROTATE_TILE&&t!==X.a.FLIP_N_ROTATE_ROW||(G[1]=[F,1-w,B,1-w,B,1-U,F,1-U]),x=0;x<u;x++)y.push(v-c+f,x*n-p+m,0),y.push(v+f,x*n-p+m,0),y.push(v+f,(x+1)*n-p+m,0),y.push(v-c+f,(x+1)*n-p+m,0),C.push(P,P+1,P+3,P+1,P+2,P+3),P+=4,S=t===X.a.FLIP_TILE||t===X.a.ROTATE_TILE||t===X.a.FLIP_N_ROTATE_TILE?S.concat(G[(x+s)%2]):t===X.a.FLIP_ROW||t===X.a.ROTATE_ROW||t===X.a.FLIP_N_ROTATE_ROW?S.concat(G[x%2]):S.concat(G[0]),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}}var z=0===e.sideOrientation?0:e.sideOrientation||H.a.DEFAULTSIDE;H.a._ComputeSides(z,y,C,T,S,e.frontUVs,e.backUVs);var j=new H.a;j.indices=C,j.positions=y,j.normals=T,j.uvs=S;var W=z===H.a.DOUBLESIDE?A.concat(A):A;
1return j.colors=W,j};var he=(pe.CreateTiledPlane=function(e,t,i){void 0===i&&(i=null);var n=new X.a(e,i);return t.sideOrientation=X.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,H.a.CreateTiledPlane(t).applyToMesh(n,t.updatable),n},pe),de=i(135);function pe(){}X.a.CreateTube=function(e,t,i,n,r,o,a,s,c,l){var u={path:t,radius:i,tessellation:n,radiusFunction:r,arc:1,cap:o,updatable:s,sideOrientation:c,instance:l};return fe.CreateTube(e,u,a)};var fe=(_e.CreateTube=function(e,t,i){void 0===i&&(i=null);var n=t.path,r=t.instance,o=1;void 0!==t.radius?o=t.radius:r&&(o=r._creationDataStorage.radius);var a,s=t.tessellation||64,c=t.radiusFunction||null,l=t.cap||X.a.NO_CAP,u=t.invertUV||!1,h=t.updatable,d=X.a._GetDefaultSideOrientation(t.sideOrientation);function p(r,e,t,i,n,o,a,s){for(var c,l,u,h,d=e.getTangents(),p=e.getNormals(),f=e.getDistances(),m=2*Math.PI/n*s,_=o||function(){return i},g=z.c.Matrix[0],v=a===X.a.NO_CAP||a===X.a.CAP_END?0:2,b=0;b<r.length;b++){l=_(b,f[b]),c=Array(),u=p[b];for(var y=0;y<n;y++)z.a.RotationAxisToRef(d[b],m*y,g),h=c[y]?c[y]:z.e.Zero(),z.e.TransformCoordinatesToRef(u,g,h),h.scaleInPlace(l).addInPlace(r[b]),c[y]=h;t[v]=c,v++}function T(e,t){for(var i=Array(),n=0;n<e;n++)i.push(r[t]);return i}switch(a){case X.a.NO_CAP:break;case X.a.CAP_START:t[0]=T(n,0),t[1]=t[2].slice(0);break;case X.a.CAP_END:t[v]=t[v-1].slice(0),t[v+1]=T(n,r.length-1);break;case X.a.CAP_ALL:t[0]=T(n,0),t[1]=t[2].slice(0),t[v]=t[v-1].slice(0),t[v+1]=T(n,r.length-1)}return t}if(t.arc=(!t.arc||!(t.arc<=0||1<t.arc))&&t.arc||1,r){var f=r._creationDataStorage,m=t.arc||f.arc,_=p(n,a=f.path3D.update(n),f.pathArray,o,f.tessellation,c,f.cap,m),r=y.a.CreateRibbon("",{pathArray:_,instance:r});return f.path3D=a,f.pathArray=_,f.arc=m,f.radius=o,r}_=p(n,a=new K.g(n),new Array,o,s,c,l=l<0||3<l?0:l,t.arc);var g=y.a.CreateRibbon(e,{pathArray:_,closePath:!0,closeArray:!1,updatable:h,sideOrientation:d,invertUV:u,frontUVs:t.frontUVs,backUVs:t.backUVs},i);return g._creationDataStorage.pathArray=_,g._creationDataStorage.path3D=a,g._creationDataStorage.tessellation=s,g._creationDataStorage.cap=l,g._creationDataStorage.arc=t.arc,g._creationDataStorage.radius=o,g},_e),me=i(168);function _e(){}H.a.CreateIcoSphere=function(e){for(var t=e.sideOrientation||H.a.DEFAULTSIDE,i=e.radius||1,p=void 0===e.flat||e.flat,f=e.subdivisions||4,m=e.radiusX||i,_=e.radiusY||i,g=e.radiusZ||i,n=(1+Math.sqrt(5))/2,r=[-1,n,-0,1,n,0,-1,-n,0,1,-n,0,0,-1,-n,0,1,-n,0,-1,n,0,1,n,n,0,1,n,0,-1,-n,0,1,-n,0,-1],o=[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],a=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],s=[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],c=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],v=new Array,b=new Array,y=new Array,T=new Array,E=0,S=new Array(3),A=new Array(3),l=0;l<3;l++)S[l]=z.e.Zero(),A[l]=z.d.Zero();for(var u=0;u<20;u++){for(l=0;l<3;l++){var h=o[3*u+l];S[l].copyFromFloats(r[3*a[h]],r[3*a[h]+1],r[3*a[h]+2]),S[l].normalize().scaleInPlace(i),A[l].copyFromFloats(s[2*h]*(138/1024)+60/1024+c[u]*(-40/1024),s[2*h+1]*(239/1024)+26/1024+c[u]*(20/1024))}for(var d=function(e,t,i,n){var r,o,a,s=z.e.Lerp(S[0],S[2],t/f),c=z.e.Lerp(S[1],S[2],t/f),l=f===t?S[2]:z.e.Lerp(s,c,e/(f-t));l.normalize(),(a=p?(r=z.e.Lerp(S[0],S[2],n/f),o=z.e.Lerp(S[1],S[2],n/f),z.e.Lerp(r,o,i/(f-n))):new z.e(l.x,l.y,l.z)).x/=m,a.y/=_,a.z/=g,a.normalize();var u=z.d.Lerp(A[0],A[2],t/f),h=z.d.Lerp(A[1],A[2],t/f),d=f===t?A[2]:z.d.Lerp(u,h,e/(f-t));b.push(l.x*m,l.y*_,l.z*g),y.push(a.x,a.y,a.z),T.push(d.x,d.y),v.push(E),E++},C=0;C<f;C++)for(var P=0;P+C<f;P++)d(P,C,P+1/3,C+1/3),d(P+1,C,P+1/3,C+1/3),d(P,C+1,P+1/3,C+1/3),P+C+1<f&&(d(P+1,C,P+2/3,C+2/3),d(P+1,C+1,P+2/3,C+2/3),d(P,C+1,P+2/3,C+2/3))}H.a._ComputeSides(t,b,v,y,T,e.frontUVs,e.backUVs);var x=new H.a;return x.indices=v,x.positions=b,x.normals=y,x.uvs=T,x},X.a.CreateIcoSphere=function(e,t,i){return ge.CreateIcoSphere(e,t,i)};var ge=(be.CreateIcoSphere=function(e,t,i){void 0===i&&(i=null);var n=new X.a(e,i);return t.sideOrientation=X.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,H.a.CreateIcoSphere(t).applyToMesh(n,t.updatable),n},be),ve=i(211);function be(){}X.a.CreateDecal=function(e,t,i,n,r,o){var a={position:i,normal:n,size:r,angle:o};return Ee.CreateDecal(e,t,a)};var ye,Te,Ee=(Oe.CreateDecal=function(e,t,i){var n,r,o,a=t.getIndices(),s=t.getVerticesData(F.b.PositionKind),c=t.getVerticesData(F.b.NormalKind),l=i.position||z.e.Zero(),u=i.normal||z.e.Up(),p=i.size||z.e.One(),h=i.angle||0;
1u||(n=new z.e(0,0,1),r=t.getScene().activeCamera,o=z.e.TransformCoordinates(n,r.getWorldMatrix()),u=r.globalPosition.subtract(o));var d=-Math.atan2(u.z,u.x)-Math.PI/2,f=Math.sqrt(u.x*u.x+u.z*u.z),m=Math.atan2(u.y,f),_=z.a.RotationYawPitchRoll(d,m,h).multiply(z.a.Translation(l.x,l.y,l.z)),g=z.a.Invert(_),v=t.getWorldMatrix().multiply(g),b=new H.a;b.indices=[],b.positions=[],b.normals=[],b.uvs=[];for(var y=0,T=function(e){var t=new ve.b;if(!a||!s||!c)return t;var i=a[e];return t.position=new z.e(s[3*i],s[3*i+1],s[3*i+2]),t.position=z.e.TransformCoordinates(t.position,v),t.normal=new z.e(c[3*i],c[3*i+1],c[3*i+2]),t.normal=z.e.TransformNormal(t.normal,v),t},E=function(e,n){if(0===e.length)return e;for(var r=.5*Math.abs(z.e.Dot(p,n)),t=function(e,t){var i=z.e.GetClipFactor(e.position,t.position,n,r);return new ve.b(z.e.Lerp(e.position,t.position,i),z.e.Lerp(e.normal,t.normal,i))},i=new Array,o=0;o<e.length;o+=3){var a,s,c,l=null,u=null,h=null,d=null;switch(((a=0<z.e.Dot(e[o].position,n)-r)?1:0)+((s=0<z.e.Dot(e[o+1].position,n)-r)?1:0)+((c=0<z.e.Dot(e[o+2].position,n)-r)?1:0)){case 0:i.push(e[o]),i.push(e[o+1]),i.push(e[o+2]);break;case 1:if(a&&(l=e[o+1],u=e[o+2],h=t(e[o],l),d=t(e[o],u)),s){l=e[o],u=e[o+2],h=t(e[o+1],l),d=t(e[o+1],u),i.push(h),i.push(u.clone()),i.push(l.clone()),i.push(u.clone()),i.push(h.clone()),i.push(d);break}c&&(l=e[o],u=e[o+1],h=t(e[o+2],l),d=t(e[o+2],u)),l&&u&&h&&d&&(i.push(l.clone()),i.push(u.clone()),i.push(h),i.push(d),i.push(h.clone()),i.push(u.clone()));break;case 2:a||(u=t(l=e[o].clone(),e[o+1]),h=t(l,e[o+2]),i.push(l),i.push(u),i.push(h)),s||(u=t(l=e[o+1].clone(),e[o+2]),h=t(l,e[o]),i.push(l),i.push(u),i.push(h)),c||(u=t(l=e[o+2].clone(),e[o]),h=t(l,e[o+1]),i.push(l),i.push(u),i.push(h))}}return i},S=0;S<a.length;S+=3){var A=new Array;if(A.push(T(S)),A.push(T(S+1)),A.push(T(S+2)),0!==(A=E(A=E(A=E(A=E(A=E(A=E(A,new z.e(1,0,0)),new z.e(-1,0,0)),new z.e(0,1,0)),new z.e(0,-1,0)),new z.e(0,0,1)),new z.e(0,0,-1))).length)for(var C=0;C<A.length;C++){var P=A[C];b.indices.push(y),P.position.toArray(b.positions,3*y),P.normal.toArray(b.normals,3*y),b.uvs.push(.5+P.position.x/p.x),b.uvs.push(.5+P.position.y/p.y),y++}}var x=new X.a(e,t.getScene());return b.applyToMesh(x),x.position=l.clone(),x.rotation=new z.e(m,d,h),x},Oe),Se=(Re.CreateBox=function(e,t,i){return void 0===i&&(i=null),T.a.CreateBox(e,t,i)},Re.CreateTiledBox=function(e,t,i){return void 0===i&&(i=null),D.CreateTiledBox(e,t,i)},Re.CreateSphere=function(e,t,i){return void 0===i&&(i=null),L.a.CreateSphere(e,t,i)},Re.CreateDisc=function(e,t,i){return void 0===i&&(i=null),b.a.CreateDisc(e,t,i)},Re.CreateIcoSphere=function(e,t,i){return void 0===i&&(i=null),ge.CreateIcoSphere(e,t,i)},Re.CreateRibbon=function(e,t,i){return void 0===i&&(i=null),y.a.CreateRibbon(e,t,i)},Re.CreateCylinder=function(e,t,i){return void 0===i&&(i=null),N.a.CreateCylinder(e,t,i)},Re.CreateTorus=function(e,t,i){return void 0===i&&(i=null),B.a.CreateTorus(e,t,i)},Re.CreateTorusKnot=function(e,t,i){return void 0===i&&(i=null),k.CreateTorusKnot(e,t,i)},Re.CreateLineSystem=function(e,t,i){return G.a.CreateLineSystem(e,t,i)},Re.CreateLines=function(e,t,i){return void 0===i&&(i=null),G.a.CreateLines(e,t,i)},Re.CreateDashedLines=function(e,t,i){return void 0===i&&(i=null),G.a.CreateDashedLines(e,t,i)},Re.ExtrudeShape=function(e,t,i){return void 0===i&&(i=null),ae.a.ExtrudeShape(e,t,i)},Re.ExtrudeShapeCustom=function(e,t,i){return void 0===i&&(i=null),ae.a.ExtrudeShapeCustom(e,t,i)},Re.CreateLathe=function(e,t,i){return void 0===i&&(i=null),ce.CreateLathe(e,t,i)},Re.CreateTiledPlane=function(e,t,i){return void 0===i&&(i=null),he.CreateTiledPlane(e,t,i)},Re.CreatePlane=function(e,t,i){return void 0===i&&(i=null),le.a.CreatePlane(e,t,i)},Re.CreateGround=function(e,t,i){return void 0===i&&(i=null),de.a.CreateGround(e,t,i)},Re.CreateTiledGround=function(e,t,i){return void 0===i&&(i=null),de.a.CreateTiledGround(e,t,i)},Re.CreateGroundFromHeightMap=function(e,t,i,n){return void 0===n&&(n=null),de.a.CreateGroundFromHeightMap(e,t,i,n)},Re.CreatePolygon=function(e,t,i,n){return void 0===i&&(i=null),void 0===n&&(n=earcut),oe.CreatePolygon(e,t,i,n)},Re.ExtrudePolygon=function(e,t,i,n){return void 0===i&&(i=null),void 0===n&&(n=earcut),oe.ExtrudePolygon(e,t,i,n)},Re.CreateTube=function(e,t,i){return void 0===i&&(i=null),fe.CreateTube(e,t,i)},Re.CreatePolyhedron=function(e,t,i){return void 0===i&&(i=null),me.a.CreatePolyhedron(e,t,i)},Re.CreateDecal=function(e,t,i){return Ee.CreateDecal(e,t,i)}
1,Re),Ae=i(32),Ce=function(e,t,i){this.quality=e,this.distance=t,this.optimizeMesh=i},Pe=(xe.prototype.addTask=function(e){this._simplificationArray.push(e)},xe.prototype.executeNext=function(){var e=this._simplificationArray.pop();e?(this.running=!0,this.runSimplification(e)):this.running=!1},xe.prototype.runSimplification=function(n){var r,i=this;n.parallelProcessing?n.settings.forEach(function(t){i.getSimplifier(n).simplify(t,function(e){n.mesh.addLODLevel(t.distance,e),e.isVisible=!0,t.quality===n.settings[n.settings.length-1].quality&&n.successCallback&&n.successCallback(),i.executeNext()})}):(r=this.getSimplifier(n),a.a.Run(n.settings.length,function(e){function t(){e.executeNext()}var i=n.settings[e.index];r.simplify(i,function(e){n.mesh.addLODLevel(i.distance,e),e.isVisible=!0,t()})},function(){n.successCallback&&n.successCallback(),i.executeNext()}))},xe.prototype.getSimplifier=function(e){switch(e.simplificationType){case ye.QUADRATIC:default:return new Ne(e.mesh)}},xe);function xe(){this.running=!1,this._simplificationArray=[]}function Re(){}function Oe(){}(Te=ye=ye||{})[Te.QUADRATIC=0]="QUADRATIC";function Me(e){this.vertices=e,this.error=new Array(4),this.deleted=!1,this.isDirty=!1,this.deletePending=!1,this.borderFactor=0}function Ie(e,t){this.vertexId=e,this.triangleId=t}var De=(Ve.prototype.updatePosition=function(e){this.position.copyFrom(e)},Ve),Le=(Ue.prototype.det=function(e,t,i,n,r,o,a,s,c){return this.data[e]*this.data[r]*this.data[c]+this.data[i]*this.data[n]*this.data[s]+this.data[t]*this.data[o]*this.data[a]-this.data[i]*this.data[r]*this.data[a]-this.data[e]*this.data[o]*this.data[s]-this.data[t]*this.data[n]*this.data[c]},Ue.prototype.addInPlace=function(e){for(var t=0;t<10;++t)this.data[t]+=e.data[t]},Ue.prototype.addArrayInPlace=function(e){for(var t=0;t<10;++t)this.data[t]+=e[t]},Ue.prototype.add=function(e){for(var t=new Ue,i=0;i<10;++i)t.data[i]=this.data[i]+e.data[i];return t},Ue.FromData=function(e,t,i,n){return new Ue(Ue.DataFromNumbers(e,t,i,n))},Ue.DataFromNumbers=function(e,t,i,n){return[e*e,e*t,e*i,e*n,t*t,t*i,t*n,i
1*i,i*n,n*n]},Ue),Ne=(Be.prototype.simplify=function(t,e){var i=this;this.initDecimatedMesh(),a.a.Run(this._mesh.subMeshes.length,function(e){i.initWithMesh(e.index,function(){i.runDecimation(t,e.index,function(){e.executeNext()})},t.optimizeMesh)},function(){setTimeout(function(){e(i._reconstructedMesh)},0)})},Be.prototype.runDecimation=function(e,t,i){var m=this,n=~~(this.triangles.length*e.quality),_=0,r=this.triangles.length;a.a.Run(this.decimationIterations,function(e){var t,i;r-_<=n?e.breakLoop():(t=e.index,i=function(){e.executeNext()},setTimeout(function(){t%5==0&&m.updateMesh(0===t);for(var e=0;e<m.triangles.length;++e)m.triangles[e].isDirty=!1;var f=1e-9*Math.pow(t+3,m.aggressiveness);a.a.SyncAsyncForLoop(m.triangles.length,m.syncIterations,function(e){var t=~~((m.triangles.length/2+e)%m.triangles.length),i=m.triangles[t];if(i&&!(i.error[3]>f||i.deleted||i.isDirty))for(var n=0;n<3;++n)if(i.error[n]<f){var r=[],o=[],a=i.vertices[n],s=i.vertices[(n+1)%3];if(a.isBorder||s.isBorder)continue;var c=z.e.Zero();m.calculateError(a,s,c);var l=new Array;if(m.isFlipped(a,s,c,r,l))continue;if(m.isFlipped(s,a,c,o,l))continue;if(r.indexOf(!0)<0||o.indexOf(!0)<0)continue;var u=new Array;if(l.forEach(function(e){-1===u.indexOf(e)&&(e.deletePending=!0,u.push(e))}),u.length%2!=0)continue;a.q=s.q.add(a.q),a.updatePosition(c);var h=m.references.length;_=m.updateTriangles(a,a,r,_),_=m.updateTriangles(a,s,o,_);var d=m.references.length-h;if(d<=a.triangleCount){if(d)for(var p=0;p<d;p++)m.references[a.triangleStart+p]=m.references[h+p]}else a.triangleStart=h;a.triangleCount=d;break}},i,function(){return r-_<=n})},0))},function(){setTimeout(function(){m.reconstructMesh(t),i()},0)})},Be.prototype.initWithMesh=function(e,t,r){var l=this;this.vertices=[],this.triangles=[];var o=this._mesh.getVerticesData(F.b.PositionKind),u=this._mesh.getIndices(),h=this._mesh.subMeshes[e],d=[],i=h.verticesCount;a.a.SyncAsyncForLoop(i,this.syncIterations/4>>0,function(e){var t,i,n;o&&(t=e+h.verticesStart,(n=function(e){if(r)for(var t=0;t<l.vertices.length;++t)if(l.vertices[t].position.equals(e))return l.vertices[t];return null}(i=z.e.FromArray(o,3*t))||new De(i,l.vertices.length)).originalOffsets.push(t),n.id===l.vertices.length&&l.vertices.push(n),d.push(n.id))},function(){a.a.SyncAsyncForLoop(h.indexCount/3,l.syncIterations,function(e){var t,i,n,r,o,a,s,c;u&&(t=3*(h.indexStart/3+e),i=u[0+t],n=u[1+t],r=u[2+t],o=l.vertices[d[i-h.verticesStart]],a=l.vertices[d[n-h.verticesStart]],s=l.vertices[d[r-h.verticesStart]],(c=new Me([o,a,s])).originalOffset=t,l.triangles.push(c))},function(){l.init(t)})})},Be.prototype.init=function(e){var n=this;a.a.SyncAsyncForLoop(this.triangles.length,this.syncIterations,function(e){var t=n.triangles[e];t.normal=z.e.Cross(t.vertices[1].position.subtract(t.vertices[0].position),t.vertices[2].position.subtract(t.vertices[0].position)).normalize();for(var i=0;i<3;i++)t.vertices[i].q.addArrayInPlace(Le.DataFromNumbers(t.normal.x,t.normal.y,t.normal.z,-z.e.Dot(t.normal,t.vertices[0].position)))},function(){a.a.SyncAsyncForLoop(n.triangles.length,n.syncIterations,function(e){for(var t=n.triangles[e],i=0;i<3;++i)t.error[i]=n.calculateError(t.vertices[i],t.vertices[(i+1)%3]);t.error[3]=Math.min(t.error[0],t.error[1],t.error[2])},function(){e()})})},Be.prototype.reconstructMesh=function(e){for(var n,t,i=[],r=0;r<this.vertices.length;++r)this.vertices[r].triangleCount=0;for(r=0;r<this.triangles.length;++r)if(!this.triangles[r].deleted){for(n=this.triangles[r],t=0;t<3;++t)n.vertices[t].triangleCount=1;i.push(n)}var o=this._reconstructedMesh.getVerticesData(F.b.PositionKind)||[],a=this._reconstructedMesh.getVerticesData(F.b.NormalKind)||[],s=this._reconstructedMesh.getVerticesData(F.b.UVKind)||[],c=this._reconstructedMesh.getVerticesData(F.b.ColorKind)||[],l=this._mesh.getVerticesData(F.b.NormalKind),u=this._mesh.getVerticesData(F.b.UVKind),h=this._mesh.getVerticesData(F.b.ColorKind),d=0;for(r=0;r<this.vertices.length;++r){var p=this.vertices[r];p.id=d,p.triangleCount&&p.originalOffsets.forEach(function(e){l&&(o.push(p.position.x),o.push(p.position.y),o.push(p.position.z),a.push(l[3*e]),a.push(l[3*e+1]),a.push(l[3*e+2]),u&&u.length&&(s.push(u[2*e]),s.push(u[2*e+1])),h&&h.length&&(c.push(h[4*e]),c.push(h[4*e+1]),c.push(h[4*e+2]),c.push(h[4*e+3])),++d)})}var f=this._reconstructedMesh.getTotalIndices(),m=this._reconstructedMesh.getTotalVertices(),_=this._reconstructedMesh.subMeshes;this._reconstructedMesh.subMeshes=[];var g=this._reconstructedMesh.getIndices(),v=this._mesh.getIndices();for(r=0;r<i.length;++r)n=i[r],[0,1,2].forEach(function(e){var t=v[n.originalOffset+e],i=n.vertices[e].originalOffsets.indexOf(t);i<0&&(i=0),g.push(n.vertices[e].id+i+m)});this._reconstructedMesh.setIndices(g),this._reconstructedMesh.setVerticesData(F.b.PositionKind,o),this._reconstructedMesh.setVerticesData(F.b.NormalKind,a),0<s.length&&this._reconstructedMesh.setVerticesData(F.b.UVKind,s),0<c.length&&this._reconstructedMesh.setVerticesData(F.b.ColorKind,c);var b=this._mesh.subMeshes[e];0<e&&(this._reconstructedMesh.subMeshes=[],_.forEach(function(e){w.a.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())}),w.a.AddToMesh(b.materialIndex,m,d,f,3*i.length,this._reconstructedMesh))},Be.prototype.initDecimatedMesh=function(){this._reconstructedMesh=new X.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},Be.prototype.isFlipped=function(e,t,i,n,r){for(var o=0;o<e.triangleCount;++o){var a=this.triangles[this.references[e.triangleStart+o].triangleId];if(!a.deleted){var s=this.references[e.triangleStart+o].vertexId,c=a.vertices[(s+1)%3],l=a.vertices[(s+2)%3];if(c!==t&&l!==t){var u=(u=c.position.subtract(i)).normalize(),h=(h=l.position.subtract(i)).normalize();if(.999<Math.abs(z.e.Dot(u,h)))return!0;var d=z.e.Cross(u,h).normalize();if(n[o]=!1,z.e.Dot(d,a.normal)<.2)return!0}else n[o]=!0,r.push(a)}}return!1},Be.prototype.updateTriangles=function(e,t,i,n){for(var r=n,o=0;o<t.triangleCount;++o){var a=this.references[t.triangleStart+o],s=this.triangles[a.tri
1angleId];s.deleted||(i[o]&&s.deletePending?(s.deleted=!0,r++):(s.vertices[a.vertexId]=e,s.isDirty=!0,s.error[0]=this.calculateError(s.vertices[0],s.vertices[1])+s.borderFactor/2,s.error[1]=this.calculateError(s.vertices[1],s.vertices[2])+s.borderFactor/2,s.error[2]=this.calculateError(s.vertices[2],s.vertices[0])+s.borderFactor/2,s.error[3]=Math.min(s.error[0],s.error[1],s.error[2]),this.references.push(a)))}return r},Be.prototype.identifyBorder=function(){for(var e=0;e<this.vertices.length;++e){for(var t=[],i=[],n=this.vertices[e],r=0;r<n.triangleCount;++r)for(var o=this.triangles[this.references[n.triangleStart+r].triangleId],a=0;a<3;a++){for(var s=0,c=o.vertices[a];s<t.length&&i[s]!==c.id;)++s;s===t.length?(t.push(1),i.push(c.id)):t[s]++}for(r=0;r<t.length;++r)1===t[r]?this.vertices[i[r]].isBorder=!0:this.vertices[i[r]].isBorder=!1}},Be.prototype.updateMesh=function(e){var t,i,n;if(void 0===e&&(e=!1),!e){for(var r=[],o=0;o<this.triangles.length;++o)this.triangles[o].deleted||r.push(this.triangles[o]);this.triangles=r}for(o=0;o<this.vertices.length;++o)this.vertices[o].triangleCount=0,this.vertices[o].triangleStart=0;for(o=0;o<this.triangles.length;++o)for(t=this.triangles[o],i=0;i<3;++i)(n=t.vertices[i]).triangleCount++;var a=0;for(o=0;o<this.vertices.length;++o)this.vertices[o].triangleStart=a,a+=this.vertices[o].triangleCount,this.vertices[o].triangleCount=0;var s=new Array(3*this.triangles.length);for(o=0;o<this.triangles.length;++o)for(t=this.triangles[o],i=0;i<3;++i)s[(n=t.vertices[i]).triangleStart+n.triangleCount]=new Ie(i,o),n.triangleCount++;this.references=s,e&&this.identifyBorder()},Be.prototype.vertexError=function(e,t){var i=t.x,n=t.y,r=t.z;return e.data[0]*i*i+2*e.data[1]*i*n+2*e.data[2]*i*r+2*e.data[3]*i+e.data[4]*n*n+2*e.data[5]*n*r+2*e.data[6]*n+e.data[7]*r*r+2*e.data[8]*r+e.data[9]},Be.prototype.calculateError=function(e,t,i){var n,r,o,a,s=e.q.add(t.q),c=e.isBorder&&t.isBorder,l=0,u=s.det(0,1,2,1,4,5,2,5,7);return 0===u||c?(n=e.position.add(t.position).divide(new z.e(2,2,2)),r=this.vertexError(s,e.position),o=this.vertexError(s,t.position),a=this.vertexError(s,n),(l=Math.min(r,o,a))===r?i&&i.copyFrom(e.position):l===o?i&&i.copyFrom(t.position):i&&i.copyFrom(n)):((i=i||z.e.Zero()).x=-1/u*s.det(1,2,3,4,5,6,5,7,8),i.y=1/u*s.det(0,2,3,1,5,6,2,7,8),i.z=-1/u*s.det(0,1,3,1,4,6,2,5,8),l=this.vertexError(s,i)),l},Be),Fe=i(18),we=i(17);function Be(e){this._mesh=e,this.syncIterations=5e3,this.aggressiveness=7,this.decimationIterations=100,this.boundingBoxEpsilon=Ae.a}function Ue(e){this.data=new Array(10);for(var t=0;t<10;++t)e&&e[t]?this.data[t]=e[t]:this.data[t]=0}function Ve(e,t){this.position=e,this.id=t,this.isBorder=!0,this.q=new Le,this.triangleCount=0,this.triangleStart=0,this.originalOffsets=[]}Object.defineProperty(Fe.a.prototype,"simplificationQueue",{get:function(){var e;return this._simplificationQueue||(this._simplificationQueue=new Pe,(e=this._getComponent(we.a.NAME_SIMPLIFICATIONQUEUE))||(e=new ke(this),this._addComponent(e))),this._simplificationQueue},set:function(e){this._simplificationQueue=e},enumerable:!0,configurable:!0}),X.a.prototype.simplify=function(e,t,i,n){return void 0===t&&(t=!0),void 0===i&&(i=ye.QUADRATIC),this.get
1Scene().simplificationQueue.addTask({settings:e,parallelProcessing:t,mesh:this,simplificationType:i,successCallback:n}),this};var ke=(Xe.prototype.register=function(){this.scene._beforeCameraUpdateStage.registerStep(we.a.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE,this,this._beforeCameraUpdate)},Xe.prototype.rebuild=function(){},Xe.prototype.dispose=function(){},Xe.prototype._beforeCameraUpdate=function(){this.scene._simplificationQueue&&!this.scene._simplificationQueue.running&&this.scene._simplificationQueue.executeNext()},Xe),Ge=i(246),ze=i(51),je=i(209),We=i(123),He=i(122);function Xe(e){this.name=we.a.NAME_SIMPLIFICATIONQUEUE,this.scene=e}X.a.prototype.thinInstanceAdd=function(e,t){void 0===t&&(t=!0),this._thinInstanceUpdateBufferSize("matrix",Array.isArray(e)?e.length:1);var i=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(e))for(var n=0;n<e.length;++n)this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++,e[n],n===e.length-1&&t);else this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++,e,t);return i},X.a.prototype.thinInstanceAddSelf=function(e){return void 0===e&&(e=!0),this.thinInstanceAdd(z.a.IdentityReadOnly,e)},X.a.prototype.thinInstanceRegisterAttribute=function(e,t){this.removeVerticesData(e),this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.strides[e]=t,this._userThinInstanceBuffersStorage.sizes[e]=t*Math.max(32,this._thinInstanceDataStorage.instancesCount),this._userThinInstanceBuffersStorage.data[e]=new Float32Array(this._userThinInstanceBuffersStorage.sizes[e]),this._userThinInstanceBuffersStorage.vertexBuffers[e]=new F.b(this.getEngine(),this._userThinInstanceBuffersStorage.data[e],e,!0,!1,t,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])},X.a.prototype.thinInstanceSetMatrixAt=function(e,t,i){if(void 0===i&&(i=!0),!this._thinInstanceDataStorage.matrixData||e>=this._thinInstanceDataStorage.instancesCount)return!1;var n=this._thinInstanceDataStorage.matrixData;return t.copyToArray(n,16*e),i&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},X.a.prototype.thinInstanceSetAttributeAt=function(e,t,i,n){return void 0===n&&(n=!0),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount||(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(i,t*this._userThinInstanceBuffersStorage.strides[e]),n&&this.thinInstanceBufferUpdated(e),0))},Object.defineProperty(X.a.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,i;e<=(null!==(i=null===(t=this._thinInstanceDataStorage.matrixData)||void 0===t?void 0:t.length)&&void 0!==i?i:0)/16&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),X.a.prototype.thinInstanceSetBuffer=function(e,t,i,n){var r,o,a;void 0===i&&(i=0),void 0===n&&(n=!1),i=i||16,"matrix"===e?(null===(r=this._thinInstanceDataStorage.matrixBuffer)||void 0===r||r.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*i,null!==(this._thinInstanceDataStorage.matrixData=t)?(this._thinInstanceDataStorage.instancesCount=t.length/i,a=new F.a(this.getEngine(),t,!n,i,!1,!0),this._thinInstanceDataStorage.matrixBuffer=a,this.setVerticesBuffer(a.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(a.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(a.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(a.createVertexBuffer("world3",12,4)),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo(!0))):null===t?null!==(o=this._userThinInstanceBuffersStorage)&&void 0!==o&&o.data[e]&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=i,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new F.b(this.getEngine(),t,e,!n,!1,i,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e]))},X.a.prototype.thinInstanceBufferUpdated=function(e){var t;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.
1instancesCount):null!==(t=this._userThinInstanceBuffersStorage)&&void 0!==t&&t.vertexBuffers[e]&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0)},X.a.prototype.thinInstanceRefreshBoundingInfo=function(e){if(void 0===e&&(e=!1),this._thinInstanceDataStorage.matrixData&&this._thinInstanceDataStorage.matrixBuffer){var t=this._thinInstanceDataStorage.boundingVectors;e&&(t.length=0,this.refreshBoundingInfo(!0));var i=this.getBoundingInfo(),n=this._thinInstanceDataStorage.matrixData;if(0===t.length)for(var r=this.getWorldMatrix(),o=0;o<i.boundingBox.vectors.length;++o)t.push(i.boundingBox.vectors[o].clone()),z.e.TransformCoordinatesToRef(t[o],r,t[o]);z.c.Vector3[0].setAll(Number.MAX_VALUE),z.c.Vector3[1].setAll(Number.MIN_VALUE);for(var a=0;a<this._thinInstanceDataStorage.instancesCount;++a)for(z.a.FromArrayToRef(n,16*a,z.c.Matrix[0]),o=0;o<t.length;++o)z.e.TransformCoordinatesToRef(t[o],z.c.Matrix[0],z.c.Vector3[2]),z.c.Vector3[0].minimizeInPlace(z.c.Vector3[2]),z.c.Vector3[1].maximizeInPlace(z.c.Vector3[2]);i.reConstruct(z.c.Vector3[0],z.c.Vector3[1])}},X.a.prototype._thinInstanceUpdateBufferSize=function(e,t){var i,n;void 0===t&&(t=1);var r="matrix"===e;if(r||this._userThinInstanceBuffersStorage&&this._userThinInstanceBuffersStorage.strides[e]){for(var o,a,s=r?16:this._userThinInstanceBuffersStorage.strides[e],c=r?this._thinInstanceDataStorage.matrixBufferSize:this._userThinInstanceBuffersStorage.sizes[e],l=r?this._thinInstanceDataStorage.matrixData:this._userThinInstanceBuffersStorage.data[e],u=(this._thinInstanceDataStorage.instancesCount+t)*s,h=c;h<u;)h*=2;l&&c==h||(l=l?((o=new Float32Array(h)).set(l,0),o):new Float32Array(h),r?(null===(i=this._thinInstanceDataStorage.matrixBuffer)||void 0===i||i.dispose(),a=new F.a(this.getEngine(),l,!0,s,!1,!0),this._thinInstanceDataStorage.matrixBuffer=a,this._thinInstanceDataStorage.matrixData=l,this._thinInstanceDataStorage.matrixBufferSize=h,this.setVerticesBuffer(a.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(a.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(a.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(a.createVertexBuffer("world3",12,4))):(null===(n=this._userThinInstanceBuffersStorage.vertexBuffers[e])||void 0===n||n.dispose(),this._userThinInstanceBuffersStorage.data[e]=l,this._userThinInstanceBuffersStorage.sizes[e]=h,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new F.b(this.getEngine(),l,e,!0,!1,s,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])))}},X.a.prototype._thinInstanceInitializeUserStorage=function(){this._userThinInstanceBuffersStorage||(this._userThinInstanceBuffersStorage={data:{},sizes:{},vertexBuffers:{},strides:{}})},X.a.prototype._disposeThinInstanceSpecificData=function(){var e;null!==(e=this._thinInstanceDataStorage)&&void 0!==e&&e.matrixBuffer&&(this._thinInstanceDataStorage.matrixBuffer.dispose(),this._thinInstanceDataStorage.matrixBuffer=null)}},function(e,t,i){"use strict";i.d(t,"a",function(){return d}),i.d(t,"b",function(){return p.a}),i.d(t,"c",function(){return _}),i.d(t,"d",function(){return A}),i.d(t,"g",function(){return C}),i.d(t,"e",function(){return P.a}),i.d(t,"f",function(){return x.a}),i.d(t,"i",function(){return k}),i.d(t,"j",function(){return W}),i.d(t,"h",function(){return Q}),i.d(t,"k",function(){return q.a}),i.d(t,"l",function(){return Z.a}),i.d(t,"m",function(){return Z.b}),i.d(t,"n",function(){return J.a});var n=i(18),ie=i(4),r=i(28),o=i(16),ne=i(0),s=i(40),a=i(17),c=i(29),l=i(121),u=(i(91),i(334),i(335),i(10)),h=i(6);Object.defineProperty(n.a.prototype,"forceShowBoundingBoxes",{get:function(){return this._forceShowBoundingBoxes||!1},set:function(e){(this._forceShowBoundingBoxes=e)&&this.getBoundingBoxRenderer()},enumerable:!0,configurable:!0}),n.a.prototype.getBoundingBoxRenderer=function(){return this._boundingBoxRenderer||(this._boundingBoxRenderer=new d(this)),this._boundingBoxRenderer},Object.defineProperty(r.a.prototype,"showBoundingBox",{get:function(){return this._showBoundingBox||!1}
1,set:function(e){(this._showBoundingBox=e)&&this.getScene().getBoundingBoxRenderer()},enumerable:!0,configurable:!0});var d=(m.prototype.register=function(){this.scene._beforeEvaluateActiveMeshStage.registerStep(a.a.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER,this,this.reset),this.scene._activeMeshStage.registerStep(a.a.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER,this,this._activeMesh),this.scene._evaluateSubMeshStage.registerStep(a.a.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER,this,this._evaluateSubMesh),this.scene._afterRenderingGroupDrawStage.registerStep(a.a.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER,this,this.render)},m.prototype._evaluateSubMesh=function(e,t){var i;!e.showSubMeshesBoundingBox||null!=(i=t.getBoundingInfo())&&(i.boundingBox._tag=e.renderingGroupId,this.renderList.push(i.boundingBox))},m.prototype._activeMesh=function(e,t){var i;(e.showBoundingBox||this.scene.forceShowBoundingBoxes)&&((i=e.getBoundingInfo()).boundingBox._tag=t.renderingGroupId,this.renderList.push(i.boundingBox))},m.prototype._prepareRessources=function(){var e,t;this._colorShader||(this._colorShader=new l.a("colorShader",this.scene,"color",{attributes:[ie.b.PositionKind],uniforms:["world","viewProjection","color"]}),this._colorShader.reservedDataStore={hidden:!0},e=this.scene.getEngine(),t=o.a.CreateBox({size:1}),this._vertexBuffers[ie.b.PositionKind]=new ie.b(e,t.positions,ie.b.PositionKind,!1),this._createIndexBuffer(),this._fillIndexData=t.indices)},m.prototype._createIndexBuffer=function(){var e=this.scene.getEngine();this._indexBuffer=e.createIndexBuffer([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,7,1,6,2,5,3,4])},m.prototype.rebuild=function(){var e=this._vertexBuffers[ie.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},m.prototype.reset=function(){this.renderList.reset()},m.prototype.render=function(e){if(0!==this.renderList.length&&(this._prepareRessources(),this._colorShader.isReady())){var t=this.scene.getEngine();t.setDepthWrite(!1),this._colorShader._preBind();for(var i=0;i<this.renderList.length;i++){var n,r,o,a,s=this.renderList.data[i];s._tag===e&&(this.onBeforeBoxRenderingObservable.notifyObservers(s),n=s.minimum,r=s.maximum.subtract(n),o=n.add(r.scale(.5)),a=ne.a.Scaling(r.x,r.y,r.z).multiply(ne.a.Translation(o.x,o.y,o.z)).multiply(s.getWorldMatrix()),t.bindBuffers(this._vertexBuffers,this._indexBuffer,this._colorShader.getEffect()),this.showBackLines&&(t.setDepthFunctionToGreaterOrEqual(),this.scene.resetCachedMaterial(),this._colorShader.setColor4("color",this.backColor.toColor4()
1),this._colorShader.bind(a),t.drawElementsType(c.a.LineListDrawMode,0,24)),t.setDepthFunctionToLess(),this.scene.resetCachedMaterial(),this._colorShader.setColor4("color",this.frontColor.toColor4()),this._colorShader.bind(a),t.drawElementsType(c.a.LineListDrawMode,0,24),this.onAfterBoxRenderingObservable.notifyObservers(s))}this._colorShader.unbind(),t.setDepthFunctionToLessOrEqual(),t.setDepthWrite(!0)}},m.prototype.renderOcclusionBoundingBox=function(e){var t,i,n,r,o,a;this._prepareRessources(),this._colorShader.isReady()&&e._boundingInfo&&(t=this.scene.getEngine(),this._fillIndexBuffer||(this._fillIndexBuffer=t.createIndexBuffer(this._fillIndexData)),t.setDepthWrite(!1),t.setColorWrite(!1),this._colorShader._preBind(),n=(i=e._boundingInfo.boundingBox).minimum,r=i.maximum.subtract(n),o=n.add(r.scale(.5)),a=ne.a.Scaling(r.x,r.y,r.z).multiply(ne.a.Translation(o.x,o.y,o.z)).multiply(i.getWorldMatrix()),t.bindBuffers(this._vertexBuffers,this._fillIndexBuffer,this._colorShader.getEffect()),t.setDepthFunctionToLess(),this.scene.resetCachedMaterial(),this._colorShader.bind(a),t.drawElementsType(c.a.TriangleFillMode,0,36),this._colorShader.unbind(),t.setDepthFunctionToLessOrEqual(),t.setDepthWrite(!0),t.setColorWrite(!0))},m.prototype.dispose=function(){var e;this._colorShader&&(this.onBeforeBoxRenderingObservable.clear(),this.onAfterBoxRenderingObservable.clear(),this.renderList.dispose(),this._colorShader.dispose(),(e=this._vertexBuffers[ie.b.PositionKind])&&(e.dispose(),this._vertexBuffers[ie.b.PositionKind]=null),this.scene.getEngine()._releaseBuffer(this._indexBuffer),this._fillIndexBuffer&&(this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer),this._fillIndexBuffer=null))},m),p=i(172),f=i(2);function m(e){this.name=a.a.NAME_BOUNDINGBOXRENDERER,this.frontColor=new u.a(1,1,1),this.backColor=new u.a(.1,.1,.1),this.showBackLines=!0,this.onBeforeBoxRenderingObservable=new h.c,this.onAfterBoxRenderingObservable=new h.c,this.renderList=new s.a(32),this._vertexBuffers={},this._fillIndexBuffer=null,this._fillIndexData=null,(this.scene=e)._addComponent(this)}n.a.prototype.enableDepthRenderer=function(e,t){if(void 0===t&&(t=!1),!(e=e||this.activeCamera))throw"No camera available to enable depth renderer";var i;return this._depthRenderer||(this._depthRenderer={}),this._depthRenderer[e.id]||(i=this.getEngine().getCaps().textureHalfFloatRender?f.a.TEXTURETYPE_HALF_FLOAT:this.getEngine().getCaps().textureFloatRender?f.a.TEXTURETYPE_FLOAT:f.a.TEXTURETYPE_UNSIGNED_BYTE,this._depthRenderer[e.id]=new p.a(this,i,e,t)),this._depthRenderer[e.id]},n.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 _=(g.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(a.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER,this,this._gatherRenderTargets),this.scene._gatherActiveCameraRenderTargetsStage.registerStep(a.a.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER,this,this._gatherActiveCameraRenderTargets)},g.prototype.rebuild=function(){},g.prototype.dispose=function(){for(var e in this.scene._depthRenderer)this.scene._depthRenderer[e].dispose()},g.prototype._gatherRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.enabled&&!i.useOnlyInActiveCamera&&e.push(i.getDepthMap())}},g.prototype._gatherActiveCameraRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.enabled&&i.useOnlyInActiveCamera&&this.scene.activeCamera.id===t&&e.push(i.getDepthMap())}},g);function g(e){this.name=a.a.NAME_DEPTHRENDERER,this.scene=e}p.a._SceneComponentInitialization=function(e){var t=e._getComponent(a.a.NAME_DEPTHRENDERER);t||(t=new _(e),e._addComponent(t))};var v=i(1),b=i(139),y=i(25),T=i(5);T.a.ShadersStore.linePixelShader="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}",i(108),i(109);T.a.ShadersStore.lineVertexShader="#include<instancesDeclaration>\n\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 viewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\n#include<instancesVertex>\nmat4 worldViewProjection=viewProjection*finalWorld;\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;
1\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}",r.a.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},r.a.prototype.enableEdgesRendering=function(e,t,i){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new A(this,e,t,!0,i),this},Object.defineProperty(r.a.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),b.b.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new C(this,e,t),this},b.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),b.b.prototype.enableEdgesRendering.apply(this,arguments),this};function E(){this.edges=new Array,this.edgesConnectedCount=0}var S,A=(w.GetShader=function(e){var t;return e._edgeRenderLineShader||((t=new l.a("lineShader",e,"line",{attributes:["position","normal"],uniforms:["world","viewProjection","color","width","aspectRatio"]})).disableDepthWrite=!0,t.backFaceCulling=!1,e._edgeRenderLineShader=t),e._edgeRenderLineShader},w.prototype._prepareRessources=function(){this._lineShader||(this._lineShader=w.GetShader(this._source.getScene()))},w.prototype._rebuild=function(){var e=this._buffers[ie.b.PositionKind];e&&e._rebuild(),(e=this._buffers[ie.b.NormalKind])&&e._rebuild();var t=this._source.getScene().getEngine();this._ib=t.createIndexBuffer(this._linesIndices)},w.prototype.dispose=function(){this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);var e=this._buffers[ie.b.PositionKind];e&&(e.dispose(),this._buffers[ie.b.PositionKind]=null),(e=this._buffers[ie.b.NormalKind])&&(e.dispose(),this._buffers[ie.b.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose()},w.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},w.prototype._processEdgeForAdjacenciesWithVertices=function(e,t,i,n,r){var o=1e-10;return e.equalsWithEpsilon(i,o)&&t.equalsWithEpsilon(n,o)||e.equalsWithEpsilon(n,o)&&t.equalsWithEpsilon(i,o)?0:e.equalsWithEpsilon(n,o)&&t.equalsWithEpsilon(r,o)||e.equalsWithEpsilon(r,o)&&t.equalsWithEpsilon(n,o)?1:e.equalsWithEpsilon(r,o)&&t.equalsWithEpsilon(i,o)||e.equalsWithEpsilon(i,o)&&t.equalsWithEpsilon(r,o)?2:-1},w.prototype._checkEdge=function(e,t,i,n,r){var o=void 0===t||ne.e.Dot(i[e],i[t])<this._epsilon;o&&this.createLine(n,r,this._linesPositions.length/3)},w.prototype.createLine=function(e,t,i){this._linesPositions.push(e.x,e.y,e.z,e.x,e.y,e.z,t.x,t.y,t.z,t.x,t.y,t.z),this._linesNormals.push(t.x,t.y,t.z,-1,t.x,t.y,t.z,1,e.x,e.y,e.z,-1,e.x,e.y,e.z,1),this._linesIndices.push(i,i+1,i+2,i,i+2,i+3)},w.prototype._tessellateTriangle=function(e,t,i,n){function r(e,t,i){0<=i&&t.push(i);for(var n=0;n<e.length;++n)t.push(e[n][0])}var o=0;e[1].length>=e[0].length&&e[1].length>=e[2].length?o=1:e[2].length>=e[0].length&&e[2].length>=e[1].length&&(o=2);for(var a=0;a<3;++a)a===o?e[a].sort(function(e,t){return e[1]<t[1]?-1:e[1]>t[1]?1:0}):e[a].sort(function(e,t){return e[1]>t[1]?-1:e[1]<t[1]?1:0});var s=[],c=[];r(e[o],s,-1);for(var l=s.length,u=o+2;o+1<=u;--u)r(e[u%3],c,u!==o+2?n[i[t+(u+1)%3]]:-1);var h=c.length;i.push(n[i[t+o]],s[0],c[0]),i.push(n[i[t+(o+1)%3]],c[h-1],s[l-1]);for(var d=l<=h,p=d?l:h,f=d?h:l,m=d?l-1:h-1,_=d?0:1,g=l+h-2,v=0,b=0,y=d?s:c,T=d?c:s,E=0;0<g--;){_?i.push(y[v],T[b]):i.push(T[b],y[v]);var S=void 0;(E+=p)>=f&&v<m?(S=y[++v],E-=f):S=T[++b],i.push(S)}i[t+0]=i[i.length-3],i[t+1]=i[i.length-2],i[t+2]=i[i.length-1],i.length=i.length-3},w.prototype._generateEdgesLinesAlternate=function(){var e,t,i,n,r,o,a,s,c,l=this._source.getVerticesData(ie.b.PositionKind),u=this._source.getIndices();if(u&&l){Array.isArray(u)||(u=Array.from(u));var h=null===(t=null===(e=this._options)||void 0===e?void 0:e.useFastVertexMerger)||void 0===t||t,d=h?Math.round(-Math.log(null!==(n=null===(i=this._options)||void 0===i?void 0:i.epsilonVertexMerge)&&void 0!==n?n:1e-6)/Math.log(10)):null!==(o=null===(r=this._options)||void 0===r?void 0:r.epsilonVertexMerge)&&void 0!==o?o:1e-6,p=[],f=[];if(h)for(var m={},_=0;_<l.length;_+=3){var g,v=l[_+0],b=l[_+1],y=l[_+2];void 0!==m[ee=v.toFixed(d)+"|"+b.toFixed(d)+"|"+y.toFixed(d)]?p.push(m[ee]):(g=_/3,m[ee]=g,p.push(g),f.push(g))}else for(_=0;_<l.length;_+=3){v=l[_+0],b=l[_+1],y=l[_+2];for(var T=!1,E=0;E<_&&!T;E+=3){var S=l[E+0],A=l[E+1],C=l[E+2];if(Math.abs(v-S)<d&&Math.abs(b-A)<d&&Math.abs(y-C)<d){p.push(E/3),T=!0;break}}T||(p.push(_/3),f.push(_/3))}if(null!==(a=this._options)&&void 0!==a&&a.applyTessellation){for(var P=null!==(c=null===(s=this._options)||void 0===s?void 0:s.epsilonVertexAligned)&&void 0!==c?c:1e-6,x=[],R=0;R<u.length;R+=3)for(var O=void 0,M=0;M<3;++M){var I=p[u[R+M]],D=p[u[R+(M+1)%3]],L=p[u[R+(M+2)%3]];if(I!==D)for(var N=l[3*I+0],F=l[3*I+1],w=l[3*I+2],B=l[3*D+0],U=l[3*D+1],V=l[3*D+2],k=Math.sqrt((B-N)*(B-N)+(U-F)*(U-F)+(V-w)*(V-w)),G=0;G<f.length-1;G++){var z,j,W,H,X,Y=f[G];Y!==I&&Y!==D&&Y!==L&&(z=l[3*Y+0],j=l[3*Y+1],W=l[3*Y+2],H=Math.sqrt((z-N)*(z-N)+(j-F)*(j-F)+(W-w)*(W-w)),X=Math.sqrt((z-B)*(z-B)+(j-U)*(j-U)+(W-V)*(W-V)),Math.abs(H+X-k)<P&&(O||(O={
1index:R,edgesPoints:[[],[],[]]},x.push(O)),O.edgesPoints[M].push([Y,H])))}}for(var K=0;K<x.length;++K){var Q=x[K];this._tessellateTriangle(Q.edgesPoints,Q.index,u,p)}x=null}for(var q,Z={},R=0;R<u.length;R+=3)for(var J,$=void 0,M=0;M<3;++M)I=p[u[R+M]],D=p[u[R+(M+1)%3]],L=p[u[R+(M+2)%3]],I!==D&&(ne.c.Vector3[0].copyFromFloats(l[3*I+0],l[3*I+1],l[3*I+2]),ne.c.Vector3[1].copyFromFloats(l[3*D+0],l[3*D+1],l[3*D+2]),ne.c.Vector3[2].copyFromFloats(l[3*L+0],l[3*L+1],l[3*L+2]),$||(ne.c.Vector3[1].subtractToRef(ne.c.Vector3[0],ne.c.Vector3[3]),ne.c.Vector3[2].subtractToRef(ne.c.Vector3[1],ne.c.Vector3[4]),($=ne.e.Cross(ne.c.Vector3[3],ne.c.Vector3[4])).normalize()),D<I&&(J=I,I=D,D=J),(q=Z[ee=I+"_"+D])?q.done||(ne.e.Dot($,q.normal)<this._epsilon&&this.createLine(ne.c.Vector3[0],ne.c.Vector3[1],this._linesPositions.length/3),q.done=!0):Z[ee]={normal:$,done:!1,index:R,i:M});for(var ee in Z)(q=Z[ee]).done||(I=p[u[q.index+q.i]],D=p[u[q.index+(q.i+1)%3]],ne.c.Vector3[0].copyFromFloats(l[3*I+0],l[3*I+1],l[3*I+2]),ne.c.Vector3[1].copyFromFloats(l[3*D+0],l[3*D+1],l[3*D+2]),this.createLine(ne.c.Vector3[0],ne.c.Vector3[1],this._linesPositions.length/3));var te=this._source.getScene().getEngine();this._buffers[ie.b.PositionKind]=new ie.b(te,this._linesPositions,ie.b.PositionKind,!1),this._buffers[ie.b.NormalKind]=new ie.b(te,this._linesNormals,ie.b.NormalKind,!1,!1,4),this._buffersForInstances[ie.b.PositionKind]=this._buffers[ie.b.PositionKind],this._buffersForInstances[ie.b.NormalKind]=this._buffers[ie.b.NormalKind],this._ib=te.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},w.prototype._generateEdgesLines=function(){var e=this._source.getVerticesData(ie.b.PositionKind),t=this._source.getIndices();if(t&&e){for(var i,n=new Array,r=new Array,o=0;o<t.length;o+=3){i=new E;var a=t[o],s=t[o+1],c=t[o+2];i.p0=new ne.e(e[3*a],e[3*a+1],e[3*a+2]),i.p1=new ne.e(e[3*s],e[3*s+1],e[3*s+2]),i.p2=new ne.e(e[3*c],e[3*c+1],e[3*c+2]);var l=ne.e.Cross(i.p1.subtract(i.p0),i.p2.subtract(i.p1));l.normalize(),r.push(l),n.push(i)}for(o=0;o<n.length;o++){i=n[o];for(var u=o+1;u<n.length;u++){var h=n[u];if(3===i.edgesConnectedCount)break;if(3!==h.edgesConnectedCount)for(var d=t[3*u],p=t[3*u+1],f=t[3*u+2],m=0;m<3;m++){var _=0;if(void 0===i.edges[m]){switch(m){case 0:_=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(i.p0,i.p1,h.p0,h.p1,h.p2):this._processEdgeForAdjacencies(t[3*o],t[3*o+1],d,p,f);break;case 1:_=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(i.p1,i.p2,h.p0,h.p1,h.p2):this._processEdgeForAdjacencies(t[3*o+1],t[3*o+2],d,p,f);break;case 2:_=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(i.p2,i.p0,h.p0,h.p1,h.p2):this._processEdgeForAdjacencies(t[3*o+2],t[3*o],d,p,f)}if(-1!==_&&(i.edges[m]=u,h.edges[_]=o,i.edgesConnectedCount++,h.edgesConnectedCount++,3===i.edgesConnectedCount))break}}}}for(o=0;o<n.length;o++){var g=n[o];this._checkEdge(o,g.edges[0],r,g.p0,g.p1),this._checkEdge(o,g.edges[1],r,g.p1,g.p2),this._checkEdge(o,g.edges[2],r,g.p2,g.p0)}var v=this._source.getScene().getEngine();this._buffers[ie.b.PositionKind]=new ie.b(v,this._linesPositions,ie.b.PositionKind,!1),this._buffers[ie.b.NormalKind]=new ie.b(v,this._linesNormals,ie.b.NormalKind,!1,!1,4),this._buffersForInstances[ie.b.PositionKind]=this._buffers[ie.b.PositionKind],this._buffersForInstances[ie.b.NormalKind]=this._buffers[ie.b.NormalKind],this._ib=v.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},w.prototype.isReady=function(){return this._lineShader.isReady(this._source,this._source.hasInstances&&0<this.customInstances.length||this._source.hasThinInstances)},w.prototype.render=function(){var e=this._source.getScene();if(this.isReady()&&e.activeCamera){var t=e.getEngine();this._lineShader._preBind(),1!==this._source.edgesColor.a?t.setAlphaMode(f.a.ALPHA_COMBINE):t.setAlphaMode(f.a.ALPHA_DISABLE);var i=this._source.hasInstances&&0<this.customInstances.length,n=i||this._source.hasThinInstances,r=0;if(n)if(this._buffersForInstances.world0=this._source.getVertexBuffer("world0"),this._buffersForInstances.world1=this._source.getVertexBuffer("world1"),this._buffersForInstances.world2=this._source.getVertexBuffer("world2"),this._buffersForInstances.world3=this._source.getVertexBuffer("world3"),i){var o=this._source._instanceDataStorage,r=this.customInstances.length;if(!o.isFrozen){for(var a=0,s=0;s<r;++s)this.customInstances.data[s].copyToArray(o.instancesData,a),a+=16;o.instancesBuffer.updateDirectly(o.instancesData,0,r)}}else r=this._source.thinInstanceCount;t.bindBuffers(n?this._buffersForInstances:this._buffers,this._ib,this._lineShader.getEffect()),e.resetCachedMaterial(),this._lineShader.setColor4("color",this._source.edgesColor),e.activeCamera.mode===y.a.ORTHOGRAPHIC_CAMERA?this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForOrthogra
1phic):this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForPerspective),this._lineShader.setFloat("aspectRatio",t.getAspectRatio(e.activeCamera)),this._lineShader.bind(this._source.getWorldMatrix()),t.drawElementsType(c.a.TriangleFillMode,0,this._indicesCount,r),this._lineShader.unbind(),this.customInstances.reset()}},w),C=(S=A,Object(v.d)(F,S),F.prototype._generateEdgesLines=function(){var e=this._source.getVerticesData(ie.b.PositionKind),t=this._source.getIndices();if(t&&e){for(var i=ne.c.Vector3[0],n=ne.c.Vector3[1],r=t.length-1,o=0,a=0;o<r;o+=2,a+=4)ne.e.FromArrayToRef(e,3*t[o],i),ne.e.FromArrayToRef(e,3*t[o+1],n),this.createLine(i,n,a);var s=this._source.getScene().getEngine();this._buffers[ie.b.PositionKind]=new ie.b(s,this._linesPositions,ie.b.PositionKind,!1),this._buffers[ie.b.NormalKind]=new ie.b(s,this._linesNormals,ie.b.NormalKind,!1,!1,4),this._ib=s.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},F),P=i(127),x=i(231),R=i(187),O=i(147),M=i(21),I=i(7),D=i(9),L=i(23),N=(i(333),"#define rcp(x) 1./x\n#define GOLDEN_RATIO 1.618033988749895\n#define TWO_PI 6.2831855\n\n\nvec2 Golden2dSeq(int i,float n)\n{\n\n\nreturn vec2(float(i)/n+(0.5/n),fract(float(i)*rcp(GOLDEN_RATIO)));\n}\nvec2 SampleDiskGolden(int i,int sampleCount)\n{\nvec2 f=Golden2dSeq(i,float(sampleCount));\nreturn vec2(sqrt(f.x),TWO_PI*f.y);\n}");function F(e,t,i){void 0===t&&(t=.95),void 0===i&&(i=!1);var n=S.call(this,e,t,i,!1)||this;return n._generateEdgesLines(),n}function w(e,t,i,n,r){var o,a=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._buffersForInstances={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this.customInstances=new s.a(32),this._source=e,this._checkVerticesInsteadOfIndices=i,this._options=null!=r?r:null,this._epsilon=t,this._prepareRessources(),n&&(null===(o=null==r?void 0:r.useAlternateEdgeFinder)||void 0===o||o?this._generateEdgesLinesAlternate():this._generateEdgesLines()),this._meshRebuildObserver=this._source.onRebuildObservable.add(function(){a._rebuild()}),this._meshDisposeObserver=this._source.onDisposeObservable.add(function(){a.dispose()})}T.a.IncludesShadersStore.fibonacci=N,i(74),i(345);T.a.IncludesShadersStore.diffusionProfile="uniform vec3 diffusionS[5];\nuniform float diffusionD[5];\nuniform float filterRadii[5];";T.a.ShadersStore.subSurfaceScatteringPixelShader="\n#include<fibonacci>\n#include<helperFunctions>\n#include<subSurfaceScatteringFunctions>\n#include<diffusionProfile>\nvarying vec2 vUV;\nuniform vec2 texelSize;\nuniform sampler2D textureSampler;\nuniform sampler2D irradianceSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D albedoSampler;\nuniform vec2 viewportSize;\nuniform float metersPerUnit;\nconst float LOG2_E=1.4426950408889634;\nconst float SSS_PIXELS_PER_SAMPLE=4.;\nconst int _SssSampleBudget=40;\n#define rcp(x) 1./x\n#define Sq(x) x*x\n#define SSS_BILATERAL_FILTER true\n\n\nvec3 EvalBurleyDiffusionProfile(float r,vec3 S)\n{\nvec3 exp_13=exp2(((LOG2_E*(-1.0/3.0))*r)*S);\nvec3 expSum=exp_13*(1.+exp_13*exp_13);\nreturn (S*rcp(8.*PI))*expSum;\n}\n\n\n\n\n\n\nvec2 SampleBurleyDiffusionProfile(float u,float rcpS)\n{\nu=1.-u;\nfloat g=1.+(4.*u)*(2.*u+sqrt(1.+(4.*u)*u));\nfloat n=exp2(log2(g)*(-1.0/3.0));\nfloat p=(g*n)*n;\nfloat c=1.+p+n;\nfloat d=(3./LOG2_E*2.)+(3./LOG2_E)*log2(u);\nfloat x=(3./LOG2_E)*log2(c)-d;\n\n\n\n\n\n\nfloat rcpExp=((c*c)*c)*rcp((4.*u)*((c*c)+(4.*u)*(4.*u)));\nfloat r=x*rcpS;\nfloat rcpPdf=(8.*PI*rcpS)*rcpExp;\nreturn vec2(r,rcpPdf);\n}\n\n\nvec3 ComputeBilateralWeight(float xy2,float z,float mmPerUnit,vec3 S,float rcpPdf)\n{\n#ifndef SSS_BILATERAL_FILTER\nz=0.;\n#endif\n\n\n\nfloat r=sqrt(xy2+(z*mmPerUnit)*(z*mmPerUnit));\nfloat area=rcpPdf;\n#if SSS_CLAMP_ARTIFACT\nreturn clamp(EvalBurleyDiffusionProfile(r,S)*area,0.0,1.0);\n#else\nreturn EvalBurleyDiffusionProfile(r,S)*area;\n#endif\n}\nvoid EvaluateSample(int i,int n,vec3 S,float d,vec3 centerPosVS,float mmPerUnit,float pixelsPerMm,\nfloat phase,inout vec3 totalIrradiance,inout vec3 totalWeight)\n{\n\nfloat scale=rcp(float(n));\nfloat offset=rcp(float(n))*0.5;\n\nfloat sinPhase,cosPhase;\nsinPhase=sin(phase);\ncosPhase=cos(phase);\nvec2 bdp=SampleBurleyDiffusionProfile(float(i)*scale+offset,d);\nfloat r=bdp.x;\nfloat rcpPdf=bdp.y;\nfloat phi=SampleDiskGolden(i,n).y;\nfloat sinPhi,cosPhi;\nsinPhi=sin(phi);\ncosPhi=cos(phi);\nfloat sinPsi=cosPhase*sinPhi+sinPhase*cosPhi;
1\nfloat cosPsi=cosPhase*cosPhi-sinPhase*sinPhi;\nvec2 vec=r*vec2(cosPsi,sinPsi);\n\nvec2 position;\nfloat xy2;\nposition=vUV+round((pixelsPerMm*r)*vec2(cosPsi,sinPsi))*texelSize;\nxy2=r*r;\nvec4 textureSample=texture2D(irradianceSampler,position);\nfloat viewZ=texture2D(depthSampler,position).r;\nvec3 irradiance=textureSample.rgb;\nif (testLightingForSSS(irradiance))\n{\n\nfloat relZ=viewZ-centerPosVS.z;\nvec3 weight=ComputeBilateralWeight(xy2,relZ,mmPerUnit,S,rcpPdf);\ntotalIrradiance+=weight*irradiance;\ntotalWeight+=weight;\n}\nelse\n{\n\n\n\n\n\n\n}\n}\nvoid main(void)\n{\nvec4 irradianceAndDiffusionProfile=texture2D(irradianceSampler,vUV);\nvec3 centerIrradiance=irradianceAndDiffusionProfile.rgb;\nint diffusionProfileIndex=int(round(irradianceAndDiffusionProfile.a*255.));\nfloat centerDepth=0.;\nvec4 inputColor=texture2D(textureSampler,vUV);\nbool passedStencilTest=testLightingForSSS(centerIrradiance);\nif (passedStencilTest)\n{\ncenterDepth=texture2D(depthSampler,vUV).r;\n}\nif (!passedStencilTest) {\ngl_FragColor=inputColor;\nreturn;\n}\nfloat distScale=1.;\nvec3 S=diffusionS[diffusionProfileIndex];\nfloat d=diffusionD[diffusionProfileIndex];\nfloat filterRadius=filterRadii[diffusionProfileIndex];\n\nvec2 centerPosNDC=vUV;\nvec2 cornerPosNDC=vUV+0.5*texelSize;\nvec3 centerPosVS=vec3(centerPosNDC*viewportSize,1.0)*centerDepth;\nvec3 cornerPosVS=vec3(cornerPosNDC*viewportSize,1.0)*centerDepth;\n\nfloat mmPerUnit=1000.*(metersPerUnit*rcp(distScale));\nfloat unitsPerMm=rcp(mmPerUnit);\n\n\nfloat unitsPerPixel=2.*abs(cornerPosVS.x-centerPosVS.x);\nfloat pixelsPerMm=rcp(unitsPerPixel)*unitsPerMm;\n\nfloat filterArea=PI*Sq(filterRadius*pixelsPerMm);\nint sampleCount=int(filterArea*rcp(SSS_PIXELS_PER_SAMPLE));\nint sampleBudget=_SssSampleBudget;\nint texturingMode=0;\nvec3 albedo=texture2D(albedoSampler,vUV).rgb;\nif (distScale == 0. || sampleCount<1)\n{\n#ifdef DEBUG_SSS_SAMPLES\nvec3 green=vec3(0.,1.,0.);\ngl_FragColor=vec4(green,1.0);\nreturn;\n#endif\ngl_FragColor=vec4(inputColor.rgb+albedo*centerIrradiance,1.0);\nreturn;\n}\n#ifdef DEBUG_SSS_SAMPLES\nvec3 red=vec3(1.,0.,0.);\nvec3 blue=vec3(0.,0.,1.);\ngl_FragColor=vec4(mix(blue,red,clamp(float(sampleCount)/float(sampleBudget),0.0,1.0)),1.0);\nreturn;\n#endif\n\nfloat phase=0.;\nint n=min(sampleCount,sampleBudget);\n\nvec3 centerWeight=vec3(0.);\nvec3 totalIrradiance=vec3(0.);\nvec3 totalWeight=vec3(0.);\nfor (int i=0; i<n; i++)\n{\n\nEvaluateSample(i,n,S,d,centerPosVS,mmPerUnit,pixelsPerMm,\nphase,totalIrradiance,totalWeight);\n}\n\ntotalWeight=max(totalWeight,HALF_MIN);\ngl_FragColor=vec4(inputColor.rgb+albedo*max(totalIrradiance/totalWeight,vec3(0.0)),1.);\n}",i(217);var B,U=(B=L.a,Object(v.d)(j,B),j),V=(Object.defineProperty(z.prototype,"ssDiffusionS",{get:function(){return this._ssDiffusionS},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"ssDiffusionD",{get:function(){return this._ssDiffusionD},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"ssFilterRadii",{get:function(){return this._ssFilterRadii},enumerable:!1,configurable:!0}),z.prototype.addDiffusionProfile=function(e){if(5<=this.ssDiffusionD.length)return I.a.Error("You already reached the maximum number of diffusion profiles."),0;for(var t=0;t<this._ssDiffusionS.length/3;t++)if(this._ssDiffusionS[3*t]===e.r&&this._ssDiffusionS[3*t+1]===e.g&&this._ssDiffusionS[3*t+2]===e.b)return t;return this._ssDiffusionS.push(e.r,e.b,e.g),this._ssDiffusionD.push(Math.max(Math.max(e.r,e.b),e.g)),this._ssFilterRadii.push(this.getDiffusionProfileParameters(e)),this.ssDiffusionProfileColors.push(e),this._ssDiffusionD.length-1},z.prototype.createPostProcess=function(){return this.postProcess=new U("subSurfaceScattering",this._scene,1,null,void 0,this._scene.getEngine()),this.postProcess.autoClear=!1,this.postProcess},z.prototype.clearAllDiffusionProfiles=function(){this._ssDiffusionD=[],this._ssDiffusionS=[],this._ssFilterRadii=[],this.ssDiffusionProfileColors=[]},z.prototype.dispose=function(){this.clearAllDiffusionProfiles(),this.postProcess.dispose()},z.prototype.getDiffusionProfileParameters=function(e){var t=Math.max(e.r,e.g,e.b);return this._sampleBurleyDiffusionProfile(.997,t)},z.prototype._sampleBurleyDiffusionProfile=function(e,t){var i=1+4*(e=1-e)*(2*e+Math.sqrt(1+4*e*e)),n=Math.pow(i,-1/3),r=1+i*n*n+n;return 3*Math.log(r/(4*e))*t},z),k=(Object.defineProperty(G.prototype,"enabled",{get:function(){return this._enabled}
1,enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"samples",{get:function(){return this.prePassRT.samples},set:function(e){this.imageProcessingPostProcess||this._createCompositionEffect(),this.prePassRT.samples=e},enumerable:!1,configurable:!0}),G.prototype._initializeAttachments=function(){var e=this._engine._gl;this._multiRenderAttachments=[],this._clearAttachments=[e.NONE],this._defaultAttachments=[e.COLOR_ATTACHMENT0];for(var t=0;t<this.mrtCount;t++)this._multiRenderAttachments.push(e["COLOR_ATTACHMENT"+t]),0<t&&(this._clearAttachments.push(e["COLOR_ATTACHMENT"+t]),this._defaultAttachments.push(e.NONE))},G.prototype._createCompositionEffect=function(){this.prePassRT=new R.a("sceneprePassRT",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},this.mrtCount,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:f.a.TEXTURETYPE_UNSIGNED_INT,types:this._mrtTypes}),this.prePassRT.samples=1,this._initializeAttachments(),this.imageProcessingPostProcess=new O.a("sceneCompositionPass",1,null,void 0,this._engine),this.imageProcessingPostProcess.autoClear=!1},Object.defineProperty(G.prototype,"isSupported",{get:function(){return 1<this._engine.webGLVersion},enumerable:!1,configurable:!0}),G.prototype.bindAttachmentsForEffect=function(e){this.enabled&&(e._multiTarget?this._engine.bindAttachments(this._multiRenderAttachments):this._engine.bindAttachments(this._defaultAttachments))},G.prototype._beforeCameraDraw=function(){this._isDirty&&this._update(),this._bindFrameBuffer()},G.prototype._afterCameraDraw=function(){var e;this._enabled&&((e=this._scene.activeCamera&&this._scene.activeCamera._getFirstPostProcess())&&this._scene.postProcessManager._prepareFrame(),this._scene.postProcessManager.directRender(this._postProcesses,e?e.inputTexture:null))},G.prototype._checkRTSize=function(){var e=this._engine.getRenderWidth(!0),t=this._engine.getRenderHeight(!0),i=this.prePassRT.getRenderWidth(),n=this.prePassRT.getRenderHeight();i===e&&n===t||(this.prePassRT.resize({width:e,height:t}),this._bindPostProcessChain())},G.prototype._bindFrameBuffer=function(){var e;this._enabled&&(this._checkRTSize(),(e=this.prePassRT.getInternalTexture())&&this._engine.bindFramebuffer(e))},G.prototype.clear=function(){this._enabled&&(this._bindFrameBuffer(),this._engine.clear(this._scene.clearColor,this._scene.autoClear||this._scene.forceWireframe||this._scene.forcePointsCloud,this._scene.autoClearDepthAndStencil,this._scene.autoClearDepthAndStencil),this._engine.bindAttachments(this._clearAttachments),this._engine.clear(this._clearColor,!0,!1,!1),this._engine.bindAttachments(this._multiRenderAttachments))},G.prototype._setState=function(e){this._enabled=e,this._scene.prePass=e,this.imageProcessingPostProcess&&(this.imageProcessingPostProcess.imageProcessingConfiguration.applyByPostProcess=e)},G.prototype._enable=function(){this._resetPostProcessChain(),this.subSurfaceConfiguration.enabled&&(this.subSurfaceConfiguration.postProcess||this.subSurfaceConfiguration.createPostProcess(),this._postProcesses.push(this.subSurfaceConfiguration.postProcess)),this.imageProcessingPostProcess||this._createCompositionEffect(),this._postProcesses.push(this.imageProcessingPostProcess),this._bindPostProcessChain(),this._setState(!0)},G.prototype._disable=function(){this._setState(!1),this.subSurfaceConfiguration.enabled=!1,this.materialsShouldRenderGeometry=!1,this.materialsShouldRenderIrradiance=!1},G.prototype._resetPostProcessChain=function(){this._postProcesses=[],this.imageProcessingPostProcess&&this.imageProcessingPostProcess.restoreDefaultInputTexture(),this.subSurfaceConfiguration.postProcess&&this.subSurfaceConfiguration.postProcess.restoreDefaultInputTexture()},G.prototype._bindPostProcessChain=function(){this._postProcesses[0].inputTexture=this.prePassRT.getInternalTexture()},G.prototype.markAsDirty=function(){this._isDirty=!0},G.prototype._update=function(){this._disable();for(var e=!1,t=0;t<this._scene.materials.length;t++)this._scene.materials[t].setPrePassRenderer(this)&&(e=!0);for(var i=this._scene.postProcessRenderPipelineManager.supportedPipelines,t=0;t<i.length;t++)i[t].setPrePassRenderer(this)&&(e=!0);
1this._isDirty=!1,e&&this._enable(),this.enabled||this._engine.bindAttachments(this._defaultAttachments)},G.prototype.dispose=function(){this.imageProcessingPostProcess.dispose(),this.subSurfaceConfiguration.dispose(),this.prePassRT.dispose()},G._SceneComponentInitialization=function(e){throw M.a.WarnImport("PrePassRendererSceneComponent")},G);function G(e){this._isDirty=!1,this.mrtCount=4,this._mrtTypes=[f.a.TEXTURETYPE_HALF_FLOAT,f.a.TEXTURETYPE_HALF_FLOAT,f.a.TEXTURETYPE_HALF_FLOAT,f.a.TEXTURETYPE_UNSIGNED_INT],this._postProcesses=[],this._clearColor=new u.b(0,0,0,0),this.materialsShouldRenderGeometry=!1,this.materialsShouldRenderIrradiance=!1,this._enabled=!1,this._scene=e,this._engine=e.getEngine(),G._SceneComponentInitialization(this._scene),this.subSurfaceConfiguration=new V(this._scene)}function z(e){this._ssDiffusionS=[],this._ssFilterRadii=[],this._ssDiffusionD=[],this.enabled=!1,this.ssDiffusionProfileColors=[],this.metersPerUnit=1,this.addDiffusionProfile(new u.a(1,1,1)),this._scene=e}function j(e,i,t,n,r,o,a,s){void 0===n&&(n=null),void 0===s&&(s=f.a.TEXTURETYPE_UNSIGNED_INT);var c=B.call(this,e,"subSurfaceScattering",["texelSize","viewportSize","metersPerUnit"],["diffusionS","diffusionD","filterRadii","irradianceSampler","depthSampler","albedoSampler"],t,n,r||D.a.BILINEAR_SAMPLINGMODE,o,a,null,s,"postprocess",void 0,!0)||this;return c._scene=i,c.updateEffect(),c.onApplyObservable.add(function(e){var t;i.prePassRenderer?(t=c.texelSize,e.setFloat("metersPerUnit",i.prePassRenderer.subSurfaceConfiguration.metersPerUnit),e.setFloat2("texelSize",t.x,t.y),e.setTexture("irradianceSampler",i.prePassRenderer.prePassRT.textures[1]),e.setTexture("depthSampler",i.prePassRenderer.prePassRT.textures[2]),e.setTexture("albedoSampler",i.prePassRenderer.prePassRT.textures[3]),e.setFloat2("viewportSize",Math.tan(i.activeCamera.fov/2)*i.getEngine().getAspectRatio(i.activeCamera,!0),Math.tan(i.activeCamera.fov/2)),e.setArray3("diffusionS",i.prePassRenderer.subSurfaceConfiguration.ssDiffusionS),e.setArray("diffusionD",i.prePassRenderer.subSurfaceConfiguration.ssDiffusionD),e.setArray("filterRadii",i.prePassRenderer.subSurfaceConfiguration.ssFilterRadii)):I.a.Error("PrePass needs to be enabled for subsurface scattering.")}),c}i(42).a.AddParser(a.a.NAME_PREPASSRENDERER,function(e,t){if(void 0!==e.ssDiffusionProfileColors&&null!==e.ssDiffusionProfileColors&&(t.enablePrePassRenderer(),t.prePassRenderer))for(var i=0,n=e.ssDiffusionProfileColors.length;i<n;i++){var r=e.ssDiffusionProfileColors[i];t.prePassRenderer.subSurfaceConfiguration.addDiffusionProfile(new u.a(r.r,r.g,r.b))}}),Object.defineProperty(n.a.prototype,"prePassRenderer",{get:function(){return this._prePassRenderer},set:function(e){e&&e.isSupported&&(this._prePassRenderer=e)},enumerable:!0,configurable:!0}),n.a.prototype.enablePrePassRenderer=function(){return this._prePassRenderer||(this._prePassRenderer=new k(this),this._prePassRenderer.isSupported||(this._prePassRenderer=null,I.a.Error("PrePassRenderer needs WebGL 2 support.\nMaybe you tried to use the following features that need the PrePassRenderer :\n + Subsurface Scattering"))),this._prePassRenderer},n.a.prototype.disablePrePassRenderer=function(){this._prePassRenderer&&(this._prePassRenderer.dispose(),this._prePassRenderer=null)};var W=(H.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(a.a.STEP_BEFORECAMERADRAW_PREPASS,this,this._beforeCameraDraw),this.scene._afterCameraDrawStage.registerStep(a.a.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterCameraDraw),this.scene._beforeClearStage.registerStep(a.a.STEP_BEFORECLEARSTAGE_PREPASS,this,this._beforeClearStage)},H.prototype._beforeCameraDraw=function(){this.scene.prePassRenderer&&this.scene.prePassRenderer._beforeCameraDraw()},H.prototype._afterCameraDraw=function(){this.scene.prePassRenderer&&this.scene.prePassRenderer._afterCameraDraw()},H.prototype._beforeClearStage=function(){this.scene.prePassRenderer&&this.scene.prePassRenderer.clear()},H.prototype.serialize=function(e){if(this.scene.prePassRenderer){var t=this.scene.prePassRenderer.subSurfaceConfiguration.ssDiffusionProfileColors;e.ssDiffusionProfileColors=[];for(var i=0;i<t.length;i++)e.ssDiffusionProfileColors.push({r:t[i].r,g:t[i].g,b:t[i].b})}},H.prototype.addFromContainer=function(e){},H.prototype.removeFromContainer=function(e,t){this.scene.prePassRenderer&&this.scene.prePassRenderer.subSurfaceConfiguration.clearAllDiffusionProfiles()},H.prototype.rebuild=function(){},H.prototype.dispose=function(){},H);function H(e){this.name=a.a.NAME_PREPASSRENDERER,this.scene=e}k._SceneComponentInitialization=function(e){var t=e._getComponent(a.a.NAME_PREPASSRENDERER);t||(t=new W(e),e._addComponent(t))};var X=i(8),Y=i(15),K=(i(178),i(309),"#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include<logDepthFragment>\ngl_FragColor=color;\n}");T.a.ShadersStore.outlinePixelShader=K,i(107),i(131),i(132),i(145),i(110),i(312);T.a.ShadersStore.outlineVertexShader="\nattribute vec3 position;\nattribute vec3 normal;\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\nuniform float offset;\n#include<instancesDeclaration>\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<logDepthDeclaration>\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
1\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include<logDepthVertex>\n}\n",n.a.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new Q(this)),this._outlineRenderer},Object.defineProperty(X.a.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(X.a.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var Q=($.prototype.register=function(){this.scene._beforeRenderingMeshStage.registerStep(a.a.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(a.a.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)},$.prototype.rebuild=function(){},$.prototype.dispose=function(){},$.prototype.render=function(e,t,i){var n=this;void 0===i&&(i=!1);var r,o,a,s,c,l,u=this.scene,h=u.getEngine(),d=h.getCaps().instancedArrays&&(null!==t.visibleInstances[e._id]&&void 0!==t.visibleInstances[e._id]||e.getRenderingMesh().hasThinInstances);this.isReady(e,d)&&(o=(r=e.getMesh())._internalAbstractMeshDataInfo._actAsRegularMesh?r:null,a=e.getRenderingMesh(),s=o||a,(c=e.getMaterial())&&u.activeCamera&&(h.enableEffect(this._effect),c.useLogarithmicDepth&&this._effect.setFloat("logarithmicDepthConstant",2/(Math.log(u.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",u.getTransformMatrix()),a.useBones&&a.computeBonesUsingShaders&&a.skeleton&&this._effect.setMatrices("mBones",a.skeleton.getTransformMatrices(a)),Y.a.BindMorphTargetParameters(a,this._effect),a._bind(e,this._effect,c.fillMode),c&&c.needAlphaTesting()&&(l=c.getAlphaTestTexture())&&(this._effect.setTexture("diffuseSampler",l),this._effect.setMatrix("diffuseMatrix",l.getTextureMatrix())),h.setZOffset(-this.zOffset),a._processRendering(s,e,this._effect,c.fillMode,t,d,function(e,t){n._effect.setMatrix("world",t)}),h.setZOffset(0)))},$.prototype.isReady=function(e,t){var i=[],n=[ie.b.PositionKind,ie.b.NormalKind],r=e.getMesh(),o=e.getMaterial();o&&(o.needAlphaTesting()&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(ie.b.UVKind)&&(n.push(ie.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(ie.b.UV2Kind)&&(n.push(ie.b.UV2Kind),i.push("#define UV2"))),o.useLogarithmicDepth&&i.push("#define LOGARITHMICDEPTH")),r.useBones&&r.computeBonesUsingShaders?(n.push(ie.b.MatricesIndicesKind),n.push(ie.b.MatricesWeightsKind),4<r.numBoneInfluencers&&(n.push(ie.b.MatricesIndicesExtraKind),n.push(ie.b.MatricesWeightsExtraKind)),i.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),i.push("#define BonesPerMesh "+(r.skeleton?r.skeleton.bones.length+1:0))):i.push("#define NUM_BONE_INFLUENCERS 0");var a=r.morphTargetManager,s=0;a&&0<a.numInfluencers&&(s=a.numInfluencers,i.push("#define MORPHTARGETS"),i.push("#define NUM_MORPH_INFLUENCERS "+s),Y.a.PrepareAttributesForMorphTargetsInfluencers(n,r,s)),t&&(i.push("#define INSTANCES"),Y.a.PushAttributesForInstances(n),e.getRenderingMesh().hasThinInstances&&i.push("#define THIN_INSTANCES"));var c=i.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this.scene.getEngine().createEffect("outline",n,["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s})),this._effect.isReady()},$.prototype._beforeRenderingMesh=function(e,t,i){var n;this._savedDepthWrite=this._engine.getDepthWrite(),e.renderOutline&&((n=t.getMaterial())&&n.needAlphaBlendingForMesh(e)&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(f.a.REPLACE),this._engine.setStencilFunction(f.a.ALWAYS),this._engine.setStencilMask($._StencilReference),this._engine.setStencilFunctionReference($._StencilReference),this.render(t,i,!0),this._engine.setColorWrite(!0),this._engine.setStencilFunction(f.a.NOTEQUAL)),this._engine.setDepthWrite(!1),this.render(t,i),this._engine.setDepthWrite(this._savedDepthWrite),n&&n.needAlphaBlendingForMesh(e)&&this._engine.restoreStencilState())},$.prototype._afterRenderingMesh=function(e,t,i){var n,r;e.renderOverlay&&(n=this._engine.getAlphaMode(),r=this._engine.alphaState.alphaBlend,this._engine.setAlphaMode(f.a.ALPHA_COMBINE),this.render(t,i,!0),this._engine.setAlphaMode(n),this._engine.setDepthWrite(this._savedDepthWrite),this._engine.alphaState.alphaBlend=r),e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i),this._engine.setColorWrite(!0))},$._StencilReference=4,$),q=i(244),Z=i(134),J=i(47);function $(e){this.name=a.a.NAME_OUTLINERENDERER,this.zOffset=1,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this)}},function(e,t,i){"use strict";i.d(t,"d",function(){return _.a}),i.d(t,"h",function(){return n.a}),i.d(t,"f",function(){return b}),i.d(t,"a",function(){return F}),i.d(t,"g",function(){return V}),i.d(t,"b",function(){return G.a}),i.d(t,"c",function(){return z.a}),i.d(t,"e",function(){return j.a}),i.d(t,"i",function(){return W.a});var _=i(63),n=i(149),d=i(1),y=i(0),o=i(10),M=i(4),I=i(15),a=i(9),r=i(39),s=i(23),c=i(61),l=i(2),u=i(5),h=(i(230),"\n\n\n\n\nfloat bayerDither2(vec2 _P) {\nreturn mod(2.0*_P.y+_P.x+1.0,4.0);\n}\n\n\nfloat bayerDither4(vec2 _P) {\nvec2 P1=mod(_P,2.0);\nvec2 P2=floor(0.5*mod(_P,4.0));\nreturn 4.0*bayerDither2(P1)+bayerDither2(P2);\n}\n\nfloat bayerDither8(vec2 _P) {\nvec2 P1=mod(_P,2.0);\nvec2 P2=floor(0.5*mod(_P,4.0));\nvec2 P4=floor(0.25*mod(_P,8.0));\nreturn 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);\n}\n");u.a.IncludesShadersStore.bayerDitherFunctions=h;u.a.IncludesShadersStore.shadowMapFragmentDeclaration="#if SM_FLOAT == 0\n#include<packingFunctions>\n#endif\n#if SM_SOFTTRANSPARENTSHADOW == 1\n#include<bayerDitherFunctions>\nuniform float softTransparentShadowSM;\n#endif\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE == 1\nuniform vec3 lightDataSM;\nvarying vec3 vPositionWSM;\n#endif\nuniform vec3 biasAndScaleSM;\nuniform vec2 depthValuesSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1\nvarying float zSM;\n#endif\n",i(177),i(161);u.a.IncludesShadersStore.shadowMapFragment=" float depthSM=vDepthMetricSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1\n#if SM_USEDISTANCE == 1\ndepthSM=clamp(((length(vPositionWSM-lightDataSM)+depthValuesSM.x)/(depthValuesSM.y))+biasAndScaleSM.x,0.0,1.0);\n#else\ndepthSM=clamp(((zSM+depthValuesSM.x)/(depthValuesSM.y))+biasAndScaleSM.x,0.0,1.0);\n#endif\ngl_FragDepth=depthSM;\n#elif SM_USEDISTANCE == 1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/(depthValuesSM.y)+biasAndScaleSM.x;\n#endif\n#if SM_ESM == 1\ndepthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);\n#endif\n#if SM_FLOAT == 1\ngl_FragColor=vec4(depthSM,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depthSM);\n#endif\nreturn;";u.a.ShadersStore.shadowMapPixelShader="#include<shadowMapFragmentDeclaration>\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include<clipPlaneFragmentDeclaration>\nvoid main(void)\n{\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nfloat alphaFromAlphaTexture=texture2D(diffuseSampler,vUV).a;\nif (alphaFromAlphaTexture<0.4)\ndiscard;\n#endif\n#if SM_SOFTTRANSPARENTSHADOW == 1\n#ifdef ALPHATEST\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alphaFromAlphaTexture) discard;\n#else\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM) discard;\n#endif\n#endif\n#include<shadowMapFragment>\n}",i(107),i(131),i(132),i(108),i(74);u.a.IncludesShadersStore.shadowMapVertexDeclaration="#if SM_NORMALBIAS == 1\nuniform vec3 lightDataSM;\n#endif\nuniform vec3 biasAndScaleSM;\nuniform vec2 depthValuesSM;\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE == 1\nvarying vec3 vPositionWSM;\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1\nvarying float zSM;\n#endif\n",i(179),i(145),i(109),i(110);u.a.IncludesShadersStore.shadowMapVertexNormalBias="\n#if SM_NORMALBIAS == 1\n#if SM_DIRECTIONINLIGHTDATA == 1\nvec3 worldLightDirSM=normalize(-lightDataSM.xyz);\n#else\nvec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;\nvec3 worldLightDirSM=normalize(directionToLightSM);\n#endif\nfloat ndlSM=dot(vNormalW,worldLightDirSM);\nfloat sinNLSM=sqrt(1.0-ndlSM*ndlSM);\nfloat normalBiasSM=biasAndScaleSM.y*sinNLSM;\nworldPos.xyz-=vNormalW*normalBiasSM;\n#endif\n";u.a.IncludesShadersStore.shadowMapVertexMetric="#if SM_USEDISTANCE == 1\nvPositionWSM=worldPos.xyz;\n#endif\n#if SM_DEPTHTEXTURE == 1\n\ngl_Position.z+=biasAndScaleSM.x*gl_Position.w;\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP == 1\nzSM=gl_Position.z;\ngl_Position.z=0.0;\n#elif SM_USEDISTANCE == 0\n\nvDepthMetricSM=((gl_Position.z+depthValuesSM.x)/(depthValuesSM.y))+biasAndScaleSM.x;\n#endif\n",i(162);
1u.a.ShadersStore.shadowMapVertexShader="\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\n#include<instancesDeclaration>\n#include<helperFunctions>\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<shadowMapVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normWorldSM=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));\nvNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvec3 vNormalW=normalize(normWorldSM*normalUpdated);\n#endif\n#endif\n#include<shadowMapVertexNormalBias>\n\ngl_Position=viewProjection*worldPos;\n#include<shadowMapVertexMetric>\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include<clipPlaneVertex>\n}";u.a.ShadersStore.depthBoxBlurPixelShader="\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}";u.a.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow="#if SM_SOFTTRANSPARENTSHADOW == 1\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alpha) discard;\n#endif\n";var T,p=i(6),f=i(21),D=i(84),m=i(134),g=new y.a,v=new y.a,b=(Object.defineProperty(U.prototype,"bias",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"blurBoxOffset",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"blurScale",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"blurKernel",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"useKernelBlur",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"depthScale",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!1,configurable:!0}),U.prototype._validateFilter=function(e){return e},Object.defineProperty(U.prototype,"filter",{get:function(){return this._filter},set:function(e){if(e=this._validateFilter(e),this._light.needCube()){if(e===U.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(e===U.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(e===U.FILTER_PCF||e===U.FILTER_PCSS)return void(this.usePoissonSampling=!0)}e!==U.FILTER_PCF&&e!==U.FILTER_PCSS||1!==this._scene.getEngine().webGLVersion?this._filter!==e&&(this._filter=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0}
1,enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"usePoissonSampling",{get:function(){return this.filter===U.FILTER_POISSONSAMPLING},set:function(e){var t=this._validateFilter(U.FILTER_POISSONSAMPLING);!e&&this.filter!==U.FILTER_POISSONSAMPLING||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"useExponentialShadowMap",{get:function(){return this.filter===U.FILTER_EXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(U.FILTER_EXPONENTIALSHADOWMAP);!e&&this.filter!==U.FILTER_EXPONENTIALSHADOWMAP||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"useBlurExponentialShadowMap",{get:function(){return this.filter===U.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(U.FILTER_BLUREXPONENTIALSHADOWMAP);!e&&this.filter!==U.FILTER_BLUREXPONENTIALSHADOWMAP||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"useCloseExponentialShadowMap",{get:function(){return this.filter===U.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(U.FILTER_CLOSEEXPONENTIALSHADOWMAP);!e&&this.filter!==U.FILTER_CLOSEEXPONENTIALSHADOWMAP||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"useBlurCloseExponentialShadowMap",{get:function(){return this.filter===U.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(U.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);!e&&this.filter!==U.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"usePercentageCloserFiltering",{get:function(){return this.filter===U.FILTER_PCF},set:function(e){var t=this._validateFilter(U.FILTER_PCF);!e&&this.filter!==U.FILTER_PCF||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"useContactHardeningShadow",{get:function(){return this.filter===U.FILTER_PCSS},set:function(e){var t=this._validateFilter(U.FILTER_PCSS);!e&&this.filter!==U.FILTER_PCSS||(this.filter=e?t:U.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"contactHardeningLightSizeUVRatio",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"darkness",{get:function(){return this._darkness},set:function(e){this.setDarkness(e)},enumerable:!1,configurable:!0}),U.prototype.getDarkness=function(){return this._darkness},U.prototype.setDarkness=function(e){return this._darkness=1<=e?1:e<=0?0:e,this},Object.defineProperty(U.prototype,"transparencyShadow",{get:function(){return this._transparencyShadow},set:function(e){this.setTransparencyShadow(e)},enumerable:!1,configurable:!0}),U.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},U.prototype.getShadowMap=function(){return this._shadowMap},U.prototype.getShadowMapForRendering=function(){return this._shadowMap2?this._shadowMap2:this._shadowMap},U.prototype.getClassName=function(){return U.CLASSNAME},U.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},U.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();n<r.length;n++){var o=r[n];this.removeShadowCaster(o)}return this},U.prototype.getLight=function(){return this._light},U.prototype._initializeGenerator=function(){this._light._markMeshesAsLightDirty(),this._initializeShadowMap()},U.prototype._createTargetRenderTexture=function(){1<this._scene.getEngine().webGLVersion?(this._shadowMap=new r.a(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture(l.a.LESS,!0)):this._shadowMap=new r.a(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube())},U.prototype._initializeShadowMap=function(){var n=this;if(this._createTargetRenderTexture(),null!==this._shadowMap){this._shadowMap.wrapU=a.a.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=a.a.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode(a.a.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._storedUniqueId&&(this._shadowMap.uniqueId=this._storedUniqueId),this._shadowMap.customRenderFunction=this._renderForShadowMap.bind(this),this._shadowMap.customIsReadyFunction=function(e,t){return!0};var r=this._scene.getEngine();this._shadowMap.onBeforeRenderObservable.add(function(e){var t;n._currentFaceIndex=e,n._filter===U.FILTER_PCF&&r.setColorWrite(!1),n._scene.getSceneUniformBuffer().useUbo&&((t=n._scene.getSceneUniformBuffer()).updateMatrix("viewProjection",n.getTransformMatrix()),t.updateMatrix("view",n._viewMatrix),t.update(
1))}),this._shadowMap.onAfterUnbindObservable.add(function(){var e,t,i;n._scene.getSceneUniformBuffer().useUbo&&((e=n._scene.getSceneUniformBuffer()).updateMatrix("viewProjection",n._scene.getTransformMatrix()),e.updateMatrix("view",n._scene.getViewMatrix()),e.update()),n._filter===U.FILTER_PCF&&r.setColorWrite(!0),(n.useBlurExponentialShadowMap||n.useBlurCloseExponentialShadowMap)&&(t=n.getShadowMapForRendering())&&(i=t.getInternalTexture(),n._scene.postProcessManager.directRender(n._blurPostProcesses,i,!0),r.unBindFramebuffer(i,!0))});var t=new o.b(0,0,0,0),i=new o.b(1,1,1,1);this._shadowMap.onClearObservable.add(function(e){n._filter===U.FILTER_PCF?e.clear(i,!1,!0,!1):n.useExponentialShadowMap||n.useBlurExponentialShadowMap?e.clear(t,!0,!0,!1):e.clear(i,!0,!0,!1)}),this._shadowMap.onResizeObservable.add(function(e){n._storedUniqueId=n._shadowMap.uniqueId,n._mapSize=e.getRenderSize(),n._light._markMeshesAsLightDirty(),n.recreateShadowMap()});for(var e=m.b.MIN_RENDERINGGROUPS;e<m.b.MAX_RENDERINGGROUPS;e++)this._shadowMap.setRenderingAutoClearDepthStencil(e,!1)}},U.prototype._initializeBlurRTTAndPostProcesses=function(){var t=this,e=this._scene.getEngine(),i=this._mapSize/this.blurScale;this.useKernelBlur&&1===this.blurScale||(this._shadowMap2=new r.a(this._light.name+"_shadowMap2",i,this._scene,!1,!0,this._textureType),this._shadowMap2.wrapU=a.a.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=a.a.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode(a.a.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new c.a(this._light.name+"KernelBlurX",new y.d(1,0),this.blurKernel,1,null,a.a.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.width=i,this._kernelBlurXPostprocess.height=i,this._kernelBlurXPostprocess.onApplyObservable.add(function(e){e.setTexture("textureSampler",t._shadowMap)}),this._kernelBlurYPostprocess=new c.a(this._light.name+"KernelBlurY",new y.d(0,1),this.blurKernel,1,null,a.a.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===l.a.TEXTURETYPE_UNSIGNED_INT&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new s.a(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,a.a.BILINEAR_SAMPLINGMODE,e,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType),this._boxBlurPostprocess.onApplyObservable.add(function(e){e.setFloat2("screenSize",i,i),e.setTexture("textureSampler",t._shadowMap)}),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])},U.prototype._renderForShadowMap=function(e,t,i,n){var r,o=this._scene.getEngine(),a=o.getColorWrite();if(n.length){for(o.setColorWrite(!1),r=0;r<n.length;r++)this._renderSubMeshForShadowMap(n.data[r]);o.setColorWrite(a)}for(r=0;r<e.length;r++)this._renderSubMeshForShadowMap(e.data[r]);for(r=0;r<t.length;r++)this._renderSubMeshForShadowMap(t.data[r]);if(this._transparencyShadow)for(r=0;r<i.length;r++)this._renderSubMeshForShadowMap(i.data[r],!0);else for(r=0;r<i.length;r++)i.data[r].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate=!1},U.prototype._bindCustomEffectForRenderSubMeshForShadowMap=function(e,t,i,n){var r,o,a,s,c,l;t.setMatrix(null!==(r=null==i?void 0:i.viewProjection)&&void 0!==r?r:"viewProjection",this.getTransformMatrix()),t.setMatrix(null!==(o=null==i?void 0:i.view)&&void 0!==o?o:"view",this._viewMatrix),t.setMatrix(null!==(a=null==i?void 0:i.projection)&&void 0!==a?a:"projection",this._projectionMatrix);var u=n.getWorldMatrix();t.setMatrix(null!==(s=null==i?void 0:i.world)&&void 0!==s?s:"world",u),u.multiplyToRef(this.getTransformMatrix(),g),t.setMatrix(null!==(c=null==i?void 0:i.worldViewProjection)&&void 0!==c?c:"worldViewProjection",g),u.multiplyToRef(this._viewMatrix,v),t.setMatr
1ix(null!==(l=null==i?void 0:i.worldView)&&void 0!==l?l:"worldView",v)},U.prototype._renderSubMeshForShadowMap=function(e,t){var i,n;void 0===t&&(t=!1);var r=e.getRenderingMesh(),o=e.getEffectiveMesh(),a=this._scene,s=a.getEngine(),c=e.getMaterial();if(o._internalAbstractMeshDataInfo._isActiveIntermediate=!1,c&&0!==e.verticesCount){s.setState(c.backFaceCulling);var l=r._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(!l.mustReturn){var u=s.getCaps().instancedArrays&&(null!==l.visibleInstances[e._id]&&void 0!==l.visibleInstances[e._id]||r.hasThinInstances);if(this.isReady(e,u,t)){var h,d=null===(i=r.material)||void 0===i?void 0:i.shadowDepthWrapper,p=null!==(n=null==d?void 0:d.getEffect(e,this))&&void 0!==n?n:this._effect;if(s.enableEffect(p),r._bind(e,p,c.fillMode),this.getTransformMatrix(),p.setFloat3("biasAndScaleSM",this.bias,this.normalBias,this.depthScale),this.getLight().getTypeID()===_.a.LIGHTTYPEID_DIRECTIONALLIGHT?p.setVector3("lightDataSM",this._cachedDirection):p.setVector3("lightDataSM",this._cachedPosition),a.activeCamera&&p.setFloat2("depthValuesSM",this.getLight().getDepthMinZ(a.activeCamera),this.getLight().getDepthMinZ(a.activeCamera)+this.getLight().getDepthMaxZ(a.activeCamera)),t&&this.enableSoftTransparentShadow&&p.setFloat("softTransparentShadowSM",o.visibility),d)e._effectOverride=p,d.standalone?d.baseMaterial.bindForSubMesh(o.getWorldMatrix(),r,e):c.bindForSubMesh(o.getWorldMatrix(),r,e),e._effectOverride=null;else{if(p.setMatrix("viewProjection",this.getTransformMatrix()),c&&c.needAlphaTesting()&&(h=c.getAlphaTestTexture())&&(p.setTexture("diffuseSampler",h),p.setMatrix("diffuseMatrix",h.getTextureMatrix()||this._defaultTextureMatrix)),r.useBones&&r.computeBonesUsingShaders&&r.skeleton){var f=r.skeleton;if(f.isUsingTextureForMatrices){var m=f.getTransformMatrixTexture(r);if(!m)return;p.setTexture("boneSampler",m),p.setFloat("boneTextureWidth",4*(f.bones.length+1))}else p.setMatrices("mBones",f.getTransformMatrices(r))}I.a.BindMorphTargetParameters(r,p),I.a.BindClipPlane(p,a)}this._bindCustomEffectForRenderSubMeshForShadowMap(e,p,null==d?void 0:d._matriceNames,o),this.forceBackFacesOnly&&s.setState(!0,0,!1,!0),this.onBeforeShadowMapRenderMeshObservable.notifyObservers(r),this.onBeforeShadowMapRenderObservable.notifyObservers(p),r._processRendering(o,e,p,c.fillMode,l,u,function(e,t){return p.setMatrix("world",t)}),this.forceBackFacesOnly&&s.setState(!0,0,!1,!1),this.onAfterShadowMapRenderObservable.notifyObservers(p),this.onAfterShadowMapRenderMeshObservable.notifyObservers(r)}else this._shadowMap&&this._shadowMap.resetRefreshCounter()}}},U.prototype._applyFilterValues=function(){this._shadowMap&&(this.filter===U.FILTER_NONE||this.filter===U.FILTER_PCSS?this._shadowMap.updateSamplingMode(a.a.NEAREST_SAMPLINGMODE):this._shadowMap.updateSamplingMode(a.a.BILINEAR_SAMPLINGMODE))},U.prototype.forceCompilation=function(i,e){var n=this,r=Object(d.a)({useInstances:!1},e),t=this.getShadowMap();if(t){var o=t.renderList;if(o){for(var a,s,c=new Array,l=0,u=o;l<u.length;l++){var h=u[l];c.push.apply(c,h.subMeshes)}0!==c.length?(a=0,(s=function(){var e,t;if(n._scene&&n._scene.getEngine()){for(;n.isReady(c[a],r.useInstances,null!==(t=null===(e=c[a].getMaterial())||void 0===e?void 0:e.needAlphaBlendingForMesh(c[a].getMesh()))&&void 0!==t&&t);)if(++a>=c.length)return void(i&&i(n));setTimeout(s,16)}})()):i&&i(this)}else i&&i(this)}else i&&i(this)},U.prototype.forceCompilationAsync=function(t){var i=this;return new Promise(function(e){i.forceCompilation(function(){e()},t)})},U.prototype._isReadyCustomDefines=function(e,t,i){},U.prototype._prepareShadowDefines=function(e,t,i,n){i.push("#define SM_FLOAT "+(this._textureType!==l.a.TEXTURETYPE_UNSIGNED_INT?"1":"0")),i.push("#define SM_ESM "+(this.useExponentialShadowMap||this.useBlurExponentialShadowMap?"1":"0")),i.push("#define SM_DEPTHTEXTURE "+(this.usePercentageCloserFiltering||this.useContactHardeningShadow?"1":"0"));var r=e.getMesh();return i.push("#define SM_NORMALBIAS "+(this.normalBias&&r.isVerticesDataPresent(M.b.NormalKind)?"1":"0")),i.push("#define SM_DIRECTIONINLIGHTDATA "+(this.getLight().getTypeID()===_.a.LIGHTTYPEID_DIRECTIONALLIGHT?"1":"0")),i.push("#define SM_USEDISTANCE "+(this._light.needCube()?"1":"0")),i.push("#define SM_SOFTTRANSPARENTSHADOW "+(this.enableSoftTransparentShadow&&n?"1":"0")),this._isReadyCustomDefines(i,e,t),i},U.prototype.isReady=function(e,t,i){var n=e.getMaterial(),r=null==n?void 0:n.shadowDepthWrapper,o=[];if(this._prepareShadowDefines(e,t,o,i),r){if(!r.isReadyForSubMesh(e,o,this,t))return!1}else{var a=[M.b.PositionKind],s=e.getMesh();if(this.normalBias&&s.isVerticesDataPresent(M.b.NormalKind)&&(a.push(M.b.NormalKind),o.push("#define NORMAL"),s.nonUniformScaling&&o.push("#define NONUNIFORMSCALING")),n&&n.needAlphaTesting()){var c=n.getAlphaTestTexture();if(c){if(!c.isReady())return!1;o.push("#define ALPHATEST"),s.isVerticesDataPresent(M.b.UVKind)&&(a.push(M.b.UVKind),o.push("#define UV1")),s.isVerticesDataPresent(M.b.UV2Kind)&&1===c.coordinatesIndex&&(a.push(M.b.UV2Kind),o.push("#define UV2"))}}var l,u=new D.a;s.useBones&&s.computeBonesUsingShaders&&s.skeleton?(a.push(M.b.MatricesIndicesKind),a.push(M.b.MatricesWeightsKind),4<s.numBoneInfluencers&&(a.push(M.b.MatricesIndicesExtraKind),a.push(M.b.MatricesWeightsExtraKind)
1),l=s.skeleton,o.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),0<s.numBoneInfluencers&&u.addCPUSkinningFallback(0,s),l.isUsingTextureForMatrices?o.push("#define BONETEXTURE"):o.push("#define BonesPerMesh "+(l.bones.length+1))):o.push("#define NUM_BONE_INFLUENCERS 0");var h=s.morphTargetManager,d=0;h&&0<h.numInfluencers&&(o.push("#define MORPHTARGETS"),d=h.numInfluencers,o.push("#define NUM_MORPH_INFLUENCERS "+d),I.a.PrepareAttributesForMorphTargetsInfluencers(a,s,d));var p=this._scene;if(p.clipPlane&&o.push("#define CLIPPLANE"),p.clipPlane2&&o.push("#define CLIPPLANE2"),p.clipPlane3&&o.push("#define CLIPPLANE3"),p.clipPlane4&&o.push("#define CLIPPLANE4"),p.clipPlane5&&o.push("#define CLIPPLANE5"),p.clipPlane6&&o.push("#define CLIPPLANE6"),t&&(o.push("#define INSTANCES"),I.a.PushAttributesForInstances(a),e.getRenderingMesh().hasThinInstances&&o.push("#define THIN_INSTANCES")),this.customShaderOptions&&this.customShaderOptions.defines)for(var f=0,m=this.customShaderOptions.defines;f<m.length;f++){var _=m[f];-1===o.indexOf(_)&&o.push(_)}var g=o.join("\n");if(this._cachedDefines!==g){this._cachedDefines=g;var v="shadowMap",b=["world","mBones","viewProjection","diffuseMatrix","lightDataSM","depthValuesSM","biasAndScaleSM","morphTargetInfluences","boneTextureWidth","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","softTransparentShadowSM"],y=["diffuseSampler","boneSampler"];if(this.customShaderOptions){if(v=this.customShaderOptions.shaderName,this.customShaderOptions.attributes)for(var T=0,E=this.customShaderOptions.attributes;T<E.length;T++){var S=E[T];-1===a.indexOf(S)&&a.push(S)}if(this.customShaderOptions.uniforms)for(var A=0,C=this.customShaderOptions.uniforms;A<C.length;A++){var P=C[A];-1===b.indexOf(P)&&b.push(P)}if(this.customShaderOptions.samplers)for(var x=0,R=this.customShaderOptions.samplers;x<R.length;x++){var O=R[x];-1===y.indexOf(O)&&y.push(O)}}this._effect=this._scene.getEngine().createEffect(v,a,b,y,g,u,void 0,void 0,{maxSimultaneousMorphTargets:d})}if(!this._effect.isReady())return!1}return(this.useBlurExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(this._blurPostProcesses&&this._blurPostProcesses.length||this._initializeBlurRTTAndPostProcesses()),!(this._kernelBlurXPostprocess&&!this._kernelBlurXPostprocess.isReady()||this._kernelBlurYPostprocess&&!this._kernelBlurYPostprocess.isReady()||this._boxBlurPostprocess&&!this._boxBlurPostprocess.isReady())},U.prototype.prepareDefines=function(e,t){var i=this._scene,n=this._light;i.shadowsEnabled&&n.shadowEnabled&&(e["SHADOW"+t]=!0,this.useContactHardeningShadow?(e["SHADOWPCSS"+t]=!0,this._filteringQuality===U.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===U.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePercentageCloserFiltering?(e["SHADOWPCF"+t]=!0,this._filteringQuality===U.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===U.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePoissonSampling?e["SHADOWPOISSON"+t]=!0:this.useExponentialShadowMap||this.useBlurExponentialShadowMap?e["SHADOWESM"+t]=!0:(this.useCloseExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(e["SHADOWCLOSEESM"+t]=!0),n.needCube()&&(e["SHADOWCUBE"+t]=!0))},U.prototype.bindShadowLight=function(e,t){var i,n,r=this._light,o=this._scene;o.shadowsEnabled&&r.shadowEnabled&&(!(i=o.activeCamera)||(n=this.getShadowMap())&&(r.needCube()||t.setMatrix("lightMatrix"+e,this.getTransformMatrix()),this._filter===U.FILTER_PCF?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),r._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),n.getSize().width,1/n.getSize().width,this.frustumEdgeFalloff,e)):this._filter===U.FILTER_PCSS?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),t.setTexture("depthSampler"+e,this.getShadowMapForRendering()),r._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/n.getSize().width,this._contactHardeningLightSizeUVRatio*n.getSize().width,this.frustumEdgeFalloff,e)):(t.setTexture("shadowSampler"+e,this.get
1ShadowMapForRendering()),r._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),this.blurScale/n.getSize().width,this.depthScale,this.frustumEdgeFalloff,e)),r._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(i),this.getLight().getDepthMinZ(i)+this.getLight().getDepthMaxZ(i),e)))},U.prototype.getTransformMatrix=function(){var e=this._scene;if(this._currentRenderID===e.getRenderId()&&this._currentFaceIndexCache===this._currentFaceIndex)return this._transformMatrix;this._currentRenderID=e.getRenderId(),this._currentFaceIndexCache=this._currentFaceIndex;var t,i,n=this._light.position;return this._light.computeTransformedInformation()&&(n=this._light.transformedPosition),y.e.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex),this._lightDirection),1===Math.abs(y.e.Dot(this._lightDirection,y.e.Up()))&&(this._lightDirection.z=1e-13),!this._light.needProjectionMatrixCompute()&&this._cachedPosition&&this._cachedDirection&&n.equals(this._cachedPosition)&&this._lightDirection.equals(this._cachedDirection)||(this._cachedPosition.copyFrom(n),this._cachedDirection.copyFrom(this._lightDirection),y.a.LookAtLHToRef(n,n.add(this._lightDirection),y.e.Up(),this._viewMatrix),!(t=this.getShadowMap())||(i=t.renderList)&&this._light.setShadowProjectionMatrix(this._projectionMatrix,this._viewMatrix,i),this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix)),this._transformMatrix},U.prototype.recreateShadowMap=function(){var e,t=this._shadowMap;t&&(e=t.renderList,this._disposeRTTandPostProcesses(),this._initializeGenerator(),this.filter=this.filter,this._applyFilterValues(),this._shadowMap.renderList=e)},U.prototype._disposeBlurPostProcesses=function(){this._shadowMap2&&(this._shadowMap2.dispose(),this._shadowMap2=null),this._boxBlurPostprocess&&(this._boxBlurPostprocess.dispose(),this._boxBlurPostprocess=null),this._kernelBlurXPostprocess&&(this._kernelBlurXPostprocess.dispose(),this._kernelBlurXPostprocess=null),this._kernelBlurYPostprocess&&(this._kernelBlurYPostprocess.dispose(),this._kernelBlurYPostprocess=null),this._blurPostProcesses=[]},U.prototype._disposeRTTandPostProcesses=function(){this._shadowMap&&(this._shadowMap.dispose(),this._shadowMap=null),this._disposeBlurPostProcesses()},U.prototype.dispose=function(){this._disposeRTTandPostProcesses(),this._light&&(this._light._shadowGenerator=null,this._light._markMeshesAsLightDirty()),this.onBeforeShadowMapRenderMeshObservable.clear(),this.onBeforeShadowMapRenderObservable.clear(),this.onAfterShadowMapRenderMeshObservable.clear(),this.onAfterShadowMapRenderObservable.clear()},U.prototype.serialize=function(){var e={},t=this.getShadowMap();if(!t)return e;if(e.className=this.getClassName(),e.lightId=this._light.id,e.mapSize=t.getRenderSize(),e.forceBackFacesOnly=this.forceBackFacesOnly,e.darkness=this.getDarkness(),e.transparencyShadow=this._transparencyShadow,e.frustumEdgeFalloff=this.frustumEdgeFalloff,e.bias=this.bias,e.normalBias=this.normalBias,e.usePercentageCloserFiltering=this.usePercentageCloserFiltering,e.useContactHardeningShadow=this.useContactHardeningShadow,e.contactHardeningLightSizeUVRatio=this.contactHardeningLightSizeUVRatio,e.filteringQuality=this.filteringQuality,e.useExponentialShadowMap=this.useExponentialShadowMap,e.useBlurExponentialShadowMap=this.useBlurExponentialShadowMap,e.useCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.useBlurCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.usePoissonSampling=this.usePoissonSampling,e.depthScale=this.depthScale,e.blurBoxOffset=this.blurBoxOffset,e.blurKernel=this.blurKernel,e.blurScale=this.blurScale,e.useKernelBlur=this.useKernelBlur,e.renderList=[],t.renderList)for(var i=0;i<t.renderList.length;i++){var n=t.renderList[i];e.renderList.push(n.id)}return e},U.Parse=function(e,t,i){for(var n=t.getLightByID(e.lightId),r=i?i(e.mapSize,n):new U(e.mapSize,n),o=r.getShadowMap(),a=0;a<e.renderList.length;a++)t.getMeshesByID(e.renderList[a]).forEach(function(e){o&&(o.renderList||(o.renderList=[]),o.renderList.push(e))});return r.forceBackFacesOnly=!!e.forceBackFacesOnly,void 0!==e.darkness&&r.setDarkness(e.darkness),e.transparencyShadow&&r.setTransparencyShadow(!0),void 0!==e.frustumEdgeFalloff&&(r.frustumEdgeFalloff=e.frustumEdgeFalloff),void 0!==e.bias&&(r.bias=e.bias),void 0!==e.normalBias&&(r.normalBias=e.n
1ormalBias),e.usePercentageCloserFiltering?r.usePercentageCloserFiltering=!0:e.useContactHardeningShadow?r.useContactHardeningShadow=!0:e.usePoissonSampling?r.usePoissonSampling=!0:e.useExponentialShadowMap?r.useExponentialShadowMap=!0:e.useBlurExponentialShadowMap?r.useBlurExponentialShadowMap=!0:e.useCloseExponentialShadowMap?r.useCloseExponentialShadowMap=!0:e.useBlurCloseExponentialShadowMap?r.useBlurCloseExponentialShadowMap=!0:e.useVarianceShadowMap?r.useExponentialShadowMap=!0:e.useBlurVarianceShadowMap&&(r.useBlurExponentialShadowMap=!0),void 0!==e.contactHardeningLightSizeUVRatio&&(r.contactHardeningLightSizeUVRatio=e.contactHardeningLightSizeUVRatio),void 0!==e.filteringQuality&&(r.filteringQuality=e.filteringQuality),e.depthScale&&(r.depthScale=e.depthScale),e.blurScale&&(r.blurScale=e.blurScale),e.blurBoxOffset&&(r.blurBoxOffset=e.blurBoxOffset),e.useKernelBlur&&(r.useKernelBlur=e.useKernelBlur),e.blurKernel&&(r.blurKernel=e.blurKernel),r},U.CLASSNAME="ShadowGenerator",U.FILTER_NONE=0,U.FILTER_EXPONENTIALSHADOWMAP=1,U.FILTER_POISSONSAMPLING=2,U.FILTER_BLUREXPONENTIALSHADOWMAP=3,U.FILTER_CLOSEEXPONENTIALSHADOWMAP=4,U.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP=5,U.FILTER_PCF=6,U.FILTER_PCSS=7,U.QUALITY_HIGH=0,U.QUALITY_MEDIUM=1,U.QUALITY_LOW=2,U._SceneComponentInitialization=function(e){throw f.a.WarnImport("ShadowGeneratorSceneComponent")},U),E=i(52),S=i(281),A=i(7),C=i(22),P=y.e.Up(),x=y.e.Zero(),R=new y.e,O=new y.e,L=new y.a,N=new y.a,F=(T=b,Object(d.d)(B,T),B.prototype._validateFilter=function(e){return e===b.FILTER_NONE||e===b.FILTER_PCF||e===b.FILTER_PCSS?e:(console.error('Unsupported filter "'+e+'"!'),b.FILTER_NONE)},Object.defineProperty(B.prototype,"numCascades",{get:function(){return this._numCascades},set:function(e){(e=Math.min(Math.max(e,B.MIN_CASCADES_COUNT),B.MAX_CASCADES_COUNT))!==this._numCascades&&(this._numCascades=e,this.recreateShadowMap())},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"freezeShadowCastersBoundingInfo",{get:function(){return this._freezeShadowCastersBoundingInfo},set:function(e){this._freezeShadowCastersBoundingInfoObservable&&e&&(this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable),this._freezeShadowCastersBoundingInfoObservable=null),this._freezeShadowCastersBoundingInfoObservable||e||(this._freezeShadowCastersBoundingInfoObservable=this._scene.onBeforeRenderObservable.add(this._computeShadowCastersBoundingInfo.bind(this))),(this._freezeShadowCastersBoundingInfo=e)&&this._computeShadowCastersBoundingInfo()},enumerable:!1,configurable:!0}),B.prototype._computeShadowCastersBoundingInfo=function(){if(this._scbiMin.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._scbiMax.copyFromFloats(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),this._shadowMap&&this._shadowMap.renderList){for(var e,t=this._shadowMap.renderList,i=0;i<t.length;i++)(n=t[i])&&(e=n.getBoundingInfo().boundingBox,this._scbiMin.minimizeInPlace(e.minimumWorld),this._scbiMax.maximizeInPlace(e.maximumWorld));for(var n,r=this._scene.meshes,i=0;i<r.length;i++)(n=r[i])&&n.isVisible&&n.isEnabled&&n.receiveShadows&&(e=n.getBoundingInfo().boundingBox,this._scbiMin.minimizeInPlace(e.minimumWorld),this._scbiMax.maximizeInPlace(e.maximumWorld))}this._shadowCastersBoundingInfo.reConstruct(this._scbiMin,this._scbiMax)},Object.defineProperty(B.prototype,"shadowCastersBoundingInfo",{get:function(){return this._shadowCastersBoundingInfo},set:function(e){this._shadowCastersBoundingInfo=e},enumerable:!1,configurable:!0}),B.prototype.setMinMaxDistance=function(e,t){this._minDistance===e&&this._maxDistance===t||(t<e&&(e=0,t=1),e<0&&(e=0),1<t&&(t=1),this._minDistance=e,this._maxDistance=t,this._breaksAreDirty=!0)},Object.defineProperty(B.prototype,"minDistance",{get:function(){return this._minDistance},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"maxDistance",{get:function(){return this._maxDistance},enumerable:!1,configurable:!0}),B.prototype.getClassName=function(){return B.CLASSNAME},B.prototype.getCascadeMinExtents=function(e){return 0<=e&&e<this._numCascades?this._cascadeMinExtents[e]:null},B.prototype.getCascadeMaxExtents=function(e){return 0<=e&&e<this._numCascades?this._cascadeMaxExtents[e]:null},Object.defineProperty(B.prototype,"shadowMaxZ",{get:function(){return this._scene&&this._scene.activeCamera?this._shadowMaxZ:0},set:function(e){this._scene&&this._scene.activeCamera?this._shadowMaxZ===e||e<this._scene.activeCamera.minZ||e>this._scene.activeCamera.maxZ||(this._shadowMaxZ=e,this._light._markMeshesAsLightDirty(),this._breaksAreDirty=!0):this._shadowMaxZ=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"debug",{get:function(){return this._debug},set:function(e){this._debug=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"depthClamp",{get:function(){return this._depthClamp},set:function(e){this._depthClamp=e},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"cascadeBlendPercentage",{get:function(){return this._cascadeBlendPercentage},set:function(e){this._cascadeBlendPercentage=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"lambda",{get:function(){return this._lambda},set:function(e){var t=Math.min(Math.max(e,0),1);this._lambda!=t&&(this._lambda=t,this._breaksAreDirty=!0)},enumerable:!1,configurable:!0}),B.prototype.getCascadeViewMatrix=function(e){return 0<=e&&e<this._numCascades?this._viewMatrices[e]:null},B.prototype.getCascadeProjectionMatrix=function(e){return 0<=e&&e<this._numCascades?this._projectionMatrices[e]:null},B.prototype.getCascadeTransformMatrix=function(e){return 0<=e&&e<this._numCascades?this._transformMatrices[e]:null},B.prototype.setDepthRenderer=function(e){this._depthRenderer=e,this._depthReducer&&this._depthReducer.setDepthRenderer(this._depthRenderer)},Object.defineProperty(B.prototype,"autoCalcDepthBounds",{get:function(){return this._autoCalcDepthBounds},set:function(e){var n=this,t=this._scene.activeCamera;if(t){if(!(this._autoCalcDepthBounds=e))return this._depthReducer&&this._depthReducer.deactivate(),void this.setMinMaxDistance(0,1);this._depthReducer||(this._depthReducer=new S.a(t),this._depthReducer.onAfterReductionPerformed.add(function(e){var t=e.min,i=e.max;i<=t&&(t=0,i=1),t==n._minDistance&&i==n._maxDistance||n.setMinMaxDistance(t,i)}),this._depthReducer.setDepthRenderer(this._depthRenderer)),this._depthReducer.activate()}},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"autoCalcDepthBoundsRefreshRate",{get:function(){var e,t,i;return null!==(i=null===(t=null===(e=this._depthReducer)||void 0===e?void 0:e.depthRenderer)||void 0===t?void 0:t.getDepthMap().refreshRate)&&void 0!==i?i:-1},set:function(e){var t;null!==(t=this._depthReducer)&&void 0!==t&&t.depthRenderer&&(this._depthReducer.depthRenderer.getDepthMap().refreshRate=e)},enumerable:!1,configurable:!0}),B.prototype.splitFrustum=function(){this._breaksAreDirty=!0},B.prototype._splitFrustum=function(){var e=this._scene.activeCamera;if(e){for(var t=e.minZ,i=e.maxZ,n=i-t,r=this._minDistance,o=t+r*n,a=t+(this._shadowMaxZ<i&&this._shadowMaxZ>=t?Math.min((this._shadowMaxZ-t)/(i-t),this._maxDistance):this._maxDistance)*n,s=a-o,c=a/o,l=0;l<this._cascades.length;++l){var u=(l+1)/this._numCascades,h=o*Math.pow(c,u),d=o+s*u,p=this._lambda*(h-d)+d;this._cascades[l].prevBreakDistance=0===l?r:this._cascades[l-1].breakDistance,this._cascades[l].breakDistance=(p-t)/n,this._viewSpaceFrustumsZ[l]=t+this._cascades[l].breakDistance*n,this._frustumLengths[l]=(this._cascades[l].breakDistance-this._cascades[l].prevBreakDistance)*n}this._breaksAreDirty=!1}},B.prototype._computeMatrices=function(){if(this._scene.activeCamera){y.e.NormalizeToRef(this._light.getShadowDirection(0),this._lightDirection),1===Math.abs(y.e.Dot(this._lightDirection,y.e.Up()))&&(this._lightDirection.z=1e-13),this._cachedDirection.copyFrom(this._lightDirection);for(var e=0;e<this._numCascades;++e){this._computeFrustumInWorldSpace(e),this._computeCascadeFrustum(e),this._cascadeMaxExtents[e].subtractToRef(this._cascadeMinExtents[e],R),this._frustumCenter[e].addToRef(this._lightDirection.scale(this._cascadeMinExtents[e].z),this._shadowCameraPos[e]),y.a.LookAtLHToRef(this._shadowCameraPos[e],this._frustumCenter[e],P,this._viewMatrices[e]);var t=0,i=R.z,n=this._shadowCastersBoundingInfo;n.update(this._viewMatrices[e]),i=Math.min(i,n.boundingBox.maximumWorld.z),t=this._depthClamp&&this.filter!==b.FILTER_PCSS?Math.max(t,n.boundingBox.minimumWorld.z):Math.min(t,n.boundingBox.minimumWorld.z),y.a.OrthoOffCenterLHToRef(this._cascadeMinExtents[e].x,this._cascadeMaxExtents[e].x,this._cascadeMinExtents[e].y,this._cascadeMaxExtents[e].y,t,i,this._projectionMatrices[e]),this._cascadeMinExtents[e].z=t,this._cascadeMaxExtents[e].z=i,this._viewMatrices[e].multiplyToRef(this._projectionMatrices[e],this._transformMatrices[e]),y.e.TransformCoordinatesToRef(x,this._transformMatrices[e],R),R.scaleInPlace(this._mapSize/2),O.copyFromFloats(Math.round(R.x),Math.round(R.y),Math.round(R.z)),O.subtractInPlace(R).scaleInPlace(2/this._mapSize),y.a.TranslationToRef(O.x,O.y,0,L),this._projectionMatrices[e].multiplyToRef(L,this._projectionMatrices[e]),this._viewMatrices[e].multiplyToRef(this._projectionMatrices[e],this._transformMatrices[e]),this._transformMatrices[e].copyToArray(this._transformMatricesAsArray,16*e)}}},B.prototype._computeFrustumInWorldSpace=function(e){if(this._scene.activeCamera){var t=this._cascades[e].prevBreakDistance,i=this._cascades[e].breakDistance;this._scene.activeCamera.getViewMatrix();for(var n=y.a.Invert(this._scene.activeCamera.getTransformationMatrix()),r=0;r<B.frustumCornersNDCSpace.length;++r)y.e.TransformCoordinatesToRef(B.frustumCornersNDCSpace[r],n,this._frustumCornersWorldSpace[e][r]);for(r=0;r<B.frustumCornersNDCSpace.length/2;++r)R.copyFrom(this._frustumCornersWorldSpace[e][r+4]).subtractInPlace(this._frustumCornersWorldSpace[e][r]),O.copyFrom(R).scaleInPlace(t),R.scaleInPlace(i),R.addInPlace(this._frustumCornersWorldSpace[e][r]),this._frustumCornersWorldSpace[e][r+4].copyFrom(R),this._frustumCornersWorldSpace[e][r].addInPlace(O)}},B.prototype._computeCascadeFrustum=function(e){if(this._cascadeMinExtents[e].copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cascadeMaxExtents[e].copyFromFloats(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),this._frustumCenter[e].copyFromFloats(0,0,0),this._scene.activeCamera){for(var t=0;t<this._frustumCornersWorldSpace[e].length;++t)this._frustumCenter[e].addInPlace(this._frustumCornersWorldSpace[e][t]);if(this._frustumCenter[e].scaleInPlace(1/this._frustumCornersWorldSpace[e].length),this.stabilizeCascades){for(var i=0,t=0;t<this._frustumCornersWorldSpace[e].length;++t)var n=this._frustumCornersWorldSpace[e][t].subtractToRef(this._frustumCenter[e],R).length(),i=Math.max(i,n);i=Math.ceil(16*i)/16,this._cascadeMaxExtents[e].copyFromFloats(i,i,i),this._cascadeMinExtents[e].copyFromFloats(-i,-i,-i)}else{var r=this._frustumCenter[e];for(this._frustumCenter[e].addToRef(this._lightDirection,R),y.a.LookAtLHToRef(r,R,P,L),t=0;t<this._frustumCornersWorldSpace[e].length;++t)y.e.TransformCoordinatesToRef(this._frustumCornersWorldSpace[e][t],L,R),this._cascadeMinExtents[e].minimizeInPlace(R),this._cascadeMaxExtents[e].maximizeInPlace(R)}}},Object.defineProperty(B,"IsSupported",{get:function(){var e=C.a.LastCreatedEngine;return!!e&&1!=e.webGLVersion}
1,enumerable:!1,configurable:!0}),B.prototype._initializeGenerator=function(){var e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m,_,g,v,b;this.penumbraDarkness=null!==(e=this.penumbraDarkness)&&void 0!==e?e:1,this._numCascades=null!==(t=this._numCascades)&&void 0!==t?t:B.DEFAULT_CASCADES_COUNT,this.stabilizeCascades=null!==(i=this.stabilizeCascades)&&void 0!==i&&i,this._freezeShadowCastersBoundingInfoObservable=null!==(n=this._freezeShadowCastersBoundingInfoObservable)&&void 0!==n?n:null,this.freezeShadowCastersBoundingInfo=null!==(r=this.freezeShadowCastersBoundingInfo)&&void 0!==r&&r,this._scbiMin=null!==(o=this._scbiMin)&&void 0!==o?o:new y.e(0,0,0),this._scbiMax=null!==(a=this._scbiMax)&&void 0!==a?a:new y.e(0,0,0),this._shadowCastersBoundingInfo=null!==(s=this._shadowCastersBoundingInfo)&&void 0!==s?s:new E.a(new y.e(0,0,0),new y.e(0,0,0)),this._breaksAreDirty=null===(c=this._breaksAreDirty)||void 0===c||c,this._minDistance=null!==(l=this._minDistance)&&void 0!==l?l:0,this._maxDistance=null!==(u=this._maxDistance)&&void 0!==u?u:1,this._currentLayer=null!==(h=this._currentLayer)&&void 0!==h?h:0,this._shadowMaxZ=null!==(f=null!==(d=this._shadowMaxZ)&&void 0!==d?d:null===(p=this._scene.activeCamera)||void 0===p?void 0:p.maxZ)&&void 0!==f?f:1e4,this._debug=null!==(m=this._debug)&&void 0!==m&&m,this._depthClamp=null===(_=this._depthClamp)||void 0===_||_,this._cascadeBlendPercentage=null!==(g=this._cascadeBlendPercentage)&&void 0!==g?g:.1,this._lambda=null!==(v=this._lambda)&&void 0!==v?v:.5,this._autoCalcDepthBounds=null!==(b=this._autoCalcDepthBounds)&&void 0!==b&&b,T.prototype._initializeGenerator.call(this)},B.prototype._createTargetRenderTexture=function(){var e={width:this._mapSize,height:this._mapSize,layers:this.numCascades};this._shadowMap=new r.a(this._light.name+"_shadowMap",e,this._scene,!1,!0,this._textureType,!1,void 0,!1,!1,void 0),this._shadowMap.createDepthStencilTexture(l.a.LESS,!0)},B.prototype._initializeShadowMap=function(){var i=this;if(T.prototype._initializeShadowMap.call(this),null!==this._shadowMap){this._transformMatricesAsArray=new Float32Array(16*this._numCascades),this._viewSpaceFrustumsZ=new Array(this._numCascades),this._frustumLengths=new Array(this._numCascades),this._lightSizeUVCorrection=new Array(2*this._numCascades),this._depthCorrection=new Array(this._numCascades),this._cascades=[],this._viewMatrices=[],this._projectionMatrices=[],this._transformMatrices=[],this._cascadeMinExtents=[],this._cascadeMaxExtents=[],this._frustumCenter=[],this._shadowCameraPos=[],this._frustumCornersWorldSpace=[];for(var e=0;e<this._numCascades;++e){this._cascades[e]={prevBreakDistance:0,breakDistance:0},this._viewMatrices[e]=y.a.Zero(),this._projectionMatrices[e]=y.a.Zero(),this._transformMatrices[e]=y.a.Zero(),this._cascadeMinExtents[e]=new y.e,this._cascadeMaxExtents[e]=new y.e,this._frustumCenter[e]=new y.e,this._shadowCameraPos[e]=new y.e,this._frustumCornersWorldSpace[e]=new Array(B.frustumCornersNDCSpace.length);for(var t=0;t<B.frustumCornersNDCSpace.length;++t)this._frustumCornersWorldSpace[e][t]=new y.e}this._shadowMap.onBeforeRenderObservable.add(function(e){var t;i._currentLayer=e,i._scene.getSceneUniformBuffer().useUbo&&((t=i._scene.getSceneUniformBuffer()).updateMatrix("viewProjection",i.getCascadeTransformMatrix(e)),t.updateMatrix("view",i.getCascadeViewMatrix(e)),t.update())}),this._shadowMap.onBeforeBindObservable.add(function(){i._breaksAreDirty&&i._splitFrustum(),i._computeMatrices()}),this._splitFrustum()}},B.prototype._bindCustomEffectForRenderSubMeshForShadowMap=function(e,t,i,n){var r,o,a,s,c;t.setMatrix(null!==(r=null==i?void 0:i.viewProjection)&&void 0!==r?r:"viewProjection",this.getCascadeTransformMatrix(this._currentLayer)),t.setMatrix(null!==(o=null==i?void 0:i.view)&&void 0!==o?o:"view",this.getCascadeViewMatrix(this._currentLayer)),t.setMatrix(null!==(a=null==i?void 0:i.projection)&&void 0!==a?a:"projection",this.getCascadeProjectionMatrix(this._currentLayer));var l=n.getWorldMatrix();l.multiplyToRef(this.getCascadeTransformMatrix(this._currentLayer),L),t.setMatrix(null!==(s=null==i?void 0:i.worldViewProjection)&&void 0!==s?s:"worldViewProjection",L),l.multiplyToRef(this.getCascadeViewMatrix(this._currentLayer),N),t.setMatr
1ix(null!==(c=null==i?void 0:i.worldView)&&void 0!==c?c:"worldView",N)},B.prototype._isReadyCustomDefines=function(e,t,i){e.push("#define SM_DEPTHCLAMP "+(this._depthClamp&&this._filter!==b.FILTER_PCSS?"1":"0"))},B.prototype.prepareDefines=function(e,t){T.prototype.prepareDefines.call(this,e,t);var i,n=this._scene,r=this._light;n.shadowsEnabled&&r.shadowEnabled&&(e["SHADOWCSM"+t]=!0,e["SHADOWCSMDEBUG"+t]=this.debug,e["SHADOWCSMNUM_CASCADES"+t]=this.numCascades,e["SHADOWCSM_RIGHTHANDED"+t]=n.useRightHandedSystem,(i=n.activeCamera)&&this._shadowMaxZ<i.maxZ&&(e["SHADOWCSMUSESHADOWMAXZ"+t]=!0),0===this.cascadeBlendPercentage&&(e["SHADOWCSMNOBLEND"+t]=!0))},B.prototype.bindShadowLight=function(e,t){var i=this._light,n=this._scene;if(n.shadowsEnabled&&i.shadowEnabled){var r=n.activeCamera;if(r){var o=this.getShadowMap();if(o){var a=o.getSize().width;if(t.setMatrices("lightMatrix"+e,this._transformMatricesAsArray),t.setArray("viewFrustumZ"+e,this._viewSpaceFrustumsZ),t.setFloat("cascadeBlendFactor"+e,0===this.cascadeBlendPercentage?1e4:1/this.cascadeBlendPercentage),t.setArray("frustumLengths"+e,this._frustumLengths),this._filter===b.FILTER_PCF)t.setDepthStencilTexture("shadowSampler"+e,o),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),a,1/a,this.frustumEdgeFalloff,e);else if(this._filter===b.FILTER_PCSS){for(var s=0;s<this._numCascades;++s)this._lightSizeUVCorrection[2*s+0]=0===s?1:(this._cascadeMaxExtents[0].x-this._cascadeMinExtents[0].x)/(this._cascadeMaxExtents[s].x-this._cascadeMinExtents[s].x),this._lightSizeUVCorrection[2*s+1]=0===s?1:(this._cascadeMaxExtents[0].y-this._cascadeMinExtents[0].y)/(this._cascadeMaxExtents[s].y-this._cascadeMinExtents[s].y),this._depthCorrection[s]=0===s?1:(this._cascadeMaxExtents[s].z-this._cascadeMinExtents[s].z)/(this._cascadeMaxExtents[0].z-this._cascadeMinExtents[0].z);t.setDepthStencilTexture("shadowSampler"+e,o),t.setTexture("depthSampler"+e,o),t.setArray2("lightSizeUVCorrection"+e,this._lightSizeUVCorrection),t.setArray("depthCorrection"+e,this._depthCorrection),t.setFloat("penumbraDarkness"+e,this.penumbraDarkness),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/a,this._contactHardeningLightSizeUVRatio*a,this.frustumEdgeFalloff,e)}else t.setTexture("shadowSampler"+e,o),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),a,1/a,this.frustumEdgeFalloff,e);i._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(r),this.getLight().getDepthMinZ(r)+this.getLight().getDepthMaxZ(r),e)}}}},B.prototype.getTransformMatrix=function(){return this.getCascadeTransformMatrix(0)},B.prototype.dispose=function(){T.prototype.dispose.call(this),this._freezeShadowCastersBoundingInfoObservable&&(this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable),this._freezeShadowCastersBoundingInfoObservable=null),this._depthReducer&&(this._depthReducer.dispose(),this._depthReducer=null)},B.prototype.serialize=function(){var e=T.prototype.serialize.call(this),t=this.getShadowMap();if(!t)return e;if(e.numCascades=this._numCascades,e.debug=this._debug,e.stabilizeCascades=this.stabilizeCascades,e.lambda=this._lambda,e.cascadeBlendPercentage=this.cascadeBlendPercentage,e.depthClamp=this._depthClamp,e.autoCalcDepthBounds=this.autoCalcDepthBounds,e.shadowMaxZ=this._shadowMaxZ,e.penumbraDarkness=this.penumbraDarkness,e.freezeShadowCastersBoundingInfo=this._freezeShadowCastersBoundingInfo,e.minDistance=this.minDistance,e.maxDistance=this.maxDistance,e.renderList=[],t.renderList)for(var i=0;i<t.renderList.length;i++){var n=t.renderList[i];e.renderList.push(n.id)}return e},B.Parse=function(e,t){var i=b.Parse(e,t,function(e,t){return new B(e,t)});return void 0!==e.numCascades&&(i.numCascades=e.numCascades),void 0!==e.debug&&(i.debug=e.debug),void 0!==e.stabilizeCascades&&(i.stabilizeCascades=e.stabilizeCascades),void 0!==e.lambda&&(i.lambda=e.lambda),void 0!==e.cascadeBlendPercentage&&(i.cascadeBlendPercentage=e.cascadeBlendPercentage),void 0!==e.depthClamp&&(i.depthClamp=e.depthClamp),void 0!==e.autoCalcDepthBounds&&(i.autoCalcDepthBounds=e.autoCalcDepthBounds),void 0!==e.shadowMaxZ&&(i.shadowMaxZ=e.shadowMaxZ),void 0!==e.penumbraDarkness&&(i.penumbraDarkness=e.penumbraDarkness),void 0!==e.freezeShadowCastersBoundingInfo&&(i.freezeShadowCastersBoundingInfo=e.freezeShadowCastersBoundingInfo),void 0!==e.minDistance&&void 0!==e.maxDistance&&i.setMinMaxDistance(e.minDistance,e.maxDistance),i},B.frustumCornersNDCSpace=[new y.e(-1,1,-1),new y.e(1,1,-1),new y.e(1,-1,-1),new y.e(-1,-1,-1),new y.e(-1,1,1),new y.e(1,1,1),new y.e(1,-1,1),new y.e(-1,-1,1)],B.CLASSNAME="CascadedShadowGenerator",B.DEFAULT_CA
1SCADES_COUNT=4,B.MIN_CASCADES_COUNT=2,B.MAX_CASCADES_COUNT=4,B._SceneComponentInitialization=function(e){throw f.a.WarnImport("ShadowGeneratorSceneComponent")},B),w=i(17);function B(e,t,i){var n=T.call(this,e,t,i)||this;return B.IsSupported?n.usePercentageCloserFiltering=!0:A.a.Error("CascadedShadowMap needs WebGL 2 support."),n}function U(e,t,i){this.onBeforeShadowMapRenderObservable=new p.c,this.onAfterShadowMapRenderObservable=new p.c,this.onBeforeShadowMapRenderMeshObservable=new p.c,this.onAfterShadowMapRenderMeshObservable=new p.c,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=U.FILTER_NONE,this._filteringQuality=U.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.enableSoftTransparentShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=y.e.Zero(),this._viewMatrix=y.a.Zero(),this._projectionMatrix=y.a.Zero(),this._transformMatrix=y.a.Zero(),this._cachedPosition=new y.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new y.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=y.a.Identity(),this._mapSize=e,this._light=t,this._scene=t.getScene(),t._shadowGenerator=this,U._SceneComponentInitialization(this._scene);var n=this._scene.getEngine().getCaps();i?n.textureFloatRender&&n.textureFloatLinearFiltering?this._textureType=l.a.TEXTURETYPE_FLOAT:n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?this._textureType=l.a.TEXTURETYPE_HALF_FLOAT:this._textureType=l.a.TEXTURETYPE_UNSIGNED_INT:n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?this._textureType=l.a.TEXTURETYPE_HALF_FLOAT:n.textureFloatRender&&n.textureFloatLinearFiltering?this._textureType=l.a.TEXTURETYPE_FLOAT:this._textureType=l.a.TEXTURETYPE_UNSIGNED_INT,this._initializeGenerator(),this._applyFilterValues()}i(42).a.AddParser(w.a.NAME_SHADOWGENERATOR,function(e,t){if(void 0!==e.shadowGenerators&&null!==e.shadowGenerators)for(var i=0,n=e.shadowGenerators.length;i<n;i++){var r=e.shadowGenerators[i];r.className===F.CLASSNAME?F.Parse(r,t):b.Parse(r,t)}});var V=(k.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(w.a.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR,this,this._gatherRenderTargets)},k.prototype.rebuild=function(){},k.prototype.serialize=function(e){e.shadowGenerators=[];for(var t=0,i=this.scene.lights;t<i.length;t++){var n=i[t].getShadowGenerator();n&&e.shadowGenerators.push(n.serialize())}},k.prototype.addFromContainer=function(e){},k.prototype.removeFromContainer=function(e,t){},k.prototype.dispose=function(){},k.prototype._gatherRenderTargets=function(e){var t=this.scene;if(this.scene.shadowsEnabled)for(var i=0;i<t.lights.length;i++){var n,r=t.lights[i],o=r.getShadowGenerator();r.isEnabled()&&r.shadowEnabled&&o&&(n=o.getShadowMap(),-1!==t.textures.indexOf(n)&&e.push(n))}},k);function k(e){this.name=w.a.NAME_SHADOWGENERATOR,this.scene=e}b._SceneComponentInitialization=function(e){var t=e._getComponent(w.a.NAME_SHADOWGENERATOR);t||(t=new V(e),e._addComponent(t))};var G=i(267),z=i(118),j=i(282),W=i(268)},function(e,t,i){"use strict";i.d(t,"e",function(){return r.a}),i.d(t,"l",function(){return o.b}),i.d(t,"m",function(){return o.c}),i.d(t,"k",function(){return o.a}),i.d(t,"n",function(){return a.a}),i.d(t,"u",function(){return s.a}),i.d(t,"v",function(){return c.a}),i.d(t,"x",function(){return l.b}),i.d(t,"w",function(){return l.a}),i.d(t,"F",function(){return u.a}),i.d(t,"E",function(){return h.a}),i.d(t,"j",function(){return d.b}),i.d(t,"i",function(){return d.a}),i.d(t,"o",function(){return p.a}),i.d(t,"p",function(){return p.b}),i.d(t,"t",function(){return v}),i.d(t,"c",function(){return S}),i.d(t,"C",function(){return x}),i.d(t,"d",function(){return M}),i.d(t,"A",function(){return L.a}),i.d(t,"h",function(){return N.a}),i.d(t,"a",function(){return U}),i.d(t,"g",function(){return V}),i.d(t,"s",function(){return z}),i.d(t,"b",function(){return H.a}),i.d(t,"f",function(){return X.a}),i.d(t,"q",function(){return Y.a}),i.d(t,"y",function(){return Z}),i.d(t,"z",function(){return K.a}),i.d(t,"B",function(){return te}),i.d(t,"r",function(){return oe}),i.d(t,"D",function(){return ce.a}
1);var n,r=i(273),o=i(278),a=i(272),s=i(274),c=i(275),l=i(263),u=i(73),h=i(184),d=i(271),p=i(56),f=i(1),m=i(6),_=i(0),g=i(87),v=(n=g.a,Object(f.d)(b,n),b.XRHitTestWithRay=function(e,t,i,n){return e.requestHitTest(t,i).then(function(e){var t=n||function(e){return!!e.hitMatrix};return e.filter(t)})},b.XRHitTestWithSelectEvent=function(e,t){var i=e.frame.getPose(e.inputSource.targetRaySpace,t);if(!i)return Promise.resolve([]);var n=new XRRay(i.transform);return this.XRHitTestWithRay(e.frame.session,n,t)},b.prototype.attach=function(){return!!n.prototype.attach.call(this)&&(this.options.testOnPointerDownOnly&&this._xrSessionManager.session.addEventListener("select",this._onSelect,!1),!0)},b.prototype.detach=function(){return!!n.prototype.detach.call(this)&&(this._onSelectEnabled=!1,this._xrSessionManager.session.removeEventListener("select",this._onSelect),!0)},b.prototype.dispose=function(){n.prototype.dispose.call(this),this.onHitTestResultObservable.clear()},b.prototype._onXRFrame=function(e){var t,i;!this.attached||this.options.testOnPointerDownOnly||(t=e.getViewerPose(this._xrSessionManager.referenceSpace))&&(_.a.FromArrayToRef(t.transform.matrix,0,this._mat),_.e.TransformCoordinatesFromFloatsToRef(0,0,0,this._mat,this._origin),_.e.TransformCoordinatesFromFloatsToRef(0,0,-1,this._mat,this._direction),this._direction.subtractInPlace(this._origin),this._direction.normalize(),i=new XRRay({x:this._origin.x,y:this._origin.y,z:this._origin.z,w:0},{x:this._direction.x,y:this._direction.y,z:this._direction.z,w:0}),b.XRHitTestWithRay(this._xrSessionManager.session,i,this._xrSessionManager.referenceSpace).then(this._onHitTestResults))},b.Name=p.a.HIT_TEST,b.Version=1,b);function b(e,t){void 0===t&&(t={});var i=n.call(this,e)||this;return i.options=t,i._direction=new _.e(0,0,-1),i._mat=new _.a,i._onSelectEnabled=!1,i._origin=new _.e(0,0,0),i.lastNativeXRHitResults=[],i.onHitTestResultObservable=new m.c,i._onHitTestResults=function(e){var t=e.map(function(e){var t=_.a.FromArray(e.hitMatrix);return i._xrSessionManager.scene.useRightHandedSystem||t.toggleModelMatrixHandInPlace(),i.options.worldParentNode&&t.multiplyToRef(i.options.worldParentNode.getWorldMatrix(),t),{xrHitResult:e,transformationMatrix:t}});i.lastNativeXRHitResults=e,i.onHitTestResultObservable.notifyObservers(t)},i._onSelect=function(e){i._onSelectEnabled&&b.XRHitTestWithSelectEvent(e,i._xrSessionManager.referenceSpace)},i}p.b.AddWebXRFeature(v.Name,function(e,t){return function(){return new v(e,t)}},v.Version,!1);var y,T=i(13),E=0,S=(y=g.a,Object(f.d)(A,y),Object.defineProperty(A.prototype,"referenceSpaceForFrameAnchors",{set:function(e){this._referenceSpaceForFrameAnchors=e},enumerable:!1,configurable:!0}),A.prototype._populateTmpTransformation=function(e,t){return this._tmpVector.copyFrom(e),this._tmpQuaternion.copyFrom(t),this._xrSessionManager.scene.useRightHandedSystem||(this._tmpVector.z*=-1,this._tmpQuaternion.z*=-1,this._tmpQuaternion.w*=-1),{position:this._tmpVector,rotationQuaternion:this._tmpQuaternion}},A.prototype.addAnchorPointUsingHitTestResultAsync=function(i,n,r){return void 0===n&&(n=new _.e),void 0===r&&(r=new _.b),Object(f.b)(this,void 0,void 0,function(){var t;return Object(f.e)(this,function(e){if(this._populateTmpTransformation(n,r),t=new XRRigidTransform({x:this._tmpVector.x,y:this._tmpVector.y,z:this._tmpVector.z},{x:this._tmpQuaternion.x,y:this._tmpQuaternion.y,z:this._tmpQuaternion.z,w:this._tmpQuaternion.w}),!i.xrHitResult.createAnchor)throw new Error('Anchors not enabled in this browsed. Add "anchors" to optional features');try{return[2,i.xrHitResult.createAnchor(t)]}catch(e){throw new Error(e)}return[2]})})},A.prototype.addAnchorAtPositionAndRotationAsync=function(e,t,i){var n=this;void 0===t&&(t=new _.b),void 0===i&&(i=!1),this._populateTmpTransformation(e,t);var r=new XRRigidTransform({x:this._tmpVector.x,y:this._tmpVector.y,z:this._tmpVector.z},{x:this._tmpQuaternion.x,y:this._tmpQuaternion.y,z:this._tmpQuaternion.z,w:this._tmpQuaternion.w});return i&&this.attached&&this._xrSessionManager.currentFrame?this._createAnchorAtTransformation(r,this._xrSessionManager.currentFrame):new Promise(function(e,t){n._futureAnchors.push({xrTransformation:r,resolve:e,reject:t})})},A.prototype.detach=function(){if(!y.prototype.detach.call(this))return!1;if(!this._options.doNotRemoveAnchorsOnSessionEnded)for(;this._trackedAnchors.length;){var e=this._trackedAnchors.pop();e&&this.onAnchorRemovedObservable.notifyObservers(e)}return!0},A.prototype.dispose=function(){y.prototype.dispose.call(this),this.onAnchorAddedObservable.clear(),this.onAnchorRemovedObservable.clear(),this.onAnchorUpdatedObservable.clear()},A.prototype._onXRFrame=function(r){var o=this;if(this.attached&&r){var e,i,t=r.trackedAnchors;for(t&&(e=this._trackedAnchors.filter(function(e){return!t.has(e.xrAnchor)}).map(function(e){return o._trackedAnchors.indexOf(e)}),i=0,e.forEach(function(e){var t=o._trackedAnchors.splice(e-i,1)[0];o.onAnchorRemovedObservable.notifyObservers(t),i--}),t.forEach(function(e){if(o._lastFrameDetected.has(e)){var t=o._findIndexInAnchorArray(e),i=o._trackedAnchors[t];try{o._updateAnchorWithXRFrame(e,i,r),i.attachedNode&&(i.attachedNode.rotationQuaternion=i.attachedNode.rotationQuaternion||new _.b,i.transformationMatrix.decompose(i.attachedNode.scaling,i.attachedNode.rotationQuaternion,i.attachedNode.position)),o.onAnchorUpdatedObservable.notifyObservers(i)}catch(e){T.b.Warn("Anchor could not be updated")}}else{var n={id:E++,xrAnchor:e},i=o._updateAnchorWithXRFrame(e,n,r);o._trackedAnchors.push(i),o.onAnchorAddedObservable.notifyObservers(i)}}),this._lastFrameDetected=t);this._futureAnchors.length;){var n=this._futureAnchors.pop();if(!n)return;r.createAnchor||n.reject("Anchors not enabled in this browser"),this._createAnchorAtTransformation(n.xrTransformation,r).then(n.resolve,n.reject)}}},A.prototype._findIndexInAnchorArray=function(e){for(var t=0;t<this._trackedAnchors.length;++t)if(this._trackedAnchors[t].xrAnchor===e)return t;return-1},A.prototype._updateAnchorWithXRFrame=function(e,t,i){var n,r=i.getPose(e.anchorSpace,this._xrSessionManager.referenceSpace);return r&&(n=t.transformationMatrix||new _.a,_.a.FromArrayToRef(r.transform.matrix,0,n),this._xrSessionManager.scene.useRightHandedSystem||n.toggleModelMatrixHandInPlace(),t.transformationMatrix=n,this._options.worldParentNode&&n.multiplyToRef(this._options.worldParentNode.getWorldMatrix(),n)),t},A.prototype._createAnchorAtTransformation=function(t,i){var n;return Object(f.b)(this,void 0,void 0,function(){return Object(f.e)(this,function(e){if(!i.createAnchor)throw new Error("Anchors are not enabled in your browser");try{return[2,i.createAnchor(t,null!==(n=this._referenceSpaceForFrameAnchors)&&void 0!==n?n:this._xrSessionManager.referenceSpace)]}catch(e){throw new Error(e)}return[2]})})}
1,A.Name=p.a.ANCHOR_SYSTEM,A.Version=1,A);function A(e,t){void 0===t&&(t={});var i=y.call(this,e)||this;return i._options=t,i._lastFrameDetected=new Set,i._trackedAnchors=[],i._futureAnchors=[],i.onAnchorAddedObservable=new m.c,i.onAnchorRemovedObservable=new m.c,i.onAnchorUpdatedObservable=new m.c,i._tmpVector=new _.e,i._tmpQuaternion=new _.b,i}p.b.AddWebXRFeature(S.Name,function(e,t){return function(){return new S(e,t)}},S.Version);var C,P=0,x=(C=g.a,Object(f.d)(R,C),R.prototype.detach=function(){if(!C.prototype.detach.call(this))return!1;if(!this._options.doNotRemovePlanesOnSessionEnded)for(;this._detectedPlanes.length;){var e=this._detectedPlanes.pop();e&&this.onPlaneRemovedObservable.notifyObservers(e)}return!0},R.prototype.dispose=function(){C.prototype.dispose.call(this),this.onPlaneAddedObservable.clear(),this.onPlaneRemovedObservable.clear(),this.onPlaneUpdatedObservable.clear()},R.prototype._onXRFrame=function(r){var t,e,i,o=this;this.attached&&this._enabled&&r&&(t=r.worldInformation.detectedPlanes)&&(e=this._detectedPlanes.filter(function(e){return!t.has(e.xrPlane)}).map(function(e){return o._detectedPlanes.indexOf(e)}),i=0,e.forEach(function(e){var t=o._detectedPlanes.splice(e-i,1)[0];o.onPlaneRemovedObservable.notifyObservers(t),i--}),t.forEach(function(e){var t,i,n;o._lastFrameDetected.has(e)?e.lastChangedTime===o._xrSessionManager.currentTimestamp&&(t=o.findIndexInPlaneArray(e),n=o._detectedPlanes[t],o._updatePlaneWithXRPlane(e,n,r),o.onPlaneUpdatedObservable.notifyObservers(n)):(i={id:P++,xrPlane:e,polygonDefinition:[]},n=o._updatePlaneWithXRPlane(e,i,r),o._detectedPlanes.push(n),o.onPlaneAddedObservable.notifyObservers(n))}),this._lastFrameDetected=t)},R.prototype._init=function(){this._xrSessionManager.session.updateWorldTrackingState&&(this._xrSessionManager.session.updateWorldTrackingState({planeDetectionState:{enabled:!0}}),this._enabled=!0,this._detectedPlanes.length&&(this._detectedPlanes=[]))},R.prototype._updatePlaneWithXRPlane=function(e,t,i){var n=this;t.polygonDefinition=e.polygon.map(function(e){var t=n._xrSessionManager.scene.useRightHandedSystem?1:-1;return new _.e(e.x,e.y,e.z*t)});var r,o=i.getPose(e.planeSpace,this._xrSessionManager.referenceSpace);return o&&(r=t.transformationMatrix||new _.a,_.a.FromArrayToRef(o.transform.matrix,0,r),this._xrSessionManager.scene.useRightHandedSystem||r.toggleModelMatrixHandInPlace(),t.transformationMatrix=r,this._options.worldParentNode&&r.multiplyToRef(this._options.worldParentNode.getWorldMatrix(),r)),t},R.prototype.findIndexInPlaneArray=function(e){for(var t=0;t<this._detectedPlanes.length;++t)if(this._detectedPlanes[t].xrPlane===e)return t;return-1},R.Name=p.a.PLANE_DETECTION,R.Version=1,R);function R(e,t){void 0===t&&(t={});var i=C.call(this,e)||this;return i._options=t,i._detectedPlanes=[],i._enabled=!1,i._lastFrameDetected=new Set,i.onPlaneAddedObservable=new m.c,i.onPlaneRemovedObservable=new m.c,i.onPlaneUpdatedObservable=new m.c,i._xrSessionManager.session?i._init():i._xrSessionManager.onXRSessionInit.addOnce(function(){i._init()}),i}p.b.AddWebXRFeature(x.Name,function(e,t){return function(){return new x(e,t)}},x.Version);var O,M=(O=g.a,Object(f.d)(I,O),I.prototype.attach=function(){return this._setBackgroundState(!1),O.prototype.attach.call(this)},I.prototype.detach=function(){return this._setBackgroundState(!0),O.prototype.detach.call(this)},I.prototype.dispose=function(){O.prototype.dispose.call(this),this.onBackgroundStateChangedObservable.clear()},I.prototype._onXRFrame=function(e){},I.prototype._setBackgroundState=function(t){var e,i,n,r=this._xrSessionManager.scene;this.options.ignoreEnvironmentHelper||(this.options.environmentHelperRemovalFlags?(!this.options.environmentHelperRemovalFlags.skyBox||(e=r.getMeshByName("BackgroundSkybox"))&&e.setEnabled(t),!this.options.environmentHelperRemovalFlags.ground||(i=r.getMeshByName("BackgroundPlane"))&&i.setEnabled(t)):(n=r.getMeshByName("BackgroundHelper"))&&n.setEnabled(t)),this.options.backgroundMeshes&&this.options.backgroundMeshes.forEach(function(e){return e.setEnabled(t)}),this.onBackgroundStateChangedObservable.notifyObservers(t)},I.Name=p.a.BACKGROUND_REMOVER,I.Version=1,I);function I(e,t){void 0===t&&(t={});var i=O.call(this,e)||this;
1return i.options=t,i.onBackgroundStateChangedObservable=new m.c,i}p.b.AddWebXRFeature(M.Name,function(e,t){return function(){return new M(e,t)}},M.Version,!0);var D,L=i(300),N=i(277),F=i(34),w=i(60),B=i(7),U=function(){},V=(D=g.a,Object(f.d)(k,D),k.prototype._enablePhysicsDebug=function(){var i=this;this._debugMode=!0,Object.keys(this._controllers).forEach(function(e){var t=i._controllers[e];t.impostorMesh&&(t.impostorMesh.isVisible=!0)})},k.prototype.addController=function(e){this._attachController(e)},k.prototype.attach=function(){var e,t,i=this;return!!D.prototype.attach.call(this)&&(this._options.xrInput&&(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,function(e){i._detachController(e.uniqueId)}),this._options.enableHeadsetImpostor&&(t=(e=this._options.headsetImpostorParams||{impostorType:F.a.SphereImpostor,restitution:.8,impostorSize:.3}).impostorSize||.3,this._headsetMesh=w.a.CreateSphere("headset-mesh",{diameterX:"number"==typeof t?t:t.width,diameterY:"number"==typeof t?t:t.height,diameterZ:"number"==typeof t?t:t.depth}),this._headsetMesh.rotationQuaternion=new _.b,this._headsetMesh.isVisible=!1,this._headsetImpostor=new F.a(this._headsetMesh,e.impostorType,Object(f.a)({mass:0},e)))),!0)},k.prototype.detach=function(){var t=this;return!!D.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach(function(e){t._detachController(e)}),this._headsetMesh&&this._headsetMesh.dispose(),!0)},k.prototype.getHeadsetImpostor=function(){return this._headsetImpostor},k.prototype.getImpostorForController=function(e){var t="string"==typeof e?e:e.uniqueId;return this._controllers[t]?this._controllers[t].impostor:null},k.prototype.setPhysicsProperties=function(e){this._options.physicsProperties=Object(f.a)(Object(f.a)({},this._options.physicsProperties),e)},k.prototype._onXRFrame=function(e){var s=this;this._delta=this._xrSessionManager.currentTimestamp-this._lastTimestamp,this._lastTimestamp=this._xrSessionManager.currentTimestamp,this._headsetMesh&&(this._headsetMesh.position.copyFrom(this._options.xrInput.xrCamera.position),this._headsetMesh.rotationQuaternion.copyFrom(this._options.xrInput.xrCamera.rotationQuaternion)),Object.keys(this._controllers).forEach(function(e){var t,i,n=s._controllers[e],r=n.xrController.grip||n.xrController.pointer,o=n.oldPos||n.impostorMesh.position,a=n.oldRotation||n.impostorMesh.rotationQuaternion;r.position.subtractToRef(o,s._tmpVector),s._tmpVector.scaleInPlace(1e3/s._delta),n.impostor.setLinearVelocity(s._tmpVector),s._debugMode&&console.log(s._tmpVector,"linear"),a.equalsWithEpsilon(r.rotationQuaternion)||(a.conjugateInPlace().multiplyToRef(r.rotationQuaternion,s._tmpQuaternion),t=Math.sqrt(s._tmpQuaternion.x*s._tmpQuaternion.x+s._tmpQuaternion.y*s._tmpQuaternion.y+s._tmpQuaternion.z*s._tmpQuaternion.z),s._tmpVector.set(s._tmpQuaternion.x,s._tmpQuaternion.y,s._tmpQuaternion.z),t<.001?s._tmpVector.scaleInPlace(2):(i=2*Math.atan2(t,s._tmpQuaternion.w),s._tmpVector.scaleInPlace(i/(t*(s._delta/1e3)))),n.impostor.setAngularVelocity(s._tmpVector),s._debugMode&&console.log(s._tmpVector,s._tmpQuaternion,"angular")),o.copyFrom(r.position),a.copyFrom(r.rotationQuaternion)})},k.prototype._detachController=function(e){var t=this._controllers[e];t&&(t.impostorMesh&&t.impostorMesh.dispose(),delete this._controllers[e])},k.Name=p.a.PHYSICS_CONTROLLERS,k.Version=1,k);function k(e,t){var a=D.call(this,e)||this;return a._options=t,a._attachController=function(n){var e,t,i,r,o;a._controllers[n.uniqueId]||(a._xrSessionManager.scene.isPhysicsEnabled()||B.a.Warn("physics engine not enabled, skipped. Please add this controller manually."),a._options.physicsProperties.useControllerMesh&&n.inputSource.gamepad?n.onMotionControllerInitObservable.addOnce(function(i){i.onModelLoadedObservable.addOnce(function(){var e=new F.a(i.rootMesh,F.a.MeshImpostor,Object(f.a)({mass:0},a._options.physicsProperties)),t=n.grip||n.pointer;a._controllers[n.uniqueId]={xrController:n,impostor:e,oldPos:t.position.clone(),oldRotation:t.rotationQuaternion.clone()}})}):(e=a._options.physicsProperties.impostorType||F.a.SphereImpostor,t=a._options.physicsProperties.impostorSize||.1,(i=w.a.CreateSphere("impostor-mesh-"+n.uniqueId,{diameterX:"number"==typeof t?t:t.width,diameterY:"number"==typeof t?t:t.height,diameterZ:"number"==typeof t?t:t.depth})).isVisible=a._debugMode,i.isPickable=!1,i.rotationQuaternion=new _.b,r=n.grip||n.pointer,i.position.copyFrom(r.position),i.rotationQuaternion.copyFrom(r.rotationQuaternion),o=new F.a(i,e,Object(f.a)({mass:0},a._options.physicsProperties)),a._controllers[n.uniqueId]={xrController:n,impostor:o,impostorMesh:i}))},a._controllers={},a._debugMode=!1,a._delta=0,a._lastTimestamp=0,a._tmpQuaternion=new _.b,a._tmpVector=new _.e,a._options.physicsProperties||(a._options.physicsProperties={}),a}p.b.AddWebXRFeature(V.Name,function(e,t){return function(){return new V(e,t)}},V.Version,!0);var G,z=(G=g.a,Object(f.d)(j,G),j.prototype.attach=function(){var e,t=this;return!!G.prototype.attach.call(this)&&(this.options.disablePermanentHitTest||(this._xrSessionManager.referenceSpace&&this.initHitTestSource(this._xrSessionManager.referenceSpace),this._xrSessionManager.onXRReferenceSpaceChanged.add(this.initHitTestSource)),this.options.enableTransientHitTest&&(e=new XRRay(this.options.transientOffsetRay||{}),this._xrSessionManager.session.requestHitTestSourceForTransientInput({profile:"generic-touchscreen",offsetRay:e}).then(function(e){t._transientXrHitTestSource=e})),!0)},j.prototype.detach=function(){return!!G.prototype.detach.call(this)&&(this._xrHitTestSource&&(this._xrHitTestSource.cancel(),this._xrHitTestSource=null),this._xrSessionManager.onXRReferenceSpaceChanged.removeCallback(this.initHitTestSource),this._transientXrHitTestSource&&(this._transientXrHitTestSource.cancel(),this._transientXrHitTestSource=null),!0)},j.prototype.dispose=function(){G.prototype.dispose.call(this),this.onHitTestResultObservable.clear()},j.prototype._onXRFrame=function(e){var t,i=this;this.attached&&!this.paused&&(!this._xrHitTestSource||(t=e.getHitTestResults(this._xrHitTestSource)).length&&this._processWebXRHitTestResult(t),this._transientXrHitTestSource&&e.getHitTestResultsForTransientInput(this._transientXrHitTestSource).forEach(function(e){0<e.results.length&&i._processWebXRHitTestResult(e.results,e.inputSource)}))},j.prototype._processWebXRHitTestResult=function(e,o){var a=this,s=[];e.forEach(function(e){var t,i,n,r=e.getPose(a._xrSessionManager.referenceSpace);r&&(t=r.transform.position,i=r.transform.orientation,a._tmpPos.set(t.x,t.y,t.z),a._tmpQuat.set(i.x,i.y,i.z,i.w),_.a.FromFloat32ArrayToRefScaled(r.transform.matrix,0,1,a._tmpMat),a._xrSessionManager.scene.useRightHandedSystem||(a._tmpPos.z*=-1,a._tmpQuat.z*=-1,a._tmpQuat.w*=-1,a._tmpMat.toggleModelMatrixHandInPlace()),n={position:a.autoCloneTransformation?a._tmpPos.clone():a._tmpPos,rotationQuaternion:a.autoCloneTransformation?a._tmpQuat.clone():a._tmpQuat,transformationMatrix:a.autoCloneTransformation?a._tmpMat.clone():a._tmpMat,inputSource:o,isTransient:!!o,xrHitResult:e},s.push(n))}),s.length&&this.onHitTestResultObservable.notifyObservers(s)},j.Name=p.a.HIT_TEST,j.Version=2,j);function j(e,t){void 0===t&&(t={});var n=G.call(this,e)||this;return n.options=t,n._tmpMat=new _.a,n._tmpPos=new _.e,n._tmpQuat=new _.b,n.initHitTestSource=function(e){var t,i;e&&(t=new XRRay(n.options.offsetRay||{}),(i={space:n.options.useReferenceSpace?e:n._xrSessionManager.viewerReferenceSpace,offsetRay:t}).space?n._xrSessionManager.session.requestHitTestSource(i).then(function(e){n._xrHitTestSource&&n._xrHitTestSource.cancel(),n._xrHitTestSource=e}):T.b.Warn("waiting for viewer reference space to initialize"))},n.autoCloneTransformation=!1,n.onHitTestResultObservable=new m.c,n.paused=!1,T.b.Warn("Hit test is an experimental and unstable feature. make sure you enable optionalFeatures when creating the XR session"),n}p.b.AddWebXRFeature(z.Name,function(e,t){return function(){return new z(e,t)}},z.Version,!1);var W,H=i(104),X=i(125),Y=i(210),K=i(88),Q=i(8),q=i(36),Z=(W=H.a,Object(f.d)(J,W),J.prototype._getFilenameAndPath=function(){return{filename:"left"
1===this.handedness?J.MODEL_LEFT_FILENAME:J.MODEL_RIGHT_FILENAME,path:J.MODEL_BASE_URL+"default/"}},J.prototype._getModelLoadingConstraints=function(){var e=q.a.IsPluginForExtensionAvailable(".glb");return e||B.a.Warn("glTF / glb loaded was not registered, using generic controller instead"),e},J.prototype._processLoadedModel=function(e){var a=this;this.rootMesh&&(this.getComponentIds().forEach(function(e,t){if(!a.disableAnimation&&e&&a.rootMesh){var i=a._mapping.buttons[e],n=i.rootNodeName;if(!n)return void B.a.Log("Skipping unknown button at index: "+t+" with mapped name: "+e);var r,o=a._getChildByName(a.rootMesh,n);if(!o)return void B.a.Warn("Missing button mesh with name: "+n);i.valueMesh=a._getImmediateChildByName(o,a._mapping.defaultButton.valueNodeName),i.pressedMesh=a._getImmediateChildByName(o,a._mapping.defaultButton.pressedNodeName),i.unpressedMesh=a._getImmediateChildByName(o,a._mapping.defaultButton.unpressedNodeName),i.valueMesh&&i.pressedMesh&&i.unpressedMesh?(r=a.getComponent(e))&&r.onButtonStateChangedObservable.add(function(e){a._lerpTransform(i,e.value)},void 0,!0):B.a.Warn("Missing button submesh under mesh with name: "+n)}}),this.getComponentIds().forEach(function(t,e){var r=a.getComponent(t);r.isAxes()&&["x-axis","y-axis"].forEach(function(i){var n,e;a.rootMesh&&(n=a._mapping.axes[t][i],(e=a._getChildByName(a.rootMesh,n.rootNodeName))?(n.valueMesh=a._getImmediateChildByName(e,a._mapping.defaultAxis.valueNodeName),n.minMesh=a._getImmediateChildByName(e,a._mapping.defaultAxis.minNodeName),n.maxMesh=a._getImmediateChildByName(e,a._mapping.defaultAxis.maxNodeName),n.valueMesh&&n.minMesh&&n.maxMesh?r&&r.onAxisValueChangedObservable.add(function(e){var t="x-axis"===i?e.x:e.y;a._lerpTransform(n,t,!0)},void 0,!0):B.a.Warn("Missing axis submesh under mesh with name: "+n.rootNodeName)):B.a.Warn("Missing axis mesh with name: "+n.rootNodeName))})}))},J.prototype._setRootMesh=function(e){var t;this.rootMesh=new Q.a(this.profileId+" "+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(var i=0;i<e.length;i++){var n=e[i];n.isPickable=!1,n.parent||(t=n)}t&&t.setParent(this.rootMesh),this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=_.b.FromEulerAngles(0,Math.PI,0))},J.prototype._updateModel=function(){},J.MODEL_BASE_URL="https://controllers.babylonjs.com/microsoft/",J.MODEL_LEFT_FILENAME="left.glb",J.MODEL_RIGHT_FILENAME="right.glb",J);function J(e,t,i){var n=W.call(this,e,ee["left-right"],t,i)||this;return n._mapping={defaultButton:{valueNodeName:"VALUE",unpressedNodeName:"UNPRESSED",pressedNodeName:"PRESSED"},defaultAxis:{valueNodeName:"VALUE",minNodeName:"MIN",maxNodeName:"MAX"},buttons:{"xr-standard-trigger":{rootNodeName:"SELECT",componentProperty:"button",states:["default","touched","pressed"]},"xr-standard-squeeze":{rootNodeName:"GRASP",componentProperty:"state",states:["pressed"]},"xr-standard-touchpad":{rootNodeName:"TOUCHPAD_PRESS",labelAnchorNodeName:"squeeze-label",touchPointNodeName:"TOUCH"},"xr-standard-thumbstick":{rootNodeName:"THUMBSTICK_PRESS",componentProperty:"state",states:["pressed"]}},axes:{"xr-standard-touchpad":{"x-axis":{rootNodeName:"TOUCHPAD_TOUCH_X"},"y-axis":{rootNodeName:"TOUCHPAD_TOUCH_Y"}},"xr-standard-thumbstick":{"x-axis":{rootNodeName:"THUMBSTICK_X"},"y-axis":{rootNodeName:"THUMBSTICK_Y"}}}},n.profileId="microsoft-mixed-reality",n}K.a.RegisterController("windows-mixed-reality",function(e,t){return new Z(t,e.gamepad,e.handedness)});var $,ee={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{xr_standard_trigger_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_trigger_pressed_value",minNodeName:"xr_standard_trigger_pressed_min",maxNodeName:"xr_standard_trigger_pressed_max"}}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{xr_standard_squeeze_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_squeeze_pressed_value",minNodeName:"xr_standard_squeeze_pressed_min",maxNodeName:"xr_standard_squeeze_pressed_max"}}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{xr_standard_touchpad_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_pressed_value",minNodeName:"xr_standard_touchpad_pressed_min",maxNodeName:"xr_standard_touchpad_pressed_max"},xr_standard_touchpad_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_pressed_value",minNodeName:"xr_standard_touchpad_xaxis_pressed_min",maxNodeName:"xr_standard_touchpad_xaxis_pressed_max"},xr_standard_touchpad_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_pressed_value",minNodeName:"xr_standard_touchpad_yaxis_pressed_min",maxNodeName:"xr_standard_touchpad_yaxis_pressed_max"},xr_standard_touchpad_xaxis_touched:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_touched_value",minNodeName:"xr_standard_touchpad_xaxis_touched_min",maxNodeName:"xr_standard_touchpad_xaxis_touched_max"},xr_standard_touchpad_yaxis_touched:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_touched_value",minNodeName:"xr_standard_touchpad_yaxis_touched_min",maxNodeName:"xr_standard_touchpad_yaxis_touched_max"},xr_standard_touchpad_axes_touched:{componentProperty:"state",states:["touched","pressed"],valueNodeProperty:"visibility",valueNodeName:"xr_standard_touchpad_axes_touched_value"}},touchPointNodeName:"xr_standard_touchpad_axes_touched_value"},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{xr_standard_thumbstick_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_pressed_value",minNodeName:"xr_standard_thumbstick_pressed_min",maxNodeName:"xr_standard_thumbstick_pressed_max"},xr_standard_thumbstick_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_xaxis_pressed_value",minNodeName:"xr_standard_thumbstick_xaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_xaxis_pressed_max"},xr_standard_thumbstick_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_yaxis_pressed_value",minNodeName:"xr_standard_thumbstick_yaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_yaxis_pressed_max"}}}},gamepadMapping:"xr-standard",rootNodeName:"microsoft-mixed-reality-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{xr_standard_trigger_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_trigger_pressed_value",minNodeName:"xr_standard_trigger_pressed_min",maxNodeName:"xr_standard_trigger_pressed_max"}}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{xr_standard_squeeze_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_squeeze_pressed_value",minNodeName:"xr_standard_squeeze_pressed_min",maxNodeName:"xr_standard_squeeze_pressed_max"}}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{xr_standard_touchpad_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_pressed_value",minNodeName:"xr_standard_touchpad_pressed_min",maxNodeName:"xr_standard_touchpad_pressed_max"},xr_standard_touchpad_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_pressed_value",minNodeName:"xr_standard_touchpad_xaxis_pressed_min",maxNodeName:"xr_standard_touchpad_xaxis_pressed_max"},xr_standard_touchpad_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_pressed_value",minNodeName:"xr_standard_touchpad_yaxis_pressed_min",maxNodeName:"xr_standard_touchpad_yaxis_pressed_max"},xr_standard_touchpad_xaxis_touched:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_touched_value",minNodeName:"xr_standard_touchpad_xaxis_touched_min",maxNodeName:"xr_standard_touchpad_xaxis_touched_max"},xr_standard_touchpad_yaxis_touched:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_touched_value",minNodeName:"xr_standard_touchpad_yaxis_touched_min",maxNodeName:"xr_standard_touchpad_yaxis_touched_max"},xr_standard_touchpad_axes_touched:{componentProperty:"state",states:["touched","pressed"],valueNodeProperty:"visibility",valueNodeName:"xr_standard_touchpad_axes_touched_value"}},touchPointNodeName:"xr_standard_touchpad_axes_touched_value"},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{xr_standard_thumbstick_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_pressed_value",minNodeName:"xr_standard_thumbstick_pressed_min",maxNodeName:"xr_standard_thumbstick_pressed_max"},xr_standard_thumbstick_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_xaxis_pressed_value",minNodeName:"xr_standard_thumbstick_xaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_xaxis_pressed_max"},xr_standard_thumbstick_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_yaxis_pressed_value",minNodeName:"xr_standard_thumbstick_yaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_yaxis_pressed_max"}}}},gamepadMapping:"xr-standard",rootNodeName:"microsoft-mixed-reality-right",assetPath:"right.glb"}},te=($=H.a,Object(f.d)(ie,$),ie.prototype._getFilenameAndPath=function(){return{filename:"left"
1===this.handedness?ie.MODEL_LEFT_FILENAME:ie.MODEL_RIGHT_FILENAME,path:this._isQuest()?ie.QUEST_MODEL_BASE_URL:ie.MODEL_BASE_URL}},ie.prototype._getModelLoadingConstraints=function(){return!0},ie.prototype._processLoadedModel=function(e){var i=this,n=this._isQuest(),r="right"===this.handedness?-1:1;this.getComponentIds().forEach(function(t){var e=t&&i.getComponent(t);e&&e.onButtonStateChangedObservable.add(function(e){if(i.rootMesh&&!i.disableAnimation)switch(t){case"xr-standard-trigger":return void(n||(i._modelRootNode.getChildren()[3].rotation.x=.2*-e.value,i._modelRootNode.getChildren()[3].position.y=.005*-e.value,i._modelRootNode.getChildren()[3].position.z=.005*-e.value));case"xr-standard-squeeze":return void(n||(i._modelRootNode.getChildren()[4].position.x=r*e.value*.0035));case"xr-standard-thumbstick":return;case"a-button":case"x-button":return void(n||(e.pressed?i._modelRootNode.getChildren()[1].position.y=-.001:i._modelRootNode.getChildren()[1].position.y=0));case"b-button":case"y-button":return void(n||(e.pressed?i._modelRootNode.getChildren()[2].position.y=-.001:i._modelRootNode.getChildren()[2].position.y=0))}},void 0,!0)})},ie.prototype._setRootMesh=function(e){this.rootMesh=new Q.a(this.profileId+" "+this.handedness,this.scene),this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=_.b.FromEulerAngles(0,Math.PI,0)),e.forEach(function(e){e.isPickable=!1}),this._isQuest()?this._modelRootNode=e[0]:(this._modelRootNode=e[1],this.rootMesh.position.y=.034,this.rootMesh.position.z=.052),this._modelRootNode.parent=this.rootMesh},ie.prototype._updateModel=function(){},ie.prototype._isQuest=function(){return!!navigator.userAgent.match(/Quest/gi)&&!this._forceLegacyControllers},ie.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",ie.MODEL_LEFT_FILENAME="left.babylon",ie.MODEL_RIGHT_FILENAME="right.babylon",ie.QUEST_MODEL_BASE_URL="https://controllers.babylonjs.com/oculusQuest/",ie);function ie(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var o=$.call(this,e,re[i],t,i)||this;return o._forceLegacyControllers=r,o.profileId="oculus-touch",o}K.a.RegisterController("oculus-touch",function(e,t){return new te(t,e.gamepad,e.handedness)}),K.a.RegisterController("oculus-touch-legacy",function(e,t){return new te(t,e.gamepad,e.handedness,!0)});var ne,re={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{}},"x-button":{type:"button",gamepadIndices:{button:4},rootNodeName:"x_button",visualResponses:{}},"y-button":{type:"button",gamepadIndices:{button:5},rootNodeName:"y_button",visualResponses:{}},thumbrest:{type:"button",gamepadIndices:{button:6},rootNodeName:"thumbrest",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"oculus-touch-v2-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{}},"a-button":{type:"button",gamepadIndices:{button:4},rootNodeName:"a_button",visualResponses:{}},"b-button":{type:"button",gamepadIndices:{button:5},rootNodeName:"b_button",visualResponses:{}},thumbrest:{type:"button",gamepadIndices:{button:6},rootNodeName:"thumbrest",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"oculus-touch-v2-right",assetPath:"right.glb"}},oe=(ne=H.a,Object(f.d)(ae,ne),ae.prototype._getFilenameAndPath=function(){return{filename:ae.MODEL_FILENAME,path:ae.MODEL_BASE_URL}},ae.prototype._getModelLoadingConstraints=function(){return!0},ae.prototype._processLoadedModel=function(e){var i=this;
1this.getComponentIds().forEach(function(t){var e=t&&i.getComponent(t);e&&e.onButtonStateChangedObservable.add(function(e){if(i.rootMesh&&!i.disableAnimation)switch(t){case"xr-standard-trigger":return void(i._modelRootNode.getChildren()[6].rotation.x=.15*-e.value);case"xr-standard-touchpad":case"xr-standard-squeeze":return}},void 0,!0)})},ae.prototype._setRootMesh=function(e){this.rootMesh=new Q.a(this.profileId+" "+this.handedness,this.scene),e.forEach(function(e){e.isPickable=!1}),this._modelRootNode=e[1],this._modelRootNode.parent=this.rootMesh,this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=_.b.FromEulerAngles(0,Math.PI,0))},ae.prototype._updateModel=function(){},ae.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",ae.MODEL_FILENAME="wand.babylon",ae);function ae(e,t,i){var n=ne.call(this,e,se[i],t,i)||this;return n.profileId="htc-vive",n}K.a.RegisterController("htc-vive",function(e,t){return new oe(t,e.gamepad,e.handedness)});var se={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc_vive_none",assetPath:"none.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc_vive_none",assetPath:"none.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc-vive-none",assetPath:"none.glb"}},ce=i(276)},function(e,t,i){"use strict";i.d(t,"a",function(){return s.a}),i.d(t,"b",function(){return u}),i.d(t,"c",function(){return E}),i.d(t,"d",function(){return l.a}),i.d(t,"e",function(){return G}),i.d(t,"h",function(){return L}),i.d(t,"i",function(){return U}),i.d(t,"j",function(){return N}),i.d(t,"k",function(){return k}),i.d(t,"f",function(){return X}),i.d(t,"g",function(){return B});var n,r,o,h,a,d,f,p,s=i(100),c=i(1),C=i(6),P=i(0),x=i(28),m=i(91),_=i(79),R=i(35),O=i(81),l=i(76),M=i(47),I=i(10),u=(p=l.a,Object(c.d)(te,p),te.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(te.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedMesh=this._parent.attachedMesh,this.attachedNode=this._parent.attachedNode):(this.attachedMesh=null,this.attachedNode=null)},enumerable:!1,configurable:!0}),te.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._arrow&&this._arrow.dispose(),[this._coloredMaterial,this._hoverMaterial].forEach(function(e){e&&e.dispose()}),p.prototype.dispose.call(this)},te.prototype.setCustomMesh=function(e,t){var i=this;void 0===t&&(t=!1),p.prototype.setCustomMesh.call(this,e),t&&(this._rootMesh.getChildMeshes().forEac
1h(function(e){e.material=i._coloredMaterial,e.color&&(e.color=i._coloredMaterial.diffuseColor)}),this._customMeshSet=!1)},te),g=i(7),D=i(8),v=i(60),b=i(58),y=i(75),T=i(32),E=(f=l.a,Object(c.d)(ee,f),ee.prototype.setColor=function(t){this.coloredMaterial.emissiveColor=t,this.hoverColoredMaterial.emissiveColor=t.clone().add(new I.a(.3,.3,.3)),this._lineBoundingBox.getChildren().forEach(function(e){e.color&&(e.color=t)})},ee.prototype._attachedNodeChanged=function(e){var t,i=this;e&&(y.a._RemoveAndStorePivotPoint(e),t=e.parent,this._anchorMesh.addChild(e),this._anchorMesh.removeChild(e),e.setParent(t),y.a._RestorePivotPoint(e),this.updateBoundingBox(),e.getChildMeshes(!1).forEach(function(e){e.markAsDirty("scaling")}),this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function(){i._updateDummy()}))},ee.prototype._selectNode=function(t){this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach(function(e){e.isVisible=!t||e==t})},ee.prototype.updateBoundingBox=function(){var e,t,i;this.attachedMesh&&(y.a._RemoveAndStorePivotPoint(this.attachedMesh),e=this.attachedMesh.parent,this.attachedMesh.setParent(null),t=null,this.attachedMesh.skeleton&&(t=this.attachedMesh.skeleton.overrideMesh,this.attachedMesh.skeleton.overrideMesh=null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=P.b.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=P.b.RotationYawPitchRoll(this._anchorMesh.rotation.y,this._anchorMesh.rotation.x,this._anchorMesh.rotation.z)),this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0),(i=this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren,this.includeChildPredicate)).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),y.a._RestorePivotPoint(this.attachedMesh))},ee.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,o=4*t+2*i+n;0==t&&(e[o].position.set(this._boundingDimensions.x/2,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[o].position.addInPlace(new P.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[o].lookAt(P.e.Cross(e[o].position.normalizeToNew(),P.e.Right()).normalizeToNew().add(e[o].position))),1==t&&(e[o].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y/2,this._boundingDimensions.z*n),e[o].position.addInPlace(new P.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[o].lookAt(P.e.Cross(e[o].position.normalizeToNew(),P.e.Up()).normalizeToNew().add(e[o].position))),2==t&&(e[o].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y*n,this._boundingDimensions.z/2),e[o].position.addInPlace(new P.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[o].lookAt(P.e.Cross(e[o].position.normalizeToNew(),P.e.Forward()).normalizeToNew().add(e[o].position))),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera?(e[o].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector),r=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor,e[o].scaling.set(r,r,r)):e[o].scaling.set(this.rotationSphereSize,this.rotationSphereSize,this.rotationSphereSize)}},ee.prototype._updateScaleBoxes=function(){for(var e=this._scaleBoxesParent.getChildMeshes(),t=0,i=0;i<3;i++)for(var n=0;n<3;n++)for(var r=0;r<3;r++){var o,a=(1===i?1:0)+(1===n?1:0)+(1===r?1:0);1!=a&&3!=a&&(e[t]&&(e[t].position.set(this._boundingDimensions.x*(i/2),this._boundingDimensions.y*(n/2),this._boundingDimensions.z*(r/2)),e[t].position.addInPlace(new P.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera?(e[t].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector),o=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor,e[t].scaling.set(o,o,o)):e[t].scaling.set(this.scaleBoxSize,this.scaleBoxSize,this.scaleBoxSize)),t++)}},ee.prototype.setEnabledRotationAxis=function(i){this._rotateSpheresParent.getChildMeshes().forEac
1h(function(e,t){t<4?e.setEnabled(-1!=i.indexOf("x")):t<8?e.setEnabled(-1!=i.indexOf("y")):e.setEnabled(-1!=i.indexOf("z"))})},ee.prototype.setEnabledScaling=function(n,r){void 0===r&&(r=!1),this._scaleBoxesParent.getChildMeshes().forEach(function(e,t){var i=n;r&&!0===e.metadata&&(i=!1),e.setEnabled(i)})},ee.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))},ee.prototype.enableDragBehavior=function(){this._dragMesh=D.a.CreateBox("dummy",1,this.gizmoLayer.utilityLayerScene),this._dragMesh.visibility=0,this._dragMesh.rotationQuaternion=new P.b,this.pointerDragBehavior.useObjectOrientationForDragging=!1,this._dragMesh.addBehavior(this.pointerDragBehavior)},ee.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(),f.prototype.dispose.call(this)},ee.MakeNotPickableAndWrapInBoundingBox=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach(function(e){t(e)})};t(e),e.rotationQuaternion||(e.rotationQuaternion=P.b.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z));var i=e.position.clone(),n=e.rotationQuaternion.clone();e.rotationQuaternion.set(0,0,0,1),e.position.set(0,0,0);var r=m.a.CreateBox("box",{size:1},e.getScene()),o=e.getHierarchyBoundingVectors();return o.max.subtractToRef(o.min,r.scaling),0===r.scaling.y&&(r.scaling.y=T.a),0===r.scaling.x&&(r.scaling.x=T.a),0===r.scaling.z&&(r.scaling.z=T.a),r.position.set((o.max.x+o.min.x)/2,(o.max.y+o.min.y)/2,(o.max.z+o.min.z)/2),e.addChild(r),e.rotationQuaternion.copyFrom(n),e.position.copyFrom(i),e.removeChild(r),r.addChild(e),r.visibility=0,r},ee.prototype.setCustomMesh=function(e){g.a.Error("Custom meshes are not supported on this gizmo")},ee),S=i(20),A=i(250),L=(d=l.a,Object(c.d)($,d),$.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty($.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!1,configurable:!0}),$.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),d.prototype.dispose.call(this)},$),N=(a=l.a,Object(c.d)(J,a),Object.defineProperty(J.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(t){this._meshAttached=t,this._nodeAttached=t,[this.xGizmo,this.yGizmo,this.zGizmo].forEach(function(e){e.isEnabled?e.attachedMesh=t:e.attachedMesh=null})},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"attachedNode",{get:function(){return this._nodeAttached},set:function(t){this._meshAttached=null,this._nodeAttached=t,[this.xGizmo,this.yGizmo,this.zGizmo].forEach(function(e){e.isEnabled?e.attachedNode=t:e.attachedNode=null})},enumerable:!1,configurable:!0}),Object.defineProperty(J.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:!1,configurable:!0}),Object.defineProperty(J.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:!1,configurable:!0}),Object.defineProperty(J.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)}
1,enumerable:!1,configurable:!0}),J.prototype.dispose=function(){this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},J.prototype.setCustomMesh=function(e){g.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)")},J),F=i(51),w=i(115),B=(h=l.a,Object(c.d)(Z,h),Z._CreatePlane=function(e,t){var i=new F.a("plane",e),n=w.a.CreatePlane("dragPlane",{width:.1375,height:.1375,sideOrientation:2},e);return n.material=t,n.parent=i,n.material=t,i},Z._CreateArrowInstance=function(e,t){for(var i=new F.a("arrow",e),n=0,r=t.getChildMeshes();n<r.length;n++){var o=r[n];o.createInstance(o.name).parent=i}return i},Z.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(Z.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedNode=this._parent.attachedNode):this.attachedNode=null},enumerable:!1,configurable:!0}),Z.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),h.prototype.dispose.call(this),this._plane&&this._plane.dispose(),[this._coloredMaterial,this._hoverMaterial].forEach(function(e){e&&e.dispose()})},Z),U=(o=l.a,Object(c.d)(q,o),Object.defineProperty(q.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(t){this._meshAttached=t,this._nodeAttached=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e.isEnabled?e.attachedMesh=t:e.attachedMesh=null})},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"attachedNode",{get:function(){return this._nodeAttached},set:function(t){this._meshAttached=null,this._nodeAttached=null,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e.isEnabled?e.attachedNode=t:e.attachedNode=null})},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"planarGizmoEnabled",{get:function(){return this._planarGizmoEnabled},set:function(t){var i=this;this._planarGizmoEnabled=t,[this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e&&(e.isEnabled=t)&&(e.attachedMesh?e.attachedMesh=i.attachedMesh:e.attachedNode=i.attachedNode)},this)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(t){this._updateGizmoRotationToMatchAttachedMesh=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e&&(e.updateGizmoRotationToMatchAttachedMesh=t)})},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"snapDistance",{get:function(){return this._snapDistance},set:function(t){this._snapDistance=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e&&(e.snapDistance=t)})},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(t){this._scaleRatio=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e&&(e.scaleRatio=t)})},enumerable:!1,configurable:!0}),q.prototype.dispose=function(){[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach(function(e){e&&e.dispose()}),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},q.prototype.setCustomMesh=function(e){g.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,gizmo.xPlaneGizmo, gizmo.yPlaneGizmo, gizmo.zPlaneGizmo)")},q),V=i(168),k=(r=l.a,Object(c.d)(Q,r),Object.defineProperty(Q.prototype,"attachedMesh",{get:function(){return this._meshAttached}
1,set:function(t){this._meshAttached=t,this._nodeAttached=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e.isEnabled?e.attachedMesh=t:e.attachedMesh=null})},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"attachedNode",{get:function(){return this._nodeAttached},set:function(t){this._meshAttached=null,this._nodeAttached=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e.isEnabled?e.attachedNode=t:e.attachedNode=null})},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(t){t?(this._updateGizmoRotationToMatchAttachedMesh=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e&&(e.updateGizmoRotationToMatchAttachedMesh=t)})):g.a.Warn("Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported.")},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"snapDistance",{get:function(){return this._snapDistance},set:function(t){this._snapDistance=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e&&(e.snapDistance=t)})},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(t){this._scaleRatio=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e&&(e.scaleRatio=t)})},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"sensitivity",{get:function(){return this._sensitivity},set:function(t){this._sensitivity=t,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e&&(e.sensitivity=t)})},enumerable:!1,configurable:!0}),Q.prototype.dispose=function(){[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach(function(e){e&&e.dispose()}),this.onDragStartObservable.clear(),this.onDragEndObservable.clear(),[this._uniformScalingMesh,this._octahedron].forEach(function(e){e&&e.dispose()})},Q),G=(Object.defineProperty(K.prototype,"keepDepthUtilityLayer",{get:function(){return this._defaultKeepDepthUtilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"utilityLayer",{get:function(){return this._defaultUtilityLayer},enumerable:!1,configurable:!0}),K.prototype.attachToMesh=function(e){for(var t in this._attachedMesh&&this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh=e,this.gizmos){var i=this.gizmos[t];i&&this._gizmosEnabled[t]&&(i.attachedMesh=e)}this.boundingBoxGizmoEnabled&&this._attachedMesh&&this._attachedMesh.addBehavior(this.boundingBoxDragBehavior),this.onAttachedToMeshObservable.notifyObservers(e)},Object.defineProperty(K.prototype,"positionGizmoEnabled",{get:function(){return this._gizmosEnabled.positionGizmo},set:function(e){e?(this.gizmos.positionGizmo||(this.gizmos.positionGizmo=new U(this._defaultUtilityLayer,this._thickness)),this.gizmos.positionGizmo.attachedMesh=this._attachedMesh):this.gizmos.positionGizmo&&(this.gizmos.positionGizmo.attachedMesh=null),this._gizmosEnabled.positionGizmo=e},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationGizmoEnabled",{get:function(){return this._gizmosEnabled.rotationGizmo},set:function(e){e?(this.gizmos.rotationGizmo||(this.gizmos.rotationGizmo=new N(this._defaultUtilityLayer,32,!1,this._thickness)),this.gizmos.rotationGizmo.attachedMesh=this._attachedMesh):this.gizmos.rotationGizmo&&(this.gizmos.rotationGizmo.attachedMesh=null),this._gizmosEnabled.rotationGizmo=e},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"scaleGizmoEnabled",{get:function(){return this._gizmosEnabled.scaleGizmo},set:function(e){e?(this.gizmos.scaleGizmo=this.gizmos.scaleGizmo||new k(this._defaultUtilityLayer,this._thickness),this.gizmos.scaleGizmo.attachedMesh=this._attachedMesh):this.gizmos.scaleGizmo&&(this.gizmos.scaleGizmo.attachedMesh=null),this._gizmosEnabled.scaleGizmo=e},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"boundingBoxGizmoEnabled",{get:function(){return this._gizmosEnabled.boundingBoxGizmo},set:function(e){e?(this.gizmos.boundingBoxGizmo=this.gizmos.boundingBoxGizmo||new E(this._boundingBoxColor,this._defaultKeepDepthUtilityLayer),this.gizmos.boundingBoxGizmo.attachedMesh=this._attachedMesh,this._attachedMesh&&(this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh.addBehavior(this.boundingBoxDragBehavior))):this.gizmos.boundingBoxGizmo&&(this._attachedMesh&&this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this.gizmos.boundingBoxGizmo.attachedMesh=null),this._gizmosEnabled.boundingBoxGizmo=e}
1,enumerable:!1,configurable:!0}),K.prototype.dispose=function(){for(var e in this.scene.onPointerObservable.remove(this._pointerObserver),this.gizmos){var t=this.gizmos[e];t&&t.dispose()}this._defaultKeepDepthUtilityLayer.dispose(),this._defaultUtilityLayer.dispose(),this.boundingBoxDragBehavior.detach(),this.onAttachedToMeshObservable.clear()},K),z=i(118),j=i(267),W=i(209),H=i(268),X=(n=l.a,Object(c.d)(Y,n),Object.defineProperty(Y.prototype,"light",{get:function(){return this._light},set:function(e){var t,i=this;(this._light=e)&&(this._lightMesh&&this._lightMesh.dispose(),e instanceof z.a?this._lightMesh=Y._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof j.a?this._lightMesh=Y._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof H.a?this._lightMesh=Y._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene):this._lightMesh=Y._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene),this._lightMesh.getChildMeshes(!1).forEach(function(e){e.material=i._material}),this._lightMesh.parent=this._rootMesh,(t=this.gizmoLayer._getSharedGizmoLight()).includedOnlyMeshes=t.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(!1)),this._lightMesh.rotationQuaternion=new P.b,this.attachedMesh.reservedDataStore||(this.attachedMesh.reservedDataStore={}),this.attachedMesh.reservedDataStore.lightGizmo=this,e.parent&&this._attachedMeshParent.freezeWorldMatrix(e.parent.getWorldMatrix()),e.position&&(this.attachedMesh.position.copyFrom(e.position),this.attachedMesh.computeWorldMatrix(!0),this._cachedPosition.copyFrom(this.attachedMesh.position)),e.direction&&(this.attachedMesh.setDirection(e.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.forward)),this._update())},enumerable:!1,configurable:!0}),Object.defineProperty(Y.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Y.prototype._update=function(){n.prototype._update.call(this),this._light&&(this._light.parent&&this._attachedMeshParent.freezeWorldMatrix(this._light.parent.getWorldMatrix()),this._light.position&&(this.attachedMesh.position.equals(this._cachedPosition)?(this.attachedMesh.position.copyFrom(this._light.position),this.attachedMesh.computeWorldMatrix(!0)):this._light.position.copyFrom(this.attachedMesh.position),this._cachedPosition.copyFrom(this.attachedMesh.position)),this._light.direction&&(1e-4<P.e.DistanceSquared(this.attachedMesh.forward,this._cachedForward)?(this._light.direction.copyFrom(this.attachedMesh.forward),this._cachedForward.copyFrom(this.attachedMesh.forward)):1e-4<P.e.DistanceSquared(this.attachedMesh.forward,this._light.direction)&&(this.attachedMesh.setDirection(this._light.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.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))},Y.prototype.dispose=function(){this._material.dispose(),n.prototype.dispose.call(this),this._attachedMeshParent.dispose()},Y._CreateHemisphericLightMesh=function(e){var t=new D.a("hemisphereLight",e),i=W.a.CreateHemisphere(t.name,{segments:10,diameter:1},e);i.position.z=-.15,i.rotation.x=Math.PI/2,i.parent=t;var n=this._CreateLightLines(3,e);return n.parent=t,n.position.z,t.scaling.scaleInPlace(Y._Scale),t.rotation.x=Math.PI/2,t},Y._CreatePointLightMesh=function(e){var t=new D.a("pointLight",e),i=v.a.CreateSphere(t.name,{segments:10,diameter:1},e);return i.rotation.x=Math.PI/2,i.parent=t,(this._CreateLightLines(5,e).parent=t).scaling.scaleInPlace(Y._Scale),t.rotation.x=Math.PI/2,t},Y._CreateSpotLightMesh=function(e){var t=new D.a("spotLight",e);v.a.CreateSphere(t.name,{segments:10,diameter:1},e).parent=t;var i=W.a.CreateHemisphere(t.name,{segments:10,diameter:2},e);return i.parent=t,i.rotation.x=-Math.PI/2,(this._CreateLightLines(2,e).parent=t).scaling.scaleInPlace(Y._Scale),t.rotation.x=Math.PI/2,t},Y._CreateDirectionalLightMesh=function(e){var t=new D.a("directionalLight",e),i=new D.a(t.name,e);i.parent=t,v.a.CreateSphere(t.name,{diameter:1.2,segments:10},e).parent=i;var n=D.a.CreateCylinder(t.name,6,.3,.3,6,1,e);n.parent=i,(r=n.clone(t.name)).scaling.y=.5,r.position.x+=1.25,(o=n.
1clone(t.name)).scaling.y=.5,o.position.x+=-1.25;var r,o,a=D.a.CreateCylinder(t.name,1,0,.6,6,1,e);return a.position.y+=3,a.parent=i,(r=a.clone(t.name)).position.y=1.5,r.position.x+=1.25,(o=a.clone(t.name)).position.y=1.5,o.position.x+=-1.25,i.scaling.scaleInPlace(Y._Scale),i.rotation.z=Math.PI/2,i.rotation.y=Math.PI/2,t},Y._Scale=.007,Y._CreateLightLines=function(e,t){var i=new D.a("root",t);i.rotation.x=Math.PI/2;var n=new D.a("linePivot",t);n.parent=i;var r=D.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,a=0;a<4;a++)(o=n.clone("lineParentClone")).rotation.z=Math.PI/4,o.rotation.y=Math.PI/2+Math.PI/2*a,o.getChildMeshes()[0].scaling.y=.5,o.getChildMeshes()[0].scaling.x=o.getChildMeshes()[0].scaling.z=.8,o.getChildMeshes()[0].position.y=o.getChildMeshes()[0].scaling.y/2+1.2;if(e<3)return i;for(a=0;a<4;a++)(o=n.clone("linePivotClone")).rotation.z=Math.PI/2,o.rotation.y=Math.PI/2*a;if(e<4)return i;for(a=0;a<4;a++)(o=n.clone("linePivotClone")).rotation.z=Math.PI+Math.PI/4,o.rotation.y=Math.PI/2+Math.PI/2*a,o.getChildMeshes()[0].scaling.y=.5,o.getChildMeshes()[0].scaling.x=o.getChildMeshes()[0].scaling.z=.8,o.getChildMeshes()[0].position.y=o.getChildMeshes()[0].scaling.y/2+1.2;return e<5||((o=n.clone("linePivotClone")).rotation.z=Math.PI),i},Y);function Y(e){var t=n.call(this,e)||this;return t._cachedPosition=new P.e,t._cachedForward=new P.e(0,0,1),t._light=null,t.attachedMesh=new x.a("",t.gizmoLayer.utilityLayerScene),t._attachedMeshParent=new F.a("parent",t.gizmoLayer.utilityLayerScene),t.attachedMesh.parent=t._attachedMeshParent,t._material=new R.a("light",t.gizmoLayer.utilityLayerScene),t._material.diffuseColor=new I.a(.5,.5,.5),t._material.specularColor=new I.a(.1,.1,.1),t}function K(e,t){var n=this;void 0===t&&(t=1),this.scene=e,this.clearGizmoOnEmptyPointerEvent=!1,this.onAttachedToMeshObservable=new C.c,this._gizmosEnabled={positionGizmo:!1,rotationGizmo:!1,scaleGizmo:!1,boundingBoxGizmo:!1},this._pointerObserver=null,this._attachedMesh=null,this._boundingBoxColor=I.a.FromHexString("#0984e3"),this._thickness=1,this.boundingBoxDragBehavior=new A.a,this.attachableMeshes=null,this.usePointerToAttachGizmos=!0,this._defaultKeepDepthUtilityLayer=new M.a(e),this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,this._defaultUtilityLayer=new M.a(e),this._thickness=t,this.gizmos={positionGizmo:null,rotationGizmo:null,scaleGizmo:null,boundingBoxGizmo:null},this._pointerObserver=e.onPointerObservable.add(function(e){if(n.usePointerToAttachGizmos&&e.type==S.a.POINTERDOWN)if(e.pickInfo&&e.pickInfo.pickedMesh){var t=e.pickInfo.pickedMesh;if(null==n.attachableMeshes)for(;t&&null!=t.parent;)t=t.parent;else{var i=!1;n.attachableMeshes.forEach(function(e){t&&(t==e||t.isDescendantOf(e))&&(t=e,i=!0)}),i||(t=null)}t instanceof x.a?n._attachedMesh!=t&&n.attachToMesh(t):n.clearGizmoOnEmptyPointerEvent&&n.attachToMesh(null)}else n.clearGizmoOnEmptyPointerEvent&&n.attachToMesh(null)})}function Q(e,t){void 0===e&&(e=M.a.DefaultUtilityLayer),void 0===t&&(t=1);var i=r.call(this,e)||this;i._meshAttached=null,i._nodeAttached=null,i._sensitivity=1,i.onDragStartObservable=new C.c,i.onDragEndObservable=new C.c,i.xGizmo=new u(new P.e(1,0,0),I.a.Red().scale(.5),e,i,t),i.yGizmo=new u(new P.e(0,1,0),I.a.Green().scale(.5),e,i,t),i.zGizmo=new u(new P.e(0,0,1),I.a.Blue().scale(.5),e,i,t),i.uniformScaleGizmo=new u(new P.e(0,1,0),I.a.Yellow().scale(.5),e,i),i.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh=!1,i.uniformScaleGizmo.uniformScaling=!0,i._uniformScalingMesh=V.a.CreatePolyhedron("",{type:1},i.uniformScaleGizmo.gizmoLayer.utilityLayerScene),i._uniformScalingMesh.scaling.scaleInPlace(.02),i._uniformScalingMesh.visibility=0,i._octahedron=V.a.CreatePolyhedron("",{type:1},i.uniformScaleGizmo.gizmoLayer.utilityLayerScene),i._octahedron.scaling.scaleInPlace(.007),i._uniformScalingMesh.addChild(i._octahedron),i.uniformScaleGizmo.setCustomMesh(i._uniformScalingMesh,!0);var n=e._getSharedGizmoLight();return n.includedOnlyMeshes=n.includedOnlyMeshes.concat(i._octahedron),[i.xGizmo,i.yGizmo,i.zGizmo,i.uniformScaleGizmo].forEac
1h(function(e){e.dragBehavior.onDragStartObservable.add(function(){i.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){i.onDragEndObservable.notifyObservers({})})}),i.attachedMesh=null,i.attachedNode=null,i}function q(e,t){void 0===e&&(e=M.a.DefaultUtilityLayer),void 0===t&&(t=1);var i=o.call(this,e)||this;return i._meshAttached=null,i._nodeAttached=null,i.onDragStartObservable=new C.c,i.onDragEndObservable=new C.c,i._planarGizmoEnabled=!1,i.xGizmo=new s.a(new P.e(1,0,0),I.a.Red().scale(.5),e,i,t),i.yGizmo=new s.a(new P.e(0,1,0),I.a.Green().scale(.5),e,i,t),i.zGizmo=new s.a(new P.e(0,0,1),I.a.Blue().scale(.5),e,i,t),i.xPlaneGizmo=new B(new P.e(1,0,0),I.a.Red().scale(.5),i.gizmoLayer,i),i.yPlaneGizmo=new B(new P.e(0,1,0),I.a.Green().scale(.5),i.gizmoLayer,i),i.zPlaneGizmo=new B(new P.e(0,0,1),I.a.Blue().scale(.5),i.gizmoLayer,i),[i.xGizmo,i.yGizmo,i.zGizmo,i.xPlaneGizmo,i.yPlaneGizmo,i.zPlaneGizmo].forEach(function(e){e.dragBehavior.onDragStartObservable.add(function(){i.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){i.onDragEndObservable.notifyObservers({})})}),i.attachedMesh=null,i}function Z(e,t,i,n){void 0===t&&(t=I.a.Gray()),void 0===i&&(i=M.a.DefaultUtilityLayer),void 0===n&&(n=null);var r=h.call(this,i)||this;r._pointerObserver=null,r.snapDistance=0,r.onSnapObservable=new C.c,r._isEnabled=!1,r._parent=null,r._parent=n,r._coloredMaterial=new R.a("",i.utilityLayerScene),r._coloredMaterial.diffuseColor=t,r._coloredMaterial.specularColor=t.subtract(new I.a(.1,.1,.1)),r._hoverMaterial=new R.a("",i.utilityLayerScene),r._hoverMaterial.diffuseColor=t.add(new I.a(.3,.3,.3)),r._plane=Z._CreatePlane(i.utilityLayerScene,r._coloredMaterial),r._plane.lookAt(r._rootMesh.position.add(e)),r._plane.scaling.scaleInPlace(1/3),r._plane.parent=r._rootMesh;var o=0,a=new P.e,s={snapDistance:0};r.dragBehavior=new O.a({dragPlaneNormal:e}),r.dragBehavior.moveAttached=!1,r._rootMesh.addBehavior(r.dragBehavior);var c=new P.e,l=new P.a;r.dragBehavior.onDragObservable.add(function(e){var t;r.attachedNode&&(r.attachedNode.parent?(r.attachedNode.parent.computeWorldMatrix().invertToRef(l),l.setTranslationFromFloats(0,0,0),P.e.TransformCoordinatesToRef(e.delta,l,c)):c.copyFrom(e.delta),0==r.snapDistance?r.attachedNode.getWorldMatrix().addTranslationFromFloats(c.x,c.y,c.z):(o+=e.dragDistance,Math.abs(o)>r.snapDistance&&(t=Math.floor(Math.abs(o)/r.snapDistance),o%=r.snapDistance,c.normalizeToRef(a),a.scaleInPlace(r.snapDistance*t),r.attachedNode.getWorldMatrix().addTranslationFromFloats(a.x,a.y,a.z),s.snapDistance=r.snapDistance*t,r.onSnapObservable.notifyObservers(s))),r._matrixChanged())}),r._pointerObserver=i.utilityLayerScene.onPointerObservable.add(function(e){var t;r._customMeshSet||(t=e.pickInfo&&-1!=r._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?r._hoverMaterial:r._coloredMaterial,r._rootMesh.getChildMeshes().forEach(function(e){e.material=t}))});var u=i._getSharedGizmoLight();return u.includedOnlyMeshes=u.includedOnlyMeshes.concat(r._rootMesh.getChildMeshes(!1)),r}function J(e,t,i,n){void 0===e&&(e=M.a.DefaultUtilityLayer),void 0===t&&(t=32),void 0===i&&(i=!1),void 0===n&&(n=1);var r=a.call(this,e)||this;return r.onDragStartObservable=new C.c,r.onDragEndObservable=new C.c,r.xGizmo=new L(new P.e(1,0,0),I.a.Red().scale(.5),e,t,r,i,n),r.yGizmo=new L(new P.e(0,1,0),I.a.Green().scale(.5),e,t,r,i,n),r.zGizmo=new L(new P.e(0,0,1),I.a.Blue().scale(.5),e,t,r,i,n),[r.xGizmo,r.yGizmo,r.zGizmo].forEach(function(e){e.dragBehavior.onDragStartObservable.add(function(){r.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){r.onDragEndObservable.notifyObservers({})})}),r.attachedMesh=null,r.attachedNode=null,r}function $(f,e,m,t,i,n,r){void 0===e&&(e=I.a.Gray()),void 0===m&&(m=M.a.DefaultUtilityLayer),void 0===t&&(t=32),void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=1);var _=d.call(this,m)||this;_._pointerObserver=null,_.snapDistance=0,_.onSnapObservable=new C.c,_._isEnabled=!0,_._parent=null,_._parent=i;var o=new R.a("",m.utilityLayerScene);
1o.diffuseColor=e,o.specularColor=e.subtract(new I.a(.1,.1,.1));var a=new R.a("",m.utilityLayerScene);a.diffuseColor=e.add(new I.a(.3,.3,.3));var s=new x.a("",m.utilityLayerScene),c=D.a.CreateTorus("",.6,.03*r,t,m.utilityLayerScene);c.visibility=0;var l=D.a.CreateTorus("",.6,.005*r,t,m.utilityLayerScene);l.material=o,l.rotation.x=Math.PI/2,c.rotation.x=Math.PI/2,s.addChild(l),s.addChild(c),s.lookAt(_._rootMesh.position.add(f)),_._rootMesh.addChild(s),s.scaling.scaleInPlace(1/3),_.dragBehavior=new O.a({dragPlaneNormal:f}),_.dragBehavior.moveAttached=!1,_.dragBehavior.maxDragAngle=9*Math.PI/20,_.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,_._rootMesh.addBehavior(_.dragBehavior);var g=new P.e;_.dragBehavior.onDragStartObservable.add(function(e){_.attachedNode&&g.copyFrom(e.dragPlanePoint)});var v=new P.a,b=new P.e,y=new P.e,T={snapDistance:0},E=0,S=new P.a,A=new P.b;_.dragBehavior.onDragObservable.add(function(e){var t,i,n,r,o,a,s,c,l,u,h,d,p;_.attachedNode&&(t=new P.e(1,1,1),i=new P.b(0,0,0,1),n=new P.e(0,0,0),_.attachedNode.getWorldMatrix().decompose(t,i,n),r=e.dragPlanePoint.subtract(n).normalize(),o=g.subtract(n).normalize(),a=P.e.Cross(r,o),s=P.e.Dot(r,o),c=Math.atan2(a.length(),s),b.copyFrom(f),y.copyFrom(f),_.updateGizmoRotationToMatchAttachedMesh&&(i.toRotationMatrix(v),y=P.e.TransformCoordinates(b,v)),m.utilityLayerScene.activeCamera&&(l=m.utilityLayerScene.activeCamera.position.subtract(n),0<P.e.Dot(l,y)&&(b.scaleInPlace(-1),y.scaleInPlace(-1))),0<P.e.Dot(y,a)&&(c=-c),u=!1,0!=_.snapDistance&&(E+=c,Math.abs(E)>_.snapDistance?(h=Math.floor(Math.abs(E)/_.snapDistance),E<0&&(h*=-1),E%=_.snapDistance,c=_.snapDistance*h,u=!0):c=0),d=Math.sin(c/2),A.set(b.x*d,b.y*d,b.z*d,Math.cos(c/2)),0<S.determinant()&&(p=new P.e,A.toEulerAnglesToRef(p),P.b.RotationYawPitchRollToRef(p.y,-p.x,-p.z,A)),_.updateGizmoRotationToMatchAttachedMesh?i.multiplyToRef(A,i):A.multiplyToRef(i,i),_.attachedNode.getWorldMatrix().copyFrom(P.a.Compose(t,i,n)),g.copyFrom(e.dragPlanePoint),u&&(T.snapDistance=c,_.onSnapObservable.notifyObservers(T)),_._matrixChanged())}),_._pointerObserver=m.utilityLayerScene.onPointerObservable.add(function(e){var t;_._customMeshSet||(t=e.pickInfo&&-1!=_._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?a:o,_._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)}))});var u=m._getSharedGizmoLight();return u.includedOnlyMeshes=u.includedOnlyMeshes.concat(_._rootMesh.getChildMeshes(!1)),_}function ee(t,i){void 0===t&&(t=I.a.Gray()),void 0===i&&(i=M.a.DefaultKeepDepthUtilityLayer);var l=f.call(this,i)||this;l._boundingDimensions=new P.e(1,1,1),l._renderObserver=null,l._pointerObserver=null,l._scaleDragSpeed=.2,l._tmpQuaternion=new P.b,l._tmpVector=new P.e(0,0,0),l._tmpRotationMatrix=new P.a,l.ignoreChildren=!1,l.includeChildPredicate=null,l.rotationSphereSize=.1,l.scaleBoxSize=.1,l.fixedDragMeshScreenSize=!1,l.fixedDragMeshScreenSizeDistanceFactor=10,l.onDragStartObservable=new C.c,l.onScaleBoxDragObservable=new C.c,l.onScaleBoxDragEndObservable=new C.c,l.onRotationSphereDragObservable=new C.c,l.onRotationSphereDragEndObservable=new C.c,l.scalePivot=null,l._existingMeshScale=new P.e,l._dragMesh=null,l.pointerDragBehavior=new O.a,l.updateScale=!1,l._anchorMesh=new x.a("anchor",i.utilityLayerScene),l.coloredMaterial=new R.a("",i.utilityLayerScene),l.coloredMaterial.disableLighting=!0,l.hoverColoredMaterial=new R.a("",i.utilityLayerScene),l.hoverColoredMaterial.disableLighting=!0,l._lineBoundingBox=new x.a("",i.utilityLayerScene),l._lineBoundingBox.rotationQuaternion=new P.b;var e=[];e.push(b.a.CreateLines("lines",{points:[new P.e(0,0,0),new P.e(l._boundingDimensions.x,0,0)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(0,0,0),new P.e(0,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(0,0,0),new P.e(0,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(l._boundingDimensions.x,0,0),new P.e(l._boundingDimensions.x,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(l._boundingDimensions.x,0,0),new P.e(l._boundingDimensions.x,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(0,l._boundingDimensions.y,0),new P.e(l._boundingDimensions.x,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(0,l._boundingDimensions.y,0),new P.e(0,l._boundingDimensions.y,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(0,0,l._boundingDimensions.z),new P.e(l._boundingDimensions.x,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(0,0,l._boundingDimensions.z),new P.e(0,l._boundingDimensions.y,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(l._boundingDimensions.x,l._boundingDimensions.y,l._boundingDimensions.z),new P.e(0,l._boundingDimensions.y,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(l._boundingDimensions.x,l._boundingDimensions.y,l._boundingDimensions.z),new P.e(l._boundingDimensions.x,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(b.a.CreateLines("lines",{points:[new P.e(l._boundingDimensions.x,l._boundingDimensions.y,l._boundingDimensions.z),new P.e(l._boundingDimensions.x,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.forEach(function(e){e.color=t,e.position.addInPlace(new P.e(-l._boundingDimensions.x/2,-l._boundingDimensions.y/2,-l._boundingDimensions.z/2)),e.isPickable=!1,l._lineBoundingBox.addChild(e)}),l._rootMesh.addChild(l._lineBoundingBox),l.setColor(t),l._rotateSpheresParent=new x.a("",i.utilityLayerScene),l._rotateSpheresParent.rotationQuaternion=new P.b;for(var n=function(a){var e=v.a.CreateSphere("",{diameter:1},i.utilityLayerScene);e.rotationQuaternion=new P.b,e.material=r.coloredMaterial,(u=new O.a({})).moveAttached=!1,u.updateDragPlane=!1,e.addBehavior(u);var s=new P.e(1,0,0),c=0;u.onDragStartObservable.add(function(){s.copyFrom(e.forward),c=0}
1),u.onDragObservable.add(function(e){if(l.onRotationSphereDragObservable.notifyObservers({}),l.attachedMesh){var t=l.attachedMesh.parent;if(t&&t.scaling&&t.scaling.isNonUniformWithinEpsilon(.001))return void g.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");y.a._RemoveAndStorePivotPoint(l.attachedMesh);var i=s,n=e.dragPlaneNormal.scale(P.e.Dot(e.dragPlaneNormal,i)),r=i.subtract(n).normalizeToNew(),o=(o=P.e.Dot(r,e.delta)<0?Math.abs(e.delta.length()):-Math.abs(e.delta.length()))/l._boundingDimensions.length()*l._anchorMesh.scaling.length();l.attachedMesh.rotationQuaternion||(l.attachedMesh.rotationQuaternion=P.b.RotationYawPitchRoll(l.attachedMesh.rotation.y,l.attachedMesh.rotation.x,l.attachedMesh.rotation.z)),l._anchorMesh.rotationQuaternion||(l._anchorMesh.rotationQuaternion=P.b.RotationYawPitchRoll(l._anchorMesh.rotation.y,l._anchorMesh.rotation.x,l._anchorMesh.rotation.z)),c+=o,Math.abs(c)<=2*Math.PI&&(8<=a?P.b.RotationYawPitchRollToRef(0,0,o,l._tmpQuaternion):4<=a?P.b.RotationYawPitchRollToRef(o,0,0,l._tmpQuaternion):P.b.RotationYawPitchRollToRef(0,o,0,l._tmpQuaternion),l._anchorMesh.addChild(l.attachedMesh),l._anchorMesh.rotationQuaternion.multiplyToRef(l._tmpQuaternion,l._anchorMesh.rotationQuaternion),l._anchorMesh.removeChild(l.attachedMesh),l.attachedMesh.setParent(t)),l.updateBoundingBox(),y.a._RestorePivotPoint(l.attachedMesh)}l._updateDummy()}),u.onDragStartObservable.add(function(){l.onDragStartObservable.notifyObservers({}),l._selectNode(e)}),u.onDragEndObservable.add(function(){l.onRotationSphereDragEndObservable.notifyObservers({}),l._selectNode(null),l._updateDummy()}),r._rotateSpheresParent.addChild(e)},r=this,o=0;o<12;o++)n(o);l._rootMesh.addChild(l._rotateSpheresParent),l._scaleBoxesParent=new x.a("",i.utilityLayerScene),l._scaleBoxesParent.rotationQuaternion=new P.b;for(var s=0;s<3;s++)for(var c=0;c<3;c++)for(var u,a=function(){var r=(1===s?1:0)+(1===c?1:0)+(1===d?1:0);if(1==r||3==r)return"continue";var o=m.a.CreateBox("",{size:1},i.utilityLayerScene);o.material=h.coloredMaterial,o.metadata=2==r;var a=new P.e(s-1,c-1,d-1);(u=new O.a({dragAxis:a})).moveAttached=!1,o.addBehavior(u),u.onDragObservable.add(function(e){if(l.onScaleBoxDragObservable.notifyObservers({}),l.attachedMesh){var t=l.attachedMesh.parent;if(t&&t.scaling&&t.scaling.isNonUniformWithinEpsilon(.001))return void g.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");y.a._RemoveAndStorePivotPoint(l.attachedMesh);var i=e.dragDistance/l._boundingDimensions.length()*l._anchorMesh.scaling.length(),n=new P.e(i,i,i);2==r&&(n.x*=Math.abs(a.x),n.y*=Math.abs(a.y),n.z*=Math.abs(a.z)),n.scaleInPlace(l._scaleDragSpeed),l.updateBoundingBox(),l.scalePivot?(l.attachedMesh.getWorldMatrix().getRotationMatrixToRef(l._tmpRotationMatrix),l._boundingDimensions.scaleToRef(.5,l._tmpVector),P.e.TransformCoordinatesToRef(l._tmpVector,l._tmpRotationMatrix,l._tmpVector),l._anchorMesh.position.subtractInPlace(l._tmpVector),l._boundingDimensions.multiplyToRef(l.scalePivot,l._tmpVector),P.e.TransformCoordinatesToRef(l._tmpVector,l._tmpRotationMatrix,l._tmpVector),l._anchorMesh.position.addInPlace(l._tmpVector)):(o.absolutePosition.subtractToRef(l._anchorMesh.position,l._tmpVector),l._anchorMesh.position.subtractInPlace(l._tmpVector)),l._anchorMesh.addChild(l.attachedMesh),l._anchorMesh.scaling.addInPlace(n),(l._anchorMesh.scaling.x<0||l._anchorMesh.scaling.y<0||l._anchorMesh.scaling.z<0)&&l._anchorMesh.scaling.subtractInPlace(n),l._anchorMesh.removeChild(l.attachedMesh),l.attachedMesh.setParent(t),y.a._RestorePivotPoint(l.attachedMesh)}l._updateDummy()}),u.onDragStartObservable.add(function(){l.onDragStartObservable.notifyObservers({}),l._selectNode(o)}),u.onDragEndObservable.add(function(){l.onScaleBoxDragEndObservable.notifyObservers({}),l._selectNode(null),l._updateDummy()}),h._scaleBoxesParent.addChild(o)},h=this,d=0;d<3;d++)a();l._rootMesh.addChild(l._scaleBoxesParent);var p=new Array;return l._pointerObserver=i.utilityLayerScene.onPointerObservable.add(function(t){p[t.event.pointerId]?t.pickInfo&&t.pickInfo.pickedMesh!=p[t.event.pointerId]&&(p[t.event.pointerId].material=l.coloredMaterial,delete p[t.event.pointerId]):l._rotateSpheresParent.getChildMeshes().concat(l._scaleBoxesParent.getChildMeshes()).forEac
1h(function(e){t.pickInfo&&t.pickInfo.pickedMesh==e&&((p[t.event.pointerId]=e).material=l.hoverColoredMaterial)})}),l._renderObserver=l.gizmoLayer.originalScene.onBeforeRenderObservable.add(function(){l.attachedMesh&&!l._existingMeshScale.equals(l.attachedMesh.scaling)?l.updateBoundingBox():l.fixedDragMeshScreenSize&&(l._updateRotationSpheres(),l._updateScaleBoxes()),l._dragMesh&&l.attachedMesh&&l.pointerDragBehavior.dragging&&(l._lineBoundingBox.position.rotateByQuaternionToRef(l._rootMesh.rotationQuaternion,l._tmpVector),l.attachedMesh.setAbsolutePosition(l._dragMesh.position.add(l._tmpVector.scale(-1))))}),l.updateBoundingBox(),l}function te(o,e,t,i,n){void 0===e&&(e=I.a.Gray()),void 0===t&&(t=M.a.DefaultUtilityLayer),void 0===i&&(i=null),void 0===n&&(n=1);var a=p.call(this,t)||this;a._pointerObserver=null,a.snapDistance=0,a.onSnapObservable=new C.c,a.uniformScaling=!1,a.sensitivity=1,a._isEnabled=!0,a._parent=null,a._parent=i,a._coloredMaterial=new R.a("",t.utilityLayerScene),a._coloredMaterial.diffuseColor=e,a._coloredMaterial.specularColor=e.subtract(new I.a(.1,.1,.1)),a._hoverMaterial=new R.a("",t.utilityLayerScene),a._hoverMaterial.diffuseColor=e.add(new I.a(.3,.3,.3)),a._arrow=new x.a("",t.utilityLayerScene);var r=m.a.CreateBox("yPosMesh",{size:.4*(1+(n-1)/4)},t.utilityLayerScene),s=_.a.CreateCylinder("cylinder",{diameterTop:.005*n,height:.275,diameterBottom:.005*n,tessellation:96},t.utilityLayerScene);s.material=a._coloredMaterial,a._arrow.addChild(r),a._arrow.addChild(s),r.scaling.scaleInPlace(.1),r.material=a._coloredMaterial,r.rotation.x=Math.PI/2,r.position.z+=.3,s.position.z+=.1375,s.rotation.x=Math.PI/2,a._arrow.lookAt(a._rootMesh.position.add(o)),a._rootMesh.addChild(a._arrow),a._arrow.scaling.scaleInPlace(1/3),a.dragBehavior=new O.a({dragAxis:o}),a.dragBehavior.moveAttached=!1,a._rootMesh.addBehavior(a.dragBehavior);var c=0,l=new P.e,u={snapDistance:0};a.dragBehavior.onDragObservable.add(function(e){var t,i,n,r;a.attachedNode&&(t=a.sensitivity*e.dragDistance*(3*a.scaleRatio/a._rootMesh.scaling.length()),i=!1,n=0,a.uniformScaling?(a.attachedNode.getWorldMatrix().decompose(l),l.normalize(),l.y<0&&l.scaleInPlace(-1)):l.copyFrom(o),0==a.snapDistance?l.scaleToRef(t,l):(c+=t,Math.abs(c)>a.snapDistance?(n=Math.floor(Math.abs(c)/a.snapDistance),c<0&&(n*=-1),c%=a.snapDistance,l.scaleToRef(a.snapDistance*n,l),i=!0):l.scaleInPlace(0)),r=new P.a,P.a.ScalingToRef(1+l.x,1+l.y,1+l.z,r),a.attachedNode.getWorldMatrix().copyFrom(r.multiply(a.attachedNode.getWorldMatrix())),i&&(u.snapDistance=a.snapDistance*n,a.onSnapObservable.notifyObservers(u)),a._matrixChanged())}),a._pointerObserver=t.utilityLayerScene.onPointerObservable.add(function(e){var t;a._customMeshSet||(t=e.pickInfo&&-1!=a._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?a._hoverMaterial:a._coloredMaterial,a._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)}))});var h=t._getSharedGizmoLight();return h.includedOnlyMeshes=h.includedOnlyMeshes.concat(a._rootMesh.getChildMeshes()),a}},function(e,t,i){"use strict";i.d(t,"a",function(){return s}),i.d(t,"h",function(){return f}),i.d(t,"i",function(){return g}),i.d(t,"k",function(){return E}),i.d(t,"n",function(){return a.c}),i.d(t,"m",function(){return a.b}),i.d(t,"l",function(){return a.a}),i.d(t,"p",function(){return C}),i.d(t,"q",function(){return o.a}),i.d(t,"r",function(){return I}),i.d(t,"s",function(){return D}),i.d(t,"o",function(){return F.c}),i.d(t,"e",function(){return F.a}),i.d(t,"j",function(){return F.b}),i.d(t,"f",function(){return w.a}),i.d(t,"g",function(){return B.a}),i.d(t,"t",function(){return U.a}),i.d(t,"u",function(){return U.b}),i.d(t,"v",function(){return U.c}),i.d(t,"b",function(){return V.a}),i.d(t,"c",function(){return V.b}),i.d(t,"d",function(){return V.c});var n,r=i(1),h=i(7),c=i(36),o=i(83),a=i(49),s=(n=o.a,Object(r.d)(l,n),l.prototype.initControllerMesh=function(e,t){var i=this;c.a.ImportMesh("",l.MODEL_BASE_URL,l.MODEL_FILENAME,e,function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)})},l.prototype._handleButtonChange=function(e,t,i){var n;0===e?(n=this.onTriggerStateChangedObservable)&&n.notifyObservers(t):h.a.Warn("Unrecognized Daydream button index: "+e)},l.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",l.MODEL_FILENAME="generic.babylon",l.GAMEPAD_ID_PREFIX="Daydream",l);function l(e){var t=n.call(this,e)||this;return t.controllerType=a.c.DAYDREAM,t}a.b._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(s.GAMEPAD_ID_PREFIX)},create:function(e){return new s(e)}});var u,d=i(0),p=i(8),f=(u=o.a,Object(r.d)(m,u),m.prototype.initControllerMesh=function(i,n){var r=this;c.a.ImportMesh("",m.MODEL_BASE_URL,m.MODEL_FILENAME,i,function(e){var t=new p.a("",i);e[1].parent=t,e[1].position.z=-.15,r._defaultModel=t,r.attachToMesh(r._defaultModel),n&&n(r._defaultModel)})},m.prototype._handleButtonChange=function(e,t,i){var n;e<this._buttonIndexToObservableNameMap.length&&(n=this[this._buttonIndexToObservableNameMap[e]])&&n.notifyObservers(t)},m.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",m.MODEL_FILENAME="generic.babylon",m.GAMEPAD_ID_PREFIX="Gear VR",m);function m(e){var t=u.call(this,e)||this;return t._buttonIndexToObservableNameMap=["onPadStateChangedObservable","onTriggerStateChangedObservable"],t.controllerType=a.c.GEAR_VR,t._calculatedPosition=new d.e("left"==t.hand?-.15:.15,-.5,.25),t._disableTrackPosition(t._calculatedPosition),t}a.b._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(f.GAMEPAD_ID_PREFIX)||-1!==e.id.indexOf("Oculus Go")||-1!==e.id.indexOf("Vive Focus")},create:function(e){return new f(e)}});var _,g=(_=o.a,Object(r.d)(v,_),v.prototype.initControllerMesh=function(e,t){var i=this;c.a.ImportMesh("",v.MODEL_BASE_URL,v.MODEL_FILENAME,e,function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)})},v.prototype._handleButtonChange=function(e,t,i){console.log("Button i
1d: "+e+"state: "),console.dir(t)},v.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",v.MODEL_FILENAME="generic.babylon",v);function v(e){return _.call(this,e)||this}a.b._DefaultControllerFactory=function(e){return new g(e)};var b,y=i(6),T=i(12),E=(b=o.a,Object(r.d)(S,b),S.prototype.initControllerMesh=function(e,t){var i=this,n="left"===this.hand?S.MODEL_LEFT_FILENAME:S.MODEL_RIGHT_FILENAME;c.a.ImportMesh("",S._IsQuest?S.QUEST_MODEL_BASE_URL:S.MODEL_BASE_URL,n,e,function(e){i._defaultModel=S._IsQuest?e[0]:e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)})},Object.defineProperty(S.prototype,"onAButtonStateChangedObservable",{get:function(){if("right"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No A button on left hand")},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onBButtonStateChangedObservable",{get:function(){if("right"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No B button on left hand")},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onXButtonStateChangedObservable",{get:function(){if("left"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No X button on right hand")},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onYButtonStateChangedObservable",{get:function(){if("left"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No Y button on right hand")},enumerable:!1,configurable:!0}),S.prototype._handleButtonChange=function(e,t,i){var n=t,r="right"===this.hand?-1:1;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(n);case 1:return!S._IsQuest&&this._defaultModel&&(this._defaultModel.getChildren()[3].rotation.x=.2*-n.value,this._defaultModel.getChildren()[3].position.y=.005*-n.value,this._defaultModel.getChildren()[3].position.z=.005*-n.value),void this.onTriggerStateChangedObservable.notifyObservers(n);case 2:return!S._IsQuest&&this._defaultModel&&(this._defaultModel.getChildren()[4].position.x=r*n.value*.0035),void this.onSecondaryTriggerStateChangedObservable.notifyObservers(n);case 3:return!S._IsQuest&&this._defaultModel&&(n.pressed?this._defaultModel.getChildren()[1].position.y=-.001:this._defaultModel.getChildren()[1].position.y=0),void this.onMainButtonStateChangedObservable.notifyObservers(n);case 4:return!S._IsQuest&&this._defaultModel&&(n.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(n);case 5:return void this.onThumbRestChangedObservable.notifyObservers(n)}},S.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",S.MODEL_LEFT_FILENAME="left.babylon",S.MODEL_RIGHT_FILENAME="right.babylon",S.QUEST_MODEL_BASE_URL="https://controllers.babylonjs.com/oculusQuest/",S._IsQuest=!1,S);function S(e){var t=b.call(this,e)||this;return t.onSecondaryTriggerStateChangedObservable=new y.c,t.onThumbRestChangedObservable=new y.c,t.controllerType=a.c.OCULUS,t}a.b._ControllerFactories.push({canCreate:function(e){return T.a.LastCreatedEngine&&T.a.LastCreatedEngine._vrDisplay&&"Oculus Quest"===T.a.LastCreatedEngine._vrDisplay.displayName&&(E._IsQuest=!0),-1!==e.id.indexOf("Oculus Touch")},create:function(e){return new E(e)}});var A,C=(A=o.a,Object(r.d)(P,A),P.prototype.initControllerMesh=function(e,t){var i=this;c.a.ImportMesh("",P.MODEL_BASE_URL,P.MODEL_FILENAME,e,function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)})},Object.defineProperty(P.prototype,"onLeftButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onRightButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onMenuButtonStateChangedObservable",{get:function(){return this.onSecondaryButtonStateChangedObservable},enumerable:!1,configurable:!0}),P.prototype._handleButtonChange=function(e,t,i){var n=t;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(n);case 1:return this._defaultModel&&(this._defaultModel.getChildren()[6].rotation.x=.15*-n.value),void this.onTriggerStateChangedObservable.notifyObservers(n);case 2:return void this.onMainButtonStateChangedObservable.notifyObservers(n);case 3:return this._defaultModel&&(n.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(n)}},P.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",P.MODEL_FILENAME="wand.babylon",P);function P(e){var t=A.call(this,e)||this;return t.controllerType=a.c.VIVE,t._invertLeftStickY=!0,t}a.b._ControllerFactories.push({canCreate:function(e){return-1!==e.id.toLowerCase().indexOf("openvr")},create:function(e){return new C(e)}});function x(){this.buttonMeshes={},this.axisMeshes={}}var R,O,M=i(45),I=(O=o.a,Object(r.d)(N,O),Object.defineProperty(N.prototype,"onTriggerButtonStateChangedObservable",{get:function(){return this.onTriggerStateChangedObservable}
1,enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onMenuButtonStateChangedObservable",{get:function(){return this.onSecondaryButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onGripButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onThumbstickButtonStateChangedObservable",{get:function(){return this.onPadStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onTouchpadButtonStateChangedObservable",{get:function(){return this.onTrackpadChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onTouchpadValuesChangedObservable",{get:function(){return this.onTrackpadValuesChangedObservable},enumerable:!1,configurable:!0}),N.prototype._updateTrackpad=function(){!this.browserGamepad.axes||this.browserGamepad.axes[2]==this.trackpad.x&&this.browserGamepad.axes[3]==this.trackpad.y||(this.trackpad.x=this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_X")],this.trackpad.y=this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_Y")],this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad))},N.prototype.update=function(){if(O.prototype.update.call(this),this.browserGamepad.axes&&(this._updateTrackpad(),this._loadedMeshInfo))for(var e=0;e<this._mapping.axisMeshNames.length;e++)this._lerpAxisTransform(e,this.browserGamepad.axes[e])},N.prototype._handleButtonChange=function(e,t,i){var n,r=this._mapping.buttons[e];r&&(this._updateTrackpad(),(n=this[this._mapping.buttonObservableNames[r]])&&n.notifyObservers(t),this._lerpButtonTransform(r,t.value))},N.prototype._lerpButtonTransform=function(e,t){var i;!this._loadedMeshInfo||(i=this._loadedMeshInfo.buttonMeshes[e])&&i.unpressed.rotationQuaternion&&i.pressed.rotationQuaternion&&i.value.rotationQuaternion&&(d.b.SlerpToRef(i.unpressed.rotationQuaternion,i.pressed.rotationQuaternion,t,i.value.rotationQuaternion),d.e.LerpToRef(i.unpressed.position,i.pressed.position,t,i.value.position))},N.prototype._lerpAxisTransform=function(e,t){var i,n;!this._loadedMeshInfo||(i=this._loadedMeshInfo.axisMeshes[e])&&i.min.rotationQuaternion&&i.max.rotationQuaternion&&i.value.rotationQuaternion&&(n=.5*t+.5,d.b.SlerpToRef(i.min.rotationQuaternion,i.max.rotationQuaternion,n,i.value.rotationQuaternion),d.e.LerpToRef(i.min.position,i.max.position,n,i.value.position))},N.prototype.initControllerMesh=function(t,i,n){var r,o,e,a,s=this;void 0===n&&(n=!1),c.a.IsPluginForExtensionAvailable(".glb")?(a="default",this.id&&!n&&(a=(e=this.id.match(N.GAMEPAD_ID_PATTERN))&&e[0]||a),o="left"===this.hand?N.MODEL_LEFT_FILENAME:N.MODEL_RIGHT_FILENAME,r=N.MODEL_BASE_URL+a+"/"):(h.a.Warn("You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models"),r=g.MODEL_BASE_URL,o=g.MODEL_FILENAME),c.a.ImportMesh("",r,o,t,function(e){s._loadedMeshInfo=s.processModel(t,e),s._loadedMeshInfo&&(s._defaultModel=s._loadedMeshInfo.rootNode,s.attachToMesh(s._defaultModel),i&&i(s._defaultModel))},null,function(e,t){h.a.Log(t),h.a.Warn("Failed to retrieve controller model from the remote server: "+r+o),n||s.initControllerMesh(e,i,!0)})},N.prototype.processModel=function(e,t){for(var i=null,n=new p.a(this.id+" "+this.hand,e),r=null,o=0;o<t.length;o++){var a=t[o];if(!a.parent){a.isPickable=!1,r=a;break}}return r?(r.setParent(n),i=this.createMeshInfo(n)):h.a.Warn("Could not find root node in model file."),i},N.prototype.createMeshInfo=function(e){var t,i=new x;for(i.rootNode=e,i.buttonMeshes={},i.axisMeshes={},t=0;t<this._mapping.buttons.length;t++){var n,r,o=this._mapping.buttonMeshNames[this._mapping.buttons[t]];o?(n=l(e,o))?(r={index:t,value:u(n,"VALUE"),pressed:u(n,"PRESSED"),unpressed:u(n,"UNPRESSED")}).value&&r.pressed&&r.unpressed?i.buttonMeshes[this._mapping.buttons[t]]=r:h.a.Warn("Missing button submesh under mesh with name: "+o+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):h.a.Warn("Missing button mesh with name: "+o):h.a.Log("Skipping unknown button at index: "+t+" with mapped name: "+this._mapping.buttons[t])}for(t=0;t<this._mapping.axisMeshNames.length;t++){var a,s,c=this._mapping.axisMeshNames[t];c?(a=l(e,c))?(s={index:t,value:u(a,"VALUE"),min:u(a,"MIN"),max:u(a,"MAX")}
1).value&&s.min&&s.max?i.axisMeshes[t]=s:h.a.Warn("Missing axis submesh under mesh with name: "+c+"(VALUE: "+!!s.value+", MIN: "+!!s.min+", MAX:"+!!s.max+")"):h.a.Warn("Missing axis mesh with name: "+c):h.a.Log("Skipping unknown axis at index: "+t)}return i.pointingPoseNode=l(e,this._mapping.pointingPoseMeshName),i.pointingPoseNode?this._pointingPoseNode=i.pointingPoseNode:h.a.Warn("Missing pointing pose mesh with name: "+this._mapping.pointingPoseMeshName),i;function l(e,t){return e.getChildren(function(e){return e.name===t},!1)[0]}function u(e,t){return e.getChildren(function(e){return e.name==t},!0)[0]}},N.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this._loadedMeshInfo||!this._loadedMeshInfo.pointingPoseNode)return O.prototype.getForwardRay.call(this,e);var t=this._loadedMeshInfo.pointingPoseNode.getWorldMatrix(),i=t.getTranslation(),n=new d.e(0,0,-1),r=d.e.TransformNormal(n,t),o=d.e.Normalize(r);return new M.a(i,o,e)},N.prototype.dispose=function(){O.prototype.dispose.call(this),this.onTrackpadChangedObservable.clear(),this.onTrackpadValuesChangedObservable.clear()},N.MODEL_BASE_URL="https://controllers.babylonjs.com/microsoft/",N.MODEL_LEFT_FILENAME="left.glb",N.MODEL_RIGHT_FILENAME="right.glb",N.GAMEPAD_ID_PREFIX="Spatial Controller (Spatial Interaction Source) ",N.GAMEPAD_ID_PATTERN=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,N),D=(R=I,Object(r.d)(L,R),Object.defineProperty(L.prototype,"onThumbstickButtonStateChangedObservable",{get:function(){return this.onThumbstickStateChangedObservable},enumerable:!1,configurable:!0}),L.prototype._updateTrackpad=function(){!this.browserGamepad.axes||this.browserGamepad.axes[2]==this.thumbstickValues.x&&this.browserGamepad.axes[3]==this.thumbstickValues.y||(this.trackpad.x=this.browserGamepad.axes[2],this.trackpad.y=this.browserGamepad.axes[3],this.onThumbstickValuesChangedObservable.notifyObservers(this.trackpad))},L.prototype.dispose=function(){R.prototype.dispose.call(this),this.onThumbstickStateChangedObservable.clear(),this.onThumbstickValuesChangedObservable.clear()},L);function L(e){var t=R.call(this,e)||this;return t._mapping={buttons:["trigger","grip","trackpad","thumbstick","menu"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},buttonObservableNames:{trigger:"onTriggerStateChangedObservable",menu:"onSecondaryButtonStateChangedObservable",grip:"onMainButtonStateChangedObservable",thumbstick:"onThumbstickStateChangedObservable",trackpad:"onTrackpadChangedObservable"}
1,axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y","THUMBSTICK_X","THUMBSTICK_Y"],pointingPoseMeshName:a.a.POINTING_POSE},t.thumbstickValues={x:0,y:0},t.onThumbstickStateChangedObservable=new y.c,t.onThumbstickValuesChangedObservable=new y.c,t.onTrackpadChangedObservable=t.onPadStateChangedObservable,t.onTrackpadValuesChangedObservable=t.onPadValuesChangedObservable,t}function N(e){var t=O.call(this,e)||this;return t._mapping={buttons:["thumbstick","trigger","grip","menu","trackpad"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},buttonObservableNames:{trigger:"onTriggerStateChangedObservable",menu:"onSecondaryButtonStateChangedObservable",grip:"onMainButtonStateChangedObservable",thumbstick:"onPadStateChangedObservable",trackpad:"onTrackpadChangedObservable"},axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],pointingPoseMeshName:a.a.POINTING_POSE},t.onTrackpadChangedObservable=new y.c,t.onTrackpadValuesChangedObservable=new y.c,t.trackpad={x:0,y:0},t.controllerType=a.c.WINDOWS,t._loadedMeshInfo=null,t}a.b._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(I.GAMEPAD_ID_PREFIX)},create:function(e){return new I(e)}});var F=i(57),w=i(259),B=i(199),U=i(167),V=i(260)},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return o}),i.d(t,"c",function(){return T}),i.d(t,"d",function(){return l}),i.d(t,"e",function(){return s}),i.d(t,"f",function(){return S});var m=i(12),n=(r.prototype.getFrequencyBinCount=function(){return this._audioEngine.canUseWebAudio?this._webAudioAnalyser.frequencyBinCount:0},r.prototype.getByteFrequencyData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs)),this._byteFreqs},r.prototype.getByteTimeDomainData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getByteTimeDomainData(this._byteTime)),this._byteTime},r.prototype.getFloatFrequencyData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs)),this._floatFreqs},r.prototype.drawDebugCanvas=function(){var e=this;if(this._audioEngine.canUseWebAudio&&(this._debugCanvas||(this._debugCanvas=document.createElement("canvas"),this._debugCanvas.width=this.DEBUGCANVASSIZE.width,this._debugCanvas.height=this.DEBUGCANVASSIZE.height,this._debugCanvas.style.position="absolute",this._debugCanvas.style.top=this.DEBUGCANVASPOS.y+"px",this._debugCanvas.style.left=this.DEBUGCANVASPOS.x+"px",this._debugCanvasContext=this._debugCanvas.getContext("2d"),document.body.appendChild(this._debugCanvas),this._registerFunc=function(){e.drawDebugCanvas()},this._scene.registerBeforeRender(this._registerFunc)),this._registerFunc&&this._debugCanvasContext)){var t=this.getByteFrequencyData();this._debugCanvasContext.fillStyle="rgb(0, 0, 0)",this._debugCanvasContext.fillRect(0,0,this.DEBUGCANVASSIZE.width,this.DEBUGCANVASSIZE.height);for(var i=0;i<this.getFrequencyBinCount();i++){var n=t[i]/this.BARGRAPHAMPLITUDE,r=this.DEBUGCANVASSIZE.height*n,o=this.DEBUGCANVASSIZE.height-r-1,a=this.DEBUGCANVASSIZE.width/this.getFrequencyBinCount(),s=i/this.getFrequencyBinCount()*360;this._debugCanvasContext.fillStyle="hsl("+s+", 100%, 50%)",this._debugCanvasContext.fillRect(i*a,o,a,r)}}},r.prototype.stopDebugCanvas=function(){this._debugCanvas&&(this._registerFunc&&(this._scene.unregisterBeforeRender(this._registerFunc),this._registerFunc=null),document.body.removeChild(this._debugCanvas),this._debugCanvas=null,this._debugCanvasContext=null)},r.prototype.connectAudioNodes=function(e,t){this._audioEngine.canUseWebAudio&&(e.connect(this._webAudioAnalyser),this._webAudioAnalyser.connect(t))},r.prototype.dispose=function(){this._audioEngine.canUseWebAudio&&this._webAudioAnalyser.disconnect()},r),_=i(6),g=i(7);function r(e){this.SMOOTHING=.75,this.FFT_SIZE=512,this.BARGRAPHAMPLITUDE=256,this.DEBUGCANVASPOS={x:20,y:20},this.DEBUGCANVASSIZE={width:320,height:200},this._scene=e,this._audioEngine=m.a.audioEngine,this._audioEngine.canUseWebAudio&&this._audioEngine.audioContext&&(this._webAudioAnalyser=this._audioEngine.audioContext.createAnalyser(),this._webAudioAnalyser.minDecibels=-140,this._webAudioAnalyser.maxDecibels=0,this._byteFreqs=new Uint8Array(this._webAudioAnalyser.frequencyBinCount),this._byteTime=new Uint8Array(this._webAudioAnalyser.frequencyBinCount),this._floatFreqs=new Float32Array(this._webAudioAnalyser.frequencyBinCount))}m.a.AudioEngineFactory=function(e){return new o(e)};var o=(Object.defineProperty(f.prototype,"audioContext",{get:function(){return this._audioContextInitialized?this.unlocked||this._muteButton||this._displayMuteButton():this._initializeAudioContext(),this._audioContext}
1,enumerable:!1,configurable:!0}),f.prototype.lock=function(){this._triggerSuspendedState()},f.prototype.unlock=function(){this._triggerRunningState()},f.prototype._resumeAudioContext=function(){var e;return void 0!==this._audioContext.resume&&(e=this._audioContext.resume()),e||Promise.resolve()},f.prototype._initializeAudioContext=function(){try{this.canUseWebAudio&&(this._audioContext=new AudioContext,this.masterGain=this._audioContext.createGain(),this.masterGain.gain.value=1,this.masterGain.connect(this._audioContext.destination),this._audioContextInitialized=!0,"running"===this._audioContext.state&&this._triggerRunningState())}catch(e){this.canUseWebAudio=!1,g.a.Error("Web Audio: "+e.message)}},f.prototype._triggerRunningState=function(){var e=this;this._tryToRun||(this._tryToRun=!0,this._resumeAudioContext().then(function(){e._tryToRun=!1,e._muteButton&&e._hideMuteButton(),e.unlocked=!0,e.onAudioUnlockedObservable.notifyObservers(e)}).catch(function(){e._tryToRun=!1,e.unlocked=!1}))},f.prototype._triggerSuspendedState=function(){this.unlocked=!1,this.onAudioLockedObservable.notifyObservers(this),this._displayMuteButton()},f.prototype._displayMuteButton=function(){var e,t,i=this;this.useCustomUnlockedButton||this._muteButton||(this._muteButton=document.createElement("BUTTON"),this._muteButton.className="babylonUnmuteIcon",this._muteButton.id="babylonUnmuteIconBtn",this._muteButton.title="Unmute",e=".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E":"https://cdn.babylonjs.com/Assets/audio.png")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }",(t=document.createElement("style")).appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(t),document.body.appendChild(this._muteButton),this._moveButtonToTopLeft(),this._muteButton.addEventListener("touchend",function(){i._triggerRunningState()},!0),this._muteButton.addEventListener("click",function(){i._triggerRunningState()},!0),window.addEventListener("resize",this._onResize))},f.prototype._moveButtonToTopLeft=function(){this._hostElement&&this._muteButton&&(this._muteButton.style.top=this._hostElement.offsetTop+20+"px",this._muteButton.style.left=this._hostElement.offsetLeft+20+"px")},f.prototype._hideMuteButton=function(){this._muteButton&&(document.body.removeChild(this._muteButton),this._muteButton=null)},f.prototype.dispose=function(){this.canUseWebAudio&&this._audioContextInitialized&&(this._connectedAnalyser&&this._audioContext&&(this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser.dispose(),this.masterGain.disconnect(),this.masterGain.connect(this._audioContext.destination),this._connectedAnalyser=null),this.masterGain.gain.value=1),this.WarnedWebAudioUnsupported=!1,this._hideMuteButton(),window.removeEventListener("resize",this._onResize),this.onAudioUnlockedObservable.clear(),this.onAudioLockedObservable.clear()},f.prototype.getGlobalVolume=function(){return this.canUseWebAudio&&this._audioContextInitialized?this.masterGain.gain.value:-1},f.prototype.setGlobalVolume=function(e){this.canUseWebAudio&&this._audioContextInitialized&&(this.masterGain.gain.value=e)},f.prototype.connectToAnalyser=function(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this.canUseWebAudio&&this._audioContextInitialized&&this._audioContext&&(this._connectedAnalyser=e,this.masterGain.disconnect(),this._connectedAnalyser.connectAudioNodes(this.masterGain,this._audioContext.destination))},f),v=i(13),b=i(0),a=i(21),l=(y.prototype.dispose=function(){m.a.audioEngine.canUseWebAudio&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.RemoveSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].RemoveSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null))},y.prototype.isReady=function(){return this._isReadyToPlay},y.prototype._soundLoaded=function(e){var t=this;m.a.audioEngine.audioContext&&m.a.audioEngine.audioContext.decodeAudioData(e,function(e){t._audioBuffer=e,t._isReadyToPlay=!0,t.autoplay&&t.play(0,t._offset,t._length),t._readyToPlayCallback&&t._readyToPlayCallback()},function(e){g.a.Error("Error while decoding audio data for: "+t.name+" / Error: "+e)})},y.prototype.setAudioBuffer=function(e){m.a.audioEngine.canUseWebAudio&&(this._audioBuffer=e,this._isReadyToPlay=!0)},y.prototype.updateOptions=function(e){var t,i,n,r,o,a,s,c,l;e&&(this.loop=null!==(t=e.loop)&&void 0!==t?t:this.loop,this.maxDistance=null!==(i=e.maxDistance)&&void 0!==i?i:this.maxDistance,this.useCustomAttenuation=null!==(n=e.useCustomAttenuation)&&void 0!==n?n:this.useCustomAttenuation,this.rolloffFactor=null!==(r=e.rolloffFactor)&&void 0!==r?r:this.rolloffFactor,this.refDistance=null!==(o=e.refDistance)&&void 0!==o?o:this.refDistance,this.distanceModel=null!==(a=e.distanceModel)&&void 0!==a?a:this.distanceModel,this._playbackRate=null!==(s=e.playbackRate)&&void 0!==s?s:this._playbackRate,this._length=null!==(c=e.length)&&void 0!==c?c:void 0,this._offset=null!==(l=e.offset)&&void 0!==l?l:void 0,this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate)))},y.prototype._createSpatialParameters=function(){m.a.audioEngine.canUseWebAudio&&m.a.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=m.a.audioEngine.audioContext.createPanner(),this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner)},y.prototype._updateSpatialParameters=function(){this.spatialSound&&this._soundPanner&&(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor),this._soundPanner.panningModel=this._panningModel)},y.prototype.switchPanningModelToHRTF=function(){this._panningModel="HRTF",this._switchPanningModel()},y.prototype.switchPanningModelToEqualPower=function(){this._panningModel="equalpower",this._switchPanningModel()},y.prototype._switchPanningModel=function(){m.a.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)},y.prototype.connectToSoundTrackAudioNode=function(e){m.a.audioEngine.canUseWebAudio&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)},y.prototype.setDirectionalCone=function(e,t,i){t<e?g.a.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle."):(this._coneInnerAngle=e,this._coneOuterAngle=t,this._coneOuterGain=i,this._isDirectional=!0,this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length)))},Object.defineProperty(y.prototype,"directionalConeInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){if(e!=this._coneInnerAngle){if(this._coneOuterAngle<e)return void g.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneInnerAngle=e,m.a.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.coneInnerAngle=this._coneInnerAngle)}}
1,enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"directionalConeOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){if(e!=this._coneOuterAngle){if(e<this._coneInnerAngle)return void g.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneOuterAngle=e,m.a.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.coneOuterAngle=this._coneOuterAngle)}},enumerable:!1,configurable:!0}),y.prototype.setPosition=function(e){this._position=e,m.a.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&!isNaN(this._position.x)&&!isNaN(this._position.y)&&!isNaN(this._position.z)&&this._soundPanner.setPosition(this._position.x,this._position.y,this._position.z)},y.prototype.setLocalDirectionToMesh=function(e){this._localDirection=e,m.a.audioEngine.canUseWebAudio&&this._connectedTransformNode&&this.isPlaying&&this._updateDirection()},y.prototype._updateDirection=function(){var e,t;this._connectedTransformNode&&this._soundPanner&&(e=this._connectedTransformNode.getWorldMatrix(),(t=b.e.TransformNormal(this._localDirection,e)).normalize(),this._soundPanner.setOrientation(t.x,t.y,t.z))},y.prototype.updateDistanceFromListener=function(){var e;m.a.audioEngine.canUseWebAudio&&this._connectedTransformNode&&this.useCustomAttenuation&&this._soundGain&&this._scene.activeCamera&&(e=this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera),this._soundGain.gain.value=this._customAttenuationFunction(this._volume,e,this.maxDistance,this.refDistance,this.rolloffFactor))},y.prototype.setAttenuationFunction=function(e){this._customAttenuationFunction=e},y.prototype.play=function(i,n,r){var o=this;if(this._isReadyToPlay&&this._scene.audioEnabled&&m.a.audioEngine.audioContext)try{this._startOffset<0&&(i=-this._startOffset,this._startOffset=0);var t,a=i?m.a.audioEngine.audioContext.currentTime+i:m.a.audioEngine.audioContext.currentTime;this._soundSource&&this._streamingSource||this.spatialSound&&this._soundPanner&&(isNaN(this._position.x)||isNaN(this._position.y)||isNaN(this._position.z)||this._soundPanner.setPosition(this._position.x,this._position.y,this._position.z),this._isDirectional&&(this._soundPanner.coneInnerAngle=this._coneInnerAngle,this._soundPanner.coneOuterAngle=this._coneOuterAngle,this._soundPanner.coneOuterGain=this._coneOuterGain,this._connectedTransformNode?this._updateDirection():this._soundPanner.setOrientation(this._localDirection.x,this._localDirection.y,this._localDirection.z))),this._streaming?(this._streamingSource||(this._streamingSource=m.a.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement),this._htmlAudioElement.onended=function(){o._onended()},this._htmlAudioElement.playbackRate=this._playbackRate),this._streamingSource.disconnect(),this._streamingSource.connect(this._inputAudioNode),this._htmlAudioElement&&(t=function(){var e;m.a.audioEngine.unlocked?void 0!==(e=o._htmlAudioElement.play())&&e.catch(function(e){m.a.audioEngine.lock(),(o.loop||o.autoplay)&&m.a.audioEngine.onAudioUnlockedObservable.addOnce(function(){t()})}):(o.loop||o.autoplay)&&m.a.audioEngine.onAudioUnlockedObservable.addOnce(function(){t()})})()):(t=function(){var e,t;m.a.audioEngine.audioContext&&(r=r||o._length,n=n||o._offset,o._soundSource&&((e=o._soundSource).onended=function(){e.disconnect()}),o._soundSource=m.a.audioEngine.audioContext.createBufferSource(),o._soundSource.buffer=o._audioBuffer,o._soundSource.connect(o._inputAudioNode),o._soundSource.loop=o.loop,void 0!==n&&(o._soundSource.loopStart=n),void 0!==r&&(o._soundSource.loopEnd=(0|n)+r),o._soundSource.playbackRate.value=o._playbackRate,o._soundSource.onended=function(){o._onended()},a=i?m.a.audioEngine.audioContext.currentTime+i:m.a.audioEngine.audioContext.currentTime,t=o.isPaused?o._startOffset%o._soundSource.buffer.duration:n||0,o._soundSource.start(a,t,o.loop?void 0:r))},"suspended"===m.a.audioEngine.audioContext.state?setTimeout(function(){"suspended"===m.a.audioEngine.audioContext.state?(m.a.audioEngine.lock(),(o.loop||o.autoplay)&&m.a.audioEngine.onAudioUnlockedObservable.addOnce(function(){t()})):t()},500):t()),this._startTime=a,this.isPlaying=!0,this.isPaused=!1}catch(i){g.a.Error("Error while trying to play audio: "+this.name+", "+i.message)}},y.prototype._onended=function(){this.isPlaying=!1,this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)},y.prototype.stop=function(e){var t,i=this;this.isPlaying&&(this._streaming?(this._htmlAudioElement?(this._htmlAudioElement.pause(),0<this._htmlAudioElement.currentTime&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1):m.a.audioEngine.audioContext&&this._soundSource&&(t=e?m.a.audioEngine.audioContext.currentTime+e:m.a.audioEngine.audioContext.currentTime,this._soundSource.stop(t),this._soundSource.onended=function(){i.isPlaying=!1},this.isPaused||(this._startOffset=0)))},y.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this._streaming?this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect():m.a.audioEngine.audioContext&&(this.stop(0),this._startOffset+=m.a.audioEngine.audioContext.currentTime-this._startTime))},y.prototype.setVolume=function(e,t){m.a.audioEngine.canUseWebAudio&&this._soundGain&&(t&&m.a.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(m.a.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,m.a.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,m.a.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},y.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))},y.prototype.getVolume=function(){return this._volume},y.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this.spatialSound||(this.spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},y.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},y.prototype._onRegisterAfterWorldMatrixUpdate=function(e){var t;this._positionInEmitterSpace?(e.worldMatrixFromCache.invertToRef(b.c.Matrix[0]),this.setPosition(b.c.Matrix[0].getTranslation())):e.getBoundingInfo?(t=e.getBoundingInfo(),this.setPosition(t.boundingSphere.centerWorld)):this.setPosition(e.absolutePosition),m.a.audioEngine.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()},y.prototype.clone=function(){var e=this;if(this._streaming)return null;var t=function(){e._isReadyToPlay?(n._audioBuffer=e.getAudioBuffer(),n._isReadyToPlay=!0,n.autoplay&&n.play(0,e._offset,e._length)):window.setTimeout(t,300)},i={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},n=new y(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,i);return this.useCustomAttenuation&&n.setAttenuationFunction(this._customAttenuationFunction),n.setPosition(this._position),n.setPlaybackRate(this._playbackRate),t(),n},y.prototype.getAudioBuffer=function(){return this._audioBuffer},y.prototype.getSoundSource=function(){return this._soundSource},y.prototype.getSoundGain=function(){return this._soundGain},y.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,metadata:this.metadata};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},y.Parse=function(e,t,i,n){var r,o,a,s,c,l=e.name,u=e.url?i+e.url:i+l,h={autoplay:e.autoplay,loop:e.loop,volume:e.volume,spatialSound:e.spatialSound,maxDistance:e.maxDistance,rolloffFactor:e.rolloffFactor,refDistance:e.refDistance,distanceModel:e.distanceModel,playbackRate:e.playbackRate};return n?(r=function(){n._isReadyToPlay?(o._audioBuffer=n.getAudioBuffer(),o._isReadyToPlay=!0,o.autoplay&&o.play(0,o._offset,o._length)):window.setTimeout(r,300)},o=new y(l,new ArrayBuffer(0),t,null,h),r()):(o=new y(l,u,t,function(){t._removePendingData(o)},h),t._addPendingData(o)),e.position&&(a=b.e.FromArray(e.position),o.setPosition(a)),e.isDirectional&&(o.setDirectionalCone(e.coneInnerAngle||360,e.coneOuterAngle||360,e.coneOuterGain||0),e.localDirectionToMesh)&&(s=b.e.FromArray(e.localDirectionToMesh),o.setLocalDirectionToMesh(s)),!e.connectedMeshId||(c=t.getMe
1shByID(e.connectedMeshId))&&o.attachToMesh(c),e.metadata&&(o.metadata=e.metadata),o},y._SceneComponentInitialization=function(e){throw a.a.WarnImport("AudioSceneComponent")},y),s=(p.prototype._initializeSoundTrackAudioGraph=function(){m.a.audioEngine.canUseWebAudio&&m.a.audioEngine.audioContext&&(this._outputAudioNode=m.a.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(m.a.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)},p.prototype.dispose=function(){if(m.a.audioEngine&&m.a.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},p.prototype.AddSound=function(e){this._isInitialized||this._initializeSoundTrackAudioGraph(),m.a.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},p.prototype.RemoveSound=function(e){var t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)},p.prototype.setVolume=function(e){m.a.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},p.prototype.switchPanningModelToHRTF=function(){if(m.a.audioEngine.canUseWebAudio)for(var e=0;e<this.soundCollection.length;e++)this.soundCollection[e].switchPanningModelToHRTF()},p.prototype.switchPanningModelToEqualPower=function(){if(m.a.audioEngine.canUseWebAudio)for(var e=0;e<this.soundCollection.length;e++)this.soundCollection[e].switchPanningModelToEqualPower()},p.prototype.connectToAnalyser=function(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser=e,m.a.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.disconnect(),this._connectedAnalyser.connectAudioNodes(this._outputAudioNode,m.a.audioEngine.masterGain))},p),c=i(17),u=i(18),h=i(42),d=i(72);function p(e,t){void 0===t&&(t={}),this.id=-1,this._isInitialized=!1,this._scene=e,this.soundCollection=new Array,this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1)}function y(e,t,i,n,r){var o,a,s,c,l=this;if(void 0===n&&(n=null),this.autoplay=!1,this.loop=!1,this.useCustomAttenuation=!1,this.isPlaying=!1,this.isPaused=!1,this.spatialSound=!1,this.refDistance=1,this.rolloffFactor=1,this.maxDistance=100,this.distanceModel="linear",this.metadata=null,this.onEndedObservable=new _.c,this._panningModel="equalpower",this._playbackRate=1,this._streaming=!1,this._startTime=0,this._startOffset=0,this._position=b.e.Zero(),this._positionInEmitterSpace=!1,this._localDirection=new b.e(1,0,0),this._volume=1,this._isReadyToPlay=!1,this._isDirectional=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._coneOuterGain=0,this._isOutputConnected=!1,this._urlType="Unknown",this.name=e,this._scene=i,y._SceneComponentInitialization(i),this._readyToPlayCallback=n,this._customAttenuationFunction=function(e,t,i,n,r){return t<i?e*(1-t/i):0},r&&(this.autoplay=r.autoplay||!1,this.loop=r.loop||!1,void 0!==r.volume&&(this._volume=r.volume),this.spatialSound=null!==(o=r.spatialSound)&&void 0!==o&&o,this.maxDistance=null!==(a=r.maxDistance)&&void 0!==a?a:100,this.useCustomAttenuation=null!==(s=r.useCustomAttenuation)&&void 0!==s&&s,this.rolloffFactor=r.rolloffFactor||1,this.refDistance=r.refDistance||1,this.distanceModel=r.distanceModel||"linear",this._playbackRate=r.playbackRate||1,this._streaming=null!==(c=r.streaming)&&void 0!==c&&c,this._length=r.length,this._offset=r.offset),m.a.audioEngine.canUseWebAudio&&m.a.audioEngine.audioContext){this._soundGain=m.a.audioEngine.audioContext.createGain(),this._soundGain.gain.value=this._volume,this._inputAudioNode=this._soundGain,this._outputAudioNode=this._soundGain,this.spatialSound&&this._createSpatialParameters(),this._scene.mainSoundTrack.AddSound(this);var u=!0;if(t)try{"string"==typeof t?this._urlType="String":t instanceof ArrayBuffer?this._urlType="ArrayBuffer":t instanceof MediaStream?this._urlType="MediaStream":Array.isArray(t)&&(this._urlType="Array");var h=[],d=!1;switch(this._urlType){case"MediaStream":this._streaming=!0,this._isReadyToPlay=!0,this._streamingSource=m.a.audioEngine.audioContext.createMediaStreamSource(t),this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback();break;case"ArrayBuffer":0<t.byteLength&&(d=!0,this._soundLoaded(t));break;case"String":h.push(t);case"Array":0===h.length&&(h=t);for(var p=0;p<h.length;p++){var f=h[p];if(d=r&&r.skipCodecCheck||-1!==f.indexOf(".mp3",f.length-4)&&m.a.audioEngine.isMP3supported||-1!==f.indexOf(".ogg",f.length-4)&&m.a.audioEngine.isOGGsupported||-1!==f.indexOf(".wav",f.length-4)||-1!==f.indexOf("blob:")){this._streaming?(this._htmlAudioElement=new Audio(f),this._htmlAudioElement.controls=!1,this._htmlAudioElement.loop=this.loop,v.b.SetCorsBehavior(f,this._htmlAudioElement),this._htmlAudioElement.preload="auto",this._htmlAudioElement.addEventListener("canplaythrough",function(){l._isReadyToPlay=!0,l.autoplay&&l.play(0,l._offset,l._length),l._readyToPlayCallback&&l._readyToPlayCallback()}),document.body.appendChild(this._htmlAudioElement),this._htmlAudioElement.load()):this._scene._loadFile(f,function(e){l._soundLoaded(e)},void 0,!0,!0,function(e){e&&g.a.Error("XHR "+e.status+" error on: "+f+"."),g.a.Error("Sound creation aborted."),l._scene.mainSoundTrack.RemoveSound(l)});break}}break;default:u=!1}u?d||(this._isReadyToPlay=!0,this._readyToPlayCallback&&window.setTimeout(function(){l._readyToPlayCallback&&l._readyToPlayCallback()},1e3)):g.a.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){g.a.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.RemoveSound(this)}}else this._scene.mainSoundTrack.AddSound(this),m.a.audioEngine.WarnedWebAudioUnsupported||(g.a.Error("Web Audio is not supported by your browser."),m.a.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&window.setTimeout(function(){l._readyToPlayCallback&&l._readyToPlayCallback()},1e3)}function f(e){var t=this;void 0===e&&(e=null),this._audioContext=null,this._audioContextInitialized=!1,this._muteButton=null,this.canUseWebAudio=!1,this.WarnedWebAudioUnsupported=!1,this.isMP3supported=!1,this.isOGGsupported=!1,this.unlocked=!0,this.useCustomUnlockedButton=!1,this.onAudioUnlockedObservable=new _.c,this.onAudioLockedObservable=new _.c,this._tryToRun=!1,this._onResize=function(){t._moveButtonToTopLeft()},void 0===window.AudioContext&&void 0===window.webkitAudioContext||(window.AudioContext=window.AudioContext||window.webkitAudioContext,this.canUseWebAudio=!0);var i=document.createElement("audio");this._hostElement=e;try{i&&i.canPlayType&&i.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,"")&&(this.isMP3supported=!0)}catch(e){}try{i&&i.canPlayType&&i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(this.isOGGsupported=!0)}catch(e){}}h.a.AddParser(c.a.NAME_AUDIO,function(e,t,i,n){var r,o=[];if(i.sounds=i.sounds||[],void 0!==e.sounds&&null!==e.sounds)for(var a=0,s=e.sounds.length;a<s;a++){var c=e.sounds[a];m.a.audioEngine.canUseWebAudio?(c.url||(c.url=c.name),o[c.url]?i.sounds.push(l.Parse(c,t,n,o[c.url])):(r=l.Parse(c,t,n),o[c.url]=r,i.sounds.push(r))):i.sounds.push(new l(c.name,null,t))}o=[]}),Object.defineProperty(u.a.prototype,"mainSoundTrack",{get:function(){var e=this._getComponent(c.a.NAME_AUDIO);return e||(e=new T(this),this._addComponent(e)),this._mainSoundTrack||(this._mainSoundTrack=new s(this,{mainTrack:!0})),this._mainSoundTrack},enumerable:!0,configurable:!0}),u.a.prototype.getSoundByName=function(e){for(var t=0;t<this.mainSoundTrack.soundCollection.length;t++)if(this.mainSoundTrack.soundCollection[t].name===e)return this.mainSoundTrack.soundCollection[t];if(this.soundTracks)for(var i=0;i<this.soundTracks.length;i++)for(t=0;t<this.soundTracks[i].soundCollection.length;t++)if(this.soundTracks[i].soundCollection[t].name===e)return this.soundTracks[i].soundCollection[t];return null},Object.defineProperty(u.a.prototype,"audioEnabled",{get:function(){var e=this._getComponent(c.a.NAME_AUDIO);return e||(e=new T(this),this._addComponent(e)),e.audioEnabled},set:function(e){var t=this._getComponent(c.a.NAME_AUDIO);t||(t=new T(this),this._addComponent(t)),e?t.enableAudio():t.disableAudio()},enumerable:!0,configurable:!0}),Object.defineProperty(u.a.prototype,"headphone",{get:function(){var e=this._getComponent(c.a.NAME_AUDIO);return e||(e=new T(this),this._addComponent(e)),e.headphone},set:function(e){var t=this._getComponent(c.a.NAME_AUDIO);t||(t=new T(this),this._addComponent(t)),e?t.switchAudioModeForHeadphones():t.switchAudioModeForNormalSpeakers()},enumerable:!0,configurable:!0}),Object.defineProperty(u.a.prototype,"audioListenerPositionProvider",{get:function(){var e=this._getComponent(c.a.NAME_AUDIO);return e||(e=new T(this),this._addComponent(e)),e.audioListenerPositionProvider},set:function(e){var t=this._getComponent(c.a.NAME_AUDIO);if(t||(t=new T(this),this._addComponent(t)),"function"!=typeof e)throw new Error("The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3");t.audioListenerPositionProvider=e},enumerable:!0,configurable:!0}),Object.defineProperty(u.a.prototype,"audioPositioningRefreshRate",{get:function(){var e=this._getComponent(c.a.NAME_AUDIO);return e||(e=new T(this),this._addComponent(e)),e.audioPositioningRefreshRate},set:function(e){var t=this._getComponent(c.a.NAME_AUDIO);t||(t=new T(this),this._addComponent(t)),t.audioPositioningRefreshRate=e},enumerable:!0,configurable:!0});var T=(Object.defineProperty(E.prototype,"audioEnabled",{get:function(){return this._audioEnabled}
1,enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"headphone",{get:function(){return this._headphone},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"audioListenerPositionProvider",{get:function(){return this._audioListenerPositionProvider},set:function(e){this._audioListenerPositionProvider=e},enumerable:!1,configurable:!0}),E.prototype.register=function(){this.scene._afterRenderStage.registerStep(c.a.STEP_AFTERRENDER_AUDIO,this,this._afterRender)},E.prototype.rebuild=function(){},E.prototype.serialize=function(e){if(e.sounds=[],this.scene.soundTracks)for(var t=0;t<this.scene.soundTracks.length;t++)for(var i=this.scene.soundTracks[t],n=0;n<i.soundCollection.length;n++)e.sounds.push(i.soundCollection[n].serialize())},E.prototype.addFromContainer=function(e){var t=this;e.sounds&&e.sounds.forEach(function(e){e.play(),e.autoplay=!0,t.scene.mainSoundTrack.AddSound(e)})},E.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.sounds&&e.sounds.forEach(function(e){e.stop(),e.autoplay=!1,i.scene.mainSoundTrack.RemoveSound(e),t&&e.dispose()})},E.prototype.dispose=function(){var e=this.scene;if(e._mainSoundTrack&&e.mainSoundTrack.dispose(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].dispose()},E.prototype.disableAudio=function(){var e,t=this.scene;for(this._audioEnabled=!1,m.a.audioEngine&&m.a.audioEngine.audioContext&&m.a.audioEngine.audioContext.suspend(),e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].pause();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(var i=0;i<t.soundTracks[e].soundCollection.length;i++)t.soundTracks[e].soundCollection[i].pause()},E.prototype.enableAudio=function(){var e,t=this.scene;for(this._audioEnabled=!0,m.a.audioEngine&&m.a.audioEngine.audioContext&&m.a.audioEngine.audioContext.resume(),e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].isPaused&&t.mainSoundTrack.soundCollection[e].play();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(var i=0;i<t.soundTracks[e].soundCollection.length;i++)t.soundTracks[e].soundCollection[i].isPaused&&t.soundTracks[e].soundCollection[i].play()},E.prototype.switchAudioModeForHeadphones=function(){var e=this.scene;if(this._headphone=!0,e.mainSoundTrack.switchPanningModelToHRTF(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToHRTF()},E.prototype.switchAudioModeForNormalSpeakers=function(){var e=this.scene;if(this._headphone=!1,e.mainSoundTrack.switchPanningModelToEqualPower(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToEqualPower()},E.prototype._afterRender=function(){var e=d.a.Now;if(!(this._lastCheck&&e-this._lastCheck<this.audioPositioningRefreshRate)){this._lastCheck=e;var t=this.scene;if(this._audioEnabled&&t._mainSoundTrack&&t.soundTracks&&(0!==t._mainSoundTrack.soundCollection.length||1!==t.soundTracks.length)){var i,n,r,o,a,s=m.a.audioEngine;if(s.audioContext){for(this._audioListenerPositionProvider?((i=this._audioListenerPositionProvider()).x=i.x||0,i.y=i.y||0,i.z=i.z||0,s.audioContext.listener.setPosition(i.x,i.y,i.z)):(n=0<t.activeCameras.length?t.activeCameras[0]:t.activeCamera)?(this._cachedCameraPosition.equals(n.globalPosition)||(this._cachedCameraPosition.copyFrom(n.globalPosition),s.audioContext.listener.setPosition(n.globalPosition.x,n.globalPosition.y,n.globalPosition.z)),n.rigCameras&&0<n.rigCameras.length&&(n=n.rigCameras[0]),r=b.a.Invert(n.getViewMatrix()),(o=b.e.TransformNormal(new b.e(0,0,-1),r)).normalize(),isNaN(o.x)||isNaN(o.y)||isNaN(o.z)||this._cachedCameraDirection.equals(o)||(this._cachedCameraDirection.copyFrom(o),s.audioContext.listener.setOrientation(o.x,o.y,o.z,0,1,0))):s.audioContext.listener.setPosition(0,0,0),a=0;a<t.mainSoundTrack.soundCollection.length;a++){var c=t.mainSoundTrack.soundCollection[a];c.useCustomAttenuation&&c.updateDistanceFromListener()}if(t.soundTracks)for(a=0;a<t.soundTracks.length;a++)for(var l=0;l<t.soundTracks[a].soundCollection.length;l++)(c=t.soundTracks[a].soundCollection[l]).useCustomAttenuation&&c.updateDistanceFromListener()}}}},E);function E(e){this.name=c.a.NAME_AUDIO,this._audioEnabled=!0,this._headphone=!1,this.audioPositioningRefreshRate=500,this._audioListenerPositionProvider=null,this._cachedCameraDirection=new b.e,this._cachedCameraPosition=new b.e,this._lastCheck=0,(this.scene=e).soundTracks=new Array,e.sounds=new Array}l._SceneComponentInitialization=function(e){var t=e._getComponent(c.a.NAME_AUDIO);t||(t=new T(e),e._addComponent(t))};var S=(Object.defineProperty(A.prototype,"directionalConeInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){if(e!==this._coneInnerAngle){if(this._coneOuterAngle<e)return void g.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneInnerAngle=e;for(var t=0,i=this._sounds;t<i.length;t++)i[t].directionalConeInnerAngle=e}}
1,enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"directionalConeOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){if(e!==this._coneOuterAngle){if(e<this._coneInnerAngle)return void g.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneOuterAngle=e;for(var t=0,i=this._sounds;t<i.length;t++)i[t].directionalConeOuterAngle=e}},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"volume",{get:function(){return this._volume},set:function(e){if(e!==this._volume)for(var t=0,i=this._sounds;t<i.length;t++)i[t].setVolume(e)},enumerable:!1,configurable:!0}),A.prototype._onended=function(){void 0!==this._currentIndex&&(this._sounds[this._currentIndex].autoplay=!1),this.loop&&this.isPlaying?this.play():this.isPlaying=!1},A.prototype.pause=function(){this.isPaused=!0,void 0!==this._currentIndex&&this._sounds[this._currentIndex].pause()},A.prototype.stop=function(){this.isPlaying=!1,void 0!==this._currentIndex&&this._sounds[this._currentIndex].stop()},A.prototype.play=function(e){if(!this.isPaused){this.stop();for(var t=Math.random(),i=0,n=0;n<this._weights.length;n++)if(t<=(i+=this._weights[n])){this._currentIndex=n;break}}var r=this._sounds[this._currentIndex];r.isReady()?r.play(0,this.isPaused?void 0:e):r.autoplay=!0,this.isPlaying=!0,this.isPaused=!1},A);function A(e,t,i){var n=this;if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=e;for(var r=0,o=0,a=this._weights=i;o<a.length;o++)r+=a[o];for(var s=0<r?1/r:0,c=0;c<this._weights.length;c++)this._weights[c]*=s;this._sounds=t;for(var l=0,u=this._sounds;l<u.length;l++)u[l].onEndedObservable.add(function(){n._onended()})}},function(e,t,i){"use strict";i.d(t,"a",function(){return n.a}),i.d(t,"b",function(){return r.a}),i.d(t,"c",function(){return o.a}),i.d(t,"d",function(){return x}),i.d(t,"e",function(){return F}),i.d(t,"f",function(){return D});var n=i(138),r=i(317),o=i(280),a=i(1),s=i(3),l=i(6),u=i(0),c=i(12),h=i(4),d=i(29),p=i(9),f=i(39),m=i(23),_=i(105),g=i(61),v=i(42),b=i(2),y=i(7),T=i(11),E=i(10),S=(i(349),i(350),i(5));S.a.ShadersStore.glowBlurPostProcessPixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\n\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\n\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\n\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}",v.a.prototype.getHighlightLayerByName=function(e){for(var t=0;t<this.effectLayers.length;t++)if(this.effectLayers[t].name===e&&this.effectLayers[t].getEffectName()===x.EffectName)return this.effectLayers[t];return null};var A,C,P=(C=m.a,Object(a.d)(O,C),O),x=(A=n.a,Object(a.d)(R,A),Object.defineProperty(R.prototype,"blurHorizontalSize",{get:function(){return this._horizontalBlurPostprocess.kernel},set:function(e){this._horizontalBlurPostprocess.kernel=e},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"blurVerticalSize",{get:function(){return this._verticalBlurPostprocess.kernel},set:function(e){this._verticalBlurPostprocess.kernel=e},enumerable:!1,configurable:!0}),R.prototype.getEffectName=function(){return R.EffectName},R.prototype._createMergeEffect=function(){return this._engine.createEffe
1ct("glowMapMerge",[h.b.PositionKind],["offset"],["textureSampler"],this._options.isStroke?"#define STROKE \n":void 0)},R.prototype._createTextureAndPostProcesses=function(){var t=this,i=this._mainTextureDesiredSize.width*this._options.blurTextureSizeRatio,n=this._mainTextureDesiredSize.height*this._options.blurTextureSizeRatio,i=this._engine.needPOTTextures?c.a.GetExponentOfTwo(i,this._maxSize):i,n=this._engine.needPOTTextures?c.a.GetExponentOfTwo(n,this._maxSize):n,e=this._engine.getCaps().textureHalfFloatRender?b.a.TEXTURETYPE_HALF_FLOAT:b.a.TEXTURETYPE_UNSIGNED_INT;this._blurTexture=new f.a("HighlightLayerBlurRTT",{width:i,height:n},this._scene,!1,!0,e),this._blurTexture.wrapU=p.a.CLAMP_ADDRESSMODE,this._blurTexture.wrapV=p.a.CLAMP_ADDRESSMODE,this._blurTexture.anisotropicFilteringLevel=16,this._blurTexture.updateSamplingMode(p.a.TRILINEAR_SAMPLINGMODE),this._blurTexture.renderParticles=!1,this._blurTexture.ignoreCameraViewport=!0,this._textures=[this._blurTexture],this._options.alphaBlendingMode===b.a.ALPHA_COMBINE?(this._downSamplePostprocess=new _.b("HighlightLayerPPP",this._options.blurTextureSizeRatio,null,p.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._downSamplePostprocess.onApplyObservable.add(function(e){e.setTexture("textureSampler",t._mainTexture)}),this._horizontalBlurPostprocess=new P("HighlightLayerHBP",new u.d(1,0),this._options.blurHorizontalSize,1,null,p.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._horizontalBlurPostprocess.onApplyObservable.add(function(e){e.setFloat2("screenSize",i,n)}),this._verticalBlurPostprocess=new P("HighlightLayerVBP",new u.d(0,1),this._options.blurVerticalSize,1,null,p.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._verticalBlurPostprocess.onApplyObservable.add(function(e){e.setFloat2("screenSize",i,n)}),this._postProcesses=[this._downSamplePostprocess,this._horizontalBlurPostprocess,this._verticalBlurPostprocess]):(this._horizontalBlurPostprocess=new g.a("HighlightLayerHBP",new u.d(1,0),this._options.blurHorizontalSize/2,{width:i,height:n},null,p.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,e),this._horizontalBlurPostprocess.width=i,this._horizontalBlurPostprocess.height=n,this._horizontalBlurPostprocess.onApplyObservable.add(function(e){e.setTexture("textureSampler",t._mainTexture)}),this._verticalBlurPostprocess=new g.a("HighlightLayerVBP",new u.d(0,1),this._options.blurVerticalSize/2,{width:i,height:n},null,p.a.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,e),this._postProcesses=[this._horizontalBlurPostprocess,this._verticalBlurPostprocess]),this._mainTexture.onAfterUnbindObservable.add(function(){t.onBeforeBlurObservable.notifyObservers(t);var e=t._blurTexture.getInternalTexture();e&&(t._scene.postProcessManager.directRender(t._postProcesses,e,!0),t._engine.unBindFramebuffer(e,!0)),t.onAfterBlurObservable.notifyObservers(t)}),this._postProcesses.map(function(e){e.autoClear=!1})},R.prototype.needStencil=function(){return!0},R.prototype.isReady=function(e,t){var i=e.getMaterial(),n=e.getRenderingMesh();if(!i||!n||!this._meshes)return!1;var r=null,o=this._meshes[n.uniqueId];return o&&o.glowEmissiveOnly&&i&&(r=i.emissiveTexture),A.prototype._isReady.call(this,e,t,r)},R.prototype._internalRender=function(e){e.setTexture("textureSampler",this._blurTexture);var t=this._engine;t.cacheStencilState(),t.setStencilOperationPass(b.a.REPLACE),t.setStencilOperationFail(b.a.KEEP),t.setStencilOperationDepthFail(b.a.KEEP),t.setStencilMask(0),t.setStencilBuffer(!0),t.setStencilFunctionReference(this._instanceGlowingMeshStencilReference),this.outerGlow&&(e.setFloat("offset",0),t.setStencilFunction(b.a.NOTEQUAL),t.drawElementsType(d.a.TriangleFillMode,0,6)),this.innerGlow&&(e.setFloat("offset",1),t.setStencilFunction(b.a.EQUAL),t.drawElementsType(d.a.TriangleFillMode,0,6)),t.restoreStencilState()},R.prototype.shouldRender=function(){return!!A.prototype.shouldRender.call(this)&&!!this._meshes},R.prototype._shouldRenderMesh=function(e){return!(this._excludedMeshes&&this._excludedMeshes[e.uniqueId]||!A.prototype.hasMesh.call(this,e))},R.prototype._canRenderMesh=function(e,t){return!0},R.prototype._addCustomEffectDefines=function(e){e.push("#define HIGHLIGHT")},R.prototype._setEmissiveTextureAndColor=function(e,t,i){var n=this._meshes[e.uniqueId];n?this._emissiveTextureAndColor.color.set(n.color.r,n.color.g,n.color.b,1):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a),n&&n.glowEmissiveOnly&&i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.color.set(1,1,1,1)):this._emissiveTextureAndColor.texture=null},R.prototype.addExcludedMesh=function(e){this._excludedMeshes&&(this._excludedMeshes[e.uniqueId]||(this._excludedMeshes[e.uniqueId]={mesh:e,beforeBind:e.onBeforeBindObservable.add(function(e){e.getEngine().setStencilBuffer(!1)}),afterRender:e.onAfterRenderObservable.add(function(e){e.getEngine().setStencilBuffer(!0)})}))},R.prototype.removeExcludedMesh=function(e){var t;this._excludedMeshes&&((t=this._excludedMeshes[e.uniqueId])&&(t.beforeBind&&e.onBeforeBindObservable.remove(t.beforeBind),t.afterRe
1nder&&e.onAfterRenderObservable.remove(t.afterRender)),this._excludedMeshes[e.uniqueId]=null)},R.prototype.hasMesh=function(e){return!!this._meshes&&!!A.prototype.hasMesh.call(this,e)&&void 0!==this._meshes[e.uniqueId]&&null!==this._meshes[e.uniqueId]},R.prototype.addMesh=function(e,t,i){var n,r=this;void 0===i&&(i=!1),this._meshes&&((n=this._meshes[e.uniqueId])?n.color=t:(this._meshes[e.uniqueId]={mesh:e,color:t,observerHighlight:e.onBeforeBindObservable.add(function(e){r.isEnabled&&(r._excludedMeshes&&r._excludedMeshes[e.uniqueId]?r._defaultStencilReference(e):e.getScene().getEngine().setStencilFunctionReference(r._instanceGlowingMeshStencilReference))}),observerDefault:e.onAfterRenderObservable.add(function(e){r.isEnabled&&r._defaultStencilReference(e)}),glowEmissiveOnly:i},e.onDisposeObservable.add(function(){r._disposeMesh(e)})),this._shouldRender=!0)},R.prototype.removeMesh=function(e){if(this._meshes){var t=this._meshes[e.uniqueId];for(var i in t&&(t.observerHighlight&&e.onBeforeBindObservable.remove(t.observerHighlight),t.observerDefault&&e.onAfterRenderObservable.remove(t.observerDefault),delete this._meshes[e.uniqueId]),this._shouldRender=!1,this._meshes)if(this._meshes[i]){this._shouldRender=!0;break}}},R.prototype.removeAllMeshes=function(){if(this._meshes)for(var e in this._meshes){var t;!this._meshes.hasOwnProperty(e)||(t=this._meshes[e])&&this.removeMesh(t.mesh)}},R.prototype._defaultStencilReference=function(e){e.getScene().getEngine().setStencilFunctionReference(R.NormalMeshStencilReference)},R.prototype._disposeMesh=function(e){this.removeMesh(e),this.removeExcludedMesh(e)},R.prototype.dispose=function(){if(this._meshes){for(var e in this._meshes)(t=this._meshes[e])&&t.mesh&&(t.observerHighlight&&t.mesh.onBeforeBindObservable.remove(t.observerHighlight),t.observerDefault&&t.mesh.onAfterRenderObservable.remove(t.observerDefault));this._meshes=null}if(this._excludedMeshes){for(var e in this._excludedMeshes){var t;(t=this._excludedMeshes[e])&&(t.beforeBind&&t.mesh.onBeforeBindObservable.remove(t.beforeBind),t.afterRender&&t.mesh.onAfterRenderObservable.remove(t.afterRender))}this._excludedMeshes=null}A.prototype.dispose.call(this)},R.prototype.getClassName=function(){return"HighlightLayer"},R.prototype.serialize=function(){var e=s.a.Serialize(this);if(e.customType="BABYLON.HighlightLayer",e.meshes=[],this._meshes)for(var t in this._meshes){var i=this._meshes[t];i&&e.meshes.push({glowEmissiveOnly:i.glowEmissiveOnly,color:i.color.asArray(),meshId:i.mesh.id})}if(e.excludedMeshes=[],this._excludedMeshes)for(var n in this._excludedMeshes){var r=this._excludedMeshes[n];r&&e.excludedMeshes.push(r.mesh.id)}return e},R.Parse=function(e,t,i){for(var n=s.a.Parse(function(){return new R(e.name,t,e.options)},e,t,i),r=0;r<e.excludedMeshes.length;r++)(o=t.getMeshByID(e.excludedMeshes[r]))&&n.addExcludedMesh(o);for(r=0;r<e.meshes.length;r++){var o,a=e.meshes[r];(o=t.getMeshByID(a.meshId))&&n.addMesh(o,E.a.FromArray(a.color),a.glowEmissiveOnly)}return n},R.EffectName="HighlightLayer",R.NeutralColor=new E.b(0,0,0,0),R.GlowingMeshStencilReference=2,R.NormalMeshStencilReference=1,Object(a.c)([Object(s.c)()],R.prototype,"innerGlow",void 0),Object(a.c)([Object(s.c)()],R.prototype,"outerGlow",void 0),Object(a.c)([Object(s.c)()],R.prototype,"blurHorizontalSize",null),Object(a.c)([Object(s.c)()],R.prototype,"blurVerticalSize",null),Object(a.c)([Object(s.c)("options")],R.prototype,"_options",void 0),R);function R(e,t,i){var n=A.call(this,e,t)||this;return n.name=e,n.innerGlow=!0,n.outerGlow=!0,n.onBeforeBlurObservable=new l.c,n.onAfterBlurObservable=new l.c,n._instanceGlowingMeshStencilReference=R.GlowingMeshStencilReference++,n._meshes={},n._excludedMeshes={},n.neutralColor=R.NeutralColor,n._engine.isStencilEnable||y.a.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }"),n._options=Object(a.a)({mainTextureRatio:.5,blurTextureSizeRatio:.5,blurHorizontalSize:1,blurVerticalSize:1,alphaBlendingMode:b.a.ALPHA_COMBINE,camera:null,renderingGroupId:-1},i),n._init({alphaBlendingMode:n._options.alphaBlendingMode,camera:n._options.camera,mainTextureFixedSize:n._options.mainTextureFixedSize,mainTextureRatio:n._options.mainTextureRatio,renderingGroupId:n._options.renderingGroupId}),n._shouldRender=!1,n}function O(e,t,i,n,r,o,a,s){void 0===o&&(o=p.a.BILINEAR_SAMPLINGMODE);var c=C.call(this,e,"glowBlurPostProcess",["screenSize","direction","blurWidth"],null,n,r,o,a,s)||this;return c.direction=t,c.kernel=i,c.onApplyObservable.add(function(e){e.setFloat2("screenSize",c.width,c.height),e.setVector2("direction",c.direction),e.setFloat("blurWidth",c.kernel)}),c}T.a.RegisteredTypes["BABYLON.HighlightLayer"]=x;var M=i(22),I=i(17),D=(N.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(I.a.STEP_BEFORECAMERADRAW_LAYER,this,this._drawCameraBackgroun
1d),this.scene._afterCameraDrawStage.registerStep(I.a.STEP_AFTERCAMERADRAW_LAYER,this,this._drawCameraForeground),this.scene._beforeRenderTargetDrawStage.registerStep(I.a.STEP_BEFORERENDERTARGETDRAW_LAYER,this,this._drawRenderTargetBackground),this.scene._afterRenderTargetDrawStage.registerStep(I.a.STEP_AFTERRENDERTARGETDRAW_LAYER,this,this._drawRenderTargetForeground)},N.prototype.rebuild=function(){for(var e=0,t=this.scene.layers;e<t.length;e++)t[e]._rebuild()},N.prototype.dispose=function(){for(var e=this.scene.layers;e.length;)e[0].dispose()},N.prototype._draw=function(e){var t=this.scene.layers;if(t.length){this._engine.setDepthBuffer(!1);for(var i=0,n=t;i<n.length;i++){var r=n[i];e(r)&&r.render()}this._engine.setDepthBuffer(!0)}},N.prototype._drawCameraPredicate=function(e,t,i){return!e.renderOnlyInRenderTargetTextures&&e.isBackground===t&&0!=(e.layerMask&i)},N.prototype._drawCameraBackground=function(t){var i=this;this._draw(function(e){return i._drawCameraPredicate(e,!0,t.layerMask)})},N.prototype._drawCameraForeground=function(t){var i=this;this._draw(function(e){return i._drawCameraPredicate(e,!1,t.layerMask)})},N.prototype._drawRenderTargetPredicate=function(e,t,i,n){return 0<e.renderTargetTextures.length&&e.isBackground===t&&-1<e.renderTargetTextures.indexOf(n)&&0!=(e.layerMask&i)},N.prototype._drawRenderTargetBackground=function(t){var i=this;this._draw(function(e){return i._drawRenderTargetPredicate(e,!0,i.scene.activeCamera.layerMask,t)})},N.prototype._drawRenderTargetForeground=function(t){var i=this;this._draw(function(e){return i._drawRenderTargetPredicate(e,!1,i.scene.activeCamera.layerMask,t)})},N.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach(function(e){t.scene.layers.push(e)})},N.prototype.removeFromContainer=function(e,i){var n=this;void 0===i&&(i=!1),e.layers&&e.layers.forEach(function(e){var t=n.scene.layers.indexOf(e);-1!==t&&n.scene.layers.splice(t,1),i&&e.dispose()})},N),L=(i(74),"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\n\n#include<helperFunctions>\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef LINEAR\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}");function N(e){this.name=I.a.NAME_LAYER,this.scene=e,this._engine=e.getEngine(),e.layers=new Array}S.a.ShadersStore.layerPixelShader=L;S.a.ShadersStore.layerVertexShader="\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}";var F=(Object.defineProperty(w.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),w.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)},w.prototype._rebuild=function(){var e=this._vertexBuffers[h.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},w.prototype.render=function(){var e=this._scene.getEngine(),t="";this.alphaTest&&(t="#define ALPHATEST"),this.texture&&!this.texture.gammaSpace&&(t+="\r\n#define LINEAR"),this._previousDefines!==t&&(this._previousDefines=t,this._effect=e.createEffe
1ct("layer",[h.b.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],t));var i=this._effect;i&&i.isReady()&&this.texture&&this.texture.isReady()&&(e=this._scene.getEngine(),this.onBeforeRenderObservable.notifyObservers(this),e.enableEffect(i),e.setState(!1),i.setTexture("textureSampler",this.texture),i.setMatrix("textureMatrix",this.texture.getTextureMatrix()),i.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),i.setVector2("offset",this.offset),i.setVector2("scale",this.scale),e.bindBuffers(this._vertexBuffers,this._indexBuffer,i),this.alphaTest?e.drawElementsType(d.a.TriangleFillMode,0,6):(e.setAlphaMode(this.alphaBlendingMode),e.drawElementsType(d.a.TriangleFillMode,0,6),e.setAlphaMode(b.a.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this))},w.prototype.dispose=function(){var e=this._vertexBuffers[h.b.PositionKind];e&&(e.dispose(),this._vertexBuffers[h.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()},w);function w(e,t,i,n,r){this.name=e,this.scale=new u.d(1,1),this.offset=new u.d(0,0),this.alphaBlendingMode=b.a.ALPHA_COMBINE,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this._vertexBuffers={},this.onDisposeObservable=new l.c,this.onBeforeRenderObservable=new l.c,this.onAfterRenderObservable=new l.c,this.texture=t?new p.a(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===r?new E.b(1,1,1,1):r,this._scene=i||M.a.LastCreatedScene;var o=this._scene._getComponent(I.a.NAME_LAYER);o||(o=new D(this._scene),this._scene._addComponent(o)),this._scene.layers.push(this);var a=this._scene.getEngine(),s=[];s.push(1,1),s.push(-1,1),s.push(-1,-1),s.push(1,-1);var c=new h.b(a,s,h.b.PositionKind,!1,!1,2);this._vertexBuffers[h.b.PositionKind]=c,this._createIndexBuffer()}},function(e,t,i){"use strict";i.d(t,"a",function(){return l}),i.d(t,"b",function(){return p}),i.d(t,"c",function(){return g});var c=i(10),o=i(9),b=i(2),l=(h.AddFlare=function(e,t,i,n,r){return new h(e,t,i,n,r)},h.prototype.dispose=function(){this.texture&&this.texture.dispose();var e=this._system.lensFlares.indexOf(this);this._system.lensFlares.splice(e,1)},h),a=i(13),y=i(0),T=i(14),s=i(22),u=i(4),r=i(45),E=i(29),n=i(5);function h(e,t,i,n,r){this.size=e,this.position=t,this.alphaMode=b.a.ALPHA_ONEONE,this.color=i||new c.a(1,1,1),this.texture=n?new o.a(n,r.getScene(),!0):null,(this._system=r).lensFlares.push(this)}n.a.ShadersStore.lensFlarePixelShader="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}";n.a.ShadersStore.lensFlareVertexShader="\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}";var d=i(21),p=(Object.defineProperty(_.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e},enumerable:!1,configurable:!0}),_.prototype.getScene=function(){return this._scene},_.prototype.getEmitter=function(){return this._emitter},_.prototype.setEmitter=function(e){this._emitter=e},_.prototype.getEmitterPosition=function(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position},_.prototype.computeEffectivePosition=function(e){var t=this.getEmitterPosition(),t=y.e.Project(t,y.a.Identity(),this._scene.getTransformMatrix(),e);return this._positionX=t.x,this._positionY=t.y,t=y.e.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),0<this.viewportBorder&&(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),0<t.z&&(this._positionX>e.x&&this._positionX<e.x+e.width&&this._positionY>e.y&&(this._positionY,e.y,e.height),!0)},_.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 r.a(this._scene.activeCamera.globalPosition,e),n=this._scene.pickWithRay(i,this.meshesSelectionPredicate,!0);return!n||!n.hit||n.distance>t},_.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._positionX<this.borderLimit+n.x?this.borderLimit+n.x-this._positionX:this._positionX>n.x+n.width-this.borderLimit?this._positionX-n.x-n.width+this.borderLimit:0)>(t=this._positionY<this.borderLimit+n.y?this.borderLimit+n.y-this._positionY:this._positionY>n.y+n.height-this.borderLimit?this._positionY-n.y-n.height+this.borderLimit:0)?e:t;(r-=this.viewportBorder)>this.borderLimit&&(r=this.borderLimit);var o=1-T.a.Clamp(r/this.borderLimit,0,1);if(o<0)return!1;1<o&&(o=1),0<this.viewportBorder&&(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,s=n.y+n.height/2,c=a-this._positionX,l=s-this._positionY;i.enableEffect(this._effect),i.setState(!1),i.setDepthBuffer(!1),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect);for(var u=0;u<this.lensFlares.length;u++){var h,d,p,f,m,_,g,v=this.lensFlares[u];v.texture&&!v.texture.isReady()||(i.setAlphaMode(v.alphaMode),h=a-c*v.position,d=s-l*v.position,p=v.size,f=v.size*i.getAspectRatio(this._scene.activeCamera,!0),m=h/(n.width+2*n.x)*2-1,_=1-d/(n.height+2*n.y)*2,g=y.a.FromValues(p/2,0,0,0,0,f/2,0,0,0,0,1,0,m,_,0,1),this._effect.setMatr
1ix("viewportMatrix",g),this._effect.setTexture("textureSampler",v.texture),this._effect.setFloat4("color",v.color.r*o,v.color.g*o,v.color.b*o,1),i.drawElementsType(E.a.TriangleFillMode,0,6))}return i.setDepthBuffer(!0),i.setAlphaMode(b.a.ALPHA_DISABLE),!0},_.prototype.dispose=function(){var e=this._vertexBuffers[u.b.PositionKind];for(e&&(e.dispose(),this._vertexBuffers[u.b.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null);this.lensFlares.length;)this.lensFlares[0].dispose();var t=this._scene.lensFlareSystems.indexOf(this);this._scene.lensFlareSystems.splice(t,1)},_.Parse=function(e,t,i){var n=t.getLastEntryByID(e.emitterId),r=e.name||"lensFlareSystem#"+e.emitterId,o=new _(r,n,t);o.id=e.id||r,o.borderLimit=e.borderLimit;for(var a=0;a<e.flares.length;a++){var s=e.flares[a];l.AddFlare(s.size,s.position,c.a.FromArray(s.color),s.textureName?i+s.textureName:"",o)}return o},_.prototype.serialize=function(){var e={};e.id=this.id,e.name=this.name,e.emitterId=this.getEmitter().id,e.borderLimit=this.borderLimit,e.flares=[];for(var t=0;t<this.lensFlares.length;t++){var i=this.lensFlares[t];e.flares.push({size:i.size,position:i.position,color:i.color.asArray(),textureName:a.b.GetFilename(i.texture?i.texture.name:"")})}return e},_._SceneComponentInitialization=function(e){throw d.a.WarnImport("LensFlareSystemSceneComponent")},_),f=i(17),m=i(42);function _(e,t,i){this.name=e,this.lensFlares=new Array,this.borderLimit=300,this.viewportBorder=0,this.layerMask=268435455,this._vertexBuffers={},this._isEnabled=!0,this._scene=i||s.a.LastCreatedScene,_._SceneComponentInitialization(this._scene),this._emitter=t,this.id=e,i.lensFlareSystems.push(this),this.meshesSelectionPredicate=function(e){return i.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&i.activeCamera.layerMask)};var n=i.getEngine(),r=[];r.push(1,1),r.push(-1,1),r.push(-1,-1),r.push(1,-1),this._vertexBuffers[u.b.PositionKind]=new u.b(n,r,u.b.PositionKind,!1,!1,2);var o=[];o.push(0),o.push(1),o.push(2),o.push(0),o.push(2),o.push(3),this._indexBuffer=n.createIndexBuffer(o),this._effect=n.createEffect("lensFlare",[u.b.PositionKind],["color","viewportMatrix"],["textureSampler"],"")}m.a.AddParser(f.a.NAME_LENSFLARESYSTEM,function(e,t,i,n){if(void 0!==e.lensFlareSystems&&null!==e.lensFlareSystems){i.lensFlareSystems||(i.lensFlareSystems=new Array);for(var r=0,o=e.lensFlareSystems.length;r<o;r++){var a=e.lensFlareSystems[r],s=p.Parse(a,t,n);i.lensFlareSystems.push(s)}}}),m.a.prototype.getLensFlareSystemByName=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].name===e)return this.lensFlareSystems[t];return null},m.a.prototype.getLensFlareSystemByID=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].id===e)return this.lensFlareSystems[t];return null},m.a.prototype.removeLensFlareSystem=function(e){var t=this.lensFlareSystems.indexOf(e);return-1!==t&&this.lensFlareSystems.splice(t,1),t},m.a.prototype.addLensFlareSystem=function(e){this.lensFlareSystems.push(e)};var g=(v.prototype.register=function(){this.scene._afterCameraDrawStage.registerStep(f.a.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM,this,this._draw)},v.prototype.rebuild=function(){},v.prototype.addFromContainer=function(e){var t=this;e.lensFlareSystems&&e.lensFlareSystems.forEach(function(e){t.scene.addLensFlareSystem(e)})},v.prototype.removeFromContainer=function(e,t){var i=this;e.lensFlareSystems&&e.lensFlareSystems.forEach(function(e){i.scene.removeLensFlareSystem(e),t&&e.dispose()})},v.prototype.serialize=function(e){e.lensFlareSystems=[];for(var t=0,i=this.scene.lensFlareSystems;t<i.length;t++){var n=i[t];e.lensFlareSystems.push(n.serialize())}},v.prototype.dispose=function(){for(var e=this.scene.lensFlareSystems;e.length;)e[0].dispose()},v.prototype._draw=function(e){if(this.scene.lensFlaresEnabled){var t=this.scene.lensFlareSystems;a.b.StartPerformanceCounter("Lens flares",0<t.length);for(var i=0,n=t;i<n.length;i++){var r=n[i];0!=(e.layerMask&r.layerMask)&&r.render()}a.b.EndPerformanceCounter("Lens flares",0<t.length)}},v);function v(e){this.name=f.a.NAME_LENSFLARESYSTEM,(this.scene=e).lensFlareSystems=new Array}p._SceneComponentInitialization=function(e){var t=e._getComponent(f.a.NAME_LENSFLARESYSTEM);t||(t=new g(e),e._addComponent(t))}},function(e,t,i){"use strict";i.d(t,"a",function(){return o.a}),i.d(t,"b",function(){return n.a}),i.d(t,"c",function(){return r.a}),i.d(t,"d",function(){return c}),i.d(t,"e",function(){return s}),i.d(t,"f",function(){return _}),i.d(t,"g",function(){return h.a});var o=i(155),n=i(52),r=i(164),a=i(40),p=i(0),s=(Object.defineProperty(m.prototype,"capacity",{get:function(){return this._capacity}
1,enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"minPoint",{get:function(){return this._minPoint},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"maxPoint",{get:function(){return this._maxPoint},enumerable:!1,configurable:!0}),m.prototype.addEntry=function(e){if(this.blocks)for(var t=0;t<this.blocks.length;t++)this.blocks[t].addEntry(e);else this._creationFunc(e,this),this.entries.length>this.capacity&&this._depth<this._maxDepth&&this.createInnerBlocks()},m.prototype.removeEntry=function(e){if(this.blocks)for(var t=0;t<this.blocks.length;t++)this.blocks[t].removeEntry(e);else{var i=this.entries.indexOf(e);-1<i&&this.entries.splice(i,1)}},m.prototype.addEntries=function(e){for(var t=0;t<e.length;t++){var i=e[t];this.addEntry(i)}},m.prototype.select=function(e,t,i){if(o.a.IsInFrustum(this._boundingVectors,e)){if(this.blocks){for(var n=0;n<this.blocks.length;n++)this.blocks[n].select(e,t,i);return}i?t.concat(this.entries):t.concatWithNoDuplicate(this.entries)}},m.prototype.intersects=function(e,t,i,n){if(o.a.IntersectsSphere(this._minPoint,this._maxPoint,e,t)){if(this.blocks){for(var r=0;r<this.blocks.length;r++)this.blocks[r].intersects(e,t,i,n);return}n?i.concat(this.entries):i.concatWithNoDuplicate(this.entries)}},m.prototype.intersectsRay=function(e,t){if(e.intersectsBoxMinMax(this._minPoint,this._maxPoint)){if(this.blocks){for(var i=0;i<this.blocks.length;i++)this.blocks[i].intersectsRay(e,t);return}t.concatWithNoDuplicate(this.entries)}},m.prototype.createInnerBlocks=function(){m._CreateBlocks(this._minPoint,this._maxPoint,this.entries,this._capacity,this._depth,this._maxDepth,this,this._creationFunc)},m._CreateBlocks=function(e,t,i,n,r,o,a,s){a.blocks=new Array;for(var c=new p.e((t.x-e.x)/2,(t.y-e.y)/2,(t.z-e.z)/2),l=0;l<2;l++)for(var u=0;u<2;u++)for(var h=0;h<2;h++){var d=new m(e.add(c.multiplyByFloats(l,u,h)),e.add(c.multiplyByFloats(l+1,u+1,h+1)),n,r+1,o,s);d.addEntries(i),a.blocks.push(d)}},m),c=(f.prototype.update=function(e,t,i){s._CreateBlocks(e,t,i,this._maxBlockCapacity,0,this.maxDepth,this,this._creationFunc)},f.prototype.addMesh=function(e){for(var t=0;t<this.blocks.length;t++)this.blocks[t].addEntry(e)},f.prototype.removeMesh=function(e){for(var t=0;t<this.blocks.length;t++)this.blocks[t].removeEntry(e)},f.prototype.select=function(e,t){this._selectionContent.reset();for(var i=0;i<this.blocks.length;i++)this.blocks[i].select(e,this._selectionContent,t);return t?this._selectionContent.concat(this.dynamicContent):this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},f.prototype.intersects=function(e,t,i){this._selectionContent.reset();for(var n=0;n<this.blocks.length;n++)this.blocks[n].intersects(e,t,this._selectionContent,i);return i?this._selectionContent.concat(this.dynamicContent):this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},f.prototype.intersectsRay=function(e){this._selectionContent.reset();for(var t=0;t<this.blocks.length;t++)this.blocks[t].intersectsRay(e,this._selectionContent);return this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},f.CreationFuncForMeshes=function(e,t){var i=e.getBoundingInfo();!e.isBlocked&&i.boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},f.CreationFuncForSubMeshes=function(e,t){e.getBoundingInfo().boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},f),l=i(18),u=i(28),h=i(45),d=i(17);function f(e,t,i){void 0===i&&(i=2),this.maxDepth=i,this.dynamicContent=new Array,this._maxBlockCapacity=t||64,this._selectionContent=new a.b(1024),this._creationFunc=e}function m(e,t,i,n,r,o){this.entries=new Array,this._boundingVectors=new Array,this._capacity=i,this._depth=n,this._maxDepth=r,this._creationFunc=o,this._minPoint=e,this._maxPoint=t,this._boundingVectors.push(e.clone()),this._boundingVectors.push(t.clone()),this._boundingVectors.push(e.clone()),this._boundingVectors[2].x=t.x,this._boundingVectors.push(e.clone()),this._boundingVectors[3].y=t.y,this._boundingVectors.push(e.clone()),this._boundingVectors[4].z=t.z,this._boundingVectors.push(t.clone()),this._boundingVectors[5].z=e.z,this._boundingVectors.push(t.clone()),this._boundingVectors[6].x=e.x,this._boundingVectors.push(t.clone()),this._boundingVectors[7].y=e.y}
1l.a.prototype.createOrUpdateSelectionOctree=function(e,t){void 0===e&&(e=64),void 0===t&&(t=2);var i=this._getComponent(d.a.NAME_OCTREE);i||(i=new _(this),this._addComponent(i)),this._selectionOctree||(this._selectionOctree=new c(c.CreationFuncForMeshes,e,t));var n=this.getWorldExtends();return this._selectionOctree.update(n.min,n.max,this.meshes),this._selectionOctree},Object.defineProperty(l.a.prototype,"selectionOctree",{get:function(){return this._selectionOctree},enumerable:!0,configurable:!0}),u.a.prototype.createOrUpdateSubmeshesOctree=function(e,t){void 0===e&&(e=64),void 0===t&&(t=2);var i=this.getScene(),n=i._getComponent(d.a.NAME_OCTREE);n||(n=new _(i),i._addComponent(n)),this._submeshesOctree||(this._submeshesOctree=new c(c.CreationFuncForSubMeshes,e,t)),this.computeWorldMatrix(!0);var r=this.getBoundingInfo().boundingBox;return this._submeshesOctree.update(r.minimumWorld,r.maximumWorld,this.subMeshes),this._submeshesOctree};var _=(g.prototype.register=function(){var n=this;this.scene.onMeshRemovedObservable.add(function(e){var t,i=n.scene.selectionO
1ctree;null==i||-1!==(t=i.dynamicContent.indexOf(e))&&i.dynamicContent.splice(t,1)}),this.scene.onMeshImportedObservable.add(function(e){var t=n.scene.selectionOctree;null!=t&&t.addMesh(e)})},g.prototype.getActiveMeshCandidates=function(){return this.scene._selectionOctree?this.scene._selectionOctree.select(this.scene.frustumPlanes):this.scene._getDefaultMeshCandidates()},g.prototype.getActiveSubMeshCandidates=function(e){return e._submeshesOctree&&e.useOctreeForRenderingSelection?e._submeshesOctree.select(this.scene.frustumPlanes):this.scene._getDefaultSubMeshCandidates(e)},g.prototype.getIntersectingSubMeshCandidates=function(e,t){return e._submeshesOctree&&e.useOctreeForPicking?(h.a.TransformToRef(t,e.getWorldMatrix(),this._tempRay),e._submeshesOctree.intersectsRay(this._tempRay)):this.scene._getDefaultSubMeshCandidates(e)},g.prototype.getCollidingSubMeshCandidates=function(e,t){if(e._submeshesOctree&&e.useOctreeForCollisions){var i=t._velocityWorldLength+Math.max(t._radius.x,t._radius.y,t._radius.z);return e._submeshesOctree.intersects(t._basePointWorld,i)}return this.scene._getDefaultSubMeshCandidates(e)},g.prototype.rebuild=function(){},g.prototype.dispose=function(){},g);function g(e){this.name=d.a.NAME_OCTREE,this.checksIsEnabled=!0,this._tempRay=new h.a(p.e.Zero(),new p.e(1,1,1)),this.scene=e,this.scene.getActiveMeshCandidates=this.getActiveMeshCandidates.bind(this),this.scene.getActiveSubMeshCandidates=this.getActiveSubMeshCandidates.bind(this),this.scene.getCollidingSubMeshCandidates=this.getCollidingSubMeshCandidates.bind(this),this.scene.getIntersectingSubMeshCandidates=this.getIntersectingSubMeshCandidates.bind(this)}},function(e,t,i){"use strict";i.d(t,"a",function(){return g}),i.d(t,"b",function(){return y}),i.d(t,"d",function(){return O}),i.d(t,"c",function(){return F});var u,n=i(1),h=i(6),d=i(102),p=i(0),r=i(10),f=i(8),o=i(62),m=i(9),a=i(269),s=i(86),_=i(137),c=i(2),l=(i(115),i(91),i(80)),g=(I._getDefaultOptions=function(){return{createGround:!0,groundSize:15,groundTexture:this._groundTextureCDNUrl,groundColor:new r.a(.2,.2,.3).toLinearSpace().scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:c.a.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._skyboxTextureCDNUrl,skyboxColor:new r.a(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:p.e.Zero(),setupImageProcessing:!0,environmentTexture:this._environmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(I.prototype,"rootMesh",{get:function(){return this._rootMesh},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"skybox",{get:function(){return this._skybox},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"skyboxTexture",{get:function(){return this._skyboxTexture},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"skyboxMaterial",{get:function(){return this._skyboxMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"ground",{get:function(){return this._ground},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"groundTexture",{get:function(){return this._groundTexture},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"groundMirror",{get:function(){return this._groundMirror},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"groundMirrorRenderList",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"groundMaterial",{get:function(){return this._groundMaterial},enumerable:!1,configurable:!0}),I.prototype.updateOptions=function(e){var t=Object(n.a)(Object(n.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._setupBackgroun
1d(),this._setupImageProcessing()},I.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new r.b(e.r,e.g,e.b,1))},I.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())},I.prototype._setupEnvironmentTexture=function(){var e;this._scene.environmentTexture||(this._options.environmentTexture instanceof o.a?this._scene.environmentTexture=this._options.environmentTexture:(e=s.a.CreateFromPrefilteredData(this._options.environmentTexture,this._scene),this._scene.environmentTexture=e))},I.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new f.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},I.prototype._getSceneSize=function(){var t=this,e=this._options.groundSize,i=this._options.skyboxSize,n=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:e,skyboxSize:i,rootPosition:n};var r,o=this._scene.getWorldExtends(function(e){return e!==t._ground&&e!==t._rootMesh&&e!==t._skybox}),a=o.max.subtract(o.min);return this._options.sizeAuto&&(this._scene.activeCamera instanceof d.a&&this._scene.activeCamera.upperRadiusLimit&&(i=e=2*this._scene.activeCamera.upperRadiusLimit),e<(r=a.length())&&(i=e=2*r),e*=1.1,i*=1.5,(n=o.min.add(a.scale(.5))).y=o.min.y-this._options.groundYBias),{groundSize:e,skyboxSize:i,rootPosition:n}},I.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=f.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},I.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new _.a("Backgroun
1dPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=c.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)},I.prototype._setupGroundDiffuseTexture=function(){var e;this._groundMaterial&&!this._groundTexture&&(this._options.groundTexture instanceof o.a?this._groundMaterial.diffuseTexture=this._options.groundTexture:((e=new m.a(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler)).gammaSpace=!1,e.hasAlpha=!0,this._groundMaterial.diffuseTexture=e))},I.prototype._setupGroundMirrorTexture=function(e){var t=m.a.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new a.a("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,m.a.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new l.a(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.gammaSpace=!1,this._groundMirror.renderList))for(var i=0;i<this._scene.meshes.length;i++){var n=this._scene.meshes[i];n!==this._ground&&n!==this._skybox&&n!==this._rootMesh&&this._groundMirror.renderList.push(n)}this._groundMirror.clearColor=new r.b(this._options.groundColor.r,this._options.groundColor.g,this._options.groundColor.b,1),this._groundMirror.adaptiveBlurKernel=this._options.groundMirrorBlurKernel},I.prototype._setupMirrorInGroundMaterial=function(){this._groundMaterial&&(this._groundMaterial.reflectionTexture=this._groundMirror,this._groundMaterial.reflectionFresnel=!0,this._groundMaterial.reflectionAmount=this._options.groundMirrorAmount,this._groundMaterial.reflectionStandardFresnelWeight=this._options.groundMirrorFresnelWeight,this._groundMaterial.reflectionFalloffDistance=this._options.groundMirrorFallOffDistance)},I.prototype._setupSkybox=function(e){var t=this;this._skybox&&!this._skybox.isDisposed()||(this._skybox=f.a.CreateBox("BackgroundSkybox",e.skyboxSize,this._scene,void 0,f.a.BACKSIDE),this._skybox.onDisposeObservable.add(function(){t._skybox=null})),this._skybox.parent=this._rootMesh},I.prototype._setupSkyboxMaterial=function(){this._skybox&&(this._skyboxMaterial||(this._skyboxMaterial=new _.a("Backgroun
1dSkyboxMaterial",this._scene)),this._skyboxMaterial.useRGBColor=!1,this._skyboxMaterial.primaryColor=this._options.skyboxColor,this._skyboxMaterial.enableNoise=!0,this._skybox.material=this._skyboxMaterial)},I.prototype._setupSkyboxReflectionTexture=function(){this._skyboxMaterial&&(this._skyboxTexture||(this._options.skyboxTexture instanceof o.a?this._skyboxMaterial.reflectionTexture=this._options.skyboxTexture:(this._skyboxTexture=new s.a(this._options.skyboxTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._skyboxTexture.coordinatesMode=m.a.SKYBOX_MODE,this._skyboxTexture.gammaSpace=!1,this._skyboxMaterial.reflectionTexture=this._skyboxTexture)))},I.prototype.dispose=function(){this._groundMaterial&&this._groundMaterial.dispose(!0,!0),this._skyboxMaterial&&this._skyboxMaterial.dispose(!0,!0),this._rootMesh.dispose(!1)},I._groundTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundGround.png",I._skyboxTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundSkybox.dds",I._environmentTextureCDNUrl="https://assets.babylonjs.com/environments/environmentSpecular.env",I),v=i(51),b=i(60),y=(u=v.a,Object(n.d)(M,u),Object.defineProperty(M.prototype,"photoTexture",{get:function(){return this._photoTexture},set:function(e){this._photoTexture!==e&&(this._photoTexture=e,this._useDirectMapping?(this._photoTexture.wrapU=m.a.CLAMP_ADDRESSMODE,this._photoTexture.wrapV=m.a.CLAMP_ADDRESSMODE,this._material.diffuseTexture=this._photoTexture):(this._photoTexture.coordinatesMode=m.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,this._photoTexture.wrapV=m.a.CLAMP_ADDRESSMODE,this._material.reflectionTexture=this._photoTexture))},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"mesh",{get:function(){return this._mesh},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"imageMode",{get:function(){return this._imageMode},set:function(e){this._imageMode!==e&&this._changeImageMode(e)},enumerable:!1,configurable:!0}),M.prototype._changeImageMode=function(e){var t=this;switch(this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._imageMode=e,this._photoTexture.uScale=1,this._photoTexture.vScale=1,this._photoTexture.uOffset=0,this._photoTexture.vOffset=0,e){case M.MODE_SIDEBYSIDE:this._photoTexture.uScale=.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){t._photoTexture.uOffset=e.isRightCamera?.5:0});break;case M.MODE_TOPBOTTOM:this._photoTexture.vScale=.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){t._photoTexture.vOffset=e.isRightCamera?.5:0})}},M.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._photoTexture.dispose(),this._mesh.dispose(),this._material.dispose(),this.onLoadErrorObservable.clear(),this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),u.prototype.dispose.call(this,e,t)},M.MODE_MONOSCOPIC=0,M.MODE_TOPBOTTOM=1,M.MODE_SIDEBYSIDE=2,M),T=i(7),E=i(18),S=i(35),A=i(169),C=i(118),P=i(71),x=i(261),R=(i(315),i(316),i(320),i(271)),O=!0;function M(e,t,i,n,r){void 0===r&&(r=null);var o=u.call(this,e,n)||this;o._useDirectMapping=!1,o.onLoadErrorObservable=new h.c,o._imageMode=M.MODE_MONOSCOPIC,o._onBeforeCameraRenderObserver=null,e=e||"photoDome",i.resolution=0|Math.abs(i.resolution)||32,i.size=Math.abs(i.size)||(n.activeCamera?.48*n.activeCamera.maxZ:1e3),void 0===i.useDirectMapping?o._useDirectMapping=!0:o._useDirectMapping=i.useDirectMapping,void 0===i.faceForward&&(i.faceForward=!0),o._setReady(!1);var a,s,c,l=o._material=new _.a(e+"_material",n);return o._mesh=f.a.CreateSphere(e+"_mesh",i.resolution,i.size,n,!1,f.a.BACKSIDE),l.opacityFresnel=!1,l.useEquirectangularFOV=!0,l.fovMultiplier=1,o.photoTexture=new m.a(t,n,!0,!o._useDirectMapping,void 0,void 0,function(e,t){o.onLoadErrorObservable.notifyObservers(e||"Unknown error occured"),r&&r(e,t)}),o.photoTexture.anisotropicFilteringLevel=1,o.photoTexture.onLoadObservable.addOnce(function(){o._setReady(!0)}),o._mesh.material=l,o._mesh.parent=o,i.faceForward&&n.activeCamera&&(a=n.activeCamera,s=p.e.Forward(),(c=p.e.TransformNormal(s,a.getViewMatrix())).normalize(),o.rotation.y=Math.acos(p.e.Dot
1(s,c))),o}function I(e,t){var i=this;this._errorHandler=function(e,t){i.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=Object(n.a)(Object(n.a)({},I._getDefaultOptions()),e),this._scene=t,this.onErrorObservable=new h.c,this._setupBackground(),this._setupImageProcessing()}E.a.prototype.createDefaultLight=function(e){if(void 0===e&&(e=!1),e&&this.lights)for(var t=0;t<this.lights.length;t++)this.lights[t].dispose();0===this.lights.length&&new C.a("default light",p.e.Up(),this)},E.a.prototype.createDefaultCamera=function(e,t,i){var n,r,o,a,s,c,l,u;void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),t&&this.activeCamera&&(this.activeCamera.dispose(),this.activeCamera=null),this.activeCamera||(o=(r=this.getWorldExtends(function(e){return e.isVisible&&e.isEnabled()})).max.subtract(r.min),a=r.min.add(o.scale(.5)),s=1.5*o.length(),isFinite(s)||(s=1,a.copyFromFloats(0,0,0)),(n=e?((c=new d.a("default camera",-Math.PI/2,Math.PI/2,s,a,this)).lowerRadiusLimit=.01*s,c.wheelPrecision=100/s,c):((l=new P.a("default camera",new p.e(a.x,a.y,-s),this)).setTarget(a),l)).minZ=.01*s,n.maxZ=1e3*s,n.speed=.2*s,this.activeCamera=n,u=this.getEngine().getInputElement(),i&&u&&n.attachControl(u))},E.a.prototype.createDefaultCameraOrLight=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this.createDefaultLight(t),this.createDefaultCamera(e,t,i)},E.a.prototype.createDefaultSkybox=function(e,t,i,n,r){if(void 0===t&&(t=!1),void 0===i&&(i=1e3),void 0===n&&(n=0),void 0===r&&(r=!0),!e)return T.a.Warn("Can not create default skybox without environment texture."),null;r&&e&&(this.environmentTexture=e);var o,a,s=f.a.CreateBox("hdrSkyBox",i,this);return t?((o=new A.a("skyBox",this)).backFaceCulling=!1,o.reflectionTexture=e.clone(),o.reflectionTexture&&(o.reflectionTexture.coordinatesMode=m.a.SKYBOX_MODE),o.microSurface=1-n,o.disableLighting=!0,o.twoSidedLighting=!0,s.infiniteDistance=!0,s.material=o):((a=new S.a("skyBox",this)).backFaceCulling=!1,a.reflectionTexture=e.clone(),a.reflectionTexture&&(a.reflectionTexture.coordinatesMode=m.a.SKYBOX_MODE),a.disableLighting=!0,s.infiniteDistance=!0,s.material=a),s.isPickable=!1,s},E.a.prototype.createDefaultEnvironment=function(e){return g?new g(e,this):null},E.a.prototype.createDefaultVRExperience=function(e){return void 0===e&&(e={}),new x.b(this,e)},E.a.prototype.createDefaultXRExperienceAsync=function(e){return void 0===e&&(e={}),R.a.CreateAsync(this,e).then(function(e){return e})};var D,L=i(279),N=i(33),F=(D=v.a,Object(n.d)(w,D),Object.defineProperty(w.prototype,"videoTexture",{get:function(){return this._videoTexture},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"mesh",{get:function(){return this._mesh},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"videoMode",{get:function(){return this._videoMode},set:function(e){this._videoMode!==e&&this._changeVideoMode(e)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"halfDome",{get:function(){return this._halfDome},set:function(e){this._halfDome=e,this._halfDomeMask.setEnabled(e)},enumerable:!1,configurable:!0}),w.prototype._changeVideoMode=function(e){var t=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 w.MODE_SIDEBYSIDE:this._videoTexture.uScale=this._halfDome?.99999:.5;var i=this._halfDome?0:.5,n=this._halfDome?.5:0;this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){t._videoTexture.uOffset=e.isRightCamera?i:n});break;case w.MODE_TOPBOTTOM:this._videoTexture.vScale=this._halfDome?.99999:.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){t._videoTexture.vOffset=e.isRightCamera?.5:0})}},w.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._videoTexture.dispose(),this._mesh.dispose(),this._material.dispose(),this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),D.prototype.dispose.call(this,e,t)},w.MODE_MONOSCOPIC=0,w.MODE_TOPBOTTOM=1,w.MODE_SIDEBYSIDE=2,w);function w(e,t,i,n){var r=D.call(this,e,n)||this;r._halfDome=!1,r._useDirectMapping=!1,r._videoMode=w.MODE_MONOSCOPIC,r._onBeforeCameraRenderObserver=null,n=r.getSce
1ne(),e=e||"videoDome",i.resolution=0|Math.abs(i.resolution)||32,i.clickToPlay=Boolean(i.clickToPlay),i.autoPlay=void 0===i.autoPlay||Boolean(i.autoPlay),i.loop=void 0===i.loop||Boolean(i.loop),i.size=Math.abs(i.size)||(n.activeCamera?.48*n.activeCamera.maxZ:1e3),void 0===i.useDirectMapping?r._useDirectMapping=!0:r._useDirectMapping=i.useDirectMapping,void 0===i.faceForward&&(i.faceForward=!0),r._setReady(!1);var o,a,s,c={loop:i.loop,autoPlay:i.autoPlay,autoUpdateTexture:!0,poster:i.poster},l=r._material=new _.a(e+"_material",n),u=r._videoTexture=new L.a(e+"_texture",t,n,!1,r._useDirectMapping,m.a.TRILINEAR_SAMPLINGMODE,c);return r._mesh=f.a.CreateSphere(e+"_mesh",i.resolution,i.size,n,!1,f.a.BACKSIDE),u.anisotropicFilteringLevel=1,u.onLoadObservable.addOnce(function(){r._setReady(!0)}),l.useEquirectangularFOV=!0,l.fovMultiplier=1,l.opacityFresnel=!1,r._useDirectMapping?(u.wrapU=m.a.CLAMP_ADDRESSMODE,u.wrapV=m.a.CLAMP_ADDRESSMODE,l.diffuseTexture=u):(u.coordinatesMode=m.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,u.wrapV=m.a.CLAMP_ADDRESSMODE,l.reflectionTexture=u),r._mesh.material=l,(r._mesh.parent=r)._halfDomeMask=b.a.CreateSphere("",{slice:.5,diameter:.99*i.size,segments:i.resolution,sideOrientation:f.a.BACKSIDE},n),r._halfDomeMask.rotate(N.c.X,-Math.PI/2),r._halfDomeMask.parent=r._mesh,r._halfDome=!!i.halfDomeMode,r._halfDomeMask.setEnabled(r._halfDome),i.clickToPlay&&(n.onPointerUp=function(){r._videoTexture.video.play()}),i.faceForward&&n.activeCamera&&(o=n.activeCamera,a=p.e.Forward(),(s=p.e.TransformNormal(a,o.getViewMatrix())).normalize(),r.rotation.y=Math.acos(p.e.Dot(a,s))),r}},function(e,t,i){"use strict";i.d(t,"b",function(){return a}),i.d(t,"c",function(){return s}),i.d(t,"a",function(){return c}),i(303);var n=i(12),o=i(28),r=i(266),a=function(){this.occlusionInternalRetryCounter=0,this.isOcclusionQueryInProgress=!1,this.isOccluded=!1,this.occlusionRetryCount=-1,this.occlusionType=o.a.OCCLUSION_TYPE_NONE,this.occlusionQueryAlgorithmType=o.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE};n.a.prototype.createQuery=function(){return this._gl.createQuery()},n.a.prototype.deleteQuery=function(e){return this._gl.deleteQuery(e),this},n.a.prototype.isQueryResultAvailable=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT_AVAILABLE)},n.a.prototype.getQueryResult=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT)},n.a.prototype.beginOcclusionQuery=function(e,t){var i=this._getGlAlgorithmType(e);return this._gl.beginQuery(i,t),this},n.a.prototype.endOcclusionQuery=function(e){var t=this._getGlAlgorithmType(e);return this._gl.endQuery(t),this},n.a.prototype._createTimeQuery=function(){var e=this.getCaps().timerQuery;return e.createQueryEXT?e.createQueryEXT():this.createQuery()},n.a.prototype._deleteTimeQuery=function(e){var t=this.getCaps().timerQuery;t.deleteQueryEXT?t.deleteQueryEXT(e):this.deleteQuery(e)},n.a.prototype._getTimeQueryResult=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT):this.getQueryResult(e)},n.a.prototype._getTimeQueryAvailability=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT):this.isQueryResultAvailable(e)},n.a.prototype.startTimeQuery=function(){var e=this.getCaps(),t=e.timerQuery;if(!t)return null;var i=new r.a;if(this._gl.getParameter(t.GPU_DISJOINT_EXT),e.canUseTimestampForTimerQuery)i._startTimeQuery=this._createTimeQuery(),t.queryCounterEXT(i._startTimeQuery,t.TIMESTAMP_EXT);else{if(this._currentNonTimestampToken)return this._currentNonTimestampToken;i._timeElapsedQuery=this._createTimeQuery(),t.beginQueryEXT?t.beginQueryEXT(t.TIME_ELAPSED_EXT,i._timeElapsedQuery):this._gl.beginQuery(t.TIME_ELAPSED_EXT,i._timeElapsedQuery),this._currentNonTimestampToken=i}return i},n.a.prototype.endTimeQuery=function(e){var t=this.getCaps(),i=t.timerQuery;if(!i||!e)return-1;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery)return-1;e._endTimeQuery||(e._endTimeQuery=this._createTimeQuery(),i.queryCounterEXT(e._endTimeQuery,i.TIMESTAMP_EXT))}else if(!e._timeElapsedQueryEnded){if(!e._timeElapsedQuery)return-1;i.endQueryEXT?i.endQueryEXT(i.TIME_ELAPSED_EXT):this._gl.endQuery(i.TIME_ELAPSED_EXT),e._timeElapsedQueryEnded=!0}var n=this._gl.getParameter(i.GPU_DISJOINT_EXT),r=!1;if(e._endTimeQuery?r=this._getTimeQueryAvailability(e._endTimeQuery):e._timeElapsedQuery&&(r=this._getTimeQueryAvailability(e._timeElapsedQuery)),!r||n)return-1;var o=0;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery||!e._endTimeQuery)return-1;var a=this._getTimeQueryResult(e._startTimeQuery),o=this._getTimeQueryResult(e._endTimeQuery)-a;this._deleteTimeQuery(e._startTimeQuery),this._deleteTimeQuery(e._endTimeQuery),e._startTimeQuery=null,e._endTimeQuery=null}else{if(!e._timeElapsedQuery)return-1;o=this._getTimeQueryResult(e._timeElapsedQuery),this._deleteTimeQuery(e._timeElapsedQuery),e._timeElapsedQuery=null,e._timeElapsedQueryEnded=!1,this._currentNonTimestampToken=null}return o},n.a.prototype._getGlAlgorithmType=function(e){return e===o.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED},Object.defineProperty(o.a.prototype,"isOcclusionQueryInProgress",{get:function(){return this._occlusionDataStorage.
1isOcclusionQueryInProgress},set:function(e){this._occlusionDataStorage.isOcclusionQueryInProgress=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.a.prototype,"_occlusionDataStorage",{get:function(){return this.__occlusionDataStorage||(this.__occlusionDataStorage=new a),this.__occlusionDataStorage},enumerable:!1,configurable:!0}),Object.defineProperty(o.a.prototype,"isOccluded",{get:function(){return this._occlusionDataStorage.isOccluded},set:function(e){this._occlusionDataStorage.isOccluded=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.a.prototype,"occlusionQueryAlgorithmType",{get:function(){return this._occlusionDataStorage.occlusionQueryAlgorithmType},set:function(e){this._occlusionDataStorage.occlusionQueryAlgorithmType=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.a.prototype,"occlusionType",{get:function(){return this._occlusionDataStorage.occlusionType},set:function(e){this._occlusionDataStorage.occlusionType=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.a.prototype,"occlusionRetryCount",{get:function(){return this._occlusionDataStorage.occlusionRetryCount},set:function(e){this._occlusionDataStorage.occlusionRetryCount=e},enumerable:!0,configurable:!0}),o.a.prototype._checkOcclusionQuery=function(){var e=this._occlusionDataStorage;if(e.occlusionType===o.a.OCCLUSION_TYPE_NONE)return e.isOccluded=!1;var t=this.getEngine();if(t.webGLVersion<2)return e.isOccluded=!1;if(!t.isQueryResultAvailable)return e.isOccluded=!1;if(this.isOcclusionQueryInProgress&&this._occlusionQuery)if(t.isQueryResultAvailable(this._occlusionQuery)){var i=t.getQueryResult(this._occlusionQuery);e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=1!==i}else{if(e.occlusionInternalRetryCounter++,!(-1!==e.occlusionRetryCount&&e.occlusionInternalRetryCounter>e.occlusionRetryCount))return!1;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==o.a.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}var n,r=this.getScene();return r.getBoundingBoxRenderer&&(n=r.getBoundingBoxRenderer(),this._occlusionQuery||(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery),n.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0),e.isOccluded};var s=!0;n.a.prototype.createTransformFeedback=function(){return this._gl.createTransformFeedback()},n.a.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},n.a.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},n.a.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},n.a.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},n.a.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},n.a.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)},i(319),i(130),i(202),i(228),i(314),i(229),i(176),i(200),i(307),i(304);var c=function(){};function l(i){if(this._excludedCompressedTextures&&this._excludedCompressedTextures.some(function(e){var t="\\b"+e+"\\b";return i&&(i===e||i.match(new RegExp(t,"g")))}))return i;var e=i.lastIndexOf(".");return(-1<e?i.substring(0,e):i)+this._textureFormatInUse}n.a.prototype.getInputElement=function(){return this.inputElement||this.getRenderingCanvas()},n.a.prototype.registerView=function(e,t){var i=this;this.views||(this.views=[]);for(var n=0,r=this.views;n<r.length;n++){var o=r[n];if(o.target===e)return o}var a=this.getRenderingCanvas();a&&(e.width=a.width,e.height=a.height);var s={target:e,camera:t};return this.views.push(s),t&&t.onDisposeObservable.add(function(){i.unRegisterView(e)}),s},n.a.prototype.unRegisterView=function(e){if(!this.views)return this;for(var t=0,i=this.views;t<i.length;t++){var n=i[t];if(n.target===e){var r=this.views.indexOf(n);-1!==r&&this.views.splice(r,1);break}}return this},n.a.prototype._renderViews=function(){if(!this.views)return!1;var e=this.getRenderingCanvas();if(!e)return!1;for(var t=0,i=this.views;t<i.length;t++){var n=i[t],r=n.target,o=r.getContext("2d");if(o){var a=n.camera,s=null,c=null;if(a){if((c=a.getScene()).activeCameras.length)continue;this.activeView=n,s=c.activeCamera,c.activeCamera=a}var l=r.width!==r.clientWidth||r.height!==r.clientHeight;if(r.clientWidth&&r.clientHeight&&l&&(r.width=r.clientWidth,r.height=r.clientHeight,e.width=r.clientWidth,e.height=r.clientHeight,this.resize()),!e.width||!e.height)return!1;this._renderFrame(),o.drawImage(e,0,0),s&&c&&(c.activeCamera=s)}}return!(this.activeView=null)},i(216),Object.defineProperty(n.a.prototype,"texturesSupported",{get:function(){var e=new Array;return this._caps.astc&&e.push("-astc.ktx"),this._caps.s3tc&&e.push("-dxt.ktx"),this._caps.pvrtc&&e.push("-pvrtc.ktx"),this._caps.etc2&&e.push("-etc2.ktx"),this._caps.etc1&&e.push("-etc1.ktx"),e},enumerable:!0,configurable:!0}),Object.defineProperty(n.a.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse||null},enumerable:!0,configurable:!0}),n.a.prototype.setCompressedTextureExclusions=function(e){this._excludedCompressedTextures=e},n.a.prototype.setTextureFormatToUse=function(e){for(var t=this.texturesSupported,i=0,n=t.length;i<n;i++)for(var r=0,o=e.length;r<o;r++)if(t[i]===e[r].toLowerCase())return this._transformTextureUrl=l.bind(this),this._textureFormatInUse=t[i];return delete this._textureFormatInUse,delete this._transformTextureUrl,null}},function(e,t,i){"use strict";i.d(t,"b",function(){return r}),i.d(t,"f",function(){return o}
1),i.d(t,"a",function(){return _}),i.d(t,"d",function(){return fe.b}),i.d(t,"c",function(){return fe.a}),i.d(t,"e",function(){return s.a});var n=i(12),r=(c.prototype.displayLoadingUI=function(){var e,t,i,n,r,o,a,s;this._loadingDiv||(this._loadingDiv=document.createElement("div"),this._loadingDiv.id="babylonjsLoadingDiv",this._loadingDiv.style.opacity="0",this._loadingDiv.style.transition="opacity 1.5s ease",this._loadingDiv.style.pointerEvents="none",this._loadingTextDiv=document.createElement("div"),this._loadingTextDiv.style.position="absolute",this._loadingTextDiv.style.left="0",this._loadingTextDiv.style.top="50%",this._loadingTextDiv.style.marginTop="80px",this._loadingTextDiv.style.width="100%",this._loadingTextDiv.style.height="20px",this._loadingTextDiv.style.fontFamily="Arial",this._loadingTextDiv.style.fontSize="14px",this._loadingTextDiv.style.color="white",this._loadingTextDiv.style.textAlign="center",this._loadingTextDiv.innerHTML="Loading",this._loadingDiv.appendChild(this._loadingTextDiv),this._loadingTextDiv.innerHTML=this._loadingText,(e=document.createElement("style")).type="text/css",e.innerHTML="@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\n 100% { -webkit-transform: rotate(360deg);}\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\n 100% { transform: rotate(360deg);}\n }",document.getElementsByTagName("head")[0].appendChild(e),t=!!window.SVGSVGElement,(i=new Image).src=c.DefaultLogoUrl?c.DefaultLogoUrl:t?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+":"https://cdn.babylonjs.com/Assets/babylonLogo.png",i.style.position="absolute",i.style.left="40%",i.style.top="40%",i.style.width="20%",i.style.height="20%",(n=new Image).src=c.DefaultSpinnerUrl?c.DefaultSpinnerUrl:t?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==":"https://cdn.babylonjs.com/Assets/loadingIcon.png",n.style.position="absolute",n.style.left="30%",n.style.top="30%",n.style.width="40%",n.style.height="40%",n.style.animation="spin1 0.75s infinite linear",n.style.webkitAnimation="spin1 0.75s infinite linear",n.style.transformOrigin="50% 50%",n.style.webkitTransformOrigin="50% 50%",t||(r=16,o=18.5,s=a=30,i.style.width=r+"vh",i.style.height=o+"vh",i.style.left="calc(50% - "+r/2+"vh)",i.style.top="calc(50% - "+o/2+"vh)",n.style.width=a+"vh",n.style.height=s+"vh",n.style.left="calc(50% - "+a/2+"vh)",n.style.top="calc(50% - "+s/2+"vh)"),this._loadingDiv.appendChild(i),this._loadingDiv.appendChild(n),this._resizeLoadingUI(),window.addEventListener("resize",this._resizeLoadingUI),this._loadingDiv.style.backgroundColor=this._loadingDivBackgroun
1dColor,document.body.appendChild(this._loadingDiv),this._loadingDiv.style.opacity="1")},c.prototype.hideLoadingUI=function(){var e=this;this._loadingDiv&&(this._loadingDiv.style.opacity="0",this._loadingDiv.addEventListener("transitionend",function(){e._loadingDiv&&(e._loadingDiv.parentElement&&e._loadingDiv.parentElement.removeChild(e._loadingDiv),window.removeEventListener("resize",e._resizeLoadingUI),e._loadingDiv=null)}))},Object.defineProperty(c.prototype,"loadingUIText",{get:function(){return this._loadingText},set:function(e){this._loadingText=e,this._loadingTextDiv&&(this._loadingTextDiv.innerHTML=this._loadingText)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"loadingUIBackgroundColor",{get:function(){return this._loadingDivBackgroundColor},set:function(e){this._loadingDivBackgroundColor=e,this._loadingDiv&&(this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor)},enumerable:!1,configurable:!0}),c.DefaultLogoUrl="",c.DefaultSpinnerUrl="",c);function c(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="black"),this._renderingCanvas=e,this._loadingText=t,this._loadingDivBackgroundColor=i,this._resizeLoadingUI=function(){var e=n._renderingCanvas.getBoundingClientRect(),t=window.getComputedStyle(n._renderingCanvas).position;n._loadingDiv&&(n._loadingDiv.style.position="fixed"===t?"fixed":"absolute",n._loadingDiv.style.left=e.left+"px",n._loadingDiv.style.top=e.top+"px",n._loadingDiv.style.width=e.width+"px",n._loadingDiv.style.height=e.height+"px")}}n.a.DefaultLoadingScreenFactory=function(e){return new r(e)};function V(e,t,i,n){for(var r=0,o=t.materials.length;r<o;r++){var a=t.materials[r];if(a.id===e)return ce.a.Parse(a,i,n)}return null}function k(e,t,i){for(var n in t)if(e.name===t[n])return i.push(e.id),1;return!(!e.parentId||-1===i.indexOf(e.parentId)||(i.push(e.id),0))}function te(e,t){return e+" of "+(t?t.file+" from "+t.name+" version: "+t.version+", exporter version: "+t.exporter_version:"unknown")}function ie(e,t){var i=t;if(t._waitingData.lods){if(t._waitingData.lods.ids&&0<t._waitingData.lods.ids.length){var n=t._waitingData.lods.ids,r=i.isEnabled(!1);if(t._waitingData.lods.distances){var o=t._waitingData.lods.distances;if(o.length>=n.length){var a=o.length>n.length?o[o.length-1]:0;i.setEnabled(!1);for(var s=0;s<n.length;s++){var c=n[s],l=e.getMeshByID(c);null!=l&&i.addLODLevel(o[s],l)}0<a&&i.addLODLevel(a,null),!0===r&&i.setEnabled(!0)}else m.b.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}}function l(i,e,t,n,r){void 0===r&&(r=!1);var o=new _e.a(i),a="importScene has failed JSON parse";try{var s,c,l,u,h,d,p,f,m,_=JSON.parse(e),a="",g=fe.a.loggingLevel===fe.a.DETAILED_LOGGING;if(void 0!==_.environmentTexture&&null!==_.environmentTexture&&(l=void 0===_.isPBR||_.isPBR,_.environmentTextureType&&"BABYLON.HDRCubeTexture"===_.environmentTextureType?(u=_.environmentTextureSize?_.environmentTextureSize:128,h=new he.a((_.environmentTexture.match(/https?:\/\//g)?"":t)+_.environmentTexture,i,u,!0,!l),_.environmentTextureRotationY&&(h.rotationY=_.environmentTextureRotationY),i.environmentTexture=h):Ee.a.EndsWith(_.environmentTexture,".env")?(d=new ue.a((_.environmentTexture.match(/https?:\/\//g)?"":t)+_.environmentTexture,i),_.environmentTextureRotationY&&(d.rotationY=_.environmentTextureRotationY),i.environmentTexture=d):(p=ue.a.CreateFromPrefilteredData((_.environmentTexture.match(/https?:\/\//g)?"":t)+_.environmentTexture,i),_.environmentTextureRotationY&&(p.rotationY=_.environmentTextureRotationY),i.environmentTexture=p),!0===_.createDefaultSkybox&&(f=void 0!==i.activeCamera&&null!==i.activeCamera?(i.activeCamera.maxZ-i.activeCamera.minZ)/2:1e3,m=_.skyboxBlurLevel||0,i.createDefaultSkybox(i.environmentTexture,l,f,m)),o.environmentTexture=i.environmentTexture),void 0!==_.environmentIntensity&&null!==_.environmentIntensity&&(i.environmentIntensity=_.environmentIntensity),void 0!==_.lights&&null!==_.lights)for(s=0,c=_.lights.length;s<c;s++){var v=_.lights[s],b=pe.a.Parse(v,i);b&&(o.lights.push(b),a+=0===s?"\n\tLights:":"",a+="\n\t\t"+b.toString(g))}if(void 0!==_.reflectionProbes&&null!==_.reflectionProbes)for(s=0,c=_.reflectionProbes.length;s<c;s++){var y=_.reflectionProbes[s],T=ye.a.Parse(y,i,t);T&&(o.reflectionProbes.push(T),a+=0===s?"\n\tReflection Probes:":"",a+="\n\t\t"+T.toString(g))}if(void 0!==_.animations&&null!==_.animations)for(s=0,c=_.animations.length;s<c;s++){var E,S=_.animations[s],A=Te.a.GetClass("BABYLON.Animation");A&&(E=A.Parse(S),i.animations.push(E),o.animations.push(E),a+=0===s?"\n\tAnimations:":"",a+="\n\t\t"+E.toString(g))}if(void 0!==_.materials&&null!==_.materials)for(s=0,c=_.materials.length;s<c;s++){var C=_.materials[s],P=ce.a.Parse(C,i,t);P&&(o.materials.push(P),a+=0===s?"\n\tMaterials:":"",a+="\n\t\t"+P.toString(g),P.getActiveTextures().forEac
1h(function(e){-1==o.textures.indexOf(e)&&o.textures.push(e)}))}if(void 0!==_.multiMaterials&&null!==_.multiMaterials)for(s=0,c=_.multiMaterials.length;s<c;s++){var x=_.multiMaterials[s],R=le.a.ParseMultiMaterial(x,i);o.multiMaterials.push(R),a+=0===s?"\n\tMultiMaterials:":"",a+="\n\t\t"+R.toString(g),R.getActiveTextures().forEach(function(e){-1==o.textures.indexOf(e)&&o.textures.push(e)})}if(void 0!==_.morphTargetManagers&&null!==_.morphTargetManagers)for(var O=0,M=_.morphTargetManagers;O<M.length;O++){var I=M[O];o.morphTargetManagers.push(be.a.Parse(I,i))}if(void 0!==_.skeletons&&null!==_.skeletons)for(s=0,c=_.skeletons.length;s<c;s++){var D=_.skeletons[s],L=ve.a.Parse(D,i);o.skeletons.push(L),a+=0===s?"\n\tSkeletons:":"",a+="\n\t\t"+L.toString(g)}var N=_.geometries;if(null!=N){var F=new Array,w=N.vertexData;if(null!=w)for(s=0,c=w.length;s<c;s++){var B=w[s];F.push(ae.a.Parse(B,i,t))}F.forEach(function(e){e&&o.geometries.push(e)})}if(void 0!==_.transformNodes&&null!==_.transformNodes)for(s=0,c=_.transformNodes.length;s<c;s++){var U=_.transformNodes[s],V=se.a.Parse(U,i,t);o.transformNodes.push(V)}if(void 0!==_.meshes&&null!==_.meshes)for(s=0,c=_.meshes.length;s<c;s++){var k=_.meshes[s],G=oe.a.Parse(k,i,t);o.meshes.push(G),a+=0===s?"\n\tMeshes:":"",a+="\n\t\t"+G.toString(g)}if(void 0!==_.cameras&&null!==_.cameras)for(s=0,c=_.cameras.length;s<c;s++){var z=_.cameras[s],j=re.a.Parse(z,i);o.cameras.push(j),a+=0===s?"\n\tCameras:":"",a+="\n\t\t"+j.toString(g)}if(void 0!==_.animationGroups&&null!==_.animationGroups)for(s=0,c=_.animationGroups.length;s<c;s++){var W=_.animationGroups[s],H=de.a.Parse(W,i);o.animationGroups.push(H),a+=0===s?"\n\tAnimationGroups:":"",a+="\n\t\t"+H.toString(g)}for(s=0,c=i.cameras.length;s<c;s++)(j=i.cameras[s])._waitingParentId&&(j.parent=i.getLastEntryByID(j._waitingParentId),j._waitingParentId=null);for(s=0,c=i.lights.length;s<c;s++){var X=i.lights[s];X&&X._waitingParentId&&(X.parent=i.getLastEntryByID(X._waitingParentId),X._waitingParentId=null)}for(s=0,c=i.transformNodes.length;s<c;s++){var Y=i.transformNodes[s];Y._waitingParentId&&(Y.parent=i.getLastEntryByID(Y._waitingParentId),Y._waitingParentId=null)}for(s=0,c=i.meshes.length;s<c;s++)(G=i.meshes[s])._waitingParentId&&(G.parent=i.getLastEntryByID(G._waitingParentId),G._waitingParentId=null),G._waitingData.lods&&ie(i,G);for(s=0,c=i.skeletons.length;s<c;s++)(L=i.skeletons[s])._hasWaitingData&&(null!=L.bones&&L.bones.forEach(function(e){var t;e._waitingTransformNodeId&&((t=i.getLastEntryByID(e._waitingTransformNodeId))&&e.linkTransformNode(t),e._waitingTransformNodeId=null)}),L._hasWaitingData=null);for(s=0,c=i.meshes.length;s<c;s++){var K=i.meshes[s];K._waitingData.freezeWorldMatrix?(K.freezeWorldMatrix(),K._waitingData.freezeWorldMatrix=null):K.computeWorldMatrix(!0)}for(s=0,c=i.lights.length;s<c;s++){var Q=i.lights[s];if(0<Q._excludedMeshesIds.length){for(var q=0;q<Q._excludedMeshesIds.length;q++){var Z=i.getMeshByID(Q._excludedMeshesIds[q]);Z&&Q.excludedMeshes.push(Z)}Q._excludedMeshesIds=[]}if(0<Q._includedOnlyMeshesIds.length){for(var J=0;J<Q._includedOnlyMeshesIds.length;J++){var $=i.getMeshByID(Q._includedOnlyMeshesIds[J]);$&&Q.includedOnlyMeshes.push($)}Q._includedOnlyMeshesIds=[]}}for(me.a.Parse(_,i,o,t),s=0,c=i.meshes.length;s<c;s++)(G=i.meshes[s])._waitingData.actions&&(ge.a.Parse(G._waitingData.actions,G,i),G._waitingData.actions=null);void 0!==_.actions&&null!==_.actions&&ge.a.Parse(_.actions,null,i)}catch(i){var ee=te("loadAssets",_?_.producer:"Unknown")+a;if(!n)throw ne.a.Log(ee),i;n(ee,i)}finally{r||o.removeAllFromScene(),null!==a&&fe.a.loggingLevel!==fe.a.NO_LOGGING&&ne.a.Log(te("loadAssets",_?_.producer:"Unknown")+(fe.a.loggingLevel!==fe.a.MINIMAL_LOGGING?a:""))}return o}var ne=i(7),re=i(25),u=i(0),h=i(10),oe=i(8),ae=i(95),se=i(51),ce=i(29),le=i(98),ue=i(86),he=i(185),de=i(180),pe=i(63),G=i(17),fe=i(36),me=i(42),_e=i(245),ge=i(205),ve=i(206),be=i(213),d=i(285),p=i(286),f=i(287),ye=i(288),Te=i(11),m=i(13),Ee=i(41),o=!0,_=(a.LoaderInjectedPhysicsEngine=void 0,a);function a(){}fe.a.RegisterPlugin({name:"babylon.js",extensions:".babylon",canDirectLoad:function(e){return-1!==e.indexOf("babylon")},importMesh:function(e,i,t,n,r,o,a,s){var c="importMesh has failed JSON parse";try{var l=JSON.parse(t),c="",u=fe.a.loggingLevel===fe.a.DETAILED_LOGGING;e?Array.isArray(e)||(e=[e]):e=null;var h=new Array;
1if(void 0!==l.meshes&&null!==l.meshes){for(var d,p=[],f=[],m=0,_=l.meshes.length;m<_;m++){var g,v=l.meshes[m];if(null===e||k(v,e,h)){if(null!==e&&delete e[e.indexOf(v.name)],void 0!==v.geometryId&&null!==v.geometryId&&void 0!==l.geometries&&null!==l.geometries&&(g=!1,["boxes","spheres","cylinders","toruses","grounds","planes","torusKnots","vertexData"].forEach(function(t){!0!==g&&l.geometries[t]&&Array.isArray(l.geometries[t])&&l.geometries[t].forEach(function(e){if(e.id===v.geometryId){switch(t){case"vertexData":ae.a.Parse(e,i,n)}g=!0}})}),!1===g&&ne.a.Warn("Geometry not found for mesh "+v.id)),v.materialId){var b=-1!==f.indexOf(v.materialId);if(!1===b&&void 0!==l.multiMaterials&&null!==l.multiMaterials)for(var y=0,T=l.multiMaterials.length;y<T;y++){var E=l.multiMaterials[y];if(E.id===v.materialId){for(var S=0,A=E.materials.length;S<A;S++){var C,P=E.materials[S];f.push(P),(C=V(P,l,i,n))&&(c+="\n\tMaterial "+C.toString(u))}f.push(E.id);var x=le.a.ParseMultiMaterial(E,i);x&&(b=!0,c+="\n\tMulti-Material "+x.toString(u));break}}!1===b&&(f.push(v.materialId),(C=V(v.materialId,l,i,n))?c+="\n\tMaterial "+C.toString(u):ne.a.Warn("Material not found for mesh "+v.id))}if(-1<v.skeletonId&&void 0!==l.skeletons&&null!==l.skeletons&&!1==-1<p.indexOf(v.skeletonId))for(var R=0,O=l.skeletons.length;R<O;R++){var M,I=l.skeletons[R];I.id===v.skeletonId&&(M=ve.a.Parse(I,i),a.push(M),p.push(I.id),c+="\n\tSkeleton "+M.toString(u))}if(void 0!==l.morphTargetManagers&&null!==l.morphTargetManagers)for(var D=0,L=l.morphTargetManagers;D<L.length;D++){var N=L[D];be.a.Parse(N,i)}var F=oe.a.Parse(v,i,n);r.push(F),c+="\n\tMesh "+F.toString(u)}}for(m=0,_=i.meshes.length;m<_;m++)(d=i.meshes[m])._waitingParentId&&(d.parent=i.getLastEntryByID(d._waitingParentId),d._waitingParentId=null),d._waitingData.lods&&ie(i,d);for(m=0,_=i.skeletons.length;m<_;m++)(M=i.skeletons[m])._hasWaitingData&&(null!=M.bones&&M.bones.forEach(function(e){var t;e._waitingTransformNodeId&&((t=i.getLastEntryByID(e._waitingTransformNodeId))&&e.linkTransformNode(t),e._waitingTransformNodeId=null)}),M._hasWaitingData=null);for(m=0,_=i.meshes.length;m<_;m++)(d=i.meshes[m])._waitingData.freezeWorldMatrix?(d.freezeWorldMatrix(),d._waitingData.freezeWorldMatrix=null):d.computeWorldMatrix(!0)}if(void 0!==l.particleSystems&&null!==l.particleSystems){var w=me.a.GetIndividualParser(G.a.NAME_PARTICLESYSTEM);if(w)for(m=0,_=l.particleSystems.length;m<_;m++){var B=l.particleSystems[m];-1!==h.indexOf(B.emitterId)&&o.push(w(B,i,n))}}return!0}catch(e){var U=te("importMesh",l?l.producer:"Unknown")+c;if(!s)throw ne.a.Log(U),e;s(U,e)}finally{null!==c&&fe.a.loggingLevel!==fe.a.NO_LOGGING&&ne.a.Log(te("importMesh",l?l.producer:"Unknown")+(fe.a.loggingLevel!==fe.a.MINIMAL_LOGGING?c:""))}return!1},load:function(e,t,i,n){var r="importScene has failed JSON parse";try{var o,a,s=JSON.parse(t),r="";if(void 0!==s.useDelayedTextureLoading&&null!==s.useDelayedTextureLoading&&(e.useDelayedTextureLoading=s.useDelayedTextureLoading&&!fe.a.ForceFullSceneLoadingForIncremental),void 0!==s.autoClear&&null!==s.autoClear&&(e.autoClear=s.autoClear),void 0!==s.clearColor&&null!==s.clearColor&&(e.clearColor=h.b.FromArray(s.clearColor)),void 0!==s.ambientColor&&null!==s.ambientColor&&(e.ambientColor=h.a.FromArray(s.ambientColor)),void 0!==s.gravity&&null!==s.gravity&&(e.gravity=u.e.FromArray(s.gravity)),s.fogMode&&0!==s.fogMode)switch(e.fogMode=s.fogMode,e.fogColor=h.a.FromArray(s.fogColor),e.fogStart=s.fogStart,e.fogEnd=s.fogEnd,e.fogDensity=s.fogDensity,r+="\tFog mode for scene: ",e.fogMode){case 1:r+="exp\n";break;case 2:r+="exp2\n";break;case 3:r+="linear\n"}return s.physicsEnabled&&("cannon"===s.physicsEngine?o=new d.a(void 0,void 0,_.LoaderInjectedPhysicsEngine):"oimo"===s.physicsEngine?o=new p.a(void 0,_.LoaderInjectedPhysicsEngine):"ammo"===s.physicsEngine&&(o=new f.a(void 0,_.LoaderInjectedPhysicsEngine,void 0)),r="\tPhysics engine "+(s.physicsEngine?s.physicsEngine:"oimo")+" enabled\n",a=s.physicsGravity?u.e.FromArray(s.physicsGravity):null,e.enablePhysics(a,o)),void 0!==s.metadata&&null!==s.metadata&&(e.metadata=s.metadata),void 0!==s.collisionsEnabled&&null!==s.collisionsEnabled&&(e.collisionsEnabled=s.collisionsEnabled),!!l(e,t,i,n,!0)&&(s.autoAnimate&&e.beginAnimation(e,s.autoAnimateFrom,s.autoAnimateTo,s.autoAnimateLoop,s.autoAnimateSpeed||1),void 0!==s.activeCameraID&&null!==s.activeCameraID&&e.setActiveCameraByID(s.activeCameraID),!0)}catch(e){var c=te("importScene",s?s.producer:"Unknown")+r;if(!n)throw ne.a.Log(c),e;n(c,e)}finally{null!==r&&fe.a.loggingLevel!==fe.a.NO_LOGGING&&ne.a.Log(te("importScene",s?s.producer:"Unknown")+(fe.a.loggingLevel!==fe.a.MINI
1MAL_LOGGING?r:""))}return!1},loadAssetContainer:function(e,t,i,n){return l(e,t,i,n)}});var s=i(93)},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return a}),i.d(t,"c",function(){return c}),i.d(t,"d",function(){return s.a}),i.d(t,"e",function(){return l.a});function n(e,t,i,n){void 0===t&&(t=new o.e),void 0===i&&(i=0),void 0===n&&(n=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=n}var o=i(0),r=(d.prototype.init=function(){},d.prototype._closestFace=function(t){var i=this;return this._faceVectors.forEach(function(e){i._target.rotationQuaternion||(i._target.rotationQuaternion=o.b.RotationYawPitchRoll(i._target.rotation.y,i._target.rotation.x,i._target.rotation.z)),i._target.rotationQuaternion.toRotationMatrix(i._tmpMatrix),o.e.TransformCoordinatesToRef(e.direction,i._tmpMatrix,e.rotatedDirection),e.diff=o.e.GetAngleBetweenVectors(e.rotatedDirection,t,o.e.Cross(e.rotatedDirection,t))}),this._faceVectors.reduce(function(e,t){return!e.ignore&&(t.ignore||e.diff<t.diff)?e:t},this._faceVectors[0])},d.prototype._lookAtToRef=function(e,t,i){void 0===t&&(t=new o.e(0,1,0)),o.a.LookAtLHToRef(this._zeroVector,e,t,this._lookAtTmpMatrix),this._lookAtTmpMatrix.invert(),o.b.FromRotationMatrixToRef(this._lookAtTmpMatrix,i)},d.prototype.attach=function(n){var r=this;this._target=n,this._scene=this._target.getScene(),this._onRenderObserver=this._scene.onBeforeRenderObservable.add(function(){var e,t,i;r._scene.activeCamera&&(e=r._scene.activeCamera.position,r._scene.activeCamera.devicePosition&&(e=r._scene.activeCamera.devicePosition),t=r._closestFace(e.subtract(n.position)),r._scene.activeCamera.leftCamera?r._scene.activeCamera.leftCamera.computeWorldMatrix().getRotationMatrixToRef(r._tmpMatrix):r._scene.activeCamera.computeWorldMatrix().getRotationMatrixToRef(r._tmpMatrix),o.e.TransformCoordinatesToRef(o.e.Up(),r._tmpMatrix,r._tmpVector),r._faceVectors.forEach(function(e){t.direction.x&&e.direction.x&&(e.ignore=!0),t.direction.y&&e.direction.y&&(e.ignore=!0),t.direction.z&&e.direction.z&&(e.ignore=!0)}),i=r._closestFace(r._tmpVector),r._faceVectors.forEach(function(e){e.ignore=!1}),r.ui.position.copyFrom(n.position),t.direction.x&&(t.rotatedDirection.scaleToRef(n.scaling.x/2+r.distanceAwayFromFace,r._tmpVector),r.ui.position.addInPlace(r._tmpVector)),t.direction.y&&(t.rotatedDirection.scaleToRef(n.scaling.y/2+r.distanceAwayFromFace,r._tmpVector),r.ui.position.addInPlace(r._tmpVector)),t.direction.z&&(t.rotatedDirection.scaleToRef(n.scaling.z/2+r.distanceAwayFromFace,r._tmpVector),r.ui.position.addInPlace(r._tmpVector)),r.ui.rotationQuaternion||(r.ui.rotationQuaternion=o.b.RotationYawPitchRoll(r.ui.rotation.y,r.ui.rotation.x,r.ui.rotation.z)),t.rotatedDirection.scaleToRef(-1,r._tmpVector),r._lookAtToRef(r._tmpVector,i.rotatedDirection,r.ui.rotationQuaternion),i.direction.x&&r.ui.up.scaleToRef(r.distanceAwayFromBottomOfFace-n.scaling.x/2,r._tmpVector),i.direction.y&&r.ui.up.scaleToRef(r.distanceAwayFromBottomOfFace-n.scaling.y/2,r._tmpVector),i.direction.z&&r.ui.up.scaleToRef(r.distanceAwayFromBottomOfFace-n.scaling.z/2,r._tmpVector),r.ui.position.addInPlace(r._tmpVector))})},d.prototype.detach=function(){this._scene.onBeforeRenderObservable.remove(this._onRenderObserver)},d),a=(Object.defineProperty(h.prototype,"name",{get:function(){return"FadeInOut"},enumerable:!1,configurable:!0}),h.prototype.init=function(){},h.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},h.prototype.detach=function(){this._ownerNode=null},h.prototype.fadeIn=function(e){this._hovered=e,this._update()},h.prototype._setAllVisibility=function(e,t){var i=this;e.visibility=t,e.getChildMeshes().forEach(function(e){i._setAllVisibility(e,t)})},h),s=i(81),c=(Object.defineProperty(u.prototype,"name",{get:function(){return"MultiPointerScale"},enumerable:!1,configurable:!0}),u.prototype.init=function(){},u.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},u.prototype.attach=function(t){var i=this;this._ownerNode=t,this._dragBehaviorA.onDragStartObservable.add(function(e){i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging&&(i._dragBehaviorA.currentDraggingPointerID==i._dragBehaviorB.currentDraggingPointerID?i._dragBehaviorA.releaseDrag():(i._initialScale.copyFrom(t.scaling),i._startDistance=i._getCurrentDistance()))}),this._dragBehaviorB.onDragStartObservable.add(function(e){i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging&&(i._dragBehaviorA.currentDraggingPointerID==i._dragBehaviorB.currentDraggingPointerID?i._dragBehaviorB.releaseDrag():(i._initialScale.copyFrom(t.scaling),i._startDistance=i._getCurrentDistance()))}
1),[this._dragBehaviorA,this._dragBehaviorB].forEach(function(e){e.onDragObservable.add(function(){var e;i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging&&(e=i._getCurrentDistance()/i._startDistance,i._initialScale.scaleToRef(e,i._targetScale))})}),t.addBehavior(this._dragBehaviorA),t.addBehavior(this._dragBehaviorB),this._sceneRenderObserver=t.getScene().onBeforeRenderObservable.add(function(){var e;i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging&&.01<(e=i._targetScale.subtract(t.scaling).scaleInPlace(.1)).length()&&t.scaling.addInPlace(e)})},u.prototype.detach=function(){var t=this;this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),[this._dragBehaviorA,this._dragBehaviorB].forEach(function(e){e.onDragStartObservable.clear(),e.onDragObservable.clear(),t._ownerNode.removeBehavior(e)})},u),l=i(250);function u(){this._startDistance=0,this._initialScale=new o.e(0,0,0),this._targetScale=new o.e(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new s.a({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new s.a({}),this._dragBehaviorB.moveAttached=!1}function h(){var e=this;this.delay=0,this.fadeInTime=300,this._millisecondsPerFrame=1e3/60,this._hovered=!1,this._hoverValue=0,this._ownerNode=null,this._update=function(){if(e._ownerNode){if(e._hoverValue+=e._hovered?e._millisecondsPerFrame:-e._millisecondsPerFrame,e._setAllVisibility(e._ownerNode,(e._hoverValue-e.delay)/e.fadeInTime),1<e._ownerNode.visibility)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)}}}function d(e){this.ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new n(o.e.Up()),new n(o.e.Down()),new n(o.e.Left()),new n(o.e.Right()),new n(o.e.Forward()),new n(o.e.Forward().scaleInPlace(-1))],this._tmpMatrix=new o.a,this._tmpVector=new o.e,this._zeroVector=o.e.Zero(),this._lookAtTmpMatrix=new o.a}},function(e,t,i){"use strict";i.d(t,"d",function(){return o.b}),i.d(t,"a",function(){return o.a}),i.d(t,"b",function(){return l}),i.d(t,"c",function(){return u.a}),i.d(t,"e",function(){return d}),i.d(t,"f",function(){return _});var n,r,o=i(65),a=i(1),s=i(3),c=i(10),l=(r=o.a,Object(a.d)(f,r),Object.defineProperty(f.prototype,"doubleSided",{get:function(){return this._twoSidedLighting},set:function(e){this._twoSidedLighting!==e&&(this._twoSidedLighting=e,this.backFaceCulling=!e,this._markAllSubMeshesAsTexturesDirty())},enumerable:!1,configurable:!0}),f.prototype.getClassName=function(){return"PBRBaseSimpleMaterial"},Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsLightsDirty")],f.prototype,"maxSimultaneousLights",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsLightsDirty")],f.prototype,"disableLighting",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_reflectionTexture")],f.prototype,"environmentTexture",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty")],f.prototype,"invertNormalMapX",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty")],f.prototype,"invertNormalMapY",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_bumpTexture")],f.prototype,"normalTexture",void 0),Object(a.c)([Object(s.e)("emissive"),Object(s.b)("_markAllSubMeshesAsTexturesDirty")],f.prototype,"emissiveColor",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty")],f.prototype,"emissiveTexture",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_ambientTextureStrength")],f.prototype,"occlusionStrength",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_ambientTexture")],f.prototype,"occlusionTexture",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_alphaCutOff")],f.prototype,"alphaCutOff",void 0),Object(a.c)([Object(s.c)()],f.prototype,"doubleSided",null),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty",null)],f.prototype,"lightmapTexture",void 0),Object(a.c)([Object(s.c)(),Ob
1ject(s.b)("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useLightmapAsShadowmap",void 0),f),u=i(169),h=i(11),d=(n=l,Object(a.d)(p,n),p.prototype.getClassName=function(){return"PBRMetallicRoughnessMaterial"},p.prototype.clone=function(e){var t=this,i=s.a.Clone(function(){return new p(e,t.getScene())},this);return i.id=e,i.name=e,this.clearCoat.copyTo(i.clearCoat),this.anisotropy.copyTo(i.anisotropy),this.brdf.copyTo(i.brdf),this.sheen.copyTo(i.sheen),this.subSurface.copyTo(i.subSurface),i},p.prototype.serialize=function(){var e=s.a.Serialize(this);return e.customType="BABYLON.PBRMetallicRoughnessMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},p.Parse=function(e,t,i){var n=s.a.Parse(function(){return new p(e.name,t)},e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),n},Object(a.c)([Object(s.e)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_albedoColor")],p.prototype,"baseColor",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],p.prototype,"baseTexture",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty")],p.prototype,"metallic",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty")],p.prototype,"roughness",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_metallicTexture")],p.prototype,"metallicRoughnessTexture",void 0),p);function p(e,t){var i=n.call(this,e,t)||this;return i._useRoughnessFromMetallicTextureAlpha=!1,i._useRoughnessFromMetallicTextureGreen=!0,i._useMetallnessFromMetallicTextureBlue=!0,i.metallic=1,i.roughness=1,i}function f(e,t){var i=r.call(this,e,t)||this;return i.maxSimultaneousLights=4,i.disableLighting=!1,i.invertNormalMapX=!1,i.invertNormalMapY=!1,i.emissiveColor=new c.a(0,0,0),i.occlusionStrength=1,i.useLightmapAsShadowmap=!1,i._useAlphaFromAlbedoTexture=!0,i._useAmbientInGrayScale=!0,i}h.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessMaterial"]=d;var m,_=(m=l,Object(a.d)(g,m),g.prototype.getClassName=function(){return"PBRSpecularGlossinessMaterial"},g.prototype.clone=function(e){var t=this,i=s.a.Clone(function(){return new g(e,t.getScene())},this);return i.id=e,i.name=e,this.clearCoat.copyTo(i.clearCoat),this.anisotropy.copyTo(i.anisotropy),this.brdf.copyTo(i.brdf),this.sheen.copyTo(i.sheen),this.subSurface.copyTo(i.subSurface),i},g.prototype.serialize=function(){var e=s.a.Serialize(this);return e.customType="BABYLON.PBRSpecularGlossinessMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},g.Parse=function(e,t,i){var n=s.a.Parse(function(){return new g(e.name,t)},e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),n},Object(a.c)([Object(s.e)("diffuse"),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_albedoColor")],g.prototype,"diffuseColor",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],g.prototype,"diffuseTexture",void 0),Object(a.c)([Object(s.e)("specular"),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_reflectivityColor")],g.prototype,"specularColor",void 0),Object(a.c)([Object(s.c)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_microSurface")],g.prototype,"glossiness",void 0),Object(a.c)([Object(s.m)(),Object(s.b)("_markAllSubMeshesAsTexturesDirty","_reflectivityTexture")],g.prototype,"specularGlossinessTexture",void 0),g);function g(e,t){var i=m.call(this,e,t)||this;return i._useMicroSurfaceFromReflectivityMapAlpha=!0,i}h.a.RegisteredTypes["BABYLON.PBRSpecularGlossinessMaterial"]=_},function(e,t,i){"use strict";i.d(t,"a",function(){return h}),i.d(t,"b",function(){return _}),i.d(t,"c",function(){return l.a}),i.d(t,"d",function(){return v.a});var s,n=i(1),o=i(7),r=i(0),a=i(10),c=i(9),l=i(152),u=i(55),h=(s=l.a,Object(n.d)(f,s),f.prototype._loadJson=function(e){function t(){try{i.setFragment(i._texturePath)}catch(e){o.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture")}}var i=this,n=e+"/config.json",r=new u.a;r.open("GET",n),r.addEventListener("load",function(){if(200===r.
1status||r.responseText&&0<r.responseText.length)try{i._config=JSON.parse(r.response),i.updateShaderUniforms(),i.updateTextures(),i.setFragment(i._texturePath+"/custom"),i._animate=i._config.animate,i.refreshRate=i._config.refreshrate}catch(e){t()}else t()},!1),r.addEventListener("error",function(){t()},!1);try{r.send()}catch(e){o.a.Error("CustomProceduralTexture: Error on XHR send request.")}},f.prototype.isReady=function(){if(!s.prototype.isReady.call(this))return!1;for(var e in this._textures)if(!this._textures[e].isReady())return!1;return!0},f.prototype.render=function(e){var t=this.getScene();this._animate&&t&&(this._time+=.03*t.getAnimationRatio(),this.updateShaderUniforms()),s.prototype.render.call(this,e)},f.prototype.updateTextures=function(){for(var e=0;e<this._config.sampler2Ds.length;e++)this.setTexture(this._config.sampler2Ds[e].sample2Dname,new c.a(this._texturePath+"/"+this._config.sampler2Ds[e].textureRelativeUrl,this.getScene()))},f.prototype.updateShaderUniforms=function(){if(this._config)for(var e=0;e<this._config.uniforms.length;e++){var t=this._config.uniforms[e];switch(t.type){case"float":this.setFloat(t.name,t.value);break;case"color3":this.setColor3(t.name,new a.a(t.r,t.g,t.b));break;case"color4":this.setColor4(t.name,new a.b(t.r,t.g,t.b,t.a));break;case"vector2":this.setVector2(t.name,new r.d(t.x,t.y));break;case"vector3":this.setVector3(t.name,new r.e(t.x,t.y,t.z))}}this.setFloat("time",this._time)},Object.defineProperty(f.prototype,"animate",{get:function(){return this._animate},set:function(e){this._animate=e},enumerable:!1,configurable:!0}),f),d=i(22),p=i(11);function f(e,t,i,n,r,o){var a=s.call(this,e,i,null,n,r,o)||this;return a._animate=!0,a._time=0,a._texturePath=t,a._loadJson(t),a.refreshRate=1,a}i(5).a.ShadersStore.noisePixelShader="\n\nuniform float brightness;\nuniform float persistence;\nuniform float timeScale;\n\nvarying vec2 vUV;\n\nvec2 hash22(vec2 p)\n{\np=p*mat2(127.1,311.7,269.5,183.3);\np=-1.0+2.0*fract(sin(p)*43758.5453123);\nreturn sin(p*6.283+timeScale);\n}\nfloat interpolationNoise(vec2 p)\n{\nvec2 pi=floor(p);\nvec2 pf=p-pi;\nvec2 w=pf*pf*(3.-2.*pf);\nfloat f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));\nfloat f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));\nfloat f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));\nfloat f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));\nfloat xm1=mix(f00,f10,w.x);\nfloat xm2=mix(f01,f11,w.x);\nfloat ym=mix(xm1,xm2,w.y);\nreturn ym;\n}\nfloat perlinNoise2D(float x,float y)\n{\nfloat sum=0.0;\nfloat frequency=0.0;\nfloat amplitude=0.0;\nfor(int i=0; i<OCTAVES; i++)\n{\nfrequency=pow(2.0,float(i));\namplitude=pow(persistence,float(i));\nsum=sum+interpolationNoise(vec2(x*frequency,y*frequency))*amplitude;\n}\nreturn sum;\n}\n\nvoid main(void)\n{\nfloat x=abs(vUV.x);\nfloat y=abs(vUV.y);\nfloat noise=brightness+(1.0-brightness)*perlinNoise2D(x,y);\ngl_FragColor=vec4(noise,noise,noise,1.0);\n}\n";var m,_=(m=l.a,Object(n.d)(g,m),g.prototype._updateShaderUniforms=function(){var e=this.getScene();e&&(this._time+=e.getAnimationRatio()*this.animationSpeedFactor*.01,this.setFloat("brightness",this.brightness),this.setFloat("persistence",this.persistence),this.setFloat("timeScale",this._time))},g.prototype._getDefines=function(){return"#define OCTAVES "+(0|this.octaves)},g.prototype.render=function(e){this._updateShaderUniforms(),m.prototype.render.call(this,e)},g.prototype.serialize=function(){var e={customType:"BABYLON.NoiseProceduralTexture"};return e.brightness=this.brightness,e.octaves=this.octaves,e.persistence=this.persistence,e.animationSpeedFactor=this.animationSpeedFactor,e.size=this.getSize().width,e.generateMipMaps=this._generateMipMaps,e},g.prototype.clone=function(){var e=this.getSize(),t=new g(this.name,e.width,this.getScene(),this._fallbackTexture?this._fallbackTexture:void 0,this._generateMipMaps);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,t.brightness=this.brightness,t.octaves=this.octaves,t.persistence=this.persistence,t.animationSpeedFactor=this.animationSpeedFactor,t},g.Parse=function(e,t){var i=new g(e.name,e.size,t,void 0,e.generateMipMaps);return i.brightness=e.brightness,i.octaves=e.octaves,i.persistence=e.persistence,i.animationSpeedFactor=e.animationSpeedFactor,i},g);function g(e,t,i,n,r){void 0===t&&(t=256),void 0===i&&(i=d.a.LastCreatedScene);var o=m.call(this,e,t,"noise",i,n,r)||this;return o._time=0,o.brightness=.2,o.octaves=3,o.persistence=.8,o.animationSpeedFactor=1,o.autoClear=!1,o._updateShaderUniforms(),o}p.a.RegisteredTypes["BABYLON.NoiseProceduralTexture"]=_;var v=i(290)},function(e,t,i){"use strict";i.d(t,"a",function(){return n.a}),i.d(t,"b",function(){return a.a}),i.d(t,"c",function(){return s.a}),i.d(t,"d",function(){return c.a}),i.d(t,"f",function(){return l.a}),i.d(t,"u",function(){return l.d}),i.d(t,"m",function(){return l.b}),i.d(t,"q",function(){return l.c}),i.d(t,"t",function(){return u.j}),i.d(t,"o",function(){return u.g}),i.d(t,"p",function(){return u.h}),i.d(t,"i",function(){return u.d}),i.d(t,"k",function(){return u.e}),i.d(t,"r",function(){return u.i}),i.d(t,"g",function(){return u.b}),i.d(t,"e",function(){return u.a}),i.d(t,"h",function(){return u.c}),i.d(t,"n",function(){return u.f}),i.d(t,"l",function(){return p}),i.d(t,"s",function(){return f}),i.d(t,"j",function(){return S});var r,o,n=i(128),a=i(38),s=i(53),c=i(205),l=i(190),u=i(232),h=i(1),d=i(11),p=(o=a.a,Object(h.d)(_,o),_.prototype._prepare=function(){},_.prototype.execute=function(){void 0!==this._sound&&this._sound.play()},_.prototype.serialize=function(e){return o.prototype._serialize.call(this,{name:"PlaySoundAction",properties:[{name:"sound",value:this._sound.name}]},e)},_),f=(r=a.a,Object(h.d)(m,r),m.prototype._prepare=function(){},m.prototype.execute=function(){void 0!==this._sound&&this._sound.stop()},m.prototype.serialize=function(e){return r.prototype._serialize.call(this,{name:"StopSoundAction",properties:[{name:"sound",value:this._sound.name}]},e)},m);function m(e,t,i){var n=r.call(this,e,i)||this;return n._sound=t,n}function _(e,t,i){var n=o.call(this,e,i)||this;return n._sound=t,n}d.a.RegisteredTypes["BABYLON.PlaySoundAction"]=f,d.a.RegisteredTypes["BABYLON.StopSoundAction"]=f;var g,v=i(7),b=i(6),y=i(10),T=i(0),E=i(26),S=(g=a.a,Object(h.d)(A,g),A.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},A.prototype.execute=function(){var e,t=this,i=this._actionManager.getScene(),n=[{frame:0,value:this._effectiveTarget[this._property]},{frame:100,value:this.value}];if("number"==typeof this.value)e=E.a.ANIMATIONTYPE_FLOAT;else if(this.value instanceof y.a)e=E.a.ANIMATIONTYPE_COLOR3;else if(this.value instanceof T.e)e=E.a.ANIMATIONTYPE_VECTOR3;else if(this.value instanceof T.a)e=E.a.ANIMATIONTYPE_MATRIX;else{if(!(this.value instanceof T.b))return void v.a.Warn("InterpolateValueAction: Unsupported type ("+typeof this.value+")");e=E.a.ANIMATIONTYPE_QUATERNION}
1var r=new E.a("InterpolateValueAction",this._property,1e3/this.duration*100,e,E.a.ANIMATIONLOOPMODE_CONSTANT);r.setKeys(n),this.stopOtherAnimations&&i.stopAnimation(this._effectiveTarget),i.beginDirectAnimation(this._effectiveTarget,[r],0,100,!1,1,function(){t.onInterpolationDoneObservable.notifyObservers(t),t.onInterpolationDone&&t.onInterpolationDone()})},A.prototype.serialize=function(e){return g.prototype._serialize.call(this,{name:"InterpolateValueAction",properties:[a.a._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:a.a._SerializeValueAsString(this.value)},{name:"duration",value:a.a._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:a.a._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)},A);function A(e,t,i,n,r,o,a,s){void 0===r&&(r=1e3);var c=g.call(this,e,o)||this;return c.duration=1e3,c.onInterpolationDoneObservable=new b.c,c.propertyPath=i,c.value=n,c.duration=r,c.stopOtherAnimations=a,c.onInterpolationDone=s,c._target=c._effectiveTarget=t,c}d.a.RegisteredTypes["BABYLON.InterpolateValueAction"]=S},function(e,t,i){"use strict";i.d(t,"a",function(){return n.a}),i.d(t,"b",function(){return r}),i.d(t,"c",function(){return a}),i.d(t,"d",function(){return s.a});var n=i(166),R=i(0),O=i(24),r=(Object.defineProperty(b.prototype,"maxAngle",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!1,configurable:!0}),b.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))},b.prototype.update=function(){var e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m,_,g,v=this._bone1;v&&(e=this.targetPosition,t=this.poleTargetPosition,i=b._tmpMats[0],n=b._tmpMats[1],this.targetMesh&&e.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,t):this.poleTargetMesh&&R.e.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),t),r=b._tmpVecs[0],o=b._tmpVecs[1],a=b._tmpVecs[2],s=b._tmpVecs[3],c=b._tmpVecs[4],l=b._tmpQuat,v.getAbsolutePositionToRef(this.mesh,r),t.subtractToRef(r,c),0==c.x&&0==c.y&&0==c.z?c.y=1:c.normalize(),e.subtractToRef(r,s),s.normalize(),R.e.CrossToRef(s,c,o),o.normalize(),R.e.CrossToRef(s,o,a),a.normalize(),R.a.FromXYZAxesToRef(a,s,o,i),u=this._bone1Length,h=this._bone2Length,d=R.e.Distance(r,e),0<this._maxReach&&(d=Math.min(this._maxReach,d)),1<(p=(h*h+d*d-u*u)/(2*h*d))&&(p=1),1<(f=(d*d+u*u-h*h)/(2*d*u))&&(f=1),p<-1&&(p=-1),f<-1&&(f=-1),_=-Math.acos(p)-(m=Math.acos(f)),this._rightHandedSystem?(R.a.RotationYawPitchRollToRef(0,0,this._adjustRoll,n),n.multiplyToRef(i,i),R.a.RotationAxisToRef(this._bendAxis,m,n)):((g=b._tmpVecs[5]).copyFrom(this._bendAxis),g.x*=-1,R.a.RotationAxisToRef(g,-m,n)),n.multiplyToRef(i,i),this.poleAngle&&(R.a.RotationAxisToRef(s,this.poleAngle,n),i.multiplyToRef(n,i)),this._bone1&&(this.slerpAmount<1?(this._slerping||R.b.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),R.b.FromRotationMatrixToRef(i,l),R.b.SlerpToRef(this._bone1Quat,l,this.slerpAmount,this._bone1Quat),_=this._bone2Ang*(1-this.slerpAmount)+_*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,O.b.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(i,O.b.WORLD,this.mesh),this._bone1Mat.copyFrom(i),this._slerping=!1)),this._bone2.setAxisAngle(this._bendAxis,_,O.b.LOCAL),this._bone2Ang=_)},b._tmpVecs=[R.e.Zero(),R.e.Zero(),R.e.Zero(),R.e.Zero(),R.e.Zero(),R.e.Zero()],b._tmpQuat=R.b.Identity(),b._tmpMats=[R.a.Identity(),R.a.Identity()],b),o=i(50),a=(Object.defineProperty(M.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:!1,configurable:!0}),Object.defineProperty(M.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)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"minPitch",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"maxPitch",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),M.prototype.update=function(){var e,t,i,n,r,o,a,s,c,l,u,h,d,p,f,m,_,g,v,b,y,T,E,S,A,C,P,x;this.slerpAmount<1&&!this._firstFrameSkipped?this._firstFrameSkipped=!0:(e=this.bone,t=M._tmpVecs[0],e.getAbsolutePositionToRef(this.mesh,t),i=this.target,n=M._tmpMats[0],r=M._tmpMats[1],o=this.mesh,a=e.getParent(),(s=M._tmpVecs[1]).copyFrom(this.upAxis),this.upAxisSpace==O.b.BONE&&a?(this._transformYawPitch&&R.e.TransformCoordinatesToRef(s,this._transformYawPitchInv,s),a.getDirectionToRef(s,this.mesh,s)):this.upAxisSpace==O.b.LOCAL&&(o.getDirectionToRef(s,s),1==o.scaling.x&&1==o.scaling.y&&1==o.scaling.z||s.normalize()),l=c=!1,this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(c=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(l=!0),(c||l)&&(u=M._tmpMats[2],h=M._tmpMats[3],this.upAxisSpace==O.b.BONE&&1==s.y&&a?a.getRotationMatrixToRef(O.b.WORLD,this.mesh,u):this.upAxisSpace!=O.b.LOCAL||1!=s.y||a?((p=M._tmpVecs[2]).copyFrom(this._fowardAxis),this._transformYawPitch&&R.e.TransformCoordinatesToRef(p,this._transformYawPitchInv,p),a?a.getDirectionToRef(p,this.mesh,p):o.getDirectionToRef(p,p),(d=R.e.Cross(s,p)).normalize(),p=R.e.Cross(d,s),R.a.FromXYZAxesToRef(d,s,p,u)):u.copyFrom(o.getWorldMatrix()),u.invertToRef(h),f=null,l&&(m=M._tmpVecs[3],i.subtractToRef(t,m),R.e.TransformCoordinatesToRef(m,h,m),f=Math.sqrt(m.x*m.x+m.z*m.z),(g=_=Math.atan2(m.y,f))>this._maxPitch?(m.y=this._maxPitchTan*f,g=this._maxPitch):_<this._minPitch&&(m.y=this._minPitchTan*f,g=this._minPitch),_!=g&&(R.e.TransformCoordinatesToRef(m,u,m),m.addInPlace(t),i=m)),c&&(m=M._tmpVecs[4],i.subtractToRef(t,m),R.e.TransformCoordinatesToRef(m,h,m),((S=v=Math.atan2(m.x,m.z))>this._maxYaw||v<this._minYaw)&&(null==f&&(f=Math.sqrt(m.x*m.x+m.z*m.z)),this._yawRange>Math.PI?this._isAngleBetween(v,this._maxYaw,this._midYawConstraint)?(m.z=this._maxYawCos*f,m.x=this._maxYawSin*f,S=this._maxYaw):this._isAngleBetween(v,this._midYawConstraint,this._minYaw)&&(m.z=this._minYawCos*f,m.x=this._minYawSin*f,S=this._minYaw):v>this._maxYaw?(m.z=this._maxYawCos*f,m.x=this._maxYawSin*f,S=this._maxYaw):v<this._minYaw&&(m.z=this._minYawCos*f,m.x=this._minYawSin*f,S=this._minYaw)),this._slerping&&this._yawRange>Math.PI&&((b=M._tmpVecs[8]).copyFrom(O.a.Z),this._transformYawPitch&&R.e.TransformCoordinatesToRef(b,this._transformYawPitchInv,b),y=M._tmpMats[4],this._boneQuat.toRotationMatrix(y),this.mesh.getWorldMatrix().multiplyToRef(y,y),R.e.TransformCoordinatesToRef(b,y,b),R.e.TransformCoordinatesToRef(b,h,b),T=Math.atan2(b.x,b.z),this._getAngleBetween(T,v)>this._getAngleBetween(T,this._midYawConstraint)&&(null==f&&(f=Math.sqrt(m.x*m.x+m.z*m.z)),E=this._getAngleBetween(T,this._maxYaw),S=this._getAngleBetween(T,this._minYaw)<E?T+.75*Math.PI:T-.75*Math.PI,m.z=Math.cos(S)*f,m.x=Math.sin(S)*f)),v!=S&&(R.e.TransformCoordinatesToRef(m,u,m),m.addInPlace(t),i=m))),A=M._tmpVecs[5],C=M._tmpVecs[6],P=M._tmpVecs[7],x=M._tmpQuat,i.subtractToRef(t,A),A.normalize(),R.e.CrossToRef(s,A,C),C.normalize(),R.e.CrossToRef(A,C,P),P.normalize(),R.a.FromXYZAxesToRef(C,P,A,n),0===C.x&&0===C.y&&0===C.z||0===P.x&&0===P.y&&0===P.z||0===A.x&&0===A.y&&0===A.z||((this.adjustYaw||this.adjustPitch||this.adjustRoll)&&(R.a.RotationYawPitchRollToRef(this.adjustYaw,this.adjustPitch,this.adjustRoll,r),r.multiplyToRef(n,n)),this.slerpAmount<1?(this._slerping||this.bone.getRotationQuaternionToRef(O.b.WORLD,this.mesh,this._boneQuat),this._transformYawPitch&&this._transformYawPitch.multiplyToRef(n,n),R.b.FromRotationMatrixToRef(n,x),R.b.SlerpToRef(this._boneQuat,x,this.slerpAmount,this._boneQuat),this.bone.setRotationQuaternion(this._boneQuat,O.b.WORLD,this.mesh),this._slerping=!0):(this._transformYawPitch&&this._transformYawPitch.multiplyToRef(n,n),this.bone.setRotationMatrix(n,O.b.WORLD,this.mesh),this._slerping=!1)))},M.prototype._getAngleDiff=function(e,t){var i=t-e;return(i%=2*Math.PI)>Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i}
1,M.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},M.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(t<e&&e<i)return!0}else if(i<e&&e<t)return!0;return!1},M._tmpVecs=o.a.BuildArray(10,R.e.Zero),M._tmpQuat=R.b.Identity(),M._tmpMats=o.a.BuildArray(5,R.a.Identity),M),s=i(206);function M(e,t,i,n){var r,o,a;this.upAxis=R.e.Up(),this.upAxisSpace=O.b.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=R.b.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=R.e.Forward(),this.mesh=e,this.bone=t,this.target=i,n&&(n.adjustYaw&&(this.adjustYaw=n.adjustYaw),n.adjustPitch&&(this.adjustPitch=n.adjustPitch),n.adjustRoll&&(this.adjustRoll=n.adjustRoll),null!=n.maxYaw?this.maxYaw=n.maxYaw:this.maxYaw=Math.PI,null!=n.minYaw?this.minYaw=n.minYaw:this.minYaw=-Math.PI,null!=n.maxPitch?this.maxPitch=n.maxPitch:this.maxPitch=Math.PI,null!=n.minPitch?this.minPitch=n.minPitch:this.minPitch=-Math.PI,null!=n.slerpAmount&&(this.slerpAmount=n.slerpAmount),null!=n.upAxis&&(this.upAxis=n.upAxis),null!=n.upAxisSpace&&(this.upAxisSpace=n.upAxisSpace),null!=n.yawAxis||null!=n.pitchAxis)&&(r=O.a.Y,o=O.a.X,null!=n.yawAxis&&(r=n.yawAxis.clone()).normalize(),null!=n.pitchAxis&&(o=n.pitchAxis.clone()).normalize(),a=R.e.Cross(o,r),this._transformYawPitch=R.a.Identity(),R.a.FromXYZAxesToRef(o,r,a,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()),t.getParent()||this.upAxisSpace!=O.b.BONE||(this.upAxisSpace=O.b.LOCAL)}function b(e,t,i){var n,r,o,a,s,c;this.targetPosition=R.e.Zero(),this.poleTargetPosition=R.e.Zero(),this.poleTargetLocalOffset=R.e.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=R.b.Identity(),this._bone1Mat=R.a.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=R.e.Right(),this._slerping=!1,this._adjustRoll=0,this._bone2=t,this._bone1=t.getParent(),this._bone1&&(this.mesh=e,n=t.getPosition(),0<t.getAbsoluteTransform().determinant()&&(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?(r=this._bone1.getScale(),o=this._bone2.getScale(),this._bone1Length=this._bone1.length*r.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*o.y*this.mesh.scaling.y):this._bone1.children[0]&&(e.computeWorldMatrix(!0),a=this._bone2.children[0].getAbsolutePosition(e),s=this._bone2.getAbsolutePosition(e),c=this._bone1.getAbsolutePosition(e),this._bone1Length=R.e.Distance(a,s),this._bone2Length=R.e.Distance(s,c)),this._bone1.getRotationMatrixToRef(O.b.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount)))}},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return o}),i.d(t,"d",function(){return c.a}),i.d(t,"c",function(){return u.a}),i.d(t,"e",function(){return d.a});var l,P=i(0),x=i(80),R=(l={root:0,found:!1},function(e,t,i,n){l.root=0,l.found=!1;var r=t*t-4*e*i;if(r<0)return l;var o,a=Math.sqrt(r),s=(-t-a)/(2*e),c=(-t+a)/(2*e);return c<s&&(o=c,c=s,s=o),0<s&&s<n?(l.root=s,l.found=!0):0<c&&c<n&&(l.root=c,l.found=!0),l}),n=(Object.defineProperty(s.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"slidePlaneNormal",{get:function(){return this._slidePlaneNormal},enumerable:!1,configurable:!0}),s.prototype._initialize=function(e,t,i){this._velocity=t,P.e.NormalizeToRef(t,this._normalizedVelocity),(this._basePoint=e).multiplyToRef(this._radius,this._basePointWorld),t.multiplyToRef(this._radius,this._velocityWorld),this._velocityWorldLength=this._velocityWorld.length(),this._epsilon=i,this.collisionFound=!1},s.prototype._checkPointInTriangle=function(e,t,i,n,r){return t.subtractToRef(e,this._tempVector),i.subtractToRef(e,this._tempVector2),P.e.CrossToRef(this._tempVector,this._tempVector2,this._tempVector4),!(P.e.Dot(this._tempVector4,r)<0)&&(n.subtractToRef(e,this._tempVector3),P.e.CrossToRef(this._tempVector2,this._tempVector3,this._tempVector4),!(P.e.Dot(this._tempVector4,r)<0)&&(P.e.CrossToRef(this._tempVector3,this._tempVector,this._tempVector4),0<=P.e.Dot(this._tempVector4,r)))},s.prototype._canDoCollision=function(e,t,i,n){var r,o,a=P.e.Distance(this._basePointWorld,e),s=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(a>this._velocityWorldLength+s+t||(r=this._basePointWorld,o=this._velocityWorldLength+s,i.x>r.x+o||r.x-o>n.x||i.y>r.y+o||r.y-o>n.y||i.z>r.z+o||r.z-o>n.z))},s.prototype._testTriangle=function(e,t,i,n,r,o,a){var s=!1;(t=t||[])[e]||(t[e]=new x.a(0,0,0,0),t[e].copyFromPoints(i,n,r));var c=t[e];if(o||c.isFrontFacingTo(this._normalizedVelocity,0)){var l=c.signedDistanceTo(this._basePoint),u=P.e.Dot(c.normal,this._velocity);if(0==u){if(1<=Math.abs(l))return;s=!0,d=0}else{var h,d,p=(1-l)/u;if((d=(-1-l)/u)>p&&(h=p,p=d,d=h),1<d||p<0)return;d<0&&(d=0),1<d&&(d=1)}this._collisionPoint.copyFromFloats(0,0,0);var f,m,_,g,v,b,y,T,E,S,A=!1,C=1;s||(this._basePoint.subtractToRef(c.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(d,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,n,r,c.normal)&&(A=!0,C=d,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),A||(y=f=this._velocity.lengthSquared(),this._basePoint.subtractToRef(i,this._tempVector),T=2*P.e.Dot(this._velocity,this._tempVector),E=this._tempVector.lengthSquared()-1,(m=R(y,T,E,C)).found&&(C=m.root,A=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(n,this._tempVector),T=2*P.e.Dot(this._velocity,this._tempVector),E=this._tempVector.lengthSquared()-1,(m=R(y,T,E,C)).found&&(C=m.root,A=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),T=2*P.e.Dot(this._velocity,this._tempVector),E=this._tempVector.lengthSquared()-1,(m=R(y,T,E,C)).found&&(C=m.root,A=!0,this._collisionPoint.copyFrom(r)),n.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex),_=this._edge.lengthSquared(),g=P.e.Dot(this._edge,this._velocity),v=P.e.Dot(this._edge,this._baseToVertex),y=_*-f+g*g,T=_*(2*P.e.Dot(this._velocity,this._baseToVertex))-2*g*v,E=_*(1-this._baseToVertex.lengthSquared())+v*v,(m=R(y,T,E,C)).found&&0<=(b=(g*m.root-v)/_)&&b<=1&&(C=m.root,A=!0,this._edge.scaleInPlace(b),i.addToRef(this._edge,this._collisionPoint)),r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),_=this._edge.lengthSquared(),g=P.e.Dot(this._edge,this._velocity),v=P.e.Dot(this._edge,this._baseToVertex),y=_*-f+g*g,T=_*(2*P.e.Dot(this._velocity,this._baseToVertex))-2*g*v,E=_*(1-this._baseToVertex.lengthSquared())+v*v,(m=R(y,T,E,C)).found&&0<=(b=(g*m.root-v)/_)&&b<=1&&(C=m.root,A=!0,this._edge.scaleInPlace(b),n.addToRef(this._edge,this._collisionPoint)),i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),_=this._edge.lengthSquared(),g=P.e.Dot(this._edge,this._velocity),v=P.e.Dot(this._edge,this._baseToVertex),y=_*-f+g*g,T=_*(2*P.e.Dot(this._velocity,this._baseToVertex))-2*g*v,E=_*(1-this._baseToVertex.lengthSquared())+v*v,(m=R(y,T,E,C)).found&&0<=(b=(g*m.root-v)/_)&&b<=1&&(C=m.root,A=!0,this._edge.scaleInPlace(b),r.addToRef(this._edge,this._collisionPoint))),A&&(S=C*this._velocity.length(),(!this.collisionFound||S<this._nearestDistance)&&(this.intersectionPoint?this.intersectionPoint.copyFrom(this._collisionPoint):this.intersectionPoint=this._collisionPoint.clone(),this._nearestDistance=S,this.collisionFound=!0,this.collidedMesh=a))}},s.prototype._collide=function(e,t,i,n,r,o,a,s){for(var c=n;c<r;c+=3){var l=t[i[c]-o],u=t[i[c+1]-o],h=t[i[c+2]-o];this._testTriangle(c,e,h,u,l,a,s)}},s.prototype._getResponse=function(e,t){e.addToRef(t,this._destinationPoint),t.scaleInPlace(this._nearestDistance/t.length()),this._basePoint.addToRef(t,e),e.subtractToRef(this.intersectionPoint,this._slidePlaneNormal),this._slidePlaneNormal.normalize(),this._slidePlaneNormal.scaleToRef(this._epsilon,this._displacementVector),e.addInPlace(this._displacementVector),this.intersectionPoint.addInPlace(this._displacementVector),this._slidePlaneNormal.scaleInPlace(x.a.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint,this._slidePlaneNormal,this._destinationPoint)),this._destinationPoint.subtractInPlace(this._slidePlaneNormal),this._destinationPoint.subtractToRef(this.intersectionPoint,t)},s),r=i(18),h=i(12),o=(a.prototype.getNewPosition=function(e,t,i,n,r,o,a){e.divideToRef(i._radius,this._scaledPosition),t.divideToRef(i._radius,this._scaledVelocity),i.collidedMesh=null,i._retry=0,i._initialVelocity=this._scaledVelocity,i._initialPosition=this._scaledPosition,this._collideWithWorld(this._scaledPosition,this._scaledVelocity,i,n,this._finalPosition,r),this._finalPosition.multiplyInPlace(i._radius),o(a,this._finalPosition,i.collidedMesh)},a.prototype.createCollider=function(){return new n},a.prototype.init=function(e){this._scene=e},a.prototype._collideWithWorld=function(e,t,i,n,r,o){void 0===o&&(o=null);var a=10*h.a.CollisionsEpsilon;if(i._retry>=n)r.copyFrom(e);else{var s=o?o.collisionMask:i.collisionMask;i._initialize(e,t,a);for(var c=o&&o.surroundingMeshes||this._scene.meshes,l=0;l<c.length;l++){var u=c[l];u.isEnabled()&&u.checkCollisions&&u.subMeshes&&u!==o&&0!=(s&u.collisionGroup)&&u._checkCollision(i)}i.collisionFound?(0===t.x&&0===t.y&&0===t.z||i._getResponse(e,t),t.length()<=a?r.copyFrom(e):(i._retry++,this._collideWithWorld(e,t,i,n,r,o))):e.addToRef(t,r)}},a);function a(){this._scaledPosition=P.e.Zero(),this._scaledVelocity=P.e.Zero(),this._finalPosition=P.e.Zero()}function s(){this._collisionPoint=P.e.Zero(),this._planeIntersectionPoint=P.e.Zero(),this._tempVector=P.e.Zero(),this._tempVector2=P.e.Zero(),this._tempVector3=P.e.Zero(),this._tempVector4=P.e.Zero(),this._edge=P.e.Zero(),this._baseToVertex=P.e.Zero(),this._destinationPoint=P.e.Zero(),this._slidePlaneNormal=P.e.Zero(),this._displacementVector=P.e.Zero(),this._radius=P.e.One(),this._retry=0,this._basePointWorld=P.e.Zero(),this._velocityWorld=P.e.Zero(),this._normalizedVelocity=P.e.Zero(),this._collisionMask=-1}r.a.CollisionCoordinatorFactory=function(){return new o};var c=i(66),u=i(165),d=i(243)},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return a}),i.d(t,"c",function(){return s.a});var n=i(67),r=(Object.defineProperty(l.prototype,"gpuFrameTimeCounter",{get:function(){return this._gpuFrameTime}
1,enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"captureGPUFrameTime",{get:function(){return this._captureGPUFrameTime},set:function(e){var t=this;e!==this._captureGPUFrameTime&&((this._captureGPUFrameTime=e)?(this._onBeginFrameObserver=this.engine.onBeginFrameObservable.add(function(){t._gpuFrameTimeToken||(t._gpuFrameTimeToken=t.engine.startTimeQuery())}),this._onEndFrameObserver=this.engine.onEndFrameObservable.add(function(){var e;!t._gpuFrameTimeToken||-1<(e=t.engine.endTimeQuery(t._gpuFrameTimeToken))&&(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:!1,configurable:!0}),Object.defineProperty(l.prototype,"shaderCompilationTimeCounter",{get:function(){return this._shaderCompilationTime},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"captureShaderCompilationTime",{get:function(){return this._captureShaderCompilationTime},set:function(e){var t=this;e!==this._captureShaderCompilationTime&&((this._captureShaderCompilationTime=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:!1,configurable:!0}),l.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},l),o=i(13),a=(Object.defineProperty(c.prototype,"activeMeshesEvaluationTimeCounter",{get:function(){return this._activeMeshesEvaluationTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureActiveMeshesEvaluationTime",{get:function(){return this._captureActiveMeshesEvaluationTime},set:function(e){var t=this;e!==this._captureActiveMeshesEvaluationTime&&((this._captureActiveMeshesEvaluationTime=e)?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add(function(){o.b.StartPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.beginMonitoring()}),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add(function(){o.b.EndPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.endMonitoring()})):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"renderTargetsRenderTimeCounter",{get:function(){return this._renderTargetsRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureRenderTargetsRenderTime",{get:function(){return this._captureRenderTargetsRenderTime},set:function(e){var t=this;e!==this._captureRenderTargetsRenderTime&&((this._captureRenderTargetsRenderTime=e)?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add(function(){o.b.StartPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.beginMonitoring()}),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add(function(){o.b.EndPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.endMonitoring(!1)})):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))}
1,enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"particlesRenderTimeCounter",{get:function(){return this._particlesRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureParticlesRenderTime",{get:function(){return this._captureParticlesRenderTime},set:function(e){var t=this;e!==this._captureParticlesRenderTime&&((this._captureParticlesRenderTime=e)?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add(function(){o.b.StartPerformanceCounter("Particles"),t._particlesRenderTime.beginMonitoring()}),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add(function(){o.b.EndPerformanceCounter("Particles"),t._particlesRenderTime.endMonitoring(!1)})):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"spritesRenderTimeCounter",{get:function(){return this._spritesRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.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(){o.b.StartPerformanceCounter("Sprites"),t._spritesRenderTime.beginMonitoring()}),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add(function(){o.b.EndPerformanceCounter("Sprites"),t._spritesRenderTime.endMonitoring(!1)})):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"physicsTimeCounter",{get:function(){return this._physicsTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"capturePhysicsTime",{get:function(){return this._capturePhysicsTime},set:function(e){var t=this;e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&((this._capturePhysicsTime=e)?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add(function(){o.b.StartPerformanceCounter("Physics"),t._physicsTime.beginMonitoring()}),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add(function(){o.b.EndPerformanceCounter("Physics"),t._physicsTime.endMonitoring()})):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"animationsTimeCounter",{get:function(){return this._animationsTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureAnimationsTime",{get:function(){return this._captureAnimationsTime},set:function(e){var t=this;e!==this._captureAnimationsTime&&((this._captureAnimationsTime=e)?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add(function(){t._animationsTime.endMonitoring()}):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"frameTimeCounter",{get:function(){return this._frameTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureFrameTime",{get:function(){return this._captureFrameTime},set:function(e){this._captureFrameTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"interFrameTimeCounter",{get:function(){return this._interFrameTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureInterFrameTime",{get:function(){return this._captureInterFrameTime},set:function(e){this._captureInterFrameTime=e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&((this._captureRenderTime=e)?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add(function(){t._renderTime.beginMonitoring(),o.b.StartPerformanceCounter("Main render")}),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add(function(){t._renderTime.endMonitoring(!1),o.b.EndPerformanceCounter("Main render")})):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"cameraRenderTimeCounter",{get:function(){return this._cameraRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"captureCameraRenderTime",{get:function(){return this._captureCameraRenderTime},set:function(e){var t=this;e!==this._captureCameraRenderTime&&((this._captureCameraRenderTime=e)?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add(function(e){t._cameraRenderTime.beginMonitoring(),o.b.StartPerformanceCounter("Rendering camera "+e.name)}),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add(function(e){t._cameraRenderTime.endMonitoring(!1),o.b.EndPerformanceCounter("Rendering camera "+e.name)})):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"drawCallsCounter",{get:function(){return this.scene.getEngine()._drawCalls},enumerable:!1,configurable:!0}),c.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},c),s=i(266);function c(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new n.a,this._captureRen
1derTargetsRenderTime=!1,this._renderTargetsRenderTime=new n.a,this._captureFrameTime=!1,this._frameTime=new n.a,this._captureRenderTime=!1,this._renderTime=new n.a,this._captureInterFrameTime=!1,this._interFrameTime=new n.a,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new n.a,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new n.a,this._capturePhysicsTime=!1,this._physicsTime=new n.a,this._captureAnimationsTime=!1,this._animationsTime=new n.a,this._captureCameraRenderTime=!1,this._cameraRenderTime=new n.a,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add(function(){t._captureActiveMeshesEvaluationTime&&t._activeMeshesEvaluationTime.fetchNewFrame(),t._captureRenderTargetsRenderTime&&t._renderTargetsRenderTime.fetchNewFrame(),t._captureFrameTime&&(o.b.StartPerformanceCounter("Scene rendering"),t._frameTime.beginMonitoring()),t._captureInterFrameTime&&t._interFrameTime.endMonitoring(),t._captureParticlesRenderTime&&t._particlesRenderTime.fetchNewFrame(),t._captureSpritesRenderTime&&t._spritesRenderTime.fetchNewFrame(),t._captureAnimationsTime&&t._animationsTime.beginMonitoring(),t.scene.getEngine()._drawCalls.fetchNewFrame()}),this._onAfterRenderObserver=e.onAfterRenderObservable.add(function(){t._captureFrameTime&&(o.b.EndPerformanceCounter("Scene rendering"),t._frameTime.endMonitoring()),t._captureRenderTime&&t._renderTime.endMonitoring(!1),t._captureInterFrameTime&&t._interFrameTime.beginMonitoring()})}function l(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new n.a,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new n.a,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var l=i(12),d=i(0),u=i(9),h=i(90),p=i(121),f=i(8),m=i(5),n=(i(115),"precision highp float;\nvarying vec3 vPosition;\nvarying vec2 vUV;\nvarying vec2 tUV;\nuniform float time;\nuniform float spriteCount;\nuniform sampler2D spriteSheet;\nuniform vec2 spriteMapSize;\nuniform vec2 outputSize;\nuniform vec2 stageSize;\nuniform sampler2D frameMap;\nuniform sampler2D tileMaps[LAYERS];\nuniform sampler2D animationMap;\nuniform vec3 colorMul;\nfloat mt;\nconst float fdStep=1./4.;\nconst float aFrameSteps=1./MAX_ANIMATION_FRAMES;\nmat4 getFrameData(float frameID){\nfloat fX=frameID/spriteCount;\nreturn mat4(\ntexture2D(frameMap,vec2(fX,0.),0.),\ntexture2D(frameMap,vec2(fX,fdStep*1.),0.),\ntexture2D(frameMap,vec2(fX,fdStep*2.),0.),\nvec4(0.)\n);\n}\nvoid main(){\nvec4 color=vec4(0.);\nvec2 tileUV=fract(tUV);\n#ifdef FLIPU\ntileUV.y=1.0-tileUV.y;\n#endif\nvec2 tileID=floor(tUV);\nvec2 sheetUnits=1./spriteMapSize;\nfloat spriteUnits=1./spriteCount;\nvec2 stageUnits=1./stageSize;\nfor(int i=0; i<LAYERS; i++) {\nfloat frameID;\n#define LAYER_ID_SWITCH\nvec4 animationData=texture2D(animationMap,vec2((frameID+0.5)/spriteCount,0.),0.);\nif(animationData.y>0.) {\nmt=mod(time*animationData.z,1.0);\nfor(float f=0.; f<MAX_ANIMATION_FRAMES; f++){\nif(animationData.y>mt){\nframeID=animationData.x;\nbreak;\n}\nanimationData=texture2D(animationMap,vec2((frameID+0.5)/spriteCount,aFrameSteps*f),0.);\n}\n}\n\nmat4 frameData=getFrameData(frameID+0.5);\nvec2 frameSize=(frameData[0].wz)/spriteMapSize;\nvec2 offset=frameData[0].xy*sheetUnits;\nvec2 ratio=frameData[2].xy/frameData[0].wz;\n\nif (frameData[2].z == 1.){\ntileUV.xy=tileUV.yx;\n}\nif (i == 0){\ncolor=texture2D(spriteSheet,tileUV*frameSize+offset);\n} else {\nvec4 nc=texture2D(spriteSheet,tileUV*frameSize+offset);\nfloat alpha=min(color.a+nc.a,1.0);\nvec3 mixed=mix(color.xyz,nc.xyz,nc.a);\ncolor=vec4(mixed,alpha);\n}\n}\ncolor.xyz*=colorMul;\ngl_FragColor=color;\n}");m.a.ShadersStore.spriteMapPixelShader=n;
1m.a.ShadersStore.spriteMapVertexShader="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n\nvarying vec3 vPosition;\nvarying vec2 vUV;\nvarying vec2 tUV;\nvarying vec2 stageUnits;\nvarying vec2 levelUnits;\nvarying vec2 tileID;\n\nuniform float time;\nuniform mat4 worldViewProjection;\nuniform vec2 outputSize;\nuniform vec2 stageSize;\nuniform vec2 spriteMapSize;\nuniform float stageScale;\nvoid main() {\nvec4 p=vec4( position,1. );\nvPosition=p.xyz;\nvUV=uv;\ntUV=uv*stageSize;\ngl_Position=worldViewProjection*p;\n}";var r=(Object.defineProperty(o.prototype,"spriteCount",{get:function(){return this.sprites.length},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"position",{get:function(){return this._output.position},set:function(e){this._output.position=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rotation",{get:function(){return this._output.rotation},set:function(e){this._output.rotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"animationMap",{get:function(){return this._animationMap},set:function(e){var t=e._texture._bufferView,i=this._createTileAnimationBuffer(t);this._animationMap.dispose(),this._animationMap=i,this._material.setTexture("animationMap",this._animationMap)},enumerable:!1,configurable:!0}),o.prototype.getTileID=function(){var e=this.getMousePosition();return e.multiplyInPlace(this.options.stageSize||d.d.Zero()),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e},o.prototype.getMousePosition=function(){var t=this._output,e=this._scene.pick(this._scene.pointerX,this._scene.pointerY,function(e){return e===t});return e&&e.hit&&e.getTextureCoordinates&&e.getTextureCoordinates()||new d.d(-1,-1)},o.prototype._createFrameBuffer=function(){for(var e=new Array,t=0;t<this.spriteCount;t++)e.push(0,0,0,0),e.push(0,0,0,0),e.push(0,0,0,0),e.push(0,0,0,0);for(t=0;t<this.spriteCount;t++){var i=this.sprites[t].frame,n=this.sprites[t].spriteSourceSize,r=this.sprites[t].sourceSize,o=this.sprites[t].rotated?1:0,a=this.sprites[t].trimmed?1:0;e[4*t]=i.x,e[4*t+1]=i.y,e[4*t+2]=i.w,e[4*t+3]=i.h,e[4*t+4*this.spriteCount]=n.x,e[4*t+1+4*this.spriteCount]=n.y,e[4*t+3+4*this.spriteCount]=n.h,e[4*t+8*this.spriteCount]=r.w,e[4*t+1+8*this.spriteCount]=r.h,e[4*t+2+8*this.spriteCount]=o,e[4*t+3+8*this.spriteCount]=a}var s=new Float32Array(e);return h.a.CreateRGBATexture(s,this.spriteCount,4,this._scene,!1,!1,u.a.NEAREST_NEAREST,l.a.TEXTURETYPE_FLOAT)},o.prototype._createTileBuffer=function(e,t){void 0===t&&(t=0);var i=new Array,n=this.options.stageSize.y||0,r=this.options.stageSize.x||0;if(e)i=e;else{var o=this.options.baseTile;0!=t&&(o=0);for(var a=0;a<n;a++)for(var s=0;s<4*r;s+=4)i.push(o,0,0,0)}var c=new Float32Array(i);return h.a.CreateRGBATexture(c,r,n,this._scene,!1,!1,u.a.NEAREST_NEAREST,l.a.TEXTURETYPE_FLOAT)},o.prototype.changeTiles=function(e,t,i){var n;if(void 0===e&&(e=0),void 0===i&&(i=0),null!==(n=this._tileMaps[e]._texture._bufferView)){var r=new Array;t instanceof d.d?r.push(t):r=t;for(var o=this.options.stageSize.x||0,a=0;a<r.length;a++){var s=r[a];s.x=Math.floor(s.x),s.y=Math.floor(s.y),n[4*s.x+s.y*(4*o)]=i}var c=this._createTileBuffer(n);this._tileMaps[e].dispose(),this._tileMaps[e]=c,this._material.setTextureArray("tileMap",this._tileMaps)}},o.prototype._createTileAnimationBuffer=function(e){var t,i=new Array;if(e)t=e;else{for(var n=0;n<this.spriteCount;n++){i.push(0,0,0,0);for(var r=1;r<(this.options.maxAnimationFrames||4);)i.push(0,0,0,0),r++}t=new Float32Array(i)}return h.a.CreateRGBATexture(t,this.spriteCount,this.options.maxAnimationFrames||4,this._scene,!1,!1,u.a.NEAREST_NEAREST,l.a.TEXTURETYPE_FLOAT)},o.prototype.addAnimationToTile=function(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1);var o,a=this._animationMap._texture._bufferView,s=4*e+4*this.spriteCount*t;a&&(a[s]=i,a[1+s]=n,a[2+s]=r,o=this._createTileAnimationBuffer(a),this._animationMap.dispose(),this._animationMap=o,this._material.setTexture("animationMap",this._animationMap))},o.prototype.saveTileMaps=function(){for(var e="",t=0;t<this._tileMaps.length;t++)0<t&&(e+="\n\r"),e+=this._tileMaps[t]._texture._bufferView.toString();var i=document.createElement("a");i.href="data:octet/stream;charset=utf-8,"+encodeURI(e),i.target="_blank",i.download=this.name+".tilemaps",i.click(),i.remove()},o.prototype.loadTileMaps=function(e){var r=this,o=new XMLHttpRequest;o.open("GET",e);var a=this.options.layerCount||0;o.onload=function(){for(var e=o.response.split("\n\r"),t=0;t<a;t++){var i=e[t].split(",").map(Number),n=r._createTileBuffer(i);r._tileMaps[t].dispose(),r._tileMaps[t]=n}r._material.setTextureArray("tileMap",r._tileMaps)},o.send()},o.prototype.dispose=function(){this._output.dispose(),this._material.dispose(),this._animationMap.dispose(),this._tileMaps.forEach(function(e){e.dispose()}),this._frameMap.dispose()},o);function o(e,t,i,n,r){var o=this;this.name=e,this.sprites=[],this.atlasJSON=t,this.sprites=this.atlasJSON.frames,this.spriteSheet=i,(this.options=n).stageSize=n.stageSize||new d.d(1,1),n.outputSize=n.outputSize||n.stageSize,n.outputPosition=n.outputPosition||d.e.Zero(),n.outputRotation=n.outputRotation||d.e.Zero(),n.layerCount=n.layerCount||1,n.maxAnimationFrames=n.maxAnimationFrames||0,n.baseTile=n.baseTile||0,n.flipU=n.flipU||!1,n.colorMultiply=n.colorMultiply||new d.e(1,1,1),this._scene=r,this._frameMap=this._createFrameBuffer(),this._tileMaps=new Array;for(var a=0;a<n.layerCount;a++)this._tileMaps.push(this._createTileBuffer(null,a));this._animationMap=this._createTileAnimationBuffer(null);var s=[];s.push("#define LAYERS "+n.layerCount),n.flipU&&s.push("#define FLIPU"),s.push("#define MAX_ANIMATION_FRAMES "+n.maxAnimationFrames+".0");var c,l=m.a.ShadersStore.spriteMapPixelShader;if(1===this._scene.getEngine().webGLVersion)for(c="",a=0;a<n.layerCount;a++)c+="if ("+a+" == i) { frameID = texture2D(tileMaps["+a+"], (tileID + 0.5) / stageSize, 0.).x; }";else{for(c="switch(i) {",a=0;a<n.layerCount;a++)c+="case "+a+" : frameID = texture(tileMaps["+a+"], (tileID + 0.5) / stageSize, 0.).x;",c+="break;";c+="}"}m.a.ShadersStore["spriteMap"+this.name+"PixelShader"]=l.replace("#define LAYER_ID_SWITCH",c),this._material=new p.a("spriteMap:"+this.name,this._scene,{vertex:"spriteMap",fragment:"spriteMap"+this.name},{defines:s,attributes:["position","normal","uv"],uniforms:["worldViewProjection","time","stageSize","outputSize","spriteMapSize","spriteCount","time","colorMul","mousePosition","curTile","flipU"],samplers:["spriteSheet","frameMap","tileMaps","animationMap"],needAlphaBlending:!0}),this._time=0,this._material.setFloat("spriteCount",this.spriteCount),this._material.setVector2("stageSize",n.stageSize),this._material.setVector2("outputSize",n.outputSize),this._material.setTexture("spriteSheet",this.spriteSheet),this._material.setVector2("spriteMapSize",new d.d(1,1)),this._material.setVector3("colorMul",n.colorMultiply);var u=0,h=function(){o.spriteSheet&&o.spriteSheet.isReady()&&o.spriteSheet._texture?o._material.setVector2("spriteMapSize",new d.d(o.spriteSheet._texture.baseWi
1dth||1,o.spriteSheet._texture.baseHeight||1)):u<100&&setTimeout(function(){u++,h()},100)};h(),this._material.setVector3("colorMul",n.colorMultiply),this._material.setTexture("frameMap",this._frameMap),this._material.setTextureArray("tileMaps",this._tileMaps),this._material.setTexture("animationMap",this._animationMap),this._material.setFloat("time",this._time),this._output=f.a.CreatePlane(e+":output",1,r,!0),this._output.scaling.x=n.outputSize.x,this._output.scaling.y=n.outputSize.y,this._scene.onBeforeRenderObservable.add(function(){o._time+=o._scene.getEngine().getDeltaTime(),o._material.setFloat("time",o._time)}),this._output.material=this._material}},function(e,t,i){"use strict";i.d(t,"b",function(){return n.a}),i.d(t,"c",function(){return r.a}),i.d(t,"d",function(){return o.a}),i.d(t,"e",function(){return l}),i.d(t,"a",function(){return p});var n=i(315),r=i(316),o=i(320),a=i(171),s=i(12),c=i(41),l=(u.prototype.canLoad=function(e){return c.a.EndsWith(e,".tga")},u.prototype.loadCubeData=function(e,t,i,n,r){throw".env not supported in Cube."},u.prototype.loadData=function(e,t,i){var n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.a.GetTGAHeader(n);i(r.width,r.height,t.generateMipMaps,!1,function(){a.a.UploadContent(t,n)})},u);function u(){this.supportCascades=!1}s.a._TextureLoaders.push(new l);var h=i(174),d=i(13),p=(f.prototype.canLoad=function(e){return c.a.EndsWith(e,".basis")},f.prototype.loadCubeData=function(e,i,t,n,r){var o,a;Array.isArray(e)||(a={supportedCompressionFormats:{etc1:!!(o=i.getEngine().getCaps()).etc1,s3tc:!!o.s3tc,pvrtc:!!o.pvrtc,etc2:!!o.etc2}},h.a.TranscodeAsync(e,a).then(function(e){var t=1<e.fileInfo.images[0].levels.length&&i.generateMipMaps;h.a.LoadTextureFromTranscodeResult(i,e),i.getEngine()._setCubeMapTextureParams(t),i.isReady=!0,i.onLoadedObservable.notifyObservers(i),i.onLoadedObservable.clear(),n&&n()}).catch(function(e){d.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),i.isReady=!0}))},f.prototype.loadData=function(e,n,r){var t=n.getEngine().getCaps(),i={supportedCompressionFormats:{etc1:!!t.etc1,s3tc:!!t.s3tc,pvrtc:!!t.pvrtc,etc2:!!t.etc2}};h.a.TranscodeAsync(e,i).then(function(e){var t=e.fileInfo.images[0].levels[0],i=1<e.fileInfo.images[0].levels.length&&n.generateMipMaps;r(t.width,t.height,i,-1!==e.format,function(){h.a.LoadTextureFromTranscodeResult(n,e)})}).catch(function(e){d.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),r(0,0,!1,!1,function(){})})},f);function f(){this.supportCascades=!1}s.a._TextureLoaders.push(new p)},function(e,t,i){"use strict";i.d(t,"a",function(){return n}),i.d(t,"b",function(){return d});var a=i(12),g=i(4),s=i(9),T=i(85),E=i(0),S=i(10),d=function(e,t,i){this.id=e,this.scale=t,this.offset=i},p=i(7),A=i(13),n=(v.prototype._createFrames=function(c){for(var l=this,u=this._calculateSize(),h=new E.d(1,1).divide(u),d=0,p=this._expecting,e=this.meshes.length,f=Object.keys(this.sets),m=0;m<f.length;m++){var t=f[m],i=new T.a(this.name+".TexturePack."+t+"Set",{width:u.x,height:u.y},this.scene,!0,s.a.TRILINEAR_SAMPLINGMODE,a.a.TEXTUREFORMAT_RGBA),n=i.getContext();n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,u.x,u.y),i.update(!1),this.sets[t]=i}for(var _=this.options.frameSize||256,g=this._paddingValue,v=_+2*g,m=0;m<e;m++)for(var b=this.meshes[m].material,r=function(e){function n(){d++,o.update(!1);var e=a.getImageData(0,0,v,v),t=l.sets[s];return t.getContext().putImageData(e,u.x*i.x,u.y*i.y),o.dispose(),t.update(!1),d==p&&(l._calculateMeshUVFrames(_,g,u,h,l.options.updateInputMeshes||!1),void c())}var t,r,o=new T.a("temp",v,y.scene,!0),a=o.getContext(),i=y._getFrameOffset(m),s=f[e]||"_blank";b&&null!==b[s]?(t=b[s],r=new Image,t instanceof T.a?r.src=t.getContext().canvas.toDataURL("image/png"):r.src=t.url,A.b.SetCorsBehavior(r.src,r),r.onload=function(){a.fillStyle="rgba(0,0,0,0)",a.fillRect(0,0,v,v),o.update(!1),a.setTransform(1,0,0,-1,0,0);var e=[0,0,1,0,1,1,0,1,-1,1,-1,0,-2,0,-1,1,-1];switch(l.options.paddingMode){case 0:for(var t=0;t<9;t++)a.drawImage(r,0,0,r.width,r.height,g+_*e[t],g+_*e[t+1]-v,_,_);break;case 1:for(var i=0;i<g;i++)a.drawImage(r,0,0,r.width,r.height,i+_*e[0],g-v,_,_),a.drawImage(r,0,0,r.width,r.height,2*g-i,g-v,_,_),a.drawImage(r,0,0,r.width,r.height,g,i-v,_,_),a.drawImage(r,0,0,r.width,r.height,g,2*g-i-v,_,_);a.drawImage(r,0,0,r.width,r.height,g+_*e[0],g+_*e[1]-v,_,_);break;case 2:a.fillStyle=(l.options.paddingColor||S.a.Black()).toHexString(),a.fillRect(0,0,v,-v),a.clearRect(g,g,_,_),a.drawImage(r,0,0,r.width,r.height,g+_*e[0],g+_*e[1]-v,_,_)}a.setTransform(1,0,0,1,0,0),n()}):(a.fillStyle="rgba(0,0,0,0)",y.options.fillBlanks&&(a.fillStyle=y.options.customFillColor),a.fillRect(0,0,v,v),n())},y=this,o=0;o<f.length;o++)r(o)},v.prototype._calculateSize=function(){var e=this.meshes.length||0,t=this.options.frameSize||0,i=this._paddingValue||0;switch(this.options.layout){case 0:return new E.d(t*e+2*i*e,t+2*i);case 1:var n=Math.max(2,Math.ceil(Math.sqrt(e))),r=t*n+2*i*n;return new E.d(r,r);case 2:var o=this.options.colnum||1,a=Math.max(1,Math.ceil(e/o));return new E.d(t*o+2*i*o,t*a+2*i*a)}return E.d.Zero()},v.prototype._calculateMeshUVFrames=function(e,t,i,n,r){for(var o=this.meshes.length,a=0;a<o;a++){var s=this.meshes[a],c=new E.d(e/i.x,e/i.y),l=n.clone().scale(t),u=this._getFrameOffset(a).add(l),h=new d(a,c,u);this.frames.push(h),r&&(this._updateMeshUV(s,a),this._updateTextureReferences(s))}},v.prototype._getFrameOffset=function(e){var t=this.meshes.length;switch(this.options.layout){case 0:return r=1/t,new E.d(e*r,0);case 1:var i=Math.max(2,Math.ceil(Math.sqrt(t))),n=e-(s=Math.floor(e/i))*i,r=1/i;return new E.d(n*r,s*r);case 2:var o=this.options.colnum||1,a=Math.max(1,Math.ceil(t/o)),s=e-(n=Math.floor(e/a))*a;return r=new E.d(1/o,1/a),new E.d(n*r.x,s*r.y)}return E.d.Zero()},v.prototype._updateMeshUV=function(e,t){var i=this.frames[t],n=e.getVerticesData(this.options.uvsIn||g.b.UVKind),r=[],o=0;n.length&&(o=n.length||0);for(var a=0;a<o;a+=2)r.push(n[a]*i.scale.x+i.offset.x,n[a+1]*i.scale.y+i.offset.y);e.setVerticesData(this.options.uvsOut||g.b.UVKind,r)},v.prototype._updateTextureReferences=function(e,t){void 0===t&&(t=!1);for(var i=e.material,n=Object.keys(this.sets),r=function(e){e.dispose&&e.dispose()},o=0;o<n.length;o++){var a=n[o];if(t)null!==i[a]&&r(i[a]),i[a]=this.sets[a];else{if(!i)return;
1null!==i[a]&&(r(i[a]),i[a]=this.sets[a])}}},v.prototype.setMeshToFrame=function(e,t,i){void 0===i&&(i=!1),this._updateMeshUV(e,t),i&&this._updateTextureReferences(e,!0)},v.prototype.processAsync=function(){var a=this;return new Promise(function(n,t){try{if(0===a.meshes.length)return void n();for(var r=0,e=function(e){var t=a.meshes[e],i=t.material;if(!i)return++r===a.meshes.length?{value:a._createFrames(n)}:"continue";i.forceCompilationAsync(t).then(function(){!function(e){if(r++,a.options.map){for(var t=0;t<a.options.map.length;t++)null!==e[a.options.map[t]]&&(a.sets[a.options.map[t]]||(a.sets[a.options.map[t]]=!0),a._expecting++);r===a.meshes.length&&a._createFrames(n)}}(i)})},i=0;i<a.meshes.length;i++){var o=e(i);if("object"==typeof o)return o.value}}catch(e){return t(e)}})},v.prototype.dispose=function(){for(var e=Object.keys(this.sets),t=0;t<e.length;t++){var i=e[t];this.sets[i].dispose()}},v.prototype.download=function(u,h){var d=this;void 0===u&&(u="png"),void 0===h&&(h=1),setTimeout(function(){var e={name:d.name,sets:{},options:{},frames:[]},t=Object.keys(d.sets),i=Object.keys(d.options);try{for(var n=0;n<t.length;n++){var r=t[n],o=d.sets[r];e.sets[r]=o.getContext().canvas.toDataURL("image/"+u,h)}for(n=0;n<i.length;n++){var a=i[n];e.options[a]=d.options[a]}for(n=0;n<d.frames.length;n++){var s=d.frames[n];e.frames.push(s.scale.x,s.scale.y,s.offset.x,s.offset.y)}}catch(e){return void p.a.Warn("Unable to download: "+e)}var c="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,4)),l=document.createElement("a");l.setAttribute("href",c),l.setAttribute("download",d.name+"_texurePackage.json"),document.body.appendChild(l),l.click(),l.remove()},0)},v.prototype.updateFromJSON=function(e){try{var t=JSON.parse(e);this.name=t.name;for(var i=Object.keys(t.options),n=0;n<i.length;n++)this.options[i[n]]=t.options[i[n]];for(n=0;n<t.frames.length;n+=4){var r=new d(n/4,new E.d(t.frames[n],t.frames[n+1]),new E.d(t.frames[n+2],t.frames[n+3]));this.frames.push(r)}for(var o=Object.keys(t.sets),n=0;n<o.length;n++){var a=new s.a(t.sets[o[n]],this.scene,!1,!1);this.sets[o[n]]=a}}catch(e){p.a.Warn("Unable to update from JSON: "+e)}},v.LAYOUT_STRIP=0,v.LAYOUT_POWER2=1,v.LAYOUT_COLNUM=2,v.SUBUV_WRAP=0,v.SUBUV_EXTEND=1,v.SUBUV_COLOR=2,v);function v(e,t,i,n){var r,o,a,s,c,l,u,h,d,p,f,m,_;return this.name=e,this.meshes=t,this.scene=n,this.options=i,this.options.map=null!==(r=this.options.map)&&void 0!==r?r:["ambientTexture","bumpTexture","diffuseTexture","emissiveTexture","lightmapTexture","opacityTexture","reflectionTexture","refractionTexture","specularTexture"],this.options.uvsIn=null!==(o=this.options.uvsIn)&&void 0!==o?o:g.b.UVKind,this.options.uvsOut=null!==(a=this.options.uvsOut)&&void 0!==a?a:g.b.UVKind,this.options.layout=null!==(s=this.options.layout)&&void 0!==s?s:v.LAYOUT_STRIP,this.options.layout===v.LAYOUT_COLNUM&&(this.options.colnum=null!==(c=this.options.colnum)&&void 0!==c?c:8),this.options.updateInputMeshes=null===(l=this.options.updateInputMeshes)||void 0===l||l,this.options.disposeSources=null===(u=this.options.disposeSources)||void 0===u||u,this._expecting=0,this.options.fillBlanks=null===(h=this.options.fillBlanks)||void 0===h||h,!0===this.options.fillBlanks&&(this.options.customFillColor=null!==(d=this.options.customFillColor)&&void 0!==d?d:"black"),this.options.frameSize=null!==(p=this.options.frameSize)&&void 0!==p?p:256,this.options.paddingRatio=null!==(f=this.options.paddingRatio)&&void 0!==f?f:.0115,this._paddingValue=Math.ceil(this.options.frameSize*this.options.paddingRatio),this._paddingValue%2!=0&&this._paddingValue++,this.options.paddingMode=null!==(m=this.options.paddingMode)&&void 0!==m?m:v.SUBUV_WRAP,this.options.paddingMode===v.SUBUV_COLOR&&(this.options.paddingColor=null!==(_=this.options.paddingColor)&&void 0!==_?_:new S.b(0,0,0,1)),this.sets={},this.frames=[],this}},function(e,t,i){"use strict";i.d(t,"c",function(){return n.a}),i.d(t,"d",function(){return n.b}),i.d(t,"e",function(){return n.c}),i.d(t,"f",function(){return r.a}),i.d(t,"h",function(){return r.c}),i.d(t,"i",function(){return r.d}),i.d(t,"g",function(){return r.b}),i.d(t,"a",function(){return o}
1),i.d(t,"b",function(){return a});var n=i(82),r=i(20),o=(c.COPY=1,c.CUT=2,c.PASTE=3,c),a=(s.GetTypeFromCharacter=function(e){switch(e){case 67:return o.COPY;case 86:return o.PASTE;case 88:return o.CUT;default:return-1}},s);function s(e,t){this.type=e,this.event=t}function c(){}},function(e,t,i){"use strict";i.d(t,"b",function(){return r}),i.d(t,"a",function(){return o});var n=i(7),u=i(16),h=i(8),m=i(33),_=i(4),r=(s.prototype.createNavMesh=function(e,t){var i=new this.bjsRECAST.rcConfig;i.cs=t.cs,i.ch=t.ch,i.borderSize=0,i.tileSize=0,i.walkableSlopeAngle=t.walkableSlopeAngle,i.walkableHeight=t.walkableHeight,i.walkableClimb=t.walkableClimb,i.walkableRadius=t.walkableRadius,i.maxEdgeLen=t.maxEdgeLen,i.maxSimplificationError=t.maxSimplificationError,i.minRegionArea=t.minRegionArea,i.mergeRegionArea=t.mergeRegionArea,i.maxVertsPerPoly=t.maxVertsPerPoly,i.detailSampleDist=t.detailSampleDist,i.detailSampleMaxError=t.detailSampleMaxError,this.navMesh=new this.bjsRECAST.NavMesh;for(var n=[],r=[],o=0,a=0;a<e.length;a++)if(e[a]){var s=e[a],c=s.getIndices();if(!c)continue;var l=s.getVerticesData(_.b.PositionKind,!1,!1);if(!l)continue;for(var u=s.computeWorldMatrix(!1),h=0;h<c.length;h++)n.push(c[h]+o);for(var d=m.y.Zero(),p=m.y.Zero(),f=0;f<l.length;f+=3)m.y.FromArrayToRef(l,f,p),m.y.TransformCoordinatesToRef(p,u,d),r.push(d.x,d.y,d.z);o+=l.length/3}this.navMesh.build(r,o,n,n.length,i)},s.prototype.createDebugNavMesh=function(e){for(var t,i=this.navMesh.getDebugNavMesh(),n=i.getTriangleCount(),r=[],o=[],a=0;a<3*n;a++)r.push(a);for(a=0;a<n;a++)for(t=0;t<3;t++){var s=i.getTriangle(a).getPoint(t);o.push(s.x,s.y,s.z)}var c=new h.a("NavMeshDebug",e),l=new u.a;return l.indices=r,l.positions=o,l.applyToMesh(c,!1),c},s.prototype.getClosestPoint=function(e){var t=new this.bjsRECAST.Vec3(e.x,e.y,e.z),i=this.navMesh.getClosestPoint(t);return new m.y(i.x,i.y,i.z)},s.prototype.getClosestPointToRef=function(e,t){var i=new this.bjsRECAST.Vec3(e.x,e.y,e.z),n=this.navMesh.getClosestPoint(i);t.set(n.x,n.y,n.z)},s.prototype.getRandomPointAround=function(e,t){var i=new this.bjsRECAST.Vec3(e.x,e.y,e.z),n=this.navMesh.getRandomPointAround(i,t);return new m.y(n.x,n.y,n.z)},s.prototype.getRandomPointAroundToRef=function(e,t,i){var n=new this.bjsRECAST.Vec3(e.x,e.y,e.z),r=this.navMesh.getRandomPointAround(n,t);i.set(r.x,r.y,r.z)},s.prototype.moveAlong=function(e,t){var i=new this.bjsRECAST.Vec3(e.x,e.y,e.z),n=new this.bjsRECAST.Vec3(t.x,t.y,t.z),r=this.navMesh.moveAlong(i,n);return new m.y(r.x,r.y,r.z)},s.prototype.moveAlongToRef=function(e,t,i){var n=new this.bjsRECAST.Vec3(e.x,e.y,e.z),r=new this.bjsRECAST.Vec3(t.x,t.y,t.z),o=this.navMesh.moveAlong(n,r);i.set(o.x,o.y,o.z)},s.prototype.computePath=function(e,t){for(var i=new this.bjsRECAST.Vec3(e.x,e.y,e.z),n=new this.bjsRECAST.Vec3(t.x,t.y,t.z),r=this.navMesh.computePath(i,n),o=r.getPointCount(),a=[],s=0;s<o;s++){var c=r.getPoint(s);a.push(new m.y(c.x,c.y,c.z))}return a},s.prototype.createCrowd=function(e,t,i){return new o(this,e,t,i)},s.prototype.setDefaultQueryExtent=function(e){var t=new this.bjsRECAST.Vec3(e.x,e.y,e.z);this.navMesh.setDefaultQueryExtent(t)},s.prototype.getDefaultQueryExtent=function(){var e=this.navMesh.getDefaultQueryExtent();return new m.y(e.x,e.y,e.z)},s.prototype.buildFromNavmeshData=function(e){var t=e.length*e.BYTES_PER_ELEMENT,i=this.bjsRECAST._malloc(t),n=new Uint8Array(this.bjsRECAST.HEAPU8.buffer,i,t);n.set(e);var r=new this.bjsRECAST.NavmeshData;r.dataPointer=n.byteOffset,r.size=e.length,this.navMesh=new this.bjsRECAST.NavMesh,this.navMesh.buildFromNavmeshData(r),this.bjsRECAST._free(n.byteOffset)},s.prototype.getNavmeshData=function(){var e=this.navMesh.getNavmeshData(),t=new Uint8Array(this.bjsRECAST.HEAPU8.buffer,e.dataPointer,e.size),i=new Uint8Array(e.size);return i.set(t),this.navMesh.freeNavmeshData(e),i},s.prototype.getDefaultQueryExtentToRef=function(e){var t=this.navMesh.getDefaultQueryExtent();e.set(t.x,t.y,t.z)},s.prototype.dispose=function(){},s.prototype.isSupported=function(){return void 0!==this.bjsRECAST},s),o=(a.prototype.addAgent=function(e,t,i){var n=new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParam
1s;n.radius=t.radius,n.height=t.height,n.maxAcceleration=t.maxAcceleration,n.maxSpeed=t.maxSpeed,n.collisionQueryRange=t.collisionQueryRange,n.pathOptimizationRange=t.pathOptimizationRange,n.separationWeight=t.separationWeight,n.updateFlags=7,n.obstacleAvoidanceType=0,n.queryFilterType=0,n.userData=0;var r=this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(e.x,e.y,e.z),n);return this.transforms.push(i),this.agents.push(r),r},a.prototype.getAgentPosition=function(e){var t=this.recastCrowd.getAgentPosition(e);return new m.y(t.x,t.y,t.z)},a.prototype.getAgentPositionToRef=function(e,t){var i=this.recastCrowd.getAgentPosition(e);t.set(i.x,i.y,i.z)},a.prototype.getAgentVelocity=function(e){var t=this.recastCrowd.getAgentVelocity(e);return new m.y(t.x,t.y,t.z)},a.prototype.getAgentVelocityToRef=function(e,t){var i=this.recastCrowd.getAgentVelocity(e);t.set(i.x,i.y,i.z)},a.prototype.agentGoto=function(e,t){this.recastCrowd.agentGoto(e,new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x,t.y,t.z))},a.prototype.agentTeleport=function(e,t){this.recastCrowd.agentTeleport(e,new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x,t.y,t.z))},a.prototype.updateAgentParameters=function(e,t){var i=this.recastCrowd.getAgentParameters(e);void 0!==t.radius&&(i.radius=t.radius),void 0!==t.height&&(i.height=t.height),void 0!==t.maxAcceleration&&(i.maxAcceleration=t.maxAcceleration),void 0!==t.maxSpeed&&(i.maxSpeed=t.maxSpeed),void 0!==t.collisionQueryRange&&(i.collisionQueryRange=t.collisionQueryRange),void 0!==t.pathOptimizationRange&&(i.pathOptimizationRange=t.pathOptimizationRange),void 0!==t.separationWeight&&(i.separationWeight=t.separationWeight),this.recastCrowd.setAgentParameters(e,i)},a.prototype.removeAgent=function(e){this.recastCrowd.removeAgent(e);var t=this.agents.indexOf(e);-1<t&&(this.agents.splice(t,1),this.transforms.splice(t,1))},a.prototype.getAgents=function(){return this.agents},a.prototype.update=function(e){this.recastCrowd.update(e);for(var t=0;t<this.agents.length;t++)this.transforms[t].position=this.getAgentPosition(this.agents[t])},a.prototype.setDefaultQueryExtent=function(e){var t=new this.bjsRECASTPlugin.bjsRECAST.Vec3(e.x,e.y,e.z);this.recastCrowd.setDefaultQueryExtent(t)},a.prototype.getDefaultQueryExtent=function(){var e=this.recastCrowd.getDefaultQueryExtent();return new m.y(e.x,e.y,e.z)},a.prototype.getDefaultQueryExtentToRef=function(e){var t=this.recastCrowd.getDefaultQueryExtent();e.set(t.x,t.y,t.z)},a.prototype.dispose=function(){this.recastCrowd.destroy(),this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null},a);function a(e,t,i,n){var r=this;this.recastCrowd={},this.transforms=new Array,this.agents=new Array,this._onBeforeAnimationsObserver=null,this.bjsRECASTPlugin=e,this.recastCrowd=new this.bjsRECASTPlugin.bjsRECAST.Crowd(t,i,this.bjsRECASTPlugin.navMesh.getNavMesh()),this._scene=n,this._onBeforeAnimationsObserver=n.onBeforeAnimationsObservable.add(function(){r.update(.001*n.getEngine().getDeltaTime())})}function s(e){void 0===e&&(e=Recast),this.bjsRECAST={},this.name="RecastJSPlugin","function"==typeof e?e(this.bjsRECAST):this.bjsRECAST=e,this.isSupported()||n.a.Error("RecastJS is not available. Please make sure you included the js file.")}},function(e,l,u){"use strict";u.r(l),function(e){u.d(l,"Debug",function(){return c});var t=u(204),i=u(144);for(var n in t)["Debug","default"].indexOf(n)<0&&function(e){u.d(l,e,function(){return t[e]})}(n);var r=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==r){r.BABYLON=o,r.BABYLON=r.BABYLON||{};var o=r.BABYLON;o.Debug=o.Debug||{};var a=[];for(var s in i)o.Debug[s]=i[s],a.push(s);for(var s in t)o[s]=t[s]}var c={AxesViewer:i.AxesViewer,BoneAxesViewer:i.BoneAxesViewer,PhysicsViewer:i.PhysicsViewer,SkeletonViewer:i.SkeletonViewer}}.call(this,u(321))}],r.c=n,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}
1),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=441);function r(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}var i,n});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.