=e.HAVE_CURRENT_DATA&&(d.needsUpdate=!0)}Texture.call(this,e,t,a,r,n,o,i,s,l),this.generateMipmaps=!1;var d=this;update()}function CompressedTexture(e,t,a,r,n,o,i,s,l,d,p,c){Texture.call(this,null,o,i,s,l,d,r,n,p,c),this.image={width:t,height:a},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function DepthTexture(e,t,a,r,n,o,i,s,l,d){if(d=void 0===d?st:d,d!==st&&d!==lt)throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');void 0===a&&d===st&&(a=je),void 0===a&&d===lt&&(a=et),Texture.call(this,null,r,n,o,i,s,d,a,l),this.image={width:e,height:t},this.magFilter=void 0===i?Oe:i,this.minFilter=void 0===s?Oe:s,this.flipY=!1,this.generateMipmaps=!1}function WireframeGeometry(t){BufferGeometry.call(this),this.type='WireframeGeometry';var a=[],r=[0,0],n={},s=['a','b','c'],d,i,p,l,o,c,e,m,g,f;if(t&&t.isGeometry){var _=t.faces;for(d=0,p=_.length;di;i++)e=h[s[i]],m=h[s[(i+1)%3]],r[0]=u(e,m),r[1]=x(e,m),g=r[0]+','+r[1],void 0===n[g]&&(n[g]={index1:r[0],index2:r[1]})}for(g in n)c=n[g],f=t.vertices[c.index1],a.push(f.x,f.y,f.z),f=t.vertices[c.index2],a.push(f.x,f.y,f.z)}else if(t&&t.isBufferGeometry){var E,y,v,T,b,C,S,A;if(f=new Vector3,null!==t.index){for(E=t.attributes.position,y=t.index,v=t.groups,0===v.length&&(v=[{start:0,count:y.count,materialIndex:0}]),(l=0,o=v.length);li;i++)e=y.getX(d+i),m=y.getX(d+(i+1)%3),r[0]=u(e,m),r[1]=x(e,m),g=r[0]+','+r[1],void 0===n[g]&&(n[g]={index1:r[0],index2:r[1]});for(g in n)c=n[g],f.fromBufferAttribute(E,c.index1),a.push(f.x,f.y,f.z),f.fromBufferAttribute(E,c.index2),a.push(f.x,f.y,f.z)}else for(E=t.attributes.position,d=0,p=E.count/3;di;i++)S=3*d+i,f.fromBufferAttribute(E,S),a.push(f.x,f.y,f.z),A=3*d+(i+1)%3,f.fromBufferAttribute(E,A),a.push(f.x,f.y,f.z)}this.addAttribute('position',new Float32BufferAttribute(a,3))}function ParametricGeometry(e,t,a){Geometry.call(this),this.type='ParametricGeometry',this.parameters={func:e,slices:t,stacks:a},this.fromBufferGeometry(new ParametricBufferGeometry(e,t,a)),this.mergeVertices()}function ParametricBufferGeometry(e,t,r){BufferGeometry.call(this),this.type='ParametricBufferGeometry',this.parameters={func:e,slices:t,stacks:r};var n=[],o=[],s=[],l=[],p=1e-5,m=new Vector3,g=new Vector3,f=new Vector3,_=new Vector3,h=new Vector3,E=t+1,y,i;for(y=0;y<=r;y++){var x=y/r;for(i=0;i<=t;i++){var v=i/t;g=e(v,x,g),o.push(g.x,g.y,g.z),0<=v-p?(f=e(v-p,x,f),_.subVectors(g,f)):(f=e(v+p,x,f),_.subVectors(f,g)),0<=x-p?(f=e(v,x-p,f),h.subVectors(g,f)):(f=e(v,x+p,f),h.subVectors(f,g)),m.crossVectors(_,h).normalize(),s.push(m.x,m.y,m.z),l.push(v,x)}}for(y=0;yi&&(0.2>t&&(o[e+0]+=1),0.2>a&&(o[e+2]+=1),0.2>r&&(o[e+4]+=1))}}function pushVertex(e){n.push(e.x,e.y,e.z)}function getVertexByIndex(t,a){var r=3*t;a.x=e[r+0],a.y=e[r+1],a.z=e[r+2]}function correctUVs(){for(var e=new Vector3,t=new Vector3,a=new Vector3,r=new Vector3,s=new Vector2,l=new Vector2,d=new Vector2,p=0,i=0;pr&&1===e.x&&(o[t]=e.x-1),0===a.x&&0===a.z&&(o[t]=r/2/C+0.5)}function azimuth(e){return i(e.z,-e.x)}function inclination(e){return i(-e.y,l(e.x*e.x+e.z*e.z))}BufferGeometry.call(this),this.type='PolyhedronBufferGeometry',this.parameters={vertices:e,indices:t,radius:a,detail:r},a=a||1,r=r||0;var n=[],o=[];(function subdivide(e){for(var r=new Vector3,a=new Vector3,n=new Vector3,o=0;ov;v++)p=l[d[v]],c=l[d[(v+1)%3]],o[0]=u(p,c),o[1]=x(p,c),m=o[0]+','+o[1],void 0===s[m]?s[m]={index1:o[0],index2:o[1],face1:E,face2:void 0}:s[m].face2=E}for(m in s){var T=s[m];if(T.face2===void 0||h[T.face1].normal.dot(h[T.face2].normal)<=n){var e=_[T.index1];r.push(e.x,e.y,e.z),e=_[T.index2],r.push(e.x,e.y,e.z)}}this.addAttribute('position',new Float32BufferAttribute(r,3))}function CylinderGeometry(e,t,a,r,n,o,i,s){Geometry.call(this),this.type='CylinderGeometry',this.parameters={radiusTop:e,radiusBottom:t,height:a,radialSegments:r,heightSegments:n,openEnded:o,thetaStart:i,thetaLength:s},this.fromBufferGeometry(new CylinderBufferGeometry(e,t,a,r,n,o,i,s)),this.mergeVertices()}function CylinderBufferGeometry(e,t,r,n,o,a,i,s){function generateCap(a){var r=new Vector2,o=new Vector3,_=0,E=!0===a?e:t,v=!0===a?1:-1,b,x,C;for(x=h,b=1;b<=n;b++)d.push(0,y*v,0),c.push(0,v,0),f.push(0.5,0.5),h++;for(C=h,b=0;b<=n;b++){var S=b/n,u=S*s+i,A=g(u),R=m(u);o.x=E*R,o.y=y*v,o.z=E*A,d.push(o.x,o.y,o.z),c.push(0,v,0),r.x=0.5*A+0.5,r.y=0.5*R*v+0.5,f.push(r.x,r.y),h++}for(b=0;bthis.duration&&this.resetDuration(),this.optimize()}function MaterialLoader(e){this.manager=e===void 0?la:e,this.textures={}}function BufferGeometryLoader(e){this.manager=e===void 0?la:e}function Loader(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function JSONLoader(e){'boolean'==typeof e&&(console.warn('THREE.JSONLoader: showStatus parameter has been removed from constructor.'),e=void 0),this.manager=e===void 0?la:e,this.withCredentials=!1}function ObjectLoader(e){this.manager=e===void 0?la:e,this.texturePath=''}function CatmullRom(e,t,a,r,n){var o=0.5*(r-t),i=0.5*(n-a),s=e*e;return(2*a-2*r+o+i)*(e*s)+(-3*a+3*r-2*o-i)*s+o*e+a}function QuadraticBezierP0(e,t){var a=1-e;return a*a*t}function QuadraticBezierP1(e,t){return 2*(1-e)*e*t}function QuadraticBezierP2(e,t){return e*e*t}function QuadraticBezier(e,t,a,r){return QuadraticBezierP0(e,t)+QuadraticBezierP1(e,a)+QuadraticBezierP2(e,r)}function CubicBezierP0(e,t){var a=1-e;return a*a*a*t}function CubicBezierP1(e,t){var a=1-e;return 3*a*a*e*t}function CubicBezierP2(e,t){return 3*(1-e)*e*e*t}function CubicBezierP3(e,t){return e*e*e*t}function CubicBezier(e,t,a,r,n){return CubicBezierP0(e,t)+CubicBezierP1(e,a)+CubicBezierP2(e,r)+CubicBezierP3(e,n)}function Curve(){this.arcLengthDivisions=200}function LineCurve(e,t){Curve.call(this),this.v1=e,this.v2=t}function CurvePath(){Curve.call(this),this.curves=[],this.autoClose=!1}function EllipseCurve(e,t,a,r,n,o,i,s){Curve.call(this),this.aX=e,this.aY=t,this.xRadius=a,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=i,this.aRotation=s||0}function SplineCurve(e){Curve.call(this),this.points=e===void 0?[]:e}function CubicBezierCurve(e,t,a,r){Curve.call(this),this.v0=e,this.v1=t,this.v2=a,this.v3=r}function QuadraticBezierCurve(e,t,a){Curve.call(this),this.v0=e,this.v1=t,this.v2=a}function Path(e){CurvePath.call(this),this.currentPoint=new Vector2,e&&this.fromPoints(e)}function Shape(){Path.apply(this,arguments),this.holes=[]}function ShapePath(){this.subPaths=[],this.currentPath=null}function Font(e){this.data=e}function FontLoader(e){this.manager=e===void 0?la:e}function AudioLoader(e){this.manager=e===void 0?la:e}function StereoCamera(){this.type='StereoCamera',this.aspect=1,this.eyeSep=0.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function CubeCamera(e,t,a){Object3D.call(this),this.type='CubeCamera';var r=90,n=1,o=new PerspectiveCamera(r,n,e,t);o.up.set(0,-1,0),o.lookAt(new Vector3(1,0,0)),this.add(o);var i=new PerspectiveCamera(r,n,e,t);i.up.set(0,-1,0),i.lookAt(new Vector3(-1,0,0)),this.add(i);var s=new PerspectiveCamera(r,n,e,t);s.up.set(0,0,1),s.lookAt(new Vector3(0,1,0)),this.add(s);var l=new PerspectiveCamera(r,n,e,t);l.up.set(0,0,-1),l.lookAt(new Vector3(0,-1,0)),this.add(l);var d=new PerspectiveCamera(r,n,e,t);d.up.set(0,-1,0),d.lookAt(new Vector3(0,0,1)),this.add(d);var p=new PerspectiveCamera(r,n,e,t);p.up.set(0,-1,0),p.lookAt(new Vector3(0,0,-1)),this.add(p);this.renderTarget=new WebGLRenderTargetCube(a,a,{format:at,magFilter:We,minFilter:We}),this.renderTarget.texture.name='CubeCamera',this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var a=this.renderTarget,r=a.texture.generateMipmaps;a.texture.generateMipmaps=!1,a.activeCubeFace=0,e.render(t,o,a),a.activeCubeFace=1,e.render(t,i,a),a.activeCubeFace=2,e.render(t,s,a),a.activeCubeFace=3,e.render(t,l,a),a.activeCubeFace=4,e.render(t,d,a),a.texture.generateMipmaps=r,a.activeCubeFace=5,e.render(t,p,a),e.setRenderTarget(null)},this.clear=function(e,t,a,r){for(var n=this.renderTarget,o=0;6>o;o++)n.activeCubeFace=o,e.setRenderTarget(n),e.clear(t,a,r);e.setRenderTarget(null)}}function AudioListener(){Object3D.call(this),this.type='AudioListener',this.context=_a.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Audio(e){Object3D.call(this),this.type='Audio',this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType='empty',this.filters=[]}function PositionalAudio(e){Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function AudioAnalyser(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t===void 0?2048:t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function PropertyMixer(e,t,a){this.binding=e,this.valueSize=a;var r=Float64Array,n;'quaternion'===t?n=this._slerp:'string'===t||'bool'===t?(r=Array,n=this._select):n=this._lerp;this.buffer=new r(4*a),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Composite(e,t,a){var r=a||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function PropertyBinding(e,t,a){this.path=t,this.parsedPath=a||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function AnimationObjectGroup(){this.uuid=Wt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,a=arguments.length;t!==a;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function AnimationAction(e,t,a){this._mixer=e,this._clip=t,this._localRoot=a||null;for(var r=t.tracks,n=r.length,o=Array(n),s={endingStart:Ct,endingEnd:Ct},l=0,i;l!==n;++l)i=r[l].createInterpolant(null),o[l]=i,i.settings=s;this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=yt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=Infinity,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function AnimationMixer(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Uniform(e){'string'==typeof e&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),e=arguments[1]),this.value=e}function InstancedBufferGeometry(){BufferGeometry.call(this),this.type='InstancedBufferGeometry',this.maxInstancedCount=void 0}function InterleavedBufferAttribute(e,t,a,r){this.uuid=Wt.generateUUID(),this.data=e,this.itemSize=t,this.offset=a,this.normalized=!0===r}function InterleavedBuffer(e,t){this.uuid=Wt.generateUUID(),this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function InstancedInterleavedBuffer(e,t,a){InterleavedBuffer.call(this,e,t),this.meshPerAttribute=a||1}function InstancedBufferAttribute(e,t,a){BufferAttribute.call(this,e,t),this.meshPerAttribute=a||1}function Raycaster(e,t,a,r){this.ray=new Ray(e,t),this.near=a||0,this.far=r||Infinity,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'),this.Points}}})}function ascSort(e,t){return e.distance-t.distance}function intersectObject(e,t,a,r){if(!1!==e.visible&&(e.raycast(t,a),!0===r))for(var n=e.children,o=0,i=n.length;oe.length&&console.warn('THREE.CatmullRomCurve3: Points array needs at least two entries.'),this.points=e||[],this.closed=!1}function CubicBezierCurve3(e,t,a,r){Curve.call(this),this.v0=e,this.v1=t,this.v2=a,this.v3=r}function QuadraticBezierCurve3(e,t,a){Curve.call(this),this.v0=e,this.v1=t,this.v2=a}function LineCurve3(e,t){Curve.call(this),this.v1=e,this.v2=t}function ArcCurve(e,t,a,r,n,o){EllipseCurve.call(this,e,t,a,a,r,n,o)}function Face4(e,t,a,r,n,o,i){return console.warn('THREE.Face4 has been removed. A THREE.Face3 will be created instead.'),new Face3(e,t,a,n,o,i)}function MeshFaceMaterial(e){return console.warn('THREE.MeshFaceMaterial has been removed. Use an Array instead.'),e}function MultiMaterial(e){return void 0===e&&(e=[]),console.warn('THREE.MultiMaterial has been removed. Use an Array instead.'),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function PointCloud(e,t){return console.warn('THREE.PointCloud has been renamed to THREE.Points.'),new Points(e,t)}function Particle(e){return console.warn('THREE.Particle has been renamed to THREE.Sprite.'),new Sprite(e)}function ParticleSystem(e,t){return console.warn('THREE.ParticleSystem has been renamed to THREE.Points.'),new Points(e,t)}function PointCloudMaterial(e){return console.warn('THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.'),new PointsMaterial(e)}function ParticleBasicMaterial(e){return console.warn('THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.'),new PointsMaterial(e)}function ParticleSystemMaterial(e){return console.warn('THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.'),new PointsMaterial(e)}function Vertex(e,t,a){return console.warn('THREE.Vertex has been removed. Use THREE.Vector3 instead.'),new Vector3(e,t,a)}function DynamicBufferAttribute(e,t){return console.warn('THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.'),new BufferAttribute(e,t).setDynamic(!0)}function Int8Attribute(e,t){return console.warn('THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.'),new Int8BufferAttribute(e,t)}function Uint8Attribute(e,t){return console.warn('THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.'),new Uint8BufferAttribute(e,t)}function Uint8ClampedAttribute(e,t){return console.warn('THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.'),new Uint8ClampedBufferAttribute(e,t)}function Int16Attribute(e,t){return console.warn('THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.'),new Int16BufferAttribute(e,t)}function Uint16Attribute(e,t){return console.warn('THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.'),new Uint16BufferAttribute(e,t)}function Int32Attribute(e,t){return console.warn('THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.'),new Int32BufferAttribute(e,t)}function Uint32Attribute(e,t){return console.warn('THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.'),new Uint32BufferAttribute(e,t)}function Float32Attribute(e,t){return console.warn('THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.'),new Float32BufferAttribute(e,t)}function Float64Attribute(e,t){return console.warn('THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.'),new Float64BufferAttribute(e,t)}function ClosedSplineCurve3(e){console.warn('THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.'),CatmullRomCurve3.call(this,e),this.type='catmullrom',this.closed=!0}function SplineCurve3(e){console.warn('THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.'),CatmullRomCurve3.call(this,e),this.type='catmullrom'}function Spline(e){console.warn('THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.'),CatmullRomCurve3.call(this,e),this.type='catmullrom'}function BoundingBoxHelper(e,t){return console.warn('THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.'),new BoxHelper(e,t)}function EdgesHelper(e,t){return console.warn('THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.'),new LineSegments(new EdgesGeometry(e.geometry),new LineBasicMaterial({color:void 0===t?16777215:t}))}function WireframeHelper(e,t){return console.warn('THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.'),new LineSegments(new WireframeGeometry(e.geometry),new LineBasicMaterial({color:void 0===t?16777215:t}))}function XHRLoader(e){return console.warn('THREE.XHRLoader has been renamed to THREE.FileLoader.'),new FileLoader(e)}function BinaryTextureLoader(e){return console.warn('THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.'),new DataTextureLoader(e)}function Projector(){console.error('THREE.Projector has been moved to /examples/js/renderers/Projector.js.'),this.projectVector=function(e,t){console.warn('THREE.Projector: .projectVector() is now vector.project().'),e.project(t)},this.unprojectVector=function(e,t){console.warn('THREE.Projector: .unprojectVector() is now vector.unproject().'),e.unproject(t)},this.pickingRay=function(){console.error('THREE.Projector: .pickingRay() is now raycaster.setFromCamera().')}}function CanvasRenderer(){console.error('THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js'),this.domElement=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}var r=Math.tan,n=Math.atan,o=Math.acos,m=Math.sin,g=Math.cos,i=Math.atan2,l=Math.sqrt,s=Math.pow,d=Math.round,p=Math.LN2,c=Math.log,u=Math.min,f=Math.sign,_=Math.floor,h=Number.isInteger,E=Number.EPSILON,y=Math.ceil,x=Math.max,T=Math.abs,C=Math.PI;Object.defineProperty(t,'__esModule',{value:!0}),a.d(t,'WebGLRenderTargetCube',function(){return WebGLRenderTargetCube}),a.d(t,'WebGLRenderTarget',function(){return WebGLRenderTarget}),a.d(t,'WebGLRenderer',function(){return WebGLRenderer}),a.d(t,'ShaderLib',function(){return $t}),a.d(t,'UniformsLib',function(){return Zt}),a.d(t,'UniformsUtils',function(){return Jt}),a.d(t,'ShaderChunk',function(){return Qt}),a.d(t,'FogExp2',function(){return FogExp2}),a.d(t,'Fog',function(){return Fog}),a.d(t,'Scene',function(){return Scene}),a.d(t,'LensFlare',function(){return LensFlare}),a.d(t,'Sprite',function(){return Sprite}),a.d(t,'LOD',function(){return LOD}),a.d(t,'SkinnedMesh',function(){return SkinnedMesh}),a.d(t,'Skeleton',function(){return Skeleton}),a.d(t,'Bone',function(){return Bone}),a.d(t,'Mesh',function(){return Mesh}),a.d(t,'LineSegments',function(){return LineSegments}),a.d(t,'LineLoop',function(){return LineLoop}),a.d(t,'Line',function(){return Line}),a.d(t,'Points',function(){return Points}),a.d(t,'Group',function(){return Group}),a.d(t,'VideoTexture',function(){return VideoTexture}),a.d(t,'DataTexture',function(){return DataTexture}),a.d(t,'CompressedTexture',function(){return CompressedTexture}),a.d(t,'CubeTexture',function(){return CubeTexture}),a.d(t,'CanvasTexture',function(){return CanvasTexture}),a.d(t,'DepthTexture',function(){return DepthTexture}),a.d(t,'Texture',function(){return Texture}),a.d(t,'CompressedTextureLoader',function(){return CompressedTextureLoader}),a.d(t,'DataTextureLoader',function(){return DataTextureLoader}),a.d(t,'CubeTextureLoader',function(){return CubeTextureLoader}),a.d(t,'TextureLoader',function(){return TextureLoader}),a.d(t,'ObjectLoader',function(){return ObjectLoader}),a.d(t,'MaterialLoader',function(){return MaterialLoader}),a.d(t,'BufferGeometryLoader',function(){return BufferGeometryLoader}),a.d(t,'DefaultLoadingManager',function(){return la}),a.d(t,'LoadingManager',function(){return LoadingManager}),a.d(t,'JSONLoader',function(){return JSONLoader}),a.d(t,'ImageLoader',function(){return ImageLoader}),a.d(t,'FontLoader',function(){return FontLoader}),a.d(t,'FileLoader',function(){return FileLoader}),a.d(t,'Loader',function(){return Loader}),a.d(t,'Cache',function(){return sa}),a.d(t,'AudioLoader',function(){return AudioLoader}),a.d(t,'SpotLightShadow',function(){return SpotLightShadow}),a.d(t,'SpotLight',function(){return SpotLight}),a.d(t,'PointLight',function(){return PointLight}),a.d(t,'RectAreaLight',function(){return RectAreaLight}),a.d(t,'HemisphereLight',function(){return HemisphereLight}),a.d(t,'DirectionalLightShadow',function(){return DirectionalLightShadow}),a.d(t,'DirectionalLight',function(){return DirectionalLight}),a.d(t,'AmbientLight',function(){return AmbientLight}),a.d(t,'LightShadow',function(){return LightShadow}),a.d(t,'Light',function(){return Light}),a.d(t,'StereoCamera',function(){return StereoCamera}),a.d(t,'PerspectiveCamera',function(){return PerspectiveCamera}),a.d(t,'OrthographicCamera',function(){return OrthographicCamera}),a.d(t,'CubeCamera',function(){return CubeCamera}),a.d(t,'ArrayCamera',function(){return ArrayCamera}),a.d(t,'Camera',function(){return Camera}),a.d(t,'AudioListener',function(){return AudioListener}),a.d(t,'PositionalAudio',function(){return PositionalAudio}),a.d(t,'AudioContext',function(){return _a}),a.d(t,'AudioAnalyser',function(){return AudioAnalyser}),a.d(t,'Audio',function(){return Audio}),a.d(t,'VectorKeyframeTrack',function(){return VectorKeyframeTrack}),a.d(t,'StringKeyframeTrack',function(){return StringKeyframeTrack}),a.d(t,'QuaternionKeyframeTrack',function(){return QuaternionKeyframeTrack}),a.d(t,'NumberKeyframeTrack',function(){return NumberKeyframeTrack}),a.d(t,'ColorKeyframeTrack',function(){return ColorKeyframeTrack}),a.d(t,'BooleanKeyframeTrack',function(){return BooleanKeyframeTrack}),a.d(t,'PropertyMixer',function(){return PropertyMixer}),a.d(t,'PropertyBinding',function(){return PropertyBinding}),a.d(t,'KeyframeTrack',function(){return KeyframeTrack}),a.d(t,'AnimationUtils',function(){return da}),a.d(t,'AnimationObjectGroup',function(){return AnimationObjectGroup}),a.d(t,'AnimationMixer',function(){return AnimationMixer}),a.d(t,'AnimationClip',function(){return AnimationClip}),a.d(t,'Uniform',function(){return Uniform}),a.d(t,'InstancedBufferGeometry',function(){return InstancedBufferGeometry}),a.d(t,'BufferGeometry',function(){return BufferGeometry}),a.d(t,'GeometryIdCount',function(){return GeometryIdCount}),a.d(t,'Geometry',function(){return Geometry}),a.d(t,'InterleavedBufferAttribute',function(){return InterleavedBufferAttribute}),a.d(t,'InstancedInterleavedBuffer',function(){return InstancedInterleavedBuffer}),a.d(t,'InterleavedBuffer',function(){return InterleavedBuffer}),a.d(t,'InstancedBufferAttribute',function(){return InstancedBufferAttribute}),a.d(t,'Face3',function(){return Face3}),a.d(t,'Object3D',function(){return Object3D}),a.d(t,'Raycaster',function(){return Raycaster}),a.d(t,'Layers',function(){return Layers}),a.d(t,'EventDispatcher',function(){return EventDispatcher}),a.d(t,'Clock',function(){return Clock}),a.d(t,'QuaternionLinearInterpolant',function(){return QuaternionLinearInterpolant}),a.d(t,'LinearInterpolant',function(){return LinearInterpolant}),a.d(t,'DiscreteInterpolant',function(){return DiscreteInterpolant}),a.d(t,'CubicInterpolant',function(){return CubicInterpolant}),a.d(t,'Interpolant',function(){return Interpolant}),a.d(t,'Triangle',function(){return Triangle}),a.d(t,'Math',function(){return Wt}),a.d(t,'Spherical',function(){return Spherical}),a.d(t,'Cylindrical',function(){return Cylindrical}),a.d(t,'Plane',function(){return Plane}),a.d(t,'Frustum',function(){return Frustum}),a.d(t,'Sphere',function(){return Sphere}),a.d(t,'Ray',function(){return Ray}),a.d(t,'Matrix4',function(){return Matrix4}),a.d(t,'Matrix3',function(){return Matrix3}),a.d(t,'Box3',function(){return Box3}),a.d(t,'Box2',function(){return Box2}),a.d(t,'Line3',function(){return Line3}),a.d(t,'Euler',function(){return Euler}),a.d(t,'Vector4',function(){return Vector4}),a.d(t,'Vector3',function(){return Vector3}),a.d(t,'Vector2',function(){return Vector2}),a.d(t,'Quaternion',function(){return Quaternion}),a.d(t,'Color',function(){return Color}),a.d(t,'ImmediateRenderObject',function(){return ImmediateRenderObject}),a.d(t,'VertexNormalsHelper',function(){return VertexNormalsHelper}),a.d(t,'SpotLightHelper',function(){return SpotLightHelper}),a.d(t,'SkeletonHelper',function(){return SkeletonHelper}),a.d(t,'PointLightHelper',function(){return PointLightHelper}),a.d(t,'RectAreaLightHelper',function(){return RectAreaLightHelper}),a.d(t,'HemisphereLightHelper',function(){return HemisphereLightHelper}),a.d(t,'GridHelper',function(){return GridHelper}),a.d(t,'PolarGridHelper',function(){return PolarGridHelper}),a.d(t,'FaceNormalsHelper',function(){return FaceNormalsHelper}),a.d(t,'DirectionalLightHelper',function(){return DirectionalLightHelper}),a.d(t,'CameraHelper',function(){return CameraHelper}),a.d(t,'BoxHelper',function(){return BoxHelper}),a.d(t,'Box3Helper',function(){return Box3Helper}),a.d(t,'PlaneHelper',function(){return PlaneHelper}),a.d(t,'ArrowHelper',function(){return ArrowHelper}),a.d(t,'AxisHelper',function(){return AxisHelper}),a.d(t,'CatmullRomCurve3',function(){return CatmullRomCurve3}),a.d(t,'CubicBezierCurve3',function(){return CubicBezierCurve3}),a.d(t,'QuadraticBezierCurve3',function(){return QuadraticBezierCurve3}),a.d(t,'LineCurve3',function(){return LineCurve3}),a.d(t,'ArcCurve',function(){return ArcCurve}),a.d(t,'EllipseCurve',function(){return EllipseCurve}),a.d(t,'SplineCurve',function(){return SplineCurve}),a.d(t,'CubicBezierCurve',function(){return CubicBezierCurve}),a.d(t,'QuadraticBezierCurve',function(){return QuadraticBezierCurve}),a.d(t,'LineCurve',function(){return LineCurve}),a.d(t,'Shape',function(){return Shape}),a.d(t,'Path',function(){return Path}),a.d(t,'ShapePath',function(){return ShapePath}),a.d(t,'Font',function(){return Font}),a.d(t,'CurvePath',function(){return CurvePath}),a.d(t,'Curve',function(){return Curve}),a.d(t,'ShapeUtils',function(){return na}),a.d(t,'SceneUtils',function(){return Ca}),a.d(t,'WebGLUtils',function(){return WebGLUtils}),a.d(t,'WireframeGeometry',function(){return WireframeGeometry}),a.d(t,'ParametricGeometry',function(){return ParametricGeometry}),a.d(t,'ParametricBufferGeometry',function(){return ParametricBufferGeometry}),a.d(t,'TetrahedronGeometry',function(){return TetrahedronGeometry}),a.d(t,'TetrahedronBufferGeometry',function(){return TetrahedronBufferGeometry}),a.d(t,'OctahedronGeometry',function(){return OctahedronGeometry}),a.d(t,'OctahedronBufferGeometry',function(){return OctahedronBufferGeometry}),a.d(t,'IcosahedronGeometry',function(){return IcosahedronGeometry}),a.d(t,'IcosahedronBufferGeometry',function(){return IcosahedronBufferGeometry}),a.d(t,'DodecahedronGeometry',function(){return DodecahedronGeometry}),a.d(t,'DodecahedronBufferGeometry',function(){return DodecahedronBufferGeometry}),a.d(t,'PolyhedronGeometry',function(){return PolyhedronGeometry}),a.d(t,'PolyhedronBufferGeometry',function(){return PolyhedronBufferGeometry}),a.d(t,'TubeGeometry',function(){return TubeGeometry}),a.d(t,'TubeBufferGeometry',function(){return TubeBufferGeometry}),a.d(t,'TorusKnotGeometry',function(){return TorusKnotGeometry}),a.d(t,'TorusKnotBufferGeometry',function(){return TorusKnotBufferGeometry}),a.d(t,'TorusGeometry',function(){return TorusGeometry}),a.d(t,'TorusBufferGeometry',function(){return TorusBufferGeometry}),a.d(t,'TextGeometry',function(){return TextGeometry}),a.d(t,'TextBufferGeometry',function(){return TextBufferGeometry}),a.d(t,'SphereGeometry',function(){return SphereGeometry}),a.d(t,'SphereBufferGeometry',function(){return SphereBufferGeometry}),a.d(t,'RingGeometry',function(){return RingGeometry}),a.d(t,'RingBufferGeometry',function(){return RingBufferGeometry}),a.d(t,'PlaneGeometry',function(){return PlaneGeometry}),a.d(t,'PlaneBufferGeometry',function(){return PlaneBufferGeometry}),a.d(t,'LatheGeometry',function(){return LatheGeometry}),a.d(t,'LatheBufferGeometry',function(){return LatheBufferGeometry}),a.d(t,'ShapeGeometry',function(){return ShapeGeometry}),a.d(t,'ShapeBufferGeometry',function(){return ShapeBufferGeometry}),a.d(t,'ExtrudeGeometry',function(){return ExtrudeGeometry}),a.d(t,'ExtrudeBufferGeometry',function(){return ExtrudeBufferGeometry}),a.d(t,'EdgesGeometry',function(){return EdgesGeometry}),a.d(t,'ConeGeometry',function(){return ConeGeometry}),a.d(t,'ConeBufferGeometry',function(){return ConeBufferGeometry}),a.d(t,'CylinderGeometry',function(){return CylinderGeometry}),a.d(t,'CylinderBufferGeometry',function(){return CylinderBufferGeometry}),a.d(t,'CircleGeometry',function(){return CircleGeometry}),a.d(t,'CircleBufferGeometry',function(){return CircleBufferGeometry}),a.d(t,'BoxGeometry',function(){return BoxGeometry}),a.d(t,'BoxBufferGeometry',function(){return BoxBufferGeometry}),a.d(t,'ShadowMaterial',function(){return ShadowMaterial}),a.d(t,'SpriteMaterial',function(){return SpriteMaterial}),a.d(t,'RawShaderMaterial',function(){return RawShaderMaterial}),a.d(t,'ShaderMaterial',function(){return ShaderMaterial}),a.d(t,'PointsMaterial',function(){return PointsMaterial}),a.d(t,'MeshPhysicalMaterial',function(){return MeshPhysicalMaterial}),a.d(t,'MeshStandardMaterial',function(){return MeshStandardMaterial}),a.d(t,'MeshPhongMaterial',function(){return MeshPhongMaterial}),a.d(t,'MeshToonMaterial',function(){return MeshToonMaterial}),a.d(t,'MeshNormalMaterial',function(){return MeshNormalMaterial}),a.d(t,'MeshLambertMaterial',function(){return MeshLambertMaterial}),a.d(t,'MeshDepthMaterial',function(){return MeshDepthMaterial}),a.d(t,'MeshDistanceMaterial',function(){return MeshDistanceMaterial}),a.d(t,'MeshBasicMaterial',function(){return MeshBasicMaterial}),a.d(t,'LineDashedMaterial',function(){return LineDashedMaterial}),a.d(t,'LineBasicMaterial',function(){return LineBasicMaterial}),a.d(t,'Material',function(){return Material}),a.d(t,'Float64BufferAttribute',function(){return Float64BufferAttribute}),a.d(t,'Float32BufferAttribute',function(){return Float32BufferAttribute}),a.d(t,'Uint32BufferAttribute',function(){return Uint32BufferAttribute}),a.d(t,'Int32BufferAttribute',function(){return Int32BufferAttribute}),a.d(t,'Uint16BufferAttribute',function(){return Uint16BufferAttribute}),a.d(t,'Int16BufferAttribute',function(){return Int16BufferAttribute}),a.d(t,'Uint8ClampedBufferAttribute',function(){return Uint8ClampedBufferAttribute}),a.d(t,'Uint8BufferAttribute',function(){return Uint8BufferAttribute}),a.d(t,'Int8BufferAttribute',function(){return Int8BufferAttribute}),a.d(t,'BufferAttribute',function(){return BufferAttribute}),a.d(t,'REVISION',function(){return v}),a.d(t,'MOUSE',function(){return b}),a.d(t,'CullFaceNone',function(){return S}),a.d(t,'CullFaceBack',function(){return A}),a.d(t,'CullFaceFront',function(){return R}),a.d(t,'CullFaceFrontBack',function(){return M}),a.d(t,'FrontFaceDirectionCW',function(){return I}),a.d(t,'FrontFaceDirectionCCW',function(){return L}),a.d(t,'BasicShadowMap',function(){return N}),a.d(t,'PCFShadowMap',function(){return P}),a.d(t,'PCFSoftShadowMap',function(){return F}),a.d(t,'FrontSide',function(){return w}),a.d(t,'BackSide',function(){return B}),a.d(t,'DoubleSide',function(){return D}),a.d(t,'FlatShading',function(){return O}),a.d(t,'SmoothShading',function(){return U}),a.d(t,'NoColors',function(){return G}),a.d(t,'FaceColors',function(){return W}),a.d(t,'VertexColors',function(){return V}),a.d(t,'NoBlending',function(){return H}),a.d(t,'NormalBlending',function(){return k}),a.d(t,'AdditiveBlending',function(){return z}),a.d(t,'SubtractiveBlending',function(){return X}),a.d(t,'MultiplyBlending',function(){return j}),a.d(t,'CustomBlending',function(){return Y}),a.d(t,'AddEquation',function(){return q}),a.d(t,'SubtractEquation',function(){return K}),a.d(t,'ReverseSubtractEquation',function(){return Z}),a.d(t,'MinEquation',function(){return J}),a.d(t,'MaxEquation',function(){return Q}),a.d(t,'ZeroFactor',function(){return $}),a.d(t,'OneFactor',function(){return ee}),a.d(t,'SrcColorFactor',function(){return te}),a.d(t,'OneMinusSrcColorFactor',function(){return ae}),a.d(t,'SrcAlphaFactor',function(){return re}),a.d(t,'OneMinusSrcAlphaFactor',function(){return ne}),a.d(t,'DstAlphaFactor',function(){return oe}),a.d(t,'OneMinusDstAlphaFactor',function(){return ie}),a.d(t,'DstColorFactor',function(){return se}),a.d(t,'OneMinusDstColorFactor',function(){return le}),a.d(t,'SrcAlphaSaturateFactor',function(){return de}),a.d(t,'NeverDepth',function(){return pe}),a.d(t,'AlwaysDepth',function(){return ce}),a.d(t,'LessDepth',function(){return me}),a.d(t,'LessEqualDepth',function(){return ue}),a.d(t,'EqualDepth',function(){return ge}),a.d(t,'GreaterEqualDepth',function(){return fe}),a.d(t,'GreaterDepth',function(){return _e}),a.d(t,'NotEqualDepth',function(){return he}),a.d(t,'MultiplyOperation',function(){return Ee}),a.d(t,'MixOperation',function(){return ye}),a.d(t,'AddOperation',function(){return ve}),a.d(t,'NoToneMapping',function(){return xe}),a.d(t,'LinearToneMapping',function(){return Te}),a.d(t,'ReinhardToneMapping',function(){return be}),a.d(t,'Uncharted2ToneMapping',function(){return Ce}),a.d(t,'CineonToneMapping',function(){return Se}),a.d(t,'UVMapping',function(){return Ae}),a.d(t,'CubeReflectionMapping',function(){return Re}),a.d(t,'CubeRefractionMapping',function(){return Me}),a.d(t,'EquirectangularReflectionMapping',function(){return Ie}),a.d(t,'EquirectangularRefractionMapping',function(){return Le}),a.d(t,'SphericalReflectionMapping',function(){return Ne}),a.d(t,'CubeUVReflectionMapping',function(){return Pe}),a.d(t,'CubeUVRefractionMapping',function(){return Fe}),a.d(t,'RepeatWrapping',function(){return we}),a.d(t,'ClampToEdgeWrapping',function(){return Be}),a.d(t,'MirroredRepeatWrapping',function(){return De}),a.d(t,'NearestFilter',function(){return Oe}),a.d(t,'NearestMipMapNearestFilter',function(){return Ue}),a.d(t,'NearestMipMapLinearFilter',function(){return Ge}),a.d(t,'LinearFilter',function(){return We}),a.d(t,'LinearMipMapNearestFilter',function(){return Ve}),a.d(t,'LinearMipMapLinearFilter',function(){return He}),a.d(t,'UnsignedByteType',function(){return ke}),a.d(t,'ByteType',function(){return ze}),a.d(t,'ShortType',function(){return Xe}),a.d(t,'UnsignedShortType',function(){return je}),a.d(t,'IntType',function(){return Ye}),a.d(t,'UnsignedIntType',function(){return qe}),a.d(t,'FloatType',function(){return Ke}),a.d(t,'HalfFloatType',function(){return Ze}),a.d(t,'UnsignedShort4444Type',function(){return Je}),a.d(t,'UnsignedShort5551Type',function(){return Qe}),a.d(t,'UnsignedShort565Type',function(){return $e}),a.d(t,'UnsignedInt248Type',function(){return et}),a.d(t,'AlphaFormat',function(){return tt}),a.d(t,'RGBFormat',function(){return at}),a.d(t,'RGBAFormat',function(){return rt}),a.d(t,'LuminanceFormat',function(){return nt}),a.d(t,'LuminanceAlphaFormat',function(){return ot}),a.d(t,'RGBEFormat',function(){return it}),a.d(t,'DepthFormat',function(){return st}),a.d(t,'DepthStencilFormat',function(){return lt}),a.d(t,'RGB_S3TC_DXT1_Format',function(){return dt}),a.d(t,'RGBA_S3TC_DXT1_Format',function(){return pt}),a.d(t,'RGBA_S3TC_DXT3_Format',function(){return ct}),a.d(t,'RGBA_S3TC_DXT5_Format',function(){return mt}),a.d(t,'RGB_PVRTC_4BPPV1_Format',function(){return ut}),a.d(t,'RGB_PVRTC_2BPPV1_Format',function(){return gt}),a.d(t,'RGBA_PVRTC_4BPPV1_Format',function(){return ft}),a.d(t,'RGBA_PVRTC_2BPPV1_Format',function(){return _t}),a.d(t,'RGB_ETC1_Format',function(){return ht}),a.d(t,'LoopOnce',function(){return Et}),a.d(t,'LoopRepeat',function(){return yt}),a.d(t,'LoopPingPong',function(){return vt}),a.d(t,'InterpolateDiscrete',function(){return xt}),a.d(t,'InterpolateLinear',function(){return Tt}),a.d(t,'InterpolateSmooth',function(){return bt}),a.d(t,'ZeroCurvatureEnding',function(){return Ct}),a.d(t,'ZeroSlopeEnding',function(){return St}),a.d(t,'WrapAroundEnding',function(){return At}),a.d(t,'TrianglesDrawMode',function(){return Rt}),a.d(t,'TriangleStripDrawMode',function(){return Mt}),a.d(t,'TriangleFanDrawMode',function(){return It}),a.d(t,'LinearEncoding',function(){return Lt}),a.d(t,'sRGBEncoding',function(){return Nt}),a.d(t,'GammaEncoding',function(){return Pt}),a.d(t,'RGBEEncoding',function(){return Ft}),a.d(t,'LogLuvEncoding',function(){return wt}),a.d(t,'RGBM7Encoding',function(){return Bt}),a.d(t,'RGBM16Encoding',function(){return Dt}),a.d(t,'RGBDEncoding',function(){return Ot}),a.d(t,'BasicDepthPacking',function(){return Ut}),a.d(t,'RGBADepthPacking',function(){return Gt}),a.d(t,'CubeGeometry',function(){return BoxGeometry}),a.d(t,'Face4',function(){return Face4}),a.d(t,'LineStrip',function(){return Sa}),a.d(t,'LinePieces',function(){return Aa}),a.d(t,'MeshFaceMaterial',function(){return MeshFaceMaterial}),a.d(t,'MultiMaterial',function(){return MultiMaterial}),a.d(t,'PointCloud',function(){return PointCloud}),a.d(t,'Particle',function(){return Particle}),a.d(t,'ParticleSystem',function(){return ParticleSystem}),a.d(t,'PointCloudMaterial',function(){return PointCloudMaterial}),a.d(t,'ParticleBasicMaterial',function(){return ParticleBasicMaterial}),a.d(t,'ParticleSystemMaterial',function(){return ParticleSystemMaterial}),a.d(t,'Vertex',function(){return Vertex}),a.d(t,'DynamicBufferAttribute',function(){return DynamicBufferAttribute}),a.d(t,'Int8Attribute',function(){return Int8Attribute}),a.d(t,'Uint8Attribute',function(){return Uint8Attribute}),a.d(t,'Uint8ClampedAttribute',function(){return Uint8ClampedAttribute}),a.d(t,'Int16Attribute',function(){return Int16Attribute}),a.d(t,'Uint16Attribute',function(){return Uint16Attribute}),a.d(t,'Int32Attribute',function(){return Int32Attribute}),a.d(t,'Uint32Attribute',function(){return Uint32Attribute}),a.d(t,'Float32Attribute',function(){return Float32Attribute}),a.d(t,'Float64Attribute',function(){return Float64Attribute}),a.d(t,'ClosedSplineCurve3',function(){return ClosedSplineCurve3}),a.d(t,'SplineCurve3',function(){return SplineCurve3}),a.d(t,'Spline',function(){return Spline}),a.d(t,'BoundingBoxHelper',function(){return BoundingBoxHelper}),a.d(t,'EdgesHelper',function(){return EdgesHelper}),a.d(t,'WireframeHelper',function(){return WireframeHelper}),a.d(t,'XHRLoader',function(){return XHRLoader}),a.d(t,'BinaryTextureLoader',function(){return BinaryTextureLoader}),a.d(t,'GeometryUtils',function(){return Ra}),a.d(t,'ImageUtils',function(){return Ma}),a.d(t,'Projector',function(){return Projector}),a.d(t,'CanvasRenderer',function(){return CanvasRenderer}),E===void 0&&(E=2.220446049250313e-16),h===void 0&&(h=function(e){return'number'==typeof e&&isFinite(e)&&_(e)===e}),f===void 0&&(f=function(e){return 0>e?-1:0r;r++)8===r||13===r||18===r||23===r?t[r]='-':14===r?t[r]='4':(2>=a&&(a=0|33554432+16777216*Math.random()),n=15&a,a>>=4,t[r]=e[19===r?8|3&n:n]);return t.join('')}}(),clamp:function(e,t,a){return x(t,u(a,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,a,r,n){return r+(e-t)*(n-r)/(a-t)},lerp:function(e,a,r){return(1-r)*e+r*a},smoothstep:function(e,t,a){return e<=t?0:e>=a?1:(e=(e-t)/(a-t),e*e*(3-2*e))},smootherstep:function(e,t,a){return e<=t?0:e>=a?1:(e=(e-t)/(a-t),e*e*e*(e*(6*e-15)+10))},randInt:function(e,t){return e+_(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(0.5-Math.random())},degToRad:function(e){return e*Wt.DEG2RAD},radToDeg:function(e){return e*Wt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return s(2,d(c(e)/p))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}};Object.defineProperties(Vector2.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Vector2.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this):(console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this):(console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=u(this.x,e.x),this.y=u(this.y,e.y),this},max:function(e){return this.x=x(this.x,e.x),this.y=x(this.y,e.y),this},clamp:function(e,t){return this.x=x(e.x,u(t.x,this.x)),this.y=x(e.y,u(t.y,this.y)),this},clampScalar:function(){var e=new Vector2,t=new Vector2;return function clampScalar(a,r){return e.set(a,a),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var a=this.length();return this.divideScalar(a||1).multiplyScalar(x(e,u(t,a)))},floor:function(){return this.x=_(this.x),this.y=_(this.y),this},ceil:function(){return this.x=y(this.x),this.y=y(this.y),this},round:function(){return this.x=d(this.x),this.y=d(this.y),this},roundToZero:function(){return this.x=0>this.x?y(this.x):_(this.x),this.y=0>this.y?y(this.y):_(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return l(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return T(this.x)+T(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=i(this.y,this.x);return 0>e&&(e+=2*C),e},distanceTo:function(e){return l(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,a=this.y-e.y;return t*t+a*a},distanceToManhattan:function(e){return T(this.x-e.x)+T(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,a){return this.subVectors(t,e).multiplyScalar(a).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,a){return void 0!==a&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().'),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var a=g(t),r=m(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*a-o*r+e.x,this.y=n*r+o*a+e.y,this}});var Vt=0;Texture.DEFAULT_IMAGE=void 0,Texture.DEFAULT_MAPPING=Ae,Object.defineProperty(Texture.prototype,'needsUpdate',{set:function(e){!0===e&&this.version++}}),Object.assign(Texture.prototype,EventDispatcher.prototype,{constructor:Texture,isTexture:!0,clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){function getDataURL(e){var t;if(e instanceof HTMLCanvasElement)t=e;else{t=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'),t.width=e.width,t.height=e.height;var a=t.getContext('2d');e instanceof ImageData?a.putImageData(e,0,0):a.drawImage(e,0,0,e.width,e.height)}return 2048e.x||1e.x?0:1;break;case De:1===T(_(e.x)%2)?e.x=y(e.x)-e.x:e.x-=_(e.x);}if(0>e.y||1e.y?0:1;break;case De:1===T(_(e.y)%2)?e.y=y(e.y)-e.y:e.y-=_(e.y);}this.flipY&&(e.y=1-e.y)}}}),Object.assign(Vector4.prototype,{isVector4:!0,set:function(e,t,a,r){return this.x=e,this.y=t,this.z=a,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0===e.w?1:e.w,this},add:function(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(t){var a=this.x,r=this.y,n=this.z,o=this.w,i=t.elements;return this.x=i[0]*a+i[4]*r+i[8]*n+i[12]*o,this.y=i[1]*a+i[5]*r+i[9]*n+i[13]*o,this.z=i[2]*a+i[6]*r+i[10]*n+i[14]*o,this.w=i[3]*a+i[7]*r+i[11]*n+i[15]*o,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*o(e.w);var t=l(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t=0.01,a=0.1,r=e.elements,n=r[0],i=r[4],d=r[8],p=r[1],c=r[5],m=r[9],u=r[2],g=r[6],f=r[10],_,h,E,y;if(T(i-p)x&&v>b?vb?xT(M)&&(M=1),this.x=(g-m)/M,this.y=(d-u)/M,this.z=(p-i)/M,this.w=o((n+c+f-1)/2),this},min:function(e){return this.x=u(this.x,e.x),this.y=u(this.y,e.y),this.z=u(this.z,e.z),this.w=u(this.w,e.w),this},max:function(e){return this.x=x(this.x,e.x),this.y=x(this.y,e.y),this.z=x(this.z,e.z),this.w=x(this.w,e.w),this},clamp:function(e,t){return this.x=x(e.x,u(t.x,this.x)),this.y=x(e.y,u(t.y,this.y)),this.z=x(e.z,u(t.z,this.z)),this.w=x(e.w,u(t.w,this.w)),this},clampScalar:function(){var e,t;return function clampScalar(a,r){return void 0==e&&(e=new Vector4,t=new Vector4),e.set(a,a,a,a),t.set(r,r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var a=this.length();return this.divideScalar(a||1).multiplyScalar(x(e,u(t,a)))},floor:function(){return this.x=_(this.x),this.y=_(this.y),this.z=_(this.z),this.w=_(this.w),this},ceil:function(){return this.x=y(this.x),this.y=y(this.y),this.z=y(this.z),this.w=y(this.w),this},round:function(){return this.x=d(this.x),this.y=d(this.y),this.z=d(this.z),this.w=d(this.w),this},roundToZero:function(){return this.x=0>this.x?y(this.x):_(this.x),this.y=0>this.y?y(this.y):_(this.y),this.z=0>this.z?y(this.z):_(this.z),this.w=0>this.w?y(this.w):_(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return l(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return T(this.x)+T(this.y)+T(this.z)+T(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,a){return this.subVectors(t,e).multiplyScalar(a).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,a){return void 0!==a&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Object.assign(WebGLRenderTarget.prototype,EventDispatcher.prototype,{isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:'dispose'})}}),WebGLRenderTargetCube.prototype=Object.create(WebGLRenderTarget.prototype),WebGLRenderTargetCube.prototype.constructor=WebGLRenderTargetCube,WebGLRenderTargetCube.prototype.isWebGLRenderTargetCube=!0,Object.assign(Quaternion,{slerp:function(e,a,r,n){return r.copy(e).slerp(a,n)},slerpFlat:function(e,a,r,n,o,d,p){var t=r[n+0],c=r[n+1],u=r[n+2],g=r[n+3],_=o[d+0],h=o[d+1],y=o[d+2],v=o[d+3];if(g!==v||t!==_||c!==h||u!==y){var x=1-p,s=t*_+c*h+u*y+g*v,T=0<=s?1:-1,b=1-s*s;if(b>E){var C=l(b),S=i(C,s*T);x=m(x*S)/C,p=m(p*S)/C}var A=p*T;if(t=t*x+_*A,c=c*x+h*A,u=u*x+y*A,g=g*x+v*A,x==1-p){var R=1/l(t*t+c*c+u*u+g*g);t*=R,c*=R,u*=R,g*=R}}e[a]=t,e[a+1]=c,e[a+2]=u,e[a+3]=g}}),Object.defineProperties(Quaternion.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(Quaternion.prototype,{set:function(e,t,a,r){return this._x=e,this._y=t,this._z=a,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var a=e._x,r=e._y,n=e._z,o=e.order,i=g,s=m,l=i(a/2),d=i(r/2),p=i(n/2),c=s(a/2),u=s(r/2),f=s(n/2);return'XYZ'===o?(this._x=c*d*p+l*u*f,this._y=l*u*p-c*d*f,this._z=l*d*f+c*u*p,this._w=l*d*p-c*u*f):'YXZ'===o?(this._x=c*d*p+l*u*f,this._y=l*u*p-c*d*f,this._z=l*d*f-c*u*p,this._w=l*d*p+c*u*f):'ZXY'===o?(this._x=c*d*p-l*u*f,this._y=l*u*p+c*d*f,this._z=l*d*f+c*u*p,this._w=l*d*p-c*u*f):'ZYX'===o?(this._x=c*d*p-l*u*f,this._y=l*u*p+c*d*f,this._z=l*d*f-c*u*p,this._w=l*d*p+c*u*f):'YZX'===o?(this._x=c*d*p+l*u*f,this._y=l*u*p+c*d*f,this._z=l*d*f-c*u*p,this._w=l*d*p-c*u*f):'XZY'===o&&(this._x=c*d*p-l*u*f,this._y=l*u*p-c*d*f,this._z=l*d*f+c*u*p,this._w=l*d*p+c*u*f),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var a=t/2,r=m(a);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=g(a),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,a=t[0],r=t[4],n=t[8],o=t[1],i=t[5],d=t[9],p=t[2],c=t[6],m=t[10],u=a+i+m,g;return 0i&&a>m?(g=2*l(1+a-i-m),this._w=(c-d)/g,this._x=0.25*g,this._y=(r+o)/g,this._z=(n+p)/g):i>m?(g=2*l(1+i-a-m),this._w=(n-p)/g,this._x=(r+o)/g,this._y=0.25*g,this._z=(d+c)/g):(g=2*l(1+m-a-i),this._w=(o-r)/g,this._x=(n+p)/g,this._y=(d+c)/g,this._z=0.25*g),this.onChangeCallback(),this},setFromUnitVectors:function(){var e=new Vector3,t;return function setFromUnitVectors(a,r){return void 0===e&&(e=new Vector3),t=a.dot(r)+1,t<1e-6?(t=0,T(a.x)>T(a.z)?e.set(-a.y,a.x,0):e.set(0,-a.z,a.y)):e.crossVectors(a,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return l(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this.onChangeCallback(),this},multiply:function(e,t){return void 0===t?this.multiplyQuaternions(this,e):(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(e,t))},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var a=e._x,r=e._y,n=e._z,o=e._w,i=t._x,s=t._y,l=t._z,d=t._w;return this._x=a*d+o*i+r*l-n*s,this._y=r*d+o*s+n*i-a*l,this._z=n*d+o*l+a*s-r*i,this._w=o*d-a*i-r*s-n*l,this.onChangeCallback(),this},slerp:function(e,a){if(0===a)return this;if(1===a)return this.copy(e);var t=this._x,r=this._y,n=this._z,o=this._w,s=o*e._w+t*e._x+r*e._y+n*e._z;if(0>s?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s)return this._w=o,this._x=t,this._y=r,this._z=n,this;var d=l(1-s*s);if(1e-3>T(d))return this._w=0.5*(o+this._w),this._x=0.5*(t+this._x),this._y=0.5*(r+this._y),this._z=0.5*(n+this._z),this;var p=i(d,s),c=m((1-a)*p)/d,u=m(a*p)/d;return this._w=o*c+this._w*u,this._x=t*c+this._x*u,this._y=r*c+this._y*u,this._z=n*c+this._z*u,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Vector3.prototype,{isVector3:!0,set:function(e,t,a){return this.x=e,this.y=t,this.z=a,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error('index is out of range: '+e);}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error('index is out of range: '+e);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0===t?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'),this.multiplyVectors(e,t))},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e=new Quaternion;return function applyEuler(t){return t&&t.isEuler||console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e=new Quaternion;return function applyAxisAngle(t,a){return this.applyQuaternion(e.setFromAxisAngle(t,a))}}(),applyMatrix3:function(t){var a=this.x,r=this.y,n=this.z,o=t.elements;return this.x=o[0]*a+o[3]*r+o[6]*n,this.y=o[1]*a+o[4]*r+o[7]*n,this.z=o[2]*a+o[5]*r+o[8]*n,this},applyMatrix4:function(t){var a=this.x,r=this.y,n=this.z,o=t.elements,e=1/(o[3]*a+o[7]*r+o[11]*n+o[15]);return this.x=(o[0]*a+o[4]*r+o[8]*n+o[12])*e,this.y=(o[1]*a+o[5]*r+o[9]*n+o[13])*e,this.z=(o[2]*a+o[6]*r+o[10]*n+o[14])*e,this},applyQuaternion:function(e){var t=this.x,a=this.y,r=this.z,n=e.x,o=e.y,i=e.z,s=e.w,l=s*t+o*r-i*a,d=s*a+i*t-n*r,p=s*r+n*a-o*t,c=-n*t-o*a-i*r;return this.x=l*s+c*-n+d*-i-p*-o,this.y=d*s+c*-o+p*-n-l*-i,this.z=p*s+c*-i+l*-o-d*-n,this},project:function(){var e=new Matrix4;return function project(t){return e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e=new Matrix4;return function unproject(t){return e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(t){var a=this.x,r=this.y,n=this.z,o=t.elements;return this.x=o[0]*a+o[4]*r+o[8]*n,this.y=o[1]*a+o[5]*r+o[9]*n,this.z=o[2]*a+o[6]*r+o[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=u(this.x,e.x),this.y=u(this.y,e.y),this.z=u(this.z,e.z),this},max:function(e){return this.x=x(this.x,e.x),this.y=x(this.y,e.y),this.z=x(this.z,e.z),this},clamp:function(e,t){return this.x=x(e.x,u(t.x,this.x)),this.y=x(e.y,u(t.y,this.y)),this.z=x(e.z,u(t.z,this.z)),this},clampScalar:function(){var e=new Vector3,t=new Vector3;return function clampScalar(a,r){return e.set(a,a,a),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var a=this.length();return this.divideScalar(a||1).multiplyScalar(x(e,u(t,a)))},floor:function(){return this.x=_(this.x),this.y=_(this.y),this.z=_(this.z),this},ceil:function(){return this.x=y(this.x),this.y=y(this.y),this.z=y(this.z),this},round:function(){return this.x=d(this.x),this.y=d(this.y),this.z=d(this.z),this},roundToZero:function(){return this.x=0>this.x?y(this.x):_(this.x),this.y=0>this.y?y(this.y):_(this.y),this.z=0>this.z?y(this.z):_(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return l(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return T(this.x)+T(this.y)+T(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,a){return this.subVectors(t,e).multiplyScalar(a).add(e)},cross:function(e,t){if(void 0!==t)return console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(e,t);var a=this.x,r=this.y,n=this.z;return this.x=r*e.z-n*e.y,this.y=n*e.x-a*e.z,this.z=a*e.y-r*e.x,this},crossVectors:function(e,t){var a=e.x,r=e.y,n=e.z,o=t.x,i=t.y,s=t.z;return this.x=r*s-n*i,this.y=n*o-a*s,this.z=a*i-r*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new Vector3;return function projectOnPlane(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new Vector3;return function reflect(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/l(this.lengthSq()*e.lengthSq());return o(Wt.clamp(t,-1,1))},distanceTo:function(e){return l(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,a=this.y-e.y,r=this.z-e.z;return t*t+a*a+r*r},distanceToManhattan:function(e){return T(this.x-e.x)+T(this.y-e.y)+T(this.z-e.z)},setFromSpherical:function(e){var t=m(e.phi)*e.radius;return this.x=t*m(e.theta),this.y=g(e.phi)*e.radius,this.z=t*g(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*m(e.theta),this.y=e.y,this.z=e.radius*g(e.theta),this},setFromMatrixPosition:function(t){var a=t.elements;return this.x=a[12],this.y=a[13],this.z=a[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),a=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=a,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,a){return void 0!==a&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(Matrix4.prototype,{isMatrix4:!0,set:function(e,t,a,r,n,o,i,s,l,d,p,c,m,u,g,f){var _=this.elements;return _[0]=e,_[4]=t,_[8]=a,_[12]=r,_[1]=n,_[5]=o,_[9]=i,_[13]=s,_[2]=l,_[6]=d,_[10]=p,_[14]=c,_[3]=m,_[7]=u,_[11]=g,_[15]=f,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new Matrix4().fromArray(this.elements)},copy:function(e){var t=this.elements,a=e.elements;return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],t[6]=a[6],t[7]=a[7],t[8]=a[8],t[9]=a[9],t[10]=a[10],t[11]=a[11],t[12]=a[12],t[13]=a[13],t[14]=a[14],t[15]=a[15],this},copyPosition:function(e){var t=this.elements,a=e.elements;return t[12]=a[12],t[13]=a[13],t[14]=a[14],this},extractBasis:function(e,t,a){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),a.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,a){return this.set(e.x,t.x,a.x,0,e.y,t.y,a.y,0,e.z,t.z,a.z,0,0,0,0,1),this},extractRotation:function(){var e=new Vector3;return function extractRotation(t){var a=this.elements,r=t.elements,n=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),i=1/e.setFromMatrixColumn(t,2).length();return a[0]=r[0]*n,a[1]=r[1]*n,a[2]=r[2]*n,a[4]=r[4]*o,a[5]=r[5]*o,a[6]=r[6]*o,a[8]=r[8]*i,a[9]=r[9]*i,a[10]=r[10]*i,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var r=this.elements,n=t.x,o=t.y,i=t.z,s=g(n),l=m(n),p=g(o),u=m(o),_=g(i),e=m(i);if('XYZ'===t.order){var h=s*_,E=s*e,y=l*_,v=l*e;r[0]=p*_,r[4]=-p*e,r[8]=u,r[1]=E+y*u,r[5]=h-v*u,r[9]=-l*p,r[2]=v-h*u,r[6]=y+E*u,r[10]=s*p}else if('YXZ'===t.order){var x=p*_,T=p*e,C=u*_,S=u*e;r[0]=x+S*l,r[4]=C*l-T,r[8]=s*u,r[1]=s*e,r[5]=s*_,r[9]=-l,r[2]=T*l-C,r[6]=S+x*l,r[10]=s*p}else if('ZXY'===t.order){var x=p*_,T=p*e,C=u*_,S=u*e;r[0]=x-S*l,r[4]=-s*e,r[8]=C+T*l,r[1]=T+C*l,r[5]=s*_,r[9]=S-x*l,r[2]=-s*u,r[6]=l,r[10]=s*p}else if('ZYX'===t.order){var h=s*_,E=s*e,y=l*_,v=l*e;r[0]=p*_,r[4]=y*u-E,r[8]=h*u+v,r[1]=p*e,r[5]=v*u+h,r[9]=E*u-y,r[2]=-u,r[6]=l*p,r[10]=s*p}else if('YZX'===t.order){var A=s*p,R=s*u,M=l*p,I=l*u;r[0]=p*_,r[4]=I-A*e,r[8]=M*e+R,r[1]=e,r[5]=s*_,r[9]=-l*_,r[2]=-u*_,r[6]=R*e+M,r[10]=A-I*e}else if('XZY'===t.order){var A=s*p,R=s*u,M=l*p,I=l*u;r[0]=p*_,r[4]=-e,r[8]=u*_,r[1]=A*e+I,r[5]=s*_,r[9]=R*e-M,r[2]=M*e-R,r[6]=l*_,r[10]=I*e+A}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,a=e._x,r=e._y,n=e._z,o=e._w,i=a+a,s=r+r,l=n+n,d=a*i,p=a*s,c=a*l,m=r*s,u=r*l,g=n*l,f=o*i,_=o*s,h=o*l;return t[0]=1-(m+g),t[4]=p-h,t[8]=c+_,t[1]=p+h,t[5]=1-(d+g),t[9]=u-f,t[2]=c-_,t[6]=u+f,t[10]=1-(d+m),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new Vector3,t=new Vector3,a=new Vector3;return function lookAt(r,n,o){var i=this.elements;return a.subVectors(r,n),0===a.lengthSq()&&(a.z=1),a.normalize(),e.crossVectors(o,a),0===e.lengthSq()&&(1===T(o.z)?a.x+=1e-4:a.z+=1e-4,a.normalize(),e.crossVectors(o,a)),e.normalize(),t.crossVectors(a,e),i[0]=e.x,i[4]=t.x,i[8]=a.x,i[1]=e.y,i[5]=t.y,i[9]=a.y,i[2]=e.z,i[6]=t.z,i[10]=a.z,this}}(),multiply:function(e,t){return void 0===t?this.multiplyMatrices(this,e):(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'),this.multiplyMatrices(e,t))},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var a=e.elements,r=t.elements,n=this.elements,o=a[0],i=a[4],s=a[8],l=a[12],d=a[1],p=a[5],c=a[9],m=a[13],u=a[2],g=a[6],f=a[10],_=a[14],h=a[3],E=a[7],y=a[11],v=a[15],x=r[0],T=r[4],b=r[8],C=r[12],S=r[1],A=r[5],R=r[9],M=r[13],I=r[2],L=r[6],N=r[10],P=r[14],F=r[3],w=r[7],B=r[11],D=r[15];return n[0]=o*x+i*S+s*I+l*F,n[4]=o*T+i*A+s*L+l*w,n[8]=o*b+i*R+s*N+l*B,n[12]=o*C+i*M+s*P+l*D,n[1]=d*x+p*S+c*I+m*F,n[5]=d*T+p*A+c*L+m*w,n[9]=d*b+p*R+c*N+m*B,n[13]=d*C+p*M+c*P+m*D,n[2]=u*x+g*S+f*I+_*F,n[6]=u*T+g*A+f*L+_*w,n[10]=u*b+g*R+f*N+_*B,n[14]=u*C+g*M+f*P+_*D,n[3]=h*x+E*S+y*I+v*F,n[7]=h*T+E*A+y*L+v*w,n[11]=h*b+E*R+y*N+v*B,n[15]=h*C+E*M+y*P+v*D,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new Vector3;return function applyToBufferAttribute(t){for(var a=0,r=t.count;ad&&(i=-i),a.x=o[12],a.y=o[13],a.z=o[14],t.copy(this);var p=1/i,c=1/s,m=1/l;return t.elements[0]*=p,t.elements[1]*=p,t.elements[2]*=p,t.elements[4]*=c,t.elements[5]*=c,t.elements[6]*=c,t.elements[8]*=m,t.elements[9]*=m,t.elements[10]*=m,r.setFromRotationMatrix(t),n.x=i,n.y=s,n.z=l,this}}(),makePerspective:function(e,t,a,r,n,o){void 0===o&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');var i=this.elements;return i[0]=2*n/(t-e),i[4]=0,i[8]=(t+e)/(t-e),i[12]=0,i[1]=0,i[5]=2*n/(a-r),i[9]=(a+r)/(a-r),i[13]=0,i[2]=0,i[6]=0,i[10]=-(o+n)/(o-n),i[14]=-2*o*n/(o-n),i[3]=0,i[7]=0,i[11]=-1,i[15]=0,this},makeOrthographic:function(e,t,a,r,n,o){var i=this.elements,s=1/(t-e),l=1/(a-r),d=1/(o-n);return i[0]=2*s,i[4]=0,i[8]=0,i[12]=-((t+e)*s),i[1]=0,i[5]=2*l,i[9]=0,i[13]=-((a+r)*l),i[2]=0,i[6]=0,i[10]=-2*d,i[14]=-((o+n)*d),i[3]=0,i[7]=0,i[11]=0,i[15]=1,this},equals:function(e){for(var t=this.elements,a=e.elements,r=0;16>r;r++)if(t[r]!==a[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var a=0;16>a;a++)this.elements[a]=e[a+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var a=this.elements;return e[t]=a[0],e[t+1]=a[1],e[t+2]=a[2],e[t+3]=a[3],e[t+4]=a[4],e[t+5]=a[5],e[t+6]=a[6],e[t+7]=a[7],e[t+8]=a[8],e[t+9]=a[9],e[t+10]=a[10],e[t+11]=a[11],e[t+12]=a[12],e[t+13]=a[13],e[t+14]=a[14],e[t+15]=a[15],e}}),DataTexture.prototype=Object.create(Texture.prototype),DataTexture.prototype.constructor=DataTexture,DataTexture.prototype.isDataTexture=!0,CubeTexture.prototype=Object.create(Texture.prototype),CubeTexture.prototype.constructor=CubeTexture,CubeTexture.prototype.isCubeTexture=!0,Object.defineProperty(CubeTexture.prototype,'images',{get:function(){return this.image},set:function(e){this.image=e}});var Ht=new Texture,kt=new CubeTexture,zt=[],Xt=[],jt=new Float32Array(16),Yt=new Float32Array(9);StructuredUniform.prototype.setValue=function(e,t){for(var a=this.seq,r=0,o=a.length,n;r!==o;++r)n=a[r],n.setValue(e,t[n.id])};var qt=/([\w\d_]+)(\])?(\[|\.)?/g;WebGLUniforms.prototype.setValue=function(e,t,a){var r=this.map[t];r!==void 0&&r.setValue(e,a,this.renderer)},WebGLUniforms.prototype.setOptional=function(e,t,a){var r=t[a];r!==void 0&&this.setValue(e,a,r)},WebGLUniforms.upload=function(e,t,a,r){for(var o=0,i=t.length;o!==i;++o){var n=t[o],s=a[n.id];!1!==s.needsUpdate&&n.setValue(e,s.value,r)}},WebGLUniforms.seqWithValue=function(e,t){for(var a=[],r=0,o=e.length,n;r!==o;++r)n=e[r],n.id in t&&a.push(n);return a};var Kt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(Color.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):'number'==typeof e?this.setHex(e):'string'==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=_(e),this.r=(255&e>>16)/255,this.g=(255&e>>8)/255,this.b=(255&e)/255,this},setRGB:function(e,t,a){return this.r=e,this.g=t,this.b=a,this},setHSL:function(){function hue2rgb(e,a,r){return 0>r&&(r+=1),1=a?a*(1+t):a+t-a*t,n=2*a-r;this.r=hue2rgb(n,r,e+1/3),this.g=hue2rgb(n,r,e),this.b=hue2rgb(n,r,e-1/3)}return this}}(),setStyle:function(e){function handleAlpha(t){void 0===t||1>parseFloat(t)&&console.warn('THREE.Color: Alpha component of '+e+' will be ignored.')}var t;if(t=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var a=t[1],r=t[2],n;switch(a){case'rgb':case'rgba':if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=u(255,parseInt(n[1],10))/255,this.g=u(255,parseInt(n[2],10))/255,this.b=u(255,parseInt(n[3],10))/255,handleAlpha(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=u(100,parseInt(n[1],10))/100,this.g=u(100,parseInt(n[2],10))/100,this.b=u(100,parseInt(n[3],10))/100,handleAlpha(n[5]),this;break;case'hsl':case'hsla':if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var o=parseFloat(n[1])/360,i=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100;return handleAlpha(n[5]),this.setHSL(o,i,s)}}}else if(t=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=t[1],d=l.length;if(3===d)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(e&&0=s?p/(o+i):p/(2-o-i),o===a?l=(r-n)/p+(r 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n',bumpmap_pars_fragment:'#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n',clipping_planes_fragment:'#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n',clipping_planes_pars_fragment:'#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n',clipping_planes_pars_vertex:'#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n',clipping_planes_vertex:'#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n',color_fragment:'#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif',color_pars_fragment:'#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n',color_pars_vertex:'#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif',color_vertex:'#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif',common:'#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n',cube_uv_reflection_fragment:'#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n',defaultnormal_vertex:'vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n',displacementmap_pars_vertex:'#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n',displacementmap_vertex:'#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n',emissivemap_fragment:'#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n',emissivemap_pars_fragment:'#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n',encodings_fragment:' gl_FragColor = linearToOutputTexel( gl_FragColor );\n',encodings_pars_fragment:'\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n',envmap_fragment:'#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n',envmap_pars_fragment:'#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n',envmap_pars_vertex:'#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n',envmap_vertex:'#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n',fog_vertex:'\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif',fog_pars_vertex:'#ifdef USE_FOG\n varying float fogDepth;\n#endif\n',fog_fragment:'#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n',fog_pars_fragment:'#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n',gradientmap_pars_fragment:'#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n',lightmap_fragment:'#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n',lightmap_pars_fragment:'#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif',lights_lambert_vertex:'vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n',lights_pars:'uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n',lights_phong_fragment:'BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n',lights_phong_pars_fragment:'varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n',lights_physical_fragment:'PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n',lights_physical_pars_fragment:'struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n',lights_template:'\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n',logdepthbuf_fragment:'#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif',logdepthbuf_pars_fragment:'#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n',logdepthbuf_pars_vertex:'#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif',logdepthbuf_vertex:'#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n',map_fragment:'#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n',map_pars_fragment:'#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n',map_particle_fragment:'#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n',map_particle_pars_fragment:'#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n',metalnessmap_fragment:'float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n',metalnessmap_pars_fragment:'#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif',morphnormal_vertex:'#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n',morphtarget_pars_vertex:'#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif',morphtarget_vertex:'#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n',normal_fragment:'#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n',normalmap_pars_fragment:'#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n',packing:'vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n',premultiplied_alpha_fragment:'#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n',project_vertex:'vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n',dithering_fragment:'#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n',dithering_pars_fragment:'#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n',roughnessmap_fragment:'float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n',roughnessmap_pars_fragment:'#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif',shadowmap_pars_fragment:'#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n',shadowmap_pars_vertex:'#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n',shadowmap_vertex:'#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n',shadowmask_pars_fragment:'float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n',skinbase_vertex:'#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif',skinning_pars_vertex:'#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n',skinning_vertex:'#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n',skinnormal_vertex:'#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n',specularmap_fragment:'float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif',specularmap_pars_fragment:'#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif',tonemapping_fragment:'#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n',tonemapping_pars_fragment:'#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n',uv_pars_fragment:'#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif',uv_pars_vertex:'#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n',uv_vertex:'#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif',uv2_pars_fragment:'#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif',uv2_pars_vertex:'#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif',uv2_vertex:'#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif',worldpos_vertex:'#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n',cube_frag:'uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n',cube_vert:'varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n',depth_frag:'#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n',depth_vert:'#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n',distanceRGBA_frag:'#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n',distanceRGBA_vert:'#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n',equirect_frag:'uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n',equirect_vert:'varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n',linedashed_frag:'uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n',linedashed_vert:'uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n',meshbasic_frag:'uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n',meshbasic_vert:'#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n',meshlambert_frag:'uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n',meshlambert_vert:'#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n',meshphong_frag:'#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include