700 lines
383 KiB
JavaScript
700 lines
383 KiB
JavaScript
// three@0.183.2 downloaded from https://ga.jspm.io/npm:three@0.183.2/build/three.module.js
|
|
|
|
import{c as e,V as t,C as n,f$ as a,a as r,u as l,d as c,at as d,a8 as u,a7 as p,fe as m,B as h,g0 as _,h as v,S as E,b0 as S,b1 as T,g1 as x,n as R,as as b,al as C,aG as L,Y as U,w,aM as N,an as y,x as O,y as B,ar as G,aa as V,ap as W,ao as k,N as z,ah as X,e as Y,aq as K,fU as q,a3 as $,v as J,_ as te,ab as ne,ac as ae,ad as ie,m as re,aB as oe,aC as se,b as le,X as ce,dQ as fe,cX as ue,cW as pe,cV as me,cU as he,cT as _e,cS as ge,aP as ve,f9 as Ee,T as Se,$ as Me,dS as Te,q as xe,p as Re,cq as Ae,aR as be,aS as Ce,ae as Pe,af as Le,ag as Ue,e8 as De,eu as we,t as Ie,aH as Ne,z as ye,O as Fe,g2 as Oe,R as Be,b8 as Ge,eK as He,eL as Ve,aT as We,aE as ke,r as ze,aV as Xe,U as Ye,bB as Ke,bC as qe,bD as je,bE as Ze,bF as $e,bG as Qe,bH as Je,bI as tt,bJ as nt,bw as at,bl as it,bm as rt,aK as ot,cK as st,cJ as lt,eR as ut,dG as pt,eS as mt,dH as ht,bn as _t,bo as gt,aJ as vt,bp as Et,bq as St,br as Mt,bs as Tt,aI as xt,bt as Rt,bu as At,b3 as bt,b2 as Ct,by as Pt,bz as Lt,bA as Ut,bv as Dt,bx as wt,g3 as It,aF as Nt,bi as yt,cj as Ft,am as Ot,ck as Bt,aX as Gt,aY as Ht,cl as Vt,cm as Wt,G as kt,cn as zt,L as Xt,co as Yt,cp as Kt,k as qt,aD as jt,cr as Zt,bK as $t,bL as Qt,bM as Jt,bN as tn,bh as nn,bg as an,bO as rn,be as on,bb as sn,ba as ln,bc as cn,bf as un,bP as pn,bQ as mn,bR as hn,bS as _n,bT as gn,bU as vn,bV as En,bW as Sn,bX as Mn,bY as Tn,bZ as xn,b_ as Rn,b$ as An,K as bn,c0 as Cn,c1 as Pn,c2 as Ln,c3 as Un,c4 as Dn,c5 as wn,c6 as In,c7 as Nn,c8 as yn,c9 as Fn,ca as On,cb as Bn,cc as Gn,cd as Hn,ce as Vn,cf as Wn,f6 as kn,f7 as zn,cg as Xn,ch as Yn,J as Kn,ci as qn,e2 as jn,E as Zn,a$ as $n,b6 as Qn,b7 as Jn,ak as ta,bk as na,a5 as aa,a_ as ia,l as ra,W as oa,g4 as sa}from"../_/nWl398M7.js";export{d1 as AdditiveAnimationBlendMode,cz as AlwaysStencilFunc,cP as AmbientLight,d2 as AnimationAction,d3 as AnimationClip,d4 as AnimationLoader,d5 as AnimationMixer,d6 as AnimationObjectGroup,d7 as AnimationUtils,d8 as ArcCurve,d9 as ArrowHelper,da as AttachedBindMode,db as Audio,dc as AudioAnalyser,dd as AudioContext,de as AudioListener,df as AudioLoader,dg as AxesHelper,dh as BasicDepthPacking,aU as BasicShadowMap,di as BatchedMesh,dj as BezierInterpolant,dk as Bone,dl as BooleanKeyframeTrack,dm as Box2,dn as Box3,dp as Box3Helper,dq as BoxHelper,dr as BufferGeometryLoader,ds as Cache,dt as Camera,du as CameraHelper,dv as CanvasTexture,dw as CapsuleGeometry,dx as CatmullRomCurve3,dy as CircleGeometry,dz as Clock,dA as ColorKeyframeTrack,o as Compatibility,dB as CompressedArrayTexture,dC as CompressedCubeTexture,dD as CompressedTexture,dE as CompressedTextureLoader,dF as ConeGeometry,dI as Controls,dJ as CubeTextureLoader,dK as CubicBezierCurve,dL as CubicBezierCurve3,dM as CubicInterpolant,dN as CullFaceFrontBack,dO as Curve,dP as CurvePath,b4 as CylinderGeometry,dR as Cylindrical,dT as DataTextureLoader,dU as DataUtils,cD as DecrementStencilOp,cB as DecrementWrapStencilOp,dV as DefaultLoadingManager,dW as DetachedBindMode,cN as DirectionalLight,dX as DirectionalLightHelper,dY as DiscreteInterpolant,dZ as DodecahedronGeometry,d_ as DynamicCopyUsage,D as DynamicDrawUsage,d$ as DynamicReadUsage,e0 as EdgesGeometry,e1 as EllipseCurve,cw as EqualStencilFunc,e3 as ExtrudeGeometry,c_ as FileLoader,aZ as Float16BufferAttribute,e4 as Fog,e5 as FogExp2,Z as FramebufferTexture,b9 as FrustumArray,e6 as GLBufferAttribute,e7 as GLSL1,cv as GreaterEqualStencilFunc,cu as GreaterStencilFunc,e9 as GridHelper,cY as Group,cQ as HemisphereLight,ea as HemisphereLightHelper,eb as IcosahedronGeometry,ec as ImageBitmapLoader,ed as ImageLoader,ee as ImageUtils,cE as IncrementStencilOp,cC as IncrementWrapStencilOp,P as InstancedBufferAttribute,ef as InstancedBufferGeometry,Q as InstancedInterleavedBuffer,eg as InstancedMesh,eh as Int16BufferAttribute,ei as Int32BufferAttribute,ej as Int8BufferAttribute,I as InterleavedBuffer,j as InterleavedBufferAttribute,ek as Interpolant,el as InterpolateBezier,em as InterpolateDiscrete,en as InterpolateLinear,eo as InterpolateSmooth,ep as InterpolationSamplingMode,eq as InterpolationSamplingType,cF as InvertStencilOp,cI as KeepStencilOp,er as KeyframeTrack,es as LOD,et as LatheGeometry,cx as LessEqualStencilFunc,cy as LessStencilFunc,ev as Light,cR as LightProbe,ew as Line,ex as Line3,a1 as LineBasicMaterial,ey as LineCurve,ez as LineCurve3,a2 as LineDashedMaterial,eA as LineLoop,eB as LineSegments,eC as LinearInterpolant,aO as LinearMipMapLinearFilter,eD as LinearMipMapNearestFilter,cZ as Loader,eE as LoaderUtils,eF as LoadingManager,eG as LoopOnce,eH as LoopPingPong,eI as LoopRepeat,eJ as MOUSE,a0 as Material,aL as MaterialBlending,c$ as MaterialLoader,f as MathUtils,M as Matrix2,ai as MeshLambertMaterial,ax as MeshMatcapMaterial,a4 as MeshNormalMaterial,aj as MeshPhongMaterial,av as MeshPhysicalMaterial,au as MeshStandardMaterial,aw as MeshToonMaterial,eM as NearestMipMapLinearFilter,eN as NearestMipMapNearestFilter,cA as NeverStencilFunc,A as NoNormalPacking,eO as NormalAnimationBlendMode,H as NormalGAPacking,F as NormalRGPacking,ct as NotEqualStencilFunc,eP as NumberKeyframeTrack,aN as Object3D,d0 as ObjectLoader,eQ as OctahedronGeometry,eT as Path,eU as PlaneHelper,cM as PointLight,eV as PointLightHelper,eW as Points,az as PointsMaterial,eX as PolarGridHelper,eY as PolyhedronGeometry,eZ as PositionalAudio,e_ as PropertyBinding,e$ as PropertyMixer,f0 as QuadraticBezierCurve,f1 as QuadraticBezierCurve3,b5 as Quaternion,f2 as QuaternionKeyframeTrack,f3 as QuaternionLinearInterpolant,f4 as RGBADepthPacking,f5 as RGBDepthPacking,bd as RGBIntegerFormat,f8 as RGDepthPacking,fa as Ray,fb as Raycaster,cO as RectAreaLight,a6 as RenderTarget,fc as RenderTarget3D,cG as ReplaceStencilOp,fd as RingGeometry,a9 as Scene,aA as ShadowMaterial,ff as Shape,fg as ShapeGeometry,fh as ShapePath,fi as ShapeUtils,fj as Skeleton,fk as SkeletonHelper,fl as SkinnedMesh,fm as Source,s as Sphere,aW as SphereGeometry,fn as Spherical,fo as SphericalHarmonics3,fp as SplineCurve,cL as SpotLight,fq as SpotLightHelper,fr as Sprite,ay as SpriteMaterial,fs as StaticCopyUsage,i as StaticDrawUsage,ft as StaticReadUsage,fu as StereoCamera,fv as StreamCopyUsage,fw as StreamDrawUsage,fx as StreamReadUsage,fy as StringKeyframeTrack,fz as TOUCH,fA as TetrahedronGeometry,fB as TextureLoader,fC as TextureUtils,fD as Timer,bj as TimestampQuery,fE as TorusGeometry,fF as TorusKnotGeometry,fG as Triangle,fH as TriangleFanDrawMode,fI as TriangleStripDrawMode,fJ as TrianglesDrawMode,fK as TubeGeometry,aQ as UVMapping,fL as Uint8BufferAttribute,fM as Uint8ClampedBufferAttribute,fN as Uniform,fO as UniformsGroup,fP as VectorKeyframeTrack,fQ as VideoFrameTexture,fR as VideoTexture,fS as WebGL3DRenderTarget,fT as WebGLArrayRenderTarget,g as WebGPUCoordinateSystem,fV as WireframeGeometry,fW as WrapAroundEnding,fX as ZeroCurvatureEnding,fY as ZeroSlopeEnding,cH as ZeroStencilOp,fZ as getConsoleFunction,f_ as setConsoleFunction}from"../_/nWl398M7.js";
|
|
/**
|
|
* @license
|
|
* Copyright 2010-2026 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
*/function la(){let e=null;let t=false;let n=null;let a=null;function i(t,r){n(t,r);a=e.requestAnimationFrame(i)}return{start:function(){if(t!==true&&n!==null){a=e.requestAnimationFrame(i);t=true}},stop:function(){e.cancelAnimationFrame(a);t=false},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ca(e){const t=new WeakMap;function n(t,n){const a=t.array;const i=t.usage;const r=a.byteLength;const o=e.createBuffer();e.bindBuffer(n,o);e.bufferData(n,a,i);t.onUploadCallback();let s;if(a instanceof Float32Array)s=e.FLOAT;else if(typeof Float16Array!=="undefined"&&a instanceof Float16Array)s=e.HALF_FLOAT;else if(a instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(a instanceof Int16Array)s=e.SHORT;else if(a instanceof Uint32Array)s=e.UNSIGNED_INT;else if(a instanceof Int32Array)s=e.INT;else if(a instanceof Int8Array)s=e.BYTE;else if(a instanceof Uint8Array)s=e.UNSIGNED_BYTE;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);s=e.UNSIGNED_BYTE}return{buffer:o,type:s,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version,size:r}}function a(t,n,a){const i=n.array;const r=n.updateRanges;e.bindBuffer(a,t);if(r.length===0)e.bufferSubData(a,0,i);else{r.sort(((e,t)=>e.start-t.start));let t=0;for(let e=1;e<r.length;e++){const n=r[t];const a=r[e];if(a.start<=n.start+n.count+1)n.count=Math.max(n.count,a.start+a.count-n.start);else{++t;r[t]=a}}r.length=t+1;for(let t=0,n=r.length;t<n;t++){const n=r[t];e.bufferSubData(a,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}function i(e){e.isInterleavedBufferAttribute&&(e=e.data);return t.get(e)}function r(n){n.isInterleavedBufferAttribute&&(n=n.data);const a=t.get(n);if(a){e.deleteBuffer(a.buffer);t.delete(n)}}function o(e,i){e.isInterleavedBufferAttribute&&(e=e.data);if(e.isGLBufferAttribute){const n=t.get(e);(!n||n.version<e.version)&&t.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version});return}const r=t.get(e);if(r===void 0)t.set(e,n(e,i));else if(r.version<e.version){if(r.size!==e.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(r.buffer,e,i);r.version=e.version}}return{get:i,remove:r,update:o}}var ua="#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif";var pa="#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif";var ma="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif";var ha="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";var _a="#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif";var ga="#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";var va="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";var Ea="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";var Sa="#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec4 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n\t}\n#endif";var Ma="#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif";var Ta="vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";var xa="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";var Ra="float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated";var Aa="#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.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\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";var ba="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";var Ca="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif";var Pa="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";var La="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif";var Ua="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif";var Da="#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#endif";var wa="#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#endif";var Ia="#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec4 vColor;\n#endif";var Na="#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif";var ya="#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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";var Fa="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";var Oa="vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";var Ba="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";var Ga="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif";var Ha="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif";var Va="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif";var Wa="gl_FragColor = linearToOutputTexel( gl_FragColor );";var ka="vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";var za="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif";var Xa="#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif";var Ya="#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";var Ka="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";var qa="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";var ja="#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif";var Za="#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif";var $a="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif";var Qa="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";var Ja="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";var ti="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";var ni="LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";var ii="varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat 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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";var ri="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";var oi="#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";var si="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";var li="varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 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\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";var ci="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";var ui="varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat 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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";var pi="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = 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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";var mi="uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn v;\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn 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\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\n\t}\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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\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\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\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\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";var hi="\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\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";var _i="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";var gi="#if defined( RE_IndirectDiffuse )\n\t#if defined( LAMBERT ) || defined( PHONG )\n\t\tirradiance += iblIrradiance;\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";var vi="#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";var Ei="#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";var Si="#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";var Mi="#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";var Ti="#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";var xi="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";var Ri="#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";var Ai="#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";var bi="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif";var Ci="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";var Pi="#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif";var Li="#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif";var Ui="#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";var Di="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif";var wi="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";var Ii="float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";var Ni="#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";var yi="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";var Fi="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";var Oi="#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";var Bi="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";var Gi="#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";var Hi="#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";var Vi="#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif";var Wi="#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif";var ki="#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";var zi="vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;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\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn 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\treturn 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\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\t#else\n\t\treturn depth * ( near - far ) - near;\n\t#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\t#else\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\t#endif\n}";var Xi="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";var Yi="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";var Ki="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";var qi="#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif";var ji="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";var Zi="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";var $i="#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\t\t\t#else\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\t\t\t#endif\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tdepth = 1.0 - depth;\n\t\t\t#endif\n\t\t\tshadow = step( dp, depth );\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif";var Qi="#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";var Ji="#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif";var tr="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";var nr="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";var ar="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";var ir="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";var rr="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif";var or="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif";var sr="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif";var lr="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";var cr="#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";var ur="#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";var pr="#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";var mr="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";var hr="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";var _r="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";var gr="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";const vr="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";const Er="uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const Sr="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";const Mr="#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform 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\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const Tr="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";const xr="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const Rr="#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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";const Ar="#if DEPTH_PACKING == 3200\n\tuniform 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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";const br="#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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";const Cr="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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 <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}";const Pr="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";const Lr="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const Ur="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\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";const Dr="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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";const wr="#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";const Ir="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying 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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const Nr="#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const yr="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const Fr="#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";const Or="#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const Br="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying 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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";const Gr="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\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\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";const Hr="#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const Vr="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\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 <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const Wr="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying 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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";const kr="#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\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 <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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const zr="#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const Xr="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const Yr="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\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";const Kr="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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";const qr="#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\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const jr="uniform vec3 color;\nuniform float opacity;\n#include <common>\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\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";const Zr="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\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";const $r="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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";const Qr={alphahash_fragment:ua,alphahash_pars_fragment:pa,alphamap_fragment:ma,alphamap_pars_fragment:ha,alphatest_fragment:_a,alphatest_pars_fragment:ga,aomap_fragment:va,aomap_pars_fragment:Ea,batching_pars_vertex:Sa,batching_vertex:Ma,begin_vertex:Ta,beginnormal_vertex:xa,bsdfs:Ra,iridescence_fragment:Aa,bumpmap_pars_fragment:ba,clipping_planes_fragment:Ca,clipping_planes_pars_fragment:Pa,clipping_planes_pars_vertex:La,clipping_planes_vertex:Ua,color_fragment:Da,color_pars_fragment:wa,color_pars_vertex:Ia,color_vertex:Na,common:ya,cube_uv_reflection_fragment:Fa,defaultnormal_vertex:Oa,displacementmap_pars_vertex:Ba,displacementmap_vertex:Ga,emissivemap_fragment:Ha,emissivemap_pars_fragment:Va,colorspace_fragment:Wa,colorspace_pars_fragment:ka,envmap_fragment:za,envmap_common_pars_fragment:Xa,envmap_pars_fragment:Ya,envmap_pars_vertex:Ka,envmap_physical_pars_fragment:oi,envmap_vertex:qa,fog_vertex:ja,fog_pars_vertex:Za,fog_fragment:$a,fog_pars_fragment:Qa,gradientmap_pars_fragment:Ja,lightmap_pars_fragment:ti,lights_lambert_fragment:ni,lights_lambert_pars_fragment:ii,lights_pars_begin:ri,lights_toon_fragment:si,lights_toon_pars_fragment:li,lights_phong_fragment:ci,lights_phong_pars_fragment:ui,lights_physical_fragment:pi,lights_physical_pars_fragment:mi,lights_fragment_begin:hi,lights_fragment_maps:_i,lights_fragment_end:gi,logdepthbuf_fragment:vi,logdepthbuf_pars_fragment:Ei,logdepthbuf_pars_vertex:Si,logdepthbuf_vertex:Mi,map_fragment:Ti,map_pars_fragment:xi,map_particle_fragment:Ri,map_particle_pars_fragment:Ai,metalnessmap_fragment:bi,metalnessmap_pars_fragment:Ci,morphinstance_vertex:Pi,morphcolor_vertex:Li,morphnormal_vertex:Ui,morphtarget_pars_vertex:Di,morphtarget_vertex:wi,normal_fragment_begin:Ii,normal_fragment_maps:Ni,normal_pars_fragment:yi,normal_pars_vertex:Fi,normal_vertex:Oi,normalmap_pars_fragment:Bi,clearcoat_normal_fragment_begin:Gi,clearcoat_normal_fragment_maps:Hi,clearcoat_pars_fragment:Vi,iridescence_pars_fragment:Wi,opaque_fragment:ki,packing:zi,premultiplied_alpha_fragment:Xi,project_vertex:Yi,dithering_fragment:Ki,dithering_pars_fragment:qi,roughnessmap_fragment:ji,roughnessmap_pars_fragment:Zi,shadowmap_pars_fragment:$i,shadowmap_pars_vertex:Qi,shadowmap_vertex:Ji,shadowmask_pars_fragment:tr,skinbase_vertex:nr,skinning_pars_vertex:ar,skinning_vertex:ir,skinnormal_vertex:rr,specularmap_fragment:or,specularmap_pars_fragment:sr,tonemapping_fragment:lr,tonemapping_pars_fragment:cr,transmission_fragment:ur,transmission_pars_fragment:pr,uv_pars_fragment:mr,uv_pars_vertex:hr,uv_vertex:_r,worldpos_vertex:gr,background_vert:vr,background_frag:Er,backgroundCube_vert:Sr,backgroundCube_frag:Mr,cube_vert:Tr,cube_frag:xr,depth_vert:Rr,depth_frag:Ar,distance_vert:br,distance_frag:Cr,equirect_vert:Pr,equirect_frag:Lr,linedashed_vert:Ur,linedashed_frag:Dr,meshbasic_vert:wr,meshbasic_frag:Ir,meshlambert_vert:Nr,meshlambert_frag:yr,meshmatcap_vert:Fr,meshmatcap_frag:Or,meshnormal_vert:Br,meshnormal_frag:Gr,meshphong_vert:Hr,meshphong_frag:Vr,meshphysical_vert:Wr,meshphysical_frag:kr,meshtoon_vert:zr,meshtoon_frag:Xr,points_vert:Yr,points_frag:Kr,shadow_vert:qr,shadow_frag:jr,sprite_vert:Zr,sprite_frag:$r};const Jr={common:{diffuse:{value:new n(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new e}},envmap:{envMap:{value:null},envMapRotation:{value:new e},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new e}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new e}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new e},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new e},normalScale:{value:new t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new e},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new e}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new e}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new e}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new n(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},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 n(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0},uvTransform:{value:new e}},sprite:{diffuse:{value:new n(16777215)},opacity:{value:1},center:{value:new t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new e},alphaMap:{value:null},alphaMapTransform:{value:new e},alphaTest:{value:0}}};const to={basic:{uniforms:a([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.fog]),vertexShader:Qr.meshbasic_vert,fragmentShader:Qr.meshbasic_frag},lambert:{uniforms:a([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.fog,Jr.lights,{emissive:{value:new n(0)},envMapIntensity:{value:1}}]),vertexShader:Qr.meshlambert_vert,fragmentShader:Qr.meshlambert_frag},phong:{uniforms:a([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.fog,Jr.lights,{emissive:{value:new n(0)},specular:{value:new n(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Qr.meshphong_vert,fragmentShader:Qr.meshphong_frag},standard:{uniforms:a([Jr.common,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.roughnessmap,Jr.metalnessmap,Jr.fog,Jr.lights,{emissive:{value:new n(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qr.meshphysical_vert,fragmentShader:Qr.meshphysical_frag},toon:{uniforms:a([Jr.common,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.gradientmap,Jr.fog,Jr.lights,{emissive:{value:new n(0)}}]),vertexShader:Qr.meshtoon_vert,fragmentShader:Qr.meshtoon_frag},matcap:{uniforms:a([Jr.common,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.fog,{matcap:{value:null}}]),vertexShader:Qr.meshmatcap_vert,fragmentShader:Qr.meshmatcap_frag},points:{uniforms:a([Jr.points,Jr.fog]),vertexShader:Qr.points_vert,fragmentShader:Qr.points_frag},dashed:{uniforms:a([Jr.common,Jr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qr.linedashed_vert,fragmentShader:Qr.linedashed_frag},depth:{uniforms:a([Jr.common,Jr.displacementmap]),vertexShader:Qr.depth_vert,fragmentShader:Qr.depth_frag},normal:{uniforms:a([Jr.common,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,{opacity:{value:1}}]),vertexShader:Qr.meshnormal_vert,fragmentShader:Qr.meshnormal_frag},sprite:{uniforms:a([Jr.sprite,Jr.fog]),vertexShader:Qr.sprite_vert,fragmentShader:Qr.sprite_frag},background:{uniforms:{uvTransform:{value:new e},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qr.background_vert,fragmentShader:Qr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new e}},vertexShader:Qr.backgroundCube_vert,fragmentShader:Qr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qr.cube_vert,fragmentShader:Qr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qr.equirect_vert,fragmentShader:Qr.equirect_frag},distance:{uniforms:a([Jr.common,Jr.displacementmap,{referencePosition:{value:new r},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qr.distance_vert,fragmentShader:Qr.distance_frag},shadow:{uniforms:a([Jr.lights,Jr.fog,{color:{value:new n(0)},opacity:{value:1}}]),vertexShader:Qr.shadow_vert,fragmentShader:Qr.shadow_frag}};to.physical={uniforms:a([to.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new e},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new e},clearcoatNormalScale:{value:new t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new e},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new e},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new e},sheen:{value:0},sheenColor:{value:new n(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new e},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new e},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new e},transmissionSamplerSize:{value:new t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new e},attenuationDistance:{value:0},attenuationColor:{value:new n(0)},specularColor:{value:new n(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new e},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new e},anisotropyVector:{value:new t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new e}}]),vertexShader:Qr.meshphysical_vert,fragmentShader:Qr.meshphysical_frag};const no={r:0,b:0,g:0};const ao=new l;const io=new c;function ro(e,t,a,i,r,o){const s=new n(0);let l=r===true?0:1;let c;let f;let g=null;let M=0;let R=null;function A(e){let n=e.isScene===true?e.background:null;if(n&&n.isTexture){const a=e.backgroundBlurriness>0;n=t.get(n,a)}return n}function b(t){let n=false;const i=A(t);if(i===null)P(s,l);else if(i&&i.isColor){P(i,1);n=true}const r=e.xr.getEnvironmentBlendMode();r==="additive"?a.buffers.color.setClear(0,0,0,1,o):r==="alpha-blend"&&a.buffers.color.setClear(0,0,0,0,o);if(e.autoClear||n){a.buffers.depth.setTest(true);a.buffers.depth.setMask(true);a.buffers.color.setMask(true);e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}}function C(t,n){const a=A(n);if(a&&(a.isCubeTexture||a.mapping===d)){if(f===void 0){f=new u(new p(1,1,1),new m({name:"BackgroundCubeMaterial",uniforms:_(to.backgroundCube.uniforms),vertexShader:to.backgroundCube.vertexShader,fragmentShader:to.backgroundCube.fragmentShader,side:h,depthTest:false,depthWrite:false,fog:false,allowOverride:false}));f.geometry.deleteAttribute("normal");f.geometry.deleteAttribute("uv");f.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)};Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}});i.update(f)}ao.copy(n.backgroundRotation);ao.x*=-1;ao.y*=-1;ao.z*=-1;if(a.isCubeTexture&&a.isRenderTargetTexture===false){ao.y*=-1;ao.z*=-1}f.material.uniforms.envMap.value=a;f.material.uniforms.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===false?-1:1;f.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness;f.material.uniforms.backgroundIntensity.value=n.backgroundIntensity;f.material.uniforms.backgroundRotation.value.setFromMatrix4(io.makeRotationFromEuler(ao));f.material.toneMapped=v.getTransfer(a.colorSpace)!==E;if(g!==a||M!==a.version||R!==e.toneMapping){f.material.needsUpdate=true;g=a;M=a.version;R=e.toneMapping}f.layers.enableAll();t.unshift(f,f.geometry,f.material,0,0,null)}else if(a&&a.isTexture){if(c===void 0){c=new u(new S(2,2),new m({name:"BackgroundMaterial",uniforms:_(to.background.uniforms),vertexShader:to.background.vertexShader,fragmentShader:to.background.fragmentShader,side:T,depthTest:false,depthWrite:false,fog:false,allowOverride:false}));c.geometry.deleteAttribute("normal");Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}});i.update(c)}c.material.uniforms.t2D.value=a;c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity;c.material.toneMapped=v.getTransfer(a.colorSpace)!==E;a.matrixAutoUpdate===true&&a.updateMatrix();c.material.uniforms.uvTransform.value.copy(a.matrix);if(g!==a||M!==a.version||R!==e.toneMapping){c.material.needsUpdate=true;g=a;M=a.version;R=e.toneMapping}c.layers.enableAll();t.unshift(c,c.geometry,c.material,0,0,null)}}function P(t,n){t.getRGB(no,x(e));a.buffers.color.setClear(no.r,no.g,no.b,n,o)}function L(){if(f!==void 0){f.geometry.dispose();f.material.dispose();f=void 0}if(c!==void 0){c.geometry.dispose();c.material.dispose();c=void 0}}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e);l=t;P(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(e){l=e;P(s,l)},render:b,addToRenderList:C,dispose:L}}function oo(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS);const a={};const i=u(null);let r=i;let o=false;function s(n,a,i,s,l){let d=false;const u=f(n,s,i,a);if(r!==u){r=u;c(r.object)}d=p(n,s,i,l);d&&m(n,s,i,l);l!==null&&t.update(l,e.ELEMENT_ARRAY_BUFFER);if(d||o){o=false;S(n,a,i,s);l!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(l).buffer)}}function l(){return e.createVertexArray()}function c(t){return e.bindVertexArray(t)}function d(t){return e.deleteVertexArray(t)}function f(e,t,n,i){const r=i.wireframe===true;let o=a[t.id];if(o===void 0){o={};a[t.id]=o}const s=e.isInstancedMesh===true?e.id:0;let c=o[s];if(c===void 0){c={};o[s]=c}let d=c[n.id];if(d===void 0){d={};c[n.id]=d}let f=d[r];if(f===void 0){f=u(l());d[r]=f}return f}function u(e){const t=[];const a=[];const i=[];for(let e=0;e<n;e++){t[e]=0;a[e]=0;i[e]=0}return{geometry:null,program:null,wireframe:false,newAttributes:t,enabledAttributes:a,attributeDivisors:i,object:e,attributes:{},index:null}}function p(e,t,n,a){const i=r.attributes;const o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){const n=l[t];if(n.location>=0){const n=i[t];let a=o[t];if(a===void 0){t==="instanceMatrix"&&e.instanceMatrix&&(a=e.instanceMatrix);t==="instanceColor"&&e.instanceColor&&(a=e.instanceColor)}if(n===void 0)return true;if(n.attribute!==a)return true;if(a&&n.data!==a.data)return true;s++}}return r.attributesNum!==s||r.index!==a}function m(e,t,n,a){const i={};const o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l){const n=l[t];if(n.location>=0){let n=o[t];if(n===void 0){t==="instanceMatrix"&&e.instanceMatrix&&(n=e.instanceMatrix);t==="instanceColor"&&e.instanceColor&&(n=e.instanceColor)}const a={};a.attribute=n;n&&n.data&&(a.data=n.data);i[t]=a;s++}}r.attributes=i;r.attributesNum=s;r.index=a}function h(){const e=r.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function _(e){g(e,0)}function g(t,n){const a=r.newAttributes;const i=r.enabledAttributes;const o=r.attributeDivisors;a[t]=1;if(i[t]===0){e.enableVertexAttribArray(t);i[t]=1}if(o[t]!==n){e.vertexAttribDivisor(t,n);o[t]=n}}function v(){const t=r.newAttributes;const n=r.enabledAttributes;for(let a=0,i=n.length;a<i;a++)if(n[a]!==t[a]){e.disableVertexAttribArray(a);n[a]=0}}function E(t,n,a,i,r,o,s){s===true?e.vertexAttribIPointer(t,n,a,r,o):e.vertexAttribPointer(t,n,a,i,r,o)}function S(n,a,i,r){h();const o=r.attributes;const s=i.getAttributes();const l=a.defaultAttributeValues;for(const a in s){const i=s[a];if(i.location>=0){let s=o[a];if(s===void 0){a==="instanceMatrix"&&n.instanceMatrix&&(s=n.instanceMatrix);a==="instanceColor"&&n.instanceColor&&(s=n.instanceColor)}if(s!==void 0){const a=s.normalized;const o=s.itemSize;const l=t.get(s);if(l===void 0)continue;const c=l.buffer;const d=l.type;const f=l.bytesPerElement;const u=d===e.INT||d===e.UNSIGNED_INT||s.gpuType===R;if(s.isInterleavedBufferAttribute){const t=s.data;const l=t.stride;const p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)g(i.location+e,t.meshPerAttribute);n.isInstancedMesh!==true&&r._maxInstanceCount===void 0&&(r._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)_(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<i.locationSize;e++)E(i.location+e,o/i.locationSize,d,a,l*f,(p+o/i.locationSize*e)*f,u)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)g(i.location+e,s.meshPerAttribute);n.isInstancedMesh!==true&&r._maxInstanceCount===void 0&&(r._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<i.locationSize;e++)_(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<i.locationSize;e++)E(i.location+e,o/i.locationSize,d,a,o*f,o/i.locationSize*e*f,u)}}else if(l!==void 0){const t=l[a];if(t!==void 0)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}v()}function M(){b();for(const e in a){const t=a[e];for(const e in t){const n=t[e];for(const e in n){const t=n[e];for(const e in t){d(t[e].object);delete t[e]}delete n[e]}}delete a[e]}}function T(e){if(a[e.id]===void 0)return;const t=a[e.id];for(const e in t){const n=t[e];for(const e in n){const t=n[e];for(const e in t){d(t[e].object);delete t[e]}delete n[e]}}delete a[e.id]}function x(e){for(const t in a){const n=a[t];for(const t in n){const a=n[t];if(a[e.id]===void 0)continue;const i=a[e.id];for(const e in i){d(i[e].object);delete i[e]}delete a[e.id]}}}function A(e){for(const t in a){const n=a[t];const i=e.isInstancedMesh===true?e.id:0;const r=n[i];if(r!==void 0){for(const e in r){const t=r[e];for(const e in t){d(t[e].object);delete t[e]}delete r[e]}delete n[i];Object.keys(n).length===0&&delete a[t]}}}function b(){C();o=true;if(r!==i){r=i;c(r.object)}}function C(){i.geometry=null;i.program=null;i.wireframe=false}return{setup:s,reset:b,resetDefaultState:C,dispose:M,releaseStatesOfGeometry:T,releaseStatesOfObject:A,releaseStatesOfProgram:x,initAttributes:h,enableAttribute:_,disableUnusedAttributes:v}}function so(e,t,n){let a;function i(e){a=e}function r(t,i){e.drawArrays(a,t,i);n.update(i,a,1)}function o(t,i,r){if(r!==0){e.drawArraysInstanced(a,t,i,r);n.update(i,a,r)}}function s(e,i,r){if(r===0)return;const o=t.get("WEBGL_multi_draw");o.multiDrawArraysWEBGL(a,e,0,i,0,r);let s=0;for(let e=0;e<r;e++)s+=i[e];n.update(s,a,1)}function l(e,i,r,s){if(r===0)return;const l=t.get("WEBGL_multi_draw");if(l===null)for(let t=0;t<e.length;t++)o(e[t],i[t],s[t]);else{l.multiDrawArraysInstancedWEBGL(a,e,0,i,0,s,0,r);let t=0;for(let e=0;e<r;e++)t+=i[e]*s[e];n.update(t,a,1)}}this.setMode=i;this.render=r;this.renderInstances=o;this.renderMultiDraw=s;this.renderMultiDrawInstances=l}function lo(e,t,n,a){let i;function r(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===true){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(t){return t===b||a.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)}function s(n){const i=n===C&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==L&&a.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==U&&!i)}function l(t){if(t==="highp"){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 t==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);if(d!==c){w("WebGLRenderer:",c,"not supported, using",d,"instead.");c=d}const f=n.logarithmicDepthBuffer===true;const u=n.reversedDepthBuffer===true&&t.has("EXT_clip_control");const p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);const m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);const h=e.getParameter(e.MAX_TEXTURE_SIZE);const _=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE);const g=e.getParameter(e.MAX_VERTEX_ATTRIBS);const v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS);const E=e.getParameter(e.MAX_VARYING_VECTORS);const S=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS);const M=e.getParameter(e.MAX_SAMPLES);const T=e.getParameter(e.SAMPLES);return{isWebGL2:true,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:s,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:u,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:v,maxVaryings:E,maxFragmentUniforms:S,maxSamples:M,samples:T}}function co(t){const n=this;let a=null,i=0,r=false,o=false;const s=new N,l=new e,c={value:null,needsUpdate:false};this.uniform=c;this.numPlanes=0;this.numIntersection=0;this.init=function(e,t){const n=e.length!==0||t||i!==0||r;r=t;i=e.length;return n};this.beginShadows=function(){o=true;f(null)};this.endShadows=function(){o=false};this.setGlobalState=function(e,t){a=f(e,t,0)};this.setState=function(e,n,s){const l=e.clippingPlanes,u=e.clipIntersection,p=e.clipShadows;const m=t.get(e);if(!r||l===null||l.length===0||o&&!p)o?f(null):d();else{const e=o?0:i,t=e*4;let r=m.clippingState||null;c.value=r;r=f(l,n,t,s);for(let e=0;e!==t;++e)r[e]=a[e];m.clippingState=r;this.numIntersection=u?this.numPlanes:0;this.numPlanes+=e}};function d(){if(c.value!==a){c.value=a;c.needsUpdate=i>0}n.numPlanes=i;n.numIntersection=0}function f(e,t,a,i){const r=e!==null?e.length:0;let o=null;if(r!==0){o=c.value;if(i!==true||o===null){const n=a+r*4,i=t.matrixWorldInverse;l.getNormalMatrix(i);(o===null||o.length<n)&&(o=new Float32Array(n));for(let t=0,n=a;t!==r;++t,n+=4){s.copy(e[t]).applyMatrix4(i,l);s.normal.toArray(o,n);o[n+3]=s.constant}}c.value=o;c.needsUpdate=true}n.numPlanes=r;n.numIntersection=0;return o}}const uo=4;const po=[.125,.215,.35,.446,.526,.582];const mo=20;const ho=256;const _o=new y;const go=new n;let vo=null;let Eo=0;let So=0;let Mo=false;const To=new r;class PMREMGenerator{
|
|
/**
|
|
* Constructs a new PMREM generator.
|
|
*
|
|
* @param {WebGLRenderer} renderer - The renderer.
|
|
*/
|
|
constructor(e){this._renderer=e;this._pingPongRenderTarget=null;this._lodMax=0;this._cubeSize=0;this._sizeLods=[];this._sigmas=[];this._lodMeshes=[];this._backgroundBox=null;this._cubemapMaterial=null;this._equirectMaterial=null;this._blurMaterial=null;this._ggxMaterial=null}
|
|
/**
|
|
* Generates a PMREM from a supplied Scene, which can be faster than using an
|
|
* image if networking bandwidth is low. Optional sigma specifies a blur radius
|
|
* in radians to be applied to the scene before PMREM generation. Optional near
|
|
* and far planes ensure the scene is rendered in its entirety.
|
|
*
|
|
* @param {Scene} scene - The scene to be captured.
|
|
* @param {number} [sigma=0] - The blur radius in radians.
|
|
* @param {number} [near=0.1] - The near plane distance.
|
|
* @param {number} [far=100] - The far plane distance.
|
|
* @param {Object} [options={}] - The configuration options.
|
|
* @param {number} [options.size=256] - The texture size of the PMREM.
|
|
* @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene.
|
|
* @return {WebGLRenderTarget} The resulting PMREM.
|
|
*/fromScene(e,t=0,n=.1,a=100,i={}){const{size:r=256,position:o=To}=i;vo=this._renderer.getRenderTarget();Eo=this._renderer.getActiveCubeFace();So=this._renderer.getActiveMipmapLevel();Mo=this._renderer.xr.enabled;this._renderer.xr.enabled=false;this._setSize(r);const s=this._allocateTargets();s.depthBuffer=true;this._sceneToCubeUV(e,n,a,s,o);t>0&&this._blur(s,0,0,t);this._applyPMREM(s);this._cleanup(s);return s}
|
|
/**
|
|
* Generates a PMREM from an equirectangular texture, which can be either LDR
|
|
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
* as this matches best with the 256 x 256 cubemap output.
|
|
*
|
|
* @param {Texture} equirectangular - The equirectangular texture to be converted.
|
|
* @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
|
|
* @return {WebGLRenderTarget} The resulting PMREM.
|
|
*/fromEquirectangular(e,t=null){return this._fromTexture(e,t)}
|
|
/**
|
|
* Generates a PMREM from an cubemap texture, which can be either LDR
|
|
* or HDR. The ideal input cube size is 256 x 256,
|
|
* as this matches best with the 256 x 256 cubemap output.
|
|
*
|
|
* @param {Texture} cubemap - The cubemap texture to be converted.
|
|
* @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
|
|
* @return {WebGLRenderTarget} The resulting PMREM.
|
|
*/fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null){this._cubemapMaterial=Lo();this._compileMaterial(this._cubemapMaterial)}}compileEquirectangularShader(){if(this._equirectMaterial===null){this._equirectMaterial=Po();this._compileMaterial(this._equirectMaterial)}}dispose(){this._dispose();this._cubemapMaterial!==null&&this._cubemapMaterial.dispose();this._equirectMaterial!==null&&this._equirectMaterial.dispose();if(this._backgroundBox!==null){this._backgroundBox.geometry.dispose();this._backgroundBox.material.dispose()}}_setSize(e){this._lodMax=Math.floor(Math.log2(e));this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose();this._ggxMaterial!==null&&this._ggxMaterial.dispose();this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(vo,Eo,So);this._renderer.xr.enabled=Mo;e.scissorTest=false;Ao(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===O||e.mapping===B?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4);vo=this._renderer.getRenderTarget();Eo=this._renderer.getActiveCubeFace();So=this._renderer.getActiveMipmapLevel();Mo=this._renderer.xr.enabled;this._renderer.xr.enabled=false;const n=t||this._allocateTargets();this._textureToCubeUV(e,n);this._applyPMREM(n);this._cleanup(n);return n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112);const t=4*this._cubeSize;const n={magFilter:V,minFilter:V,generateMipmaps:false,type:C,format:b,colorSpace:G,depthBuffer:false};const a=Ro(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose();this._pingPongRenderTarget=Ro(e,t,n);const{_lodMax:a}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=xo(a));this._blurMaterial=Co(a,e,t);this._ggxMaterial=bo(a,e,t)}return a}_compileMaterial(e){const t=new u(new W,e);this._renderer.compile(t,_o)}_sceneToCubeUV(e,t,n,a,i){const r=90;const o=1;const s=new k(r,o,t,n);const l=[1,-1,1,1,1,1];const c=[1,1,1,-1,-1,-1];const d=this._renderer;const f=d.autoClear;const m=d.toneMapping;d.getClearColor(go);d.toneMapping=z;d.autoClear=false;const _=d.state.buffers.depth.getReversed();if(_){d.setRenderTarget(a);d.clearDepth();d.setRenderTarget(null)}this._backgroundBox===null&&(this._backgroundBox=new u(new p,new X({name:"PMREM.Background",side:h,depthWrite:false,depthTest:false})));const g=this._backgroundBox;const v=g.material;let E=false;const S=e.background;if(S){if(S.isColor){v.color.copy(S);e.background=null;E=true}}else{v.color.copy(go);E=true}for(let t=0;t<6;t++){const n=t%3;if(n===0){s.up.set(0,l[t],0);s.position.set(i.x,i.y,i.z);s.lookAt(i.x+c[t],i.y,i.z)}else if(n===1){s.up.set(0,0,l[t]);s.position.set(i.x,i.y,i.z);s.lookAt(i.x,i.y+c[t],i.z)}else{s.up.set(0,l[t],0);s.position.set(i.x,i.y,i.z);s.lookAt(i.x,i.y,i.z+c[t])}const r=this._cubeSize;Ao(a,n*r,t>2?r:0,r,r);d.setRenderTarget(a);E&&d.render(g,s);d.render(e,s)}d.toneMapping=m;d.autoClear=f;e.background=S}_textureToCubeUV(e,t){const n=this._renderer;const a=e.mapping===O||e.mapping===B;if(a){this._cubemapMaterial===null&&(this._cubemapMaterial=Lo());this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===false?-1:1}else this._equirectMaterial===null&&(this._equirectMaterial=Po());const i=a?this._cubemapMaterial:this._equirectMaterial;const r=this._lodMeshes[0];r.material=i;const o=i.uniforms;o.envMap.value=e;const s=this._cubeSize;Ao(t,0,0,3*s,2*s);n.setRenderTarget(t);n.render(r,_o)}_applyPMREM(e){const t=this._renderer;const n=t.autoClear;t.autoClear=false;const a=this._lodMeshes.length;for(let t=1;t<a;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}
|
|
/**
|
|
* Applies GGX VNDF importance sampling filter to generate a prefiltered environment map.
|
|
* Uses Monte Carlo integration with VNDF importance sampling to accurately represent the
|
|
* GGX BRDF for physically-based rendering. Reads from the previous LOD level and
|
|
* applies incremental roughness filtering to avoid over-blurring.
|
|
*
|
|
* @private
|
|
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
* @param {number} lodIn - Source LOD level to read from
|
|
* @param {number} lodOut - Target LOD level to write to
|
|
*/_applyGGXFilter(e,t,n){const a=this._renderer;const i=this._pingPongRenderTarget;const r=this._ggxMaterial;const o=this._lodMeshes[n];o.material=r;const s=r.uniforms;const l=n/(this._lodMeshes.length-1);const c=t/(this._lodMeshes.length-1);const d=Math.sqrt(l*l-c*c);const f=0+l*1.25;const u=d*f;const{_lodMax:p}=this;const m=this._sizeLods[n];const h=3*m*(n>p-uo?n-p+uo:0);const _=4*(this._cubeSize-m);s.envMap.value=e.texture;s.roughness.value=u;s.mipInt.value=p-t;Ao(i,h,_,3*m,2*m);a.setRenderTarget(i);a.render(o,_o);s.envMap.value=i.texture;s.roughness.value=0;s.mipInt.value=p-n;Ao(e,h,_,3*m,2*m);a.setRenderTarget(e);a.render(o,_o)}
|
|
/**
|
|
* This is a two-pass Gaussian blur for a cubemap. Normally this is done
|
|
* vertically and horizontally, but this breaks down on a cube. Here we apply
|
|
* the blur latitudinally (around the poles), and then longitudinally (towards
|
|
* the poles) to approximate the orthogonally-separable blur. It is least
|
|
* accurate at the poles, but still does a decent job.
|
|
*
|
|
* Used for initial scene blur in fromScene() method when sigma > 0.
|
|
*
|
|
* @private
|
|
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
* @param {number} lodIn
|
|
* @param {number} lodOut
|
|
* @param {number} sigma
|
|
* @param {Vector3} [poleAxis]
|
|
*/_blur(e,t,n,a,i){const r=this._pingPongRenderTarget;this._halfBlur(e,r,t,n,a,"latitudinal",i);this._halfBlur(r,e,n,n,a,"longitudinal",i)}_halfBlur(e,t,n,a,i,r,o){const s=this._renderer;const l=this._blurMaterial;r!=="latitudinal"&&r!=="longitudinal"&&Y("blur direction must be either latitudinal or longitudinal!");const c=3;const d=this._lodMeshes[a];d.material=l;const f=l.uniforms;const u=this._sizeLods[n]-1;const p=isFinite(i)?Math.PI/(2*u):2*Math.PI/(2*mo-1);const m=i/p;const h=isFinite(i)?1+Math.floor(c*m):mo;h>mo&&w(`sigmaRadians, ${i}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${mo}`);const _=[];let g=0;for(let e=0;e<mo;++e){const t=e/m;const n=Math.exp(-t*t/2);_.push(n);e===0?g+=n:e<h&&(g+=2*n)}for(let e=0;e<_.length;e++)_[e]=_[e]/g;f.envMap.value=e.texture;f.samples.value=h;f.weights.value=_;f.latitudinal.value=r==="latitudinal";o&&(f.poleAxis.value=o);const{_lodMax:v}=this;f.dTheta.value=p;f.mipInt.value=v-n;const E=this._sizeLods[a];const S=3*E*(a>v-uo?a-v+uo:0);const M=4*(this._cubeSize-E);Ao(t,S,M,3*E,2*E);s.setRenderTarget(t);s.render(d,_o)}}function xo(e){const t=[];const n=[];const a=[];let i=e;const r=e-uo+1+po.length;for(let o=0;o<r;o++){const r=Math.pow(2,i);t.push(r);let s=1/r;o>e-uo?s=po[o-e+uo-1]:o===0&&(s=0);n.push(s);const l=1/(r-2);const c=-l;const d=1+l;const f=[c,c,d,c,d,d,c,c,d,d,c,d];const p=6;const m=6;const h=3;const _=2;const g=1;const v=new Float32Array(h*m*p);const E=new Float32Array(_*m*p);const S=new Float32Array(g*m*p);for(let e=0;e<p;e++){const t=e%3*2/3-1;const n=e>2?0:-1;const a=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(a,h*m*e);E.set(f,_*m*e);const i=[e,e,e,e,e,e];S.set(i,g*m*e)}const M=new W;M.setAttribute("position",new K(v,h));M.setAttribute("uv",new K(E,_));M.setAttribute("faceIndex",new K(S,g));a.push(new u(M,null));i>uo&&i--}return{lodMeshes:a,sizeLods:t,sigmas:n}}function Ro(e,t,n){const a=new q(e,t,n);a.texture.mapping=d;a.texture.name="PMREM.cubeUv";a.scissorTest=true;return a}function Ao(e,t,n,a,i){e.viewport.set(t,n,a,i);e.scissor.set(t,n,a,i)}function bo(e,t,n){const a=new m({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:ho,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Uo(),fragmentShader:'\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tvec3 T1 = vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(V, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + V.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:$,depthTest:false,depthWrite:false});return a}function Co(e,t,n){const a=new Float32Array(mo);const i=new r(0,1,0);const o=new m({name:"SphericalGaussianBlur",defines:{n:mo,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:a},latitudinal:{value:false},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Uo(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:$,depthTest:false,depthWrite:false});return o}function Po(){return new m({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Uo(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:$,depthTest:false,depthWrite:false})}function Lo(){return new m({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Uo(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:$,depthTest:false,depthWrite:false})}function Uo(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}class WebGLCubeRenderTarget extends q{
|
|
/**
|
|
* Constructs a new cube render target.
|
|
*
|
|
* @param {number} [size=1] - The size of the render target.
|
|
* @param {RenderTarget~Options} [options] - The configuration object.
|
|
*/
|
|
constructor(e=1,t={}){super(e,e,t);
|
|
/**
|
|
* This flag can be used for type testing.
|
|
*
|
|
* @type {boolean}
|
|
* @readonly
|
|
* @default true
|
|
*/this.isWebGLCubeRenderTarget=true;const n={width:e,height:e,depth:1};const a=[n,n,n,n,n,n];
|
|
/**
|
|
* Overwritten with a different texture type.
|
|
*
|
|
* @type {DataArrayTexture}
|
|
*/this.texture=new J(a);this._setTextureOptions(t);this.texture.isRenderTargetTexture=true}
|
|
/**
|
|
* Converts the given equirectangular texture to a cube map.
|
|
*
|
|
* @param {WebGLRenderer} renderer - The renderer.
|
|
* @param {Texture} texture - The equirectangular texture.
|
|
* @return {WebGLCubeRenderTarget} A reference to this cube render target.
|
|
*/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;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"};const a=new p(5,5,5);const i=new m({name:"CubemapFromEquirect",uniforms:_(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:h,blending:$});i.uniforms.tEquirect.value=t;const r=new u(a,i);const o=t.minFilter;t.minFilter===te&&(t.minFilter=V);const s=new ne(1,10,this);s.update(e,r);t.minFilter=o;r.geometry.dispose();r.material.dispose();return this}
|
|
/**
|
|
* Clears this cube render target.
|
|
*
|
|
* @param {WebGLRenderer} renderer - The renderer.
|
|
* @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
* @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
* @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
*/clear(e,t=true,n=true,a=true){const i=e.getRenderTarget();for(let i=0;i<6;i++){e.setRenderTarget(this,i);e.clear(t,n,a)}e.setRenderTarget(i)}}function Do(e){let t=new WeakMap;let n=new WeakMap;let a=null;function i(e,t=false){return e===null||e===void 0?null:t?o(e):r(e)}function r(n){if(n&&n.isTexture){const a=n.mapping;if(a===ae||a===ie){if(t.has(n)){const e=t.get(n).texture;return s(e,n.mapping)}{const a=n.image;if(a&&a.height>0){const i=new WebGLCubeRenderTarget(a.height);i.fromEquirectangularTexture(e,n);t.set(n,i);n.addEventListener("dispose",c);return s(i.texture,n.mapping)}return null}}}return n}function o(t){if(t&&t.isTexture){const i=t.mapping;const r=i===ae||i===ie;const o=i===O||i===B;if(r||o){let i=n.get(t);const s=i!==void 0?i.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==s){a===null&&(a=new PMREMGenerator(e));i=r?a.fromEquirectangular(t,i):a.fromCubemap(t,i);i.texture.pmremVersion=t.pmremVersion;n.set(t,i);return i.texture}if(i!==void 0)return i.texture;{const s=t.image;if(r&&s&&s.height>0||o&&s&&l(s)){a===null&&(a=new PMREMGenerator(e));i=r?a.fromEquirectangular(t):a.fromCubemap(t);i.texture.pmremVersion=t.pmremVersion;n.set(t,i);t.addEventListener("dispose",d);return i.texture}return null}}}return t}function s(e,t){t===ae?e.mapping=O:t===ie&&(e.mapping=B);return e}function l(e){let t=0;const n=6;for(let a=0;a<n;a++)e[a]!==void 0&&t++;return t===n}function c(e){const n=e.target;n.removeEventListener("dispose",c);const a=t.get(n);if(a!==void 0){t.delete(n);a.dispose()}}function d(e){const t=e.target;t.removeEventListener("dispose",d);const a=n.get(t);if(a!==void 0){n.delete(t);a.dispose()}}function f(){t=new WeakMap;n=new WeakMap;if(a!==null){a.dispose();a=null}}return{get:i,dispose:f}}function wo(e){const t={};function n(n){if(t[n]!==void 0)return t[n];const a=e.getExtension(n);t[n]=a;return a}return{has:function(e){return n(e)!==null},init:function(){n("EXT_color_buffer_float");n("WEBGL_clip_cull_distance");n("OES_texture_float_linear");n("EXT_color_buffer_half_float");n("WEBGL_multisampled_render_to_texture");n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);t===null&&re("WebGLRenderer: "+e+" extension not supported.");return t}}}function Io(e,t,n,a){const i={};const r=new WeakMap;function o(e){const s=e.target;s.index!==null&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener("dispose",o);delete i[s.id];const l=r.get(s);if(l){t.remove(l);r.delete(s)}a.releaseStatesOfGeometry(s);s.isInstancedBufferGeometry===true&&delete s._maxInstanceCount;n.memory.geometries--}function s(e,t){if(i[t.id]===true)return t;t.addEventListener("dispose",o);i[t.id]=true;n.memory.geometries++;return t}function l(n){const a=n.attributes;for(const n in a)t.update(a[n],e.ARRAY_BUFFER)}function c(e){const n=[];const a=e.index;const i=e.attributes.position;let o=0;if(i===void 0)return;if(a!==null){const e=a.array;o=a.version;for(let t=0,a=e.length;t<a;t+=3){const a=e[t+0];const i=e[t+1];const r=e[t+2];n.push(a,i,i,r,r,a)}}else{const e=i.array;o=i.version;for(let t=0,a=e.length/3-1;t<a;t+=3){const e=t+0;const a=t+1;const i=t+2;n.push(e,a,a,i,i,e)}}const s=new(i.count>=65535?oe:se)(n,1);s.version=o;const l=r.get(e);l&&t.remove(l);r.set(e,s)}function d(e){const t=r.get(e);if(t){const n=e.index;n!==null&&t.version<n.version&&c(e)}else c(e);return r.get(e)}return{get:s,update:l,getWireframeAttribute:d}}function No(e,t,n){let a;function i(e){a=e}let r,o;function s(e){r=e.type;o=e.bytesPerElement}function l(t,i){e.drawElements(a,i,r,t*o);n.update(i,a,1)}function c(t,i,s){if(s!==0){e.drawElementsInstanced(a,i,r,t*o,s);n.update(i,a,s)}}function d(e,i,o){if(o===0)return;const s=t.get("WEBGL_multi_draw");s.multiDrawElementsWEBGL(a,i,0,r,e,0,o);let l=0;for(let e=0;e<o;e++)l+=i[e];n.update(l,a,1)}function f(e,i,s,l){if(s===0)return;const d=t.get("WEBGL_multi_draw");if(d===null)for(let t=0;t<e.length;t++)c(e[t]/o,i[t],l[t]);else{d.multiDrawElementsInstancedWEBGL(a,i,0,r,e,0,l,0,s);let t=0;for(let e=0;e<s;e++)t+=i[e]*l[e];n.update(t,a,1)}}this.setMode=i;this.setIndex=s;this.render=l;this.renderInstances=c;this.renderMultiDraw=d;this.renderMultiDrawInstances=f}function yo(e){const t={geometries:0,textures:0};const n={frame:0,calls:0,triangles:0,points:0,lines:0};function a(t,a,i){n.calls++;switch(a){case e.TRIANGLES:n.triangles+=i*(t/3);break;case e.LINES:n.lines+=i*(t/2);break;case e.LINE_STRIP:n.lines+=i*(t-1);break;case e.LINE_LOOP:n.lines+=i*t;break;case e.POINTS:n.points+=i*t;break;default:Y("WebGLInfo: Unknown draw mode:",a);break}}function i(){n.calls=0;n.triangles=0;n.points=0;n.lines=0}return{memory:t,render:n,programs:null,autoReset:true,reset:i,update:a}}function Fo(e,n,a){const i=new WeakMap;const r=new le;function o(o,s,l){const c=o.morphTargetInfluences;const d=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color;const f=d!==void 0?d.length:0;let u=i.get(s);if(u===void 0||u.count!==f){u!==void 0&&u.texture.dispose();const p=s.morphAttributes.position!==void 0;const m=s.morphAttributes.normal!==void 0;const h=s.morphAttributes.color!==void 0;const _=s.morphAttributes.position||[];const g=s.morphAttributes.normal||[];const v=s.morphAttributes.color||[];let E=0;p===true&&(E=1);m===true&&(E=2);h===true&&(E=3);let S=s.attributes.position.count*E;let M=1;if(S>n.maxTextureSize){M=Math.ceil(S/n.maxTextureSize);S=n.maxTextureSize}const T=new Float32Array(S*M*4*f);const x=new ce(T,S,M,f);x.type=U;x.needsUpdate=true;const R=E*4;for(let b=0;b<f;b++){const C=_[b];const P=g[b];const L=v[b];const D=S*M*4*b;for(let w=0;w<C.count;w++){const I=w*R;if(p===true){r.fromBufferAttribute(C,w);T[D+I+0]=r.x;T[D+I+1]=r.y;T[D+I+2]=r.z;T[D+I+3]=0}if(m===true){r.fromBufferAttribute(P,w);T[D+I+4]=r.x;T[D+I+5]=r.y;T[D+I+6]=r.z;T[D+I+7]=0}if(h===true){r.fromBufferAttribute(L,w);T[D+I+8]=r.x;T[D+I+9]=r.y;T[D+I+10]=r.z;T[D+I+11]=L.itemSize===4?r.w:1}}}u={count:f,texture:x,size:new t(S,M)};i.set(s,u);function A(){x.dispose();i.delete(s);s.removeEventListener("dispose",A)}s.addEventListener("dispose",A)}if(o.isInstancedMesh===true&&o.morphTexture!==null)l.getUniforms().setValue(e,"morphTexture",o.morphTexture,a);else{let N=0;for(let F=0;F<c.length;F++)N+=c[F];const y=s.morphTargetsRelative?1:1-N;l.getUniforms().setValue(e,"morphTargetBaseInfluence",y);l.getUniforms().setValue(e,"morphTargetInfluences",c)}l.getUniforms().setValue(e,"morphTargetsTexture",u.texture,a);l.getUniforms().setValue(e,"morphTargetsTextureSize",u.size)}return{update:o}}function Oo(e,t,n,a,i){let r=new WeakMap;function o(a){const o=i.render.frame;const s=a.geometry;const c=t.get(a,s);if(r.get(c)!==o){t.update(c);r.set(c,o)}if(a.isInstancedMesh){a.hasEventListener("dispose",l)===false&&a.addEventListener("dispose",l);if(r.get(a)!==o){n.update(a.instanceMatrix,e.ARRAY_BUFFER);a.instanceColor!==null&&n.update(a.instanceColor,e.ARRAY_BUFFER);r.set(a,o)}}if(a.isSkinnedMesh){const e=a.skeleton;if(r.get(e)!==o){e.update();r.set(e,o)}}return c}function s(){r=new WeakMap}function l(e){const t=e.target;t.removeEventListener("dispose",l);a.releaseStatesOfObject(t);n.remove(t.instanceMatrix);t.instanceColor!==null&&n.remove(t.instanceColor)}return{update:o,dispose:s}}const Bo={[ge]:"LINEAR_TONE_MAPPING",[_e]:"REINHARD_TONE_MAPPING",[he]:"CINEON_TONE_MAPPING",[me]:"ACES_FILMIC_TONE_MAPPING",[pe]:"AGX_TONE_MAPPING",[ue]:"NEUTRAL_TONE_MAPPING",[fe]:"CUSTOM_TONE_MAPPING"};function Go(e,t,n,a,i){const r=new q(t,n,{type:e,depthBuffer:a,stencilBuffer:i});const o=new q(t,n,{type:C,depthBuffer:false,stencilBuffer:false});const s=new W;s.setAttribute("position",new ve([-1,3,0,-1,-1,0,3,-1,0],3));s.setAttribute("uv",new ve([0,2,0,0,2,0],2));const l=new Ee({uniforms:{tDiffuse:{value:null}},vertexShader:"\n\t\t\tprecision highp float;\n\n\t\t\tuniform mat4 modelViewMatrix;\n\t\t\tuniform mat4 projectionMatrix;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t}",fragmentShader:"\n\t\t\tprecision highp float;\n\n\t\t\tuniform sampler2D tDiffuse;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\t#include <tonemapping_pars_fragment>\n\t\t\t#include <colorspace_pars_fragment>\n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}",depthTest:false,depthWrite:false});const c=new u(s,l);const d=new y(-1,1,1,-1,0,1);let f=null;let p=null;let m=false;let h;let _=null;let g=[];let S=false;this.setSize=function(e,t){r.setSize(e,t);o.setSize(e,t);for(let n=0;n<g.length;n++){const a=g[n];a.setSize&&a.setSize(e,t)}};this.setEffects=function(e){g=e;S=g.length>0&&g[0].isRenderPass===true;const t=r.width;const n=r.height;for(let e=0;e<g.length;e++){const a=g[e];a.setSize&&a.setSize(t,n)}};this.begin=function(e,t){if(m)return false;if(e.toneMapping===z&&g.length===0)return false;_=t;if(t!==null){const e=t.width;const n=t.height;r.width===e&&r.height===n||this.setSize(e,n)}S===false&&e.setRenderTarget(r);h=e.toneMapping;e.toneMapping=z;return true};this.hasRenderPass=function(){return S};this.end=function(e,t){e.toneMapping=h;m=true;let n=r;let a=o;for(let i=0;i<g.length;i++){const r=g[i];if(r.enabled!==false){r.render(e,a,n,t);if(r.needsSwap!==false){const e=n;n=a;a=e}}}if(f!==e.outputColorSpace||p!==e.toneMapping){f=e.outputColorSpace;p=e.toneMapping;l.defines={};v.getTransfer(f)===E&&(l.defines.SRGB_TRANSFER="");const t=Bo[p];t&&(l.defines[t]="");l.needsUpdate=true}l.uniforms.tDiffuse.value=n.texture;e.setRenderTarget(_);e.render(c,d);_=null;m=false};this.isCompositing=function(){return m};this.dispose=function(){r.dispose();o.dispose();s.dispose();l.dispose()}}const Ho=new Se;const Vo=new Me(1,1);const Wo=new ce;const ko=new Te;const zo=new J;const Xo=[];const Yo=[];const Ko=new Float32Array(16);const qo=new Float32Array(9);const jo=new Float32Array(4);function Zo(e,t,n){const a=e[0];if(a<=0||a>0)return e;const i=t*n;let r=Xo[i];if(r===void 0){r=new Float32Array(i);Xo[i]=r}if(t!==0){a.toArray(r,0);for(let a=1,i=0;a!==t;++a){i+=n;e[a].toArray(r,i)}}return r}function $o(e,t){if(e.length!==t.length)return false;for(let n=0,a=e.length;n<a;n++)if(e[n]!==t[n])return false;return true}function Qo(e,t){for(let n=0,a=t.length;n<a;n++)e[n]=t[n]}function Jo(e,t){let n=Yo[t];if(n===void 0){n=new Int32Array(t);Yo[t]=n}for(let a=0;a!==t;++a)n[a]=e.allocateTextureUnit();return n}function ts(e,t){const n=this.cache;if(n[0]!==t){e.uniform1f(this.addr,t);n[0]=t}}function ns(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y){e.uniform2f(this.addr,t.x,t.y);n[0]=t.x;n[1]=t.y}}else{if($o(n,t))return;e.uniform2fv(this.addr,t);Qo(n,t)}}function as(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z){e.uniform3f(this.addr,t.x,t.y,t.z);n[0]=t.x;n[1]=t.y;n[2]=t.z}}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b){e.uniform3f(this.addr,t.r,t.g,t.b);n[0]=t.r;n[1]=t.g;n[2]=t.b}}else{if($o(n,t))return;e.uniform3fv(this.addr,t);Qo(n,t)}}function is(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w){e.uniform4f(this.addr,t.x,t.y,t.z,t.w);n[0]=t.x;n[1]=t.y;n[2]=t.z;n[3]=t.w}}else{if($o(n,t))return;e.uniform4fv(this.addr,t);Qo(n,t)}}function rs(e,t){const n=this.cache;const a=t.elements;if(a===void 0){if($o(n,t))return;e.uniformMatrix2fv(this.addr,false,t);Qo(n,t)}else{if($o(n,a))return;jo.set(a);e.uniformMatrix2fv(this.addr,false,jo);Qo(n,a)}}function os(e,t){const n=this.cache;const a=t.elements;if(a===void 0){if($o(n,t))return;e.uniformMatrix3fv(this.addr,false,t);Qo(n,t)}else{if($o(n,a))return;qo.set(a);e.uniformMatrix3fv(this.addr,false,qo);Qo(n,a)}}function ss(e,t){const n=this.cache;const a=t.elements;if(a===void 0){if($o(n,t))return;e.uniformMatrix4fv(this.addr,false,t);Qo(n,t)}else{if($o(n,a))return;Ko.set(a);e.uniformMatrix4fv(this.addr,false,Ko);Qo(n,a)}}function ls(e,t){const n=this.cache;if(n[0]!==t){e.uniform1i(this.addr,t);n[0]=t}}function cs(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y){e.uniform2i(this.addr,t.x,t.y);n[0]=t.x;n[1]=t.y}}else{if($o(n,t))return;e.uniform2iv(this.addr,t);Qo(n,t)}}function us(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z){e.uniform3i(this.addr,t.x,t.y,t.z);n[0]=t.x;n[1]=t.y;n[2]=t.z}}else{if($o(n,t))return;e.uniform3iv(this.addr,t);Qo(n,t)}}function ps(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w){e.uniform4i(this.addr,t.x,t.y,t.z,t.w);n[0]=t.x;n[1]=t.y;n[2]=t.z;n[3]=t.w}}else{if($o(n,t))return;e.uniform4iv(this.addr,t);Qo(n,t)}}function ms(e,t){const n=this.cache;if(n[0]!==t){e.uniform1ui(this.addr,t);n[0]=t}}function hs(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y){e.uniform2ui(this.addr,t.x,t.y);n[0]=t.x;n[1]=t.y}}else{if($o(n,t))return;e.uniform2uiv(this.addr,t);Qo(n,t)}}function _s(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z){e.uniform3ui(this.addr,t.x,t.y,t.z);n[0]=t.x;n[1]=t.y;n[2]=t.z}}else{if($o(n,t))return;e.uniform3uiv(this.addr,t);Qo(n,t)}}function gs(e,t){const n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w){e.uniform4ui(this.addr,t.x,t.y,t.z,t.w);n[0]=t.x;n[1]=t.y;n[2]=t.z;n[3]=t.w}}else{if($o(n,t))return;e.uniform4uiv(this.addr,t);Qo(n,t)}}function vs(e,t,n){const a=this.cache;const i=n.allocateTextureUnit();if(a[0]!==i){e.uniform1i(this.addr,i);a[0]=i}let r;if(this.type===e.SAMPLER_2D_SHADOW){Vo.compareFunction=n.isReversedDepthBuffer()?xe:Re;r=Vo}else r=Ho;n.setTexture2D(t||r,i)}function Es(e,t,n){const a=this.cache;const i=n.allocateTextureUnit();if(a[0]!==i){e.uniform1i(this.addr,i);a[0]=i}n.setTexture3D(t||ko,i)}function Ss(e,t,n){const a=this.cache;const i=n.allocateTextureUnit();if(a[0]!==i){e.uniform1i(this.addr,i);a[0]=i}n.setTextureCube(t||zo,i)}function Ms(e,t,n){const a=this.cache;const i=n.allocateTextureUnit();if(a[0]!==i){e.uniform1i(this.addr,i);a[0]=i}n.setTexture2DArray(t||Wo,i)}function Ts(e){switch(e){case 5126:return ts;case 35664:return ns;case 35665:return as;case 35666:return is;case 35674:return rs;case 35675:return os;case 35676:return ss;case 5124:case 35670:return ls;case 35667:case 35671:return cs;case 35668:case 35672:return us;case 35669:case 35673:return ps;case 5125:return ms;case 36294:return hs;case 36295:return _s;case 36296:return gs;case 35678:case 36198:case 36298:case 36306:case 35682:return vs;case 35679:case 36299:case 36307:return Es;case 35680:case 36300:case 36308:case 36293:return Ss;case 36289:case 36303:case 36311:case 36292:return Ms}}function xs(e,t){e.uniform1fv(this.addr,t)}function Rs(e,t){const n=Zo(t,this.size,2);e.uniform2fv(this.addr,n)}function As(e,t){const n=Zo(t,this.size,3);e.uniform3fv(this.addr,n)}function bs(e,t){const n=Zo(t,this.size,4);e.uniform4fv(this.addr,n)}function Cs(e,t){const n=Zo(t,this.size,4);e.uniformMatrix2fv(this.addr,false,n)}function Ps(e,t){const n=Zo(t,this.size,9);e.uniformMatrix3fv(this.addr,false,n)}function Ls(e,t){const n=Zo(t,this.size,16);e.uniformMatrix4fv(this.addr,false,n)}function Us(e,t){e.uniform1iv(this.addr,t)}function Ds(e,t){e.uniform2iv(this.addr,t)}function ws(e,t){e.uniform3iv(this.addr,t)}function Is(e,t){e.uniform4iv(this.addr,t)}function Ns(e,t){e.uniform1uiv(this.addr,t)}function ys(e,t){e.uniform2uiv(this.addr,t)}function Fs(e,t){e.uniform3uiv(this.addr,t)}function Os(e,t){e.uniform4uiv(this.addr,t)}function Bs(e,t,n){const a=this.cache;const i=t.length;const r=Jo(n,i);if(!$o(a,r)){e.uniform1iv(this.addr,r);Qo(a,r)}let o;o=this.type===e.SAMPLER_2D_SHADOW?Vo:Ho;for(let e=0;e!==i;++e)n.setTexture2D(t[e]||o,r[e])}function Gs(e,t,n){const a=this.cache;const i=t.length;const r=Jo(n,i);if(!$o(a,r)){e.uniform1iv(this.addr,r);Qo(a,r)}for(let e=0;e!==i;++e)n.setTexture3D(t[e]||ko,r[e])}function Hs(e,t,n){const a=this.cache;const i=t.length;const r=Jo(n,i);if(!$o(a,r)){e.uniform1iv(this.addr,r);Qo(a,r)}for(let e=0;e!==i;++e)n.setTextureCube(t[e]||zo,r[e])}function Vs(e,t,n){const a=this.cache;const i=t.length;const r=Jo(n,i);if(!$o(a,r)){e.uniform1iv(this.addr,r);Qo(a,r)}for(let e=0;e!==i;++e)n.setTexture2DArray(t[e]||Wo,r[e])}function Ws(e){switch(e){case 5126:return xs;case 35664:return Rs;case 35665:return As;case 35666:return bs;case 35674:return Cs;case 35675:return Ps;case 35676:return Ls;case 5124:case 35670:return Us;case 35667:case 35671:return Ds;case 35668:case 35672:return ws;case 35669:case 35673:return Is;case 5125:return Ns;case 36294:return ys;case 36295:return Fs;case 36296:return Os;case 35678:case 36198:case 36298:case 36306:case 35682:return Bs;case 35679:case 36299:case 36307:return Gs;case 35680:case 36300:case 36308:case 36293:return Hs;case 36289:case 36303:case 36311:case 36292:return Vs}}class SingleUniform{constructor(e,t,n){this.id=e;this.addr=n;this.cache=[];this.type=t.type;this.setValue=Ts(t.type)}}class PureArrayUniform{constructor(e,t,n){this.id=e;this.addr=n;this.cache=[];this.type=t.type;this.size=t.size;this.setValue=Ws(t.type)}}class StructuredUniform{constructor(e){this.id=e;this.seq=[];this.map={}}setValue(e,t,n){const a=this.seq;for(let i=0,r=a.length;i!==r;++i){const r=a[i];r.setValue(e,t[r.id],n)}}}const ks=/(\w+)(\])?(\[|\.)?/g;function zs(e,t){e.seq.push(t);e.map[t.id]=t}function Xs(e,t,n){const a=e.name,i=a.length;ks.lastIndex=0;while(true){const r=ks.exec(a),o=ks.lastIndex;let s=r[1];const l=r[2]==="]",c=r[3];l&&(s|=0);if(c===void 0||c==="["&&o+2===i){zs(n,c===void 0?new SingleUniform(s,e,t):new PureArrayUniform(s,e,t));break}{const e=n.map;let t=e[s];if(t===void 0){t=new StructuredUniform(s);zs(n,t)}n=t}}}class WebGLUniforms{constructor(e,t){this.seq=[];this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const n=e.getActiveUniform(t,a),i=e.getUniformLocation(t,n.name);Xs(n,i,this)}const a=[];const i=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?a.push(t):i.push(t);a.length>0&&(this.seq=a.concat(i))}setValue(e,t,n,a){const i=this.map[t];i!==void 0&&i.setValue(e,n,a)}setOptional(e,t,n){const a=t[n];a!==void 0&&this.setValue(e,n,a)}static upload(e,t,n,a){for(let i=0,r=t.length;i!==r;++i){const r=t[i],o=n[r.id];o.needsUpdate!==false&&r.setValue(e,o.value,a)}}static seqWithValue(e,t){const n=[];for(let a=0,i=e.length;a!==i;++a){const i=e[a];i.id in t&&n.push(i)}return n}}function Ys(e,t,n){const a=e.createShader(t);e.shaderSource(a,n);e.compileShader(a);return a}const Ks=37297;let qs=0;function js(e,t){const n=e.split("\n");const a=[];const i=Math.max(t-6,0);const r=Math.min(t+6,n.length);for(let e=i;e<r;e++){const i=e+1;a.push(`${i===t?">":" "} ${i}: ${n[e]}`)}return a.join("\n")}const Zs=new e;function $s(e){v._getMatrix(Zs,v.workingColorSpace,e);const t=`mat3( ${Zs.elements.map((e=>e.toFixed(4)))} )`;switch(v.getTransfer(e)){case Ae:return[t,"LinearTransferOETF"];case E:return[t,"sRGBTransferOETF"];default:w("WebGLProgram: Unsupported color space: ",e);return[t,"LinearTransferOETF"]}}function Qs(e,t,n){const a=e.getShaderParameter(t,e.COMPILE_STATUS);const i=e.getShaderInfoLog(t)||"";const r=i.trim();if(a&&r==="")return"";const o=/ERROR: 0:(\d+)/.exec(r);if(o){const a=parseInt(o[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+js(e.getShaderSource(t),a)}return r}function Js(e,t){const n=$s(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}const tl={[ge]:"Linear",[_e]:"Reinhard",[he]:"Cineon",[me]:"ACESFilmic",[pe]:"AgX",[ue]:"Neutral",[fe]:"Custom"};function nl(e,t){const n=tl[t];if(n===void 0){w("WebGLProgram: Unsupported toneMapping:",t);return"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const al=new r;function il(){v.getLuminanceCoefficients(al);const e=al.x.toFixed(4);const t=al.y.toFixed(4);const n=al.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${e}, ${t}, ${n} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function rl(e){const t=[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""];return t.filter(ll).join("\n")}function ol(e){const t=[];for(const n in e){const a=e[n];a!==false&&t.push("#define "+n+" "+a)}return t.join("\n")}function sl(e,t){const n={};const a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<a;i++){const a=e.getActiveAttrib(t,i);const r=a.name;let o=1;a.type===e.FLOAT_MAT2&&(o=2);a.type===e.FLOAT_MAT3&&(o=3);a.type===e.FLOAT_MAT4&&(o=4);n[r]={type:a.type,location:e.getAttribLocation(t,r),locationSize:o}}return n}function ll(e){return e!==""}function cl(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).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 ul(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const pl=/^[ \t]*#include +<([\w\d./]+)>/gm;function ml(e){return e.replace(pl,_l)}const hl=new Map;function _l(e,t){let n=Qr[t];if(n===void 0){const e=hl.get(t);if(e===void 0)throw new Error("Can not resolve #include <"+t+">");n=Qr[e];w('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return ml(n)}const gl=/#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 vl(e){return e.replace(gl,El)}function El(e,t,n,a){let i="";for(let e=parseInt(t);e<parseInt(n);e++)i+=a.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function Sl(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;e.precision==="highp"?t+="\n#define HIGH_PRECISION":e.precision==="mediump"?t+="\n#define MEDIUM_PRECISION":e.precision==="lowp"&&(t+="\n#define LOW_PRECISION");return t}const Ml={[Ce]:"SHADOWMAP_TYPE_PCF",[be]:"SHADOWMAP_TYPE_VSM"};function Tl(e){return Ml[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const xl={[O]:"ENVMAP_TYPE_CUBE",[B]:"ENVMAP_TYPE_CUBE",[d]:"ENVMAP_TYPE_CUBE_UV"};function Rl(e){return e.envMap===false?"ENVMAP_TYPE_CUBE":xl[e.envMapMode]||"ENVMAP_TYPE_CUBE"}const Al={[B]:"ENVMAP_MODE_REFRACTION"};function bl(e){return e.envMap===false?"ENVMAP_MODE_REFLECTION":Al[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Cl={[Ue]:"ENVMAP_BLENDING_MULTIPLY",[Le]:"ENVMAP_BLENDING_MIX",[Pe]:"ENVMAP_BLENDING_ADD"};function Pl(e){return e.envMap===false?"ENVMAP_BLENDING_NONE":Cl[e.combine]||"ENVMAP_BLENDING_NONE"}function Ll(e){const t=e.envMapCubeUVHeight;if(t===null)return null;const n=Math.log2(t)-2;const a=1/t;const i=1/(3*Math.max(Math.pow(2,n),112));return{texelWidth:i,texelHeight:a,maxMip:n}}function Ul(e,t,n,a){const i=e.getContext();const r=n.defines;let o=n.vertexShader;let s=n.fragmentShader;const l=Tl(n);const c=Rl(n);const d=bl(n);const f=Pl(n);const u=Ll(n);const p=rl(n);const m=ol(r);const h=i.createProgram();let _,g;let v=n.glslVersion?"#version "+n.glslVersion+"\n":"";if(n.isRawShaderMaterial){_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(ll).join("\n");_.length>0&&(_+="\n");g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(ll).join("\n");g.length>0&&(g+="\n")}else{_=[Sl(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===false?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===false?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ll).join("\n");g=[Sl(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===false?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==z?"#define TONE_MAPPING":"",n.toneMapping!==z?Qr.tonemapping_pars_fragment:"",n.toneMapping!==z?nl("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Qr.colorspace_pars_fragment,Js("linearToOutputTexel",n.outputColorSpace),il(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ll).join("\n")}o=ml(o);o=cl(o,n);o=ul(o,n);s=ml(s);s=cl(s,n);s=ul(s,n);o=vl(o);s=vl(s);if(n.isRawShaderMaterial!==true){v="#version 300 es\n";_=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_;g=["#define varying in",n.glslVersion===De?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===De?"":"#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"+g}const E=v+_+o;const S=v+g+s;const M=Ys(i,i.VERTEX_SHADER,E);const T=Ys(i,i.FRAGMENT_SHADER,S);i.attachShader(h,M);i.attachShader(h,T);n.index0AttributeName!==void 0?i.bindAttribLocation(h,0,n.index0AttributeName):n.morphTargets===true&&i.bindAttribLocation(h,0,"position");i.linkProgram(h);function x(t){if(e.debug.checkShaderErrors){const n=i.getProgramInfoLog(h)||"";const a=i.getShaderInfoLog(M)||"";const r=i.getShaderInfoLog(T)||"";const o=n.trim();const s=a.trim();const l=r.trim();let c=true;let d=true;if(i.getProgramParameter(h,i.LINK_STATUS)===false){c=false;if(typeof e.debug.onShaderError==="function")e.debug.onShaderError(i,h,M,T);else{const e=Qs(i,M,"vertex");const n=Qs(i,T,"fragment");Y("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(h,i.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}}else o!==""?w("WebGLProgram: Program Info Log:",o):s!==""&&l!==""||(d=false);d&&(t.diagnostics={runnable:c,programLog:o,vertexShader:{log:s,prefix:_},fragmentShader:{log:l,prefix:g}})}i.deleteShader(M);i.deleteShader(T);R=new WebGLUniforms(i,h);A=sl(i,h)}let R;this.getUniforms=function(){R===void 0&&x(this);return R};let A;this.getAttributes=function(){A===void 0&&x(this);return A};let b=n.rendererExtensionParallelShaderCompile===false;this.isReady=function(){b===false&&(b=i.getProgramParameter(h,Ks));return b};this.destroy=function(){a.releaseStatesOfProgram(this);i.deleteProgram(h);this.program=void 0};this.type=n.shaderType;this.name=n.shaderName;this.id=qs++;this.cacheKey=t;this.usedTimes=1;this.program=h;this.vertexShader=M;this.fragmentShader=T;return this}let Dl=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map;this.materialCache=new Map}update(e){const t=e.vertexShader;const n=e.fragmentShader;const a=this._getShaderStage(t);const i=this._getShaderStage(n);const r=this._getShaderCacheForMaterial(e);if(r.has(a)===false){r.add(a);a.usedTimes++}if(r.has(i)===false){r.add(i);i.usedTimes++}return this}remove(e){const t=this.materialCache.get(e);for(const e of t){e.usedTimes--;e.usedTimes===0&&this.shaderCache.delete(e.code)}this.materialCache.delete(e);return 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){const t=this.materialCache;let n=t.get(e);if(n===void 0){n=new Set;t.set(e,n)}return n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);if(n===void 0){n=new WebGLShaderStage(e);t.set(e,n)}return n}}class WebGLShaderStage{constructor(e){this.id=Dl++;this.code=e;this.usedTimes=0}}function wl(e,t,n,a,i,r){const o=new we;const s=new WebGLShaderCache;const l=new Set;const c=[];const f=new Map;const u=a.logarithmicDepthBuffer;let p=a.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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"};function _(e){l.add(e);return e===0?"uv":`uv${e}`}function g(i,o,c,f,g){const S=f.fog;const M=g.geometry;const T=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?f.environment:null;const x=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap;const R=t.get(i.envMap||T,x);const A=!R||R.mapping!==d?null:R.image.height;const b=m[i.type];if(i.precision!==null){p=a.getMaxPrecision(i.precision);p!==i.precision&&w("WebGLProgram.getParameters:",i.precision,"not supported, using",p,"instead.")}const C=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color;const P=C!==void 0?C.length:0;let L=0;M.morphAttributes.position!==void 0&&(L=1);M.morphAttributes.normal!==void 0&&(L=2);M.morphAttributes.color!==void 0&&(L=3);let U,D;let I,N;if(b){const e=to[b];U=e.vertexShader;D=e.fragmentShader}else{U=i.vertexShader;D=i.fragmentShader;s.update(i);I=s.getVertexShaderID(i);N=s.getFragmentShaderID(i)}const y=e.getRenderTarget();const F=e.state.buffers.depth.getReversed();const O=g.isInstancedMesh===true;const B=g.isBatchedMesh===true;const H=!!i.map;const V=!!i.matcap;const W=!!R;const k=!!i.aoMap;const X=!!i.lightMap;const Y=!!i.bumpMap;const K=!!i.normalMap;const q=!!i.displacementMap;const j=!!i.emissiveMap;const Z=!!i.metalnessMap;const $=!!i.roughnessMap;const Q=i.anisotropy>0;const J=i.clearcoat>0;const ee=i.dispersion>0;const te=i.iridescence>0;const ne=i.sheen>0;const ae=i.transmission>0;const ie=Q&&!!i.anisotropyMap;const re=J&&!!i.clearcoatMap;const oe=J&&!!i.clearcoatNormalMap;const se=J&&!!i.clearcoatRoughnessMap;const le=te&&!!i.iridescenceMap;const ce=te&&!!i.iridescenceThicknessMap;const de=ne&&!!i.sheenColorMap;const fe=ne&&!!i.sheenRoughnessMap;const ue=!!i.specularMap;const pe=!!i.specularColorMap;const me=!!i.specularIntensityMap;const he=ae&&!!i.transmissionMap;const _e=ae&&!!i.thicknessMap;const ge=!!i.gradientMap;const ve=!!i.alphaMap;const Ee=i.alphaTest>0;const Se=!!i.alphaHash;const Me=!!i.extensions;let Te=z;i.toneMapped&&(y!==null&&y.isXRRenderTarget!==true||(Te=e.toneMapping));const xe={shaderID:b,shaderType:i.type,shaderName:i.name,vertexShader:U,fragmentShader:D,defines:i.defines,customVertexShaderID:I,customFragmentShaderID:N,isRawShaderMaterial:i.isRawShaderMaterial===true,glslVersion:i.glslVersion,precision:p,batching:B,batchingColor:B&&g._colorsTexture!==null,instancing:O,instancingColor:O&&g.instanceColor!==null,instancingMorph:O&&g.morphTexture!==null,outputColorSpace:y===null?e.outputColorSpace:y.isXRRenderTarget===true?y.texture.colorSpace:G,alphaToCoverage:!!i.alphaToCoverage,map:H,matcap:V,envMap:W,envMapMode:W&&R.mapping,envMapCubeUVHeight:A,aoMap:k,lightMap:X,bumpMap:Y,normalMap:K,displacementMap:q,emissiveMap:j,normalMapObjectSpace:K&&i.normalMapType===Fe,normalMapTangentSpace:K&&i.normalMapType===ye,metalnessMap:Z,roughnessMap:$,anisotropy:Q,anisotropyMap:ie,clearcoat:J,clearcoatMap:re,clearcoatNormalMap:oe,clearcoatRoughnessMap:se,dispersion:ee,iridescence:te,iridescenceMap:le,iridescenceThicknessMap:ce,sheen:ne,sheenColorMap:de,sheenRoughnessMap:fe,specularMap:ue,specularColorMap:pe,specularIntensityMap:me,transmission:ae,transmissionMap:he,thicknessMap:_e,gradientMap:ge,opaque:i.transparent===false&&i.blending===Ne&&i.alphaToCoverage===false,alphaMap:ve,alphaTest:Ee,alphaHash:Se,combine:i.combine,mapUv:H&&_(i.map.channel),aoMapUv:k&&_(i.aoMap.channel),lightMapUv:X&&_(i.lightMap.channel),bumpMapUv:Y&&_(i.bumpMap.channel),normalMapUv:K&&_(i.normalMap.channel),displacementMapUv:q&&_(i.displacementMap.channel),emissiveMapUv:j&&_(i.emissiveMap.channel),metalnessMapUv:Z&&_(i.metalnessMap.channel),roughnessMapUv:$&&_(i.roughnessMap.channel),anisotropyMapUv:ie&&_(i.anisotropyMap.channel),clearcoatMapUv:re&&_(i.clearcoatMap.channel),clearcoatNormalMapUv:oe&&_(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:se&&_(i.clearcoatRoughnessMap.channel),iridescenceMapUv:le&&_(i.iridescenceMap.channel),iridescenceThicknessMapUv:ce&&_(i.iridescenceThicknessMap.channel),sheenColorMapUv:de&&_(i.sheenColorMap.channel),sheenRoughnessMapUv:fe&&_(i.sheenRoughnessMap.channel),specularMapUv:ue&&_(i.specularMap.channel),specularColorMapUv:pe&&_(i.specularColorMap.channel),specularIntensityMapUv:me&&_(i.specularIntensityMap.channel),transmissionMapUv:he&&_(i.transmissionMap.channel),thicknessMapUv:_e&&_(i.thicknessMap.channel),alphaMapUv:ve&&_(i.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(K||Q),vertexColors:i.vertexColors,vertexAlphas:i.vertexColors===true&&!!M.attributes.color&&M.attributes.color.itemSize===4,pointsUvs:g.isPoints===true&&!!M.attributes.uv&&(H||ve),fog:!!S,useFog:i.fog===true,fogExp2:!!S&&S.isFogExp2,flatShading:i.wireframe===false&&(i.flatShading===true||M.attributes.normal===void 0&&K===false&&(i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshPhysicalMaterial)),sizeAttenuation:i.sizeAttenuation===true,logarithmicDepthBuffer:u,reversedDepthBuffer:F,skinning:g.isSkinnedMesh===true,morphTargets:M.morphAttributes.position!==void 0,morphNormals:M.morphAttributes.normal!==void 0,morphColors:M.morphAttributes.color!==void 0,morphTargetsCount:P,morphTextureStride:L,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:r.numPlanes,numClipIntersection:r.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:Te,decodeVideoTexture:H&&i.map.isVideoTexture===true&&v.getTransfer(i.map.colorSpace)===E,decodeVideoTextureEmissive:j&&i.emissiveMap.isVideoTexture===true&&v.getTransfer(i.emissiveMap.colorSpace)===E,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===Ie,flipSided:i.side===h,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:Me&&i.extensions.clipCullDistance===true&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Me&&i.extensions.multiDraw===true||B)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:i.customProgramCacheKey()};xe.vertexUv1s=l.has(1);xe.vertexUv2s=l.has(2);xe.vertexUv3s=l.has(3);l.clear();return xe}function S(t){const n=[];if(t.shaderID)n.push(t.shaderID);else{n.push(t.customVertexShaderID);n.push(t.customFragmentShaderID)}if(t.defines!==void 0)for(const e in t.defines){n.push(e);n.push(t.defines[e])}if(t.isRawShaderMaterial===false){M(n,t);T(n,t);n.push(e.outputColorSpace)}n.push(t.customProgramCacheKey);return n.join()}function M(e,t){e.push(t.precision);e.push(t.outputColorSpace);e.push(t.envMapMode);e.push(t.envMapCubeUVHeight);e.push(t.mapUv);e.push(t.alphaMapUv);e.push(t.lightMapUv);e.push(t.aoMapUv);e.push(t.bumpMapUv);e.push(t.normalMapUv);e.push(t.displacementMapUv);e.push(t.emissiveMapUv);e.push(t.metalnessMapUv);e.push(t.roughnessMapUv);e.push(t.anisotropyMapUv);e.push(t.clearcoatMapUv);e.push(t.clearcoatNormalMapUv);e.push(t.clearcoatRoughnessMapUv);e.push(t.iridescenceMapUv);e.push(t.iridescenceThicknessMapUv);e.push(t.sheenColorMapUv);e.push(t.sheenRoughnessMapUv);e.push(t.specularMapUv);e.push(t.specularColorMapUv);e.push(t.specularIntensityMapUv);e.push(t.transmissionMapUv);e.push(t.thicknessMapUv);e.push(t.combine);e.push(t.fogExp2);e.push(t.sizeAttenuation);e.push(t.morphTargetsCount);e.push(t.morphAttributeCount);e.push(t.numDirLights);e.push(t.numPointLights);e.push(t.numSpotLights);e.push(t.numSpotLightMaps);e.push(t.numHemiLights);e.push(t.numRectAreaLights);e.push(t.numDirLightShadows);e.push(t.numPointLightShadows);e.push(t.numSpotLightShadows);e.push(t.numSpotLightShadowsWithMaps);e.push(t.numLightProbes);e.push(t.shadowMapType);e.push(t.toneMapping);e.push(t.numClippingPlanes);e.push(t.numClipIntersection);e.push(t.depthPacking)}function T(e,t){o.disableAll();t.instancing&&o.enable(0);t.instancingColor&&o.enable(1);t.instancingMorph&&o.enable(2);t.matcap&&o.enable(3);t.envMap&&o.enable(4);t.normalMapObjectSpace&&o.enable(5);t.normalMapTangentSpace&&o.enable(6);t.clearcoat&&o.enable(7);t.iridescence&&o.enable(8);t.alphaTest&&o.enable(9);t.vertexColors&&o.enable(10);t.vertexAlphas&&o.enable(11);t.vertexUv1s&&o.enable(12);t.vertexUv2s&&o.enable(13);t.vertexUv3s&&o.enable(14);t.vertexTangents&&o.enable(15);t.anisotropy&&o.enable(16);t.alphaHash&&o.enable(17);t.batching&&o.enable(18);t.dispersion&&o.enable(19);t.batchingColor&&o.enable(20);t.gradientMap&&o.enable(21);e.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.reversedDepthBuffer&&o.enable(4);t.skinning&&o.enable(5);t.morphTargets&&o.enable(6);t.morphNormals&&o.enable(7);t.morphColors&&o.enable(8);t.premultipliedAlpha&&o.enable(9);t.shadowMapEnabled&&o.enable(10);t.doubleSided&&o.enable(11);t.flipSided&&o.enable(12);t.useDepthPacking&&o.enable(13);t.dithering&&o.enable(14);t.transmission&&o.enable(15);t.sheen&&o.enable(16);t.opaque&&o.enable(17);t.pointsUvs&&o.enable(18);t.decodeVideoTexture&&o.enable(19);t.decodeVideoTextureEmissive&&o.enable(20);t.alphaToCoverage&&o.enable(21);e.push(o.mask)}function x(e){const t=m[e.type];let n;if(t){const e=to[t];n=Oe.clone(e.uniforms)}else n=e.uniforms;return n}function R(t,n){let a=f.get(n);if(a!==void 0)++a.usedTimes;else{a=new Ul(e,n,t,i);c.push(a);f.set(n,a)}return a}function A(e){if(--e.usedTimes===0){const t=c.indexOf(e);c[t]=c[c.length-1];c.pop();f.delete(e.cacheKey);e.destroy()}}function b(e){s.remove(e)}function C(){s.dispose()}return{getParameters:g,getProgramCacheKey:S,getUniforms:x,acquireProgram:R,releaseProgram:A,releaseShaderCache:b,programs:c,dispose:C}}function Il(){let e=new WeakMap;function t(t){return e.has(t)}function n(t){let n=e.get(t);if(n===void 0){n={};e.set(t,n)}return n}function a(t){e.delete(t)}function i(t,n,a){e.get(t)[n]=a}function r(){e=new WeakMap}return{has:t,get:n,remove:a,update:i,dispose:r}}function Nl(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.materialVariant!==t.materialVariant?e.materialVariant-t.materialVariant:e.z!==t.z?e.z-t.z:e.id-t.id}function yl(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 Fl(){const e=[];let t=0;const n=[];const a=[];const i=[];function r(){t=0;n.length=0;a.length=0;i.length=0}function o(e){let t=0;e.isInstancedMesh&&(t+=2);e.isSkinnedMesh&&(t+=1);return t}function s(n,a,i,r,s,l){let c=e[t];if(c===void 0){c={id:n.id,object:n,geometry:a,material:i,materialVariant:o(n),groupOrder:r,renderOrder:n.renderOrder,z:s,group:l};e[t]=c}else{c.id=n.id;c.object=n;c.geometry=a;c.material=i;c.materialVariant=o(n);c.groupOrder=r;c.renderOrder=n.renderOrder;c.z=s;c.group=l}t++;return c}function l(e,t,r,o,l,c){const d=s(e,t,r,o,l,c);r.transmission>0?a.push(d):r.transparent===true?i.push(d):n.push(d)}function c(e,t,r,o,l,c){const d=s(e,t,r,o,l,c);r.transmission>0?a.unshift(d):r.transparent===true?i.unshift(d):n.unshift(d)}function d(e,t){n.length>1&&n.sort(e||Nl);a.length>1&&a.sort(t||yl);i.length>1&&i.sort(t||yl)}function f(){for(let n=t,a=e.length;n<a;n++){const t=e[n];if(t.id===null)break;t.id=null;t.object=null;t.geometry=null;t.material=null;t.group=null}}return{opaque:n,transmissive:a,transparent:i,init:r,push:l,unshift:c,finish:f,sort:d}}function Ol(){let e=new WeakMap;function t(t,n){const a=e.get(t);let i;if(a===void 0){i=new Fl;e.set(t,[i])}else if(n>=a.length){i=new Fl;a.push(i)}else i=a[n];return i}function n(){e=new WeakMap}return{get:t,dispose:n}}function Bl(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let a;switch(t.type){case"DirectionalLight":a={direction:new r,color:new n};break;case"SpotLight":a={position:new r,direction:new r,color:new n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":a={position:new r,color:new n,distance:0,decay:0};break;case"HemisphereLight":a={direction:new r,skyColor:new n,groundColor:new n};break;case"RectAreaLight":a={color:new n,position:new r,halfWidth:new r,halfHeight:new r};break}e[t.id]=a;return a}}}function Gl(){const e={};return{get:function(n){if(e[n.id]!==void 0)return e[n.id];let a;switch(n.type){case"DirectionalLight":a={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t};break;case"SpotLight":a={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t};break;case"PointLight":a={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t,shadowCameraNear:1,shadowCameraFar:1e3};break}e[n.id]=a;return a}}}let Hl=0;function Vl(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Wl(e){const t=new Bl;const n=Gl();const a={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++)a.probe.push(new r);const i=new r;const o=new c;const s=new c;function l(i){let r=0,o=0,s=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let l=0;let c=0;let d=0;let f=0;let u=0;let p=0;let m=0;let h=0;let _=0;let g=0;let v=0;i.sort(Vl);for(let e=0,E=i.length;e<E;e++){const E=i[e];const S=E.color;const M=E.intensity;const T=E.distance;let x=null;E.shadow&&E.shadow.map&&(x=E.shadow.map.texture.format===Be?E.shadow.map.texture:E.shadow.map.depthTexture||E.shadow.map.texture);if(E.isAmbientLight){r+=S.r*M;o+=S.g*M;s+=S.b*M}else if(E.isLightProbe){for(let e=0;e<9;e++)a.probe[e].addScaledVector(E.sh.coefficients[e],M);v++}else if(E.isDirectionalLight){const e=t.get(E);e.color.copy(E.color).multiplyScalar(E.intensity);if(E.castShadow){const e=E.shadow;const t=n.get(E);t.shadowIntensity=e.intensity;t.shadowBias=e.bias;t.shadowNormalBias=e.normalBias;t.shadowRadius=e.radius;t.shadowMapSize=e.mapSize;a.directionalShadow[l]=t;a.directionalShadowMap[l]=x;a.directionalShadowMatrix[l]=E.shadow.matrix;p++}a.directional[l]=e;l++}else if(E.isSpotLight){const e=t.get(E);e.position.setFromMatrixPosition(E.matrixWorld);e.color.copy(S).multiplyScalar(M);e.distance=T;e.coneCos=Math.cos(E.angle);e.penumbraCos=Math.cos(E.angle*(1-E.penumbra));e.decay=E.decay;a.spot[d]=e;const i=E.shadow;if(E.map){a.spotLightMap[_]=E.map;_++;i.updateMatrices(E);E.castShadow&&g++}a.spotLightMatrix[d]=i.matrix;if(E.castShadow){const e=n.get(E);e.shadowIntensity=i.intensity;e.shadowBias=i.bias;e.shadowNormalBias=i.normalBias;e.shadowRadius=i.radius;e.shadowMapSize=i.mapSize;a.spotShadow[d]=e;a.spotShadowMap[d]=x;h++}d++}else if(E.isRectAreaLight){const e=t.get(E);e.color.copy(S).multiplyScalar(M);e.halfWidth.set(E.width*.5,0,0);e.halfHeight.set(0,E.height*.5,0);a.rectArea[f]=e;f++}else if(E.isPointLight){const e=t.get(E);e.color.copy(E.color).multiplyScalar(E.intensity);e.distance=E.distance;e.decay=E.decay;if(E.castShadow){const e=E.shadow;const t=n.get(E);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;a.pointShadow[c]=t;a.pointShadowMap[c]=x;a.pointShadowMatrix[c]=E.shadow.matrix;m++}a.point[c]=e;c++}else if(E.isHemisphereLight){const e=t.get(E);e.skyColor.copy(E.color).multiplyScalar(M);e.groundColor.copy(E.groundColor).multiplyScalar(M);a.hemi[u]=e;u++}}if(f>0)if(e.has("OES_texture_float_linear")===true){a.rectAreaLTC1=Jr.LTC_FLOAT_1;a.rectAreaLTC2=Jr.LTC_FLOAT_2}else{a.rectAreaLTC1=Jr.LTC_HALF_1;a.rectAreaLTC2=Jr.LTC_HALF_2}a.ambient[0]=r;a.ambient[1]=o;a.ambient[2]=s;const E=a.hash;if(E.directionalLength!==l||E.pointLength!==c||E.spotLength!==d||E.rectAreaLength!==f||E.hemiLength!==u||E.numDirectionalShadows!==p||E.numPointShadows!==m||E.numSpotShadows!==h||E.numSpotMaps!==_||E.numLightProbes!==v){a.directional.length=l;a.spot.length=d;a.rectArea.length=f;a.point.length=c;a.hemi.length=u;a.directionalShadow.length=p;a.directionalShadowMap.length=p;a.pointShadow.length=m;a.pointShadowMap.length=m;a.spotShadow.length=h;a.spotShadowMap.length=h;a.directionalShadowMatrix.length=p;a.pointShadowMatrix.length=m;a.spotLightMatrix.length=h+_-g;a.spotLightMap.length=_;a.numSpotLightShadowsWithMaps=g;a.numLightProbes=v;E.directionalLength=l;E.pointLength=c;E.spotLength=d;E.rectAreaLength=f;E.hemiLength=u;E.numDirectionalShadows=p;E.numPointShadows=m;E.numSpotShadows=h;E.numSpotMaps=_;E.numLightProbes=v;a.version=Hl++}}function d(e,t){let n=0;let r=0;let l=0;let c=0;let d=0;const f=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=a.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld);i.setFromMatrixPosition(u.target.matrixWorld);e.direction.sub(i);e.direction.transformDirection(f);n++}else if(u.isSpotLight){const e=a.spot[l];e.position.setFromMatrixPosition(u.matrixWorld);e.position.applyMatrix4(f);e.direction.setFromMatrixPosition(u.matrixWorld);i.setFromMatrixPosition(u.target.matrixWorld);e.direction.sub(i);e.direction.transformDirection(f);l++}else if(u.isRectAreaLight){const e=a.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld);e.position.applyMatrix4(f);s.identity();o.copy(u.matrixWorld);o.premultiply(f);s.extractRotation(o);e.halfWidth.set(u.width*.5,0,0);e.halfHeight.set(0,u.height*.5,0);e.halfWidth.applyMatrix4(s);e.halfHeight.applyMatrix4(s);c++}else if(u.isPointLight){const e=a.point[r];e.position.setFromMatrixPosition(u.matrixWorld);e.position.applyMatrix4(f);r++}else if(u.isHemisphereLight){const e=a.hemi[d];e.direction.setFromMatrixPosition(u.matrixWorld);e.direction.transformDirection(f);d++}}}return{setup:l,setupView:d,state:a}}function kl(e){const t=new Wl(e);const n=[];const a=[];function i(e){c.camera=e;n.length=0;a.length=0}function r(e){n.push(e)}function o(e){a.push(e)}function s(){t.setup(n)}function l(e){t.setupView(n,e)}const c={lightsArray:n,shadowsArray:a,camera:null,lights:t,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:s,setupLightsView:l,pushLight:r,pushShadow:o}}function zl(e){let t=new WeakMap;function n(n,a=0){const i=t.get(n);let r;if(i===void 0){r=new kl(e);t.set(n,[r])}else if(a>=i.length){r=new kl(e);i.push(r)}else r=i[a];return r}function a(){t=new WeakMap}return{get:n,dispose:a}}const Xl="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";const Yl="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}";const Kl=[new r(1,0,0),new r(-1,0,0),new r(0,1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1)];const ql=[new r(0,-1,0),new r(0,-1,0),new r(0,0,1),new r(0,0,-1),new r(0,-1,0),new r(0,-1,0)];const jl=new c;const Zl=new r;const $l=new r;function Ql(e,n,a){let i=new Ge;const r=new t,o=new t,s=new le,l=new He,c=new Ve,d={},f=a.maxTextureSize;const p={[T]:h,[h]:T,[Ie]:Ie};const _=new m({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t},radius:{value:4}},vertexShader:Xl,fragmentShader:Yl});const g=_.clone();g.defines.HORIZONTAL_PASS=1;const v=new W;v.setAttribute("position",new K(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new u(v,_);const S=this;this.enabled=false;this.autoUpdate=true;this.needsUpdate=false;this.type=Ce;let M=this.type;this.render=function(t,n,a){if(S.enabled===false)return;if(S.autoUpdate===false&&S.needsUpdate===false)return;if(t.length===0)return;if(this.type===We){w("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.");this.type=Ce}const l=e.getRenderTarget();const c=e.getActiveCubeFace();const d=e.getActiveMipmapLevel();const u=e.state;u.setBlending($);u.buffers.depth.getReversed()===true?u.buffers.color.setClear(0,0,0,0):u.buffers.color.setClear(1,1,1,1);u.buffers.depth.setTest(true);u.setScissorTest(false);const p=M!==this.type;p&&n.traverse((function(e){e.material&&(Array.isArray(e.material)?e.material.forEach((e=>e.needsUpdate=true)):e.material.needsUpdate=true)}));for(let l=0,c=t.length;l<c;l++){const c=t[l];const d=c.shadow;if(d===void 0){w("WebGLShadowMap:",c,"has no shadow.");continue}if(d.autoUpdate===false&&d.needsUpdate===false)continue;r.copy(d.mapSize);const m=d.getFrameExtents();r.multiply(m);o.copy(d.mapSize);if(r.x>f||r.y>f){if(r.x>f){o.x=Math.floor(f/m.x);r.x=o.x*m.x;d.mapSize.x=o.x}if(r.y>f){o.y=Math.floor(f/m.y);r.y=o.y*m.y;d.mapSize.y=o.y}}const h=e.state.buffers.depth.getReversed();d.camera._reversedDepth=h;if(d.map===null||p===true){if(d.map!==null){if(d.map.depthTexture!==null){d.map.depthTexture.dispose();d.map.depthTexture=null}d.map.dispose()}if(this.type===be){if(c.isPointLight){w("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}d.map=new q(r.x,r.y,{format:Be,type:C,minFilter:V,magFilter:V,generateMipmaps:false});d.map.texture.name=c.name+".shadowMap";d.map.depthTexture=new Me(r.x,r.y,U);d.map.depthTexture.name=c.name+".shadowMapDepth";d.map.depthTexture.format=ke;d.map.depthTexture.compareFunction=null;d.map.depthTexture.minFilter=ze;d.map.depthTexture.magFilter=ze}else{if(c.isPointLight){d.map=new WebGLCubeRenderTarget(r.x);d.map.depthTexture=new Xe(r.x,Ye)}else{d.map=new q(r.x,r.y);d.map.depthTexture=new Me(r.x,r.y,Ye)}d.map.depthTexture.name=c.name+".shadowMap";d.map.depthTexture.format=ke;if(this.type===Ce){d.map.depthTexture.compareFunction=h?xe:Re;d.map.depthTexture.minFilter=V;d.map.depthTexture.magFilter=V}else{d.map.depthTexture.compareFunction=null;d.map.depthTexture.minFilter=ze;d.map.depthTexture.magFilter=ze}}d.camera.updateProjectionMatrix()}const _=d.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<_;t++){if(d.map.isWebGLCubeRenderTarget){e.setRenderTarget(d.map,t);e.clear()}else{if(t===0){e.setRenderTarget(d.map);e.clear()}const n=d.getViewport(t);s.set(o.x*n.x,o.y*n.y,o.x*n.z,o.y*n.w);u.viewport(s)}if(c.isPointLight){const e=d.camera;const n=d.matrix;const a=c.distance||e.far;if(a!==e.far){e.far=a;e.updateProjectionMatrix()}Zl.setFromMatrixPosition(c.matrixWorld);e.position.copy(Zl);$l.copy(e.position);$l.add(Kl[t]);e.up.copy(ql[t]);e.lookAt($l);e.updateMatrixWorld();n.makeTranslation(-Zl.x,-Zl.y,-Zl.z);jl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);d._frustum.setFromProjectionMatrix(jl,e.coordinateSystem,e.reversedDepth)}else d.updateMatrices(c);i=d.getFrustum();A(n,a,d.camera,c,this.type)}d.isPointLightShadow!==true&&this.type===be&&x(d,a);d.needsUpdate=false}M=this.type;S.needsUpdate=false;e.setRenderTarget(l,c,d)};function x(t,a){const i=n.update(E);if(_.defines.VSM_SAMPLES!==t.blurSamples){_.defines.VSM_SAMPLES=t.blurSamples;g.defines.VSM_SAMPLES=t.blurSamples;_.needsUpdate=true;g.needsUpdate=true}t.mapPass===null&&(t.mapPass=new q(r.x,r.y,{format:Be,type:C}));_.uniforms.shadow_pass.value=t.map.depthTexture;_.uniforms.resolution.value=t.mapSize;_.uniforms.radius.value=t.radius;e.setRenderTarget(t.mapPass);e.clear();e.renderBufferDirect(a,null,i,_,E,null);g.uniforms.shadow_pass.value=t.mapPass.texture;g.uniforms.resolution.value=t.mapSize;g.uniforms.radius.value=t.radius;e.setRenderTarget(t.map);e.clear();e.renderBufferDirect(a,null,i,g,E,null)}function R(t,n,a,i){let r=null;const o=a.isPointLight===true?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)r=o;else{r=a.isPointLight===true?c:l;if(e.localClippingEnabled&&n.clipShadows===true&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===true){const e=r.uuid,t=n.uuid;let a=d[e];if(a===void 0){a={};d[e]=a}let i=a[t];if(i===void 0){i=r.clone();a[t]=i;n.addEventListener("dispose",b)}r=i}}r.visible=n.visible;r.wireframe=n.wireframe;r.side=i===be?n.shadowSide!==null?n.shadowSide:n.side:n.shadowSide!==null?n.shadowSide:p[n.side];r.alphaMap=n.alphaMap;r.alphaTest=n.alphaToCoverage===true?.5:n.alphaTest;r.map=n.map;r.clipShadows=n.clipShadows;r.clippingPlanes=n.clippingPlanes;r.clipIntersection=n.clipIntersection;r.displacementMap=n.displacementMap;r.displacementScale=n.displacementScale;r.displacementBias=n.displacementBias;r.wireframeLinewidth=n.wireframeLinewidth;r.linewidth=n.linewidth;if(a.isPointLight===true&&r.isMeshDistanceMaterial===true){const t=e.properties.get(r);t.light=a}return r}function A(t,a,r,o,s){if(t.visible===false)return;const l=t.layers.test(a.layers);if(l&&(t.isMesh||t.isLine||t.isPoints)&&(t.castShadow||t.receiveShadow&&s===be)&&(!t.frustumCulled||i.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld);const i=n.update(t);const l=t.material;if(Array.isArray(l)){const n=i.groups;for(let c=0,d=n.length;c<d;c++){const d=n[c];const f=l[d.materialIndex];if(f&&f.visible){const n=R(t,f,o,s);t.onBeforeShadow(e,t,a,r,i,n,d);e.renderBufferDirect(r,null,i,n,t,d);t.onAfterShadow(e,t,a,r,i,n,d)}}}else if(l.visible){const n=R(t,l,o,s);t.onBeforeShadow(e,t,a,r,i,n,null);e.renderBufferDirect(r,null,i,n,t,null);t.onAfterShadow(e,t,a,r,i,n,null)}}const c=t.children;for(let e=0,t=c.length;e<t;e++)A(c[e],a,r,o,s)}function b(e){const t=e.target;t.removeEventListener("dispose",b);for(const t in d){const n=d[t];const a=e.target.uuid;if(a in n){const e=n[a];e.dispose();delete n[a]}}}}function Jl(e,t){function a(){let t=false;const n=new le;let a=null;const i=new le(0,0,0,0);return{setMask:function(n){if(a!==n&&!t){e.colorMask(n,n,n,n);a=n}},setLocked:function(e){t=e},setClear:function(t,a,r,o,s){if(s===true){t*=o;a*=o;r*=o}n.set(t,a,r,o);if(i.equals(n)===false){e.clearColor(t,a,r,o);i.copy(n)}},reset:function(){t=false;a=null;i.set(-1,0,0,0)}}}function i(){let n=false;let a=false;let i=null;let r=null;let o=null;return{setReversed:function(e){if(a!==e){const n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT);a=e;const i=o;o=null;this.setClear(i)}},getReversed:function(){return a},setTest:function(t){t?X(e.DEPTH_TEST):K(e.DEPTH_TEST)},setMask:function(t){if(i!==t&&!n){e.depthMask(t);i=t}},setFunc:function(t){a&&(t=Ke[t]);if(r!==t){switch(t){case nt:e.depthFunc(e.NEVER);break;case tt:e.depthFunc(e.ALWAYS);break;case Je:e.depthFunc(e.LESS);break;case Qe:e.depthFunc(e.LEQUAL);break;case $e:e.depthFunc(e.EQUAL);break;case Ze:e.depthFunc(e.GEQUAL);break;case je:e.depthFunc(e.GREATER);break;case qe:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}r=t}},setLocked:function(e){n=e},setClear:function(t){if(o!==t){o=t;a&&(t=1-t);e.clearDepth(t)}},reset:function(){n=false;i=null;r=null;o=null;a=false}}}function r(){let t=false;let n=null;let a=null;let i=null;let r=null;let o=null;let s=null;let l=null;let c=null;return{setTest:function(n){t||(n?X(e.STENCIL_TEST):K(e.STENCIL_TEST))},setMask:function(a){if(n!==a&&!t){e.stencilMask(a);n=a}},setFunc:function(t,n,o){if(a!==t||i!==n||r!==o){e.stencilFunc(t,n,o);a=t;i=n;r=o}},setOp:function(t,n,a){if(o!==t||s!==n||l!==a){e.stencilOp(t,n,a);o=t;s=n;l=a}},setLocked:function(e){t=e},setClear:function(t){if(c!==t){e.clearStencil(t);c=t}},reset:function(){t=false;n=null;a=null;i=null;r=null;o=null;s=null;l=null;c=null}}}const o=new a;const s=new i;const l=new r;const c=new WeakMap;const d=new WeakMap;let f={};let u={};let p=new WeakMap;let m=[];let _=null;let g=false;let v=null;let E=null;let S=null;let M=null;let T=null;let x=null;let R=null;let A=new n(0,0,0);let b=0;let C=false;let P=null;let L=null;let U=null;let D=null;let w=null;const I=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let N=false;let y=0;const F=e.getParameter(e.VERSION);if(F.indexOf("WebGL")!==-1){y=parseFloat(/^WebGL (\d)/.exec(F)[1]);N=y>=1}else if(F.indexOf("OpenGL ES")!==-1){y=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]);N=y>=2}let O=null;let B={};const G=e.getParameter(e.SCISSOR_BOX);const H=e.getParameter(e.VIEWPORT);const V=(new le).fromArray(G);const W=(new le).fromArray(H);function k(t,n,a,i){const r=new Uint8Array(4);const o=e.createTexture();e.bindTexture(t,o);e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST);e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<a;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,r):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r);return o}const z={};z[e.TEXTURE_2D]=k(e.TEXTURE_2D,e.TEXTURE_2D,1);z[e.TEXTURE_CUBE_MAP]=k(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6);z[e.TEXTURE_2D_ARRAY]=k(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1);z[e.TEXTURE_3D]=k(e.TEXTURE_3D,e.TEXTURE_3D,1,1);o.setClear(0,0,0,1);s.setClear(1);l.setClear(0);X(e.DEPTH_TEST);s.setFunc(Qe);ne(false);ae(at);X(e.CULL_FACE);ee($);function X(t){if(f[t]!==true){e.enable(t);f[t]=true}}function K(t){if(f[t]!==false){e.disable(t);f[t]=false}}function q(t,n){if(u[t]!==n){e.bindFramebuffer(t,n);u[t]=n;t===e.DRAW_FRAMEBUFFER&&(u[e.FRAMEBUFFER]=n);t===e.FRAMEBUFFER&&(u[e.DRAW_FRAMEBUFFER]=n);return true}return false}function j(t,n){let a=m;let i=false;if(t){a=p.get(n);if(a===void 0){a=[];p.set(n,a)}const r=t.textures;if(a.length!==r.length||a[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=r.length;t<n;t++)a[t]=e.COLOR_ATTACHMENT0+t;a.length=r.length;i=true}}else if(a[0]!==e.BACK){a[0]=e.BACK;i=true}i&&e.drawBuffers(a)}function Z(t){if(_!==t){e.useProgram(t);_=t;return true}return false}const Q={[ot]:e.FUNC_ADD,[rt]:e.FUNC_SUBTRACT,[it]:e.FUNC_REVERSE_SUBTRACT};Q[st]=e.MIN;Q[lt]=e.MAX;const J={[bt]:e.ZERO,[At]:e.ONE,[Rt]:e.SRC_COLOR,[xt]:e.SRC_ALPHA,[Tt]:e.SRC_ALPHA_SATURATE,[Mt]:e.DST_COLOR,[St]:e.DST_ALPHA,[Et]:e.ONE_MINUS_SRC_COLOR,[vt]:e.ONE_MINUS_SRC_ALPHA,[gt]:e.ONE_MINUS_DST_COLOR,[_t]:e.ONE_MINUS_DST_ALPHA,[ht]:e.CONSTANT_COLOR,[mt]:e.ONE_MINUS_CONSTANT_COLOR,[pt]:e.CONSTANT_ALPHA,[ut]:e.ONE_MINUS_CONSTANT_ALPHA};function ee(t,n,a,i,r,o,s,l,c,d){if(t!==$){if(g===false){X(e.BLEND);g=true}if(t===Ct){r=r||n;o=o||a;s=s||i;if(n!==E||r!==T){e.blendEquationSeparate(Q[n],Q[r]);E=n;T=r}if(a!==S||i!==M||o!==x||s!==R){e.blendFuncSeparate(J[a],J[i],J[o],J[s]);S=a;M=i;x=o;R=s}if(l.equals(A)===false||c!==b){e.blendColor(l.r,l.g,l.b,c);A.copy(l);b=c}v=t;C=false}else if(t!==v||d!==C){if(E!==ot||T!==ot){e.blendEquation(e.FUNC_ADD);E=ot;T=ot}if(d)switch(t){case Ne:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case Ut:e.blendFunc(e.ONE,e.ONE);break;case Lt:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Pt:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Y("WebGLState: Invalid blending: ",t);break}else switch(t){case Ne:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case Ut:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Lt:Y("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Pt:Y("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Y("WebGLState: Invalid blending: ",t);break}S=null;M=null;x=null;R=null;A.set(0,0,0);b=0;v=t;C=d}}else if(g===true){K(e.BLEND);g=false}}function te(t,n){t.side===Ie?K(e.CULL_FACE):X(e.CULL_FACE);let a=t.side===h;n&&(a=!a);ne(a);t.blending===Ne&&t.transparent===false?ee($):ee(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha);s.setFunc(t.depthFunc);s.setTest(t.depthTest);s.setMask(t.depthWrite);o.setMask(t.colorWrite);const i=t.stencilWrite;l.setTest(i);if(i){l.setMask(t.stencilWriteMask);l.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask);l.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)}re(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits);t.alphaToCoverage===true?X(e.SAMPLE_ALPHA_TO_COVERAGE):K(e.SAMPLE_ALPHA_TO_COVERAGE)}function ne(t){if(P!==t){t?e.frontFace(e.CW):e.frontFace(e.CCW);P=t}}function ae(t){if(t!==Dt){X(e.CULL_FACE);t!==L&&(t===at?e.cullFace(e.BACK):t===wt?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))}else K(e.CULL_FACE);L=t}function ie(t){if(t!==U){N&&e.lineWidth(t);U=t}}function re(t,n,a){if(t){X(e.POLYGON_OFFSET_FILL);if(D!==n||w!==a){D=n;w=a;s.getReversed()&&(n=-n);e.polygonOffset(n,a)}}else K(e.POLYGON_OFFSET_FILL)}function oe(t){t?X(e.SCISSOR_TEST):K(e.SCISSOR_TEST)}function se(t){t===void 0&&(t=e.TEXTURE0+I-1);if(O!==t){e.activeTexture(t);O=t}}function ce(t,n,a){a===void 0&&(a=O===null?e.TEXTURE0+I-1:O);let i=B[a];if(i===void 0){i={type:void 0,texture:void 0};B[a]=i}if(i.type!==t||i.texture!==n){if(O!==a){e.activeTexture(a);O=a}e.bindTexture(t,n||z[t]);i.type=t;i.texture=n}}function de(){const t=B[O];if(t!==void 0&&t.type!==void 0){e.bindTexture(t.type,null);t.type=void 0;t.texture=void 0}}function fe(){try{e.compressedTexImage2D(...arguments)}catch(e){Y("WebGLState:",e)}}function ue(){try{e.compressedTexImage3D(...arguments)}catch(e){Y("WebGLState:",e)}}function pe(){try{e.texSubImage2D(...arguments)}catch(e){Y("WebGLState:",e)}}function me(){try{e.texSubImage3D(...arguments)}catch(e){Y("WebGLState:",e)}}function he(){try{e.compressedTexSubImage2D(...arguments)}catch(e){Y("WebGLState:",e)}}function _e(){try{e.compressedTexSubImage3D(...arguments)}catch(e){Y("WebGLState:",e)}}function ge(){try{e.texStorage2D(...arguments)}catch(e){Y("WebGLState:",e)}}function ve(){try{e.texStorage3D(...arguments)}catch(e){Y("WebGLState:",e)}}function Ee(){try{e.texImage2D(...arguments)}catch(e){Y("WebGLState:",e)}}function Se(){try{e.texImage3D(...arguments)}catch(e){Y("WebGLState:",e)}}function Me(t){if(V.equals(t)===false){e.scissor(t.x,t.y,t.z,t.w);V.copy(t)}}function Te(t){if(W.equals(t)===false){e.viewport(t.x,t.y,t.z,t.w);W.copy(t)}}function xe(t,n){let a=d.get(n);if(a===void 0){a=new WeakMap;d.set(n,a)}let i=a.get(t);if(i===void 0){i=e.getUniformBlockIndex(n,t.name);a.set(t,i)}}function Re(t,n){const a=d.get(n);const i=a.get(t);if(c.get(n)!==i){e.uniformBlockBinding(n,i,t.__bindingPointIndex);c.set(n,i)}}function Ae(){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(0,0,0,0);e.colorMask(true,true,true,true);e.clearColor(0,0,0,0);e.depthMask(true);e.depthFunc(e.LESS);s.setReversed(false);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);f={};O=null;B={};u={};p=new WeakMap;m=[];_=null;g=false;v=null;E=null;S=null;M=null;T=null;x=null;R=null;A=new n(0,0,0);b=0;C=false;P=null;L=null;U=null;D=null;w=null;V.set(0,0,e.canvas.width,e.canvas.height);W.set(0,0,e.canvas.width,e.canvas.height);o.reset();s.reset();l.reset()}return{buffers:{color:o,depth:s,stencil:l},enable:X,disable:K,bindFramebuffer:q,drawBuffers:j,useProgram:Z,setBlending:ee,setMaterial:te,setFlipSided:ne,setCullFace:ae,setLineWidth:ie,setPolygonOffset:re,setScissorTest:oe,activeTexture:se,bindTexture:ce,unbindTexture:de,compressedTexImage2D:fe,compressedTexImage3D:ue,texImage2D:Ee,texImage3D:Se,updateUBOMapping:xe,uniformBlockBinding:Re,texStorage2D:ge,texStorage3D:ve,texSubImage2D:pe,texSubImage3D:me,compressedTexSubImage2D:he,compressedTexSubImage3D:_e,scissor:Me,viewport:Te,reset:Ae}}function tc(e,n,a,i,r,o,s){const l=n.has("WEBGL_multisampled_render_to_texture")?n.get("WEBGL_multisampled_render_to_texture"):null;const c=typeof navigator!=="undefined"&&/OculusBrowser/g.test(navigator.userAgent);const d=new t;const f=new WeakMap;let u;const p=new WeakMap;let m=false;try{m=typeof OffscreenCanvas!=="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(e){}function h(e,t){return m?new OffscreenCanvas(e,t):It("canvas")}function _(e,t,n){let a=1;const i=he(e);(i.width>n||i.height>n)&&(a=n/Math.max(i.width,i.height));if(a<1){if(typeof HTMLImageElement!=="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!=="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!=="undefined"&&e instanceof ImageBitmap||typeof VideoFrame!=="undefined"&&e instanceof VideoFrame){const n=Math.floor(a*i.width);const r=Math.floor(a*i.height);u===void 0&&(u=h(n,r));const o=t?h(n,r):u;o.width=n;o.height=r;const s=o.getContext("2d");s.drawImage(e,0,0,n,r);w("WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+r+").");return o}"data"in e&&w("WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+").");return e}return e}function g(e){return e.generateMipmaps}function S(t){e.generateMipmap(t)}function M(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function T(t,a,i,r,o=false){if(t!==null){if(e[t]!==void 0)return e[t];w("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let s=a;if(a===e.RED){i===e.FLOAT&&(s=e.R32F);i===e.HALF_FLOAT&&(s=e.R16F);i===e.UNSIGNED_BYTE&&(s=e.R8)}if(a===e.RED_INTEGER){i===e.UNSIGNED_BYTE&&(s=e.R8UI);i===e.UNSIGNED_SHORT&&(s=e.R16UI);i===e.UNSIGNED_INT&&(s=e.R32UI);i===e.BYTE&&(s=e.R8I);i===e.SHORT&&(s=e.R16I);i===e.INT&&(s=e.R32I)}if(a===e.RG){i===e.FLOAT&&(s=e.RG32F);i===e.HALF_FLOAT&&(s=e.RG16F);i===e.UNSIGNED_BYTE&&(s=e.RG8)}if(a===e.RG_INTEGER){i===e.UNSIGNED_BYTE&&(s=e.RG8UI);i===e.UNSIGNED_SHORT&&(s=e.RG16UI);i===e.UNSIGNED_INT&&(s=e.RG32UI);i===e.BYTE&&(s=e.RG8I);i===e.SHORT&&(s=e.RG16I);i===e.INT&&(s=e.RG32I)}if(a===e.RGB_INTEGER){i===e.UNSIGNED_BYTE&&(s=e.RGB8UI);i===e.UNSIGNED_SHORT&&(s=e.RGB16UI);i===e.UNSIGNED_INT&&(s=e.RGB32UI);i===e.BYTE&&(s=e.RGB8I);i===e.SHORT&&(s=e.RGB16I);i===e.INT&&(s=e.RGB32I)}if(a===e.RGBA_INTEGER){i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI);i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI);i===e.UNSIGNED_INT&&(s=e.RGBA32UI);i===e.BYTE&&(s=e.RGBA8I);i===e.SHORT&&(s=e.RGBA16I);i===e.INT&&(s=e.RGBA32I)}if(a===e.RGB){i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5);i===e.UNSIGNED_INT_10F_11F_11F_REV&&(s=e.R11F_G11F_B10F)}if(a===e.RGBA){const t=o?Ae:v.getTransfer(r);i===e.FLOAT&&(s=e.RGBA32F);i===e.HALF_FLOAT&&(s=e.RGBA16F);i===e.UNSIGNED_BYTE&&(s=t===E?e.SRGB8_ALPHA8:e.RGBA8);i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4);i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||n.get("EXT_color_buffer_float");return s}function x(t,n){let a;if(t){if(n===null||n===Ye||n===Nt)a=e.DEPTH24_STENCIL8;else if(n===U)a=e.DEPTH32F_STENCIL8;else if(n===yt){a=e.DEPTH24_STENCIL8;w("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}}else n===null||n===Ye||n===Nt?a=e.DEPTH_COMPONENT24:n===U?a=e.DEPTH_COMPONENT32F:n===yt&&(a=e.DEPTH_COMPONENT16);return a}function R(e,t){return g(e)===true||e.isFramebufferTexture&&e.minFilter!==ze&&e.minFilter!==V?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){const t=e.target;t.removeEventListener("dispose",A);P(t);t.isVideoTexture&&f.delete(t)}function C(e){const t=e.target;t.removeEventListener("dispose",C);I(t)}function P(e){const t=i.get(e);if(t.__webglInit===void 0)return;const n=e.source;const a=p.get(n);if(a){const i=a[t.__cacheKey];i.usedTimes--;i.usedTimes===0&&D(e);Object.keys(a).length===0&&p.delete(n)}i.remove(e)}function D(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const a=t.source;const r=p.get(a);delete r[n.__cacheKey];s.memory.textures--}function I(t){const n=i.get(t);if(t.depthTexture){t.depthTexture.dispose();i.remove(t.depthTexture)}if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let a=0;a<n.__webglFramebuffer[t].length;a++)e.deleteFramebuffer(n.__webglFramebuffer[t][a]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer);if(n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const a=t.textures;for(let t=0,n=a.length;t<n;t++){const n=i.get(a[t]);if(n.__webglTexture){e.deleteTexture(n.__webglTexture);s.memory.textures--}i.remove(a[t])}i.remove(t)}let N=0;function y(){N=0}function F(){const e=N;e>=r.maxTextures&&w("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures);N+=1;return e}function O(e){const t=[];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);return t.join()}function B(t,n){const r=i.get(t);t.isVideoTexture&&pe(t);if(t.isRenderTargetTexture===false&&t.isExternalTexture!==true&&t.version>0&&r.__version!==t.version){const e=t.image;if(e===null)w("WebGLRenderer: Texture marked for update but no image data found.");else{if(e.complete!==false){Q(r,t,n);return}w("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(r.__webglTexture=t.sourceTexture?t.sourceTexture:null);a.bindTexture(e.TEXTURE_2D,r.__webglTexture,e.TEXTURE0+n)}function H(t,n){const r=i.get(t);if(t.isRenderTargetTexture===false&&t.version>0&&r.__version!==t.version)Q(r,t,n);else{t.isExternalTexture&&(r.__webglTexture=t.sourceTexture?t.sourceTexture:null);a.bindTexture(e.TEXTURE_2D_ARRAY,r.__webglTexture,e.TEXTURE0+n)}}function W(t,n){const r=i.get(t);t.isRenderTargetTexture===false&&t.version>0&&r.__version!==t.version?Q(r,t,n):a.bindTexture(e.TEXTURE_3D,r.__webglTexture,e.TEXTURE0+n)}function k(t,n){const r=i.get(t);t.isCubeDepthTexture!==true&&t.version>0&&r.__version!==t.version?J(r,t,n):a.bindTexture(e.TEXTURE_CUBE_MAP,r.__webglTexture,e.TEXTURE0+n)}const z={[Bt]:e.REPEAT,[Ot]:e.CLAMP_TO_EDGE,[Ft]:e.MIRRORED_REPEAT};const X={[ze]:e.NEAREST,[Vt]:e.NEAREST_MIPMAP_NEAREST,[Ht]:e.NEAREST_MIPMAP_LINEAR,[V]:e.LINEAR,[Gt]:e.LINEAR_MIPMAP_NEAREST,[te]:e.LINEAR_MIPMAP_LINEAR};const K={[Kt]:e.NEVER,[Yt]:e.ALWAYS,[Xt]:e.LESS,[Re]:e.LEQUAL,[zt]:e.EQUAL,[xe]:e.GEQUAL,[kt]:e.GREATER,[Wt]:e.NOTEQUAL};function q(t,a){a.type!==U||n.has("OES_texture_float_linear")!==false||a.magFilter!==V&&a.magFilter!==Gt&&a.magFilter!==Ht&&a.magFilter!==te&&a.minFilter!==V&&a.minFilter!==Gt&&a.minFilter!==Ht&&a.minFilter!==te||w("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");e.texParameteri(t,e.TEXTURE_WRAP_S,z[a.wrapS]);e.texParameteri(t,e.TEXTURE_WRAP_T,z[a.wrapT]);t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY||e.texParameteri(t,e.TEXTURE_WRAP_R,z[a.wrapR]);e.texParameteri(t,e.TEXTURE_MAG_FILTER,X[a.magFilter]);e.texParameteri(t,e.TEXTURE_MIN_FILTER,X[a.minFilter]);if(a.compareFunction){e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE);e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,K[a.compareFunction])}if(n.has("EXT_texture_filter_anisotropic")===true){if(a.magFilter===ze)return;if(a.minFilter!==Ht&&a.minFilter!==te)return;if(a.type===U&&n.has("OES_texture_float_linear")===false)return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy()));i.get(a).__currentAnisotropy=a.anisotropy}}}function j(t,n){let a=false;if(t.__webglInit===void 0){t.__webglInit=true;n.addEventListener("dispose",A)}const i=n.source;let r=p.get(i);if(r===void 0){r={};p.set(i,r)}const o=O(n);if(o!==t.__cacheKey){if(r[o]===void 0){r[o]={texture:e.createTexture(),usedTimes:0};s.memory.textures++;a=true}r[o].usedTimes++;const i=r[t.__cacheKey];if(i!==void 0){r[t.__cacheKey].usedTimes--;i.usedTimes===0&&D(n)}t.__cacheKey=o;t.__webglTexture=r[o].texture}return a}function Z(e,t,n){return Math.floor(Math.floor(e/n)/t)}function $(t,n,i,r){const o=4;const s=t.updateRanges;if(s.length===0)a.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,i,r,n.data);else{s.sort(((e,t)=>e.start-t.start));let l=0;for(let e=1;e<s.length;e++){const t=s[l];const a=s[e];const i=t.start+t.count;const r=Z(a.start,n.width,o);const c=Z(t.start,n.width,o);if(a.start<=i+1&&r===c&&Z(a.start+a.count-1,n.width,o)===r)t.count=Math.max(t.count,a.start+a.count-t.start);else{++l;s[l]=a}}s.length=l+1;const c=e.getParameter(e.UNPACK_ROW_LENGTH);const d=e.getParameter(e.UNPACK_SKIP_PIXELS);const f=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,n.width);for(let t=0,l=s.length;t<l;t++){const l=s[t];const c=Math.floor(l.start/o);const d=Math.ceil(l.count/o);const f=c%n.width;const u=Math.floor(c/n.width);const p=d;const m=1;e.pixelStorei(e.UNPACK_SKIP_PIXELS,f);e.pixelStorei(e.UNPACK_SKIP_ROWS,u);a.texSubImage2D(e.TEXTURE_2D,0,f,u,p,m,i,r,n.data)}t.clearUpdateRanges();e.pixelStorei(e.UNPACK_ROW_LENGTH,c);e.pixelStorei(e.UNPACK_SKIP_PIXELS,d);e.pixelStorei(e.UNPACK_SKIP_ROWS,f)}}function Q(t,n,s){let l=e.TEXTURE_2D;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY);n.isData3DTexture&&(l=e.TEXTURE_3D);const c=j(t,n);const d=n.source;a.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const f=i.get(d);if(d.version!==f.__version||c===true){a.activeTexture(e.TEXTURE0+s);const t=v.getPrimaries(v.workingColorSpace);const i=n.colorSpace===qt?null:v.getPrimaries(n.colorSpace);const u=n.colorSpace===qt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY);e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha);e.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment);e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=_(n.image,false,r.maxTextureSize);p=me(n,p);const m=o.convert(n.format,n.colorSpace);const h=o.convert(n.type);let E=T(n.internalFormat,m,h,n.colorSpace,n.isVideoTexture);q(l,n);let M;const A=n.mipmaps;const C=n.isVideoTexture!==true;const P=f.__version===void 0||c===true;const L=d.dataReady;const U=R(n,p);if(n.isDepthTexture){E=x(n.format===jt,n.type);P&&(C?a.texStorage2D(e.TEXTURE_2D,1,E,p.width,p.height):a.texImage2D(e.TEXTURE_2D,0,E,p.width,p.height,0,m,h,null))}else if(n.isDataTexture)if(A.length>0){C&&P&&a.texStorage2D(e.TEXTURE_2D,U,E,A[0].width,A[0].height);for(let t=0,n=A.length;t<n;t++){M=A[t];C?L&&a.texSubImage2D(e.TEXTURE_2D,t,0,0,M.width,M.height,m,h,M.data):a.texImage2D(e.TEXTURE_2D,t,E,M.width,M.height,0,m,h,M.data)}n.generateMipmaps=false}else if(C){P&&a.texStorage2D(e.TEXTURE_2D,U,E,p.width,p.height);L&&$(n,p,m,h)}else a.texImage2D(e.TEXTURE_2D,0,E,p.width,p.height,0,m,h,p.data);else if(n.isCompressedTexture)if(n.isCompressedArrayTexture){C&&P&&a.texStorage3D(e.TEXTURE_2D_ARRAY,U,E,A[0].width,A[0].height,p.depth);for(let t=0,i=A.length;t<i;t++){M=A[t];if(n.format!==b)if(m!==null)if(C){if(L)if(n.layerUpdates.size>0){const i=Zt(M.width,M.height,n.format,n.type);for(const r of n.layerUpdates){const n=M.data.subarray(r*i/M.data.BYTES_PER_ELEMENT,(r+1)*i/M.data.BYTES_PER_ELEMENT);a.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,M.width,M.height,1,m,n)}n.clearLayerUpdates()}else a.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,M.width,M.height,p.depth,m,M.data)}else a.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,E,M.width,M.height,p.depth,0,M.data,0,0);else w("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?L&&a.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,M.width,M.height,p.depth,m,h,M.data):a.texImage3D(e.TEXTURE_2D_ARRAY,t,E,M.width,M.height,p.depth,0,m,h,M.data)}}else{C&&P&&a.texStorage2D(e.TEXTURE_2D,U,E,A[0].width,A[0].height);for(let t=0,i=A.length;t<i;t++){M=A[t];n.format!==b?m!==null?C?L&&a.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,M.width,M.height,m,M.data):a.compressedTexImage2D(e.TEXTURE_2D,t,E,M.width,M.height,0,M.data):w("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?L&&a.texSubImage2D(e.TEXTURE_2D,t,0,0,M.width,M.height,m,h,M.data):a.texImage2D(e.TEXTURE_2D,t,E,M.width,M.height,0,m,h,M.data)}}else if(n.isDataArrayTexture)if(C){P&&a.texStorage3D(e.TEXTURE_2D_ARRAY,U,E,p.width,p.height,p.depth);if(L)if(n.layerUpdates.size>0){const t=Zt(p.width,p.height,n.format,n.type);for(const i of n.layerUpdates){const n=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);a.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,m,h,n)}n.clearLayerUpdates()}else a.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,h,p.data)}else a.texImage3D(e.TEXTURE_2D_ARRAY,0,E,p.width,p.height,p.depth,0,m,h,p.data);else if(n.isData3DTexture)if(C){P&&a.texStorage3D(e.TEXTURE_3D,U,E,p.width,p.height,p.depth);L&&a.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,h,p.data)}else a.texImage3D(e.TEXTURE_3D,0,E,p.width,p.height,p.depth,0,m,h,p.data);else if(n.isFramebufferTexture){if(P)if(C)a.texStorage2D(e.TEXTURE_2D,U,E,p.width,p.height);else{let t=p.width,n=p.height;for(let i=0;i<U;i++){a.texImage2D(e.TEXTURE_2D,i,E,t,n,0,m,h,null);t>>=1;n>>=1}}}else if(A.length>0){if(C&&P){const t=he(A[0]);a.texStorage2D(e.TEXTURE_2D,U,E,t.width,t.height)}for(let t=0,n=A.length;t<n;t++){M=A[t];C?L&&a.texSubImage2D(e.TEXTURE_2D,t,0,0,m,h,M):a.texImage2D(e.TEXTURE_2D,t,E,m,h,M)}n.generateMipmaps=false}else if(C){if(P){const t=he(p);a.texStorage2D(e.TEXTURE_2D,U,E,t.width,t.height)}L&&a.texSubImage2D(e.TEXTURE_2D,0,0,0,m,h,p)}else a.texImage2D(e.TEXTURE_2D,0,E,m,h,p);g(n)&&S(l);f.__version=d.version;n.onUpdate&&n.onUpdate(n)}t.__version=n.version}function J(t,n,s){if(n.image.length!==6)return;const l=j(t,n);const c=n.source;a.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const d=i.get(c);if(c.version!==d.__version||l===true){a.activeTexture(e.TEXTURE0+s);const t=v.getPrimaries(v.workingColorSpace);const i=n.colorSpace===qt?null:v.getPrimaries(n.colorSpace);const f=n.colorSpace===qt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY);e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha);e.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment);e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);const u=n.isCompressedTexture||n.image[0].isCompressedTexture;const p=n.image[0]&&n.image[0].isDataTexture;const m=[];for(let e=0;e<6;e++){m[e]=u||p?p?n.image[e].image:n.image[e]:_(n.image[e],true,r.maxCubemapSize);m[e]=me(n,m[e])}const h=m[0],E=o.convert(n.format,n.colorSpace),M=o.convert(n.type),x=T(n.internalFormat,E,M,n.colorSpace);const A=n.isVideoTexture!==true;const C=d.__version===void 0||l===true;const P=c.dataReady;let L=R(n,h);q(e.TEXTURE_CUBE_MAP,n);let U;if(u){A&&C&&a.texStorage2D(e.TEXTURE_CUBE_MAP,L,x,h.width,h.height);for(let t=0;t<6;t++){U=m[t].mipmaps;for(let i=0;i<U.length;i++){const r=U[i];n.format!==b?E!==null?A?P&&a.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,E,r.data):a.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,r.data):w("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?P&&a.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,E,M,r.data):a.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,E,M,r.data)}}}else{U=n.mipmaps;if(A&&C){U.length>0&&L++;const t=he(m[0]);a.texStorage2D(e.TEXTURE_CUBE_MAP,L,x,t.width,t.height)}for(let t=0;t<6;t++)if(p){A?P&&a.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,E,M,m[t].data):a.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,m[t].width,m[t].height,0,E,M,m[t].data);for(let n=0;n<U.length;n++){const i=U[n];const r=i.image[t].image;A?P&&a.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,n+1,0,0,r.width,r.height,E,M,r.data):a.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,n+1,x,r.width,r.height,0,E,M,r.data)}}else{A?P&&a.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,E,M,m[t]):a.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,E,M,m[t]);for(let n=0;n<U.length;n++){const i=U[n];A?P&&a.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,n+1,0,0,E,M,i.image[t]):a.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,n+1,x,E,M,i.image[t])}}}g(n)&&S(e.TEXTURE_CUBE_MAP);d.__version=c.version;n.onUpdate&&n.onUpdate(n)}t.__version=n.version}function ee(t,n,r,s,c,d){const f=o.convert(r.format,r.colorSpace);const u=o.convert(r.type);const p=T(r.internalFormat,f,u,r.colorSpace);const m=i.get(n);const h=i.get(r);h.__renderTarget=n;if(!m.__hasExternalTextures){const t=Math.max(1,n.width>>d);const i=Math.max(1,n.height>>d);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?a.texImage3D(c,d,p,t,i,n.depth,0,f,u,null):a.texImage2D(c,d,p,t,i,0,f,u,null)}a.bindFramebuffer(e.FRAMEBUFFER,t);ue(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,c,h.__webglTexture,0,fe(n)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,c,h.__webglTexture,d);a.bindFramebuffer(e.FRAMEBUFFER,null)}function ne(t,n,a){e.bindRenderbuffer(e.RENDERBUFFER,t);if(n.depthBuffer){const i=n.depthTexture;const r=i&&i.isDepthTexture?i.type:null;const o=x(n.stencilBuffer,r);const s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;ue(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,fe(n),o,n.width,n.height):a?e.renderbufferStorageMultisample(e.RENDERBUFFER,fe(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,s,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i<t.length;i++){const r=t[i];const s=o.convert(r.format,r.colorSpace);const c=o.convert(r.type);const d=T(r.internalFormat,s,c,r.colorSpace);ue(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,fe(n),d,n.width,n.height):a?e.renderbufferStorageMultisample(e.RENDERBUFFER,fe(n),d,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,d,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function ae(t,n,r){const s=n.isWebGLCubeRenderTarget===true;a.bindFramebuffer(e.FRAMEBUFFER,t);if(!(n.depthTexture&&n.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const c=i.get(n.depthTexture);c.__renderTarget=n;if(!c.__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=true}if(s){if(c.__webglInit===void 0){c.__webglInit=true;n.depthTexture.addEventListener("dispose",A)}if(c.__webglTexture===void 0){c.__webglTexture=e.createTexture();a.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture);q(e.TEXTURE_CUBE_MAP,n.depthTexture);const t=o.convert(n.depthTexture.format);const i=o.convert(n.depthTexture.type);let r;n.depthTexture.format===ke?r=e.DEPTH_COMPONENT24:n.depthTexture.format===jt&&(r=e.DEPTH24_STENCIL8);for(let a=0;a<6;a++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,r,n.width,n.height,0,t,i,null)}}else B(n.depthTexture,0);const d=c.__webglTexture;const f=fe(n);const u=s?e.TEXTURE_CUBE_MAP_POSITIVE_X+r:e.TEXTURE_2D;const p=n.depthTexture.format===jt?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(n.depthTexture.format===ke)ue(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,u,d,0,f):e.framebufferTexture2D(e.FRAMEBUFFER,p,u,d,0);else{if(n.depthTexture.format!==jt)throw new Error("Unknown depthTexture format");ue(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,u,d,0,f):e.framebufferTexture2D(e.FRAMEBUFFER,p,u,d,0)}}function ie(t){const n=i.get(t);const r=t.isWebGLCubeRenderTarget===true;if(n.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;n.__depthDisposeCallback&&n.__depthDisposeCallback();if(e){const t=()=>{delete n.__boundDepthTexture;delete n.__depthDisposeCallback;e.removeEventListener("dispose",t)};e.addEventListener("dispose",t);n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(r)for(let e=0;e<6;e++)ae(n.__webglFramebuffer[e],t,e);else{const e=t.texture.mipmaps;e&&e.length>0?ae(n.__webglFramebuffer[0],t,0):ae(n.__webglFramebuffer,t,0)}else if(r){n.__webglDepthbuffer=[];for(let i=0;i<6;i++){a.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[i]);if(n.__webglDepthbuffer[i]===void 0){n.__webglDepthbuffer[i]=e.createRenderbuffer();ne(n.__webglDepthbuffer[i],t,false)}else{const a=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;const r=n.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,r);e.framebufferRenderbuffer(e.FRAMEBUFFER,a,e.RENDERBUFFER,r)}}}else{const i=t.texture.mipmaps;i&&i.length>0?a.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):a.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);if(n.__webglDepthbuffer===void 0){n.__webglDepthbuffer=e.createRenderbuffer();ne(n.__webglDepthbuffer,t,false)}else{const a=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;const i=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i);e.framebufferRenderbuffer(e.FRAMEBUFFER,a,e.RENDERBUFFER,i)}}a.bindFramebuffer(e.FRAMEBUFFER,null)}function re(t,n,a){const r=i.get(t);n!==void 0&&ee(r.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);a!==void 0&&ie(t)}function oe(t){const n=t.texture;const r=i.get(t);const l=i.get(n);t.addEventListener("dispose",C);const c=t.textures;const d=t.isWebGLCubeRenderTarget===true;const f=c.length>1;if(!f){l.__webglTexture===void 0&&(l.__webglTexture=e.createTexture());l.__version=n.version;s.memory.textures++}if(d){r.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){r.__webglFramebuffer[t]=[];for(let a=0;a<n.mipmaps.length;a++)r.__webglFramebuffer[t][a]=e.createFramebuffer()}else r.__webglFramebuffer[t]=e.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){r.__webglFramebuffer=[];for(let t=0;t<n.mipmaps.length;t++)r.__webglFramebuffer[t]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(f)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);if(n.__webglTexture===void 0){n.__webglTexture=e.createTexture();s.memory.textures++}}if(t.samples>0&&ue(t)===false){r.__webglMultisampledFramebuffer=e.createFramebuffer();r.__webglColorRenderbuffer=[];a.bindFramebuffer(e.FRAMEBUFFER,r.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const a=c[n];r.__webglColorRenderbuffer[n]=e.createRenderbuffer();e.bindRenderbuffer(e.RENDERBUFFER,r.__webglColorRenderbuffer[n]);const i=o.convert(a.format,a.colorSpace);const s=o.convert(a.type);const l=T(a.internalFormat,i,s,a.colorSpace,t.isXRRenderTarget===true);const d=fe(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,d,l,t.width,t.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,r.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null);if(t.depthBuffer){r.__webglDepthRenderbuffer=e.createRenderbuffer();ne(r.__webglDepthRenderbuffer,t,true)}a.bindFramebuffer(e.FRAMEBUFFER,null)}}if(d){a.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture);q(e.TEXTURE_CUBE_MAP,n);for(let a=0;a<6;a++)if(n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)ee(r.__webglFramebuffer[a][i],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+a,i);else ee(r.__webglFramebuffer[a],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+a,0);g(n)&&S(e.TEXTURE_CUBE_MAP);a.unbindTexture()}else if(f){for(let n=0,o=c.length;n<o;n++){const o=c[n];const s=i.get(o);let l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY);a.bindTexture(l,s.__webglTexture);q(l,o);ee(r.__webglFramebuffer,t,o,e.COLOR_ATTACHMENT0+n,l,0);g(o)&&S(l)}a.unbindTexture()}else{let i=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY);a.bindTexture(i,l.__webglTexture);q(i,n);if(n.mipmaps&&n.mipmaps.length>0)for(let a=0;a<n.mipmaps.length;a++)ee(r.__webglFramebuffer[a],t,n,e.COLOR_ATTACHMENT0,i,a);else ee(r.__webglFramebuffer,t,n,e.COLOR_ATTACHMENT0,i,0);g(n)&&S(i);a.unbindTexture()}t.depthBuffer&&ie(t)}function se(e){const t=e.textures;for(let n=0,r=t.length;n<r;n++){const r=t[n];if(g(r)){const t=M(e);const n=i.get(r).__webglTexture;a.bindTexture(t,n);S(t);a.unbindTexture()}}}const le=[];const ce=[];function de(t){if(t.samples>0)if(ue(t)===false){const n=t.textures;const r=t.width;const o=t.height;let s=e.COLOR_BUFFER_BIT;const l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;const d=i.get(t);const f=n.length>1;if(f)for(let t=0;t<n.length;t++){a.bindFramebuffer(e.FRAMEBUFFER,d.__webglMultisampledFramebuffer);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null);a.bindFramebuffer(e.FRAMEBUFFER,d.__webglFramebuffer);e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0)}a.bindFramebuffer(e.READ_FRAMEBUFFER,d.__webglMultisampledFramebuffer);const u=t.texture.mipmaps;u&&u.length>0?a.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer[0]):a.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglFramebuffer);for(let a=0;a<n.length;a++){if(t.resolveDepthBuffer){t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT);t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)}if(f){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,d.__webglColorRenderbuffer[a]);const t=i.get(n[a]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,r,o,0,0,r,o,s,e.NEAREST);if(c===true){le.length=0;ce.length=0;le.push(e.COLOR_ATTACHMENT0+a);if(t.depthBuffer&&t.resolveDepthBuffer===false){le.push(l);ce.push(l);e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,ce)}e.invalidateFramebuffer(e.READ_FRAMEBUFFER,le)}}a.bindFramebuffer(e.READ_FRAMEBUFFER,null);a.bindFramebuffer(e.DRAW_FRAMEBUFFER,null);if(f)for(let t=0;t<n.length;t++){a.bindFramebuffer(e.FRAMEBUFFER,d.__webglMultisampledFramebuffer);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,d.__webglColorRenderbuffer[t]);const r=i.get(n[t]).__webglTexture;a.bindFramebuffer(e.FRAMEBUFFER,d.__webglFramebuffer);e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,r,0)}a.bindFramebuffer(e.DRAW_FRAMEBUFFER,d.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&t.resolveDepthBuffer===false&&c){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}function fe(e){return Math.min(r.maxSamples,e.samples)}function ue(e){const t=i.get(e);return e.samples>0&&n.has("WEBGL_multisampled_render_to_texture")===true&&t.__useRenderToTexture!==false}function pe(e){const t=s.render.frame;if(f.get(e)!==t){f.set(e,t);e.update()}}function me(e,t){const n=e.colorSpace;const a=e.format;const i=e.type;if(e.isCompressedTexture===true||e.isVideoTexture===true)return t;n!==G&&n!==qt&&(v.getTransfer(n)===E?a===b&&i===L||w("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Y("WebGLTextures: Unsupported texture color space:",n));return t}function he(e){if(typeof HTMLImageElement!=="undefined"&&e instanceof HTMLImageElement){d.width=e.naturalWidth||e.width;d.height=e.naturalHeight||e.height}else if(typeof VideoFrame!=="undefined"&&e instanceof VideoFrame){d.width=e.displayWidth;d.height=e.displayHeight}else{d.width=e.width;d.height=e.height}return d}this.allocateTextureUnit=F;this.resetTextureUnits=y;this.setTexture2D=B;this.setTexture2DArray=H;this.setTexture3D=W;this.setTextureCube=k;this.rebindTextures=re;this.setupRenderTarget=oe;this.updateRenderTargetMipmap=se;this.updateMultisampleRenderTarget=de;this.setupDepthRenderbuffer=ie;this.setupFrameBufferTexture=ee;this.useMultisampledRTT=ue;this.isReversedDepthBuffer=function(){return a.buffers.depth.getReversed()}}function nc(e,t){function n(n,a=qt){let i;const r=v.getTransfer(a);if(n===L)return e.UNSIGNED_BYTE;if(n===$t)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Qt)return e.UNSIGNED_SHORT_5_5_5_1;if(n===Jt)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===tn)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===nn)return e.BYTE;if(n===an)return e.SHORT;if(n===yt)return e.UNSIGNED_SHORT;if(n===R)return e.INT;if(n===Ye)return e.UNSIGNED_INT;if(n===U)return e.FLOAT;if(n===C)return e.HALF_FLOAT;if(n===rn)return e.ALPHA;if(n===on)return e.RGB;if(n===b)return e.RGBA;if(n===ke)return e.DEPTH_COMPONENT;if(n===jt)return e.DEPTH_STENCIL;if(n===sn)return e.RED;if(n===ln)return e.RED_INTEGER;if(n===Be)return e.RG;if(n===cn)return e.RG_INTEGER;if(n===un)return e.RGBA_INTEGER;if(n===pn||n===mn||n===hn||n===_n)if(r===E){i=t.get("WEBGL_compressed_texture_s3tc_srgb");if(i===null)return null;if(n===pn)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===mn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===hn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===_n)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{i=t.get("WEBGL_compressed_texture_s3tc");if(i===null)return null;if(n===pn)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===mn)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===hn)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===_n)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===gn||n===vn||n===En||n===Sn){i=t.get("WEBGL_compressed_texture_pvrtc");if(i===null)return null;if(n===gn)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===vn)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===En)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Sn)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Mn||n===Tn||n===xn||n===Rn||n===An||n===bn||n===Cn){i=t.get("WEBGL_compressed_texture_etc");if(i===null)return null;if(n===Mn||n===Tn)return r===E?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===xn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===Rn)return i.COMPRESSED_R11_EAC;if(n===An)return i.COMPRESSED_SIGNED_R11_EAC;if(n===bn)return i.COMPRESSED_RG11_EAC;if(n===Cn)return i.COMPRESSED_SIGNED_RG11_EAC}if(n===Pn||n===Ln||n===Un||n===Dn||n===wn||n===In||n===Nn||n===yn||n===Fn||n===On||n===Bn||n===Gn||n===Hn||n===Vn){i=t.get("WEBGL_compressed_texture_astc");if(i===null)return null;if(n===Pn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ln)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Un)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Dn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===wn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===In)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Nn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===yn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Fn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===On)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Bn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Gn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Hn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Vn)return r===E?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Wn||n===kn||n===zn){i=t.get("EXT_texture_compression_bptc");if(i===null)return null;if(n===Wn)return r===E?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===kn)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===zn)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===Xn||n===Yn||n===Kn||n===qn){i=t.get("EXT_texture_compression_rgtc");if(i===null)return null;if(n===Xn)return i.COMPRESSED_RED_RGTC1_EXT;if(n===Yn)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Kn)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===qn)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Nt?e.UNSIGNED_INT_24_8:e[n]!==void 0?e[n]:null}return{convert:n}}const ac="\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}";const ic="\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}";class WebXRDepthSensing{constructor(){
|
|
/**
|
|
* An opaque texture representing the depth of the user's environment.
|
|
*
|
|
* @type {?ExternalTexture}
|
|
*/
|
|
this.texture=null;
|
|
/**
|
|
* A plane mesh for visualizing the depth texture.
|
|
*
|
|
* @type {?Mesh}
|
|
*/this.mesh=null;
|
|
/**
|
|
* The depth near value.
|
|
*
|
|
* @type {number}
|
|
*/this.depthNear=0;
|
|
/**
|
|
* The depth near far.
|
|
*
|
|
* @type {number}
|
|
*/this.depthFar=0}
|
|
/**
|
|
* Inits the depth sensing module
|
|
*
|
|
* @param {XRWebGLDepthInformation} depthData - The XR depth data.
|
|
* @param {XRRenderState} renderState - The XR render state.
|
|
*/init(e,t){if(this.texture===null){const n=new jn(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar){this.depthNear=e.depthNear;this.depthFar=e.depthFar}this.texture=n}}
|
|
/**
|
|
* Returns a plane mesh that visualizes the depth texture.
|
|
*
|
|
* @param {ArrayCamera} cameraXR - The XR camera.
|
|
* @return {?Mesh} The plane mesh.
|
|
*/getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport;const n=new m({vertexShader:ac,fragmentShader:ic,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new u(new S(20,20),n)}return this.mesh}reset(){this.texture=null;this.mesh=null}getDepthTexture(){return this.texture}}class WebXRManager extends Zn{
|
|
/**
|
|
* Constructs a new WebGL renderer.
|
|
*
|
|
* @param {WebGLRenderer} renderer - The renderer.
|
|
* @param {WebGL2RenderingContext} gl - The rendering context.
|
|
*/
|
|
constructor(e,n){super();const a=this;let i=null;let o=1;let s=null;let l="local-floor";let c=1;let d=null;let f=null;let u=null;let p=null;let m=null;let h=null;const _=typeof XRWebGLBinding!=="undefined";const g=new WebXRDepthSensing;const v={};const E=n.getContextAttributes();let S=null;let M=null;const T=[];const x=[];const R=new t;let A=null;const C=new k;C.viewport=new le;const P=new k;P.viewport=new le;const U=[C,P];const D=new $n;let I=null;let N=null;
|
|
/**
|
|
* Whether the manager's XR camera should be automatically updated or not.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
*/this.cameraAutoUpdate=true;
|
|
/**
|
|
* This flag notifies the renderer to be ready for XR rendering. Set it to `true`
|
|
* if you are going to use XR in your app.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
*/this.enabled=false;
|
|
/**
|
|
* Whether XR presentation is active or not.
|
|
*
|
|
* @type {boolean}
|
|
* @readonly
|
|
* @default false
|
|
*/this.isPresenting=false;
|
|
/**
|
|
* Returns a group representing the `target ray` space of the XR controller.
|
|
* Use this space for visualizing 3D objects that support the user in pointing
|
|
* tasks like UI interaction.
|
|
*
|
|
* @param {number} index - The index of the controller.
|
|
* @return {Group} A group representing the `target ray` space.
|
|
*/this.getController=function(e){let t=T[e];if(t===void 0){t=new Qn;T[e]=t}return t.getTargetRaySpace()};
|
|
/**
|
|
* Returns a group representing the `grip` space of the XR controller.
|
|
* Use this space for visualizing 3D objects that support the user in pointing
|
|
* tasks like UI interaction.
|
|
*
|
|
* Note: If you want to show something in the user's hand AND offer a
|
|
* pointing ray at the same time, you'll want to attached the handheld object
|
|
* to the group returned by `getControllerGrip()` and the ray to the
|
|
* group returned by `getController()`. The idea is to have two
|
|
* different groups in two different coordinate spaces for the same WebXR
|
|
* controller.
|
|
*
|
|
* @param {number} index - The index of the controller.
|
|
* @return {Group} A group representing the `grip` space.
|
|
*/this.getControllerGrip=function(e){let t=T[e];if(t===void 0){t=new Qn;T[e]=t}return t.getGripSpace()};
|
|
/**
|
|
* Returns a group representing the `hand` space of the XR controller.
|
|
* Use this space for visualizing 3D objects that support the user in pointing
|
|
* tasks like UI interaction.
|
|
*
|
|
* @param {number} index - The index of the controller.
|
|
* @return {Group} A group representing the `hand` space.
|
|
*/this.getHand=function(e){let t=T[e];if(t===void 0){t=new Qn;T[e]=t}return t.getHandSpace()};function y(e){const t=x.indexOf(e.inputSource);if(t===-1)return;const n=T[t];if(n!==void 0){n.update(e.inputSource,e.frame,d||s);n.dispatchEvent({type:e.type,data:e.inputSource})}}function F(){i.removeEventListener("select",y);i.removeEventListener("selectstart",y);i.removeEventListener("selectend",y);i.removeEventListener("squeeze",y);i.removeEventListener("squeezestart",y);i.removeEventListener("squeezeend",y);i.removeEventListener("end",F);i.removeEventListener("inputsourceschange",O);for(let e=0;e<T.length;e++){const t=x[e];if(t!==null){x[e]=null;T[e].disconnect(t)}}I=null;N=null;g.reset();for(const e in v)delete v[e];e.setRenderTarget(S);m=null;p=null;u=null;i=null;M=null;Y.stop();a.isPresenting=false;e.setPixelRatio(A);e.setSize(R.width,R.height,false);a.dispatchEvent({type:"sessionend"})}
|
|
/**
|
|
* Sets the framebuffer scale factor.
|
|
*
|
|
* This method can not be used during a XR session.
|
|
*
|
|
* @param {number} value - The framebuffer scale factor.
|
|
*/this.setFramebufferScaleFactor=function(e){o=e;a.isPresenting===true&&w("WebXRManager: Cannot change framebuffer scale while presenting.")};
|
|
/**
|
|
* Sets the reference space type. Can be used to configure a spatial relationship with the user's physical
|
|
* environment. Depending on how the user moves in 3D space, setting an appropriate reference space can
|
|
* improve tracking. Default is `local-floor`. Valid values can be found here
|
|
* https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types.
|
|
*
|
|
* This method can not be used during a XR session.
|
|
*
|
|
* @param {string} value - The reference space type.
|
|
*/this.setReferenceSpaceType=function(e){l=e;a.isPresenting===true&&w("WebXRManager: Cannot change reference space type while presenting.")};this.getReferenceSpace=function(){return d||s};
|
|
/**
|
|
* Sets a custom XR reference space.
|
|
*
|
|
* @param {XRReferenceSpace} space - The XR reference space.
|
|
*/this.setReferenceSpace=function(e){d=e};this.getBaseLayer=function(){return p!==null?p:m};this.getBinding=function(){u===null&&_&&(u=new XRWebGLBinding(i,n));return u};this.getFrame=function(){return h};this.getSession=function(){return i};
|
|
/**
|
|
* After a XR session has been requested usually with one of the `*Button` modules, it
|
|
* is injected into the renderer with this method. This method triggers the start of
|
|
* the actual XR rendering.
|
|
*
|
|
* @async
|
|
* @param {XRSession} value - The XR session to set.
|
|
* @return {Promise} A Promise that resolves when the session has been set.
|
|
*/this.setSession=async function(t){i=t;if(i!==null){S=e.getRenderTarget();i.addEventListener("select",y);i.addEventListener("selectstart",y);i.addEventListener("selectend",y);i.addEventListener("squeeze",y);i.addEventListener("squeezestart",y);i.addEventListener("squeezeend",y);i.addEventListener("end",F);i.addEventListener("inputsourceschange",O);E.xrCompatible!==true&&await n.makeXRCompatible();A=e.getPixelRatio();e.getSize(R);const t=_&&"createProjectionLayer"in XRWebGLBinding.prototype;if(t){let t=null;let a=null;let r=null;if(E.depth){r=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24;t=E.stencil?jt:ke;a=E.stencil?Nt:Ye}const s={colorFormat:n.RGBA8,depthFormat:r,scaleFactor:o};u=this.getBinding();p=u.createProjectionLayer(s);i.updateRenderState({layers:[p]});e.setPixelRatio(1);e.setSize(p.textureWidth,p.textureHeight,false);M=new q(p.textureWidth,p.textureHeight,{format:b,type:L,depthTexture:new Me(p.textureWidth,p.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===false,resolveStencilBuffer:p.ignoreDepthValues===false})}else{const t={antialias:E.antialias,alpha:true,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(i,n,t);i.updateRenderState({baseLayer:m});e.setPixelRatio(1);e.setSize(m.framebufferWidth,m.framebufferHeight,false);M=new q(m.framebufferWidth,m.framebufferHeight,{format:b,type:L,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:m.ignoreDepthValues===false,resolveStencilBuffer:m.ignoreDepthValues===false})}M.isXRRenderTarget=true;this.setFoveation(c);d=null;s=await i.requestReferenceSpace(l);Y.setContext(i);Y.start();a.isPresenting=true;a.dispatchEvent({type:"sessionstart"})}};this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};this.getDepthTexture=function(){return g.getDepthTexture()};function O(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t];const a=x.indexOf(n);if(a>=0){x[a]=null;T[a].disconnect(n)}}for(let t=0;t<e.added.length;t++){const n=e.added[t];let a=x.indexOf(n);if(a===-1){for(let e=0;e<T.length;e++){if(e>=x.length){x.push(n);a=e;break}if(x[e]===null){x[e]=n;a=e;break}}if(a===-1)break}const i=T[a];i&&i.connect(n)}}const B=new r;const G=new r;
|
|
/**
|
|
* Assumes 2 cameras that are parallel and share an X-axis, and that
|
|
* the cameras' projection and world matrices have already been set.
|
|
* And that near and far planes are identical for both cameras.
|
|
* Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
|
|
*
|
|
* @param {ArrayCamera} camera - The camera to update.
|
|
* @param {PerspectiveCamera} cameraL - The left camera.
|
|
* @param {PerspectiveCamera} cameraR - The right camera.
|
|
*/function H(e,t,n){B.setFromMatrixPosition(t.matrixWorld);G.setFromMatrixPosition(n.matrixWorld);const a=B.distanceTo(G);const i=t.projectionMatrix.elements;const r=n.projectionMatrix.elements;const o=i[14]/(i[10]-1);const s=i[14]/(i[10]+1);const l=(i[9]+1)/i[5];const c=(i[9]-1)/i[5];const d=(i[8]-1)/i[0];const f=(r[8]+1)/r[0];const u=o*d;const p=o*f;const m=a/(-d+f);const h=m*-d;t.matrixWorld.decompose(e.position,e.quaternion,e.scale);e.translateX(h);e.translateZ(m);e.matrixWorld.compose(e.position,e.quaternion,e.scale);e.matrixWorldInverse.copy(e.matrixWorld).invert();if(i[10]===-1){e.projectionMatrix.copy(t.projectionMatrix);e.projectionMatrixInverse.copy(t.projectionMatrixInverse)}else{const t=o+m;const n=s+m;const i=u-h;const r=p+(a-h);const d=l*s/n*t;const f=c*s/n*t;e.projectionMatrix.makePerspective(i,r,d,f,t,n);e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function V(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix);e.matrixWorldInverse.copy(e.matrixWorld).invert()}
|
|
/**
|
|
* Updates the state of the XR camera. Use this method on app level if you
|
|
* set `cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
* camera of the scene as a parameter. The passed in camera's transformation
|
|
* is automatically adjusted to the position of the XR camera when calling
|
|
* this method.
|
|
*
|
|
* @param {Camera} camera - The camera.
|
|
*/this.updateCamera=function(e){if(i===null)return;let t=e.near;let n=e.far;if(g.texture!==null){g.depthNear>0&&(t=g.depthNear);g.depthFar>0&&(n=g.depthFar)}D.near=P.near=C.near=t;D.far=P.far=C.far=n;if(I!==D.near||N!==D.far){i.updateRenderState({depthNear:D.near,depthFar:D.far});I=D.near;N=D.far}D.layers.mask=e.layers.mask|6;C.layers.mask=D.layers.mask&-5;P.layers.mask=D.layers.mask&-3;const a=e.parent;const r=D.cameras;V(D,a);for(let e=0;e<r.length;e++)V(r[e],a);r.length===2?H(D,C,P):D.projectionMatrix.copy(C.projectionMatrix);W(e,D,a)};function W(e,t,n){if(n===null)e.matrix.copy(t.matrixWorld);else{e.matrix.copy(n.matrixWorld);e.matrix.invert();e.matrix.multiply(t.matrixWorld)}e.matrix.decompose(e.position,e.quaternion,e.scale);e.updateMatrixWorld(true);e.projectionMatrix.copy(t.projectionMatrix);e.projectionMatrixInverse.copy(t.projectionMatrixInverse);if(e.isPerspectiveCamera){e.fov=Jn*2*Math.atan(1/e.projectionMatrix.elements[5]);e.zoom=1}}this.getCamera=function(){return D};this.getFoveation=function(){if(p!==null||m!==null)return c};
|
|
/**
|
|
* Sets the foveation value.
|
|
*
|
|
* @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution)
|
|
* and `1` means maximum foveation (the edges render at lower resolution).
|
|
*/this.setFoveation=function(e){c=e;p!==null&&(p.fixedFoveation=e);m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=e)};this.hasDepthSensing=function(){return g.texture!==null};this.getDepthSensingMesh=function(){return g.getMesh(D)};
|
|
/**
|
|
* Retrieves an opaque texture from the view-aligned {@link XRCamera}.
|
|
* Only available during the current animation loop.
|
|
*
|
|
* @param {XRCamera} xrCamera - The camera to query.
|
|
* @return {?Texture} An opaque texture representing the current raw camera frame.
|
|
*/this.getCameraTexture=function(e){return v[e]};let z=null;function X(t,n){f=n.getViewerPose(d||s);h=n;if(f!==null){const t=f.views;if(m!==null){e.setRenderTargetFramebuffer(M,m.framebuffer);e.setRenderTarget(M)}let n=false;if(t.length!==D.cameras.length){D.cameras.length=0;n=true}for(let a=0;a<t.length;a++){const i=t[a];let r=null;if(m!==null)r=m.getViewport(i);else{const t=u.getViewSubImage(p,i);r=t.viewport;if(a===0){e.setRenderTargetTextures(M,t.colorTexture,t.depthStencilTexture);e.setRenderTarget(M)}}let o=U[a];if(o===void 0){o=new k;o.layers.enable(a);o.viewport=new le;U[a]=o}o.matrix.fromArray(i.transform.matrix);o.matrix.decompose(o.position,o.quaternion,o.scale);o.projectionMatrix.fromArray(i.projectionMatrix);o.projectionMatrixInverse.copy(o.projectionMatrix).invert();o.viewport.set(r.x,r.y,r.width,r.height);if(a===0){D.matrix.copy(o.matrix);D.matrix.decompose(D.position,D.quaternion,D.scale)}n===true&&D.cameras.push(o)}const r=i.enabledFeatures;const o=r&&r.includes("depth-sensing")&&i.depthUsage=="gpu-optimized";if(o&&_){u=a.getBinding();const e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&g.init(e,i.renderState)}const s=r&&r.includes("camera-access");if(s&&_){e.state.unbindTexture();u=a.getBinding();for(let e=0;e<t.length;e++){const n=t[e].camera;if(n){let e=v[n];if(!e){e=new jn;v[n]=e}const t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<T.length;e++){const t=x[e];const a=T[e];t!==null&&a!==void 0&&a.update(t,n,d||s)}z&&z(t,n);n.detectedPlanes&&a.dispatchEvent({type:"planesdetected",data:n});h=null}const Y=new la;Y.setAnimationLoop(X);this.setAnimationLoop=function(e){z=e};this.dispose=function(){}}}const rc=new l;const oc=new c;function sc(e,t){function n(e,t){e.matrixAutoUpdate===true&&e.updateMatrix();t.value.copy(e.matrix)}function a(t,n){n.color.getRGB(t.fogColor.value,x(e));if(n.isFog){t.fogNear.value=n.near;t.fogFar.value=n.far}else n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,a,i){if(t.isMeshBasicMaterial)r(e,t);else if(t.isMeshLambertMaterial){r(e,t);t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}else if(t.isMeshToonMaterial){r(e,t);f(e,t)}else if(t.isMeshPhongMaterial){r(e,t);d(e,t);t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}else if(t.isMeshStandardMaterial){r(e,t);u(e,t);t.isMeshPhysicalMaterial&&p(e,t,i)}else if(t.isMeshMatcapMaterial){r(e,t);m(e,t)}else if(t.isMeshDepthMaterial)r(e,t);else if(t.isMeshDistanceMaterial){r(e,t);_(e,t)}else if(t.isMeshNormalMaterial)r(e,t);else if(t.isLineBasicMaterial){o(e,t);t.isLineDashedMaterial&&s(e,t)}else if(t.isPointsMaterial)l(e,t,n,a);else if(t.isSpriteMaterial)c(e,t);else if(t.isShadowMaterial){e.color.value.copy(t.color);e.opacity.value=t.opacity}else t.isShaderMaterial&&(t.uniformsNeedUpdate=false)}function r(e,a){e.opacity.value=a.opacity;a.color&&e.diffuse.value.copy(a.color);a.emissive&&e.emissive.value.copy(a.emissive).multiplyScalar(a.emissiveIntensity);if(a.map){e.map.value=a.map;n(a.map,e.mapTransform)}if(a.alphaMap){e.alphaMap.value=a.alphaMap;n(a.alphaMap,e.alphaMapTransform)}if(a.bumpMap){e.bumpMap.value=a.bumpMap;n(a.bumpMap,e.bumpMapTransform);e.bumpScale.value=a.bumpScale;a.side===h&&(e.bumpScale.value*=-1)}if(a.normalMap){e.normalMap.value=a.normalMap;n(a.normalMap,e.normalMapTransform);e.normalScale.value.copy(a.normalScale);a.side===h&&e.normalScale.value.negate()}if(a.displacementMap){e.displacementMap.value=a.displacementMap;n(a.displacementMap,e.displacementMapTransform);e.displacementScale.value=a.displacementScale;e.displacementBias.value=a.displacementBias}if(a.emissiveMap){e.emissiveMap.value=a.emissiveMap;n(a.emissiveMap,e.emissiveMapTransform)}if(a.specularMap){e.specularMap.value=a.specularMap;n(a.specularMap,e.specularMapTransform)}a.alphaTest>0&&(e.alphaTest.value=a.alphaTest);const i=t.get(a);const r=i.envMap;const o=i.envMapRotation;if(r){e.envMap.value=r;rc.copy(o);rc.x*=-1;rc.y*=-1;rc.z*=-1;if(r.isCubeTexture&&r.isRenderTargetTexture===false){rc.y*=-1;rc.z*=-1}e.envMapRotation.value.setFromMatrix4(oc.makeRotationFromEuler(rc));e.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===false?-1:1;e.reflectivity.value=a.reflectivity;e.ior.value=a.ior;e.refractionRatio.value=a.refractionRatio}if(a.lightMap){e.lightMap.value=a.lightMap;e.lightMapIntensity.value=a.lightMapIntensity;n(a.lightMap,e.lightMapTransform)}if(a.aoMap){e.aoMap.value=a.aoMap;e.aoMapIntensity.value=a.aoMapIntensity;n(a.aoMap,e.aoMapTransform)}}function o(e,t){e.diffuse.value.copy(t.color);e.opacity.value=t.opacity;if(t.map){e.map.value=t.map;n(t.map,e.mapTransform)}}function s(e,t){e.dashSize.value=t.dashSize;e.totalSize.value=t.dashSize+t.gapSize;e.scale.value=t.scale}function l(e,t,a,i){e.diffuse.value.copy(t.color);e.opacity.value=t.opacity;e.size.value=t.size*a;e.scale.value=i*.5;if(t.map){e.map.value=t.map;n(t.map,e.uvTransform)}if(t.alphaMap){e.alphaMap.value=t.alphaMap;n(t.alphaMap,e.alphaMapTransform)}t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function c(e,t){e.diffuse.value.copy(t.color);e.opacity.value=t.opacity;e.rotation.value=t.rotation;if(t.map){e.map.value=t.map;n(t.map,e.mapTransform)}if(t.alphaMap){e.alphaMap.value=t.alphaMap;n(t.alphaMap,e.alphaMapTransform)}t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function d(e,t){e.specular.value.copy(t.specular);e.shininess.value=Math.max(t.shininess,1e-4)}function f(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function u(e,t){e.metalness.value=t.metalness;if(t.metalnessMap){e.metalnessMap.value=t.metalnessMap;n(t.metalnessMap,e.metalnessMapTransform)}e.roughness.value=t.roughness;if(t.roughnessMap){e.roughnessMap.value=t.roughnessMap;n(t.roughnessMap,e.roughnessMapTransform)}t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,a){e.ior.value=t.ior;if(t.sheen>0){e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen);e.sheenRoughness.value=t.sheenRoughness;if(t.sheenColorMap){e.sheenColorMap.value=t.sheenColorMap;n(t.sheenColorMap,e.sheenColorMapTransform)}if(t.sheenRoughnessMap){e.sheenRoughnessMap.value=t.sheenRoughnessMap;n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)}}if(t.clearcoat>0){e.clearcoat.value=t.clearcoat;e.clearcoatRoughness.value=t.clearcoatRoughness;if(t.clearcoatMap){e.clearcoatMap.value=t.clearcoatMap;n(t.clearcoatMap,e.clearcoatMapTransform)}if(t.clearcoatRoughnessMap){e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap;n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)}if(t.clearcoatNormalMap){e.clearcoatNormalMap.value=t.clearcoatNormalMap;n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform);e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale);t.side===h&&e.clearcoatNormalScale.value.negate()}}t.dispersion>0&&(e.dispersion.value=t.dispersion);if(t.iridescence>0){e.iridescence.value=t.iridescence;e.iridescenceIOR.value=t.iridescenceIOR;e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0];e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1];if(t.iridescenceMap){e.iridescenceMap.value=t.iridescenceMap;n(t.iridescenceMap,e.iridescenceMapTransform)}if(t.iridescenceThicknessMap){e.iridescenceThicknessMap.value=t.iridescenceThicknessMap;n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)}}if(t.transmission>0){e.transmission.value=t.transmission;e.transmissionSamplerMap.value=a.texture;e.transmissionSamplerSize.value.set(a.width,a.height);if(t.transmissionMap){e.transmissionMap.value=t.transmissionMap;n(t.transmissionMap,e.transmissionMapTransform)}e.thickness.value=t.thickness;if(t.thicknessMap){e.thicknessMap.value=t.thicknessMap;n(t.thicknessMap,e.thicknessMapTransform)}e.attenuationDistance.value=t.attenuationDistance;e.attenuationColor.value.copy(t.attenuationColor)}if(t.anisotropy>0){e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation));if(t.anisotropyMap){e.anisotropyMap.value=t.anisotropyMap;n(t.anisotropyMap,e.anisotropyMapTransform)}}e.specularIntensity.value=t.specularIntensity;e.specularColor.value.copy(t.specularColor);if(t.specularColorMap){e.specularColorMap.value=t.specularColorMap;n(t.specularColorMap,e.specularColorMapTransform)}if(t.specularIntensityMap){e.specularIntensityMap.value=t.specularIntensityMap;n(t.specularIntensityMap,e.specularIntensityMapTransform)}}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function _(e,n){const a=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(a.matrixWorld);e.nearDistance.value=a.shadow.camera.near;e.farDistance.value=a.shadow.camera.far}return{refreshFogUniforms:a,refreshMaterialUniforms:i}}function lc(e,t,n,a){let i={};let r={};let o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t){const n=t.program;a.uniformBlockBinding(e,n)}function c(e,n){let o=i[e.id];if(o===void 0){m(e);o=d(e);i[e.id]=o;e.addEventListener("dispose",_)}const s=n.program;a.updateUBOMapping(e,s);const l=t.render.frame;if(r[e.id]!==l){u(e);r[e.id]=l}}function d(t){const n=f();t.__bindingPointIndex=n;const a=e.createBuffer();const i=t.__size;const r=t.usage;e.bindBuffer(e.UNIFORM_BUFFER,a);e.bufferData(e.UNIFORM_BUFFER,i,r);e.bindBuffer(e.UNIFORM_BUFFER,null);e.bindBufferBase(e.UNIFORM_BUFFER,n,a);return a}function f(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1){o.push(e);return e}Y("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.");return 0}function u(t){const n=i[t.id];const a=t.uniforms;const r=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=a.length;t<n;t++){const n=Array.isArray(a[t])?a[t]:[a[t]];for(let a=0,i=n.length;a<i;a++){const i=n[a];if(p(i,t,a,r)===true){const t=i.__offset;const n=Array.isArray(i.value)?i.value:[i.value];let a=0;for(let r=0;r<n.length;r++){const o=n[r];const s=h(o);if(typeof o==="number"||typeof o==="boolean"){i.__data[0]=o;e.bufferSubData(e.UNIFORM_BUFFER,t+a,i.__data)}else if(o.isMatrix3){i.__data[0]=o.elements[0];i.__data[1]=o.elements[1];i.__data[2]=o.elements[2];i.__data[3]=0;i.__data[4]=o.elements[3];i.__data[5]=o.elements[4];i.__data[6]=o.elements[5];i.__data[7]=0;i.__data[8]=o.elements[6];i.__data[9]=o.elements[7];i.__data[10]=o.elements[8];i.__data[11]=0}else{o.toArray(i.__data,a);a+=s.storage/Float32Array.BYTES_PER_ELEMENT}}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(e,t,n,a){const i=e.value;const r=t+"_"+n;if(a[r]===void 0){a[r]=typeof i==="number"||typeof i==="boolean"?i:i.clone();return true}{const e=a[r];if(typeof i==="number"||typeof i==="boolean"){if(e!==i){a[r]=i;return true}}else if(e.equals(i)===false){e.copy(i);return true}}return false}function m(e){const t=e.uniforms;let n=0;const a=16;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e];const r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=r[e];const o=h(i);const s=n%a;const l=s%o.boundary;const c=s+l;n+=l;c!==0&&a-c<o.storage&&(n+=a-c);t.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT);t.__offset=n;n+=o.storage}}}const i=n%a;i>0&&(n+=a-i);e.__size=n;e.__cache={};return this}function h(e){const t={boundary:0,storage:0};if(typeof e==="number"||typeof e==="boolean"){t.boundary=4;t.storage=4}else if(e.isVector2){t.boundary=8;t.storage=8}else if(e.isVector3||e.isColor){t.boundary=16;t.storage=12}else if(e.isVector4){t.boundary=16;t.storage=16}else if(e.isMatrix3){t.boundary=48;t.storage=48}else if(e.isMatrix4){t.boundary=64;t.storage=64}else e.isTexture?w("WebGLRenderer: Texture samplers can not be part of an uniforms group."):w("WebGLRenderer: Unsupported uniform value type.",e);return t}function _(t){const n=t.target;n.removeEventListener("dispose",_);const a=o.indexOf(n.__bindingPointIndex);o.splice(a,1);e.deleteBuffer(i[n.id]);delete i[n.id];delete r[n.id]}function g(){for(const t in i)e.deleteBuffer(i[t]);o=[];i={};r={}}return{bind:l,update:c,dispose:g}}const cc=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let uc=null;function pc(){if(uc===null){uc=new ta(cc,16,16,Be,C);uc.name="DFG_LUT";uc.minFilter=V;uc.magFilter=V;uc.wrapS=Ot;uc.wrapT=Ot;uc.generateMipmaps=false;uc.needsUpdate=true}return uc}class WebGLRenderer{
|
|
/**
|
|
* Constructs a new WebGL renderer.
|
|
*
|
|
* @param {WebGLRenderer~Options} [parameters] - The configuration parameter.
|
|
*/
|
|
constructor(e={}){const{canvas:t=na(),context:a=null,depth:i=true,stencil:o=false,alpha:s=false,antialias:l=false,premultipliedAlpha:d=true,preserveDrawingBuffer:f=false,powerPreference:u="default",failIfMajorPerformanceCaveat:p=false,reversedDepthBuffer:m=false,outputBufferType:_=L}=e;
|
|
/**
|
|
* This flag can be used for type testing.
|
|
*
|
|
* @type {boolean}
|
|
* @readonly
|
|
* @default true
|
|
*/this.isWebGLRenderer=true;let g;if(a!==null){if(typeof WebGLRenderingContext!=="undefined"&&a instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=a.getContextAttributes().alpha}else g=s;const E=_;const S=new Set([un,cn,ln]);const M=new Set([L,Ye,yt,Nt,$t,Qt]);const x=new Uint32Array(4);const R=new Int32Array(4);let A=null;let b=null;const P=[];const U=[];let D=null;
|
|
/**
|
|
* A canvas where the renderer draws its output. This is automatically created by the renderer
|
|
* in the constructor (if not provided already); you just need to add it to your page like so:
|
|
* ```js
|
|
* document.body.appendChild( renderer.domElement );
|
|
* ```
|
|
*
|
|
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
*/this.domElement=t;
|
|
/**
|
|
* A object with debug configuration settings.
|
|
*
|
|
* - `checkShaderErrors`: If it is `true`, defines whether material shader programs are
|
|
* checked for errors during compilation and linkage process. It may be useful to disable
|
|
* this check in production for performance gain. It is strongly recommended to keep these
|
|
* checks enabled during development. If the shader does not compile and link, it will not
|
|
* work and associated material will not render.
|
|
* - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that
|
|
* can be used for custom error reporting. The callback receives the WebGL context, an instance
|
|
* of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader.
|
|
* Assigning a custom function disables the default error reporting.
|
|
*
|
|
* @type {Object}
|
|
*/this.debug={
|
|
/**
|
|
* Enables error checking and reporting when shader programs are being compiled.
|
|
* @type {boolean}
|
|
*/
|
|
checkShaderErrors:true,
|
|
/**
|
|
* Callback for custom error reporting.
|
|
* @type {?Function}
|
|
*/
|
|
onShaderError:null};
|
|
/**
|
|
* Whether the renderer should automatically clear its output before rendering a frame or not.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
*/this.autoClear=true;
|
|
/**
|
|
* If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
|
|
* the color buffer or not.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
*/this.autoClearColor=true;
|
|
/**
|
|
* If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
|
|
* the depth buffer or not.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
*/this.autoClearDepth=true;
|
|
/**
|
|
* If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
|
|
* the stencil buffer or not.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
*/this.autoClearStencil=true;
|
|
/**
|
|
* Whether the renderer should sort objects or not.
|
|
*
|
|
* Note: Sorting is used to attempt to properly render objects that have some
|
|
* degree of transparency. By definition, sorting objects may not work in all
|
|
* cases. Depending on the needs of application, it may be necessary to turn
|
|
* off sorting and use other methods to deal with transparency rendering e.g.
|
|
* manually determining each object's rendering order.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
*/this.sortObjects=true;
|
|
/**
|
|
* User-defined clipping planes specified in world space. These planes apply globally.
|
|
* Points in space whose dot product with the plane is negative are cut away.
|
|
*
|
|
* @type {Array<Plane>}
|
|
*/this.clippingPlanes=[];
|
|
/**
|
|
* Whether the renderer respects object-level clipping planes or not.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
*/this.localClippingEnabled=false;
|
|
/**
|
|
* The tone mapping technique of the renderer.
|
|
*
|
|
* @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)}
|
|
* @default NoToneMapping
|
|
*/this.toneMapping=z;
|
|
/**
|
|
* Exposure level of tone mapping.
|
|
*
|
|
* @type {number}
|
|
* @default 1
|
|
*/this.toneMappingExposure=1;
|
|
/**
|
|
* The normalized resolution scale for the transmission render target, measured in percentage
|
|
* of viewport dimensions. Lowering this value can result in significant performance improvements
|
|
* when using {@link MeshPhysicalMaterial#transmission}.
|
|
*
|
|
* @type {number}
|
|
* @default 1
|
|
*/this.transmissionResolutionScale=1;const I=this;let N=false;this._outputColorSpace=aa;let y=0;let F=0;let O=null;let B=-1;let H=null;const V=new le;const W=new le;let k=null;const X=new n(0);let K=0;let j=t.width;let Z=t.height;let $=1;let Q=null;let J=null;const ee=new le(0,0,j,Z);const ne=new le(0,0,j,Z);let ae=false;const ie=new Ge;let oe=false;let se=false;const ce=new c;const de=new r;const fe=new le;const ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:true};let pe=false;function me(){return O===null?$:1}let he=a;function _e(e,n){return t.getContext(e,n)}try{const e={alpha:true,depth:i,stencil:o,antialias:l,premultipliedAlpha:d,preserveDrawingBuffer:f,powerPreference:u,failIfMajorPerformanceCaveat:p};"setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ia}`);t.addEventListener("webglcontextlost",ze,false);t.addEventListener("webglcontextrestored",Xe,false);t.addEventListener("webglcontextcreationerror",Ke,false);if(he===null){const t="webgl2";he=_e(t,e);if(he===null)throw _e(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){Y("WebGLRenderer: "+e.message);throw e}let ge,ve,Ee,Se;let Me,Te,xe,Re,Ae,be;let Ce,Pe,Le,Ue,De,we;let Ne,ye,Fe,Oe;let Be,He,Ve;function We(){ge=new wo(he);ge.init();Be=new nc(he,ge);ve=new lo(he,ge,e,Be);Ee=new Jl(he,ge);ve.reversedDepthBuffer&&m&&Ee.buffers.depth.setReversed(true);Se=new yo(he);Me=new Il;Te=new tc(he,ge,Ee,Me,ve,Be,Se);xe=new Do(I);Re=new ca(he);He=new oo(he,Re);Ae=new Io(he,Re,Se,He);be=new Oo(he,Ae,Re,He,Se);ye=new Fo(he,ve,Te);De=new co(Me);Ce=new wl(I,xe,ge,ve,He,De);Pe=new sc(I,Me);Le=new Ol;Ue=new zl(ge);Ne=new ro(I,xe,Ee,be,g,d);we=new Ql(I,be,ve);Ve=new lc(he,Se,ve,Ee);Fe=new so(he,ge,Se);Oe=new No(he,ge,Se);Se.programs=Ce.programs;
|
|
/**
|
|
* Holds details about the capabilities of the current rendering context.
|
|
*
|
|
* @name WebGLRenderer#capabilities
|
|
* @type {WebGLRenderer~Capabilities}
|
|
*/I.capabilities=ve;
|
|
/**
|
|
* Provides methods for retrieving and testing WebGL extensions.
|
|
*
|
|
* - `get(extensionName:string)`: Used to check whether a WebGL extension is supported
|
|
* and return the extension object if available.
|
|
* - `has(extensionName:string)`: returns `true` if the extension is supported.
|
|
*
|
|
* @name WebGLRenderer#extensions
|
|
* @type {Object}
|
|
*/I.extensions=ge;
|
|
/**
|
|
* Used to track properties of other objects like native WebGL objects.
|
|
*
|
|
* @name WebGLRenderer#properties
|
|
* @type {Object}
|
|
*/I.properties=Me;
|
|
/**
|
|
* Manages the render lists of the renderer.
|
|
*
|
|
* @name WebGLRenderer#renderLists
|
|
* @type {Object}
|
|
*/I.renderLists=Le;
|
|
/**
|
|
* Interface for managing shadows.
|
|
*
|
|
* @name WebGLRenderer#shadowMap
|
|
* @type {WebGLRenderer~ShadowMap}
|
|
*/I.shadowMap=we;
|
|
/**
|
|
* Interface for managing the WebGL state.
|
|
*
|
|
* @name WebGLRenderer#state
|
|
* @type {Object}
|
|
*/I.state=Ee;
|
|
/**
|
|
* Holds a series of statistical information about the GPU memory
|
|
* and the rendering process. Useful for debugging and monitoring.
|
|
*
|
|
* By default these data are reset at each render call but when having
|
|
* multiple render passes per frame (e.g. when using post processing) it can
|
|
* be preferred to reset with a custom pattern. First, set `autoReset` to
|
|
* `false`.
|
|
* ```js
|
|
* renderer.info.autoReset = false;
|
|
* ```
|
|
* Call `reset()` whenever you have finished to render a single frame.
|
|
* ```js
|
|
* renderer.info.reset();
|
|
* ```
|
|
*
|
|
* @name WebGLRenderer#info
|
|
* @type {WebGLRenderer~Info}
|
|
*/I.info=Se}We();E!==L&&(D=new Go(E,t.width,t.height,i,o));const ke=new WebXRManager(I,he);
|
|
/**
|
|
* A reference to the XR manager.
|
|
*
|
|
* @type {WebXRManager}
|
|
*/this.xr=ke;this.getContext=function(){return he};this.getContextAttributes=function(){return he.getContextAttributes()};this.forceContextLoss=function(){const e=ge.get("WEBGL_lose_context");e&&e.loseContext()};this.forceContextRestore=function(){const e=ge.get("WEBGL_lose_context");e&&e.restoreContext()};this.getPixelRatio=function(){return $};
|
|
/**
|
|
* Sets the given pixel ratio and resizes the canvas if necessary.
|
|
*
|
|
* @param {number} value - The pixel ratio.
|
|
*/this.setPixelRatio=function(e){if(e!==void 0){$=e;this.setSize(j,Z,false)}};
|
|
/**
|
|
* Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.
|
|
*
|
|
* @param {Vector2} target - The method writes the result in this target object.
|
|
* @return {Vector2} The renderer's size in logical pixels.
|
|
*/this.getSize=function(e){return e.set(j,Z)};
|
|
/**
|
|
* Resizes the output canvas to (width, height) with device pixel ratio taken
|
|
* into account, and also sets the viewport to fit that size, starting in (0,
|
|
* 0). Setting `updateStyle` to false prevents any style changes to the output canvas.
|
|
*
|
|
* @param {number} width - The width in logical pixels.
|
|
* @param {number} height - The height in logical pixels.
|
|
* @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.
|
|
*/this.setSize=function(e,n,a=true){if(ke.isPresenting)w("WebGLRenderer: Can't change size while VR device is presenting.");else{j=e;Z=n;t.width=Math.floor(e*$);t.height=Math.floor(n*$);if(a===true){t.style.width=e+"px";t.style.height=n+"px"}D!==null&&D.setSize(t.width,t.height);this.setViewport(0,0,e,n)}};
|
|
/**
|
|
* Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.
|
|
*
|
|
* @param {Vector2} target - The method writes the result in this target object.
|
|
* @return {Vector2} The drawing buffer size.
|
|
*/this.getDrawingBufferSize=function(e){return e.set(j*$,Z*$).floor()};
|
|
/**
|
|
* This method allows to define the drawing buffer size by specifying
|
|
* width, height and pixel ratio all at once. The size of the drawing
|
|
* buffer is computed with this formula:
|
|
* ```js
|
|
* size.x = width * pixelRatio;
|
|
* size.y = height * pixelRatio;
|
|
* ```
|
|
*
|
|
* @param {number} width - The width in logical pixels.
|
|
* @param {number} height - The height in logical pixels.
|
|
* @param {number} pixelRatio - The pixel ratio.
|
|
*/this.setDrawingBufferSize=function(e,n,a){j=e;Z=n;$=a;t.width=Math.floor(e*a);t.height=Math.floor(n*a);this.setViewport(0,0,e,n)};
|
|
/**
|
|
* Sets the post-processing effects to be applied after rendering.
|
|
*
|
|
* @param {Array} effects - An array of post-processing effects.
|
|
*/this.setEffects=function(e){if(E!==L){if(e)for(let t=0;t<e.length;t++)if(e[t].isOutputPass===true){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}D.setEffects(e||[])}else console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.")};
|
|
/**
|
|
* Returns the current viewport definition.
|
|
*
|
|
* @param {Vector2} target - The method writes the result in this target object.
|
|
* @return {Vector2} The current viewport definition.
|
|
*/this.getCurrentViewport=function(e){return e.copy(V)};
|
|
/**
|
|
* Returns the viewport definition.
|
|
*
|
|
* @param {Vector4} target - The method writes the result in this target object.
|
|
* @return {Vector4} The viewport definition.
|
|
*/this.getViewport=function(e){return e.copy(ee)};
|
|
/**
|
|
* Sets the viewport to render from `(x, y)` to `(x + width, y + height)`.
|
|
*
|
|
* @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
|
|
* Or alternatively a four-component vector specifying all the parameters of the viewport.
|
|
* @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.
|
|
* @param {number} width - The width of the viewport in logical pixel unit.
|
|
* @param {number} height - The height of the viewport in logical pixel unit.
|
|
*/this.setViewport=function(e,t,n,a){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,a);Ee.viewport(V.copy(ee).multiplyScalar($).round())};
|
|
/**
|
|
* Returns the scissor region.
|
|
*
|
|
* @param {Vector4} target - The method writes the result in this target object.
|
|
* @return {Vector4} The scissor region.
|
|
*/this.getScissor=function(e){return e.copy(ne)};
|
|
/**
|
|
* Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`.
|
|
*
|
|
* @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit.
|
|
* Or alternatively a four-component vector specifying all the parameters of the scissor region.
|
|
* @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit.
|
|
* @param {number} width - The width of the scissor region in logical pixel unit.
|
|
* @param {number} height - The height of the scissor region in logical pixel unit.
|
|
*/this.setScissor=function(e,t,n,a){e.isVector4?ne.set(e.x,e.y,e.z,e.w):ne.set(e,t,n,a);Ee.scissor(W.copy(ne).multiplyScalar($).round())};this.getScissorTest=function(){return ae};
|
|
/**
|
|
* Enable or disable the scissor test. When this is enabled, only the pixels
|
|
* within the defined scissor area will be affected by further renderer
|
|
* actions.
|
|
*
|
|
* @param {boolean} boolean - Whether the scissor test is enabled or not.
|
|
*/this.setScissorTest=function(e){Ee.setScissorTest(ae=e)};
|
|
/**
|
|
* Sets a custom opaque sort function for the render lists. Pass `null`
|
|
* to use the default `painterSortStable` function.
|
|
*
|
|
* @param {?Function} method - The opaque sort function.
|
|
*/this.setOpaqueSort=function(e){Q=e};
|
|
/**
|
|
* Sets a custom transparent sort function for the render lists. Pass `null`
|
|
* to use the default `reversePainterSortStable` function.
|
|
*
|
|
* @param {?Function} method - The opaque sort function.
|
|
*/this.setTransparentSort=function(e){J=e};
|
|
/**
|
|
* Returns the clear color.
|
|
*
|
|
* @param {Color} target - The method writes the result in this target object.
|
|
* @return {Color} The clear color.
|
|
*/this.getClearColor=function(e){return e.copy(Ne.getClearColor())};
|
|
/**
|
|
* Sets the clear color and alpha.
|
|
*
|
|
* @param {Color} color - The clear color.
|
|
* @param {number} [alpha=1] - The clear alpha.
|
|
*/this.setClearColor=function(){Ne.setClearColor(...arguments)};this.getClearAlpha=function(){return Ne.getClearAlpha()};
|
|
/**
|
|
* Sets the clear alpha.
|
|
*
|
|
* @param {number} alpha - The clear alpha.
|
|
*/this.setClearAlpha=function(){Ne.setClearAlpha(...arguments)};
|
|
/**
|
|
* Tells the renderer to clear its color, depth or stencil drawing buffer(s).
|
|
* This method initializes the buffers to the current clear color values.
|
|
*
|
|
* @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
* @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
* @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
*/this.clear=function(e=true,t=true,n=true){let a=0;if(e){let e=false;if(O!==null){const t=O.texture.format;e=S.has(t)}if(e){const e=O.texture.type;const t=M.has(e);const n=Ne.getClearColor();const a=Ne.getClearAlpha();const i=n.r;const r=n.g;const o=n.b;if(t){x[0]=i;x[1]=r;x[2]=o;x[3]=a;he.clearBufferuiv(he.COLOR,0,x)}else{R[0]=i;R[1]=r;R[2]=o;R[3]=a;he.clearBufferiv(he.COLOR,0,R)}}else a|=he.COLOR_BUFFER_BIT}t&&(a|=he.DEPTH_BUFFER_BIT);if(n){a|=he.STENCIL_BUFFER_BIT;this.state.buffers.stencil.setMask(4294967295)}a!==0&&he.clear(a)};this.clearColor=function(){this.clear(true,false,false)};this.clearDepth=function(){this.clear(false,true,false)};this.clearStencil=function(){this.clear(false,false,true)};this.dispose=function(){t.removeEventListener("webglcontextlost",ze,false);t.removeEventListener("webglcontextrestored",Xe,false);t.removeEventListener("webglcontextcreationerror",Ke,false);Ne.dispose();Le.dispose();Ue.dispose();Me.dispose();xe.dispose();be.dispose();He.dispose();Ve.dispose();Ce.dispose();ke.dispose();ke.removeEventListener("sessionstart",et);ke.removeEventListener("sessionend",tt);nt.stop()};function ze(e){e.preventDefault();ra("WebGLRenderer: Context Lost.");N=true}function Xe(){ra("WebGLRenderer: Context Restored.");N=false;const e=Se.autoReset;const t=we.enabled;const n=we.autoUpdate;const a=we.needsUpdate;const i=we.type;We();Se.autoReset=e;we.enabled=t;we.autoUpdate=n;we.needsUpdate=a;we.type=i}function Ke(e){Y("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function qe(e){const t=e.target;t.removeEventListener("dispose",qe);je(t)}function je(e){Ze(e);Me.remove(e)}function Ze(e){const t=Me.get(e).programs;if(t!==void 0){t.forEach((function(e){Ce.releaseProgram(e)}));e.isShaderMaterial&&Ce.releaseShaderCache(e)}}this.renderBufferDirect=function(e,t,n,a,i,r){t===null&&(t=ue);const o=i.isMesh&&i.matrixWorld.determinant()<0;const s=ft(e,t,n,a,i);Ee.setMaterial(a,o);let l=n.index;let c=1;if(a.wireframe===true){l=Ae.getWireframeAttribute(n);if(l===void 0)return;c=2}const d=n.drawRange;const f=n.attributes.position;let u=d.start*c;let p=(d.start+d.count)*c;if(r!==null){u=Math.max(u,r.start*c);p=Math.min(p,(r.start+r.count)*c)}if(l!==null){u=Math.max(u,0);p=Math.min(p,l.count)}else if(f!==void 0&&f!==null){u=Math.max(u,0);p=Math.min(p,f.count)}const m=p-u;if(m<0||m===Infinity)return;He.setup(i,a,s,n,l);let h;let _=Fe;if(l!==null){h=Re.get(l);_=Oe;_.setIndex(h)}if(i.isMesh)if(a.wireframe===true){Ee.setLineWidth(a.wireframeLinewidth*me());_.setMode(he.LINES)}else _.setMode(he.TRIANGLES);else if(i.isLine){let e=a.linewidth;e===void 0&&(e=1);Ee.setLineWidth(e*me());i.isLineSegments?_.setMode(he.LINES):i.isLineLoop?_.setMode(he.LINE_LOOP):_.setMode(he.LINE_STRIP)}else i.isPoints?_.setMode(he.POINTS):i.isSprite&&_.setMode(he.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null){re("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");_.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances)}else if(ge.get("WEBGL_multi_draw"))_.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{const e=i._multiDrawStarts;const t=i._multiDrawCounts;const n=i._multiDrawCount;const r=l?Re.get(l).bytesPerElement:1;const o=Me.get(a).currentProgram.getUniforms();for(let a=0;a<n;a++){o.setValue(he,"_gl_DrawID",a);_.render(e[a]/r,t[a])}}else if(i.isInstancedMesh)_.renderInstances(u,m,i.count);else if(n.isInstancedBufferGeometry){const e=n._maxInstanceCount!==void 0?n._maxInstanceCount:Infinity;const t=Math.min(n.instanceCount,e);_.renderInstances(u,m,t)}else _.render(u,m)};function $e(e,t,n){if(e.transparent===true&&e.side===Ie&&e.forceSinglePass===false){e.side=h;e.needsUpdate=true;lt(e,t,n);e.side=T;e.needsUpdate=true;lt(e,t,n);e.side=Ie}else lt(e,t,n)}
|
|
/**
|
|
* Compiles all materials in the scene with the camera. This is useful to precompile shaders
|
|
* before the first rendering. If you want to add a 3D object to an existing scene, use the third
|
|
* optional parameter for applying the target scene.
|
|
*
|
|
* Note that the (target) scene's lighting and environment must be configured before calling this method.
|
|
*
|
|
* @param {Object3D} scene - The scene or another type of 3D object to precompile.
|
|
* @param {Camera} camera - The camera.
|
|
* @param {?Scene} [targetScene=null] - The target scene.
|
|
* @return {Set<Material>} The precompiled materials.
|
|
*/this.compile=function(e,t,n=null){n===null&&(n=e);b=Ue.get(n);b.init(t);U.push(b);n.traverseVisible((function(e){if(e.isLight&&e.layers.test(t.layers)){b.pushLight(e);e.castShadow&&b.pushShadow(e)}}));e!==n&&e.traverseVisible((function(e){if(e.isLight&&e.layers.test(t.layers)){b.pushLight(e);e.castShadow&&b.pushShadow(e)}}));b.setupLights();const a=new Set;e.traverse((function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){const r=t[i];$e(r,n,e);a.add(r)}else{$e(t,n,e);a.add(t)}}));b=U.pop();return a};
|
|
/**
|
|
* Asynchronous version of {@link WebGLRenderer#compile}.
|
|
*
|
|
* This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence,
|
|
* it is recommended to use this version of `compile()` whenever possible.
|
|
*
|
|
* @async
|
|
* @param {Object3D} scene - The scene or another type of 3D object to precompile.
|
|
* @param {Camera} camera - The camera.
|
|
* @param {?Scene} [targetScene=null] - The target scene.
|
|
* @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation.
|
|
*/this.compileAsync=function(e,t,n=null){const a=this.compile(e,t,n);return new Promise((t=>{function n(){a.forEach((function(e){const t=Me.get(e);const n=t.currentProgram;n.isReady()&&a.delete(e)}));a.size!==0?setTimeout(n,10):t(e)}ge.get("KHR_parallel_shader_compile")!==null?n():setTimeout(n,10)}))};let Qe=null;function Je(e){Qe&&Qe(e)}function et(){nt.stop()}function tt(){nt.start()}const nt=new la;nt.setAnimationLoop(Je);typeof self!=="undefined"&&nt.setContext(self)
|
|
/**
|
|
* Applications are advised to always define the animation loop
|
|
* with this method and not manually with `requestAnimationFrame()`
|
|
* for best compatibility.
|
|
*
|
|
* @param {?onAnimationCallback} callback - The application's animation loop.
|
|
*/;this.setAnimationLoop=function(e){Qe=e;ke.setAnimationLoop(e);e===null?nt.stop():nt.start()};ke.addEventListener("sessionstart",et);ke.addEventListener("sessionend",tt);
|
|
/**
|
|
* Renders the given scene (or other type of 3D object) using the given camera.
|
|
*
|
|
* The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget}
|
|
* or to the canvas as usual.
|
|
*
|
|
* By default render buffers are cleared before rendering but you can prevent
|
|
* this by setting the property `autoClear` to `false`. If you want to prevent
|
|
* only certain buffers being cleared you can `autoClearColor`, `autoClearDepth`
|
|
* or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}.
|
|
*
|
|
* @param {Object3D} scene - The scene to render.
|
|
* @param {Camera} camera - The camera.
|
|
*/this.render=function(e,t){if(t!==void 0&&t.isCamera!==true){Y("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===true)return;const n=ke.enabled===true&&ke.isPresenting===true;const a=D!==null&&(O===null||n)&&D.begin(I,O);e.matrixWorldAutoUpdate===true&&e.updateMatrixWorld();t.parent===null&&t.matrixWorldAutoUpdate===true&&t.updateMatrixWorld();if(ke.enabled===true&&ke.isPresenting===true&&(D===null||D.isCompositing()===false)){ke.cameraAutoUpdate===true&&ke.updateCamera(t);t=ke.getCamera()}e.isScene===true&&e.onBeforeRender(I,e,t,O);b=Ue.get(e,U.length);b.init(t);U.push(b);ce.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);ie.setFromProjectionMatrix(ce,oa,t.reversedDepth);se=this.localClippingEnabled;oe=De.init(this.clippingPlanes,se);A=Le.get(e,P.length);A.init();P.push(A);if(ke.enabled===true&&ke.isPresenting===true){const e=I.xr.getDepthSensingMesh();e!==null&&at(e,t,-Infinity,I.sortObjects)}at(e,t,0,I.sortObjects);A.finish();I.sortObjects===true&&A.sort(Q,J);pe=ke.enabled===false||ke.isPresenting===false||ke.hasDepthSensing()===false;pe&&Ne.addToRenderList(A,e);this.info.render.frame++;oe===true&&De.beginShadows();const i=b.state.shadowsArray;we.render(i,e,t);oe===true&&De.endShadows();this.info.autoReset===true&&this.info.reset();const r=a&&D.hasRenderPass();if(r===false){const n=A.opaque;const a=A.transmissive;b.setupLights();if(t.isArrayCamera){const i=t.cameras;if(a.length>0)for(let t=0,r=i.length;t<r;t++){const r=i[t];rt(n,a,e,r)}pe&&Ne.render(e);for(let t=0,n=i.length;t<n;t++){const n=i[t];it(A,e,n,n.viewport)}}else{a.length>0&&rt(n,a,e,t);pe&&Ne.render(e);it(A,e,t)}}if(O!==null&&F===0){Te.updateMultisampleRenderTarget(O);Te.updateRenderTargetMipmap(O)}a&&D.end(I);e.isScene===true&&e.onAfterRender(I,e,t);He.resetDefaultState();B=-1;H=null;U.pop();if(U.length>0){b=U[U.length-1];oe===true&&De.setGlobalState(I.clippingPlanes,b.state.camera)}else b=null;P.pop();A=P.length>0?P[P.length-1]:null};function at(e,t,n,a){if(e.visible===false)return;const i=e.layers.test(t.layers);if(i)if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===true&&e.update(t);else if(e.isLight){b.pushLight(e);e.castShadow&&b.pushShadow(e)}else if(e.isSprite){if(!e.frustumCulled||ie.intersectsSprite(e)){a&&fe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ce);const t=be.update(e);const i=e.material;i.visible&&A.push(e,t,i,n,fe.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ie.intersectsObject(e))){const t=be.update(e);const i=e.material;if(a){if(e.boundingSphere!==void 0){e.boundingSphere===null&&e.computeBoundingSphere();fe.copy(e.boundingSphere.center)}else{t.boundingSphere===null&&t.computeBoundingSphere();fe.copy(t.boundingSphere.center)}fe.applyMatrix4(e.matrixWorld).applyMatrix4(ce)}if(Array.isArray(i)){const a=t.groups;for(let r=0,o=a.length;r<o;r++){const o=a[r];const s=i[o.materialIndex];s&&s.visible&&A.push(e,t,s,n,fe.z,o)}}else i.visible&&A.push(e,t,i,n,fe.z,null)}const r=e.children;for(let e=0,i=r.length;e<i;e++)at(r[e],t,n,a)}function it(e,t,n,a){const{opaque:i,transmissive:r,transparent:o}=e;b.setupLightsView(n);oe===true&&De.setGlobalState(I.clippingPlanes,n);a&&Ee.viewport(V.copy(a));i.length>0&&ot(i,t,n);r.length>0&&ot(r,t,n);o.length>0&&ot(o,t,n);Ee.buffers.depth.setTest(true);Ee.buffers.depth.setMask(true);Ee.buffers.color.setMask(true);Ee.setPolygonOffset(false)}function rt(e,t,n,a){const i=n.isScene===true?n.overrideMaterial:null;if(i!==null)return;if(b.state.transmissionRenderTarget[a.id]===void 0){const e=ge.has("EXT_color_buffer_half_float")||ge.has("EXT_color_buffer_float");b.state.transmissionRenderTarget[a.id]=new q(1,1,{generateMipmaps:true,type:e?C:L,minFilter:te,samples:Math.max(4,ve.samples),stencilBuffer:o,resolveDepthBuffer:false,resolveStencilBuffer:false,colorSpace:v.workingColorSpace})}const r=b.state.transmissionRenderTarget[a.id];const s=a.viewport||V;r.setSize(s.z*I.transmissionResolutionScale,s.w*I.transmissionResolutionScale);const l=I.getRenderTarget();const c=I.getActiveCubeFace();const d=I.getActiveMipmapLevel();I.setRenderTarget(r);I.getClearColor(X);K=I.getClearAlpha();K<1&&I.setClearColor(16777215,.5);I.clear();pe&&Ne.render(n);const f=I.toneMapping;I.toneMapping=z;const u=a.viewport;a.viewport!==void 0&&(a.viewport=void 0);b.setupLightsView(a);oe===true&&De.setGlobalState(I.clippingPlanes,a);ot(e,n,a);Te.updateMultisampleRenderTarget(r);Te.updateRenderTargetMipmap(r);if(ge.has("WEBGL_multisampled_render_to_texture")===false){let e=false;for(let i=0,r=t.length;i<r;i++){const r=t[i];const{object:o,geometry:s,material:l,group:c}=r;if(l.side===Ie&&o.layers.test(a.layers)){const t=l.side;l.side=h;l.needsUpdate=true;st(o,n,a,s,l,c);l.side=t;l.needsUpdate=true;e=true}}if(e===true){Te.updateMultisampleRenderTarget(r);Te.updateRenderTargetMipmap(r)}}I.setRenderTarget(l,c,d);I.setClearColor(X,K);u!==void 0&&(a.viewport=u);I.toneMapping=f}function ot(e,t,n){const a=t.isScene===true?t.overrideMaterial:null;for(let i=0,r=e.length;i<r;i++){const r=e[i];const{object:o,geometry:s,group:l}=r;let c=r.material;c.allowOverride===true&&a!==null&&(c=a);o.layers.test(n.layers)&&st(o,t,n,s,c,l)}}function st(e,t,n,a,i,r){e.onBeforeRender(I,t,n,a,i,r);e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld);e.normalMatrix.getNormalMatrix(e.modelViewMatrix);i.onBeforeRender(I,t,n,a,e,r);if(i.transparent===true&&i.side===Ie&&i.forceSinglePass===false){i.side=h;i.needsUpdate=true;I.renderBufferDirect(n,t,a,i,e,r);i.side=T;i.needsUpdate=true;I.renderBufferDirect(n,t,a,i,e,r);i.side=Ie}else I.renderBufferDirect(n,t,a,i,e,r);e.onAfterRender(I,t,n,a,i,r)}function lt(e,t,n){t.isScene!==true&&(t=ue);const a=Me.get(e);const i=b.state.lights;const r=b.state.shadowsArray;const o=i.state.version;const s=Ce.getParameters(e,i.state,r,t,n);const l=Ce.getProgramCacheKey(s);let c=a.programs;a.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null;a.fog=t.fog;const d=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;a.envMap=xe.get(e.envMap||a.environment,d);a.envMapRotation=a.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation;if(c===void 0){e.addEventListener("dispose",qe);c=new Map;a.programs=c}let f=c.get(l);if(f!==void 0){if(a.currentProgram===f&&a.lightsStateVersion===o){dt(e,s);return f}}else{s.uniforms=Ce.getUniforms(e);e.onBeforeCompile(s,I);f=Ce.acquireProgram(s,l);c.set(l,f);a.uniforms=s.uniforms}const u=a.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&e.clipping!==true||(u.clippingPlanes=De.uniform);dt(e,s);a.needsLights=pt(e);a.lightsStateVersion=o;if(a.needsLights){u.ambientLightColor.value=i.state.ambient;u.lightProbe.value=i.state.probe;u.directionalLights.value=i.state.directional;u.directionalLightShadows.value=i.state.directionalShadow;u.spotLights.value=i.state.spot;u.spotLightShadows.value=i.state.spotShadow;u.rectAreaLights.value=i.state.rectArea;u.ltc_1.value=i.state.rectAreaLTC1;u.ltc_2.value=i.state.rectAreaLTC2;u.pointLights.value=i.state.point;u.pointLightShadows.value=i.state.pointShadow;u.hemisphereLights.value=i.state.hemi;u.directionalShadowMatrix.value=i.state.directionalShadowMatrix;u.spotLightMatrix.value=i.state.spotLightMatrix;u.spotLightMap.value=i.state.spotLightMap;u.pointShadowMatrix.value=i.state.pointShadowMatrix}a.currentProgram=f;a.uniformsList=null;return f}function ct(e){if(e.uniformsList===null){const t=e.currentProgram.getUniforms();e.uniformsList=WebGLUniforms.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function dt(e,t){const n=Me.get(e);n.outputColorSpace=t.outputColorSpace;n.batching=t.batching;n.batchingColor=t.batchingColor;n.instancing=t.instancing;n.instancingColor=t.instancingColor;n.instancingMorph=t.instancingMorph;n.skinning=t.skinning;n.morphTargets=t.morphTargets;n.morphNormals=t.morphNormals;n.morphColors=t.morphColors;n.morphTargetsCount=t.morphTargetsCount;n.numClippingPlanes=t.numClippingPlanes;n.numIntersection=t.numClipIntersection;n.vertexAlphas=t.vertexAlphas;n.vertexTangents=t.vertexTangents;n.toneMapping=t.toneMapping}function ft(e,t,n,a,i){t.isScene!==true&&(t=ue);Te.resetTextureUnits();const r=t.fog;const o=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?t.environment:null;const s=O===null?I.outputColorSpace:O.isXRRenderTarget===true?O.texture.colorSpace:G;const l=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap;const c=xe.get(a.envMap||o,l);const d=a.vertexColors===true&&!!n.attributes.color&&n.attributes.color.itemSize===4;const f=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0);const u=!!n.morphAttributes.position;const p=!!n.morphAttributes.normal;const m=!!n.morphAttributes.color;let h=z;a.toneMapped&&(O!==null&&O.isXRRenderTarget!==true||(h=I.toneMapping));const _=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color;const g=_!==void 0?_.length:0;const v=Me.get(a);const E=b.state.lights;if(oe===true&&(se===true||e!==H)){const t=e===H&&a.id===B;De.setState(a,e,t)}let S=false;if(a.version===v.__version)v.needsLights&&v.lightsStateVersion!==E.state.version||v.outputColorSpace!==s||i.isBatchedMesh&&v.batching===false?S=true:i.isBatchedMesh||v.batching!==true?i.isBatchedMesh&&v.batchingColor===true&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===false&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===false?S=true:i.isInstancedMesh||v.instancing!==true?i.isSkinnedMesh&&v.skinning===false?S=true:i.isSkinnedMesh||v.skinning!==true?i.isInstancedMesh&&v.instancingColor===true&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===false&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===true&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===false&&i.morphTexture!==null||v.envMap!==c||a.fog===true&&v.fog!==r?S=true:v.numClippingPlanes===void 0||v.numClippingPlanes===De.numPlanes&&v.numIntersection===De.numIntersection?(v.vertexAlphas!==d||v.vertexTangents!==f||v.morphTargets!==u||v.morphNormals!==p||v.morphColors!==m||v.toneMapping!==h||v.morphTargetsCount!==g)&&(S=true):S=true:S=true:S=true:S=true;else{S=true;v.__version=a.version}let M=v.currentProgram;S===true&&(M=lt(a,t,i));let T=false;let x=false;let R=false;const A=M.getUniforms(),C=v.uniforms;if(Ee.useProgram(M.program)){T=true;x=true;R=true}if(a.id!==B){B=a.id;x=true}if(T||H!==e){const t=Ee.buffers.depth.getReversed();if(t&&e.reversedDepth!==true){e._reversedDepth=true;e.updateProjectionMatrix()}A.setValue(he,"projectionMatrix",e.projectionMatrix);A.setValue(he,"viewMatrix",e.matrixWorldInverse);const n=A.map.cameraPosition;n!==void 0&&n.setValue(he,de.setFromMatrixPosition(e.matrixWorld));ve.logarithmicDepthBuffer&&A.setValue(he,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2));(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&A.setValue(he,"isOrthographic",e.isOrthographicCamera===true);if(H!==e){H=e;x=true;R=true}}if(v.needsLights){E.state.directionalShadowMap.length>0&&A.setValue(he,"directionalShadowMap",E.state.directionalShadowMap,Te);E.state.spotShadowMap.length>0&&A.setValue(he,"spotShadowMap",E.state.spotShadowMap,Te);E.state.pointShadowMap.length>0&&A.setValue(he,"pointShadowMap",E.state.pointShadowMap,Te)}if(i.isSkinnedMesh){A.setOptional(he,i,"bindMatrix");A.setOptional(he,i,"bindMatrixInverse");const e=i.skeleton;if(e){e.boneTexture===null&&e.computeBoneTexture();A.setValue(he,"boneTexture",e.boneTexture,Te)}}if(i.isBatchedMesh){A.setOptional(he,i,"batchingTexture");A.setValue(he,"batchingTexture",i._matricesTexture,Te);A.setOptional(he,i,"batchingIdTexture");A.setValue(he,"batchingIdTexture",i._indirectTexture,Te);A.setOptional(he,i,"batchingColorTexture");i._colorsTexture!==null&&A.setValue(he,"batchingColorTexture",i._colorsTexture,Te)}const P=n.morphAttributes;P.position===void 0&&P.normal===void 0&&P.color===void 0||ye.update(i,n,M);if(x||v.receiveShadow!==i.receiveShadow){v.receiveShadow=i.receiveShadow;A.setValue(he,"receiveShadow",i.receiveShadow)}(a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial)&&a.envMap===null&&t.environment!==null&&(C.envMapIntensity.value=t.environmentIntensity);C.dfgLUT!==void 0&&(C.dfgLUT.value=pc());if(x){A.setValue(he,"toneMappingExposure",I.toneMappingExposure);v.needsLights&&ut(C,R);r&&a.fog===true&&Pe.refreshFogUniforms(C,r);Pe.refreshMaterialUniforms(C,a,$,Z,b.state.transmissionRenderTarget[e.id]);WebGLUniforms.upload(he,ct(v),C,Te)}if(a.isShaderMaterial&&a.uniformsNeedUpdate===true){WebGLUniforms.upload(he,ct(v),C,Te);a.uniformsNeedUpdate=false}a.isSpriteMaterial&&A.setValue(he,"center",i.center);A.setValue(he,"modelViewMatrix",i.modelViewMatrix);A.setValue(he,"normalMatrix",i.normalMatrix);A.setValue(he,"modelMatrix",i.matrixWorld);if(a.isShaderMaterial||a.isRawShaderMaterial){const e=a.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];Ve.update(n,M);Ve.bind(n,M)}}return M}function ut(e,t){e.ambientLightColor.needsUpdate=t;e.lightProbe.needsUpdate=t;e.directionalLights.needsUpdate=t;e.directionalLightShadows.needsUpdate=t;e.pointLights.needsUpdate=t;e.pointLightShadows.needsUpdate=t;e.spotLights.needsUpdate=t;e.spotLightShadows.needsUpdate=t;e.rectAreaLights.needsUpdate=t;e.hemisphereLights.needsUpdate=t}function pt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===true}this.getActiveCubeFace=function(){return y};this.getActiveMipmapLevel=function(){return F};this.getRenderTarget=function(){return O};this.setRenderTargetTextures=function(e,t,n){const a=Me.get(e);a.__autoAllocateDepthBuffer=e.resolveDepthBuffer===false;a.__autoAllocateDepthBuffer===false&&(a.__useRenderToTexture=false);Me.get(e.texture).__webglTexture=t;Me.get(e.depthTexture).__webglTexture=a.__autoAllocateDepthBuffer?void 0:n;a.__hasExternalTextures=true};this.setRenderTargetFramebuffer=function(e,t){const n=Me.get(e);n.__webglFramebuffer=t;n.__useDefaultFramebuffer=t===void 0};const mt=he.createFramebuffer();
|
|
/**
|
|
* Sets the active rendertarget.
|
|
*
|
|
* @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given,
|
|
* the canvas is set as the active render target instead.
|
|
* @param {number} [activeCubeFace=0] - The active cube face when using a cube render target.
|
|
* Indicates the z layer to render in to when using 3D or array render targets.
|
|
* @param {number} [activeMipmapLevel=0] - The active mipmap level.
|
|
*/this.setRenderTarget=function(e,t=0,n=0){O=e;y=t;F=n;let a=null;let i=false;let r=false;if(e){const o=Me.get(e);if(o.__useDefaultFramebuffer!==void 0){Ee.bindFramebuffer(he.FRAMEBUFFER,o.__webglFramebuffer);V.copy(e.viewport);W.copy(e.scissor);k=e.scissorTest;Ee.viewport(V);Ee.scissor(W);Ee.setScissorTest(k);B=-1;return}if(o.__webglFramebuffer===void 0)Te.setupRenderTarget(e);else if(o.__hasExternalTextures)Te.rebindTextures(e,Me.get(e.texture).__webglTexture,Me.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&Me.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Te.setupDepthRenderbuffer(e)}}const s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(r=true);const l=Me.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget){a=Array.isArray(l[t])?l[t][n]:l[t];i=true}else a=e.samples>0&&Te.useMultisampledRTT(e)===false?Me.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l;V.copy(e.viewport);W.copy(e.scissor);k=e.scissorTest}else{V.copy(ee).multiplyScalar($).floor();W.copy(ne).multiplyScalar($).floor();k=ae}n!==0&&(a=mt);const o=Ee.bindFramebuffer(he.FRAMEBUFFER,a);o&&Ee.drawBuffers(e,a);Ee.viewport(V);Ee.scissor(W);Ee.setScissorTest(k);if(i){const a=Me.get(e.texture);he.framebufferTexture2D(he.FRAMEBUFFER,he.COLOR_ATTACHMENT0,he.TEXTURE_CUBE_MAP_POSITIVE_X+t,a.__webglTexture,n)}else if(r){const a=t;for(let t=0;t<e.textures.length;t++){const i=Me.get(e.textures[t]);he.framebufferTextureLayer(he.FRAMEBUFFER,he.COLOR_ATTACHMENT0+t,i.__webglTexture,n,a)}}else if(e!==null&&n!==0){const t=Me.get(e.texture);he.framebufferTexture2D(he.FRAMEBUFFER,he.COLOR_ATTACHMENT0,he.TEXTURE_2D,t.__webglTexture,n)}B=-1};
|
|
/**
|
|
* Reads the pixel data from the given render target into the given buffer.
|
|
*
|
|
* @param {WebGLRenderTarget} renderTarget - The render target to read from.
|
|
* @param {number} x - The `x` coordinate of the copy region's origin.
|
|
* @param {number} y - The `y` coordinate of the copy region's origin.
|
|
* @param {number} width - The width of the copy region.
|
|
* @param {number} height - The height of the copy region.
|
|
* @param {TypedArray} buffer - The result buffer.
|
|
* @param {number} [activeCubeFaceIndex] - The active cube face index.
|
|
* @param {number} [textureIndex=0] - The texture index of an MRT render target.
|
|
*/this.readRenderTargetPixels=function(e,t,n,a,i,r,o,s=0){if(!(e&&e.isWebGLRenderTarget)){Y("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let l=Me.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget&&o!==void 0&&(l=l[o]);if(l){Ee.bindFramebuffer(he.FRAMEBUFFER,l);try{const o=e.textures[s];const l=o.format;const c=o.type;e.textures.length>1&&he.readBuffer(he.COLOR_ATTACHMENT0+s);if(!ve.textureFormatReadable(l)){Y("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ve.textureTypeReadable(c)){Y("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-a&&n>=0&&n<=e.height-i&&he.readPixels(t,n,a,i,Be.convert(l),Be.convert(c),r)}finally{const e=O!==null?Me.get(O).__webglFramebuffer:null;Ee.bindFramebuffer(he.FRAMEBUFFER,e)}}};
|
|
/**
|
|
* Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}.
|
|
*
|
|
* It is recommended to use this version of `readRenderTargetPixels()` whenever possible.
|
|
*
|
|
* @async
|
|
* @param {WebGLRenderTarget} renderTarget - The render target to read from.
|
|
* @param {number} x - The `x` coordinate of the copy region's origin.
|
|
* @param {number} y - The `y` coordinate of the copy region's origin.
|
|
* @param {number} width - The width of the copy region.
|
|
* @param {number} height - The height of the copy region.
|
|
* @param {TypedArray} buffer - The result buffer.
|
|
* @param {number} [activeCubeFaceIndex] - The active cube face index.
|
|
* @param {number} [textureIndex=0] - The texture index of an MRT render target.
|
|
* @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
|
|
*/this.readRenderTargetPixelsAsync=async function(e,t,n,a,i,r,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=Me.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget&&o!==void 0&&(l=l[o]);if(l){if(t>=0&&t<=e.width-a&&n>=0&&n<=e.height-i){Ee.bindFramebuffer(he.FRAMEBUFFER,l);const o=e.textures[s];const c=o.format;const d=o.type;e.textures.length>1&&he.readBuffer(he.COLOR_ATTACHMENT0+s);if(!ve.textureFormatReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ve.textureTypeReadable(d))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const f=he.createBuffer();he.bindBuffer(he.PIXEL_PACK_BUFFER,f);he.bufferData(he.PIXEL_PACK_BUFFER,r.byteLength,he.STREAM_READ);he.readPixels(t,n,a,i,Be.convert(c),Be.convert(d),0);const u=O!==null?Me.get(O).__webglFramebuffer:null;Ee.bindFramebuffer(he.FRAMEBUFFER,u);const p=he.fenceSync(he.SYNC_GPU_COMMANDS_COMPLETE,0);he.flush();await sa(he,p,4);he.bindBuffer(he.PIXEL_PACK_BUFFER,f);he.getBufferSubData(he.PIXEL_PACK_BUFFER,0,r);he.deleteBuffer(f);he.deleteSync(p);return r}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}};
|
|
/**
|
|
* Copies pixels from the current bound framebuffer into the given texture.
|
|
*
|
|
* @param {FramebufferTexture} texture - The texture.
|
|
* @param {?Vector2} [position=null] - The start position of the copy operation.
|
|
* @param {number} [level=0] - The mip level. The default represents the base mip.
|
|
*/this.copyFramebufferToTexture=function(e,t=null,n=0){const a=Math.pow(2,-n);const i=Math.floor(e.image.width*a);const r=Math.floor(e.image.height*a);const o=t!==null?t.x:0;const s=t!==null?t.y:0;Te.setTexture2D(e,0);he.copyTexSubImage2D(he.TEXTURE_2D,n,0,0,o,s,i,r);Ee.unbindTexture()};const ht=he.createFramebuffer();const _t=he.createFramebuffer();
|
|
/**
|
|
* Copies data of the given source texture into a destination texture.
|
|
*
|
|
* When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized
|
|
* {@link WebGLRenderer#initRenderTarget}.
|
|
*
|
|
* @param {Texture} srcTexture - The source texture.
|
|
* @param {Texture} dstTexture - The destination texture.
|
|
* @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
* @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
* @param {number} [srcLevel=0] - The source mipmap level to copy.
|
|
* @param {?number} [dstLevel=0] - The destination mipmap level.
|
|
*/this.copyTextureToTexture=function(e,t,n=null,a=null,i=0,r=0){let o,s,l,c,d,f;let u,p,m;const h=e.isCompressedTexture?e.mipmaps[r]:e.image;if(n!==null){o=n.max.x-n.min.x;s=n.max.y-n.min.y;l=n.isBox3?n.max.z-n.min.z:1;c=n.min.x;d=n.min.y;f=n.isBox3?n.min.z:0}else{const t=Math.pow(2,-i);o=Math.floor(h.width*t);s=Math.floor(h.height*t);l=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1;c=0;d=0;f=0}if(a!==null){u=a.x;p=a.y;m=a.z}else{u=0;p=0;m=0}const _=Be.convert(t.format);const g=Be.convert(t.type);let v;if(t.isData3DTexture){Te.setTexture3D(t,0);v=he.TEXTURE_3D}else if(t.isDataArrayTexture||t.isCompressedArrayTexture){Te.setTexture2DArray(t,0);v=he.TEXTURE_2D_ARRAY}else{Te.setTexture2D(t,0);v=he.TEXTURE_2D}he.pixelStorei(he.UNPACK_FLIP_Y_WEBGL,t.flipY);he.pixelStorei(he.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha);he.pixelStorei(he.UNPACK_ALIGNMENT,t.unpackAlignment);const E=he.getParameter(he.UNPACK_ROW_LENGTH);const S=he.getParameter(he.UNPACK_IMAGE_HEIGHT);const M=he.getParameter(he.UNPACK_SKIP_PIXELS);const T=he.getParameter(he.UNPACK_SKIP_ROWS);const x=he.getParameter(he.UNPACK_SKIP_IMAGES);he.pixelStorei(he.UNPACK_ROW_LENGTH,h.width);he.pixelStorei(he.UNPACK_IMAGE_HEIGHT,h.height);he.pixelStorei(he.UNPACK_SKIP_PIXELS,c);he.pixelStorei(he.UNPACK_SKIP_ROWS,d);he.pixelStorei(he.UNPACK_SKIP_IMAGES,f);const R=e.isDataArrayTexture||e.isData3DTexture;const A=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=Me.get(e);const a=Me.get(t);const h=Me.get(n.__renderTarget);const _=Me.get(a.__renderTarget);Ee.bindFramebuffer(he.READ_FRAMEBUFFER,h.__webglFramebuffer);Ee.bindFramebuffer(he.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;n<l;n++){if(R){he.framebufferTextureLayer(he.READ_FRAMEBUFFER,he.COLOR_ATTACHMENT0,Me.get(e).__webglTexture,i,f+n);he.framebufferTextureLayer(he.DRAW_FRAMEBUFFER,he.COLOR_ATTACHMENT0,Me.get(t).__webglTexture,r,m+n)}he.blitFramebuffer(c,d,o,s,u,p,o,s,he.DEPTH_BUFFER_BIT,he.NEAREST)}Ee.bindFramebuffer(he.READ_FRAMEBUFFER,null);Ee.bindFramebuffer(he.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||Me.has(e)){const n=Me.get(e);const a=Me.get(t);Ee.bindFramebuffer(he.READ_FRAMEBUFFER,ht);Ee.bindFramebuffer(he.DRAW_FRAMEBUFFER,_t);for(let e=0;e<l;e++){R?he.framebufferTextureLayer(he.READ_FRAMEBUFFER,he.COLOR_ATTACHMENT0,n.__webglTexture,i,f+e):he.framebufferTexture2D(he.READ_FRAMEBUFFER,he.COLOR_ATTACHMENT0,he.TEXTURE_2D,n.__webglTexture,i);A?he.framebufferTextureLayer(he.DRAW_FRAMEBUFFER,he.COLOR_ATTACHMENT0,a.__webglTexture,r,m+e):he.framebufferTexture2D(he.DRAW_FRAMEBUFFER,he.COLOR_ATTACHMENT0,he.TEXTURE_2D,a.__webglTexture,r);i!==0?he.blitFramebuffer(c,d,o,s,u,p,o,s,he.COLOR_BUFFER_BIT,he.NEAREST):A?he.copyTexSubImage3D(v,r,u,p,m+e,c,d,o,s):he.copyTexSubImage2D(v,r,u,p,c,d,o,s)}Ee.bindFramebuffer(he.READ_FRAMEBUFFER,null);Ee.bindFramebuffer(he.DRAW_FRAMEBUFFER,null)}else A?e.isDataTexture||e.isData3DTexture?he.texSubImage3D(v,r,u,p,m,o,s,l,_,g,h.data):t.isCompressedArrayTexture?he.compressedTexSubImage3D(v,r,u,p,m,o,s,l,_,h.data):he.texSubImage3D(v,r,u,p,m,o,s,l,_,g,h):e.isDataTexture?he.texSubImage2D(he.TEXTURE_2D,r,u,p,o,s,_,g,h.data):e.isCompressedTexture?he.compressedTexSubImage2D(he.TEXTURE_2D,r,u,p,h.width,h.height,_,h.data):he.texSubImage2D(he.TEXTURE_2D,r,u,p,o,s,_,g,h);he.pixelStorei(he.UNPACK_ROW_LENGTH,E);he.pixelStorei(he.UNPACK_IMAGE_HEIGHT,S);he.pixelStorei(he.UNPACK_SKIP_PIXELS,M);he.pixelStorei(he.UNPACK_SKIP_ROWS,T);he.pixelStorei(he.UNPACK_SKIP_IMAGES,x);r===0&&t.generateMipmaps&&he.generateMipmap(v);Ee.unbindTexture()};
|
|
/**
|
|
* Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
|
|
* can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
|
|
* rendered to.
|
|
*
|
|
* @param {WebGLRenderTarget} target - The render target.
|
|
*/this.initRenderTarget=function(e){Me.get(e).__webglFramebuffer===void 0&&Te.setupRenderTarget(e)};
|
|
/**
|
|
* Initializes the given texture. Useful for preloading a texture rather than waiting until first
|
|
* render (which can cause noticeable lags due to decode and GPU upload overhead).
|
|
*
|
|
* @param {Texture} texture - The texture.
|
|
*/this.initTexture=function(e){e.isCubeTexture?Te.setTextureCube(e,0):e.isData3DTexture?Te.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Te.setTexture2DArray(e,0):Te.setTexture2D(e,0);Ee.unbindTexture()};this.resetState=function(){y=0;F=0;O=null;Ee.reset();He.reset()};typeof __THREE_DEVTOOLS__!=="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}
|
|
/**
|
|
* Defines the coordinate system of the renderer.
|
|
*
|
|
* In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`.
|
|
*
|
|
* @type {WebGLCoordinateSystem|WebGPUCoordinateSystem}
|
|
* @default WebGLCoordinateSystem
|
|
* @readonly
|
|
*/get coordinateSystem(){return oa}
|
|
/**
|
|
* Defines the output color space of the renderer.
|
|
*
|
|
* @type {SRGBColorSpace|LinearSRGBColorSpace}
|
|
* @default SRGBColorSpace
|
|
*/get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=v._getDrawingBufferColorSpace(e);t.unpackColorSpace=v._getUnpackColorSpace()}}export{me as ACESFilmicToneMapping,ot as AddEquation,Pe as AddOperation,Ut as AdditiveBlending,pe as AgXToneMapping,rn as AlphaFormat,Yt as AlwaysCompare,tt as AlwaysDepth,$n as ArrayCamera,h as BackSide,p as BoxGeometry,K as BufferAttribute,W as BufferGeometry,nn as ByteType,he as CineonToneMapping,Ot as ClampToEdgeWrapping,n as Color,v as ColorManagement,pt as ConstantAlphaFactor,ht as ConstantColorFactor,ne as CubeCamera,Xe as CubeDepthTexture,O as CubeReflectionMapping,B as CubeRefractionMapping,J as CubeTexture,d as CubeUVReflectionMapping,at as CullFaceBack,wt as CullFaceFront,Dt as CullFaceNone,Ct as CustomBlending,fe as CustomToneMapping,Te as Data3DTexture,ce as DataArrayTexture,ta as DataTexture,ke as DepthFormat,jt as DepthStencilFormat,Me as DepthTexture,Ie as DoubleSide,St as DstAlphaFactor,Mt as DstColorFactor,zt as EqualCompare,$e as EqualDepth,ae as EquirectangularReflectionMapping,ie as EquirectangularRefractionMapping,l as Euler,Zn as EventDispatcher,jn as ExternalTexture,ve as Float32BufferAttribute,U as FloatType,T as FrontSide,Ge as Frustum,De as GLSL3,kt as GreaterCompare,je as GreaterDepth,xe as GreaterEqualCompare,Ze as GreaterEqualDepth,C as HalfFloatType,R as IntType,we as Layers,Xt as LessCompare,Je as LessDepth,Re as LessEqualCompare,Qe as LessEqualDepth,V as LinearFilter,te as LinearMipmapLinearFilter,Gt as LinearMipmapNearestFilter,G as LinearSRGBColorSpace,ge as LinearToneMapping,Ae as LinearTransfer,e as Matrix3,c as Matrix4,lt as MaxEquation,u as Mesh,X as MeshBasicMaterial,He as MeshDepthMaterial,Ve as MeshDistanceMaterial,st as MinEquation,Ft as MirroredRepeatWrapping,Le as MixOperation,Pt as MultiplyBlending,Ue as MultiplyOperation,ze as NearestFilter,Ht as NearestMipmapLinearFilter,Vt as NearestMipmapNearestFilter,ue as NeutralToneMapping,Kt as NeverCompare,nt as NeverDepth,$ as NoBlending,qt as NoColorSpace,z as NoToneMapping,Ne as NormalBlending,Wt as NotEqualCompare,qe as NotEqualDepth,Fe as ObjectSpaceNormalMap,At as OneFactor,ut as OneMinusConstantAlphaFactor,mt as OneMinusConstantColorFactor,_t as OneMinusDstAlphaFactor,gt as OneMinusDstColorFactor,vt as OneMinusSrcAlphaFactor,Et as OneMinusSrcColorFactor,y as OrthographicCamera,Ce as PCFShadowMap,We as PCFSoftShadowMap,PMREMGenerator,k as PerspectiveCamera,N as Plane,S as PlaneGeometry,Rn as R11_EAC_Format,Kn as RED_GREEN_RGTC2_Format,Xn as RED_RGTC1_Format,ia as REVISION,bn as RG11_EAC_Format,b as RGBAFormat,un as RGBAIntegerFormat,Gn as RGBA_ASTC_10x10_Format,Fn as RGBA_ASTC_10x5_Format,On as RGBA_ASTC_10x6_Format,Bn as RGBA_ASTC_10x8_Format,Hn as RGBA_ASTC_12x10_Format,Vn as RGBA_ASTC_12x12_Format,Pn as RGBA_ASTC_4x4_Format,Ln as RGBA_ASTC_5x4_Format,Un as RGBA_ASTC_5x5_Format,Dn as RGBA_ASTC_6x5_Format,wn as RGBA_ASTC_6x6_Format,In as RGBA_ASTC_8x5_Format,Nn as RGBA_ASTC_8x6_Format,yn as RGBA_ASTC_8x8_Format,Wn as RGBA_BPTC_Format,xn as RGBA_ETC2_EAC_Format,Sn as RGBA_PVRTC_2BPPV1_Format,En as RGBA_PVRTC_4BPPV1_Format,mn as RGBA_S3TC_DXT1_Format,hn as RGBA_S3TC_DXT3_Format,_n as RGBA_S3TC_DXT5_Format,on as RGBFormat,kn as RGB_BPTC_SIGNED_Format,zn as RGB_BPTC_UNSIGNED_Format,Mn as RGB_ETC1_Format,Tn as RGB_ETC2_Format,vn as RGB_PVRTC_2BPPV1_Format,gn as RGB_PVRTC_4BPPV1_Format,pn as RGB_S3TC_DXT1_Format,Be as RGFormat,cn as RGIntegerFormat,Ee as RawShaderMaterial,sn as RedFormat,ln as RedIntegerFormat,_e as ReinhardToneMapping,Bt as RepeatWrapping,it as ReverseSubtractEquation,An as SIGNED_R11_EAC_Format,qn as SIGNED_RED_GREEN_RGTC2_Format,Yn as SIGNED_RED_RGTC1_Format,Cn as SIGNED_RG11_EAC_Format,aa as SRGBColorSpace,E as SRGBTransfer,Qr as ShaderChunk,to as ShaderLib,m as ShaderMaterial,an as ShortType,xt as SrcAlphaFactor,Tt as SrcAlphaSaturateFactor,Rt as SrcColorFactor,rt as SubtractEquation,Lt as SubtractiveBlending,ye as TangentSpaceNormalMap,Se as Texture,se as Uint16BufferAttribute,oe as Uint32BufferAttribute,Jr as UniformsLib,Oe as UniformsUtils,L as UnsignedByteType,tn as UnsignedInt101111Type,Nt as UnsignedInt248Type,Jt as UnsignedInt5999Type,Ye as UnsignedIntType,$t as UnsignedShort4444Type,Qt as UnsignedShort5551Type,yt as UnsignedShortType,be as VSMShadowMap,t as Vector2,r as Vector3,le as Vector4,oa as WebGLCoordinateSystem,WebGLCubeRenderTarget,q as WebGLRenderTarget,WebGLRenderer,nc as WebGLUtils,Qn as WebXRController,bt as ZeroFactor,na as createCanvasElement,Y as error,ra as log,w as warn,re as warnOnce};
|
|
|