!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="assets/js",n(n.s=24)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(5),o=(r=i)&&r.__esModule?r:{default:r};e.default={isDev:!1,isShowingStats:!0,isLoaded:!1,isTweening:!1,isRotating:!0,isMouseMoving:!1,isMouseOver:!1,maxAnisotropy:1,dpr:1,easing:o.default.Easing.Quadratic.InOut,duration:500,model:{path:"./assets/models/Teapot.json",scale:20},texture:{path:"./assets/textures/",imageFiles:[{name:"UV",image:"UV_Grid_Sm.jpg"}]},mesh:{enableHelper:!1,wireframe:!1,translucent:!1,material:{color:16777215,emissive:16777215}},fog:{color:16777215,near:8e-4},camera:{fov:40,near:2,far:1e3,aspect:1,posX:0,posY:30,posZ:40},controls:{autoRotate:!0,autoRotateSpeed:-.5,rotateSpeed:.5,zoomSpeed:.8,minDistance:200,maxDistance:600,minPolarAngle:Math.PI/5,maxPolarAngle:Math.PI/2,minAzimuthAngle:-1/0,maxAzimuthAngle:1/0,enableDamping:!0,dampingFactor:.5,enableZoom:!0,target:{x:0,y:0,z:0}},ambientLight:{enabled:!1,color:1315860},directionalLight:{enabled:!0,color:15790320,intensity:.4,x:-75,y:280,z:150},shadow:{enabled:!0,helperEnabled:!0,bias:0,mapWidth:2048,mapHeight:2048,near:250,far:400,top:100,right:100,bottom:-100,left:-100},pointLight:{enabled:!0,color:16777215,intensity:.34,distance:115,x:0,y:0,z:0},hemiLight:{enabled:!0,color:13158600,groundColor:16777215,intensity:.55,x:0,y:0,z:0}}},function(t,e,n){"use strict";function r(){}n.r(e),n.d(e,"WebGLRenderTargetCube",function(){return tn}),n.d(e,"WebGLRenderTarget",function(){return $e}),n.d(e,"WebGLRenderer",function(){return Di}),n.d(e,"ShaderLib",function(){return qn}),n.d(e,"UniformsLib",function(){return Wn}),n.d(e,"UniformsUtils",function(){return Xn}),n.d(e,"ShaderChunk",function(){return Yn}),n.d(e,"FogExp2",function(){return Fi}),n.d(e,"Fog",function(){return Bi}),n.d(e,"Scene",function(){return zi}),n.d(e,"Sprite",function(){return Hi}),n.d(e,"LOD",function(){return ki}),n.d(e,"SkinnedMesh",function(){return Wi}),n.d(e,"Skeleton",function(){return ji}),n.d(e,"Bone",function(){return Vi}),n.d(e,"Mesh",function(){return ii}),n.d(e,"LineSegments",function(){return qi}),n.d(e,"LineLoop",function(){return Zi}),n.d(e,"Line",function(){return Yi}),n.d(e,"Points",function(){return Ki}),n.d(e,"Group",function(){return Qi}),n.d(e,"VideoTexture",function(){return $i}),n.d(e,"DataTexture",function(){return en}),n.d(e,"CompressedTexture",function(){return to}),n.d(e,"CubeTexture",function(){return nn}),n.d(e,"CanvasTexture",function(){return Zn}),n.d(e,"DepthTexture",function(){return eo}),n.d(e,"Texture",function(){return Ke}),n.d(e,"CompressedTextureLoader",function(){return Ra}),n.d(e,"DataTextureLoader",function(){return Ca}),n.d(e,"CubeTextureLoader",function(){return Oa}),n.d(e,"TextureLoader",function(){return Ia}),n.d(e,"ObjectLoader",function(){return Fs}),n.d(e,"MaterialLoader",function(){return As}),n.d(e,"BufferGeometryLoader",function(){return Ls}),n.d(e,"DefaultLoadingManager",function(){return Sa}),n.d(e,"LoadingManager",function(){return Ta}),n.d(e,"JSONLoader",function(){return Ds}),n.d(e,"ImageLoader",function(){return Pa}),n.d(e,"ImageBitmapLoader",function(){return ks}),n.d(e,"FontLoader",function(){return Xs}),n.d(e,"FileLoader",function(){return La}),n.d(e,"Loader",function(){return Ns}),n.d(e,"LoaderUtils",function(){return Us}),n.d(e,"Cache",function(){return Ea}),n.d(e,"AudioLoader",function(){return ic}),n.d(e,"SpotLightShadow",function(){return as}),n.d(e,"SpotLight",function(){return ss}),n.d(e,"PointLight",function(){return cs}),n.d(e,"RectAreaLight",function(){return ds}),n.d(e,"HemisphereLight",function(){return is}),n.d(e,"DirectionalLightShadow",function(){return us}),n.d(e,"DirectionalLight",function(){return hs}),n.d(e,"AmbientLight",function(){return ls}),n.d(e,"LightShadow",function(){return os}),n.d(e,"Light",function(){return rs}),n.d(e,"StereoCamera",function(){return oc}),n.d(e,"PerspectiveCamera",function(){return wi}),n.d(e,"OrthographicCamera",function(){return Mr}),n.d(e,"CubeCamera",function(){return ac}),n.d(e,"ArrayCamera",function(){return _i}),n.d(e,"Camera",function(){return _r}),n.d(e,"AudioListener",function(){return sc}),n.d(e,"PositionalAudio",function(){return uc}),n.d(e,"AudioContext",function(){return rc}),n.d(e,"AudioAnalyser",function(){return hc}),n.d(e,"Audio",function(){return cc}),n.d(e,"VectorKeyframeTrack",function(){return Ts}),n.d(e,"StringKeyframeTrack",function(){return ps}),n.d(e,"QuaternionKeyframeTrack",function(){return vs}),n.d(e,"NumberKeyframeTrack",function(){return xs}),n.d(e,"ColorKeyframeTrack",function(){return ys}),n.d(e,"BooleanKeyframeTrack",function(){return fs}),n.d(e,"PropertyMixer",function(){return lc}),n.d(e,"PropertyBinding",function(){return Sc}),n.d(e,"KeyframeTrack",function(){return Es}),n.d(e,"AnimationUtils",function(){return Ms}),n.d(e,"AnimationObjectGroup",function(){return Ac}),n.d(e,"AnimationMixer",function(){return Rc}),n.d(e,"AnimationClip",function(){return Ss}),n.d(e,"Uniform",function(){return Cc}),n.d(e,"InstancedBufferGeometry",function(){return Pc}),n.d(e,"BufferGeometry",function(){return qr}),n.d(e,"Geometry",function(){return Ar}),n.d(e,"InterleavedBufferAttribute",function(){return Oc}),n.d(e,"InstancedInterleavedBuffer",function(){return Nc}),n.d(e,"InterleavedBuffer",function(){return Ic}),n.d(e,"InstancedBufferAttribute",function(){return Uc}),n.d(e,"Face3",function(){return Er}),n.d(e,"Object3D",function(){return wr}),n.d(e,"Raycaster",function(){return Dc}),n.d(e,"Layers",function(){return mr}),n.d(e,"EventDispatcher",function(){return r}),n.d(e,"Clock",function(){return zc}),n.d(e,"QuaternionLinearInterpolant",function(){return gs}),n.d(e,"LinearInterpolant",function(){return ws}),n.d(e,"DiscreteInterpolant",function(){return _s}),n.d(e,"CubicInterpolant",function(){return bs}),n.d(e,"Interpolant",function(){return ms}),n.d(e,"Triangle",function(){return ri}),n.d(e,"Math",function(){return Ve}),n.d(e,"Spherical",function(){return Gc}),n.d(e,"Cylindrical",function(){return Hc}),n.d(e,"Plane",function(){return hr}),n.d(e,"Frustum",function(){return lr}),n.d(e,"Sphere",function(){return ur}),n.d(e,"Ray",function(){return ei}),n.d(e,"Matrix4",function(){return Xe}),n.d(e,"Matrix3",function(){return Ze}),n.d(e,"Box3",function(){return cr}),n.d(e,"Box2",function(){return kc}),n.d(e,"Line3",function(){return ni}),n.d(e,"Euler",function(){return fr}),n.d(e,"Vector4",function(){return Qe}),n.d(e,"Vector3",function(){return qe}),n.d(e,"Vector2",function(){return We}),n.d(e,"Quaternion",function(){return Ye}),n.d(e,"Color",function(){return Vn}),n.d(e,"ImmediateRenderObject",function(){return jc}),n.d(e,"VertexNormalsHelper",function(){return Vc}),n.d(e,"SpotLightHelper",function(){return Wc}),n.d(e,"SkeletonHelper",function(){return Xc}),n.d(e,"PointLightHelper",function(){return Yc}),n.d(e,"RectAreaLightHelper",function(){return qc}),n.d(e,"HemisphereLightHelper",function(){return Zc}),n.d(e,"GridHelper",function(){return Jc}),n.d(e,"PolarGridHelper",function(){return Kc}),n.d(e,"FaceNormalsHelper",function(){return Qc}),n.d(e,"DirectionalLightHelper",function(){return $c}),n.d(e,"CameraHelper",function(){return tu}),n.d(e,"BoxHelper",function(){return eu}),n.d(e,"Box3Helper",function(){return nu}),n.d(e,"PlaneHelper",function(){return ru}),n.d(e,"ArrowHelper",function(){return iu}),n.d(e,"AxesHelper",function(){return ou}),n.d(e,"Shape",function(){return ns}),n.d(e,"Path",function(){return es}),n.d(e,"ShapePath",function(){return js}),n.d(e,"Font",function(){return Vs}),n.d(e,"CurvePath",function(){return ts}),n.d(e,"Curve",function(){return Na}),n.d(e,"ShapeUtils",function(){return Vo}),n.d(e,"WebGLUtils",function(){return Ei}),n.d(e,"WireframeGeometry",function(){return no}),n.d(e,"ParametricGeometry",function(){return ro}),n.d(e,"ParametricBufferGeometry",function(){return io}),n.d(e,"TetrahedronGeometry",function(){return so}),n.d(e,"TetrahedronBufferGeometry",function(){return co}),n.d(e,"OctahedronGeometry",function(){return uo}),n.d(e,"OctahedronBufferGeometry",function(){return ho}),n.d(e,"IcosahedronGeometry",function(){return lo}),n.d(e,"IcosahedronBufferGeometry",function(){return po}),n.d(e,"DodecahedronGeometry",function(){return fo}),n.d(e,"DodecahedronBufferGeometry",function(){return mo}),n.d(e,"PolyhedronGeometry",function(){return oo}),n.d(e,"PolyhedronBufferGeometry",function(){return ao}),n.d(e,"TubeGeometry",function(){return go}),n.d(e,"TubeBufferGeometry",function(){return vo}),n.d(e,"TorusKnotGeometry",function(){return yo}),n.d(e,"TorusKnotBufferGeometry",function(){return xo}),n.d(e,"TorusGeometry",function(){return bo}),n.d(e,"TorusBufferGeometry",function(){return wo}),n.d(e,"TextGeometry",function(){return Zo}),n.d(e,"TextBufferGeometry",function(){return Jo}),n.d(e,"SphereGeometry",function(){return Ko}),n.d(e,"SphereBufferGeometry",function(){return Qo}),n.d(e,"RingGeometry",function(){return $o}),n.d(e,"RingBufferGeometry",function(){return ta}),n.d(e,"PlaneGeometry",function(){return Kr}),n.d(e,"PlaneBufferGeometry",function(){return Qr}),n.d(e,"LatheGeometry",function(){return ea}),n.d(e,"LatheBufferGeometry",function(){return na}),n.d(e,"ShapeGeometry",function(){return ra}),n.d(e,"ShapeBufferGeometry",function(){return ia}),n.d(e,"ExtrudeGeometry",function(){return Yo}),n.d(e,"ExtrudeBufferGeometry",function(){return qo}),n.d(e,"EdgesGeometry",function(){return aa}),n.d(e,"ConeGeometry",function(){return ua}),n.d(e,"ConeBufferGeometry",function(){return ha}),n.d(e,"CylinderGeometry",function(){return sa}),n.d(e,"CylinderBufferGeometry",function(){return ca}),n.d(e,"CircleGeometry",function(){return la}),n.d(e,"CircleBufferGeometry",function(){return da}),n.d(e,"BoxGeometry",function(){return Zr}),n.d(e,"BoxBufferGeometry",function(){return Jr}),n.d(e,"ShadowMaterial",function(){return fa}),n.d(e,"SpriteMaterial",function(){return Gi}),n.d(e,"RawShaderMaterial",function(){return ma}),n.d(e,"ShaderMaterial",function(){return ti}),n.d(e,"PointsMaterial",function(){return Ji}),n.d(e,"MeshPhysicalMaterial",function(){return va}),n.d(e,"MeshStandardMaterial",function(){return ga}),n.d(e,"MeshPhongMaterial",function(){return ya}),n.d(e,"MeshToonMaterial",function(){return xa}),n.d(e,"MeshNormalMaterial",function(){return ba}),n.d(e,"MeshLambertMaterial",function(){return wa}),n.d(e,"MeshDepthMaterial",function(){return ar}),n.d(e,"MeshDistanceMaterial",function(){return sr}),n.d(e,"MeshBasicMaterial",function(){return $r}),n.d(e,"LineDashedMaterial",function(){return _a}),n.d(e,"LineBasicMaterial",function(){return Xi}),n.d(e,"Material",function(){return or}),n.d(e,"Float64BufferAttribute",function(){return Fr}),n.d(e,"Float32BufferAttribute",function(){return Dr}),n.d(e,"Uint32BufferAttribute",function(){return Ur}),n.d(e,"Int32BufferAttribute",function(){return Nr}),n.d(e,"Uint16BufferAttribute",function(){return Ir}),n.d(e,"Int16BufferAttribute",function(){return Or}),n.d(e,"Uint8ClampedBufferAttribute",function(){return Pr}),n.d(e,"Uint8BufferAttribute",function(){return Cr}),n.d(e,"Int8BufferAttribute",function(){return Rr}),n.d(e,"BufferAttribute",function(){return Lr}),n.d(e,"ArcCurve",function(){return Da}),n.d(e,"CatmullRomCurve3",function(){return ka}),n.d(e,"CubicBezierCurve",function(){return Xa}),n.d(e,"CubicBezierCurve3",function(){return Ya}),n.d(e,"EllipseCurve",function(){return Ua}),n.d(e,"LineCurve",function(){return qa}),n.d(e,"LineCurve3",function(){return Za}),n.d(e,"QuadraticBezierCurve",function(){return Ja}),n.d(e,"QuadraticBezierCurve3",function(){return Ka}),n.d(e,"SplineCurve",function(){return Qa}),n.d(e,"REVISION",function(){return p}),n.d(e,"MOUSE",function(){return f}),n.d(e,"CullFaceNone",function(){return m}),n.d(e,"CullFaceBack",function(){return g}),n.d(e,"CullFaceFront",function(){return v}),n.d(e,"CullFaceFrontBack",function(){return y}),n.d(e,"FrontFaceDirectionCW",function(){return x}),n.d(e,"FrontFaceDirectionCCW",function(){return b}),n.d(e,"BasicShadowMap",function(){return w}),n.d(e,"PCFShadowMap",function(){return _}),n.d(e,"PCFSoftShadowMap",function(){return M}),n.d(e,"FrontSide",function(){return E}),n.d(e,"BackSide",function(){return T}),n.d(e,"DoubleSide",function(){return S}),n.d(e,"FlatShading",function(){return A}),n.d(e,"SmoothShading",function(){return L}),n.d(e,"NoColors",function(){return R}),n.d(e,"FaceColors",function(){return C}),n.d(e,"VertexColors",function(){return P}),n.d(e,"NoBlending",function(){return O}),n.d(e,"NormalBlending",function(){return I}),n.d(e,"AdditiveBlending",function(){return N}),n.d(e,"SubtractiveBlending",function(){return U}),n.d(e,"MultiplyBlending",function(){return D}),n.d(e,"CustomBlending",function(){return F}),n.d(e,"AddEquation",function(){return B}),n.d(e,"SubtractEquation",function(){return z}),n.d(e,"ReverseSubtractEquation",function(){return G}),n.d(e,"MinEquation",function(){return H}),n.d(e,"MaxEquation",function(){return k}),n.d(e,"ZeroFactor",function(){return j}),n.d(e,"OneFactor",function(){return V}),n.d(e,"SrcColorFactor",function(){return W}),n.d(e,"OneMinusSrcColorFactor",function(){return X}),n.d(e,"SrcAlphaFactor",function(){return Y}),n.d(e,"OneMinusSrcAlphaFactor",function(){return q}),n.d(e,"DstAlphaFactor",function(){return Z}),n.d(e,"OneMinusDstAlphaFactor",function(){return J}),n.d(e,"DstColorFactor",function(){return K}),n.d(e,"OneMinusDstColorFactor",function(){return Q}),n.d(e,"SrcAlphaSaturateFactor",function(){return $}),n.d(e,"NeverDepth",function(){return tt}),n.d(e,"AlwaysDepth",function(){return et}),n.d(e,"LessDepth",function(){return nt}),n.d(e,"LessEqualDepth",function(){return rt}),n.d(e,"EqualDepth",function(){return it}),n.d(e,"GreaterEqualDepth",function(){return ot}),n.d(e,"GreaterDepth",function(){return at}),n.d(e,"NotEqualDepth",function(){return st}),n.d(e,"MultiplyOperation",function(){return ct}),n.d(e,"MixOperation",function(){return ut}),n.d(e,"AddOperation",function(){return ht}),n.d(e,"NoToneMapping",function(){return lt}),n.d(e,"LinearToneMapping",function(){return dt}),n.d(e,"ReinhardToneMapping",function(){return pt}),n.d(e,"Uncharted2ToneMapping",function(){return ft}),n.d(e,"CineonToneMapping",function(){return mt}),n.d(e,"UVMapping",function(){return gt}),n.d(e,"CubeReflectionMapping",function(){return vt}),n.d(e,"CubeRefractionMapping",function(){return yt}),n.d(e,"EquirectangularReflectionMapping",function(){return xt}),n.d(e,"EquirectangularRefractionMapping",function(){return bt}),n.d(e,"SphericalReflectionMapping",function(){return wt}),n.d(e,"CubeUVReflectionMapping",function(){return _t}),n.d(e,"CubeUVRefractionMapping",function(){return Mt}),n.d(e,"RepeatWrapping",function(){return Et}),n.d(e,"ClampToEdgeWrapping",function(){return Tt}),n.d(e,"MirroredRepeatWrapping",function(){return St}),n.d(e,"NearestFilter",function(){return At}),n.d(e,"NearestMipMapNearestFilter",function(){return Lt}),n.d(e,"NearestMipMapLinearFilter",function(){return Rt}),n.d(e,"LinearFilter",function(){return Ct}),n.d(e,"LinearMipMapNearestFilter",function(){return Pt}),n.d(e,"LinearMipMapLinearFilter",function(){return Ot}),n.d(e,"UnsignedByteType",function(){return It}),n.d(e,"ByteType",function(){return Nt}),n.d(e,"ShortType",function(){return Ut}),n.d(e,"UnsignedShortType",function(){return Dt}),n.d(e,"IntType",function(){return Ft}),n.d(e,"UnsignedIntType",function(){return Bt}),n.d(e,"FloatType",function(){return zt}),n.d(e,"HalfFloatType",function(){return Gt}),n.d(e,"UnsignedShort4444Type",function(){return Ht}),n.d(e,"UnsignedShort5551Type",function(){return kt}),n.d(e,"UnsignedShort565Type",function(){return jt}),n.d(e,"UnsignedInt248Type",function(){return Vt}),n.d(e,"AlphaFormat",function(){return Wt}),n.d(e,"RGBFormat",function(){return Xt}),n.d(e,"RGBAFormat",function(){return Yt}),n.d(e,"LuminanceFormat",function(){return qt}),n.d(e,"LuminanceAlphaFormat",function(){return Zt}),n.d(e,"RGBEFormat",function(){return Jt}),n.d(e,"DepthFormat",function(){return Kt}),n.d(e,"DepthStencilFormat",function(){return Qt}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return $t}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return te}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return ee}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return ne}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return re}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return ie}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return oe}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return ae}),n.d(e,"RGB_ETC1_Format",function(){return se}),n.d(e,"RGBA_ASTC_4x4_Format",function(){return ce}),n.d(e,"RGBA_ASTC_5x4_Format",function(){return ue}),n.d(e,"RGBA_ASTC_5x5_Format",function(){return he}),n.d(e,"RGBA_ASTC_6x5_Format",function(){return le}),n.d(e,"RGBA_ASTC_6x6_Format",function(){return de}),n.d(e,"RGBA_ASTC_8x5_Format",function(){return pe}),n.d(e,"RGBA_ASTC_8x6_Format",function(){return fe}),n.d(e,"RGBA_ASTC_8x8_Format",function(){return me}),n.d(e,"RGBA_ASTC_10x5_Format",function(){return ge}),n.d(e,"RGBA_ASTC_10x6_Format",function(){return ve}),n.d(e,"RGBA_ASTC_10x8_Format",function(){return ye}),n.d(e,"RGBA_ASTC_10x10_Format",function(){return xe}),n.d(e,"RGBA_ASTC_12x10_Format",function(){return be}),n.d(e,"RGBA_ASTC_12x12_Format",function(){return we}),n.d(e,"LoopOnce",function(){return _e}),n.d(e,"LoopRepeat",function(){return Me}),n.d(e,"LoopPingPong",function(){return Ee}),n.d(e,"InterpolateDiscrete",function(){return Te}),n.d(e,"InterpolateLinear",function(){return Se}),n.d(e,"InterpolateSmooth",function(){return Ae}),n.d(e,"ZeroCurvatureEnding",function(){return Le}),n.d(e,"ZeroSlopeEnding",function(){return Re}),n.d(e,"WrapAroundEnding",function(){return Ce}),n.d(e,"TrianglesDrawMode",function(){return Pe}),n.d(e,"TriangleStripDrawMode",function(){return Oe}),n.d(e,"TriangleFanDrawMode",function(){return Ie}),n.d(e,"LinearEncoding",function(){return Ne}),n.d(e,"sRGBEncoding",function(){return Ue}),n.d(e,"GammaEncoding",function(){return De}),n.d(e,"RGBEEncoding",function(){return Fe}),n.d(e,"LogLuvEncoding",function(){return Be}),n.d(e,"RGBM7Encoding",function(){return ze}),n.d(e,"RGBM16Encoding",function(){return Ge}),n.d(e,"RGBDEncoding",function(){return He}),n.d(e,"BasicDepthPacking",function(){return ke}),n.d(e,"RGBADepthPacking",function(){return je}),n.d(e,"CubeGeometry",function(){return Zr}),n.d(e,"Face4",function(){return au}),n.d(e,"LineStrip",function(){return su}),n.d(e,"LinePieces",function(){return cu}),n.d(e,"MeshFaceMaterial",function(){return uu}),n.d(e,"MultiMaterial",function(){return hu}),n.d(e,"PointCloud",function(){return lu}),n.d(e,"Particle",function(){return du}),n.d(e,"ParticleSystem",function(){return pu}),n.d(e,"PointCloudMaterial",function(){return fu}),n.d(e,"ParticleBasicMaterial",function(){return mu}),n.d(e,"ParticleSystemMaterial",function(){return gu}),n.d(e,"Vertex",function(){return vu}),n.d(e,"DynamicBufferAttribute",function(){return yu}),n.d(e,"Int8Attribute",function(){return xu}),n.d(e,"Uint8Attribute",function(){return bu}),n.d(e,"Uint8ClampedAttribute",function(){return wu}),n.d(e,"Int16Attribute",function(){return _u}),n.d(e,"Uint16Attribute",function(){return Mu}),n.d(e,"Int32Attribute",function(){return Eu}),n.d(e,"Uint32Attribute",function(){return Tu}),n.d(e,"Float32Attribute",function(){return Su}),n.d(e,"Float64Attribute",function(){return Au}),n.d(e,"ClosedSplineCurve3",function(){return Lu}),n.d(e,"SplineCurve3",function(){return Ru}),n.d(e,"Spline",function(){return Cu}),n.d(e,"AxisHelper",function(){return Pu}),n.d(e,"BoundingBoxHelper",function(){return Ou}),n.d(e,"EdgesHelper",function(){return Iu}),n.d(e,"WireframeHelper",function(){return Nu}),n.d(e,"XHRLoader",function(){return Uu}),n.d(e,"BinaryTextureLoader",function(){return Du}),n.d(e,"GeometryUtils",function(){return Fu}),n.d(e,"ImageUtils",function(){return Bu}),n.d(e,"Projector",function(){return zu}),n.d(e,"CanvasRenderer",function(){return Gu}),n.d(e,"SceneUtils",function(){return Hu}),n.d(e,"LensFlare",function(){return ku}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(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>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&n]+t[n>>8&255]+"-"+t[n>>16&15|64]+t[n>>24&255]+"-"+t[63&r|128]+t[r>>8&255]+"-"+t[r>>16&255]+t[r>>24&255]+t[255&i]+t[i>>8&255]+t[i>>16&255]+t[i>>24&255]}}(),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,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},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*Ve.DEG2RAD},radToDeg:function(t){return t*Ve.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function We(t,e){this.x=t||0,this.y=e||0}function Xe(){this.elements=[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.")}function Ye(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1}function qe(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function Ze(){this.elements=[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.defineProperties(We.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(We.prototype,{isVector2:!0,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)}return this},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 this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},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:(i=new We,o=new We,function(t,e){return i.set(t,t),o.set(e,e),this.clamp(i,o)}),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},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},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},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},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}}),Object.assign(Xe.prototype,{isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,c,u,h,l,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=h,g[14]=l,g[3]=d,g[7]=p,g[11]=f,g[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 Xe).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],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:(l=new qe,function(t){var e=this.elements,n=t.elements,r=1/l.setFromMatrixColumn(t,0).length(),i=1/l.setFromMatrixColumn(t,1).length(),o=1/l.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,this}),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),c=Math.sin(r),u=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){var l=o*u,d=o*h,p=a*u,f=a*h;e[0]=s*u,e[4]=-s*h,e[8]=c,e[1]=d+p*c,e[5]=l-f*c,e[9]=-a*s,e[2]=f-l*c,e[6]=p+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){l=o*u,d=o*h,p=a*u,f=a*h;e[0]=s*u,e[4]=p*c-d,e[8]=l*c+f,e[1]=s*h,e[5]=f*c+l,e[9]=d*c-p,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var x=o*s,b=o*c,w=a*s,_=a*c;e[0]=s*u,e[4]=_-x*h,e[8]=w*h+b,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=b*h+w,e[10]=x-_*h}else if("XZY"===t.order){x=o*s,b=o*c,w=a*s,_=a*c;e[0]=s*u,e[4]=-h,e[8]=c*u,e[1]=x*h+_,e[5]=o*u,e[9]=b*h-w,e[2]=w*h-b,e[6]=a*u,e[10]=_*h+x}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,r=t._y,i=t._z,o=t._w,a=n+n,s=r+r,c=i+i,u=n*a,h=n*s,l=n*c,d=r*s,p=r*c,f=i*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+f),e[4]=h-v,e[8]=l+g,e[1]=h+v,e[5]=1-(u+f),e[9]=p-m,e[2]=l-g,e[6]=p+m,e[10]=1-(u+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:(c=new qe,u=new qe,h=new qe,function(t,e,n){var r=this.elements;return h.subVectors(t,e),0===h.lengthSq()&&(h.z=1),h.normalize(),c.crossVectors(n,h),0===c.lengthSq()&&(1===Math.abs(n.z)?h.x+=1e-4:h.z+=1e-4,h.normalize(),c.crossVectors(n,h)),c.normalize(),u.crossVectors(h,c),r[0]=c.x,r[4]=u.x,r[8]=h.x,r[1]=c.y,r[5]=u.y,r[9]=h.y,r[2]=c.z,r[6]=u.z,r[10]=h.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,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],u=n[1],h=n[5],l=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],E=r[12],T=r[1],S=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],O=r[14],I=r[3],N=r[7],U=r[11],D=r[15];return i[0]=o*w+a*T+s*R+c*I,i[4]=o*_+a*S+s*C+c*N,i[8]=o*M+a*A+s*P+c*U,i[12]=o*E+a*L+s*O+c*D,i[1]=u*w+h*T+l*R+d*I,i[5]=u*_+h*S+l*C+d*N,i[9]=u*M+h*A+l*P+d*U,i[13]=u*E+h*L+l*O+d*D,i[2]=p*w+f*T+m*R+g*I,i[6]=p*_+f*S+m*C+g*N,i[10]=p*M+f*A+m*P+g*U,i[14]=p*E+f*L+m*O+g*D,i[3]=v*w+y*T+x*R+b*I,i[7]=v*_+y*S+x*C+b*N,i[11]=v*M+y*A+x*P+b*U,i[15]=v*E+y*L+x*O+b*D,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},applyToBufferAttribute:function(){var t=new qe;return function(e){for(var n=0,r=e.count;n=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*v;if(s=s*m+l*w,c=c*m+d*w,u=u*m+p*w,h=h*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=_,c*=_,u*=_,h*=_}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),Object.defineProperties(Ye.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Ye.prototype,{set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(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)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(n/2),u=a(r/2),h=a(i/2),l=s(n/2),d=s(r/2),p=s(i/2);return"XYZ"===o?(this._x=l*u*h+c*d*p,this._y=c*d*h-l*u*p,this._z=c*u*p+l*d*h,this._w=c*u*h-l*d*p):"YXZ"===o?(this._x=l*u*h+c*d*p,this._y=c*d*h-l*u*p,this._z=c*u*p-l*d*h,this._w=c*u*h+l*d*p):"ZXY"===o?(this._x=l*u*h-c*d*p,this._y=c*d*h+l*u*p,this._z=c*u*p+l*d*h,this._w=c*u*h-l*d*p):"ZYX"===o?(this._x=l*u*h-c*d*p,this._y=c*d*h+l*u*p,this._z=c*u*p-l*d*h,this._w=c*u*h+l*d*p):"YZX"===o?(this._x=l*u*h+c*d*p,this._y=c*d*h+l*u*p,this._z=c*u*p-l*d*h,this._w=c*u*h-l*d*p):"XZY"===o&&(this._x=l*u*h-c*d*p,this._y=c*d*h-l*u*p,this._z=c*u*p+l*d*h,this._w=c*u*h+l*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],c=n[9],u=n[2],h=n[6],l=n[10],d=r+s+l;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-u)*e,this._z=(a-i)*e):r>s&&r>l?(e=2*Math.sqrt(1+r-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+u)/e):s>l?(e=2*Math.sqrt(1+s-r-l),this._w=(o-u)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-r-s),this._w=(a-i)/e,this._x=(o+u)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new qe;return function(n,r){return void 0===e&&(e=new qe),(t=n.dot(r)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate()},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,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=n*u+o*a+r*c-i*s,this._y=r*u+o*s+i*a-n*c,this._z=i*u+o*c+n*s-r*a,this._w=o*u-n*a-r*s-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=o*u+this._w*h,this._x=n*u+this._x*h,this._y=r*u+this._y*h,this._z=i*u+this._z*h,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(qe.prototype,{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)}return this},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 this.x*=t,this.y*=t,this.z*=t,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:(d=new Ye,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(d.setFromEuler(t))}),applyAxisAngle:function(){var t=new Ye;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*r-a*n,u=s*n+a*e-i*r,h=s*r+i*n-o*e,l=-i*e-o*n-a*r;return this.x=c*s+l*-i+u*-a-h*-o,this.y=u*s+l*-o+h*-i-c*-a,this.z=h*s+l*-a+c*-o-u*-i,this},project:function(){var t=new Xe;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new Xe;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,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=new qe,e=new qe;return function(n,r){return t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},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){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new qe;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new qe;return function(e){return 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(Ve.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,r=this.z-t.z;return e*e+n*n+r*r},manhattanDistanceTo: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},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){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},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Ze.prototype,{isMatrix3:!0,set:function(t,e,n,r,i,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=i,u[5]=s,u[6]=n,u[7]=o,u[8]=c,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=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[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},applyToBufferAttribute:function(){var t=new qe;return function(e){for(var n=0,r=e.count;n2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(r)}),n.image=r.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===gt){if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Et:t.x=t.x-Math.floor(t.x);break;case Tt:t.x=t.x<0?0:1;break;case St: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 Et:t.y=t.y-Math.floor(t.y);break;case Tt:t.y=t.y<0?0:1;break;case St: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.defineProperty(Ke.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Qe.prototype,{isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,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)}return this},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 this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,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,r,i,o=t.elements,a=o[0],s=o[4],c=o[8],u=o[1],h=o[5],l=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(c-d)<.01&&Math.abs(l-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(c+d)<.1&&Math.abs(l+p)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+u)/4,x=(c+d)/4,b=(l+p)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(m)),i=x/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(g)),i=b/r):v<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(v)),r=b/i),this.set(n,r,i,e),this}var w=Math.sqrt((p-l)*(p-l)+(c-d)*(c-d)+(u-s)*(u-s));return Math.abs(w)<.001&&(w=1),this.x=(p-l)/w,this.y=(c-d)/w,this.z=(u-s)/w,this.w=Math.acos((a+h+f-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(n,r){return void 0===t&&(t=new Qe,e=new Qe),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},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)},manhattanLength: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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},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},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),$e.prototype=Object.assign(Object.create(r.prototype),{constructor:$e,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"})}}),tn.prototype=Object.create($e.prototype),tn.prototype.constructor=tn,tn.prototype.isWebGLRenderTargetCube=!0,en.prototype=Object.create(Ke.prototype),en.prototype.constructor=en,en.prototype.isDataTexture=!0,nn.prototype=Object.create(Ke.prototype),nn.prototype.constructor=nn,nn.prototype.isCubeTexture=!0,Object.defineProperty(nn.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var rn=new Ke,on=new nn;function an(){this.seq=[],this.map={}}var sn=[],cn=[],un=new Float32Array(16),hn=new Float32Array(9);function ln(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=sn[i];if(void 0===o&&(o=new Float32Array(i),sn[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function dn(t,e){var n=cn[e];void 0===n&&(n=new Int32Array(e),cn[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function pn(t,e){t.uniform1f(this.addr,e)}function fn(t,e){t.uniform1i(this.addr,e)}function mn(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function gn(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 vn(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function yn(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function xn(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(hn.set(e.elements),t.uniformMatrix3fv(this.addr,!1,hn))}function bn(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(un.set(e.elements),t.uniformMatrix4fv(this.addr,!1,un))}function wn(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||rn,r)}function _n(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||on,r)}function Mn(t,e){t.uniform2iv(this.addr,e)}function En(t,e){t.uniform3iv(this.addr,e)}function Tn(t,e){t.uniform4iv(this.addr,e)}function Sn(t,e){t.uniform1fv(this.addr,e)}function An(t,e){t.uniform1iv(this.addr,e)}function Ln(t,e){t.uniform2fv(this.addr,ln(e,this.size,2))}function Rn(t,e){t.uniform3fv(this.addr,ln(e,this.size,3))}function Cn(t,e){t.uniform4fv(this.addr,ln(e,this.size,4))}function Pn(t,e){t.uniformMatrix2fv(this.addr,!1,ln(e,this.size,4))}function On(t,e){t.uniformMatrix3fv(this.addr,!1,ln(e,this.size,9))}function In(t,e){t.uniformMatrix4fv(this.addr,!1,ln(e,this.size,16))}function Nn(t,e,n){var r=e.length,i=dn(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||rn,i[o])}function Un(t,e,n){var r=e.length,i=dn(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||on,i[o])}function Dn(t,e,n){this.id=t,this.addr=n,this.setValue=function(t){switch(t){case 5126:return pn;case 35664:return mn;case 35665:return gn;case 35666:return vn;case 35674:return yn;case 35675:return xn;case 35676:return bn;case 35678:case 36198:return wn;case 35680:return _n;case 5124:case 35670:return fn;case 35667:case 35671:return Mn;case 35668:case 35672:return En;case 35669:case 35673:return Tn}}(e.type)}function Fn(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Sn;case 35664:return Ln;case 35665:return Rn;case 35666:return Cn;case 35674:return Pn;case 35675:return On;case 35676:return In;case 35678:return Nn;case 35680:return Un;case 5124:case 35670:return An;case 35667:case 35671:return Mn;case 35668:case 35672:return En;case 35669:case 35673:return Tn}}(e.type)}function Bn(t){this.id=t,an.call(this)}Bn.prototype.setValue=function(t,e){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var o=n[r];o.setValue(t,e[o.id])}};var zn=/([\w\d_]+)(\])?(\[|\.)?/g;function Gn(t,e){t.seq.push(e),t.map[e.id]=e}function Hn(t,e,n){var r=t.name,i=r.length;for(zn.lastIndex=0;;){var o=zn.exec(r),a=zn.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s|=0),void 0===u||"["===u&&a+2===i){Gn(n,void 0===u?new Dn(s,t,e):new Fn(s,t,e));break}var h=n.map[s];void 0===h&&Gn(n,h=new Bn(s)),n=h}}function kn(t,e,n){an.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i>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,r){if(e=Ve.euclideanModulo(e,1),n=Ve.clamp(n,0,1),r=Ve.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,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 r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u,h=(u=n[1]).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}t&&t.length>0&&(void 0!==(u=jn[t])?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,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),c=Math.min(i,o,a),u=(c+s)/2;if(c===s)e=0,n=0;else{var h=s-c;switch(n=u<=.5?h/(s+c):h/(2-s-c),s){case i:e=(o-a)/h+(o 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},qn={basic:{uniforms:Xn.merge([Wn.common,Wn.specularmap,Wn.envmap,Wn.aomap,Wn.lightmap,Wn.fog]),vertexShader:Yn.meshbasic_vert,fragmentShader:Yn.meshbasic_frag},lambert:{uniforms:Xn.merge([Wn.common,Wn.specularmap,Wn.envmap,Wn.aomap,Wn.lightmap,Wn.emissivemap,Wn.fog,Wn.lights,{emissive:{value:new Vn(0)}}]),vertexShader:Yn.meshlambert_vert,fragmentShader:Yn.meshlambert_frag},phong:{uniforms:Xn.merge([Wn.common,Wn.specularmap,Wn.envmap,Wn.aomap,Wn.lightmap,Wn.emissivemap,Wn.bumpmap,Wn.normalmap,Wn.displacementmap,Wn.gradientmap,Wn.fog,Wn.lights,{emissive:{value:new Vn(0)},specular:{value:new Vn(1118481)},shininess:{value:30}}]),vertexShader:Yn.meshphong_vert,fragmentShader:Yn.meshphong_frag},standard:{uniforms:Xn.merge([Wn.common,Wn.envmap,Wn.aomap,Wn.lightmap,Wn.emissivemap,Wn.bumpmap,Wn.normalmap,Wn.displacementmap,Wn.roughnessmap,Wn.metalnessmap,Wn.fog,Wn.lights,{emissive:{value:new Vn(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Yn.meshphysical_vert,fragmentShader:Yn.meshphysical_frag},points:{uniforms:Xn.merge([Wn.points,Wn.fog]),vertexShader:Yn.points_vert,fragmentShader:Yn.points_frag},dashed:{uniforms:Xn.merge([Wn.common,Wn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Yn.linedashed_vert,fragmentShader:Yn.linedashed_frag},depth:{uniforms:Xn.merge([Wn.common,Wn.displacementmap]),vertexShader:Yn.depth_vert,fragmentShader:Yn.depth_frag},normal:{uniforms:Xn.merge([Wn.common,Wn.bumpmap,Wn.normalmap,Wn.displacementmap,{opacity:{value:1}}]),vertexShader:Yn.normal_vert,fragmentShader:Yn.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Yn.cube_vert,fragmentShader:Yn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Yn.equirect_vert,fragmentShader:Yn.equirect_frag},distanceRGBA:{uniforms:Xn.merge([Wn.common,Wn.displacementmap,{referencePosition:{value:new qe},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Yn.distanceRGBA_vert,fragmentShader:Yn.distanceRGBA_frag},shadow:{uniforms:Xn.merge([Wn.lights,Wn.fog,{color:{value:new Vn(0)},opacity:{value:1}}]),vertexShader:Yn.shadow_vert,fragmentShader:Yn.shadow_frag}};function Zn(t,e,n,r,i,o,a,s,c){Ke.call(this,t,e,n,r,i,o,a,s,c),this.needsUpdate=!0}function Jn(t,e,n,r,i){var o,a,s,c,u,h,l=new qe,d=new Ye,p=new qe;function f(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);o=e.createBuffer(),a=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,a),e.bufferData(e.ELEMENT_ARRAY_BUFFER,n,e.STATIC_DRAW),s=function(){var t=e.createProgram(),n=e.createShader(e.VERTEX_SHADER),r=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(n,["precision "+i.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 center;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float fogDepth;","void main() {","\tvUV = uvOffset + uv * uvScale;","\tvec2 alignedPosition = ( position - center ) * scale;","\tvec2 rotatedPosition;","\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","\tvec4 mvPosition;","\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","\tmvPosition.xy += rotatedPosition;","\tgl_Position = projectionMatrix * mvPosition;","\tfogDepth = - mvPosition.z;","}"].join("\n")),e.shaderSource(r,["precision "+i.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvec4 texture = texture2D( map, vUV );","\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","\tif ( gl_FragColor.a < alphaTest ) discard;","\tif ( fogType > 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),e.compileShader(n),e.compileShader(r),e.attachShader(t,n),e.attachShader(t,r),e.linkProgram(t),t}(),c={position:e.getAttribLocation(s,"position"),uv:e.getAttribLocation(s,"uv")},u={uvOffset:e.getUniformLocation(s,"uvOffset"),uvScale:e.getUniformLocation(s,"uvScale"),rotation:e.getUniformLocation(s,"rotation"),center:e.getUniformLocation(s,"center"),scale:e.getUniformLocation(s,"scale"),color:e.getUniformLocation(s,"color"),map:e.getUniformLocation(s,"map"),opacity:e.getUniformLocation(s,"opacity"),modelViewMatrix:e.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:e.getUniformLocation(s,"projectionMatrix"),fogType:e.getUniformLocation(s,"fogType"),fogDensity:e.getUniformLocation(s,"fogDensity"),fogNear:e.getUniformLocation(s,"fogNear"),fogFar:e.getUniformLocation(s,"fogFar"),fogColor:e.getUniformLocation(s,"fogColor"),fogDepth:e.getUniformLocation(s,"fogDepth"),alphaTest:e.getUniformLocation(s,"alphaTest")};var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=8,r.height=8;var l=r.getContext("2d");l.fillStyle="white",l.fillRect(0,0,8,8),h=new Zn(r)}function m(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(i,g,v){if(0!==i.length){void 0===s&&f(),n.useProgram(s),n.initAttributes(),n.enableAttribute(c.position),n.enableAttribute(c.uv),n.disableUnusedAttributes(),n.disable(e.CULL_FACE),n.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(c.position,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(c.uv,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,a),e.uniformMatrix4fv(u.projectionMatrix,!1,v.projectionMatrix.elements),n.activeTexture(e.TEXTURE0),e.uniform1i(u.map,0);var y=0,x=0,b=g.fog;b?(e.uniform3f(u.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(e.uniform1f(u.fogNear,b.near),e.uniform1f(u.fogFar,b.far),e.uniform1i(u.fogType,1),y=1,x=1):b.isFogExp2&&(e.uniform1f(u.fogDensity,b.density),e.uniform1i(u.fogType,2),y=2,x=2)):(e.uniform1i(u.fogType,0),y=0,x=0);for(var w=0,_=i.length;w<_;w++){(T=i[w]).modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,T.matrixWorld),T.z=-T.modelViewMatrix.elements[14]}i.sort(m);var M=[],E=[];for(w=0,_=i.length;w<_;w++){var T,S=(T=i[w]).material;if(!1!==S.visible){T.onBeforeRender(t,g,v,void 0,S,void 0),e.uniform1f(u.alphaTest,S.alphaTest),e.uniformMatrix4fv(u.modelViewMatrix,!1,T.modelViewMatrix.elements),T.matrixWorld.decompose(l,d,p),M[0]=p.x,M[1]=p.y,E[0]=T.center.x-.5,E[1]=T.center.y-.5;var A=0;g.fog&&S.fog&&(A=x),y!==A&&(e.uniform1i(u.fogType,A),y=A),null!==S.map?(e.uniform2f(u.uvOffset,S.map.offset.x,S.map.offset.y),e.uniform2f(u.uvScale,S.map.repeat.x,S.map.repeat.y)):(e.uniform2f(u.uvOffset,0,0),e.uniform2f(u.uvScale,1,1)),e.uniform1f(u.opacity,S.opacity),e.uniform3f(u.color,S.color.r,S.color.g,S.color.b),e.uniform1f(u.rotation,S.rotation),e.uniform2fv(u.center,E),e.uniform2fv(u.scale,M),n.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst,S.blendEquationAlpha,S.blendSrcAlpha,S.blendDstAlpha,S.premultipliedAlpha),n.buffers.depth.setTest(S.depthTest),n.buffers.depth.setMask(S.depthWrite),n.buffers.color.setMask(S.colorWrite),r.setTexture2D(S.map||h,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0),T.onAfterRender(t,g,v,void 0,S,void 0)}}n.enable(e.CULL_FACE),n.reset()}}}qn.physical={uniforms:Xn.merge([qn.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Yn.meshphysical_vert,fragmentShader:Yn.meshphysical_frag},Zn.prototype=Object.create(Ke.prototype),Zn.prototype.constructor=Zn;var Kn,Qn,$n,tr,er,nr,rr,ir=0;function or(){Object.defineProperty(this,"id",{value:ir++}),this.uuid=Ve.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=I,this.side=E,this.flatShading=!1,this.vertexColors=R,this.opacity=1,this.transparent=!1,this.blendSrc=Y,this.blendDst=q,this.blendEquation=B,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=rt,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function ar(t){or.call(this),this.type="MeshDepthMaterial",this.depthPacking=ke,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)}function sr(t){or.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new qe,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(t)}function cr(t,e){this.min=void 0!==t?t:new qe(1/0,1/0,1/0),this.max=void 0!==e?e:new qe(-1/0,-1/0,-1/0)}function ur(t,e){this.center=void 0!==t?t:new qe,this.radius=void 0!==e?e:0}function hr(t,e){this.normal=void 0!==t?t:new qe(1,0,0),this.constant=void 0!==e?e:0}function lr(t,e,n,r,i,o){this.planes=[void 0!==t?t:new hr,void 0!==e?e:new hr,void 0!==n?n:new hr,void 0!==r?r:new hr,void 0!==i?i:new hr,void 0!==o?o:new hr]}function dr(t,e,n){for(var r=new lr,i=new Xe,o=new We,a=new We(n,n),s=new qe,c=new qe,u=1,h=2,l=1+(u|h),d=new Array(l),p=new Array(l),f={},m={0:T,1:E,2:S},g=[new qe(1,0,0),new qe(-1,0,0),new qe(0,0,1),new qe(0,0,-1),new qe(0,1,0),new qe(0,-1,0)],v=[new qe(0,1,0),new qe(0,1,0),new qe(0,1,0),new qe(0,1,0),new qe(0,0,1),new qe(0,0,-1)],y=[new Qe,new Qe,new Qe,new Qe,new Qe,new Qe],x=0;x!==l;++x){var b=0!=(x&u),w=0!=(x&h),M=new ar({depthPacking:je,morphTargets:b,skinning:w});d[x]=M;var A=new sr({morphTargets:b,skinning:w});p[x]=A}var L=this;function R(e,n,r,i,o,a){var s=e.geometry,c=null,l=d,g=e.customDepthMaterial;if(r&&(l=p,g=e.customDistanceMaterial),g)c=g;else{var v=!1;n.morphTargets&&(s&&s.isBufferGeometry?v=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(v=s.morphTargets&&s.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var y=e.isSkinnedMesh&&n.skinning,x=0;v&&(x|=u),y&&(x|=h),c=l[x]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var b=c.uuid,w=n.uuid,_=f[b];void 0===_&&(_={},f[b]=_);var M=_[w];void 0===M&&(M=c.clone(),_[w]=M),c=M}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:m[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,r&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(i),c.nearDistance=o,c.farDistance=a),c}function C(n,i,o,a){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);var s=e.update(n),u=n.material;if(Array.isArray(u))for(var h=s.groups,l=0,d=h.length;l0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var i=r(t.textures),o=r(t.images);i.length>0&&(n.textures=i),o.length>0&&(n.images=o)}return n},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.flatShading=t.flatShading,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.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ar.prototype=Object.create(or.prototype),ar.prototype.constructor=ar,ar.prototype.isMeshDepthMaterial=!0,ar.prototype.copy=function(t){return or.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},sr.prototype=Object.create(or.prototype),sr.prototype.constructor=sr,sr.prototype.isMeshDistanceMaterial=!0,sr.prototype.copy=function(t){return or.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,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},Object.assign(cr.prototype,{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,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;si&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;si&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.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){return(e||new qe).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.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:(Qn=new qe,function(t){return this.clampPoint(t.center,Qn),Qn.distanceToSquared(t.center)<=t.radius*t.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},intersectsTriangle:function(){var t=new qe,e=new qe,n=new qe,r=new qe,i=new qe,o=new qe,a=new qe,s=new qe,c=new qe,u=new qe;function h(r){var i,o;for(i=0,o=r.length-3;i<=o;i+=3){a.fromArray(r,i);var s=c.x*Math.abs(a.x)+c.y*Math.abs(a.y)+c.z*Math.abs(a.z),u=t.dot(a),h=e.dot(a),l=n.dot(a);if(Math.max(-Math.max(u,h,l),Math.min(u,h,l))>s)return!1}return!0}return function(a){if(this.isEmpty())return!1;this.getCenter(s),c.subVectors(this.max,s),t.subVectors(a.a,s),e.subVectors(a.b,s),n.subVectors(a.c,s),r.subVectors(e,t),i.subVectors(n,e),o.subVectors(t,n);var l=[0,-r.z,r.y,0,-i.z,i.y,0,-o.z,o.y,r.z,0,-r.x,i.z,0,-i.x,o.z,0,-o.x,-r.y,r.x,0,-i.y,i.x,0,-o.y,o.x,0];return!!h(l)&&(!!h(l=[1,0,0,0,1,0,0,0,1])&&(u.crossVectors(r,i),h(l=[u.x,u.y,u.z])))}}(),clampPoint:function(t,e){return(e||new qe).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new qe;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new qe;return function(e){var n=e||new ur;return this.getCenter(n.center),n.radius=.5*this.getSize(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:(Kn=[new qe,new qe,new qe,new qe,new qe,new qe,new qe,new qe],function(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),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)}}),Object.assign(ur.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:($n=new cr,function(t,e){var n=this.center;void 0!==e?n.copy(e):$n.setFromPoints(t).getCenter(n);for(var r=0,i=0,o=t.length;ithis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new cr;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}}),Object.assign(hr.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new qe,e=new qe;return function(n,r,i){var o=t.subVectors(i,r).cross(e.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,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(e||new qe).copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new qe;return function(e,n){var r=n||new qe,i=e.delta(t),o=this.normal.dot(i);if(0===o)return 0===this.distanceToPoint(e.start)?r.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/o;return a<0||a>1?void 0:r.copy(i).multiplyScalar(a).add(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){return(t||new qe).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new qe,e=new Ze;return function(n,r){var i=r||e.getNormalMatrix(n),o=this.coplanarPoint(t).applyMatrix4(n),a=this.normal.applyMatrix3(i).normalize();return this.constant=-o.dot(a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(lr.prototype,{set:function(t,e,n,r,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),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,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],c=n[5],u=n[6],h=n[7],l=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-r,h-s,f-l,y-m).normalize(),e[1].setComponents(a+r,h+s,f+l,y+m).normalize(),e[2].setComponents(a+i,h+c,f+d,y+g).normalize(),e[3].setComponents(a-i,h-c,f-d,y-g).normalize(),e[4].setComponents(a-o,h-u,f-p,y-v).normalize(),e[5].setComponents(a+o,h+u,f+p,y+v).normalize(),this},intersectsObject:(nr=new ur,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),nr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)}),intersectsSprite:function(){var t=new ur;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,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.min.x:t.max.x,er.x=r.normal.x>0?t.max.x:t.min.x,tr.y=r.normal.y>0?t.min.y:t.max.y,er.y=r.normal.y>0?t.max.y:t.min.y,tr.z=r.normal.z>0?t.min.z:t.max.z,er.z=r.normal.z>0?t.max.z:t.min.z;var i=r.distanceToPoint(tr),o=r.distanceToPoint(er);if(i<0&&o<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}}),fr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],fr.DefaultOrder="XYZ",Object.defineProperties(fr.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(fr.prototype,{isEuler:!0,set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||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 r=Ve.clamp,i=t.elements,o=i[0],a=i[4],s=i[8],c=i[1],u=i[5],h=i[9],l=i[2],d=i[6],p=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-l,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===e?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,u),this._y=Math.atan2(-l,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(d,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-h,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new Xe;return function(e,n,r){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(rr=new Ye,function(t){return rr.setFromEuler(this),this.setFromQuaternion(rr,t)}),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 qe(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(mr.prototype,{set:function(t){this.mask=1<1){for(var e=0;e1){for(var e=0;e0){r.children=[];for(s=0;s0&&(n.geometries=l),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),f.length>0&&(n.images=f),a.length>0&&(n.shapes=a)}return n.object=r,n;function m(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}},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.layers.mask=t.layers.mask,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)),!0===e)for(var n=0;ne&&(e=t[n]);return e}Ar.prototype=Object.assign(Object.create(r.prototype),{constructor:Ar,isGeometry:!0,applyMatrix:function(t){for(var e=(new Ze).getNormalMatrix(t),n=0,r=this.vertices.length;n0)for(d=0;d0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n=0;n--){var f=d[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x,0,0),1,!0),2,!1),3,f),4,m),5,g),6,v),7,y),a.push(x),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var b=this.faceVertexUvs[0][i];a.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&a.push(E(p.normal)),g){var w=p.vertexNormals;a.push(E(w[0]),E(w[1]),E(w[2]))}if(v&&a.push(T(p.color)),y){var _=p.vertexColors;a.push(T(_[0]),T(_[1]),T(_[2]))}}function M(t,e,n){return n?t|1<0&&(t.data.colors=u),l.length>0&&(t.data.uvs=[l]),t.data.faces=a,t},clone:function(){return(new Ar).copy(this)},copy:function(t){var e,n,r,i,o,a;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.name=t.name;var s=t.vertices;for(e=0,n=s.length;e0,a=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var u=0;u0){h=[];for(u=0;u0?1:-1,u.push(R.x,R.y,R.z),h.push(y/m),h.push(1-x/g),A+=1}}for(x=0;x1&&n.sort(oi),r.length>1&&r.sort(ai)}}},t[r]=i),i},dispose:function(){t={}}}}function ci(t,e){return Math.abs(e[1])-Math.abs(t[1])}function ui(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),!1===t.getShaderParameter(r,t.COMPILE_STATUS)&&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),function(t){for(var e=t.split("\n"),n=0;n65535?Ur:Ir)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new Lr(arguments[1],arguments[2])))},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.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new Ze).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new Xe;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new Xe;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new Xe;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new Xe;return function(e,n,r){return t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t=new Xe;return function(e,n,r){return t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t=new wr;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Dr(3*e.vertices.length,3),r=new Dr(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new Dr(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],n=0,r=t.length;n0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Lr(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new Lr(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Lr(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Lr(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=new(zr(t.indices)>65535?Uint32Array:Uint16Array)(3*t.indices.length);this.setIndex(new Lr(a,1).copyIndicesArray(t.indices))}for(var s in this.groups=t.groups,t.morphTargets){for(var c=[],u=t.morphTargets[s],h=0,l=u.length;h0){var f=new Dr(4*t.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var m=new Dr(4*t.skinWeights.length,4);this.addAttribute("skinWeight",m.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 cr);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(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 cr,e=new qe;return function(){null===this.boundingSphere&&(this.boundingSphere=new ur);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(r);for(var i=0,o=0,a=n.count;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new qr).copy(this)},copy:function(t){var e,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],u=s[e];for(n=0,r=u.length;n0)if(o=u*h-l,s=c*p,(i=u*l-h)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(i*=f)*(i+u*(o*=f)+2*h)+o*(u*i+o+2*l)+d}else o=c,a=-(i=Math.max(0,-(u*o+h)))*i+o*(o+2*l)+d;else o=-c,a=-(i=Math.max(0,-(u*o+h)))*i+o*(o+2*l)+d;else o<=-s?a=-(i=Math.max(0,-(-u*c+h)))*i+(o=i>0?-c:Math.min(Math.max(-c,-l),c))*(o+2*l)+d:o<=s?(i=0,a=(o=Math.min(Math.max(-c,-l),c))*(o+2*l)+d):a=-(i=Math.max(0,-(u*c+h)))*i+(o=i>0?c:Math.min(Math.max(-c,-l),c))*(o+2*l)+d;else o=u>0?-c:c,a=-(i=Math.max(0,-(u*o+h)))*i+o*(o+2*l)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(kr).multiplyScalar(o).add(Hr),a}),intersectSphere:function(){var t=new qe;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,c=r+a;return s<0&&c<0?null:s<0?this.at(c,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);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,r,i,o,a,s,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,l=this.origin;return c>=0?(n=(t.min.x-l.x)*c,r=(t.max.x-l.x)*c):(n=(t.max.x-l.x)*c,r=(t.min.x-l.x)*c),u>=0?(i=(t.min.y-l.y)*u,o=(t.max.y-l.y)*u):(i=(t.max.y-l.y)*u,o=(t.min.y-l.y)*u),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o=0?(a=(t.min.z-l.z)*h,s=(t.max.z-l.z)*h):(a=(t.max.z-l.z)*h,s=(t.min.z-l.z)*h),n>s||a>r?null:((a>n||n!=n)&&(n=a),(s=0?n:r,e)))},intersectsBox:(Gr=new qe,function(t){return null!==this.intersectBox(t,Gr)}),intersectTriangle:function(){var t=new qe,e=new qe,n=new qe,r=new qe;return function(i,o,a,s,c){e.subVectors(o,i),n.subVectors(a,i),r.crossVectors(e,n);var u,h=this.direction.dot(r);if(h>0){if(s)return null;u=1}else{if(!(h<0))return null;u=-1,h=-h}t.subVectors(this.origin,i);var l=u*this.direction.dot(n.crossVectors(t,n));if(l<0)return null;var d=u*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>h)return null;var p=-u*t.dot(r);return p<0?null:this.at(p/h,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(ni.prototype,{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},getCenter:function(t){return(t||new qe).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new qe).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 qe;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(Vr=new qe,Wr=new qe,function(t,e){Vr.subVectors(t,this.start),Wr.subVectors(this.end,this.start);var n=Wr.dot(Wr),r=Wr.dot(Vr)/n;return e&&(r=Ve.clamp(r,0,1)),r}),closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e),i=n||new qe;return this.delta(i).multiplyScalar(r).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)}}),Object.assign(ri,{normal:(Xr=new qe,function(t,e,n,r){var i=r||new qe;i.subVectors(n,e),Xr.subVectors(t,e),i.cross(Xr);var o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}),barycoordFromPoint:function(){var t=new qe,e=new qe,n=new qe;return function(r,i,o,a,s){t.subVectors(a,i),e.subVectors(o,i),n.subVectors(r,i);var c=t.dot(t),u=t.dot(e),h=t.dot(n),l=e.dot(e),d=e.dot(n),p=c*l-u*u,f=s||new qe;if(0===p)return f.set(-2,-1,-1);var m=1/p,g=(l*h-u*d)*m,v=(c*d-u*h)*m;return f.set(1-g-v,v,g)}}(),containsPoint:function(){var t=new qe;return function(e,n,r,i){var o=ri.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(ri.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),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 qe,e=new qe;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new qe).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return ri.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new hr).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return ri.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return ri.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(){var t=new hr,e=[new ni,new ni,new ni],n=new qe,r=new qe;return function(i,o){var a=o||new qe,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,n),!0===this.containsPoint(n))a.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 c=0;c0){var a=i[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=a.length;t0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;tn.far?null:{distance:c,point:f.clone(),object:t}}function v(t,e,n,a,s,c,d,f){r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,d),o.fromBufferAttribute(a,f);var v=g(t,t.material,e,n,r,i,o,p);return v&&(s&&(u.fromBufferAttribute(s,c),h.fromBufferAttribute(s,d),l.fromBufferAttribute(s,f),v.uv=m(p,r,i,o,u,h,l)),v.face=new Er(c,d,f,ri.normal(r,i,o)),v.faceIndex=c),v}return function(d,f){var y,x=this.geometry,b=this.material,w=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),n.copy(x.boundingSphere),n.applyMatrix4(w),!1!==d.ray.intersectsSphere(n)&&(t.getInverse(w),e.copy(d.ray).applyMatrix4(t),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var _,M,E,T,S,A=x.index,L=x.attributes.position,R=x.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(I=F);for(var B=0,z=D.length;B/gm,function(t,e){var n=Yn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return gi(n)})}function vi(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,r){for(var i="",o=parseInt(e);o0?t.gammaFactor:1,b=function(t,e,n){return[(t=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":""].filter(pi).join("\n")}(r.extensions,o,e),w=function(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(s),E=a.createProgram();r.isRawShaderMaterial?((f=[w].filter(pi).join("\n")).length>0&&(f+="\n"),(m=[b,w].filter(pi).join("\n")).length>0&&(m+="\n")):(f=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+i.name,w,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+h:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.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(pi).join("\n"),m=[b,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+i.name,w,o.alphaTest?"#define ALPHATEST "+o.alphaTest:"","#define GAMMA_FACTOR "+x,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+l:"",o.envMap?"#define "+d:"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+h:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&e.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==lt?"#define TONE_MAPPING":"",o.toneMapping!==lt?Yn.tonemapping_pars_fragment:"",o.toneMapping!==lt?function(t,e){var n;switch(e){case dt:n="Linear";break;case pt:n="Reinhard";break;case ft:n="Uncharted2";break;case mt:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?Yn.encodings_pars_fragment:"",o.mapEncoding?di("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?di("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?di("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?(g="linearToOutputTexel",v=o.outputEncoding,y=li(v),"vec4 "+g+"( vec4 value ) { return LinearTo"+y[0]+y[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(pi).join("\n")),c=mi(c=fi(c=gi(c),o),o),u=mi(u=fi(u=gi(u),o),o);var T=f+(c=vi(c)),S=m+(u=vi(u)),A=ui(a,a.VERTEX_SHADER,T),L=ui(a,a.FRAGMENT_SHADER,S);a.attachShader(E,A),a.attachShader(E,L),void 0!==r.index0AttributeName?a.bindAttribLocation(E,0,r.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(E,0,"position"),a.linkProgram(E);var R,C,P=a.getProgramInfoLog(E).trim(),O=a.getShaderInfoLog(A).trim(),I=a.getShaderInfoLog(L).trim(),N=!0,U=!0;return!1===a.getProgramParameter(E,a.LINK_STATUS)?(N=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(E,a.VALIDATE_STATUS),"gl.getProgramInfoLog",P,O,I)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==O&&""!==I||(U=!1),U&&(this.diagnostics={runnable:N,material:r,programLog:P,vertexShader:{log:O,prefix:f},fragmentShader:{log:I,prefix:m}}),a.deleteShader(A),a.deleteShader(L),this.getUniforms=function(){return void 0===R&&(R=new kn(a,E,t)),R},this.getAttributes=function(){return void 0===C&&(C=function(t,e){for(var n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=0;i0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:c,numClipIntersection:u,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&o.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===S,flipSided:e.side===T,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,n){var r=[];if(n.shaderID?r.push(n.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(var a=0;ae||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n),r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function d(t){return Ve.isPowerOfTwo(t.width)&&Ve.isPowerOfTwo(t.height)}function p(t,e){return t.generateMipmaps&&e&&t.minFilter!==At&&t.minFilter!==Ct}function f(e){return e===At||e===Lt||e===Rt?t.NEAREST:t.LINEAR}function m(e){var n=e.target;n.removeEventListener("dispose",m),function(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.remove(e)}(n),n.isVideoTexture&&delete h[n.id],a.textures--}function g(e){var n=e.target;n.removeEventListener("dispose",g),function(e){var n=r.get(e),i=r.get(e.texture);if(!e)return;void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.remove(e.texture),r.remove(e)}(n),a.textures--}function v(e,f){var g=r.get(e);if(e.isVideoTexture&&function(t){var e=t.id,n=s.frame;h[e]!==n&&(h[e]=n,t.update())}(e),e.version>0&&g.__version!==e.version){var v=e.image;if(void 0===v)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==v.complete)return void function(e,r,s){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",m),e.__webglTexture=t.createTexture(),a.textures++);n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var h=l(r.image,i.maxTextureSize);(function(t){return t.wrapS!==Tt||t.wrapT!==Tt||t.minFilter!==At&&t.minFilter!==Ct})(r)&&!1===d(h)&&(h=function(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap?(void 0===c&&(c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),c.width=Ve.floorPowerOfTwo(t.width),c.height=Ve.floorPowerOfTwo(t.height),c.getContext("2d").drawImage(t,0,0,c.width,c.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+c.width+"x"+c.height,t),c):t}(h));var f=d(h),g=o.convert(r.format),v=o.convert(r.type);y(t.TEXTURE_2D,r,f);var x,b=r.mipmaps;if(r.isDepthTexture){var w=t.DEPTH_COMPONENT;if(r.type===zt){if(!u)throw new Error("Float Depth Texture only supported in WebGL2.0");w=t.DEPTH_COMPONENT32F}else u&&(w=t.DEPTH_COMPONENT16);r.format===Kt&&w===t.DEPTH_COMPONENT&&r.type!==Dt&&r.type!==Bt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Dt,v=o.convert(r.type)),r.format===Qt&&(w=t.DEPTH_STENCIL,r.type!==Vt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Vt,v=o.convert(r.type))),n.texImage2D(t.TEXTURE_2D,0,w,h.width,h.height,0,g,v,null)}else if(r.isDataTexture)if(b.length>0&&f){for(var _=0,M=b.length;_-1?n.compressedTexImage2D(t.TEXTURE_2D,_,g,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,_,g,x.width,x.height,0,g,v,x.data);else if(b.length>0&&f){for(var _=0,M=b.length;_1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,i,a,s){var c=o.convert(i.texture.format),u=o.convert(i.texture.type);n.texImage2D(s,0,c,i.width,i.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function b(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 w(e){var n=r.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLRenderTargetCube)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");r.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),v(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Kt)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Qt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),b(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),b(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}this.setTexture2D=v,this.setTextureCube=function(e,s){var c=r.get(e);if(6===e.image.length)if(e.version>0&&c.__version!==e.version){c.__image__webglTextureCube||(e.addEventListener("dispose",m),c.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var u=e&&e.isCompressedTexture,h=e.image[0]&&e.image[0].isDataTexture,f=[],g=0;g<6;g++)f[g]=u||h?h?e.image[g].image:e.image[g]:l(e.image[g],i.maxCubemapSize);var v=d(f[0]),x=o.convert(e.format),b=o.convert(e.type);for(y(t.TEXTURE_CUBE_MAP,e,v),g=0;g<6;g++)if(u)for(var w,_=f[g].mipmaps,M=0,E=_.length;M-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,x,b,w.data);else h?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,f[g].width,f[g].height,0,x,b,f[g].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,x,b,f[g]);p(e,v)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),c.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)},this.setupRenderTarget=function(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",g),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,c=d(e);if(s){i.__webglFramebuffer=[];for(var u=0;u<6;u++)i.__webglFramebuffer[u]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(s){for(n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),y(t.TEXTURE_CUBE_MAP,e.texture,c),u=0;u<6;u++)x(i.__webglFramebuffer[u],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+u);p(e.texture,c)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),y(t.TEXTURE_2D,e.texture,c),x(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),p(e.texture,c)&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&w(e)},this.updateRenderTargetMipmap=function(e){var i=e.texture;if(p(i,d(e))){var o=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}}function wi(t,e,n,r){_r.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!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function _i(t){wi.call(this),this.cameras=t||[]}function Mi(t){var e=this,n=null,r=null,i=null,o=new Xe,a=new Xe;"undefined"!=typeof window&&"VRFrameData"in window&&(r=new window.VRFrameData);var s=new Xe,c=new wi;c.bounds=new Qe(0,0,.5,1),c.layers.enable(1);var u=new wi;u.bounds=new Qe(.5,0,.5,1),u.layers.enable(2);var h,l,d=new _i([c,u]);function p(){if(null!==n&&n.isPresenting){var r=n.getEyeParameters("left"),i=r.renderWidth,o=r.renderHeight;l=t.getPixelRatio(),h=t.getSize(),t.setDrawingBufferSize(2*i,o,1)}else e.enabled&&t.setDrawingBufferSize(h.width,h.height,l)}d.layers.enable(1),d.layers.enable(2),"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",p,!1),this.enabled=!1,this.userHeight=1.6,this.getDevice=function(){return n},this.setDevice=function(t){void 0!==t&&(n=t)},this.setPoseTarget=function(t){void 0!==t&&(i=t)},this.getCamera=function(t){if(null===n)return t;n.depthNear=t.near,n.depthFar=t.far,n.getFrameData(r);var h=r.pose,l=null!==i?i:t;null!==h.position?l.position.fromArray(h.position):l.position.set(0,0,0),null!==h.orientation&&l.quaternion.fromArray(h.orientation);var p=n.stageParameters;if(p?o.fromArray(p.sittingToStandingTransform):o.makeTranslation(0,e.userHeight,0),l.position.applyMatrix4(o),l.updateMatrixWorld(),!1===n.isPresenting)return t;c.near=t.near,u.near=t.near,c.far=t.far,u.far=t.far,d.matrixWorld.copy(t.matrixWorld),d.matrixWorldInverse.copy(t.matrixWorldInverse),c.matrixWorldInverse.fromArray(r.leftViewMatrix),u.matrixWorldInverse.fromArray(r.rightViewMatrix),a.getInverse(o),c.matrixWorldInverse.multiply(a),u.matrixWorldInverse.multiply(a);var f=l.parent;null!==f&&(s.getInverse(f.matrixWorld),c.matrixWorldInverse.multiply(s),u.matrixWorldInverse.multiply(s)),c.matrixWorld.getInverse(c.matrixWorldInverse),u.matrixWorld.getInverse(u.matrixWorldInverse),c.projectionMatrix.fromArray(r.leftProjectionMatrix),u.projectionMatrix.fromArray(r.rightProjectionMatrix),d.projectionMatrix.copy(c.projectionMatrix);var m=n.getLayers();if(m.length){var g=m[0];null!==g.leftBounds&&4===g.leftBounds.length&&c.bounds.fromArray(g.leftBounds),null!==g.rightBounds&&4===g.rightBounds.length&&u.bounds.fromArray(g.rightBounds)}return d},this.getStandingMatrix=function(){return o},this.submitFrame=function(){n&&n.isPresenting&&n.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",p)}}function Ei(t,e){return{convert:function(n){var r;if(n===Et)return t.REPEAT;if(n===Tt)return t.CLAMP_TO_EDGE;if(n===St)return t.MIRRORED_REPEAT;if(n===At)return t.NEAREST;if(n===Lt)return t.NEAREST_MIPMAP_NEAREST;if(n===Rt)return t.NEAREST_MIPMAP_LINEAR;if(n===Ct)return t.LINEAR;if(n===Pt)return t.LINEAR_MIPMAP_NEAREST;if(n===Ot)return t.LINEAR_MIPMAP_LINEAR;if(n===It)return t.UNSIGNED_BYTE;if(n===Ht)return t.UNSIGNED_SHORT_4_4_4_4;if(n===kt)return t.UNSIGNED_SHORT_5_5_5_1;if(n===jt)return t.UNSIGNED_SHORT_5_6_5;if(n===Nt)return t.BYTE;if(n===Ut)return t.SHORT;if(n===Dt)return t.UNSIGNED_SHORT;if(n===Ft)return t.INT;if(n===Bt)return t.UNSIGNED_INT;if(n===zt)return t.FLOAT;if(n===Gt&&null!==(r=e.get("OES_texture_half_float")))return r.HALF_FLOAT_OES;if(n===Wt)return t.ALPHA;if(n===Xt)return t.RGB;if(n===Yt)return t.RGBA;if(n===qt)return t.LUMINANCE;if(n===Zt)return t.LUMINANCE_ALPHA;if(n===Kt)return t.DEPTH_COMPONENT;if(n===Qt)return t.DEPTH_STENCIL;if(n===B)return t.FUNC_ADD;if(n===z)return t.FUNC_SUBTRACT;if(n===G)return t.FUNC_REVERSE_SUBTRACT;if(n===j)return t.ZERO;if(n===V)return t.ONE;if(n===W)return t.SRC_COLOR;if(n===X)return t.ONE_MINUS_SRC_COLOR;if(n===Y)return t.SRC_ALPHA;if(n===q)return t.ONE_MINUS_SRC_ALPHA;if(n===Z)return t.DST_ALPHA;if(n===J)return t.ONE_MINUS_DST_ALPHA;if(n===K)return t.DST_COLOR;if(n===Q)return t.ONE_MINUS_DST_COLOR;if(n===$)return t.SRC_ALPHA_SATURATE;if((n===$t||n===te||n===ee||n===ne)&&null!==(r=e.get("WEBGL_compressed_texture_s3tc"))){if(n===$t)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ee)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ne)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((n===re||n===ie||n===oe||n===ae)&&null!==(r=e.get("WEBGL_compressed_texture_pvrtc"))){if(n===re)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ie)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===oe)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ae)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===se&&null!==(r=e.get("WEBGL_compressed_texture_etc1")))return r.COMPRESSED_RGB_ETC1_WEBGL;if((n===ce||n===ue||n===he||n===le||n===de||n===pe||n===fe||n===me||n===ge||n===ve||n===ye||n===xe||n===be||n===we)&&null!==(r=e.get("WEBGL_compressed_texture_astc")))return n;if((n===H||n===k)&&null!==(r=e.get("EXT_blend_minmax"))){if(n===H)return r.MIN_EXT;if(n===k)return r.MAX_EXT}return n===Vt&&null!==(r=e.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:0}}}wi.prototype=Object.assign(Object.create(_r.prototype),{constructor:wi,isPerspectiveCamera:!0,copy:function(t,e){return _r.prototype.copy.call(this,t,e),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*Ve.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Ve.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Ve.RAD2DEG*Math.atan(Math.tan(.5*Ve.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,r,i,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Ve.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;i+=o.offsetX*r/a,e-=o.offsetY*n/s,r*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(i+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far)},toJSON:function(t){var e=wr.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}}),_i.prototype=Object.assign(Object.create(wi.prototype),{constructor:_i,isArrayCamera:!0});var Ti,Si,Ai,Li,Ri,Ci,Pi,Oi,Ii=0;function Ni(){var t=new function(){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 qe,color:new Vn,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new We};break;case"SpotLight":n={position:new qe,direction:new qe,color:new Vn,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":n={position:new qe,color:new Vn,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new qe,skyColor:new Vn,groundColor:new Vn};break;case"RectAreaLight":n={color:new Vn,position:new qe,halfWidth:new qe,halfHeight:new qe}}return t[e.id]=n,n}}},e={id:Ii++,hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=new qe,r=new Xe,i=new Xe;return{setup:function(o,a,s){for(var c=0,u=0,h=0,l=0,d=0,p=0,f=0,m=0,g=s.matrixWorldInverse,v=0,y=o.length;v0),t.numPlanes=n,t.numIntersection=0}function u(e,n,r,i){var c=null!==e?e.length:0,u=null;if(0!==c){if(u=s.value,!0!==i||null===u){var h=r+4*c,l=n.matrixWorldInverse;a.getNormalMatrix(l),(null===u||u.length0&&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 o=void 0!==n.precision?n.precision:"highp",a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),l=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),f=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=u>0,v=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==r)return r;var n=e.get("EXT_texture_filter_anisotropic");return r=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:l,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}(d,f,t),(x=new function(t,e,n){var r=new function(){var e=!1,n=new Qe,r=null,i=new Qe(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},i=new function(){var e=!1,n=null,r=null,i=null;return{setTest:function(e){e?Y(t.DEPTH_TEST):q(t.DEPTH_TEST)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case tt:t.depthFunc(t.NEVER);break;case et:t.depthFunc(t.ALWAYS);break;case nt:t.depthFunc(t.LESS);break;case rt:t.depthFunc(t.LEQUAL);break;case it:t.depthFunc(t.EQUAL);break;case ot:t.depthFunc(t.GEQUAL);break;case at:t.depthFunc(t.GREATER);break;case st:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},o=new function(){var e=!1,n=null,r=null,i=null,o=null,a=null,s=null,c=null,u=null;return{setTest:function(e){e?Y(t.STENCIL_TEST):q(t.STENCIL_TEST)},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&c===r||(t.stencilOp(e,n,r),a=e,s=n,c=r)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,c=null,u=null}}},a=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),c=new Uint8Array(a),u=new Uint8Array(a),h={},l=null,d=null,p=null,f=null,y=null,x=null,b=null,w=null,_=null,M=!1,E=null,A=null,L=null,R=null,C=null,P=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=!1,z=0,G=t.getParameter(t.VERSION);-1!==G.indexOf("WebGL")?(z=parseFloat(/^WebGL\ ([0-9])/.exec(G)[1]),B=z>=1):-1!==G.indexOf("OpenGL ES")&&(z=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(G)[1]),B=z>=2);var H=null,k={},j=new Qe,V=new Qe;function W(e,n,r){var i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a65535?Ur:Ir)(a,1),e.update(r,t.ELEMENT_ARRAY_BUFFER),i[n.id]=r,r}}}(d,_,_t),E=new function(t,e){var n={};return{update:function(r){var i=e.frame,o=r.geometry,a=t.get(r,o);return n[a.id]!==i&&(o.isGeometry&&a.updateFromObject(r),t.update(a),n[a.id]=i),a},dispose:function(){n={}}}}(M,Mt),B=new function(t){var e={},n=new Float32Array(8);return{update:function(r,i,o,a){var s=r.morphTargetInfluences,c=s.length,u=e[i.id];if(void 0===u){u=[];for(var h=0;h=0){var u=i[s];if(void 0!==u){var h=u.normalized,l=u.itemSize,p=_.get(u);if(void 0===p)continue;var m=p.buffer,g=p.type,v=p.bytesPerElement;if(u.isInterleavedBufferAttribute){var y=u.data,b=y.stride,w=u.offset;y&&y.isInstancedInterleavedBuffer?(x.enableAttributeAndDivisor(c,y.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=y.meshPerAttribute*y.count)):x.enableAttribute(c),d.bindBuffer(d.ARRAY_BUFFER,m),d.vertexAttribPointer(c,l,g,h,b*v,(r*b+w)*v)}else u.isInstancedBufferAttribute?(x.enableAttributeAndDivisor(c,u.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=u.meshPerAttribute*u.count)):x.enableAttribute(c),d.bindBuffer(d.ARRAY_BUFFER,m),d.vertexAttribPointer(c,l,g,h,0,r*l*v)}else if(void 0!==a){var M=a[s];if(void 0!==M)switch(M.length){case 2:d.vertexAttrib2fv(c,M);break;case 3:d.vertexAttrib3fv(c,M);break;case 4:d.vertexAttrib4fv(c,M);break;default:d.vertexAttrib1fv(c,M)}}}}x.disableUnusedAttributes()}(r,s,n),null!==l&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.buffer));var v=1/0;null!==l?v=l.count:void 0!==p&&(v=p.count);var y=n.drawRange.start*m,b=n.drawRange.count*m,w=null!==o?o.start*m:0,E=null!==o?o.count*m:1/0,T=Math.max(y,w),S=Math.min(v,y+b,w+E)-1,A=Math.max(0,S-T+1);if(0!==A){if(i.isMesh)if(!0===r.wireframe)x.setLineWidth(r.wireframeLinewidth*Et()),g.setMode(d.LINES);else switch(i.drawMode){case Pe:g.setMode(d.TRIANGLES);break;case Oe:g.setMode(d.TRIANGLE_STRIP);break;case Ie:g.setMode(d.TRIANGLE_FAN)}else if(i.isLine){var L=r.linewidth;void 0===L&&(L=1),x.setLineWidth(L*Et()),i.isLineSegments?g.setMode(d.LINES):i.isLineLoop?g.setMode(d.LINE_LOOP):g.setMode(d.LINE_STRIP)}else i.isPoints&&g.setMode(d.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&g.renderInstances(n,T,A):g.render(T,A)}},this.compile=function(t,e){(l=C.get(t,e)).init(),t.traverse(function(t){t.isLight&&(l.pushLight(t),t.castShadow&&l.pushShadow(t))}),l.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(p=0;p=0&&t.numSupportedMorphNormals++}var f=r.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=vt.numPlanes,r.numIntersection=vt.numIntersection,f.clippingPlanes=vt.uniform),r.fog=e,r.lightsHash=i.state.hash,t.lights&&(f.ambientLightColor.value=i.state.ambient,f.directionalLights.value=i.state.directional,f.spotLights.value=i.state.spot,f.rectAreaLights.value=i.state.rectArea,f.pointLights.value=i.state.point,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMap.value=i.state.directionalShadowMap,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotShadowMap.value=i.state.spotShadowMap,f.spotShadowMatrix.value=i.state.spotShadowMatrix,f.pointShadowMap.value=i.state.pointShadowMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix);var m=r.program.getUniforms(),g=kn.seqWithValue(m.seq,f);r.uniformsList=g}function Wt(t,e,n,r){ct=0;var i=b.get(n),o=l.state.lights;if(yt&&(xt||t!==Z)){var a=t===Z&&n.id===Y;vt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,a)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==o.state.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===vt.numPlanes&&i.numIntersection===vt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(Vt(n,e,r),n.needsUpdate=!1);var s,c,u=!1,h=!1,p=!1,f=i.program,m=f.getUniforms(),g=i.shader.uniforms;if(x.useProgram(f.program)&&(u=!0,h=!0,p=!0),n.id!==Y&&(Y=n.id,h=!0),u||t!==Z){if(m.setValue(d,"projectionMatrix",t.projectionMatrix),y.logarithmicDepthBuffer&&m.setValue(d,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),Z!==(J||t)&&(Z=J||t,h=!0,p=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var v=m.map.cameraPosition;void 0!==v&&v.setValue(d,wt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&m.setValue(d,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){m.setOptional(d,r,"bindMatrix"),m.setOptional(d,r,"bindMatrixInverse");var w=r.skeleton;if(w){var _=w.bones;if(y.floatVertexTextures){if(void 0===w.boneTexture){var M=Math.sqrt(4*_.length);M=Ve.ceilPowerOfTwo(M),M=Math.max(M,4);var E=new Float32Array(M*M*4);E.set(w.boneMatrices);var T=new en(E,M,M,Yt,zt);T.needsUpdate=!0,w.boneMatrices=E,w.boneTexture=T,w.boneTextureSize=M}m.setValue(d,"boneTexture",w.boneTexture),m.setValue(d,"boneTextureSize",w.boneTextureSize)}else m.setOptional(d,w,"boneMatrices")}}return h&&(m.setValue(d,"toneMappingExposure",j.toneMappingExposure),m.setValue(d,"toneMappingWhitePoint",j.toneMappingWhitePoint),n.lights&&(c=p,(s=g).ambientLightColor.needsUpdate=c,s.directionalLights.needsUpdate=c,s.pointLights.needsUpdate=c,s.spotLights.needsUpdate=c,s.rectAreaLights.needsUpdate=c,s.hemisphereLights.needsUpdate=c),e&&n.fog&&function(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)}(g,e),n.isMeshBasicMaterial?Xt(g,n):n.isMeshLambertMaterial?(Xt(g,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(g,n)):n.isMeshPhongMaterial?(Xt(g,n),n.isMeshToonMaterial?function(t,e){qt(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(g,n):qt(g,n)):n.isMeshStandardMaterial?(Xt(g,n),n.isMeshPhysicalMaterial?function(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,Zt(t,e)}(g,n):Zt(g,n)):n.isMeshDepthMaterial?(Xt(g,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(g,n)):n.isMeshDistanceMaterial?(Xt(g,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(g,n)):n.isMeshNormalMaterial?(Xt(g,n),function(t,e){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)}(g,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}(g,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(g,n)):n.isPointsMaterial?function(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*lt,t.scale.value=.5*ht,t.map.value=e.map,null!==e.map){if(!0===e.map.matrixAutoUpdate){var n=e.map.offset,r=e.map.repeat,i=e.map.rotation,o=e.map.center;e.map.matrix.setUvTransform(n.x,n.y,r.x,r.y,i,o.x,o.y)}t.uvTransform.value.copy(e.map.matrix)}}(g,n):n.isShadowMaterial&&(g.color.value=n.color,g.opacity.value=n.opacity),void 0!==g.ltc_1&&(g.ltc_1.value=Wn.LTC_1),void 0!==g.ltc_2&&(g.ltc_2.value=Wn.LTC_2),kn.upload(d,i.uniformsList,g,j)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(kn.upload(d,i.uniformsList,g,j),n.uniformsNeedUpdate=!1),m.setValue(d,"modelViewMatrix",r.modelViewMatrix),m.setValue(d,"normalMatrix",r.normalMatrix),m.setValue(d,"modelMatrix",r.matrixWorld),f}function Xt(t,e){var n;if(t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(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),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),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){if(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate){var r=n.offset,i=n.repeat,o=n.rotation,a=n.center;n.matrix.setUvTransform(r.x,r.y,i.x,i.y,o,a.x,a.y)}t.uvTransform.value.copy(n.matrix)}}function qt(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),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 Zt(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.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)}this.animate=function(t){null!==(Dt=t)?Ut||(Bt(),Ut=!0):Ft()},this.render=function(t,e,n,r){if(e&&e.isCamera){if(!V){q="",Y=-1,Z=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),At.enabled&&(e=At.getCamera(e)),(l=C.get(t,e)).init(),t.onBeforeRender(j,t,e,n),bt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),gt.setFromMatrix(bt),xt=this.localClippingEnabled,yt=vt.init(this.clippingPlanes,xt,e),(h=L.get(t,e)).init(),function t(e,n,r){if(!1===e.visible)return;var i=e.layers.test(n.layers);if(i)if(e.isLight)l.pushLight(e),e.castShadow&&l.pushShadow(e);else if(e.isSprite)e.frustumCulled&&!gt.intersectsSprite(e)||l.pushSprite(e);else if(e.isImmediateRenderObject)r&&wt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(bt),h.push(e,null,e.material,wt.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||gt.intersectsObject(e))){r&&wt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(bt);var o=E.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,c=0,u=s.length;c=y.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+y.maxTextures),ct+=1,t},this.setTexture2D=(Nt=!1,function(t,e){t&&t.isWebGLRenderTarget&&(Nt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Nt=!0),t=t.texture),w.setTexture2D(t,e)}),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),w.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?w.setTextureCube(e,n):w.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return W},this.setRenderTarget=function(t){W=t,t&&void 0===b.get(t).__webglFramebuffer&&w.setupRenderTarget(t);var e=null,n=!1;if(t){var r=b.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(e=r[t.activeCubeFace],n=!0):e=r,K.copy(t.viewport),Q.copy(t.scissor),$=t.scissorTest}else K.copy(pt).multiplyScalar(lt),Q.copy(ft).multiplyScalar(lt),$=mt;if(X!==e&&(d.bindFramebuffer(d.FRAMEBUFFER,e),X=e),x.viewport(K),x.scissor(Q),x.setScissorTest($),n){var i=b.get(t.texture);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(t&&t.isWebGLRenderTarget){var a=b.get(t).__webglFramebuffer;if(a){var s=!1;a!==X&&(d.bindFramebuffer(d.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==Yt&&k.convert(u)!==d.getParameter(d.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===It||k.convert(h)===d.getParameter(d.IMPLEMENTATION_COLOR_READ_TYPE)||h===zt&&(f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||h===Gt&&f.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");d.checkFramebufferStatus(d.FRAMEBUFFER)===d.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&d.readPixels(e,n,r,i,k.convert(u),k.convert(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&d.bindFramebuffer(d.FRAMEBUFFER,X)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){var r=e.image.width,i=e.image.height,o=k.convert(e.format);this.setTexture2D(e,0),d.copyTexImage2D(d.TEXTURE_2D,n||0,o,t.x,t.y,r,i,0)}}function Fi(t,e){this.name="",this.color=new Vn(t),this.density=void 0!==e?e:25e-5}function Bi(t,e,n){this.name="",this.color=new Vn(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function zi(){wr.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Gi(t){or.call(this),this.type="SpriteMaterial",this.color=new Vn(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Hi(t){wr.call(this),this.type="Sprite",this.material=void 0!==t?t:new Gi,this.center=new We(.5,.5)}function ki(){wr.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ji(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n=0?(l=t(g-1e-5,m,l),d.subVectors(h,l)):(l=t(g+1e-5,m,l),d.subVectors(l,h)),m-1e-5>=0?(l=t(g,m-1e-5,l),p.subVectors(h,l)):(l=t(g,m+1e-5,l),p.subVectors(l,h)),u.crossVectors(d,p).normalize(),s.push(u.x,u.y,u.z),c.push(g,m)}}for(r=0;r.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),r<.2&&(o[t+4]+=1))}}()}(),this.addAttribute("position",new Dr(i,3)),this.addAttribute("normal",new Dr(i.slice(),3)),this.addAttribute("uv",new Dr(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function so(t,e){Ar.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new co(t,e)),this.mergeVertices()}function co(t,e){ao.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function uo(t,e){Ar.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ho(t,e)),this.mergeVertices()}function ho(t,e){ao.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function lo(t,e){Ar.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new po(t,e)),this.mergeVertices()}function po(t,e){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];ao.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function fo(t,e){Ar.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new mo(t,e)),this.mergeVertices()}function mo(t,e){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];ao.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function go(t,e,n,r,i,o){Ar.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new vo(t,e,n,r,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function vo(t,e,n,r,i){qr.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},e=e||64,n=n||1,r=r||8,i=i||!1;var o=t.computeFrenetFrames(e,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new qe,u=new qe,h=new We,l=new qe,d=[],p=[],f=[],m=[];function g(i){l=t.getPointAt(i/e,l);var a=o.normals[i],h=o.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);u.x=g*a.x+m*h.x,u.y=g*a.y+m*h.y,u.z=g*a.z+m*h.z,u.normalize(),p.push(u.x,u.y,u.z),c.x=l.x+n*u.x,c.y=l.y+n*u.y,c.z=l.z+n*u.z,d.push(c.x,c.y,c.z)}}!function(){for(a=0;an)){var r=t.ray.origin.distanceTo(Ti);rt.far||e.push({distance:r,point:Ti.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return wr.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),ki.prototype=Object.assign(Object.create(wr.prototype),{constructor:ki,copy:function(t){wr.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);r[0].object.visible=!0;for(var o=1,a=r.length;o=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;oa))d.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(d))r.far||i.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else for(v=0,y=m.length/3-1;va))d.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(d))r.far||i.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var w=s.vertices,_=w.length;for(v=0;v<_-1;v+=p){var M;if(!(e.distanceSqToSegment(w[v],w[v+1],d,l)>a))d.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(d))r.far||i.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),qi.prototype=Object.assign(Object.create(Yi.prototype),{constructor:qi,isLineSegments:!0,computeLineDistances:function(){var t=new qe,e=new qe;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var r=n.attributes.position,i=[],o=0,a=r.count;or.far)return;i.push({distance:u,distanceToRay:Math.sqrt(a),point:c.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Qi.prototype=Object.assign(Object.create(wr.prototype),{constructor:Qi,isGroup:!0}),$i.prototype=Object.assign(Object.create(Ke.prototype),{constructor:$i,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),to.prototype=Object.create(Ke.prototype),to.prototype.constructor=to,to.prototype.isCompressedTexture=!0,eo.prototype=Object.create(Ke.prototype),eo.prototype.constructor=eo,eo.prototype.isDepthTexture=!0,no.prototype=Object.create(qr.prototype),no.prototype.constructor=no,ro.prototype=Object.create(Ar.prototype),ro.prototype.constructor=ro,io.prototype=Object.create(qr.prototype),io.prototype.constructor=io,oo.prototype=Object.create(Ar.prototype),oo.prototype.constructor=oo,ao.prototype=Object.create(qr.prototype),ao.prototype.constructor=ao,so.prototype=Object.create(Ar.prototype),so.prototype.constructor=so,co.prototype=Object.create(ao.prototype),co.prototype.constructor=co,uo.prototype=Object.create(Ar.prototype),uo.prototype.constructor=uo,ho.prototype=Object.create(ao.prototype),ho.prototype.constructor=ho,lo.prototype=Object.create(Ar.prototype),lo.prototype.constructor=lo,po.prototype=Object.create(ao.prototype),po.prototype.constructor=po,fo.prototype=Object.create(Ar.prototype),fo.prototype.constructor=fo,mo.prototype=Object.create(ao.prototype),mo.prototype.constructor=mo,go.prototype=Object.create(Ar.prototype),go.prototype.constructor=go,vo.prototype=Object.create(qr.prototype),vo.prototype.constructor=vo,yo.prototype=Object.create(Ar.prototype),yo.prototype.constructor=yo,xo.prototype=Object.create(qr.prototype),xo.prototype.constructor=xo,bo.prototype=Object.create(Ar.prototype),bo.prototype.constructor=bo,wo.prototype=Object.create(qr.prototype),wo.prototype.constructor=wo;var _o=function(t,e,n){n=n||2;var r,i,o,a,s,c,u,h=e&&e.length,l=h?e[0]*n:t.length,d=Mo(t,0,l,n,!0),p=[];if(!d)return p;if(h&&(d=function(t,e,n,r){var i,o,a,s,c,u=[];for(i=0,o=e.length;i80*n){r=o=t[0],i=a=t[1];for(var f=n;fo&&(o=s),c>a&&(a=c);u=0!==(u=Math.max(o-r,a-i))?1/u:0}return To(d,p,n,r,i,u),p};function Mo(t,e,n,r,i){var o,a;if(i===function(t,e,n,r){for(var i=0,o=e,a=n-r;o0)for(o=e;o=e;o-=r)a=Ho(o,t[o],t[o+1],a);return a&&Fo(a,a.next)&&(ko(a),a=a.next),a}function Eo(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Fo(r,r.next)&&0!==Do(r.prev,r,r.next))r=r.next;else{if(ko(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function To(t,e,n,r,i,o,a){if(t){!a&&o&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Oo(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,a,s,c,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;e0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(a>1)}(i)}(t,r,i,o);for(var s,c,u=t;t.prev!==t.next;)if(s=t.prev,c=t.next,o?Ao(t,r,i,o):So(t))e.push(s.i/n),e.push(t.i/n),e.push(c.i/n),ko(t),t=c.next,u=c.next;else if((t=c)===u){a?1===a?To(t=Lo(t,e,n),e,n,r,i,o,2):2===a&&Ro(t,e,n,r,i,o):To(Eo(t),e,n,r,i,o,1);break}}}function So(t){var e=t.prev,n=t,r=t.next;if(Do(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(No(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Do(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Ao(t,e,n,r){var i=t.prev,o=t,a=t.next;if(Do(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,h=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,l=Oo(s,c,e,n,r),d=Oo(u,h,e,n,r),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&No(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Do(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=l;){if(p!==t.prev&&p!==t.next&&No(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Do(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function Lo(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Fo(i,o)&&Bo(i,r,r.next,o)&&zo(i,o)&&zo(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),ko(r),ko(r.next),r=t=o),r=r.next}while(r!==t);return r}function Ro(t,e,n,r,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Uo(a,s)){var c=Go(a,s);return a=Eo(a,a.next),c=Eo(c,c.next),To(a,e,n,r,i,o),void To(c,e,n,r,i,o)}s=s.next}a=a.next}while(a!==t)}function Co(t,e){return t.x-e.x}function Po(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>a){if(a=s,s===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x=r.x&&r.x>=h&&i!==r.x&&No(on.x)&&zo(r,t)&&(n=r,d=c),r=r.next;return n}(t,e)){var n=Go(e,t);Eo(n,n.next)}}function Oo(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Io(t){var e=t,n=t;do{e.x=0&&(t-a)*(r-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function Uo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Bo(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&zo(t,e)&&zo(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)}function Do(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Fo(t,e){return t.x===e.x&&t.y===e.y}function Bo(t,e,n,r){return!!(Fo(t,e)&&Fo(n,r)||Fo(t,r)&&Fo(n,e))||Do(t,e,n)>0!=Do(t,e,r)>0&&Do(n,r,t)>0!=Do(n,r,e)>0}function zo(t,e){return Do(t.prev,t,t.next)<0?Do(t,e,t.next)>=0&&Do(t,t.prev,e)>=0:Do(t,e,t.prev)<0||Do(t,t.next,e)<0}function Go(t,e){var n=new jo(t.i,t.x,t.y),r=new jo(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Ho(t,e,n,r){var i=new jo(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ko(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function jo(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Vo={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i2&&t[e-1].equals(t[0])&&t.pop()}function Xo(t,e){for(var n=0;n0)&&f.push(w,_,E),(c!==n-1||u0&&v(!0),e>0&&v(!1)),this.setIndex(u),this.addAttribute("position",new Dr(h,3)),this.addAttribute("normal",new Dr(l,3)),this.addAttribute("uv",new Dr(d,2))}function ua(t,e,n,r,i,o,a){sa.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function ha(t,e,n,r,i,o,a){ca.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function la(t,e,n,r){Ar.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new da(t,e,n,r)),this.mergeVertices()}function da(t,e,n,r){qr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||1,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,o,a=[],s=[],c=[],u=[],h=new qe,l=new We;for(s.push(0,0,0),c.push(0,0,1),u.push(.5,.5),o=0,i=3;o<=e;o++,i+=3){var d=n+o/e*r;h.x=t*Math.cos(d),h.y=t*Math.sin(d),s.push(h.x,h.y,h.z),c.push(0,0,1),l.x=(s[i]/t+1)/2,l.y=(s[i+1]/t+1)/2,u.push(l.x,l.y)}for(i=1;i<=e;i++)a.push(i,i+1,0);this.setIndex(a),this.addAttribute("position",new Dr(s,3)),this.addAttribute("normal",new Dr(c,3)),this.addAttribute("uv",new Dr(u,2))}Yo.prototype=Object.create(Ar.prototype),Yo.prototype.constructor=Yo,qo.prototype=Object.create(qr.prototype),qo.prototype.constructor=qo,qo.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],n=this.getAttribute("uv"),r=n?Array.prototype.slice.call(n.array):[],i=this.index;return{position:e,uv:r,index:i?Array.prototype.slice.call(i.array):[]}},qo.prototype.addShapeList=function(t,e){var n=t.length;e.arrays=this.getArrays();for(var r=0;rNumber.EPSILON){var d=Math.sqrt(h),p=Math.sqrt(c*c+u*u),f=e.x-s/d,m=e.y+a/d,g=((n.x-u/p-f)*u-(n.y+c/p-m)*c)/(a*u-s*c),v=(r=f+a*g-t.x)*r+(i=m+s*g-t.y)*i;if(v<=2)return new We(r,i);o=Math.sqrt(v/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=a,o=Math.sqrt(h)):(r=a,i=s,o=Math.sqrt(h/2))}return new We(r/o,i/o)}for(var H=[],k=0,j=C.length,V=j-1,W=k+1;k=0;O--){for(N=O/y,U=g*Math.cos(N*Math.PI/2),I=v*Math.sin(N*Math.PI/2),k=0,j=C.length;k=0;){n=k,(r=k-1)<0&&(r=t.length-1);var i=0,o=w+2*y;for(i=0;i0||0===t.search(/^data\:image\/jpeg/);i.format=r?Xt:Yt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Na.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,r=[],i=this.getPoint(0),o=0;for(r.push(0),n=1;n<=t;n++)o+=(e=this.getPoint(n/t)).distanceTo(i),r.push(o),i=e;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,o=r.length;n=e||t*r[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(a>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(o-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var r=this.getPoint(e);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,i,o=new qe,a=[],s=[],c=[],u=new qe,h=new Xe;for(n=0;n<=t;n++)r=n/t,a[n]=this.getTangentAt(r),a[n].normalize();s[0]=new qe,c[0]=new qe;var l=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=l&&(l=d,o.set(1,0,0)),p<=l&&(l=p,o.set(0,1,0)),f<=l&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),i=Math.acos(Ve.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(u,i))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(i=Math.acos(Ve.clamp(s[0].dot(s[t]),-1,1)),i/=t,a[0].dot(u.crossVectors(s[0],s[t]))>0&&(i=-i),n=1;n<=t;n++)s[n].applyMatrix4(h.makeRotationAxis(a[n],i*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Ua.prototype=Object.create(Na.prototype),Ua.prototype.constructor=Ua,Ua.prototype.isEllipseCurve=!0,Ua.prototype.getPoint=function(t,e){for(var n=e||new We,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,o=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(h)/s.length)+1)*s.length:0===l&&h===c-1&&(h=c-2,l=1),this.closed||h>0?n=s[(h-1)%c]:(Ba.subVectors(s[0],s[1]).add(s[0]),n=Ba),r=s[h%c],i=s[(h+1)%c],this.closed||h+2r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return n.set(ja(a,s.x,c.x,u.x,h.x),ja(a,s.y,c.y,u.y,h.y)),n},Qa.prototype.copy=function(t){Na.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e=e){var i=n[r]-e,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){Na.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;e0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)},copy:function(t){return ts.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=ts.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return ts.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),ns.prototype=Object.assign(Object.create(es.prototype),{constructor:ns,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n=i)break t;var s=e[1];t=(i=e[--n-1]))break e}o=n,n=0}for(;n>>1;te;)--o;if(++o,0!==i||o!==r){i>=o&&(i=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Ms.arraySlice(n,i,o),this.values=Ms.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==r&&Ms.isTypedArray(r)){a=0;for(var c=r.length;a!==c;++a){var u=r[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=this.getInterpolation()===Ae,i=1,o=t.length-1,a=1;a0){t[i]=t[o];for(f=o*n,m=i*n,d=0;d!==n;++d)e[m+d]=e[f+d];++i}return i!==t.length&&(this.times=Ms.arraySlice(t,0,i),this.values=Ms.arraySlice(e,0,i*n)),this}}),Ts.prototype=Object.assign(Object.create(Es.prototype),{constructor:Ts,ValueTypeName:"vector"}),Object.assign(Ss,{parse:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,o=n.length;i!==o;++i)e.push(Es.parse(n[i]).scale(r));return new Ss(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e},i=0,o=n.length;i!==o;++i)e.push(Es.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(t,e,n,r){for(var i=e.length,o=[],a=0;a1){var u=r[l=c[1]];u||(r[l]=u=[]),u.push(s)}}var h=[];for(var l in r)h.push(Ss.CreateFromMorphTargetSequence(l,r[l],e,n));return h},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var o=[],a=[];Ms.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c1?t.skinWeights[r+1]:0,s=n>2?t.skinWeights[r+2]:0,c=n>3?t.skinWeights[r+3]:0;e.skinWeights.push(new Qe(o,a,s,c))}if(t.skinIndices)for(r=0,i=t.skinIndices.length;r1?t.skinIndices[r+1]:0,l=n>2?t.skinIndices[r+2]:0,d=n>3?t.skinIndices[r+3]:0;e.skinIndices.push(new Qe(u,h,l,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,n),function(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var r=0,i=t.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var h=e.faces,l=t.morphColors[0].colors;for(r=0,i=h.length;r0&&(e.animations=n)}(t,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:n}:{geometry:n,materials:Ns.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}()}),Object.assign(Fs.prototype,{load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new La(i.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?i.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.")},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseShape(t.shapes),r=this.parseGeometries(t.geometries,n),i=this.parseImages(t.images,function(){void 0!==e&&e(s)}),o=this.parseTextures(t.textures,i),a=this.parseMaterials(t.materials,o),s=this.parseObject(t.object,r,a);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var n=0,r=t.length;n0){var o=new Pa(new Ta(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new Wi(a,s):new ii(a,s);break;case"LOD":r=new ki;break;case"Line":r=new Yi(i(t.geometry),o(t.material),t.mode);break;case"LineLoop":r=new Zi(i(t.geometry),o(t.material));break;case"LineSegments":r=new qi(i(t.geometry),o(t.material));break;case"PointCloud":case"Points":r=new Ki(i(t.geometry),o(t.material));break;case"Sprite":r=new Hi(o(t.material));break;case"Group":r=new Qi;break;default:r=new wr}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.children)for(var c=t.children,u=0;uNumber.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[i],u=-u),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var h=u*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;r=!r}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return r}var i=Vo.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,c,u=[];if(1===o.length)return s=o[0],(c=new ns).curves=s.curves,u.push(c),u;var h=!i(o[0].getPoints());h=t?!h:h;var l,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)p[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],E=0;E0&&(x||(m=p))}v=0;for(var L=f.length;v0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==i;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,r){Ye.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*r}}});var dc,pc,fc,mc,gc,vc,yc,xc,bc,wc,_c,Mc,Ec;function Tc(t,e,n){var r=n||Sc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Sc(t,e,n){this.path=e,this.parsedPath=n||Sc.parseTrackName(e),this.node=Sc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Ac(){this.uuid=Ve.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Lc(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:Le,endingEnd:Le},s=0;s!==i;++s){var c=r[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Me,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Rc(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Cc(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Pc(){qr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Oc(t,e,n,r){this.uuid=Ve.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function Ic(t,e){this.uuid=Ve.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Nc(t,e,n){Ic.call(this,t,e),this.meshPerAttribute=n||1}function Uc(t,e,n){Lr.call(this,t,e),this.meshPerAttribute=n||1}function Dc(t,e,n,r){this.ray=new ei(t,e),this.near=n||0,this.far=r||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Fc(t,e){return t.distance-e.distance}function Bc(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,o=0,a=i.length;o=e){var h=e++,l=t[h];n[l.uuid]=u,t[u]=l,n[c]=h,t[h]=s;for(var d=0,p=i;d!==p;++d){var f=r[d],m=f[h],g=f[u];f[u]=m,f[h]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,o=i.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a].uuid,u=r[c];if(void 0!==u)if(delete r[c],u0)for(var c=this._interpolants,u=this._propertyBindings,h=0,l=c.length;h!==l;++h)c[h].evaluate(a),u[h].accumulate(r,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(r===_e){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=r===Ee;if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&i))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=Re,r.endingEnd=Re):(r.endingStart=t?this.zeroSlopeAtStart?Re:Le:Ce,r.endingEnd=e?this.zeroSlopeAtEnd?Re:Le:Ce)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}}),Rc.prototype=Object.assign(Object.create(r.prototype),{constructor:Rc,_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var h=0;h!==i;++h){var l=r[h],d=l.name,p=u[d];if(void 0!==p)o[h]=p;else{if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[h].binding.parsedPath;++(p=new lc(Sc.create(n,d,f),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[h]=p}a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.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){return(e||new We).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.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new We).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new We;return function(e){return t.copy(e).clamp(this.min,this.max).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)}}),jc.prototype=Object.create(wr.prototype),jc.prototype.constructor=jc,jc.prototype.isImmediateRenderObject=!0,Vc.prototype=Object.create(qi.prototype),Vc.prototype.constructor=Vc,Vc.prototype.update=function(){var t=new qe,e=new qe,n=new Ze;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,u=0,h=0,l=c.length;h.99999?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(Ec.set(t.z,0,-t.x).normalize(),Mc=Math.acos(t.y),this.quaternion.setFromAxisAngle(Ec,Mc))}),iu.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},iu.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},ou.prototype=Object.create(qi.prototype),ou.prototype.constructor=ou;var su=0,cu=1;function uu(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function hu(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function lu(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Ki(t,e)}function du(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Hi(t)}function pu(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Ki(t,e)}function fu(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ji(t)}function mu(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ji(t)}function gu(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ji(t)}function vu(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new qe(t,e,n)}function yu(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Lr(t,e).setDynamic(!0)}function xu(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Rr(t,e)}function bu(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Cr(t,e)}function wu(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Pr(t,e)}function _u(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Or(t,e)}function Mu(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ir(t,e)}function Eu(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Nr(t,e)}function Tu(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Ur(t,e)}function Su(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Dr(t,e)}function Au(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Fr(t,e)}function Lu(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),ka.call(this,t),this.type="catmullrom",this.closed=!0}function Ru(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),ka.call(this,t),this.type="catmullrom"}function Cu(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),ka.call(this,t),this.type="catmullrom"}function Pu(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new ou(t)}function Ou(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new eu(t,e)}function Iu(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new qi(new aa(t.geometry),new Xi({color:void 0!==e?e:16777215}))}function Nu(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new qi(new no(t.geometry),new Xi({color:void 0!==e?e:16777215}))}function Uu(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new La(t)}function Du(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ca(t)}Na.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Na.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(ts.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new Ar,n=0,r=t.length;n1)for(var n=1;n1?1:h),i)if(void 0!==r[a]){var _=r[a]||0,M=i[a];M instanceof Array?n[a]=m(M,w):("string"==typeof M&&(M="+"===M.charAt(0)||"-"===M.charAt(0)?_+parseFloat(M):parseFloat(M)),"number"==typeof M&&(n[a]=_+(M-_)*w))}if(null!==x&&x.call(n,w),1===h){if(c>0){for(a in isFinite(c)&&c--,o){if("string"==typeof i[a]&&(o[a]=o[a]+parseFloat(i[a])),u){var E=o[a];o[a]=i[a],i[a]=E}r[a]=o[a]}return u&&(l=!l),p=void 0!==e?t+e:t+d,!0}null!==b&&b.call(n,n);for(var T=0,S=g.length;T1?o(t[n],t[n-1],n-r):o(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,o=a.Interpolation.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-e,r-s)*i(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=a.Interpolation.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n1;n--)e*=n;return o[t]=e,e}),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),a=.5*(r-e),s=i*i;return(2*e-2*n+o+a)*(i*s)+(-3*e+3*n-2*o-a)*s+o*i+e}}},void 0===(r=function(){return a}.apply(e,[]))||(t.exports=r)}).call(this,n(4))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(0),o=(r=i)&&r.__esModule?r:{default:r};e.default=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var i=new dat.GUI;this.camera=e.camera.threeCamera,this.controls=e.controls.threeControls,this.light=e.light;var a=i.addFolder("Camera"),s=a.add(o.default.camera,"fov",0,180).name("Camera FOV");s.onChange(function(t){r.controls.enableRotate=!1,r.camera.fov=t}),s.onFinishChange(function(){r.camera.updateProjectionMatrix(),r.controls.enableRotate=!0});var c=a.add(o.default.camera,"aspect",0,4).name("Camera Aspect");c.onChange(function(t){r.controls.enableRotate=!1,r.camera.aspect=t}),c.onFinishChange(function(){r.camera.updateProjectionMatrix(),r.controls.enableRotate=!0}),a.addColor(o.default.fog,"color").name("Fog Color").onChange(function(t){e.scene.fog.color.setHex(t)});var u=a.add(o.default.fog,"near",0,.01).name("Fog Near");u.onChange(function(t){r.controls.enableRotate=!1,e.scene.fog.density=t}),u.onFinishChange(function(){r.controls.enableRotate=!0});var h=i.addFolder("Controls");h.add(o.default.controls,"autoRotate").name("Auto Rotate").onChange(function(t){r.controls.autoRotate=t});var l=h.add(o.default.controls,"autoRotateSpeed",-1,1).name("Rotation Speed");l.onChange(function(t){r.controls.enableRotate=!1,r.controls.autoRotateSpeed=t}),l.onFinishChange(function(){r.controls.enableRotate=!0});var d=i.addFolder("Mesh");d.add(o.default.mesh,"translucent",!0).name("Translucent").onChange(function(t){t?(n.material.transparent=!0,n.material.opacity=.5):n.material.opacity=1}),d.add(o.default.mesh,"wireframe",!0).name("Wireframe").onChange(function(t){n.material.wireframe=t});var p=i.addFolder("Ambient Light");p.add(o.default.ambientLight,"enabled").name("Enabled").onChange(function(t){r.light.ambientLight.visible=t}),p.addColor(o.default.ambientLight,"color").name("Color").onChange(function(t){r.light.ambientLight.color.setHex(t)});var f=i.addFolder("Directional Light");f.add(o.default.directionalLight,"enabled").name("Enabled").onChange(function(t){r.light.directionalLight.visible=t}),f.addColor(o.default.directionalLight,"color").name("Color").onChange(function(t){r.light.directionalLight.color.setHex(t)});var m=f.add(o.default.directionalLight,"intensity",0,2).name("Intensity");m.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.intensity=t}),m.onFinishChange(function(){r.controls.enableRotate=!0});var g=f.add(o.default.directionalLight,"x",-1e3,1e3).name("Position X");g.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.position.x=t}),g.onFinishChange(function(){r.controls.enableRotate=!0});var v=f.add(o.default.directionalLight,"y",-1e3,1e3).name("Position Y");v.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.position.y=t}),v.onFinishChange(function(){r.controls.enableRotate=!0});var y=f.add(o.default.directionalLight,"z",-1e3,1e3).name("Position Z");y.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.position.z=t}),y.onFinishChange(function(){r.controls.enableRotate=!0});var x=i.addFolder("Shadow Map");x.add(o.default.shadow,"enabled").name("Enabled").onChange(function(t){r.light.directionalLight.castShadow=t}),x.add(o.default.shadow,"helperEnabled").name("Helper Enabled").onChange(function(t){r.light.directionalLightHelper.visible=t});var b=x.add(o.default.shadow,"near",0,400).name("Near");b.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.camera.near=t}),b.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var w=x.add(o.default.shadow,"far",0,1200).name("Far");w.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.camera.far=t}),w.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var _=x.add(o.default.shadow,"top",-400,400).name("Top");_.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.camera.top=t}),_.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var M=x.add(o.default.shadow,"right",-400,400).name("Right");M.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.camera.right=t}),M.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var E=x.add(o.default.shadow,"bottom",-400,400).name("Bottom");E.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.camera.bottom=t}),E.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var T=x.add(o.default.shadow,"left",-400,400).name("Left");T.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.camera.left=t}),T.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var S=x.add(o.default.shadow,"bias",-1e-5,1).name("Bias");S.onChange(function(t){r.controls.enableRotate=!1,r.light.directionalLight.shadow.bias=t}),S.onFinishChange(function(){r.controls.enableRotate=!0,r.light.directionalLight.shadow.map.dispose(),r.light.directionalLight.shadow.map=null,r.light.directionalLightHelper.update()});var A=i.addFolder("Point Light");A.add(o.default.pointLight,"enabled").name("Enabled").onChange(function(t){r.light.pointLight.visible=t}),A.addColor(o.default.pointLight,"color").name("Color").onChange(function(t){r.light.pointLight.color.setHex(t)});var L=A.add(o.default.pointLight,"intensity",0,2).name("Intensity");L.onChange(function(t){r.controls.enableRotate=!1,r.light.pointLight.intensity=t}),L.onFinishChange(function(){r.controls.enableRotate=!0});var R=A.add(o.default.pointLight,"distance",0,1e3).name("Distance");R.onChange(function(t){r.controls.enableRotate=!1,r.light.pointLight.distance=t}),R.onFinishChange(function(){r.controls.enableRotate=!0});var C=A.add(o.default.pointLight,"x",-1e3,1e3).name("Position X");C.onChange(function(t){r.controls.enableRotate=!1,r.light.pointLight.position.x=t}),C.onFinishChange(function(){r.controls.enableRotate=!0});var P=A.add(o.default.pointLight,"y",-1e3,1e3).name("Position Y");P.onChange(function(t){r.controls.enableRotate=!1,r.light.pointLight.position.y=t}),P.onFinishChange(function(){r.controls.enableRotate=!0});var O=A.add(o.default.pointLight,"z",-1e3,1e3).name("Position Z");O.onChange(function(t){r.controls.enableRotate=!1,r.light.pointLight.position.z=t}),O.onFinishChange(function(){r.controls.enableRotate=!0});var I=i.addFolder("Hemi Light");I.add(o.default.hemiLight,"enabled").name("Enabled").onChange(function(t){r.light.hemiLight.visible=t}),I.addColor(o.default.hemiLight,"color").name("Color").onChange(function(t){r.light.hemiLight.color.setHex(t)}),I.addColor(o.default.hemiLight,"groundColor").name("ground Color").onChange(function(t){r.light.hemiLight.groundColor.setHex(t)});var N=I.add(o.default.hemiLight,"intensity",0,2).name("Intensity");N.onChange(function(t){r.controls.enableRotate=!1,r.light.hemiLight.intensity=t}),N.onFinishChange(function(){r.controls.enableRotate=!0});var U=I.add(o.default.hemiLight,"x",-1e3,1e3).name("Position X");U.onChange(function(t){r.controls.enableRotate=!1,r.light.hemiLight.position.x=t}),U.onFinishChange(function(){r.controls.enableRotate=!0});var D=I.add(o.default.hemiLight,"y",-500,1e3).name("Position Y");D.onChange(function(t){r.controls.enableRotate=!1,r.light.hemiLight.position.y=t}),D.onFinishChange(function(){r.controls.enableRotate=!0});var F=I.add(o.default.hemiLight,"z",-1e3,1e3).name("Position Z");F.onChange(function(t){r.controls.enableRotate=!1,r.light.hemiLight.position.z=t}),F.onFinishChange(function(){r.controls.enableRotate=!0})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;e.geo=new i.PlaneGeometry(t,n,r,o)}:"sphere"===t?function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32;e.geo=new i.SphereGeometry(t,n,r)}:void 0}},{key:"place",value:function(t,e){var n,r,s=new o.default(15658734).standard,u=new i.Mesh(this.geo,s);(n=u.position).set.apply(n,c(t)),(r=u.rotation).set.apply(r,c(e)),a.default.shadow.enabled&&(u.receiveShadow=!0),this.scene.add(u)}}]),t}();e.default=u},function(t,e,n){"use strict";t.exports=function(t){var e=t.MOUSE;function n(e,n){var r=new function(e){this.object=e,this.target=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var n,r,i,o,a,s,c,u,h=this,l=0,d=0,p=1,f=new t.Vector3,m=!1;this.getPolarAngle=function(){return r},this.getAzimuthalAngle=function(){return n},this.rotateLeft=function(t){d-=t},this.rotateUp=function(t){l-=t},this.panLeft=(i=new t.Vector3,function(t){var e=this.object.matrix.elements;i.set(e[0],e[1],e[2]),i.multiplyScalar(-t),f.add(i)}),this.panUp=function(){var e=new t.Vector3;return function(t){var n=this.object.matrix.elements;e.set(n[4],n[5],n[6]),e.multiplyScalar(t),f.add(e)}}(),this.pan=function(e,n,r,i){if(h.object instanceof t.PerspectiveCamera){var o=h.object.position.clone().sub(h.target).length();o*=Math.tan(h.object.fov/2*Math.PI/180),h.panLeft(2*e*o/i),h.panUp(2*n*o/i)}else h.object instanceof t.OrthographicCamera?(h.panLeft(e*(h.object.right-h.object.left)/r),h.panUp(n*(h.object.top-h.object.bottom)/i)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){h.object instanceof t.PerspectiveCamera?p/=e:h.object instanceof t.OrthographicCamera?(h.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),h.object.updateProjectionMatrix(),m=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){h.object instanceof t.PerspectiveCamera?p*=e:h.object instanceof t.OrthographicCamera?(h.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),h.object.updateProjectionMatrix(),m=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.update=(o=new t.Vector3,a=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),s=a.clone().inverse(),c=new t.Vector3,u=new t.Quaternion,function(){var t=this.object.position;o.copy(t).sub(this.target),o.applyQuaternion(a),n=Math.atan2(o.x,o.z),r=Math.atan2(Math.sqrt(o.x*o.x+o.z*o.z),o.y),n+=d,r+=l,n=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,n)),r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(1e-6,Math.min(Math.PI-1e-6,r));var e=o.length()*p;return e=Math.max(this.minDistance,Math.min(this.maxDistance,e)),this.target.add(f),o.x=e*Math.sin(r)*Math.sin(n),o.y=e*Math.cos(r),o.z=e*Math.sin(r)*Math.cos(n),o.applyQuaternion(s),t.copy(this.target).add(o),this.object.lookAt(this.target),!0===this.enableDamping?(d*=1-this.dampingFactor,l*=1-this.dampingFactor):(d=0,l=0),p=1,f.set(0,0,0),!!(m||c.distanceToSquared(this.object.position)>1e-6||8*(1-u.dot(this.object.quaternion))>1e-6)&&(c.copy(this.object.position),u.copy(this.object.quaternion),m=!1,!0)})}(e);this.domElement=void 0!==n?n:document,Object.defineProperty(this,"constraint",{get:function(){return r}}),this.getPolarAngle=function(){return r.getPolarAngle()},this.getAzimuthalAngle=function(){return r.getAzimuthalAngle()},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:t.MOUSE.LEFT,ZOOM:t.MOUSE.MIDDLE,PAN:t.MOUSE.RIGHT};var i=this,o=new t.Vector2,a=new t.Vector2,s=new t.Vector2,c=new t.Vector2,u=new t.Vector2,h=new t.Vector2,l=new t.Vector2,d=new t.Vector2,p=new t.Vector2,f={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},m=f.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom;var g={type:"change"},v={type:"start"},y={type:"end"};function x(t,e){var n=i.domElement===document?i.domElement.body:i.domElement;r.pan(t,e,n.clientWidth,n.clientHeight)}function b(){return Math.pow(.95,i.zoomSpeed)}function w(t){if(!1!==i.enabled){if(t.preventDefault(),t.button===i.mouseButtons.ORBIT){if(!1===i.enableRotate)return;m=f.ROTATE,o.set(t.clientX,t.clientY)}else if(t.button===i.mouseButtons.ZOOM){if(!1===i.enableZoom)return;m=f.DOLLY,l.set(t.clientX,t.clientY)}else if(t.button===i.mouseButtons.PAN){if(!1===i.enablePan)return;m=f.PAN,c.set(t.clientX,t.clientY)}m!==f.NONE&&(document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",M,!1),i.dispatchEvent(v))}}function _(t){if(!1!==i.enabled){t.preventDefault();var e=i.domElement===document?i.domElement.body:i.domElement;if(m===f.ROTATE){if(!1===i.enableRotate)return;a.set(t.clientX,t.clientY),s.subVectors(a,o),r.rotateLeft(2*Math.PI*s.x/e.clientWidth*i.rotateSpeed),r.rotateUp(2*Math.PI*s.y/e.clientHeight*i.rotateSpeed),o.copy(a)}else if(m===f.DOLLY){if(!1===i.enableZoom)return;d.set(t.clientX,t.clientY),p.subVectors(d,l),p.y>0?r.dollyIn(b()):p.y<0&&r.dollyOut(b()),l.copy(d)}else if(m===f.PAN){if(!1===i.enablePan)return;u.set(t.clientX,t.clientY),h.subVectors(u,c),x(h.x,h.y),c.copy(u)}m!==f.NONE&&i.update()}}function M(){!1!==i.enabled&&(document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",M,!1),i.dispatchEvent(y),m=f.NONE)}function E(t){if(!1!==i.enabled&&!1!==i.enableZoom&&m===f.NONE){t.preventDefault(),t.stopPropagation();var e=0;void 0!==t.wheelDelta?e=t.wheelDelta:void 0!==t.detail&&(e=-t.detail),e>0?r.dollyOut(b()):e<0&&r.dollyIn(b()),i.update(),i.dispatchEvent(v),i.dispatchEvent(y)}}function T(t){if(!1!==i.enabled&&!1!==i.enableKeys&&!1!==i.enablePan)switch(t.keyCode){case i.keys.UP:x(0,i.keyPanSpeed),i.update();break;case i.keys.BOTTOM:x(0,-i.keyPanSpeed),i.update();break;case i.keys.LEFT:x(i.keyPanSpeed,0),i.update();break;case i.keys.RIGHT:x(-i.keyPanSpeed,0),i.update()}}function S(t){if(!1!==i.enabled){switch(t.touches.length){case 1:if(!1===i.enableRotate)return;m=f.TOUCH_ROTATE,o.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(!1===i.enableZoom)return;m=f.TOUCH_DOLLY;var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);l.set(0,r);break;case 3:if(!1===i.enablePan)return;m=f.TOUCH_PAN,c.set(t.touches[0].pageX,t.touches[0].pageY);break;default:m=f.NONE}m!==f.NONE&&i.dispatchEvent(v)}}function A(t){if(!1!==i.enabled){t.preventDefault(),t.stopPropagation();var e=i.domElement===document?i.domElement.body:i.domElement;switch(t.touches.length){case 1:if(!1===i.enableRotate)return;if(m!==f.TOUCH_ROTATE)return;a.set(t.touches[0].pageX,t.touches[0].pageY),s.subVectors(a,o),r.rotateLeft(2*Math.PI*s.x/e.clientWidth*i.rotateSpeed),r.rotateUp(2*Math.PI*s.y/e.clientHeight*i.rotateSpeed),o.copy(a),i.update();break;case 2:if(!1===i.enableZoom)return;if(m!==f.TOUCH_DOLLY)return;var n=t.touches[0].pageX-t.touches[1].pageX,g=t.touches[0].pageY-t.touches[1].pageY,v=Math.sqrt(n*n+g*g);d.set(0,v),p.subVectors(d,l),p.y>0?r.dollyOut(b()):p.y<0&&r.dollyIn(b()),l.copy(d),i.update();break;case 3:if(!1===i.enablePan)return;if(m!==f.TOUCH_PAN)return;u.set(t.touches[0].pageX,t.touches[0].pageY),h.subVectors(u,c),x(h.x,h.y),c.copy(u),i.update();break;default:m=f.NONE}}}function L(){!1!==i.enabled&&(i.dispatchEvent(y),m=f.NONE)}function R(t){t.preventDefault()}this.update=function(){this.autoRotate&&m===f.NONE&&r.rotateLeft(2*Math.PI/60/60*i.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(g)},this.reset=function(){m=f.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(g),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",R,!1),this.domElement.removeEventListener("mousedown",w,!1),this.domElement.removeEventListener("mousewheel",E,!1),this.domElement.removeEventListener("MozMousePixelScroll",E,!1),this.domElement.removeEventListener("touchstart",S,!1),this.domElement.removeEventListener("touchend",L,!1),this.domElement.removeEventListener("touchmove",A,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",M,!1),window.removeEventListener("keydown",T,!1)},this.domElement.addEventListener("contextmenu",R,!1),this.domElement.addEventListener("mousedown",w,!1),this.domElement.addEventListener("mousewheel",E,!1),this.domElement.addEventListener("MozMousePixelScroll",E,!1),this.domElement.addEventListener("touchstart",S,!1),this.domElement.addEventListener("touchend",L,!1),this.domElement.addEventListener("touchmove",A,!1),window.addEventListener("keydown",T,!1),this.update()}return e||(e={LEFT:0,MIDDLE:1,RIGHT:2}),n.prototype=Object.create(t.EventDispatcher.prototype),n.prototype.constructor=n,Object.defineProperties(n.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(t){console.warn("THREE.OrbitControls: target is now immutable. Use target.set() instead."),this.constraint.target.copy(t)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(t){this.constraint.minDistance=t}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(t){this.constraint.maxDistance=t}},minZoom:{get:function(){return this.constraint.minZoom},set:function(t){this.constraint.minZoom=t}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(t){this.constraint.maxZoom=t}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(t){this.constraint.minPolarAngle=t}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(t){this.constraint.maxPolarAngle=t}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(t){this.constraint.minAzimuthAngle=t}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(t){this.constraint.maxAzimuthAngle=t}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(t){this.constraint.enableDamping=t}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(t){this.constraint.dampingFactor=t}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(t){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!t}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(t){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!t}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(t){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!t}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(t){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!t}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(t){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!t}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(t){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=t}}}),n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;nWebGL.
','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].join("\n")),t},addGetWebGLMessage:function(t){var e,n,r;e=void 0!==(t=t||{}).parent?t.parent:document.body,n=void 0!==t.id?t.id:"oldie",(r=this.getWebGLErrorMessage()).id=n,e.appendChild(r)}}},function(t,e,n){"use strict";var r=a(n(0)),i=a(n(22)),o=a(n(21));function a(t){return t&&t.__esModule?t:{default:t}}console.log("----- RUNNING IN DEV ENVIRONMENT! -----"),r.default.isDev=!0,function(){if(i.default.webgl){var t=document.getElementById("appContainer");new o.default(t)}else i.default.addGetWebGLMessage()}()},function(t,e,n){t.exports=n(23)}]);