diff --git a/README.md b/README.md
index a903608..271b9a6 100644
--- a/README.md
+++ b/README.md
@@ -3,25 +3,67 @@ WebGL Clustered Deferred and Forward+ Shading
**University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 5**
-* (TODO) YOUR NAME HERE
-* Tested on: (TODO) **Google Chrome 222.2** on
- Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)
+* Yuxin Hu
+* Tested on: Windows 10, i7-6700HQ @ 2.60GHz 8GB, GTX 960M 4096MB (Personal Laptop)
### Live Online
-[![](img/thumb.png)](http://TODO.github.io/Project5B-WebGL-Deferred-Shading)
+[![](img/ThumbNail.PNG)](https://huyuxin.github.io/Project5-WebGL-Clustered-Deferred-Forward-Plus/)
### Demo Video/GIF
-[![](img/video.png)](TODO)
+![](img/ZLogIntervalResult2.gif)
-### (TODO: Your README)
+### Yuxin Hu
-*DO NOT* leave the README to the last minute! It is a crucial part of the
-project, and we will not be able to grade you without a good README.
+### Overview
+* This is a WebGL based project. There are three rendering methods implemented for performance comparason.
+* Forward Rendering: For each geometry, loop over all lights in the scene.
+* Forward Plus Clustered Rendering: Divide frustrum into 15 x 15 x 15 clusters. Build a light cluster map to store lights within each cluster. For each geometry, only loop over lights within the same cluster.
+* Deferred Clustered Rendering: Generate gBuffer maps by 1st pass of scene. Each gBuffer stores the information of fragment that is going to be rendered on screen: such as normal, color, and position. In the second pass, for each fragment in gBuffer, applies the light in the same cluster based on position in gBuffer.
+* Clusters will improve the performance when the number of lights in scene increase. A preprocess to build the light cluster structure will increase the render speed. Deferred clustered rendering filters out the fragments that are occluded or out of screen in the first pass, and it saves computation time over lights by only looping through fragments in gBuffer in second pass, thus in general it is faster than forward plus rendering. However, deferred clustered does not handle transparent objects in scene.
-This assignment has a considerable amount of performance analysis compared
-to implementation work. Complete the implementation early to leave time!
+### Features implemented:
+* Create light cluster map storing light count and light index in each cluster. The clusters are divided by logarithmic in z direction, and equally divided in x and y directions. For each light, I checked its 6 bounding planes in x, y and z directions, and adding this light to the clusteres within these 6 bounding planes.
+* Clustered deferred rendering. I reuse the light cluster map created for forward plus rendering, and create gBuffers to store fragment information, and then I pass the gBuffers to another fragment shader for light shading.
+* Blinn-Phong shading model in clustered deferred rendering.
+* Compact gBuffer data. gb0 stores [color.x, color.y, color.z, worldPos.z]. gb1 stores [tan(normz/normx),normy, worldPos.x, worldPos.y]. The recorvered normal seems not very accurate at the moment though.
+
+### Performance Analysis
+## Performance Comparason between Clustered Forward+ and Clustered Deferred shading
+![Performance Comparason between Clustered Forward+ and Clustered Deferred shading](/img/Performance1.PNG)
+
Performance Comparason between Clustered Forward+ and Clustered Deferred shading
+
+![Performance Comparason between Clustered Forward+ and Clustered Deferred shading](/img/Performance2.PNG)
+Performance Comparason between Clustered Forward+ and Clustered Deferred shading
+
+Clustered Deferred shading is more than 2 times faster than Clustered Forward+ when the rendering is taken place inside castle. However, when the rendering is taken palce outside of the whole castle, the performance of Clustered Forward+ starts to get better than clustered deferred. Both shading methods use the same clustered lights calculations, so the performance difference arises from the calculation of which cluster does the fragment belong to. In clustered forward+, we loop over all vertex of geometries, calculate their clusteres, and find lights in those clusteres, no matter they will be rendered out in the final image or not. A lots of geometry vertice are out of screen space, or are being occluded, when the camera is inside the castle, which result in many calculations wasted. While clustered deferred shading has avoided this problem by filtering out the vertices that are occluded or out of screen in the first pass.
+
+![Performance Comparason between Clustered Forward+ and Clustered Deferred shading](/img/Performance3.PNG)
+Performance Comparason between Clustered Forward+ and Clustered Deferred shading
+
+As light number increases, the performance clustered deferred shading becomes much better than forward plus. While forward plus takes more time to do light calculation of geometry vertices that do not contribute to final rendering result, clustered deferred shading avoids the problem by first pass.
+
+## number of gBuffer used
+![Performance Comparason bettern number of gBuffers used](/img/Performance5.PNG)
+Performance Comparason bettern number of gBuffers used
+
+Using fewer number of gBuffers improves the performance slightly. If we can compact essential information within fewer number fo gBuffers, it should help improve the performance.
+
+## Z Interval Slice Methods comparason
+![Performance Comparason between Z Slice Method](/img/Performance4.PNG)
+Performance Comparason between Z Slice Method
+
+![Equal Z Slice Method](/img/equalZ.PNG)
+Equal Z Slice Method
+
+![Log Z Slice Method](/img/logZ2.PNG)
+Log Z Slice Method
+
+![Log Z Slice Method](/img/LogZ.PNG)
+Log Z Slice Method
+
+Z interval is the length between far plane and near plane, which is a large range. If we divide the Z direction equally, then almost everything in the scene is going to be clustered in the first cluster along Z direction. By changing the division method from equally division to logarithmic division, so that intervalLenth^(_zSliceNum) equals total range along z direction, we can get more clusters along z direction to cover the geometries in scene. There will be fewer lights in each cluster, and the rendering of each fragment will be faster.
### Credits
diff --git a/build/bundle.js b/build/bundle.js
new file mode 100644
index 0000000..c4ddf3f
--- /dev/null
+++ b/build/bundle.js
@@ -0,0 +1,2 @@
+(function(e){function __webpack_require__(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r.exports}var t={};return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e['default']}:function getModuleExports(){return e};return __webpack_require__.d(t,'a',t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p='',__webpack_require__(__webpack_require__.s=1)})([function(e,t,n){'use strict';var r=Math.abs;n.d(t,'a',function(){return o});const a=1e-6;t.b=a;let o='undefined'==typeof Float32Array?Array:Float32Array;const i=Math.random;t.c=i;const s=Math.PI/180},function(e,t,n){'use strict';function abort(e){throw f=!0,e}function setSize(e,t){E.width=e,E.height=t,S.aspect=e/t,S.updateProjectionMatrix()}Object.defineProperty(t,'__esModule',{value:!0}),n.d(t,'DEBUG',function(){return h}),n.d(t,'ABORTED',function(){return f}),t.abort=abort,n.d(t,'canvas',function(){return E}),n.d(t,'gl',function(){return C}),n.d(t,'WEBGL_draw_buffers',function(){return i}),n.d(t,'MAX_DRAW_BUFFERS_WEBGL',function(){return x}),n.d(t,'gui',function(){return v}),n.d(t,'camera',function(){return S}),n.d(t,'cameraControls',function(){return R}),t.makeRenderLoop=function makeRenderLoop(e){return function tick(){R.update(),T.begin(),e(),T.end(),f||requestAnimationFrame(tick)}};for(var r=n(12),a=n.n(r),o=n(15),s=n.n(o),l=n(17),d=n.n(l),c=n(7),p=n(18),u=n.n(p),m=n(19),g=n.n(m),h=!1,f=!1,E=document.getElementById('canvas'),_=E.getContext('webgl'),C=_,y=C.getSupportedExtensions(),A=['OES_texture_float','OES_texture_float_linear','OES_element_index_uint','WEBGL_depth_texture','WEBGL_draw_buffers'],b=0;by.indexOf(A[b]))throw'Unable to load extension '+A[b];C.getExtension('OES_texture_float'),C.getExtension('OES_texture_float_linear'),C.getExtension('OES_element_index_uint'),C.getExtension('WEBGL_depth_texture');var i=C.getExtension('WEBGL_draw_buffers'),x=C.getParameter(i.MAX_DRAW_BUFFERS_WEBGL),v=new a.a.GUI,T=new d.a;T.setMode(1),T.domElement.style.position='absolute',T.domElement.style.left='0px',T.domElement.style.top='0px',document.body.appendChild(T.domElement);var S=new c.PerspectiveCamera(75,E.clientWidth/E.clientHeight,0.1,1e3),R=new u.a(S,E);R.enableDamping=!0,R.enableZoom=!0,R.rotateSpeed=0.3,R.zoomSpeed=1,R.panSpeed=2,setSize(E.clientWidth,E.clientHeight),window.addEventListener('resize',function(){return setSize(E.clientWidth,E.clientHeight)});n(20)},function(e,t,n){'use strict';var r=n(0),a=n(22),o=n(23),i=n(8),s=n(24),l=n(25),d=n(26),c=n(9),p=n(10);n.d(t,'a',function(){return s}),n.d(t,'b',function(){return l}),n.d(t,'c',function(){return c}),n.d(t,'d',function(){return p})},function(e,t,n){'use strict';function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}n.d(t,'a',function(){return l});var r=n(1),a=n(27),o=[-14,0,-6],s=[14,20,6],l=300,i=function(){function Scene(){_classCallCheck(this,Scene),this.lights=[],this.models=[];for(var e=0;eS&&!F&&(_=D,F=!0))}R||(E=this._xSlices-1);for(var U=0;US&&!M&&(y=U,M=!0))}w||(C=this._ySlices-1);for(var V=0,$;VS&&!B&&(b=V,B=!0));L||(A=this._zSlices-1);for(var z=0,X=0,j=0,Y=A;Y<=b;++Y)for(var K=C;K<=y;++K)for(var q=E,Z;q<=_;++q)Z=q+K*this._xSlices+Y*this._xSlices*this._ySlices,j=this._clusterTexture.buffer[this._clusterTexture.bufferIndex(Z,0)+0],j++,this._clusterTexture.buffer[this._clusterTexture.bufferIndex(Z,0)+0]=j,z=Math.floor(j/4),X=j-4*z,this._clusterTexture.buffer[this._clusterTexture.bufferIndex(Z,z)+X]=f}this._clusterTexture.update()},ClusteredRenderer}();t.b=s},function(e,t,n){'use strict';function compileShader(e,t){var n=r.gl.createShader(t);return r.gl.shaderSource(n,e),r.gl.compileShader(n),r.gl.getShaderParameter(n,r.gl.COMPILE_STATUS)||(console.error(e),Object(r.abort)('shader compiler error:\n'+r.gl.getShaderInfoLog(n))),n}function linkShader(e,t){var n=r.gl.createProgram();return r.gl.attachShader(n,e),r.gl.attachShader(n,t),r.gl.linkProgram(n),r.gl.getProgramParameter(n,r.gl.LINK_STATUS)||Object(r.abort)('shader linker error:\n'+r.gl.getProgramInfoLog(n)),n}function addShaderLocations(e,t){if(t&&t.uniforms&&t.uniforms.length)for(var n=0;n=o||0 0 ) {','float depth = gl_FragCoord.z / gl_FragCoord.w;','float fogFactor = 0.0;','if ( fogType == 1 ) {','fogFactor = smoothstep( fogNear, fogFar, depth );','} else {','const float LOG2 = 1.442695;','fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );','fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );','}','gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );','}','}'].join('\n')),t.compileShader(n),t.compileShader(r),t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),e}function painterSortStable(e,t){return e.renderOrder===t.renderOrder?e.z===t.z?t.id-e.id:t.z-e.z:e.renderOrder-t.renderOrder}var o=new Vector3,i=new Quaternion,s=new Vector3,d,c,p,u,m,l;this.render=function(a,g,h){if(0!==a.length){void 0===p&&init(),n.useProgram(p),n.initAttributes(),n.enableAttribute(u.position),n.enableAttribute(u.uv),n.disableUnusedAttributes(),n.disable(t.CULL_FACE),n.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,d),t.vertexAttribPointer(u.position,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(u.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c),t.uniformMatrix4fv(m.projectionMatrix,!1,h.projectionMatrix.elements),n.activeTexture(t.TEXTURE0),t.uniform1i(m.map,0);var f=0,E=0,_=g.fog;_?(t.uniform3f(m.fogColor,_.color.r,_.color.g,_.color.b),_.isFog?(t.uniform1f(m.fogNear,_.near),t.uniform1f(m.fogFar,_.far),t.uniform1i(m.fogType,1),f=1,E=1):_.isFogExp2&&(t.uniform1f(m.fogDensity,_.density),t.uniform1i(m.fogType,2),f=2,E=2)):(t.uniform1i(m.fogType,0),f=0,E=0);for(var C=0,y=a.length,A;Ct&&(t=e[n]);return t}function BufferGeometry(){Object.defineProperty(this,'id',{value:GeometryIdCount()}),this.uuid=kt.generateUUID(),this.name='',this.type='BufferGeometry',this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:Infinity}}function BoxGeometry(e,t,n,r,a,o){Geometry.call(this),this.type='BoxGeometry',this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:a,depthSegments:o},this.fromBufferGeometry(new BoxBufferGeometry(e,t,n,r,a,o)),this.mergeVertices()}function BoxBufferGeometry(e,t,n,r,a,o){function buildPlane(e,t,n,r,o,u,g,h,f,E,_){var C=f+1,A=0,v=0,T=new Vector3,S,R;for(R=0;Rp;p++){if(m=c[p],m){var g=m[0],h=m[1];if(h){i&&a.addAttribute('morphTarget'+p,i[g]),u&&a.addAttribute('morphNormal'+p,u[g]),n[p]=h;continue}}n[p]=0}s.getUniforms().setValue(e,'morphTargetInfluences',n)}}}function WebGLIndexedBufferRenderer(e,t,n){var r,a,o;this.setMode=function setMode(e){r=e},this.setIndex=function setIndex(e){a=e.type,o=e.bytesPerElement},this.render=function render(t,i){e.drawElements(r,i,a,t*o),n.calls++,n.vertices+=i,r===e.TRIANGLES?n.faces+=i/3:r===e.POINTS&&(n.points+=i)},this.renderInstances=function renderInstances(i,s,l){var d=t.get('ANGLE_instanced_arrays');return null===d?void console.error('THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'):void(d.drawElementsInstancedANGLE(r,l,a,s*o,i.maxInstancedCount),n.calls++,n.vertices+=l*i.maxInstancedCount,r===e.TRIANGLES?n.faces+=i.maxInstancedCount*l/3:r===e.POINTS&&(n.points+=i.maxInstancedCount*l))}}function WebGLBufferRenderer(e,t,n){var r;this.setMode=function setMode(e){r=e},this.render=function render(t,a){e.drawArrays(r,t,a),n.calls++,n.vertices+=a,r===e.TRIANGLES?n.faces+=a/3:r===e.POINTS&&(n.points+=a)},this.renderInstances=function renderInstances(a,o,i){var s=t.get('ANGLE_instanced_arrays');if(null===s)return void console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');var l=a.attributes.position;l.isInterleavedBufferAttribute?(i=l.data.count,s.drawArraysInstancedANGLE(r,0,i,a.maxInstancedCount)):s.drawArraysInstancedANGLE(r,o,i,a.maxInstancedCount),n.calls++,n.vertices+=i*a.maxInstancedCount,r===e.TRIANGLES?n.faces+=a.maxInstancedCount*i/3:r===e.POINTS&&(n.points+=a.maxInstancedCount*i)}}function WebGLGeometries(e,t,n){function onGeometryDispose(e){var a=e.target,i=r[a.id];for(var s in null!==i.index&&t.remove(i.index),i.attributes)t.remove(i.attributes[s]);a.removeEventListener('dispose',onGeometryDispose),delete r[a.id];var l=o[a.id];l&&(t.remove(l),delete o[a.id]),l=o[i.id],l&&(t.remove(l),delete o[i.id]),n.geometries--}var r={},o={};return{get:function get(e,t){var a=r[t.id];return a?a:(t.addEventListener('dispose',onGeometryDispose),t.isBufferGeometry?a=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=new BufferGeometry().setFromObject(e)),a=t._bufferGeometry),r[t.id]=a,n.geometries++,a)},update:function update(n){var r=n.index,a=n.attributes;for(var o in null!==r&&t.update(r,e.ELEMENT_ARRAY_BUFFER),a)t.update(a[o],e.ARRAY_BUFFER);var s=n.morphAttributes;for(var o in s)for(var d=s[o],c=0,i=d.length;c');return parseIncludes(n)}var t=/^[ \t]*#include +<([\w\d.]+)>/gm;return e.replace(t,replace)}function unrollLoops(e){var t=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return e.replace(t,function replace(e,t,n,r){for(var a='',o=parseInt(t);ot||e.height>t){var n=t/y(e.width,e.height),r=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');r.width=h(e.width*n),r.height=h(e.height*n);var a=r.getContext('2d');return a.drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn('THREE.WebGLRenderer: image is too big ('+e.width+'x'+e.height+'). Resized to '+r.width+'x'+r.height,e),r}return e}function isPowerOfTwo(e){return kt.isPowerOfTwo(e.width)&&kt.isPowerOfTwo(e.height)}function makePowerOfTwo(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');t.width=kt.nearestPowerOfTwo(e.width),t.height=kt.nearestPowerOfTwo(e.height);var n=t.getContext('2d');return n.drawImage(e,0,0,t.width,t.height),console.warn('THREE.WebGLRenderer: image is not power of two ('+e.width+'x'+e.height+'). Resized to '+t.width+'x'+t.height,e),t}return e}function textureNeedsPowerOfTwo(e){return e.wrapS!==Ne||e.wrapT!==Ne||e.minFilter!==Oe&&e.minFilter!==ke}function textureNeedsGenerateMipmaps(e,t){return e.generateMipmaps&&t&&e.minFilter!==Oe&&e.minFilter!==ke}function filterFallback(t){return t===Oe||t===Ue||t===Ge?e.NEAREST:e.LINEAR}function onTextureDispose(e){var t=e.target;t.removeEventListener('dispose',onTextureDispose),deallocateTexture(t),s.textures--}function onRenderTargetDispose(e){var t=e.target;t.removeEventListener('dispose',onRenderTargetDispose),deallocateRenderTarget(t),s.textures--}function deallocateTexture(t){var n=r.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(n.__webglInit===void 0)return;e.deleteTexture(n.__webglTexture)}r.remove(t)}function deallocateRenderTarget(t){var n=r.get(t),a=r.get(t.texture);if(t){if(void 0!==a.__webglTexture&&e.deleteTexture(a.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var o=0;6>o;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);r.remove(t.texture),r.remove(t)}}function setTexture2D(t,a){var o=r.get(t);if(0o;o++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),setupRenderBufferStorage(n.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),setupRenderBufferStorage(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}var i='undefined'!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext;this.setTexture2D=setTexture2D,this.setTextureCube=function setTextureCube(t,l){var d=r.get(t);if(6===t.image.length)if(0m;m++)u[m]=c||p?p?t.image[m].image:t.image[m]:clampToMaxSize(t.image[m],a.maxCubemapSize);var i=u[0],g=isPowerOfTwo(i),h=o.convert(t.format),f=o.convert(t.type);setTextureParameters(e.TEXTURE_CUBE_MAP,t,g);for(var m=0;6>m;m++)if(!c)p?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,h,u[m].width,u[m].height,0,h,f,u[m].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,h,h,f,u[m]);else for(var E=u[m].mipmaps,_=0,C=E.length,y;_c;c++)a.__webglFramebuffer[c]=e.createFramebuffer()}else a.__webglFramebuffer=e.createFramebuffer();if(l){n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),setTextureParameters(e.TEXTURE_CUBE_MAP,t.texture,d);for(var c=0;6>c;c++)setupFrameBufferTexture(a.__webglFramebuffer[c],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+c);textureNeedsGenerateMipmaps(t.texture,d)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,o.__webglTexture),setTextureParameters(e.TEXTURE_2D,t.texture,d),setupFrameBufferTexture(a.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),textureNeedsGenerateMipmaps(t.texture,d)&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function updateRenderTargetMipmap(t){var a=t.texture,o=isPowerOfTwo(t);if(textureNeedsGenerateMipmaps(a,o)){var i=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,s=r.get(a).__webglTexture;n.bindTexture(i,s),e.generateMipmap(i),n.bindTexture(i,null)}}}function WebGLProperties(){var e={};return{get:function get(t){var n=t.uuid,r=e[n];return void 0===r&&(r={},e[n]=r),r},remove:function remove(t){delete e[t.uuid]},clear:function clear(){e={}}}}function WebGLState(e,t,n){function createTexture(t,n,r){var a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var s=0;s=Q.maxTextures&&console.warn('THREE.WebGLRenderer: Trying to use '+e+' texture units while this GPU supports only '+Q.maxTextures),D+=1,e},this.setTexture2D=function(){var e=!1;return function setTexture2D(t,n){t&&t.isWebGLRenderTarget&&(!e&&(console.warn('THREE.WebGLRenderer.setTexture2D: don\'t use render targets as textures. Use their .texture property instead.'),e=!0),t=t.texture),te.setTexture2D(t,n)}}(),this.setTexture=function(){var e=!1;return function setTexture(t,n){e||(console.warn('THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead.'),e=!0),te.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function setTextureCube(t,n){t&&t.isWebGLRenderTargetCube&&(!e&&(console.warn('THREE.WebGLRenderer.setTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.'),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?te.setTextureCube(t,n):te.setTextureCubeDynamic(t,n)}}(),this.getRenderTarget=function(){return x},this.setRenderTarget=function(e){x=e,e&&void 0===ee.get(e).__webglFramebuffer&&te.setupRenderTarget(e);var t=null,n=!1;if(e){var r=ee.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=r[e.activeCubeFace],n=!0):t=r,M.copy(e.viewport),L.copy(e.scissor),B=e.scissorTest}else M.copy(O).multiplyScalar(P),L.copy(U).multiplyScalar(P),B=k;if(v!==t&&(K.bindFramebuffer(K.FRAMEBUFFER,t),v=t),J.viewport(M),J.scissor(L),J.setScissorTest(B),n){var a=ee.get(e.texture);K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,a.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,r,a,o){if(!(e&&e.isWebGLRenderTarget))return void console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');var i=ee.get(e).__webglFramebuffer;if(i){var s=!1;i!==v&&(K.bindFramebuffer(K.FRAMEBUFFER,i),s=!0);try{var l=e.texture,d=l.format,c=l.type;if(d!==rt&&ge.convert(d)!==K.getParameter(K.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.');if(c!==Ve&&ge.convert(c)!==K.getParameter(K.IMPLEMENTATION_COLOR_READ_TYPE)&&!(c===Ke&&(Z.get('OES_texture_float')||Z.get('WEBGL_color_buffer_float')))&&!(c===qe&&Z.get('EXT_color_buffer_half_float')))return void console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');K.checkFramebufferStatus(K.FRAMEBUFFER)===K.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-r&&0<=n&&n<=e.height-a&&K.readPixels(t,n,r,a,ge.convert(d),ge.convert(c),o):console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.')}finally{s&&K.bindFramebuffer(K.FRAMEBUFFER,v)}}}}function FogExp2(e,t){this.name='',this.color=new Color(e),this.density=t===void 0?2.5e-4:t}function Fog(e,t,n){this.name='',this.color=new Color(e),this.near=t===void 0?1:t,this.far=n===void 0?1e3:n}function Scene(){Object3D.call(this),this.type='Scene',this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function LensFlare(e,t,n,r,a){Object3D.call(this),this.lensFlares=[],this.positionScreen=new Vector3,this.customUpdateCallback=void 0,e!==void 0&&this.add(e,t,n,r,a)}function SpriteMaterial(e){Material.call(this),this.type='SpriteMaterial',this.color=new Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function Sprite(e){Object3D.call(this),this.type='Sprite',this.material=e===void 0?new SpriteMaterial:e}function LOD(){Object3D.call(this),this.type='LOD',Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Skeleton(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn('THREE.Skeleton boneInverses is the wrong length.'),this.boneInverses=[];for(var n=0,r=this.bones.length;n=e.HAVE_CURRENT_DATA&&(d.needsUpdate=!0)}Texture.call(this,e,t,n,r,a,o,i,s,l),this.generateMipmaps=!1;var d=this;update()}function CompressedTexture(e,t,n,r,a,o,i,s,l,d,c,p){Texture.call(this,null,o,i,s,l,d,r,a,c,p),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function DepthTexture(e,t,n,r,a,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===n&&d===st&&(n=Xe),void 0===n&&d===lt&&(n=et),Texture.call(this,null,r,a,o,i,s,d,n,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 n=[],r=[0,0],a={},s=['a','b','c'],d,i,c,l,o,u,e,m,g,h;if(t&&t.isGeometry){var f=t.faces;for(d=0,c=f.length;di;i++)e=E[s[i]],m=E[s[(i+1)%3]],r[0]=p(e,m),r[1]=y(e,m),g=r[0]+','+r[1],void 0===a[g]&&(a[g]={index1:r[0],index2:r[1]})}for(g in a)u=a[g],h=t.vertices[u.index1],n.push(h.x,h.y,h.z),h=t.vertices[u.index2],n.push(h.x,h.y,h.z)}else if(t&&t.isBufferGeometry){var _,C,A,b,x,v,T,S;if(h=new Vector3,null!==t.index){for(_=t.attributes.position,C=t.index,A=t.groups,0===A.length&&(A=[{start:0,count:C.count,materialIndex:0}]),(l=0,o=A.length);li;i++)e=C.getX(d+i),m=C.getX(d+(i+1)%3),r[0]=p(e,m),r[1]=y(e,m),g=r[0]+','+r[1],void 0===a[g]&&(a[g]={index1:r[0],index2:r[1]});for(g in a)u=a[g],h.fromBufferAttribute(_,u.index1),n.push(h.x,h.y,h.z),h.fromBufferAttribute(_,u.index2),n.push(h.x,h.y,h.z)}else for(_=t.attributes.position,d=0,c=_.count/3;di;i++)T=3*d+i,h.fromBufferAttribute(_,T),n.push(h.x,h.y,h.z),S=3*d+(i+1)%3,h.fromBufferAttribute(_,S),n.push(h.x,h.y,h.z)}this.addAttribute('position',new Float32BufferAttribute(n,3))}function ParametricGeometry(e,t,n){Geometry.call(this),this.type='ParametricGeometry',this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new ParametricBufferGeometry(e,t,n)),this.mergeVertices()}function ParametricBufferGeometry(e,t,n){BufferGeometry.call(this),this.type='ParametricBufferGeometry',this.parameters={func:e,slices:t,stacks:n};var r=[],o=[],s=[],l=[],p=1e-5,m=new Vector3,g=new Vector3,h=new Vector3,f=new Vector3,E=new Vector3,_=t+1,C,i;for(C=0;C<=n;C++){var y=C/n;for(i=0;i<=t;i++){var A=i/t;g=e(A,y,g),o.push(g.x,g.y,g.z),0<=A-p?(h=e(A-p,y,h),f.subVectors(g,h)):(h=e(A+p,y,h),f.subVectors(h,g)),0<=y-p?(h=e(A,y-p,h),E.subVectors(g,h)):(h=e(A,y+p,h),E.subVectors(h,g)),m.crossVectors(f,E).normalize(),s.push(m.x,m.y,m.z),l.push(A,y)}}for(C=0;Co&&(0.2>t&&(s[e+0]+=1),0.2>n&&(s[e+2]+=1),0.2>r&&(s[e+4]+=1))}}function pushVertex(e){o.push(e.x,e.y,e.z)}function getVertexByIndex(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function correctUVs(){for(var e=new Vector3,t=new Vector3,n=new Vector3,r=new Vector3,a=new Vector2,l=new Vector2,d=new Vector2,c=0,i=0;cr&&1===e.x&&(s[t]=e.x-1),0===n.x&&0===n.z&&(s[t]=r/2/S+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:n,detail:r},n=n||1,r=r||0;var o=[],s=[];(function subdivide(e){for(var n=new Vector3,r=new Vector3,a=new Vector3,o=0;oA;A++)c=l[d[A]],u=l[d[(A+1)%3]],o[0]=p(c,u),o[1]=y(c,u),g=o[0]+','+o[1],void 0===s[g]?s[g]={index1:o[0],index2:o[1],face1:_,face2:void 0}:s[g].face2=_}for(g in s){var b=s[g];if(b.face2===void 0||E[b.face1].normal.dot(E[b.face2].normal)<=a){var e=f[b.index1];r.push(e.x,e.y,e.z),e=f[b.index2],r.push(e.x,e.y,e.z)}}this.addAttribute('position',new Float32BufferAttribute(r,3))}function CylinderGeometry(e,t,n,r,a,o,i,s){Geometry.call(this),this.type='CylinderGeometry',this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:i,thetaLength:s},this.fromBufferGeometry(new CylinderBufferGeometry(e,t,n,r,a,o,i,s)),this.mergeVertices()}function CylinderBufferGeometry(e,t,n,r,i,a,s,l){function generateCap(n){var a=new Vector2,h=new Vector3,E=0,y=!0===n?e:t,A=!0===n?1:-1,b,x,v;for(x=f,b=1;b<=r;b++)d.push(0,_*A,0),c.push(0,A,0),g.push(0.5,0.5),f++;for(v=f,b=0;b<=r;b++){var T=b/r,S=T*l+s,R=m(S),F=o(S);h.x=y*F,h.y=_*A,h.z=y*R,d.push(h.x,h.y,h.z),c.push(0,A,0),a.x=0.5*R+0.5,a.y=0.5*F*A+0.5,g.push(a.x,a.y),f++}for(b=0;bthis.duration&&this.resetDuration(),this.optimize()}function MaterialLoader(e){this.manager=e===void 0?dn:e,this.textures={}}function BufferGeometryLoader(e){this.manager=e===void 0?dn: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?dn:e,this.withCredentials=!1}function ObjectLoader(e){this.manager=e===void 0?dn:e,this.texturePath=''}function CatmullRom(e,t,n,r,a){var o=0.5*(r-t),i=0.5*(a-n),s=e*e;return(2*n-2*r+o+i)*(e*s)+(-3*n+3*r-2*o-i)*s+o*e+n}function QuadraticBezierP0(e,t){var n=1-e;return n*n*t}function QuadraticBezierP1(e,t){return 2*(1-e)*e*t}function QuadraticBezierP2(e,t){return e*e*t}function QuadraticBezier(e,t,n,r){return QuadraticBezierP0(e,t)+QuadraticBezierP1(e,n)+QuadraticBezierP2(e,r)}function CubicBezierP0(e,t){var n=1-e;return n*n*n*t}function CubicBezierP1(e,t){var n=1-e;return 3*n*n*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,n,r,a){return CubicBezierP0(e,t)+CubicBezierP1(e,n)+CubicBezierP2(e,r)+CubicBezierP3(e,a)}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,n,r,a,o,i,s){Curve.call(this),this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=a,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,n,r){Curve.call(this),this.v0=e,this.v1=t,this.v2=n,this.v3=r}function QuadraticBezierCurve(e,t,n){Curve.call(this),this.v0=e,this.v1=t,this.v2=n}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?dn:e}function AudioLoader(e){this.manager=e===void 0?dn: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,n){Object3D.call(this),this.type='CubeCamera';var r=90,a=1,o=new PerspectiveCamera(r,a,e,t);o.up.set(0,-1,0),o.lookAt(new Vector3(1,0,0)),this.add(o);var i=new PerspectiveCamera(r,a,e,t);i.up.set(0,-1,0),i.lookAt(new Vector3(-1,0,0)),this.add(i);var s=new PerspectiveCamera(r,a,e,t);s.up.set(0,0,1),s.lookAt(new Vector3(0,1,0)),this.add(s);var l=new PerspectiveCamera(r,a,e,t);l.up.set(0,0,-1),l.lookAt(new Vector3(0,-1,0)),this.add(l);var d=new PerspectiveCamera(r,a,e,t);d.up.set(0,-1,0),d.lookAt(new Vector3(0,0,1)),this.add(d);var c=new PerspectiveCamera(r,a,e,t);c.up.set(0,-1,0),c.lookAt(new Vector3(0,0,-1)),this.add(c);this.renderTarget=new WebGLRenderTargetCube(n,n,{format:nt,magFilter:ke,minFilter:ke}),this.renderTarget.texture.name='CubeCamera',this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,o,n),n.activeCubeFace=1,e.render(t,i,n),n.activeCubeFace=2,e.render(t,s,n),n.activeCubeFace=3,e.render(t,l,n),n.activeCubeFace=4,e.render(t,d,n),n.texture.generateMipmaps=r,n.activeCubeFace=5,e.render(t,c,n),e.setRenderTarget(null)},this.clear=function(e,t,n,r){for(var a=this.renderTarget,o=0;6>o;o++)a.activeCubeFace=o,e.setRenderTarget(a),e.clear(t,n,r);e.setRenderTarget(null)}}function AudioListener(){Object3D.call(this),this.type='AudioListener',this.context=En.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,n){this.binding=e,this.valueSize=n;var r=Float64Array,a;'quaternion'===t?a=this._slerp:'string'===t||'bool'===t?(r=Array,a=this._select):a=this._lerp;this.buffer=new r(4*n),this._mixBufferRegion=a,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Composite(e,t,n){var r=n||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function PropertyBinding(e,t,n){this.path=t,this.parsedPath=n||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function AnimationObjectGroup(){this.uuid=kt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function AnimationAction(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var r=t.tracks,a=r.length,o=Array(a),s={endingStart:vt,endingEnd:vt},l=0,i;l!==a;++l)i=r[l].createInterpolant(null),o[l]=i,i.settings=s;this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ct,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,n,r){this.uuid=kt.generateUUID(),this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function InterleavedBuffer(e,t){this.uuid=kt.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,n){InterleavedBuffer.call(this,e,t),this.meshPerAttribute=n||1}function InstancedBufferAttribute(e,t,n){BufferAttribute.call(this,e,t),this.meshPerAttribute=n||1}function Raycaster(e,t,n,r){this.ray=new Ray(e,t),this.near=n||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,n,r){if(!1!==e.visible&&(e.raycast(t,n),!0===r))for(var a=e.children,o=0,i=a.length;oe.length&&console.warn('THREE.CatmullRomCurve3: Points array needs at least two entries.'),this.points=e||[],this.closed=!1}function CubicBezierCurve3(e,t,n,r){Curve.call(this),this.v0=e,this.v1=t,this.v2=n,this.v3=r}function QuadraticBezierCurve3(e,t,n){Curve.call(this),this.v0=e,this.v1=t,this.v2=n}function LineCurve3(e,t){Curve.call(this),this.v1=e,this.v2=t}function ArcCurve(e,t,n,r,a,o){EllipseCurve.call(this,e,t,n,n,r,a,o)}function Face4(e,t,n,r,a,o,i){return console.warn('THREE.Face4 has been removed. A THREE.Face3 will be created instead.'),new Face3(e,t,n,a,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,n){return console.warn('THREE.Vertex has been removed. Use THREE.Vector3 instead.'),new Vector3(e,t,n)}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.atan,a=Math.acos,o=Math.sin,m=Math.cos,i=Math.atan2,l=Math.sqrt,s=Math.round,d=Math.LN2,p=Math.min,c=Math.sign,u=Number.isInteger,g=Number.EPSILON,h=Math.floor,f=Math.pow,E=Math.tan,_=Math.log,C=Math.ceil,y=Math.max,A=Math.abs,S=Math.PI;Object.defineProperty(t,'__esModule',{value:!0}),n.d(t,'WebGLRenderTargetCube',function(){return WebGLRenderTargetCube}),n.d(t,'WebGLRenderTarget',function(){return WebGLRenderTarget}),n.d(t,'WebGLRenderer',function(){return WebGLRenderer}),n.d(t,'ShaderLib',function(){return Jt}),n.d(t,'UniformsLib',function(){return qt}),n.d(t,'UniformsUtils',function(){return Zt}),n.d(t,'ShaderChunk',function(){return Qt}),n.d(t,'FogExp2',function(){return FogExp2}),n.d(t,'Fog',function(){return Fog}),n.d(t,'Scene',function(){return Scene}),n.d(t,'LensFlare',function(){return LensFlare}),n.d(t,'Sprite',function(){return Sprite}),n.d(t,'LOD',function(){return LOD}),n.d(t,'SkinnedMesh',function(){return SkinnedMesh}),n.d(t,'Skeleton',function(){return Skeleton}),n.d(t,'Bone',function(){return Bone}),n.d(t,'Mesh',function(){return Mesh}),n.d(t,'LineSegments',function(){return LineSegments}),n.d(t,'LineLoop',function(){return LineLoop}),n.d(t,'Line',function(){return Line}),n.d(t,'Points',function(){return Points}),n.d(t,'Group',function(){return Group}),n.d(t,'VideoTexture',function(){return VideoTexture}),n.d(t,'DataTexture',function(){return DataTexture}),n.d(t,'CompressedTexture',function(){return CompressedTexture}),n.d(t,'CubeTexture',function(){return CubeTexture}),n.d(t,'CanvasTexture',function(){return CanvasTexture}),n.d(t,'DepthTexture',function(){return DepthTexture}),n.d(t,'Texture',function(){return Texture}),n.d(t,'CompressedTextureLoader',function(){return CompressedTextureLoader}),n.d(t,'DataTextureLoader',function(){return DataTextureLoader}),n.d(t,'CubeTextureLoader',function(){return CubeTextureLoader}),n.d(t,'TextureLoader',function(){return TextureLoader}),n.d(t,'ObjectLoader',function(){return ObjectLoader}),n.d(t,'MaterialLoader',function(){return MaterialLoader}),n.d(t,'BufferGeometryLoader',function(){return BufferGeometryLoader}),n.d(t,'DefaultLoadingManager',function(){return dn}),n.d(t,'LoadingManager',function(){return LoadingManager}),n.d(t,'JSONLoader',function(){return JSONLoader}),n.d(t,'ImageLoader',function(){return ImageLoader}),n.d(t,'FontLoader',function(){return FontLoader}),n.d(t,'FileLoader',function(){return FileLoader}),n.d(t,'Loader',function(){return Loader}),n.d(t,'Cache',function(){return ln}),n.d(t,'AudioLoader',function(){return AudioLoader}),n.d(t,'SpotLightShadow',function(){return SpotLightShadow}),n.d(t,'SpotLight',function(){return SpotLight}),n.d(t,'PointLight',function(){return PointLight}),n.d(t,'RectAreaLight',function(){return RectAreaLight}),n.d(t,'HemisphereLight',function(){return HemisphereLight}),n.d(t,'DirectionalLightShadow',function(){return DirectionalLightShadow}),n.d(t,'DirectionalLight',function(){return DirectionalLight}),n.d(t,'AmbientLight',function(){return AmbientLight}),n.d(t,'LightShadow',function(){return LightShadow}),n.d(t,'Light',function(){return Light}),n.d(t,'StereoCamera',function(){return StereoCamera}),n.d(t,'PerspectiveCamera',function(){return PerspectiveCamera}),n.d(t,'OrthographicCamera',function(){return OrthographicCamera}),n.d(t,'CubeCamera',function(){return CubeCamera}),n.d(t,'ArrayCamera',function(){return ArrayCamera}),n.d(t,'Camera',function(){return Camera}),n.d(t,'AudioListener',function(){return AudioListener}),n.d(t,'PositionalAudio',function(){return PositionalAudio}),n.d(t,'AudioContext',function(){return En}),n.d(t,'AudioAnalyser',function(){return AudioAnalyser}),n.d(t,'Audio',function(){return Audio}),n.d(t,'VectorKeyframeTrack',function(){return VectorKeyframeTrack}),n.d(t,'StringKeyframeTrack',function(){return StringKeyframeTrack}),n.d(t,'QuaternionKeyframeTrack',function(){return QuaternionKeyframeTrack}),n.d(t,'NumberKeyframeTrack',function(){return NumberKeyframeTrack}),n.d(t,'ColorKeyframeTrack',function(){return ColorKeyframeTrack}),n.d(t,'BooleanKeyframeTrack',function(){return BooleanKeyframeTrack}),n.d(t,'PropertyMixer',function(){return PropertyMixer}),n.d(t,'PropertyBinding',function(){return PropertyBinding}),n.d(t,'KeyframeTrack',function(){return KeyframeTrack}),n.d(t,'AnimationUtils',function(){return cn}),n.d(t,'AnimationObjectGroup',function(){return AnimationObjectGroup}),n.d(t,'AnimationMixer',function(){return AnimationMixer}),n.d(t,'AnimationClip',function(){return AnimationClip}),n.d(t,'Uniform',function(){return Uniform}),n.d(t,'InstancedBufferGeometry',function(){return InstancedBufferGeometry}),n.d(t,'BufferGeometry',function(){return BufferGeometry}),n.d(t,'GeometryIdCount',function(){return GeometryIdCount}),n.d(t,'Geometry',function(){return Geometry}),n.d(t,'InterleavedBufferAttribute',function(){return InterleavedBufferAttribute}),n.d(t,'InstancedInterleavedBuffer',function(){return InstancedInterleavedBuffer}),n.d(t,'InterleavedBuffer',function(){return InterleavedBuffer}),n.d(t,'InstancedBufferAttribute',function(){return InstancedBufferAttribute}),n.d(t,'Face3',function(){return Face3}),n.d(t,'Object3D',function(){return Object3D}),n.d(t,'Raycaster',function(){return Raycaster}),n.d(t,'Layers',function(){return Layers}),n.d(t,'EventDispatcher',function(){return EventDispatcher}),n.d(t,'Clock',function(){return Clock}),n.d(t,'QuaternionLinearInterpolant',function(){return QuaternionLinearInterpolant}),n.d(t,'LinearInterpolant',function(){return LinearInterpolant}),n.d(t,'DiscreteInterpolant',function(){return DiscreteInterpolant}),n.d(t,'CubicInterpolant',function(){return CubicInterpolant}),n.d(t,'Interpolant',function(){return Interpolant}),n.d(t,'Triangle',function(){return Triangle}),n.d(t,'Math',function(){return kt}),n.d(t,'Spherical',function(){return Spherical}),n.d(t,'Cylindrical',function(){return Cylindrical}),n.d(t,'Plane',function(){return Plane}),n.d(t,'Frustum',function(){return Frustum}),n.d(t,'Sphere',function(){return Sphere}),n.d(t,'Ray',function(){return Ray}),n.d(t,'Matrix4',function(){return Matrix4}),n.d(t,'Matrix3',function(){return Matrix3}),n.d(t,'Box3',function(){return Box3}),n.d(t,'Box2',function(){return Box2}),n.d(t,'Line3',function(){return Line3}),n.d(t,'Euler',function(){return Euler}),n.d(t,'Vector4',function(){return Vector4}),n.d(t,'Vector3',function(){return Vector3}),n.d(t,'Vector2',function(){return Vector2}),n.d(t,'Quaternion',function(){return Quaternion}),n.d(t,'Color',function(){return Color}),n.d(t,'ImmediateRenderObject',function(){return ImmediateRenderObject}),n.d(t,'VertexNormalsHelper',function(){return VertexNormalsHelper}),n.d(t,'SpotLightHelper',function(){return SpotLightHelper}),n.d(t,'SkeletonHelper',function(){return SkeletonHelper}),n.d(t,'PointLightHelper',function(){return PointLightHelper}),n.d(t,'RectAreaLightHelper',function(){return RectAreaLightHelper}),n.d(t,'HemisphereLightHelper',function(){return HemisphereLightHelper}),n.d(t,'GridHelper',function(){return GridHelper}),n.d(t,'PolarGridHelper',function(){return PolarGridHelper}),n.d(t,'FaceNormalsHelper',function(){return FaceNormalsHelper}),n.d(t,'DirectionalLightHelper',function(){return DirectionalLightHelper}),n.d(t,'CameraHelper',function(){return CameraHelper}),n.d(t,'BoxHelper',function(){return BoxHelper}),n.d(t,'Box3Helper',function(){return Box3Helper}),n.d(t,'PlaneHelper',function(){return PlaneHelper}),n.d(t,'ArrowHelper',function(){return ArrowHelper}),n.d(t,'AxisHelper',function(){return AxisHelper}),n.d(t,'CatmullRomCurve3',function(){return CatmullRomCurve3}),n.d(t,'CubicBezierCurve3',function(){return CubicBezierCurve3}),n.d(t,'QuadraticBezierCurve3',function(){return QuadraticBezierCurve3}),n.d(t,'LineCurve3',function(){return LineCurve3}),n.d(t,'ArcCurve',function(){return ArcCurve}),n.d(t,'EllipseCurve',function(){return EllipseCurve}),n.d(t,'SplineCurve',function(){return SplineCurve}),n.d(t,'CubicBezierCurve',function(){return CubicBezierCurve}),n.d(t,'QuadraticBezierCurve',function(){return QuadraticBezierCurve}),n.d(t,'LineCurve',function(){return LineCurve}),n.d(t,'Shape',function(){return Shape}),n.d(t,'Path',function(){return Path}),n.d(t,'ShapePath',function(){return ShapePath}),n.d(t,'Font',function(){return Font}),n.d(t,'CurvePath',function(){return CurvePath}),n.d(t,'Curve',function(){return Curve}),n.d(t,'ShapeUtils',function(){return an}),n.d(t,'SceneUtils',function(){return Tn}),n.d(t,'WebGLUtils',function(){return WebGLUtils}),n.d(t,'WireframeGeometry',function(){return WireframeGeometry}),n.d(t,'ParametricGeometry',function(){return ParametricGeometry}),n.d(t,'ParametricBufferGeometry',function(){return ParametricBufferGeometry}),n.d(t,'TetrahedronGeometry',function(){return TetrahedronGeometry}),n.d(t,'TetrahedronBufferGeometry',function(){return TetrahedronBufferGeometry}),n.d(t,'OctahedronGeometry',function(){return OctahedronGeometry}),n.d(t,'OctahedronBufferGeometry',function(){return OctahedronBufferGeometry}),n.d(t,'IcosahedronGeometry',function(){return IcosahedronGeometry}),n.d(t,'IcosahedronBufferGeometry',function(){return IcosahedronBufferGeometry}),n.d(t,'DodecahedronGeometry',function(){return DodecahedronGeometry}),n.d(t,'DodecahedronBufferGeometry',function(){return DodecahedronBufferGeometry}),n.d(t,'PolyhedronGeometry',function(){return PolyhedronGeometry}),n.d(t,'PolyhedronBufferGeometry',function(){return PolyhedronBufferGeometry}),n.d(t,'TubeGeometry',function(){return TubeGeometry}),n.d(t,'TubeBufferGeometry',function(){return TubeBufferGeometry}),n.d(t,'TorusKnotGeometry',function(){return TorusKnotGeometry}),n.d(t,'TorusKnotBufferGeometry',function(){return TorusKnotBufferGeometry}),n.d(t,'TorusGeometry',function(){return TorusGeometry}),n.d(t,'TorusBufferGeometry',function(){return TorusBufferGeometry}),n.d(t,'TextGeometry',function(){return TextGeometry}),n.d(t,'TextBufferGeometry',function(){return TextBufferGeometry}),n.d(t,'SphereGeometry',function(){return SphereGeometry}),n.d(t,'SphereBufferGeometry',function(){return SphereBufferGeometry}),n.d(t,'RingGeometry',function(){return RingGeometry}),n.d(t,'RingBufferGeometry',function(){return RingBufferGeometry}),n.d(t,'PlaneGeometry',function(){return PlaneGeometry}),n.d(t,'PlaneBufferGeometry',function(){return PlaneBufferGeometry}),n.d(t,'LatheGeometry',function(){return LatheGeometry}),n.d(t,'LatheBufferGeometry',function(){return LatheBufferGeometry}),n.d(t,'ShapeGeometry',function(){return ShapeGeometry}),n.d(t,'ShapeBufferGeometry',function(){return ShapeBufferGeometry}),n.d(t,'ExtrudeGeometry',function(){return ExtrudeGeometry}),n.d(t,'ExtrudeBufferGeometry',function(){return ExtrudeBufferGeometry}),n.d(t,'EdgesGeometry',function(){return EdgesGeometry}),n.d(t,'ConeGeometry',function(){return ConeGeometry}),n.d(t,'ConeBufferGeometry',function(){return ConeBufferGeometry}),n.d(t,'CylinderGeometry',function(){return CylinderGeometry}),n.d(t,'CylinderBufferGeometry',function(){return CylinderBufferGeometry}),n.d(t,'CircleGeometry',function(){return CircleGeometry}),n.d(t,'CircleBufferGeometry',function(){return CircleBufferGeometry}),n.d(t,'BoxGeometry',function(){return BoxGeometry}),n.d(t,'BoxBufferGeometry',function(){return BoxBufferGeometry}),n.d(t,'ShadowMaterial',function(){return ShadowMaterial}),n.d(t,'SpriteMaterial',function(){return SpriteMaterial}),n.d(t,'RawShaderMaterial',function(){return RawShaderMaterial}),n.d(t,'ShaderMaterial',function(){return ShaderMaterial}),n.d(t,'PointsMaterial',function(){return PointsMaterial}),n.d(t,'MeshPhysicalMaterial',function(){return MeshPhysicalMaterial}),n.d(t,'MeshStandardMaterial',function(){return MeshStandardMaterial}),n.d(t,'MeshPhongMaterial',function(){return MeshPhongMaterial}),n.d(t,'MeshToonMaterial',function(){return MeshToonMaterial}),n.d(t,'MeshNormalMaterial',function(){return MeshNormalMaterial}),n.d(t,'MeshLambertMaterial',function(){return MeshLambertMaterial}),n.d(t,'MeshDepthMaterial',function(){return MeshDepthMaterial}),n.d(t,'MeshDistanceMaterial',function(){return MeshDistanceMaterial}),n.d(t,'MeshBasicMaterial',function(){return MeshBasicMaterial}),n.d(t,'LineDashedMaterial',function(){return LineDashedMaterial}),n.d(t,'LineBasicMaterial',function(){return LineBasicMaterial}),n.d(t,'Material',function(){return Material}),n.d(t,'Float64BufferAttribute',function(){return Float64BufferAttribute}),n.d(t,'Float32BufferAttribute',function(){return Float32BufferAttribute}),n.d(t,'Uint32BufferAttribute',function(){return Uint32BufferAttribute}),n.d(t,'Int32BufferAttribute',function(){return Int32BufferAttribute}),n.d(t,'Uint16BufferAttribute',function(){return Uint16BufferAttribute}),n.d(t,'Int16BufferAttribute',function(){return Int16BufferAttribute}),n.d(t,'Uint8ClampedBufferAttribute',function(){return Uint8ClampedBufferAttribute}),n.d(t,'Uint8BufferAttribute',function(){return Uint8BufferAttribute}),n.d(t,'Int8BufferAttribute',function(){return Int8BufferAttribute}),n.d(t,'BufferAttribute',function(){return BufferAttribute}),n.d(t,'REVISION',function(){return b}),n.d(t,'MOUSE',function(){return x}),n.d(t,'CullFaceNone',function(){return v}),n.d(t,'CullFaceBack',function(){return T}),n.d(t,'CullFaceFront',function(){return R}),n.d(t,'CullFaceFrontBack',function(){return F}),n.d(t,'FrontFaceDirectionCW',function(){return w}),n.d(t,'FrontFaceDirectionCCW',function(){return M}),n.d(t,'BasicShadowMap',function(){return L}),n.d(t,'PCFShadowMap',function(){return B}),n.d(t,'PCFSoftShadowMap',function(){return D}),n.d(t,'FrontSide',function(){return I}),n.d(t,'BackSide',function(){return N}),n.d(t,'DoubleSide',function(){return P}),n.d(t,'FlatShading',function(){return O}),n.d(t,'SmoothShading',function(){return U}),n.d(t,'NoColors',function(){return G}),n.d(t,'FaceColors',function(){return k}),n.d(t,'VertexColors',function(){return W}),n.d(t,'NoBlending',function(){return H}),n.d(t,'NormalBlending',function(){return V}),n.d(t,'AdditiveBlending',function(){return $}),n.d(t,'SubtractiveBlending',function(){return z}),n.d(t,'MultiplyBlending',function(){return X}),n.d(t,'CustomBlending',function(){return j}),n.d(t,'AddEquation',function(){return Y}),n.d(t,'SubtractEquation',function(){return K}),n.d(t,'ReverseSubtractEquation',function(){return q}),n.d(t,'MinEquation',function(){return Z}),n.d(t,'MaxEquation',function(){return Q}),n.d(t,'ZeroFactor',function(){return J}),n.d(t,'OneFactor',function(){return ee}),n.d(t,'SrcColorFactor',function(){return te}),n.d(t,'OneMinusSrcColorFactor',function(){return ne}),n.d(t,'SrcAlphaFactor',function(){return re}),n.d(t,'OneMinusSrcAlphaFactor',function(){return ae}),n.d(t,'DstAlphaFactor',function(){return oe}),n.d(t,'OneMinusDstAlphaFactor',function(){return ie}),n.d(t,'DstColorFactor',function(){return se}),n.d(t,'OneMinusDstColorFactor',function(){return le}),n.d(t,'SrcAlphaSaturateFactor',function(){return de}),n.d(t,'NeverDepth',function(){return ce}),n.d(t,'AlwaysDepth',function(){return pe}),n.d(t,'LessDepth',function(){return ue}),n.d(t,'LessEqualDepth',function(){return me}),n.d(t,'EqualDepth',function(){return ge}),n.d(t,'GreaterEqualDepth',function(){return he}),n.d(t,'GreaterDepth',function(){return fe}),n.d(t,'NotEqualDepth',function(){return Ee}),n.d(t,'MultiplyOperation',function(){return _e}),n.d(t,'MixOperation',function(){return Ce}),n.d(t,'AddOperation',function(){return ye}),n.d(t,'NoToneMapping',function(){return Ae}),n.d(t,'LinearToneMapping',function(){return be}),n.d(t,'ReinhardToneMapping',function(){return xe}),n.d(t,'Uncharted2ToneMapping',function(){return ve}),n.d(t,'CineonToneMapping',function(){return Te}),n.d(t,'UVMapping',function(){return Se}),n.d(t,'CubeReflectionMapping',function(){return Re}),n.d(t,'CubeRefractionMapping',function(){return Fe}),n.d(t,'EquirectangularReflectionMapping',function(){return we}),n.d(t,'EquirectangularRefractionMapping',function(){return Me}),n.d(t,'SphericalReflectionMapping',function(){return Le}),n.d(t,'CubeUVReflectionMapping',function(){return Be}),n.d(t,'CubeUVRefractionMapping',function(){return De}),n.d(t,'RepeatWrapping',function(){return Ie}),n.d(t,'ClampToEdgeWrapping',function(){return Ne}),n.d(t,'MirroredRepeatWrapping',function(){return Pe}),n.d(t,'NearestFilter',function(){return Oe}),n.d(t,'NearestMipMapNearestFilter',function(){return Ue}),n.d(t,'NearestMipMapLinearFilter',function(){return Ge}),n.d(t,'LinearFilter',function(){return ke}),n.d(t,'LinearMipMapNearestFilter',function(){return We}),n.d(t,'LinearMipMapLinearFilter',function(){return He}),n.d(t,'UnsignedByteType',function(){return Ve}),n.d(t,'ByteType',function(){return $e}),n.d(t,'ShortType',function(){return ze}),n.d(t,'UnsignedShortType',function(){return Xe}),n.d(t,'IntType',function(){return je}),n.d(t,'UnsignedIntType',function(){return Ye}),n.d(t,'FloatType',function(){return Ke}),n.d(t,'HalfFloatType',function(){return qe}),n.d(t,'UnsignedShort4444Type',function(){return Ze}),n.d(t,'UnsignedShort5551Type',function(){return Qe}),n.d(t,'UnsignedShort565Type',function(){return Je}),n.d(t,'UnsignedInt248Type',function(){return et}),n.d(t,'AlphaFormat',function(){return tt}),n.d(t,'RGBFormat',function(){return nt}),n.d(t,'RGBAFormat',function(){return rt}),n.d(t,'LuminanceFormat',function(){return at}),n.d(t,'LuminanceAlphaFormat',function(){return ot}),n.d(t,'RGBEFormat',function(){return it}),n.d(t,'DepthFormat',function(){return st}),n.d(t,'DepthStencilFormat',function(){return lt}),n.d(t,'RGB_S3TC_DXT1_Format',function(){return dt}),n.d(t,'RGBA_S3TC_DXT1_Format',function(){return ct}),n.d(t,'RGBA_S3TC_DXT3_Format',function(){return pt}),n.d(t,'RGBA_S3TC_DXT5_Format',function(){return ut}),n.d(t,'RGB_PVRTC_4BPPV1_Format',function(){return mt}),n.d(t,'RGB_PVRTC_2BPPV1_Format',function(){return gt}),n.d(t,'RGBA_PVRTC_4BPPV1_Format',function(){return ht}),n.d(t,'RGBA_PVRTC_2BPPV1_Format',function(){return ft}),n.d(t,'RGB_ETC1_Format',function(){return Et}),n.d(t,'LoopOnce',function(){return _t}),n.d(t,'LoopRepeat',function(){return Ct}),n.d(t,'LoopPingPong',function(){return yt}),n.d(t,'InterpolateDiscrete',function(){return At}),n.d(t,'InterpolateLinear',function(){return bt}),n.d(t,'InterpolateSmooth',function(){return xt}),n.d(t,'ZeroCurvatureEnding',function(){return vt}),n.d(t,'ZeroSlopeEnding',function(){return Tt}),n.d(t,'WrapAroundEnding',function(){return St}),n.d(t,'TrianglesDrawMode',function(){return Rt}),n.d(t,'TriangleStripDrawMode',function(){return Ft}),n.d(t,'TriangleFanDrawMode',function(){return wt}),n.d(t,'LinearEncoding',function(){return Mt}),n.d(t,'sRGBEncoding',function(){return Lt}),n.d(t,'GammaEncoding',function(){return Bt}),n.d(t,'RGBEEncoding',function(){return Dt}),n.d(t,'LogLuvEncoding',function(){return It}),n.d(t,'RGBM7Encoding',function(){return Nt}),n.d(t,'RGBM16Encoding',function(){return Pt}),n.d(t,'RGBDEncoding',function(){return Ot}),n.d(t,'BasicDepthPacking',function(){return Ut}),n.d(t,'RGBADepthPacking',function(){return Gt}),n.d(t,'CubeGeometry',function(){return BoxGeometry}),n.d(t,'Face4',function(){return Face4}),n.d(t,'LineStrip',function(){return Sn}),n.d(t,'LinePieces',function(){return Rn}),n.d(t,'MeshFaceMaterial',function(){return MeshFaceMaterial}),n.d(t,'MultiMaterial',function(){return MultiMaterial}),n.d(t,'PointCloud',function(){return PointCloud}),n.d(t,'Particle',function(){return Particle}),n.d(t,'ParticleSystem',function(){return ParticleSystem}),n.d(t,'PointCloudMaterial',function(){return PointCloudMaterial}),n.d(t,'ParticleBasicMaterial',function(){return ParticleBasicMaterial}),n.d(t,'ParticleSystemMaterial',function(){return ParticleSystemMaterial}),n.d(t,'Vertex',function(){return Vertex}),n.d(t,'DynamicBufferAttribute',function(){return DynamicBufferAttribute}),n.d(t,'Int8Attribute',function(){return Int8Attribute}),n.d(t,'Uint8Attribute',function(){return Uint8Attribute}),n.d(t,'Uint8ClampedAttribute',function(){return Uint8ClampedAttribute}),n.d(t,'Int16Attribute',function(){return Int16Attribute}),n.d(t,'Uint16Attribute',function(){return Uint16Attribute}),n.d(t,'Int32Attribute',function(){return Int32Attribute}),n.d(t,'Uint32Attribute',function(){return Uint32Attribute}),n.d(t,'Float32Attribute',function(){return Float32Attribute}),n.d(t,'Float64Attribute',function(){return Float64Attribute}),n.d(t,'ClosedSplineCurve3',function(){return ClosedSplineCurve3}),n.d(t,'SplineCurve3',function(){return SplineCurve3}),n.d(t,'Spline',function(){return Spline}),n.d(t,'BoundingBoxHelper',function(){return BoundingBoxHelper}),n.d(t,'EdgesHelper',function(){return EdgesHelper}),n.d(t,'WireframeHelper',function(){return WireframeHelper}),n.d(t,'XHRLoader',function(){return XHRLoader}),n.d(t,'BinaryTextureLoader',function(){return BinaryTextureLoader}),n.d(t,'GeometryUtils',function(){return Fn}),n.d(t,'ImageUtils',function(){return wn}),n.d(t,'Projector',function(){return Projector}),n.d(t,'CanvasRenderer',function(){return CanvasRenderer}),g===void 0&&(g=2.220446049250313e-16),u===void 0&&(u=function(e){return'number'==typeof e&&isFinite(e)&&h(e)===e}),c===void 0&&(c=function(e){return 0>e?-1:0r;r++)8===r||13===r||18===r||23===r?t[r]='-':14===r?t[r]='4':(2>=n&&(n=0|33554432+16777216*Math.random()),a=15&n,n>>=4,t[r]=e[19===r?8|3&a:a]);return t.join('')}}(),clamp:function(e,t,n){return y(t,p(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,a){return r+(e-t)*(a-r)/(n-t)},lerp:function(e,n,r){return(1-r)*e+r*n},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},randInt:function(e,t){return e+h(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*kt.DEG2RAD},radToDeg:function(e){return e*kt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return f(2,s(_(e)/d))},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=p(this.x,e.x),this.y=p(this.y,e.y),this},max:function(e){return this.x=y(this.x,e.x),this.y=y(this.y,e.y),this},clamp:function(e,t){return this.x=y(e.x,p(t.x,this.x)),this.y=y(e.y,p(t.y,this.y)),this},clampScalar:function(){var e=new Vector2,t=new Vector2;return function clampScalar(n,r){return e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(y(e,p(t,n)))},floor:function(){return this.x=h(this.x),this.y=h(this.y),this},ceil:function(){return this.x=C(this.x),this.y=C(this.y),this},round:function(){return this.x=s(this.x),this.y=s(this.y),this},roundToZero:function(){return this.x=0>this.x?C(this.x):h(this.x),this.y=0>this.y?C(this.y):h(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 A(this.x)+A(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=i(this.y,this.x);return 0>e&&(e+=2*S),e},distanceTo:function(e){return l(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},distanceToManhattan:function(e){return A(this.x-e.x)+A(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,n){return this.subVectors(t,e).multiplyScalar(n).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,n){return void 0!==n&&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 n=m(t),r=o(t),a=this.x-e.x,i=this.y-e.y;return this.x=a*n-i*r+e.x,this.y=a*r+i*n+e.y,this}});var Wt=0;Texture.DEFAULT_IMAGE=void 0,Texture.DEFAULT_MAPPING=Se,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 n=t.getContext('2d');e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height)}return 2048e.x||1e.x?0:1;break;case Pe:1===A(h(e.x)%2)?e.x=C(e.x)-e.x:e.x-=h(e.x);}if(0>e.y||1e.y?0:1;break;case Pe:1===A(h(e.y)%2)?e.y=C(e.y)-e.y:e.y-=h(e.y);}this.flipY&&(e.y=1-e.y)}}}),Object.assign(Vector4.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,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 n=this.x,r=this.y,a=this.z,o=this.w,i=t.elements;return this.x=i[0]*n+i[4]*r+i[8]*a+i[12]*o,this.y=i[1]*n+i[5]*r+i[9]*a+i[13]*o,this.z=i[2]*n+i[6]*r+i[10]*a+i[14]*o,this.w=i[3]*n+i[7]*r+i[11]*a+i[15]*o,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*a(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,n=0.1,r=e.elements,o=r[0],i=r[4],d=r[8],c=r[1],p=r[5],u=r[9],m=r[2],g=r[6],h=r[10],f,E,_,C;if(A(i-c)b&&y>x?yx?bA(F)&&(F=1),this.x=(g-u)/F,this.y=(d-m)/F,this.z=(c-i)/F,this.w=a((o+p+h-1)/2),this},min:function(e){return this.x=p(this.x,e.x),this.y=p(this.y,e.y),this.z=p(this.z,e.z),this.w=p(this.w,e.w),this},max:function(e){return this.x=y(this.x,e.x),this.y=y(this.y,e.y),this.z=y(this.z,e.z),this.w=y(this.w,e.w),this},clamp:function(e,t){return this.x=y(e.x,p(t.x,this.x)),this.y=y(e.y,p(t.y,this.y)),this.z=y(e.z,p(t.z,this.z)),this.w=y(e.w,p(t.w,this.w)),this},clampScalar:function(){var e,t;return function clampScalar(n,r){return void 0==e&&(e=new Vector4,t=new Vector4),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(y(e,p(t,n)))},floor:function(){return this.x=h(this.x),this.y=h(this.y),this.z=h(this.z),this.w=h(this.w),this},ceil:function(){return this.x=C(this.x),this.y=C(this.y),this.z=C(this.z),this.w=C(this.w),this},round:function(){return this.x=s(this.x),this.y=s(this.y),this.z=s(this.z),this.w=s(this.w),this},roundToZero:function(){return this.x=0>this.x?C(this.x):h(this.x),this.y=0>this.y?C(this.y):h(this.y),this.z=0>this.z?C(this.z):h(this.z),this.w=0>this.w?C(this.w):h(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 A(this.x)+A(this.y)+A(this.z)+A(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,n){return this.subVectors(t,e).multiplyScalar(n).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,n){return void 0!==n&&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,n,r,a){return r.copy(e).slerp(n,a)},slerpFlat:function(e,n,r,a,d,c,p){var t=r[a+0],u=r[a+1],m=r[a+2],h=r[a+3],E=d[c+0],_=d[c+1],C=d[c+2],y=d[c+3];if(h!==y||t!==E||u!==_||m!==C){var A=1-p,s=t*E+u*_+m*C+h*y,b=0<=s?1:-1,x=1-s*s;if(x>g){var v=l(x),T=i(v,s*b);A=o(A*T)/v,p=o(p*T)/v}var S=p*b;if(t=t*A+E*S,u=u*A+_*S,m=m*A+C*S,h=h*A+y*S,A==1-p){var R=1/l(t*t+u*u+m*m+h*h);t*=R,u*=R,m*=R,h*=R}}e[n]=t,e[n+1]=u,e[n+2]=m,e[n+3]=h}}),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,n,r){return this._x=e,this._y=t,this._z=n,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 n=e._x,r=e._y,a=e._z,i=e.order,s=m,l=o,d=s(n/2),c=s(r/2),p=s(a/2),u=l(n/2),g=l(r/2),h=l(a/2);return'XYZ'===i?(this._x=u*c*p+d*g*h,this._y=d*g*p-u*c*h,this._z=d*c*h+u*g*p,this._w=d*c*p-u*g*h):'YXZ'===i?(this._x=u*c*p+d*g*h,this._y=d*g*p-u*c*h,this._z=d*c*h-u*g*p,this._w=d*c*p+u*g*h):'ZXY'===i?(this._x=u*c*p-d*g*h,this._y=d*g*p+u*c*h,this._z=d*c*h+u*g*p,this._w=d*c*p-u*g*h):'ZYX'===i?(this._x=u*c*p-d*g*h,this._y=d*g*p+u*c*h,this._z=d*c*h-u*g*p,this._w=d*c*p+u*g*h):'YZX'===i?(this._x=u*c*p+d*g*h,this._y=d*g*p+u*c*h,this._z=d*c*h-u*g*p,this._w=d*c*p-u*g*h):'XZY'===i&&(this._x=u*c*p-d*g*h,this._y=d*g*p-u*c*h,this._z=d*c*h+u*g*p,this._w=d*c*p+u*g*h),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=o(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=m(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],a=t[8],o=t[1],i=t[5],d=t[9],c=t[2],p=t[6],u=t[10],m=n+i+u,g;return 0i&&n>u?(g=2*l(1+n-i-u),this._w=(p-d)/g,this._x=0.25*g,this._y=(r+o)/g,this._z=(a+c)/g):i>u?(g=2*l(1+i-n-u),this._w=(a-c)/g,this._x=(r+o)/g,this._y=0.25*g,this._z=(d+p)/g):(g=2*l(1+u-n-i),this._w=(o-r)/g,this._x=(a+c)/g,this._y=(d+p)/g,this._z=0.25*g),this.onChangeCallback(),this},setFromUnitVectors:function(){var e=new Vector3,t;return function setFromUnitVectors(n,r){return void 0===e&&(e=new Vector3),t=n.dot(r)+1,t<1e-6?(t=0,A(n.x)>A(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,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 n=e._x,r=e._y,a=e._z,o=e._w,i=t._x,s=t._y,l=t._z,d=t._w;return this._x=n*d+o*i+r*l-a*s,this._y=r*d+o*s+a*i-n*l,this._z=a*d+o*l+n*s-r*i,this._w=o*d-n*i-r*s-a*l,this.onChangeCallback(),this},slerp:function(e,n){if(0===n)return this;if(1===n)return this.copy(e);var t=this._x,r=this._y,a=this._z,s=this._w,d=s*e._w+t*e._x+r*e._y+a*e._z;if(0>d?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,d=-d):this.copy(e),1<=d)return this._w=s,this._x=t,this._y=r,this._z=a,this;var c=l(1-d*d);if(1e-3>A(c))return this._w=0.5*(s+this._w),this._x=0.5*(t+this._x),this._y=0.5*(r+this._y),this._z=0.5*(a+this._z),this;var p=i(c,d),u=o((1-n)*p)/c,m=o(n*p)/c;return this._w=s*u+this._w*m,this._x=t*u+this._x*m,this._y=r*u+this._y*m,this._z=a*u+this._z*m,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,n){return this.x=e,this.y=t,this.z=n,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,n){return this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(t){var n=this.x,r=this.y,a=this.z,o=t.elements;return this.x=o[0]*n+o[3]*r+o[6]*a,this.y=o[1]*n+o[4]*r+o[7]*a,this.z=o[2]*n+o[5]*r+o[8]*a,this},applyMatrix4:function(t){var n=this.x,r=this.y,a=this.z,o=t.elements,e=1/(o[3]*n+o[7]*r+o[11]*a+o[15]);return this.x=(o[0]*n+o[4]*r+o[8]*a+o[12])*e,this.y=(o[1]*n+o[5]*r+o[9]*a+o[13])*e,this.z=(o[2]*n+o[6]*r+o[10]*a+o[14])*e,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,a=e.x,o=e.y,i=e.z,s=e.w,l=s*t+o*r-i*n,d=s*n+i*t-a*r,c=s*r+a*n-o*t,p=-a*t-o*n-i*r;return this.x=l*s+p*-a+d*-i-c*-o,this.y=d*s+p*-o+c*-a-l*-i,this.z=c*s+p*-i+l*-o-d*-a,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 n=this.x,r=this.y,a=this.z,o=t.elements;return this.x=o[0]*n+o[4]*r+o[8]*a,this.y=o[1]*n+o[5]*r+o[9]*a,this.z=o[2]*n+o[6]*r+o[10]*a,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=p(this.x,e.x),this.y=p(this.y,e.y),this.z=p(this.z,e.z),this},max:function(e){return this.x=y(this.x,e.x),this.y=y(this.y,e.y),this.z=y(this.z,e.z),this},clamp:function(e,t){return this.x=y(e.x,p(t.x,this.x)),this.y=y(e.y,p(t.y,this.y)),this.z=y(e.z,p(t.z,this.z)),this},clampScalar:function(){var e=new Vector3,t=new Vector3;return function clampScalar(n,r){return e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(y(e,p(t,n)))},floor:function(){return this.x=h(this.x),this.y=h(this.y),this.z=h(this.z),this},ceil:function(){return this.x=C(this.x),this.y=C(this.y),this.z=C(this.z),this},round:function(){return this.x=s(this.x),this.y=s(this.y),this.z=s(this.z),this},roundToZero:function(){return this.x=0>this.x?C(this.x):h(this.x),this.y=0>this.y?C(this.y):h(this.y),this.z=0>this.z?C(this.z):h(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 A(this.x)+A(this.y)+A(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,n){return this.subVectors(t,e).multiplyScalar(n).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 n=this.x,r=this.y,a=this.z;return this.x=r*e.z-a*e.y,this.y=a*e.x-n*e.z,this.z=n*e.y-r*e.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,a=e.z,o=t.x,i=t.y,s=t.z;return this.x=r*s-a*i,this.y=a*o-n*s,this.z=n*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 a(kt.clamp(t,-1,1))},distanceTo:function(e){return l(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},distanceToManhattan:function(e){return A(this.x-e.x)+A(this.y-e.y)+A(this.z-e.z)},setFromSpherical:function(e){var t=o(e.phi)*e.radius;return this.x=t*o(e.theta),this.y=m(e.phi)*e.radius,this.z=t*m(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*o(e.theta),this.y=e.y,this.z=e.radius*m(e.theta),this},setFromMatrixPosition:function(t){var n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,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,n){return void 0!==n&&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,n,r,a,o,i,s,l,d,c,p,u,m,g,h){var f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=a,f[5]=o,f[9]=i,f[13]=s,f[2]=l,f[6]=d,f[10]=c,f[14]=p,f[3]=u,f[7]=m,f[11]=g,f[15]=h,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,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e=new Vector3;return function extractRotation(t){var n=this.elements,r=t.elements,a=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),i=1/e.setFromMatrixColumn(t,2).length();return n[0]=r[0]*a,n[1]=r[1]*a,n[2]=r[2]*a,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*i,n[9]=r[9]*i,n[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 n=this.elements,r=t.x,i=t.y,s=t.z,l=m(r),p=o(r),u=m(i),g=o(i),h=m(s),e=o(s);if('XYZ'===t.order){var E=l*h,_=l*e,C=p*h,y=p*e;n[0]=u*h,n[4]=-u*e,n[8]=g,n[1]=_+C*g,n[5]=E-y*g,n[9]=-p*u,n[2]=y-E*g,n[6]=C+_*g,n[10]=l*u}else if('YXZ'===t.order){var A=u*h,x=u*e,v=g*h,T=g*e;n[0]=A+T*p,n[4]=v*p-x,n[8]=l*g,n[1]=l*e,n[5]=l*h,n[9]=-p,n[2]=x*p-v,n[6]=T+A*p,n[10]=l*u}else if('ZXY'===t.order){var A=u*h,x=u*e,v=g*h,T=g*e;n[0]=A-T*p,n[4]=-l*e,n[8]=v+x*p,n[1]=x+v*p,n[5]=l*h,n[9]=T-A*p,n[2]=-l*g,n[6]=p,n[10]=l*u}else if('ZYX'===t.order){var E=l*h,_=l*e,C=p*h,y=p*e;n[0]=u*h,n[4]=C*g-_,n[8]=E*g+y,n[1]=u*e,n[5]=y*g+E,n[9]=_*g-C,n[2]=-g,n[6]=p*u,n[10]=l*u}else if('YZX'===t.order){var S=l*u,R=l*g,F=p*u,w=p*g;n[0]=u*h,n[4]=w-S*e,n[8]=F*e+R,n[1]=e,n[5]=l*h,n[9]=-p*h,n[2]=-g*h,n[6]=R*e+F,n[10]=S-w*e}else if('XZY'===t.order){var S=l*u,R=l*g,F=p*u,w=p*g;n[0]=u*h,n[4]=-e,n[8]=g*h,n[1]=S*e+w,n[5]=l*h,n[9]=R*e-F,n[2]=F*e-R,n[6]=p*h,n[10]=w*e+S}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e._x,r=e._y,a=e._z,o=e._w,i=n+n,s=r+r,l=a+a,d=n*i,c=n*s,p=n*l,u=r*s,m=r*l,g=a*l,h=o*i,f=o*s,E=o*l;return t[0]=1-(u+g),t[4]=c-E,t[8]=p+f,t[1]=c+E,t[5]=1-(d+g),t[9]=m-h,t[2]=p-f,t[6]=m+h,t[10]=1-(d+u),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,n=new Vector3;return function lookAt(r,a,o){var i=this.elements;return n.subVectors(r,a),0===n.lengthSq()&&(n.z=1),n.normalize(),e.crossVectors(o,n),0===e.lengthSq()&&(1===A(o.z)?n.x+=1e-4:n.z+=1e-4,n.normalize(),e.crossVectors(o,n)),e.normalize(),t.crossVectors(n,e),i[0]=e.x,i[4]=t.x,i[8]=n.x,i[1]=e.y,i[5]=t.y,i[9]=n.y,i[2]=e.z,i[6]=t.z,i[10]=n.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 n=e.elements,r=t.elements,a=this.elements,o=n[0],i=n[4],s=n[8],l=n[12],d=n[1],c=n[5],p=n[9],u=n[13],m=n[2],g=n[6],h=n[10],f=n[14],E=n[3],_=n[7],C=n[11],y=n[15],A=r[0],b=r[4],x=r[8],v=r[12],T=r[1],S=r[5],R=r[9],F=r[13],w=r[2],M=r[6],L=r[10],B=r[14],D=r[3],I=r[7],N=r[11],P=r[15];return a[0]=o*A+i*T+s*w+l*D,a[4]=o*b+i*S+s*M+l*I,a[8]=o*x+i*R+s*L+l*N,a[12]=o*v+i*F+s*B+l*P,a[1]=d*A+c*T+p*w+u*D,a[5]=d*b+c*S+p*M+u*I,a[9]=d*x+c*R+p*L+u*N,a[13]=d*v+c*F+p*B+u*P,a[2]=m*A+g*T+h*w+f*D,a[6]=m*b+g*S+h*M+f*I,a[10]=m*x+g*R+h*L+f*N,a[14]=m*v+g*F+h*B+f*P,a[3]=E*A+_*T+C*w+y*D,a[7]=E*b+_*S+C*M+y*I,a[11]=E*x+_*R+C*L+y*N,a[15]=E*v+_*F+C*B+y*P,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 n=0,r=t.count;nd&&(i=-i),n.x=o[12],n.y=o[13],n.z=o[14],t.copy(this);var c=1/i,p=1/s,u=1/l;return t.elements[0]*=c,t.elements[1]*=c,t.elements[2]*=c,t.elements[4]*=p,t.elements[5]*=p,t.elements[6]*=p,t.elements[8]*=u,t.elements[9]*=u,t.elements[10]*=u,r.setFromRotationMatrix(t),a.x=i,a.y=s,a.z=l,this}}(),makePerspective:function(e,t,n,r,a,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*a/(t-e),i[4]=0,i[8]=(t+e)/(t-e),i[12]=0,i[1]=0,i[5]=2*a/(n-r),i[9]=(n+r)/(n-r),i[13]=0,i[2]=0,i[6]=0,i[10]=-(o+a)/(o-a),i[14]=-2*o*a/(o-a),i[3]=0,i[7]=0,i[11]=-1,i[15]=0,this},makeOrthographic:function(e,t,n,r,a,o){var i=this.elements,s=1/(t-e),l=1/(n-r),d=1/(o-a);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]=-((n+r)*l),i[2]=0,i[6]=0,i[10]=-2*d,i[14]=-((o+a)*d),i[3]=0,i[7]=0,i[11]=0,i[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;16>r;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;16>n;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[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,Vt=new CubeTexture,$t=[],zt=[],Xt=new Float32Array(16),jt=new Float32Array(9);StructuredUniform.prototype.setValue=function(e,t){for(var r=this.seq,a=0,o=r.length,n;a!==o;++a)n=r[a],n.setValue(e,t[n.id])};var Yt=/([\w\d_]+)(\])?(\[|\.)?/g;WebGLUniforms.prototype.setValue=function(e,t,n){var r=this.map[t];r!==void 0&&r.setValue(e,n,this.renderer)},WebGLUniforms.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)},WebGLUniforms.upload=function(e,t,r,a){for(var o=0,i=t.length;o!==i;++o){var n=t[o],s=r[n.id];!1!==s.needsUpdate&&n.setValue(e,s.value,a)}},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=h(e),this.r=(255&e>>16)/255,this.g=(255&e>>8)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function hue2rgb(e,n,r){return 0>r&&(r+=1),1=n?n*(1+t):n+t-n*t,a=2*n-r;this.r=hue2rgb(a,r,e+1/3),this.g=hue2rgb(a,r,e),this.b=hue2rgb(a,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 n=t[1],r=t[2],a;switch(n){case'rgb':case'rgba':if(a=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=p(255,parseInt(a[1],10))/255,this.g=p(255,parseInt(a[2],10))/255,this.b=p(255,parseInt(a[3],10))/255,handleAlpha(a[5]),this;if(a=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=p(100,parseInt(a[1],10))/100,this.g=p(100,parseInt(a[2],10))/100,this.b=p(100,parseInt(a[3],10))/100,handleAlpha(a[5]),this;break;case'hsl':case'hsla':if(a=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var o=parseFloat(a[1])/360,i=parseInt(a[2],10)/100,s=parseInt(a[3],10)/100;return handleAlpha(a[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?c/(o+i):c/(2-o-i),o===n?l=(r-a)/c+(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