2025-12-29 20:02:54 -08:00
( globalThis . TURBOPACK || ( globalThis . TURBOPACK = [ ] ) ) . push ( [ "object" == typeof document ? document . currentScript : void 0 , 79474 , ( e , t , n ) => { "use strict" ; var i = e . r ( 71645 ) . _ _CLIENT _INTERNALS _DO _NOT _USE _OR _WARN _USERS _THEY _CANNOT _UPGRADE ; n . c = function ( e ) { return i . H . useMemoCache ( e ) } } , 932 , ( e , t , n ) => { "use strict" ; t . exports = e . r ( 79474 ) } , 24478 , ( e , t , n ) => { "use strict" ; n . ConcurrentRoot = 1 , n . ContinuousEventPriority = 8 , n . DefaultEventPriority = 32 , n . DiscreteEventPriority = 2 , n . IdleEventPriority = 0x10000000 , n . LegacyRoot = 0 , n . NoEventPriority = 0 } , 39695 , ( e , t , n ) => { "use strict" ; t . exports = e . r ( 24478 ) } , 55838 , ( e , t , n ) => { "use strict" ; var i = e . r ( 71645 ) , r = "function" == typeof Object . is ? Object . is : function ( e , t ) { return e === t && ( 0 !== e || 1 / e == 1 / t ) || e != e && t != t } , a = i . useState , s = i . useEffect , o = i . useLayoutEffect , l = i . useDebugValue ; function u ( e ) { var t = e . getSnapshot ; e = e . value ; try { var n = t ( ) ; return ! r ( e , n ) } catch ( e ) { return ! 0 } } var c = "undefined" == typeof window || void 0 === window . document || void 0 === window . document . createElement ? function ( e , t ) { return t ( ) } : function ( e , t ) { var n = t ( ) , i = a ( { inst : { value : n , getSnapshot : t } } ) , r = i [ 0 ] . inst , c = i [ 1 ] ; return o ( function ( ) { r . value = n , r . getSnapshot = t , u ( r ) && c ( { inst : r } ) } , [ e , n , t ] ) , s ( function ( ) { return u ( r ) && c ( { inst : r } ) , e ( function ( ) { u ( r ) && c ( { inst : r } ) } ) } , [ e ] ) , l ( n ) , n } ; n . useSyncExternalStore = void 0 !== i . useSyncExternalStore ? i . useSyncExternalStore : c } , 2239 , ( e , t , n ) => { "use strict" ; t . exports = e . r ( 55838 ) } , 52822 , ( e , t , n ) => { "use strict" ; var i = e . r ( 71645 ) , r = e . r ( 2239 ) , a = "function" == typeof Object . is ? Object . is : function ( e , t ) { return e === t && ( 0 !== e || 1 / e == 1 / t ) || e != e && t != t } , s = r . useSyncExternalStore , o = i . useRef , l = i . useEffect , u = i . useMemo , c = i . useDebugValue ; n . useSyncExternalStoreWithSelector = function ( e , t , n , i , r ) { var h = o ( null ) ; if ( null === h . current ) { var d = { hasValue : ! 1 , value : null } ; h . current = d } else d = h . current ; var p = s ( e , ( h = u ( function ( ) { function e ( e ) { if ( ! l ) { if ( l = ! 0 , s = e , e = i ( e ) , void 0 !== r && d . hasValue ) { var t = d . value ; if ( r ( t , e ) ) return o = t } return o = e } if ( t = o , a ( s , e ) ) return t ; var n = i ( e ) ; return void 0 !== r && r ( t , n ) ? ( s = e , t ) : ( s = e , o = n ) } var s , o , l = ! 1 , u = void 0 === n ? null : n ; return [ function ( ) { return e ( t ( ) ) } , null === u ? void 0 : function ( ) { return e ( u ( ) ) } ] } , [ t , n , i , r ] ) ) [ 0 ] , h [ 1 ] ) ; return l ( function ( ) { d . hasValue = ! 0 , d . value = p } , [ p ] ) , c ( p ) , p } } , 30224 , ( e , t , n ) => { "use strict" ; t . exports = e . r ( 52822 ) } , 29779 , ( e , t , n ) => { "use strict" ; function i ( e , t ) { var n = e . length ; for ( e . push ( t ) ; 0 < n ; ) { var i = n - 1 >>> 1 , r = e [ i ] ; if ( 0 < s ( r , t ) ) e [ i ] = t , e [ n ] = r , n = i ; else break } } function r ( e ) { return 0 === e . length ? null : e [ 0 ] } function a ( e ) { if ( 0 === e . length ) return null ; var t = e [ 0 ] , n = e . pop ( ) ; if ( n !== t ) { e [ 0 ] = n ; for ( var i = 0 , r = e . length , a = r >>> 1 ; i < a ; ) { var o = 2 * ( i + 1 ) - 1 , l = e [ o ] , u = o + 1 , c = e [ u ] ; if ( 0 > s ( l , n ) ) u < r && 0 > s ( c , l ) ? ( e [ i ] = c , e [ u ] = n , i = u ) : ( e [ i ] = l , e [ o ] = n , i = o ) ; else if ( u < r && 0 > s ( c , n ) ) e [ i ] = c , e [ u ] = n , i = u ; else break } } return t } function s ( e , t ) { var n = e . sortIndex - t . sortIndex ; return 0 !== n ? n : e . id - t . id } if ( n . unstable _now = void 0 , "object" == typeof performance && "function" == typeof performance . now ) { var o , l = performance ; n . unstable _now = function ( ) { return l . now ( ) } } else { var u = Date , c = u . now ( ) ; n . unstable _now = function ( ) { return u . now ( ) - c } } var h = [ ] , d = [ ] , p = 1 , f = null , m = 3 , g = ! 1 , v = ! 1 , _ = ! 1 , y = "function" == typeof setTimeout ? setTimeout : null , x = "function" == typeof clearTimeout ? clearTimeout : null , b = "undefined" != typeof setImmediate ? setImmediate : null ; function S ( e ) { for ( var t = r ( d ) ; null !== t ; ) { if ( null === t . callback ) a ( d ) ; else if ( t . startTime <= e ) a ( d ) , t . sortIndex = t . expirationTime , i ( h , t ) ; else break ; t = r ( d ) } } function M ( e ) { if ( _ = ! 1 , S ( e ) , ! v ) if ( null !== r ( h ) ) v = ! 0 , L ( ) ; else { var t = r ( d ) ; null !== t && N ( M , t . startTime - e ) } } var w = ! 1 , T = - 1 , E = 5 , A = - 1 ; function C ( ) { return ! ( n . unstable _now ( ) - A < E ) } function R ( ) { if ( w ) { var e = n . unstable _now ( ) ; A = e ; var t = ! 0 ; try { e : { v = ! 1 , _ && ( _ = ! 1 , x ( T ) , T = - 1 ) , g = ! 0 ; var i = m ; try { t : { for ( S ( e ) , f = r ( h ) ; null !== f && ! ( f . expirationTime > e && C ( ) ) ; ) { var s = f . callback ; if ( "function" == typeof s ) { f . callback = null , m = f . priorityLevel ; var l = s ( f . expirationTime <= e ) ; if ( e = n . unstable _now ( ) , "function" == typeof l ) { f . callback = l , S ( e ) , t = ! 0 ; break t } f === r ( h ) && a ( h ) , S ( e ) } else a ( h ) ; f = r ( h ) } if ( null !== f ) t = ! 0 ; else { var u = r ( d ) ; null !== u && N ( M , u . startTime - e ) , t = ! 1 } } break e } finally { f = null , m = i , g = ! 1 } } } finally { t ? o ( ) : w = ! 1 } } } if ( "function" == typeof b ) o = function ( ) { b ( R ) } ; else if ( "undefined" != typeof MessageChannel ) { var P = new MessageChannel , I = P . por
2025-12-12 14:16:21 -08:00
varying vec3 vWorldDirection ;
vec3 transformDirection ( in vec3 dir , in mat4 matrix ) {
return normalize ( ( matrix * vec4 ( dir , 0.0 ) ) . xyz ) ;
}
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
}
` ,fragmentShader: `
uniform sampler2D tEquirect ;
varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vec3 direction = normalize ( vWorldDirection ) ;
vec2 sampleUV = equirectUv ( direction ) ;
gl _FragColor = texture2D ( tEquirect , sampleUV ) ;
}
` },i=new nM(5,5,5),r=new nC({name:"CubemapFromEquirect",uniforms:nw(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;let a=new nb(i,r),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new nD(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}class nF extends tT{constructor(){super(),this.isGroup=!0,this.type="Group"}}let nB={type:"move"};class nk{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new nF,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new nF,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new eh,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new eh),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new nF,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new eh,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new eh),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let i of(a=!0,e.hand.values())){let e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(nB)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new nF;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class nz{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new tW(e),this.density=t}clone(){return new nz(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class nV{co
precision mediump float ;
precision mediump int ;
varying vec3 vOutputDirection ;
uniform sampler2D envMap ;
uniform int samples ;
uniform float weights [ n ] ;
uniform bool latitudinal ;
uniform float dTheta ;
uniform float mipInt ;
uniform vec3 poleAxis ;
# define ENVMAP _TYPE _CUBE _UV
# include < cube _uv _reflection _fragment >
vec3 getSample ( float theta , vec3 axis ) {
float cosTheta = cos ( theta ) ;
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross ( axis , vOutputDirection ) * sin ( theta )
+ axis * dot ( axis , vOutputDirection ) * ( 1.0 - cosTheta ) ;
return bilinearCubeUV ( envMap , sampleDirection , mipInt ) ;
}
void main ( ) {
vec3 axis = latitudinal ? poleAxis : cross ( poleAxis , vOutputDirection ) ;
if ( all ( equal ( axis , vec3 ( 0.0 ) ) ) ) {
axis = vec3 ( vOutputDirection . z , 0.0 , - vOutputDirection . x ) ;
}
axis = normalize ( axis ) ;
gl _FragColor = vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
gl _FragColor . rgb += weights [ 0 ] * getSample ( 0.0 , axis ) ;
for ( int i = 1 ; i < n ; i ++ ) {
if ( i >= samples ) {
break ;
}
float theta = dTheta * float ( i ) ;
gl _FragColor . rgb += weights [ i ] * getSample ( - 1.0 * theta , axis ) ;
gl _FragColor . rgb += weights [ i ] * getSample ( theta , axis ) ;
}
}
` ,blending:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(a=i,new nC({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP: ` $ { a } . 0 ` },uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:lM(),fragmentShader: `
precision highp float ;
precision highp int ;
varying vec3 vOutputDirection ;
uniform sampler2D envMap ;
uniform float roughness ;
uniform float mipInt ;
# define ENVMAP _TYPE _CUBE _UV
# include < cube _uv _reflection _fragment >
# define PI 3.14159265359
// Van der Corput radical inverse
float radicalInverse _VdC ( uint bits ) {
bits = ( bits << 16 u ) | ( bits >> 16 u ) ;
bits = ( ( bits & 0x55555555 u ) << 1 u ) | ( ( bits & 0xAAAAAAAA u ) >> 1 u ) ;
bits = ( ( bits & 0x33333333 u ) << 2 u ) | ( ( bits & 0xCCCCCCCC u ) >> 2 u ) ;
bits = ( ( bits & 0x0F0F0F0F u ) << 4 u ) | ( ( bits & 0xF0F0F0F0 u ) >> 4 u ) ;
bits = ( ( bits & 0x00FF00FF u ) << 8 u ) | ( ( bits & 0xFF00FF00 u ) >> 8 u ) ;
return float ( bits ) * 2.3283064365386963 e - 10 ; // / 0x100000000
}
// Hammersley sequence
vec2 hammersley ( uint i , uint N ) {
return vec2 ( float ( i ) / float ( N ) , radicalInverse _VdC ( i ) ) ;
}
// GGX VNDF importance sampling (Eric Heitz 2018)
// "Sampling the GGX Distribution of Visible Normals"
// https://jcgt.org/published/0007/04/01/
vec3 importanceSampleGGX _VNDF ( vec2 Xi , vec3 V , float roughness ) {
float alpha = roughness * roughness ;
// Section 3.2: Transform view direction to hemisphere configuration
vec3 Vh = normalize ( vec3 ( alpha * V . x , alpha * V . y , V . z ) ) ;
// Section 4.1: Orthonormal basis
float lensq = Vh . x * Vh . x + Vh . y * Vh . y ;
vec3 T1 = lensq > 0.0 ? vec3 ( - Vh . y , Vh . x , 0.0 ) / sqrt ( lensq ) : vec3 ( 1.0 , 0.0 , 0.0 ) ;
vec3 T2 = cross ( Vh , T1 ) ;
// Section 4.2: Parameterization of projected area
float r = sqrt ( Xi . x ) ;
float phi = 2.0 * PI * Xi . y ;
float t1 = r * cos ( phi ) ;
float t2 = r * sin ( phi ) ;
float s = 0.5 * ( 1.0 + Vh . z ) ;
t2 = ( 1.0 - s ) * sqrt ( 1.0 - t1 * t1 ) + s * t2 ;
// Section 4.3: Reprojection onto hemisphere
vec3 Nh = t1 * T1 + t2 * T2 + sqrt ( max ( 0.0 , 1.0 - t1 * t1 - t2 * t2 ) ) * Vh ;
// Section 3.4: Transform back to ellipsoid configuration
return normalize ( vec3 ( alpha * Nh . x , alpha * Nh . y , max ( 0.0 , Nh . z ) ) ) ;
}
void main ( ) {
vec3 N = normalize ( vOutputDirection ) ;
vec3 V = N ; // Assume view direction equals normal for pre-filtering
vec3 prefilteredColor = vec3 ( 0.0 ) ;
float totalWeight = 0.0 ;
// For very low roughness, just sample the environment directly
if ( roughness < 0.001 ) {
gl _FragColor = vec4 ( bilinearCubeUV ( envMap , N , mipInt ) , 1.0 ) ;
return ;
}
// Tangent space basis for VNDF sampling
vec3 up = abs ( N . z ) < 0.999 ? vec3 ( 0.0 , 0.0 , 1.0 ) : vec3 ( 1.0 , 0.0 , 0.0 ) ;
vec3 tangent = normalize ( cross ( up , N ) ) ;
vec3 bitangent = cross ( N , tangent ) ;
for ( uint i = 0 u ; i < uint ( GGX _SAMPLES ) ; i ++ ) {
vec2 Xi = hammersley ( i , uint ( GGX _SAMPLES ) ) ;
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
vec3 H _tangent = importanceSampleGGX _VNDF ( Xi , vec3 ( 0.0 , 0.0 , 1.0 ) , roughness ) ;
// Transform H back to world space
vec3 H = normalize ( tangent * H _tangent . x + bitangent * H _tangent . y + N * H _tangent . z ) ;
vec3 L = normalize ( 2.0 * dot ( V , H ) * H - V ) ;
float NdotL = max ( dot ( N , L ) , 0.0 ) ;
if ( NdotL > 0.0 ) {
// Sample environment at fixed mip level
// VNDF importance sampling handles the distribution filtering
vec3 sampleColor = bilinearCubeUV ( envMap , L , mipInt ) ;
// Weight by NdotL for the split-sum approximation
// VNDF PDF naturally accounts for the visible microfacet distribution
prefilteredColor += sampleColor * NdotL ;
totalWeight += NdotL ;
}
}
if ( totalWeight > 0.0 ) {
prefilteredColor = prefilteredColor / totalWeight ;
}
gl _FragColor = vec4 ( prefilteredColor , 1.0 ) ;
}
` ,blending:0,depthTest:!1,depthWrite:!1}))}return i}_compileMaterial(e){let t=new nb(new nu,e);this._renderer.compile(t,lh)}_sceneToCubeUV(e,t,n,i,r){let a=new nN(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(ld),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new nb(new nM,new tq({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));let h=this._backgroundBox,d=h.material,p=!1,f=e.background;f?f.isColor&&(d.color.copy(f),e.background=null,p=!0):(d.color.copy(ld),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+o[t],r.y,r.z)):1===n?(a.up.set(0,0,s[t]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+o[t],r.z)):(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+o[t]));let u=this._cubeSize;lx(i,n*u,t>2?u:0,u,u),l.setRenderTarget(i),p&&l.render(h,a),l.render(e,a)}l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=lS()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=lb());let r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r,r.uniforms.envMap.value=e;let s=this._cubeSize;lx(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,lh)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let t=1;t<i;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[n];s.material=a;let o=a.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-u*u),{_lodMax:h}=this,d=this._sizeLods[n],p=3*d*(n>h-4?n-h+4:0),f=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c*(0+1.25*l),o.mipInt.value=h-t,lx(r,p,f,3*d,2*d),i.setRenderTarget(r),i.render(s,lh),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=h-n,lx(e,p,f,3*d,2*d),i.setRenderTarget(e),i.render(s,lh)}_blur(e,t,n,i,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&q("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[i];u.material=l;let c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&X( ` sigmaRadians , $ { r } , is too large and will clip , as it requested $ { f } samples when the maximum is set to 20 ` );let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e<f&&(g+=2*n)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;c.envMap.value=e.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s);let{_lodMax:v}=this;c.dTheta.value=d,c.mipInt.value=v-n;let _=this._sizeLods[i],y=4*(this._cubeSize-_);lx(t,3*_*(i>v-4?i-v+4:0),y,3*_,2*_),o.setRenderTarget(t),o.render(u,lh)}}function ly(e,t,n){let i=new eP(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function lx(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function lb(){return new nC({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lM(),fragmentShader: `
precision mediump float ;
precision mediump int ;
varying vec3 vOutputDirection ;
uniform sampler2D envMap ;
# include < common >
void main ( ) {
vec3 outputDirection = normalize ( vOutputDirection ) ;
vec2 uv = equirectUv ( outputDirection ) ;
gl _FragColor = vec4 ( texture2D ( envMap , uv ) . rgb , 1.0 ) ;
}
` ,blending:0,depthTest:!1,depthWrite:!1})}function lS(){return new nC({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lM(),fragmentShader: `
precision mediump float ;
precision mediump int ;
uniform float flipEnvMap ;
varying vec3 vOutputDirection ;
uniform samplerCube envMap ;
void main ( ) {
gl _FragColor = textureCube ( envMap , vec3 ( flipEnvMap * vOutputDirection . x , vOutputDirection . yz ) ) ;
}
` ,blending:0,depthTest:!1,depthWrite:!1})}function lM(){return `
precision mediump float ;
precision mediump int ;
attribute float faceIndex ;
varying vec3 vOutputDirection ;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection ( vec2 uv , float face ) {
uv = 2.0 * uv - 1.0 ;
vec3 direction = vec3 ( uv , 1.0 ) ;
if ( face == 0.0 ) {
direction = direction . zyx ; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction . xzy ;
direction . xz *= - 1.0 ; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction . x *= - 1.0 ; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction . zyx ;
direction . xz *= - 1.0 ; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction . xzy ;
direction . xy *= - 1.0 ; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction . z *= - 1.0 ; // ( u, v, -1 ) neg z
}
return direction ;
}
void main ( ) {
vOutputDirection = getDirection ( uv , faceIndex ) ;
gl _Position = vec4 ( position , 1.0 ) ;
}
` }function lw(e){let t=new WeakMap,n=null;function i(e){let n=e.target;n.removeEventListener("dispose",i);let r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(r),l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new l_(e)),(a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a)).texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;{if(void 0!==a)return a.texture;let l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new l_(e)),(a=s?n.fromEquirectangular(r):n.fromCubemap(r)).texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function lT(e){let t={};function n(n){if(void 0!==t[n])return t[n];let i=e.getExtension(n);return t[n]=i,i}return{has:function(e){return null!==n(e)},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){let t=n(e);return null===t&&Y("WebGLRenderer: "+e+" extension not supported."),t}}}function lE(e,t,n,i){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){let n=[],i=e.index,r=e.attributes.position,s=0;if(null!==i){let e=i.array;s=i.version;for(let t=0,i=e.length;t<i;t+=3){let i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;let e=r.array;s=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){let e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}let o=new(O(n)?t7:t8)(n,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,n.memory.geometries++),t},update:function(n){let i=n.attributes;for(let n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=a.get(e);if(t){let n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return a.get(e)}}}function lA(e,t,n){let i,r,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(i,s,r,t*a,o),n.update(s,i,o))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(i,s,r,t*a),n.update(s,i,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,o,l,u){if(0===l)return;let c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],u[t]);else{c.multiDrawElementsInstancedWEBGL(i,o,0,r,e,0,u,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*u[e];n.update(t,i,1)}}}function lC(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=n/3*r;break;case e.LINES:t.lines+=n/2*r;break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:q("WebGLInfo: Unknown draw mode:",i)}}}}function lR(e,t,n){let i=new WeakMap,r=new eC;return{update:function(a,s,o){let l=a.morphTargetInfluences,u=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,c=void 0!==u?u.length:0,h=i.get(s);if(void 0===h||h.count!==c){void 0!==h&&h.texture.dispose();let e=void 0!==s.morphAttributes.position,n=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.positi
precision highp float ;
uniform mat4 modelViewMatrix ;
uniform mat4 projectionMatrix ;
attribute vec3 position ;
attribute vec2 uv ;
varying vec2 vUv ;
void main ( ) {
vUv = uv ;
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
} ` ,fragmentShader: `
precision highp float ;
uniform sampler2D tDiffuse ;
varying vec2 vUv ;
# include < tonemapping _pars _fragment >
# include < colorspace _pars _fragment >
void main ( ) {
gl _FragColor = texture2D ( tDiffuse , vUv ) ;
# ifdef LINEAR _TONE _MAPPING
gl _FragColor . rgb = LinearToneMapping ( gl _FragColor . rgb ) ;
# elif defined ( REINHARD _TONE _MAPPING )
gl _FragColor . rgb = ReinhardToneMapping ( gl _FragColor . rgb ) ;
# elif defined ( CINEON _TONE _MAPPING )
gl _FragColor . rgb = CineonToneMapping ( gl _FragColor . rgb ) ;
# elif defined ( ACES _FILMIC _TONE _MAPPING )
gl _FragColor . rgb = ACESFilmicToneMapping ( gl _FragColor . rgb ) ;
# elif defined ( AGX _TONE _MAPPING )
gl _FragColor . rgb = AgXToneMapping ( gl _FragColor . rgb ) ;
# elif defined ( NEUTRAL _TONE _MAPPING )
gl _FragColor . rgb = NeutralToneMapping ( gl _FragColor . rgb ) ;
# elif defined ( CUSTOM _TONE _MAPPING )
gl _FragColor . rgb = CustomToneMapping ( gl _FragColor . rgb ) ;
# endif
# ifdef SRGB _TRANSFER
gl _FragColor = sRGBTransferOETF ( gl _FragColor ) ;
# endif
} ` ,depthTest:!1,depthWrite:!1}),c=new nb(l,u),h=new sv(-1,1,1,-1,0,1),d=null,p=null,f=!1,m=null,g=[],v=!1;this.setSize=function(e,t){s.setSize(e,t),o.setSize(e,t);for(let n=0;n<g.length;n++){let i=g[n];i.setSize&&i.setSize(e,t)}},this.setEffects=function(e){v=(g=e).length>0&&!0===g[0].isRenderPass;let t=s.width,n=s.height;for(let e=0;e<g.length;e++){let i=g[e];i.setSize&&i.setSize(t,n)}},this.begin=function(e,t){if(f||0===e.toneMapping&&0===g.length)return!1;if(m=t,null!==t){let e=t.width,n=t.height;(s.width!==e||s.height!==n)&&this.setSize(e,n)}return!1===v&&e.setRenderTarget(s),a=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return v},this.end=function(e,t){e.toneMapping=a,f=!0;let n=s,i=o;for(let r=0;r<g.length;r++){let a=g[r];if(!1!==a.enabled&&(a.render(e,i,n,t),!1!==a.needsSwap)){let e=n;n=i,i=e}}if(d!==e.outputColorSpace||p!==e.toneMapping){d=e.outputColorSpace,p=e.toneMapping,u.defines={},e_.getTransfer(d)===I&&(u.defines.SRGB_TRANSFER="");let t=lI[p];t&&(u.defines[t]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(m),e.render(c,h),m=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),o.dispose(),l.dispose(),u.dispose()}}let lN=new eA,lD=new r_(1,1),lU=new eI,lO=new eN,lF=new nU,lB=[],lk=[],lz=new Float32Array(16),lV=new Float32Array(9),lH=new Float32Array(4);function lG(e,t,n){let i=e[0];if(i<=0||i>0)return e;let r=t*n,a=lB[r];if(void 0===a&&(a=new Float32Array(r),lB[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function lW(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function lj(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function l $ (e,t){let n=lk[t];void 0===n&&(n=new Int32Array(t),lk[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function lX(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function lq(e,t){let n=this.cache;if(void 0!==t.x)(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(lW(n,t))return;e.uniform2fv(this.addr,t),lj(n,t)}}function lY(e,t){let n=this.cache;if(void 0!==t.x)(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(void 0!==t.r)(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(lW(n,t))return;e.uniform3fv(this.addr,t),lj(n,t)}}function lJ(e,t){let n=this.cache;if(void 0!==t.x)(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(lW(n,t))return;e.uniform4fv(this.addr,t),lj(n,t)}}function lZ(e,t){let n=this.cache,i=t.elements;if(void 0===i){if(lW(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),lj(n,t)}else{if(lW(n,i))return;lH.set(i),e.uniformMatrix2fv(this.addr,!1,lH),lj(n,i)}}function lK(e,t){let n=this.cache,i=t.elements;if(void 0===i){if(lW(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),lj(n,t)}else{if(lW(n,i))return;lV.set(i),e.uniformMatrix3fv(this.addr,!1,lV),lj(n,i)}}function lQ(e,t){let n=this.cache,i=t.elements;if(void 0===i){if(lW(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),lj(n,t)}else{if(lW(n,i))return;lz.set(i),e.uniformMatrix4fv(this.addr,!1,lz),lj(n,i)}}function l0(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function l1(e,t){let n=this.cache;if(void 0!==t.x)(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(lW(n,t))return;e.uniform2iv(this.addr,t),lj(n,t)}}function l2(e,t){let n=this.cache;if(void 0!==t.x)(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(lW(n,t))return;e.uniform3iv(this.addr,t),lj(n,t)}}function l3(e,t){let n=this.cache;if(void 0!==t.x)(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(lW(n,t))return;e.uniform4iv(this.addr,t),lj(n,t)}}function l4(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}func
precision $ { e . precision } int ;
precision $ { e . precision } sampler2D ;
precision $ { e . precision } samplerCube ;
precision $ { e . precision } sampler3D ;
precision $ { e . precision } sampler2DArray ;
precision $ { e . precision } sampler2DShadow ;
precision $ { e . precision } samplerCubeShadow ;
precision $ { e . precision } sampler2DArrayShadow ;
precision $ { e . precision } isampler2D ;
precision $ { e . precision } isampler3D ;
precision $ { e . precision } isamplerCube ;
precision $ { e . precision } isampler2DArray ;
precision $ { e . precision } usampler2D ;
precision $ { e . precision } usampler3D ;
precision $ { e . precision } usamplerCube ;
precision $ { e . precision } usampler2DArray ;
` ;return"highp"===e.precision?t+=" \n #define HIGH_PRECISION":"mediump"===e.precision?t+=" \n #define MEDIUM_PRECISION":"lowp"===e.precision&&(t+=" \n #define LOW_PRECISION"),t}let uW={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"},uj={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"},u $ ={302:"ENVMAP_MODE_REFRACTION"},uX={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function uq(e,t,n,i){var r,a;let s,o,l,u,c=e.getContext(),h=n.defines,d=n.vertexShader,p=n.fragmentShader,f=uW[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC",m=!1===n.envMap?"ENVMAP_TYPE_CUBE":uj[n.envMapMode]||"ENVMAP_TYPE_CUBE",g=!1===n.envMap?"ENVMAP_MODE_REFLECTION":u $ [n.envMapMode]||"ENVMAP_MODE_REFLECTION",v=!1===n.envMap?"ENVMAP_BLENDING_NONE":uX[n.combine]||"ENVMAP_BLENDING_NONE",_=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let n=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:1/t,maxMip:n}}(n),y=[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(uN).join(" \n "),x=function(e){let t=[];for(let n in e){let i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join(" \n ")}(h),b=c.createProgram(),S=n.glslVersion?"#version "+n.glslVersion+" \n ":"";if(n.isRawShaderMaterial)(s=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(uN).join(" \n ")).length>0&&(s+=" \n "),(o=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(uN).join(" \n ")).length>0&&(o+=" \n ");else{let e,t,i,l,u;s=[uG(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,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 "+g:"",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?"#defi
return $ { t [ 1 ] } ( vec4 ( value . rgb * $ { t [ 0 ] } , value . a ) ) ;
} ` ),(e_.getLuminanceCoefficients(uL),i=uL.x.toFixed(4),l=uL.y.toFixed(4),u=uL.z.toFixed(4), ` float luminance ( const in vec3 rgb ) {
const vec3 weights = vec3 ( $ { i } , $ { l } , $ { u } ) ;
return dot ( weights , rgb ) ;
} ` ),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:""," \n "].filter(uN).join(" \n ")}d=uU(d=uD(d=uF(d),n),n),p=uU(p=uD(p=uF(p),n),n),d=uV(d),p=uV(p),!0!==n.isRawShaderMaterial&&(S="#version 300 es \n ",s=[y,"#define attribute in \n #define varying out \n #define texture2D texture"].join(" \n ")+" \n "+s,o=["#define varying in",n.glslVersion===L?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===L?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth \n #define texture2D texture \n #define textureCube texture \n #define texture2DProj textureProj \n #define texture2DLodEXT textureLod \n #define texture2DProjLodEXT textureProjLod \n #define textureCubeLodEXT textureLod \n #define texture2DGradEXT textureGrad \n #define texture2DProjGradEXT textureProjGrad \n #define textureCubeGradEXT textureGrad"].join(" \n ")+" \n "+o);let M=S+s+d,w=S+o+p,T=uA(c,c.VERTEX_SHADER,M),E=uA(c,c.FRAGMENT_SHADER,w);function A(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(b)||"",i=c.getShaderInfoLog(T)||"",r=c.getShaderInfoLog(E)||"",a=n.trim(),l=i.trim(),u=r.trim(),h=!0,d=!0;if(!1===c.getProgramParameter(b,c.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,b,T,E);else{let e=uP(c,T,"vertex"),n=uP(c,E,"fragment");q("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(b,c.VALIDATE_STATUS)+" \n \n Material Name: "+t.name+" \n Material Type: "+t.type+" \n \n Program Info Log: "+a+" \n "+e+" \n "+n)}else""!==a?X("WebGLProgram: Program Info Log:",a):(""===l||""===u)&&(d=!1);d&&(t.diagnostics={runnable:h,programLog:a,vertexShader:{log:l,prefix:s},fragmentShader:{log:u,prefix:o}})}c.deleteShader(T),c.deleteShader(E),l=new uE(c,b),u=function(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let i=e.getActiveAttrib(t,r),a=i.name,s=1;i.type===e.FLOAT_MAT2&&(s=2),i.type===e.FLOAT_MAT3&&(s=3),i.type===e.FLOAT_MAT4&&(s=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:s}}return n}(c,b)}c.attachShader(b,T),c.attachShader(b,E),void 0!==n.index0AttributeName?c.bindAttribLocation(b,0,n.index0AttributeName):!0===n.morphTargets&&c.bindAttribLocation(b,0,"position"),c.linkProgram(b),this.getUniforms=function(){return void 0===l&&A(this),l},this.getAttributes=function(){return void 0===u&&A(this),u};let C=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===C&&(C=c.getProgramParameter(b,37297)),C},this.destroy=function(){i.releaseStatesOfProgram(this),c.deleteProgram(b),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=uC++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=T,this.fragmentShader=E,this}let uY=0;class uJ{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new uZ(e),t.set(e,n)),n}}class uZ{constructor(e){this.id=uY++,this.code=e,this.usedTimes=0}}function uK(e,t,n,i,r,a,s){let o=new tu,l=new uJ,u=new Set,c=[],h=new Map,d=r.logarithmicDepthBuffer,p=r.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic"
void main ( ) {
gl _Position = vec4 ( position , 1.0 ) ;
} ` ,ch= `
uniform sampler2DArray depthColor ;
uniform float depthWidth ;
uniform float depthHeight ;
void main ( ) {
vec2 coord = vec2 ( gl _FragCoord . x / depthWidth , gl _FragCoord . y / depthHeight ) ;
if ( coord . x >= 1.0 ) {
gl _FragDepth = texture ( depthColor , vec3 ( coord . x - 1.0 , coord . y , 1 ) ) . r ;
} else {
gl _FragDepth = texture ( depthColor , vec3 ( coord . x , coord . y , 0 ) ) . r ;
}
2025-12-29 20:02:54 -08:00
} ` ;class cd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let n=new rx(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new nC({vertexShader:cc,fragmentShader:ch,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new nb(new ag(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class cp extends Z{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null;const f="undefined"!=typeof XRWebGLBinding,m=new cd,g={},v=t.getContextAttributes();let _=null,y=null;const x=[],b=[],S=new eu;let M=null;const w=new nN;w.viewport=new eC;const T=new nN;T.viewport=new eC;const E=[w,T],A=new sz;let C=null,R=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function I(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",L);for(let e=0;e<x.length;e++){let t=b[e];null!==t&&(b[e]=null,x[e].disconnect(t))}for(let e in C=null,R=null,m.reset(),g)delete g[e];e.setRenderTarget(_),d=null,h=null,c=null,i=null,y=null,F.stop(),n.isPresenting=!1,e.setPixelRatio(M),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:"sessionend"})}function L(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],i=b.indexOf(n);i>=0&&(b[i]=null,x[i].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],i=b.indexOf(n);if(-1===i){for(let e=0;e<x.length;e++)if(e>=b.length){b.push(n),i=e;break}else if(null===b[e]){b[e]=n,i=e;break}if(-1===i)break}let r=x[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new nk,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new nk,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new nk,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&X("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&X("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(i,t)),c},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(u){if(null!==(i=u)){if(_=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",I),i.addEventListener("inputsourceschange",L),!0!==v.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?1027:1026,a=v.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=(c=this.getBinding()).createProjectionLayer(o),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),y=new eP(h.textureWidth,h.textureHeight,{format:1023,type:1009,depthTexture:new r_(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,s
2025-12-12 14:16:21 -08:00
$ { r }
$ { this . line ( "});" ) } ` }{let t=e.name.name;this.currentFunction=t.toLowerCase();let n=this.functionBody(e.body,e.params);return this.currentFunction=null, ` $ { this . line ( ` ${ this . runtime } .registerFunction( ${ JSON . stringify ( t ) } , function() { ` ) }
$ { n }
$ { this . line ( "});" ) } ` }}functionBody(e,t){this.indentLevel++;let n=[];n.push(this.line( ` const $ { this . locals } = $ { this . runtime } . locals ( ) ; ` ));for(let e=0;e<t.length;e++)n.push(this.line( ` $ { this . locals } . set ( $ { JSON . stringify ( t [ e ] . name ) } , arguments [ $ { e } ] ) ; ` ));for(let t of e.body)n.push(this.statement(t));return this.indentLevel--,n.join(" \n ")}packageDeclaration(e){let t=JSON.stringify(e.name.name);this.indentLevel++;let n=e.body.map(e=>this.statement(e)).join(" \n \n ");return this.indentLevel--, ` $ { this . line ( ` ${ this . runtime } .package( ${ t } , function() { ` ) }
$ { n }
$ { this . line ( "});" ) } ` }datablockDeclaration(e){let t=JSON.stringify(e.className.name),n=e.instanceName?JSON.stringify(e.instanceName.name):"null",i=e.parent?JSON.stringify(e.parent.name):"null",r=this.objectBody(e.body);return this.line( ` $ { this . runtime } . datablock ( $ { t } , $ { n } , $ { i } , $ { r } ) ; ` )}objectDeclaration(e){let t="Identifier"===e.className.type?JSON.stringify(e.className.name):this.expression(e.className),n=null===e.instanceName?"null":"Identifier"===e.instanceName.type?JSON.stringify(e.instanceName.name):this.expression(e.instanceName),i=[],r=[];for(let t of e.body)"Assignment"===t.type?i.push(t):r.push(t);let a=this.objectBody(i);if(r.length>0){let e=r.map(e=>this.objectDeclaration(e)).join(", \n ");return ` $ { this . runtime } . create ( $ { t } , $ { n } , $ { a } , [
$ { e }
] ) ` }return ` $ { this . runtime } . create ( $ { t } , $ { n } , $ { a } ) ` }objectBody(e){if(0===e.length)return"{}";let t=[];for(let n of e)if("Assignment"===n.type){let e=this.expression(n.value);if("Identifier"===n.target.type){let i=n.target.name;/^[a-zA-Z_][a-zA-Z0-9_]* $ /.test(i)?t.push( ` $ { i } : $ { e } ` ):t.push( ` [ $ { JSON . stringify ( i ) } ] : $ { e } ` )}else if("IndexExpression"===n.target.type){let i=this.objectPropertyKey(n.target);t.push( ` [ $ { i } ] : $ { e } ` )}else{let i=this.expression(n.target);t.push( ` [ $ { i } ] : $ { e } ` )}}if(t.length<=1)return ` { $ { t . join ( ", " ) } } ` ;let n=this.indent.repeat(this.indentLevel+1),i=this.indent.repeat(this.indentLevel);return ` {
$ { n } $ { t . join ( ",\n" + n ) }
$ { i } } ` }objectPropertyKey(e){let t="Identifier"===e.object.type?JSON.stringify(e.object.name):this.expression(e.object),n=Array.isArray(e.index)?e.index.map(e=>this.expression(e)).join(", "):this.expression(e.index);return ` $ { this . runtime } . key ( $ { t } , $ { n } ) ` }ifStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.consequent);if(e.alternate)if("IfStatement"===e.alternate.type){let i=this.ifStatement(e.alternate).replace(/^ \s */,"");return this.line( ` if ( $ { t } ) $ { n } else $ { i } ` )}else{let i=this.statementAsBlock(e.alternate);return this.line( ` if ( $ { t } ) $ { n } else $ { i } ` )}return this.line( ` if ( $ { t } ) $ { n } ` )}forStatement(e){let t=e.init?this.expression(e.init):"",n=e.test?this.expression(e.test):"",i=e.update?this.expression(e.update):"",r=this.statementAsBlock(e.body);return this.line( ` for ( $ { t } ; $ { n } ; $ { i } ) $ { r } ` )}whileStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.body);return this.line( ` while ( $ { t } ) $ { n } ` )}doWhileStatement(e){let t=this.statementAsBlock(e.body),n=this.expression(e.test);return this.line( ` do $ { t } while ( $ { n } ) ; ` )}switchStatement(e){if(e.stringMode)return this.switchStringStatement(e);let t=this.expression(e.discriminant);this.indentLevel++;let n=[];for(let t of e.cases)n.push(this.switchCase(t));return this.indentLevel--, ` $ { this . line ( ` switch ( ${ t } ) { ` ) }
$ { n . join ( "\n" ) }
$ { this . line ( "}" ) } ` }switchCase(e){let t=[];if(null===e.test)t.push(this.line("default:"));else if(Array.isArray(e.test))for(let n of e.test)t.push(this.line( ` case $ { this . expression ( n ) } : ` ));else t.push(this.line( ` case $ { this . expression ( e . test ) } : ` ));for(let n of(this.indentLevel++,e.consequent))t.push(this.statement(n));return t.push(this.line("break;")),this.indentLevel--,t.join(" \n ")}switchStringStatement(e){let t=this.expression(e.discriminant),n=[];for(let t of e.cases)if(null===t.test)n.push( ` default : ( ) => { $ { this . blockContent ( t . consequent ) } } ` );else if(Array.isArray(t.test))for(let e of t.test)n.push( ` $ { this . expression ( e ) } : ( ) => { $ { this . blockContent ( t . consequent ) } } ` );else n.push( ` $ { this . expression ( t . test ) } : ( ) => { $ { this . blockContent ( t . consequent ) } } ` );return this.line( ` $ { this . runtime } . switchStr ( $ { t } , { $ { n . join ( ", " ) } } ) ; ` )}returnStatement(e){return e.value?this.line( ` return $ { this . expression ( e . value ) } ; ` ):this.line("return;")}blockStatement(e){this.indentLevel++;let t=e.body.map(e=>this.statement(e)).join(" \n ");return this.indentLevel--, ` {
$ { t }
$ { this . line ( "}" ) } ` }statementAsBlock(e){if("BlockStatement"===e.type)return this.blockStatement(e);this.indentLevel++;let t=this.statement(e);return this.indentLevel--, ` {
$ { t }
2026-02-12 12:04:26 -08:00
$ { this . line ( "}" ) } ` }blockContent(e){return e.map(e=>this.statement(e).trim()).join(" ")}expression(e){switch(e.type){case"Identifier":return this.identifier(e);case"Variable":return this.variable(e);case"NumberLiteral":case"BooleanLiteral":return String(e.value);case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":return this.binaryExpression(e);case"UnaryExpression":return this.unaryExpression(e);case"PostfixExpression":return this.postfixExpression(e);case"AssignmentExpression":return this.assignmentExpression(e);case"ConditionalExpression":return ` ( $ { this . expression ( e . test ) } ? $ { this . expression ( e . consequent ) } : $ { this . expression ( e . alternate ) } ) ` ;case"CallExpression":return this.callExpression(e);case"MemberExpression":return this.memberExpression(e);case"IndexExpression":return this.indexExpression(e);case"TagDereferenceExpression":return ` $ { this . runtime } . deref ( $ { this . expression ( e . argument ) } ) ` ;case"ObjectDeclaration":return this.objectDeclaration(e);case"DatablockDeclaration":return ` $ { this . runtime } . datablock ( $ { JSON . stringify ( e . className . name ) } , $ { e . instanceName ? JSON . stringify ( e . instanceName . name ) : "null" } , $ { e . parent ? JSON . stringify ( e . parent . name ) : "null" } , $ { this . objectBody ( e . body ) } ) ` ;default:throw Error( ` Unknown expression type : $ { e . type } ` )}}identifier(e){let t=i(e.name);return t&&"parent"===t.namespace.toLowerCase()?e.name:t? ` $ { this . runtime } . nsRef ( $ { JSON . stringify ( t . namespace ) } , $ { JSON . stringify ( t . method ) } ) ` :JSON.stringify(e.name)}variable(e){return"global"===e.scope? ` $ { this . globals } . get ( $ { JSON . stringify ( e . name ) } ) ` : ` $ { this . locals } . get ( $ { JSON . stringify ( e . name ) } ) ` }binaryExpression(e){let t=this.expression(e.left),n=this.expression(e.right),i=e.operator,a=this.concatExpression(t,i,n);if(a)return a;if(" $ ="===i)return ` $ { this . runtime } . streq ( $ { t } , $ { n } ) ` ;if("! $ ="===i)return ` ! $ { this . runtime } . streq ( $ { t } , $ { n } ) ` ;if("&&"===i||"||"===i)return ` ( $ { t } $ { i } $ { n } ) ` ;let s=r[i];return s? ` $ { s } ( $ { t } , $ { n } ) ` : ` ( $ { t } $ { i } $ { n } ) ` }unaryExpression(e){if("++"===e.operator||"--"===e.operator){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?1:-1;return t.setter( ` $ { this . runtime } . add ( $ { t . getter } , $ { n } ) ` )}}let t=this.expression(e.argument);return"~"===e.operator? ` $ { this . runtime } . bitnot ( $ { t } ) ` :"-"===e.operator? ` $ { this . runtime } . neg ( $ { t } ) ` : ` $ { e . operator } $ { t } ` }postfixExpression(e){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?t.postIncHelper:t.postDecHelper;if(n)return n}return ` $ { this . expression ( e . argument ) } $ { e . operator } ` }assignmentExpression(e){let t=this.expression(e.value),n=e.operator,i=this.getAccessInfo(e.target);if(!i)throw Error( ` Unhandled assignment target type : $ { e . target . type } ` );if("="===n)return i.setter(t);{let e=n.slice(0,-1),r=this.compoundAssignmentValue(i.getter,e,t);return i.setter(r)}}callExpression(e){let t=e.arguments.map(e=>this.expression(e)).join(", ");if("Identifier"===e.callee.type){let n=e.callee.name,r=i(n);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return ` $ { this . runtime } . parent ( $ { JSON . stringify ( this . currentClass ) } , $ { JSON . stringify ( r . method ) } , arguments [ 0 ] $ { t ? ", " + t : "" } ) ` ;else if(this.currentFunction)return ` $ { this . runtime } . parentFunc ( $ { JSON . stringify ( this . currentFunction ) } $ { t ? ", " + t : "" } ) ` ;else throw Error("Parent:: call outside of function context");return r? ` $ { this . runtime } . nsCall ( $ { JSON . stringify ( r . namespace ) } , $ { JSON . stringify ( r . method ) } $ { t ? ", " + t : "" } ) ` : ` $ { this . functions } . call ( $ { JSON . stringify ( n ) } $ { t ? ", " + t : "" } ) ` }if("MemberExpression"===e.callee.type){let n=this.expression(e.callee.object),i="Identifier"===e.callee.property.type?JSON.stringify(e.callee.property.name):this.expression(e.callee.property);return ` $ { this . runtime } . call ( $ { n } , $ { i } $ { t ? ", " + t : "" } ) ` }let n=this.expression(e.callee);return ` $ { n } ( $ { t } ) ` }memberExpression(e){let t=this.expression(e.object);return e.computed||"Identifier"!==e.property.type? ` $ { this . runtime } . prop ( $ { t } , $ { this . expression ( e . property ) } ) ` : ` $ { this . runtime } . prop ( $ { t } , $ { JSON . stringify ( e . property . name ) } ) ` }indexExpression(e){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Vari