1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[737],{31700:function(e,t,i){let r,n,a,s,o;i.r(t),i.d(t,{ACESFilmicToneMapping:function(){return eu},AddEquation:function(){return R},AddOperation:function(){return ea},AdditiveAnimationBlendMode:function(){return tF},AdditiveBlending:function(){return A},AgXToneMapping:function(){return ed},AlphaFormat:function(){return eq},AlwaysCompare:function(){return i_},AlwaysDepth:function(){return Z},AlwaysStencilFunc:function(){return ih},AmbientLight:function(){return AmbientLight},AnimationAction:function(){return AnimationAction},AnimationClip:function(){return AnimationClip},AnimationLoader:function(){return AnimationLoader},AnimationMixer:function(){return AnimationMixer},AnimationObjectGroup:function(){return AnimationObjectGroup},AnimationUtils:function(){return si},ArcCurve:function(){return ArcCurve},ArrayCamera:function(){return ArrayCamera},ArrowHelper:function(){return ArrowHelper},AttachedBindMode:function(){return ef},Audio:function(){return Audio},AudioAnalyser:function(){return AudioAnalyser},AudioContext:function(){return AudioContext},AudioListener:function(){return AudioListener},AudioLoader:function(){return AudioLoader},AxesHelper:function(){return AxesHelper},BackSide:function(){return M},BasicDepthPacking:function(){return tk},BasicShadowMap:function(){return m},BatchedMesh:function(){return BatchedMesh},Bone:function(){return Bone},BooleanKeyframeTrack:function(){return BooleanKeyframeTrack},Box2:function(){return Box2},Box3:function(){return Box3},Box3Helper:function(){return Box3Helper},BoxGeometry:function(){return BoxGeometry},BoxHelper:function(){return BoxHelper},BufferAttribute:function(){return BufferAttribute},BufferGeometry:function(){return BufferGeometry},BufferGeometryLoader:function(){return BufferGeometryLoader},ByteType:function(){return eB},Cache:function(){return sr},Camera:function(){return Camera},CameraHelper:function(){return CameraHelper},CanvasTexture:function(){return CanvasTexture},CapsuleGeometry:function(){return CapsuleGeometry},CatmullRomCurve3:function(){return CatmullRomCurve3},CineonToneMapping:function(){return eh},CircleGeometry:function(){return CircleGeometry},ClampToEdgeWrapping:function(){return eb},Clock:function(){return Clock},Color:function(){return Color},ColorKeyframeTrack:function(){return ColorKeyframeTrack},ColorManagement:function(){return iW},CompressedArrayTexture:function(){return CompressedArrayTexture},CompressedCubeTexture:function(){return CompressedCubeTexture},CompressedTexture:function(){return CompressedTexture},CompressedTextureLoader:function(){return CompressedTextureLoader},ConeGeometry:function(){return ConeGeometry},ConstantAlphaFactor:function(){return q},ConstantColorFactor:function(){return X},CubeCamera:function(){return CubeCamera},CubeReflectionMapping:function(){return ev},CubeRefractionMapping:function(){return e_},CubeTexture:function(){return CubeTexture},CubeTextureLoader:function(){return CubeTextureLoader},CubeUVReflectionMapping:function(){return eM},CubicBezierCurve:function(){return CubicBezierCurve},CubicBezierCurve3:function(){return CubicBezierCurve3},CubicInterpolant:function(){return CubicInterpolant},CullFaceBack:function(){return d},CullFaceFront:function(){return p},CullFaceFrontBack:function(){return f},CullFaceNone:function(){return c},Curve:function(){return Curve},CurvePath:function(){return CurvePath},CustomBlending:function(){return C},CustomToneMapping:function(){return ec},CylinderGeometry:function(){return CylinderGeometry},Cylindrical:function(){return Cylindrical},Data3DTexture:function(){return Data3DTexture},DataArrayTexture:function(){return DataArrayTexture},DataTexture:function(){return DataTexture},DataTextureLoader:function(){return DataTextureLoader},DataUtils:function(){return rY},DecrementStencilOp:function(){return t8},DecrementWrapStencilOp:function(){return t7},DefaultLoadingManager:function(){return sn},DepthFormat:function(){return eQ},DepthStencilFormat:function(){return e$},DepthTexture:function(){return DepthTexture},DetachedBindMode:function(){return em},DirectionalLight:function(){return DirectionalLight},DirectionalLightHelper:function(){return DirectionalLightHelper},DiscreteInterpolant:function(){return DiscreteInterpolant},DisplayP3ColorSpace:function(){return tJ},DodecahedronGeometry:function(){return DodecahedronGeometry},DoubleSide:function(){return S},DstAlphaFactor:function(){return z},DstColorFactor:function(){return k},DynamicCopyUsage:function(){return iE},DynamicDrawUsage:function(){return ix},DynamicReadUsage:function(){return ib},EdgesGeometry:function(){return EdgesGeometry},EllipseCurve:function(){return EllipseCurve},EqualCompare:function(){return id},EqualDepth:function(){return $},EqualStencilFunc:function(){return ir},EquirectangularReflectionMapping:function(){return ey},EquirectangularRefractionMapping:function(){return ex},Euler:function(){return Euler},EventDispatcher:function(){return EventDispatcher},ExtrudeGeometry:function(){return ExtrudeGeometry},FileLoader:function(){return FileLoader},Float16BufferAttribute:function(){return Float16BufferAttribute},Float32BufferAttribute:function(){return Float32BufferAttribute},FloatType:function(){return eG},Fog:function(){return Fog},FogExp2:function(){return FogExp2},FramebufferTexture:function(){return FramebufferTexture},FrontSide:function(){return x},Frustum:function(){return Frustum},GLBufferAttribute:function(){return GLBufferAttribute},GLSL1:function(){return iC},GLSL3:function(){return iR},GreaterCompare:function(){return im},GreaterDepth:function(){return et},GreaterEqualCompare:function(){return iv},GreaterEqualDepth:function(){return ee},GreaterEqualStencilFunc:function(){return il},GreaterStencilFunc:function(){return is},GridHelper:function(){return GridHelper},Group:function(){return Group},HalfFloatType:function(){return ek},HemisphereLight:function(){return HemisphereLight},HemisphereLightHelper:function(){return HemisphereLightHelper},IcosahedronGeometry:function(){return IcosahedronGeometry},ImageBitmapLoader:function(){return ImageBitmapLoader},ImageLoader:function(){return ImageLoader},ImageUtils:function(){return ImageUtils},IncrementStencilOp:function(){return t6},IncrementWrapStencilOp:function(){return t9},InstancedBufferAttribute:function(){return InstancedBufferAttribute},InstancedBufferGeometry:function(){return InstancedBufferGeometry},InstancedInterleavedBuffer:function(){return InstancedInterleavedBuffer},InstancedMesh:function(){return InstancedMesh},Int16BufferAttribute:function(){return Int16BufferAttribute},Int32BufferAttribute:function(){return Int32BufferAttribute},Int8BufferAttribute:function(){return Int8BufferAttribute},IntType:function(){return eV},InterleavedBuffer:function(){return InterleavedBuffer},InterleavedBufferAttribute:function(){return InterleavedBufferAttribute},Interpolant:function(){return Interpolant},InterpolateDiscrete:function(){return tP},InterpolateLinear:function(){return tI},InterpolateSmooth:function(){return tU},InvertStencilOp:function(){return ie},KeepStencilOp:function(){return t4},KeyframeTrack:function(){return KeyframeTrack},LOD:function(){return LOD},LatheGeometry:function(){return LatheGeometry},Layers:function(){return Layers},LessCompare:function(){return ic},LessDepth:function(){return J},LessEqualCompare:function(){return ip},LessEqualDepth:function(){return Q},LessEqualStencilFunc:function(){return ia},LessStencilFunc:function(){return ii},Light:function(){return Light},LightProbe:function(){return LightProbe},Line:function(){return Line},Line3:function(){return Line3},LineBasicMaterial:function(){return LineBasicMaterial},LineCurve:function(){return LineCurve},LineCurve3:function(){return LineCurve3},LineDashedMaterial:function(){return LineDashedMaterial},LineLoop:function(){return LineLoop},LineSegments:function(){return LineSegments},LinearDisplayP3ColorSpace:function(){return tQ},LinearFilter:function(){return eL},LinearInterpolant:function(){return LinearInterpolant},LinearMipMapLinearFilter:function(){return eD},LinearMipMapNearestFilter:function(){return eI},LinearMipmapLinearFilter:function(){return eU},LinearMipmapNearestFilter:function(){return eP},LinearSRGBColorSpace:function(){return tZ},LinearToneMapping:function(){return eo},LinearTransfer:function(){return t$},Loader:function(){return Loader},LoaderUtils:function(){return LoaderUtils},LoadingManager:function(){return LoadingManager}
1,LoopOnce:function(){return tC},LoopPingPong:function(){return tL},LoopRepeat:function(){return tR},LuminanceAlphaFormat:function(){return eJ},LuminanceFormat:function(){return eZ},MOUSE:function(){return h},Material:function(){return Material},MaterialLoader:function(){return MaterialLoader},MathUtils:function(){return iB},Matrix2:function(){return Matrix2},Matrix3:function(){return Matrix3},Matrix4:function(){return Matrix4},MaxEquation:function(){return U},Mesh:function(){return Mesh},MeshBasicMaterial:function(){return MeshBasicMaterial},MeshDepthMaterial:function(){return MeshDepthMaterial},MeshDistanceMaterial:function(){return MeshDistanceMaterial},MeshLambertMaterial:function(){return MeshLambertMaterial},MeshMatcapMaterial:function(){return MeshMatcapMaterial},MeshNormalMaterial:function(){return MeshNormalMaterial},MeshPhongMaterial:function(){return MeshPhongMaterial},MeshPhysicalMaterial:function(){return MeshPhysicalMaterial},MeshStandardMaterial:function(){return MeshStandardMaterial},MeshToonMaterial:function(){return MeshToonMaterial},MinEquation:function(){return I},MirroredRepeatWrapping:function(){return eT},MixOperation:function(){return en},MultiplyBlending:function(){return w},MultiplyOperation:function(){return er},NearestFilter:function(){return eA},NearestMipMapLinearFilter:function(){return eR},NearestMipMapNearestFilter:function(){return ew},NearestMipmapLinearFilter:function(){return eC},NearestMipmapNearestFilter:function(){return eE},NeutralToneMapping:function(){return ep},NeverCompare:function(){return iu},NeverDepth:function(){return K},NeverStencilFunc:function(){return it},NoBlending:function(){return b},NoColorSpace:function(){return tY},NoToneMapping:function(){return es},NormalAnimationBlendMode:function(){return tO},NormalBlending:function(){return T},NotEqualCompare:function(){return ig},NotEqualDepth:function(){return ei},NotEqualStencilFunc:function(){return io},NumberKeyframeTrack:function(){return NumberKeyframeTrack},Object3D:function(){return Object3D},ObjectLoader:function(){return ObjectLoader},ObjectSpaceNormalMap:function(){return tq},OctahedronGeometry:function(){return OctahedronGeometry},OneFactor:function(){return N},OneMinusConstantAlphaFactor:function(){return Y},OneMinusConstantColorFactor:function(){return j},OneMinusDstAlphaFactor:function(){return G},OneMinusDstColorFactor:function(){return H},OneMinusSrcAlphaFactor:function(){return V},OneMinusSrcColorFactor:function(){return O},OrthographicCamera:function(){return OrthographicCamera},P3Primaries:function(){return t3},PCFShadowMap:function(){return g},PCFSoftShadowMap:function(){return _},PMREMGenerator:function(){return PMREMGenerator},Path:function(){return Path},PerspectiveCamera:function(){return PerspectiveCamera},Plane:function(){return Plane},PlaneGeometry:function(){return PlaneGeometry},PlaneHelper:function(){return PlaneHelper},PointLight:function(){return PointLight},PointLightHelper:function(){return PointLightHelper},Points:function(){return Points},PointsMaterial:function(){return PointsMaterial},PolarGridHelper:function(){return PolarGridHelper},PolyhedronGeometry:function(){return PolyhedronGeometry},PositionalAudio:function(){return PositionalAudio},PropertyBinding:function(){return PropertyBinding},PropertyMixer:function(){return PropertyMixer},QuadraticBezierCurve:function(){return QuadraticBezierCurve},QuadraticBezierCurve3:function(){return QuadraticBezierCurve3},Quaternion:function(){return Quaternion},QuaternionKeyframeTrack:function(){return QuaternionKeyframeTrack},QuaternionLinearInterpolant:function(){return QuaternionLinearInterpolant},RED_GREEN_RGTC2_Format:function(){return tE},RED_RGTC1_Format:function(){return tT},REVISION:function(){return l},RGBADepthPacking:function(){return tH},RGBAFormat:function(){return eK},RGBAIntegerFormat:function(){return e5},RGBA_ASTC_10x10_Format:function(){return t_},RGBA_ASTC_10x5_Format:function(){return tm},RGBA_ASTC_10x6_Format:function(){return tg},RGBA_ASTC_10x8_Format:function(){return tv},RGBA_ASTC_12x10_Format:function(){return ty},RGBA_ASTC_12x12_Format:function(){return tx},RGBA_ASTC_4x4_Format:function(){return to},RGBA_ASTC_5x4_Format:function(){return tl},RGBA_ASTC_5x5_Format:function(){return th},RGBA_ASTC_6x5_Format:function(){return tu},RGBA_ASTC_6x6_Format:function(){return tc},RGBA_ASTC_8x5_Format:function(){return td},RGBA_ASTC_8x6_Format:function(){return tp}
1,RGBA_ASTC_8x8_Format:function(){return tf},RGBA_BPTC_Format:function(){return tM},RGBA_ETC2_EAC_Format:function(){return ts},RGBA_PVRTC_2BPPV1_Format:function(){return tr},RGBA_PVRTC_4BPPV1_Format:function(){return ti},RGBA_S3TC_DXT1_Format:function(){return e8},RGBA_S3TC_DXT3_Format:function(){return e9},RGBA_S3TC_DXT5_Format:function(){return e7},RGBDepthPacking:function(){return tW},RGBFormat:function(){return eY},RGBIntegerFormat:function(){return e4},RGB_BPTC_SIGNED_Format:function(){return tS},RGB_BPTC_UNSIGNED_Format:function(){return tb},RGB_ETC1_Format:function(){return tn},RGB_ETC2_Format:function(){return ta},RGB_PVRTC_2BPPV1_Format:function(){return tt},RGB_PVRTC_4BPPV1_Format:function(){return te},RGB_S3TC_DXT1_Format:function(){return e6},RGDepthPacking:function(){return tX},RGFormat:function(){return e3},RGIntegerFormat:function(){return e2},RawShaderMaterial:function(){return RawShaderMaterial},Ray:function(){return Ray},Raycaster:function(){return Raycaster},Rec709Primaries:function(){return t1},RectAreaLight:function(){return RectAreaLight},RedFormat:function(){return e0},RedIntegerFormat:function(){return e1},ReinhardToneMapping:function(){return el},RenderTarget:function(){return RenderTarget},RepeatWrapping:function(){return eS},ReplaceStencilOp:function(){return t5},ReverseSubtractEquation:function(){return P},RingGeometry:function(){return RingGeometry},SIGNED_RED_GREEN_RGTC2_Format:function(){return tw},SIGNED_RED_RGTC1_Format:function(){return tA},SRGBColorSpace:function(){return tK},SRGBTransfer:function(){return t0},Scene:function(){return Scene},ShaderChunk:function(){return nx},ShaderLib:function(){return nS},ShaderMaterial:function(){return ShaderMaterial},ShadowMaterial:function(){return ShadowMaterial},Shape:function(){return Shape},ShapeGeometry:function(){return ShapeGeometry},ShapePath:function(){return ShapePath},ShapeUtils:function(){return ShapeUtils},ShortType:function(){return eO},Skeleton:function(){return Skeleton},SkeletonHelper:function(){return SkeletonHelper},SkinnedMesh:function(){return SkinnedMesh},Source:function(){return Source},Sphere:function(){return Sphere},SphereGeometry:function(){return SphereGeometry},Spherical:function(){return Spherical},SphericalHarmonics3:function(){return SphericalHarmonics3},SplineCurve:function(){return SplineCurve},SpotLight:function(){return SpotLight},SpotLightHelper:function(){return SpotLightHelper},Sprite:function(){return Sprite},SpriteMaterial:function(){return SpriteMaterial},SrcAlphaFactor:function(){return F},SrcAlphaSaturateFactor:function(){return W},SrcColorFactor:function(){return B},StaticCopyUsage:function(){return iA},StaticDrawUsage:function(){return iy},StaticReadUsage:function(){return iS},StereoCamera:function(){return StereoCamera},StreamCopyUsage:function(){return iw},StreamDrawUsage:function(){return iM},StreamReadUsage:function(){return iT},StringKeyframeTrack:function(){return StringKeyframeTrack},SubtractEquation:function(){return L},SubtractiveBlending:function(){return E},TOUCH:function(){return u},TangentSpaceNormalMap:function(){return tj},TetrahedronGeometry:function(){return TetrahedronGeometry},Texture:function(){return Texture},TextureLoader:function(){return TextureLoader},TextureUtils:function(){return n0},TorusGeometry:function(){return TorusGeometry},TorusKnotGeometry:function(){return TorusKnotGeometry},Triangle:function(){return Triangle},TriangleFanDrawMode:function(){return tG},TriangleStripDrawMode:function(){return tz},TrianglesDrawMode:function(){return tV},TubeGeometry:function(){return TubeGeometry},UVMapping:function(){return eg},Uint16BufferAttribute:function(){return Uint16BufferAttribute},Uint32BufferAttribute:function(){return Uint32BufferAttribute},Uint8BufferAttribute:function(){return Uint8BufferAttribute},Uint8ClampedBufferAttribute:function(){return Uint8ClampedBufferAttribute},Uniform:function(){return Uniform},UniformsGroup:function(){return UniformsGroup},UniformsLib:function(){return nM},UniformsUtils:function(){return nc},UnsignedByteType:function(){return eN},UnsignedInt248Type:function(){return eX},UnsignedInt5999Type:function(){return ej},UnsignedIntType:function(){return ez},UnsignedShort4444Type:function(){return eH},UnsignedShort5551Type:function(){return eW},UnsignedShortType:function(){return eF},VSMShadowMap:function(){return y},Vector2:function(){return Vector2},Vector3:function(){return Vector3},Vector4:function(){return Vector4},VectorKeyframeTrack:function(){return VectorKeyframeTrack},VideoTexture:function(){return VideoTexture},WebGL3DRenderTarget:function(){return WebGL3DRenderTarget},WebGLArrayRenderTarget:function(){return WebGLArrayRenderTarget},WebGLCoordinateSystem:function(){return iL}
1,WebGLCubeRenderTarget:function(){return WebGLCubeRenderTarget},WebGLMultipleRenderTargets:function(){return WebGLMultipleRenderTargets},WebGLRenderTarget:function(){return WebGLRenderTarget},WebGLRenderer:function(){return WebGLRenderer},WebGLUtils:function(){return WebGLUtils},WebGPUCoordinateSystem:function(){return iP},WireframeGeometry:function(){return WireframeGeometry},WrapAroundEnding:function(){return tB},ZeroCurvatureEnding:function(){return tD},ZeroFactor:function(){return D},ZeroSlopeEnding:function(){return tN},ZeroStencilOp:function(){return t2},createCanvasElement:function(){return createCanvasElement}});/** 2 * @license 3 * Copyright 2010-2024 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */let l="167",h={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},u={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},c=0,d=1,p=2,f=3,m=0,g=1,_=2,y=3,x=0,M=1,S=2,b=0,T=1,A=2,E=3,w=4,C=5,R=100,L=101,P=102,I=103,U=104,D=200,N=201,B=202,O=203,F=204,V=205,z=206,G=207,k=208,H=209,W=210,X=211,j=212,q=213,Y=214,K=0,Z=1,J=2,Q=3,$=4,ee=5,et=6,ei=7,er=0,en=1,ea=2,es=0,eo=1,el=2,eh=3,eu=4,ec=5,ed=6,ep=7,ef="attached",em="detached",eg=300,ev=301,e_=302,ey=303,ex=304,eM=306,eS=1e3,eb=1001,eT=1002,eA=1003,eE=1004,ew=1004,eC=1005,eR=1005,eL=1006,eP=1007,eI=1007,eU=1008,eD=1008,eN=1009,eB=1010,eO=1011,eF=1012,eV=1013,ez=1014,eG=1015,ek=1016,eH=1017,eW=1018,eX=1020,ej=35902,eq=1021,eY=1022,eK=1023,eZ=1024,eJ=1025,eQ=1026,e$=1027,e0=1028,e1=1029,e3=1030,e2=1031,e4=1032,e5=1033,e6=33776,e8=33777,e9=33778,e7=33779,te=35840,tt=35841,ti=35842,tr=35843,tn=36196,ta=37492,ts=37496,to=37808,tl=37809,th=37810,tu=37811,tc=37812,td=37813,tp=37814,tf=37815,tm=37816,tg=37817,tv=37818,t_=37819,ty=37820,tx=37821,tM=36492,tS=36494,tb=36495,tT=36283,tA=36284,tE=36285,tw=36286,tC=2200,tR=2201,tL=2202,tP=2300,tI=2301,tU=2302,tD=2400,tN=2401,tB=2402,tO=2500,tF=2501,tV=0,tz=1,tG=2,tk=3200,tH=3201,tW=3202,tX=3203,tj=0,tq=1,tY="",tK="srgb",tZ="srgb-linear",tJ="display-p3",tQ="display-p3-linear",t$="linear",t0="srgb",t1="rec709",t3="p3",t2=0,t4=7680,t5=7681,t6=7682,t8=7683,t9=34055,t7=34056,ie=5386,it=512,ii=513,ir=514,ia=515,is=516,io=517,il=518,ih=519,iu=512,ic=513,id=514,ip=515,im=516,ig=517,iv=518,i_=519,iy=35044,ix=35048,iM=35040,iS=35045,ib=35049,iT=35041,iA=35046,iE=35050,iw=35042,iC="100",iR="300 es",iL=2e3,iP=2001;let EventDispatcher=class EventDispatcher{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners,r=i[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners,i=t[e.type];if(void 0!==i){e.target=this;let t=i.slice(0);for(let i=0,r=t.length;i<r;i++)t[i].call(this,e);e.target=null}}};let iI=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],iU=1234567,iD=Math.PI/180,iN=180/Math.PI;function generateUUID(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=iI[255&e]+iI[e>>8&255]+iI[e>>16&255]+iI[e>>24&255]+"-"+iI[255&t]+iI[t>>8&255]+"-"+iI[t>>16&15|64]+iI[t>>24&255]+"-"+iI[63&i|128]+iI[i>>8&255]+"-"+iI[i>>16&255]+iI[i>>24&255]+iI[255&r]+iI[r>>8&255]+iI[r>>16&255]+iI[r>>24&255];return n.toLowerCase()}function clamp(e,t,i){return Math.max(t,Math.min(i,e))}function euclideanModulo(e,t){return(e%t+t)%t}function lerp(e,t,i){return(1-i)*e+i*t}function denormalize(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function normalize(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let iB={DEG2RAD:iD,RAD2DEG:iN,generateUUID:generateUUID,clamp:clamp,euclideanModulo:euclideanModulo,mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:lerp,damp:function(e,t,i,r){return lerp(e,t,1-Math.exp(-i*r))},pingpong:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(euclideanModulo(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(iU=e);let t=iU+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*iD},radToDeg:function(e){return e*iN},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,i,r,n){let a=Math.cos,s=Math.sin,o=a(i/2),l=s(i/2),h=a((t+r)/2),u=s((t+r)/2),c=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),f=s((r-t)/2);switch(n){case"XYX":e.set(o*u,l*c,l*d,o*h);break;case"YZY":e.set(l*d,o*u,l*c,o*h);break;case"ZXZ":e.set(l*c,l*d,o*u,o*h);break;case"XZX":e.set(o*u,l*f,l*p,o*h);break;case"YXY":e.set(l*p,o*u,l*f,o*h);break;case"ZYZ":e.set(l*f,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}},normalize:normalize,denormalize:denormalize};let Vector2=class Vector2{get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
5sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(clamp(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}constructor(e=0,t=0){Vector2.prototype.isVector2=!0,this.x=e,this.y=t}};let Matrix3=class Matrix3{set(e,t,i,r,n,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=r,h[2]=s,h[3]=t,h[4]=n,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=r[0],m=r[3],g=r[6],_=r[1],y=r[4],x=r[7],M=r[2],S=r[5],b=r[8];return n[0]=a*f+s*_+o*M,n[3]=a*m+s*y+o*S,n[6]=a*g+s*x+o*b,n[1]=l*f+h*_+u*M,n[4]=l*m+h*y+u*S,n[7]=l*g+h*x+u*b,n[2]=c*f+d*_+p*M,n[5]=c*m+d*y+p*S,n[8]=c*g+d*x+p*b,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-i*n*h+i*s*o+r*n*l-r*a*o}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],u=h*a-s*l,c=s*o-h*n,d=l*n-a*o,p=t*u+i*c+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=u*f,e[1]=(r*l-h*i)*f,e[2]=(s*i-r*a)*f,e[3]=c*f,e[4]=(h*t-r*o)*f,e[5]=(r*n-s*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(a*t-i*n)*f,this}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,n,a,s){let o=Math.cos(n),l=Math.sin(n);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(iO.makeScale(e,t)),this}rotate(e){return this.premultiply(iO.makeRotation(-e)),this}translate(e,t){return this.premultiply(iO.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}constructor(e,t,i,r,n,a,s,o,l){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,r,n,a,s,o,l)}};let iO=new Matrix3;function arrayNeedsUint32(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let iF={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function getTypedArray(e,t){return new iF[e](t)}function createElementNS(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function createCanvasElement(){let e=createElementNS("canvas");return e.style.display="block",e}let iV={};function warnOnce(e){e in iV||(iV[e]=!0,console.warn(e))}let iz=new Matrix3().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),iG=new Matrix3().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ik={[tZ]:{transfer:t$,primaries:t1,luminanceCoefficients:[.2126,.7152,.0722],toReference:e=>e,fromReference:e=>e},[tK]:{transfer:t0,primaries:t1,luminanceCoefficients:[.2126,.7152,.0722],toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[tQ]:{transfer:t$,primaries:t3,luminanceCoefficients:[.2289,.6917,.0793],toReference:e=>
5e.applyMatrix3(iG),fromReference:e=>e.applyMatrix3(iz)},[tJ]:{transfer:t0,primaries:t3,luminanceCoefficients:[.2289,.6917,.0793],toReference:e=>e.convertSRGBToLinear().applyMatrix3(iG),fromReference:e=>e.applyMatrix3(iz).convertLinearToSRGB()}},iH=new Set([tZ,tQ]),iW={enabled:!0,_workingColorSpace:tZ,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(colorSpace){if(!iH.has(colorSpace))throw Error('Unsupported working color space, "'.concat(colorSpace,'".'));this._workingColorSpace=colorSpace},convert:function(e,t,i){if(!1===this.enabled||t===i||!t||!i)return e;let r=ik[t].toReference,n=ik[i].fromReference;return n(r(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return ik[e].primaries},getTransfer:function(e){return e===tY?t$:ik[e].transfer},getLuminanceCoefficients:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._workingColorSpace;return e.fromArray(ik[t].luminanceCoefficients)}};function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function LinearToSRGB(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let ImageUtils=class ImageUtils{static getDataURL(e){let t;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===r&&(r=createElementNS("canvas")),r.width=e.width,r.height=e.height;let i=r.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=r}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=createElementNS("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),n=r.data;for(let e=0;e<n.length;e++)n[e]=255*SRGBToLinear(n[e]/255);return i.putImageData(r,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*SRGBToLinear(t[e]/255)):t[e]=SRGBToLinear(t[e]);return{data:t,width:e.width,height:e.height}}}};let iX=0;let Source=class Source{set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(serializeImage(r[t].image)):e.push(serializeImage(r[t]))}else e=serializeImage(r);i.url=e}return t||(e.images[this.uuid]=i),i}constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iX++}),this.uuid=generateUUID(),this.data=e,this.dataReady=!0,this.version=0}};function serializeImage(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ImageUtils.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ij=0;let Texture=class Texture extends EventDispatcher{get image(){return this.source.data}set image(e){void 0===e&&(e=null),this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace
5=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==eg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case eS:e.x=e.x-Math.floor(e.x);break;case eb:e.x=e.x<0?0:1;break;case eT:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case eS:e.y=e.y-Math.floor(e.y);break;case eb:e.y=e.y<0?0:1;break;case eT:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}constructor(e=Texture.DEFAULT_IMAGE,t=Texture.DEFAULT_MAPPING,i=eb,r=eb,n=eL,a=eU,s=eK,o=eN,l=Texture.DEFAULT_ANISOTROPY,h=tY){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ij++}),this.uuid=generateUUID(),this.name="",this.source=new Source(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}};Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=eg,Texture.DEFAULT_ANISOTROPY=1;let Vector4=class Vector4{get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*n,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r;let n=e.elements,a=n[0],s=n[4],o=n[8],l=n[1],h=n[5],u=n[9],c=n[2],d=n[6],p=n[10];if(.01>Math.abs(s-l)&&.01>Math.abs(o-c)&&.01>Math.abs(u-d)){if(.1>Math.abs(s+l)&&.1>Math.abs(o+c)&&.1>Math.abs(u+d)&&.1>Math.abs(a+h+p-3))return this.set(1,0,0,0),this;let e=(a+1)/2,n=(h+1)/2,f=(p+1)/2,m=(s+l)/4,g=(o+c)/4,_=(u+d)/4;return e>n&&e>f?e<.01?(t=0,i=.707106781,r=.707106781):(i=m/(t=Math.sqrt(e)),r=g/t):n>f?n<.01?(t=.707106781,i=0,r=.707106781):(t=m/(i=Math.sqrt(n)),r=_/i):f<.01?(t=.707106781,i=.707106781,r=0):(t=g/(r=Math.sqrt(f)),i=_/r),this.set(t,i,r,Math.PI),this}let f=Math.sqrt((d-u)*(d-u)+(o-c)*(o-c)+(l-s)*(l-s));return .001>Math.abs(f)&&(f=1),this.x=(d-u)/f,this.y=(o-c)/f,this.z=(l-s)/f,this.w=Math.acos((a+h+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){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(){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}
5round(){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(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}constructor(e=0,t=0,i=0,r=1){Vector4.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}};let RenderTarget=class RenderTarget extends EventDispatcher{get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,n=this.textures.length;r<n;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new Source(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new Vector4(0,0,e,t),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:eL,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);let r=new Texture({width:e,height:t,depth:1},i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);r.flipY=!1,r.generateMipmaps=i.generateMipmaps,r.internalFormat=i.internalFormat,this.textures=[];let n=i.count;for(let e=0;e<n;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}};let WebGLRenderTarget=class WebGLRenderTarget extends RenderTarget{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}};let DataArrayTexture=class DataArrayTexture extends Texture{addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=eA,this.minFilter=eA,this.wrapR=eb,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}};let WebGLArrayRenderTarget=class WebGLArrayRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,i=1,r={}
5){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new DataArrayTexture(null,e,t,i),this.texture.isRenderTargetTexture=!0}};let Data3DTexture=class Data3DTexture extends Texture{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=eA,this.minFilter=eA,this.wrapR=eb,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};let WebGL3DRenderTarget=class WebGL3DRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Data3DTexture(null,e,t,i),this.texture.isRenderTargetTexture=!0}};let Quaternion=class Quaternion{static slerpFlat(e,t,i,r,n,a,s){let o=i[r+0],l=i[r+1],h=i[r+2],u=i[r+3],c=n[a+0],d=n[a+1],p=n[a+2],f=n[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(1===s){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(u!==f||o!==c||l!==d||h!==p){let e=1-s,t=o*c+l*d+h*p+u*f,i=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let n=Math.sqrt(r),a=Math.atan2(n,t*i);e=Math.sin(e*a)/n,s=Math.sin(s*a)/n}let n=s*i;if(o=o*e+c*n,l=l*e+d*n,h=h*e+p*n,u=u*e+f*n,e===1-s){let e=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=e,l*=e,h*=e,u*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,n,a){let s=i[r],o=i[r+1],l=i[r+2],h=i[r+3],u=n[a],c=n[a+1],d=n[a+2],p=n[a+3];return e[t]=s*p+h*u+o*d-l*c,e[t+1]=o*p+h*c+l*u-s*d,e[t+2]=l*p+h*d+s*c-o*u,e[t+3]=h*p-s*u-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e._x,r=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(r/2),u=s(n/2),c=o(i/2),d=o(r/2),p=o(n/2);switch(a){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],u=t[10],c=i+s+u;if(c>0){let e=.5/Math.sqrt(c+1);this._w=.25/e,this._x=(h-o)*e,this._y=(n-l)*e,this._z=(a-r)*e}else if(i>s&&i>u){let e=2*Math.sqrt(1+i-s-u);this._w=(h-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(n+l)/e}else if(s>u){let e=2*Math.sqrt(1+s-i-u);this._w=(n-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+u-i-s);this._w=(a-r)/e,this._x=(n+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(clamp(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);return 0===i||this.slerp(e,Math.min(1,t/i)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}
5conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*s+r*l-n*o,this._y=r*h+a*o+n*s-i*l,this._z=n*h+a*l+i*o-r*s,this._w=a*h-i*s-r*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,r=this._y,n=this._z,a=this._w,s=a*e._w+i*e._x+r*e._y+n*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=i,this._y=r,this._z=n,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*i+t*this._x,this._y=e*r+t*this._y,this._z=e*n+t*this._z,this.normalize(),this}let l=Math.sqrt(o),h=Math.atan2(l,s),u=Math.sin((1-t)*h)/l,c=Math.sin(t*h)/l;return this._w=a*u+this._w*c,this._x=i*u+this._x*c,this._y=r*u+this._y*c,this._z=n*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}};let Vector3=class Vector3{set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(iY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(iY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=e.elements,a=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this}
5applyQuaternion(e){let t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*r-s*i),h=2*(s*t-n*r),u=2*(n*i-a*t);return this.x=t+o*l+a*u-s*h,this.y=i+o*h+s*l-n*u,this.z=r+o*u+n*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return iq.copy(this).projectOnVector(e),this.sub(iq)}reflect(e){return this.sub(iq.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(clamp(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}constructor(e=0,t=0,i=0){Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}};let iq=new Vector3,iY=new Quaternion;let Box3=class Box3{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(iZ.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(iZ.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=iZ.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);let i=e.geometry;if(void 0!==i){let r=i.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,i=r.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,iZ):iZ.fromBufferAttribute(r,t),iZ.applyMatrix4(e.matrixWorld),this.expandByPoint(iZ);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),iJ.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),iJ.copy(i.boundingBox)),iJ.applyM
vendor: 1,643 bytes, line 5
5atrix4(e.matrixWorld),this.union(iJ)}let r=e.children;for(let e=0,i=r.length;e<i;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,iZ),iZ.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(i4),i5.subVectors(this.max,i4),iQ.subVectors(e.a,i4),i$.subVectors(e.b,i4),i0.subVectors(e.c,i4),i1.subVectors(i$,iQ),i3.subVectors(i0,i$),i2.subVectors(iQ,i0);let t=[0,-i1.z,i1.y,0,-i3.z,i3.y,0,-i2.z,i2.y,i1.z,0,-i1.x,i3.z,0,-i3.x,i2.z,0,-i2.x,-i1.y,i1.x,0,-i3.y,i3.x,0,-i2.y,i2.x,0];return!!(satForAxes(t,iQ,i$,i0,i5)&&satForAxes(t=[1,0,0,0,1,0,0,0,1],iQ,i$,
5i0,i5))&&(i6.crossVectors(i1,i3),satForAxes(t=[i6.x,i6.y,i6.z],iQ,i$,i0,i5))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,iZ).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(iZ).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(iK[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),iK[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),iK[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),iK[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),iK[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),iK[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),iK[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),iK[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(iK)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new Vector3(Infinity,Infinity,Infinity),t=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}};let iK=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],iZ=new Vector3,iJ=new Box3,iQ=new Vector3,i$=new Vector3,i0=new Vector3,i1=new Vector3,i3=new Vector3,i2=new Vector3,i4=new Vector3,i5=new Vector3,i6=new Vector3,i8=new Vector3;function satForAxes(e,t,i,r,n){for(let a=0,s=e.length-3;a<=s;a+=3){i8.fromArray(e,a);
5let s=n.x*Math.abs(i8.x)+n.y*Math.abs(i8.y)+n.z*Math.abs(i8.z),o=t.dot(i8),l=i.dot(i8),h=r.dot(i8);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}let i9=new Box3,i7=new Vector3,re=new Vector3;let Sphere=class Sphere{set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):i9.setFromPoints(e).getCenter(i);let r=0;for(let t=0,n=e.length;t<n;t++)r=Math.max(r,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;i7.subVectors(e,this.center);let t=i7.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(i7,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(re.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(i7.copy(e.center).add(re)),this.expandByPoint(i7.copy(e.center).sub(re)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3,t=-1){this.isSphere=!0,this.center=e,this.radius=t}};let rt=new Vector3,ri=new Vector3,rr=new Vector3,rn=new Vector3,ra=new Vector3,rs=new Vector3,ro=new Vector3;let Ray=class Ray{set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rt.copy(this.origin).addScaledVector(this.direction,t),rt.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){let n,a,s,o;ri.copy(e).add(t).multiplyScalar(.5),rr.copy(t).sub(e).normalize(),rn.copy(this.origin).sub(ri);let l=.5*e.distanceTo(t),h=-this.direction.dot(rr),u=rn.dot(this.direction),c=-rn.dot(rr),d=rn.lengthSq(),p=Math.abs(1-h*h);if(p>0){if(n=h*c-u,a=h*u-c,o=l*p,n>=0){if(a>=-o){if(a<=o){let e=1/p;n*=e,a*=e,s=n*(n+h*a+2*u)+a*(h*n+a+2*c)+d}else s=-(n=Math.max(0,-(h*(a=l)+u)))*n+a*(a+2*c)+d}else s=-(n=Math.max(0,-(h*(a=-l)+u)))*n+a*(a+2*c)+d}else a<=-o?(a=(n=Math.max(0,-(-h*l+u)))>0?-l:Math.min(Math.max(-l,-c),l),s=-n*n+a*(a+2*c)+d):a<=o?(n=0,s=(a=Math.min(Math.max(-l,-c),l))*(a+2*c)+d):(a=(n=Math.max(0,-(h*l+u)))>0?l:Math.min(Math.max(-l,-c),l),s=-n*n+a*(a+2*c)+d)}else a=h>0?-l:l,s=-(n=Math.max(0,-(h*a+u)))*n+a*(a+2*c)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,n),r&&r.copy(ri).addScaledVector(rr,a),s}intersectSphere(e,t){rt.subVectors(e.center,this.origin);let i=rt.dot(this.direction),r=rt.dot(rt)-i*i,n=e.radius*e.radiu
5s;if(r>n)return null;let a=Math.sqrt(n-r),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let i=e.normal.dot(this.direction);return i*t<0}intersectBox(e,t){let i,r,n,a,s,o;let l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(l>=0?(i=(e.min.x-c.x)*l,r=(e.max.x-c.x)*l):(i=(e.max.x-c.x)*l,r=(e.min.x-c.x)*l),h>=0?(n=(e.min.y-c.y)*h,a=(e.max.y-c.y)*h):(n=(e.max.y-c.y)*h,a=(e.min.y-c.y)*h),i>a||n>r)?null:((n>i||isNaN(i))&&(i=n),(a<r||isNaN(r))&&(r=a),u>=0?(s=(e.min.z-c.z)*u,o=(e.max.z-c.z)*u):(s=(e.max.z-c.z)*u,o=(e.min.z-c.z)*u),i>o||s>r)?null:((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return null!==this.intersectBox(e,rt)}intersectTriangle(e,t,i,r,n){let a;ra.subVectors(t,e),rs.subVectors(i,e),ro.crossVectors(ra,rs);let s=this.direction.dot(ro);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}rn.subVectors(this.origin,e);let o=a*this.direction.dot(rs.crossVectors(rn,rs));if(o<0)return null;let l=a*this.direction.dot(ra.cross(rn));if(l<0||o+l>s)return null;let h=-a*rn.dot(ro);return h<0?null:this.at(h/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3,t=new Vector3(0,0,-1)){this.origin=e,this.direction=t}};let Matrix4=class Matrix4{set(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Matrix4().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,r=1/rl.setFromMatrixColumn(e,0).length(),n=1/rl.setFromMatrixColumn(e,1).length(),a=1/rl.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,n=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),u=Math.sin(n);if("XYZ"===e.order){let e=a*h,i=a*u,r=s*h,n=s*u;t[0]=o*h,t[4]=-o*u,t[8]=l,t[1]=i+r*l,t[5]=e-n*l,t[9]=-s*o,t[2]=n-e*l,t[6]=r+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*h,i=o*u,r=l*h,n=l*u;t[0]=e+n*s,t[4]=r*s-i,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-s,t[2]=i*s-r,t[6]=n+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*h,i=o*u,r=l*h,n=l*u;t[0]=e-n*s,t[4]=-a*u,t[8]=r+i*s,t[1]=i+r*s,t[5]=a*h,t[9]=n-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*h,i=a*u,r=s*h,n=s*u;t[0]=o*h,t[4]=r*l-i,t[8]=e*l+n,t[1]=o*u,t[5]=n*l+e,t[9]=i*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,r=s*o,n=s*l;t[0]=o*h,t[4]=n-e*u,t[8]=r*u+i,t[1]=u,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=i*u+r,t[10]=e-n*u}else if("XZY"===e.order){let e=a*o,i=a*l,r=s*o,n=s*l;t[0]=o*h,t[4]=-u,t[8]=l*h,t[1]=e*u+n,t[5]=a*h,t[9]=i*u-r,t[2]=r*u-i,t[6]=s*h,t[10]=n*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ru,e,rc)}lookAt(e,t,i){let r=this.elements;return rf.subVectors(e,t),0===rf.lengthSq()&&(rf.z=1),rf.normalize(),rd.crossVectors(i,rf),0===rd.lengthSq()&&(1===Math.abs(i.z)?rf.x+=1e-4:rf.z+=1e-4,rf.normalize(),rd.crossVectors(i,rf)),rd.normalize(),rp.crossVectors(rf,rd),r[0]=rd.x,r[4]=rp.x,r[8]=rf.x,r[1]=rd.y,r[5]=rp.y,r[9]=rf.y,r[2]=rd.z,r[6]=rp.z,r[10]=rf.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],_=i[3],y=i[7],x=i[11],M=i[15],S=r[0],b=r[4],T=r[8],A=r[12],E=r[1],w=r[5],C=r[9],R=r[13],L=r[2],P=r[6],I=r[10],U=r[14],D=r[3],N=r[7],B=r[11
5],O=r[15];return n[0]=a*S+s*E+o*L+l*D,n[4]=a*b+s*w+o*P+l*N,n[8]=a*T+s*C+o*I+l*B,n[12]=a*A+s*R+o*U+l*O,n[1]=h*S+u*E+c*L+d*D,n[5]=h*b+u*w+c*P+d*N,n[9]=h*T+u*C+c*I+d*B,n[13]=h*A+u*R+c*U+d*O,n[2]=p*S+f*E+m*L+g*D,n[6]=p*b+f*w+m*P+g*N,n[10]=p*T+f*C+m*I+g*B,n[14]=p*A+f*R+m*U+g*O,n[3]=_*S+y*E+x*L+M*D,n[7]=_*b+y*w+x*P+M*N,n[11]=_*T+y*C+x*I+M*B,n[15]=_*A+y*R+x*U+M*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],u=e[6],c=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+n*o*u-r*l*u-n*s*c+i*l*c+r*s*d-i*o*d)+f*(+t*o*d-t*l*c+n*a*c-r*a*d+r*l*h-n*o*h)+m*(+t*l*u-t*s*d-n*a*u+i*a*d+n*s*h-i*l*h)+g*(-r*s*h-t*o*u+t*s*c+r*a*u-i*a*c+i*o*h)}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],_=u*m*l-f*c*l+f*o*d-s*m*d-u*o*g+s*c*g,y=p*c*l-h*m*l-p*o*d+a*m*d+h*o*g-a*c*g,x=h*f*l-p*u*l+p*s*d-a*f*d-h*s*g+a*u*g,M=p*u*o-h*f*o-p*s*c+a*f*c+h*s*m-a*u*m,S=t*_+i*y+r*x+n*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let b=1/S;return e[0]=_*b,e[1]=(f*c*n-u*m*n-f*r*d+i*m*d+u*r*g-i*c*g)*b,e[2]=(s*m*n-f*o*n+f*r*l-i*m*l-s*r*g+i*o*g)*b,e[3]=(u*o*n-s*c*n-u*r*l+i*c*l+s*r*d-i*o*d)*b,e[4]=y*b,e[5]=(h*m*n-p*c*n+p*r*d-t*m*d-h*r*g+t*c*g)*b,e[6]=(p*o*n-a*m*n-p*r*l+t*m*l+a*r*g-t*o*g)*b,e[7]=(a*c*n-h*o*n+h*r*l-t*c*l-a*r*d+t*o*d)*b,e[8]=x*b,e[9]=(p*u*n-h*f*n-p*i*d+t*f*d+h*i*g-t*u*g)*b,e[10]=(a*f*n-p*s*n+p*i*l-t*f*l-a*i*g+t*s*g)*b,e[11]=(h*s*n-a*u*n-h*i*l+t*u*l+a*i*d-t*s*d)*b,e[12]=M*b,e[13]=(h*f*r-p*u*r+p*i*c-t*f*c-h*i*m+t*u*m)*b,e[14]=(p*s*r-a*f*r-p*i*o+t*f*o+a*i*m-t*s*m)*b,e[15]=(a*u*r-h*s*r+h*i*o-t*u*o-a*i*c+t*s*c)*b,this}scale(e){let t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),n=1-i,a=e.x,s=e.y,o=e.z,l=n*a,h=n*s;return this.set(l*a+i,l*s-r*o,l*o+r*s,0,l*s+r*o,h*s+i,h*o-r*a,0,l*o-r*s,h*o+r*a,n*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,n,a){return this.set(1,i,n,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,h=a+a,u=s+s,c=n*l,d=n*h,p=n*u,f=a*h,m=a*u,g=s*u,_=o*l,y=o*h,x=o*u,M=i.x,S=i.y,b=i.z;return r[0]=(1-(f+g))*M,r[1]=(d+x)*M,r[2]=(p-y)*M,r[3]=0,r[4]=(d-x)*S,r[5]=(1-(c+g))*S,r[6]=(m+_)*S,r[7]=0,r[8]=(p+y)*b,r[9]=(m-_)*b,r[10]=(1-(c+f))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements,n=rl.set(r[0],r[1],r[2]).length(),a=rl.set(r[4],r[5],r[6]).length(),s=rl.set(r[8],r[9],r[10]).length(),o=this.determinant();o<0&&(n=-n),e.x=r[12],e.y=r[13],e.z=r[14],rh.copy(this);let l=1/n,h=1/a,u=1/s;return rh.elements[0]*=l,rh.elements[1]*=l,rh.elements[2]*=l,rh.elements[4]*=h,rh.elements[5]*=h,rh.elements[6]*=h,rh.elements[8]*=u,rh.elements[9]*=u,rh.elements[10]*=u,t.setFromRotationMatrix(rh),i.x=n,i.y=a,i.z=s,this}makePerspective(e,t,i,r,n,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:iL,h=this.elements;if(l===iL)s=-(a+n)/(a-n),o=-2*a*n/(a-n);else if(l===iP)s=-a/(a-n),o=-a*n/(a-n);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return h[0]=2*n/(t-e),h[4]=0,h[8]=(t+e)/(t-e),h[12]=0,h[1]=0,h[5]=2*n/(i-r),h[9]=(i+r)/(i-r),h[13]=0,h[2]=0,h[6]=0,h[10]=s,h[14]=o,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}
5makeOrthographic(e,t,i,r,n,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:iL,h=this.elements,u=1/(t-e),c=1/(i-r),d=1/(a-n);if(l===iL)s=(a+n)*d,o=-2*d;else if(l===iP)s=n*d,o=-1*d;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return h[0]=2*u,h[4]=0,h[8]=0,h[12]=-((t+e)*u),h[1]=0,h[5]=2*c,h[9]=0,h[13]=-((i+r)*c),h[2]=0,h[6]=0,h[10]=o,h[14]=-s,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}constructor(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m)}};let rl=new Vector3,rh=new Matrix4,ru=new Vector3(0,0,0),rc=new Vector3(1,1,1),rd=new Vector3,rp=new Vector3,rf=new Vector3,rm=new Matrix4,rg=new Quaternion;let Euler=class Euler{get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=e.elements,n=r[0],a=r[4],s=r[8],o=r[1],l=r[5],h=r[9],u=r[2],c=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(clamp(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-clamp(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(clamp(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-clamp(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return rm.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rm,t,i)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return rg.setFromEuler(this),this.setFromQuaternion(rg,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}
5constructor(e=0,t=0,i=0,r=Euler.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}};Euler.DEFAULT_ORDER="XYZ";let Layers=class Layers{set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}constructor(){this.mask=1}};let rv=0,r_=new Vector3,ry=new Quaternion,rx=new Matrix4,rM=new Vector3,rS=new Vector3,rb=new Vector3,rT=new Quaternion,rA=new Vector3(1,0,0),rE=new Vector3(0,1,0),rw=new Vector3(0,0,1),rC={type:"added"},rR={type:"removed"},rL={type:"childadded",child:null},rP={type:"childremoved",child:null};let Object3D=class Object3D extends EventDispatcher{onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ry.setFromAxisAngle(e,t),this.quaternion.multiply(ry),this}rotateOnWorldAxis(e,t){return ry.setFromAxisAngle(e,t),this.quaternion.premultiply(ry),this}rotateX(e){return this.rotateOnAxis(rA,e)}rotateY(e){return this.rotateOnAxis(rE,e)}rotateZ(e){return this.rotateOnAxis(rw,e)}translateOnAxis(e,t){return r_.copy(e).applyQuaternion(this.quaternion),this.position.add(r_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(rA,e)}translateY(e){return this.translateOnAxis(rE,e)}translateZ(e){return this.translateOnAxis(rw,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(rx.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?rM.copy(e):rM.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),rS.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rx.lookAt(rS,rM,this.up):rx.lookAt(rM,rS,this.up),this.quaternion.setFromRotationMatrix(rx),r&&(rx.extractRotation(r.matrixWorld),ry.setFromRotationMatrix(rx),this.quaternion.premultiply(ry.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(rC),rL.child=e,this.dispatchEvent(rL),rL.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rR),rP.child=e,this.dispatchEvent(rP),rP.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),rx.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),rx.multiply(e.parent.matrixWorld)),e.applyMatrix4(rx),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(rC),rL.child=e,this.dispatchEvent(rL),rL.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let r=this.children[i],n=r.getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&i.push(this);let r=this.children;for(let n=0,a=r.length;n<a;n++)r[n].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rS,e,rb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rS,rT,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++){let r=t[i];r.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++){let i=e[t];i.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let r={};function serialize(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),null!==this.boundingBox&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=serialize(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let r=i[t];serialize(e.shapes,r)}else serialize(e.shapes,i)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let t=[];for(let i=0,r=this.material.length;i<r;i++)t.push(serialize(e.materials,this.material[i]));r.material=t}else r.material=serialize(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];r.animations.push(serialize(e.animations,i))}}if(t){let t=extractFromCache(e.geometries),r=extractFromCache(e.materials),n=extractFromCache(e.textures),a=extractFromCache(e.images),s=extractFromCache(e.shapes),o=extractFromCache(e.skeletons),l=extractFromCache(e.animations),h=extractFromCache(e.nodes);t.length>0&&(i.geometries=t),r.length>0&&(i.materials=r),n.length>0&&(i.textures=n),a.length>0&&(i.images=a),s.length>0&&(i.shapes=s),o.length>0&&(i.skeletons=o),l.length>0&&(i.animations=l),h.length>0&&(i.nodes=h)}return i.object=r,i;function extractFromCache(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:rv++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();let e=new Vector3,t=new Euler,i=new Quaternion,r=new Vector3(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}};Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let rI=new Vector3,rU=new Vector3,rD=new Vector3,rN=new Vector3,rB=new Vector3,rO=new Vector3,rF=new Vector3,rV=new Vector3,rz=new Vector3,rG=new Vector3;let Triangle=class Triangle{static getNormal(e,t,i,r){r.subVectors(i,t),rI.subVectors(e,t),r.cross(rI);let n=r.lengthSq();return n>0?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}static getBarycoord(e,t,i,r,n){rI.subVectors(r,t),rU.subVectors(i,t),rD.subVectors(e,t);let a=rI.dot(rI),s=rI.dot(rU),o=rI.dot(rD),l=rU.dot(rU),h=rU.dot(rD),u=a*l-s*s;if(0===u)return n.set(0,0,0),null;
5let c=1/u,d=(l*o-s*h)*c,p=(a*h-s*o)*c;return n.set(1-d-p,p,d)}static containsPoint(e,t,i,r){return null!==this.getBarycoord(e,t,i,r,rN)&&rN.x>=0&&rN.y>=0&&rN.x+rN.y<=1}static getInterpolation(e,t,i,r,n,a,s,o){return null===this.getBarycoord(e,t,i,r,rN)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,rN.x),o.addScaledVector(a,rN.y),o.addScaledVector(s,rN.z),o)}static isFrontFacing(e,t,i,r){return rI.subVectors(i,t),rU.subVectors(e,t),0>rI.cross(rU).dot(r)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return rI.subVectors(this.c,this.b),rU.subVectors(this.a,this.b),.5*rI.cross(rU).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Triangle.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Triangle.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,n){return Triangle.getInterpolation(e,this.a,this.b,this.c,t,i,r,n)}containsPoint(e){return Triangle.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Triangle.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,r;let n=this.a,a=this.b,s=this.c;rB.subVectors(a,n),rO.subVectors(s,n),rV.subVectors(e,n);let o=rB.dot(rV),l=rO.dot(rV);if(o<=0&&l<=0)return t.copy(n);rz.subVectors(e,a);let h=rB.dot(rz),u=rO.dot(rz);if(h>=0&&u<=h)return t.copy(a);let c=o*u-h*l;if(c<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(n).addScaledVector(rB,i);rG.subVectors(e,s);let d=rB.dot(rG),p=rO.dot(rG);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(n).addScaledVector(rO,r);let m=h*p-d*u;if(m<=0&&u-h>=0&&d-p>=0)return rF.subVectors(s,a),r=(u-h)/(u-h+(d-p)),t.copy(a).addScaledVector(rF,r);let g=1/(m+f+c);return i=f*g,r=c*g,t.copy(n).addScaledVector(rB,i).addScaledVector(rO,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}constructor(e=new Vector3,t=new Vector3,i=new Vector3){this.a=e,this.b=t,this.c=i}};let rk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},rH={h:0,s:0,l:0},rW={h:0,s:0,l:0};function hue2rgb(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}let Color=class Color{set(e,t,i){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tK;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,iW.toWorkingColorSpace(this,t),this}setRGB(e,t,i){let r=arguments.length>
53&&void 0!==arguments[3]?arguments[3]:iW.workingColorSpace;return this.r=e,this.g=t,this.b=i,iW.toWorkingColorSpace(this,r),this}setHSL(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:iW.workingColorSpace;if(e=euclideanModulo(e,1),t=clamp(t,0,1),i=clamp(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,n=2*i-r;this.r=hue2rgb(n,r,e+1/3),this.g=hue2rgb(n,r,e),this.b=hue2rgb(n,r,e-1/3)}return iW.toWorkingColorSpace(this,r),this}setStyle(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tK;function handleAlpha(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;let n=t[1],a=t[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return handleAlpha(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,i);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return handleAlpha(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,i);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return handleAlpha(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,i);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=t[1],n=r.length;if(3===n)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,i);if(6===n)return this.setHex(parseInt(r,16),i);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,i);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tK,i=rk[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=SRGBToLinear(e.r),this.g=SRGBToLinear(e.g),this.b=SRGBToLinear(e.b),this}copyLinearToSRGB(e){return this.r=LinearToSRGB(e.r),this.g=LinearToSRGB(e.g),this.b=LinearToSRGB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tK;return iW.fromWorkingColorSpace(rX.copy(this),e),65536*Math.round(clamp(255*rX.r,0,255))+256*Math.round(clamp(255*rX.g,0,255))+Math.round(clamp(255*rX.b,0,255))}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tK;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iW.workingColorSpace;iW.fromWorkingColorSpace(rX.copy(this),r);let n=rX.r,a=rX.g,s=rX.b,o=Math.max(n,a,s),l=Math.min(n,a,s),h=(l+o)/2;if(l===o)t=0,i=0;else{let e=o-l;switch(i=h<=.5?e/(o+l):e/(2-o-l),o){case n:t=(a-s)/e+(a<s?6:0);break;case a:t=(s-n)/e+2;break;case s:t=(n-a)/e+4}t/=6}return e.h=t,e.s=i,e.l=h,e}getRGB(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iW.workingColorSpace;return iW.fromWorkingColorSpace(rX.copy(this),t),e.r=rX.r,e.g=rX.g,e.b=rX.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tK;iW.fromWorkingColorSpace(rX.copy(this),e);let t=rX.r,i=rX.g,r=rX.b;return e!==tK?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(i.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*i),",").concat(Math.round(255*r),")")}offsetHSL(e,t,i){return this.getHSL(rH),this.setHSL(rH.h+e,rH.s+t,rH.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(rH),e.getHSL(rW);let i=lerp(rH.h,rW.h,t),r=lerp(rH.s,rW.s,t),n=lerp(rH.l,rW.l,t);return this.setHSL(i,r,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,n=e.elements;return this.r=n[0]*t+n[3]*i+n[6]*r,this.g=n[1]*t+n[4]*i+n[7]*r,this.b=n[2]*t+n[5]*i+n[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}};let rX=new Color;Color.NAMES=rk;let rj=0;
5let Material=class Material extends EventDispatcher{get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let r=this[t];if(void 0===r){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function extractFromCache(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==T&&(i.blending=this.blending),this.side!==x&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),this.blendSrc!==F&&(i.blendSrc=this.blendSrc),this.blendDst!==V&&(i.blendDst=this.blendDst),this.blendEquation!==R&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&
5(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Q&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ih&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==t4&&(i.stencilFail=this.stencilFail),this.stencilZFail!==t4&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==t4&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=extractFromCache(e.textures),r=extractFromCache(e.images);t.length>0&&(i.textures=t),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let r=0;r!==e;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rj++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=T,this.side=x,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=F,this.blendDst=V,this.blendEquation=R,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Color(0,0,0),this.blendAlpha=0,this.depthFunc=Q,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ih,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=t4,this.stencilZFail=t4,this.stencilZPass=t4,this.stencilWrite=!1,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}};let MeshBasicMaterial=class MeshBasicMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=er,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}};let rq=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),n=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,n[e]=24,n[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,n[e]=-t-1,n[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,n[e]=13,n[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,n[e]=24,n[256|e]=24):(r[e]=31744,r[256|e]=64512,n[e]=13,n[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;(8388608&t)==0;)t<<=1,i-=8388608;t&=-8388609,i+=947912704,a[e]=t|i}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:n,mantissaTable:a,exponentTable:s,offsetTable:o}}();function toHalfFloat(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=clamp(e,-65504,65504),rq.floatView[0]=e;let t=rq.uint32View[0],i=t>>23&511;return rq.baseTable[i]+((8388607&t)>>rq.shiftTable[i])}function fromHalfFloat(e){let t=e>>10;return rq.uint32View[0]=rq.mantissaTable[rq.offsetTable[t]+(1023&e)]+rq.exponentTable[t],rq.floatView[0]}let rY={toHalfFloat:toHalfFloat,fromHalfFloat:fromHalfFloat},rK=new Vector3,rZ=new Vector2;let BufferAttribute=class BufferAttribute{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return warnOnce("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;
5for(let r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)rZ.fromBufferAttribute(this,t),rZ.applyMatrix3(e),this.setXY(t,rZ.x,rZ.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)rK.fromBufferAttribute(this,t),rK.applyMatrix3(e),this.setXYZ(t,rK.x,rK.y,rK.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)rK.fromBufferAttribute(this,t),rK.applyMatrix4(e),this.setXYZ(t,rK.x,rK.y,rK.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)rK.fromBufferAttribute(this,t),rK.applyNormalMatrix(e),this.setXYZ(t,rK.x,rK.y,rK.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)rK.fromBufferAttribute(this,t),rK.transformDirection(e),this.setXYZ(t,rK.x,rK.y,rK.z);return this}set(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=denormalize(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=normalize(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=denormalize(t,this.array)),t}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=denormalize(t,this.array)),t}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=denormalize(t,this.array)),t}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=denormalize(t,this.array)),t}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array),n=normalize(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==iy&&(e.usage=this.usage),e}constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=iy,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=eG,this.version=0}};let Int8BufferAttribute=class Int8BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Int8Array(e),t,i)}};let Uint8BufferAttribute=class Uint8BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint8Array(e),t,i)}};let Uint8ClampedBufferAttribute=class Uint8ClampedBufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}};let Int16BufferAttribute=class Int16BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Int16Array(e),t,i)}};let Uint16BufferAttribute=class Uint16BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint16Array(e),t,i)}};let Int32BufferAttribute=class Int32BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Int32Array(e),t,i)}};let Uint32BufferAttribute=class Uint32BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Uint32Array(e),t,i)}};let Float16BufferAttribute=class Float16BufferAttribute extends BufferAttribute{getX(e){let t=fromHalfFloat(this.array[e*this.itemSize]);return this.normalized&&(t=denormalize(t,this.array)),t}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize]=toHalfFloat(t),this}getY(e){let t=fromHalfFloat(this.array[e*this.itemSize+1]);return this.normalized&&(t=denormalize(t,this.array)),t}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+1]=toHalfFloat(t),this}getZ(e){let t=fromHalfFloat(this.array[e*this.itemSize+2]);return this.normalized&&(t=denormalize(t,this.array)),t}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+2]=toHalfFloat(t),this}getW(e){let t=fromHalfFloat(this.array[e*this.itemSize+3]);return this.normalized&&(t=denormalize(t,this.array)),t}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+3]=toH
5alfFloat(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array)),this.array[e+0]=toHalfFloat(t),this.array[e+1]=toHalfFloat(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array)),this.array[e+0]=toHalfFloat(t),this.array[e+1]=toHalfFloat(i),this.array[e+2]=toHalfFloat(r),this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array),n=normalize(n,this.array)),this.array[e+0]=toHalfFloat(t),this.array[e+1]=toHalfFloat(i),this.array[e+2]=toHalfFloat(r),this.array[e+3]=toHalfFloat(n),this}constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}};let Float32BufferAttribute=class Float32BufferAttribute extends BufferAttribute{constructor(e,t,i){super(new Float32Array(e),t,i)}};let rJ=0,rQ=new Matrix4,r$=new Object3D,r0=new Vector3,r1=new Box3,r3=new Box3,r2=new Vector3;let BufferGeometry=class BufferGeometry extends EventDispatcher{getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(arrayNeedsUint32(e)?Uint32BufferAttribute:Uint16BufferAttribute)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new Matrix3().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return rQ.makeRotationFromQuaternion(e),this.applyMatrix4(rQ),this}rotateX(e){return rQ.makeRotationX(e),this.applyMatrix4(rQ),this}rotateY(e){return rQ.makeRotationY(e),this.applyMatrix4(rQ),this}rotateZ(e){return rQ.makeRotationZ(e),this.applyMatrix4(rQ),this}translate(e,t,i){return rQ.makeTranslation(e,t,i),this.applyMatrix4(rQ),this}scale(e,t,i){return rQ.makeScale(e,t,i),this.applyMatrix4(rQ),this}lookAt(e){return r$.lookAt(e),r$.updateMatrix(),this.applyMatrix4(r$.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(r0).negate(),this.translate(r0.x,r0.y,r0.z),this}setFromPoints(e){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Float32BufferAttribute(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];r1.setFromBufferAttribute(i),this.morphTargetsRelative?(r2.addVectors(this.boundingBox.min,r1.min),this.boundingBox.expandByPoint(r2),r2.addVectors(this.boundingBox.max,r1.max),this.boundingBox.expandByPoint(r2)):(this.boundingBox.expandByPoint(r1.min),this.boundingBox.expandByPoint(r1.max))}}else 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(){null===this.boundingSphere&&(this.boundingSphere=new Sphere);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Vector3,1/0);return}if(e){let i=this.boundingSphere.center;if(r1.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];r3.setFromBufferAttribute(i),this.morphTargetsRelative?(r2.addVectors(r1.min,r3.min),r1.expandByPoint(r2),r2.addVectors(r1.max,r3.max),r1.expandByPoint(r2)):(r1.expandByPoint(r3.min),r1.expandByPoint(r3.max))}r1.getCenter(i);let r=0;for(let t=0,n=e.count;t<n;
5t++)r2.fromBufferAttribute(e,t),r=Math.max(r,i.distanceToSquared(r2));if(t)for(let n=0,a=t.length;n<a;n++){let a=t[n],s=this.morphTargetsRelative;for(let t=0,n=a.count;t<n;t++)r2.fromBufferAttribute(a,t),s&&(r0.fromBufferAttribute(e,t),r2.add(r0)),r=Math.max(r,i.distanceToSquared(r2))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,r=t.normal,n=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new Vector3,o[e]=new Vector3;let l=new Vector3,h=new Vector3,u=new Vector3,c=new Vector2,d=new Vector2,p=new Vector2,f=new Vector3,m=new Vector3,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,r=g.length;t<r;++t){let r=g[t],a=r.start,_=r.count;for(let t=a,r=a+_;t<r;t+=3)!function(e,t,r){l.fromBufferAttribute(i,e),h.fromBufferAttribute(i,t),u.fromBufferAttribute(i,r),c.fromBufferAttribute(n,e),d.fromBufferAttribute(n,t),p.fromBufferAttribute(n,r),h.sub(l),u.sub(l),d.sub(c),p.sub(c);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(h).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(a),m.copy(u).multiplyScalar(d.x).addScaledVector(h,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[r].add(f),o[e].add(m),o[t].add(m),o[r].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let _=new Vector3,y=new Vector3,x=new Vector3,M=new Vector3;function handleVertex(e){x.fromBufferAttribute(r,e),M.copy(x);let t=s[e];_.copy(t),_.sub(x.multiplyScalar(x.dot(t))).normalize(),y.crossVectors(M,t);let i=y.dot(o[e]);a.setXYZW(e,_.x,_.y,_.z,i<0?-1:1)}for(let t=0,i=g.length;t<i;++t){let i=g[t],r=i.start,n=i.count;for(let t=r,i=r+n;t<i;t+=3)handleVertex(e.getX(t+0)),handleVertex(e.getX(t+1)),handleVertex(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new BufferAttribute(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let r=new Vector3,n=new Vector3,a=new Vector3,s=new Vector3,o=new Vector3,l=new Vector3,h=new Vector3,u=new Vector3;if(e)for(let c=0,d=e.count;c<d;c+=3){let d=e.getX(c+0),p=e.getX(c+1),f=e.getX(c+2);r.fromBufferAttribute(t,d),n.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),h.subVectors(a,n),u.subVectors(r,n),h.cross(u),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(h),o.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),n.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),h.subVectors(a,n),u.subVectors(r,n),h.cross(u),i.setXYZ(e+0,h.x,h.y,h.z),i.setXYZ(e+1,h.x,h.y,h.z),i.setXYZ(e+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)r2.fromBufferAttribute(e,t),r2.normalize(),e.setXYZ(t,r2.x,r2.y,r2.z)}toNonIndexed(){function convertBufferAttribute(e,t){let i=e.array,r=e.itemSize,n=e.normalized,a=new i.constructor(t.length*r),s=0,o=0;for(let n=0,l=t.length;n<l;n++){s=e.isInterleavedBufferAttribute?t[n]*e.data.stride+e.offset:t[n]*r;for(let e=0;e<r;e++)a[o++]=i[s++]}return new BufferAttribute(a,r,n)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new BufferGeometry,t=this.index.array,i=this.attributes;for(let r in i){let n=i[r],a=convertBufferAttribute(n,t);e.setAttribute(r,a)}let r=this.morphAttributes;for(let i in r){let n=[],a=r[i];for(let e=0,i=a.length;e<i;e++){let i=a[e],r=convertBufferAttribute(i,t);n.push(r)}e.morphAttributes[i]=n}e.morphTargetsRelative=this.morphTargetsRelative;let n=this.groups;for(let t=0,i=n.length;t<i;t++){let i=n[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
5if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let r=i[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},n=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,r=i.length;t<r;t++){let r=i[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,n=!0)}n&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let r=e.attributes;for(let e in r){let i=r[e];this.setAttribute(e,i.clone(t))}let n=e.morphAttributes;for(let e in n){let i=[],r=n[e];for(let e=0,n=r.length;e<n;e++)i.push(r[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rJ++}),this.uuid=generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}};let r4=new Matrix4,r5=new Ray,r6=new Sphere,r8=new Vector3,r9=new Vector3,r7=new Vector3,ne=new Vector3,nt=new Vector3,ni=new Vector3,nr=new Vector2,nn=new Vector2,na=new Vector2,ns=new Vector3,no=new Vector3,nl=new Vector3,nh=new Vector3,nu=new Vector3;let Mesh=class Mesh extends Object3D{copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let e=t[i[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,i=e.length;t<i;t++){let i=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,n=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let s=this.morphTargetInfluences;if(n&&s){ni.set(0,0,0);for(let i=0,r=n.length;i<r;i++){let r=s[i],o=n[i];0!==r&&(nt.fromBufferAttribute(o,e),a?ni.addScaledVector(nt,r):ni.addScaledVector(nt.sub(t),r))}t.add(ni)}return t}raycast(e,t){let i=this.geometry,r=this.material,n=this.matrixWorld;if(void 0!==r){if(null===i.boundingSphere&&i.computeBoundingSphere(),r6.copy(i.boundingSphere),r6.applyMatrix4(n),r5.copy(e.ray).recast(e.near),!1===r6.containsPoint(r5.origin)&&(null===r5.intersectSphere(r6,r8)||r5.origin.distanceToSquared(r8)>(e.far-e.near)**2)||(r4.copy(n).invert(),r5.copy(e.ray).applyMatrix4(r4),null!==i.boundingBox&&!1===r5.intersectsBox(i.boundingBox)))return;this._computeIntersections(e,t,r5)}}_computeIntersections(e,t,i){let r;let n=this.geometry,a=this.material,s=n.index,o=n.attributes.position,l=n.attributes.uv,h=n.attributes.uv1,u=n.attributes.normal,c=n.groups,d=n.drawRange;if(null!==s){if(Array.isArray(a))for(let n=0,o=c.length;n<o;n++){let o=c[n],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let n=f;n<m;n+=3){let a=s.getX(n),c=s.getX(n+1),d=s.getX(n+2);(r=checkGeometryIntersection(this,p,e,i,l,h,u,a,c,d))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let n=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let c=n;c<o;c+=3){let n=s.getX(c),o=s.getX(c+1),d=s.getX(c+2);(r=checkGeometryIntersection(this,a,e,i,l,h,u,n,o,d))&&(r.faceIndex=Math.floor(c/3),t.pu
5sh(r))}}}else if(void 0!==o){if(Array.isArray(a))for(let n=0,s=c.length;n<s;n++){let s=c[n],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let n=f;n<m;n+=3){let a=n,o=n+1,c=n+2;(r=checkGeometryIntersection(this,p,e,i,l,h,u,a,o,c))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let n=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=n;o<s;o+=3){let n=o,s=o+1,c=o+2;(r=checkGeometryIntersection(this,a,e,i,l,h,u,n,s,c))&&(r.faceIndex=Math.floor(o/3),t.push(r))}}}}constructor(e=new BufferGeometry,t=new MeshBasicMaterial){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}};function checkGeometryIntersection(e,t,i,r,n,a,s,o,l,h){e.getVertexPosition(o,r9),e.getVertexPosition(l,r7),e.getVertexPosition(h,ne);let u=function(e,t,i,r,n,a,s,o){if(null===(t.side===M?r.intersectTriangle(s,a,n,!0,o):r.intersectTriangle(n,a,s,t.side===x,o)))return null;nu.copy(o),nu.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(nu);return l<i.near||l>i.far?null:{distance:l,point:nu.clone(),object:e}}(e,t,i,r,r9,r7,ne,nh);if(u){n&&(nr.fromBufferAttribute(n,o),nn.fromBufferAttribute(n,l),na.fromBufferAttribute(n,h),u.uv=Triangle.getInterpolation(nh,r9,r7,ne,nr,nn,na,new Vector2)),a&&(nr.fromBufferAttribute(a,o),nn.fromBufferAttribute(a,l),na.fromBufferAttribute(a,h),u.uv1=Triangle.getInterpolation(nh,r9,r7,ne,nr,nn,na,new Vector2)),s&&(ns.fromBufferAttribute(s,o),no.fromBufferAttribute(s,l),nl.fromBufferAttribute(s,h),u.normal=Triangle.getInterpolation(nh,r9,r7,ne,ns,no,nl,new Vector3),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let e={a:o,b:l,c:h,normal:new Vector3,materialIndex:0};Triangle.getNormal(r9,r7,ne,e.normal),u.face=e}return u}let BoxGeometry=class BoxGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new BoxGeometry(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}constructor(e=1,t=1,i=1,r=1,n=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a};let s=this;r=Math.floor(r),n=Math.floor(n),a=Math.floor(a);let o=[],l=[],h=[],u=[],c=0,d=0;function buildPlane(e,t,i,r,n,a,p,f,m,g,_){let y=a/m,x=p/g,M=a/2,S=p/2,b=f/2,T=m+1,A=g+1,E=0,w=0,C=new Vector3;for(let a=0;a<A;a++){let s=a*x-S;for(let o=0;o<T;o++){let c=o*y-M;C[e]=c*r,C[t]=s*n,C[i]=b,l.push(C.x,C.y,C.z),C[e]=0,C[t]=0,C[i]=f>0?1:-1,h.push(C.x,C.y,C.z),u.push(o/m),u.push(1-a/g),E+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let i=c+t+T*e,r=c+t+T*(e+1),n=c+(t+1)+T*(e+1),a=c+(t+1)+T*e;o.push(i,r,a),o.push(r,n,a),w+=6}s.addGroup(d,w,_),d+=w,c+=E}buildPlane("z","y","x",-1,-1,i,t,e,a,n,0),buildPlane("z","y","x",1,-1,i,t,-e,a,n,1),buildPlane("x","z","y",1,1,e,i,t,r,a,2),buildPlane("x","z","y",1,-1,e,i,-t,r,a,3),buildPlane("x","y","z",1,-1,e,t,i,r,n,4),buildPlane("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(o),this.setAttribute("position",new Float32BufferAttribute(l,3)),this.setAttribute("normal",new Float32BufferAttribute(h,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2))}};function cloneUniforms(e){let t={};for(let i in e)for(let r in t[i]={},e[i]){let n=e[i][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][r]=null):t[i][r]=n.clone():Array.isArray(n)?t[
5i][r]=n.slice():t[i][r]=n}return t}function mergeUniforms(e){let t={};for(let i=0;i<e.length;i++){let r=cloneUniforms(e[i]);for(let e in r)t[e]=r[e]}return t}function getUnlitUniformColorSpace(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:iW.workingColorSpace}let nc={clone:cloneUniforms,merge:mergeUniforms};let ShaderMaterial=class ShaderMaterial extends Material{copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cloneUniforms(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let r=this.uniforms[i],n=r.value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}};let Camera=class Camera extends Object3D{copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4,this.coordinateSystem=iL}};let nd=new Vector3,np=new Vector2,nf=new Vector2;let PerspectiveCamera=class PerspectiveCamera extends Camera{copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*iN*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*iD*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*iN*Math.atan(Math.tan(.5*iD*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){nd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(nd.x,nd.y).multiplyScalar(-e/nd.z),nd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(nd.x,nd.y).multiplyScalar(-e/nd.z)}getViewSize(e,t){return this.getViewBounds(e,np,nf),t.subVectors(nf,np)}setViewOffset(e,t,i,r,n,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*iD*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;n+=a.offsetX*r/e,t-=a.offsetY*i/s,r*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(n+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}};let CubeCamera=class CubeCamera extends Object3D{updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,r,n,a,s,o]=t;
5for(let e of t)this.remove(e);if(e===iL)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),n.up.set(0,0,-1),n.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(e===iP)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),n.up.set(0,0,1),n.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[n,a,s,o,l,h]=this.children,u=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,n),e.setRenderTarget(i,1,r),e.render(t,a),e.setRenderTarget(i,2,r),e.render(t,s),e.setRenderTarget(i,3,r),e.render(t,o),e.setRenderTarget(i,4,r),e.render(t,l),i.texture.generateMipmaps=f,e.setRenderTarget(i,5,r),e.render(t,h),e.setRenderTarget(u,c,d),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new PerspectiveCamera(-90,1,e,t);r.layers=this.layers,this.add(r);let n=new PerspectiveCamera(-90,1,e,t);n.layers=this.layers,this.add(n);let a=new PerspectiveCamera(-90,1,e,t);a.layers=this.layers,this.add(a);let s=new PerspectiveCamera(-90,1,e,t);s.layers=this.layers,this.add(s);let o=new PerspectiveCamera(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new PerspectiveCamera(-90,1,e,t);l.layers=this.layers,this.add(l)}};let CubeTexture=class CubeTexture extends Texture{get images(){return this.image}set images(e){this.image=e}constructor(e,t,i,r,n,a,s,o,l,h){super(e=void 0!==e?e:[],t=void 0!==t?t:ev,i,r,n,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}};let WebGLCubeRenderTarget=class WebGLCubeRenderTarget extends WebGLRenderTarget{fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n "},r=new BoxGeometry(5,5,5),n=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:M,blending:b});n.uniforms.tEquirect.value=t;let a=new Mesh(r,n),s=t.minFilter;t.minFilter===eU&&(t.minFilter=eL);let o=new CubeCamera(1,10,this);return o.update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){let n=e.getRenderTarget();for(let n=0;n<6;n++)e.setRenderTarget(this,n),e.clear(t,i,r);e.setRenderTarget(n)}constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new CubeTexture(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:eL}};
5let nm=new Vector3,ng=new Vector3,nv=new Matrix3;let Plane=class Plane{set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=nm.subVectors(i,t).cross(ng.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(nm),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let n=-(e.start.dot(this.normal)+this.constant)/r;return n<0||n>1?null:t.copy(e.start).addScaledVector(i,n)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||nv.getNormalMatrix(e),r=this.coplanarPoint(nm).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}};let n_=new Sphere,ny=new Vector3;let Frustum=class Frustum{set(e,t,i,r,n,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(r),s[4].copy(n),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iL,i=this.planes,r=e.elements,n=r[0],a=r[1],s=r[2],o=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],p=r[9],f=r[10],m=r[11],g=r[12],_=r[13],y=r[14],x=r[15];if(i[0].setComponents(o-n,c-l,m-d,x-g).normalize(),i[1].setComponents(o+n,c+l,m+d,x+g).normalize(),i[2].setComponents(o+a,c+h,m+p,x+_).normalize(),i[3].setComponents(o-a,c-h,m-p,x-_).normalize(),i[4].setComponents(o-s,c-u,m-f,x-y).normalize(),t===iL)i[5].setComponents(o+s,c+u,m+f,x+y).normalize();else if(t===iP)i[5].setComponents(s,u,f,y).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),n_.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),n_.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(n_)}intersectsSprite(e){return n_.center.set(0,0,0),n_.radius=.7071067811865476,n_.applyM
5atrix4(e.matrixWorld),this.intersectsSphere(n_)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let e=0;e<6;e++){let n=t[e].distanceToPoint(i);if(n<r)return!1}return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(ny.x=r.normal.x>0?e.max.x:e.min.x,ny.y=r.normal.y>0?e.max.y:e.min.y,ny.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(ny))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}constructor(e=new Plane,t=new Plane,i=new Plane,r=new Plane,n=new Plane,a=new Plane){this.planes=[e,t,i,r,n,a]}};function WebGLAnimation(){let e=null,t=!1,i=null,r=null;function onAnimationFrame(t,n){i(t,n),r=e.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==t&&null!==i&&(r=e.requestAnimationFrame(onAnimationFrame),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function WebGLAttributes(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let r=t.get(i);r&&(e.deleteBuffer(r.buffer),t.delete(i))},update:function(i,r){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){let e=t.get(i);(!e||e.version<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}let n=t.get(i);if(void 0===n)t.set(i,function(t,i){let r;let n=t.array,a=t.usage,s=n.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,n,a),t.onUploadCallback(),n instanceof Float32Array)r=e.FLOAT;else if(n instanceof Uint16Array)r=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(n instanceof Int16Array)r=e.SHORT;else if(n instanceof Uint32Array)r=e.UNSIGNED_INT;else if(n instanceof Int32Array)r=e.INT;else if(n instanceof Int8Array)r=e.BYTE;else if(n instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(n instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);return{buffer:o,type:r,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,r));else if(n.version<i.version){if(n.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,r){let n=i.array,a=i._updateRange,s=i.updateRanges;if(e.bindBuffer(r,t),-1===a.count&&0===s.length&&e.bufferSubData(r,0,n),0!==s.length){for(let t=0,i=s.length;t<i;t++){let i=s[t];e.bufferSubData(r,i.start*n.BYTES_PER_ELEMENT,n,i.start,i.count)}i.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(r,a.offset*n.BYTES_PER_ELEMENT,n,a.offset,a.count),a.count=-1),i.onUploadCallback()}(n.buffer,i,r),n.version=i.version}}}}let PlaneGeometry=class PlaneGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PlaneGeometry(e.width,e.height,e.widthSegments,e.heightSegments)}constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};let n=e/2,a=t/2,s=Math.floor(i),o=Math.floor(r),l=s+1,h=o+1,u=e/s,c=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<h;e++){let t=e*c-a;for(let i=0;i<l;i++){let r=i*u-n;p.push(r,-t,0),f.push(0,0,1),m.push(i/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){let i=t+l*e,r=t+l*(e+1),n=t+1+l*(e+1),a=t+1+l*e;d.push(i,r,a),d.push(r,n,a)}this.setIndex(d),this.setAttribute("position",new Float32BufferAttribute(p,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2))}};let nx={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot
5( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
5\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );
5\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n }
5 else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }
5\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;
5\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alph
5aB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x >
5 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );
5\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
5\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_L
5IGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );
5\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 25
55.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;
5\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }
5\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
5\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );
5\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n \n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n \n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n \n #else\n \n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n \n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;
5\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
5\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include
5<project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;
5\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
5\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},nM={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Matrix3},normalScale:{value:new Vector2(1,1)}}
vendor: 4,152 bytes, line 5
5,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}}},nS={basic:{uniforms:mergeUniforms([nM.common,nM.specularmap,nM.envmap,nM.aomap,nM.lightmap,nM.fog]),vertexShader:nx.meshbasic_vert,fragmentShader:nx.meshbasic_frag},lambert:{uniforms:mergeUniforms([nM.common,nM.specularmap,nM.envmap,nM.aomap,nM.lightmap,nM.emissivemap,nM.bumpmap,nM.normalmap,nM.displacementmap,nM.fog,nM.lights,{emissive:{value:new Color(0)}}]),vertexShader:nx.meshlambert_vert,fragmentShader:nx.meshlambert_frag},phong:{uniforms:mergeUniforms([nM.common,nM.specularmap,nM.envmap,nM.aomap,nM.lightmap,nM.emissivemap,nM.bumpmap,nM.normalmap,nM.displacementmap,nM.fog,nM.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:nx.meshphong_vert,fragmentShader:nx.meshphong_frag},standard:{uniforms:mergeUniforms([nM.common,nM.envmap,nM.aomap,nM.lightmap,nM.emissivemap,nM.bumpmap,nM.normalmap,nM.displacementmap,nM.roughnessmap,nM.metalnessmap,nM.fog,nM.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nx.meshphysical_vert,fragmentShader:nx.meshphysical_frag},toon:{uniforms:mergeUniforms([nM.common,nM.aomap,nM.lightmap,nM.emissivemap,nM.bumpmap,nM.normalmap,nM.displacementmap,nM.gradientmap,nM.fog,nM.lights,{emissive:{value:new Color(0)}}]),vertexShader:nx.meshtoon_vert,fragmentShader:nx.meshtoon_frag},matcap:{uniforms:mergeUniforms([nM.common,nM.bumpmap,nM.normalmap,nM.displacementmap,nM.fog,{matcap:{value:null}}]),vertexShader:nx.meshmatcap_vert,fragmentShader:nx.meshmatcap_frag},points:{uniforms:mergeUniforms([nM.points,nM.fog]),vertexShader:nx.points_vert,fragmentShader:nx.points_frag},dashed:{uniforms:mergeUniforms([nM.common,nM.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nx.linedashed_vert,fragmentShader:nx.linedashed_frag},depth:{uniforms:mergeUniforms([nM.common,nM.displacementmap]),vertexShader:nx.depth_vert,fragmentShader:nx.depth_frag},normal:{uniforms:mergeUniforms([nM.common,nM.bumpmap,nM.normalmap,n
5M.displacementmap,{opacity:{value:1}}]),vertexShader:nx.meshnormal_vert,fragmentShader:nx.meshnormal_frag},sprite:{uniforms:mergeUniforms([nM.sprite,nM.fog]),vertexShader:nx.sprite_vert,fragmentShader:nx.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nx.background_vert,fragmentShader:nx.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Matrix3}},vertexShader:nx.backgroundCube_vert,fragmentShader:nx.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nx.cube_vert,fragmentShader:nx.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nx.equirect_vert,fragmentShader:nx.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([nM.common,nM.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nx.distanceRGBA_vert,fragmentShader:nx.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([nM.lights,nM.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:nx.shadow_vert,fragmentShader:nx.shadow_frag}};nS.physical={uniforms:mergeUniforms([nS.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Matrix3},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Matrix3},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix3},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Matrix3},anisotropyVector:{value:new Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Matrix3}}]),vertexShader:nx.meshphysical_vert,fragmentShader:nx.meshphysical_frag};let nb={r:0,b:0,g:0},nT=new Euler,nA=new Matrix4;function WebGLBackground(e,t,i,r,n,a,s){let o,l;let h=new Color(0),u=!0===a?0:1,c=null,d=0,p=null;function getBackground(e){let r=!0===e.isScene?e.background:null;if(r&&r.isTexture){let n=e.backgroundBlurriness>0;r=(n?i:t).get(r)}return r}function setClear(t,i){t.getRGB(nb,getUnlitUniformColorSpace(e)),r.buffers.color.setClear(nb.r,nb.g,nb.b,i,s)}return{getClearColor:function(){return h},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;h.set(e),setClear(h,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){setClear(h,u=e)},render:function(t){let i=!1,n=getBackground(t);null===n?setClear(h,u):n&&n.isColor&&(setClear(n,1),i=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,s),(e.autoClear||i)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,i){let r=getBackground(i);r&&(r.isCubeTexture||r.mapping===eM)?(void 0===l&&((l=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"Backgroun
5dCubeMaterial",uniforms:cloneUniforms(nS.backgroundCube.uniforms),vertexShader:nS.backgroundCube.vertexShader,fragmentShader:nS.backgroundCube.fragmentShader,side:M,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),nT.copy(i.backgroundRotation),nT.x*=-1,nT.y*=-1,nT.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(nT.y*=-1,nT.z*=-1),l.material.uniforms.envMap.value=r,l.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(nA.makeRotationFromEuler(nT)),l.material.toneMapped=iW.getTransfer(r.colorSpace)!==t0,(c!==r||d!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,c=r,d=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&((o=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(nS.background.uniforms),vertexShader:nS.background.vertexShader,fragmentShader:nS.background.fragmentShader,side:x,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,o.material.toneMapped=iW.getTransfer(r.colorSpace)!==t0,!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),(c!==r||d!==r.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,c=r,d=r.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))}}}function WebGLBindingStates(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},n=createBindingState(null),a=n,s=!1;function bindVertexArrayObject(t){return e.bindVertexArray(t)}function deleteVertexArrayObject(t){return e.deleteVertexArray(t)}function createBindingState(e){let t=[],r=[],n=[];for(let e=0;e<i;e++)t[e]=0,r[e]=0,n[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:n,object:e,attributes:{},index:null}}function initAttributes(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function enableAttribute(e){enableAttributeAndDivisor(e,0)}function enableAttributeAndDivisor(t,i){let r=a.newAttributes,n=a.enabledAttributes,s=a.attributeDivisors;r[t]=1,0===n[t]&&(e.enableVertexAttribArray(t),n[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function disableUnusedAttributes(){let t=a.newAttributes,i=a.enabledAttributes;for(let r=0,n=i.length;r<n;r++)i[r]!==t[r]&&(e.disableVertexAttribArray(r),i[r]=0)}function vertexAttribPointer(t,i,r,n,a,s,o){!0===o?e.vertexAttribIPointer(t,i,r,a,s):e.vertexAttribPointer(t,i,r,n,a,s)}function reset(){resetDefaultState(),s=!0,a!==n&&bindVertexArrayObject((a=n).object)}function resetDefaultState(){n.geometry=null,n.program=null,n.wireframe=!1}return{setup:function(i,n,o,l,h){let u=!1,c=function(t,i,n){let a=!0===n.wireframe,s=r[t.id];void 0===s&&(s={},r[t.id]=s);let o=s[i.id];void 0===o&&(o={},s[i.id]=o);let l=o[a];return void 0===l&&(l=createBindingState(e.createVertexArray()),o[a]=l),l}(l,o,n);a!==c&&bindVertexArrayObject((a=c).object),(u=function(e,t,i,r){let n=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l){let i=l[t];if(i.location>=0){let i=n[t],r=s[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===i||i.attribute!==r||r&&i.data!==r.data)return!0;o++}}return a.attributesNum!==o||a.index!==r}(i,l,o,h))&&function(e,t,i,r){let n={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l){let i=l[t];if(i.location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let r={};r.attribute=i,i&&i.data&&(r.data=i.data),n[t]=r,o++}}a.attributes=n,a.attributesNum=o,a.index=r}(i,l,o,h),null!==h&&t.update(h,e.ELEMENT_ARRAY_BUFFER),(u||s)&&(s=!1,function(i,r,n,a){initAttributes();let s=a.attributes,o=n.getAttributes(),l=r.defaultAttributeValues;for(let r in o){let n=o[r];if(n.location>=0){let o=s[r];if(void 0===o&&("instanceMatrix"===r&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===r&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let r=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let h=l.buffer,u=l.type,c=l.bytesPerElement,d=u===e.INT||u===e.UNSIGNED_INT||o.gpuType===eV;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,p=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<n.locationSize;e++)enableAttributeAndDivisor(n.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<n.locationSize;e++)enableAttribute(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<n.locationSize;e++)vertexAttribPointer(n.location+e,s/n.locationSize,u,r,l*c,(p+s/n.locationSize*e)*c,d)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<n.locationSize;e++)enableAttributeAndDivisor(n.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}
5else for(let e=0;e<n.locationSize;e++)enableAttribute(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<n.locationSize;e++)vertexAttribPointer(n.location+e,s/n.locationSize,u,r,s*c,s/n.locationSize*e*c,d)}}else if(void 0!==l){let t=l[r];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(n.location,t);break;case 3:e.vertexAttrib3fv(n.location,t);break;case 4:e.vertexAttrib4fv(n.location,t);break;default:e.vertexAttrib1fv(n.location,t)}}}}disableUnusedAttributes()}(i,n,o,l),null!==h&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(h).buffer))},reset:reset,resetDefaultState:resetDefaultState,dispose:function(){for(let e in reset(),r){let t=r[e];for(let e in t){let i=t[e];for(let e in i)deleteVertexArrayObject(i[e].object),delete i[e];delete t[e]}delete r[e]}},releaseStatesOfGeometry:function(e){if(void 0===r[e.id])return;let t=r[e.id];for(let e in t){let i=t[e];for(let e in i)deleteVertexArrayObject(i[e].object),delete i[e];delete t[e]}delete r[e.id]},releaseStatesOfProgram:function(e){for(let t in r){let i=r[t];if(void 0===i[e.id])continue;let n=i[e.id];for(let e in n)deleteVertexArrayObject(n[e].object),delete n[e];delete i[e.id]}},initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes}}function WebGLBufferRenderer(e,t,i){let r;function renderInstances(t,n,a){0!==a&&(e.drawArraysInstanced(r,t,n,a),i.update(n,r,a))}this.setMode=function(e){r=e},this.render=function(t,n){e.drawArrays(r,t,n),i.update(n,r,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function(e,n,a){if(0===a)return;let s=t.get("WEBGL_multi_draw");s.multiDrawArraysWEBGL(r,e,0,n,0,a);let o=0;for(let e=0;e<a;e++)o+=n[e];i.update(o,r,1)},this.renderMultiDrawInstances=function(e,n,a,s){if(0===a)return;let o=t.get("WEBGL_multi_draw");if(null===o)for(let t=0;t<e.length;t++)renderInstances(e[t],n[t],s[t]);
5else{o.multiDrawArraysInstancedWEBGL(r,e,0,n,0,s,0,a);let t=0;for(let e=0;e<a;e++)t+=n[e];for(let e=0;e<s.length;e++)i.update(t,r,s[e])}}}function WebGLCapabilities(e,t,i,r){let n;function getMaxPrecision(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==i.precision?i.precision:"highp",s=getMaxPrecision(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);let o=!0===i.logarithmicDepthBuffer,l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_TEXTURE_SIZE),c=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),g=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:getMaxPrecision,textureFormatReadable:function(t){return t===eK||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){let n=i===ek&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return i===eN||r.convert(i)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||i===eG||!!n},precision:a,logarithmicDepthBuffer:o,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:c,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:h>0,maxSamples:g}}function WebGLClipping(e){let t=this,i=null,r=0,n=!1,a=!1,s=new Plane,o=new Matrix3,l={value:null,needsUpdate:!1};function projectPlanes(e,i,r,n){let a=null!==e?e.length:0,h=null;if(0!==a){if(h=l.value,!0!==n||null===h){let t=r+4*a,n=i.matrixWorldInverse;o.getNormalMatrix(n),(null===h||h.length<t)&&(h=new Float32Array(t));for(let t=0,i=r;t!==a;++t,i+=4)s.copy(e[t]).applyMatrix4(n,o),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==r||n;return n=t,r=e.length,i},this.beginShadows=function(){a=!0,projectPlanes(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=projectPlanes(e,t,0)},this.setState=function(s,o,h){let u=s.clippingPlanes,c=s.clipIntersection,d=s.clipShadows,p=e.get(s);if(n&&null!==u&&0!==u.length&&(!a||d)){let e=a?0:r,t=4*e,n=p.clippingState||null;l.value=n,n=projectPlanes(u,o,t,h);for(let e=0;e!==t;++e)n[e]=i[e];p.clippingState=n,this.numIntersection=c?this.numPlanes:0,this.numPlanes+=e}else a?projectPlanes(null):(l.value!==i&&(l.value=i,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}function WebGLCubeMaps(e){let t=new WeakMap;function mapTextureMapping(e,t){return t===ey?e.mapping=ev:t===ex&&(e.mapping=e_),e}function onTextureDispose(e){let i=e.target;i.removeEventListener("dispose",onTextureDispose);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(i){if(i&&i.isTexture){let r=i.mapping;if(r===ey||r===ex){if(t.has(i)){let e=t.get(i).texture;return mapTextureMapping(e,i.mapping)}{let r=i.image;if(!r||!(r.height>0))return null;{let n=new WebGLCubeRenderTarget(r.height);return n.fromEquirectangularTexture(e,i),t.set(i,n),i.addEventListener("dispose",onTextureDispose),mapTextureMapping(n.texture,i.mapping)}}}}return i},dispose:function(){t=new WeakMap}}}let OrthographicCamera=class OrthographicCamera extends Camera{copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,n,a){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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,n=i-e,a=i+e,s=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}
5this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}constructor(e=-1,t=1,i=1,r=-1,n=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=n,this.far=a,this.updateProjectionMatrix()}};let nE=[.125,.215,.35,.446,.526,.582],nw=new OrthographicCamera,nC=new Color,nR=null,nL=0,nP=0,nI=!1,nU=(1+Math.sqrt(5))/2,nD=1/nU,nN=[new Vector3(-nU,nD,0),new Vector3(nU,nD,0),new Vector3(-nD,0,nU),new Vector3(nD,0,nU),new Vector3(0,nU,-nD),new Vector3(0,nU,nD),new Vector3(-1,1,-1),new Vector3(1,1,-1),new Vector3(-1,1,1),new Vector3(1,1,1)];let PMREMGenerator=class PMREMGenerator{fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;nR=this._renderer.getRenderTarget(),nL=this._renderer.getActiveCubeFace(),nP=this._renderer.getActiveMipmapLevel(),nI=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let n=this._allocateTargets();return n.depthBuffer=!0,this._sceneToCubeUV(e,i,r,n),t>0&&this._blur(n,0,0,t),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(nR,nL,nP),this._renderer.xr.enabled=nI,e.scissorTest=!1,_setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ev||e.mapping===e_?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),nR=this._renderer.getRenderTarget(),nL=this._renderer.getActiveCubeFace(),nP=this._renderer.getActiveMipmapLevel(),nI=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:eL,minFilter:eL,generateMipmaps:!1,type:ek,format:eK,colorSpace:tZ,depthBuffer:!1},r=_createRenderTarget(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(e,t,i);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){let t=[],i=[],r=[],n=e,a=e-4+1+nE.length;for(let s=0;s<a;s++){let a=Math.pow(2,n);i.push(a);let o=1/a;s>e-4?o=nE[s-e+4-1]:0===s&&(o=0),r.push(o);let l=1/(a-2),h=-l,u=1+l,c=[h,h,u,h,u,u,h,h,u,u,h,u],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,r=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(r,18*e),p.set(c,12*e);let n=[e,e,e,e,e,e];f.set(n,6*e)}let m=new BufferGeometry;m.setAttribute("position",new BufferAttribute(d,3)),m.setAttribute("uv",new BufferAttribute(p,2)),m.setAttribute("faceIndex",new BufferAttribute(f,1)
5),t.push(m),n>4&&n--}return{lodPlanes:t,sizeLods:i,sigmas:r}}(r)),this._blurMaterial=function(e,t,i){let r=new Float32Array(20),n=new Vector3(0,1,0),a=new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:b,depthTest:!1,depthWrite:!1});return a}(r,e,t)}return r}_compileMaterial(e){let t=new Mesh(this._lodPlanes[0],e);this._renderer.compile(t,nw)}_sceneToCubeUV(e,t,i,r){let n=new PerspectiveCamera(90,1,t,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.toneMapping;o.getClearColor(nC),o.toneMapping=es,o.autoClear=!1;
5let u=new MeshBasicMaterial({name:"PMREM.Background",side:M,depthWrite:!1,depthTest:!1}),c=new Mesh(new BoxGeometry,u),d=!1,p=e.background;p?p.isColor&&(u.color.copy(p),e.background=null,d=!0):(u.color.copy(nC),d=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(n.up.set(0,a[t],0),n.lookAt(s[t],0,0)):1===i?(n.up.set(0,0,a[t]),n.lookAt(0,s[t],0)):(n.up.set(0,a[t],0),n.lookAt(0,0,s[t]));let l=this._cubeSize;_setViewport(r,i*l,t>2?l:0,l,l),o.setRenderTarget(r),d&&o.render(c,n),o.render(e,n)}c.geometry.dispose(),c.material.dispose(),o.toneMapping=h,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let i=this._renderer,r=e.mapping===ev||e.mapping===e_;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());let n=r?this._cubemapMaterial:this._equirectMaterial,a=new Mesh(this._lodPlanes[0],n),s=n.uniforms;s.envMap.value=e;let o=this._cubeSize;_setViewport(t,0,0,3*o,2*o),i.setRenderTarget(t),i.render(a,nw)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;t<r;t++){let i=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),n=nN[(r-t-1)%nN.length];this._blur(e,t-1,t,i,n)}t.autoClear=i}_blur(e,t,i,r,n){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",n),this._halfBlur(a,e,i,i,r,"longitudinal",n)}_halfBlur(e,t,i,r,n,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let h=new Mesh(this._lodPlanes[r],l),u=l.uniforms,c=this._sizeLods[i]-1,d=isFinite(n)?Math.PI/(2*c):2*Math.PI/39,p=n/d,f=isFinite(n)?1+Math.floor(3*p):20;f>20&&console.warn("sigmaRadians, ".concat(n,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(20));let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,i=Math.exp(-t*t/2);m.push(i),0===e?g+=i:e<f&&(g+=2*i)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,s&&(u.poleAxis.value=s);let{_lodMax:_}=this;u.dTheta.value=d,u.mipInt.value=_-i;let y=this._sizeLods[r],x=3*y*(r>_-4?r-_+4:0),M=4*(this._cubeSize-y);_setViewport(t,x,M,3*y,2*y),o.setRenderTarget(t),o.render(h,nw)}constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}};function _createRenderTarget(e,t,i){let r=new WebGLRenderTarget(e,t,i);return r.texture.mapping=eM,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function _setViewport(e,t,i,r,n){e.viewport.set(t,i,r,n),e.scissor.set(t,i,r,n)}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:b,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:b,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function WebGLCubeUVMaps(e){let t=new WeakMap,i=null;function onTextureDispose(e){let i=e.target;i.removeEventListener("dispose",onTextureDispose);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let n=r.mapping,a=n===ey||n===ex,s=n===ev||n===e_;if(a||s){let n=t.get(r),o=void 0!==n?n.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==o)return null===i&&(i=new PMREMGenerator(e)),(n=a?i.fromEquirectangular(r,n):i.fromCubemap(r,n)).texture.pmremVersion=r.pmremVersion,t.set(r,n),n.texture;if(void 0!==n)return n.texture;{let o=r.image;return a&&o&&o.height>0||s&&o&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(o)?(null===i&&(i=new PMREMGenerator(e)),(n=a?i.fromEquirectangular(r):i.fromCubemap(r)).texture.pmremVersion=r.pmremVersion,t.set(r,n),r.addEventListener("dispose",onTextureDispose),n.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function WebGLExtensions(e){let t={};function getExtension(i){let r;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(i)}return t[i]=r,r}return{has:function(e){return null!==getExtension(e)},init:function(){getExtension("EXT_color_buffer_float"),getExtension("WEBGL_clip_cull_distance"),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture"),getExtension("WEBGL_render_shared_exponent")},get:function(e){let t=getExtension(e);return null===t&&warnOnce("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function WebGLGeometries(e,t,i,r){let n={},a=new WeakMap;function onGeometryDispose(e){let s=e.target;for(let e in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[e]);for(let e in s.morphAttributes){let i=s.morphAttributes[e];for(let e=0,r=i.length;e<r;e++)t.remove(i[e])}s.removeEventListener("dispose",onGeometryDispose),delete n[s.id];let o=a.get(s);o&&(t.remove(o),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,i.memory.geometries--}function updateWireframeAttribute(e){let i=[],r=e.index,n=e.attributes.position,s=0;if(null!==r){let e=r.array;s=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],n=e[t+1],a=e[t+2];i.push(r,n,n,a,a,r)}}else{if(void 0===n)return;let e=n.array;s=n.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,n=t+2;i.push(e,r,r,n,n,e)}}let o=new(arrayNeedsUint32(i)?Uint32BufferAttribute:Uint16BufferAttribute)(i,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===n[t.id]||(t.addEventListener("dispose",onGeometryDispose),n[t.id]=!0,i.memory.geometries++),t},update:function(i){let r=i.attributes;for(let i in r)t.update(r[i],e.ARRAY_BUFFER);let n=i.morphAttributes;for(let i in n){let r=n[i];for(let i=0,n=r.length;i<n;i++)t.update(r[i],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&updateWireframeAttribute(e)}else updateWireframeAttribute(e);return a.get(e)}}}function WebGLIndexedBufferRenderer(e,t,i){let r,n,a;function renderInstances(t,s,o){0!==o&&(e.drawElementsInstanced(r,s,n,t*a,o),i.update(s,r,o))}this.setMode=function(e){r=e},this.setIndex=function(e){n=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(r,s,n,t*a),i.update(s,r,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function(e,a,s){if(0===s)return;let o=t.get("WEBGL_multi_draw");o.multiDrawElementsWEBGL(r,a,0,n,e,0,s);let l=0;for(let e=0;e<s;e++)l+=a[e];i.update(l,r,1)},this.renderMultiDrawInstances=function(e,s,o,l){if(0===o)return;let h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)renderInstances(e[t]/a,s[t],l[t]);
5else{h.multiDrawElementsInstancedWEBGL(r,s,0,n,e,0,l,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e];for(let e=0;e<l.length;e++)i.update(t,r,l[e])}}}function WebGLInfo(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,r,n){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=n*(i/3);break;case e.LINES:t.lines+=n*(i/2);break;case e.LINE_STRIP:t.lines+=n*(i-1);break;case e.LINE_LOOP:t.lines+=n*i;break;case e.POINTS:t.points+=n*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function WebGLMorphtargets(e,t,i){let r=new WeakMap,n=new Vector4;return{update:function(a,s,o){let l=a.morphTargetInfluences,h=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,u=void 0!==h?h.length:0,c=r.get(s);if(void 0===c||c.count!==u){void 0!==c&&c.texture.dispose();let e=void 0!==s.morphAttributes.position,i=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],h=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===i&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*u),g=new DataArrayTexture(m,p,f,u);g.type=eG,g.needsUpdate=!0;let _=4*d;for(let t=0;t<u;t++){let r=o[t],s=l[t],u=h[t],c=p*f*4*t;for(let t=0;t<r.count;t++){let o=t*_;!0===e&&(n.fromBufferAttribute(r,t),m[c+o+0]=n.x,m[c+o+1]=n.y,m[c+o+2]=n.z,m[c+o+3]=0),!0===i&&(n.fromBufferAttribute(s,t),m[c+o+4]=n.x,m[c+o+5]=n.y,m[c+o+6]=n.z,m[c+o+7]=0),!0===a&&(n.fromBufferAttribute(u,t),m[c+o+8]=n.x,m[c+o+9]=n.y,m[c+o+10]=n.z,m[c+o+11]=4===u.itemSize?n.w:1)}}c={count:u,texture:g,size:new Vector2(p,f)},r.set(s,c),s.addEventListener("dispose",function disposeTexture(){g.dispose(),r.delete(s),s.removeEventListener("dispose",disposeTexture)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,i);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let i=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",i),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",c.texture,i),o.getUniforms().setValue(e,"morphTargetsTextureSize",c.size)}}}function WebGLObjects(e,t,i,r){let n=new WeakMap;function onInstancedMeshDispose(e){let t=e.target;t.removeEventListener("dispose",onInstancedMeshDispose),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(a){let s=r.render.frame,o=a.geometry,l=t.get(a,o);if(n.get(l)!==s&&(t.update(l),n.set(l,s)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",onInstancedMeshDispose)&&a.addEventListener("dispose",onInstancedMeshDispose),n.get(a)!==s&&(i.update(a.instanceMatrix,e.ARRAY_BUFFER),null!==a.instanceColor&&i.update(a.instanceColor,e.ARRAY_BUFFER),n.set(a,s))),a.isSkinnedMesh){let e=a.skeleton;n.get(e)!==s&&(e.update(),n.set(e,s))}return l},dispose:function(){n=new WeakMap}}}let DepthTexture=class DepthTexture extends Texture{copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}constructor(e,t,i,r,n,a,s,o,l,h=eQ){if(h!==eQ&&h!==e$)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===eQ&&(i=ez),void 0===i&&h===e$&&(i=eX),super(null,r,n,a,s,o,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:eA,this.minFilter=void 0!==o?o:eA,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}};let nB=new Texture,nO=new DepthTexture(1,1),nF=new DataArrayTexture,nV=new Data3DTexture,nz=new CubeTexture,nG=[],nk=[],nH=new Float32Array(16),nW=new Float32Array(9),nX=new Float32Array(4);function flatten(e,t,i){let r=e[0];if(r<=0||r>0)return e;let n=t*i,a=nG[n];if(void 0===a&&(a=new Float32Array(n),nG[n]=a),0!==t){r.toArray(a,0);for(let r=1,n=0;r!==t;++r)n+=i,e[r].toArray(a,n)}return a}function arraysEqual(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0}function copyArray(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function allocTexUnits(e,t){let i=nk[t];void 0===i&&(i=new Int32Array(t),nk[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function setValueV1f(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function setValueV2f(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(arraysEqual(i,t))return;e.uniform2fv(this.addr,t),copyArray(i,t)}}function setValueV3f(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(arraysEqual(i,t))return;e.uniform3fv(this.addr,t),copyArray(i,t)}}function setValueV4f(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(arraysEqual(i,t))return;e.uniform4fv(this.addr,t),copyArray(i,t)}}function setValueM2(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(arraysEqual(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),copyArray(i,t)}else{if(arraysEqual(i,r))return;nX.set(r),e.uniformMatrix2fv(this.addr,!1,nX),copyArray(i,r)}}function setValueM3(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(arraysEqual(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),copyArray(i,t)}else{if(arraysEqual(i,r))return;nW.set(r),e.uniformMatrix3fv(this.addr,!1,nW),copyArray(i,r)}}function setValueM4(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(arraysEqual(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),copyArray(i,t)}else{if(arraysEqual(i,r))return;nH.set(r),e.uniformMatrix4fv(this.addr,!1,nH),copyArray(i,r)}}function setValueV1i(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function setValueV2i(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(arraysEqual(i,t))return;e.uniform2iv(this.addr,t),copyArray(i,t)}}function setValueV3i(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(arraysEqual(i,t))return;e.uniform3iv(this.addr,t),copyArray(i,t)}}function setValueV4i(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(arraysEqual(i,t))return;e.uniform4iv(this.addr,t),copyArray(i,t)}}function setValueV1ui(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function setValueV2ui(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(arraysEqual(i,t))return;e.uniform2uiv(this.addr,t),copyArray(i,t)}}function setValueV3ui(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(arraysEqual(i,t))return;e.uniform3uiv(this.addr,t),copyArray(i,t)}}function setValueV4ui(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(arraysEqual(i,t))return;e.uniform4uiv(this.addr,t),copyArray(i,t)}}function setValueT1(e,t,i){let r;let n=this.cache,a=i.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),this.type===e.SAMPLER_2D_SHADOW?(nO.compareFunction=ip,r=nO):r=nB,i.setTexture2D(t||r,a)}function setValueT3D1(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture3D(t||nV,n)}function setValueT6(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTextureCube(t||nz,n)}function setValueT2DArray1(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture2DArray(t||nF,n)}function setValueV1fArray(e,t){e.uniform1fv(this.addr,t)}function setValueV2fArray(e,t){let i=flatten(t,this.size,2);e.uniform2fv(this.addr,i)}function setValueV3fArray(e,t){let i=flatten(t,this.size,3);e.uniform3fv(this.addr,i)}function setValueV4fArray(e,t){let i=flatten(t,this.size,4);e.uniform4fv(this.addr,i)}function setValueM2Array(e,t){let i=flatten(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function setValueM3Array(e,t){let i=flatten(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function setValueM4Array(e,t){let i=flatten(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function setValueV1iArray(e,t){e.uniform1iv(this.addr,t)}function setValueV2iArray(e,t){e.uniform2iv(this.addr,t)}function setValueV3iArray(e,t){e.uniform3iv(this.addr,t)}function setValueV4iArray(e,t){e.uniform4iv(this.addr,t)}function setValueV1uiArray(e,t){e.uniform1uiv(this.addr,t)}function setValueV2uiArray(e,t){e.uniform2uiv(this.addr,t)}function setValueV3uiArray(e,t){e.uniform3uiv(this.addr,t)}function setValueV4uiArray(e,t){e.uniform4uiv(this.addr,t)}function setValueT1Array(e,t,i){let r=this.cache,n=t.length,a=allocTexUnits(i,n);arraysEqual(r,a)||(e.uniform1iv(this.addr,a),copyArray(r,a));for(let e=0;e!==n;++e)i.setTexture2D(t[e]||nB,a[e])}function setValueT3DArray(e,t,i){let r=this.cache,n=t.length,a=allocTexUnits(i,n);arraysEqual(r,a)||(e.uniform1iv(this.addr,a),copyArray(r,a));for(let e=0;e!==n;++e)i.setTexture3D(t[e]||nV,a[e])}function setValueT6Array(e,t,i){let r=this.cache,n=t.length,a=allocTexUnits(i,n);arraysEqual(r,a)||(e.uniform1iv(this.addr,a),copyArray(r,a));for(let e=0;e!==n;++e)i.setTextureCube(t[e]||nz,a[e])}function setValueT2DArrayArray(e,t,i){let r=this.cache,n=t.length,a=allocTexUnits(i,n);arraysEqual(r,a)||(e.uniform1iv(this.addr,a),copyArray(r,a));for(let e=0;e!==n;++e)i.setTexture2DArray(t[e]||nF,a[e])}let SingleUniform=class SingleUniform{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(t.type)}};let PureArrayUniform=class PureArrayUniform{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(t.type)}};let StructuredUniform=class StructuredUniform{setValue(e,t,i){let r=this.seq;for(let n=0,a=r.length;n!==a;++n){let a=r[n];a.setValue(e,t[a.id],i)}}constructor(e){this.id=e,this.seq=[],this.map={}}};let nj=/(\w+)(\])?(\[|\.)?/g;function addUniform(e,t){e.seq.push(t),e.map[t.id]=t}let WebGLUniforms=class WebGLUniforms{setValue(e,t,i,r){let n=this.map[t];void 0!==n&&n.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];void 0!==r&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let n=0,a=t.length;n!==a;++n){let a=t[n],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,n=e.length;r!==n;++r){let n=e[r];n.id in t&&i.push(n)}return i}constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){let i=e.getActiveUniform(t,r),n=e.getUniformLocation(t,i.name);!function(e,t,i){let r=e.name,n=r.length;for(nj.lastIndex=0;;){let a=nj.exec(r),s=nj.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===n){addUniform(i,void 0===h?new SingleUniform(o,e,t):new PureArrayUniform(o,e,t));break}{let e=i.map,t=e[o];void 0===t&&addUniform(i,t=new StructuredUniform(o)),i=t}}}(i,n,this)}}};function WebGLShader(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}let nq=0;function getShaderErrors(e,t,i){let r=e.getShaderParameter(t,e.COMPILE_STATUS),n=e.getShaderInfoLog(t).trim();if(r&&""===n)return"";let a=/ERROR: 0:(\d+)/.exec(n);if(!a)return n;{let r=parseInt(a[1]);return i.toUpperCase()+"\n\n"+n+"\n\n"+function(e,t){let i=e.split("\n"),r=[],n=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=n;e<a;e++){let n=e+1;r.push("".concat(n===t?">":" "," ").concat(n,": ").concat(i[e]))}return r.join("\n")}(e.getShaderSource(t),r)}}let nY=new Vector3;function filterEmptyLine(e){return""!==e}function replaceLightNums(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_L
5IGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function replaceClippingPlaneNums(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let nK=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(e){return e.replace(nK,includeReplacer)}let nZ=new Map;function includeReplacer(e,t){let i=nx[t];if(void 0===i){let e=nZ.get(t);if(void 0!==e)i=nx[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return resolveIncludes(i)}let nJ=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function unrollLoops(e){return e.replace(nJ,loopReplacer)}function loopReplacer(e,t,i,r){let n="";for(let e=parseInt(t);e<parseInt(i);e++)n+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return n}function generatePrecision(e){let t="precision ".concat(e.precision," float;\n precision ").concat(e.precision," int;\n precision ").concat(e.precision," sampler2D;\n precision ").concat(e.precision," samplerCube;\n precision ").concat(e.precision," sampler3D;\n precision ").concat(e.precision," sampler2DArray;\n precision ").concat(e.precision," sampler2DShadow;\n precision ").concat(e.precision," samplerCubeShadow;\n precision ").concat(e.precision," sampler2DArrayShadow;\n precision ").concat(e.precision," isampler2D;\n precision ").concat(e.precision," isampler3D;\n precision ").concat(e.precision," isamplerCube;\n precision ").concat(e.precision," isampler2DArray;\n precision ").concat(e.precision," usampler2D;\n precision ").concat(e.precision," usampler3D;\n precision ").concat(e.precision," usamplerCube;\n precision ").concat(e.precision," usampler2DArray;\n ");return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function WebGLProgram(e,t,i,r){let n,a,s,o,l,h;let u=e.getContext(),c=i.defines,d=i.vertexShader,p=i.fragmentShader,f=(l="SHADOWMAP_TYPE_BASIC",i.shadowMapType===g?l="SHADOWMAP_TYPE_PCF":i.shadowMapType===_?l="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===y&&(l="SHADOWMAP_TYPE_VSM"),l),m=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case ev:case e_:t="ENVMAP_TYPE_CUBE";break;case eM:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),x=(h="ENVMAP_MODE_REFLECTION",i.envMap&&i.envMapMode===e_&&(h="ENVMAP_MODE_REFRACTION"),h),M=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case er:t="ENVMAP_BLENDING_MULTIPLY";break;case en:t="ENVMAP_BLENDING_MIX";break;case ea:t="ENVMAP_BLENDING_ADD"}return t}(i),S=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),b=function(e){let t=[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""];return t.filter(filterEmptyLine).join("\n")}(i),T=function(e){let t=[];for(let i in e){let r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(c),A=u.createProgram(),E=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?((n=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,T].filter(filterEmptyLine).join("\n")).length>0&&(n+="\n"),(a=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,T].filter(filterEmptyLine).join("\n")).length>0&&(a+="\n")):(n=[generatePrecision(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,T,i.extensionCl
vendor: 5,401 bytes, line 5
5ipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+x:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),a=[generatePrecision(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,T,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alph
5aToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+m:"",i.envMap?"#define "+x:"",i.envMap?"#define "+M:"",S?"#define CUBEUV_TEXEL_WIDTH "+S.texelWidth:"",S?"#define CUBEUV_TEXEL_HEIGHT "+S.texelHeight:"",S?"#define CUBEUV_MAX_MIP "+S.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==es?"#define TONE_MAPPING":"",i.toneMapping!==es?nx.tonemapping_pars_fragment:"",i.toneMapping!==es?function(e,t){let i;switch(t){case eo:i="Linear";break;case el:i="Reinhard";break;case eh:i="OptimizedCineon";break;case eu:i="ACESFilmic";break;case ed:i="AgX";break;case ep:i="Neutral";break;case ec:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",nx.colorspace_pars_fragment,function(e,t){let i=function(e){let t;let i=iW.getPrimaries(iW.workingColorSpace),r=iW.getPrimaries(e);
5switch(i===r?t="":i===t3&&r===t1?t="LinearDisplayP3ToLinearSRGB":i===t1&&r===t3&&(t="LinearSRGBToLinearDisplayP3"),e){case tZ:case tQ:return[t,"LinearTransferOETF"];case tK:case tJ:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[t,"LinearTransferOETF"]}}(t);return"vec4 ".concat(e,"( vec4 value ) { return ").concat(i[0],"( ").concat(i[1],"( value ) ); }")}("linearToOutputTexel",i.outputColorSpace),function(){iW.getLuminanceCoefficients(nY);let e=nY.x.toFixed(4),t=nY.y.toFixed(4),i=nY.z.toFixed(4);return["float luminance( const in vec3 rgb ) {"," const vec3 weights = vec3( ".concat(e,", ").concat(t,", ").concat(i," );")," return dot( weights, rgb );","}"].join("\n")}(),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),d=replaceClippingPlaneNums(d=replaceLightNums(d=resolveIncludes(d),i),i),p=replaceClippingPlaneNums(p=replaceLightNums(p=resolveIncludes(p),i),i),d=unrollLoops(d),p=unrollLoops(p),!0!==i.isRawShaderMaterial&&(E="#version 300 es\n",n=[b,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+n,a=["#define varying in",i.glslVersion===iR?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===iR?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let w=E+n+d,C=E+a+p,R=WebGLShader(u,u.VERTEX_SHADER,w),L=WebGLShader(u,u.FRAGMENT_SHADER,C);function onFirstUse(t){if(e.debug.checkShaderErrors){let i=u.getProgramInfoLog(A).trim(),r=u.getShaderInfoLog(R).trim(),s=u.getShaderInfoLog(L).trim(),o=!0,l=!0;if(!1===u.getProgramParameter(A,u.LINK_STATUS)){if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(u,A,R,L);else{let e=getShaderErrors(u,R,"vertex"),r=getShaderErrors(u,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+u.getError()+" - VALIDATE_STATUS "+u.getProgramParameter(A,u.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+r)}}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):(""===r||""===s)&&(l=!1);l&&(t.diagnostics={runnable:o,programLog:i,vertexShader:{log:r,prefix:n},fragmentShader:{log:s,prefix:a}})}u.deleteShader(R),u.deleteShader(L),s=new WebGLUniforms(u,A),o=function(e,t){let i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<r;n++){let r=e.getActiveAttrib(t,n),a=r.name,s=1;r.type===e.FLOAT_MAT2&&(s=2),r.type===e.FLOAT_MAT3&&(s=3),r.type===e.FLOAT_MAT4&&(s=4),i[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(u,A)}u.attachShader(A,R),u.attachShader(A,L),void 0!==i.index0AttributeName?u.bindAttribLocation(A,0,i.index0AttributeName):!0===i.morphTargets&&u.bindAttribLocation(A,0,"position"),u.linkProgram(A),this.getUniforms=function(){return void 0===s&&onFirstUse(this),s},this.getAttributes=function(){return void 0===o&&onFirstUse(this),o};let P=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===P&&(P=u.getProgramParameter(A,37297)),P},this.destroy=function(){r.releaseStatesOfProgram(this),u.deleteProgram(A),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=nq++,this.cacheKey=t,this.usedTimes=1,this.program=A,this.vertexShader=R,this.fragmentShader=L,this}let nQ=0;let WebGLShaderCache=class WebGLShaderCache{update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),n=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(n)&&(a.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new WebGLShaderStage(e),t.set(e,i)),i}constructor(){this.shaderCache=new Map,this.materialCache=new Map}};let WebGLShaderStage=class WebGLShaderStage{constructor(e){this.id=nQ++,this.code=e,this.usedTimes=0}};function WebGLPrograms(e,t,i,r,n,a,s){let o=new Layers,l=new WebGLShaderCache,h=new Set,u=[],c=n.logarithmicDepthBuffer,d=n.vertexTextures,p=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};
5function getChannel(e){return(h.add(e),0===e)?"uv":"uv".concat(e)}return{getParameters:function(a,o,u,m,g){let _,y,x,b;let A=m.fog,E=g.geometry,w=a.isMeshStandardMaterial?m.environment:null,C=(a.isMeshStandardMaterial?i:t).get(a.envMap||w),R=C&&C.mapping===eM?C.image.height:null,L=f[a.type];null!==a.precision&&(p=n.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let P=E.morphAttributes.position||E.morphAttributes.normal||E.morphAttributes.color,I=void 0!==P?P.length:0,U=0;if(void 0!==E.morphAttributes.position&&(U=1),void 0!==E.morphAttributes.normal&&(U=2),void 0!==E.morphAttributes.color&&(U=3),L){let e=nS[L];_=e.vertexShader,y=e.fragmentShader}else _=a.vertexShader,y=a.fragmentShader,l.update(a),x=l.getVertexShaderID(a),b=l.getFragmentShaderID(a);let D=e.getRenderTarget(),N=!0===g.isInstancedMesh,B=!0===g.isBatchedMesh,O=!!a.map,F=!!a.matcap,V=!!C,z=!!a.aoMap,G=!!a.lightMap,k=!!a.bumpMap,H=!!a.normalMap,W=!!a.displacementMap,X=!!a.emissiveMap,j=!!a.metalnessMap,q=!!a.roughnessMap,Y=a.anisotropy>0,K=a.clearcoat>0,Z=a.dispersion>0,J=a.iridescence>0,Q=a.sheen>0,$=a.transmission>0,ee=Y&&!!a.anisotropyMap,et=K&&!!a.clearcoatMap,ei=K&&!!a.clearcoatNormalMap,er=K&&!!a.clearcoatRoughnessMap,en=J&&!!a.iridescenceMap,ea=J&&!!a.iridescenceThicknessMap,eo=Q&&!!a.sheenColorMap,el=Q&&!!a.sheenRoughnessMap,eh=!!a.specularMap,eu=!!a.specularColorMap,ec=!!a.specularIntensityMap,ed=$&&!!a.transmissionMap,ep=$&&!!a.thicknessMap,ef=!!a.gradientMap,em=!!a.alphaMap,eg=a.alphaTest>0,ev=!!a.alphaHash,e_=!!a.extensions,ey=es;a.toneMapped&&(null===D||!0===D.isXRRenderTarget)&&(ey=e.toneMapping);let ex={shaderID:L,shaderType:a.type,shaderName:a.name,vertexShader:_,fragmentShader:y,defines:a.defines,customVertexShaderID:x,customFragmentShaderID:b,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:B,batchingColor:B&&null!==g._colorsTexture,instancing:N,instancingColor:N&&null!==g.instanceColor,instancingMorph:N&&null!==g.morphTexture,supportsVertexTextures:d,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:tZ,alphaToCoverage:!!a.alphaToCoverage,map:O,matcap:F,envMap:V,envMapMode:V&&C.mapping,envMapCubeUVHeight:R,aoMap:z,lightMap:G,bumpMap:k,normalMap:H,displacementMap:d&&W,emissiveMap:X,normalMapObjectSpace:H&&a.normalMapType===tq,normalMapTangentSpace:H&&a.normalMapType===tj,metalnessMap:j,roughnessMap:q,anisotropy:Y,anisotropyMap:ee,clearcoat:K,clearcoatMap:et,clearcoatNormalMap:ei,clearcoatRoughnessMap:er,dispersion:Z,iridescence:J,iridescenceMap:en,iridescenceThicknessMap:ea,sheen:Q,sheenColorMap:eo,sheenRoughnessMap:el,specularMap:eh,specularColorMap:eu,specularIntensityMap:ec,transmission:$,transmissionMap:ed,thicknessMap:ep,gradientMap:ef,opaque:!1===a.transparent&&a.blending===T&&!1===a.alphaToCoverage,alphaMap:em,alphaTest:eg,alphaHash:ev,combine:a.combine,mapUv:O&&getChannel(a.map.channel),aoMapUv:z&&getChannel(a.aoMap.channel),lightMapUv:G&&getChannel(a.lightMap.channel),bumpMapUv:k&&getChannel(a.bumpMap.channel),normalMapUv:H&&getChannel(a.normalMap.channel),displacementMapUv:W&&getChannel(a.displacementMap.channel),emissiveMapUv:X&&getChannel(a.emissiveMap.channel),metalnessMapUv:j&&getChannel(a.metalnessMap.channel),roughnessMapUv:q&&getChannel(a.roughnessMap.channel),anisotropyMapUv:ee&&getChannel(a.anisotropyMap.channel),clearcoatMapUv:et&&getChannel(a.clearcoatMap.channel),clearcoatNormalMapUv:ei&&getChannel(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:er&&getChannel(a.clearcoatRoughnessMap.channel),iridescenceMapUv:en&&getChannel(a.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&getChannel(a.iridescenceThicknessMap.channel),sheenColorMapUv:eo&&getChannel(a.sheenColorMap.channel),sheenRoughnessMapUv:el&&getChannel(a.sheenRoughnessMap.channel),specularMapUv:eh&&getChannel(a.specularMap.channel),specularColorMapUv:eu&&getChannel(a.specularColorMap.channel),specularIntensityMapUv:ec&&getChannel(a.specularIntensityMap.channel),transmissionMapUv:ed&&getChannel(a.transmissionMap.channel),thicknessMapUv:ep&&getChannel(a.thicknessMap.channel),alphaMapUv:em&&getChannel(a.alphaMap.channel),vertexTangents:!!E.attributes.tangent&&(H||Y),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!E.attributes.color&&4===E.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!E.attributes.uv&&(O||em),fog:!!A,useFog:!0===a.fog,fogExp2:!!A&&A.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==E.morphAttributes.position,morphNormals:void 0!==E.morphAttributes.normal,morphColors:void 0!==E.morphAttributes.color,morphTargetsCount:I,morphTextureStride:U,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:ey,decodeVideoTexture:O&&!0===a.map.isVideoTexture&&iW.getTransfer(a.map.colorSpace)===t0,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===S,flipSided:a.side===M,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionCl
5ipCullDistance:e_&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(e_&&!0===a.extensions.multiDraw||B)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ex.vertexUv1s=h.has(1),ex.vertexUv2s=h.has(2),ex.vertexUv3s=h.has(3),h.clear(),ex},getProgramCacheKey:function(t){let i=[];if(t.shaderID?i.push(t.shaderID):(i.push(t.customVertexShaderID),i.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)i.push(e),i.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i.push(t.precision),i.push(t.outputColorSpace),i.push(t.envMapMode),i.push(t.envMapCubeUVHeight),i.push(t.mapUv),i.push(t.alphaMapUv),i.push(t.lightMapUv),i.push(t.aoMapUv),i.push(t.bumpMapUv),i.push(t.normalMapUv),i.push(t.displacementMapUv),i.push(t.emissiveMapUv),i.push(t.metalnessMapUv),i.push(t.roughnessMapUv),i.push(t.anisotropyMapUv),i.push(t.clearcoatMapUv),i.push(t.clearcoatNormalMapUv),i.push(t.clearcoatRoughnessMapUv),i.push(t.iridescenceMapUv),i.push(t.iridescenceThicknessMapUv),i.push(t.sheenColorMapUv),i.push(t.sheenRoughnessMapUv),i.push(t.specularMapUv),i.push(t.specularColorMapUv),i.push(t.specularIntensityMapUv),i.push(t.transmissionMapUv),i.push(t.thicknessMapUv),i.push(t.combine),i.push(t.fogExp2),i.push(t.sizeAttenuation),i.push(t.morphTargetsCount),i.push(t.morphAttributeCount),i.push(t.numDirLights),i.push(t.numPointLights),i.push(t.numSpotLights),i.push(t.numSpotLightMaps),i.push(t.numHemiLights),i.push(t.numRectAreaLights),i.push(t.numDirLightShadows),i.push(t.numPointLightShadows),i.push(t.numSpotLightShadows),i.push(t.numSpotLightShadowsWithMaps),i.push(t.numLightProbes),i.push(t.shadowMapType),i.push(t.toneMapping),i.push(t.numClippingPlanes),i.push(t.numClipIntersection),i.push(t.depthPacking),o.disableAll(),t.supportsVertexTextures&&o.enable(0),t.instancing&&o.enable(1),t.instancingColor&&o.enable(2),t.instancingMorph&&o.enable(3),t.matcap&&o.enable(4),t.envMap&&o.enable(5),t.normalMapObjectSpace&&o.enable(6),t.normalMapTangentSpace&&o.enable(7),t.clearcoat&&o.enable(8),t.iridescence&&o.enable(9),t.alphaTest&&o.enable(10),t.vertexColors&&o.enable(11),t.vertexAlphas&&o.enable(12),t.vertexUv1s&&o.enable(13),t.vertexUv2s&&o.enable(14),t.vertexUv3s&&o.enable(15),t.vertexTangents&&o.enable(16),t.anisotropy&&o.enable(17),t.alphaHash&&o.enable(18),t.batching&&o.enable(19),t.dispersion&&o.enable(20),t.batchingColor&&o.enable(21),i.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.skinning&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.morphColors&&o.enable(7),t.premultipliedAlpha&&o.enable(8),t.shadowMapEnabled&&o.enable(9),t.doubleSided&&o.enable(10),t.flipSided&&o.enable(11),t.useDepthPacking&&o.enable(12),t.dithering&&o.enable(13),t.transmission&&o.enable(14),t.sheen&&o.enable(15),t.opaque&&o.enable(16),t.pointsUvs&&o.enable(17),t.decodeVideoTexture&&o.enable(18),t.alphaToCoverage&&o.enable(19),i.push(o.mask),i.push(e.outputColorSpace)),i.push(t.customProgramCacheKey),i.join()},getUniforms:function(e){let t;let i=f[e.type];if(i){let e=nS[i];t=nc.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,i){let r;for(let e=0,t=u.length;e<t;e++){let t=u[e];if(t.cacheKey===i){r=t,++r.usedTimes;break}}return void 0===r&&(r=new WebGLProgram(e,i,t,a),u.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function WebGLProperties(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,r){e.get(t)[i]=r},dispose:function(){e=new WeakMap}}}function painterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function reversePainterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function WebGLRenderList(){let e=[],t=0,i=[],r=[],n=[];function getNextRenderItem(i,r,n,a,s,o){let l=e[t];
vendor: 4,585 bytes, line 5
5return void 0===l?(l={id:i.id,object:i,geometry:r,material:n,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=r,l.material=n,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:r,transparent:n,init:function(){t=0,i.length=0,r.length=0,n.length=0},push:function(e,t,a,s,o,l){let h=getNextRenderItem(e,t,a,s,o,l);a.transmission>0?r.push(h):!0===a.transparent?n.push(h):i.push(h)},unshift:function(e,t,a,s,o,l){let h=getNextRenderItem(e,t,a,s,o,l);a.transmission>0?r.unshift(h):!0===a.transparent?n.unshift(h):i.unshift(h)},finish:function(){for(let i=t,r=e.length;i<r;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||painterSortStable),r.length>1&&r.sort(t||reversePainterSortStable),n.length>1&&n.sort(t||reversePainterSortStable)}}}function WebGLRenderLists(){let e=new WeakMap;return{get:function(t,i){let r;let n=e.get(t);return void 0===n?(r=new WebGLRenderList,e.set(t,[r])):i>=n.length?(r=new WebGLRenderList,n.push(r)):r=n[i],r},dispose:function(){e=new WeakMap}}}function UniformsCache(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new Vector3,color:new Color};break;case"SpotLight":i={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":i={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3}}return e[t.id]=i,i}}}let n$=0;function shadowCastingAndTexturingLightsFirst(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function WebGLLights(e){let t=new UniformsCache,i=function(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new Vector3);let n=new Vector3,a=new Matrix4,s=new Matrix4;return{setup:function(n){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,h=0,u=0,c=0,d=0,p=0,f=0,m=0,g=0,_=0,y=0;n.sort(shadowCastingAndTexturingLightsFirst);for(let e=0,x=n.length;e<x;e++){let x=n[e],M=x.color,S=x.intensity,b=x.distance,T=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)a+=M.r*S,s+=M.g*S,o+=M.b*S;else if(x.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(x.sh.coefficients[e],S);y++}else if(x.isDirectionalLight){let e=t.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){let e=x.shadow,t=i.get(x);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=T,r.directionalShadowMatrix[l]=x.shadow.matrix,p++}r.directional[l]=e,l++}else if(x.isSpotLight){let e=t.get(x);e.position.setFromMatrixPosition(x.matrixWorld),e.color.copy(M).multiplyScalar(S),e.distance=b,e.coneCos=Math.cos(x.angle),e.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),e.decay=x.decay,r.spot[u]=e;let n=x.shadow;if(x.map&&(r.spotLightMap[g]=x.map,g++,n.updateMatrices(x),x.castShadow&&_++),r.spotLightMatrix[u]=n.matrix,x.castShadow){let e=i.get(x);e.shadowIntensity=n.intensity,e.shadowBias=n.bias,e.shadowNormalBias=n.normalBias,e.shadowRadius=n.radius,e.shadowMapSize=n.mapSize,r.spotShadow[u]=e,r.spotShadowMap[u]=T,m++}u++}else if(x.isRectAreaLight){let e=t.get(x);e.color.copy(M).multiplyScalar(S),e.halfWidth.set(.5*x.width,0,0),e.halfHeight.set(0,.5*x.height,0),r.rectArea[c]=e,c++}
5else if(x.isPointLight){let e=t.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),e.distance=x.distance,e.decay=x.decay,x.castShadow){let e=x.shadow,t=i.get(x);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[h]=t,r.pointShadowMap[h]=T,r.pointShadowMatrix[h]=x.shadow.matrix,f++}r.point[h]=e,h++}else if(x.isHemisphereLight){let e=t.get(x);e.skyColor.copy(x.color).multiplyScalar(S),e.groundColor.copy(x.groundColor).multiplyScalar(S),r.hemi[d]=e,d++}}c>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=nM.LTC_FLOAT_1,r.rectAreaLTC2=nM.LTC_FLOAT_2):(r.rectAreaLTC1=nM.LTC_HALF_1,r.rectAreaLTC2=nM.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let x=r.hash;(x.directionalLength!==l||x.pointLength!==h||x.spotLength!==u||x.rectAreaLength!==c||x.hemiLength!==d||x.numDirectionalShadows!==p||x.numPointShadows!==f||x.numSpotShadows!==m||x.numSpotMaps!==g||x.numLightProbes!==y)&&(r.directional.length=l,r.spot.length=u,r.rectArea.length=c,r.point.length=h,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=y,x.directionalLength=l,x.pointLength=h,x.spotLength=u,x.rectAreaLength=c,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=y,r.version=n$++)},setupView:function(e,t){let i=0,o=0,l=0,h=0,u=0,c=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=r.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),n.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(n),e.direction.transformDirection(c),i++}else if(d.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),e.direction.setFromMatrixPosition(d.matrixWorld),n.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(n),e.direction.transformDirection(c),l++}else if(d.isRectAreaLight){let e=r.rectArea[h];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),s.identity(),a.copy(d.matrixWorld),a.premultiply(c),s.extractRotation(a),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(s),e.halfHeight.applyMatrix4(s),h++}else if(d.isPointLight){let e=r.point[o];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),o++}else if(d.isHemisphereLight){let e=r.hemi[u];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(c),u++}}},state:r}}function WebGLRenderState(e){let t=new WebGLLights(e),i=[],r=[],n={lightsArray:i,shadowsArray:r,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){n.camera=e,i.length=0,r.length=0},state:n,setupLights:function(){t.setup(i)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function WebGLRenderStates(e){let t=new WeakMap;return{get:function(i){let r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=t.get(i);return void 0===a?(r=new WebGLRenderState(e),t.set(i,[r])):n>=a.length?(r=new WebGLRenderState(e),a.push(r)):r=a[n],r},dispose:function(){t=new WeakMap}}}let MeshDepthMaterial=class MeshDepthMaterial extends Material{copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tk,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}};let MeshDistanceMaterial=class MeshDistanceMaterial extends Material{copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}};function WebGLShadowMap(e,t,i){let r=new Frustum,n=new Vector2,a=new Vector2,s=new Vector4,o=new MeshDepthMaterial({depthPacking:tH}),l=new MeshDistanceMaterial,h={},u=i.maxTextureSize,c={[x]:M,[M]:x,[S]:S}
5,d=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new BufferGeometry;f.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Mesh(f,d),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=g;let T=this.type;function getDepthMaterial(t,i,r,n){let a=null,s=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=a.uuid,t=i.uuid,r=h[e];void 0===r&&(r={},h[e]=r);let n=r[t];void 0===n&&(n=a.clone(),r[t]=n,i.addEventListener("dispose",onMaterialDispose)),a=n}if(a.visible=i.visible,a.wireframe=i.wireframe,n===y?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:c[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial){let t=e.properties.get(a);t.light=r}return a}function onMaterialDispose(e){let t=e.target;for(let i in t.removeEventListener("dispose",onMaterialDispose),h){let t=h[i],r=e.target.uuid;if(r in t){let e=t[r];e.dispose(),delete t[r]}}}this.render=function(i,o,l){if(!1===_.enabled||!1===_.autoUpdate&&!1===_.needsUpdate||0===i.length)return;let h=e.getRenderTarget(),c=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.state;g.setBlending(b),g.buffers.color.setClear(1,1,1,1),g.buffers.depth.setTest(!0),g.setScissorTest(!1);let x=T!==y&&this.type===y,M=T===y&&this.type!==y;for(let h=0,c=i.length;h<c;h++){let c=i[h],f=c.shadow;if(void 0===f){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;n.copy(f.mapSize);let _=f.getFrameExtents();if(n.multiply(_),a.copy(f.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(a.x=Math.floor(u/_.x),n.x=a.x*_.x,f.mapSize.x=a.x),n.y>u&&(a.y=Math.floor(u/_.y),n.y=a.y*_.y,f.mapSize.y=a.y)),null===f.map||!0===x||!0===M){let e=this.type!==y?{minFilter:eA,magFilter:eA}:{};null!==f.map&&f.map.dispose(),f.map=new WebGLRenderTarget(n.x,n.y,e),f.map.texture.name=c.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let S=f.getViewportCount();for(let i=0;i<S;i++){let n=f.getViewport(i);s.set(a.x*n.x,a.y*n.y,a.x*n.z,a.y*n.w),g.viewport(s),f.updateMatrices(c,i),r=f.getFrustum(),function renderObject(i,n,a,s,o){if(!1===i.visible)return;let l=i.layers.test(n.layers);if(l&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&o===y)&&(!i.frustumCulled||r.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);let r=t.update(i),l=i.material;if(Array.isArray(l)){let t=r.groups;for(let h=0,u=t.length;h<u;h++){let u=t[h],c=l[u.materialIndex];
5if(c&&c.visible){let t=getDepthMaterial(i,c,s,o);i.onBeforeShadow(e,i,n,a,r,t,u),e.renderBufferDirect(a,null,r,t,i,u),i.onAfterShadow(e,i,n,a,r,t,u)}}}else if(l.visible){let t=getDepthMaterial(i,l,s,o);i.onBeforeShadow(e,i,n,a,r,t,null),e.renderBufferDirect(a,null,r,t,i,null),i.onAfterShadow(e,i,n,a,r,t,null)}}let h=i.children;for(let e=0,t=h.length;e<t;e++)renderObject(h[e],n,a,s,o)}(o,l,f.camera,c,this.type)}!0!==f.isPointLightShadow&&this.type===y&&function(i,r){let a=t.update(m);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new WebGLRenderTarget(n.x,n.y)),d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,a,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,a,p,m,null)}(f,l),f.needsUpdate=!1}
5T=this.type,_.needsUpdate=!1,e.setRenderTarget(h,c,f)}}function WebGLState(e){let t=new function(){let t=!1,i=new Vector4,r=null,n=new Vector4(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,a,s,o){!0===o&&(t*=s,r*=s,a*=s),i.set(t,r,a,s),!1===n.equals(i)&&(e.clearColor(t,r,a,s),n.copy(i))},reset:function(){t=!1,r=null,n.set(-1,0,0,0)}}},i=new function(){let t=!1,i=null,r=null,n=null;return{setTest:function(t){t?enable(e.DEPTH_TEST):disable(e.DEPTH_TEST)},setMask:function(r){i===r||t||(e.depthMask(r),i=r)},setFunc:function(t){if(r!==t){switch(t){case K:e.depthFunc(e.NEVER);break;case Z:e.depthFunc(e.ALWAYS);break;case J:e.depthFunc(e.LESS);break;case Q:e.depthFunc(e.LEQUAL);break;case $:e.depthFunc(e.EQUAL);break;case ee:e.depthFunc(e.GEQUAL);break;case et:e.depthFunc(e.GREATER);break;case ei:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}r=t}},setLocked:function(e){t=e},setClear:function(t){n!==t&&(e.clearDepth(t),n=t)},reset:function(){t=!1,i=null,r=null,n=null}}},r=new function(){let t=!1,i=null,r=null,n=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(i){t||(i?enable(e.STENCIL_TEST):disable(e.STENCIL_TEST))},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,s){(r!==t||n!==i||a!==s)&&(e.stencilFunc(t,i,s),r=t,n=i,a=s)},setOp:function(t,i,r){(s!==t||o!==i||l!==r)&&(e.stencilOp(t,i,r),s=t,o=i,l=r)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,r=null,n=null,a=null,s=null,o=null,l=null,h=null}}},n=new WeakMap,a=new WeakMap,s={},o={},l=new WeakMap,h=[],u=null,f=!1,m=null,g=null,_=null,y=null,x=null,er=null,en=null,ea=new Color(0,0,0),es=0,eo=!1,el=null,eh=null,eu=null,ec=null,ed=null,ep=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ef=!1,em=e.getParameter(e.VERSION);-1!==em.indexOf("WebGL")?ef=parseFloat(/^WebGL (\d)/.exec(em)[1])>=1:-1!==em.indexOf("OpenGL ES")&&(ef=parseFloat(/^OpenGL ES (\d)/.exec(em)[1])>=2);let eg=null,ev={},e_=e.getParameter(e.SCISSOR_BOX),ey=e.getParameter(e.VIEWPORT),ex=new Vector4().fromArray(e_),eM=new Vector4().fromArray(ey);function createTexture(t,i,r,n){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<r;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,n,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let eS={};function enable(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function disable(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}eS[e.TEXTURE_2D]=createTexture(e.TEXTURE_2D,e.TEXTURE_2D,1),eS[e.TEXTURE_CUBE_MAP]=createTexture(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),eS[e.TEXTURE_2D_ARRAY]=createTexture(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),eS[e.TEXTURE_3D]=createTexture(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),i.setClear(1),r.setClear(0),enable(e.DEPTH_TEST),i.setFunc(Q),setFlipSided(!1),setCullFace(d),enable(e.CULL_FACE),setBlending(b);let eb={[R]:e.FUNC_ADD,[L]:e.FUNC_SUBTRACT,[P]:e.FUNC_REVERSE_SUBTRACT};eb[I]=e.MIN,eb[U]=e.MAX;let eT={[D]:e.ZERO,[N]:e.ONE,[B]:e.SRC_COLOR,[F]:e.SRC_ALPHA,[W]:e.SRC_ALPHA_SATURATE,[k]:e.DST_COLOR,[z]:e.DST_ALPHA,[O]:e.ONE_MINUS_SRC_COLOR,[V]:e.ONE_MINUS_SRC_ALPHA,[H]:e.ONE_MINUS_DST_COLOR,[G]:e.ONE_MINUS_DST_ALPHA,[X]:e.CONSTANT_COLOR,[j]:e.ONE_MINUS_CONSTANT_COLOR,[q]:e.CONSTANT_ALPHA,[Y]:e.ONE_MINUS_CONSTANT_ALPHA};function setBlending(t,i,r,n,a,s,o,l,h,u){if(t===b){!0===f&&(disable(e.BLEND),f=!1);return}if(!1===f&&(enable(e.BLEND),f=!0),t!==C){if(t!==m||u!==eo){if((g!==R||x!==R)&&(e.blendEquation(e.FUNC_ADD),g=R,x=R),u)switch(t){case T:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case A:e.blendFunc(e.ONE,e.ONE);break;case E:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case w:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case T:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case A:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case E:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case w:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}_=null,y=null,er=null,en=null,ea.set(0,0,0),es=0,m=t,eo=u}return}a=a||i,s=s||r,o=o||n,(i!==g||a!==x)&&(e.blendEquationSeparate(eb[i],eb[a]),g=i,x=a),(r!==_||n!==y||s!==er||o!==en)&&
vendor: 4,597 bytes, line 5
5(e.blendFuncSeparate(eT[r],eT[n],eT[s],eT[o]),_=r,y=n,er=s,en=o),(!1===l.equals(ea)||h!==es)&&(e.blendColor(l.r,l.g,l.b,h),ea.copy(l),es=h),m=t,eo=!1}function setFlipSided(t){el!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),el=t)}function setCullFace(t){t!==c?(enable(e.CULL_FACE),t!==eh&&(t===d?e.cullFace(e.BACK):t===p?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):disable(e.CULL_FACE),eh=t}function setPolygonOffset(t,i,r){t?(enable(e.POLYGON_OFFSET_FILL),(ec!==i||ed!==r)&&(e.polygonOffset(i,r),ec=i,ed=r)):disable(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:i,stencil:r},enable:enable,disable:disable,bindFramebuffer:function(t,i){return o[t]!==i&&(e.bindFramebuffer(t,i),o[t]=i,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let r=h,n=!1;if(t){void 0===(r=l.get(i))&&(r=[],l.set(i,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,n=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,n=!0);n&&e.drawBuffers(r)},useProgram:function(t){return u!==t&&(e.useProgram(t),u=t,!0)},setBlending:setBlending,setMaterial:function(n,a){n.side===S?disable(e.CULL_FACE):enable(e.CULL_FACE);let s=n.side===M;a&&(s=!s),setFlipSided(s),n.blending===T&&!1===n.transparent?setBlending(b):setBlending(n.blending,n.blendEquation,n.blendSrc,n.blendDst,n.blendEquationAlpha,n.blendSrcAlpha,n.blendDstAlpha,n.blendColor,n.blendAlpha,n.premultipliedAlpha),i.setFunc(n.depthFunc),i.setTest(n.depthTest),i.setMask(n.depthWrite),t.setMask(n.colorWrite);let o=n.stencilWrite;r.setTest(o),o&&(r.setMask(n.stencilWriteMask),r.setFunc(n.stencilFunc,n.stencilRef,n.stencilFuncMask),r.setOp(n.stencilFail,n.stencilZFail,n.stencilZPass)),setPolygonOffset(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits),!0===n.alphaToCoverage?enable(e.SAMPLE_ALPHA_TO_COVERAGE):disable(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:function(t){t!==eu&&(ef&&e.lineWidth(t),eu=t)},setPolygonOffset:setPolygonOffset,setScissorTest:function(t){t?enable(e.SCISSOR_TEST):disable(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+ep-1),eg!==t&&(e.activeTexture(t),eg=t)},bindTexture:function(t,i,r){void 0===r&&(r=null===eg?e.TEXTURE0+ep-1:eg);let n=ev[r];void 0===n&&(n={type:void 0,texture:void 0},ev[r]=n),(n.type!==t||n.texture!==i)&&(eg!==r&&(e.activeTexture(r),eg=r),e.bindTexture(t,i||eS[t]),n.type=t,n.texture=i)},unbindTexture:function(){let t=ev[eg];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,i){let r=a.get(i);void 0===r&&(r=new WeakMap,a.set(i,r));let n=r.get(t);void 0===n&&(n=e.getUniformBlockIndex(i,t.name),r.set(t,n))},uniformBlockBinding:function(t,i){let r=a.get(i),s=r.get(t);n.get(i)!==s&&(e.uniformBlockBinding(i,s,t.__bindingPointIndex),n.set(i,s))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===ex.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),ex.copy(t))},viewport:function(t){!1===eM.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),eM.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor
5(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},eg=null,ev={},o={},l=new WeakMap,h=[],u=null,f=!1,m=null,g=null,_=null,y=null,x=null,er=null,en=null,ea=new Color(0,0,0),es=0,eo=!1,el=null,eh=null,eu=null,ec=null,ed=null,ex.set(0,0,e.canvas.width,e.canvas.height),eM.set(0,0,e.canvas.width,e.canvas.height),t.reset(),i.reset(),r.reset()}}}function getByteLength(e,t,i,r){let n=function(e){switch(e){case eN:case eB:return{byteLength:1,components:1};case eF:case eO:case ek:return{byteLength:2,components:1};case eH:case eW:return{byteLength:2,components:4};case ez:case eV:case eG:return{byteLength:4,components:1};case ej:return{byteLength:4,components:3}}throw Error("Unknown texture type ".concat(e,"."))}(r);switch(i){case eq:case eZ:return e*t;case eJ:return e*t*2;case e0:case e1:return e*t/n.components*n.byteLength;case e3:case e2:return e*t*2/n.components*n.byteLength;case eY:return e*t*3/n.components*n.byteLength;case eK:case e5:return e*t*4/n.components*n.byteLength;case e6:case e8:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case e9:case e7:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case tt:case tr:return Math.max(e,16)*Math.max(t,8)/4;case te:case ti:return Math.max(e,8)*Math.max(t,8)/2;case tn:case ta:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ts:case to:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case tl:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case th:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case tu:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case tc:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case td:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case tp:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case tf:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case tm:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case tg:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case tv:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case t_:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case ty:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case tx:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case tM:case tS:case tb:return Math.ceil(e/4)*Math.ceil(t/4)*16;case tT:case tA:return Math.ceil(e/4)*Math.ceil(t/4)*8;case tE:case tw:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error("Unable to determine texture byte length for ".concat(i," format."))}let n0={contain:function(e,t){let i=e.image&&e.image.width?e.image.width/e.image.height:1;return i>t?(e.repeat.x=1,e.repeat.y=i/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/i,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e},cover:function(e,t){let i=e.image&&e.image.width?e.image.width/e.image.height:1;return i>t?(e.repeat.x=t/i,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=i/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e},fill:function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e},getByteLength};function WebGLTextures(e,t,i,r,n,a,s){let o;let l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),u=new Vector2,c=new WeakMap,d=new WeakMap,p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function createCanvas(e,t){return p?new OffscreenCanvas(e,t):createElementNS("canvas")}function resizeImage(e,t,i){let r=1,n=getDimensions(e);if((n.width>i||n.height>i)&&(r=i/Math.max(n.width,n.height)),r<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(r*n.width),a=Math.floor(r*n.height);void 0===o&&(o=createCanvas(i,a));let s=t?createCanvas(i,a):o;s.width=i,s.height=a;let l=s.getContext("2d");return l.drawImage(e,0,0,i,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+n.width+"x"+n.height+") to ("+i+"x"+a+")."),s}
5"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+n.width+"x"+n.height+").")}return e}function textureNeedsGenerateMipmaps(e){return e.generateMipmaps&&e.minFilter!==eA&&e.minFilter!==eL}function generateMipmap(t){e.generateMipmap(t)}function getInternalFormat(i,r,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=r;if(r===e.RED&&(n===e.FLOAT&&(o=e.R32F),n===e.HALF_FLOAT&&(o=e.R16F),n===e.UNSIGNED_BYTE&&(o=e.R8)),r===e.RED_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.R8UI),n===e.UNSIGNED_SHORT&&(o=e.R16UI),n===e.UNSIGNED_INT&&(o=e.R32UI),n===e.BYTE&&(o=e.R8I),n===e.SHORT&&(o=e.R16I),n===e.INT&&(o=e.R32I)),r===e.RG&&(n===e.FLOAT&&(o=e.RG32F),n===e.HALF_FLOAT&&(o=e.RG16F),n===e.UNSIGNED_BYTE&&(o=e.RG8)),r===e.RG_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RG8UI),n===e.UNSIGNED_SHORT&&(o=e.RG16UI),n===e.UNSIGNED_INT&&(o=e.RG32UI),n===e.BYTE&&(o=e.RG8I),n===e.SHORT&&(o=e.RG16I),n===e.INT&&(o=e.RG32I)),r===e.RGB&&n===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),r===e.RGBA){let t=s?t$:iW.getTransfer(a);n===e.FLOAT&&(o=e.RGBA32F),n===e.HALF_FLOAT&&(o=e.RGBA16F),n===e.UNSIGNED_BYTE&&(o=t===t0?e.SRGB8_ALPHA8:e.RGBA8),n===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),n===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function getInternalDepthFormat(t,i){let r;return t?null===i||i===ez||i===eX?r=e.DEPTH24_STENCIL8:i===eG?r=e.DEPTH32F_STENCIL8:i===eF&&(r=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||i===ez||i===eX?r=e.DEPTH_COMPONENT24:i===eG?r=e.DEPTH_COMPONENT32F:i===eF&&(r=e.DEPTH_COMPONENT16),r}function getMipLevels(e,t){return!0===textureNeedsGenerateMipmaps(e)||e.isFramebufferTexture&&e.minFilter!==eA&&e.minFilter!==eL?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function onTextureDispose(e){let t=e.target;t.removeEventListener("dispose",onTextureDispose),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let i=e.source,n=d.get(i);if(n){let r=n[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&deleteTexture(e),0===Object.keys(n).length&&d.delete(i)}r.remove(e)}(t),t.isVideoTexture&&c.delete(t)}function onRenderTargetDispose(t){let i=t.target;i.removeEventListener("dispose",onRenderTargetDispose),function(t){let i=r.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let r=0;r<i.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(i.__webglFramebuffer[t][r]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let n=t.textures;for(let t=0,i=n.length;t<i;t++){let i=r.get(n[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),r.remove(n[t])}r.remove(t)}(i)}function deleteTexture(t){let i=r.get(t);e.deleteTexture(i.__webglTexture);let n=t.source,a=d.get(n);delete a[i.__cacheKey],s.memory.textures--}let f=0;function setTexture2D(t,n){let a=r.get(t);if(t.isVideoTexture&&function(e){let t=s.render.frame;c.get(e)!==t&&(c.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===e.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{uploadTexture(a,t,n);return}}i.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+n)}let m={[eS]:e.REPEAT,[eb]:e.CLAMP_TO_EDGE,[eT]:e.MIRRORED_REPEAT},g={[eA]:e.NEAREST,[eE]:e.NEAREST_MIPMAP_NEAREST,[eC]:e.NEAREST_MIPMAP_LINEAR,[eL]:e.LINEAR,[eP]:e.LINEAR_MIPMAP_NEAREST,[eU]:e.LINEAR_MIPMAP_LINEAR},_={[iu]:e.NEVER,[i_]:e.ALWAYS,[ic]:e.LESS,[ip]:e.LEQUAL,[id]:e.EQUAL,[iv]:e.GEQUAL,[im]:e.GREATER,[ig]:e.NOTEQUAL};function setTextureParameters(i,a){if(a.type===eG&&!1===t.has("OES_texture_float_linear")&&(a.magFilter===eL||a.magFilter===eP||a.magFilter===eC||a.magFilter===eU||a.minFilter===eL||a.minFilter===eP||a.minFilter===eC||a.minFilter===eU)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,m[a.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,m[a.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,m[a.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,g[a.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,g[a.minFilter]),a.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,_[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")&&a.magFilter!==eA&&(a.minFilter===eC||a.minFilter===eU)&&(a.type!==eG||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||r.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}function initTexture(t,i){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",onTextureDispose));let n=i.source,a=d.get(n);void 0===a&&(a={},d.set(n,a));let o=function(e){let t=[];
5return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(i);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),a[o].usedTimes++;let n=a[t.__cacheKey];void 0!==n&&(a[t.__cacheKey].usedTimes--,0===n.usedTimes&&deleteTexture(i)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return r}function uploadTexture(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let h=initTexture(t,s),u=s.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let c=r.get(u);if(u.version!==c.__version||!0===h){let t;i.activeTexture(e.TEXTURE0+o);let r=iW.getPrimaries(iW.workingColorSpace),d=s.colorSpace===tY?null:iW.getPrimaries(s.colorSpace),p=s.colorSpace===tY||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=resizeImage(s.image,!1,n.maxTextureSize);f=verifyColorSpace(s,f);let m=a.convert(s.format,s.colorSpace),g=a.convert(s.type),_=getInternalFormat(s.internalFormat,m,g,s.colorSpace,s.isVideoTexture);setTextureParameters(l,s);let y=s.mipmaps,x=!0!==s.isVideoTexture,M=void 0===c.__version||!0===h,S=u.dataReady,b=getMipLevels(s,f);if(s.isDepthTexture)_=getInternalDepthFormat(s.format===e$,s.type),M&&(x?i.texStorage2D(e.TEXTURE_2D,1,_,f.width,f.height):i.texImage2D(e.TEXTURE_2D,0,_,f.width,f.height,0,m,g,null));else if(s.isDataTexture){if(y.length>0){x&&M&&i.texStorage2D(e.TEXTURE_2D,b,_,y[0].width,y[0].height);for(let r=0,n=y.length;r<n;r++)t=y[r],x?S&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,m,g,t.data):i.texImage2D(e.TEXTURE_2D,r,_,t.width,t.height,0,m,g,t.data);s.generateMipmaps=!1}else x?(M&&i.texStorage2D(e.TEXTURE_2D,b,_,f.width,f.height),S&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,f.width,f.height,m,g,f.data)):i.texImage2D(e.TEXTURE_2D,0,_,f.width,f.height,0,m,g,f.data)}else if(s.isCompressedTexture){if(s.isCompressedArrayTexture){x&&M&&i.texStorage3D(e.TEXTURE_2D_ARRAY,b,_,y[0].width,y[0].height,f.depth);for(let r=0,n=y.length;r<n;r++)if(t=y[r],s.format!==eK){if(null!==m){if(x){if(S){if(s.layerUpdates.size>0){let n=getByteLength(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*n/t.data.BYTES_PER_ELEMENT,(a+1)*n/t.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,t.width,t.height,1,m,s,0,0)}s.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,m,t.data,0,0)}}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,_,t.width,t.height,f.depth,0,t.data,0,0)}else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()")}else x?S&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,m,g,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,r,_,t.width,t.height,f.depth,0,m,g,t.data)}else{x&&M&&i.texStorage2D(e.TEXTURE_2D,b,_,y[0].width,y[0].height);for(let r=0,n=y.length;r<n;r++)t=y[r],s.format!==eK?null!==m?x?S&&i.compressedTexSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,m,t.data):i.compressedTexImage2D(e.TEXTURE_2D,r,_,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):x?S&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,m,g,t.data):i.texImage2D(e.TEXTURE_2D,r,_,t.width,t.height,0,m,g,t.data)}}else if(s.isDataArrayTexture){if(x){if(M&&i.texStorage3D(e.TEXTURE_2D_ARRAY,b,_,f.width,f.height,f.depth),S){if(s.layerUpdates.size>0){let t=getByteLength(f.width,f.height,s.format,s.type);for(let r of s.layerUpdates){let n=f.data.subarray(r*t/f.data.BYTES_PER_ELEMENT,(r+1)*t/f.data.BYTES_PER_ELEMENT);i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,f.width,f.height,1,m,g,n)}s.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,m,g,f.data)}}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,_,f.width,f.height,f.depth,0,m,g,f.data)}else if(s.isData3DTexture)x?(M&&i.texStorage3D(e.TEXTURE_3D,b,_,f.width,f.height,f.depth),S&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,m,g,f.data)):i.texImage3D(e.TEXTURE_3D,0,_,f.width,f.height,f.depth,0,m,g,f.data);else if(s.isFramebufferTexture){if(M){if(x)i.texStorage2D(e.TEXTURE_2D,b,_,f.width,f.height);else{let t=f.width,r=f.height;for(let n=0;n<b;n++)i.texImage2D(e.TEXTURE_2D,n,_,t,r,0,m,g,null),t>>=1,r>>=1}}}else if(y.length>0){if(x&&M){let t=getDimensions(y[0]);i.texStorage2D(e.TEXTURE_2D,b,_,t.width,t.height)}for(let r=0,n=y.length;r<n;r++)t=y[r],x?S&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,m,g,t):i.texImage2D(e.TEXTURE_2D,r,_,m,g,t);s.generateMipmaps=!1}else if(x){if(M){let t=getDimensions(f);i.texStorage2D(e.TEXTURE_2D,b,_,t.width,t.height)}S&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,m,g,f)}else i.texImage2D(e.TEXTURE_2D,0,_,m,g,f);textureNeedsGenerateMipmaps(s)&&generateMipmap(l),c.__version=u.version,s.onUp
5date&&s.onUpdate(s)}t.__version=s.version}function setupFrameBufferTexture(t,n,s,o,h,u){let c=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=getInternalFormat(s.internalFormat,c,d,s.colorSpace),f=r.get(n);if(!f.__hasExternalTextures){let t=Math.max(1,n.width>>u),r=Math.max(1,n.height>>u);h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?i.texImage3D(h,u,p,t,r,n.depth,0,c,d,null):i.texImage2D(h,u,p,t,r,0,c,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),useMultisampledRTT(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,h,r.get(s).__webglTexture,0,getRenderTargetSamples(n)):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,h,r.get(s).__webglTexture,u),i.bindFramebuffer(e.FRAMEBUFFER,null)}function setupRenderBufferStorage(t,i,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer){let n=i.depthTexture,a=n&&n.isDepthTexture?n.type:null,s=getInternalDepthFormat(i.stencilBuffer,a),o=i.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=getRenderTargetSamples(i),u=useMultisampledRTT(i);u?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,h,s,i.width,i.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,h,s,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,s,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=i.textures;for(let n=0;n<t.length;n++){let s=t[n],o=a.convert(s.format,s.colorSpace),h=a.convert(s.type),u=getInternalFormat(s.internalFormat,o,h,s.colorSpace),c=getRenderTargetSamples(i);r&&!1===useMultisampledRTT(i)?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,u,i.width,i.height):useMultisampledRTT(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,u,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,u,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function setupDepthRenderbuffer(t){let n=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!n.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");!function(t,n){let a=n&&n.isWebGLCubeRenderTarget;if(a)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(e.FRAMEBUFFER,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw 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),setTexture2D(n.depthTexture,0);let s=r.get(n.depthTexture).__webglTexture,o=getRenderTargetSamples(n);if(n.depthTexture.format===eQ)useMultisampledRTT(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0);else if(n.depthTexture.format===e$)useMultisampledRTT(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0);else throw Error("Unknown depthTexture format")}(n.__webglFramebuffer,t)}else if(a){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[r]),n.__webglDepthbuffer[r]=e.createRenderbuffer(),setupRenderBufferStorage(n.__webglDepthbuffer[r],t,!1)}else i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),setupRenderBufferStorage(n.__webglDepthbuffer,t,!1);i.bindFramebuffer(e.FRAMEBUFFER,null)}let y=[],x=[];function getRenderTargetSamples(e){return Math.min(n.maxSamples,e.samples)}function useMultisampledRTT(e){let i=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function verifyColorSpace(e,t){let i=e.colorSpace,r=e.format,n=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==tZ&&i!==tY&&(iW.getTransfer(i)===t0?(r!==eK||n!==eN)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),t}function getDimensions(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(u.width=e.naturalWi
5dth||e.width,u.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(u.width=e.displayWidth,u.height=e.displayHeight):(u.width=e.width,u.height=e.height),u}this.allocateTextureUnit=function(){let e=f;return e>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+n.maxTextures),f+=1,e},this.resetTextureUnits=function(){f=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function(t,n){let a=r.get(t);if(t.version>0&&a.__version!==t.version){uploadTexture(a,t,n);return}i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n)},this.setTexture3D=function(t,n){let a=r.get(t);if(t.version>0&&a.__version!==t.version){uploadTexture(a,t,n);return}i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,s){let o=r.get(t);if(t.version>0&&o.__version!==t.version){(function(t,s,o){if(6!==s.image.length)return;let l=initTexture(t,s),h=s.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let u=r.get(h);if(h.version!==u.__version||!0===l){let t;i.activeTexture(e.TEXTURE0+o);let r=iW.getPrimaries(iW.workingColorSpace),c=s.colorSpace===tY?null:iW.getPrimaries(s.colorSpace),d=s.colorSpace===tY||r===c?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)p||f?m[e]=f?s.image[e].image:s.image[e]:m[e]=resizeImage(s.image[e],!0,n.maxCubemapSize),m[e]=verifyColorSpace(s,m[e]);let g=m[0],_=a.convert(s.format,s.colorSpace),y=a.convert(s.type),x=getInternalFormat(s.internalFormat,_,y,s.colorSpace),M=!0!==s.isVideoTexture,S=void 0===u.__version||!0===l,b=h.dataReady,T=getMipLevels(s,g);if(setTextureParameters(e.TEXTURE_CUBE_MAP,s),p){M&&S&&i.texStorage2D(e.TEXTURE_CUBE_MAP,T,x,g.width,g.height);for(let r=0;r<6;r++){t=m[r].mipmaps;for(let n=0;n<t.length;n++){let a=t[n];s.format!==eK?null!==_?M?b&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,0,0,a.width,a.height,_,a.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,x,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):M?b&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,0,0,a.width,a.height,_,y,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,x,a.width,a.height,0,_,y,a.data)}}}else{if(t=s.mipmaps,M&&S){t.length>0&&T++;let r=getDimensions(m[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,T,x,r.width,r.height)}for(let r=0;r<6;r++)if(f){M?b&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,m[r].width,m[r].height,_,y,m[r].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,x,m[r].width,m[r].height,0,_,y,m[r].data);for(let n=0;n<t.length;n++){let a=t[n],s=a.image[r].image;M?b&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,0,0,s.width,s.height,_,y,s.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,x,s.width,s.height,0,_,y,s.data)}}else{M?b&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,_,y,m[r]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,x,_,y,m[r]);for(let n=0;n<t.length;n++){let a=t[n];M?b&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,0,0,_,y,a.image[r]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,x,_,y,a.image[r])}}}textureNeedsGenerateMipmaps(s)&&generateMipmap(e.TEXTURE_CUBE_MAP),u.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version})(o,t,s);return}i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,i,n){let a=r.get(t);void 0!==i&&setupFrameBufferTexture(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==n&&setupDepthRenderbuffer(t)},this.setupRenderTarget=function(t){let n=t.texture,o=r.get(t),l=r.get(n);t.addEventListener("dispose",onRenderTargetDispose);
vendor: 4,230 bytes, line 5
5let h=t.textures,u=!0===t.isWebGLCubeRenderTarget,c=h.length>1;if(!c&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),u){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let i=0;i<n.mipmaps.length;i++)o.__webglFramebuffer[t][i]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<n.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(c)for(let t=0,i=h.length;t<i;t++){let i=r.get(h[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===useMultisampledRTT(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<h.length;i++){let r=h[i];o.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[i]);let n=a.convert(r.format,r.colorSpace),s=a.convert(r.type),l=getInternalFormat(r.internalFormat,n,s,r.colorSpace,!0===t.isXRRenderTarget),u=getRenderTargetSamples(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,o.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),setupRenderBufferStorage(o.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),setTextureParameters(e.TEXTURE_CUBE_MAP,n);for(let i=0;i<6;i++)if(n.mipmaps&&n.mipmaps.length>0)for(let r=0;r<n.mipmaps.length;r++)setupFrameBufferTexture(o.__webglFramebuffer[i][r],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r);else setupFrameBufferTexture(o.__webglFramebuffer[i],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);textureNeedsGenerateMipmaps(n)&&generateMipmap(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(c){for(let n=0,a=h.length;n<a;n++){let a=h[n],s=r.get(a);i.bindTexture(e.TEXTURE_2D,s.__webglTexture),setTextureParameters(e.TEXTURE_2D,a),setupFrameBufferTexture(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+n,e.TEXTURE_2D,0),textureNeedsGenerateMipmaps(a)&&generateMipmap(e.TEXTURE_2D)}i.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(r,l.__webglTexture),setTextureParameters(r,n),n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)setupFrameBufferTexture(o.__webglFramebuffer[i],t,n,e.COLOR_ATTACHMENT0,r,i);else setupFrameBufferTexture(o.__webglFramebuffer,t,n,e.COLOR_ATTACHMENT0,r,0);textureNeedsGenerateMipmaps(n)&&generateMipmap(r),i.unbindTexture()}t.depthBuffer&&setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function(t){let n=t.textures;for(let a=0,s=n.length;a<s;a++){let s=n[a];if(textureNeedsGenerateMipmaps(s)){let n=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=r.get(s).__webglTexture;i.bindTexture(n,a),generateMipmap(n),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===useMultisampledRTT(t)){let n=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),c=n.length>1;if(c)for(let t=0;t<n.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let i=0;i<n.length;i++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),c){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRen
5derbuffer[i]);let t=r.get(n[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===h&&(y.length=0,x.length=0,y.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&!1===t.resolveDepthBuffer&&(y.push(l),x.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,x)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,y))}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),c)for(let t=0;t<n.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);let a=r.get(n[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&h){let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[i])}}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(e,t){return{convert:function(i){let r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tY,a=iW.getTransfer(n);if(i===eN)return e.UNSIGNED_BYTE;if(i===eH)return e.UNSIGNED_SHORT_4_4_4_4;if(i===eW)return e.UNSIGNED_SHORT_5_5_5_1;if(i===ej)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===eB)return e.BYTE;if(i===eO)return e.SHORT;if(i===eF)return e.UNSIGNED_SHORT;if(i===eV)return e.INT;if(i===ez)return e.UNSIGNED_INT;if(i===eG)return e.FLOAT;if(i===ek)return e.HALF_FLOAT;if(i===eq)return e.ALPHA;if(i===eY)return e.RGB;if(i===eK)return e.RGBA;if(i===eZ)return e.LUMINANCE;if(i===eJ)return e.LUMINANCE_ALPHA;if(i===eQ)return e.DEPTH_COMPONENT;if(i===e$)return e.DEPTH_STENCIL;if(i===e0)return e.RED;if(i===e1)return e.RED_INTEGER;if(i===e3)return e.RG;if(i===e2)return e.RG_INTEGER;if(i===e5)return e.RGBA_INTEGER;if(i===e6||i===e8||i===e9||i===e7){if(a===t0){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(i===e6)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===e8)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===e9)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===e7)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(i===e6)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===e8)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===e9)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===e7)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(i===te||i===tt||i===ti||i===tr){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(i===te)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===tt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===ti)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===tr)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===tn||i===ta||i===ts){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(i===tn||i===ta)return a===t0?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===ts)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(i===to||i===tl||i===th||i===tu||i===tc||i===td||i===tp||i===tf||i===tm||i===tg||i===tv||i===t_||i===ty||i===tx){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(i===to)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===tl)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===th)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===tu)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===tc)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===td)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===tp)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===tf)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===tm)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===tg)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===tv)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===t_)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ty)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===tx)return a===t0?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===tM||i===tS||i===tb){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(i===tM)return a===t0?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===tS)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===tb)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(i===tT||i===tA||i===tE||i===tw){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;
5if(i===tM)return r.COMPRESSED_RED_RGTC1_EXT;if(i===tA)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===tE)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===tw)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===eX?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}let ArrayCamera=class ArrayCamera extends PerspectiveCamera{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};let Group=class Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}};let n1={type:"move"};let WebXRController=class WebXRController{getHandSpace(){return null===this._hand&&(this._hand=new Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let r=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,i),n=this._getHandJoint(l,r);null!==e&&(n.matrix.fromArray(e.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,n.jointRadius=e.radius),n.visible=null!==e}let r=l.joints["index-finger-tip"],n=l.joints["thumb-tip"],s=r.position.distanceTo(n.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,i))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(r=t.getPose(e.targetRaySpace,i))&&null!==n&&(r=n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(n1)))}return null!==s&&(s.visible=null!==r),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new Group;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}constructor(){this._targetRay=null,this._grip=null,this._hand=null}};let WebXRDepthSensing=class WebXRDepthSensing{init(e,t,i){if(null===this.texture){let r=new Texture,n=e.properties.get(r);n.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,i=new ShaderMaterial({vertexShader:"\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n if ( coord.x >= 1.0 ) {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n } else {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n }\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}};
5let WebXRManager=class WebXRManager extends EventDispatcher{constructor(e,t){super();let i=this,r=null,n=1,a=null,s="local-floor",o=1,l=null,h=null,u=null,c=null,d=null,p=null,f=new WebXRDepthSensing,m=t.getContextAttributes(),g=null,_=null,y=[],x=[],M=new Vector2,S=null,b=new PerspectiveCamera;b.layers.enable(1),b.viewport=new Vector4;let T=new PerspectiveCamera;T.layers.enable(2),T.viewport=new Vector4;let A=[b,T],E=new ArrayCamera;E.layers.enable(1),E.layers.enable(2);let w=null,C=null;function onSessionEvent(e){let t=x.indexOf(e.inputSource);if(-1===t)return;let i=y[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||a),i.dispatchEvent({type:e.type,data:e.inputSource}))}function onSessionEnd(){r.removeEventListener("select",onSessionEvent),r.removeEventListener("selectstart",onSessionEvent),r.removeEventListener("selectend",onSessionEvent),r.removeEventListener("squeeze",onSessionEvent),r.removeEventListener("squeezestart",onSessionEvent),r.removeEventListener("squeezeend",onSessionEvent),r.removeEventListener("end",onSessionEnd),r.removeEventListener("inputsourceschange",onInputSourcesChange);for(let e=0;e<y.length;e++){let t=x[e];null!==t&&(x[e]=null,y[e].disconnect(t))}w=null,C=null,f.reset(),e.setRenderTarget(g),d=null,c=null,u=null,r=null,_=null,I.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(M.width,M.height,!1),i.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],r=x.indexOf(i);r>=0&&(x[r]=null,y[r].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],r=x.indexOf(i);if(-1===r){for(let e=0;e<y.length;e++){if(e>=x.length){x.push(i),r=e;break}if(null===x[e]){x[e]=i,r=e;break}}if(-1===r)break}let n=y[r];n&&n.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=y[e];return void 0===t&&(t=new WebXRController,y[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=y[e];return void 0===t&&(t=new WebXRController,y[e]=t),t.getGripSpace()},this.getHand=function(e){let t=y[e];return void 0===t&&(t=new WebXRController,y[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){n=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==c?c:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(h){if(null!==(r=h)){if(g=e.getRenderTarget(),r.addEventListener("select",onSessionEvent),r.addEventListener("selectstart",onSessionEvent),r.addEventListener("selectend",onSessionEvent),r.addEventListener("squeeze",onSessionEvent),r.addEventListener("squeezestart",onSessionEvent),r.addEventListener("squeezeend",onSessionEvent),r.addEventListener("end",onSessionEnd),r.addEventListener("inputsourceschange",onInputSourcesChange),!0!==m.xrCompatible&&await t.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(M),void 0===r.renderState.layers){let i={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:n};d=new XRWebGLLayer(r,t,i),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new WebGLRenderTarget(d.framebufferWidth,d.framebufferHeight,{format:eK,type:eN,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let i=null,a=null,s=null;m.depth&&(s=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=m.stencil?e$:eQ,a=m.stencil?eX:ez);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:n};c=(u=new XRWebGLBinding(r,t)).createProjectionLayer(o),r.updateRenderState({layers:[c]}),e.setPixelRatio(1),e.setSize(c.textureWidth,c.textureHeight,!1),_=new WebGLRenderTarget(c.textureWidth,c.textureHeight,{format:eK,type:eN,depthTexture:new DepthTexture(c.textureWidth,c.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:!1===c.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await r.requestReferenceSpace(s),I.setContext(r),I.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};let R=new Vector3,L=new Vector3;function updateCamera(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===r)return;null!==f.texture&&(e.near=f.depthNear,e.far=f.depthFar),E.near=T.near=b.near=e.near,E.far=T.far=b.far=e.far,(w!==E.near||C!==E.far)&&(r.updateRenderState({depthNear:E.near,depthFar:E.far}),w=E.near,C=E.far,b.near=w,b.far=C,T.near=w,T.far=C,b.updateProjectionMatrix(),T.updateProjectionMatrix(),e.updateProjectionMatrix());let t=e.parent,i=E.cameras;updateCamera(E,t);for(let e=0;e<i.length;e++)updateCamera(i[e],t);2===i.length?function(e,t,i){R.setFromMatrixPosition(t.matrixWorld),L.setFromMatrixPosition(i.matrixWorld);let r=R.distanceTo(L),n=t.projectionMatrix.elements,a=i.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],h=(n[9]-1)/n[5],u=(n[8]-1)/n[0],c=(a[8]+1)/a[0],d=r/(-u+c),p=-(d*u);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();let f=s+d,m=o+d,g=s*u-p,_=s*c+(r-p),y=l*o/m*f,x=h*o/m*f;e.projectionMatrix.makePerspective(g,_,y,x,f,m),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(E,b,T):E.projectionMatrix.copy(b.projectionMatrix),null===t?e.matrix.copy(E.matrixWorld):(e.matrix.copy(t.matrixWorld),e.matrix.invert(),e.matrix.multiply(E.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(E.projectionMatrix),e.projectionMatrixInverse.copy(E.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*iN*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)},this.getCamera=function(){return E},this.getFoveation=function(){if(null!==c||null!==d)return o},this.setFoveation=function(e){o=e,null!==c&&(c.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(E)};let P=null,I=new WebGLAnimation;I.setAnimationLoop(function(t,n){if(h=n.getViewerPose(l||a),p=n,null!==h){let t=h.views;null!==d&&(e.setRenderTargetFramebuffer(_,d.framebuffer),e.setRenderTarget(_));let i=!1;t.length!==E.cameras.length&&(E.cameras.length=0,i=!0);for(let r=0;r<t.length;r++){let n=t[r],a=null;if(null!==d)a=d.getViewport(n);else{let t=u.getViewSubImage(c,n);a=t.viewport,0===r&&(e.setRenderTargetTextures(_,t.colorTexture,c.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(_))}let s=A[r];void 0===s&&((s=new PerspectiveCamera).layers.enable(r),s.viewport=new Vector4,A[r]=s),s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(n.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===r&&(E.matrix.copy(s.matrix
5),E.matrix.decompose(E.position,E.quaternion,E.scale)),!0===i&&E.cameras.push(s)}let n=r.enabledFeatures;if(n&&n.includes("depth-sensing")){let i=u.getDepthInformation(t[0]);i&&i.isValid&&i.texture&&f.init(e,i,r.renderState)}}for(let e=0;e<y.length;e++){let t=x[e],i=y[e];null!==t&&void 0!==i&&i.update(t,n,l||a)}P&&P(t,n),n.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:n}),p=null}),this.setAnimationLoop=function(e){P=e},this.dispose=function(){}}};let n3=new Euler,n2=new Matrix4;function WebGLMaterials(e,t){function refreshTransformUniform(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function refreshUniformsCommon(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,refreshTransformUniform(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,refreshTransformUniform(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,refreshTransformUniform(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,i.side===M&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,refreshTransformUniform(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),i.side===M&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,refreshTransformUniform(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,refreshTransformUniform(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,refreshTransformUniform(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);let r=t.get(i),n=r.envMap,a=r.envMapRotation;n&&(e.envMap.value=n,n3.copy(a),n3.x*=-1,n3.y*=-1,n3.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(n3.y*=-1,n3.z*=-1),e.envMapRotation.value.setFromMatrix4(n2.makeRotationFromEuler(n3)),e.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,refreshTransformUniform(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,refreshTransformUniform(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,getUnlitUniformColorSpace(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,i,r,n,a){i.isMeshBasicMaterial?refreshUniformsCommon(e,i):i.isMeshLambertMaterial?refreshUniformsCommon(e,i):i.isMeshToonMaterial?(refreshUniformsCommon(e,i),i.gradientMap&&(e.gradientMap.value=i.gradientMap)):i.isMeshPhongMaterial?(refreshUniformsCommon(e,i),e.specular.value.copy(i.specular),e.shininess.value=Math.max(i.shininess,1e-4)):i.isMeshStandardMaterial?(refreshUniformsCommon(e,i),e.metalness.value=i.metalness,i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap,refreshTransformUniform(i.metalnessMap,e.metalnessMapTransform)),e.roughness.value=i.roughness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap,refreshTransformUniform(i.roughnessMap,e.roughnessMapTransform)),i.envMap&&(e.envMapIntensity.value=i.envMapIntensity),i.isMeshPhysicalMaterial&&(e.ior.value=i.ior,i.sheen>0&&(e.sheenColor.value.copy(i.sheenColor).multiplyScalar(i.sheen),e.sheenRoughness.value=i.sheenRoughness,i.sheenColorMap&&(e.sheenColorMap.value=i.sheenColorMap,refreshTransformUniform(i.sheenColorMap,e.sheenColorMapTransform)),i.sheenRoughnessMap&&(e.sheenRoughnessMap.value=i.sheenRoughnessMap,refreshTransformUniform(i.sheenRoughnessMap,e.sheenRoughnessMapTransform))),i.clearcoat>0&&(e.clearcoat.value=i.clearcoat,e.clearcoatRoughness.value=i.clearcoatRoughness,i.clearcoatMap&&(e.clearcoatMap.value=i.clearcoatMap,refreshTransformUniform(i.clearcoatMap,e.clearcoatMapTransform)),i.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=i.clearcoatRoughnessMap,refreshTransformUniform(i.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),i.clearcoatNormalMap&&(e.clearcoatNormalMap.value=i.clearcoatNormalMap,refreshTransformUniform(i.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(i.clearcoatNormalScale),i.side===M&&e.clearcoatNormalScale.value.negate())),i.dispersion>0&&(e.dispersion.value=i.dispersion),i.iridescence>0&&(e.iridescence.value=i.iridescence,e.iridescenceIOR.value=i.iridescenceIOR,e.iridescenceThicknessMinimum.value=i.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=i.iridescenceThicknessRange[1],i.iridescenceMap&&(e.iridescenceMap.value=i.iridescenceMap,refreshTransformUniform(i.iridescenceMap,e.iridescenceMapTransform)),i.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=i.iridescenceThicknessMap,refreshTransformUniform(i.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),i.transmission>0&&(e.transmission.value=i.transmission,e.transmissionSamplerMap.value=a.texture,e.transmissionSamplerSize.value.set(a.width,a.height),i.transmissionMap&&(e.transmissionMap.value=i.transmissionMap,refreshTransformUniform(i.transmissionMap,e.transmissionMapTransform)),e.thickness.value=i.thickness,i.thicknessMap&&(e.thicknessMap.value=i.thicknessMap,refreshTransformUniform(i.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=i.attenuationDistance,e.attenuationColor.value.copy(i.attenuationColor)),i.anisotropy>0&&(e.anisotropyVector.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation)),i.anisotropyMap&&(e.anisotropyMap.value=i.anisotropyMap,refreshTransformUniform(i.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=i.specularIntensity,e.specularColor.value.copy(i.specularColor),i.specularColorMap&&(e.specularColorMap.value=i.specularColorMap,refreshTransformUniform(i.specularColorMap,e.specularColorMapTransform)),i.specularIntensityMap&&(e.specularIntensityMap.value=i.specularIntensityMap,refreshTransformUniform(i.specularIntensityMap,e.specularIntensityMapTransform)))):i.isMeshMat
5capMaterial?(refreshUniformsCommon(e,i),i.matcap&&(e.matcap.value=i.matcap)):i.isMeshDepthMaterial?refreshUniformsCommon(e,i):i.isMeshDistanceMaterial?(refreshUniformsCommon(e,i),function(e,i){let r=t.get(i).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?refreshUniformsCommon(e,i):i.isLineBasicMaterial?(e.diffuse.value.copy(i.color),e.opacity.value=i.opacity,i.map&&(e.map.value=i.map,refreshTransformUniform(i.map,e.mapTransform)),i.isLineDashedMaterial&&(e.dashSize.value=i.dashSize,e.totalSize.value=i.dashSize+i.gapSize,e.scale.value=i.scale)):i.isPointsMaterial?(e.diffuse.value.copy(i.color),e.opacity.value=i.opacity,e.size.value=i.size*r,e.scale.value=.5*n,i.map&&(e.map.value=i.map,refreshTransformUniform(i.map,e.uvTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,refreshTransformUniform(i.alphaMap,e.alphaMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest)):i.isSpriteMaterial?(e.diffuse.value.copy(i.color),e.opacity.value=i.opacity,e.rotation.value=i.rotation,i.map&&(e.map.value=i.map,refreshTransformUniform(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,refreshTransformUniform(i.alphaMap,e.alphaMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest)):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(e,t,i,r){let n={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function getUniformSize(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function onUniformsGroupsDispose(t){let i=t.target;i.removeEventListener("dispose",onUniformsGroupsDispose);let r=s.indexOf(i.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(n[i.id]),delete n[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;r.uniformBlockBinding(e,i)},update:function(i,l){let h=n[i.id];void 0===h&&(function(e){let t=e.uniforms,i=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=n.length;e<r;e++){let r=n[e],a=getUniformSize(r),s=i%16,o=s%a.boundary,l=s+o;i+=o,0!==l&&16-l<a.storage&&(i+=16-l),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=a.storage}}}let r=i%16;r>0&&(i+=16-r),e.__size=i,e.__cache={}}(i),h=function(t){let i=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=i;let r=e.createBuffer(),n=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,n,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,i,r),r}(i),n[i.id]=h,i.addEventListener("dispose",onUniformsGroupsDispose));let u=l.program;r.updateUBOMapping(i,u);let c=t.render.frame;a[i.id]!==c&&(function(t){let i=n[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=r.length;t<i;t++){let i=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,n=i.length;r<n;r++){let n=i[r];if(!0===function(e,t,i,r){let n=e.value,a=t+"_"+i;if(void 0===r[a])return"number"==typeof n||"boolean"==typeof n?r[a]=n:r[a]=n.clone(),!0;{let e=r[a];if("number"==typeof n||"boolean"==typeof n){if(e!==n)return r[a]=n,!0}else if(!1===e.equals(n))return e.copy(n),!0}return!1}(n,t,r,a)){let t=n.__offset,i=Array.isArray(n.value)?n.value:[n.value],r=0;for(let a=0;a<i.length;a++){let s=i[a],o=getUniformSize(s);"number"==typeof s||"boolean"==typeof s?(n.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+r,n.__data)):s.isMatrix3?(n.__data[0]=s.elements[0],n.__data[1]=s.elements[1],n.__data[2]=s.elements[2],n.__data[3]=0,n.__data[4]=s.elements[3],n.__data[5]=s.elements[4],n.__data[6]=s.elements[5],n.__data[7]=0,n.__data[8]=s.elements[6],n.__data[9]=s.elements[7],n.__data[10]=s.elements[8],n.__data[11]=0):(s.toArray(n.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,n.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),a[i.id]=c)},dispose:function(){for(let t in n)e.deleteBuffer(n[t]);s=[],n={},a={}}}}let WebGLRenderer=class WebGLRenderer{get coordinateSystem(){return iL}get outputColorSpace(){return this._outputColorSpace}
5set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===tJ?"display-p3":"srgb",t.unpackColorSpace=iW.workingColorSpace===tQ?"display-p3":"srgb"}constructor(e={}){let t,i,r,n,a,s,o,h,u,c,d,p,f,m,g,_,y,b,T,A,E,w,C,R,L;let{canvas:P=createCanvasElement(),context:I=null,depth:U=!0,stencil:D=!1,alpha:N=!1,antialias:B=!1,premultipliedAlpha:O=!0,preserveDrawingBuffer:F=!1,powerPreference:V="default",failIfMajorPerformanceCaveat:z=!1}=e;if(this.isWebGLRenderer=!0,null!==I){if("undefined"!=typeof WebGLRenderingContext&&I instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=I.getContextAttributes().alpha}else t=N;let G=new Uint32Array(4),k=new Int32Array(4),H=null,W=null,X=[],j=[];this.domElement=P,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace
5=tK,this.toneMapping=es,this.toneMappingExposure=1;let q=this,Y=!1,K=0,Z=0,J=null,Q=-1,$=null,ee=new Vector4,et=new Vector4,ei=null,er=new Color(0),en=0,ea=P.width,eo=P.height,el=1,eh=null,eu=null,ec=new Vector4(0,0,ea,eo),ed=new Vector4(0,0,ea,eo),ep=!1,ef=new Frustum,em=!1,eg=!1,ev=new Matrix4,e_=new Vector3,ey=new Vector4,ex={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},eM=!1;function getTargetPixelRatio(){return null===J?el:1}let eS=I;function getContext(e,t){return P.getContext(e,t)}try{if("setAttribute"in P&&P.setAttribute("data-engine","three.js r".concat(l)),P.addEventListener("webglcontextlost",onContextLost,!1),P.addEventListener("webglcontextrestored",onContextRestore,!1),P.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===eS){let e="webgl2";if(eS=getContext(e,{alpha:!0,depth:U,stencil:D,antialias:B,premultipliedAlpha:O,preserveDrawingBuffer:F,powerPreference:V,failIfMajorPerformanceCaveat:z}),null===eS){if(getContext(e))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function initGLContext(){(i=new WebGLExtensions(eS)).init(),C=new WebGLUtils(eS,i),r=new WebGLCapabilities(eS,i,e,C),n=new WebGLState(eS),a=new WebGLInfo(eS),s=new WebGLProperties,o=new WebGLTextures(eS,i,n,s,r,C,a),h=new WebGLCubeMaps(q),u=new WebGLCubeUVMaps(q),c=new WebGLAttributes(eS),R=new WebGLBindingStates(eS,c),d=new WebGLGeometries(eS,c,a,R),p=new WebGLObjects(eS,d,c,a),A=new WebGLMorphtargets(eS,r,o),y=new WebGLClipping(s),f=new WebGLPrograms(q,h,u,i,r,R,y),m=new WebGLMaterials(q,s),g=new WebGLRenderLists,_=new WebGLRenderStates(i),T=new WebGLBackground(q,h,u,n,p,t,O),b=new WebGLShadowMap(q,p,r),L=new WebGLUniformsGroups(eS,a,r,n),E=new WebGLBufferRenderer(eS,i,a),w=new WebGLIndexedBufferRenderer(eS,i,a),a.programs=f.programs,q.capabilities=r,q.extensions=i,q.properties=s,q.renderLists=g,q.shadowMap=b,q.state=n,q.info=a}initGLContext();let eb=new WebXRManager(q,eS);function onContextLost(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),Y=!0}function onContextRestore(){console.log("THREE.WebGLRenderer: Context Restored."),Y=!1;let e=a.autoReset,t=b.enabled,i=b.autoUpdate,r=b.needsUpdate,n=b.type;initGLContext(),a.autoReset=e,b.enabled=t,b.autoUpdate=i,b.needsUpdate=r,b.type=n}function onContextCreationError(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function onMaterialDispose(e){let t=e.target;t.removeEventListener("dispose",onMaterialDispose),function(e){let t=s.get(e).programs;void 0!==t&&(t.forEach(function(e){f.releaseProgram(e)}),e.isShaderMaterial&&f.releaseShaderCache(e))}(t),s.remove(t)}function prepareMaterial(e,t,i){!0===e.transparent&&e.side===S&&!1===e.forceSinglePass?(e.side=M,e.needsUpdate=!0,getProgram(e,t,i),e.side=x,e.needsUpdate=!0,getProgram(e,t,i),e.side=S):getProgram(e,t,i)}this.xr=eb,this.getContext=function(){return eS},this.getContextAttributes=function(){return eS.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return el},this.setPixelRatio=function(e){void 0!==e&&(el=e,this.setSize(ea,eo,!1))},this.getSize=function(e){return e.set(ea,eo)},this.setSize=function(e,t){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(eb.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ea=e,eo=t,P.width=Math.floor(e*el),P.height=Math.floor(t*el),!0===i&&(P.style.width=e+"px",P.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(ea*el,eo*el).floor()},this.setDrawingBufferSize=function(e,t,i){ea=e,eo=t,el=i,P.width=Math.floor(e*i),P.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(ec)},this.setViewport=function(e,t,i,r){e.isVector4?ec.set(e.x,e.y,e.z,e.w):ec.set(e,t,i,r),n.viewport(ee.copy(ec).multiplyScalar(el).round())}
5,this.getScissor=function(e){return e.copy(ed)},this.setScissor=function(e,t,i,r){e.isVector4?ed.set(e.x,e.y,e.z,e.w):ed.set(e,t,i,r),n.scissor(et.copy(ed).multiplyScalar(el).round())},this.getScissorTest=function(){return ep},this.setScissorTest=function(e){n.setScissorTest(ep=e)},this.setOpaqueSort=function(e){eh=e},this.setTransparentSort=function(e){eu=e},this.getClearColor=function(e){return e.copy(T.getClearColor())},this.setClearColor=function(){T.setClearColor.apply(T,arguments)},this.getClearAlpha=function(){return T.getClearAlpha()},this.setClearAlpha=function(){T.setClearAlpha.apply(T,arguments)},this.clear=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=0;if(e){let e=!1;if(null!==J){let t=J.texture.format;e=t===e5||t===e2||t===e1}if(e){let e=J.texture.type,t=e===eN||e===ez||e===eF||e===eX||e===eH||e===eW,i=T.getClearColor(),r=T.getClearAlpha(),n=i.r,a=i.g,s=i.b;t?(G[0]=n,G[1]=a,G[2]=s,G[3]=r,eS.clearBufferuiv(eS.COLOR,0,G)):(k[0]=n,k[1]=a,k[2]=s,k[3]=r,eS.clearBufferiv(eS.COLOR,0,k))}else r|=eS.COLOR_BUFFER_BIT}t&&(r|=eS.DEPTH_BUFFER_BIT),i&&(r|=eS.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),eS.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){P.removeEventListener("webglcontextlost",onContextLost,!1),P.removeEventListener("webglcontextrestored",onContextRestore,!1),P.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),g.dispose(),_.dispose(),s.dispose(),h.dispose(),u.dispose(),p.dispose(),R.dispose(),L.dispose(),f.dispose(),eb.dispose(),eb.removeEventListener("sessionstart",onXRSessionStart),eb.removeEventListener("sessionend",onXRSessionEnd),eA.stop()},this.renderBufferDirect=function(e,t,a,l,p,f){let g;null===t&&(t=ex);let _=p.isMesh&&0>p.matrixWorld.determinant(),x=function(e,t,i,a,l){var c;!0!==t.isScene&&(t=ex),o.resetTextureUnits();let d=t.fog,p=a.isMeshStandardMaterial?t.environment:null,f=null===J?q.outputColorSpace:!0===J.isXRRenderTarget?J.texture.colorSpace:tZ,g=(a.isMeshStandardMaterial?u:h).get(a.envMap||p),_=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,x=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),M=!!i.morphAttributes.position,S=!!i.morphAttributes.normal,b=!!i.morphAttributes.color,T=es;a.toneMapped&&(null===J||!0===J.isXRRenderTarget)&&(T=q.toneMapping);let E=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,w=void 0!==E?E.length:0,C=s.get(a),R=W.state.lights;if(!0===em&&(!0===eg||e!==$)){let t=e===$&&a.id===Q;y.setState(a,e,t)}let P=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==R.state.version?P=!0:C.outputColorSpace!==f?P=!0:l.isBatchedMesh&&!1===C.batching?P=!0:l.isBatchedMesh||!0!==C.batching?l.isBatchedMesh&&!0===C.batchingColor&&null===l.colorTexture?P=!0:l.isBatchedMesh&&!1===C.batchingColor&&null!==l.colorTexture?P=!0:l.isInstancedMesh&&!1===C.instancing?P=!0:l.isInstancedMesh||!0!==C.instancing?l.isSkinnedMesh&&
5!1===C.skinning?P=!0:l.isSkinnedMesh||!0!==C.skinning?l.isInstancedMesh&&!0===C.instancingColor&&null===l.instanceColor?P=!0:l.isInstancedMesh&&!1===C.instancingColor&&null!==l.instanceColor?P=!0:l.isInstancedMesh&&!0===C.instancingMorph&&null===l.morphTexture?P=!0:l.isInstancedMesh&&!1===C.instancingMorph&&null!==l.morphTexture?P=!0:C.envMap!==g?P=!0:!0===a.fog&&C.fog!==d?P=!0:void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==y.numPlanes||C.numIntersection!==y.numIntersection)?P=!0:C.vertexAlphas!==_?P=!0:C.vertexTangents!==x?P=!0:C.morphTargets!==M?P=!0:C.morphNormals!==S?P=!0:C.morphColors!==b?P=!0:C.toneMapping!==T?P=!0:C.morphTargetsCount!==w&&(P=!0):P=!0:P=!0:P=!0:(P=!0,C.__version=a.version);let I=C.currentProgram;!0===P&&(I=getProgram(a,t,l));let U=!1,D=!1,N=!1,B=I.getUniforms(),O=C.uniforms;if(n.useProgram(I.program)&&(U=!0,D=!0,N=!0),a.id!==Q&&(Q=a.id,D=!0),U||$!==e){B.setValue(eS,"projectionMatrix",e.projectionMatrix),B.setValue(eS,"viewMatrix",e.matrixWorldInverse);let t=B.map.cameraPosition;void 0!==t&&t.setValue(eS,e_.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&B.setValue(eS,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&B.setValue(eS,"isOrthographic",!0===e.isOrthographicCamera),$!==e&&($=e,D=!0,N=!0)}if(l.isSkinnedMesh){B.setOptional(eS,l,"bindMatrix"),B.setOptional(eS,l,"bindMatrixInverse");let e=l.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),B.setValue(eS,"boneTexture",e.boneTexture,o))}l.isBatchedMesh&&(B.setOptional(eS,l,"batchingTexture"),B.setValue(eS,"batchingTexture",l._matricesTexture,o),B.setOptional(eS,l,"batchingIdTexture"),B.setValue(eS,"batchingIdTexture",l._indirectTexture,o),B.setOptional(eS,l,"batchingColorTexture"),null!==l._colorsTexture&&B.setValue(eS,"batchingColorTexture",l._colorsTexture,o));let F=i.morphAttributes;if((void 0!==F.position||void 0!==F.normal||void 0!==F.color)&&A.update(l,i,I),(D||C.receiveShadow!==l.receiveShadow)&&(C.receiveShadow=l.receiveShadow,B.setValue(eS,"receiveShadow",l.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(O.envMap.value=g,O.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(O.envMapIntensity.value=t.environmentIntensity),D&&(B.setValue(eS,"toneMappingExposure",q.toneMappingExposure),C.needsLights&&(c=N,O.ambientLightColor.needsUpdate=c,O.lightProbe.needsUpdate=c,O.directionalLights.needsUpdate=c,O.directionalLightShadows.needsUpdate=c,O.pointLights.needsUpdate=c,O.pointLightShadows.needsUpdate=c,O.spotLights.needsUpdate=c,O.spotLightShadows.needsUpdate=c,O.rectAreaLights.needsUpdate=c,O.hemisphereLights.needsUpdate=c),d&&!0===a.fog&&m.refreshFogUniforms(O,d),m.refreshMaterialUniforms(O,a,el,eo,W.state.transmissionRenderTarget[e.id]),WebGLUniforms.upload(eS,getUniformList(C),O,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(WebGLUniforms.upload(eS,getUniformList(C),O,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&B.setValue(eS,"center",l.center),B.setValue(eS,"modelViewMatrix",l.modelViewMatrix),B.setValue(eS,"normalMatrix",l.normalMatrix),B.setValue(eS,"modelMatrix",l.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t<i;t++){let i=e[t];L.update(i,I),L.bind(i,I)}}return I}(e,t,a,l,p);n.setMaterial(l,_);let M=a.index,S=1;if(!0===l.wireframe){if(void 0===(M=d.getWireframeAttribute(a)))return;S=2}let b=a.drawRange,T=a.attributes.position,C=b.start*S,P=(b.start+b.count)*S;null!==f&&(C=Math.max(C,f.start*S),P=Math.min(P,(f.start+f.count)*S)),null!==M?(C=Math.max(C,0),P=Math.min(P,M.count)):null!=T&&(C=Math.max(C,0),P=Math.min(P,T.count));let I=P-C;if(I<0||I===1/0)return;R.setup(p,l,x,a,M);let U=E;if(null!==M&&(g=c.get(M),(U=w).setIndex(g)),p.isMesh)!0===l.wireframe?(n.setLineWidth(l.wireframeLinewidth*getTargetPixelRatio()),U.setMode(eS.LINES)):U.setMode(eS.TRIANGLES);else if(p.isLine){let e=l.linewidth;void 0===e&&(e=1),n.setLineWidth(e*getTargetPixelRatio()),p.isLineSegments?U.setMode(eS.LINES):p.isLine
5Loop?U.setMode(eS.LINE_LOOP):U.setMode(eS.LINE_STRIP)}else p.isPoints?U.setMode(eS.POINTS):p.isSprite&&U.setMode(eS.TRIANGLES);if(p.isBatchedMesh){if(null!==p._multiDrawInstances)U.renderMultiDrawInstances(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount,p._multiDrawInstances);else if(i.get("WEBGL_multi_draw"))U.renderMultiDraw(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount);else{let e=p._multiDrawStarts,t=p._multiDrawCounts,i=p._multiDrawCount,r=M?c.get(M).bytesPerElement:1,n=s.get(l).currentProgram.getUniforms();for(let a=0;a<i;a++)n.setValue(eS,"_gl_DrawID",a),U.render(e[a]/r,t[a])}}else if(p.isInstancedMesh)U.renderInstances(C,I,p.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);U.renderInstances(C,I,t)}else U.render(C,I)},this.compile=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null===i&&(i=e),(W=_.get(i)).init(t),j.push(W),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),W.setupLights();let r=new Set;return e.traverse(function(e){let t=e.material;if(t){if(Array.isArray(t))for(let n=0;n<t.length;n++){let a=t[n];prepareMaterial(a,i,e),r.add(a)}else prepareMaterial(t,i,e),r.add(t)}}),j.pop(),W=null,r},this.compileAsync=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=this.compile(e,t,r);return new Promise(t=>{function checkMaterialsReady(){if(n.forEach(function(e){let t=s.get(e),i=t.currentProgram;i.isReady()&&n.delete(e)}),0===n.size){t(e);return}setTimeout(checkMaterialsReady,10)}null!==i.get("KHR_parallel_shader_compile")?checkMaterialsReady():setTimeout(checkMaterialsReady,10)})};let eT=null;function onXRSessionStart(){eA.stop()}function onXRSessionEnd(){eA.start()}let eA=new WebGLAnimation;function projectObject(e,t,i,r){if(!1===e.visible)return;let n=e.layers.test(t.layers);if(n){if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)W.pushLight(e),e.castShadow&&W.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ef.intersectsSprite(e)){r&&ey.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ev);let t=p.update(e),n=e.material;n.visible&&H.push(e,t,n,i,ey.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ef.intersectsObject(e))){let t=p.update(e),n=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ey.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ey.copy(t.boundingSphere.center)),ey.applyMatrix4(e.matrixWorld).applyMatrix4(ev)),Array.isArray(n)){let r=t.groups;for(let a=0,s=r.length;a<s;a++){let s=r[a],o=n[s.materialIndex];o&&o.visible&&H.push(e,t,o,i,ey.z,s)}}else n.visible&&H.push(e,t,n,i,ey.z,null)}}let a=e.children;for(let e=0,n=a.length;e<n;e++)projectObject(a[e],t,i,r)}
5function renderScene(e,t,i,r){let a=e.opaque,s=e.transmissive,o=e.transparent;W.setupLightsView(i),!0===em&&y.setGlobalState(q.clippingPlanes,i),r&&n.viewport(ee.copy(r)),a.length>0&&renderObjects(a,t,i),s.length>0&&renderObjects(s,t,i),o.length>0&&renderObjects(o,t,i),n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),n.setPolygonOffset(!1)}function renderTransmissionPass(e,t,r,n){let a=!0===r.isScene?r.overrideMaterial:null;if(null!==a)return;void 0===W.state.transmissionRenderTarget[n.id]&&(W.state.transmissionRenderTarget[n.id]=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float")?ek:eN,minFilter:eU,samples:4,stencilBuffer:D,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:iW.workingColorSpace}));let s=W.state.transmissionRenderTarget[n.id],l=n.viewport||ee;s.setSize(l.z,l.w);let h=q.getRenderTarget();q.setRenderTarget(s),q.getClearColor(er),(en=q.getClearAlpha())<1&&q.setClearColor(16777215,.5),q.clear(),eM&&T.render(r);let u=q.toneMapping;q.toneMapping=es;let c=n.viewport;if(void 0!==n.viewport&&(n.viewport=void 0),W.setupLightsView(n),!0===em&&y.setGlobalState(q.clippingPlanes,n),renderObjects(e,r,n),o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s),!1===i.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,a=t.length;i<a;i++){let a=t[i],s=a.object,o=a.geometry,l=a.material,h=a.group;if(l.side===S&&s.layers.test(n.layers)){let t=l.side;l.side=M,l.needsUpdate=!0,renderObject(s,r,n,o,l,h),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s))}q.setRenderTarget(h),q.setClearColor(er,en),void 0!==c&&(n.viewport=c),q.toneMapping=u}function renderObjects(e,t,i){let r=!0===t.isScene?t.overrideMaterial:null;for(let n=0,a=e.length;n<a;n++){let a=e[n],s=a.object,o=a.geometry,l=null===r?a.material:r,h=a.group;s.layers.test(i.layers)&&renderObject(s,t,i,o,l,h)}}function renderObject(e,t,i,r,n,a){e.onBeforeRender(q,t,i,r,n,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),!0===n.transparent&&n.side===S&&!1===n.forceSinglePass?(n.side=M,n.needsUpdate=!0,q.renderBufferDirect(i,t,r,n,e,a),n.side=x,n.needsUpdate=!0,q.renderBufferDirect(i,t,r,n,e,a),n.side=S):q.renderBufferDirect(i,t,r,n,e,a),e.onAfterRender(q,t,i,r,n,a)}function getProgram(e,t,i){!0!==t.isScene&&(t=ex);let r=s.get(e),n=W.state.lights,a=W.state.shadowsArray,o=n.state.version,l=f.getParameters(e,n.state,a,t,i),c=f.getProgramCacheKey(l),d=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?u:h).get(e.envMap||r.environment),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===d&&(e.addEventListener("dispose",onMaterialDispose),d=new Map,r.programs=d);let p=d.get(c);if(void 0!==p){if(r.currentProgram===p&&r.lightsStateVersion===o)return updateCommonMaterialProperties(e,l),p}else l.uniforms=f.getUniforms(e),e.onBeforeCompile(l,q),p=f.acquireProgram(l,c),d.set(c,p),r.uniforms=l.uniforms;let m=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(m.clippingPlanes=y.uniform),updateCommonMaterialProperties(e,l),r.needsLights=e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights,r.lightsStateVersion=o,r.needsLights&&(m.ambientLightColor.value=n.state.ambient,m.lightProbe.value=n.state.probe,m.directionalLights.value=n.state.directional,m.directionalLightShadows.value=n.state.directionalShadow,m.spotLights.value=n.state.spot,m.spotLightShadows.value=n.state.spotShadow,m.rectAreaLights.value=n.state.rectArea,m.ltc_1.value=n.state.rectAreaLTC1,m.ltc_2.value=n.state.rectAreaLTC2,m.pointLights.value=n.state.point,m.pointLightShadows.value=n.state.pointShadow,m.hemisphereLights.value=n.state.hemi,m.directionalShadowMap.value=n.state.directionalShadowMap,m.directionalShadowMatrix.value=n.state.directionalShadowMatrix,m.spotShadowMap.value=n.state.spotShadowMap,m.spotLightMatrix.value=n.state.spotLightMatrix,m.spotLightMap.value=n.state.spotLightMap,m.pointShadowMap.value=n.state.pointShadowMap,m.pointShadowMatrix.value=n.state.pointShadowMatrix),r.currentProgram=p,r.uniformsList=null,p}function getUniformList(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=WebGLUniforms.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function updateCommonMaterialProperties(e,t){let i=s.get(e);
5i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.batchingColor=t.batchingColor,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eA.setAnimationLoop(function(e){eT&&eT(e)}),"undefined"!=typeof self&&eA.setContext(self),this.setAnimationLoop=function(e){eT=e,eb.setAnimationLoop(e),null===e?eA.stop():eA.start()},eb.addEventListener("sessionstart",onXRSessionStart),eb.addEventListener("sessionend",onXRSessionEnd),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===Y)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eb.enabled&&!0===eb.isPresenting&&(!0===eb.cameraAutoUpdate&&eb.updateCamera(t),t=eb.getCamera()),!0===e.isScene&&e.onBeforeRender(q,e,t,J),(W=_.get(e,j.length)).init(t),j.push(W),ev.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ef.setFromProjectionMatrix(ev),eg=this.localClippingEnabled,em=y.init(this.clippingPlanes,eg),(H=g.get(e,X.length)).init(),X.push(H),!0===eb.enabled&&!0===eb.isPresenting){let e=q.xr.getDepthSensingMesh();null!==e&&projectObject(e,t,-1/0,q.sortObjects)}projectObject(e,t,0,q.sortObjects),H.finish(),!0===q.sortObjects&&H.sort(eh,eu),(eM=!1===eb.enabled||!1===eb.isPresenting||!1===eb.hasDepthSensing())&&T.addToRenderList(H,e),this.info.render.frame++,!0===em&&y.beginShadows();let i=W.state.shadowsArray;b.render(i,e,t),!0===em&&y.endShadows(),!0===this.info.autoReset&&this.info.reset();let r=H.opaque,n=H.transmissive;if(W.setupLights(),t.isArrayCamera){let i=t.cameras;if(n.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];renderTransmissionPass(r,n,e,a)}eM&&T.render(e);for(let t=0,r=i.length;t<r;t++){let r=i[t];renderScene(H,e,r,r.viewport)}}else n.length>0&&renderTransmissionPass(r,n,e,t),eM&&T.render(e),renderScene(H,e,t);null!==J&&(o.updateMultisampleRenderTarget(J),o.updateRenderTargetMipmap(J)),!0===e.isScene&&e.onAfterRender(q,e,t),R.resetDefaultState(),Q=-1,$=null,j.pop(),j.length>0?(W=j[j.length-1],!0===em&&y.setGlobalState(q.clippingPlanes,W.state.camera)):W=null,X.pop(),H=X.length>0?X[X.length-1]:null},this.getActiveCubeFace=function(){return K},this.getActiveMipmapLevel=function(){return Z},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(e,t,r){s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=r;let n=s.get(e);n.__hasExternalTextures=!0,n.__autoAllocateDepthBuffer=void 0===r,n.__autoAllocateDepthBuffer||!0!==i.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){let i=s.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;J=e,K=t,Z=i;let r=!0,a=null,l=!1,h=!1;if(e){let u=s.get(e);void 0!==u.__useDefaultFramebuffer?(n.bindFramebuffer(eS.FRAMEBUFFER,null),r=!1):void 0===u.__webglFramebuffer?o.setupRenderTarget(e):u.__hasExternalTextures&&o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(h=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][i]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[i]:d,ee.copy(e.viewport),et.copy(e.scissor),ei=e.scissorTest}else ee.copy(ec).multiplyScalar(el).floor(),et.copy(ed).multiplyScalar(el).floor(),ei=ep;let u=n.bindFramebuffer(eS.FRAMEBUFFER,a);if(u&&r&&n.drawBuffers(e,a),n.viewport(ee),n.scissor(et),n.setScissorTest(ei),l){let r=s.get(e.texture);eS.framebufferTexture2D(eS.FRAMEBUFFER,eS.COLOR_ATTACHMENT0,eS.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,i)}else if(h){let r=s.get(e.texture),n=t||0;eS.framebufferTextureLayer(eS.FRAMEBUFFER,eS.COLOR_ATTACHMENT0,r.__webglTexture,i||0,n)}Q=-1},this.readRenderTargetPixels=function(e,t,i,a,o,l,h){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let u=s.get(e).__webglFramebuffer;
5if(e.isWebGLCubeRenderTarget&&void 0!==h&&(u=u[h]),u){n.bindFramebuffer(eS.FRAMEBUFFER,u);try{let n=e.texture,s=n.format,h=n.type;if(!r.textureFormatReadable(s)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!r.textureTypeReadable(h)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o&&eS.readPixels(t,i,a,o,C.convert(s),C.convert(h),l)}finally{let e=null!==J?s.get(J).__webglFramebuffer:null;n.bindFramebuffer(eS.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,o,l,h){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let u=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(u=u[h]),u){n.bindFramebuffer(eS.FRAMEBUFFER,u);try{let n=e.texture,s=n.format,h=n.type;if(!r.textureFormatReadable(s))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(h))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o){var c;let e=eS.createBuffer();eS.bindBuffer(eS.PIXEL_PACK_BUFFER,e),eS.bufferData(eS.PIXEL_PACK_BUFFER,l.byteLength,eS.STREAM_READ),eS.readPixels(t,i,a,o,C.convert(s),C.convert(h),0),eS.flush();let r=eS.fenceSync(eS.SYNC_GPU_COMMANDS_COMPLETE,0);await (c=eS,new Promise(function(e,t){setTimeout(function probe(){switch(c.clientWaitSync(r,c.SYNC_FLUSH_COMMANDS_BIT,0)){case c.WAIT_FAILED:t();break;case c.TIMEOUT_EXPIRED:setTimeout(probe,4);break;default:e()}},4)}));try{eS.bindBuffer(eS.PIXEL_PACK_BUFFER,e),eS.getBufferSubData(eS.PIXEL_PACK_BUFFER,0,l)}finally{eS.deleteBuffer(e),eS.deleteSync(r)}return l}}finally{let e=null!==J?s.get(J).__webglFramebuffer:null;n.bindFramebuffer(eS.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!0!==e.isTexture&&(warnOnce("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);let r=Math.pow(2,-i),a=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),l=null!==t?t.x:0,h=null!==t?t.y:0;o.setTexture2D(e,0),eS.copyTexSubImage2D(eS.TEXTURE_2D,i,0,0,l,h,a,s),n.unbindTexture()},this.copyTextureToTexture=function(e,t){let i,r,a,s,l,h,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;!0!==e.isTexture&&(warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed."),c=arguments[0]||null,e=arguments[1],t=arguments[2],d=arguments[3]||0,u=null),null!==u?(i=u.max.x-u.min.x,r=u.max.y-u.min.y,a=u.min.x,s=u.min.y):(i=e.image.width,r=e.image.height,a=0,s=0),null!==c?(l=c.x,h=c.y):(l=0,h=0);let p=C.convert(t.format),f=C.convert(t.type);o.setTexture2D(t,0),eS.pixelStorei(eS.UNPACK_FLIP_Y_WEBGL,t.flipY),eS.pixelStorei(eS.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eS.pixelStorei(eS.UNPACK_ALIGNMENT,t.unpackAlignment);let m=eS.getParameter(eS.UNPACK_ROW_LENGTH),g=eS.getParameter(eS.UNPACK_IMAGE_HEIGHT),_=eS.getParameter(eS.UNPACK_SKIP_PIXELS),y=eS.getParameter(eS.UNPACK_SKIP_ROWS),x=eS.getParameter(eS.UNPACK_SKIP_IMAGES),M=e.isCompressedTexture?e.mipmaps[d]:e.image;eS.pixelStorei(eS.UNPACK_ROW_LENGTH,M.width),eS.pixelStorei(eS.UNPACK_IMAGE_HEIGHT,M.height),eS.pixelStorei(eS.UNPACK_SKIP_PIXELS,a),eS.pixelStorei(eS.UNPACK_SKIP_ROWS,s),e.isDataTexture?eS.texSubImage2D(eS.TEXTURE_2D,d,l,h,i,r,p,f,M.data):e.isCompressedTexture?eS.compressedTexSubImage2D(eS.TEXTURE_2D,d,l,h,M.width,M.height,p,M.data):eS.texSubImage2D(eS.TEXTURE_2D,d,l,h,i,r,p,f,M),eS.pixelStorei(eS.UNPACK_ROW_LENGTH,m),eS.pixelStorei(eS.UNPACK_IMAGE_HEIGHT,g),eS.pixelStorei(eS.UNPACK_SKIP_PIXELS,_),eS.pixelStorei(eS.UNPACK_SKIP_ROWS,y),eS.pixelStorei(eS.UNPACK_SKIP_IMAGES,x),0===d&&t.generateMipmaps&&eS.generateMipmap(eS.TEXTURE_2D),n.unbindTexture()},this.copyTextureToTexture3D=function(e,t){let i,r,a,s,l,h,u,c,d,p,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,m=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,g=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;!0!==e.isTexture&&(warnOnce("WebGLRenderer: copyTextureToTexture3D function signature has changed."),f=arguments[0]||null,m=arguments[1]||null,e=arguments[2],t=arguments[3],g=arguments[4]||0);let _=e.isCompressedTexture?e.mipmaps[g]:e.image;null!==f?(i=f.max.x-f.min.x,r=f.max.y-f.min.y,a=f.max.z-f.min.z,s=f.min.x,l=f.min.y,h=f.min.z):(i=_.width,r=_.height,a=_.depth,s=0,l=0,h=0),null!==m?(u=m.x,c=m.y,d=m.z):(u=0,c=0,d=0);let y=C.convert(t.format),x=C.convert(t.type);if(t.isData3DTexture)o.setTexture3D(t,0),p=eS.TEXTURE_3D;else if(t.isDataArrayTexture||t.isCompressedArrayTexture)o.setTexture2DArray(t,0),p=eS.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}eS.pixelStorei(eS.UNPACK_FLIP_Y_WEBGL,t.flipY),eS.pixelStorei(eS.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eS.pixelStorei(eS.UNPACK_ALIGNMENT,t.unpackAlignment);let M=eS.getParameter(eS.UNPACK_ROW_LENGTH),S=eS.getParameter(eS.UNPACK_IMAGE_HEIGHT),b=eS.getParameter(eS.UNPACK_SKIP_PIXELS),T=eS.getParameter(eS.UNPACK_SKIP_ROWS),A=eS.getParameter(eS.UNPACK_SKIP_IMAGES);eS.pixelStorei(eS.UNPACK_ROW_LENGTH,_.width),eS.pixelStorei(eS.UNPACK_IMAGE_HEIGHT,_.height),eS.pixelStorei(eS.UNPACK_SKIP_PIXELS,s),eS.pixelStorei(eS.UNPACK_SKIP_ROWS,l),eS.pixelStorei(eS.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?eS.texSubImage3D(p,g,u,c,d,i,r,a,y,x,_.data):t.isCompressedArrayTexture?eS.compressedTexSubImage3D(p,g,u,c,d,i,r,a,y,_.data):eS.texSubImage3D(p,g,u,c,d,i,r,a,y,x,_),eS.pixelStorei(eS.UNPACK_ROW_LENGTH,M),eS.pixelStorei(eS.UNPACK_IMAGE_HEIGHT,S),eS.pixelStorei(eS.UNPACK_SKIP_PIXELS,b),eS.pixelStorei(eS.UNPACK_SKIP_ROWS,T),eS.pixelStorei(eS.UNPACK_SKIP_IMAGES,A),0===g&&t.generateMipmaps&&eS.generateMipmap(p),n.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),n.unbindTexture()},this.resetState=function(){K=0,Z=0,J=null,n.reset(),R.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};let FogExp2=class FogExp2{clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color(e),this.density=t}};let Fog=class Fog{clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Color(e),this.near=t,this.far=i}};let Scene=class Scene extends Object3D{copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};let InterleavedBuffer=class InterleavedBuffer{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return warnOnce("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this}set(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=iy,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID()}};let n4=new Vector3;let InterleavedBufferAttribute=class InterleavedBufferAttribute{get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)n4.fromBufferAttribute(this,t),n4.applyMatrix4(e),this.setXYZ(t,n4.x,n4.y,n4.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)n4.fromBufferAttribute(this,t),n4.applyNormalMatrix(e),this.setXYZ(t,n4.x,n4.y,n4.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)n4.fromBufferAttribute(this,t),n4.transformDirection(e),this.setXYZ(t,n4.x,n4.y,n4.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=denormalize(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=normalize(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=denormalize(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=denormalize(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=denormalize(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=denormalize(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),i=normalize(i,this.array),r=normalize(r,this.array),n=normalize(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new InterleavedBufferAttribute(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return new BufferAttribute(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}};let SpriteMaterial=class SpriteMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}};
5let n5=new Vector3,n6=new Vector3,n8=new Vector3,n9=new Vector2,n7=new Vector2,ae=new Matrix4,at=new Vector3,ai=new Vector3,ar=new Vector3,an=new Vector2,aa=new Vector2,as=new Vector2;let Sprite=class Sprite extends Object3D{raycast(e,t){let i,r;null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),n6.setFromMatrixScale(this.matrixWorld),ae.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),n8.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&n6.multiplyScalar(-n8.z);let n=this.material.rotation;0!==n&&(r=Math.cos(n),i=Math.sin(n));let a=this.center;transformVertex(at.set(-.5,-.5,0),n8,a,n6,i,r),transformVertex(ai.set(.5,-.5,0),n8,a,n6,i,r),transformVertex(ar.set(.5,.5,0),n8,a,n6,i,r),an.set(0,0),aa.set(1,0),as.set(1,1);let s=e.ray.intersectTriangle(at,ai,ar,!1,n5);if(null===s&&(transformVertex(ai.set(-.5,.5,0),n8,a,n6,i,r),aa.set(0,1),null===(s=e.ray.intersectTriangle(at,ar,ai,!1,n5))))return;let o=e.ray.origin.distanceTo(n5);o<e.near||o>e.far||t.push({distance:o,point:n5.clone(),uv:Triangle.getInterpolation(n5,at,ai,ar,an,aa,as,new Vector2),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}constructor(e=new SpriteMaterial){if(super(),this.isSprite=!0,this.type="Sprite",void 0===n){n=new BufferGeometry;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new InterleavedBuffer(e,5);n.setIndex([0,1,2,0,2,3]),n.setAttribute("position",new InterleavedBufferAttribute(t,3,0,!1)),n.setAttribute("uv",new InterleavedBufferAttribute(t,2,3,!1))}this.geometry=n,this.material=e,this.center=new Vector2(.5,.5)}};function transformVertex(e,t,i,r,n,a){n9.subVectors(e,i).addScalar(.5).multiply(r),void 0!==n?(n7.x=a*n9.x-n*n9.y,n7.y=n*n9.x+a*n9.y):n7.copy(n9),e.copy(t),e.x+=n7.x,e.y+=n7.y,e.applyMatrix4(ae)}let ao=new Vector3,al=new Vector3;let LOD=class LOD extends Object3D{copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,i=t.length;e<i;e++){let i=t[e];this.addLevel(i.object.clone(),i.distance,i.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;i=Math.abs(i);let n=this.levels;for(t=0;t<n.length&&!(i<n[t].distance);t++);return n.splice(t,0,{distance:i,hysteresis:r,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let r=t[i].distance;if(t[i].object.visible&&(r-=r*t[i].hysteresis),e<r)break}return t[i-1].object}return null}raycast(e,t){let i=this.levels;if(i.length>0){ao.setFromMatrixPosition(this.matrixWorld);let i=e.ray.origin.distanceTo(ao);this.getObjectForDistance(i).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let i,r;ao.setFromMatrixPosition(e.matrixWorld),al.setFromMatrixPosition(this.matrixWorld);let n=ao.distanceTo(al)/e.zoom;for(i=1,t[0].object.visible=!0,r=t.length;i<r;i++){let e=t[i].distance;if(t[i].object.visible&&(e-=e*t[i].hysteresis),n>=e)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){let t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];let i=this.levels;for(let e=0,r=i.length;e<r;e++){let r=i[e];t.object.levels.push({object:r.object.uuid,distance:r.distance,hysteresis:r.hysteresis})}return t}constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}};let ah=new Vector3,au=new Vector4,ac=new Vector4,ad=new Vector3,ap=new Matrix4,af=new Vector3,am=new Sphere,ag=new Matrix4,av=new Ray;let SkinnedMesh=class SkinnedMesh extends Mesh{computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Box3),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,af),this.boundingBox.expandByPoint(af)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Sphere),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,af),this.boundingSphere.expandByPoint(af)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&
5(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let i=this.material,r=this.matrixWorld;if(void 0!==i&&(null===this.boundingSphere&&this.computeBoundingSphere(),am.copy(this.boundingSphere),am.applyMatrix4(r),!1!==e.ray.intersectsSphere(am))){if(ag.copy(r).invert(),av.copy(e.ray).applyMatrix4(ag),null!==this.boundingBox&&!1===av.intersectsBox(this.boundingBox))return;this._computeIntersections(e,t,av)}}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Vector4,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ef?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===em?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,r=this.geometry;au.fromBufferAttribute(r.attributes.skinIndex,e),ac.fromBufferAttribute(r.attributes.skinWeight,e),ah.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=ac.getComponent(e);if(0!==r){let n=au.getComponent(e);ap.multiplyMatrices(i.bones[n].matrixWorld,i.boneInverses[n]),t.addScaledVector(ad.copy(ah).applyMatrix4(ap),r)}}return t.applyMatrix4(this.bindMatrixInverse)}constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ef,this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4,this.boundingBox=null,this.boundingSphere=null}};let Bone=class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}};let DataTexture=class DataTexture extends Texture{constructor(e=null,t=1,i=1,r,n,a,s,o,l=eA,h=eA,u,c){super(null,a,s,o,l,h,r,n,u,c),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};let a_=new Matrix4,ay=new Matrix4;let Skeleton=class Skeleton{init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new Matrix4;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let r=0,n=e.length;r<n;r++){let n=e[r]?e[r].matrixWorld:ay;a_.multiplyMatrices(n,t[r]),a_.toArray(i,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=Math.max(e=4*Math.ceil(e/4),4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new DataTexture(t,e,e,eK,eG);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){let r=e.bones[i],n=t[r];void 0===n&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),n=new Bone),this.bones.push(n),this.boneInverses.push(new Matrix4().fromArray(e.boneInverses[i])
5)}return this.init(),this}toJSON(){let e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let r=0,n=t.length;r<n;r++){let n=t[r];e.bones.push(n.uuid);let a=i[r];e.boneInverses.push(a.toArray())}return e}constructor(e=[],t=[]){this.uuid=generateUUID(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}};let InstancedBufferAttribute=class InstancedBufferAttribute extends BufferAttribute{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}};let ax=new Matrix4,aM=new Matrix4,aS=[],ab=new Box3,aT=new Matrix4,aA=new Mesh,aE=new Sphere;let InstancedMesh=class InstancedMesh extends Mesh{computeBoundingBox(){let e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Box3),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,ax),ab.copy(e.boundingBox).applyMatrix4(ax),this.boundingBox.union(ab)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Sphere),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,ax),aE.copy(e.boundingSphere).applyMatrix4(ax),this.boundingSphere.union(aE)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,n=i.length+1,a=e*n+1;for(let e=0;e<i.length;e++)i[e]=r[a+e]}raycast(e,t){let i=this.matrixWorld,r=this.count;if(aA.geometry=this.geometry,aA.material=this.material,void 0!==aA.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),aE.copy(this.boundingSphere),aE.applyMatrix4(i),!1!==e.ray.intersectsSphere(aE)))for(let n=0;n<r;n++){this.getMatrixAt(n,ax),aM.multiplyMatrices(i,ax),aA.matrixWorld=aM,aA.raycast(e,aS);for(let e=0,i=aS.length;e<i;e++){let i=aS[e];i.instanceId=n,i.object=this,t.push(i)}aS.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){let i=t.morphTargetInfluences,r=i.length+1;null===this.morphTexture&&(this.morphTexture=new DataTexture(new Float32Array(r*this.count),r,this.count,e0,eG));let n=this.morphTexture.source.data.data,a=0;for(let e=0;e<i.length;e++)a+=i[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=r*e;n[o]=s,n.set(i,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<i;e++)this.setMatrixAt(e,aT)}};function sortOpaque(e,t){return e.z-t.z}
5function sortTransparent(e,t){return t.z-e.z}let aw=new Matrix4,aC=new Matrix4,aR=new Matrix4,aL=new Color(1,1,1),aP=new Matrix4,aI=new Frustum,aU=new Box3,aD=new Sphere,aN=new Vector3,aB=new Vector3,aO=new Vector3,aF=new class{push(e,t,i){let r=this.pool,n=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=e.start,a.count=e.count,a.z=t,a.index=i}reset(){this.list.length=0,this.index=0}constructor(){this.index=0,this.pool=[],this.list=[]}},aV=new Mesh,az=[];let BatchedMesh=class BatchedMesh extends Mesh{get maxInstanceCount(){return this._maxInstanceCount}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=Math.max(e=4*Math.ceil(e/4),4);let t=new Float32Array(e*e*4),i=new DataTexture(t,e,e,eK,eG);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new Uint32Array(e*e),i=new DataTexture(t,e,e,e1,ez);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxIndexCount);e=Math.ceil(e);let t=new Float32Array(e*e*4).fill(1),i=new DataTexture(t,e,e,eK,eG);
5i.colorSpace=iW.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){let t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(!1===this._geometryInitialized){for(let r in e.attributes){let n=e.getAttribute(r),{array:a,itemSize:s,normalized:o}=n,l=new a.constructor(i*s),h=new BufferAttribute(l,s,o);t.setAttribute(r,h)}if(null!==e.getIndex()){let e=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new BufferAttribute(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('BatchedMesh: All geometries must consistently have "index".');for(let i in t.attributes){if(!e.hasAttribute(i))throw Error('BatchedMesh: Added geometry missing "'.concat(i,'". All geometries must have consistent attributes.'));let r=e.getAttribute(i),n=t.getAttribute(i);if(r.itemSize!==n.itemSize||r.normalized!==n.normalized)throw Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);let e=this._geometryCount,t=this.boundingBox,i=this._drawInfo;t.makeEmpty();for(let r=0;r<e;r++){if(!1===i[r].active)continue;let e=i[r].geometryIndex;this.getMatrixAt(r,aw),this.getBoundingBoxAt(e,aU).applyMatrix4(aw),t.union(aU)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Sphere);let e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(!1===t[i].active)continue;let r=t[i].geometryIndex;this.getMatrixAt(i,aw),this.getBoundingSphereAt(r,aD).applyMatrix4(aw),e.union(aD)}}addInstance(e){if(this._drawInfo.length>=this._maxInstanceCount)throw Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:e});let t=this._drawInfo.length-1,i=this._matricesTexture,r=i.image.data;aR.toArray(r,16*t),i.needsUpdate=!0;let n=this._colorsTexture;return n&&(aL.toArray(n.image.data,4*t),n.needsUpdate=!0),t}addGeometry(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw Error("BatchedMesh: Maximum item count reached.");let r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1},n=null,a=this._reservedRanges,s=this._drawRanges,o=this._bounds;0!==this._geometryCount&&(n=a[a.length-1]),-1===t?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,null===n?r.vertexStart=0:r.vertexStart=n.vertexStart+n.vertexCount;let l=e.getIndex(),h=null!==l;if(h&&(-1===i?r.indexCount=l.count:r.indexCount=i,null===n?r.indexStart=0:r.indexStart=n.indexStart+n.indexCount),-1!==r.indexStart&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u=this._geometryCount;return this._geometryCount++,a.push(r),s.push({start:h?r.indexStart:r.vertexStart,count:-1}),o.push({boxInitialized:!1,box:new Box3,sphereInitialized:!1,sphere:new Sphere}),this.setGeometryAt(u,e),u}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let i=this.geometry,r=null!==i.getIndex(),n=i.getIndex(),a=t.getIndex(),s=this._reservedRanges[e];if(r&&a.count>s.indexCount||t.attributes.position.count>s.vertexCount)throw Error("BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.vertexCount;for(let e in i.attributes){let r=t.getAttribute(e),n=i.getAttribute(e);!function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let n=e.count;for(let a=0;a<n;a++)for(let n=0;n<r;n++)t.setComponent(a+i,n,e.getComponent(a,n))}else t.array.set(e.array,i*r);t.needsUpdate=!0}(r,n,o);let a=r.itemSize;for(let e=r.count;e<l;e++){let t=o+e;for(let e=0;e<a;e++)n.setComponent(t,e,0)}n.needsUpdate=!0,n.addUpdateRange(o*a,l*a)}if(r){let e=s.indexStart;for(let t=0;t<a.count;t++)n.setX(e+t,o+a.getX(t));for(let t=a.count,i=s.indexCount;t<i;t++)n.setX(e+t,o);n.needsUpdate=!0,n.addUpdateRange(e,s.indexCount)}let h=this._bounds[e];
5null!==t.boundingBox?(h.box.copy(t.boundingBox),h.boxInitialized=!0):h.boxInitialized=!1,null!==t.boundingSphere?(h.sphere.copy(t.boundingSphere),h.sphereInitialized=!0):h.sphereInitialized=!1;let u=this._drawRanges[e],c=t.getAttribute("position");return u.count=r?a.count:c.count,this._visibilityChanged=!0,e}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let i=this._bounds[e],r=i.box,n=this.geometry;if(!1===i.boxInitialized){r.makeEmpty();let t=n.index,a=n.attributes.position,s=this._drawRanges[e];for(let e=s.start,i=s.start+s.count;e<i;e++){let i=e;t&&(i=t.getX(i)),r.expandByPoint(aN.fromBufferAttribute(a,i))}i.boxInitialized=!0}return t.copy(r),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let i=this._bounds[e],r=i.sphere,n=this.geometry;if(!1===i.sphereInitialized){r.makeEmpty(),this.getBoundingBoxAt(e,aU),aU.getCenter(r.center);let t=n.index,a=n.attributes.position,s=this._drawRanges[e],o=0;for(let e=s.start,i=s.start+s.count;e<i;e++){let i=e;t&&(i=t.getX(i)),aN.fromBufferAttribute(a,i),o=Math.max(o,r.center.distanceToSquared(aN))}r.radius=Math.sqrt(o),i.sphereInitialized=!0}return t.copy(r),t}setMatrixAt(e,t){let i=this._drawInfo,r=this._matricesTexture,n=this._matricesTexture.image.data;return e>=i.length||!1===i[e].active||(t.toArray(n,16*e),r.needsUpdate=!0),this}getMatrixAt(e,t){let i=this._drawInfo,r=this._matricesTexture.image.data;return e>=i.length||!1===i[e].active?null:t.fromArray(r,16*e)}setColorAt(e,t){null===this._colorsTexture&&this._initColorsTexture();let i=this._colorsTexture,r=this._colorsTexture.image.data,n=this._drawInfo;return e>=n.length||!1===n[e].active||(t.toArray(r,4*e),i.needsUpdate=!0),this}getColorAt(e,t){let i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||!1===r[e].active?null:t.fromArray(i,4*e)}setVisibleAt(e,t){let i=this._drawInfo;return e>=i.length||!1===i[e].active||i[e].visible===t||(i[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){let t=this._drawInfo;return!(e>=t.length)&&!1!==t[e].active&&t[e].visible}raycast(e,t){let i=this._drawInfo,r=this._drawRanges,n=this.matrixWorld,a=this.geometry;aV.material=this.material,aV.geometry.index=a.index,aV.geometry.attributes=a.attributes,null===aV.geometry.boundingBox&&(aV.geometry.boundingBox=new Box3),null===aV.geometry.boundingSphere&&(aV.geometry.boundingSphere=new Sphere);for(let a=0,s=i.length;a<s;a++){if(!i[a].visible||!i[a].active)continue;let s=i[a].geometryIndex,o=r[s];aV.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(a,aV.matrixWorld).premultiply(n),this.getBoundingBoxAt(s,aV.geometry.boundingBox),this.getBoundingSphereAt(s,aV.geometry.boundingSphere),aV.raycast(e,az);for(let e=0,i=az.length;e<i;e++){let i=az[e];i.object=this,i.batchId=a,t.push(i)}az.length=0}aV.material=null,aV.geometry.index=null,aV.geometry.attributes={},aV.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(e=>({...e})),this._reservedRanges=e._reservedRanges.map(e=>({...e})),this._drawInfo=e._drawInfo.map(e=>({...e})),this._bounds=e._bounds.map(e=>({boxInitialized:e.boxInitialized,box:e.box.clone(),sphereInitialized:e.sphereInitialized,sphere:e.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,i,r,n){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=this._drawInfo,l=this._multiDrawStarts,h=this._multiDrawCounts,u=this._drawRanges,c=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;c&&(aP.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),aI.setFromProjectionMatrix(aP,e.coordinateSystem));let f=0;if(this.sortObjects){aC.copy(this.matrixWorld).invert(),aN.setFromMatrixPosition(i.matrixWorld).applyMatrix4(aC),aB.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(aC);for(let e=0,t=o.length;e<t;e++)if(o[e].visible&&o[e].active){let t=o[e].geometryIndex;this.getMatrixAt(e,aw),this.getBoundingSphereAt(t,aD).applyMatrix4(aw);let i=!1;if(c&&(i=!aI.intersectsSphere(aD)),!i){let i=aO.subVectors(aD.center,aN).dot(aB);aF.push(u[t],i,e)}}let e=aF.list,t=this.customSort;null===t?e.sort(n.transparent?sortTransparent:sortOpaque):t.call(this,e,i);for(let t=0,i=e.length;t<i;t++){let i=e[t];l[f]=i.start*s,h[f]=i.count,p[f]=i.index,f++}aF.reset()}else for(let e=0,t=o.length;e<t;e++)if(o[e].visible&&o[e].active){let t=o[e].geometryIndex,i=!1;if(c&&(this.getMatrixAt(e,aw),this.getBoundingSphereAt(t,aD).applyMatrix4(aw),i=!aI.intersectsSphere(aD)),!i){let i=u[t];l[f]=i.start*s,h[f]=i.count,p[f]=e,f++}}d.needsUpdate=!0,this._multiDrawCount=f,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,n,a){this.onBeforeRender(e,null,r,n,a)}constructor(e,t,i=2*t,r){super(new BufferGeometry,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}};let LineBasicMaterial=class LineBasicMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}};let aG=new Vector3,ak=new Vector3,aH=new Matrix4,aW=new Ray,aX=new Sphere,aj=new Vector3,aq=new Vector3;let Line=class Line extends Object3D{copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,r=t.count;e<r;e++)aG.fromBufferAttribute(t,e-1),ak.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=aG.distanceTo(ak);e.setAttribute("lineDistance",new Float32BufferAttribute(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),aX.copy(i.boundingSphere),aX.applyMatrix4(r),aX.radius+=n,!1===e.ray.intersectsSphere(aX))return;aH.copy(r).invert(),aW.copy(e.ray).applyMatrix4(aH);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,h=i.index,u=i.attributes,c=u.position;if(null!==h){let i=Math.max(0,a.start),r=Math.min(h.count,a.start+a.count);for(let n=i,a=r-1;n<a;n+=l){let i=h.getX(n),r=h.getX(n+1),a=checkIntersection(this,e,aW,o,i,r);a&&t.push(a)}if(this.isLineLoop){let n=h.getX(r-1),a=h.getX(i),s=checkIntersection(this,e,aW,o,n,a);
5s&&t.push(s)}}else{let i=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);for(let n=i,a=r-1;n<a;n+=l){let i=checkIntersection(this,e,aW,o,n,n+1);i&&t.push(i)}if(this.isLineLoop){let n=checkIntersection(this,e,aW,o,r-1,i);n&&t.push(n)}}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let e=t[i[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,i=e.length;t<i;t++){let i=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}}constructor(e=new BufferGeometry,t=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}};function checkIntersection(e,t,i,r,n,a){let s=e.geometry.attributes.position;aG.fromBufferAttribute(s,n),ak.fromBufferAttribute(s,a);let o=i.distanceSqToSegment(aG,ak,aj,aq);if(o>r)return;aj.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(aj);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:aq.clone().applyMatrix4(e.matrixWorld),index:n,face:null,faceIndex:null,object:e}}let aY=new Vector3,aK=new Vector3;let LineSegments=class LineSegments extends Line{computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,r=t.count;e<r;e+=2)aY.fromBufferAttribute(t,e),aK.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+aY.distanceTo(aK);e.setAttribute("lineDistance",new Float32BufferAttribute(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}};let LineLoop=class LineLoop extends Line{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}};let PointsMaterial=class PointsMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}};let aZ=new Matrix4,aJ=new Ray,aQ=new Sphere,a$=new Vector3;let Points=class Points extends Object3D{copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),aQ.copy(i.boundingSphere),aQ.applyMatrix4(r),aQ.radius+=n,!1===e.ray.intersectsSphere(aQ))return;aZ.copy(r).invert(),aJ.copy(e.ray).applyMatrix4(aZ);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=i.index,h=i.attributes,u=h.position;if(null!==l){let i=Math.max(0,a.start),n=Math.min(l.count,a.start+a.count);for(let a=i;a<n;a++){let i=l.getX(a);a$.fromBufferAttribute(u,i),testPoint(a$,i,o,r,e,t,this)}}else{let i=Math.max(0,a.start),n=Math.min(u.count,a.start+a.count);for(let a=i;a<n;a++)a$.fromBufferAttribute(u,a),testPoint(a$,a,o,r,e,t,this)}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let e=t[i[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,i=e.length;t<i;t++){let i=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}}constructor(e=new BufferGeometry,t=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}};function testPoint(e,t,i,r,n,a,s){let o=aJ.distanceSqToPoint(e);if(o<i){let i=new Vector3;aJ.closestPointToPoint(e,i),i.applyMatrix4(r);let l=n.ray.origin.distanceTo(i);if(l<n.near||l>n.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:t,face:null,object:s})}}let VideoTexture=class VideoTexture extends Texture{clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}constructor(e,t,i,r,n,a,s,o,l){super(e,t,i,r,n,a,s,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==a?a:eL,this.magFilter=void 0!==n?n:eL,this.generateMipmaps=!1;let h=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function updateVideo(){h.needsUpdate=!0,e.requestVideoFrameCallback(updateVideo)})}};let FramebufferTexture=class FramebufferTexture extends Texture{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=eA,this.minFilter=eA,this.generateMipmaps=!1,this.needsUpdate=!0}};let CompressedTexture=class CompressedTexture extends Texture{constructor(e,t,i,r,n,a,s,o,l,h,u,c){super(null,a,s,o,l,h,r,n,u,c),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};let CompressedArrayTexture=class CompressedArrayTexture extends CompressedTexture{addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}constructor(e,t,i,r,n,a){super(e,t,i,n,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=eb,this.layerUpdates=new Set}};let CompressedCubeTexture=class CompressedCubeTexture extends CompressedTexture{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,ev),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}};let CanvasTexture=class CanvasTexture extends Texture{constructor(e,t,i,r,n,a,s,o,l){super(e,t,i,r,n,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}};let Curve=class Curve{getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;
5if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,r=this.getPoint(0),n=0;t.push(0);for(let a=1;a<=e;a++)t.push(n+=(i=this.getPoint(a/e)).distanceTo(r)),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i;let r=this.getLengths(),n=0,a=r.length;i=t||e*r[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=r[n=Math.floor(s+(o-s)/2)]-i)<0)s=n+1;else if(l>0)o=n-1;else{o=n;break}if(r[n=o]===i)return n/(a-1);let h=r[n],u=r[n+1],c=(n+(i-h)/(u-h))/(a-1);return c}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let n=this.getPoint(i),a=this.getPoint(r),s=t||(n.isVector2?new Vector2:new Vector3);return s.copy(a).sub(n).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new Vector3,r=[],n=[],a=[],s=new Vector3,o=new Matrix4;for(let t=0;t<=e;t++){let i=t/e;r[t]=this.getTangentAt(i,new Vector3)}n[0]=new Vector3,a[0]=new Vector3;let l=Number.MAX_VALUE,h=Math.abs(r[0].x),u=Math.abs(r[0].y),c=Math.abs(r[0].z);h<=l&&(l=h,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),c<=l&&i.set(0,0,1),s.crossVectors(r[0],i).normalize(),n[0].crossVectors(r[0],s),a[0].crossVectors(r[0],n[0]);for(let t=1;t<=e;t++){if(n[t]=n[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(clamp(r[t-1].dot(r[t]),-1,1));n[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(r[t],n[t])}if(!0===t){let t=Math.acos(clamp(n[0].dot(n[e]),-1,1));t/=e,r[0].dot(s.crossVectors(n[0],n[e]))>0&&(t=-t);for(let i=1;i<=e;i++)n[i].applyMatrix4(o.makeRotationAxis(r[i],t*i)),a[i].crossVectors(r[i],n[i])}return{tangents:r,normals:n,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}constructor(){this.type="Curve",this.arcLengthDivisions=200}};let EllipseCurve=class EllipseCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,n=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=n?0:i),!0!==this.aClockwise||n||(r===i?r=-i:r-=i);let a=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,r=o-this.aY;s=i*e-r*t+this.aX,o=i*t+r*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}constructor(e=0,t=0,i=1,r=1,n=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}};let ArcCurve=class ArcCurve extends EllipseCurve{constructor(e,t,i,r,n,a){super(e,t,i,i,r,n,a),this.isArcCurve=!0,this.type="ArcCurve"}};function CubicPoly(){let e=0,t=0,i=0,r=0;function init(n,a,s,o){e=n,t=s,i=-3*n+3*a-2*s-o,r=2*n-2*a+s+o}return{initCatmullRom:function(e,t,i,r,n){init(t,i,n*(i-e),n*(r-t))},initNonuniformCatmullRom:function(e,t,i,r,n,a,s){let o=(t-e)/n-(i-e)/(n+a)+(i-t)/a,l=(i-t)/a-(r-t)/(a+s)+(r-i)/s;init(t,i,o*=a,l*=a)},calc:function(n){let a=n*n;return e+t*n+i*a+r*(a*n)}}}let a0=new Vector3,a1=new CubicPoly,a3=new CubicPoly,a2=new CubicPoly;let CatmullRomCurve3=class CatmullRomCurve3 extends Curve{getPoint(e){let t,i,r=arguments.length>
51&&void 0!==arguments[1]?arguments[1]:new Vector3,n=this.points,a=n.length,s=(a-(this.closed?0:1))*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?t=n[(o-1)%a]:(a0.subVectors(n[0],n[1]).add(n[0]),t=a0);let h=n[o%a],u=n[(o+1)%a];if(this.closed||o+2<a?i=n[(o+2)%a]:(a0.subVectors(n[a-1],n[a-2]).add(n[a-1]),i=a0),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,r=Math.pow(t.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(u),e),a=Math.pow(u.distanceToSquared(i),e);n<1e-4&&(n=1),r<1e-4&&(r=n),a<1e-4&&(a=n),a1.initNonuniformCatmullRom(t.x,h.x,u.x,i.x,r,n,a),a3.initNonuniformCatmullRom(t.y,h.y,u.y,i.y,r,n,a),a2.initNonuniformCatmullRom(t.z,h.z,u.z,i.z,r,n,a)}else"catmullrom"===this.curveType&&(a1.initCatmullRom(t.x,h.x,u.x,i.x,this.tension),a3.initCatmullRom(t.y,h.y,u.y,i.y,this.tension),a2.initCatmullRom(t.z,h.z,u.z,i.z,this.tension));return r.set(a1.calc(l),a3.calc(l),a2.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new Vector3().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}};function CatmullRom(e,t,i,r,n){let a=(r-t)*.5,s=(n-i)*.5,o=e*e;return(2*i-2*r+a+s)*(e*o)+(-3*i+3*r-2*a-s)*o+a*e+i}function QuadraticBezier(e,t,i,r){return function(e,t){let i=1-e;return i*i*t}(e,t)+2*(1-e)*e*i+e*e*r}function CubicBezier(e,t,i,r,n){return function(e,t){let i=1-e;return i*i*i*t}(e,t)+function(e,t){let i=1-e;return 3*i*i*e*t}(e,i)+3*(1-e)*e*e*r+e*e*e*n}let CubicBezierCurve=class CubicBezierCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,i=this.v0,r=this.v1,n=this.v2,a=this.v3;
5return t.set(CubicBezier(e,i.x,r.x,n.x,a.x),CubicBezier(e,i.y,r.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new Vector2,t=new Vector2,i=new Vector2,r=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}};let CubicBezierCurve3=class CubicBezierCurve3 extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3,i=this.v0,r=this.v1,n=this.v2,a=this.v3;return t.set(CubicBezier(e,i.x,r.x,n.x,a.x),CubicBezier(e,i.y,r.y,n.y,a.y),CubicBezier(e,i.z,r.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new Vector3,t=new Vector3,i=new Vector3,r=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}};let LineCurve=class LineCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector2,t=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}};let LineCurve3=class LineCurve3 extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector3,t=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}};let QuadraticBezierCurve=class QuadraticBezierCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,i=this.v0,r=this.v1,n=this.v2;return t.set(QuadraticBezier(e,i.x,r.x,n.x),QuadraticBezier(e,i.y,r.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector2,t=new Vector2,i=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}};let QuadraticBezierCurve3=class QuadraticBezierCurve3 extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3,i=this.v0,r=this.v1,n=this.v2;return t.set(QuadraticBezier(e,i.x,r.x,n.x),QuadraticBezier(e,i.y,r.y,n.y),QuadraticBezier(e,i.z,r.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector3,t=new Vector3,i=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}
5};let SplineCurve=class SplineCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,i=this.points,r=(i.length-1)*e,n=Math.floor(r),a=r-n,s=i[0===n?n:n-1],o=i[n],l=i[n>i.length-2?i.length-1:n+1],h=i[n>i.length-3?i.length-1:n+2];return t.set(CatmullRom(a,s.x,o.x,l.x,h.x),CatmullRom(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new Vector2().fromArray(i))}return this}constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}};var a4=Object.freeze({__proto__:null,ArcCurve:ArcCurve,CatmullRomCurve3:CatmullRomCurve3,CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:CubicBezierCurve3,EllipseCurve:EllipseCurve,LineCurve:LineCurve,LineCurve3:LineCurve3,QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,SplineCurve:SplineCurve});let CurvePath=class CurvePath extends Curve{add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new a4[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),n=0;for(;n<r.length;){if(r[n]>=i){let e=r[n]-i,a=this.curves[n],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)e.push(t+=this.curves[i].getLength());return this.cacheLengths=e,e}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,i=[];for(let r=0,n=this.curves;r<n.length;r++){let a=n[r],s=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isS
5plineCurve?t*a.points.length:t,o=a.getPoints(s);for(let t=0;t<o.length;t++){let r=o[t];e&&e.equals(r)||(i.push(r),e=r)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(new a4[i.type]().fromJSON(i))}return this}constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}};let Path=class Path extends CurvePath{setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new LineCurve(this.currentPoint.clone(),new Vector2(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let n=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(i,r));return this.curves.push(n),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,n,a){let s=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(i,r),new Vector2(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new SplineCurve(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,n,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,i,r,n,a),this}absarc(e,t,i,r,n,a){return this.absellipse(e,t,i,i,r,n,a),this}ellipse(e,t,i,r,n,a,s,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,r,n,a,s,o),this}absellipse(e,t,i,r,n,a,s,o){let l=new EllipseCurve(e,t,i,r,n,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}constructor(e){super(),this.type="Path",this.currentPoint=new Vector2,e&&this.setFromPoints(e)}};let LatheGeometry=class LatheGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new LatheGeometry(e.points,e.segments,e.phiStart,e.phiLength)}constructor(e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],t=12,i=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=clamp(r,0,2*Math.PI);let n=[],a=[],s=[],o=[],l=[],h=1/t,u=new Vector3,c=new Vector2,d=new Vector3,p=new Vector3,f=new Vector3,m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let n=0;n<=t;n++){let d=i+n*h*r,p=Math.sin(d),f=Math.cos(d);for(let i=0;i<=e.length-1;i++){u.x=e[i].x*p,u.y=e[i].y,u.z=e[i].x*f,a.push(u.x,u.y,u.z),c.x=n/t,c.y=i/(e.length-1),s.push(c.x,c.y);let r=o[3*i+0]*p,h=o[3*i+1],d=o[3*i+0]*f;l.push(r,h,d)}}for(let i=0;i<t;i++)for(let t=0;t<e.length-1;t++){let r=t+i*e.length,a=r+e.length,s=r+e.length+1,o=r+1;n.push(r,a,o),n.push(s,o,a)}this.setIndex(n),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("uv",new Float32BufferAttribute(s,2)),this.setAttribute("normal",new Float32BufferAttribute(l,3))}};let CapsuleGeometry=class CapsuleGeometry extends LatheGeometry{static fromJSON(e){return new CapsuleGeometry(e.radius,e.length,e.capSegments,e.radialSegments)}constructor(e=1,t=1,i=4,r=8){let n=new Path;n.absarc(0,-t/2,e,1.5*Math.PI,0),n.absarc(0,t/2,e,0,.5*Math.PI),super(n.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radiu
5s:e,length:t,capSegments:i,radialSegments:r}}};let CircleGeometry=class CircleGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CircleGeometry(e.radius,e.segments,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,i=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);let n=[],a=[],s=[],o=[],l=new Vector3,h=new Vector2;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let n=0,u=3;n<=t;n++,u+=3){let c=i+n/t*r;l.x=e*Math.cos(c),l.y=e*Math.sin(c),a.push(l.x,l.y,l.z),s.push(0,0,1),h.x=(a[u]/e+1)/2,h.y=(a[u+1]/e+1)/2,o.push(h.x,h.y)}for(let e=1;e<=t;e++)n.push(e,e+1,0);this.setIndex(n),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("normal",new Float32BufferAttribute(s,3)),this.setAttribute("uv",new Float32BufferAttribute(o,2))}};let CylinderGeometry=class CylinderGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,i=1,r=32,n=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:n,openEnded:a,thetaStart:s,thetaLength:o};let l=this;r=Math.floor(r),n=Math.floor(n);let h=[],u=[],c=[],d=[],p=0,f=[],m=i/2,g=0;function generateCap(i){let n=p,a=new Vector2,f=new Vector3,_=0,y=!0===i?e:t,x=!0===i?1:-1;for(let e=1;e<=r;e++)u.push(0,m*x,0),c.push(0,x,0),d.push(.5,.5),p++;let M=p;for(let e=0;e<=r;e++){let t=e/r,i=t*o+s,n=Math.cos(i),l=Math.sin(i);f.x=y*l,f.y=m*x,f.z=y*n,u.push(f.x,f.y,f.z),c.push(0,x,0),a.x=.5*n+.5,a.y=.5*l*x+.5,d.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=n+e,r=M+e;!0===i?h.push(r,r+1,t):h.push(r+1,r,t),_+=3}l.addGroup(g,_,!0===i?1:2),g+=_}(function(){let a=new Vector3,_=new Vector3,y=0,x=(t-e)/i;for(let l=0;l<=n;l++){let h=[],g=l/n,y=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,n=t*o+s,l=Math.sin(n),f=Math.cos(n);_.x=y*l,_.y=-g*i+m,_.z=y*f,u.push(_.x,_.y,_.z),a.set(l,x,f).normalize(),c.push(a.x,a.y,a.z),d.push(t,1-g),h.push(p++)}f.push(h)}for(let e=0;e<r;e++)for(let t=0;t<n;t++){let i=f[t][e],r=f[t+1][e],n=f[t+1][e+1],a=f[t][e+1];h.push(i,r,a),h.push(r,n,a),y+=6}l.addGroup(g,y,0),g+=y})(),!1===a&&(e>0&&generateCap(!0),t>0&&generateCap(!1)),this.setIndex(h),this.setAttribute("position",new Float32BufferAttribute(u,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2))}};let ConeGeometry=class ConeGeometry extends CylinderGeometry{static fromJSON(e){return new ConeGeometry(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,i=32,r=1,n=!1,a=0,s=2*Math.PI){super(0,e,t,i,r,n,a,s),this.type="C
5oneGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:s}}};let PolyhedronGeometry=class PolyhedronGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PolyhedronGeometry(e.vertices,e.indices,e.radius,e.details)}constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};let n=[],a=[];function pushVertex(e){n.push(e.x,e.y,e.z)}function getVertexByIndex(t,i){let r=3*t;i.x=e[r+0],i.y=e[r+1],i.z=e[r+2]}function correctUV(e,t,i,r){r<0&&1===e.x&&(a[t]=e.x-1),0===i.x&&0===i.z&&(a[t]=r/2/Math.PI+.5)}function azimuth(e){return Math.atan2(e.z,-e.x)}(function(e){let i=new Vector3,r=new Vector3,n=new Vector3;for(let a=0;a<t.length;a+=3)getVertexByIndex(t[a+0],i),getVertexByIndex(t[a+1],r),getVertexByIndex(t[a+2],n),function(e,t,i,r){let n=r+1,a=[];for(let r=0;r<=n;r++){a[r]=[];let s=e.clone().lerp(i,r/n),o=t.clone().lerp(i,r/n),l=n-r;for(let e=0;e<=l;e++)0===e&&r===n?a[r][e]=s:a[r][e]=s.clone().lerp(o,e/l)}for(let e=0;e<n;e++)for(let t=0;t<2*(n-e)-1;t++){let i=Math.floor(t/2);t%2==0?(pushVertex(a[e][i+1]),pushVertex(a[e+1][i]),pushVertex(a[e][i])):(pushVertex(a[e][i+1]),pushVertex(a[e+1][i+1]),pushVertex(a[e+1][i]))}}(i,r,n,e)})(r),function(e){let t=new Vector3;for(let i=0;i<n.length;i+=3)t.x=n[i+0],t.y=n[i+1],t.z=n[i+2],t.normalize().multiplyScalar(e),n[i+0]=t.x,n[i+1]=t.y,n[i+2]=t.z}(i),function(){let e=new Vector3;for(let t=0;t<n.length;t+=3){e.x=n[t+0],e.y=n[t+1],e.z=n[t+2];let i=azimuth(e)/2/Math.PI+.5,r=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;a.push(i,1-r)}(function(){let e=new Vector3,t=new Vector3,i=new Vector3,r=new Vector3,s=new Vector2,o=new Vector2,l=new Vector2;for(let h=0,u=0;h<n.length;h+=9,u+=6){e.set(n[h+0],n[h+1],n[h+2]),t.set(n[h+3],n[h+4],n[h+5]),i.set(n[h+6],n[h+7],n[h+8]),s.set(a[u+0],a[u+1]),o.set(a[u+2],a[u+3]),l.set(a[u+4],a[u+5]),r.copy(e).add(t).add(i).divideScalar(3);let c=azimuth(r);correctUV(s,u+0,e,c),correctUV(o,u+2,t,c),correctUV(l,u+4,i,c)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],i=a[e+2],r=a[e+4],n=Math.max(t,i,r),s=Math.min(t,i,r);n>.9&&s<.1&&(t<.2&&(a[e+0]+=1),i<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Float32BufferAttribute(n,3)),this.setAttribute("normal",new Float32BufferAttribute(n.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}};let DodecahedronGeometry=class DodecahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new DodecahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=1/i,n=[-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,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r];super(n,[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,
519,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}};let a5=new Vector3,a6=new Vector3,a8=new Vector3,a9=new Triangle;let EdgesGeometry=class EdgesGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){let i=Math.cos(iD*t),r=e.getIndex(),n=e.getAttribute("position"),a=r?r.count:n.count,s=[0,0,0],o=["a","b","c"],l=[,,,],h={},u=[];for(let e=0;e<a;e+=3){r?(s[0]=r.getX(e),s[1]=r.getX(e+1),s[2]=r.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:a,c}=a9;if(t.fromBufferAttribute(n,s[0]),a.fromBufferAttribute(n,s[1]),c.fromBufferAttribute(n,s[2]),a9.getNormal(a8),l[0]="".concat(Math.round(1e4*t.x),",").concat(Math.round(1e4*t.y),",").concat(Math.round(1e4*t.z)),l[1]="".concat(Math.round(1e4*a.x),",").concat(Math.round(1e4*a.y),",").concat(Math.round(1e4*a.z)),l[2]="".concat(Math.round(1e4*c.x),",").concat(Math.round(1e4*c.y),",").concat(Math.round(1e4*c.z)),l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,r=l[e],n=l[t],a=a9[o[e]],c=a9[o[t]],d="".concat(r,"_").concat(n),p="".concat(n,"_").concat(r);p in h&&h[p]?(a8.dot(h[p].normal)<=i&&(u.push(a.x,a.y,a.z),u.push(c.x,c.y,c.z)),h[p]=null):d in h||(h[d]={index0:s[e],index1:s[t],normal:a8.clone()})}}for(let e in h)if(h[e]){let{index0:t,index1:i}=h[e];a5.fromBufferAttribute(n,t),a6.fromBufferAttribute(n,i),u.push(a5.x,a5.y,a5.z),u.push(a6.x,a6.y,a6.z)}this.setAttribute("position",new Float32BufferAttribute(u,3))}}};let Shape=class Shape extends Path{getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(new Path().fromJSON(i))}return this}constructor(e){super(e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}};let a7={triangulate:function(e,t){let i,r,n,a,s,o,l,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,u=t&&t.length,c=u?t[0]*h:e.length,d=linkedList(e,0,c,h,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,i,r){let n,a,s,o,l;let h=[];for(n=0,a=t.length;n<a;n++)s=t[n]*r,o=n<a-1?t[n+1]*r:e.length,(l=linkedList(e,s,o,r,!1))===l.next&&(l.steiner=!0),h.push(function(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(l));for(h.sort(compareX),n=0;n<h.length;n++)i=function(e,t){let i=function(e,t){let i=t,r=-1/0,n,a=e.x,s=e.y;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){let e=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=a&&e>r&&(r=e,n=i.x<i.next.x?i:i.next,e===a))return n}i=i.next}while(i!==t);if(!n)return null;let o=n,l=n.x,h=n.y,u=1/0,c;i=n;do{var d,p;a>=i.x&&i.x>=l&&a!==i.x&&pointInTriangle(s<h?a:r,s,l,h,s<h?r:a,s,i.x,i.y)&&(c=Math.abs(s-i.y)/(a-i.x),locallyInside(i,e)&&(c<u||c===u&&(i.x>n.x||i.x===n.x&&(d=n,p=i,0>area(d.prev,d,p.prev)&&0>area(p.next,d,d.next))))&&(n=i,u=c)),i=i.next}while(i!==o);return n}(e,t);if(!i)return t;let r=splitPolygon(i,e);return filterPoints(r,r.next),filterPoints(i,i.next)}(h[n],i);return i}(e,t,d,h)),e.length>80*h){i=n=e[0],r=a=e[1];for(let t=h;t<c;t+=h)s=e[t],o=e[t+1],s<i&&(i=s),o<r&&(r=o),s>n&&(n=s),o>a&&(a=o);l=0!==(l=Math.max(n-i,a-r))?32767/l:0}return function earcutLinked(e,t,i,r,n,a,s){if(!e)return;!s&&a&&function(e,t,i,r){let n=e;do 0===n.z&&(n.z=zOrder(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i,r,n,a,s,o,l,h=1;do{for(i=e,e=null,a=null,s=0;i;){for(s++,r=i,o=0,t=0;t<h&&(o++,r=r.nextZ);t++);for(l=h;o>0||l>0&&r;)0!==o&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,l--),a?a.nextZ=n:e
5=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(s>1)}(n)}(e,r,n,a);let o=e,l,h;for(;e.prev!==e.next;){if(l=e.prev,h=e.next,a?function(e,t,i,r){let n=e.prev,a=e.next;if(area(n,e,a)>=0)return!1;let s=n.x,o=e.x,l=a.x,h=n.y,u=e.y,c=a.y,d=s<o?s<l?s:l:o<l?o:l,p=h<u?h<c?h:c:u<c?u:c,f=s>o?s>l?s:l:o>l?o:l,m=h>u?h>c?h:c:u>c?u:c,g=zOrder(d,p,t,i,r),_=zOrder(f,m,t,i,r),y=e.prevZ,x=e.nextZ;for(;y&&y.z>=g&&x&&x.z<=_;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==n&&y!==a&&pointInTriangle(s,h,o,u,l,c,y.x,y.y)&&area(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==n&&x!==a&&pointInTriangle(s,h,o,u,l,c,x.x,x.y)&&area(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=g;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==n&&y!==a&&pointInTriangle(s,h,o,u,l,c,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==n&&x!==a&&pointInTriangle(s,h,o,u,l,c,x.x,x.y)&&area(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}(e,r,n,a):function(e){let t=e.prev,i=e.next;if(area(t,e,i)>=0)return!1;let r=t.x,n=e.x,a=i.x,s=t.y,o=e.y,l=i.y,h=r<n?r<a?r:a:n<a?n:a,u=s<o?s<l?s:l:o<l?o:l,c=r>n?r>a?r:a:n>a?n:a,d=s>o?s>l?s:l:o>l?o:l,p=i.next;for(;p!==t;){if(p.x>=h&&p.x<=c&&p.y>=u&&p.y<=d&&pointInTriangle(r,s,n,o,a,l,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(e)){t.push(l.i/i|0),t.push(e.i/i|0),t.push(h.i/i|0),removeNode(e),e=h.next,o=h.next;continue}if((e=h)===o){s?1===s?earcutLinked(e=function(e,t,i){let r=e;do{let n=r.prev,a=r.next.next;!equals(n,a)&&intersects(n,r,r.next,a)&&locallyInside(n,a)&&locallyInside(a,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),removeNode(r),removeNode(r.next),r=e=a),r=r.next}while(r!==e);return filterPoints(r)}(filterPoints(e),t,i),t,i,r,n,a,2):2===s&&function(e,t,i,r,n,a){let s=e;do{let e=s.next.next;for(;e!==s.prev;){var o,l;if(s.i!==e.i&&(o=s,l=e,o.next.i!==l.i&&o.prev.i!==l.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&intersects(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(o,l)&&(locallyInside(o,l)&&locallyInside(l,o)&&function(e,t){let i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}(o,l)&&(area(o.prev,o,l.prev)||area(o,l.prev,l))||equals(o,l)&&area(o.prev,o,o.next)>0&&area(l.prev,l,l.next)>0))){let o=splitPolygon(s,e);s=filterPoints(s,s.next),o=filterPoints(o,o.next),earcutLinked(s,t,i,r,n,a,0),earcutLinked(o,t,i,r,n,a,0);return}e=e.next}s=s.next}while(s!==e)}(e,t,i,r,n,a):earcutLinked(filterPoints(e),t,i,r,n,a,1);break}}}(d,p,h,i,r,l,0),p}};function linkedList(e,t,i,r,n){let a,s;if(n===function(e,t,i,r){let n=0;for(let a=t,s=i-r;a<i;a+=r)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,i,r)>0)for(a=t;a<i;a+=r)s=insertNode(a,e[a],e[a+1],s);else for(a=i-r;a>=t;a-=r)s=insertNode(a,e[a],e[a+1],s);return s&&equals(s,s.next)&&(removeNode(s),s=s.next),s}function filterPoints(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(equals(i,i.next)||0===area(i.prev,i,i.next))){if(removeNode(i),(i=t=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function compareX(e,t){return e.x-t.x}function zOrder(e,t,i,r,n){return(e=((e=((e=((e=((e=(e-i)*n|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-r)*n|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function pointInTriangle(e,t,i,r,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(i-s)*(t-o)&&(i-s)*(a-o)>=(n-s)*(r-o)}function area(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function equals(e,t){return e.x===t.x&&e.y===t.y}function intersects(e,t,i,r){let n=sign(area(e,t,i)),a=sign(area(e,t,r)),s=sign(area(i,r,e)),o=sign(area(i,r,t));return!!(n!==a&&s!==o||0===n&&onSegment(e,i,t)||0===a&&onSegment(e,r,t)||0===s&&onSegment(i,e,r)||0===o&&onSegment(i,t,r))}function onSegment(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function sign(e){return e>0?1:e<0?-1:0}function locallyInside(e,t){return 0>area(e.prev,e,e.next)?area(e,t,e.next)>=0&&area(e,e.prev,t)>=0:0>area(e,t,e.prev)||0>area(e,e.next,t)}
5function splitPolygon(e,t){let i=new Node(e.i,e.x,e.y),r=new Node(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function insertNode(e,t,i,r){let n=new Node(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}let ShapeUtils=class ShapeUtils{static area(e){let t=e.length,i=0;for(let r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return .5*i}static isClockWise(e){return 0>ShapeUtils.area(e)}static triangulateShape(e,t){let i=[],r=[],n=[];removeDupEndPts(e),addContour(i,e);let a=e.length;t.forEach(removeDupEndPts);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,addContour(i,t[e]);let s=a7.triangulate(i,r);for(let e=0;e<s.length;e+=3)n.push(s.slice(e,e+3));return n}};function removeDupEndPts(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function addContour(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}let ExtrudeGeometry=class ExtrudeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return function(e,t,i){if(i.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];i.shapes.push(r.uuid)}else i.shapes.push(e.uuid);return i.options=Object.assign({},t),void 0!==t.extrudePath&&(i.options.extrudePath=t.extrudePath.toJSON()),i}(t,i,e)}static fromJSON(e,t){let i=[];for(let r=0,n=e.shapes.length;r<n;r++){let n=t[e.shapes[r]];i.push(n)}let r=e.options.extrudePath;return void 0!==r&&(e.options.extrudePath=new a4[r.type]().fromJSON(r)),new ExtrudeGeometry(i,e.options)}constructor(e=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,r=[],n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];!function(e){let a,s,o,l;let h=[],u=void 0!==t.curveSegments?t.curveSegments:12,c=void 0!==t.steps?t.steps:1,d=void 0!==t.depth?t.depth:1,p=void 0===t.bevelEnabled||t.bevelEnabled,f=void 0!==t.bevelThickness?t.bevelThickness:.2,m=void 0!==t.bevelSize?t.bevelSize:f-.1,g=void 0!==t.bevelOffset?t.bevelOffset:0,_=void 0!==t.bevelSegments?t.bevelSegments:3,y=t.extrudePath,x=void 0!==t.UVGenerator?t.UVGenerator:se,M,S=!1;y&&(M=y.getSpacedPoints(c),S=!0,p=!1,a=y.computeFrenetFrames(c,!1),s=new Vector3,o=new Vector3,l=new Vector3),p||(_=0,f=0,m=0,g=0);let b=e.extractPoints(u),T=b.shape,A=b.holes,E=!ShapeUtils.isClockWise(T);if(E){T=T.reverse();for(let e=0,t=A.length;e<t;e++){let t=A[e];ShapeUtils.isClockWise(t)&&(A[e]=t.reverse())}}let w=ShapeUtils.triangulateShape(T,A),C=T;for(let e=0,t=A.length;e<t;e++){let t=A[e];T=T.concat(t)}function scalePt2(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,i)}let R=T.length,L=w.length;function getBevelVec(e,t,i){let r,n,a;let s=e.x-t.x,o=e.y-t.y,l=i.x-e.x,h=i.y-e.y,u=s*s+o*o,c=s*h-o*l;if(Math.abs(c)>Number.EPSILON){let c=Math.sqrt(u),d=Math.sqrt(l*l+h*h),p=t.x-o/c,f=t.y+s/c,m=i.x-h/d,g=i.y+l/d,_=((m-p)*h-(g-f)*l)/(s*h-o*l);r=p+s*_-e.x,n=f+o*_-e.y;let y=r*r+n*n;if(y<=2)return new Vector2(r,n);a=Math.sqrt(y/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(h)&&(e=!0),e?(r=-o,n=s,a=Math.sqrt(u)):(r=s,n=o,a=Math.sqrt(u/2))}return new Vector2(r/a,n/a)}let P=[];for(let e=0,t=C.length,i=t-1,r=e+1;e<t;e++,i++,r++)i===t&&(i=0),r===t&&(r=0),P[e]=getBevelVec(C[e],C[i],C[r]);let I=[],U,D=P.concat();for(let e=0,t=A.length;e<t;e++){let t=A[e];U=[];for(let e=0,i=t.length,r=i-1,n=e+1;e<i;e++,r++,n++)r===i&&(r=0),n===i&&(n=0),U[e]=getBevelVec(t[e],t[r],t[n]);I.push(U),D=D.concat(U)}for(let e=0;e<_;e++){let t=e/_,i=f*Math.cos(t*Math.PI/2),r=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=C.length;e<t;e++){let t=scalePt2(C[e],P[e],r);v(t.x,t.y,-i)}for(let e=0,t=A.length;e<t;e++){let t=A[e];U=I[e];for(let e=0,n=t.length;e<n;e++){let n=scalePt2(t[e],U[e],r);v(n.x,n.y,-i)}}}let N=m+g;for(let e=0;e<R;e++){let t=p?scalePt2(T[e],D[e],N):T[e];S?(o.copy(a.normals[0]).multiplyScalar(t.x),s.copy(a.binormals[0]).multiplyScalar(t.y),l.copy(M[0]).add(o).add(s),v(l.x,l.y,l.z)):v(t.x,t.y,0)}for(let e=1;e<=c;e++)for(let t=0;t<R;t++){let i=p?scalePt2(T[t],D[t],N):T[t];S?(o.copy(a.normals[e]).multiplyScalar(i.x),s.copy(a.binormals[e]).multiplyScalar(i.y),l.copy(M[e]).add(o).add(s),v(l.x,l.y,l.z)):v(i.x,i.y,d/c*e)}for(let e=_-1;e>=0;e--){let t=e/_,i=f*Math.cos(t*Math.PI/2),r=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=C.length;e<t;e++){let t=scalePt2(C[e],P[e],r);v(t.x,t.y,d+i)}for(let e=0,t=A.length;e<t;e++){let t=A[e];U=I[e];for(let e=0,n=t.length;e<n;e++){let n=scalePt2(t[e],U[e],r);S?v(n.x,n.y+M[c-1].y,M[c-1].x+i):v(n.x,n.y,d+i)}}}function sidewalls(e,t){let n=e.length;for(;--n>=0;){let a=n,s=n-1;s<0&&(s=e.length-1);for(let e=0,n=c+2*_;e<n;e++){let n=R*e,o=R*(e+1),l=t+a+n,h=t+s+n,u=t+s+o,c=t+a+o;!function(e,t,n,a){addVertex(e),addVertex(t),addVertex(a),addVertex(t),addVertex(n),addVertex(a);let s=r.length/3,o=x.generateSideWallUV(i,r,s-6,s-3,s-2,s-1);addUV(o[0]),addUV(o[1]),addUV(o[3]),addUV(o[1]),addUV(o[2]),addUV(o[3])}(l,h,u,c)}}}function v(e,t,i){h.push(e),h.push(t),h.push(i)}function f3(e,t,n){addVertex(e),addVertex(t),addVertex(n);let a=r.length/3,s=x.generateTopUV(i,r,a-3,a-2,a-1);addUV(s[0]),addUV(s[1]),addUV(s[2])}function addVertex(e){r.push(h[3*e+0]),r.push(h[3*e+1]),r.push(h[3*e+2])}function addUV(e){n.push(e.x),n.push(e.y)}(function(){let e=r.length/3;if(p){let e=0*R;for(let t=0;t<L;t++){let i=w[t];f3(i[2]+e,i[1]+e,i[0]+e)}e=R*(c+2*_);for(let t=0;t<L;t++){let i=w[t];f3(i[0]+e,i[1]+e,i[2]+e)}}else{for(let e=0;e<L;e++){let t=w[e];f3(t[2],t[1],t[0])}for(let e=0;e<L;e++){let t=w[e];f3(t[0]+R*c,t[1]+R*c,t[2]+R*c)}}i.addGroup(e,r.length/3-e,0)})(),function(){let e=r.length/3,t=0;sidewalls(C,0),t+=C.length;for(let e=0,i=A.length;e<i;e++){let i=A[e];sidewalls(i,t),t+=i.length}i.addGroup(e,r.length/3-e,1)}()}(s)}this.setAttribute("position",new Float32BufferAttribute(r,3)),this.setAttribute("uv",new Float32BufferAttribute(n,2)),this.computeVertexNormals()}};let se={generateTopUV:function(e,t,i,r,n){let a=t[3*i],s=t[3*i+1],o=t[3*r],l=t[3*r+1],h=t[3*n],u=t[3*n+1];return[new Vector2(a,s),new Vector2(o,l),new Vector2(h,u)]},generateSideWallUV:function(e,t,i,r,n,a){let s=t[3*i],o=t[3*i+1],l=t[3*i+2],h=t[3*r],u=t[3*r+1],c=t[3*r+2],d=t[3*n],p=t[3*n+1],f=t[3*n+2],m=t[3*a],g=t[3*a+1],_=t[3*a+2];return Math.abs(o-u)<Math.abs(s-h)?[new Vector2(s,1-l),new Vector2(h,1-c),new Vector2(d,1-f),new Vector2(m,1-_)]:[new Vector2(o,1-l),new Vector2(u,1-c),new Vector2(p,1-f),new Vector2(g,1-_)]}};let IcosahedronGeometry=class IcosahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new IcosahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];super(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],e,t),this.type="IcosahedronGeometry",this.parameters={radiu
5s:e,detail:t}}};let OctahedronGeometry=class OctahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new OctahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){super([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],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}};let RingGeometry=class RingGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new RingGeometry(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}constructor(e=.5,t=1,i=32,r=1,n=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:n,thetaLength:a},i=Math.max(3,i),r=Math.max(1,r);let s=[],o=[],l=[],h=[],u=e,c=(t-e)/r,d=new Vector3,p=new Vector2;for(let e=0;e<=r;e++){for(let e=0;e<=i;e++){let r=n+e/i*a;d.x=u*Math.cos(r),d.y=u*Math.sin(r),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,h.push(p.x,p.y)}u+=c}for(let e=0;e<r;e++){let t=e*(i+1);for(let e=0;e<i;e++){let r=e+t,n=r+i+1,a=r+i+2,o=r+1;s.push(r,n,o),s.push(n,a,o)}}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(h,2))}};let ShapeGeometry=class ShapeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return function(e,t){if(t.shapes=[],Array.isArray(e))for(let i=0,r=e.length;i<r;i++){let r=e[i];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(t,e)}static fromJSON(e,t){let i=[];for(let r=0,n=e.shapes.length;r<n;r++){let n=t[e.shapes[r]];i.push(n)}return new ShapeGeometry(i,e.curveSegments)}constructor(e=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let i=[],r=[],n=[],a=[],s=0,o=0;if(!1===Array.isArray(e))addShape(e);else for(let t=0;t<e.length;t++)addShape(e[t]),this.addGroup(s,o,t),s+=o,o=0;function addShape(e){let s=r.length/3,l=e.extractPoints(t),h=l.shape,u=l.holes;!1===ShapeUtils.isClockWise(h)&&(h=h.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];!0===ShapeUtils.isClockWise(t)&&(u[e]=t.reverse())}let c=ShapeUtils.triangulateShape(h,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];h=h.concat(t)}for(let e=0,t=h.length;e<t;e++){let t=h[e];r.push(t.x,t.y,0),n.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=c.length;e<t;e++){let t=c[e],r=t[0]+s,n=t[1]+s,a=t[2]+s;i.push(r,n,a),o+=3}}this.setIndex(i),this.setAttribute("position",new Float32BufferAttribute(r,3)),this.setAttribute("normal",new Float32BufferAttribute(n,3)),this.setAttribute("uv",new Float32BufferAttribute(a,2))}};let SphereGeometry=class SphereGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new SphereGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,i=16,r=0,n=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let o=Math.min(a+s,Math.PI),l=0,h=[],u=new Vector3,c=new Vector3,d=[],p=[],f=[],m=[];for(let d=0;d<=i;d++){let g=[],_=d/i,y=0;0===d&&0===a?y=.5/t:d===i&&o===Math.PI&&(y=-.5/t);for(let i=0;i<=t;i++){let o=i/t;u.x=-e*Math.cos(r+o*n)*Math.sin(a+_*s),u.y=e*Math.cos(a+_*s),u.z=e*Math.sin(r+o*n)*Math.sin(a+_*s),p.push(u.x,u.y,u.z),c.copy(u).normalize(),f.push(c.x,c.y,c.z),m.push(o+y,1-_),g.push(l++)}h.push(g)}for(let e=0;e<i;e++)for(let r=0;r<t;r++){let t=h[e][r+1],n=h[e][r],s=h[e+1][r],l=h[e+1][r+1];(0!==e||a>0)&&d.push(t,n,l),(e!==i-1||o<Math.PI)&&d.push(n,s,l)}this.setIndex(d),this.setAttribute("position",new Float32BufferAttribute(p,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2))}};let TetrahedronGeometry=class TetrahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new TetrahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radiu
5s:e,detail:t}}};let TorusGeometry=class TorusGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TorusGeometry(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}constructor(e=1,t=.4,i=12,r=48,n=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:n},i=Math.floor(i),r=Math.floor(r);let a=[],s=[],o=[],l=[],h=new Vector3,u=new Vector3,c=new Vector3;for(let a=0;a<=i;a++)for(let d=0;d<=r;d++){let p=d/r*n,f=a/i*Math.PI*2;u.x=(e+t*Math.cos(f))*Math.cos(p),u.y=(e+t*Math.cos(f))*Math.sin(p),u.z=t*Math.sin(f),s.push(u.x,u.y,u.z),h.x=e*Math.cos(p),h.y=e*Math.sin(p),c.subVectors(u,h).normalize(),o.push(c.x,c.y,c.z),l.push(d/r),l.push(a/i)}for(let e=1;e<=i;e++)for(let t=1;t<=r;t++){let i=(r+1)*e+t-1,n=(r+1)*(e-1)+t-1,s=(r+1)*(e-1)+t,o=(r+1)*e+t;a.push(i,n,o),a.push(n,s,o)}this.setIndex(a),this.setAttribute("position",new Float32BufferAttribute(s,3)),this.setAttribute("normal",new Float32BufferAttribute(o,3)),this.setAttribute("uv",new Float32BufferAttribute(l,2))}};let TorusKnotGeometry=class TorusKnotGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TorusKnotGeometry(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}constructor(e=1,t=.4,i=64,r=8,n=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:n,q:a},i=Math.floor(i),r=Math.floor(r);let s=[],o=[],l=[],h=[],u=new Vector3,c=new Vector3,d=new Vector3,p=new Vector3,f=new Vector3,m=new Vector3,g=new Vector3;for(let s=0;s<=i;++s){let _=s/i*n*Math.PI*2;calculatePositionOnCurve(_,n,a,e,d),calculatePositionOnCurve(_+.01,n,a,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=r;++e){let n=e/r*Math.PI*2,a=-t*Math.cos(n),p=t*Math.sin(n);u.x=d.x+(a*g.x+p*f.x),u.y=d.y+(a*g.y+p*f.y),u.z=d.z+(a*g.z+p*f.z),o.push(u.x,u.y,u.z),c.subVectors(u,d).normalize(),l.push(c.x,c.y,c.z),h.push(s/i),h.push(e/r)}}for(let e=1;e<=i;e++)for(let t=1;t<=r;t++){let i=(r+1)*(e-1)+(t-1),n=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;s.push(i,n,o),s.push(n,a,o)}function calculatePositionOnCurve(e,t,i,r,n){let a=i/t*e,s=Math.cos(a);n.x=r*(2+s)*.5*Math.cos(e),n.y=r*(2+s)*Math.sin(e)*.5,n.z=r*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(h,2))}};let TubeGeometry=class TubeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new TubeGeometry(new a4[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}constructor(e=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),t=64,i=1,r=8,n=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n};let a=e.computeFrenetFrames(t,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let s=new Vector3,o=new Vector3,l=new Vector2,h=new Vector3,u=[],c=[],d=[],p=[];function generateSegment(n){h=e.getPointAt(n/t,h);let l=a.normals[n],d=a.binormals[n];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,n=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+n*d.x,o.y=a*l.y+n*d.y,o.z=a*l.z+n*d.z,o.normalize(),c.push(o.x,o.y,o.z),s.x=h.x+i*o.x,s.y=h.y+i*o.y,s.z=h.z+i*o.z,u.push(s.x,s.y,s.z)}}(function(){for(let e=0;e<t;e++)generateSegment(e);generateSegment(!1===n?t:0),function(){for(let e=0;e<=t;e++)for(let i=0;i<=r;i++)l.x=e/t,l.y=i/r,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let i=(r+1)*(e-1)+(t-1),n=(r+1)*e+(t-1),a=(r+1)*e+t,s=(r+1)*(e-1)+t;p.push(i,n,s),p.push(n,a,s)}}()})(),this.setIndex(p),this.setAttribute("position",new Float32BufferAttribute(u,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2))}};let WireframeGeometry=class WireframeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e}
5,null!==e){let t=[],i=new Set,r=new Vector3,n=new Vector3;if(null!==e.index){let a=e.attributes.position,s=e.index,o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){let l=o[e],h=l.start,u=l.count;for(let e=h,o=h+u;e<o;e+=3)for(let o=0;o<3;o++){let l=s.getX(e+o),h=s.getX(e+(o+1)%3);r.fromBufferAttribute(a,l),n.fromBufferAttribute(a,h),!0===isUniqueEdge(r,n,i)&&(t.push(r.x,r.y,r.z),t.push(n.x,n.y,n.z))}}}else{let a=e.attributes.position;for(let e=0,s=a.count/3;e<s;e++)for(let s=0;s<3;s++){let o=3*e+s,l=3*e+(s+1)%3;r.fromBufferAttribute(a,o),n.fromBufferAttribute(a,l),!0===isUniqueEdge(r,n,i)&&(t.push(r.x,r.y,r.z),t.push(n.x,n.y,n.z))}}this.setAttribute("position",new Float32BufferAttribute(t,3))}}};function isUniqueEdge(e,t,i){let r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z),n="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z);return!0!==i.has(r)&&!0!==i.has(n)&&(i.add(r),i.add(n),!0)}var st=Object.freeze({__proto__:null,BoxGeometry:BoxGeometry,CapsuleGeometry:CapsuleGeometry,CircleGeometry:CircleGeometry,ConeGeometry:ConeGeometry,CylinderGeometry:CylinderGeometry,DodecahedronGeometry:DodecahedronGeometry,EdgesGeometry:EdgesGeometry,ExtrudeGeometry:ExtrudeGeometry,IcosahedronGeometry:IcosahedronGeometry,LatheGeometry:LatheGeometry,OctahedronGeometry:OctahedronGeometry,PlaneGeometry:PlaneGeometry,PolyhedronGeometry:PolyhedronGeometry,RingGeometry:RingGeometry,ShapeGeometry:ShapeGeometry,SphereGeometry:SphereGeometry,TetrahedronGeometry:TetrahedronGeometry,TorusGeometry:TorusGeometry,TorusKnotGeometry:TorusKnotGeometry,TubeGeometry:TubeGeometry,WireframeGeometry:WireframeGeometry});let ShadowMaterial=class ShadowMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Color(0),this.transparent=!0,this.fog=!0,this.setValues(e)}};let RawShaderMaterial=class RawShaderMaterial extends ShaderMaterial{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};let MeshStandardMaterial=class MeshStandardMaterial extends Material{copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tj,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}};let MeshPhysicalMaterial=class MeshPhysicalMaterial extends MeshStandardMaterial{get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Color(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}};let MeshPhongMaterial=class MeshPhongMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color(16777215),this.specular=new Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tj,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=er,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}};let MeshToonMaterial=class MeshToonMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Color(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tj,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}};let MeshNormalMaterial=class MeshNormalMaterial extends Material{copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tj,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}};let MeshLambertMaterial=class MeshLambertMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tj,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=er,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}};let MeshMatcapMaterial=class MeshMatcapMaterial extends Material{copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}
5constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Color(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tj,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}};let LineDashedMaterial=class LineDashedMaterial extends LineBasicMaterial{copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}};function convertArray(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function getKeyframeOrder(e){let t=e.length,i=Array(t);for(let e=0;e!==t;++e)i[e]=e;return i.sort(function(t,i){return e[t]-e[i]}),i}function sortedArray(e,t,i){let r=e.length,n=new e.constructor(r);for(let a=0,s=0;s!==r;++a){let r=i[a]*t;for(let i=0;i!==t;++i)n[s++]=e[r+i]}return n}function flattenJSON(e,t,i,r){let n=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[n++];if(void 0===a)return;let s=a[r];if(void 0!==s){if(Array.isArray(s))do void 0!==(s=a[r])&&(t.push(a.time),i.push.apply(i,s)),a=e[n++];while(void 0!==a);else if(void 0!==s.toArray)do void 0!==(s=a[r])&&(t.push(a.time),s.toArray(i,i.length)),a=e[n++];while(void 0!==a);else do void 0!==(s=a[r])&&(t.push(a.time),i.push(s)),a=e[n++];while(void 0!==a)}}let si={convertArray:convertArray,isTypedArray:isTypedArray,getKeyframeOrder:getKeyframeOrder,sortedArray:sortedArray,flattenJSON:flattenJSON,subclip:function(e,t,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;let s=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],o=t.getValueSize(),l=[],h=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*n;if(!(a<i)&&!(a>=r)){l.push(t.times[e]);for(let i=0;i<o;++i)h.push(t.values[e*o+i])}}0!==l.length&&(t.times=convertArray(l,t.times.constructor),t.values=convertArray(h,t.values.constructor),s.push(t))}a.tracks=s;let o=1/0;for(let e=0;e<a.tracks.length;++e)o>a.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*o);return a.resetDuration(),a},makeClipAdditive:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);let n=i.tracks.length,a=t/r;for(let t=0;t<n;++t){let r;let n=i.tracks[t],s=n.ValueTypeName;if("bool"===s||"string"===s)continue;let o=e.tracks.find(function(e){return e.name===n.name&&e.ValueTypeName===s});if(void 0===o)continue;let l=0,h=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=h/3);let u=0,c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);let d=n.times.length-1;if(a<=n.times[0]){let e=l,t=h-l;r=n.values.slice(e,t)}else if(a>=n.times[d]){let e=d*h+l,t=e+h-l;r=n.values.slice(e,t)}else{let e=n.createInterpolant(),t=l,i=h-l;e.evaluate(a),r=e.resultBuffer.slice(t,i)}if("quaternion"===s){let e=new Quaternion().fromArray(r).normalize().conjugate();e.toArray(r)}let p=o.times.length;for(let e=0;e<p;++e){let t=e*c+u;if("quaternion"===s)Quaternion.multiplyQuaternionsFlat(o.values,t,r,0,o.values,t);else{let e=c-2*u;for(let i=0;i<e;++i)o.values[t+i]-=r[i]}}}return e.blendMode=tF,e}};let Interpolant=class Interpolant{evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],n=t[i-1];e:{t:{let a;i:{r:if(!(e<r)){for(let a=i+2;;){if(void 0===r){if(e<n)break r;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(n=r,e<(r=t[++i]))break t}a=t.length;break i}if(!(e>=n)){let s=t[1];e<s&&(i=2,n=s);for(let a=i-2;;){if(void 0===n)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(r=n,e>=(n=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let r=i+a>>>1;e<t[r]?a=r:i=r+1}if(r=t[i],void 0===(n=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r;for(let e=0;e!==r;++e)t[e]=i[n+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}};let CubicInterpolant=class CubicInterpolant extends Interpolant{intervalChanged_(e,t,i){let r=this.parameterPositions,n=e-2,a=e+1,s=r[n],o=r[a];if(void 0===s)switch(this.getSettings_().endingStart){case tN:n=e,s=2*t-i;break;case tB:n=r.length-2,s=t+r[n]-r[n+1];break;default:n=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case tN:a=e,o=2*i-t;break;case tB:a=1,o=i+r[1]-r[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=n*h,this._offsetNext=a*h}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-t)/(r-t),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,_=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-
5d*f;for(let e=0;e!==s;++e)n[e]=g*a[h+e]+_*a[l+e]+y*a[o+e]+x*a[u+e];return n}constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:tD,endingEnd:tD}}};let LinearInterpolant=class LinearInterpolant extends Interpolant{interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(i-t)/(r-t),u=1-h;for(let e=0;e!==s;++e)n[e]=a[l+e]*u+a[o+e]*h;return n}constructor(e,t,i,r){super(e,t,i,r)}};let DiscreteInterpolant=class DiscreteInterpolant extends Interpolant{interpolate_(e){return this.copySampleValue_(e-1)}constructor(e,t,i,r){super(e,t,i,r)}};let KeyframeTrack=class KeyframeTrack{static toJSON(e){let t;let i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:convertArray(e.times,Array),values:convertArray(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case tP:t=this.InterpolantFactoryMethodDiscrete;break;case tI:t=this.InterpolantFactoryMethodLinear;break;case tU:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return tP;case this.InterpolantFactoryMethodLinear:return tI;case this.InterpolantFactoryMethodSmooth:return tU}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,n=0,a=r-1;for(;n!==r&&i[n]<e;)++n;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==n||a!==r){n>=a&&(n=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(n,a),this.values=this.values.slice(n*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==n;t++){let r=i[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==a&&a>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,a),e=!1;break}a=r}if(void 0!==r&&isTypedArray(r))for(let t=0,i=r.length;t!==i;++t){let i=r[t];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,i),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===tU,n=e.length-1,a=1;for(let s=1;s<n;++s){let n=!1,o=e[s],l=e[s+1];if(o!==l&&(1!==s||o!==e[0])){if(r)n=!0;else{let e=s*i,r=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[r+s]||i!==t[a+s]){n=!0;break}}}}if(n){if(s!==a){e[a]=e[s];let r=s*i,n=a*i;for(let e=0;e!==i;++e)t[n+e]=t[r+e]}++a}}if(n>0){e[a]=e[n];for(let e=n*i,r=a*i,s=0;s!==i;++s)t[r+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}constructor(e,t,i,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=convertArray(t,this.TimeBufferType),this.values=convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}};KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=tI;let BooleanKeyframeTrack=class BooleanKeyframeTrack extends KeyframeTrack{constructor(e,t,i){super(e,t,i)}};BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=tP,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let ColorKeyframeTrack=class ColorKeyframeTrack extends KeyframeTrack{};ColorKeyframeTrack.prototype.ValueTypeName="color";let NumberKeyframeTrack=class NumberKeyframeTrack extends KeyframeTrack{};NumberKeyframeTrack.prototype.ValueTypeName="number";let QuaternionLinearInterpolant=class QuaternionLinearInterpolant extends Interpolant{interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(r-t),l=e*s;for(let e=l+s;
5l!==e;l+=4)Quaternion.slerpFlat(n,0,a,l-s,a,l,o);return n}constructor(e,t,i,r){super(e,t,i,r)}};let QuaternionKeyframeTrack=class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)}};QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let StringKeyframeTrack=class StringKeyframeTrack extends KeyframeTrack{constructor(e,t,i){super(e,t,i)}};StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=tP,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let VectorKeyframeTrack=class VectorKeyframeTrack extends KeyframeTrack{};VectorKeyframeTrack.prototype.ValueTypeName="vector";let AnimationClip=class AnimationClip{static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let e=0,n=i.length;e!==n;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];flattenJSON(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).scale(r));let n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n}static toJSON(e){let t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=i.length;e!==r;++e)t.push(KeyframeTrack.toJSON(i[e]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let n=t.length,a=[];for(let e=0;e<n;e++){let s=[],o=[];s.push((e+n-1)%n,e,(e+1)%n),o.push(0,1,0);let l=getKeyframeOrder(s);s=sortedArray(s,1,l),o=sortedArray(o,1,l),r||0!==s[0]||(s.push(n),o.push(o[0])),a.push(new NumberKeyframeTrack(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<i.length;e++)if(i[e].name===t)return i[e];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let r={},n=/^([\w-]*?)([\d]+)$/;for(let t=0,i=e.length;t<i;t++){let i=e[t],a=i.name.match(n);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(i)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let addNonemptyTrack=function(e,t,i,r,n){if(0!==i.length){let a=[],s=[];flattenJSON(i,a,s,r),0!==a.length&&n.push(new e(t,a,s))}},i=[],r=e.name||"default",n=e.fps||30,a=e.blendMode,s=e.length||-1,o=e.hierarchy||[];for(let e=0;e<o.length;e++){let r=o[e].keys;if(r&&0!==r.length){if(r[0].morphTargets){let e;let t={};for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(let n in t){let t=[],a=[];for(let i=0;i!==r[e].morphTargets.length;++i){let i=r[e];t.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new NumberKeyframeTrack(".morphTargetInfluence["+n+"]",t,a))}s=t.length*n}else{let n=".bones["+t[e].name+"]";addNonemptyTrack(VectorKeyframeTrack,n+".position",r,"pos",i),addNonemptyTrack(QuaternionKeyframeTrack,n+".quaternion",r,"rot",i),addNonemptyTrack(VectorKeyframeTrack,n+".scale",r,"scl",i)}}}if(0===i.length)return null;let l=new this(r,s,i,a);return l}resetDuration(){let e=this.tracks,t=0;for(let i=0,r=e.length;i!==r;++i){let e=this.tracks[i];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}constructor(e="",t=-1,i=[],r=tO){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}};let sr={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};let LoadingManager=class LoadingManager{constructor(e,t,i){let r;let n=this,a=!1,s=0,o=0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,!1===a&&void 0!==n.onStart&&n.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){let i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}};let sn=new LoadingManager;let Loader=class Loader{load(){}loadAsync(e,t){let i=this;return new Promise(function(r,n){i.load(e,r,t,n)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}constructor(e){this.manager=void 0!==e?e:sn,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}};Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";let sa={};
5let HttpError=class HttpError extends Error{constructor(e,t){super(e),this.response=t}};let FileLoader=class FileLoader extends Loader{load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=sr.get(e);if(void 0!==n)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if(void 0!==sa[e]){sa[e].push({onLoad:t,onProgress:i,onError:r});return}sa[e]=[],sa[e].push({onLoad:t,onProgress:i,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let i=sa[e],r=t.body.getReader(),n=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=n?parseInt(n):0,s=0!==a,o=0,l=new ReadableStream({start(e){(function readData(){r.read().then(t=>{let{done:r,value:n}=t;if(r)e.close();else{o+=n.byteLength;let t=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onProgress&&r.onProgress(t)}e.enqueue(n),readData()}},t=>{e.error(t)})})()}});return new Response(l)}throw new HttpError('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>{let t=new DOMParser;return t.parseFromString(e,s)});case"json":return e.json();default:if(void 0===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),i=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(i);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{sr.add(e,t);let i=sa[e];delete sa[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let i=sa[e];if(void 0===i)throw this.manager.itemError(e),t;delete sa[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}constructor(e){super(e)}};let AnimationLoader=class AnimationLoader extends Loader{load(e,t,i,r){let n=this,a=new FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(i){try{t(n.parse(JSON.parse(i)))}catch(t){r?r(t):console.error(t),n.manager.itemError(e)}},i,r)}parse(e){let t=[];for(let i=0;i<e.length;i++){let r=AnimationClip.parse(e[i]);t.push(r)}return t}constructor(e){super(e)}};let CompressedTextureLoader=class CompressedTextureLoader extends Loader{load(e,t,i,r){let n=this,a=[],s=new CompressedTexture,o=new FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(n.withCredentials);let l=0;if(Array.isArray(e))for(let h=0,u=e.length;h<u;++h)!function(h){o.load(e[h],function(e){let i=n.parse(e,!0);a[h]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},6===(l+=1)&&(1===i.mipmapCount&&(s.minFilter=eL),s.image=a,s.format=i.format,s.needsUpdate=!0,t&&t(s))},i,r)}(h);else o.load(e,function(e){let i=n.parse(e,!0);if(i.isCubemap){let e=i.mipmaps.length/i.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<i.mipmapCount;e++)a[t].mipmaps.push(i.mipmaps[t*i.mipmapCount+e]),a[t].format=i.format,a[t].width=i.width,a[t].height=i.height}s.image=a}else s.image.width=i.width,s.image.height=i.height,s.mipmaps=i.mipmaps;1===i.mipmapCount&&(s.minFilter=eL),s.format=i.format,s.needsUpdate=!0,t&&t(s)},i,r);return s}constructor(e){super(e)}};let ImageLoader=class ImageLoader extends Loader{load(e,t,i,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=sr.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a;let s=createElementNS("img");function onImageLoad(){removeEventListeners(),sr.add(e,this),t&&t(this),n.manager.itemEnd(e)}function onImageError(t){removeEventListeners(),r&&r(t),n.manager.itemError(e),n.manager.itemEnd(e)}function removeEventListeners(){s.removeEventListener("load",onImageLoad,!1),s.removeEventListener("error",onImageError,!1)}return s.addEventListener("load",onImageLoad,!1),s.addEventListener("error",onImageError,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),n.manager.itemStart(e),s.src=e,s}constructor(e){super(e)}};let CubeTextureLoader=class CubeTextureLoader extends Loader{load(e,t,i,r){let n=new CubeTexture;
5n.colorSpace=tK;let a=new ImageLoader(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;for(let i=0;i<e.length;++i)!function(i){a.load(e[i],function(e){n.images[i]=e,6==++s&&(n.needsUpdate=!0,t&&t(n))},void 0,r)}(i);return n}constructor(e){super(e)}};let DataTextureLoader=class DataTextureLoader extends Loader{load(e,t,i,r){let n=this,a=new DataTexture,s=new FileLoader(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,function(e){let i;try{i=n.parse(e)}catch(e){if(void 0!==r)r(e);else{console.error(e);return}}void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:eb,a.wrapT=void 0!==i.wrapT?i.wrapT:eb,a.magFilter=void 0!==i.magFilter?i.magFilter:eL,a.minFilter=void 0!==i.minFilter?i.minFilter:eL,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(a.colorSpace=i.colorSpace),void 0!==i.flipY&&(a.flipY=i.flipY),void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps,a.minFilter=eU),1===i.mipmapCount&&(a.minFilter=eL),void 0!==i.generateMipmaps&&(a.generateMipmaps=i.generateMipmaps),a.needsUpdate=!0,t&&t(a,i)},i,r),a}constructor(e){super(e)}};let TextureLoader=class TextureLoader extends Loader{load(e,t,i,r){let n=new Texture,a=new ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},i,r),n}constructor(e){super(e)}};let Light=class Light extends Object3D{dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Color(e),this.intensity=t}};let HemisphereLight=class HemisphereLight extends Light{copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Color(t)}};let ss=new Matrix4,so=new Vector3,sl=new Vector3;let LightShadow=class LightShadow{getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;so.setFromMatrixPosition(e.matrixWorld),t.position.copy(so),sl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sl),t.updateMatrixWorld(),ss.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ss),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ss)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}};let SpotLightShadow=class SpotLightShadow extends LightShadow{updateMatrices(e){let t=this.camera,i=2*iN*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(i!==t.fov||r!==t.aspect||n!==t.far)&&(t.fov=i,t.aspect=r,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}};let SpotLight=class SpotLight extends Light{get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t,i=0,r=Math.PI/3,n=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=i,this.angle=r,this.penumbra=n,this.decay=a,this.map=null,this.shadow=new SpotLightShadow}};let sh=new Matrix4,su=new Vector3,sc=new Vector3;let PointLightShadow=class PointLightShadow extends LightShadow{updateMatrices(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.camera,r=this.matrix,n=e.distance||i.far;n!==i.far&&(i.far=n,i.updateProjectionMatrix()),su.setFromMatrixPosition(e.matrixWorld),i.position.copy(su),sc.copy(i.position),sc.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(sc),i.updateMatrixWorld(),r.makeTranslation(-su.x,-su.y,-su.z),sh.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sh)}constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new Vector3(1,0,0),new Vector3(-1,0,0),new Vector3(0,0,1),new Vector3(0,0,-1),new Vector3(0,1,0),new Vector3(0,-1,0)],this._cubeUps=[new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,0,1),new Vector3(0,0,-1)]}};let PointLight=class PointLight extends Light{get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new PointLightShadow}};let DirectionalLightShadow=class DirectionalLightShadow extends LightShadow{constructor(){super(new Orthogra
5phicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};let DirectionalLight=class DirectionalLight extends Light{dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}};let AmbientLight=class AmbientLight extends Light{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};let RectAreaLight=class RectAreaLight extends Light{get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}};let SphericalHarmonics3=class SphericalHarmonics3{set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let i=e.x,r=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],1.092548*(i*r)),t.addScaledVector(a[5],1.092548*(r*n)),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],1.092548*(i*n)),t.addScaledVector(a[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){let i=e.x,r=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*n),t.addScaledVector(a[3],1.023328*i),t.addScaledVector(a[4],.858086*i*r),t.addScaledVector(a[5],.858086*r*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*i*n),t.addScaledVector(a[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+3*r);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){let i=e.x,r=e.y,n=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*n,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*i*n,t[8]=.546274*(i*i-r*r)}constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Vector3)}};let LightProbe=class LightProbe extends Light{copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}constructor(e=new SphericalHarmonics3,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}};let MaterialLoader=class MaterialLoader extends Loader{load(e,t,i,r){let n=this,a=new FileLoader(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(i){try{t(n.parse(JSON.parse(i)))}catch(t){r?r(t):console.error(t),n.manager.itemError(e)}},i,r)}parse(e){let t=this.textures;function getTexture(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}let i=MaterialLoader.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=new Color().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&
5(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=getTexture(r.value);break;case"c":i.uniforms[t].value=new Color().setHex(r.value);break;case"v2":i.uniforms[t].value=new Vector2().fromArray(r.value);break;case"v3":i.uniforms[t].value=new Vector3().fromArray(r.value);break;case"v4":i.uniforms[t].value=new Vector4().fromArray(r.value);break;case"m3":i.uniforms[t].value=new Matrix3().fromArray(r.value);break;
5case"m4":i.uniforms[t].value=new Matrix4().fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=getTexture(e.map)),void 0!==e.matcap&&(i.matcap=getTexture(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=getTexture(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=getTexture(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=getTexture(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=new Vector2().fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=getTexture(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=getTexture(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=getTexture(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=getTexture(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=getTexture(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=getTexture(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=getTexture(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=getTexture(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=getTexture(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=new Vector2().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=getTexture(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=getTexture(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=getTexture(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=getTexture(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=getTexture(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=getTexture(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=getTexture(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){return new({ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material})[e]}constructor(e){super(e),this.textures={}}};let LoaderUtils=class LoaderUtils{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}};let InstancedBufferGeometry=class InstancedBufferGeometry extends BufferGeometry{copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}};let BufferGeometryLoader=class BufferGeometryLoader extends Loader{load(e,t,i,r){let n=this,a=new FileLoader(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(i){try{t(n.parse(JSON.parse(i)))}catch(t){r?r(t):console.error(t),n.manager.itemError(e)}},i,r)}parse(e){let t={},i={};function getInterleavedBuffer(e,r){if(void 0!==t[r])return t[r];let n=e.interleavedBuffers,a=n[r],s=function(e,t){if(void 0!==i[t])return i[t];let r=e.arrayBuffers,n=r[t],a=new Uint32Array(n).buffer;return i[t]=a,a}(e,a.buffer),o=getTypedArray(a.type,s),l=new InterleavedBuffer(o,a.stride);return l.uuid=a.uuid,t[r]=l,l}let r=e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,n=e.data.index;if(void 0!==n){let e=getTypedArray(n.type,n.array);r.setIndex(new BufferAttribute(e,1))}let a=e.data.attributes;for(let t in a){let i;let n=a[t];if(n.isInterleavedBufferAttribute){let t=getInterleavedBuffer(e.data,n.data);i=new InterleavedBufferAttribute(t,n.itemSize,n.offset,n.normalized)}else{let e=getTypedArray(n.type,n.array),t=n.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;i=new t(e,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(t,i)}let s=e.data.morphAttributes;if(s)for(let t in s){let i=s[t],n=[];for(let t=0,r=i.length;t<r;t++){let r;let a=i[t];if(a.isInterleavedBufferAttribute){let t=getInterleavedBuffer(e.data,a.data);r=new InterleavedBufferAttribute(t,a.itemSize,a.offset,a.normalized)}else{let e=getTypedArray(a.type,a.array);r=new BufferAttribute(e,a.itemSize,a.normalized)}void 0!==a.name&&(r.name=a.name),n.push(r)}r.morphAttributes[t]=n}let o=e.data.morphTargetsRelative;o&&(r.morphTargetsRelative=!0);let l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){let t=l[e];r.addGroup(t.start,t.count,t.materialIndex)}let h=e.data.boundingSphere;if(void 0!==h){let e=new Vector3;void 0!==h.center&&e.fromArray(h.center),r.boundingSphere=new Sphere(e,h.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}constructor(e){super(e)}};let ObjectLoader=class ObjectLoader extends Loader{load(e,t,i,r){let n=this,a=""===this.path?LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;let s=new FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(i){let a=null;try{a=JSON.parse(i)}catch(t){void 0!==r&&r(t),console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message);return}let s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()){void 0!==r&&r(Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}n.parse(a,t)},i,r)}async loadAsync(e,t){let i=""===this.path?LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;let r=new FileLoader(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);let n=await r.loadAsync(e,t),a=JSON.parse(n),s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(a)}parse(e,t){let i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),n=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,function(){void 0!==t&&t(l)}),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,n,o,s,i),h=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,h),this.bindLightTargets(l),void 0!==t){let e=!1;for(let t in a)if(a[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){let t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),n=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,n),s=this.parseMaterials(e.materials,a),o=this.parseObject(e.object,r,s,a,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(e){let t={};if(void 0!==e)for(let i=0,r=e.length;i<r;i++){let r=new Shape().fromJSON(e[i]);t[r.uuid]=r}return t}parseSkeletons(e,t){let i={},r={};if(t.traverse(function(e){e.isBone&&(r[e.uuid]=e)}),void 0!==e)for(let t=0,n=e.length;t<n;t++){let n=new Skeleton().fromJSON(e[t],r);i[n.uuid]=n}return i}parseGeometries(e,t){let i={};if(void 0!==e){let r=new BufferGeometryLoader;for(let n=0,a=e.length;n<a;n++){let a;let s=e[n];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(s);break;default:s.type in st?a=st[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.userData&&(a.userData=s.userData),i[s.uuid]=a}}return i}parseMaterials(e,t){let i={},r={};if(void 0!==e){let n=new MaterialLoader;n.setTextures(t);for(let t=0,a=e.length;t<a;t++){let a=e[t];void 0===i[a.uuid]&&(i[a.uuid]=n.parse(a)),r[a.uuid]=i[a.uuid]}}return r}parseAnimations(e){let t={};if(void 0!==e)for(let i=0;i<e.length;i++){let r=e[i],n=AnimationClip.parse(r);t[n.uuid]=n}return t}parseImages(e,t){let i;let r=this,n={};function deserializeImage(e){if("string"==typeof e){let t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:r.resourcePath+e;return r.manager.itemStart(t),i.load(t,function(){r.manager.itemEnd(t)},void 0,function(){r.manager.itemError(t),r.manager.itemEnd(t)})}return e.data?{data:getTypedArray(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){let r=new LoadingManager(t);(i=new ImageLoader(r)).setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){let i=e[t],r=i.url;if(Array.isArray(r)){let e=[];for(let t=0,i=r.length;t<i;t++){let i=r[t],n=deserializeImage(i);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new DataTexture(n.data,n.width,n.height)))}n[i.uuid]=new Source(e)}else{let e=deserializeImage(i.url);n[i.uuid]=new Source(e)}}}return n}async parseImagesAsync(e){let t;let i=this,r={};async function deserializeImage(e){if("string"==typeof e){let r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e;return await t.loadAsync(r)}return e.data?{data:getTypedArray(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(t=new ImageLoader(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){let i=e[t],n=i.url;if(Array.isArray(n)){let e=[];for(let t=0,i=n.length;t<i;t++){let i=n[t],r=await deserializeImage(i);null!==r&&(r instanceof HTMLImageElement?e.push(r):e.push(new DataTexture(r.data,r.width,r.height)))}r[i.uuid]=new Source(e)}else{let e=await deserializeImage(i.url);r[i.uuid]=new Source(e)}}}return r}parseTextures(e,t){function parseConstant(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}let i={};if(void 0!==e)for(let r=0,n=e.length;r<n;r++){let n;let a=e[r];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let s=t[a.image],o=s.data;Array.isArray(o)?(n=new CubeTexture,6===o.length&&(n.needsUpdate=!0)):(n=o&&o.data?new DataTexture:new Texture,o&&(n.needsUpdate=!0)),n.source=s,n.uuid=a.uuid,void 0!==a.name&&(n.name=a.name),void 0!==a.mapping&&(n.mapping=parseConstant(a.mapping,sd)),void 0!==a.channel&&(n.channel=a.channel),void 0!==a.offset&&n.offset.fromArray(a.offset),void 0!==a.repeat&&n.repeat.fromArray(a.repeat),void 0!==a.center&&n.center.fromArray(a.center),void 0!==a.rotation&&(n.rotation=a.rotation),void 0!==a.wrap&&(n.wrapS=parseConstant(a.wrap[0],sp),n.wrapT=parseConstant(a.wrap[1],sp)),void 0!==a.format&&(n.format=a.format),void 0!==a.internalFormat&&(n.internalFormat=a.internalFormat),void 0!==a.type&&(n.type=a.type),void 0!==a.colorSpace&&(n.colorSpace
5=a.colorSpace),void 0!==a.minFilter&&(n.minFilter=parseConstant(a.minFilter,sf)),void 0!==a.magFilter&&(n.magFilter=parseConstant(a.magFilter,sf)),void 0!==a.anisotropy&&(n.anisotropy=a.anisotropy),void 0!==a.flipY&&(n.flipY=a.flipY),void 0!==a.generateMipmaps&&(n.generateMipmaps=a.generateMipmaps),void 0!==a.premultiplyAlpha&&(n.premultiplyAlpha=a.premultiplyAlpha),void 0!==a.unpackAlignment&&(n.unpackAlignment=a.unpackAlignment),void 0!==a.compareFunction&&(n.compareFunction=a.compareFunction),void 0!==a.userData&&(n.userData=a.userData),i[a.uuid]=n}return i}parseObject(e,t,i,r,n){let a,s,o;function getGeometry(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function getMaterial(e){if(void 0!==e){if(Array.isArray(e)){let t=[];for(let r=0,n=e.length;r<n;r++){let n=e[r];void 0===i[n]&&console.warn("THREE.ObjectLoader: Undefined material",n),t.push(i[n])}return t}return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]}}function getTexture(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":a=new Scene,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new Color(e.background):a.background=getTexture(e.background)),void 0!==e.environment&&(a.environment=getTexture(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new Fog(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new FogExp2(e.fog.color,e.fog.density)),""!==e.fog.name&&(a.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&a.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(a.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new PerspectiveCamera(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new AmbientLight(e.color,e.intensity);break;case"DirectionalLight":(a=new DirectionalLight(e.color,e.intensity)).target=e.target||"";break;case"PointLight":a=new PointLight(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new RectAreaLight(e.color,e.intensity,e.width,e.height);break;case"SpotLight":(a=new SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay)).target=e.target||"";break;case"HemisphereLight":a=new HemisphereLight(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new LightProbe().fromJSON(e);break;case"SkinnedMesh":s=getGeometry(e.geometry),o=getMaterial(e.material),a=new SkinnedMesh(s,o),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":s=getGeometry(e.geometry),o=getMaterial(e.material),a=new Mesh(s,o);break;case"InstancedMesh":s=getGeometry(e.geometry),o=getMaterial(e.material);let l=e.count,h=e.instanceMatrix,u=e.instanceColor;(a=new InstancedMesh(s,o,l)).instanceMatrix=new InstancedBufferAttribute(new Float32Array(h.array),16),void 0!==u&&(a.instanceColor=new InstancedBufferAttribute(new Float32Array(u.array),u.itemSize));break;case"BatchedMesh":s=getGeometry(e.geometry),o=getMaterial(e.material),(a=new BatchedMesh(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,o)).geometry=s,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._visibility=e.visibility,a._active=e.active,a._bounds=e.bounds.map(e=>{let t=new Box3;t.min.fromArray(e.boxMin),t.max.fromArray(e.boxMax);let i=new Sphere;return i.radius=e.sphereRadius,i.center.fromArray(e.sphereCenter),{boxInitialized:e.boxInitialized,box:t,sphereInitialized:e.sphereInitialized,sphere:i}}),a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=getTexture(e.matricesTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=getTexture(e.colorsTexture.uuid));break;case"LOD":a=new LOD;break;case"Line":a=new Line(getGeometry(e.geometry),getMaterial(e.material));break;case"LineLoop":a=new LineLoop(getGeometry(e.geometry),getMaterial(e.material));break;case"LineSegments":a=new LineSegments(getGeometry(e.geometry),getMaterial(e.material));break;case"PointCloud":case"Points":a=new Points(getGeometry(e.geometry),getMaterial(e.material));break;case"Sprite":a=new Sprite(getMaterial(e.material));break;case"Group":a=new Group;break;case"Bone":a=new Bone;break;default:a=new Object3D}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers
5),void 0!==e.children){let s=e.children;for(let e=0;e<s.length;e++)a.add(this.parseObject(s[e],t,i,r,n))}if(void 0!==e.animations){let t=e.animations;for(let e=0;e<t.length;e++){let i=t[e];a.animations.push(n[i])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);let t=e.levels;for(let e=0;e<t.length;e++){let i=t[e],r=a.getObjectByProperty("uuid",i.object);void 0!==r&&a.addLevel(r,i.distance,i.hysteresis)}}return a}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){let i=t[e.skeleton];void 0===i?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(i,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){let i=t.target,r=e.getObjectByProperty("uuid",i);void 0!==r?t.target=r:t.target=new Object3D}})}constructor(e){super(e)}};let sd={UVMapping:eg,CubeReflectionMapping:ev,CubeRefractionMapping:e_,EquirectangularReflectionMapping:ey,EquirectangularRefractionMapping:ex,CubeUVReflectionMapping:eM},sp={RepeatWrapping:eS,ClampToEdgeWrapping:eb,MirroredRepeatWrapping:eT},sf={NearestFilter:eA,NearestMipmapNearestFilter:eE,NearestMipmapLinearFilter:eC,LinearFilter:eL,LinearMipmapNearestFilter:eP,LinearMipmapLinearFilter:eU};let ImageBitmapLoader=class ImageBitmapLoader extends Loader{setOptions(e){return this.options=e,this}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=sr.get(e);if(void 0!==a){if(n.manager.itemStart(e),a.then){a.then(i=>{t&&t(i),n.manager.itemEnd(e)}).catch(e=>{r&&r(e)});return}return setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a}let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(i){return sr.add(e,i),t&&t(i),n.manager.itemEnd(e),i}).catch(function(t){r&&r(t),sr.remove(e),n.manager.itemError(e),n.manager.itemEnd(e)});sr.add(e,o),n.manager.itemStart(e)}constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}};let AudioContext=class AudioContext{static getContext(){return void 0===a&&(a=new(window.AudioContext||window.webkitAudioContext)),a}static setContext(e){a=e}};let AudioLoader=class AudioLoader extends Loader{load(e,t,i,r){let n=this,a=new FileLoader(this.manager);function handleError(t){r?r(t):console.error(t),n.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let i=e.slice(0),r=AudioContext.getContext();r.decodeAudioData(i,function(e){t(e)}).catch(handleError)}catch(e){handleError(e)}},i,r)}constructor(e){super(e)}};let sm=new Matrix4,sg=new Matrix4,sv=new Matrix4;let StereoCamera=class StereoCamera{update(e){let t=this._cache,i=t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep;if(i){let i,r;t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,sv.copy(e.projectionMatrix);let n=t.eyeSep/2,a=n*t.near/t.focus,s=t.near*Math.tan(iD*t.fov*.5)/t.zoom;sg.elements[12]=-n,sm.elements[12]=n,i=-s*t.aspect+a,r=s*t.aspect+a,sv.elements[0]=2*t.near/(r-i),sv.elements[8]=(r+i)/(r-i),this.cameraL.projectionMatrix.copy(sv),i=-s*t.aspect-a,r=s*t.aspect-a,sv.elements[0]=2*t.near/(r-i),sv.elements[8]=(r+i)/(r-i),this.cameraR.projectionMatrix.copy(sv)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(sg),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sm)}constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}};let Clock=class Clock{start(){this.startTime=now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}};function now(){return("undefined"==typeof performance?Date:performance).now()}let s_=new Vector3,sy=new Quaternion,sx=new Vector3,sM=new Vector3;let AudioListener=class AudioListener extends Object3D{getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(s_,sy,sx),sM.set(0,0,-1).applyQuaternion(sy),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(s_.x,e),t.positionY.linearRampToValueAtTime(s_.y,e),t.positionZ.linearRampToValueAtTime(s_.z,e),t.forwardX.linearRampToValueAtTime(sM.x,e),t.forwardY.linearRampToValueAtTime(sM.y,e),t.forwardZ.linearRampToValueAtTime(sM.z,e),t.upX.linearRampToValueAtTime(i.x,e),t.upY.linearRampToValueAtTime(i.y,e),t.upZ.linearRampToValueAtTime(i.z,e)}else t.setPosition(s_.x,s_.y,s_.z),t.setOrientation(sM.x,sM.y,sM.z,i.x,i.y,i.z)}constructor(){super(),this.type="AudioListener",this.context=AudioContext.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Clock}};let Audio=class Audio extends Object3D{getOutput(){return this.gain}
5setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0===this.isPlaying){console.warn("THREE.Audio: Audio is already playing.");return}if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}};let sS=new Vector3,sb=new Quaternion,sT=new Vector3,sA=new Vector3;let PositionalAudio=class PositionalAudio extends Audio{connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(sS,sb,sT),sA.set(0,0,1).applyQuaternion(sb);let t=this.panner;if(t.positionX){let e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(sS.x,e),t.positionY.linearRampToValueAtTime(sS.y,e),t.positionZ.linearRampToValueAtTime(sS.z,e),t.orientationX.linearRampToValueAtTime(sA.x,e),t.orientationY.linearRampToValueAtTime(sA.y,e),t.orientationZ.linearRampToValueAtTime(sA.z,e)}else t.setPosition(sS.x,sS.y,sS.z),t.setOrientation(sA.x,sA.y,sA.z)}constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}};let AudioAnalyser=class AudioAnalyser{getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}
5constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}};let PropertyMixer=class PropertyMixer{accumulate(e,t){let i=this.buffer,r=this.valueSize,n=e*r+r,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==r;++e)i[n+e]=i[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(i,n,0,e,r)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,n<1){let e=t*this._origIndex;this._mixBufferRegion(i,r,e,1-n,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let e=t,n=t+t;e!==n;++e)if(i[e]!==i[e+t]){s.setValue(i,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let e=i;e!==r;++e)t[e]=t[r+e%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,n){if(r>=.5)for(let r=0;r!==n;++r)e[t+r]=e[i+r]}_slerp(e,t,i,r){Quaternion.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,n){let a=this._workIndex*n;Quaternion.multiplyQuaternionsFlat(e,a,e,t,e,i),Quaternion.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,n){let a=1-r;for(let s=0;s!==n;++s){let n=t+s;e[n]=e[n]*a+e[i+s]*r}}_lerpAdditive(e,t,i,r,n){for(let a=0;a!==n;++a){let n=t+a;e[n]=e[n]+e[i+a]*r}}constructor(e,t,i){let r,n,a;switch(this.binding=e,this.valueSize=i,t){case"quaternion":r=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:r=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}};let sE="\\[\\]\\.:\\/",sw=RegExp("["+sE+"]","g"),sC="[^"+sE+"]",sR="[^"+sE.replace("\\.","")+"]",sL=/((?:WC+[\/:])*)/.source.replace("WC",sC),sP=/(WCOD+)?/.source.replace("WCOD",sR),sI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sC),sU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sC),sD=RegExp("^"+sL+sP+sI+sU+"$"),sN=["material","materials","bones","map"];let PropertyBinding=class PropertyBinding{static create(e,t,i){return e&&e.isAnimationObjectGroup?new PropertyBinding.Composite(e,t,i):new PropertyBinding(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(sw,"")}static parseTrackName(e){let t=sD.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=i.nodeName.substring(r+1);-1!==sN.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let searchNodeSubtree=function(e){for(let i=0;i<e.length;i++){let r=e[i];if(r.name===t||r.uuid===t)return r;let n=searchNodeSubtree(r.children);if(n)return n}return null},i=searchNodeSubtree(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}
5_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,n=t.propertyIndex;if(e||(e=PropertyBinding.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let r=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(void 0===e[i]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(void 0!==r){if(void 0===e[r]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[r]}}let a=e[r];if(void 0===a){let i=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+r+" but it wasn't found.",e);return}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===r){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==e.morphTargetDictionary[n]&&(n=e.morphTargetDictionary[n])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}constructor(e,t,i){this.path=t,this.parsedPath=i||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};PropertyBinding.Composite=class{getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}constructor(e,t,i){let r=i||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatr
5ixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];let AnimationObjectGroup=class AnimationObjectGroup{add(){let e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length,s,o=e.length,l=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){let u=arguments[h],c=u.uuid,d=t[c];if(void 0===d){d=o++,t[c]=d,e.push(u);for(let e=0;e!==a;++e)n[e].push(new PropertyBinding(u,i[e],r[e]))}else if(d<l){s=e[d];let o=--l,h=e[o];t[h.uuid]=d,e[d]=h,t[c]=o,e[o]=u;for(let e=0;e!==a;++e){let t=n[e],a=t[o],s=t[d];t[d]=a,void 0===s&&(s=new PropertyBinding(u,i[e],r[e])),t[o]=s}}else e[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){let e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length,n=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){let s=arguments[a],o=s.uuid,l=t[o];if(void 0!==l&&l>=n){let a=n++,h=e[a];t[h.uuid]=l,e[l]=h,t[o]=a,e[a]=s;for(let e=0;e!==r;++e){let t=i[e],r=t[a],n=t[l];t[l]=r,t[a]=n}}}this.nCachedObjects_=n}uncache(){let e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length,n=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,h=t[l];if(void 0!==h){if(delete t[l],h<n){let s=--n,o=e[s],l=--a,u=e[l];t[o.uuid]=h,e[h]=o,t[u.uuid]=s,e[s]=u,e.pop();for(let e=0;e!==r;++e){let t=i[e],r=t[s],n=t[l];t[h]=r,t[s]=n,t.pop()}}else{let n=--a,s=e[n];n>0&&(t[s.uuid]=h),e[h]=s,e.pop();for(let e=0;e!==r;++e){let t=i[e];t[h]=t[n],t.pop()}}}}this.nCachedObjects_=n}subscribe_(e,t){let i=this._bindingsIndicesByPath,r=i[e],n=this._bindings;if(void 0!==r)return n[r];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,h=this.nCachedObjects_,u=Array(l);r=n.length,i[e]=r,a.push(e),s.push(t),n.push(u);for(let i=h,r=o.length;i!==r;++i){let r=o[i];u[i]=new PropertyBinding(r,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){let r=this._paths,n=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s],l=e[s];t[l]=i,a[i]=o,a.pop(),n[i]=n[s],n.pop(),r[i]=r[s],r.pop()}}constructor(){this.isAnimationObjectGroup=!0,this.uuid=generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let t=0,i=arguments.length;t!==i;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}};let AnimationAction=class AnimationAction{play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){let i=this._clip.duration,r=e._clip.duration;e.warp(1,r/i,t),this.warp(i/r,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){let r=this._mixer,n=r.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+i,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}let n=this._startTime;if(null!==n){let r=(e-n)*i;r<0||0===i?t=0:(this._startTime=null,t=i*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(this.blendMode===tF)for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(a),t[i].accumulateAdditive(s);else for(let i=0,n=e.length;i!==n;++i)e[i].evaluate(a),t[i].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,r=this.time+e,n=this._loopCount,a=i===tL;if(0===e)return -1===n?r:a&&(1&n)==1?t-r:r;if(i===tC){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));n:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break n}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){let i=Math.floor(r/t);r-=t*i,n+=Math.abs(i);let s=this.repetitions-n;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=r;if(a&&(1&n)==1)return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=tN,r.endingEnd=tN):(e?r.endingStart=this.zeroSlopeAtStart?tN:tD:r.endingStart=tB,t?r.endingEnd=this.zeroSlopeAtEnd?tN:tD:r.endingEnd=tB)}_scheduleFading(e,t,i){let r=this._mixer,n=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=i,this}constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;let n=t.tracks,a=n.length,s=Array(a),o={endingStart:tD,endingEnd:tD};for(let e=0;e!==a;++e){let t=n[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=tR,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}};let sB=new Float32Array(1);
vendor: 6,215 bytes, line 5
5let AnimationMixer=class AnimationMixer extends EventDispatcher{_bindAction(e,t){let i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,a=e._propertyBindings,s=e._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(let e=0;e!==n;++e){let n=r[e],l=n.name,u=h[l];if(void 0!==u)++u.referenceCount,a[e]=u;else{if(void 0!==(u=a[e])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,l));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;u=new PropertyMixer(PropertyBinding.create(i,l,r),n.ValueTypeName,n.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,l),a[e]=u}s[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,i){let r=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;let n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null;let u=s.actionByRoot,c=(e._localRoot||this._root).uuid;delete u[c],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_addInactiveBinding(e,t,i){let r=this._bindingsByRootAndName,n=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[i]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,r=i.rootNode.uuid,n=i.path,a=this._bindingsByRootAndName,s=a[r],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[r]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&((i=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,sB)).__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,n=t[r];e.__cacheIndex=r,t[r]=e,n.__cacheIndex=i,t[i]=n}clipAction(e,t,i){let r=t||this._root,n=r.uuid,a="string"==typeof e?AnimationClip.findByName(r,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===i&&(i=null!==a?a.blendMode:tO),void 0!==o){let e=o.actionByRoot[n];if(void 0!==e&&e.blendMode===i)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let h=new AnimationAction(this,a,t,i);return this._bindAction(h,l),this._addInactiveAction(h,s,n),h}existingAction(e,t){let i=t||this._root,r=i.uuid,n="string"==typeof e?AnimationClip.findByName(i,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==i;++s){let i=t[s];i._update(r,e,n,a)}let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,r=this._actionsByClip,n=r[i];if(void 0!==n){let e=n.knownActions;for(let i=0,r=e.length;i!==r;++i){let r=e[i];this._deactivateAction(r);let n=r._cacheIndex,a=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=n,t[n]=a,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let e in i){let r=i[e].actionByRoot,n=r[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}let r=this._bindingsByRootAndName,n=r[t];if(void 0!==n)for(let e in n){let t=n[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}};let Uniform=class Uniform{clone(){return new Uniform(void 0===this.value.clone?this.value:this.value.clone())}constructor(e){this.value=e}};let sO=0;
5let UniformsGroup=class UniformsGroup extends EventDispatcher{add(e){return this.uniforms.push(e),this}remove(e){let t=this.uniforms.indexOf(e);return -1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;let t=e.uniforms;this.uniforms.length=0;for(let e=0,i=t.length;e<i;e++){let i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<i.length;e++)this.uniforms.push(i[e].clone())}return this}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:sO++}),this.name="",this.usage=iy,this.uniforms=[]}};let InstancedInterleavedBuffer=class InstancedInterleavedBuffer extends InterleavedBuffer{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}};let GLBufferAttribute=class GLBufferAttribute{set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}constructor(e,t,i,r,n){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=n,this.version=0}};let sF=new Matrix4;let Raycaster=class Raycaster{set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return sF.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(sF),this}intersectObject(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return intersect(e,this,i,t),i.sort(ascSort),i}intersectObjects(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let r=0,n=e.length;r<n;r++)intersect(e[r],this,i,t);return i.sort(ascSort),i}constructor(e,t,i=0,r=1/0){this.ray=new Ray(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}};function ascSort(e,t){return e.distance-t.distance}function intersect(e,t,i,r){let n=!0;if(e.layers.test(t.layers)){let r=e.raycast(t,i);!1===r&&(n=!1)}if(!0===n&&!0===r){let r=e.children;for(let e=0,n=r.length;e<n;e++)intersect(r[e],t,i,!0)}}let Spherical=class Spherical{set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(clamp(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}};let Cylindrical=class Cylindrical{set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}};let Matrix2=class Matrix2{identity(){return this.set(1,0,0,1),this}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){let n=this.elements;
5return n[0]=e,n[2]=t,n[1]=i,n[3]=r,this}constructor(e,t,i,r){Matrix2.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,i,r)}};let sV=new Vector2;let Box2=class Box2{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=sV.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sV).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new Vector2(Infinity,Infinity),t=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}};let sz=new Vector3,sG=new Vector3;let Line3=class Line3{set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){sz.subVectors(e,this.start),sG.subVectors(this.end,this.start);let i=sG.dot(sG),r=sG.dot(sz),n=r/i;return t&&(n=clamp(n,0,1)),n}closestPointToPoint(e,t,i){let r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3,t=new Vector3){this.start=e,this.end=t}};let sk=new Vector3;let SpotLightHelper=class SpotLightHelper extends Object3D{dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),sk.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(sk),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let i=new BufferGeometry,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let i=e/32*Math.PI*2,n=t/32*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(n),Math.sin(n),1)}i.setAttribute("position",new Float32BufferAttribute(r,3));let n=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(i,n),this.add(this.cone),this.update()}};let sH=new Vector3,sW=new Matrix4,sX=new Matrix4;let SkeletonHelper=class SkeletonHelper extends LineSegments{updateMatrixWorld(e){let t=this.bones,i=this.geometry,r=i.getAttribute("position");sX.copy(this.root.matrixWorld).invert();for(let e=0,i=0;e<t.length;e++){let n=t[e];n.parent&&n.parent.isBone&&(sW.multiplyMatrices(sX,n.matrixWorld),sH.setFromMatrixPosition(sW),r.setXYZ(i,sH.x,sH.y,sH.z),sW.multiplyMatrices(sX,n.parent.matrixWorld),sH.setFromMatrixPosition(sW),r.setXYZ(i+1,sH.x,sH.y,sH.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e){let t=function getBoneList(e){let t=[];!0===e.isBone&&t.push(e);for(let i=0;i<e.children.length;i++)t.push.apply(t,getBoneList(e.children[i]));return t}(e),i=new BufferGeometry,r=[],n=[],a=new Color(0,0,1),s=new Color(0,1,0);for(let e=0;e<t.length;e++){let i=t[e];i.parent&&i.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),n.push(a.r,a.g,a.b),n.push(s.r,s.g,s.b))}i.setAttribute("position",new Float32BufferAttribute(r,3)),i.setAttribute("color",new Float32BufferAttribute(n,3));let o=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}};let PointLightHelper=class PointLightHelper extends Mesh{dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}constructor(e,t,i){let r=new SphereGeometry(t,4,2),n=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(r,n),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}};let sj=new Vector3,sq=new Color,sY=new Color;let HemisphereLightHelper=class HemisphereLightHelper extends Object3D{dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");sq.copy(this.light.color),sY.copy(this.light.groundColor);for(let e=0,i=t.count;e<i;e++){let r=e<i/2?sq:sY;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(sj.setFromMatrixPosition(this.light.matrixWorld).negate())}constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";let r=new OctahedronGeometry(t);r.rotateY(.5*Math.PI),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);let n=r.getAttribute("position"),a=new Float32Array(3*n.count);r.setAttribute("color",new BufferAttribute(a,3)),this.add(new Mesh(r,this.material)),this.update()}};let GridHelper=class GridHelper extends LineSegments{dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=10,t=10,i=4473924,r=8947848){i=new Color(i),r=new Color(r);let n=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,h=0,u=-s;e<=t;e++,u+=a){o.push(-s,0,u,s,0,u),o.push(u,0,-s,u,0,s);let t=e===n?i:r;t.toArray(l,h),h+=3,t.toArray(l,h),h+=3,t.toArray(l,h),h+=3,t.toArray(l,h),h+=3}let h=new BufferGeometry;h.setAttribute("position",new Float32BufferAttribute(o,3)),h.setAttribute("color",new Float32BufferAttribute(l,3));let u=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}};let PolarGridHelper=class PolarGridHelper extends LineSegments{dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=10,t=16,i=8,r=64,n=4473924,a=8947848){n=new Color(n),a=new Color(a);let s=[],o=[];if(t>1)for(let i=0;i<t;i++){let r=i/t*(2*Math.PI),l=Math.sin(r)*e,h=Math.cos(r)*e;s.push(0,0,0),s.push(l,0,h);let u=1&i?n:a;o.push(u.r,u.g,u.b),o.push(u.r,u.g,u.b)}for(let t=0;t<i;t++){let l=1&t?n:a,h=e-e/i*t;for(let e=0;e<r;e++){let t=e/r*(2*Math.PI),i=Math.sin(t)*h,n=Math.cos(t)*h;s.push(i,0,n),o.push(l.r,l.g,l.b),i=Math.sin(t=(e+1)/r*(2*Math.PI))*h,n=Math.cos(t)*h,s.push(i,0,n),o.push(l.r,l.g,l.b)}}let l=new BufferGeometry;l.setAttribute("position",new Float32BufferAttribute(s,3)),l.setAttribute("color",new Float32BufferAttribute(o,3));let h=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(l,h),this.type="PolarGridHelper"}};let sK=new Vector3,sZ=new Vector3,sJ=new Vector3;let DirectionalLightHelper=class DirectionalLightHelper extends Object3D{dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),sK.setFromMatrixPosition(this.light.matrixWorld),sZ.setFromMatrixPosition(this.light.target.matrixWorld),sJ.subVectors(sZ,sK),this.lightPlane.lookAt(sZ),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(sZ),this.targetLine.scale.z
5=sJ.length()}constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===t&&(t=1);let r=new BufferGeometry;r.setAttribute("position",new Float32BufferAttribute([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let n=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(r,n),this.add(this.lightPlane),(r=new BufferGeometry).setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(r,n),this.add(this.targetLine),this.update()}};let sQ=new Vector3,s$=new Camera;let CameraHelper=class CameraHelper extends LineSegments{setColors(e,t,i,r,n){let a=this.geometry,s=a.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,i.r,i.g,i.b),s.setXYZ(33,i.r,i.g,i.b),s.setXYZ(34,i.r,i.g,i.b),s.setXYZ(35,i.r,i.g,i.b),s.setXYZ(36,i.r,i.g,i.b),s.setXYZ(37,i.r,i.g,i.b),s.setXYZ(38,r.r,r.g,r.b),s.setXYZ(39,r.r,r.g,r.b),s.setXYZ(40,n.r,n.g,n.b),s.setXYZ(41,n.r,n.g,n.b),s.setXYZ(42,n.r,n.g,n.b),s.setXYZ(43,n.r,n.g,n.b),s.setXYZ(44,n.r,n.g,n.b),s.setXYZ(45,n.r,n.g,n.b),s.setXYZ(46,n.r,n.g,n.b),s.setXYZ(47,n.r,n.g,n.b),s.setXYZ(48,n.r,n.g,n.b),s.setXYZ(49,n.r,n.g,n.b),s.needsUpdate=!0}update(){let e=this.geometry,t=this.pointMap;s$.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",t,e,s$,0,0,-1),setPoint("t",t,e,s$,0,0,1),setPoint("n1",t,e,s$,-1,-1,-1),setPoint("n2",t,e,s$,1,-1,-1),setPoint("n3",t,e,s$,-1,1,-1),setPoint("n4",t,e,s$,1,1,-1),setPoint("f1",t,e,s$,-1,-1,1),setPoint("f2",t,e,s$,1,-1,1),setPoint("f3",t,e,s$,-1,1,1),setPoint("f4",t,e,s$,1,1,1),setPoint("u1",t,e,s$,.7,1.1,-1),setPoint("u2",t,e,s$,-.7,1.1,-1),setPoint("u3",t,e,s$,0,2,-1),setPoint("cf1",t,e,s$,-1,0,1),setPoint("cf2",t,e,s$,1,0,1),setPoint("cf3",t,e,s$,0,-1,1),setPoint("cf4",t,e,s$,0,1,1),setPoint("cn1",t,e,s$,-1,0,-1),setPoint("cn2",t,e,s$,1,0,-1),setPoint("cn3",t,e,s$,0,-1,-1),setPoint("cn4",t,e,s$,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e){let t=new BufferGeometry,i=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],a={};function addLine(e,t){addPoint(e),addPoint(t)}function addPoint(e){r.push(0,0,0),n.push(0,0,0),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}addLine("n1","n2"),addLine("n2","n4"),addLine("n4","n3"),addLine("n3","n1"),addLine("f1","f2"),addLine("f2","f4"),addLine("f4","f3"),addLine("f3","f1"),addLine("n1","f1"),addLine("n2","f2"),addLine("n3","f3"),addLine("n4","f4"),addLine("p","n1"),addLine("p","n2"),addLine("p","n3"),addLine("p","n4"),addLine("u1","u2"),addLine("u2","u3"),addLine("u3","u1"),addLine("c","t"),addLine("p","c"),addLine("cn1","cn2"),addLine("cn3","cn4"),addLine("cf1","cf2"),addLine("cf3","cf4"),t.setAttribute("position",new Float32BufferAttribute(r,3)),t.setAttribute("color",new Float32BufferAttribute(n,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();let s=new Color(16755200),o=new Color(16711680),l=new Color(43775),h=new Color(16777215),u=new Color(3355443);this.setColors(s,o,l,h,u)}};function setPoint(e,t,i,r,n,a,s){sQ.set(n,a,s).unproject(r);let o=t[e];if(void 0!==o){let e=i.getAttribute("position");for(let t=0,i=o.length;t<i;t++)e.setXYZ(o[t],sQ.x,sQ.y,sQ.z)}}let s0=new Box3;let BoxHelper=class BoxHelper extends LineSegments{update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update(
5) has no longer arguments."),void 0!==this.object&&s0.setFromObject(this.object),s0.isEmpty())return;let t=s0.min,i=s0.max,r=this.geometry.attributes.position,n=r.array;n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=t.x,n[4]=i.y,n[5]=i.z,n[6]=t.x,n[7]=t.y,n[8]=i.z,n[9]=i.x,n[10]=t.y,n[11]=i.z,n[12]=i.x,n[13]=i.y,n[14]=t.z,n[15]=t.x,n[16]=i.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=i.x,n[22]=t.y,n[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e,t=16776960){let i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),n=new BufferGeometry;n.setIndex(new BufferAttribute(i,1)),n.setAttribute("position",new BufferAttribute(r,3)),super(n,new LineBasicMaterial({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}};let Box3Helper=class Box3Helper extends LineSegments{updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e,t=16776960){let i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new BufferGeometry;r.setIndex(new BufferAttribute(i,1)),r.setAttribute("position",new Float32BufferAttribute([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new LineBasicMaterial({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}};let PlaneHelper=class PlaneHelper extends Line{updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}constructor(e,t=1,i=16776960){let r=new BufferGeometry;r.setAttribute("position",new Float32BufferAttribute([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new LineBasicMaterial({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;let n=new BufferGeometry;n.setAttribute("position",new Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),n.computeBoundingSphere(),this.add(new Mesh(n,new MeshBasicMaterial({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}};let s1=new Vector3;let ArrowHelper=class ArrowHelper extends Object3D{setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{s1.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(s1,t)}}setLength(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}constructor(e=new Vector3(0,0,1),t=new Vector3(0,0,0),i=1,r=16776960,n=.2*i,a=.2*n){super(),this.type="ArrowHelper",void 0===s&&((s=new BufferGeometry).setAttribute("position",new Float32BufferAttribute([0,0,0,0,1,0],3)),(o=new CylinderGeometry(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Line(s,new LineBasicMaterial({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(o,new MeshBasicMaterial({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,n,a)}};let AxesHelper=class AxesHelper extends LineSegments{setColors(e,t,i){let r=new Color,n=this.geometry.attributes.color.array;return r.set(e),r.toArray(n,0),r.toArray(n,3),r.set(t),r.toArray(n,6),r.toArray(n,9),r.set(i),r.toArray(n,12),r.toArray(n,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=new BufferGeometry;i.setAttribute("position",new Float32BufferAttribute(t,3)),i.setAttribute("color",new Float32BufferAttribute([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));let r=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}};let ShapePath=class ShapePath{moveTo(e,t){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,n,a){return this.currentPath.bezierCurveTo(e,t,i,r,n,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,i,r,n,a;let s=ShapeUtils.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];
5if(1===o.length)return i=o[0],(r=new Shape).curves=i.curves,l.push(r),l;let h=!s(o[0].getPoints());h=e?!h:h;let u=[],c=[],d=[],p=0;c[0]=void 0,d[p]=[];for(let r=0,a=o.length;r<a;r++)t=s(n=(i=o[r]).getPoints()),(t=e?!t:t)?(!h&&c[p]&&p++,c[p]={s:new Shape,p:n},c[p].s.curves=i.curves,h&&p++,d[p]=[]):d[p].push({h:i,p:n[0]});if(!c[0])return function(e){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i],n=new Shape;n.curves=r.curves,t.push(n)}return t}(o);if(c.length>1){let e=!1,t=0;for(let e=0,t=c.length;e<t;e++)u[e]=[];for(let i=0,r=c.length;i<r;i++){let r=d[i];for(let n=0;n<r.length;n++){let a=r[n],s=!0;for(let r=0;r<c.length;r++)(function(e,t){let i=t.length,r=!1;for(let n=i-1,a=0;a<i;n=a++){let i=t[n],s=t[a],o=s.x-i.x,l=s.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=t[a],o=-o,s=t[n],l=-l),e.y<i.y||e.y>s.y)continue;if(e.y===i.y){if(e.x===i.x)return!0}else{let t=l*(e.x-i.x)-o*(e.y-i.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==i.y)continue;if(s.x<=e.x&&e.x<=i.x||i.x<=e.x&&e.x<=s.x)return!0}}return r})(a.p,c[r].p)&&(i!==r&&t++,s?(s=!1,u[r].push(a)):e=!0);s&&u[i].push(a)}}t>0&&!1===e&&(d=u)}for(let e=0,t=c.length;e<t;e++){r=c[e].s,l.push(r),a=d[e];for(let e=0,t=a.length;e<t;e++)r.holes.push(a[e].h)}return l}constructor(){this.type="ShapePath",this.color=new Color,this.subPaths=[],this.currentPath=null}};let WebGLMultipleRenderTargets=class WebGLMultipleRenderTargets extends WebGLRenderTarget{get texture(){return this.textures}constructor(e=1,t=1,i=1,r={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:l}})),window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=l}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.