mirror of
https://github.com/seigler/dash-website
synced 2025-07-26 23:06:09 +00:00
12 lines
No EOL
351 KiB
JavaScript
12 lines
No EOL
351 KiB
JavaScript
!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function a(t){this.options=Object.assign({},{container:document.getElementById("container"),masternodeTotalCount:4e3,pointSize:1.1,imgDir:"assets/",url:"assets/mn_locations.tsv",mouseWheel:!0},t||{}),this.globeData=[],this.globe=null,this.init()}Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),s=r(o),l=n(179),c=r(l),u=n(184),h=i(u),d=n(185),f=i(d);window.DashGlobe=a,a.Detector=h["default"],a.prototype.init=function(){var t=this;this.globe=new f["default"](this.options.container,{imgDir:this.options.imgDir,pointSize:this.options.pointSize,cameraOffset:this.options.cameraOffset,initialZoom:this.options.initialZoom,mouseWheel:this.options.mouseWheel,colorFn:function(e){return new s.Color(t.options.barColor||4294967295)}}),this.fetchData(function(){for(var e=0;e<t.globeData.length;e++)t.globe.addData(t.globeData[e][1],{format:"magnitude",name:t.globeData[e][0],animated:!0});t.globe.createPoints(),t.globe.time=1,t.globe.animate()})},a.prototype.fetchData=function(t){var e=this;c.request(this.options.url).mimeType("text/tab-separated-values").response(function(t){return e.parseMasterNodeDataFromTSV(t.responseText)}).get(function(n,i){e.masternodeTotalCount=e.countMasterNodes(i),e.globeData.push(["current",e.createGlobeDataSet(i,e.masternodeTotalCount)]),"function"==typeof t&&t()})},a.prototype.createGlobeDataSet=function(t,e){var n=[];return t.forEach(function(t){n.push(t.lat),n.push(t.lon),n.push(t.masternodes/e*3+3/e)}),n},a.prototype.countMasterNodes=function(t){var e=0;return t.forEach(function(t){e+=t.masternodes}),e},a.prototype.parseMasterNodeDataFromTSV=function(t){return c.tsvParse(t,function(t){var e=0,n=0,i=0;try{e=parseInt(t.description.replace("Masternodes: ",""),10),n=parseFloat(t.lat),i=parseFloat(t.lon)}catch(r){}return{lat:n,lon:i,masternodes:e,title:t.title}})},e["default"]=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SphereGeometry=e.BoxGeometry=e.Color=e.ColorKeywords=e.Geometry=e.Vector3=e.Matrix4=e.Mesh=e.MeshBasicMaterial=e.PerspectiveCamera=e.Scene=e.ShaderMaterial=e.TextureLoader=e.UniformsUtils=e.WebGLRenderer=void 0;var i=n(2);Object.defineProperty(e,"WebGLRenderer",{enumerable:!0,get:function(){return i.WebGLRenderer}});var r=n(13);Object.defineProperty(e,"UniformsUtils",{enumerable:!0,get:function(){return r.UniformsUtils}});var a=n(169);Object.defineProperty(e,"TextureLoader",{enumerable:!0,get:function(){return a.TextureLoader}});var o=n(129);Object.defineProperty(e,"ShaderMaterial",{enumerable:!0,get:function(){return o.ShaderMaterial}});var s=n(174);Object.defineProperty(e,"Scene",{enumerable:!0,get:function(){return s.Scene}});var l=n(152);Object.defineProperty(e,"PerspectiveCamera",{enumerable:!0,get:function(){return l.PerspectiveCamera}});var c=n(150);Object.defineProperty(e,"MeshBasicMaterial",{enumerable:!0,get:function(){return c.MeshBasicMaterial}});var u=n(146);Object.defineProperty(e,"Mesh",{enumerable:!0,get:function(){return u.Mesh}});var h=n(4);Object.defineProperty(e,"Matrix4",{enumerable:!0,get:function(){return h.Matrix4}});var d=n(6);Object.defineProperty(e,"Vector3",{enumerable:!0,get:function(){return d.Vector3}});var f=n(141);Object.defineProperty(e,"Geometry",{enumerable:!0,get:function(){return f.Geometry}});var p=n(123);Object.defineProperty(e,"ColorKeywords",{enumerable:!0,get:function(){return p.ColorKeywords}}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return p.Color}});var m=n(175);Object.defineProperty(e,"BoxGeometry",{enumerable:!0,get:function(){return m.BoxGeometry}});var v=n(176);Object.defineProperty(e,"SphereGeometry",{enumerable:!0,get:function(){return v.SphereGeometry}});var g=n(3);Object.keys(g).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return g[t]}})}),n(178)},function(t,e,n){"use strict";function i(t){function e(){return null===Dt?jt:1}function n(t,e,n,i){yt===!0&&(t*=i,e*=i,n*=i),ce.clearColor(t,e,n,i)}function i(){ce.init(),ce.scissor(Ot.copy(Xt).multiplyScalar(jt)),ce.viewport(Vt.copy(Yt).multiplyScalar(jt)),n(zt.r,zt.g,zt.b,kt)}function I(){Ct=null,It=null,Ft="",Nt=-1,ce.reset()}function O(t){t.preventDefault(),I(),i(),ue.clear()}function B(t){var e=t.target;e.removeEventListener("dispose",B),V(e)}function V(t){G(t),ue["delete"](t)}function G(t){var e=ue.get(t).program;t.program=void 0,void 0!==e&&fe.releaseProgram(e)}function z(t,e,n,i){var r;if(n&&n.isInstancedBufferGeometry&&(r=se.get("ANGLE_instanced_arrays"),null===r))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===i&&(i=0),ce.initAttributes();var a=n.attributes,o=e.getAttributes(),s=t.defaultAttributeValues;for(var l in o){var c=o[l];if(c>=0){var u=a[l];if(void 0!==u){var h=re.FLOAT,d=u.array,f=u.normalized;d instanceof Float32Array?h=re.FLOAT:d instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):d instanceof Uint16Array?h=re.UNSIGNED_SHORT:d instanceof Int16Array?h=re.SHORT:d instanceof Uint32Array?h=re.UNSIGNED_INT:d instanceof Int32Array?h=re.INT:d instanceof Int8Array?h=re.BYTE:d instanceof Uint8Array&&(h=re.UNSIGNED_BYTE);var p=u.itemSize,m=de.getAttributeBuffer(u);if(u&&u.isInterleavedBufferAttribute){var v=u.data,g=v.stride,x=u.offset;v&&v.isInstancedInterleavedBuffer?(ce.enableAttributeAndDivisor(c,v.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):ce.enableAttribute(c),re.bindBuffer(re.ARRAY_BUFFER,m),re.vertexAttribPointer(c,p,h,f,g*v.array.BYTES_PER_ELEMENT,(i*g+x)*v.array.BYTES_PER_ELEMENT)}else u&&u.isInstancedBufferAttribute?(ce.enableAttributeAndDivisor(c,u.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=u.meshPerAttribute*u.count)):ce.enableAttribute(c),re.bindBuffer(re.ARRAY_BUFFER,m),re.vertexAttribPointer(c,p,h,f,0,i*p*u.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var _=s[l];if(void 0!==_)switch(_.length){case 2:re.vertexAttrib2fv(c,_);break;case 3:re.vertexAttrib3fv(c,_);break;case 4:re.vertexAttrib4fv(c,_);break;default:re.vertexAttrib1fv(c,_)}}}}ce.disableUnusedAttributes()}function k(t,e){return Math.abs(e[0])-Math.abs(t[0])}function H(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function W(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function j(t,e,n,i,r){var a,o;n.transparent?(a=St,o=++Tt):(a=wt,o=++Et);var s=a[o];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=ee.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:n,z:ee.z,group:r},a.push(s))}function X(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),$t.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),Y($t)}function q(t){return $t.center.set(0,0,0),$t.radius=.7071067811865476,$t.applyMatrix4(t.matrixWorld),Y($t)}function Y(t){if(!Zt.intersectsSphere(t))return!1;var e=Qt.numPlanes;if(0===e)return!0;var n=Rt.clippingPlanes,i=t.center,r=-t.radius,a=0;do if(n[a].distanceToPoint(i)<r)return!1;while(++a!==e);return!0}function Z(t,e){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n)if(t.isLight)bt.push(t);else if(t.isSprite)t.frustumCulled!==!1&&q(t)!==!0||At.push(t);else if(t.isLensFlare)Pt.push(t);else if(t.isImmediateRenderObject)Rt.sortObjects===!0&&(ee.setFromMatrixPosition(t.matrixWorld),ee.applyProjection(te)),j(t,null,t.material,ee.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),t.frustumCulled===!1||X(t)===!0)){var i=t.material;if(i.visible===!0){Rt.sortObjects===!0&&(ee.setFromMatrixPosition(t.matrixWorld),ee.applyProjection(te));var r=de.update(t);if(i.isMultiMaterial)for(var a=r.groups,o=i.materials,s=0,l=a.length;s<l;s++){var c=a[s],u=o[c.materialIndex];u.visible===!0&&j(t,r,u,ee.z,c)}else j(t,r,i,ee.z,null)}}for(var h=t.children,s=0,l=h.length;s<l;s++)Z(h[s],e)}}function Q(t,e,n,i){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,l=o.geometry,c=void 0===i?o.material:i,u=o.group;if(s.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.isImmediateRenderObject){K(c);var h=$(e,n,c,s);Ft="",s.render(function(t){Rt.renderBufferImmediate(t,h,c)})}else Rt.renderBufferDirect(e,n,l,c,s,u)}}function J(t,e,n){var i=ue.get(t),r=fe.getParameters(t,ne,e,Qt.numPlanes,n),a=fe.getProgramCode(t,r),c=i.program,u=!0;if(void 0===c)t.addEventListener("dispose",B);else if(c.code!==a)G(t);else{if(void 0!==r.shaderID)return;u=!1}if(u){if(r.shaderID){var h=l.ShaderLib[r.shaderID];i.__webglShader={name:t.type,uniforms:s.UniformsUtils.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else i.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=i.__webglShader,c=fe.acquireProgram(t,r,a),i.program=c,t.program=c}var d=c.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var f=0;f<Rt.maxMorphTargets;f++)d["morphTarget"+f]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var f=0;f<Rt.maxMorphNormals;f++)d["morphNormal"+f]>=0&&t.numSupportedMorphNormals++}var p=i.__webglShader.uniforms;!t.isShaderMaterial&&!t.isRawShaderMaterial|t.clipping===!0&&(i.numClippingPlanes=Qt.numPlanes,p.clippingPlanes=Qt.uniform),i.fog=e,i.lightsHash=ne.hash,t.lights&&(p.ambientLightColor.value=ne.ambient,p.directionalLights.value=ne.directional,p.spotLights.value=ne.spot,p.pointLights.value=ne.point,p.hemisphereLights.value=ne.hemi,p.directionalShadowMap.value=ne.directionalShadowMap,p.directionalShadowMatrix.value=ne.directionalShadowMatrix,p.spotShadowMap.value=ne.spotShadowMap,p.spotShadowMatrix.value=ne.spotShadowMatrix,p.pointShadowMap.value=ne.pointShadowMap,p.pointShadowMatrix.value=ne.pointShadowMatrix);var m=i.program.getUniforms(),v=o.WebGLUniforms.seqWithValue(m.seq,p);i.uniformsList=v,i.dynamicUniforms=o.WebGLUniforms.splitDynamic(v,p)}function K(t){t.side===r.DoubleSide?ce.disable(re.CULL_FACE):ce.enable(re.CULL_FACE),ce.setFlipSided(t.side===r.BackSide),t.transparent===!0?ce.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):ce.setBlending(r.NoBlending),ce.setDepthFunc(t.depthFunc),ce.setDepthTest(t.depthTest),ce.setDepthWrite(t.depthWrite),ce.setColorWrite(t.colorWrite),ce.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function $(t,e,n,i){Gt=0;var r=ue.get(n);if(Jt&&(Kt||t!==It)){var a=t===It&&n.id===Nt;Qt.setState(n.clippingPlanes,n.clipShadows,t,r,a)}n.needsUpdate===!1&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==ne.hash?n.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==Qt.numPlanes&&(n.needsUpdate=!0)),n.needsUpdate&&(J(n,e,i),n.needsUpdate=!1);var s=!1,l=!1,c=!1,u=r.program,h=u.getUniforms(),d=r.__webglShader.uniforms;if(u.id!==Ct&&(re.useProgram(u.program),Ct=u.id,s=!0,l=!0,c=!0),n.id!==Nt&&(Nt=n.id,l=!0),s||t!==It){if(h.set(re,t,"projectionMatrix"),le.logarithmicDepthBuffer&&h.setValue(re,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==It&&(It=t,l=!0,c=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=h.map.cameraPosition;void 0!==f&&f.setValue(re,ee.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&h.setValue(re,"viewMatrix",t.matrixWorldInverse),h.set(re,Rt,"toneMappingExposure"),h.set(re,Rt,"toneMappingWhitePoint")}if(n.skinning){h.setOptional(re,i,"bindMatrix"),h.setOptional(re,i,"bindMatrixInverse");var p=i.skeleton;p&&(le.floatVertexTextures&&p.useVertexTexture?(h.set(re,p,"boneTexture"),h.set(re,p,"boneTextureWidth"),h.set(re,p,"boneTextureHeight")):h.setOptional(re,p,"boneMatrices"))}l&&(n.lights&&ct(d,c),e&&n.fog&&rt(d,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshDepthMaterial)&&tt(d,n),n.isLineBasicMaterial?et(d,n):n.isLineDashedMaterial?(et(d,n),nt(d,n)):n.isPointsMaterial?it(d,n):n.isMeshLambertMaterial?at(d,n):n.isMeshPhongMaterial?ot(d,n):n.isMeshPhysicalMaterial?lt(d,n):n.isMeshStandardMaterial?st(d,n):n.isMeshDepthMaterial?n.displacementMap&&(d.displacementMap.value=n.displacementMap,d.displacementScale.value=n.displacementScale,d.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&(d.opacity.value=n.opacity),o.WebGLUniforms.upload(re,r.uniformsList,d,Rt)),h.set(re,i,"modelViewMatrix"),h.set(re,i,"normalMatrix"),h.setValue(re,"modelMatrix",i.matrixWorld);var m=r.dynamicUniforms;return null!==m&&(o.WebGLUniforms.evalDynamic(m,d,i,t),o.WebGLUniforms.upload(re,m,d,Rt)),u}function tt(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;t.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function et(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function nt(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function it(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*jt,t.scale.value=.5*pt.clientHeight,t.map.value=e.map,null!==e.map){var n=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}function rt(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function at(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function ot(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function st(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function lt(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,st(t,e)}function ct(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function ut(t){for(var e=0,n=0,i=t.length;n<i;n++){var r=t[n];r.castShadow&&(ne.shadows[e++]=r)}ne.shadows.length=e}function ht(t,e){var n,i,r,o,s,l,c,u=0,h=0,d=0,f=e.matrixWorldInverse,p=0,m=0,v=0,g=0;for(n=0,i=t.length;n<i;n++)if(r=t[n],o=r.color,s=r.intensity,l=r.distance,c=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)u+=o.r*s,h+=o.g*s,d+=o.b*s;else if(r.isDirectionalLight){var x=pe.get(r);x.color.copy(r.color).multiplyScalar(r.intensity),x.direction.setFromMatrixPosition(r.matrixWorld),ee.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(ee),x.direction.transformDirection(f),x.shadow=r.castShadow,r.castShadow&&(x.shadowBias=r.shadow.bias,x.shadowRadius=r.shadow.radius,x.shadowMapSize=r.shadow.mapSize),ne.directionalShadowMap[p]=c,ne.directionalShadowMatrix[p]=r.shadow.matrix,ne.directional[p++]=x}else if(r.isSpotLight){var x=pe.get(r);x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(f),x.color.copy(o).multiplyScalar(s),x.distance=l,x.direction.setFromMatrixPosition(r.matrixWorld),ee.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(ee),x.direction.transformDirection(f),x.coneCos=Math.cos(r.angle),x.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(x.shadowBias=r.shadow.bias,x.shadowRadius=r.shadow.radius,x.shadowMapSize=r.shadow.mapSize),ne.spotShadowMap[v]=c,ne.spotShadowMatrix[v]=r.shadow.matrix,ne.spot[v++]=x}else if(r.isPointLight){var x=pe.get(r);x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(f),x.color.copy(r.color).multiplyScalar(r.intensity),x.distance=r.distance,x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(x.shadowBias=r.shadow.bias,x.shadowRadius=r.shadow.radius,x.shadowMapSize=r.shadow.mapSize),ne.pointShadowMap[m]=c,void 0===ne.pointShadowMatrix[m]&&(ne.pointShadowMatrix[m]=new a.Matrix4),ee.setFromMatrixPosition(r.matrixWorld).negate(),ne.pointShadowMatrix[m].identity().setPosition(ee),ne.point[m++]=x}else if(r.isHemisphereLight){var x=pe.get(r);x.direction.setFromMatrixPosition(r.matrixWorld),x.direction.transformDirection(f),x.direction.normalize(),x.skyColor.copy(r.color).multiplyScalar(s),x.groundColor.copy(r.groundColor).multiplyScalar(s),ne.hemi[g++]=x}ne.ambient[0]=u,ne.ambient[1]=h,ne.ambient[2]=d,ne.directional.length=p,ne.spot.length=v,ne.point.length=m,ne.hemi.length=g,ne.hash=p+","+m+","+v+","+g+","+ne.shadows.length}function dt(){var t=Gt;return t>=le.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+le.maxTextures),Gt+=1,t}function ft(t){var e;if(t===r.RepeatWrapping)return re.REPEAT;if(t===r.ClampToEdgeWrapping)return re.CLAMP_TO_EDGE;if(t===r.MirroredRepeatWrapping)return re.MIRRORED_REPEAT;if(t===r.NearestFilter)return re.NEAREST;if(t===r.NearestMipMapNearestFilter)return re.NEAREST_MIPMAP_NEAREST;if(t===r.NearestMipMapLinearFilter)return re.NEAREST_MIPMAP_LINEAR;if(t===r.LinearFilter)return re.LINEAR;if(t===r.LinearMipMapNearestFilter)return re.LINEAR_MIPMAP_NEAREST;if(t===r.LinearMipMapLinearFilter)return re.LINEAR_MIPMAP_LINEAR;if(t===r.UnsignedByteType)return re.UNSIGNED_BYTE;if(t===r.UnsignedShort4444Type)return re.UNSIGNED_SHORT_4_4_4_4;if(t===r.UnsignedShort5551Type)return re.UNSIGNED_SHORT_5_5_5_1;if(t===r.UnsignedShort565Type)return re.UNSIGNED_SHORT_5_6_5;if(t===r.ByteType)return re.BYTE;if(t===r.ShortType)return re.SHORT;if(t===r.UnsignedShortType)return re.UNSIGNED_SHORT;if(t===r.IntType)return re.INT;if(t===r.UnsignedIntType)return re.UNSIGNED_INT;if(t===r.FloatType)return re.FLOAT;if(e=se.get("OES_texture_half_float"),null!==e&&t===r.HalfFloatType)return e.HALF_FLOAT_OES;if(t===r.AlphaFormat)return re.ALPHA;if(t===r.RGBFormat)return re.RGB;if(t===r.RGBAFormat)return re.RGBA;if(t===r.LuminanceFormat)return re.LUMINANCE;if(t===r.LuminanceAlphaFormat)return re.LUMINANCE_ALPHA;if(t===r.DepthFormat)return re.DEPTH_COMPONENT;if(t===r.DepthStencilFormat)return re.DEPTH_STENCIL;if(t===r.AddEquation)return re.FUNC_ADD;if(t===r.SubtractEquation)return re.FUNC_SUBTRACT;if(t===r.ReverseSubtractEquation)return re.FUNC_REVERSE_SUBTRACT;if(t===r.ZeroFactor)return re.ZERO;if(t===r.OneFactor)return re.ONE;if(t===r.SrcColorFactor)return re.SRC_COLOR;if(t===r.OneMinusSrcColorFactor)return re.ONE_MINUS_SRC_COLOR;if(t===r.SrcAlphaFactor)return re.SRC_ALPHA;if(t===r.OneMinusSrcAlphaFactor)return re.ONE_MINUS_SRC_ALPHA;if(t===r.DstAlphaFactor)return re.DST_ALPHA;if(t===r.OneMinusDstAlphaFactor)return re.ONE_MINUS_DST_ALPHA;if(t===r.DstColorFactor)return re.DST_COLOR;if(t===r.OneMinusDstColorFactor)return re.ONE_MINUS_DST_COLOR;if(t===r.SrcAlphaSaturateFactor)return re.SRC_ALPHA_SATURATE;if(e=se.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===r.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===r.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===r.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===r.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=se.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===r.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===r.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===r.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===r.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=se.get("WEBGL_compressed_texture_etc1"),null!==e&&t===r.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=se.get("EXT_blend_minmax"),null!==e){if(t===r.MinEquation)return e.MIN_EXT;if(t===r.MaxEquation)return e.MAX_EXT}return e=se.get("WEBGL_depth_texture"),null!==e&&t===r.UnsignedInt248Type?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",r.REVISION),t=t||{};var pt=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),mt=void 0!==t.context?t.context:null,vt=void 0!==t.alpha&&t.alpha,gt=void 0===t.depth||t.depth,xt=void 0===t.stencil||t.stencil,_t=void 0!==t.antialias&&t.antialias,yt=void 0===t.premultipliedAlpha||t.premultipliedAlpha,Mt=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,bt=[],wt=[],Et=-1,St=[],Tt=-1,Lt=new Float32Array(8),At=[],Pt=[];this.domElement=pt,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=r.LinearToneMapping,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var Rt=this,Ct=null,Dt=null,Ut=null,Nt=-1,Ft="",It=null,Ot=new N.Vector4,Bt=null,Vt=new N.Vector4,Gt=0,zt=new F.Color(0),kt=0,Ht=pt.width,Wt=pt.height,jt=1,Xt=new N.Vector4(0,0,Ht,Wt),qt=!1,Yt=new N.Vector4(0,0,Ht,Wt),Zt=new U.Frustum,Qt=new D.WebGLClipping,Jt=!1,Kt=!1,$t=new C.Sphere,te=new a.Matrix4,ee=new R.Vector3,ne={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},ie={calls:0,vertices:0,faces:0,points:0};this.info={render:ie,memory:{geometries:0,textures:0},programs:null};var re;try{var ae={alpha:vt,depth:gt,stencil:xt,antialias:_t,premultipliedAlpha:yt,preserveDrawingBuffer:Mt};if(re=mt||pt.getContext("webgl",ae)||pt.getContext("experimental-webgl",ae),null===re)throw null!==pt.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===re.getShaderPrecisionFormat&&(re.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),pt.addEventListener("webglcontextlost",O,!1)}catch(oe){console.error("THREE.WebGLRenderer: "+oe)}var se=new P.WebGLExtensions(re);se.get("WEBGL_depth_texture"),se.get("OES_texture_float"),se.get("OES_texture_float_linear"),se.get("OES_texture_half_float"),se.get("OES_texture_half_float_linear"),se.get("OES_standard_derivatives"),se.get("ANGLE_instanced_arrays"),se.get("OES_element_index_uint")&&(A.BufferGeometry.MaxIndex=4294967296);var le=new L.WebGLCapabilities(re,se,t),ce=new T.WebGLState(re,se,ft),ue=new S.WebGLProperties,he=new E.WebGLTextures(re,se,ce,ue,le,ft,this.info),de=new w.WebGLObjects(re,ue,this.info),fe=new b.WebGLPrograms(this,le),pe=new M.WebGLLights;this.info.programs=fe.programs;var me=new y.WebGLBufferRenderer(re,se,ie),ve=new _.WebGLIndexedBufferRenderer(re,se,ie),ge=new x.OrthographicCamera((-1),1,1,(-1),0,1),xe=new g.PerspectiveCamera,_e=new p.Mesh(new v.PlaneBufferGeometry(2,2),new m.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1})),ye=l.ShaderLib.cube,Me=new p.Mesh(new f.BoxBufferGeometry(5,5,5),new d.ShaderMaterial({uniforms:ye.uniforms,vertexShader:ye.vertexShader,fragmentShader:ye.fragmentShader,side:r.BackSide,depthTest:!1,depthWrite:!1,fog:!1}));i(),this.context=re,this.capabilities=le,this.extensions=se,this.properties=ue,this.state=ce;var be=new h.WebGLShadowMap(this,ne,de,le);this.shadowMap=be;var we=new u.SpritePlugin(this,At),Ee=new c.LensFlarePlugin(this,Pt);this.getContext=function(){return re},this.getContextAttributes=function(){return re.getContextAttributes()},this.forceContextLoss=function(){se.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return le.getMaxAnisotropy()},this.getPrecision=function(){return le.precision},this.getPixelRatio=function(){return jt},this.setPixelRatio=function(t){void 0!==t&&(jt=t,this.setSize(Yt.z,Yt.w,!1))},this.getSize=function(){return{width:Ht,height:Wt}},this.setSize=function(t,e,n){Ht=t,Wt=e,pt.width=t*jt,pt.height=e*jt,n!==!1&&(pt.style.width=t+"px",pt.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,i){ce.viewport(Yt.set(t,e,n,i))},this.setScissor=function(t,e,n,i){ce.scissor(Xt.set(t,e,n,i))},this.setScissorTest=function(t){ce.setScissorTest(qt=t)},this.getClearColor=function(){return zt},this.setClearColor=function(t,e){zt.set(t),kt=void 0!==e?e:1,n(zt.r,zt.g,zt.b,kt)},this.getClearAlpha=function(){return kt},this.setClearAlpha=function(t){kt=t,n(zt.r,zt.g,zt.b,kt)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=re.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=re.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=re.STENCIL_BUFFER_BIT),re.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},this.resetGLState=I,this.dispose=function(){St=[],Tt=-1,wt=[],Et=-1,pt.removeEventListener("webglcontextlost",O,!1)},this.renderBufferImmediate=function(t,e,n){ce.initAttributes();var i=ue.get(t);t.hasPositions&&!i.position&&(i.position=re.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=re.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=re.createBuffer()),t.hasColors&&!i.color&&(i.color=re.createBuffer());var a=e.getAttributes();if(t.hasPositions&&(re.bindBuffer(re.ARRAY_BUFFER,i.position),re.bufferData(re.ARRAY_BUFFER,t.positionArray,re.DYNAMIC_DRAW),ce.enableAttribute(a.position),re.vertexAttribPointer(a.position,3,re.FLOAT,!1,0,0)),t.hasNormals){if(re.bindBuffer(re.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&n.shading===r.FlatShading)for(var o=0,s=3*t.count;o<s;o+=9){var l=t.normalArray,c=(l[o+0]+l[o+3]+l[o+6])/3,u=(l[o+1]+l[o+4]+l[o+7])/3,h=(l[o+2]+l[o+5]+l[o+8])/3;l[o+0]=c,l[o+1]=u,l[o+2]=h,l[o+3]=c,l[o+4]=u,l[o+5]=h,l[o+6]=c,l[o+7]=u,l[o+8]=h}re.bufferData(re.ARRAY_BUFFER,t.normalArray,re.DYNAMIC_DRAW),ce.enableAttribute(a.normal),re.vertexAttribPointer(a.normal,3,re.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(re.bindBuffer(re.ARRAY_BUFFER,i.uv),re.bufferData(re.ARRAY_BUFFER,t.uvArray,re.DYNAMIC_DRAW),ce.enableAttribute(a.uv),re.vertexAttribPointer(a.uv,2,re.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==r.NoColors&&(re.bindBuffer(re.ARRAY_BUFFER,i.color),re.bufferData(re.ARRAY_BUFFER,t.colorArray,re.DYNAMIC_DRAW),ce.enableAttribute(a.color),re.vertexAttribPointer(a.color,3,re.FLOAT,!1,0,0)),ce.disableUnusedAttributes(),re.drawArrays(re.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,i,a,o,s){K(a);var l=$(t,n,a,o),c=!1,u=i.id+"_"+l.id+"_"+a.wireframe;u!==Ft&&(Ft=u,c=!0);var h=o.morphTargetInfluences;if(void 0!==h){for(var d=[],f=0,p=h.length;f<p;f++){var m=h[f];d.push([m,f])}d.sort(k),d.length>8&&(d.length=8);for(var v=i.morphAttributes,f=0,p=d.length;f<p;f++){var m=d[f];if(Lt[f]=m[0],0!==m[0]){var g=m[1];a.morphTargets===!0&&v.position&&i.addAttribute("morphTarget"+f,v.position[g]),a.morphNormals===!0&&v.normal&&i.addAttribute("morphNormal"+f,v.normal[g])}else a.morphTargets===!0&&i.removeAttribute("morphTarget"+f),a.morphNormals===!0&&i.removeAttribute("morphNormal"+f)}l.getUniforms().setValue(re,"morphTargetInfluences",Lt),c=!0}var g=i.index,x=i.attributes.position;a.wireframe===!0&&(g=de.getWireframeAttribute(i));var _;null!==g?(_=ve,_.setIndex(g)):_=me,c&&(z(a,l,i),null!==g&&re.bindBuffer(re.ELEMENT_ARRAY_BUFFER,de.getAttributeBuffer(g)));var y=0,M=1/0;null!==g?M=g.count:void 0!==x&&(M=x.count);var b=i.drawRange.start,w=i.drawRange.count,E=null!==s?s.start:0,S=null!==s?s.count:1/0,T=Math.max(y,b,E),L=Math.min(y+M,b+w,E+S)-1,A=Math.max(0,L-T+1);if(o.isMesh)if(a.wireframe===!0)ce.setLineWidth(a.wireframeLinewidth*e()),_.setMode(re.LINES);else switch(o.drawMode){case r.TrianglesDrawMode:_.setMode(re.TRIANGLES);break;case r.TriangleStripDrawMode:_.setMode(re.TRIANGLE_STRIP);break;case r.TriangleFanDrawMode:_.setMode(re.TRIANGLE_FAN)}else if(o.isLine){var P=a.linewidth;void 0===P&&(P=1),ce.setLineWidth(P*e()),o.isLineSegments?_.setMode(re.LINES):_.setMode(re.LINE_STRIP)}else o.isPoints&&_.setMode(re.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&_.renderInstances(i,T,A):_.render(T,A)},this.render=function(t,e,i,a){if((e&&e.isCamera)===!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;Ft="",Nt=-1,It=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),te.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Zt.setFromMatrix(te),bt.length=0,Et=-1,Tt=-1,At.length=0,Pt.length=0,Kt=this.localClippingEnabled,Jt=Qt.init(this.clippingPlanes,Kt,e),Z(t,e),wt.length=Et+1,St.length=Tt+1,Rt.sortObjects===!0&&(wt.sort(H),St.sort(W)),Jt&&Qt.beginShadows(),ut(bt),be.render(t,e),ht(bt,e),Jt&&Qt.endShadows(),ie.calls=0,ie.vertices=0,ie.faces=0,ie.points=0,void 0===i&&(i=null),this.setRenderTarget(i);var s=t.background;if(null===s?n(zt.r,zt.g,zt.b,kt):s&&s.isColor&&(n(s.r,s.g,s.b,1),a=!0),(this.autoClear||a)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),s&&s.isCubeTexture?(xe.projectionMatrix.copy(e.projectionMatrix),xe.matrixWorld.extractRotation(e.matrixWorld),xe.matrixWorldInverse.getInverse(xe.matrixWorld),Me.material.uniforms.tCube.value=s,Me.modelViewMatrix.multiplyMatrices(xe.matrixWorldInverse,Me.matrixWorld),de.update(Me),Rt.renderBufferDirect(xe,null,Me.geometry,Me.material,Me,null)):s&&s.isTexture&&(_e.material.map=s,de.update(_e),Rt.renderBufferDirect(ge,null,_e.geometry,_e.material,_e,null)),t.overrideMaterial){var l=t.overrideMaterial;Q(wt,e,o,l),
|
||
Q(St,e,o,l)}else ce.setBlending(r.NoBlending),Q(wt,e,o),Q(St,e,o);we.render(t,e),Ee.render(t,e,Vt),i&&he.updateRenderTargetMipmap(i),ce.setDepthTest(!0),ce.setDepthWrite(!0),ce.setColorWrite(!0)},this.setFaceCulling=function(t,e){ce.setCullFace(t),ce.setFlipSided(e===r.FrontFaceDirectionCW)},this.allocTextureUnit=dt,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),he.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),he.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?he.setTextureCube(e,n):he.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return Dt},this.setRenderTarget=function(t){Dt=t,t&&void 0===ue.get(t).__webglFramebuffer&&he.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var i=ue.get(t);e=n?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,Ot.copy(t.scissor),Bt=t.scissorTest,Vt.copy(t.viewport)}else e=null,Ot.copy(Xt).multiplyScalar(jt),Bt=qt,Vt.copy(Yt).multiplyScalar(jt);if(Ut!==e&&(re.bindFramebuffer(re.FRAMEBUFFER,e),Ut=e),ce.scissor(Ot),ce.setScissorTest(Bt),ce.viewport(Vt),n){var r=ue.get(t.texture);re.framebufferTexture2D(re.FRAMEBUFFER,re.COLOR_ATTACHMENT0,re.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,a,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=ue.get(t).__webglFramebuffer;if(s){var l=!1;s!==Ut&&(re.bindFramebuffer(re.FRAMEBUFFER,s),l=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==r.RGBAFormat&&ft(u)!==re.getParameter(re.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===r.UnsignedByteType||ft(h)===re.getParameter(re.IMPLEMENTATION_COLOR_READ_TYPE)||h===r.FloatType&&(se.get("OES_texture_float")||se.get("WEBGL_color_buffer_float"))||h===r.HalfFloatType&&se.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");re.checkFramebufferStatus(re.FRAMEBUFFER)===re.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-a&&re.readPixels(e,n,i,a,ft(u),ft(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&re.bindFramebuffer(re.FRAMEBUFFER,Ut)}}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLRenderer=void 0;var r=n(3),a=n(4),o=n(8),s=n(13),l=n(14),c=n(124),u=n(126),h=n(127),d=n(129),f=n(137),p=n(146),m=n(150),v=n(151),g=n(152),x=n(154),_=n(155),y=n(156),M=n(157),b=n(158),w=n(161),E=n(163),S=n(164),T=n(165),L=n(166),A=n(138),P=n(167),R=n(6),C=n(133),D=n(168),U=n(132),N=n(122),F=n(123);e.WebGLRenderer=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=(e.REVISION="80",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=0,e.CullFaceBack=1,e.CullFaceFront=2,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=1,e.PCFSoftShadowMap=2,e.FrontSide=0,e.BackSide=1,e.DoubleSide=2,e.FlatShading=1,e.SmoothShading=2,e.NoColors=0,e.FaceColors=1,e.VertexColors=2,e.NoBlending=0,e.NormalBlending=1,e.AdditiveBlending=2,e.SubtractiveBlending=3,e.MultiplyBlending=4,e.CustomBlending=5,e.AddEquation=100,e.SubtractEquation=101,e.ReverseSubtractEquation=102,e.MinEquation=103,e.MaxEquation=104,e.ZeroFactor=200,e.OneFactor=201,e.SrcColorFactor=202,e.OneMinusSrcColorFactor=203,e.SrcAlphaFactor=204,e.OneMinusSrcAlphaFactor=205,e.DstAlphaFactor=206,e.OneMinusDstAlphaFactor=207,e.DstColorFactor=208,e.OneMinusDstColorFactor=209,e.SrcAlphaSaturateFactor=210,e.NeverDepth=0,e.AlwaysDepth=1,e.LessDepth=2,e.LessEqualDepth=3,e.EqualDepth=4,e.GreaterEqualDepth=5,e.GreaterDepth=6,e.NotEqualDepth=7,e.MultiplyOperation=0,e.MixOperation=1,e.AddOperation=2,e.NoToneMapping=0,e.LinearToneMapping=1,e.ReinhardToneMapping=2,e.Uncharted2ToneMapping=3,e.CineonToneMapping=4,e.UVMapping=300,e.CubeReflectionMapping=301,e.CubeRefractionMapping=302,e.EquirectangularReflectionMapping=303,e.EquirectangularRefractionMapping=304,e.SphericalReflectionMapping=305,e.CubeUVReflectionMapping=306,e.CubeUVRefractionMapping=307,e.RepeatWrapping=1e3,e.ClampToEdgeWrapping=1001,e.MirroredRepeatWrapping=1002,e.NearestFilter=1003,e.NearestMipMapNearestFilter=1004,e.NearestMipMapLinearFilter=1005,e.LinearFilter=1006,e.LinearMipMapNearestFilter=1007,e.LinearMipMapLinearFilter=1008,e.UnsignedByteType=1009,e.ByteType=1010,e.ShortType=1011,e.UnsignedShortType=1012,e.IntType=1013,e.UnsignedIntType=1014,e.FloatType=1015,e.HalfFloatType=1016,e.UnsignedShort4444Type=1017,e.UnsignedShort5551Type=1018,e.UnsignedShort565Type=1019,e.UnsignedInt248Type=1020,e.AlphaFormat=1021,e.RGBFormat=1022,e.RGBAFormat=1023);e.LuminanceFormat=1024,e.LuminanceAlphaFormat=1025,e.RGBEFormat=n,e.DepthFormat=1026,e.DepthStencilFormat=1027,e.RGB_S3TC_DXT1_Format=2001,e.RGBA_S3TC_DXT1_Format=2002,e.RGBA_S3TC_DXT3_Format=2003,e.RGBA_S3TC_DXT5_Format=2004,e.RGB_PVRTC_4BPPV1_Format=2100,e.RGB_PVRTC_2BPPV1_Format=2101,e.RGBA_PVRTC_4BPPV1_Format=2102,e.RGBA_PVRTC_2BPPV1_Format=2103,e.RGB_ETC1_Format=2151,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=2400,e.ZeroSlopeEnding=2401,e.WrapAroundEnding=2402,e.TrianglesDrawMode=0,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=3e3,e.sRGBEncoding=3001,e.GammaEncoding=3007,e.RGBEEncoding=3002,e.LogLuvEncoding=3003,e.RGBM7Encoding=3004,e.RGBM16Encoding=3005,e.RGBDEncoding=3006,e.BasicDepthPacking=3200,e.RGBADepthPacking=3201},function(t,e,n){"use strict";function i(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix4=void 0;var r=n(5),a=n(6);i.prototype={constructor:i,isMatrix4:!0,set:function(t,e,n,i,r,a,o,s,l,c,u,h,d,f,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=f,v[11]=p,v[15]=m,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 i).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new a.Vector3);var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),s=1/t.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*s,n[9]=i[9]*s,n[10]=i[10]*s,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var h=a*c,d=a*u,f=o*c,p=o*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=d+f*l,e[5]=h-p*l,e[9]=-o*s,e[2]=p-h*l,e[6]=f+d*l,e[10]=a*s}else if("YXZ"===t.order){var m=s*c,v=s*u,g=l*c,x=l*u;e[0]=m+x*o,e[4]=g*o-v,e[8]=a*l,e[1]=a*u,e[5]=a*c,e[9]=-o,e[2]=v*o-g,e[6]=x+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*c,v=s*u,g=l*c,x=l*u;e[0]=m-x*o,e[4]=-a*u,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*c,e[9]=x-m*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var h=a*c,d=a*u,f=o*c,p=o*u;e[0]=s*c,e[4]=f*l-d,e[8]=h*l+p,e[1]=s*u,e[5]=p*l+h,e[9]=d*l-f,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var _=a*s,y=a*l,M=o*s,b=o*l;e[0]=s*c,e[4]=b-_*u,e[8]=M*u+y,e[1]=u,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=y*u+M,e[10]=_-b*u}else if("XZY"===t.order){var _=a*s,y=a*l,M=o*s,b=o*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=_*u+b,e[5]=a*c,e[9]=y*u-M,e[2]=M*u-y,e[6]=o*c,e[10]=b*u+_}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z,a=t.w,o=n+n,s=i+i,l=r+r,c=n*o,u=n*s,h=n*l,d=i*s,f=i*l,p=r*l,m=a*o,v=a*s,g=a*l;return e[0]=1-(d+p),e[4]=u-g,e[8]=h+v,e[1]=u+g,e[5]=1-(c+p),e[9]=f-m,e[2]=h-v,e[6]=f+m,e[10]=1-(c+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(i,r,o){void 0===t&&(t=new a.Vector3,e=new a.Vector3,n=new a.Vector3);var s=this.elements;return n.subVectors(i,r).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),s[0]=t.x,s[4]=e.x,s[8]=n.x,s[1]=t.y,s[5]=e.y,s[9]=n.y,s[2]=t.z,s[6]=e.z,s[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],f=n[2],p=n[6],m=n[10],v=n[14],g=n[3],x=n[7],_=n[11],y=n[15],M=i[0],b=i[4],w=i[8],E=i[12],S=i[1],T=i[5],L=i[9],A=i[13],P=i[2],R=i[6],C=i[10],D=i[14],U=i[3],N=i[7],F=i[11],I=i[15];return r[0]=a*M+o*S+s*P+l*U,r[4]=a*b+o*T+s*R+l*N,r[8]=a*w+o*L+s*C+l*F,r[12]=a*E+o*A+s*D+l*I,r[1]=c*M+u*S+h*P+d*U,r[5]=c*b+u*T+h*R+d*N,r[9]=c*w+u*L+h*C+d*F,r[13]=c*E+u*A+h*D+d*I,r[2]=f*M+p*S+m*P+v*U,r[6]=f*b+p*T+m*R+v*N,r[10]=f*w+p*L+m*C+v*F,r[14]=f*E+p*A+m*D+v*I,r[3]=g*M+x*S+_*P+y*U,r[7]=g*b+x*T+_*R+y*N,r[11]=g*w+x*L+_*C+y*F,r[15]=g*E+x*A+_*D+y*I,this},multiplyToArray:function(t,e,n){var i=this.elements;return this.multiplyMatrices(t,e),n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,n,i){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===i&&(i=e.length);for(var r=0,o=n;r<i;r+=3,o+=3)t.fromArray(e,o),t.applyMatrix4(this),t.toArray(e,o);return e}}(),applyToBuffer:function(){var t;return function(e,n,i){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===i&&(i=e.length/e.itemSize);for(var r=0,o=n;r<i;r++,o++)t.x=e.getX(o),t.y=e.getY(o),t.z=e.getZ(o),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14],f=t[3],p=t[7],m=t[11],v=t[15];return f*(+r*s*u-i*l*u-r*o*h+n*l*h+i*o*d-n*s*d)+p*(+e*s*d-e*l*h+r*a*h-i*a*d+i*l*c-r*s*c)+m*(+e*l*u-e*o*d-r*a*u+n*a*d+r*o*c-n*l*c)+v*(-i*o*c-e*s*u+e*o*h+i*a*u-n*a*h+n*s*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new a.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,i=t.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],f=i[9],p=i[10],m=i[11],v=i[12],g=i[13],x=i[14],_=i[15],y=f*x*h-g*p*h+g*u*m-c*x*m-f*u*_+c*p*_,M=v*p*h-d*x*h-v*u*m+l*x*m+d*u*_-l*p*_,b=d*g*h-v*f*h+v*c*m-l*g*m-d*c*_+l*f*_,w=v*f*u-d*g*u-v*c*p+l*g*p+d*c*x-l*f*x,E=r*y+a*M+o*b+s*w;if(0===E){var S="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(S);return console.warn(S),this.identity()}var T=1/E;return n[0]=y*T,n[1]=(g*p*s-f*x*s-g*o*m+a*x*m+f*o*_-a*p*_)*T,n[2]=(c*x*s-g*u*s+g*o*h-a*x*h-c*o*_+a*u*_)*T,n[3]=(f*u*s-c*p*s-f*o*h+a*p*h+c*o*m-a*u*m)*T,n[4]=M*T,n[5]=(d*x*s-v*p*s+v*o*m-r*x*m-d*o*_+r*p*_)*T,n[6]=(v*u*s-l*x*s-v*o*h+r*x*h+l*o*_-r*u*_)*T,n[7]=(l*p*s-d*u*s+d*o*h-r*p*h-l*o*m+r*u*m)*T,n[8]=b*T,n[9]=(v*f*s-d*g*s-v*a*m+r*g*m+d*a*_-r*f*_)*T,n[10]=(l*g*s-v*c*s+v*a*h-r*g*h-l*a*_+r*c*_)*T,n[11]=(d*c*s-l*f*s-d*a*h+r*f*h+l*a*m-r*c*m)*T,n[12]=w*T,n[13]=(d*g*o-v*f*o+v*a*p-r*g*p-d*a*x+r*f*x)*T,n[14]=(v*c*o-l*g*o-v*a*u+r*g*u+l*a*x-r*c*x)*T,n[15]=(l*f*o-d*c*o+d*a*u-r*f*u-l*a*p+r*c*p)*T,this},scale:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,o=t.y,s=t.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t,e;return function(n,r,o){void 0===t&&(t=new a.Vector3,e=new i);var s=this.elements,l=t.set(s[0],s[1],s[2]).length(),c=t.set(s[4],s[5],s[6]).length(),u=t.set(s[8],s[9],s[10]).length(),h=this.determinant();h<0&&(l=-l),n.x=s[12],n.y=s[13],n.z=s[14],e.elements.set(this.elements);var d=1/l,f=1/c,p=1/u;return e.elements[0]*=d,e.elements[1]*=d,e.elements[2]*=d,e.elements[4]*=f,e.elements[5]*=f,e.elements[6]*=f,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,r.setFromRotationMatrix(e),o.x=l,o.y=c,o.z=u,this}}(),makeFrustum:function(t,e,n,i,r,a){var o=this.elements,s=2*r/(e-t),l=2*r/(i-n),c=(e+t)/(e-t),u=(i+n)/(i-n),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,e,n,i){var a=n*Math.tan(r._Math.DEG2RAD*t*.5),o=-a,s=o*e,l=a*e;return this.makeFrustum(s,l,o,a,n,i)},makeOrthographic:function(t,e,n,i,r,a){var o=this.elements,s=1/(e-t),l=1/(n-i),c=1/(a-r),u=(e+t)*s,h=(n+i)*l,d=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},e.Matrix4=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;e._Math=n={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),i=0;return function(){for(var r=0;r<36;r++)8===r||13===r||18===r||23===r?n[r]="-":14===r?n[r]="4":(i<=2&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,n[r]=e[19===r?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*n.DEG2RAD},radToDeg:function(t){return t*n.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}},e._Math=n},function(t,e,n){"use strict";function i(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}Object.defineProperty(e,"__esModule",{value:!0}),e.Vector3=void 0;var r=n(5),a=n(4),o=n(7);i.prototype={constructor:i,isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new o.Quaternion),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new o.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14],this},applyProjection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,s=t.w,l=s*e+a*i-o*n,c=s*n+o*e-r*i,u=s*i+r*n-a*e,h=-r*e-a*n-o*i;return this.x=l*s+h*-r+c*-o-u*-a,this.y=c*s+h*-a+u*-r-l*-o,this.z=u*s+h*-o+l*-a-c*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new i),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new i),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(r._Math.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},e.Vector3=i},function(t,e,n){"use strict";function i(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}Object.defineProperty(e,"__esModule",{value:!0}),e.Quaternion=void 0;var r=n(6);i.prototype={constructor:i,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if((t&&t.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),i=Math.cos(t._y/2),r=Math.cos(t._z/2),a=Math.sin(t._x/2),o=Math.sin(t._y/2),s=Math.sin(t._z/2),l=t.order;return"XYZ"===l?(this._x=a*i*r+n*o*s,this._y=n*o*r-a*i*s,this._z=n*i*s+a*o*r,this._w=n*i*r-a*o*s):"YXZ"===l?(this._x=a*i*r+n*o*s,this._y=n*o*r-a*i*s,this._z=n*i*s-a*o*r,this._w=n*i*r+a*o*s):"ZXY"===l?(this._x=a*i*r-n*o*s,this._y=n*o*r+a*i*s,this._z=n*i*s+a*o*r,this._w=n*i*r-a*o*s):"ZYX"===l?(this._x=a*i*r-n*o*s,this._y=n*o*r+a*i*s,this._z=n*i*s-a*o*r,this._w=n*i*r+a*o*s):"YZX"===l?(this._x=a*i*r+n*o*s,this._y=n*o*r+a*i*s,this._z=n*i*s-a*o*r,this._w=n*i*r-a*o*s):"XZY"===l&&(this._x=a*i*r-n*o*s,this._y=n*o*r-a*i*s,this._z=n*i*s+a*o*r,this._w=n*i*r+a*o*s),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],d=i+s+h;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-l)*e,this._y=(a-c)*e,this._z=(o-r)*e):i>s&&i>h?(e=2*Math.sqrt(1+i-s-h),this._w=(u-l)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+c)/e):s>h?(e=2*Math.sqrt(1+s-i-h),this._w=(a-c)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(l+u)/e):(e=2*Math.sqrt(1+h-i-s),this._w=(o-r)/e,this._x=(a+c)/e,this._y=(l+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,n=1e-6;return function(i,a){return void 0===t&&(t=new r.Vector3),e=i.dot(a)+1,e<n?(e=0,Math.abs(i.x)>Math.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,a),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var l=Math.atan2(s,o),c=Math.sin((1-e)*l)/s,u=Math.sin(e*l)/s;return this._w=a*c+this._w*u,this._x=n*c+this._x*u,this._y=i*c+this._y*u,this._z=r*c+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(i,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3],h=r[a+0],d=r[a+1],f=r[a+2],p=r[a+3];if(u!==p||s!==h||l!==d||c!==f){var m=1-o,v=s*h+l*d+c*f+u*p,g=v>=0?1:-1,x=1-v*v;if(x>Number.EPSILON){var _=Math.sqrt(x),y=Math.atan2(_,v*g);m=Math.sin(m*y)/_,o=Math.sin(o*y)/_}var M=o*g;if(s=s*m+h*M,l=l*m+d*M,c=c*m+f*M,u=u*m+p*M,m===1-o){var b=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=b,l*=b,c*=b,u*=b}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}}),e.Quaternion=i},function(t,e,n){"use strict";function i(){this.seq=[],this.map={}}function r(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,a=z[r];if(void 0===a&&(a=new Float32Array(r),z[r]=a),0!==e){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function a(t,e){var n=k[e];void 0===n&&(n=new Int32Array(e),k[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function o(t,e){t.uniform1f(this.addr,e)}function s(t,e){t.uniform1i(this.addr,e)}function l(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function c(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e);
|
||
}function u(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function h(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function d(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function f(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function p(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||V,i)}function m(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||G,i)}function v(t,e){t.uniform2iv(this.addr,e)}function g(t,e){t.uniform3iv(this.addr,e)}function x(t,e){t.uniform4iv(this.addr,e)}function _(t){switch(t){case 5126:return o;case 35664:return l;case 35665:return c;case 35666:return u;case 35674:return h;case 35675:return d;case 35676:return f;case 35678:return p;case 35680:return m;case 5124:case 35670:return s;case 35667:case 35671:return v;case 35668:case 35672:return g;case 35669:case 35673:return x}}function y(t,e){t.uniform1fv(this.addr,e)}function M(t,e){t.uniform1iv(this.addr,e)}function b(t,e){t.uniform2fv(this.addr,r(e,this.size,2))}function w(t,e){t.uniform3fv(this.addr,r(e,this.size,3))}function E(t,e){t.uniform4fv(this.addr,r(e,this.size,4))}function S(t,e){t.uniformMatrix2fv(this.addr,!1,r(e,this.size,4))}function T(t,e){t.uniformMatrix3fv(this.addr,!1,r(e,this.size,9))}function L(t,e){t.uniformMatrix4fv(this.addr,!1,r(e,this.size,16))}function A(t,e,n){var i=e.length,r=a(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||V,r[o])}function P(t,e,n){var i=e.length,r=a(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||G,r[o])}function R(t){switch(t){case 5126:return y;case 35664:return b;case 35665:return w;case 35666:return E;case 35674:return S;case 35675:return T;case 35676:return L;case 35678:return A;case 35680:return P;case 5124:case 35670:return M;case 35667:case 35671:return v;case 35668:case 35672:return g;case 35669:case 35673:return x}}function C(t,e,n){this.id=t,this.addr=n,this.setValue=_(e.type)}function D(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=R(e.type)}function U(t){this.id=t,i.call(this)}function N(t,e){t.seq.push(e),t.map[e.id]=e}function F(t,e,n){var i=t.name,r=i.length;for(H.lastIndex=0;;){var a=H.exec(i),o=H.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s=0|s),void 0===c||"["===c&&o+2===r){N(n,void 0===c?new C(s,t,e):new D(s,t,e));break}var u=n.map,h=u[s];void 0===h&&(h=new U(s),N(n,h)),n=h}}function I(t,e,n){i.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),a=0;a!==r;++a){var o=t.getActiveUniform(e,a),s=o.name,l=t.getUniformLocation(e,s);F(o,l,this)}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLUniforms=void 0;var O=n(9),B=n(10),V=new B.Texture,G=new O.CubeTexture,z=[],k=[];U.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var a=n[i];a.setValue(t,e[a.id])}};var H=/([\w\d_]+)(\])?(\[|\.)?/g;I.prototype.setValue=function(t,e,n){var i=this.map[e];void 0!==i&&i.setValue(t,n,this.renderer)},I.prototype.set=function(t,e,n){var i=this.map[n];void 0!==i&&i.setValue(t,e[n],this.renderer)},I.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},I.upload=function(t,e,n,i){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=n[o.id];s.needsUpdate!==!1&&o.setValue(t,s.value,i)}},I.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var a=t[i];a.id in e&&n.push(a)}return n},I.splitDynamic=function(t,e){for(var n=null,i=t.length,r=0,a=0;a!==i;++a){var o=t[a],s=e[o.id];s&&s.dynamic===!0?(null===n&&(n=[]),n.push(o)):(r<a&&(t[r]=o),++r)}return r<i&&(t.length=r),n},I.evalDynamic=function(t,e,n,i){for(var r=0,a=t.length;r!==a;++r){var o=e[t[r].id],s=o.onUpdateCallback;void 0!==s&&s.call(o,n,i)}},e.WebGLUniforms=I},function(t,e,n){"use strict";function i(t,e,n,i,o,s,l,c,u,h){t=void 0!==t?t:[],e=void 0!==e?e:a.CubeReflectionMapping,r.Texture.call(this,t,e,n,i,o,s,l,c,u,h),this.flipY=!1}Object.defineProperty(e,"__esModule",{value:!0}),e.CubeTexture=void 0;var r=n(10),a=n(3);i.prototype=Object.create(r.Texture.prototype),i.prototype.constructor=i,i.prototype.isCubeTexture=!0,Object.defineProperty(i.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),e.CubeTexture=i},function(t,e,n){"use strict";function i(t,e,n,a,c,u,h,d,f,p){Object.defineProperty(this,"id",{value:r()}),this.uuid=s._Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==t?t:i.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:i.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:o.ClampToEdgeWrapping,this.wrapT=void 0!==a?a:o.ClampToEdgeWrapping,this.magFilter=void 0!==c?c:o.LinearFilter,this.minFilter=void 0!==u?u:o.LinearMipMapLinearFilter,this.anisotropy=void 0!==f?f:1,this.format=void 0!==h?h:o.RGBAFormat,this.type=void 0!==d?d:o.UnsignedByteType,this.offset=new l.Vector2(0,0),this.repeat=new l.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==p?p:o.LinearEncoding,this.version=0,this.onUpdate=null}function r(){return c++}Object.defineProperty(e,"__esModule",{value:!0}),e.Texture=e.TextureIdCount=void 0;var a=n(11),o=n(3),s=n(5),l=n(12);i.DEFAULT_IMAGE=void 0,i.DEFAULT_MAPPING=o.UVMapping,i.prototype={constructor:i,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=s._Math.generateUUID()),void 0===t.images[i.uuid]&&(t.images[i.uuid]={uuid:i.uuid,url:e(i)}),n.image=i.uuid}return t.textures[this.uuid]=n,n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===o.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case o.RepeatWrapping:t.x=t.x-Math.floor(t.x);break;case o.ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case o.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case o.RepeatWrapping:t.y=t.y-Math.floor(t.y);break;case o.ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case o.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(i.prototype,a.EventDispatcher.prototype);var c=0;e.TextureIdCount=r,e.Texture=i},function(t,e){"use strict";function n(){}Object.defineProperty(e,"__esModule",{value:!0}),Object.assign(n.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&n[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,i=n[t];if(void 0!==i){var r=i.indexOf(e);r!==-1&&i.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var i=[],r=0,a=n.length;for(r=0;r<a;r++)i[r]=n[r];for(r=0;r<a;r++)i[r].call(this,t)}}}}),e.EventDispatcher=n},function(t,e){"use strict";function n(t,e){this.x=t||0,this.y=e||0}Object.defineProperty(e,"__esModule",{value:!0}),n.prototype={constructor:n,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(i,r){return void 0===t&&(t=new n,e=new n),t.set(i,i),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function i(){var i=Math.atan2(this.y,this.x);return i<0&&(i+=2*Math.PI),i},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}},e.Vector2=n},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;e.UniformsUtils=n={merge:function(t){for(var e={},n=0;n<t.length;n++){var i=this.clone(t[n]);for(var r in i)e[r]=i[r]}return e},clone:function(t){var e={};for(var n in t){e[n]={};for(var i in t[n]){var r=t[n][i];r&&r.isColor||r&&r.isVector2||r&&r.isVector3||r&&r.isVector4||r&&r.isMatrix3||r&&r.isMatrix4||r&&r.isTexture?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}},e.UniformsUtils=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShaderLib=void 0;var i=n(15),r=n(13),a=n(6),o=n(121),s=n(123),l={basic:{uniforms:r.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.aomap,o.UniformsLib.fog]),vertexShader:i.ShaderChunk.meshbasic_vert,fragmentShader:i.ShaderChunk.meshbasic_frag},lambert:{uniforms:r.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.aomap,o.UniformsLib.lightmap,o.UniformsLib.emissivemap,o.UniformsLib.fog,o.UniformsLib.lights,{emissive:{value:new s.Color(0)}}]),vertexShader:i.ShaderChunk.meshlambert_vert,fragmentShader:i.ShaderChunk.meshlambert_frag},phong:{uniforms:r.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.aomap,o.UniformsLib.lightmap,o.UniformsLib.emissivemap,o.UniformsLib.bumpmap,o.UniformsLib.normalmap,o.UniformsLib.displacementmap,o.UniformsLib.fog,o.UniformsLib.lights,{emissive:{value:new s.Color(0)},specular:{value:new s.Color(1118481)},shininess:{value:30}}]),vertexShader:i.ShaderChunk.meshphong_vert,fragmentShader:i.ShaderChunk.meshphong_frag},standard:{uniforms:r.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.aomap,o.UniformsLib.lightmap,o.UniformsLib.emissivemap,o.UniformsLib.bumpmap,o.UniformsLib.normalmap,o.UniformsLib.displacementmap,o.UniformsLib.roughnessmap,o.UniformsLib.metalnessmap,o.UniformsLib.fog,o.UniformsLib.lights,{emissive:{value:new s.Color(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:i.ShaderChunk.meshphysical_vert,fragmentShader:i.ShaderChunk.meshphysical_frag},points:{uniforms:r.UniformsUtils.merge([o.UniformsLib.points,o.UniformsLib.fog]),vertexShader:i.ShaderChunk.points_vert,fragmentShader:i.ShaderChunk.points_frag},dashed:{uniforms:r.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:i.ShaderChunk.linedashed_vert,fragmentShader:i.ShaderChunk.linedashed_frag},depth:{uniforms:r.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.displacementmap]),vertexShader:i.ShaderChunk.depth_vert,fragmentShader:i.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:i.ShaderChunk.normal_vert,fragmentShader:i.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:i.ShaderChunk.cube_vert,fragmentShader:i.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:i.ShaderChunk.equirect_vert,fragmentShader:i.ShaderChunk.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new a.Vector3}},vertexShader:i.ShaderChunk.distanceRGBA_vert,fragmentShader:i.ShaderChunk.distanceRGBA_frag}};l.physical={uniforms:r.UniformsUtils.merge([l.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:i.ShaderChunk.meshphysical_vert,fragmentShader:i.ShaderChunk.meshphysical_frag},e.ShaderLib=l},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.ShaderChunk=void 0;var r=n(16),a=i(r),o=n(17),s=i(o),l=n(18),c=i(l),u=n(19),h=i(u),d=n(20),f=i(d),p=n(21),m=i(p),v=n(22),g=i(v),x=n(23),_=i(x),y=n(24),M=i(y),b=n(25),w=i(b),E=n(26),S=i(E),T=n(27),L=i(T),A=n(28),P=i(A),R=n(29),C=i(R),D=n(30),U=i(D),N=n(31),F=i(N),I=n(32),O=i(I),B=n(33),V=i(B),G=n(34),z=i(G),k=n(35),H=i(k),W=n(36),j=i(W),X=n(37),q=i(X),Y=n(38),Z=i(Y),Q=n(39),J=i(Q),K=n(40),$=i(K),tt=n(41),et=i(tt),nt=n(42),it=i(nt),rt=n(43),at=i(rt),ot=n(44),st=i(ot),lt=n(45),ct=i(lt),ut=n(46),ht=i(ut),dt=n(47),ft=i(dt),pt=n(48),mt=i(pt),vt=n(49),gt=i(vt),xt=n(50),_t=i(xt),yt=n(51),Mt=i(yt),bt=n(52),wt=i(bt),Et=n(53),St=i(Et),Tt=n(54),Lt=i(Tt),At=n(55),Pt=i(At),Rt=n(56),Ct=i(Rt),Dt=n(57),Ut=i(Dt),Nt=n(58),Ft=i(Nt),It=n(59),Ot=i(It),Bt=n(60),Vt=i(Bt),Gt=n(61),zt=i(Gt),kt=n(62),Ht=i(kt),Wt=n(63),jt=i(Wt),Xt=n(64),qt=i(Xt),Yt=n(65),Zt=i(Yt),Qt=n(66),Jt=i(Qt),Kt=n(67),$t=i(Kt),te=n(68),ee=i(te),ne=n(69),ie=i(ne),re=n(70),ae=i(re),oe=n(71),se=i(oe),le=n(72),ce=i(le),ue=n(73),he=i(ue),de=n(74),fe=i(de),pe=n(75),me=i(pe),ve=n(76),ge=i(ve),xe=n(77),_e=i(xe),ye=n(78),Me=i(ye),be=n(79),we=i(be),Ee=n(80),Se=i(Ee),Te=n(81),Le=i(Te),Ae=n(82),Pe=i(Ae),Re=n(83),Ce=i(Re),De=n(84),Ue=i(De),Ne=n(85),Fe=i(Ne),Ie=n(86),Oe=i(Ie),Be=n(87),Ve=i(Be),Ge=n(88),ze=i(Ge),ke=n(89),He=i(ke),We=n(90),je=i(We),Xe=n(91),qe=i(Xe),Ye=n(92),Ze=i(Ye),Qe=n(93),Je=i(Qe),Ke=n(94),$e=i(Ke),tn=n(95),en=i(tn),nn=n(96),rn=i(nn),an=n(97),on=i(an),sn=n(98),ln=i(sn),cn=n(99),un=i(cn),hn=n(100),dn=i(hn),fn=n(101),pn=i(fn),mn=n(102),vn=i(mn),gn=n(103),xn=i(gn),_n=n(104),yn=i(_n),Mn=n(105),bn=i(Mn),wn=n(106),En=i(wn),Sn=n(107),Tn=i(Sn),Ln=n(108),An=i(Ln),Pn=n(109),Rn=i(Pn),Cn=n(110),Dn=i(Cn),Un=n(111),Nn=i(Un),Fn=n(112),In=i(Fn),On=n(113),Bn=i(On),Vn=n(114),Gn=i(Vn),zn=n(115),kn=i(zn),Hn=n(116),Wn=i(Hn),jn=n(117),Xn=i(jn),qn=n(118),Yn=i(qn),Zn=n(119),Qn=i(Zn),Jn=n(120),Kn=i(Jn);e.ShaderChunk={alphamap_fragment:a["default"],alphamap_pars_fragment:s["default"],alphatest_fragment:c["default"],aomap_fragment:h["default"],aomap_pars_fragment:f["default"],begin_vertex:m["default"],beginnormal_vertex:g["default"],bsdfs:_["default"],bumpmap_pars_fragment:M["default"],clipping_planes_fragment:w["default"],clipping_planes_pars_fragment:S["default"],clipping_planes_pars_vertex:L["default"],clipping_planes_vertex:P["default"],color_fragment:C["default"],color_pars_fragment:U["default"],color_pars_vertex:F["default"],color_vertex:O["default"],common:V["default"],cube_uv_reflection_fragment:z["default"],defaultnormal_vertex:H["default"],displacementmap_pars_vertex:j["default"],displacementmap_vertex:q["default"],emissivemap_fragment:Z["default"],emissivemap_pars_fragment:J["default"],encodings_fragment:$["default"],encodings_pars_fragment:et["default"],envmap_fragment:it["default"],envmap_pars_fragment:at["default"],envmap_pars_vertex:st["default"],envmap_vertex:ct["default"],fog_fragment:ht["default"],fog_pars_fragment:ft["default"],lightmap_fragment:mt["default"],lightmap_pars_fragment:gt["default"],lights_lambert_vertex:_t["default"],lights_pars:Mt["default"],lights_phong_fragment:wt["default"],lights_phong_pars_fragment:St["default"],lights_physical_fragment:Lt["default"],lights_physical_pars_fragment:Pt["default"],lights_template:Ct["default"],logdepthbuf_fragment:Ut["default"],logdepthbuf_pars_fragment:Ft["default"],logdepthbuf_pars_vertex:Ot["default"],logdepthbuf_vertex:Vt["default"],map_fragment:zt["default"],map_pars_fragment:Ht["default"],map_particle_fragment:jt["default"],map_particle_pars_fragment:qt["default"],metalnessmap_fragment:Zt["default"],metalnessmap_pars_fragment:Jt["default"],morphnormal_vertex:$t["default"],morphtarget_pars_vertex:ee["default"],morphtarget_vertex:ie["default"],normal_flip:ae["default"],normal_fragment:se["default"],normalmap_pars_fragment:ce["default"],packing:he["default"],premultiplied_alpha_fragment:fe["default"],project_vertex:me["default"],roughnessmap_fragment:ge["default"],roughnessmap_pars_fragment:_e["default"],shadowmap_pars_fragment:Me["default"],shadowmap_pars_vertex:we["default"],shadowmap_vertex:Se["default"],shadowmask_pars_fragment:Le["default"],skinbase_vertex:Pe["default"],skinning_pars_vertex:Ce["default"],skinning_vertex:Ue["default"],skinnormal_vertex:Fe["default"],specularmap_fragment:Oe["default"],specularmap_pars_fragment:Ve["default"],tonemapping_fragment:ze["default"],tonemapping_pars_fragment:He["default"],uv_pars_fragment:je["default"],uv_pars_vertex:qe["default"],uv_vertex:Ze["default"],uv2_pars_fragment:Je["default"],uv2_pars_vertex:$e["default"],uv2_vertex:en["default"],worldpos_vertex:rn["default"],cube_frag:on["default"],cube_vert:ln["default"],depth_frag:un["default"],depth_vert:dn["default"],distanceRGBA_frag:pn["default"],distanceRGBA_vert:vn["default"],equirect_frag:xn["default"],equirect_vert:yn["default"],linedashed_frag:bn["default"],linedashed_vert:En["default"],meshbasic_frag:Tn["default"],meshbasic_vert:An["default"],meshlambert_frag:Rn["default"],meshlambert_vert:Dn["default"],meshphong_frag:Nn["default"],meshphong_vert:In["default"],meshphysical_frag:Bn["default"],meshphysical_vert:Gn["default"],normal_frag:kn["default"],normal_vert:Wn["default"],points_frag:Xn["default"],points_vert:Yn["default"],shadow_frag:Qn["default"],shadow_vert:Kn["default"]}},function(t,e){t.exports="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"},function(t,e){t.exports="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_AOMAP\n\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif"},function(t,e){t.exports="\nvec3 transformed = vec3( position );\n"},function(t,e){t.exports="\nvec3 objectNormal = vec3( normal );\n"},function(t,e){t.exports='bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n\n}\n\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t\tif( decayExponent > 0.0 ) {\n\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t\t\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t\t\t// page 32, equation 26: E[window1]\n\t\t\t// http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr_v2.pdf\n\t\t\t// this is intended to be used on spot and point lights who are represented as luminous intensity\n\t\t\t// but who must be converted to luminous irradiance for surface lighting calculation\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n\n#else\n\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n#endif\n\n\t\t}\n\n\t\treturn 1.0;\n}\n\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\n\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\n\t// Original approximation by Christophe Schlick \'94\n\t//;float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH \'13)\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n} // validated\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (34)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\t// geometry term = G(l)⋅G(v) / 4(n⋅l)(n⋅v)\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\n\treturn 1.0 / ( gl * gv );\n\n} // validated\n\n// from page 12, listing 2 of http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr_v2.pdf\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\t// dotNL and dotNV are explicitly swapped. This is not a mistake.\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\n\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\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\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\tfloat D = D_GGX( alpha, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\n\treturn specularColor * AB.x + AB.y;\n\n} // validated\n\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\n\t//float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\t//float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\n\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n'},function(t,e){t.exports="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\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\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n"},function(t,e){t.exports="#if NUM_CLIPPING_PLANES > 0\n\n\tfor ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\n\t}\n\n#endif\n"},function(t,e){t.exports="#if NUM_CLIPPING_PLANES > 0\n\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n"},function(t,e){t.exports="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n"},function(t,e){t.exports="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n\n"},function(t,e){t.exports="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif"},function(t,e){t.exports="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif"},function(t,e){t.exports="#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif"},function(t,e){t.exports="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\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 ) ); }\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\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}\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\n\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n";
|
||
},function(t,e){t.exports="#ifdef ENVMAP_TYPE_CUBE_UV\n\n#define cubeUV_textureSize (1024.0)\n\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))\n\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\t// Clamp the value to the max mip level counts. hard coded to 6 mips\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\n\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\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\t// float powScale = exp2(roughnessLevel + mipLevel);\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\t// float scale = 1.0 / exp2(roughnessLevel + 2.0 + mipLevel);\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\t// float mipOffset = 0.75*(1.0 - 1.0/exp2(mipLevel))/exp2(roughnessLevel);\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\n\tfloat rcpPowScale = 1.0 / powScale;\n\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\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\n\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\n\t// round to nearest mipmap if we are not interpolating.\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\n\t// Tri linear interpolation.\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\n\tvec4 result = mix(color10, color20, t);\n\n\treturn vec4(result.rgb, 1.0);\n}\n\n#endif\n"},function(t,e){t.exports="#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n"},function(t,e){t.exports="#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n"},function(t,e){t.exports=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n"},function(t,e){t.exports="// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/\n\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\n\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\n\nvec4 sRGBToLinear( in vec4 value ) {\n return 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 return 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}\n\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\n\n// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\n\n// M matrix, for encoding\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 vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\n\n// Inverse M matrix, for decoding\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 float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n"},function(t,e){t.exports="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\tvec3 reflectView = flipNormal * 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\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\tenvColor = envMapTexelToLinear( envColor );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n\n#ifdef USE_ENVMAP\n\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\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\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\n#endif\n"},function(t,e){t.exports="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif"},function(t,e){t.exports="#ifdef USE_LIGHTMAP\n\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif"},function(t,e){t.exports="vec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\n\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n\n#if NUM_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\t}\n\n#endif\n\n#if NUM_DIR_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\n\t\t#endif\n\n\t}\n\n#endif\n"},function(t,e){t.exports="uniform vec3 ambientLightColor;\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI;\n\n\t#endif\n\n\treturn irradiance;\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\n\t\t\tdirectLight.visible = true;\n\n\t\t} else {\n\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\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\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\n\t\t\tdirectLight.visible = true;\n\n\t\t} else {\n\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tirradiance *= PI;\n\n\t\t#endif\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n\n\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\n\tvec3 getLightProbeIndirectIrradiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in int maxMIPLevel ) {\n\n\t\t#include <normal_flip>\n\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\n\t\t\t// TODO: replace with properly filtered cubemaps and access the irradiance LOD level, be it the last LOD level\n\t\t\t// of a specular cubemap, or just the default level of a specially created irradiance cubemap.\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#else\n\n\t\t\t\t// force the bias high to get the last LOD level as it is the most blurred.\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\n\t\t#else\n\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\n\t\t#endif\n\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t}\n\n\t// taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\n\t\t//float envMapWidth = pow( 2.0, maxMIPLevelScalar );\n\t\t//float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\n\t\t// clamp to allowable LOD ranges.\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\n\t}\n\n\tvec3 getLightProbeIndirectRadiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\n\t\t#endif\n\n\t\t#include <normal_flip>\n\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#endif\n\n\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t}\n\n#endif\n"},function(t,e){t.exports="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n"},function(t,e){t.exports="varying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n\nstruct BlinnPhongMaterial {\n\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\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\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n"},function(t,e){t.exports="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 ); // Burley clearcoat model\n\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n"},function(t,e){t.exports="struct PhysicalMaterial {\n\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n\n};\n\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\n\n// Clear coat directional hemishperical reflectance (this approximation should be improved)\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n\n}\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\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\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\n\t#ifndef STANDARD\n\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\n\t#endif\n\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\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\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\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\n\t#ifndef STANDARD\n\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\n\t#endif\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\n\n// ref: http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr_v2.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n"},function(t,e){t.exports="//\n// This is a template that can be used to light a material, it uses pluggable RenderEquations (RE)\n// for specific lighting scenarios.\n//\n// Instructions for use:\n// - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n// - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n// - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n//\n// TODO:\n// - Add area light support.\n// - Add sphere light support.\n// - Add diffuse light probe (irradiance cubemap) support.\n//\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\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 ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\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\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\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\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t}\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t// TODO, replace 8 with the real maxMIPLevel\n\t \tirradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 );\n\n\t#endif\n\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\t// TODO, replace 8 with the real maxMIPLevel\n\tvec3 radiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 );\n\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n\n#endif\n";
|
||
},function(t,e){t.exports="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif"},function(t,e){t.exports="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif"},function(t,e){t.exports="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n\t#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_MAP\n\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n"},function(t,e){t.exports="float metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif"},function(t,e){t.exports="#ifdef USE_MORPHNORMALS\n\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\n#endif\n"},function(t,e){t.exports="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif"},function(t,e){t.exports="#ifdef USE_MORPHTARGETS\n\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\n\t#ifndef USE_MORPHNORMALS\n\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\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n"},function(t,e){t.exports="#ifdef FLAT_SHADED\n\n\t// Workaround for Adreno/Nexus5 not able able to do dFdx( vViewPosition ) ...\n\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\n#else\n\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\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\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\n\t}\n\n#endif\n"},function(t,e){t.exports="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\n\treturn dot( v, UnpackFactors );\n\n}\n\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n"},function(t,e){t.exports="#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n"},function(t,e){t.exports="float roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif"},function(t,e){t.exports="#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHTS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHTS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHTS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\n\t#endif\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\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\n\t\tvec2 f = fract( uv * size + 0.5 );\n\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\n\t\treturn c;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t// if ( all( something, something ) ) using this instead\n\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\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\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\n\t\t\treturn (\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\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\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\n\t\t\treturn (\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\n\t\t#else // no percentage-closer filtering:\n\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn 1.0;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\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\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the distance from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t// dp = distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\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\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHTS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHTS > 0\n\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHTS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\n\t}\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\n\t}\n\n\t#endif\n\n\t#if NUM_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\n\t}\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="float getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHTS > 0\n\n\tDirectionalLight directionalLight;\n\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\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\n\t}\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHTS > 0\n\n\tSpotLight spotLight;\n\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\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\n\t}\n\n\t#endif\n\n\t#if NUM_POINT_LIGHTS > 0\n\n\tPointLight pointLight;\n\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\n\t}\n\n\t#endif\n\n\t#endif\n\n\treturn shadow;\n\n}\n"},function(t,e){t.exports="#ifdef USE_SKINNING\n\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\n#endif"},function(t,e){t.exports="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\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\tskinned = bindMatrixInverse * skinned;\n\n#endif\n"},function(t,e){t.exports="#ifdef USE_SKINNING\n\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\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n"},function(t,e){t.exports="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif"},function(t,e){t.exports="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif"},function(t,e){t.exports="#if defined( TONE_MAPPING )\n\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n"},function(t,e){t.exports="#define saturate(a) clamp( a, 0.0, 1.0 )\n\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n return toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/~reinhard/cdrom/\nvec3 ReinhardToneMapping( vec3 color ) {\n\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\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\n // John Hable's filmic operator from Uncharted 2 video game\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n"},function(t,e){t.exports="#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\n\tvarying vec2 vUv;\n\n#endif"},function(t,e){t.exports="#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\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n"},function(t,e){t.exports="#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\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif"},function(t,e){t.exports="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif"},function(t,e){t.exports="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n#endif"},function(t,e){t.exports="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = uv2;\n\n#endif"},function(t,e){t.exports="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n\t#endif\n\n#endif\n"},function(t,e){t.exports="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\n\nvarying vec3 vWorldPosition;\n\n#include <common>\n\nvoid main() {\n\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n\n}\n"},function(t,e){t.exports="varying vec3 vWorldPosition;\n\n#include <common>\n\nvoid main() {\n\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n}\n"},function(t,e){t.exports="#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\n\t#endif\n\n}\n"},function(t,e){t.exports="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <skinbase_vertex>\n\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n}\n"},function(t,e){t.exports="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\n\nvoid main () {\n\n\t#include <clipping_planes_fragment>\n\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n\n}\n"},function(t,e){t.exports="varying vec4 vWorldPosition;\n\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvWorldPosition = worldPosition;\n\n}\n"},function(t,e){t.exports="uniform sampler2D tEquirect;\nuniform float tFlip;\n\nvarying vec3 vWorldPosition;\n\n#include <common>\n\nvoid main() {\n\n\t// \tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n}\n"},function(t,e){t.exports="varying vec3 vWorldPosition;\n\n#include <common>\n\nvoid main() {\n\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n}\n"},function(t,e){t.exports="uniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n"},function(t,e){t.exports="uniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <color_vertex>\n\n\tvLineDistance = scale * lineDistance;\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n}\n"},function(t,e){t.exports="uniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n"},function(t,e){t.exports="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\n\t#ifdef USE_ENVMAP\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\n}\n"},function(t,e){t.exports="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\nvarying vec3 vLightFront;\n\n#ifdef DOUBLE_SIDED\n\n\tvarying vec3 vLightBack;\n\n#endif\n\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\n\t#include <lightmap_fragment>\n\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\n\t#else\n\n\t\treflectedLight.directDiffuse = vLightFront;\n\n\t#endif\n\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n";
|
||
},function(t,e){t.exports="#define LAMBERT\n\nvarying vec3 vLightFront;\n\n#ifdef DOUBLE_SIDED\n\n\tvarying vec3 vLightBack;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\n}\n"},function(t,e){t.exports="#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include <envmap_fragment>\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n"},function(t,e){t.exports="#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\n}\n"},function(t,e){t.exports="#define PHYSICAL\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\n\nuniform float envMapIntensity; // temporary\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n"},function(t,e){t.exports="#define PHYSICAL\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\n}\n"},function(t,e){t.exports="uniform float opacity;\nvarying vec3 vNormal;\n\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\n\t#include <logdepthbuf_fragment>\n\n}\n"},function(t,e){t.exports="varying vec3 vNormal;\n\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\tvNormal = normalize( normalMatrix * normal );\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n}\n"},function(t,e){t.exports="uniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\n\toutgoingLight = diffuseColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n"},function(t,e){t.exports="uniform float size;\nuniform float scale;\n\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\n}\n"},function(t,e){t.exports="uniform float opacity;\n\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n\nvoid main() {\n\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n\n}\n"},function(t,e){t.exports="#include <shadowmap_pars_vertex>\n\nvoid main() {\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\n}\n"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UniformsLib=void 0;var i=n(122),r=n(123),a=n(12),o={common:{diffuse:{value:new r.Color(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new i.Vector4(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new a.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new r.Color(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}}},points:{diffuse:{value:new r.Color(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new i.Vector4(0,0,1,1)}}};e.UniformsLib=o},function(t,e){"use strict";function n(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}Object.defineProperty(e,"__esModule",{value:!0}),n.prototype={constructor:n,isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){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: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,a=.01,o=.1,s=t.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],f=s[9],p=s[2],m=s[6],v=s[10];if(Math.abs(c-h)<a&&Math.abs(u-p)<a&&Math.abs(f-m)<a){if(Math.abs(c+h)<o&&Math.abs(u+p)<o&&Math.abs(f+m)<o&&Math.abs(l+d+v-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var g=(l+1)/2,x=(d+1)/2,_=(v+1)/2,y=(c+h)/4,M=(u+p)/4,b=(f+m)/4;return g>x&&g>_?g<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(g),i=y/n,r=M/n):x>_?x<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(x),n=y/i,r=b/i):_<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(_),n=M/r,i=b/r),this.set(n,i,r,e),this}var w=Math.sqrt((m-f)*(m-f)+(u-p)*(u-p)+(h-c)*(h-c));return Math.abs(w)<.001&&(w=1),this.x=(m-f)/w,this.y=(u-p)/w,this.z=(h-c)/w,this.w=Math.acos((l+d+v-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(i,r){return void 0===t&&(t=new n,e=new n),t.set(i,i,i,i),e.set(r,r,r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},e.Vector4=n},function(t,e,n){"use strict";function i(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.Color=e.ColorKeywords=void 0;var r,a=n(5);i.prototype={constructor:i,isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.r=t,this.g=t,this.b=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){if(e=a._Math.euclideanModulo(e,1),n=a._Math.clamp(n,0,1),i=a._Math.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(s,l,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=n[1],h=u.length;if(3===h)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=r[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i=t||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),l=Math.min(r,a,o),c=(l+s)/2;if(l===s)e=0,n=0;else{var u=s-l;switch(n=c<=.5?u/(s+l):u/(2-s-l),s){case r:e=(a-o)/u+(a<o?6:0);break;case a:e=(o-r)/u+2;break;case o:e=(r-a)/u+4}e/=6}return i.h=e,i.s=n,i.l=c,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=n,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}},e.ColorKeywords=r={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,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},e.ColorKeywords=r,e.Color=i},function(t,e,n){"use strict";function i(t,e){function n(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);s=m.createBuffer(),l=m.createBuffer(),m.bindBuffer(m.ARRAY_BUFFER,s),m.bufferData(m.ARRAY_BUFFER,t,m.STATIC_DRAW),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,l),m.bufferData(m.ELEMENT_ARRAY_BUFFER,e,m.STATIC_DRAW),f=m.createTexture(),p=m.createTexture(),v.bindTexture(m.TEXTURE_2D,f),m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),v.bindTexture(m.TEXTURE_2D,p),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),c={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},u=i(c),h={vertex:m.getAttribLocation(u,"position"),uv:m.getAttribLocation(u,"uv")},d={renderType:m.getUniformLocation(u,"renderType"),map:m.getUniformLocation(u,"map"),occlusionMap:m.getUniformLocation(u,"occlusionMap"),opacity:m.getUniformLocation(u,"opacity"),color:m.getUniformLocation(u,"color"),scale:m.getUniformLocation(u,"scale"),rotation:m.getUniformLocation(u,"rotation"),screenPosition:m.getUniformLocation(u,"screenPosition")}}function i(e){var n=m.createProgram(),i=m.createShader(m.FRAGMENT_SHADER),r=m.createShader(m.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return m.shaderSource(i,a+e.fragmentShader),m.shaderSource(r,a+e.vertexShader),m.compileShader(i),m.compileShader(r),m.attachShader(n,i),m.attachShader(n,r),m.linkProgram(n),n}var s,l,c,u,h,d,f,p,m=t.context,v=t.state;this.render=function(i,c,g){if(0!==e.length){var x=new o.Vector3,_=g.w/g.z,y=.5*g.z,M=.5*g.w,b=16/g.w,w=new a.Vector2(b*_,b),E=new o.Vector3(1,1,0),S=new a.Vector2(1,1),T=new r.Box2;T.min.set(0,0),T.max.set(g.z-16,g.w-16),void 0===u&&n(),m.useProgram(u),v.initAttributes(),v.enableAttribute(h.vertex),v.enableAttribute(h.uv),v.disableUnusedAttributes(),m.uniform1i(d.occlusionMap,0),m.uniform1i(d.map,1),m.bindBuffer(m.ARRAY_BUFFER,s),m.vertexAttribPointer(h.vertex,2,m.FLOAT,!1,16,0),m.vertexAttribPointer(h.uv,2,m.FLOAT,!1,16,8),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,l),v.disable(m.CULL_FACE),v.setDepthWrite(!1);for(var L=0,A=e.length;L<A;L++){b=16/g.w,w.set(b*_,b);var P=e[L];if(x.set(P.matrixWorld.elements[12],P.matrixWorld.elements[13],P.matrixWorld.elements[14]),x.applyMatrix4(c.matrixWorldInverse),x.applyProjection(c.projectionMatrix),E.copy(x),S.x=g.x+E.x*y+y-8,S.y=g.y+E.y*M+M-8,T.containsPoint(S)===!0){v.activeTexture(m.TEXTURE0),v.bindTexture(m.TEXTURE_2D,null),v.activeTexture(m.TEXTURE1),v.bindTexture(m.TEXTURE_2D,f),m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,S.x,S.y,16,16,0),m.uniform1i(d.renderType,0),m.uniform2f(d.scale,w.x,w.y),m.uniform3f(d.screenPosition,E.x,E.y,E.z),v.disable(m.BLEND),v.enable(m.DEPTH_TEST),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0),v.activeTexture(m.TEXTURE0),v.bindTexture(m.TEXTURE_2D,p),m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,S.x,S.y,16,16,0),m.uniform1i(d.renderType,1),v.disable(m.DEPTH_TEST),v.activeTexture(m.TEXTURE1),v.bindTexture(m.TEXTURE_2D,f),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0),P.positionScreen.copy(E),P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares(),m.uniform1i(d.renderType,2),v.enable(m.BLEND);for(var R=0,C=P.lensFlares.length;R<C;R++){var D=P.lensFlares[R];D.opacity>.001&&D.scale>.001&&(E.x=D.x,E.y=D.y,E.z=D.z,b=D.size*D.scale/g.w,w.x=b*_,w.y=b,m.uniform3f(d.screenPosition,E.x,E.y,E.z),m.uniform2f(d.scale,w.x,w.y),m.uniform1f(d.rotation,D.rotation),m.uniform1f(d.opacity,D.opacity),m.uniform3f(d.color,D.color.r,D.color.g,D.color.b),v.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),t.setTexture2D(D.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}}v.enable(m.CULL_FACE),v.enable(m.DEPTH_TEST),v.setDepthWrite(!0),t.resetGLState()}}}Object.defineProperty(e,"__esModule",{value:!0}),e.LensFlarePlugin=void 0;var r=n(125),a=n(12),o=n(6);e.LensFlarePlugin=i},function(t,e,n){"use strict";function i(t,e){this.min=void 0!==t?t:new r.Vector2((+(1/0)),(+(1/0))),this.max=void 0!==e?e:new r.Vector2((-(1/0)),(-(1/0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.Box2=void 0;var r=n(12);i.prototype={constructor:i,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this;
|
||
},setFromCenterAndSize:function(){var t=new r.Vector2;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=+(1/0),this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){var e=t||new r.Vector2;return e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var e=t||new r.Vector2;return e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var n=e||new r.Vector2;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){var n=e||new r.Vector2;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r.Vector2;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},e.Box2=i},function(t,e,n){"use strict";function i(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);l=p.createBuffer(),c=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,l),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,c),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),u=i(),h={position:p.getAttribLocation(u,"position"),uv:p.getAttribLocation(u,"uv")},d={uvOffset:p.getUniformLocation(u,"uvOffset"),uvScale:p.getUniformLocation(u,"uvScale"),rotation:p.getUniformLocation(u,"rotation"),scale:p.getUniformLocation(u,"scale"),color:p.getUniformLocation(u,"color"),map:p.getUniformLocation(u,"map"),opacity:p.getUniformLocation(u,"opacity"),modelViewMatrix:p.getUniformLocation(u,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(u,"projectionMatrix"),fogType:p.getUniformLocation(u,"fogType"),fogDensity:p.getUniformLocation(u,"fogDensity"),fogNear:p.getUniformLocation(u,"fogNear"),fogFar:p.getUniformLocation(u,"fogFar"),fogColor:p.getUniformLocation(u,"fogColor"),alphaTest:p.getUniformLocation(u,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var a=n.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),f=new r.Texture(n),f.needsUpdate=!0}function i(){var e=p.createProgram(),n=p.createShader(p.VERTEX_SHADER),i=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),p.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 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")),p.compileShader(n),p.compileShader(i),p.attachShader(e,n),p.attachShader(e,i),p.linkProgram(e),e}function s(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var l,c,u,h,d,f,p=t.context,m=t.state,v=new a.Vector3,g=new o.Quaternion,x=new a.Vector3;this.render=function(i,r){if(0!==e.length){void 0===u&&n(),p.useProgram(u),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(p.CULL_FACE),m.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,l),p.vertexAttribPointer(h.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,c),p.uniformMatrix4fv(d.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(p.TEXTURE0),p.uniform1i(d.map,0);var a=0,o=0,_=i.fog;_?(p.uniform3f(d.fogColor,_.color.r,_.color.g,_.color.b),_&&_.isFog?(p.uniform1f(d.fogNear,_.near),p.uniform1f(d.fogFar,_.far),p.uniform1i(d.fogType,1),a=1,o=1):_&&_.isFogExp2&&(p.uniform1f(d.fogDensity,_.density),p.uniform1i(d.fogType,2),a=2,o=2)):(p.uniform1i(d.fogType,0),a=0,o=0);for(var y=0,M=e.length;y<M;y++){var b=e[y];b.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,b.matrixWorld),b.z=-b.modelViewMatrix.elements[14]}e.sort(s);for(var w=[],y=0,M=e.length;y<M;y++){var b=e[y],E=b.material;if(E.visible!==!1){p.uniform1f(d.alphaTest,E.alphaTest),p.uniformMatrix4fv(d.modelViewMatrix,!1,b.modelViewMatrix.elements),b.matrixWorld.decompose(v,g,x),w[0]=x.x,w[1]=x.y;var S=0;i.fog&&E.fog&&(S=o),a!==S&&(p.uniform1i(d.fogType,S),a=S),null!==E.map?(p.uniform2f(d.uvOffset,E.map.offset.x,E.map.offset.y),p.uniform2f(d.uvScale,E.map.repeat.x,E.map.repeat.y)):(p.uniform2f(d.uvOffset,0,0),p.uniform2f(d.uvScale,1,1)),p.uniform1f(d.opacity,E.opacity),p.uniform3f(d.color,E.color.r,E.color.g,E.color.b),p.uniform1f(d.rotation,E.rotation),p.uniform2fv(d.scale,w),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.setDepthTest(E.depthTest),m.setDepthWrite(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(f,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0)}}m.enable(p.CULL_FACE),t.resetGLState()}}}Object.defineProperty(e,"__esModule",{value:!0}),e.SpritePlugin=void 0;var r=n(10),a=n(6),o=n(7);e.SpritePlugin=i},function(t,e,n){"use strict";function i(t,e,n,i){function m(e,n,i,a){var o=e.geometry,s=null,l=R,c=e.customDepthMaterial;if(i&&(l=C,c=e.customDistanceMaterial),c)s=c;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var h=e.isSkinnedMesh&&n.skinning,d=0;u&&(d|=L),h&&(d|=A),s=l[d]}if(t.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var f=s.uuid,p=n.uuid,m=D[f];void 0===m&&(m={},D[f]=m);var v=m[p];void 0===v&&(v=s.clone(),m[p]=v),s=v}s.visible=n.visible,s.wireframe=n.wireframe;var g=n.side;return W.renderSingleSided&&g==r.DoubleSide&&(g=r.FrontSide),W.renderReverseSided&&(g===r.FrontSide?g=r.BackSide:g===r.BackSide&&(g=r.FrontSide)),s.side=g,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,i&&void 0!==s.uniforms.lightPos&&s.uniforms.lightPos.value.copy(a),s}function v(t,e,n){if(t.visible!==!1){var i=0!==(t.layers.mask&e.layers.mask);if(i&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||_.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),T.push(t))}for(var a=t.children,o=0,s=a.length;o<s;o++)v(a[o],e,n)}}var g=t.context,x=t.state,_=new p.Frustum,y=new f.Matrix4,M=e.shadows,b=new d.Vector2,w=new d.Vector2(i.maxTextureSize,i.maxTextureSize),E=new h.Vector3,S=new h.Vector3,T=[],L=1,A=2,P=(L|A)+1,R=new Array(P),C=new Array(P),D={},U=[new h.Vector3(1,0,0),new h.Vector3((-1),0,0),new h.Vector3(0,0,1),new h.Vector3(0,0,(-1)),new h.Vector3(0,1,0),new h.Vector3(0,(-1),0)],N=[new h.Vector3(0,1,0),new h.Vector3(0,1,0),new h.Vector3(0,1,0),new h.Vector3(0,1,0),new h.Vector3(0,0,1),new h.Vector3(0,0,(-1))],F=[new u.Vector4,new u.Vector4,new u.Vector4,new u.Vector4,new u.Vector4,new u.Vector4],I=new c.MeshDepthMaterial;I.depthPacking=r.RGBADepthPacking,I.clipping=!0;for(var O=l.ShaderLib.distanceRGBA,B=s.UniformsUtils.clone(O.uniforms),V=0;V!==P;++V){var G=0!==(V&L),z=0!==(V&A),k=I.clone();k.morphTargets=G,k.skinning=z,R[V]=k;var H=new o.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:B,vertexShader:O.vertexShader,fragmentShader:O.fragmentShader,morphTargets:G,skinning:z,clipping:!0});C[V]=H}var W=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=r.PCFShadowMap,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,i){if(W.enabled!==!1&&(W.autoUpdate!==!1||W.needsUpdate!==!1)&&0!==M.length){x.clearColor(1,1,1,1),x.disable(g.BLEND),x.setDepthTest(!0),x.setScissorTest(!1);for(var o,s,l=0,c=M.length;l<c;l++){var u=M[l],h=u.shadow;if(void 0!==h){var d=h.camera;if(b.copy(h.mapSize),b.min(w),u&&u.isPointLight){o=6,s=!0;var f=b.x,p=b.y;F[0].set(2*f,p,f,p),F[1].set(0,p,f,p),F[2].set(3*f,p,f,p),F[3].set(f,p,f,p),F[4].set(3*f,0,f,p),F[5].set(f,0,f,p),b.x*=4,b.y*=2}else o=1,s=!1;if(null===h.map){var L={minFilter:r.NearestFilter,magFilter:r.NearestFilter,format:r.RGBAFormat};h.map=new a.WebGLRenderTarget(b.x,b.y,L),d.updateProjectionMatrix()}h&&h.isSpotLightShadow&&h.update(u);var A=h.map,P=h.matrix;S.setFromMatrixPosition(u.matrixWorld),d.position.copy(S),t.setRenderTarget(A),t.clear();for(var R=0;R<o;R++){if(s){E.copy(d.position),E.add(U[R]),d.up.copy(N[R]),d.lookAt(E);var C=F[R];x.viewport(C)}else E.setFromMatrixPosition(u.target.matrixWorld),d.lookAt(E);d.updateMatrixWorld(),d.matrixWorldInverse.getInverse(d.matrixWorld),P.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),P.multiply(d.projectionMatrix),P.multiply(d.matrixWorldInverse),y.multiplyMatrices(d.projectionMatrix,d.matrixWorldInverse),_.setFromMatrix(y),T.length=0,v(e,i,d);for(var D=0,I=T.length;D<I;D++){var O=T[D],B=n.update(O),V=O.material;if(V&&V.isMultiMaterial)for(var G=B.groups,z=V.materials,k=0,H=G.length;k<H;k++){var j=G[k],X=z[j.materialIndex];if(X.visible===!0){var q=m(O,X,s,S);t.renderBufferDirect(d,null,B,q,O,j)}}else{var q=m(O,V,s,S);t.renderBufferDirect(d,null,B,q,O,null)}}}}else console.warn("THREE.WebGLShadowMap:",u,"has no shadow.")}var Y=t.getClearColor(),Z=t.getClearAlpha();t.setClearColor(Y,Z),W.needsUpdate=!1}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLShadowMap=void 0;var r=n(3),a=n(128),o=n(129),s=n(13),l=n(14),c=n(131),u=n(122),h=n(6),d=n(12),f=n(4),p=n(132);e.WebGLShadowMap=i},function(t,e,n){"use strict";function i(t,e,n){this.uuid=l._Math.generateUUID(),this.width=t,this.height=e,this.scissor=new s.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new s.Vector4(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=o.LinearFilter),this.texture=new a.Texture((void 0),(void 0),n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLRenderTarget=void 0;var r=n(11),a=n(10),o=n(3),s=n(122),l=n(5);Object.assign(i.prototype,r.EventDispatcher.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),e.WebGLRenderTarget=i},function(t,e,n){"use strict";function i(t){r.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}Object.defineProperty(e,"__esModule",{value:!0}),e.ShaderMaterial=void 0;var r=n(130),a=n(13);i.prototype=Object.create(r.Material.prototype),i.prototype.constructor=i,i.prototype.isShaderMaterial=!0,i.prototype.copy=function(t){return r.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=a.UniformsUtils.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},i.prototype.toJSON=function(t){var e=r.Material.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},e.ShaderMaterial=i},function(t,e,n){"use strict";function i(){Object.defineProperty(this,"id",{value:r()}),this.uuid=s._Math.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=o.NormalBlending,this.side=o.FrontSide,this.shading=o.SmoothShading,this.vertexColors=o.NoColors,this.opacity=1,this.transparent=!1,this.blendSrc=o.SrcAlphaFactor,this.blendDst=o.OneMinusSrcAlphaFactor,this.blendEquation=o.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=o.LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function r(){return l++}Object.defineProperty(e,"__esModule",{value:!0}),e.Material=e.MaterialIdCount=void 0;var a=n(11),o=n(3),s=n(5);i.prototype={constructor:i,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){t===!0&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):"overdraw"===e?this[e]=Number(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==o.NormalBlending&&(i.blending=this.blending),this.shading!==o.SmoothShading&&(i.shading=this.shading),this.side!==o.FrontSide&&(i.side=this.side),this.vertexColors!==o.NoColors&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,n){var r=e(t.textures),a=e(t.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(i.prototype,a.EventDispatcher.prototype);var l=0;e.MaterialIdCount=r,e.Material=i},function(t,e,n){"use strict";function i(t){r.Material.call(this),this.type="MeshDepthMaterial",this.depthPacking=a.BasicDepthPacking,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.MeshDepthMaterial=void 0;var r=n(130),a=n(3);i.prototype=Object.create(r.Material.prototype),i.prototype.constructor=i,i.prototype.isMeshDepthMaterial=!0,i.prototype.copy=function(t){return r.Material.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},e.MeshDepthMaterial=i},function(t,e,n){"use strict";function i(t,e,n,i,r,a){this.planes=[void 0!==t?t:new o.Plane,void 0!==e?e:new o.Plane,void 0!==n?n:new o.Plane,void 0!==i?i:new o.Plane,void 0!==r?r:new o.Plane,void 0!==a?a:new o.Plane]}Object.defineProperty(e,"__esModule",{value:!0}),e.Frustum=void 0;var r=n(6),a=n(133),o=n(135);i.prototype={constructor:i,set:function(t,e,n,i,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],f=n[10],p=n[11],m=n[12],v=n[13],g=n[14],x=n[15];return e[0].setComponents(o-i,u-s,p-h,x-m).normalize(),e[1].setComponents(o+i,u+s,p+h,x+m).normalize(),e[2].setComponents(o+r,u+l,p+d,x+v).normalize(),e[3].setComponents(o-r,u-l,p-d,x-v).normalize(),e[4].setComponents(o-a,u-c,p-f,x-g).normalize(),e[5].setComponents(o+a,u+c,p+f,x+g).normalize(),this},intersectsObject:function(){var t=new a.Sphere;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new a.Sphere;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){var a=e[r].distanceToPoint(n);if(a<i)return!1}return!0},intersectsBox:function(){var t=new r.Vector3,e=new r.Vector3;return function(n){for(var i=this.planes,r=0;r<6;r++){var a=i[r];t.x=a.normal.x>0?n.min.x:n.max.x,e.x=a.normal.x>0?n.max.x:n.min.x,t.y=a.normal.y>0?n.min.y:n.max.y,e.y=a.normal.y>0?n.max.y:n.min.y,t.z=a.normal.z>0?n.min.z:n.max.z,e.z=a.normal.z>0?n.max.z:n.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},e.Frustum=i},function(t,e,n){"use strict";function i(t,e){this.center=void 0!==t?t:new a.Vector3,this.radius=void 0!==e?e:0}Object.defineProperty(e,"__esModule",{value:!0}),e.Sphere=void 0;var r=n(134),a=n(6);i.prototype={constructor:i,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new r.Box3;return function(e,n){var i=this.center;void 0!==n?i.copy(n):t.setFromPoints(e).center(i);for(var r=0,a=0,o=e.length;a<o;a++)r=Math.max(r,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t),i=e||new a.Vector3;return i.copy(t),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new r.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},e.Sphere=i},function(t,e,n){"use strict";function i(t,e){this.min=void 0!==t?t:new r.Vector3((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==e?e:new r.Vector3((-(1/0)),(-(1/0)),(-(1/0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.Box3=void 0;var r=n(6),a=n(133);i.prototype={constructor:i,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=+(1/0),n=+(1/0),i=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,l=t.length;s<l;s+=3){var c=t[s],u=t[s+1],h=t[s+2];c<e&&(e=c),u<n&&(n=u),h<i&&(i=h),c>r&&(r=c),u>a&&(a=u),h>o&&(o=h)}this.min.set(e,n,i),this.max.set(r,a,o)},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new r.Vector3;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(){var t=new r.Vector3;return function(e){var n=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var i=e.geometry;if(void 0!==i)if(i&&i.isGeometry)for(var r=i.vertices,a=0,o=r.length;a<o;a++)t.copy(r[a]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t);else if(i&&i.isBufferGeometry){var s=i.attributes.position;if(void 0!==s){var l,c,u;s&&s.isInterleavedBufferAttribute?(l=s.data.array,c=s.offset,u=s.data.stride):(l=s.array,c=0,u=3);for(var a=c,o=l.length;a<o;a+=u)t.fromArray(l,a),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}}}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=+(1/0),this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){var e=t||new r.Vector3;return e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var e=t||new r.Vector3;return e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var n=e||new r.Vector3;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new r.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){var n=e||new r.Vector3;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r.Vector3;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),getBoundingSphere:function(){var t=new r.Vector3;return function(e){var n=e||new a.Sphere;return n.center=this.center(),n.radius=.5*this.size(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},e.Box3=i},function(t,e,n){"use strict";function i(t,e){this.normal=void 0!==t?t:new a.Vector3(1,0,0),this.constant=void 0!==e?e:0}Object.defineProperty(e,"__esModule",{value:!0}),e.Plane=void 0;var r=n(136),a=n(6);i.prototype={constructor:i,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new a.Vector3,e=new a.Vector3;return function(n,i,r){var a=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(a,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t),i=e||new a.Vector3;return i.copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new a.Vector3;return function(e,n){var i=n||new a.Vector3,r=e.delta(t),o=this.normal.dot(r);if(0!==o){var s=-(e.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return i.copy(r).multiplyScalar(s).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){
|
||
var e=t||new a.Vector3;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new a.Vector3,e=new r.Matrix3;return function(n,i){var r=this.coplanarPoint(t).applyMatrix4(n),a=i||e.getNormalMatrix(n),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},e.Plane=i},function(t,e,n){"use strict";function i(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix3=void 0;var r=n(6);i.prototype={constructor:i,isMatrix3:!0,set:function(t,e,n,i,r,a,o,s,l){var c=this.elements;return c[0]=t,c[1]=i,c[2]=o,c[3]=e,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,n,i){void 0===t&&(t=new r.Vector3),void 0===n&&(n=0),void 0===i&&(i=e.length);for(var a=0,o=n;a<i;a+=3,o+=3)t.fromArray(e,o),t.applyMatrix3(this),t.toArray(e,o);return e}}(),applyToBuffer:function(){var t;return function(e,n,i){void 0===t&&(t=new r.Vector3),void 0===n&&(n=0),void 0===i&&(i=e.length/e.itemSize);for(var a=0,o=n;a<i;a++,o++)t.x=e.getX(o),t.y=e.getY(o),t.z=e.getZ(o),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*a*c-e*o*l-n*r*c+n*o*s+i*r*l-i*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],f=d*l-c*h,p=c*u-d*s,m=h*s-l*u,v=r*f+a*p+o*m;if(0===v){var g="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(g);return console.warn(g),this.identity()}var x=1/v;return i[0]=f*x,i[1]=(o*h-d*a)*x,i[2]=(c*a-o*l)*x,i[3]=p*x,i[4]=(d*r-o*u)*x,i[5]=(o*s-c*r)*x,i[6]=m*x,i[7]=(a*u-h*r)*x,i[8]=(l*r-a*s)*x,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}},e.Matrix3=i},function(t,e,n){"use strict";function i(t,e,n,i,s,l){function c(t,e,n){var i=0;return i+=(t+1)*(e+1)*2,i+=(t+1)*(n+1)*2,i+=(n+1)*(e+1)*2}function u(t,e,n){var i=0;return i+=t*e*2,i+=t*n*2,i+=n*e*2,6*i}function h(t,e,n,i,r,o,s,l,c,u,h){for(var f=o/c,p=s/u,E=o/2,S=s/2,T=l/2,L=c+1,A=u+1,P=0,R=0,C=new a.Vector3,D=0;D<A;D++)for(var U=D*p-S,N=0;N<L;N++){var F=N*f-E;C[t]=F*i,C[e]=U*r,C[n]=T,v[_]=C.x,v[_+1]=C.y,v[_+2]=C.z,C[t]=0,C[e]=0,C[n]=l>0?1:-1,g[_]=C.x,g[_+1]=C.y,g[_+2]=C.z,x[y]=N/c,x[y+1]=1-D/u,_+=3,y+=2,P+=1}for(D=0;D<u;D++)for(N=0;N<c;N++){var I=b+N+L*D,O=b+N+L*(D+1),B=b+(N+1)+L*(D+1),V=b+(N+1)+L*D;m[M]=I,m[M+1]=O,m[M+2]=V,m[M+3]=O,m[M+4]=B,m[M+5]=V,M+=6,R+=6}d.addGroup(w,R,h),w+=R,b+=P}r.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:s,depthSegments:l};var d=this;i=Math.floor(i)||1,s=Math.floor(s)||1,l=Math.floor(l)||1;var f=c(i,s,l),p=u(i,s,l),m=new(p>65535?Uint32Array:Uint16Array)(p),v=new Float32Array(3*f),g=new Float32Array(3*f),x=new Float32Array(2*f),_=0,y=0,M=0,b=0,w=0;h("z","y","x",-1,-1,n,e,t,l,s,0),h("z","y","x",1,-1,n,e,-t,l,s,1),h("x","z","y",1,1,t,n,e,i,l,2),h("x","z","y",1,-1,t,n,-e,i,l,3),h("x","y","z",1,-1,t,e,n,i,s,4),h("x","y","z",-1,-1,t,e,-n,i,s,5),this.setIndex(new o.BufferAttribute(m,1)),this.addAttribute("position",new o.BufferAttribute(v,3)),this.addAttribute("normal",new o.BufferAttribute(g,3)),this.addAttribute("uv",new o.BufferAttribute(x,2))}Object.defineProperty(e,"__esModule",{value:!0}),e.BoxBufferGeometry=void 0;var r=n(138),a=n(6),o=n(139);i.prototype=Object.create(r.BufferGeometry.prototype),i.prototype.constructor=i,e.BoxBufferGeometry=i},function(t,e,n){"use strict";function i(){Object.defineProperty(this,"id",{value:(0,p.GeometryIdCount)()}),this.uuid=f._Math.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:1/0}}Object.defineProperty(e,"__esModule",{value:!0}),e.BufferGeometry=void 0;var r=n(6),a=n(134),o=n(11),s=n(139),l=n(133),c=n(140),u=n(143),h=n(4),d=n(136),f=n(5),p=n(141);Object.assign(i.prototype,o.EventDispatcher.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e){return(e&&e.isBufferAttribute)===!1&&(e&&e.isInterleavedBufferAttribute)===!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new s.BufferAttribute(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new d.Matrix3).getNormalMatrix(t);i.applyToVector3Array(n.array),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,i){return void 0===t&&(t=new h.Matrix4),t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,i){return void 0===t&&(t=new h.Matrix4),t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new u.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t&&t.isPoints||t&&t.isLine){var n=new s.Float32Attribute(3*e.vertices.length,3),i=new s.Float32Attribute(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new s.Float32Attribute(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t&&t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t&&t.isMesh){var n=e.__directGeometry;if(e.elementsNeedUpdate===!0&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}var i;return e.verticesNeedUpdate===!0&&(i=this.attributes.position,void 0!==i&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),e.normalsNeedUpdate===!0&&(i=this.attributes.normal,void 0!==i&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),e.colorsNeedUpdate===!0&&(i=this.attributes.color,void 0!==i&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(i=this.attributes.uv,void 0!==i&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,void 0!==i&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new c.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new s.BufferAttribute(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new s.BufferAttribute(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new s.BufferAttribute(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new s.BufferAttribute(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new s.BufferAttribute(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=t.vertices.length>65535?Uint32Array:Uint16Array,l=new o(3*t.indices.length);this.setIndex(new s.BufferAttribute(l,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],d=0,f=h.length;d<f;d++){var p=h[d],m=new s.Float32Attribute(3*p.length,3);u.push(m.copyVector3sArray(p))}this.morphAttributes[c]=u}if(t.skinIndices.length>0){var v=new s.Float32Attribute(4*t.skinIndices.length,4);this.addAttribute("skinIndex",v.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new s.Float32Attribute(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new a.Box3,e=new r.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new l.Sphere);var n=this.attributes.position;if(n){var i=n.array,r=this.boundingSphere.center;t.setFromArray(i),t.center(r);for(var a=0,o=0,s=i.length;o<s;o+=3)e.fromArray(i,o),a=Math.max(a,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,n=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new s.BufferAttribute(new Float32Array(i.length),3));else for(var a=e.normal.array,o=0,l=a.length;o<l;o++)a[o]=0;var c,u,h,d=e.normal.array,f=new r.Vector3,p=new r.Vector3,m=new r.Vector3,v=new r.Vector3,g=new r.Vector3;if(t){var x=t.array;0===n.length&&this.addGroup(0,x.length);for(var _=0,y=n.length;_<y;++_)for(var M=n[_],b=M.start,w=M.count,o=b,l=b+w;o<l;o+=3)c=3*x[o+0],u=3*x[o+1],h=3*x[o+2],f.fromArray(i,c),p.fromArray(i,u),m.fromArray(i,h),v.subVectors(m,p),g.subVectors(f,p),v.cross(g),d[c]+=v.x,d[c+1]+=v.y,d[c+2]+=v.z,d[u]+=v.x,d[u+1]+=v.y,d[u+2]+=v.z,d[h]+=v.x,d[h+1]+=v.y,d[h+2]+=v.z}else for(var o=0,l=i.length;o<l;o+=9)f.fromArray(i,o),p.fromArray(i,o+3),m.fromArray(i,o+6),v.subVectors(m,p),g.subVectors(f,p),v.cross(g),d[o]=v.x,d[o+1]=v.y,d[o+2]=v.z,d[o+3]=v.x,d[o+4]=v.y,d[o+5]=v.z,d[o+6]=v.x,d[o+7]=v.y,d[o+8]=v.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if((t&&t.isBufferGeometry)===!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var n=this.attributes;for(var i in n)if(void 0!==t.attributes[i])for(var r=n[i],a=r.array,o=t.attributes[i],s=o.array,l=o.itemSize,c=0,u=l*e;c<s.length;c++,u++)a[u]=s[c];return this},normalizeNormals:function(){for(var t,e,n,i,r=this.attributes.normal.array,a=0,o=r.length;a<o;a+=3)t=r[a],e=r[a+1],n=r[a+2],i=1/Math.sqrt(t*t+e*e+n*n),r[a]*=i,r[a+1]*=i,r[a+2]*=i},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new i,e=this.index.array,n=this.attributes;for(var r in n){for(var a=n[r],o=a.array,l=a.itemSize,c=new o.constructor(e.length*l),u=0,h=0,d=0,f=e.length;d<f;d++){u=e[d]*l;for(var p=0;p<l;p++)c[h++]=o[u++]}t.addAttribute(r,new s.BufferAttribute(c,l))}return t},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var i=this.index;if(null!==i){var r=Array.prototype.slice.call(i.array);t.data.index={type:i.array.constructor.name,array:r}}var a=this.attributes;for(var n in a){var o=a[n],r=Array.prototype.slice.call(o.array);t.data.attributes[n]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(t.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),t},clone:function(){return(new i).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var l=a[o];this.addGroup(l.start,l.count,l.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),i.MaxIndex=65535,e.BufferGeometry=i},function(t,e,n){"use strict";function i(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=x._Math.generateUUID(),this.array=t,this.itemSize=e,this.normalized=n===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function r(t,e){return new i(new Int8Array(t),e)}function a(t,e){return new i(new Uint8Array(t),e)}function o(t,e){return new i(new Uint8ClampedArray(t),e)}function s(t,e){return new i(new Int16Array(t),e)}function l(t,e){return new i(new Uint16Array(t),e)}function c(t,e){return new i(new Int32Array(t),e)}function u(t,e){return new i(new Uint32Array(t),e)}function h(t,e){return new i(new Float32Array(t),e)}function d(t,e){return new i(new Float64Array(t),e)}function f(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new i(t,e).setDynamic(!0)}Object.defineProperty(e,"__esModule",{value:!0}),e.BufferAttribute=e.Int8Attribute=e.Uint8Attribute=e.Uint8ClampedAttribute=e.Int16Attribute=e.Uint16Attribute=e.Int32Attribute=e.Uint32Attribute=e.Float32Attribute=e.Float64Attribute=e.DynamicBufferAttribute=void 0;var p=n(122),m=n(6),v=n(12),g=n(123),x=n(5);i.prototype={constructor:i,isBufferAttribute:!0,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new g.Color),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this},copyIndicesArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];e[n++]=a.a,e[n++]=a.b,e[n++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new v.Vector2),e[n++]=a.x,e[n++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new m.Vector3),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new p.Vector4),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},clone:function(){return(new this.constructor).copy(this)}},e.DynamicBufferAttribute=f,e.Float64Attribute=d,e.Float32Attribute=h,e.Uint32Attribute=u,e.Int32Attribute=c,e.Uint16Attribute=l,e.Int16Attribute=s,e.Uint8ClampedAttribute=o,e.Uint8Attribute=a,e.Int8Attribute=r,e.BufferAttribute=i},function(t,e,n){"use strict";function i(){Object.defineProperty(this,"id",{value:(0,r.GeometryIdCount)()}),this.uuid=s._Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}Object.defineProperty(e,"__esModule",{value:!0}),e.DirectGeometry=void 0;var r=n(141),a=n(11),o=n(12),s=n(5);Object.assign(i.prototype,a.EventDispatcher.prototype,{computeBoundingBox:r.Geometry.prototype.computeBoundingBox,computeBoundingSphere:r.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){for(var e,n,i=[],r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,i.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,n=t.faces,i=t.vertices,r=t.faceVertexUvs,a=r[0]&&r[0].length>0,s=r[1]&&r[1].length>0,l=t.morphTargets,c=l.length;if(c>0){e=[];for(var u=0;u<c;u++)e[u]=[];this.morphTargets.position=e}var h,d=t.morphNormals,f=d.length;if(f>0){h=[];for(var u=0;u<f;u++)h[u]=[];this.morphTargets.normal=h}for(var p=t.skinIndices,m=t.skinWeights,v=p.length===i.length,g=m.length===i.length,u=0;u<n.length;u++){var x=n[u];this.vertices.push(i[x.a],i[x.b],i[x.c]);var _=x.vertexNormals;if(3===_.length)this.normals.push(_[0],_[1],_[2]);else{var y=x.normal;this.normals.push(y,y,y)}var M=x.vertexColors;if(3===M.length)this.colors.push(M[0],M[1],M[2]);else{var b=x.color;this.colors.push(b,b,b)}if(a===!0){var w=r[0][u];void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",u),this.uvs.push(new o.Vector2,new o.Vector2,new o.Vector2))}if(s===!0){var w=r[1][u];void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",u),this.uvs2.push(new o.Vector2,new o.Vector2,new o.Vector2))}for(var E=0;E<c;E++){var S=l[E].vertices;e[E].push(S[x.a],S[x.b],S[x.c])}for(var E=0;E<f;E++){var T=d[E].vertexNormals[u];h[E].push(T.a,T.b,T.c)}v&&this.skinIndices.push(p[x.a],p[x.b],p[x.c]),g&&this.skinWeights.push(m[x.a],m[x.b],m[x.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),e.DirectGeometry=i},function(t,e,n){"use strict";function i(){Object.defineProperty(this,"id",{value:r()}),this.uuid=m._Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function r(){return v++}Object.defineProperty(e,"__esModule",{value:!0}),e.Geometry=e.GeometryIdCount=void 0;var a=n(11),o=n(142),s=n(136),l=n(133),c=n(134),u=n(6),h=n(4),d=n(12),f=n(123),p=n(143),m=n(5);Object.assign(i.prototype,a.EventDispatcher.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new s.Matrix3).getNormalMatrix(t),n=0,i=this.vertices.length;n<i;n++){var r=this.vertices[n];r.applyMatrix4(t)}for(var n=0,i=this.faces.length;n<i;n++){var a=this.faces[n];a.normal.applyMatrix3(e).normalize();for(var o=0,l=a.vertexNormals.length;o<l;o++)a.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,i){return void 0===t&&(t=new h.Matrix4),t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,i){return void 0===t&&(t=new h.Matrix4),t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new p.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i,r){var a=void 0!==s?[p[t].clone(),p[e].clone(),p[i].clone()]:[],u=void 0!==l?[n.colors[t].clone(),n.colors[e].clone(),n.colors[i].clone()]:[],d=new o.Face3(t,e,i,a,u,r);n.faces.push(d),void 0!==c&&n.faceVertexUvs[0].push([m[t].clone(),m[e].clone(),m[i].clone()]),void 0!==h&&n.faceVertexUvs[1].push([v[t].clone(),v[e].clone(),v[i].clone()])}var n=this,i=null!==t.index?t.index.array:void 0,r=t.attributes,a=r.position.array,s=void 0!==r.normal?r.normal.array:void 0,l=void 0!==r.color?r.color.array:void 0,c=void 0!==r.uv?r.uv.array:void 0,h=void 0!==r.uv2?r.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var p=[],m=[],v=[],g=0,x=0;g<a.length;g+=3,x+=2)n.vertices.push(new u.Vector3(a[g],a[g+1],a[g+2])),void 0!==s&&p.push(new u.Vector3(s[g],s[g+1],s[g+2])),void 0!==l&&n.colors.push(new f.Color(l[g],l[g+1],l[g+2])),void 0!==c&&m.push(new d.Vector2(c[x],c[x+1])),void 0!==h&&v.push(new d.Vector2(h[x],h[x+1]));if(void 0!==i){var _=t.groups;if(_.length>0)for(var g=0;g<_.length;g++)for(var y=_[g],M=y.start,b=y.count,x=M,w=M+b;x<w;x+=3)e(i[x],i[x+1],i[x+2],y.materialIndex);else for(var g=0;g<i.length;g+=3)e(i[g],i[g+1],i[g+2])}else for(var g=0;g<a.length/3;g+=3)e(g,g+1,g+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,i=new h.Matrix4;return i.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var t=new u.Vector3,e=new u.Vector3,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,n,i,r,a,o;for(o=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)o[e]=new u.Vector3;if(t){var s,l,c,h=new u.Vector3,d=new u.Vector3;for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],h.subVectors(c,l),d.subVectors(s,l),h.cross(d),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,n=this.vertices.length;e<n;e++)o[e].normalize();for(i=0,r=this.faces.length;i<r;i++){a=this.faces[i];var f=a.vertexNormals;3===f.length?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,a;for(n=0,r=this.faces.length;n<r;n++)for(a=this.faces[n],a.__originalFaceNormal?a.__originalFaceNormal.copy(a.normal):a.__originalFaceNormal=a.normal.clone(),a.__originalVertexNormals||(a.__originalVertexNormals=[]),t=0,e=a.vertexNormals.length;t<e;t++)a.__originalVertexNormals[t]?a.__originalVertexNormals[t].copy(a.vertexNormals[t]):a.__originalVertexNormals[t]=a.vertexNormals[t].clone();var o=new i;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var s,l,c=this.morphNormals[t].faceNormals,h=this.morphNormals[t].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)s=new u.Vector3,l={a:new u.Vector3,b:new u.Vector3,c:new u.Vector3},c.push(s),h.push(l)}var d=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals();var s,l;for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],s=d.faceNormals[n],l=d.vertexNormals[n],s.copy(a.normal),l.a.copy(a.vertexNormals[0]),l.b.copy(a.vertexNormals[1]),l.c.copy(a.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],a.normal=a.__originalFaceNormal,a.vertexNormals=a.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,i=e.length;n<i;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new c.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new l.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var i,r=this.vertices.length,a=this.vertices,l=t.vertices,c=this.faces,u=t.faces,h=this.faceVertexUvs[0],d=t.faceVertexUvs[0];void 0===n&&(n=0),void 0!==e&&(i=(new s.Matrix3).getNormalMatrix(e));for(var f=0,p=l.length;f<p;f++){var m=l[f],v=m.clone();void 0!==e&&v.applyMatrix4(e),a.push(v)}for(f=0,p=u.length;f<p;f++){var g,x,_,y=u[f],M=y.vertexNormals,b=y.vertexColors;g=new o.Face3(y.a+r,y.b+r,y.c+r),g.normal.copy(y.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var w=0,E=M.length;w<E;w++)x=M[w].clone(),void 0!==i&&x.applyMatrix3(i).normalize(),g.vertexNormals.push(x);g.color.copy(y.color);for(var w=0,E=b.length;w<E;w++)_=b[w],g.vertexColors.push(_.clone());g.materialIndex=y.materialIndex+n,c.push(g)}for(f=0,p=d.length;f<p;f++){var S=d[f],T=[];if(void 0!==S){for(var w=0,E=S.length;w<E;w++)T.push(S[w].clone());h.push(T)}}},mergeMesh:function(t){return(t&&t.isMesh)===!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),void this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,n,i,r,a,o,s,l={},c=[],u=[],h=4,d=Math.pow(10,h);for(n=0,i=this.vertices.length;n<i;n++)t=this.vertices[n],e=Math.round(t.x*d)+"_"+Math.round(t.y*d)+"_"+Math.round(t.z*d),void 0===l[e]?(l[e]=n,c.push(this.vertices[n]),u[n]=c.length-1):u[n]=u[l[e]];var f=[];for(n=0,i=this.faces.length;n<i;n++){r=this.faces[n],r.a=u[r.a],r.b=u[r.b],r.c=u[r.c],a=[r.a,r.b,r.c];for(var p=-1,m=0;m<3;m++)if(a[m]===a[(m+1)%3]){p=m,f.push(n);break}}for(n=f.length-1;n>=0;n--){var v=f[n];for(this.faces.splice(v,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(v,1)}var g=this.vertices.length-c.length;return this.vertices=c,g},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,n=e.length,i=0;i<n;i++)e[i]._id=i;e.sort(t);var r,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===n&&(r=[]),s&&s.length===n&&(a=[]);for(var i=0;i<n;i++){var l=e[i]._id;r&&r.push(o[l]),a&&a.push(s[l])}r&&(this.faceVertexUvs[0]=r),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function t(t,e,n){return n?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==d[e]?d[e]:(d[e]=h.length/3,h.push(t.x,t.y,t.z),d[e]);
|
||
}function n(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==p[e]?p[e]:(p[e]=f.length,f.push(t.getHex()),p[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==v[e]?v[e]:(v[e]=m.length/2,m.push(t.x,t.y),v[e])}var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(var s=[],l=0;l<this.vertices.length;l++){var c=this.vertices[l];s.push(c.x,c.y,c.z)}for(var u=[],h=[],d={},f=[],p={},m=[],v={},l=0;l<this.faces.length;l++){var g=this.faces[l],x=!0,_=!1,y=void 0!==this.faceVertexUvs[0][l],M=g.normal.length()>0,b=g.vertexNormals.length>0,w=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,S=0;if(S=t(S,0,0),S=t(S,1,x),S=t(S,2,_),S=t(S,3,y),S=t(S,4,M),S=t(S,5,b),S=t(S,6,w),S=t(S,7,E),u.push(S),u.push(g.a,g.b,g.c),u.push(g.materialIndex),y){var T=this.faceVertexUvs[0][l];u.push(i(T[0]),i(T[1]),i(T[2]))}if(M&&u.push(e(g.normal)),b){var L=g.vertexNormals;u.push(e(L[0]),e(L[1]),e(L[2]))}if(w&&u.push(n(g.color)),E){var A=g.vertexColors;u.push(n(A[0]),n(A[1]),n(A[2]))}}return r.data={},r.data.vertices=s,r.data.normals=h,f.length>0&&(r.data.colors=f),m.length>0&&(r.data.uvs=[m]),r.data.faces=u,r},clone:function(){return(new i).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,n=0,i=e.length;n<i;n++)this.vertices.push(e[n].clone());for(var r=t.faces,n=0,i=r.length;n<i;n++)this.faces.push(r[n].clone());for(var n=0,i=t.faceVertexUvs.length;n<i;n++){var a=t.faceVertexUvs[n];void 0===this.faceVertexUvs[n]&&(this.faceVertexUvs[n]=[]);for(var o=0,s=a.length;o<s;o++){for(var l=a[o],c=[],u=0,h=l.length;u<h;u++){var d=l[u];c.push(d.clone())}this.faceVertexUvs[n].push(c)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var v=0;e.GeometryIdCount=r,e.Geometry=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s){this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new a.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=o&&o.isColor?o:new r.Color,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==s?s:0}Object.defineProperty(e,"__esModule",{value:!0}),e.Face3=void 0;var r=n(123),a=n(6);i.prototype={constructor:i,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},e.Face3=i},function(t,e,n){"use strict";function i(){function t(){f.setFromEuler(l,!1)}function e(){l.setFromQuaternion(f,void 0,!1)}Object.defineProperty(this,"id",{value:r()}),this.uuid=d._Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DefaultUp.clone();var n=new o.Vector3,l=new c.Euler,f=new a.Quaternion,p=new o.Vector3(1,1,1);l.onChange(t),f.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:l},quaternion:{enumerable:!0,value:f},scale:{enumerable:!0,value:p},modelViewMatrix:{value:new s.Matrix4},normalMatrix:{value:new h.Matrix3}}),this.matrix=new s.Matrix4,this.matrixWorld=new s.Matrix4,this.matrixAutoUpdate=i.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new u.Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function r(){return f++}Object.defineProperty(e,"__esModule",{value:!0}),e.Object3D=e.Object3DIdCount=void 0;var a=n(7),o=n(6),s=n(4),l=n(11),c=n(144),u=n(145),h=n(136),d=n(5);i.DefaultUp=new o.Vector3(0,1,0),i.DefaultMatrixAutoUpdate=!0,Object.assign(i.prototype,l.EventDispatcher.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new a.Quaternion;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new o.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new o.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new o.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new o.Vector3;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new o.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new o.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new o.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new s.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new s.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var n=this.children.indexOf(t);n!==-1&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(n,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n],a=r.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){var e=t||new o.Vector3;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new o.Vector3,e=new o.Vector3;return function(n){var i=n||new a.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,i,e),i}}(),getWorldRotation:function(){var t=new a.Quaternion;return function(e){var n=e||new c.Euler;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new o.Vector3,e=new a.Quaternion;return function(n){var i=n||new o.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,i),i}}(),getWorldDirection:function(){var t=new a.Quaternion;return function(e){var n=e||new o.Vector3;return this.getWorldQuaternion(t),n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(this.visible!==!1){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate===!0&&this.updateMatrix(),this.matrixWorldNeedsUpdate!==!0&&t!==!0||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}var n=void 0===t||""===t,i={};n&&(t={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),r.material=this.material.uuid),this.children.length>0){r.children=[];for(var a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(t).object)}if(n){var o=e(t.geometries),s=e(t.materials),l=e(t.textures),c=e(t.images);o.length>0&&(i.geometries=o),s.length>0&&(i.materials=s),l.length>0&&(i.textures=l),c.length>0&&(i.images=c)}return i.object=r,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var n=0;n<t.children.length;n++){var i=t.children[n];this.add(i.clone())}return this}});var f=0;e.Object3DIdCount=r,e.Object3D=i},function(t,e,n){"use strict";function i(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||i.DefaultOrder}Object.defineProperty(e,"__esModule",{value:!0}),e.Euler=void 0;var r=n(7),a=n(6),o=n(4),s=n(5);i.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],i.DefaultOrder="XYZ",i.prototype={constructor:i,isEuler:!0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var i=s._Math.clamp,r=t.elements,a=r[0],o=r[4],l=r[8],c=r[1],u=r[5],h=r[9],d=r[2],f=r[6],p=r[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(l,p),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-d,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(f,-1,1)),Math.abs(f)<.99999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-i(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(f,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,u))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,u),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(l,p))):"XZY"===e?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(f,u),this._y=Math.atan2(l,a)):(this._x=Math.atan2(-h,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,n,i){return void 0===t&&(t=new o.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new r.Quaternion;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new a.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},e.Euler=i},function(t,e){"use strict";function n(){this.mask=1}Object.defineProperty(e,"__esModule",{value:!0}),n.prototype={constructor:n,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}},e.Layers=n},function(t,e,n){"use strict";function i(t,e){c.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new p.BufferGeometry,this.material=void 0!==e?e:new f.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=d.TrianglesDrawMode,this.updateMorphTargets()}Object.defineProperty(e,"__esModule",{value:!0}),e.Mesh=void 0;var r=n(6),a=n(12),o=n(133),s=n(147),l=n(4),c=n(143),u=n(148),h=n(142),d=n(3),f=n(150),p=n(138);i.prototype=Object.assign(Object.create(c.Object3D.prototype),{constructor:i,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return c.Object3D.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},getMorphTargetIndexByName:function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},raycast:function(){function t(t,e,n,i,r,a,o){return u.Triangle.barycoordFromPoint(t,e,n,i,w),r.multiplyScalar(w.x),a.multiplyScalar(w.y),o.multiplyScalar(w.z),r.add(a).add(o),r.clone()}function e(t,e,n,i,r,a,o){var s,l=t.material;if(s=l.side===d.BackSide?n.intersectTriangle(a,r,i,!0,o):n.intersectTriangle(i,r,a,l.side!==d.DoubleSide,o),null===s)return null;S.copy(o),S.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(S);return c<e.near||c>e.far?null:{distance:c,point:S.clone(),object:t}}function n(n,i,r,a,o,s,l,c){p.fromArray(a,3*s),m.fromArray(a,3*l),v.fromArray(a,3*c);var d=e(n,i,r,p,m,v,E);return d&&(o&&(y.fromArray(o,2*s),M.fromArray(o,2*l),b.fromArray(o,2*c),d.uv=t(E,p,m,v,y,M,b)),d.face=new h.Face3(s,l,c,u.Triangle.normal(p,m,v)),d.faceIndex=s),d}var i=new l.Matrix4,c=new s.Ray,f=new o.Sphere,p=new r.Vector3,m=new r.Vector3,v=new r.Vector3,g=new r.Vector3,x=new r.Vector3,_=new r.Vector3,y=new a.Vector2,M=new a.Vector2,b=new a.Vector2,w=new r.Vector3,E=new r.Vector3,S=new r.Vector3;return function(r,a){var o=this.geometry,s=this.material,l=this.matrixWorld;if(void 0!==s&&(null===o.boundingSphere&&o.computeBoundingSphere(),f.copy(o.boundingSphere),f.applyMatrix4(l),r.ray.intersectsSphere(f)!==!1&&(i.getInverse(l),c.copy(r.ray).applyMatrix4(i),null===o.boundingBox||c.intersectsBox(o.boundingBox)!==!1))){var u,h;if(o&&o.isBufferGeometry){var d,w,S,T=o.index,L=o.attributes,A=L.position.array;if(void 0!==L.uv&&(u=L.uv.array),null!==T)for(var P=T.array,R=0,C=P.length;R<C;R+=3)d=P[R],w=P[R+1],S=P[R+2],h=n(this,r,c,A,u,d,w,S),h&&(h.faceIndex=Math.floor(R/3),a.push(h));else for(var R=0,C=A.length;R<C;R+=9)d=R/3,w=d+1,S=d+2,h=n(this,r,c,A,u,d,w,S),h&&(h.index=d,a.push(h))}else if(o&&o.isGeometry){var D,U,N,F=s&&s.isMultiMaterial,I=F===!0?s.materials:null,O=o.vertices,B=o.faces,V=o.faceVertexUvs[0];V.length>0&&(u=V);for(var G=0,z=B.length;G<z;G++){var k=B[G],H=F===!0?I[k.materialIndex]:s;if(void 0!==H){if(D=O[k.a],U=O[k.b],N=O[k.c],H.morphTargets===!0){var W=o.morphTargets,j=this.morphTargetInfluences;p.set(0,0,0),m.set(0,0,0),v.set(0,0,0);for(var X=0,q=W.length;X<q;X++){var Y=j[X];if(0!==Y){var Z=W[X].vertices;p.addScaledVector(g.subVectors(Z[k.a],D),Y),m.addScaledVector(x.subVectors(Z[k.b],U),Y),v.addScaledVector(_.subVectors(Z[k.c],N),Y)}}p.add(D),m.add(U),v.add(N),D=p,U=m,N=v}if(h=e(this,r,c,D,U,N,E)){if(u){var Q=u[G];y.copy(Q[0]),M.copy(Q[1]),b.copy(Q[2]),h.uv=t(E,D,U,N,y,M,b)}h.face=k,h.faceIndex=G,a.push(h)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),e.Mesh=i},function(t,e,n){"use strict";function i(t,e){this.origin=void 0!==t?t:new r.Vector3,this.direction=void 0!==e?e:new r.Vector3}Object.defineProperty(e,"__esModule",{value:!0}),e.Ray=void 0;var r=n(6);i.prototype={constructor:i,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){var n=e||new r.Vector3;return n.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new r.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new r.Vector3;n.subVectors(t,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new r.Vector3;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new r.Vector3,e=new r.Vector3,n=new r.Vector3;return function(i,r,a,o){t.copy(i).add(r).multiplyScalar(.5),e.copy(r).sub(i).normalize(),n.copy(this.origin).sub(t);var s,l,c,u,h=.5*i.distanceTo(r),d=-this.direction.dot(e),f=n.dot(this.direction),p=-n.dot(e),m=n.lengthSq(),v=Math.abs(1-d*d);if(v>0)if(s=d*p-f,l=d*f-p,u=h*v,s>=0)if(l>=-u)if(l<=u){var g=1/v;s*=g,l*=g,c=s*(s+d*l+2*f)+l*(d*s+l+2*p)+m}else l=h,s=Math.max(0,-(d*l+f)),c=-s*s+l*(l+2*p)+m;else l=-h,s=Math.max(0,-(d*l+f)),c=-s*s+l*(l+2*p)+m;else l<=-u?(s=Math.max(0,-(-d*h+f)),l=s>0?-h:Math.min(Math.max(-h,-p),h),c=-s*s+l*(l+2*p)+m):l<=u?(s=0,l=Math.min(Math.max(-h,-p),h),c=l*(l+2*p)+m):(s=Math.max(0,-(d*h+f)),l=s>0?h:Math.min(Math.max(-h,-p),h),c=-s*s+l*(l+2*p)+m);else l=d>0?-h:h,s=Math.max(0,-(d*l+f)),c=-s*s+l*(l+2*p)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(l).add(t),c}}(),intersectSphere:function(){var t=new r.Vector3;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=i-o,l=i+o;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var n=t.normal.dot(this.direction);return n*e<0},intersectBox:function(t,e){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,i=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,i=(t.min.x-h.x)*l),c>=0?(r=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(r=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),n>a||r>i?null:((r>n||n!==n)&&(n=r),(a<i||i!==i)&&(i=a),u>=0?(o=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||o>i?null:((o>n||n!==n)&&(n=o),(s<i||i!==i)&&(i=s),i<0?null:this.at(n>=0?n:i,e)))},intersectsBox:function(){var t=new r.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new r.Vector3,e=new r.Vector3,n=new r.Vector3,i=new r.Vector3;return function(r,a,o,s,l){e.subVectors(a,r),n.subVectors(o,r),i.crossVectors(e,n);var c,u=this.direction.dot(i);if(u>0){if(s)return null;c=1}else{if(!(u<0))return null;c=-1,u=-u}t.subVectors(this.origin,r);var h=c*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var d=c*this.direction.dot(e.cross(t));if(d<0)return null;if(h+d>u)return null;var f=-c*t.dot(i);return f<0?null:this.at(f/u,l)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},e.Ray=i},function(t,e,n){"use strict";function i(t,e,n){this.a=void 0!==t?t:new r.Vector3,this.b=void 0!==e?e:new r.Vector3,this.c=void 0!==n?n:new r.Vector3}Object.defineProperty(e,"__esModule",{value:!0}),e.Triangle=void 0;var r=n(6),a=n(149),o=n(135);i.normal=function(){var t=new r.Vector3;return function(e,n,i,a){var o=a||new r.Vector3;o.subVectors(i,n),t.subVectors(e,n),o.cross(t);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),i.barycoordFromPoint=function(){var t=new r.Vector3,e=new r.Vector3,n=new r.Vector3;return function(i,a,o,s,l){t.subVectors(s,a),e.subVectors(o,a),n.subVectors(i,a);var c=t.dot(t),u=t.dot(e),h=t.dot(n),d=e.dot(e),f=e.dot(n),p=c*d-u*u,m=l||new r.Vector3;if(0===p)return m.set(-2,-1,-1);var v=1/p,g=(d*h-u*f)*v,x=(c*f-u*h)*v;return m.set(1-g-x,x,g)}}(),i.containsPoint=function(){var t=new r.Vector3;return function(e,n,r,a){var o=i.barycoordFromPoint(e,n,r,a,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),i.prototype={constructor:i,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new r.Vector3,e=new r.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new r.Vector3;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return i.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new o.Plane;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return i.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return i.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,n,i;return function(s,l){void 0===t&&(t=new o.Plane,e=[new a.Line3,new a.Line3,new a.Line3],n=new r.Vector3,i=new r.Vector3);var c=l||new r.Vector3,u=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(s,n),this.containsPoint(n)===!0)c.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var h=0;h<e.length;h++){e[h].closestPointToPoint(n,!0,i);var d=n.distanceToSquared(i);d<u&&(u=d,c.copy(i))}}return c}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},e.Triangle=i},function(t,e,n){"use strict";function i(t,e){this.start=void 0!==t?t:new r.Vector3,this.end=void 0!==e?e:new r.Vector3}Object.defineProperty(e,"__esModule",{value:!0}),e.Line3=void 0;var r=n(6),a=n(5);i.prototype={constructor:i,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new r.Vector3;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new r.Vector3;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var n=e||new r.Vector3;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new r.Vector3,e=new r.Vector3;return function(n,i){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),s=o/r;return i&&(s=a._Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e),a=n||new r.Vector3;return this.delta(a).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},e.Line3=i},function(t,e,n){"use strict";function i(t){r.Material.call(this),this.type="MeshBasicMaterial",this.color=new o.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.MeshBasicMaterial=void 0;var r=n(130),a=n(3),o=n(123);i.prototype=Object.create(r.Material.prototype),i.prototype.constructor=i,i.prototype.isMeshBasicMaterial=!0,i.prototype.copy=function(t){return r.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},e.MeshBasicMaterial=i},function(t,e,n){"use strict";function i(t,e,n,i){r.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};for(var o=t/2,s=e/2,l=Math.floor(n)||1,c=Math.floor(i)||1,u=l+1,h=c+1,d=t/l,f=e/c,p=new Float32Array(u*h*3),m=new Float32Array(u*h*3),v=new Float32Array(u*h*2),g=0,x=0,_=0;_<h;_++)for(var y=_*f-s,M=0;M<u;M++){var b=M*d-o;p[g]=b,p[g+1]=-y,m[g+2]=1,v[x]=M/l,v[x+1]=1-_/c,g+=3,x+=2}g=0;for(var w=new(p.length/3>65535?Uint32Array:Uint16Array)(l*c*6),_=0;_<c;_++)for(var M=0;M<l;M++){var E=M+u*_,S=M+u*(_+1),T=M+1+u*(_+1),L=M+1+u*_;w[g]=E,w[g+1]=S,w[g+2]=L,w[g+3]=S,w[g+4]=T,w[g+5]=L,g+=6}this.setIndex(new a.BufferAttribute(w,1)),this.addAttribute("position",new a.BufferAttribute(p,3)),this.addAttribute("normal",new a.BufferAttribute(m,3)),this.addAttribute("uv",new a.BufferAttribute(v,2))}Object.defineProperty(e,"__esModule",{value:!0}),e.PlaneBufferGeometry=void 0;var r=n(138),a=n(139);i.prototype=Object.create(r.BufferGeometry.prototype),i.prototype.constructor=i,e.PlaneBufferGeometry=i},function(t,e,n){"use strict";function i(t,e,n,i){r.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Object.defineProperty(e,"__esModule",{value:!0}),e.PerspectiveCamera=void 0;var r=n(153),a=n(143),o=n(5);i.prototype=Object.assign(Object.create(r.Camera.prototype),{constructor:i,isPerspectiveCamera:!0,copy:function(t){return r.Camera.prototype.copy.call(this,t),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*o._Math.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*o._Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*o._Math.RAD2DEG*Math.atan(Math.tan(.5*o._Math.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*o._Math.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==a){var s=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/s,e-=a.offsetY*n/l,i*=a.width/s,n*=a.height/l}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makeFrustum(r,r+i,e-n,e,t,this.far)},toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),e.PerspectiveCamera=i},function(t,e,n){"use strict";function i(){o.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new r.Matrix4,this.projectionMatrix=new r.Matrix4}Object.defineProperty(e,"__esModule",{value:!0}),e.Camera=void 0;var r=n(4),a=n(7),o=n(143),s=n(6);i.prototype=Object.create(o.Object3D.prototype),i.prototype.constructor=i,i.prototype.isCamera=!0,i.prototype.getWorldDirection=function(){var t=new a.Quaternion;return function(e){var n=e||new s.Vector3;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),i.prototype.lookAt=function(){var t=new r.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),i.prototype.clone=function(){return(new this.constructor).copy(this)},i.prototype.copy=function(t){return o.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},e.Camera=i},function(t,e,n){"use strict";function i(t,e,n,i,a,o){r.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=void 0!==a?a:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}Object.defineProperty(e,"__esModule",{value:!0}),e.OrthographicCamera=void 0;var r=n(153),a=n(143);i.prototype=Object.assign(Object.create(r.Camera.prototype),{constructor:i,isOrthographicCamera:!0,copy:function(t){return r.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,a){this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,
|
||
height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-t,a=n+t,o=i+e,s=i-e;if(null!==this.view){var l=this.zoom/(this.view.width/this.view.fullWidth),c=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;r+=u*(this.view.offsetX/l),a=r+u*(this.view.width/l),o-=h*(this.view.offsetY/c),s=o-h*(this.view.height/c)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),e.OrthographicCamera=i},function(t,e){"use strict";function n(t,e,n){function i(t){s=t}function r(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(l=t.UNSIGNED_INT,c=4):(l=t.UNSIGNED_SHORT,c=2)}function a(e,i){t.drawElements(s,i,l,e*c),n.calls++,n.vertices+=i,s===t.TRIANGLES&&(n.faces+=i/3)}function o(i,r,a){var o=e.get("ANGLE_instanced_arrays");return null===o?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(o.drawElementsInstancedANGLE(s,a,l,r*c,i.maxInstancedCount),n.calls++,n.vertices+=a*i.maxInstancedCount,void(s===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*a/3)))}var s,l,c;return{setMode:i,setIndex:r,render:a,renderInstances:o}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLIndexedBufferRenderer=n},function(t,e){"use strict";function n(t,e,n){function i(t){o=t}function r(e,i){t.drawArrays(o,e,i),n.calls++,n.vertices+=i,o===t.TRIANGLES&&(n.faces+=i/3)}function a(i){var r=e.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var a=i.attributes.position,s=0;a&&a.isInterleavedBufferAttribute?(s=a.data.count,r.drawArraysInstancedANGLE(o,0,s,i.maxInstancedCount)):(s=a.count,r.drawArraysInstancedANGLE(o,0,s,i.maxInstancedCount)),n.calls++,n.vertices+=s*i.maxInstancedCount,o===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*s/3)}var o;return{setMode:i,render:r,renderInstances:a}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLBufferRenderer=n},function(t,e,n){"use strict";function i(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new a.Vector3,color:new r.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new o.Vector2};break;case"SpotLight":n={position:new a.Vector3,direction:new a.Vector3,color:new r.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new o.Vector2};break;case"PointLight":n={position:new a.Vector3,color:new r.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new o.Vector2};break;case"HemisphereLight":n={direction:new a.Vector3,skyColor:new r.Color,groundColor:new r.Color}}return t[e.id]=n,n}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLLights=void 0;var r=n(123),a=n(6),o=n(12);e.WebGLLights=i},function(t,e,n){"use strict";function i(t,e){function n(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=e.maxVertexUniforms,i=Math.floor((n-20)/4),r=i;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+r+" (try OpenGL instead of ANGLE)")),r}function i(t,e){var n;return t?t&&t.isTexture?n=t.encoding:t&&t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=a.LinearEncoding,n===a.LinearEncoding&&e&&(n=a.GammaEncoding),n}var o=[],s={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},l=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","depthPacking"];this.getParameters=function(r,o,l,c,u){var h=s[r.type],d=n(u),f=t.getPrecision();null!==r.precision&&(f=e.getMaxPrecision(r.precision),f!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",f,"instead."));var p=t.getCurrentRenderTarget(),m={shaderID:h,precision:f,supportsVertexTextures:e.vertexTextures,outputEncoding:i(p?p.texture:null,t.gammaOutput),map:!!r.map,mapEncoding:i(r.map,t.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:i(r.envMap,t.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===a.CubeUVReflectionMapping||r.envMap.mapping===a.CubeUVRefractionMapping),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:i(r.emissiveMap,t.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!l,useFog:r.fog,fogExp:l&&l.isFogExp2,flatShading:r.shading===a.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:d,useVertexTexture:e.floatVertexTextures&&u&&u.skeleton&&u.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numHemiLights:o.hemi.length,numClippingPlanes:c,shadowMapEnabled:t.shadowMap.enabled&&u.receiveShadow&&o.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===a.DoubleSide,flipSided:r.side===a.BackSide,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return m},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);for(var r=0;r<l.length;r++)n.push(e[l[r]]);return n.join()},this.acquireProgram=function(e,n,i){for(var a,s=0,l=o.length;s<l;s++){var c=o[s];if(c.code===i){a=c,++a.usedTimes;break}}return void 0===a&&(a=new r.WebGLProgram(t,i,e,n),o.push(a)),a},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},this.programs=o}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLPrograms=void 0;var r=n(159),a=n(3);e.WebGLPrograms=i},function(t,e,n){"use strict";function i(t){switch(t){case x.LinearEncoding:return["Linear","( value )"];case x.sRGBEncoding:return["sRGB","( value )"];case x.RGBEEncoding:return["RGBE","( value )"];case x.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case x.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case x.RGBDEncoding:return["RGBD","( value, 256.0 )"];case x.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function r(t,e){var n=i(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function a(t,e){var n=i(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function o(t,e){var n;switch(e){case x.LinearToneMapping:n="Linear";break;case x.ReinhardToneMapping:n="Reinhard";break;case x.Uncharted2ToneMapping:n="Uncharted2";break;case x.CineonToneMapping:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function s(t,e,n){t=t||{};var i=[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return i.filter(u).join("\n")}function l(t){var e=[];for(var n in t){var i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join("\n")}function c(t,e,n){for(var i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),a=0;a<r;a++){var o=t.getActiveAttrib(e,a),s=o.name;i[s]=t.getAttribLocation(e,s)}return i}function u(t){return""!==t}function h(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function d(t){function e(t,e){var n=g.ShaderChunk[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return d(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function f(t){function e(t,e,n,i){for(var r="",a=parseInt(e);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]");return r}var n=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(n,e)}function p(t,e,n,i){var p=t.context,y=n.extensions,M=n.defines,b=n.__webglShader.vertexShader,w=n.__webglShader.fragmentShader,E="SHADOWMAP_TYPE_BASIC";i.shadowMapType===x.PCFShadowMap?E="SHADOWMAP_TYPE_PCF":i.shadowMapType===x.PCFSoftShadowMap&&(E="SHADOWMAP_TYPE_PCF_SOFT");var S="ENVMAP_TYPE_CUBE",T="ENVMAP_MODE_REFLECTION",L="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(n.envMap.mapping){case x.CubeReflectionMapping:case x.CubeRefractionMapping:S="ENVMAP_TYPE_CUBE";break;case x.CubeUVReflectionMapping:case x.CubeUVRefractionMapping:S="ENVMAP_TYPE_CUBE_UV";break;case x.EquirectangularReflectionMapping:case x.EquirectangularRefractionMapping:S="ENVMAP_TYPE_EQUIREC";break;case x.SphericalReflectionMapping:S="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case x.CubeRefractionMapping:case x.EquirectangularRefractionMapping:T="ENVMAP_MODE_REFRACTION"}switch(n.combine){case x.MultiplyOperation:L="ENVMAP_BLENDING_MULTIPLY";break;case x.MixOperation:L="ENVMAP_BLENDING_MIX";break;case x.AddOperation:L="ENVMAP_BLENDING_ADD"}}var A,P,R=t.gammaFactor>0?t.gammaFactor:1,C=s(y,i,t.extensions),D=l(M),U=p.createProgram();n.isRawShaderMaterial?(A=[D,"\n"].filter(u).join("\n"),P=[C,D,"\n"].filter(u).join("\n")):(A=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,D,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+R,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+T:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+E:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(u).join("\n"),P=[C,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,D,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+R,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+S:"",i.envMap?"#define "+T:"",i.envMap?"#define "+L:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+E:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==x.NoToneMapping?"#define TONE_MAPPING":"",i.toneMapping!==x.NoToneMapping?g.ShaderChunk.tonemapping_pars_fragment:"",i.toneMapping!==x.NoToneMapping?o("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?g.ShaderChunk.encodings_pars_fragment:"",i.mapEncoding?r("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?r("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?r("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?a("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(u).join("\n")),b=d(b,i),b=h(b,i),w=d(w,i),w=h(w,i),n.isShaderMaterial||(b=f(b),w=f(w));var N=A+b,F=P+w,I=(0,v.WebGLShader)(p,p.VERTEX_SHADER,N),O=(0,v.WebGLShader)(p,p.FRAGMENT_SHADER,F);p.attachShader(U,I),p.attachShader(U,O),void 0!==n.index0AttributeName?p.bindAttribLocation(U,0,n.index0AttributeName):i.morphTargets===!0&&p.bindAttribLocation(U,0,"position"),p.linkProgram(U);var B=p.getProgramInfoLog(U),V=p.getShaderInfoLog(I),G=p.getShaderInfoLog(O),z=!0,k=!0;p.getProgramParameter(U,p.LINK_STATUS)===!1?(z=!1,console.error("THREE.WebGLProgram: shader error: ",p.getError(),"gl.VALIDATE_STATUS",p.getProgramParameter(U,p.VALIDATE_STATUS),"gl.getProgramInfoLog",B,V,G)):""!==B?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",B):""!==V&&""!==G||(k=!1),k&&(this.diagnostics={runnable:z,material:n,programLog:B,vertexShader:{log:V,prefix:A},fragmentShader:{log:G,prefix:P}}),p.deleteShader(I),p.deleteShader(O);var H;this.getUniforms=function(){return void 0===H&&(H=new m.WebGLUniforms(p,U,t)),H};var W;return this.getAttributes=function(){return void 0===W&&(W=c(p,U)),W},this.destroy=function(){p.deleteProgram(U),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=_++,this.code=e,this.usedTimes=1,this.program=U,this.vertexShader=I,this.fragmentShader=O,this}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLProgram=void 0;var m=n(8),v=n(160),g=n(15),x=n(3),_=0;e.WebGLProgram=p},function(t,e){"use strict";function n(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function i(t,e,i){var r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(r),n(i)),r}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLShader=i},function(t,e,n){"use strict";function i(t,e,n){function i(e){var n=d.get(e);e.geometry.isGeometry&&n.updateFromObject(e);var i=n.index,r=n.attributes;null!==i&&o(i,t.ELEMENT_ARRAY_BUFFER);for(var a in r)o(r[a],t.ARRAY_BUFFER);var s=n.morphAttributes;for(var a in s)for(var l=s[a],c=0,u=l.length;c<u;c++)o(l[c],t.ARRAY_BUFFER);return n}function o(t,n){var i=t.isInterleavedBufferAttribute?t.data:t,r=e.get(i);void 0===r.__webglBuffer?s(r,i,n):r.version!==i.version&&l(r,i,n)}function s(e,n,i){e.__webglBuffer=t.createBuffer(),t.bindBuffer(i,e.__webglBuffer);var r=n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW;t.bufferData(i,n.array,r),e.version=n.version}function l(e,n,i){t.bindBuffer(i,e.__webglBuffer),n.dynamic===!1||n.updateRange.count===-1?t.bufferSubData(i,0,n.array):0===n.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),e.version=n.version}function c(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function u(n){var i=e.get(n);if(void 0!==i.wireframe)return i.wireframe;var a=[],s=n.index,l=n.attributes,c=l.position;if(null!==s)for(var u={},d=s.array,f=0,p=d.length;f<p;f+=3){var m=d[f+0],v=d[f+1],g=d[f+2];h(u,m,v)&&a.push(m,v),h(u,v,g)&&a.push(v,g),h(u,g,m)&&a.push(g,m)}else for(var d=l.position.array,f=0,p=d.length/3-1;f<p;f+=3){var m=f+0,v=f+1,g=f+2;a.push(m,v,v,g,g,m)}var x=c.count>65535?Uint32Array:Uint16Array,_=new r.BufferAttribute(new x(a),1);return o(_,t.ELEMENT_ARRAY_BUFFER),i.wireframe=_,_}function h(t,e,n){if(e>n){var i=e;e=n,n=i}var r=t[e];return void 0===r?(t[e]=[n],!0):r.indexOf(n)===-1&&(r.push(n),!0)}var d=new a.WebGLGeometries(t,e,n);return{getAttributeBuffer:c,getWireframeAttribute:u,update:i}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLObjects=void 0;var r=n(139),a=n(162);e.WebGLObjects=i},function(t,e,n){"use strict";function i(t,e,n){function i(t){var r=t.target,a=c[r.id];null!==a.index&&o(a.index),s(a.attributes),r.removeEventListener("dispose",i),delete c[r.id];var l=e.get(r);l.wireframe&&o(l.wireframe),e["delete"](r);var u=e.get(a);u.wireframe&&o(u.wireframe),e["delete"](a),n.memory.geometries--}function a(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function o(e){var n=a(e);void 0!==n&&(t.deleteBuffer(n),l(e))}function s(t){for(var e in t)o(t[e])}function l(t){t.isInterleavedBufferAttribute?e["delete"](t.data):e["delete"](t)}var c={};return{get:function(t){var e=t.geometry;if(void 0!==c[e.id])return c[e.id];e.addEventListener("dispose",i);var a;return e.isBufferGeometry?a=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new r.BufferGeometry).setFromObject(t)),a=e._bufferGeometry),c[e.id]=a,n.memory.geometries++,a}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLGeometries=void 0;var r=n(138);e.WebGLGeometries=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s,l){function c(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n);var r=i.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function u(t){return a._Math.isPowerOfTwo(t.width)&&a._Math.isPowerOfTwo(t.height)}function h(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=a._Math.nearestPowerOfTwo(t.width),e.height=a._Math.nearestPowerOfTwo(t.height);var n=e.getContext("2d");return n.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function d(t){return t.wrapS!==r.ClampToEdgeWrapping||t.wrapT!==r.ClampToEdgeWrapping||t.minFilter!==r.NearestFilter&&t.minFilter!==r.LinearFilter}function f(e){return e===r.NearestFilter||e===r.NearestMipMapNearestFilter||e===r.NearestMipMapLinearFilter?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),v(e),P.textures--}function m(t){var e=t.target;e.removeEventListener("dispose",m),g(e),P.textures--}function v(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i["delete"](e)}function g(e){var n=i.get(e),r=i.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[a]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i["delete"](e.texture),i["delete"](e)}}function x(e,r){var a=i.get(e);if(e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(o.complete!==!1)return void b(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function _(e,a){var l=i.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",p),l.__image__webglTextureCube=t.createTexture(),P.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,d=e.image[0]&&e.image[0].isDataTexture,f=[],m=0;m<6;m++)h||d?f[m]=d?e.image[m].image:e.image[m]:f[m]=c(e.image[m],o.maxCubemapSize);var v=f[0],g=u(v),x=s(e.format),_=s(e.type);M(t.TEXTURE_CUBE_MAP,e,g);for(var m=0;m<6;m++)if(h)for(var y,b=f[m].mipmaps,w=0,E=b.length;w<E;w++)y=b[w],e.format!==r.RGBAFormat&&e.format!==r.RGBFormat?n.getCompressedTextureFormats().indexOf(x)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,x,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,x,y.width,y.height,0,x,_,y.data);else d?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,x,f[m].width,f[m].height,0,x,_,f[m].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,x,x,_,f[m]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function y(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)}function M(n,a,l){var c;if(l?(t.texParameteri(n,t.TEXTURE_WRAP_S,s(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,s(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,s(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,s(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===r.ClampToEdgeWrapping&&a.wrapT===r.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,f(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,f(a.minFilter)),a.minFilter!==r.NearestFilter&&a.minFilter!==r.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===r.FloatType&&null===e.get("OES_texture_float_linear"))return;if(a.type===r.HalfFloatType&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,o.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,i,a){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),P.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var l=c(i.image,o.maxTextureSize);d(i)&&u(l)===!1&&(l=h(l));var f=u(l),m=s(i.format),v=s(i.type);M(t.TEXTURE_2D,i,f);var g,x=i.mipmaps;if(i&&i.isDepthTexture){var _=t.DEPTH_COMPONENT;if(i.type===r.FloatType){if(!R)throw new Error("Float Depth Texture only supported in WebGL2.0");_=t.DEPTH_COMPONENT32F}else R&&(_=t.DEPTH_COMPONENT16);i.format===r.DepthStencilFormat&&(_=t.DEPTH_STENCIL),n.texImage2D(t.TEXTURE_2D,0,_,l.width,l.height,0,m,v,null)}else if(i&&i.isDataTexture)if(x.length>0&&f){for(var y=0,b=x.length;y<b;y++)g=x[y],n.texImage2D(t.TEXTURE_2D,y,m,g.width,g.height,0,m,v,g.data);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,l.width,l.height,0,m,v,l.data);else if(i&&i.isCompressedTexture)for(var y=0,b=x.length;y<b;y++)g=x[y],i.format!==r.RGBAFormat&&i.format!==r.RGBFormat?n.getCompressedTextureFormats().indexOf(m)>-1?n.compressedTexImage2D(t.TEXTURE_2D,y,m,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,y,m,g.width,g.height,0,m,v,g.data);else if(x.length>0&&f){for(var y=0,b=x.length;y<b;y++)g=x[y],n.texImage2D(t.TEXTURE_2D,y,m,m,v,g);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,m,v,l);i.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function w(e,r,a,o){var l=s(r.texture.format),c=s(r.texture.type);n.texImage2D(o,0,l,r.width,r.height,0,l,c,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,o,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function E(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function S(e,n){var a=n&&n.isWebGLRenderTargetCube;if(a)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),x(n.depthTexture,0);var o=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===r.DepthFormat)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(n.depthTexture.format!==r.DepthStencilFormat)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function T(e){var n=i.get(e),r=e&&e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");S(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=t.createRenderbuffer(),E(n.__webglDepthbuffer[a],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),E(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function L(e){var r=i.get(e),a=i.get(e.texture);e.addEventListener("dispose",m),a.__webglTexture=t.createTexture(),P.textures++;var o=e&&e.isWebGLRenderTargetCube,s=u(e);if(o){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(o){n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture),M(t.TEXTURE_CUBE_MAP,e.texture,s);for(var l=0;l<6;l++)w(r.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,a.__webglTexture),M(t.TEXTURE_2D,e.texture,s),w(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&T(e)}function A(e){var a=e.texture;if(a.generateMipmaps&&u(e)&&a.minFilter!==r.NearestFilter&&a.minFilter!==r.LinearFilter){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,s=i.get(a).__webglTexture;n.bindTexture(o,s),t.generateMipmap(o),n.bindTexture(o,null)}}var P=l.memory,R="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=x,this.setTextureCube=_,this.setTextureCubeDynamic=y,this.setupRenderTarget=L,this.updateRenderTargetMipmap=A}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLTextures=void 0;var r=n(3),a=n(5);e.WebGLTextures=i},function(t,e){"use strict";function n(){var t={};return{get:function(e){
|
||
var n=e.uuid,i=t[n];return void 0===i&&(i={},t[n]=i),i},"delete":function(e){delete t[e.uuid]},clear:function(){t={}}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLProperties=n},function(t,e,n){"use strict";function i(t,e,n){function i(){var e=!1,n=new a.Vector4,i=null,r=new a.Vector4;return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,o){n.set(e,i,a,o),r.equals(n)===!1&&(t.clearColor(e,i,a,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(0,0,0,1)}}}function o(){var e=!1,n=null,i=null,a=null;return{setTest:function(e){e?p(t.DEPTH_TEST):m(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case r.NeverDepth:t.depthFunc(t.NEVER);break;case r.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case r.LessDepth:t.depthFunc(t.LESS);break;case r.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case r.EqualDepth:t.depthFunc(t.EQUAL);break;case r.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case r.GreaterDepth:t.depthFunc(t.GREATER);break;case r.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){a!==e&&(t.clearDepth(e),a=e)},reset:function(){e=!1,n=null,i=null,a=null}}}function s(){var e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){e?p(t.STENCIL_TEST):m(t.STENCIL_TEST)},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&a===o||(t.stencilFunc(e,n,o),i=e,r=n,a=o)},setOp:function(e,n,i){o===e&&s===n&&l===i||(t.stencilOp(e,n,i),o=e,s=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}}function l(e,n,i){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var o=0;o<i;o++)t.texImage2D(n+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}function c(){I(0,0,0,1),O(1),B(0),p(t.DEPTH_TEST),M(r.LessEqualDepth),T(!1),L(r.CullFaceBack),p(t.CULL_FACE),p(t.BLEND),g(r.NormalBlending)}function u(){for(var t=0,e=X.length;t<e;t++)X[t]=0}function h(n){if(X[n]=1,0===q[n]&&(t.enableVertexAttribArray(n),q[n]=1),0!==Y[n]){var i=e.get("ANGLE_instanced_arrays");i.vertexAttribDivisorANGLE(n,0),Y[n]=0}}function d(e,n,i){X[e]=1,0===q[e]&&(t.enableVertexAttribArray(e),q[e]=1),Y[e]!==n&&(i.vertexAttribDivisorANGLE(e,n),Y[e]=n)}function f(){for(var e=0,n=q.length;e!==n;++e)q[e]!==X[e]&&(t.disableVertexAttribArray(e),q[e]=0)}function p(e){Z[e]!==!0&&(t.enable(e),Z[e]=!0)}function m(e){Z[e]!==!1&&(t.disable(e),Z[e]=!1)}function v(){if(null===Q&&(Q=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<n.length;i++)Q.push(n[i]);return Q}function g(e,i,a,o,s,l,c,u){return e===r.NoBlending?(m(t.BLEND),void(J=e)):(p(t.BLEND),e===J&&u===rt||(e===r.AdditiveBlending?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===r.SubtractiveBlending?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===r.MultiplyBlending?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),J=e,rt=u),void(e===r.CustomBlending?(s=s||i,l=l||a,c=c||o,i===K&&s===et||(t.blendEquationSeparate(n(i),n(s)),K=i,et=s),a===$&&o===tt&&l===nt&&c===it||(t.blendFuncSeparate(n(a),n(o),n(l),n(c)),$=a,tt=o,nt=l,it=c)):(K=null,$=null,tt=null,et=null,nt=null,it=null)))}function x(t){k.setMask(t)}function _(t){H.setTest(t)}function y(t){H.setMask(t)}function M(t){H.setFunc(t)}function b(t){W.setTest(t)}function w(t){W.setMask(t)}function E(t,e,n){W.setFunc(t,e,n)}function S(t,e,n){W.setOp(t,e,n)}function T(e){at!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),at=e)}function L(e){e!==r.CullFaceNone?(p(t.CULL_FACE),e!==ot&&(e===r.CullFaceBack?t.cullFace(t.BACK):e===r.CullFaceFront?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):m(t.CULL_FACE),ot=e}function A(e){e!==st&&(t.lineWidth(e),st=e)}function P(e,n,i){e?(p(t.POLYGON_OFFSET_FILL),lt===n&&ct===i||(t.polygonOffset(n,i),lt=n,ct=i)):m(t.POLYGON_OFFSET_FILL)}function R(){return ut}function C(e){ut=e,e?p(t.SCISSOR_TEST):m(t.SCISSOR_TEST)}function D(e){void 0===e&&(e=t.TEXTURE0+ht-1),dt!==e&&(t.activeTexture(e),dt=e)}function U(e,n){null===dt&&D();var i=ft[dt];void 0===i&&(i={type:void 0,texture:void 0},ft[dt]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||vt[e]),i.type=e,i.texture=n)}function N(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){console.error(e)}}function F(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error(e)}}function I(t,e,n,i){k.setClear(t,e,n,i)}function O(t){H.setClear(t)}function B(t){W.setClear(t)}function V(e){pt.equals(e)===!1&&(t.scissor(e.x,e.y,e.z,e.w),pt.copy(e))}function G(e){mt.equals(e)===!1&&(t.viewport(e.x,e.y,e.z,e.w),mt.copy(e))}function z(){for(var e=0;e<q.length;e++)1===q[e]&&(t.disableVertexAttribArray(e),q[e]=0);Z={},Q=null,dt=null,ft={},J=null,at=null,ot=null,k.reset(),H.reset(),W.reset()}var k=new i,H=new o,W=new s,j=t.getParameter(t.MAX_VERTEX_ATTRIBS),X=new Uint8Array(j),q=new Uint8Array(j),Y=new Uint8Array(j),Z={},Q=null,J=null,K=null,$=null,tt=null,et=null,nt=null,it=null,rt=!1,at=null,ot=null,st=null,lt=null,ct=null,ut=null,ht=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),dt=null,ft={},pt=new a.Vector4,mt=new a.Vector4,vt={};return vt[t.TEXTURE_2D]=l(t.TEXTURE_2D,t.TEXTURE_2D,1),vt[t.TEXTURE_CUBE_MAP]=l(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:k,depth:H,stencil:W},init:c,initAttributes:u,enableAttribute:h,enableAttributeAndDivisor:d,disableUnusedAttributes:f,enable:p,disable:m,getCompressedTextureFormats:v,setBlending:g,setColorWrite:x,setDepthTest:_,setDepthWrite:y,setDepthFunc:M,setStencilTest:b,setStencilWrite:w,setStencilFunc:E,setStencilOp:S,setFlipSided:T,setCullFace:L,setLineWidth:A,setPolygonOffset:P,getScissorTest:R,setScissorTest:C,activeTexture:D,bindTexture:U,compressedTexImage2D:N,texImage2D:F,clearColor:I,clearDepth:O,clearStencil:B,scissor:V,viewport:G,reset:z}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLState=void 0;var r=n(3),a=n(122);e.WebGLState=i},function(t,e){"use strict";function n(t,e,n){function i(){if(void 0!==a)return a;var n=e.get("EXT_texture_filter_anisotropic");return a=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=n.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=u>0,x=!!e.get("OES_texture_float"),_=g&&x;return{getMaxAnisotropy:i,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:x,floatVertexTextures:_}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLCapabilities=n},function(t,e){"use strict";function n(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i,i}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLExtensions=n},function(t,e,n){"use strict";function i(){function t(){h.value!==i&&(h.value=i,h.needsUpdate=o>0),n.numPlanes=o}function e(t,e,i,r){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=h.value,r!==!0||null===o){var s=i+4*a,l=e.matrixWorldInverse;u.getNormalMatrix(l),(null===o||o.length<s)&&(o=new Float32Array(s));for(var d=0,f=i;d!==a;++d,f+=4)c.copy(t[d]).applyMatrix4(l,u),c.normal.toArray(o,f),o[f+3]=c.constant}h.value=o,h.needsUpdate=!0}return n.numPlanes=a,o}var n=this,i=null,o=0,s=!1,l=!1,c=new a.Plane,u=new r.Matrix3,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.init=function(t,n,r){var a=0!==t.length||n||0!==o||s;return s=n,i=e(t,r,0),o=t.length,a},this.beginShadows=function(){l=!0,e(null)},this.endShadows=function(){l=!1,t()},this.setState=function(n,r,a,c,u){if(!s||null===n||0===n.length||l&&!r)l?e(null):t();else{var d=l?0:o,f=4*d,p=c.clippingState||null;h.value=p,p=e(n,a,f,u);for(var m=0;m!==f;++m)p[m]=i[m];c.clippingState=p,this.numPlanes+=d}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLClipping=void 0;var r=n(136),a=n(135);e.WebGLClipping=i},function(t,e,n){"use strict";function i(t){this.manager=void 0!==t?t:s.DefaultLoadingManager}Object.defineProperty(e,"__esModule",{value:!0}),e.TextureLoader=void 0;var r=n(3),a=n(170),o=n(10),s=n(173);Object.assign(i.prototype,{load:function(t,e,n,i){var s=new o.Texture,l=new a.ImageLoader(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setWithCredentials(this.withCredentials),l.setPath(this.path),l.load(t,function(n){var i=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);s.format=i?r.RGBFormat:r.RGBAFormat,s.image=n,s.needsUpdate=!0,void 0!==e&&e(s)},n,i),s},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),e.TextureLoader=i},function(t,e,n){"use strict";function i(t){this.manager=void 0!==t?t:a.DefaultLoadingManager}Object.defineProperty(e,"__esModule",{value:!0}),e.ImageLoader=void 0;var r=n(171),a=n(173);Object.assign(i.prototype,{load:function(t,e,n,i){var a=this,o=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(o.onload=function(){URL.revokeObjectURL(o.src),e&&e(o),a.manager.itemEnd(t)},0===t.indexOf("data:"))o.src=t;else{var s=new r.XHRLoader;s.setPath(this.path),s.setResponseType("blob"),s.setWithCredentials(this.withCredentials),s.load(t,function(t){o.src=URL.createObjectURL(t)},n,i)}return a.manager.itemStart(t),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),e.ImageLoader=i},function(t,e,n){"use strict";function i(t){this.manager=void 0!==t?t:a.DefaultLoadingManager}Object.defineProperty(e,"__esModule",{value:!0}),e.XHRLoader=void 0;var r=n(172),a=n(173);Object.assign(i.prototype,{load:function(t,e,n,i){void 0!==this.path&&(t=this.path+t);var a=this,o=r.Cache.get(t);if(void 0!==o)return a.manager.itemStart(t),setTimeout(function(){e&&e(o),a.manager.itemEnd(t)},0),o;var s=new XMLHttpRequest;return s.open("GET",t,!0),s.addEventListener("load",function(n){var o=n.target.response;r.Cache.add(t,o),200===this.status?(e&&e(o),a.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),a.manager.itemEnd(t)):(i&&i(n),a.manager.itemError(t))},!1),void 0!==n&&s.addEventListener("progress",function(t){n(t)},!1),s.addEventListener("error",function(e){i&&i(e),a.manager.itemError(t)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType("text/plain"),s.send(null),a.manager.itemStart(t),s},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this}}),e.XHRLoader=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;e.Cache=n={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},e.Cache=n},function(t,e){"use strict";function n(t,e,n){var i=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,r===!1&&void 0!==i.onStart&&i.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}}Object.defineProperty(e,"__esModule",{value:!0});var i;e.DefaultLoadingManager=i=new n,e.DefaultLoadingManager=i,e.LoadingManager=n},function(t,e,n){"use strict";function i(){r.Object3D.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}Object.defineProperty(e,"__esModule",{value:!0}),e.Scene=void 0;var r=n(143);i.prototype=Object.create(r.Object3D.prototype),i.prototype.constructor=i,i.prototype.copy=function(t,e){return r.Object3D.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},i.prototype.toJSON=function(t){var e=r.Object3D.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},e.Scene=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s){r.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:o,depthSegments:s},this.fromBufferGeometry(new a.BoxBufferGeometry(t,e,n,i,o,s)),this.mergeVertices()}Object.defineProperty(e,"__esModule",{value:!0}),e.BoxGeometry=void 0;var r=n(141),a=n(137);i.prototype=Object.create(r.Geometry.prototype),i.prototype.constructor=i,e.BoxGeometry=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s,l){r.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:o,thetaStart:s,thetaLength:l},this.fromBufferGeometry(new a.SphereBufferGeometry(t,e,n,i,o,s,l))}Object.defineProperty(e,"__esModule",{value:!0}),e.SphereGeometry=void 0;var r=n(141),a=n(177);i.prototype=Object.create(r.Geometry.prototype),i.prototype.constructor=i,e.SphereGeometry=i},function(t,e,n){"use strict";function i(t,e,n,i,l,c,u){r.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:l,thetaStart:c,thetaLength:u},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,l=void 0!==l?l:2*Math.PI,c=void 0!==c?c:0,u=void 0!==u?u:Math.PI;for(var h=c+u,d=(e+1)*(n+1),f=new s.BufferAttribute(new Float32Array(3*d),3),p=new s.BufferAttribute(new Float32Array(3*d),3),m=new s.BufferAttribute(new Float32Array(2*d),2),v=0,g=[],x=new a.Vector3,_=0;_<=n;_++){for(var y=[],M=_/n,b=0;b<=e;b++){var w=b/e,E=-t*Math.cos(i+w*l)*Math.sin(c+M*u),S=t*Math.cos(c+M*u),T=t*Math.sin(i+w*l)*Math.sin(c+M*u);x.set(E,S,T).normalize(),f.setXYZ(v,E,S,T),p.setXYZ(v,x.x,x.y,x.z),m.setXY(v,w,1-M),y.push(v),v++}g.push(y)}for(var L=[],_=0;_<n;_++)for(var b=0;b<e;b++){var A=g[_][b+1],P=g[_][b],R=g[_+1][b],C=g[_+1][b+1];(0!==_||c>0)&&L.push(A,P,C),(_!==n-1||h<Math.PI)&&L.push(P,R,C)}this.setIndex(new(f.count>65535?s.Uint32Attribute:s.Uint16Attribute)(L,1)),this.addAttribute("position",f),this.addAttribute("normal",p),this.addAttribute("uv",m),this.boundingSphere=new o.Sphere(new a.Vector3,t)}Object.defineProperty(e,"__esModule",{value:!0}),e.SphereBufferGeometry=void 0;var r=n(138),a=n(6),o=n(133),s=n(139);i.prototype=Object.create(r.BufferGeometry.prototype),i.prototype.constructor=i,e.SphereBufferGeometry=i},function(t,e){"use strict";void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(void 0!==i&&null!==i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(180);Object.defineProperty(e,"request",{enumerable:!0,get:function(){return i.request}});var r=n(183);Object.defineProperty(e,"tsvParse",{enumerable:!0,get:function(){return r.tsvParse}})},function(t,e,n){!function(t,i){i(e,n(181),n(182),n(183))}(this,function(t,e,n,i){"use strict";function r(t,i){function r(t){var e,n=f.status;if(!n&&o(f)||n>=200&&n<300||304===n){if(c)try{e=c.call(s,f)}catch(i){return void h.call("error",s,i)}else e=f;h.call("load",s,e)}else h.call("error",s,t)}var s,l,c,u,h=n.dispatch("beforesend","progress","load","error"),d=e.map(),f=new XMLHttpRequest,p=null,m=null,v=0;if("undefined"==typeof XDomainRequest||"withCredentials"in f||!/^(http(s)?:)?\/\//.test(t)||(f=new XDomainRequest),"onload"in f?f.onload=f.onerror=f.ontimeout=r:f.onreadystatechange=function(t){f.readyState>3&&r(t)},f.onprogress=function(t){h.call("progress",s,t)},s={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?d.get(t):(null==e?d.remove(t):d.set(t,e+""),s)},mimeType:function(t){return arguments.length?(l=null==t?null:t+"",s):l},responseType:function(t){return arguments.length?(u=t,s):u},timeout:function(t){return arguments.length?(v=+t,s):v},user:function(t){return arguments.length<1?p:(p=null==t?null:t+"",s)},password:function(t){return arguments.length<1?m:(m=null==t?null:t+"",s)},response:function(t){return c=t,s},get:function(t,e){return s.send("GET",t,e)},post:function(t,e){return s.send("POST",t,e)},send:function(e,n,i){return f.open(e,t,!0,p,m),null==l||d.has("accept")||d.set("accept",l+",*/*"),f.setRequestHeader&&d.each(function(t,e){f.setRequestHeader(e,t)}),null!=l&&f.overrideMimeType&&f.overrideMimeType(l),null!=u&&(f.responseType=u),v>0&&(f.timeout=v),null==i&&"function"==typeof n&&(i=n,n=null),null!=i&&1===i.length&&(i=a(i)),null!=i&&s.on("error",i).on("load",function(t){i(null,t)}),h.call("beforesend",s,f),f.send(null==n?null:n),s},abort:function(){return f.abort(),s},on:function(){var t=h.on.apply(h,arguments);return t===h?s:t}},null!=i){if("function"!=typeof i)throw new Error("invalid callback: "+i);return s.get(i)}return s}function a(t){return function(e,n){t(null==e?n:null)}}function o(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function s(t,e){return function(n,i){var a=r(n).mimeType(t).response(e);if(null!=i){if("function"!=typeof i)throw new Error("invalid callback: "+i);return a.get(i)}return a}}function l(t,e){return function(n,i,a){arguments.length<3&&(a=i,i=null);var o=r(n).mimeType(t);return o.row=function(t){return arguments.length?o.response(c(e,i=t)):i},o.row(i),a?o.get(a):o}}function c(t,e){return function(n){return t(n.responseText,e)}}var u=s("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)}),h=s("application/json",function(t){return JSON.parse(t.responseText)}),d=s("text/plain",function(t){return t.responseText}),f=s("application/xml",function(t){var e=t.responseXML;if(!e)throw new Error("parse error");return e}),p=l("text/csv",i.csvParse),m=l("text/tab-separated-values",i.tsvParse);t.request=r,t.html=u,t.json=h,t.text=d,t.xml=f,t.csv=p,t.tsv=m,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(){}function n(t,n){var i=new e;if(t instanceof e)t.each(function(t,e){i.set(e,t)});else if(Array.isArray(t)){var r,a=-1,o=t.length;if(null==n)for(;++a<o;)i.set(a,t[a]);else for(;++a<o;)i.set(n(r=t[a],a,t),r)}else if(t)for(var s in t)i.set(s,t[s]);return i}function i(){function t(e,r,a,o){if(r>=u.length)return null!=l?l(e):null!=i?e.sort(i):e;for(var s,c,h,d=-1,f=e.length,p=u[r++],m=n(),v=a();++d<f;)(h=m.get(s=p(c=e[d])+""))?h.push(c):m.set(s,[c]);return m.each(function(e,n){o(v,n,t(e,r,a,o))}),v}function e(t,n){if(++n>u.length)return t;var i,r=h[n-1];return null!=l&&n>=u.length?i=t.entries():(i=[],t.each(function(t,r){i.push({key:r,values:e(t,n)})})),null!=r?i.sort(function(t,e){return r(t.key,e.key)}):i}var i,l,c,u=[],h=[];return c={object:function(e){return t(e,0,r,a)},map:function(e){return t(e,0,o,s)},entries:function(n){return e(t(n,0,o,s),0)},key:function(t){return u.push(t),c},sortKeys:function(t){return h[u.length-1]=t,c},sortValues:function(t){return i=t,c},rollup:function(t){return l=t,c}}}function r(){return{}}function a(t,e,n){t[e]=n}function o(){return n()}function s(t,e,n){t.set(e,n)}function l(){}function c(t,e){var n=new l;if(t instanceof l)t.each(function(t){n.add(t)});else if(t){var i=-1,r=t.length;if(null==e)for(;++i<r;)n.add(t[i]);else for(;++i<r;)n.add(e(t[i],i,t))}return n}function u(t){var e=[];for(var n in t)e.push(n);return e}function h(t){var e=[];for(var n in t)e.push(t[n]);return e}function d(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e}var f="$";e.prototype=n.prototype={constructor:e,has:function(t){return f+t in this},get:function(t){return this[f+t]},set:function(t,e){return this[f+t]=e,this},remove:function(t){var e=f+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===f&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===f&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===f&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===f&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===f&&++t;return t},empty:function(){for(var t in this)if(t[0]===f)return!1;return!0},each:function(t){for(var e in this)e[0]===f&&t(this[e],e.slice(1),this)}};var p=n.prototype;l.prototype=c.prototype={constructor:l,has:p.has,add:function(t){return t+="",this[f+t]=t,this},remove:p.remove,clear:p.clear,values:p.keys,size:p.size,empty:p.empty,each:p.each},t.nest=i,t.set=c,t.map=n,t.keys=u,t.values=h,t.entries=d,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(){for(var t,e=0,i=arguments.length,r={};e<i;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new n(r)}function n(t){this._=t}function i(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}function r(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function a(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=o,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}var o={value:function(){}};n.prototype=e.prototype={constructor:n,on:function(t,e){var n,o=this._,s=i(t+"",o),l=-1,c=s.length;{if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l<c;)if(n=(t=s[l]).type)o[n]=a(o[n],t.name,e);else if(null==e)for(n in o)o[n]=a(o[n],t.name,null);return this}for(;++l<c;)if((n=(t=s[l]).type)&&(n=r(o[n],t.name)))return n}},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new n(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),a=0;a<n;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],a=0,n=i.length;a<n;++a)i[a].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}},t.dispatch=e,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function n(t,n){var i=e(t);return function(e,r){return n(i(e),r,t)}}function i(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var i in t)i in e||n.push(e[i]=i)}),n}function r(t){function r(t,i){var r,o,s=a(t,function(t,a){return r?r(t,a-1):(o=t,void(r=i?n(t,i):e(t)))});return s.columns=o,s}function a(t,e){function n(){if(c>=l)return o;if(r)return r=!1,a;var e,n=c;if(34===t.charCodeAt(n)){for(var i=n;i++<l;)if(34===t.charCodeAt(i)){if(34!==t.charCodeAt(i+1))break;++i}return c=i+2,e=t.charCodeAt(i+1),13===e?(r=!0,10===t.charCodeAt(i+2)&&++c):10===e&&(r=!0),t.slice(n+1,i).replace(/""/g,'"')}for(;c<l;){var s=1;if(e=t.charCodeAt(c++),10===e)r=!0;else if(13===e)r=!0,10===t.charCodeAt(c)&&(++c,++s);else if(e!==h)continue;return t.slice(n,c-s)}return t.slice(n)}for(var i,r,a={},o={},s=[],l=t.length,c=0,u=0;(i=n())!==o;){for(var d=[];i!==a&&i!==o;)d.push(i),i=n();e&&null==(d=e(d,u++))||s.push(d)}return s}function o(e,n){return null==n&&(n=i(e)),[n.map(c).join(t)].concat(e.map(function(e){return n.map(function(t){return c(e[t])}).join(t)})).join("\n")}function s(t){return t.map(l).join("\n")}function l(e){return e.map(c).join(t)}function c(t){return null==t?"":u.test(t+="")?'"'+t.replace(/\"/g,'""')+'"':t}var u=new RegExp('["'+t+"\n]"),h=t.charCodeAt(0);return{parse:r,parseRows:a,format:o,formatRows:s}}var a=r(","),o=a.parse,s=a.parseRows,l=a.format,c=a.formatRows,u=r("\t"),h=u.parse,d=u.parseRows,f=u.format,p=u.formatRows;t.dsvFormat=r,t.csvParse=o,t.csvParseRows=s,t.csvFormat=l,t.csvFormatRows=c,t.tsvParse=h,t.tsvParseRows=d,t.tsvFormat=f,t.tsvFormatRows=p,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(e){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n")),t},addGetWebGLMessage:function(t){var e,i,r;t=t||{},e=void 0!==t.parent?t.parent:document.body,i=void 0!==t.id?t.id:"oldie",r=n.getWebGLErrorMessage(),r.id=i,e.appendChild(r)}};e["default"]=n},function(t,e,n){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function r(t,e){function n(){t.style.color="#fff",t.style.font="13px/20px Arial, sans-serif";var n,i,r;y=t.offsetWidth||window.innerWidth,M=t.offsetHeight||window.innerHeight,g=new o.PerspectiveCamera(30,y/M,1,1e4),g.position.z=O,x=new o.Scene;var a=new o.SphereGeometry(200,40,30);n=P.earth,i=o.UniformsUtils.clone(n.uniforms);var l=new o.TextureLoader;i.texture.value=l.load(T+"world.jpg"),r=new o.ShaderMaterial({uniforms:i,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),b=new o.Mesh(a,r),b.rotation.y=Math.PI,x.add(b),n=P.atmosphere,i=o.UniformsUtils.clone(n.uniforms),r=new o.ShaderMaterial({uniforms:i,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:o.BackSide,blending:o.AdditiveBlending,transparent:!0}),b=new o.Mesh(a,r),b.scale.set(1.1,1.1,1.1),x.add(b),a=new o.BoxGeometry(e.pointSize||.75,e.pointSize||.75,1),a.applyMatrix((new o.Matrix4).makeTranslation(0,0,-.5)),w=new o.Mesh(a),_=new o.WebGLRenderer({antialias:!0}),_.setSize(y,M),_.domElement.style.position="absolute",t.appendChild(_.domElement),t.addEventListener("mousedown",s,!1),e.mouseWheel!==!1&&t.addEventListener("mousewheel",h,!1),document.addEventListener("keydown",d,!1),window.addEventListener("resize",f,!1),t.addEventListener("mouseover",function(){E=!0},!1),t.addEventListener("mouseout",function(){E=!1},!1)}function i(t,e){var n,i,r,s,l,c,u;if(e.animated=e.animated||!1,this.is_animated=e.animated,e.format=e.format||"magnitude","magnitude"===e.format)c=3,u=function(t,e){return S(t[e+2])};else{if("legend"!==e.format)throw"error: format not supported: "+e.format;c=4,u=function(t,e){return S(t[e+3])}}if(e.animated){if(void 0===this._baseGeometry)for(this._baseGeometry=new o.Geometry,l=0;l<t.length;l+=c)n=t[l],i=t[l+1],s=u(t,l),r=0,a(n,i,r,s,this._baseGeometry);void 0===this._morphTargetId?this._morphTargetId=0:this._morphTargetId+=1,e.name=e.name||"morphTarget"+this._morphTargetId}var h=new o.Geometry;for(l=0;l<t.length;l+=c)n=t[l],i=t[l+1],s=u(t,l),r=t[l+2],r=200*r,a(n,i,r,s,h);e.animated?this._baseGeometry.morphTargets.push({name:e.name,vertices:h.vertices}):this._baseGeometry=h}function r(){if(void 0!==this._baseGeometry){if(this.is_animated===!1)this.points=new o.Mesh(this._baseGeometry,new o.MeshBasicMaterial({color:16777215,vertexColors:o.FaceColors,morphTargets:!1}));else{if(this._baseGeometry.morphTargets.length<8)for(var t=8-this._baseGeometry.morphTargets.length,e=0;e<=t;e++)this._baseGeometry.morphTargets.push({name:"morphPadding"+e,vertices:this._baseGeometry.vertices});this.points=new o.Mesh(this._baseGeometry,new o.MeshBasicMaterial({color:16777215,vertexColors:o.FaceColors,morphTargets:!0}))}x.add(this.points)}}function a(t,e,n,i,r){
|
||
var a=(90-t)*Math.PI/180,o=(180-e)*Math.PI/180;w.position.x=200*Math.sin(a)*Math.cos(o),w.position.y=200*Math.cos(a),w.position.z=200*Math.sin(a)*Math.sin(o),w.lookAt(b.position),w.scale.z=Math.max(n,.1),w.updateMatrix();for(var s=0;s<w.geometry.faces.length;s++)w.geometry.faces[s].color=i;w.matrixAutoUpdate&&w.updateMatrix(),r.merge(w.geometry,w.matrix)}function s(e){e.preventDefault(),t.addEventListener("mousemove",l,!1),t.addEventListener("mouseup",c,!1),t.addEventListener("mouseout",u,!1),D.x=-e.clientX,D.y=e.clientY,I.x=F.x,I.y=F.y,t.style.cursor="move"}function l(t){C.x=-t.clientX,C.y=t.clientY;var e=O/1e3;F.x=I.x+.005*(C.x-D.x)*e,F.y=I.y+.005*(C.y-D.y)*e,F.y=F.y>V?V:F.y,F.y=F.y<-V?-V:F.y}function c(e){t.removeEventListener("mousemove",l,!1),t.removeEventListener("mouseup",c,!1),t.removeEventListener("mouseout",u,!1),t.style.cursor="auto"}function u(e){t.removeEventListener("mousemove",l,!1),t.removeEventListener("mouseup",c,!1),t.removeEventListener("mouseout",u,!1)}function h(t){return t.preventDefault(),E&&p(.3*t.wheelDeltaY),!1}function d(t){switch(t.keyCode){case 38:p(100),t.preventDefault();break;case 40:p(-100),t.preventDefault()}}function f(e){g.aspect=t.offsetWidth/t.offsetHeight,g.updateProjectionMatrix(),_.setSize(t.offsetWidth,t.offsetHeight)}function p(t){B-=t,B=B>1e3?1e3:B,B=B<350?350:B}function m(){requestAnimationFrame(m),v()}function v(){p(R),F.x-=N.x,F.y-=N.y,U.x+=.1*(F.x-U.x),U.y+=.1*(F.y-U.y),O+=.3*(B-O),g.position.x=O*Math.sin(U.x)*Math.cos(U.y),g.position.y=O*Math.sin(U.y),g.position.z=O*Math.cos(U.x)*Math.cos(U.y),g.lookAt(new o.Vector3(b.position.x+A.x,b.position.y+A.y,b.position.z+A.z)),_.render(x,g)}e=e||{};var g,x,_,y,M,b,w,E,S=e.colorFn||function(t){var e=new o.Color;return e.setHSL(.6-.5*t,1,.5),e},T=e.imgDir||"/globe/",L=e.initialZoom||1e5,A=e.cameraOffset||{x:0,y:0,z:0},P={earth:{uniforms:{texture:{type:"t",value:null}},vertexShader:["varying vec3 vNormal;","varying vec2 vUv;","void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vNormal = normalize( normalMatrix * normal );","vUv = uv;","}"].join("\n"),fragmentShader:["uniform sampler2D texture;","varying vec3 vNormal;","varying vec2 vUv;","void main() {","vec3 diffuse = texture2D( texture, vUv ).xyz;","float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );","vec3 atmosphere = vec3( 0.11764, 0.4509, 0.745 ) * pow( intensity, 3.0 );","gl_FragColor = vec4( diffuse + atmosphere, 1.0 );","}"].join("\n")},atmosphere:{uniforms:{},vertexShader:["varying vec3 vNormal;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec3 vNormal;","void main() {","float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );","gl_FragColor = vec4( 0.11764, 0.4509, 0.745, 0.5 ) * intensity;","}"].join("\n")}},R=0,C={x:0,y:0},D={x:0,y:0},U={x:0,y:0},N={x:-.001,y:0},F={x:1.1*Math.PI,y:.06*Math.PI},I={x:0,y:0},O=1e5,B=L||1e5,V=Math.PI/2;return n(),this.animate=m,this.__defineGetter__("time",function(){return this._time||0}),this.__defineSetter__("time",function(t){var e=[],n=this.points.morphTargetDictionary;for(var i in n)i.indexOf("morphPadding")<0&&e.push(n[i]);e.sort();for(var r=e.length-1,a=t*r+1,o=Math.floor(a),s=0;s<e.length;s++)this.points.morphTargetInfluences[e[s]]=0;var l=o-1,c=a-o;l>=0&&(this.points.morphTargetInfluences[l]=1-c),this.points.morphTargetInfluences[o]=c,this._time=t}),this.addData=i,this.createPoints=r,this.renderer=_,this.scene=x,this}Object.defineProperty(e,"__esModule",{value:!0});var a=n(1),o=i(a);e["default"]=r}]); |