2026-03-09 22:33:09 +01:00
( function ( ) { const e = document . createElement ( "link" ) . relList ; if ( e && e . supports && e . supports ( "modulepreload" ) ) return ; for ( const r of document . querySelectorAll ( 'link[rel="modulepreload"]' ) ) n ( r ) ; new MutationObserver ( r => { for ( const s of r ) if ( s . type === "childList" ) for ( const a of s . addedNodes ) a . tagName === "LINK" && a . rel === "modulepreload" && n ( a ) } ) . observe ( document , { childList : ! 0 , subtree : ! 0 } ) ; function t ( r ) { const s = { } ; return r . integrity && ( s . integrity = r . integrity ) , r . referrerPolicy && ( s . referrerPolicy = r . referrerPolicy ) , r . crossOrigin === "use-credentials" ? s . credentials = "include" : r . crossOrigin === "anonymous" ? s . credentials = "omit" : s . credentials = "same-origin" , s } function n ( r ) { if ( r . ep ) return ; r . ep = ! 0 ; const s = t ( r ) ; fetch ( r . href , s ) } } ) ( ) ; function E7 ( i ) { return i && i . _ _esModule && Object . prototype . hasOwnProperty . call ( i , "default" ) ? i . default : i } var Xb = { exports : { } } , jp = { } ; / * *
* @ license React
* react - jsx - runtime . production . js
*
* Copyright ( c ) Meta Platforms , Inc . and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* /var F8;function CF(){if(F8)return jp;F8=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,s){var a=null;if(s!==void 0&&(a=""+s),r.key!==void 0&&(a=""+r.key),"key"in r){s={};for(var l in r)l!=="key"&&(s[l]=r[l])}else s=r;return r=s.ref,{$$typeof:i,type:n,key:a,ref:r!==void 0?r:null,props:s}}return jp.Fragment=e,jp.jsx=t,jp.jsxs=t,jp}var k8;function NF(){return k8||(k8=1,Xb.exports=CF()),Xb.exports}var P=NF(),Yb={exports:{}},Hp={},Qb={exports:{}},Kb={};/ * *
* @ license React
* scheduler . production . js
*
* Copyright ( c ) Meta Platforms , Inc . and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2026-03-09 22:42:36 +01:00
* / v a r z 8 ; f u n c t i o n R F ( ) { r e t u r n z 8 | | ( z 8 = 1 , ( f u n c t i o n ( i ) { f u n c t i o n e ( Z , n e ) { v a r d e = Z . l e n g t h ; Z . p u s h ( n e ) ; e : f o r ( ; 0 < d e ; ) { v a r b e = d e - 1 > > > 1 , T e = Z [ b e ] ; i f ( 0 < r ( T e , n e ) ) Z [ b e ] = n e , Z [ d e ] = T e , d e = b e ; e l s e b r e a k e } } f u n c t i o n t ( Z ) { r e t u r n Z . l e n g t h = = = 0 ? n u l l : Z [ 0 ] } f u n c t i o n n ( Z ) { i f ( Z . l e n g t h = = = 0 ) r e t u r n n u l l ; v a r n e = Z [ 0 ] , d e = Z . p o p ( ) ; i f ( d e ! = = n e ) { Z [ 0 ] = d e ; e : f o r ( v a r b e = 0 , T e = Z . l e n g t h , a e = T e > > > 1 ; b e < a e ; ) { v a r M e = 2 * ( b e + 1 ) - 1 , V e = Z [ M e ] , C e = M e + 1 , F e = Z [ C e ] ; i f ( 0 > r ( V e , d e ) ) C e < T e & & 0 > r ( F e , V e ) ? ( Z [ b e ] = F e , Z [ C e ] = d e , b e = C e ) : ( Z [ b e ] = V e , Z [ M e ] = d e , b e = M e ) ; e l s e i f ( C e < T e & & 0 > r ( F e , d e ) ) Z [ b e ] = F e , Z [ C e ] = d e , b e = C e ; e l s e b r e a k e } } r e t u r n n e } f u n c t i o n r ( Z , n e ) { v a r d e = Z . s o r t I n d e x - n e . s o r t I n d e x ; r e t u r n d e ! = = 0 ? d e : Z . i d - n e . i d } i f ( i . u n s t a b l e _ n o w = v o i d 0 , t y p e o f p e r f o r m a n c e = = " o b j e c t " & & t y p e o f p e r f o r m a n c e . n o w = = " f u n c t i o n " ) { v a r s = p e r f o r m a n c e ; i . u n s t a b l e _ n o w = f u n c t i o n ( ) { r e t u r n s . n o w ( ) } } e l s e { v a r a = D a t e , l = a . n o w ( ) ; i . u n s t a b l e _ n o w = f u n c t i o n ( ) { r e t u r n a . n o w ( ) - l } } v a r u = [ ] , h = [ ] , m = 1 , v = n u l l , x = 3 , S = ! 1 , T = ! 1 , N = ! 1 , C = ! 1 , E = t y p e o f s e t T i m e o u t = = " f u n c t i o n " ? s e t T i m e o u t : n u l l , O = t y p e o f c l e a r T i m e o u t = = " f u n c t i o n " ? c l e a r T i m e o u t : n u l l , U = t y p e o f s e t I m m e d i a t e < " u " ? s e t I m m e d i a t e : n u l l ; f u n c t i o n I ( Z ) { f o r ( v a r n e = t ( h ) ; n e ! = = n u l l ; ) { i f ( n e . c a l l b a c k = = = n u l l ) n ( h ) ; e l s e i f ( n e . s t a r t T i m e < = Z ) n ( h ) , n e . s o r t I n d e x = n e . e x p i r a t i o n T i m e , e ( u , n e ) ; e l s e b r e a k ; n e = t ( h ) } } f u n c t i o n j ( Z ) { i f ( N = ! 1 , I ( Z ) , ! T ) i f ( t ( u ) ! = = n u l l ) T = ! 0 , z | | ( z = ! 0 , J ( ) ) ; e l s e { v a r n e = t ( h ) ; n e ! = = n u l l & & r e ( j , n e . s t a r t T i m e - Z ) } } v a r z = ! 1 , G = - 1 , H = 5 , q = - 1 ; f u n c t i o n V ( ) { r e t u r n C ? ! 0 : ! ( i . u n s t a b l e _ n o w ( ) - q < H ) } f u n c t i o n Q ( ) { i f ( C = ! 1 , z ) { v a r Z = i . u n s t a b l e _ n o w ( ) ; q = Z ; v a r n e = ! 0 ; t r y { e : { T = ! 1 , N & & ( N = ! 1 , O ( G ) , G = - 1 ) , S = ! 0 ; v a r d e = x ; t r y { t : { f o r ( I ( Z ) , v = t ( u ) ; v ! = = n u l l & & ! ( v . e x p i r a t i o n T i m e > Z & & V ( ) ) ; ) { v a r b e = v . c a l l b a c k ; i f ( t y p e o f b e = = " f u n c t i o n " ) { v . c a l l b a c k = n u l l , x = v . p r i o r i t y L e v e l ; v a r T e = b e ( v . e x p i r a t i o n T i m e < = Z ) ; i f ( Z = i . u n s t a b l e _ n o w ( ) , t y p e o f T e = = " f u n c t i o n " ) { v . c a l l b a c k = T e , I ( Z ) , n e = ! 0 ; b r e a k t } v = = = t ( u ) & & n ( u ) , I ( Z ) } e l s e n ( u ) ; v = t ( u ) } i f ( v ! = = n u l l ) n e = ! 0 ; e l s e { v a r a e = t ( h ) ; a e ! = = n u l l & & r e ( j , a e . s t a r t T i m e - Z ) , n e = ! 1 } } b r e a k e } f i n a l l y { v = n u l l , x = d e , S = ! 1 } n e = v o i d 0 } } f i n a l l y { n e ? J ( ) : z = ! 1 } } } v a r J ; i f ( t y p e o f U = = " f u n c t i o n " ) J = f u n c t i o n ( ) { U ( Q ) } ; e l s e i f ( t y p e o f M e s s a g e C h a n n e l < " u " ) { v a r i e = n e w M e s s a g e C h a n n e l , l e = i e . p o r t 2 ; i e . p o r t 1 . o n m e s s a g e = Q , J = f u n c t i o n ( ) { l e . p o s t M e s s a g e ( n u l l ) } } e l s e J = f u n c t i o n ( ) { E ( Q , 0 ) } ; f u n c t i o n r e ( Z , n e ) { G = E ( f u n c t i o n ( ) { Z ( i . u n s t a b l e _ n o w ( ) ) } , n e ) } i . u n s t a b l e _ I d l e P r i o r i t y = 5 , i . u n s t a b l e _ I m m e d i a t e P r i o r i t y = 1 , i . u n s t a b l e _ L o w P r i o r i t y = 4 , i . u n s t a b l e _ N o r m a l P r i o r i t y = 3 , i . u n s t a b l e _ P r o f i l i n g = n u l l , i . u n s t a b l e _ U s e r B l o c k i n g P r i o r i t y = 2 , i . u n s t a b l e _ c a n c e l C a l l b a c k = f u n c t i o n ( Z ) { Z . c a l l b a c k = n u l l } , i . u n s t a b l e _ f o r c e F r a m e R a t e = f u n c t i o n ( Z ) { 0 > Z | | 1 2 5 < Z ? c o n s o l e . e r r o r ( " f o r c e F r a m e R a t e t a k e s a p o s i t i v e i n t b e t w e e n 0 a n d 1 2 5 , f o r c i n g f r a m e r a t e s h i g h e r t h a n 1 2 5 f p s i s n o t s u p p o r t e d " ) : H = 0 < Z ? M a t h . f l o o r ( 1 e 3 / Z ) : 5 } , i . u n s t a b l e _ g e t C u r r e n t P r i o r i t y L e v e l = f u n c t i o n ( ) { r e t u r n x } , i . u n s t a b l e _ n e x t = f u n c t i o n ( Z ) { s w i t c h ( x ) { c a s e 1 : c a s e 2 : c a s e 3 : v a r n e = 3 ; b r e a k ; d e f a u l t : n e = x } v a r d e = x ; x = n e ; t r y { r e t u r n Z ( ) } f i n a l l y { x = d e } } , i . u n s t a b l e _ r e q u e s t P a i n t = f u n c t i o n ( ) { C = ! 0 } , i . u n s t a b l e _ r u n W i t h P r i o r i t y = f u n c t i o n ( Z , n e ) { s w i t c h ( Z ) { c a s e 1 : c a s e 2 : c a s e 3 : c a s e 4 : c a s e 5 : b r e a k ; d e f a u l t : Z = 3 } v a r d e = x ; x = Z ; t r y { r e t u r n n e ( ) } f i n a l l y { x = d e } } , i . u n s t a b l e _ s c h e d u l e C a l l b a c k = f u n c t i o n ( Z , n e , d e ) { v a r b e = i . u n s t a b l e _ n o w ( ) ; s w i t c h ( t y p e o f d e = = " o b j e c t " & & d e ! = = n u l l ? ( d e = d e . d e l a y , d e = t y p e o f d e = = " n u m b e r " & & 0 < d e ? b e + d e : b e ) : d e = b e , Z ) { c a s e 1 : v a r T e = - 1 ; b r e a k ; c a s e 2 : T e = 2 5 0 ; b r e a k ; c a s e 5 : T e = 1 0 7 3 7 4 1 8 2 3 ; b r e a k ; c a s e 4 : T e = 1 e 4 ; b r e a k ; d e f a u l t : T e = 5 e 3 } r e t u r n T e = d e + T e , Z = { i d : m + + , c a l l b a c k : n e , p r i o r i t y L e v e l : Z , s t a r t T i m e : d e , e x p i r a t i o n T i m e : T e , s o r t I n d e x : - 1 } , d e > b e ? ( Z . s o r t I n d e x = d e , e ( h , Z ) , t ( u ) = = = n u l l & & Z = = = t ( h ) & & ( N ? ( O ( G ) , G = - 1 ) : N = ! 0 , r e ( j , d e - b e ) ) ) : ( Z . s o r t I n d e x = T e , e ( u , Z ) , T | | S | | ( T = ! 0 , z | | ( z = ! 0 , J ( ) ) ) ) , Z } , i . u n s t a b l e _ s h o u l d Y i e l d = V , i . u n s t a b l e _ w r a p C a l l b a c k = f u n c t i o n ( Z ) { v a r n e = x ; r e t u r n f u n c t i o n ( ) { v a r d e = x ; x = n e ; t r y { r e t u r n Z . a p p l y ( t h i s , a r g u m e n t s ) } f i n a l l y { x = d e } } } } ) ( K b ) ) , K b } v a r G 8 ; f u n c t i o n D F ( ) { r e t u r n G 8 | | ( G 8 = 1 , Q b . e x p o r t s = R F ( ) ) , Q b . e x p o r t s } v a r Z b = { e x p o r t s : { } } , t i = { } ; / * *
2026-03-09 22:33:09 +01:00
* @ license React
* react . production . js
*
* Copyright ( c ) Meta Platforms , Inc . and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2026-03-09 22:42:36 +01:00
* /var q8;function PF(){if(q8)return ti;q8=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function S(ae){return ae===null||typeof ae!="object"?null:(ae=x&&ae[x]||ae["@@iterator"],typeof ae=="function"?ae:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function E(ae,Me,Ve){this.props=ae,this.context=Me,this.refs=C,this.updater=Ve||T}E.prototype.isReactComponent={},E.prototype.setState=function(ae,Me){if(typeof ae!="object"&&typeof ae!="function"&&ae!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,ae,Me,"setState")},E.prototype.forceUpdate=function(ae){this.updater.enqueueForceUpdate(this,ae,"forceUpdate")};function O(){}O.prototype=E.prototype;function U(ae,Me,Ve){this.props=ae,this.context=Me,this.refs=C,this.updater=Ve||T}var I=U.prototype=new O;I.constructor=U,N(I,E.prototype),I.isPureReactComponent=!0;var j=Array.isArray;function z(){}var G={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function q(ae,Me,Ve){var Ce=Ve.ref;return{$$typeof:i,type:ae,key:Me,ref:Ce!==void 0?Ce:null,props:Ve}}function V(ae,Me){return q(ae.type,Me,ae.props)}function Q(ae){return typeof ae=="object"&&ae!==null&&ae.$$typeof===i}function J(ae){var Me={"=":"=0",":":"=2"};return"$"+ae.replace(/ [ = : ] / g , function ( Ve ) { return Me [ Ve ] } ) } var ie = /\/+/g ; function le ( ae , Me ) { return typeof ae == "object" && ae !== null && ae . key != null ? J ( "" + ae . key ) : Me . toString ( 36 ) } function re ( ae ) { switch ( ae . status ) { case "fulfilled" : return ae . value ; case "rejected" : throw ae . reason ; default : switch ( typeof ae . status == "string" ? ae . then ( z , z ) : ( ae . status = "pending" , ae . then ( function ( Me ) { ae . status === "pending" && ( ae . status = "fulfilled" , ae . value = Me ) } , function ( Me ) { ae . status === "pending" && ( ae . status = "rejected" , ae . reason = Me ) } ) ) , ae . status ) { case "fulfilled" : return ae . value ; case "rejected" : throw ae . reason } } throw ae } function Z ( ae , Me , Ve , Ce , Fe ) { var tt = typeof ae ; ( tt === "undefined" || tt === "boolean" ) && ( ae = null ) ; var je = ! 1 ; if ( ae === null ) je = ! 0 ; else switch ( tt ) { case "bigint" : case "string" : case "number" : je = ! 0 ; break ; case "object" : switch ( ae . $$typeof ) { case i : case e : je = ! 0 ; break ; case m : return je = ae . _init , Z ( je ( ae . _payload ) , Me , Ve , Ce , Fe ) } } if ( je ) return Fe = Fe ( ae ) , je = Ce === "" ? "." + le ( ae , 0 ) : Ce , j ( Fe ) ? ( Ve = "" , je != null && ( Ve = je . replace ( ie , "$&/" ) + "/" ) , Z ( Fe , Me , Ve , "" , function ( Ft ) { return Ft } ) ) : Fe != null && ( Q ( Fe ) && ( Fe = V ( Fe , Ve + ( Fe . key == null || ae && ae . key === Fe . key ? "" : ( "" + Fe . key ) . replace ( ie , "$&/" ) + "/" ) + je ) ) , Me . push ( Fe ) ) , 1 ; je = 0 ; var Rt = Ce === "" ? "." : Ce + ":" ; if ( j ( ae ) ) for ( var Et = 0 ; Et < ae . length ; Et ++ ) Ce = ae [ Et ] , tt = Rt + le ( Ce , Et ) , je += Z ( Ce , Me , Ve , tt , Fe ) ; else if ( Et = S ( ae ) , typeof Et == "function" ) for ( ae = Et . call ( ae ) , Et = 0 ; ! ( Ce = ae . next ( ) ) . done ; ) Ce = Ce . value , tt = Rt + le ( Ce , Et ++ ) , je += Z ( Ce , Me , Ve , tt , Fe ) ; else if ( tt === "object" ) { if ( typeof ae . then == "function" ) return Z ( re ( ae ) , Me , Ve , Ce , Fe ) ; throw Me = String ( ae ) , Error ( "Objects are not valid as a React child (found: " + ( Me === "[object Object]" ? "object with keys {" + Object . keys ( ae ) . join ( ", " ) + "}" : Me ) + "). If you meant to render a collection of children, use an array instead." ) } return je } function ne ( ae , Me , Ve ) { if ( ae == null ) return ae ; var Ce = [ ] , Fe = 0 ; return Z ( ae , Ce , "" , "" , function ( tt ) { return Me . call ( Ve , tt , Fe ++ ) } ) , Ce } function de ( ae ) { if ( ae . _status === - 1 ) { var Me = ae . _result ; Me = Me ( ) , Me . then ( function ( Ve ) { ( ae . _status === 0 || ae . _status === - 1 ) && ( ae . _status = 1 , ae . _result = Ve ) } , function ( Ve ) { ( ae . _status === 0 || ae . _status === - 1 ) && ( ae . _status = 2 , ae . _result = Ve ) } ) , ae . _status === - 1 && ( ae . _status = 0 , ae . _result = Me ) } if ( ae . _status === 1 ) return ae . _result . default ; throw ae . _result } var be = typeof reportError == "function" ? reportError : function ( ae ) { if ( typeof window == "object" && typeof window . ErrorEvent == "function" ) { var Me = new w
2026-03-09 22:33:09 +01:00
* @ license React
* react - dom . production . js
*
* Copyright ( c ) Meta Platforms , Inc . and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* /var j8;function LF(){if(j8)return Qs;j8=1;var i=bT();function e(u){var h="https:/ / react . dev / errors / "+u;if(1<arguments.length){h+=" ? args [ ] = "+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)h+=" & args [ ] = "+encodeURIComponent(arguments[m])}return" Minified React error # "+u+" ; visit "+h+" for the full message or use the non - minified dev environment for full errors and additional helpful warnings . "}function t(){}var n={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},r=Symbol.for(" react . portal ");function s(u,h,m){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:v==null?null:" "+v,children:u,containerInfo:h,implementation:m}}var a=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,h){if(u===" font ")return" ";if(typeof h==" string ")return h===" use - credentials "?h:" "}return Qs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Qs.createPortal=function(u,h){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return s(u,h,null,m)},Qs.flushSync=function(u){var h=a.T,m=n.p;try{if(a.T=null,n.p=2,u)return u()}finally{a.T=h,n.p=m,n.d.f()}},Qs.preconnect=function(u,h){typeof u==" string "&&(h?(h=h.crossOrigin,h=typeof h==" string "?h===" use - credentials "?h:" ":void 0):h=null,n.d.C(u,h))},Qs.prefetchDNS=function(u){typeof u==" string "&&n.d.D(u)},Qs.preinit=function(u,h){if(typeof u==" string "&&h&&typeof h.as==" string "){var m=h.as,v=l(m,h.crossOrigin),x=typeof h.integrity==" string "?h.integrity:void 0,S=typeof h.fetchPriority==" string "?h.fetchPriority:void 0;m===" style "?n.d.S(u,typeof h.precedence==" string "?h.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:S}):m===" script "&&n.d.X(u,{crossOrigin:v,integrity:x,fetchPriority:S,nonce:typeof h.nonce==" string "?h.nonce:void 0})}},Qs.preinitModule=function(u,h){if(typeof u==" string ")if(typeof h==" object "&&h!==null){if(h.as==null||h.as===" script "){var m=l(h.as,h.crossOrigin);n.d.M(u,{crossOrigin:m,integrity:typeof h.integrity==" string "?h.integrity:void 0,nonce:typeof h.nonce==" string "?h.nonce:void 0})}}else h==null&&n.d.M(u)},Qs.preload=function(u,h){if(typeof u==" string "&&typeof h==" object "&&h!==null&&typeof h.as==" string "){var m=h.as,v=l(m,h.crossOrigin);n.d.L(u,m,{crossOrigin:v,integrity:typeof h.integrity==" string "?h.integrity:void 0,nonce:typeof h.nonce==" string "?h.nonce:void 0,type:typeof h.type==" string "?h.type:void 0,fetchPriority:typeof h.fetchPriority==" string "?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy==" string "?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet==" string "?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes==" string "?h.imageSizes:void 0,media:typeof h.media==" string "?h.media:void 0})}},Qs.preloadModule=function(u,h){if(typeof u==" string ")if(h){var m=l(h.as,h.crossOrigin);n.d.m(u,{as:typeof h.as==" string "&&h.as!==" script "?h.as:void 0,crossOrigin:m,integrity:typeof h.integrity==" string "?h.integrity:void 0})}else n.d.m(u)},Qs.requestFormReset=function(u){n.d.r(u)},Qs.unstable_batchedUpdates=function(u,h){return u(h)},Qs.useFormState=function(u,h,m){return a.H.useFormState(u,h,m)},Qs.useFormStatus=function(){return a.H.useHostTransitionStatus()},Qs.version=" 19.2 . 4 ",Qs}var H8;function UF(){if(H8)return Jb.exports;H8=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>" u "||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=" function " ) ) try { _ _REACT _DEVTOOLS _GLOBAL _HOOK _ _ . checkDCE ( i ) } catch ( e ) { console . error ( e ) } } return i ( ) , Jb . exports = LF ( ) , Jb . exports } / * *
* @ license React
* react - dom - client . production . js
*
* Copyright ( c ) Meta Platforms , Inc . and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2026-03-09 22:42:36 +01:00
* /var W8;function BF(){if(W8)return Hp;W8=1;var i=DF(),e=bT(),t=UF();function n(o){var c="https:/ / react . dev / errors / "+o;if(1<arguments.length){c+=" ? args [ ] = "+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)c+=" & args [ ] = "+encodeURIComponent(arguments[g])}return" Minified React error # "+o+" ; visit "+c+" for the full message or use the non - minified dev environment for full errors and additional helpful warnings . "}function r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var c=o,g=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(g=c.return),o=c.return;while(o)}return c.tag===3?g:null}function a(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function l(o){if(o.tag===31){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function u(o){if(s(o)!==o)throw Error(n(188))}function h(o){var c=o.alternate;if(!c){if(c=s(o),c===null)throw Error(n(188));return c!==o?null:o}for(var g=o,b=c;;){var D=g.return;if(D===null)break;var L=D.alternate;if(L===null){if(b=D.return,b!==null){g=b;continue}break}if(D.child===L.child){for(L=D.child;L;){if(L===g)return u(D),o;if(L===b)return u(D),c;L=L.sibling}throw Error(n(188))}if(g.return!==b.return)g=D,b=L;else{for(var Y=!1,ue=D.child;ue;){if(ue===g){Y=!0,g=D,b=L;break}if(ue===b){Y=!0,b=D,g=L;break}ue=ue.sibling}if(!Y){for(ue=L.child;ue;){if(ue===g){Y=!0,g=L,b=D;break}if(ue===b){Y=!0,b=L,g=D;break}ue=ue.sibling}if(!Y)throw Error(n(189))}}if(g.alternate!==b)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?o:c}function m(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=m(o),c!==null)return c;o=o.sibling}return null}var v=Object.assign,x=Symbol.for(" react . element "),S=Symbol.for(" react . transitional . element "),T=Symbol.for(" react . portal "),N=Symbol.for(" react . fragment "),C=Symbol.for(" react . strict _mode "),E=Symbol.for(" react . profiler "),O=Symbol.for(" react . consumer "),U=Symbol.for(" react . context "),I=Symbol.for(" react . forward _ref "),j=Symbol.for(" react . suspense "),z=Symbol.for(" react . suspense _list "),G=Symbol.for(" react . memo "),H=Symbol.for(" react . lazy "),q=Symbol.for(" react . activity "),V=Symbol.for(" react . memo _cache _sentinel "),Q=Symbol.iterator;function J(o){return o===null||typeof o!=" object "?null:(o=Q&&o[Q]||o[" @ @ iterator "],typeof o==" function "?o:null)}var ie=Symbol.for(" react . client . reference ");function le(o){if(o==null)return null;if(typeof o==" function ")return o.$$typeof===ie?null:o.displayName||o.name||null;if(typeof o==" string ")return o;switch(o){case N:return" Fragment ";case E:return" Profiler ";case C:return" StrictMode ";case j:return" Suspense ";case z:return" SuspenseList ";case q:return" Activity "}if(typeof o==" object ")switch(o.$$typeof){case T:return" Portal ";case U:return o.displayName||" Context ";case O:return(o._context.displayName||" Context ")+" . Consumer ";case I:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||" ",o=o!==" "?" ForwardRef ( "+o+" ) ":" ForwardRef "),o;case G:return c=o.displayName||null,c!==null?c:le(o.type)||" Memo ";case H:c=o._payload,o=o._init;try{return le(o(c))}catch{}}return null}var re=Array.isArray,Z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},be=[],Te=-1;function ae(o){return{current:o}}function Me(o){0>Te||(o.current=be[Te],be[Te]=null,Te--)}function Ve(o,c){Te++,be[Te]=o.current,o.current=c}var Ce=ae(null),Fe=ae(null),tt=ae(null),je=ae(null);function Rt(o,c){switch(Ve(tt,c),Ve(Fe,o),Ve(Ce,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?o8(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=o8(c),o=l8(c,o);else switch(o){case" svg ":o=1;break;case" math " : o = 2 ; break ; default : o = 0 } } Me ( Ce ) , Ve ( Ce , o ) } function Et ( ) { Me ( Ce ) , Me ( Fe ) , Me ( tt ) } function Ft ( o ) { o . memoizedState !== null && Ve ( je , o ) ; var c = Ce . current , g = l8 ( c , o . type ) ; c !=
2026-03-09 22:33:09 +01:00
at ` )?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return `
2026-03-09 22:42:36 +01:00
` +Ke+o+ht}var $ t=!1;function _t(o,c){if(!o|| $ t)return""; $ t=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(c){var Nt=function(){throw Error()};if(Object.defineProperty(Nt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Nt,[])}catch(ft){var ut=ft}Reflect.construct(o,[],Nt)}else{try{Nt.call()}catch(ft){ut=ft}o.call(Nt.prototype)}}else{try{throw Error()}catch(ft){ut=ft}(Nt=o())&&typeof Nt.catch=="function"&&Nt.catch(function(){})}}catch(ft){if(ft&&ut&&typeof ft.stack=="string")return[ft.stack,ut.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var D=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");D&&D.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var L=b.DetermineComponentFrameRoot(),Y=L[0],ue=L[1];if(Y&&ue){var Ne=Y.split( `
2026-03-09 22:33:09 +01:00
` ),at=ue.split( `
2026-03-09 22:42:36 +01:00
` );for(D=b=0;b<Ne.length&&!Ne[b].includes("DetermineComponentFrameRoot");)b++;for(;D<at.length&&!at[D].includes("DetermineComponentFrameRoot");)D++;if(b===Ne.length||D===at.length)for(b=Ne.length-1,D=at.length-1;1<=b&&0<=D&&Ne[b]!==at[D];)D--;for(;1<=b&&0<=D;b--,D--)if(Ne[b]!==at[D]){if(b!==1||D!==1)do if(b--,D--,0>D||Ne[b]!==at[D]){var vt= `
` +Ne[b].replace(" at new "," at ");return o.displayName&&vt.includes("<anonymous>")&&(vt=vt.replace("<anonymous>",o.displayName)),vt}while(1<=b&&0<=D);break}}}finally{ $ t=!1,Error.prepareStackTrace=g}return(g=o?o.displayName||o.name:"")?fe(g):""}function Gt(o,c){switch(o.tag){case 26:case 27:case 5:return fe(o.type);case 16:return fe("Lazy");case 13:return o.child!==c&&c!==null?fe("Suspense Fallback"):fe("Suspense");case 19:return fe("SuspenseList");case 0:case 15:return _t(o.type,!1);case 11:return _t(o.type.render,!1);case 1:return _t(o.type,!0);case 31:return fe("Activity");default:return""}}function yt(o){try{var c="",g=null;do c+=Gt(o,g),g=o,o=o.return;while(o);return c}catch(b){return `
2026-03-09 22:33:09 +01:00
Error generating stack : ` +b.message+ `
2026-03-09 22:42:36 +01:00
` +b.stack}}var Ht=Object.prototype.hasOwnProperty,pt=i.unstable_scheduleCallback,Ae=i.unstable_cancelCallback,k=i.unstable_shouldYield,xe=i.unstable_requestPaint,Oe=i.unstable_now,Ue=i.unstable_getCurrentPriorityLevel,ee=i.unstable_ImmediatePriority,we=i.unstable_UserBlockingPriority,Re=i.unstable_NormalPriority,We=i.unstable_LowPriority,Se=i.unstable_IdlePriority,Le=i.log,ct=i.unstable_setDisableYieldValue,Dt=null,It=null;function lt(o){if(typeof Le=="function"&&ct(o),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(Dt,o)}catch{}}var jt=Math.clz32?Math.clz32:me,Jt=Math.log,In=Math.LN2;function me(o){return o>>>=0,o===0?32:31-(Jt(o)/In|0)|0}var Bt=256,ot=262144,Tt=4194304;function Wt(o){var c=o&42;if(c!==0)return c;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Yt(o,c,g){var b=o.pendingLanes;if(b===0)return 0;var D=0,L=o.suspendedLanes,Y=o.pingedLanes;o=o.warmLanes;var ue=b&134217727;return ue!==0?(b=ue&~L,b!==0?D=Wt(b):(Y&=ue,Y!==0?D=Wt(Y):g||(g=ue&~o,g!==0&&(D=Wt(g))))):(ue=b&~L,ue!==0?D=Wt(ue):Y!==0?D=Wt(Y):g||(g=b&~o,g!==0&&(D=Wt(g)))),D===0?0:c!==0&&c!==D&&(c&L)===0&&(L=D&-D,g=c&-c,L>=g||L===32&&(g&4194048)!==0)?c:D}function pn(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function $ e(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function St(){var o=Tt;return Tt<<=1,(Tt&62914560)===0&&(Tt=4194304),o}function Kt(o){for(var c=[],g=0;31>g;g++)c.push(o);return c}function wn(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function qn(o,c,g,b,D,L){var Y=o.pendingLanes;o.pendingLanes=g,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=g,o.entangledLanes&=g,o.errorRecoveryDisabledLanes&=g,o.shellSuspendCounter=0;var ue=o.entanglements,Ne=o.expirationTimes,at=o.hiddenUpdates;for(g=Y&~g;0<g;){var vt=31-jt(g),Nt=1<<vt;ue[vt]=0,Ne[vt]=-1;var ut=at[vt];if(ut!==null)for(at[vt]=null,vt=0;vt<ut.length;vt++){var ft=ut[vt];ft!==null&&(ft.lane&=-536870913)}g&=~Nt}b!==0&&Je(o,b,0),L!==0&&D===0&&o.tag!==0&&(o.suspendedLanes|=L&~(Y&~c))}function Je(o,c,g){o.pendingLanes|=c,o.suspendedLanes&=~c;var b=31-jt(c);o.entangledLanes|=c,o.entanglements[b]=o.entanglements[b]|1073741824|g&261930}function dt(o,c){var g=o.entangledLanes|=c;for(o=o.entanglements;g;){var b=31-jt(g),D=1<<b;D&c|o[b]&c&&(o[b]|=c),g&=~D}}function Vt(o,c){var g=c&-c;return g=(g&42)!==0?1:xt(g),(g&(o.suspendedLanes|c))!==0?0:g}function xt(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function A(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function te(){var o=ne.p;return o!==0?o:(o=window.event,o===void 0?32:D8(o.type))}function Vn(o,c){var g=ne.p;try{return ne.p=o,c()}finally{ne.p=g}}var Wn=Math.random().toString(36).slice(2), $ n="__reactFiber $ "+Wn,dn="__reactProps $ "+Wn,Fn="__reactContainer $ "+Wn,lr="__reactEvents $ "+Wn,an="__reactListeners $ "+Wn,mn="__reactHandles $ "+Wn,Er="__reactResources $
` ).replace(QI,"")}function s8(o,c){return c=r8(c),r8(o)===c}function Xi(o,c,g,b,D,L){switch(g){case"children":typeof b=="string"?c==="body"||c==="textarea"&&b===""||xs(o,b):(typeof b=="number"||typeof b=="bigint")&&c!=="body"&&xs(o,""+b);break;case"className":xi(o,"class",b);break;case"tabIndex":xi(o,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":xi(o,g,b);break;case"style":i1(o,b,L);break;case"data":if(c!=="object"){xi(o,"data",b);break}case"src":case"href":if(b===""&&(c!=="a"||g!=="href")){o.removeAttribute(g);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){o.removeAttribute(g);break}b=qc(""+b),o.setAttribute(g,b);break;case"action":case"formAction":if(typeof b=="function"){o.setAttribute(g,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you \\ 're trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof L=="function"&&(g==="formAction"?(c!=="input"&&Xi(o,c,"name",D.name,D,null),Xi(o,c,"formEncType",D.formEncType,D,null),Xi(o,c,"formMethod",D.formMethod,D,null),Xi(o,c,"formTarget",D.formTarget,D,null)):(Xi(o,c,"encType",D.encType,D,null),Xi(o,c,"method",D.method,D,null),Xi(o,c,"target",D.target,D,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){o.removeAttribute(g);break}b=qc(""+b),o.setAttribute(g,b);break;case"onClick":b!=null&&(o.onclick=Ro);break;case"onScroll":b!=null&&mi("scroll",o);break;case"onScrollEnd":b!=null&&mi("scrollend",o);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(g=b.__html,g!=null){if(D.children!=null)throw Error(n(60));o.innerHTML=g}}break;case"multiple":o.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":o.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){o.removeAttribute("xlink:href");break}g=qc(""+b),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(g,""+b):o.removeAttribute(g);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":b&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(g,""):o.removeAttribute(g);break;case"capture":case"download":b===!0?o.setAttribute(g,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(g,b):o.removeAttribute(g);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?o.setAttribute(g,b):o.removeAttribute(g);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?o.removeAttribute(g):o.setAttribute(g,b);break;case"popover":mi("beforetoggle",o),mi("toggle",o),Rn(o,"popover",b);break;case"xlinkActuate":K(o,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":K(o,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":K(o,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":K(o,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":K(o,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":K(o,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":K(o,"http://www.w3.org/XML/1998/namespace","xml:base",b);
2026-03-09 22:33:09 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
2026-03-09 22:42:36 +01:00
* / c o n s t F 0 = " 1 7 2 " , W o = { R O T A T E : 0 , D O L L Y : 1 , P A N : 2 } , O A = { R O T A T E : 0 , P A N : 1 , D O L L Y _ P A N : 2 , D O L L Y _ R O T A T E : 3 } , C 7 = 0 , W S = 1 , N 7 = 2 , k F = 0 , S T = 1 , z F = 2 , v o = 3 , E l = 0 , o r = 1 , a s = 2 , $ a = 0 , X a = 1 , t 0 = 2 , n 0 = 3 , i 0 = 4 , w T = 5 , w o = 1 0 0 , T T = 1 0 1 , M T = 1 0 2 , R 7 = 1 0 3 , D 7 = 1 0 4 , E T = 2 0 0 , C T = 2 0 1 , N T = 2 0 2 , R T = 2 0 3 , z m = 2 0 4 , G m = 2 0 5 , D T = 2 0 6 , P T = 2 0 7 , L T = 2 0 8 , U T = 2 0 9 , B T = 2 1 0 , G F = 2 1 1 , q F = 2 1 2 , V F = 2 1 3 , j F = 2 1 4 , q m = 0 , V m = 1 , j m = 2 , B h = 3 , H m = 4 , W m = 5 , $ m = 6 , X m = 7 , D g = 0 , P 7 = 1 , L 7 = 2 , Y a = 0 , U 7 = 1 , B 7 = 2 , O 7 = 3 , I 7 = 4 , H F = 5 , F 7 = 6 , k 7 = 7 , O T = 3 0 0 , X o = 3 0 1 , Y o = 3 0 2 , O h = 3 0 3 , I h = 3 0 4 , e d = 3 0 6 , t d = 1 e 3 , Y l = 1 0 0 1 , n d = 1 0 0 2 , d r = 1 0 0 3 , i _ = 1 0 0 4 , Q l = 1 0 0 5 , p s = 1 0 0 6 , X A = 1 0 0 7 , z a = 1 0 0 8 , W F = 1 0 0 8 , r a = 1 0 0 9 , H f = 1 0 1 0 , W f = 1 0 1 1 , b l = 1 0 1 2 , N s = 1 0 1 3 , N r = 1 0 1 4 , $ r = 1 0 1 5 , G s = 1 0 1 6 , h y = 1 0 1 7 , f y = 1 0 1 8 , l u = 1 0 2 0 , d y = 3 5 9 0 2 , I T = 1 0 2 1 , P g = 1 0 2 2 , k s = 1 0 2 3 , F T = 1 0 2 4 , k T = 1 0 2 5 , t u = 1 0 2 6 , u u = 1 0 2 7 , L g = 1 0 2 8 , k 0 = 1 0 2 9 , i d = 1 0 3 0 , z 0 = 1 0 3 1 , $ F = 1 0 3 2 , G 0 = 1 0 3 3 , $ f = 3 3 7 7 6 , D h = 3 3 7 7 7 , P h = 3 3 7 7 8 , L h = 3 3 7 7 9 , Y m = 3 5 8 4 0 , Q m = 3 5 8 4 1 , K m = 3 5 8 4 2 , Z m = 3 5 8 4 3 , J m = 3 6 1 9 6 , r 0 = 3 7 4 9 2 , s 0 = 3 7 4 9 6 , a 0 = 3 7 8 0 8 , o 0 = 3 7 8 0 9 , l 0 = 3 7 8 1 0 , u 0 = 3 7 8 1 1 , c 0 = 3 7 8 1 2 , h 0 = 3 7 8 1 3 , f 0 = 3 7 8 1 4 , d 0 = 3 7 8 1 5 , A 0 = 3 7 8 1 6 , p 0 = 3 7 8 1 7 , m 0 = 3 7 8 1 8 , g 0 = 3 7 8 1 9 , v 0 = 3 7 8 2 0 , _ 0 = 3 7 8 2 1 , X f = 3 6 4 9 2 , $ S = 3 6 4 9 4 , X S = 3 6 4 9 5 , z T = 3 6 2 8 3 , e g = 3 6 2 8 4 , t g = 3 6 2 8 5 , n g = 3 6 2 8 6 , X F = 0 , Y F = 1 , X 8 = 2 , Q F = 3 2 0 0 , K F = 3 2 0 1 , M c = 0 , z 7 = 1 , T o = " " , b n = " s r g b " , M o = " s r g b - l i n e a r " , r _ = " l i n e a r " , F i = " s r g b " , Z F = 0 , N f = 7 6 8 0 , J F = 7 6 8 1 , e k = 7 6 8 2 , t k = 7 6 8 3 , n k = 3 4 0 5 5 , i k = 3 4 0 5 6 , r k = 5 3 8 6 , s k = 5 1 2 , a k = 5 1 3 , o k = 5 1 4 , l k = 5 1 5 , u k = 5 1 6 , c k = 5 1 7 , h k = 5 1 8 , Y S = 5 1 9 , G T = 5 1 2 , A y = 5 1 3 , q T = 5 1 4 , p y = 5 1 5 , V T = 5 1 6 , j T = 5 1 7 , H T = 5 1 8 , W T = 5 1 9 , s _ = 3 5 0 4 4 , I A = 3 5 0 4 8 , Y 8 = " 3 0 0 e s " , G a = 2 e 3 , c u = 2 0 0 1 ; c l a s s B c { a d d E v e n t L i s t e n e r ( e , t ) { t h i s . _ l i s t e n e r s = = = v o i d 0 & & ( t h i s . _ l i s t e n e r s = { } ) ; c o n s t n = t h i s . _ l i s t e n e r s ; n [ e ] = = = v o i d 0 & & ( n [ e ] = [ ] ) , n [ e ] . i n d e x O f ( t ) = = = - 1 & & n [ e ] . p u s h ( t ) } h a s E v e n t L i s t e n e r ( e , t ) { i f ( t h i s . _ l i s t e n e r s = = = v o i d 0 ) r e t u r n ! 1 ; c o n s t n = t h i s . _ l i s t e n e r s ; r e t u r n n [ e ] ! = = v o i d 0 & & n [ e ] . i n d e x O f ( t ) ! = = - 1 } r e m o v e E v e n t L i s t e n e r ( e , t ) { i f ( t h i s . _ l i s t e n e r s = = = v o i d 0 ) r e t u r n ; c o n s t r = t h i s . _ l i s t e n e r s [ e ] ; i f ( r ! = = v o i d 0 ) { c o n s t s = r . i n d e x O f ( t ) ; s ! = = - 1 & & r . s p l i c e ( s , 1 ) } } d i s p a t c h E v e n t ( e ) { i f ( t h i s . _ l i s t e n e r s = = = v o i d 0 ) r e t u r n ; c o n s t n = t h i s . _ l i s t e n e r s [ e . t y p e ] ; i f ( n ! = = v o i d 0 ) { e . t a r g e t = t h i s ; c o n s t r = n . s l i c e ( 0 ) ; f o r ( l e t s = 0 , a = r . l e n g t h ; s < a ; s + + ) r [ s ] . c a l l ( t h i s , e ) ; e . t a r g e t = n u l l } } } c o n s t K s = [ " 0 0 " , " 0 1 " , " 0 2 " , " 0 3 " , " 0 4 " , " 0 5 " , " 0 6 " , " 0 7 " , " 0 8 " , " 0 9 " , " 0 a " , " 0 b " , " 0 c " , " 0 d " , " 0 e " , " 0 f " , " 1 0 " , " 1 1 " , " 1 2 " , " 1 3 " , " 1 4 " , " 1 5 " , " 1 6 " , " 1 7 " , " 1 8 " , " 1 9 " , " 1 a " , " 1 b " , " 1 c " , " 1 d " , " 1 e " , " 1 f " , " 2 0 " , " 2 1 " , " 2 2 " , " 2 3 " , " 2 4 " , " 2 5 " , " 2 6 " , " 2 7 " , " 2 8 " , " 2 9 " , " 2 a " , " 2 b " , " 2 c " , " 2 d " , " 2 e " , " 2 f " , " 3 0 " , " 3 1 " , " 3 2 " , " 3 3 " , " 3 4 " , " 3 5 " , " 3 6 " , " 3 7 " , " 3 8 " , " 3 9 " , " 3 a " , " 3 b " , " 3 c " , " 3 d " , " 3 e " , " 3 f " , " 4 0 " , " 4 1 " , " 4 2 " , " 4 3 " , " 4 4 " , " 4 5 " , " 4 6 " , " 4 7 " , " 4 8 " , " 4 9 " , " 4 a " , " 4 b " , " 4 c " , " 4 d " , " 4 e " , " 4 f " , " 5 0 " , " 5 1 " , " 5 2 " , " 5 3 " , " 5 4 " , " 5 5 " , " 5 6 " , " 5 7 " , " 5 8 " , " 5 9 " , " 5 a " , " 5 b " , " 5 c " , " 5 d " , " 5 e " , " 5 f " , " 6 0 " , " 6 1 " , " 6 2 " , " 6 3 " , " 6 4 " , " 6 5 " , " 6 6 " , " 6 7 " , " 6 8 " , " 6 9 " , " 6 a " , " 6 b " , " 6 c " , " 6 d " , " 6 e " , " 6 f " , " 7 0 " , " 7 1 " , " 7 2 " , " 7 3 " , " 7 4 " , " 7 5 " , " 7 6 " , " 7 7 " , " 7 8 " , " 7 9 " , " 7 a " , " 7 b " , " 7 c " , " 7 d " , " 7 e " , " 7 f " , " 8 0 " , " 8 1 " , " 8 2 " , " 8 3 " , " 8 4 " , " 8 5 " , " 8 6 " , " 8 7 " , " 8 8 " , " 8 9 " , " 8 a " , " 8 b " , " 8 c " , " 8 d " , " 8 e " , " 8 f " , " 9 0 " , " 9 1 " , " 9 2 " , " 9 3 " , " 9 4 " , " 9 5 " , " 9 6 " , " 9 7 " , " 9 8 " , " 9 9 " , " 9 a " , " 9 b " , " 9 c " , " 9 d " , " 9 e " , " 9 f " , " a 0 " , " a 1 " , " a 2 " , " a 3 " , " a 4 " , " a 5 " , " a 6 " , " a 7 " , " a 8 " , " a 9 " , " a a " , " a b " , " a c " , " a d " , " a e " , " a f " , " b 0 " , " b 1 " , " b 2 " , " b 3 " , " b 4 " , " b 5 " , " b 6 " , " b 7 " , " b 8 " , " b 9 " , " b a " , " b b " , " b c " , " b d " , " b e " , " b f " , " c 0 " , " c 1 " , " c 2 " , " c 3 " , " c 4 " , " c 5 " , " c 6 " , " c 7 " , " c 8 " , " c 9 " , " c a " , " c b " , " c c " , " c d " , " c e " , " c f " , " d 0 " , " d 1 " , " d 2 " , " d 3 " , " d 4 " , " d 5 " , " d 6 " , " d 7 " , " d 8 " , " d 9 " , " d a " , " d b " , " d c " , " d d " , " d e " , " d f " , " e 0 " , " e 1 " , " e 2 " , " e 3 " , " e 4 " , " e 5 " , " e 6 " , " e 7 " , " e 8 " , " e 9 " , " e a " , " e b " , " e c " , " e d " , " e e " , " e f " , " f 0 " , " f 1 " , " f 2 " , " f 3 " , " f 4 " , " f 5 " , " f 6 " , " f 7 " , " f 8 " , " f 9 " , " f a " , " f b " , " f c " , " f d " , " f e " , " f f " ] ; l e t Q 8 = 1 2 3 4 5 6 7 ; c o n s t T m = M a t h . P I / 1 8 0 , y 0 = 1 8 0 / M a t h . P I ; f u n c t i o n n u ( ) { c o n s t i = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 , e = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 , t = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 , n = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 ; r e t u r n ( K s [ i & 2 5 5 ] + K s [ i > > 8 & 2 5 5 ] + K s [ i > > 1 6 & 2 5 5 ] + K s [ i > > 2 4 & 2 5 5 ] + " - " + K s [ e & 2 5 5 ] + K s [ e > > 8 & 2 5 5 ] + " - " + K s [ e > > 1 6 & 1 5 | 6 4 ] + K s [ e > > 2 4 & 2 5 5 ] + " - " + K s [ t & 6 3 | 1 2 8 ] + K s [ t > > 8 & 2 5 5 ] + " - " + K s [ t > > 1 6 & 2 5 5 ] + K s [ t > > 2 4 & 2 5 5 ] + K s [ n & 2 5 5 ] + K s [ n > > 8 & 2 5 5 ] + K s [ n > > 1 6 & 2 5 5 ] + K s [ n > > 2 4 & 2 5 5 ] ) . t o L o w e r C a s e ( ) } f u n c t i o n r i ( i , e , t ) { r e t u r n M a t h . m a x ( e , M a t h . m i n ( t , i ) ) } f u n c t i o n $ T ( i , e ) { r e t u r n ( i % e + e ) % e } f u n c t i o n f k ( i , e , t , n , r ) { r e t u r n n + ( i - e ) * ( r - n ) / ( t - e ) } f u n c t i o n d k ( i , e , t ) { r e t u r n i ! = = e ? ( t - i ) / ( e - i ) : 0 } f u n c t i o n M m ( i , e , t ) { r e t u r n ( 1 - t ) * i + t * e } f u n c t i o n A k ( i , e , t , n ) { r e t u r n M m ( i , e , 1 - M a t h . e x p ( - t * n ) ) } f u n c t i o n p k ( i , e = 1 ) { r e t u r n e - M a t h . a b s ( $ T ( i , e * 2 ) - e ) } f u n c t i o n m k ( i , e , t ) { r e t u r n i < = e ? 0 : i > = t ? 1 : ( i = ( i - e ) / ( t - e ) , i * i * ( 3 - 2 * i ) ) } f u n c t i o n g k ( i , e ,
2026-03-09 22:33:09 +01:00
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
} ` ,Yk= ` void main ( ) {
gl _FragColor = vec4 ( 1.0 , 0.0 , 0.0 , 1.0 ) ;
2026-03-09 22:42:36 +01:00
} ` ;class Qa extends oa{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Xk,this.fragmentShader=Yk,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=b0(e.uniforms),this.uniformsGroups= $ k(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class gy extends pr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new jn,this.projectionMatrix=new jn,this.projectionMatrixInverse=new jn,this.coordinateSystem=Ga}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const mh=new pe,fN=new bt,dN=new bt;class va extends gy{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=y0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Tm*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return y0*2*Math.atan(Math.tan(Tm*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){mh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(mh.x,mh.y).multiplyScalar(-e/mh.z),mh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(mh.x,mh.y).multiplyScalar(-e/mh.z)}getViewSize(e,t){return this.getViewBounds(e,fN,dN),t.subVectors(dN,fN)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.o
2026-03-09 22:33:09 +01: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 ) ;
}
2026-03-09 22:42:36 +01:00
` },r=new Vh(5,5,5),s=new Qa({name:"CubemapFromEquirect",uniforms:b0(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:or,blending: $ a});s.uniforms.tEquirect.value=t;const a=new Oi(r,s),l=t.minFilter;return t.minFilter===za&&(t.minFilter=ps),new $ 7(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class ZT extends pr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new aa,this.environmentIntensity=1,this.environmentRotation=new aa,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class JT{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=s_,this.updateRanges=[],this.version=0,this.uuid=nu()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=nu()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=nu()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const pa=new pe;class Kl{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)pa.fromBufferAttribute(this,t),pa.applyMatrix4(e),this.setXYZ(t,pa.x,pa.y,pa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)pa.fromBufferAttribute(this,t),pa.applyNormalMatrix(e),this.setXYZ(t,pa.x,pa.y,pa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)pa.fromBufferAttribute(this,t),pa.transformDirection
2026-03-09 22:33:09 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
* / f u n c t i o n f D ( ) { l e t i = n u l l , e = ! 1 , t = n u l l , n = n u l l ; f u n c t i o n r ( s , a ) { t ( s , a ) , n = i . r e q u e s t A n i m a t i o n F r a m e ( r ) } r e t u r n { s t a r t : f u n c t i o n ( ) { e ! = = ! 0 & & t ! = = n u l l & & ( n = i . r e q u e s t A n i m a t i o n F r a m e ( r ) , e = ! 0 ) } , s t o p : f u n c t i o n ( ) { i . c a n c e l A n i m a t i o n F r a m e ( n ) , e = ! 1 } , s e t A n i m a t i o n L o o p : f u n c t i o n ( s ) { t = s } , s e t C o n t e x t : f u n c t i o n ( s ) { i = s } } } f u n c t i o n i G ( i ) { c o n s t e = n e w W e a k M a p ; f u n c t i o n t ( l , u ) { c o n s t h = l . a r r a y , m = l . u s a g e , v = h . b y t e L e n g t h , x = i . c r e a t e B u f f e r ( ) ; i . b i n d B u f f e r ( u , x ) , i . b u f f e r D a t a ( u , h , m ) , l . o n U p l o a d C a l l b a c k ( ) ; l e t S ; i f ( h i n s t a n c e o f F l o a t 3 2 A r r a y ) S = i . F L O A T ; e l s e i f ( h i n s t a n c e o f U i n t 1 6 A r r a y ) l . i s F l o a t 1 6 B u f f e r A t t r i b u t e ? S = i . H A L F _ F L O A T : S = i . U N S I G N E D _ S H O R T ; e l s e i f ( h i n s t a n c e o f I n t 1 6 A r r a y ) S = i . S H O R T ; e l s e i f ( h i n s t a n c e o f U i n t 3 2 A r r a y ) S = i . U N S I G N E D _ I N T ; e l s e i f ( h i n s t a n c e o f I n t 3 2 A r r a y ) S = i . I N T ; e l s e i f ( h i n s t a n c e o f I n t 8 A r r a y ) S = i . B Y T E ; e l s e i f ( h i n s t a n c e o f U i n t 8 A r r a y ) S = i . U N S I G N E D _ B Y T E ; e l s e i f ( h i n s t a n c e o f U i n t 8 C l a m p e d A r r a y ) S = i . U N S I G N E D _ B Y T E ; e l s e t h r o w n e w E r r o r ( " T H R E E . W e b G L A t t r i b u t e s : U n s u p p o r t e d b u f f e r d a t a f o r m a t : " + h ) ; r e t u r n { b u f f e r : x , t y p e : S , b y t e s P e r E l e m e n t : h . B Y T E S _ P E R _ E L E M E N T , v e r s i o n : l . v e r s i o n , s i z e : v } } f u n c t i o n n ( l , u , h ) { c o n s t m = u . a r r a y , v = u . u p d a t e R a n g e s ; i f ( i . b i n d B u f f e r ( h , l ) , v . l e n g t h = = = 0 ) i . b u f f e r S u b D a t a ( h , 0 , m ) ; e l s e { v . s o r t ( ( S , T ) = > S . s t a r t - T . s t a r t ) ; l e t x = 0 ; f o r ( l e t S = 1 ; S < v . l e n g t h ; S + + ) { c o n s t T = v [ x ] , N = v [ S ] ; N . s t a r t < = T . s t a r t + T . c o u n t + 1 ? T . c o u n t = M a t h . m a x ( T . c o u n t , N . s t a r t + N . c o u n t - T . s t a r t ) : ( + + x , v [ x ] = N ) } v . l e n g t h = x + 1 ; f o r ( l e t S = 0 , T = v . l e n g t h ; S < T ; S + + ) { c o n s t N = v [ S ] ; i . b u f f e r S u b D a t a ( h , N . s t a r t * m . B Y T E S _ P E R _ E L E M E N T , m , N . s t a r t , N . c o u n t ) } u . c l e a r U p d a t e R a n g e s ( ) } u . o n U p l o a d C a l l b a c k ( ) } f u n c t i o n r ( l ) { r e t u r n l . i s I n t e r l e a v e d B u f f e r A t t r i b u t e & & ( l = l . d a t a ) , e . g e t ( l ) } f u n c t i o n s ( l ) { l . i s I n t e r l e a v e d B u f f e r A t t r i b u t e & & ( l = l . d a t a ) ; c o n s t u = e . g e t ( l ) ; u & & ( i . d e l e t e B u f f e r ( u . b u f f e r ) , e . d e l e t e ( l ) ) } f u n c t i o n a ( l , u ) { i f ( l . i s I n t e r l e a v e d B u f f e r A t t r i b u t e & & ( l = l . d a t a ) , l . i s G L B u f f e r A t t r i b u t e ) { c o n s t m = e . g e t ( l ) ; ( ! m | | m . v e r s i o n < l . v e r s i o n ) & & e . s e t ( l , { b u f f e r : l . b u f f e r , t y p e : l . t y p e , b y t e s P e r E l e m e n t : l . e l e m e n t S i z e , v e r s i o n : l . v e r s i o n } ) ; r e t u r n } c o n s t h = e . g e t ( l ) ; i f ( h = = = v o i d 0 ) e . s e t ( l , t ( l , u ) ) ; e l s e i f ( h . v e r s i o n < l . v e r s i o n ) { i f ( h . s i z e ! = = l . a r r a y . b y t e L e n g t h ) t h r o w n e w E r r o r ( " T H R E E . W e b G L A t t r i b u t e s : T h e s i z e o f t h e b u f f e r a t t r i b u t e ' s a r r a y b u f f e r d o e s n o t m a t c h t h e o r i g i n a l s i z e . R e s i z i n g b u f f e r a t t r i b u t e s i s n o t s u p p o r t e d . " ) ; n ( h . b u f f e r , l , u ) , h . v e r s i o n = l . v e r s i o n } } r e t u r n { g e t : r , r e m o v e : s , u p d a t e : a } } v a r r G = ` # i f d e f U S E _ A L P H A H A S H
if ( diffuseColor . a < getAlphaHashThreshold ( vPosition ) ) discard ;
# endif ` ,sG= ` # ifdef USE _ALPHAHASH
const float ALPHA _HASH _SCALE = 0.05 ;
float hash2D ( vec2 value ) {
return fract ( 1.0 e4 * sin ( 17.0 * value . x + 0.1 * value . y ) * ( 0.1 + abs ( sin ( 13.0 * value . y + value . x ) ) ) ) ;
}
float hash3D ( vec3 value ) {
return hash2D ( vec2 ( hash2D ( value . xy ) , value . z ) ) ;
}
float getAlphaHashThreshold ( vec3 position ) {
float maxDeriv = max (
length ( dFdx ( position . xyz ) ) ,
length ( dFdy ( position . xyz ) )
) ;
float pixScale = 1.0 / ( ALPHA _HASH _SCALE * maxDeriv ) ;
vec2 pixScales = vec2 (
exp2 ( floor ( log2 ( pixScale ) ) ) ,
exp2 ( ceil ( log2 ( pixScale ) ) )
) ;
vec2 alpha = vec2 (
hash3D ( floor ( pixScales . x * position . xyz ) ) ,
hash3D ( floor ( pixScales . y * position . xyz ) )
) ;
float lerpFactor = fract ( log2 ( pixScale ) ) ;
float x = ( 1.0 - lerpFactor ) * alpha . x + lerpFactor * alpha . y ;
float a = min ( lerpFactor , 1.0 - lerpFactor ) ;
vec3 cases = vec3 (
x * x / ( 2.0 * a * ( 1.0 - a ) ) ,
( x - 0.5 * a ) / ( 1.0 - a ) ,
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
) ;
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases . x : cases . y )
: cases . z ;
return clamp ( threshold , 1.0 e - 6 , 1.0 ) ;
}
# endif ` ,aG= ` # ifdef USE _ALPHAMAP
diffuseColor . a *= texture2D ( alphaMap , vAlphaMapUv ) . g ;
# endif ` ,oG= ` # ifdef USE _ALPHAMAP
uniform sampler2D alphaMap ;
# endif ` ,lG= ` # ifdef USE _ALPHATEST
# ifdef ALPHA _TO _COVERAGE
diffuseColor . a = smoothstep ( alphaTest , alphaTest + fwidth ( diffuseColor . a ) , diffuseColor . a ) ;
if ( diffuseColor . a == 0.0 ) discard ;
# else
if ( diffuseColor . a < alphaTest ) discard ;
# endif
# endif ` ,uG= ` # ifdef USE _ALPHATEST
uniform float alphaTest ;
# endif ` ,cG= ` # ifdef USE _AOMAP
float ambientOcclusion = ( texture2D ( aoMap , vAoMapUv ) . r - 1.0 ) * aoMapIntensity + 1.0 ;
reflectedLight . indirectDiffuse *= ambientOcclusion ;
# if defined ( USE _CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion ;
# endif
# if defined ( USE _SHEEN )
sheenSpecularIndirect *= ambientOcclusion ;
# endif
# if defined ( USE _ENVMAP ) && defined ( STANDARD )
float dotNV = saturate ( dot ( geometryNormal , geometryViewDir ) ) ;
reflectedLight . indirectSpecular *= computeSpecularOcclusion ( dotNV , ambientOcclusion , material . roughness ) ;
# endif
# endif ` ,hG= ` # ifdef USE _AOMAP
uniform sampler2D aoMap ;
uniform float aoMapIntensity ;
# endif ` ,fG= ` # ifdef USE _BATCHING
# if ! defined ( GL _ANGLE _multi _draw )
# define gl _DrawID _gl _DrawID
uniform int _gl _DrawID ;
# endif
uniform highp sampler2D batchingTexture ;
uniform highp usampler2D batchingIdTexture ;
mat4 getBatchingMatrix ( const in float i ) {
int size = textureSize ( batchingTexture , 0 ) . x ;
int j = int ( i ) * 4 ;
int x = j % size ;
int y = j / size ;
vec4 v1 = texelFetch ( batchingTexture , ivec2 ( x , y ) , 0 ) ;
vec4 v2 = texelFetch ( batchingTexture , ivec2 ( x + 1 , y ) , 0 ) ;
vec4 v3 = texelFetch ( batchingTexture , ivec2 ( x + 2 , y ) , 0 ) ;
vec4 v4 = texelFetch ( batchingTexture , ivec2 ( x + 3 , y ) , 0 ) ;
return mat4 ( v1 , v2 , v3 , v4 ) ;
}
float getIndirectIndex ( const in int i ) {
int size = textureSize ( batchingIdTexture , 0 ) . x ;
int x = i % size ;
int y = i / size ;
return float ( texelFetch ( batchingIdTexture , ivec2 ( x , y ) , 0 ) . r ) ;
}
# endif
# ifdef USE _BATCHING _COLOR
uniform sampler2D batchingColorTexture ;
vec3 getBatchingColor ( const in float i ) {
int size = textureSize ( batchingColorTexture , 0 ) . x ;
int j = int ( i ) ;
int x = j % size ;
int y = j / size ;
return texelFetch ( batchingColorTexture , ivec2 ( x , y ) , 0 ) . rgb ;
}
# endif ` ,dG= ` # ifdef USE _BATCHING
mat4 batchingMatrix = getBatchingMatrix ( getIndirectIndex ( gl _DrawID ) ) ;
# endif ` ,AG= ` vec3 transformed = vec3 ( position ) ;
# ifdef USE _ALPHAHASH
vPosition = vec3 ( position ) ;
# endif ` ,pG= ` vec3 objectNormal = vec3 ( normal ) ;
# ifdef USE _TANGENT
vec3 objectTangent = vec3 ( tangent . xyz ) ;
# endif ` ,mG= ` float G _BlinnPhong _Implicit ( ) {
return 0.25 ;
}
float D _BlinnPhong ( const in float shininess , const in float dotNH ) {
return RECIPROCAL _PI * ( shininess * 0.5 + 1.0 ) * pow ( dotNH , shininess ) ;
}
vec3 BRDF _BlinnPhong ( const in vec3 lightDir , const in vec3 viewDir , const in vec3 normal , const in vec3 specularColor , const in float shininess ) {
vec3 halfDir = normalize ( lightDir + viewDir ) ;
float dotNH = saturate ( dot ( normal , halfDir ) ) ;
float dotVH = saturate ( dot ( viewDir , halfDir ) ) ;
vec3 F = F _Schlick ( specularColor , 1.0 , dotVH ) ;
float G = G _BlinnPhong _Implicit ( ) ;
float D = D _BlinnPhong ( shininess , dotNH ) ;
return F * ( G * D ) ;
} // validated`,gG=`#ifdef USE_IRIDESCENCE
const mat3 XYZ _TO _REC709 = mat3 (
3.2404542 , - 0.9692660 , 0.0556434 ,
- 1.5371385 , 1.8760108 , - 0.2040259 ,
- 0.4985314 , 0.0415560 , 1.0572252
) ;
vec3 Fresnel0ToIor ( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt ( fresnel0 ) ;
return ( vec3 ( 1.0 ) + sqrtF0 ) / ( vec3 ( 1.0 ) - sqrtF0 ) ;
}
vec3 IorToFresnel0 ( vec3 transmittedIor , float incidentIor ) {
return pow2 ( ( transmittedIor - vec3 ( incidentIor ) ) / ( transmittedIor + vec3 ( incidentIor ) ) ) ;
}
float IorToFresnel0 ( float transmittedIor , float incidentIor ) {
return pow2 ( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ) ) ;
}
vec3 evalSensitivity ( float OPD , vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0 e - 9 ;
vec3 val = vec3 ( 5.4856 e - 13 , 4.4201 e - 13 , 5.2481 e - 13 ) ;
vec3 pos = vec3 ( 1.6810 e + 06 , 1.7953 e + 06 , 2.2084 e + 06 ) ;
vec3 var = vec3 ( 4.3278 e + 09 , 9.3046 e + 09 , 6.6121 e + 09 ) ;
vec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - pow2 ( phase ) * var ) ;
xyz . x += 9.7470 e - 14 * sqrt ( 2.0 * PI * 4.5282 e + 09 ) * cos ( 2.2399 e + 06 * phase + shift [ 0 ] ) * exp ( - 4.5282 e + 09 * pow2 ( phase ) ) ;
xyz /= 1.0685 e - 7 ;
vec3 rgb = XYZ _TO _REC709 * xyz ;
return rgb ;
}
vec3 evalIridescence ( float outsideIOR , float eta2 , float cosTheta1 , float thinFilmThickness , vec3 baseF0 ) {
vec3 I ;
float iridescenceIOR = mix ( outsideIOR , eta2 , smoothstep ( 0.0 , 0.03 , thinFilmThickness ) ) ;
float sinTheta2Sq = pow2 ( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2 ( cosTheta1 ) ) ;
float cosTheta2Sq = 1.0 - sinTheta2Sq ;
if ( cosTheta2Sq < 0.0 ) {
return vec3 ( 1.0 ) ;
}
float cosTheta2 = sqrt ( cosTheta2Sq ) ;
float R0 = IorToFresnel0 ( iridescenceIOR , outsideIOR ) ;
float R12 = F _Schlick ( R0 , 1.0 , cosTheta1 ) ;
float T121 = 1.0 - R12 ;
float phi12 = 0.0 ;
if ( iridescenceIOR < outsideIOR ) phi12 = PI ;
float phi21 = PI - phi12 ;
vec3 baseIOR = Fresnel0ToIor ( clamp ( baseF0 , 0.0 , 0.9999 ) ) ; vec3 R1 = IorToFresnel0 ( baseIOR , iridescenceIOR ) ;
vec3 R23 = F _Schlick ( R1 , 1.0 , cosTheta2 ) ;
vec3 phi23 = vec3 ( 0.0 ) ;
if ( baseIOR [ 0 ] < iridescenceIOR ) phi23 [ 0 ] = PI ;
if ( baseIOR [ 1 ] < iridescenceIOR ) phi23 [ 1 ] = PI ;
if ( baseIOR [ 2 ] < iridescenceIOR ) phi23 [ 2 ] = PI ;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2 ;
vec3 phi = vec3 ( phi21 ) + phi23 ;
vec3 R123 = clamp ( R12 * R23 , 1e-5 , 0.9999 ) ;
vec3 r123 = sqrt ( R123 ) ;
vec3 Rs = pow2 ( T121 ) * R23 / ( vec3 ( 1.0 ) - R123 ) ;
vec3 C0 = R12 + Rs ;
I = C0 ;
vec3 Cm = Rs - T121 ;
for ( int m = 1 ; m <= 2 ; ++ m ) {
Cm *= r123 ;
vec3 Sm = 2.0 * evalSensitivity ( float ( m ) * OPD , float ( m ) * phi ) ;
I += Cm * Sm ;
}
return max ( I , vec3 ( 0.0 ) ) ;
}
# endif ` ,vG= ` # ifdef USE _BUMPMAP
uniform sampler2D bumpMap ;
uniform float bumpScale ;
vec2 dHdxy _fwd ( ) {
vec2 dSTdx = dFdx ( vBumpMapUv ) ;
vec2 dSTdy = dFdy ( vBumpMapUv ) ;
float Hll = bumpScale * texture2D ( bumpMap , vBumpMapUv ) . x ;
float dBx = bumpScale * texture2D ( bumpMap , vBumpMapUv + dSTdx ) . x - Hll ;
float dBy = bumpScale * texture2D ( bumpMap , vBumpMapUv + dSTdy ) . x - Hll ;
return vec2 ( dBx , dBy ) ;
}
vec3 perturbNormalArb ( vec3 surf _pos , vec3 surf _norm , vec2 dHdxy , float faceDirection ) {
vec3 vSigmaX = normalize ( dFdx ( surf _pos . xyz ) ) ;
vec3 vSigmaY = normalize ( dFdy ( surf _pos . xyz ) ) ;
vec3 vN = surf _norm ;
vec3 R1 = cross ( vSigmaY , vN ) ;
vec3 R2 = cross ( vN , vSigmaX ) ;
float fDet = dot ( vSigmaX , R1 ) * faceDirection ;
vec3 vGrad = sign ( fDet ) * ( dHdxy . x * R1 + dHdxy . y * R2 ) ;
return normalize ( abs ( fDet ) * surf _norm - vGrad ) ;
}
# endif ` ,_G= ` # if NUM _CLIPPING _PLANES > 0
vec4 plane ;
# ifdef ALPHA _TO _COVERAGE
float distanceToPlane , distanceGradient ;
float clipOpacity = 1.0 ;
# pragma unroll _loop _start
for ( int i = 0 ; i < UNION _CLIPPING _PLANES ; i ++ ) {
plane = clippingPlanes [ i ] ;
distanceToPlane = - dot ( vClipPosition , plane . xyz ) + plane . w ;
distanceGradient = fwidth ( distanceToPlane ) / 2.0 ;
clipOpacity *= smoothstep ( - distanceGradient , distanceGradient , distanceToPlane ) ;
if ( clipOpacity == 0.0 ) discard ;
}
# pragma unroll _loop _end
# if UNION _CLIPPING _PLANES < NUM _CLIPPING _PLANES
float unionClipOpacity = 1.0 ;
# pragma unroll _loop _start
for ( int i = UNION _CLIPPING _PLANES ; i < NUM _CLIPPING _PLANES ; i ++ ) {
plane = clippingPlanes [ i ] ;
distanceToPlane = - dot ( vClipPosition , plane . xyz ) + plane . w ;
distanceGradient = fwidth ( distanceToPlane ) / 2.0 ;
unionClipOpacity *= 1.0 - smoothstep ( - distanceGradient , distanceGradient , distanceToPlane ) ;
}
# pragma unroll _loop _end
clipOpacity *= 1.0 - unionClipOpacity ;
# endif
diffuseColor . a *= clipOpacity ;
if ( diffuseColor . a == 0.0 ) discard ;
# else
# pragma unroll _loop _start
for ( int i = 0 ; i < UNION _CLIPPING _PLANES ; i ++ ) {
plane = clippingPlanes [ i ] ;
if ( dot ( vClipPosition , plane . xyz ) > plane . w ) discard ;
}
# pragma unroll _loop _end
# if UNION _CLIPPING _PLANES < NUM _CLIPPING _PLANES
bool clipped = true ;
# pragma unroll _loop _start
for ( int i = UNION _CLIPPING _PLANES ; i < NUM _CLIPPING _PLANES ; i ++ ) {
plane = clippingPlanes [ i ] ;
clipped = ( dot ( vClipPosition , plane . xyz ) > plane . w ) && clipped ;
}
# pragma unroll _loop _end
if ( clipped ) discard ;
# endif
# endif
# endif ` ,yG= ` # if NUM _CLIPPING _PLANES > 0
varying vec3 vClipPosition ;
uniform vec4 clippingPlanes [ NUM _CLIPPING _PLANES ] ;
# endif ` ,xG= ` # if NUM _CLIPPING _PLANES > 0
varying vec3 vClipPosition ;
# endif ` ,bG= ` # if NUM _CLIPPING _PLANES > 0
vClipPosition = - mvPosition . xyz ;
# endif ` ,SG= ` # if defined ( USE _COLOR _ALPHA )
diffuseColor *= vColor ;
# elif defined ( USE _COLOR )
diffuseColor . rgb *= vColor ;
# endif ` ,wG= ` # if defined ( USE _COLOR _ALPHA )
varying vec4 vColor ;
# elif defined ( USE _COLOR )
varying vec3 vColor ;
# endif ` ,TG= ` # if defined ( USE _COLOR _ALPHA )
varying vec4 vColor ;
# elif defined ( USE _COLOR ) || defined ( USE _INSTANCING _COLOR ) || defined ( USE _BATCHING _COLOR )
varying vec3 vColor ;
# endif ` ,MG= ` # if defined ( USE _COLOR _ALPHA )
vColor = vec4 ( 1.0 ) ;
# elif defined ( USE _COLOR ) || defined ( USE _INSTANCING _COLOR ) || defined ( USE _BATCHING _COLOR )
vColor = vec3 ( 1.0 ) ;
# endif
# ifdef USE _COLOR
vColor *= color ;
# endif
# ifdef USE _INSTANCING _COLOR
vColor . xyz *= instanceColor . xyz ;
# endif
# ifdef USE _BATCHING _COLOR
vec3 batchingColor = getBatchingColor ( getIndirectIndex ( gl _DrawID ) ) ;
vColor . xyz *= batchingColor . xyz ;
# endif ` ,EG= ` # define PI 3.141592653589793
# define PI2 6.283185307179586
# define PI _HALF 1.5707963267948966
# define RECIPROCAL _PI 0.3183098861837907
# define RECIPROCAL _PI2 0.15915494309189535
# define EPSILON 1e-6
# ifndef saturate
# define saturate ( a ) clamp ( a , 0.0 , 1.0 )
# endif
# define whiteComplement ( a ) ( 1.0 - saturate ( a ) )
float pow2 ( const in float x ) { return x * x ; }
vec3 pow2 ( const in vec3 x ) { return x * x ; }
float pow3 ( const in float x ) { return x * x * x ; }
float pow4 ( const in float x ) { float x2 = x * x ; return x2 * x2 ; }
float max3 ( const in vec3 v ) { return max ( max ( v . x , v . y ) , v . z ) ; }
float average ( const in vec3 v ) { return dot ( v , vec3 ( 0.3333333 ) ) ; }
highp float rand ( const in vec2 uv ) {
const highp float a = 12.9898 , b = 78.233 , c = 43758.5453 ;
highp float dt = dot ( uv . xy , vec2 ( a , b ) ) , sn = mod ( dt , PI ) ;
return fract ( sin ( sn ) * c ) ;
}
# ifdef HIGH _PRECISION
float precisionSafeLength ( vec3 v ) { return length ( v ) ; }
# else
float precisionSafeLength ( vec3 v ) {
float maxComponent = max3 ( abs ( v ) ) ;
return length ( v / maxComponent ) * maxComponent ;
}
# endif
struct IncidentLight {
vec3 color ;
vec3 direction ;
bool visible ;
} ;
struct ReflectedLight {
vec3 directDiffuse ;
vec3 directSpecular ;
vec3 indirectDiffuse ;
vec3 indirectSpecular ;
} ;
# ifdef USE _ALPHAHASH
varying vec3 vPosition ;
# endif
vec3 transformDirection ( in vec3 dir , in mat4 matrix ) {
return normalize ( ( matrix * vec4 ( dir , 0.0 ) ) . xyz ) ;
}
vec3 inverseTransformDirection ( in vec3 dir , in mat4 matrix ) {
return normalize ( ( vec4 ( dir , 0.0 ) * matrix ) . xyz ) ;
}
mat3 transposeMat3 ( const in mat3 m ) {
mat3 tmp ;
tmp [ 0 ] = vec3 ( m [ 0 ] . x , m [ 1 ] . x , m [ 2 ] . x ) ;
tmp [ 1 ] = vec3 ( m [ 0 ] . y , m [ 1 ] . y , m [ 2 ] . y ) ;
tmp [ 2 ] = vec3 ( m [ 0 ] . z , m [ 1 ] . z , m [ 2 ] . z ) ;
return tmp ;
}
bool isPerspectiveMatrix ( mat4 m ) {
return m [ 2 ] [ 3 ] == - 1.0 ;
}
vec2 equirectUv ( in vec3 dir ) {
float u = atan ( dir . z , dir . x ) * RECIPROCAL _PI2 + 0.5 ;
float v = asin ( clamp ( dir . y , - 1.0 , 1.0 ) ) * RECIPROCAL _PI + 0.5 ;
return vec2 ( u , v ) ;
}
vec3 BRDF _Lambert ( const in vec3 diffuseColor ) {
return RECIPROCAL _PI * diffuseColor ;
}
vec3 F _Schlick ( const in vec3 f0 , const in float f90 , const in float dotVH ) {
float fresnel = exp2 ( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ) ;
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ) ;
}
float F _Schlick ( const in float f0 , const in float f90 , const in float dotVH ) {
float fresnel = exp2 ( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ) ;
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ) ;
} // validated`,CG=`#ifdef ENVMAP_TYPE_CUBE_UV
# define cubeUV _minMipLevel 4.0
# define cubeUV _minTileSize 16.0
float getFace ( vec3 direction ) {
vec3 absDirection = abs ( direction ) ;
float face = - 1.0 ;
if ( absDirection . x > absDirection . z ) {
if ( absDirection . x > absDirection . y )
face = direction . x > 0.0 ? 0.0 : 3.0 ;
else
face = direction . y > 0.0 ? 1.0 : 4.0 ;
} else {
if ( absDirection . z > absDirection . y )
face = direction . z > 0.0 ? 2.0 : 5.0 ;
else
face = direction . y > 0.0 ? 1.0 : 4.0 ;
}
return face ;
}
vec2 getUV ( vec3 direction , float face ) {
vec2 uv ;
if ( face == 0.0 ) {
uv = vec2 ( direction . z , direction . y ) / abs ( direction . x ) ;
} else if ( face == 1.0 ) {
uv = vec2 ( - direction . x , - direction . z ) / abs ( direction . y ) ;
} else if ( face == 2.0 ) {
uv = vec2 ( - direction . x , direction . y ) / abs ( direction . z ) ;
} else if ( face == 3.0 ) {
uv = vec2 ( - direction . z , direction . y ) / abs ( direction . x ) ;
} else if ( face == 4.0 ) {
uv = vec2 ( - direction . x , direction . z ) / abs ( direction . y ) ;
} else {
uv = vec2 ( direction . x , direction . y ) / abs ( direction . z ) ;
}
return 0.5 * ( uv + 1.0 ) ;
}
vec3 bilinearCubeUV ( sampler2D envMap , vec3 direction , float mipInt ) {
float face = getFace ( direction ) ;
float filterInt = max ( cubeUV _minMipLevel - mipInt , 0.0 ) ;
mipInt = max ( mipInt , cubeUV _minMipLevel ) ;
float faceSize = exp2 ( mipInt ) ;
highp vec2 uv = getUV ( direction , face ) * ( faceSize - 2.0 ) + 1.0 ;
if ( face > 2.0 ) {
uv . y += faceSize ;
face -= 3.0 ;
}
uv . x += face * faceSize ;
uv . x += filterInt * 3.0 * cubeUV _minTileSize ;
uv . y += 4.0 * ( exp2 ( CUBEUV _MAX _MIP ) - faceSize ) ;
uv . x *= CUBEUV _TEXEL _WIDTH ;
uv . y *= CUBEUV _TEXEL _HEIGHT ;
# ifdef texture2DGradEXT
return texture2DGradEXT ( envMap , uv , vec2 ( 0.0 ) , vec2 ( 0.0 ) ) . rgb ;
# else
return texture2D ( envMap , uv ) . rgb ;
# endif
}
# define cubeUV _r0 1.0
# define cubeUV _m0 - 2.0
# define cubeUV _r1 0.8
# define cubeUV _m1 - 1.0
# define cubeUV _r4 0.4
# define cubeUV _m4 2.0
# define cubeUV _r5 0.305
# define cubeUV _m5 3.0
# define cubeUV _r6 0.21
# define cubeUV _m6 4.0
float roughnessToMip ( float roughness ) {
float mip = 0.0 ;
if ( roughness >= cubeUV _r1 ) {
mip = ( cubeUV _r0 - roughness ) * ( cubeUV _m1 - cubeUV _m0 ) / ( cubeUV _r0 - cubeUV _r1 ) + cubeUV _m0 ;
} else if ( roughness >= cubeUV _r4 ) {
mip = ( cubeUV _r1 - roughness ) * ( cubeUV _m4 - cubeUV _m1 ) / ( cubeUV _r1 - cubeUV _r4 ) + cubeUV _m1 ;
} else if ( roughness >= cubeUV _r5 ) {
mip = ( cubeUV _r4 - roughness ) * ( cubeUV _m5 - cubeUV _m4 ) / ( cubeUV _r4 - cubeUV _r5 ) + cubeUV _m4 ;
} else if ( roughness >= cubeUV _r6 ) {
mip = ( cubeUV _r5 - roughness ) * ( cubeUV _m6 - cubeUV _m5 ) / ( cubeUV _r5 - cubeUV _r6 ) + cubeUV _m5 ;
} else {
mip = - 2.0 * log2 ( 1.16 * roughness ) ; }
return mip ;
}
vec4 textureCubeUV ( sampler2D envMap , vec3 sampleDir , float roughness ) {
float mip = clamp ( roughnessToMip ( roughness ) , cubeUV _m0 , CUBEUV _MAX _MIP ) ;
float mipF = fract ( mip ) ;
float mipInt = floor ( mip ) ;
vec3 color0 = bilinearCubeUV ( envMap , sampleDir , mipInt ) ;
if ( mipF == 0.0 ) {
return vec4 ( color0 , 1.0 ) ;
} else {
vec3 color1 = bilinearCubeUV ( envMap , sampleDir , mipInt + 1.0 ) ;
return vec4 ( mix ( color0 , color1 , mipF ) , 1.0 ) ;
}
}
# endif ` ,NG= ` vec3 transformedNormal = objectNormal ;
# ifdef USE _TANGENT
vec3 transformedTangent = objectTangent ;
# endif
# ifdef USE _BATCHING
mat3 bm = mat3 ( batchingMatrix ) ;
transformedNormal /= vec3 ( dot ( bm [ 0 ] , bm [ 0 ] ) , dot ( bm [ 1 ] , bm [ 1 ] ) , dot ( bm [ 2 ] , bm [ 2 ] ) ) ;
transformedNormal = bm * transformedNormal ;
# ifdef USE _TANGENT
transformedTangent = bm * transformedTangent ;
# endif
# endif
# ifdef USE _INSTANCING
mat3 im = mat3 ( instanceMatrix ) ;
transformedNormal /= vec3 ( dot ( im [ 0 ] , im [ 0 ] ) , dot ( im [ 1 ] , im [ 1 ] ) , dot ( im [ 2 ] , im [ 2 ] ) ) ;
transformedNormal = im * transformedNormal ;
# ifdef USE _TANGENT
transformedTangent = im * transformedTangent ;
# endif
# endif
transformedNormal = normalMatrix * transformedNormal ;
# ifdef FLIP _SIDED
transformedNormal = - transformedNormal ;
# endif
# ifdef USE _TANGENT
transformedTangent = ( modelViewMatrix * vec4 ( transformedTangent , 0.0 ) ) . xyz ;
# ifdef FLIP _SIDED
transformedTangent = - transformedTangent ;
# endif
# endif ` ,RG= ` # ifdef USE _DISPLACEMENTMAP
uniform sampler2D displacementMap ;
uniform float displacementScale ;
uniform float displacementBias ;
# endif ` ,DG= ` # ifdef USE _DISPLACEMENTMAP
transformed += normalize ( objectNormal ) * ( texture2D ( displacementMap , vDisplacementMapUv ) . x * displacementScale + displacementBias ) ;
# endif ` ,PG= ` # ifdef USE _EMISSIVEMAP
vec4 emissiveColor = texture2D ( emissiveMap , vEmissiveMapUv ) ;
# ifdef DECODE _VIDEO _TEXTURE _EMISSIVE
emissiveColor = sRGBTransferEOTF ( emissiveColor ) ;
# endif
totalEmissiveRadiance *= emissiveColor . rgb ;
# endif ` ,LG= ` # ifdef USE _EMISSIVEMAP
uniform sampler2D emissiveMap ;
# endif ` ,UG="gl_FragColor = linearToOutputTexel( gl_FragColor );",BG= ` vec4 LinearTransferOETF ( in vec4 value ) {
return value ;
}
vec4 sRGBTransferEOTF ( in vec4 value ) {
return vec4 ( mix ( pow ( value . rgb * 0.9478672986 + vec3 ( 0.0521327014 ) , vec3 ( 2.4 ) ) , value . rgb * 0.0773993808 , vec3 ( lessThanEqual ( value . rgb , vec3 ( 0.04045 ) ) ) ) , value . a ) ;
}
vec4 sRGBTransferOETF ( in vec4 value ) {
return vec4 ( mix ( pow ( value . rgb , vec3 ( 0.41666 ) ) * 1.055 - vec3 ( 0.055 ) , value . rgb * 12.92 , vec3 ( lessThanEqual ( value . rgb , vec3 ( 0.0031308 ) ) ) ) , value . a ) ;
} ` ,OG= ` # ifdef USE _ENVMAP
# ifdef ENV _WORLDPOS
vec3 cameraToFrag ;
if ( isOrthographic ) {
cameraToFrag = normalize ( vec3 ( - viewMatrix [ 0 ] [ 2 ] , - viewMatrix [ 1 ] [ 2 ] , - viewMatrix [ 2 ] [ 2 ] ) ) ;
} else {
cameraToFrag = normalize ( vWorldPosition - cameraPosition ) ;
}
vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;
# ifdef ENVMAP _MODE _REFLECTION
vec3 reflectVec = reflect ( cameraToFrag , worldNormal ) ;
# else
vec3 reflectVec = refract ( cameraToFrag , worldNormal , refractionRatio ) ;
# endif
# else
vec3 reflectVec = vReflect ;
# endif
# ifdef ENVMAP _TYPE _CUBE
vec4 envColor = textureCube ( envMap , envMapRotation * vec3 ( flipEnvMap * reflectVec . x , reflectVec . yz ) ) ;
# else
vec4 envColor = vec4 ( 0.0 ) ;
# endif
# ifdef ENVMAP _BLENDING _MULTIPLY
outgoingLight = mix ( outgoingLight , outgoingLight * envColor . xyz , specularStrength * reflectivity ) ;
# elif defined ( ENVMAP _BLENDING _MIX )
outgoingLight = mix ( outgoingLight , envColor . xyz , specularStrength * reflectivity ) ;
# elif defined ( ENVMAP _BLENDING _ADD )
outgoingLight += envColor . xyz * specularStrength * reflectivity ;
# endif
# endif ` ,IG= ` # ifdef USE _ENVMAP
uniform float envMapIntensity ;
uniform float flipEnvMap ;
uniform mat3 envMapRotation ;
# ifdef ENVMAP _TYPE _CUBE
uniform samplerCube envMap ;
# else
uniform sampler2D envMap ;
# endif
# endif ` ,FG= ` # ifdef USE _ENVMAP
uniform float reflectivity ;
# if defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP ) || defined ( PHONG ) || defined ( LAMBERT )
# define ENV _WORLDPOS
# endif
# ifdef ENV _WORLDPOS
varying vec3 vWorldPosition ;
uniform float refractionRatio ;
# else
varying vec3 vReflect ;
# endif
# endif ` ,kG= ` # ifdef USE _ENVMAP
# if defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP ) || defined ( PHONG ) || defined ( LAMBERT )
# define ENV _WORLDPOS
# endif
# ifdef ENV _WORLDPOS
varying vec3 vWorldPosition ;
# else
varying vec3 vReflect ;
uniform float refractionRatio ;
# endif
# endif ` ,zG= ` # ifdef USE _ENVMAP
# ifdef ENV _WORLDPOS
vWorldPosition = worldPosition . xyz ;
# else
vec3 cameraToVertex ;
if ( isOrthographic ) {
cameraToVertex = normalize ( vec3 ( - viewMatrix [ 0 ] [ 2 ] , - viewMatrix [ 1 ] [ 2 ] , - viewMatrix [ 2 ] [ 2 ] ) ) ;
} else {
cameraToVertex = normalize ( worldPosition . xyz - cameraPosition ) ;
}
vec3 worldNormal = inverseTransformDirection ( transformedNormal , viewMatrix ) ;
# ifdef ENVMAP _MODE _REFLECTION
vReflect = reflect ( cameraToVertex , worldNormal ) ;
# else
vReflect = refract ( cameraToVertex , worldNormal , refractionRatio ) ;
# endif
# endif
# endif ` ,GG= ` # ifdef USE _FOG
vFogDepth = - mvPosition . z ;
# endif ` ,qG= ` # ifdef USE _FOG
varying float vFogDepth ;
# endif ` ,VG= ` # ifdef USE _FOG
# ifdef FOG _EXP2
float fogFactor = 1.0 - exp ( - fogDensity * fogDensity * vFogDepth * vFogDepth ) ;
# else
float fogFactor = smoothstep ( fogNear , fogFar , vFogDepth ) ;
# endif
gl _FragColor . rgb = mix ( gl _FragColor . rgb , fogColor , fogFactor ) ;
# endif ` ,jG= ` # ifdef USE _FOG
uniform vec3 fogColor ;
varying float vFogDepth ;
# ifdef FOG _EXP2
uniform float fogDensity ;
# else
uniform float fogNear ;
uniform float fogFar ;
# endif
# endif ` ,HG= ` # ifdef USE _GRADIENTMAP
uniform sampler2D gradientMap ;
# endif
vec3 getGradientIrradiance ( vec3 normal , vec3 lightDirection ) {
float dotNL = dot ( normal , lightDirection ) ;
vec2 coord = vec2 ( dotNL * 0.5 + 0.5 , 0.0 ) ;
# ifdef USE _GRADIENTMAP
return vec3 ( texture2D ( gradientMap , coord ) . r ) ;
# else
vec2 fw = fwidth ( coord ) * 0.5 ;
return mix ( vec3 ( 0.7 ) , vec3 ( 1.0 ) , smoothstep ( 0.7 - fw . x , 0.7 + fw . x , coord . x ) ) ;
# endif
} ` ,WG= ` # ifdef USE _LIGHTMAP
uniform sampler2D lightMap ;
uniform float lightMapIntensity ;
# endif ` , $ G= ` LambertMaterial material ;
material . diffuseColor = diffuseColor . rgb ;
material . specularStrength = specularStrength ; ` ,XG= ` varying vec3 vViewPosition ;
struct LambertMaterial {
vec3 diffuseColor ;
float specularStrength ;
} ;
void 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 ) {
float dotNL = saturate ( dot ( geometryNormal , directLight . direction ) ) ;
vec3 irradiance = dotNL * directLight . color ;
reflectedLight . directDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
void 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 ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
# define RE _Direct RE _Direct _Lambert
# define RE _IndirectDiffuse RE _IndirectDiffuse _Lambert ` ,YG= ` uniform bool receiveShadow ;
uniform vec3 ambientLightColor ;
# if defined ( USE _LIGHT _PROBES )
uniform vec3 lightProbe [ 9 ] ;
# endif
vec3 shGetIrradianceAt ( in vec3 normal , in vec3 shCoefficients [ 9 ] ) {
float x = normal . x , y = normal . y , z = normal . z ;
vec3 result = shCoefficients [ 0 ] * 0.886227 ;
result += shCoefficients [ 1 ] * 2.0 * 0.511664 * y ;
result += shCoefficients [ 2 ] * 2.0 * 0.511664 * z ;
result += shCoefficients [ 3 ] * 2.0 * 0.511664 * x ;
result += shCoefficients [ 4 ] * 2.0 * 0.429043 * x * y ;
result += shCoefficients [ 5 ] * 2.0 * 0.429043 * y * z ;
result += shCoefficients [ 6 ] * ( 0.743125 * z * z - 0.247708 ) ;
result += shCoefficients [ 7 ] * 2.0 * 0.429043 * x * z ;
result += shCoefficients [ 8 ] * 0.429043 * ( x * x - y * y ) ;
return result ;
}
vec3 getLightProbeIrradiance ( const in vec3 lightProbe [ 9 ] , const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;
vec3 irradiance = shGetIrradianceAt ( worldNormal , lightProbe ) ;
return irradiance ;
}
vec3 getAmbientLightIrradiance ( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor ;
return irradiance ;
}
float getDistanceAttenuation ( const in float lightDistance , const in float cutoffDistance , const in float decayExponent ) {
float distanceFalloff = 1.0 / max ( pow ( lightDistance , decayExponent ) , 0.01 ) ;
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2 ( saturate ( 1.0 - pow4 ( lightDistance / cutoffDistance ) ) ) ;
}
return distanceFalloff ;
}
float getSpotAttenuation ( const in float coneCosine , const in float penumbraCosine , const in float angleCosine ) {
return smoothstep ( coneCosine , penumbraCosine , angleCosine ) ;
}
# if NUM _DIR _LIGHTS > 0
struct DirectionalLight {
vec3 direction ;
vec3 color ;
} ;
uniform DirectionalLight directionalLights [ NUM _DIR _LIGHTS ] ;
void getDirectionalLightInfo ( const in DirectionalLight directionalLight , out IncidentLight light ) {
light . color = directionalLight . color ;
light . direction = directionalLight . direction ;
light . visible = true ;
}
# endif
# if NUM _POINT _LIGHTS > 0
struct PointLight {
vec3 position ;
vec3 color ;
float distance ;
float decay ;
} ;
uniform PointLight pointLights [ NUM _POINT _LIGHTS ] ;
void getPointLightInfo ( const in PointLight pointLight , const in vec3 geometryPosition , out IncidentLight light ) {
vec3 lVector = pointLight . position - geometryPosition ;
light . direction = normalize ( lVector ) ;
float lightDistance = length ( lVector ) ;
light . color = pointLight . color ;
light . color *= getDistanceAttenuation ( lightDistance , pointLight . distance , pointLight . decay ) ;
light . visible = ( light . color != vec3 ( 0.0 ) ) ;
}
# endif
# if NUM _SPOT _LIGHTS > 0
struct SpotLight {
vec3 position ;
vec3 direction ;
vec3 color ;
float distance ;
float decay ;
float coneCos ;
float penumbraCos ;
} ;
uniform SpotLight spotLights [ NUM _SPOT _LIGHTS ] ;
void getSpotLightInfo ( const in SpotLight spotLight , const in vec3 geometryPosition , out IncidentLight light ) {
vec3 lVector = spotLight . position - geometryPosition ;
light . direction = normalize ( lVector ) ;
float angleCos = dot ( light . direction , spotLight . direction ) ;
float spotAttenuation = getSpotAttenuation ( spotLight . coneCos , spotLight . penumbraCos , angleCos ) ;
if ( spotAttenuation > 0.0 ) {
float lightDistance = length ( lVector ) ;
light . color = spotLight . color * spotAttenuation ;
light . color *= getDistanceAttenuation ( lightDistance , spotLight . distance , spotLight . decay ) ;
light . visible = ( light . color != vec3 ( 0.0 ) ) ;
} else {
light . color = vec3 ( 0.0 ) ;
light . visible = false ;
}
}
# endif
# if NUM _RECT _AREA _LIGHTS > 0
struct RectAreaLight {
vec3 color ;
vec3 position ;
vec3 halfWidth ;
vec3 halfHeight ;
} ;
uniform sampler2D ltc _1 ; uniform sampler2D ltc _2 ;
uniform RectAreaLight rectAreaLights [ NUM _RECT _AREA _LIGHTS ] ;
# endif
# if NUM _HEMI _LIGHTS > 0
struct HemisphereLight {
vec3 direction ;
vec3 skyColor ;
vec3 groundColor ;
} ;
uniform HemisphereLight hemisphereLights [ NUM _HEMI _LIGHTS ] ;
vec3 getHemisphereLightIrradiance ( const in HemisphereLight hemiLight , const in vec3 normal ) {
float dotNL = dot ( normal , hemiLight . direction ) ;
float hemiDiffuseWeight = 0.5 * dotNL + 0.5 ;
vec3 irradiance = mix ( hemiLight . groundColor , hemiLight . skyColor , hemiDiffuseWeight ) ;
return irradiance ;
}
# endif ` ,QG= ` # ifdef USE _ENVMAP
vec3 getIBLIrradiance ( const in vec3 normal ) {
# ifdef ENVMAP _TYPE _CUBE _UV
vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;
vec4 envMapColor = textureCubeUV ( envMap , envMapRotation * worldNormal , 1.0 ) ;
return PI * envMapColor . rgb * envMapIntensity ;
# else
return vec3 ( 0.0 ) ;
# endif
}
vec3 getIBLRadiance ( const in vec3 viewDir , const in vec3 normal , const in float roughness ) {
# ifdef ENVMAP _TYPE _CUBE _UV
vec3 reflectVec = reflect ( - viewDir , normal ) ;
reflectVec = normalize ( mix ( reflectVec , normal , roughness * roughness ) ) ;
reflectVec = inverseTransformDirection ( reflectVec , viewMatrix ) ;
vec4 envMapColor = textureCubeUV ( envMap , envMapRotation * reflectVec , roughness ) ;
return envMapColor . rgb * envMapIntensity ;
# else
return vec3 ( 0.0 ) ;
# endif
}
# ifdef USE _ANISOTROPY
vec3 getIBLAnisotropyRadiance ( const in vec3 viewDir , const in vec3 normal , const in float roughness , const in vec3 bitangent , const in float anisotropy ) {
# ifdef ENVMAP _TYPE _CUBE _UV
vec3 bentNormal = cross ( bitangent , viewDir ) ;
bentNormal = normalize ( cross ( bentNormal , bitangent ) ) ;
bentNormal = normalize ( mix ( bentNormal , normal , pow2 ( pow2 ( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ) ;
return getIBLRadiance ( viewDir , bentNormal , roughness ) ;
# else
return vec3 ( 0.0 ) ;
# endif
}
# endif
# endif ` ,KG= ` ToonMaterial material ;
material . diffuseColor = diffuseColor . rgb ; ` ,ZG= ` varying vec3 vViewPosition ;
struct ToonMaterial {
vec3 diffuseColor ;
} ;
void 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 ) {
vec3 irradiance = getGradientIrradiance ( geometryNormal , directLight . direction ) * directLight . color ;
reflectedLight . directDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
void 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 ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
# define RE _Direct RE _Direct _Toon
# define RE _IndirectDiffuse RE _IndirectDiffuse _Toon ` ,JG= ` BlinnPhongMaterial material ;
material . diffuseColor = diffuseColor . rgb ;
material . specularColor = specular ;
material . specularShininess = shininess ;
material . specularStrength = specularStrength ; ` ,eq= ` varying vec3 vViewPosition ;
struct BlinnPhongMaterial {
vec3 diffuseColor ;
vec3 specularColor ;
float specularShininess ;
float specularStrength ;
} ;
void 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 ) {
float dotNL = saturate ( dot ( geometryNormal , directLight . direction ) ) ;
vec3 irradiance = dotNL * directLight . color ;
reflectedLight . directDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
reflectedLight . directSpecular += irradiance * BRDF _BlinnPhong ( directLight . direction , geometryViewDir , geometryNormal , material . specularColor , material . specularShininess ) * material . specularStrength ;
}
void 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 ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
# define RE _Direct RE _Direct _BlinnPhong
# define RE _IndirectDiffuse RE _IndirectDiffuse _BlinnPhong ` ,tq= ` PhysicalMaterial material ;
material . diffuseColor = diffuseColor . rgb * ( 1.0 - metalnessFactor ) ;
vec3 dxy = max ( abs ( dFdx ( nonPerturbedNormal ) ) , abs ( dFdy ( nonPerturbedNormal ) ) ) ;
float geometryRoughness = max ( max ( dxy . x , dxy . y ) , dxy . z ) ;
material . roughness = max ( roughnessFactor , 0.0525 ) ; material . roughness += geometryRoughness ;
material . roughness = min ( material . roughness , 1.0 ) ;
# ifdef IOR
material . ior = ior ;
# ifdef USE _SPECULAR
float specularIntensityFactor = specularIntensity ;
vec3 specularColorFactor = specularColor ;
# ifdef USE _SPECULAR _COLORMAP
specularColorFactor *= texture2D ( specularColorMap , vSpecularColorMapUv ) . rgb ;
# endif
# ifdef USE _SPECULAR _INTENSITYMAP
specularIntensityFactor *= texture2D ( specularIntensityMap , vSpecularIntensityMapUv ) . a ;
# endif
material . specularF90 = mix ( specularIntensityFactor , 1.0 , metalnessFactor ) ;
# else
float specularIntensityFactor = 1.0 ;
vec3 specularColorFactor = vec3 ( 1.0 ) ;
material . specularF90 = 1.0 ;
# endif
material . specularColor = mix ( min ( pow2 ( ( material . ior - 1.0 ) / ( material . ior + 1.0 ) ) * specularColorFactor , vec3 ( 1.0 ) ) * specularIntensityFactor , diffuseColor . rgb , metalnessFactor ) ;
# else
material . specularColor = mix ( vec3 ( 0.04 ) , diffuseColor . rgb , metalnessFactor ) ;
material . specularF90 = 1.0 ;
# endif
# ifdef USE _CLEARCOAT
material . clearcoat = clearcoat ;
material . clearcoatRoughness = clearcoatRoughness ;
material . clearcoatF0 = vec3 ( 0.04 ) ;
material . clearcoatF90 = 1.0 ;
# ifdef USE _CLEARCOATMAP
material . clearcoat *= texture2D ( clearcoatMap , vClearcoatMapUv ) . x ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
material . clearcoatRoughness *= texture2D ( clearcoatRoughnessMap , vClearcoatRoughnessMapUv ) . y ;
# endif
material . clearcoat = saturate ( material . clearcoat ) ; material . clearcoatRoughness = max ( material . clearcoatRoughness , 0.0525 ) ;
material . clearcoatRoughness += geometryRoughness ;
material . clearcoatRoughness = min ( material . clearcoatRoughness , 1.0 ) ;
# endif
# ifdef USE _DISPERSION
material . dispersion = dispersion ;
# endif
# ifdef USE _IRIDESCENCE
material . iridescence = iridescence ;
material . iridescenceIOR = iridescenceIOR ;
# ifdef USE _IRIDESCENCEMAP
material . iridescence *= texture2D ( iridescenceMap , vIridescenceMapUv ) . r ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
material . iridescenceThickness = ( iridescenceThicknessMaximum - iridescenceThicknessMinimum ) * texture2D ( iridescenceThicknessMap , vIridescenceThicknessMapUv ) . g + iridescenceThicknessMinimum ;
# else
material . iridescenceThickness = iridescenceThicknessMaximum ;
# endif
# endif
# ifdef USE _SHEEN
material . sheenColor = sheenColor ;
# ifdef USE _SHEEN _COLORMAP
material . sheenColor *= texture2D ( sheenColorMap , vSheenColorMapUv ) . rgb ;
# endif
material . sheenRoughness = clamp ( sheenRoughness , 0.07 , 1.0 ) ;
# ifdef USE _SHEEN _ROUGHNESSMAP
material . sheenRoughness *= texture2D ( sheenRoughnessMap , vSheenRoughnessMapUv ) . a ;
# endif
# endif
# ifdef USE _ANISOTROPY
# ifdef USE _ANISOTROPYMAP
mat2 anisotropyMat = mat2 ( anisotropyVector . x , anisotropyVector . y , - anisotropyVector . y , anisotropyVector . x ) ;
vec3 anisotropyPolar = texture2D ( anisotropyMap , vAnisotropyMapUv ) . rgb ;
vec2 anisotropyV = anisotropyMat * normalize ( 2.0 * anisotropyPolar . rg - vec2 ( 1.0 ) ) * anisotropyPolar . b ;
# else
vec2 anisotropyV = anisotropyVector ;
# endif
material . anisotropy = length ( anisotropyV ) ;
if ( material . anisotropy == 0.0 ) {
anisotropyV = vec2 ( 1.0 , 0.0 ) ;
} else {
anisotropyV /= material . anisotropy ;
material . anisotropy = saturate ( material . anisotropy ) ;
}
material . alphaT = mix ( pow2 ( material . roughness ) , 1.0 , pow2 ( material . anisotropy ) ) ;
material . anisotropyT = tbn [ 0 ] * anisotropyV . x + tbn [ 1 ] * anisotropyV . y ;
material . anisotropyB = tbn [ 1 ] * anisotropyV . x - tbn [ 0 ] * anisotropyV . y ;
# endif ` ,nq= ` struct PhysicalMaterial {
vec3 diffuseColor ;
float roughness ;
vec3 specularColor ;
float specularF90 ;
float dispersion ;
# ifdef USE _CLEARCOAT
float clearcoat ;
float clearcoatRoughness ;
vec3 clearcoatF0 ;
float clearcoatF90 ;
# endif
# ifdef USE _IRIDESCENCE
float iridescence ;
float iridescenceIOR ;
float iridescenceThickness ;
vec3 iridescenceFresnel ;
vec3 iridescenceF0 ;
# endif
# ifdef USE _SHEEN
vec3 sheenColor ;
float sheenRoughness ;
# endif
# ifdef IOR
float ior ;
# endif
# ifdef USE _TRANSMISSION
float transmission ;
float transmissionAlpha ;
float thickness ;
float attenuationDistance ;
vec3 attenuationColor ;
# endif
# ifdef USE _ANISOTROPY
float anisotropy ;
float alphaT ;
vec3 anisotropyT ;
vec3 anisotropyB ;
# endif
} ;
vec3 clearcoatSpecularDirect = vec3 ( 0.0 ) ;
vec3 clearcoatSpecularIndirect = vec3 ( 0.0 ) ;
vec3 sheenSpecularDirect = vec3 ( 0.0 ) ;
vec3 sheenSpecularIndirect = vec3 ( 0.0 ) ;
vec3 Schlick _to _F0 ( const in vec3 f , const in float f90 , const in float dotVH ) {
float x = clamp ( 1.0 - dotVH , 0.0 , 1.0 ) ;
float x2 = x * x ;
float x5 = clamp ( x * x2 * x2 , 0.0 , 0.9999 ) ;
return ( f - vec3 ( f90 ) * x5 ) / ( 1.0 - x5 ) ;
}
float V _GGX _SmithCorrelated ( const in float alpha , const in float dotNL , const in float dotNV ) {
float a2 = pow2 ( alpha ) ;
float gv = dotNL * sqrt ( a2 + ( 1.0 - a2 ) * pow2 ( dotNV ) ) ;
float gl = dotNV * sqrt ( a2 + ( 1.0 - a2 ) * pow2 ( dotNL ) ) ;
return 0.5 / max ( gv + gl , EPSILON ) ;
}
float D _GGX ( const in float alpha , const in float dotNH ) {
float a2 = pow2 ( alpha ) ;
float denom = pow2 ( dotNH ) * ( a2 - 1.0 ) + 1.0 ;
return RECIPROCAL _PI * a2 / pow2 ( denom ) ;
}
# ifdef USE _ANISOTROPY
float V _GGX _SmithCorrelated _Anisotropic ( const in float alphaT , const in float alphaB , const in float dotTV , const in float dotBV , const in float dotTL , const in float dotBL , const in float dotNV , const in float dotNL ) {
float gv = dotNL * length ( vec3 ( alphaT * dotTV , alphaB * dotBV , dotNV ) ) ;
float gl = dotNV * length ( vec3 ( alphaT * dotTL , alphaB * dotBL , dotNL ) ) ;
float v = 0.5 / ( gv + gl ) ;
return saturate ( v ) ;
}
float D _GGX _Anisotropic ( const in float alphaT , const in float alphaB , const in float dotNH , const in float dotTH , const in float dotBH ) {
float a2 = alphaT * alphaB ;
highp vec3 v = vec3 ( alphaB * dotTH , alphaT * dotBH , a2 * dotNH ) ;
highp float v2 = dot ( v , v ) ;
float w2 = a2 / v2 ;
return RECIPROCAL _PI * a2 * pow2 ( w2 ) ;
}
# endif
# ifdef USE _CLEARCOAT
vec3 BRDF _GGX _Clearcoat ( const in vec3 lightDir , const in vec3 viewDir , const in vec3 normal , const in PhysicalMaterial material ) {
vec3 f0 = material . clearcoatF0 ;
float f90 = material . clearcoatF90 ;
float roughness = material . clearcoatRoughness ;
float alpha = pow2 ( roughness ) ;
vec3 halfDir = normalize ( lightDir + viewDir ) ;
float dotNL = saturate ( dot ( normal , lightDir ) ) ;
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
float dotNH = saturate ( dot ( normal , halfDir ) ) ;
float dotVH = saturate ( dot ( viewDir , halfDir ) ) ;
vec3 F = F _Schlick ( f0 , f90 , dotVH ) ;
float V = V _GGX _SmithCorrelated ( alpha , dotNL , dotNV ) ;
float D = D _GGX ( alpha , dotNH ) ;
return F * ( V * D ) ;
}
# endif
vec3 BRDF _GGX ( const in vec3 lightDir , const in vec3 viewDir , const in vec3 normal , const in PhysicalMaterial material ) {
vec3 f0 = material . specularColor ;
float f90 = material . specularF90 ;
float roughness = material . roughness ;
float alpha = pow2 ( roughness ) ;
vec3 halfDir = normalize ( lightDir + viewDir ) ;
float dotNL = saturate ( dot ( normal , lightDir ) ) ;
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
float dotNH = saturate ( dot ( normal , halfDir ) ) ;
float dotVH = saturate ( dot ( viewDir , halfDir ) ) ;
vec3 F = F _Schlick ( f0 , f90 , dotVH ) ;
# ifdef USE _IRIDESCENCE
F = mix ( F , material . iridescenceFresnel , material . iridescence ) ;
# endif
# ifdef USE _ANISOTROPY
float dotTL = dot ( material . anisotropyT , lightDir ) ;
float dotTV = dot ( material . anisotropyT , viewDir ) ;
float dotTH = dot ( material . anisotropyT , halfDir ) ;
float dotBL = dot ( material . anisotropyB , lightDir ) ;
float dotBV = dot ( material . anisotropyB , viewDir ) ;
float dotBH = dot ( material . anisotropyB , halfDir ) ;
float V = V _GGX _SmithCorrelated _Anisotropic ( material . alphaT , alpha , dotTV , dotBV , dotTL , dotBL , dotNV , dotNL ) ;
float D = D _GGX _Anisotropic ( material . alphaT , alpha , dotNH , dotTH , dotBH ) ;
# else
float V = V _GGX _SmithCorrelated ( alpha , dotNL , dotNV ) ;
float D = D _GGX ( alpha , dotNH ) ;
# endif
return F * ( V * D ) ;
}
vec2 LTC _Uv ( const in vec3 N , const in vec3 V , const in float roughness ) {
const float LUT _SIZE = 64.0 ;
const float LUT _SCALE = ( LUT _SIZE - 1.0 ) / LUT _SIZE ;
const float LUT _BIAS = 0.5 / LUT _SIZE ;
float dotNV = saturate ( dot ( N , V ) ) ;
vec2 uv = vec2 ( roughness , sqrt ( 1.0 - dotNV ) ) ;
uv = uv * LUT _SCALE + LUT _BIAS ;
return uv ;
}
float LTC _ClippedSphereFormFactor ( const in vec3 f ) {
float l = length ( f ) ;
return max ( ( l * l + f . z ) / ( l + 1.0 ) , 0.0 ) ;
}
vec3 LTC _EdgeVectorFormFactor ( const in vec3 v1 , const in vec3 v2 ) {
float x = dot ( v1 , v2 ) ;
float y = abs ( x ) ;
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y ;
float b = 3.4175940 + ( 4.1616724 + y ) * y ;
float v = a / b ;
float theta _sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt ( max ( 1.0 - x * x , 1e-7 ) ) - v ;
return cross ( v1 , v2 ) * theta _sintheta ;
}
vec3 LTC _Evaluate ( const in vec3 N , const in vec3 V , const in vec3 P , const in mat3 mInv , const in vec3 rectCoords [ 4 ] ) {
vec3 v1 = rectCoords [ 1 ] - rectCoords [ 0 ] ;
vec3 v2 = rectCoords [ 3 ] - rectCoords [ 0 ] ;
vec3 lightNormal = cross ( v1 , v2 ) ;
if ( dot ( lightNormal , P - rectCoords [ 0 ] ) < 0.0 ) return vec3 ( 0.0 ) ;
vec3 T1 , T2 ;
T1 = normalize ( V - N * dot ( V , N ) ) ;
T2 = - cross ( N , T1 ) ;
mat3 mat = mInv * transposeMat3 ( mat3 ( T1 , T2 , N ) ) ;
vec3 coords [ 4 ] ;
coords [ 0 ] = mat * ( rectCoords [ 0 ] - P ) ;
coords [ 1 ] = mat * ( rectCoords [ 1 ] - P ) ;
coords [ 2 ] = mat * ( rectCoords [ 2 ] - P ) ;
coords [ 3 ] = mat * ( rectCoords [ 3 ] - P ) ;
coords [ 0 ] = normalize ( coords [ 0 ] ) ;
coords [ 1 ] = normalize ( coords [ 1 ] ) ;
coords [ 2 ] = normalize ( coords [ 2 ] ) ;
coords [ 3 ] = normalize ( coords [ 3 ] ) ;
vec3 vectorFormFactor = vec3 ( 0.0 ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 0 ] , coords [ 1 ] ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 1 ] , coords [ 2 ] ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 2 ] , coords [ 3 ] ) ;
vectorFormFactor += LTC _EdgeVectorFormFactor ( coords [ 3 ] , coords [ 0 ] ) ;
float result = LTC _ClippedSphereFormFactor ( vectorFormFactor ) ;
return vec3 ( result ) ;
}
# if defined ( USE _SHEEN )
float D _Charlie ( float roughness , float dotNH ) {
float alpha = pow2 ( roughness ) ;
float invAlpha = 1.0 / alpha ;
float cos2h = dotNH * dotNH ;
float sin2h = max ( 1.0 - cos2h , 0.0078125 ) ;
return ( 2.0 + invAlpha ) * pow ( sin2h , invAlpha * 0.5 ) / ( 2.0 * PI ) ;
}
float V _Neubelt ( float dotNV , float dotNL ) {
return saturate ( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ) ;
}
vec3 BRDF _Sheen ( const in vec3 lightDir , const in vec3 viewDir , const in vec3 normal , vec3 sheenColor , const in float sheenRoughness ) {
vec3 halfDir = normalize ( lightDir + viewDir ) ;
float dotNL = saturate ( dot ( normal , lightDir ) ) ;
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
float dotNH = saturate ( dot ( normal , halfDir ) ) ;
float D = D _Charlie ( sheenRoughness , dotNH ) ;
float V = V _Neubelt ( dotNV , dotNL ) ;
return sheenColor * ( D * V ) ;
}
# endif
float IBLSheenBRDF ( const in vec3 normal , const in vec3 viewDir , const in float roughness ) {
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
float r2 = roughness * roughness ;
float a = roughness < 0.25 ? - 339.2 * r2 + 161.4 * roughness - 25.9 : - 8.48 * r2 + 14.3 * roughness - 9.95 ;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72 ;
float DG = exp ( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ) ;
return saturate ( DG * RECIPROCAL _PI ) ;
}
vec2 DFGApprox ( const in vec3 normal , const in vec3 viewDir , const in float roughness ) {
float dotNV = saturate ( dot ( normal , viewDir ) ) ;
const vec4 c0 = vec4 ( - 1 , - 0.0275 , - 0.572 , 0.022 ) ;
const vec4 c1 = vec4 ( 1 , 0.0425 , 1.04 , - 0.04 ) ;
vec4 r = roughness * c0 + c1 ;
float a004 = min ( r . x * r . x , exp2 ( - 9.28 * dotNV ) ) * r . x + r . y ;
vec2 fab = vec2 ( - 1.04 , 1.04 ) * a004 + r . zw ;
return fab ;
}
vec3 EnvironmentBRDF ( const in vec3 normal , const in vec3 viewDir , const in vec3 specularColor , const in float specularF90 , const in float roughness ) {
vec2 fab = DFGApprox ( normal , viewDir , roughness ) ;
return specularColor * fab . x + specularF90 * fab . y ;
}
# ifdef USE _IRIDESCENCE
void 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 ) {
# else
void 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 ) {
# endif
vec2 fab = DFGApprox ( normal , viewDir , roughness ) ;
# ifdef USE _IRIDESCENCE
vec3 Fr = mix ( specularColor , iridescenceF0 , iridescence ) ;
# else
vec3 Fr = specularColor ;
# endif
vec3 FssEss = Fr * fab . x + specularF90 * fab . y ;
float Ess = fab . x + fab . y ;
float Ems = 1.0 - Ess ;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619 ; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ) ;
singleScatter += FssEss ;
multiScatter += Fms * Ems ;
}
# if NUM _RECT _AREA _LIGHTS > 0
void RE _Direct _RectArea _Physical ( const in RectAreaLight rectAreaLight , const in vec3 geometryPosition , const in vec3 geometryNormal , const in vec3 geometryViewDir , const in vec3 geometryClearcoatNormal , const in PhysicalMaterial material , inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal ;
vec3 viewDir = geometryViewDir ;
vec3 position = geometryPosition ;
vec3 lightPos = rectAreaLight . position ;
vec3 halfWidth = rectAreaLight . halfWidth ;
vec3 halfHeight = rectAreaLight . halfHeight ;
vec3 lightColor = rectAreaLight . color ;
float roughness = material . roughness ;
vec3 rectCoords [ 4 ] ;
rectCoords [ 0 ] = lightPos + halfWidth - halfHeight ; rectCoords [ 1 ] = lightPos - halfWidth - halfHeight ;
rectCoords [ 2 ] = lightPos - halfWidth + halfHeight ;
rectCoords [ 3 ] = lightPos + halfWidth + halfHeight ;
vec2 uv = LTC _Uv ( normal , viewDir , roughness ) ;
vec4 t1 = texture2D ( ltc _1 , uv ) ;
vec4 t2 = texture2D ( ltc _2 , uv ) ;
mat3 mInv = mat3 (
vec3 ( t1 . x , 0 , t1 . y ) ,
vec3 ( 0 , 1 , 0 ) ,
vec3 ( t1 . z , 0 , t1 . w )
) ;
vec3 fresnel = ( material . specularColor * t2 . x + ( vec3 ( 1.0 ) - material . specularColor ) * t2 . y ) ;
reflectedLight . directSpecular += lightColor * fresnel * LTC _Evaluate ( normal , viewDir , position , mInv , rectCoords ) ;
reflectedLight . directDiffuse += lightColor * material . diffuseColor * LTC _Evaluate ( normal , viewDir , position , mat3 ( 1.0 ) , rectCoords ) ;
}
# endif
void 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 ) {
float dotNL = saturate ( dot ( geometryNormal , directLight . direction ) ) ;
vec3 irradiance = dotNL * directLight . color ;
# ifdef USE _CLEARCOAT
float dotNLcc = saturate ( dot ( geometryClearcoatNormal , directLight . direction ) ) ;
vec3 ccIrradiance = dotNLcc * directLight . color ;
clearcoatSpecularDirect += ccIrradiance * BRDF _GGX _Clearcoat ( directLight . direction , geometryViewDir , geometryClearcoatNormal , material ) ;
# endif
# ifdef USE _SHEEN
sheenSpecularDirect += irradiance * BRDF _Sheen ( directLight . direction , geometryViewDir , geometryNormal , material . sheenColor , material . sheenRoughness ) ;
# endif
reflectedLight . directSpecular += irradiance * BRDF _GGX ( directLight . direction , geometryViewDir , geometryNormal , material ) ;
reflectedLight . directDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
void 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 ) {
reflectedLight . indirectDiffuse += irradiance * BRDF _Lambert ( material . diffuseColor ) ;
}
void 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 ) {
# ifdef USE _CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF ( geometryClearcoatNormal , geometryViewDir , material . clearcoatF0 , material . clearcoatF90 , material . clearcoatRoughness ) ;
# endif
# ifdef USE _SHEEN
sheenSpecularIndirect += irradiance * material . sheenColor * IBLSheenBRDF ( geometryNormal , geometryViewDir , material . sheenRoughness ) ;
# endif
vec3 singleScattering = vec3 ( 0.0 ) ;
vec3 multiScattering = vec3 ( 0.0 ) ;
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL _PI ;
# ifdef USE _IRIDESCENCE
computeMultiscatteringIridescence ( geometryNormal , geometryViewDir , material . specularColor , material . specularF90 , material . iridescence , material . iridescenceFresnel , material . roughness , singleScattering , multiScattering ) ;
# else
computeMultiscattering ( geometryNormal , geometryViewDir , material . specularColor , material . specularF90 , material . roughness , singleScattering , multiScattering ) ;
# endif
vec3 totalScattering = singleScattering + multiScattering ;
vec3 diffuse = material . diffuseColor * ( 1.0 - max ( max ( totalScattering . r , totalScattering . g ) , totalScattering . b ) ) ;
reflectedLight . indirectSpecular += radiance * singleScattering ;
reflectedLight . indirectSpecular += multiScattering * cosineWeightedIrradiance ;
reflectedLight . indirectDiffuse += diffuse * cosineWeightedIrradiance ;
}
# define RE _Direct RE _Direct _Physical
# define RE _Direct _RectArea RE _Direct _RectArea _Physical
# define RE _IndirectDiffuse RE _IndirectDiffuse _Physical
# define RE _IndirectSpecular RE _IndirectSpecular _Physical
float computeSpecularOcclusion ( const in float dotNV , const in float ambientOcclusion , const in float roughness ) {
return saturate ( pow ( dotNV + ambientOcclusion , exp2 ( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ) ;
} ` ,iq= `
vec3 geometryPosition = - vViewPosition ;
vec3 geometryNormal = normal ;
vec3 geometryViewDir = ( isOrthographic ) ? vec3 ( 0 , 0 , 1 ) : normalize ( vViewPosition ) ;
vec3 geometryClearcoatNormal = vec3 ( 0.0 ) ;
# ifdef USE _CLEARCOAT
geometryClearcoatNormal = clearcoatNormal ;
# endif
# ifdef USE _IRIDESCENCE
float dotNVi = saturate ( dot ( normal , geometryViewDir ) ) ;
if ( material . iridescenceThickness == 0.0 ) {
material . iridescence = 0.0 ;
} else {
material . iridescence = saturate ( material . iridescence ) ;
}
if ( material . iridescence > 0.0 ) {
material . iridescenceFresnel = evalIridescence ( 1.0 , material . iridescenceIOR , dotNVi , material . iridescenceThickness , material . specularColor ) ;
material . iridescenceF0 = Schlick _to _F0 ( material . iridescenceFresnel , 1.0 , dotNVi ) ;
}
# endif
IncidentLight directLight ;
# if ( NUM _POINT _LIGHTS > 0 ) && defined ( RE _Direct )
PointLight pointLight ;
# if defined ( USE _SHADOWMAP ) && NUM _POINT _LIGHT _SHADOWS > 0
PointLightShadow pointLightShadow ;
# endif
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHTS ; i ++ ) {
pointLight = pointLights [ i ] ;
getPointLightInfo ( pointLight , geometryPosition , directLight ) ;
# if defined ( USE _SHADOWMAP ) && ( UNROLLED _LOOP _INDEX < NUM _POINT _LIGHT _SHADOWS )
pointLightShadow = pointLightShadows [ i ] ;
directLight . color *= ( directLight . visible && receiveShadow ) ? getPointShadow ( pointShadowMap [ i ] , pointLightShadow . shadowMapSize , pointLightShadow . shadowIntensity , pointLightShadow . shadowBias , pointLightShadow . shadowRadius , vPointShadowCoord [ i ] , pointLightShadow . shadowCameraNear , pointLightShadow . shadowCameraFar ) : 1.0 ;
# endif
RE _Direct ( directLight , geometryPosition , geometryNormal , geometryViewDir , geometryClearcoatNormal , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if ( NUM _SPOT _LIGHTS > 0 ) && defined ( RE _Direct )
SpotLight spotLight ;
vec4 spotColor ;
vec3 spotLightCoord ;
bool inSpotLightMap ;
# if defined ( USE _SHADOWMAP ) && NUM _SPOT _LIGHT _SHADOWS > 0
SpotLightShadow spotLightShadow ;
# endif
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _SPOT _LIGHTS ; i ++ ) {
spotLight = spotLights [ i ] ;
getSpotLightInfo ( spotLight , geometryPosition , directLight ) ;
# if ( UNROLLED _LOOP _INDEX < NUM _SPOT _LIGHT _SHADOWS _WITH _MAPS )
# define SPOT _LIGHT _MAP _INDEX UNROLLED _LOOP _INDEX
# elif ( UNROLLED _LOOP _INDEX < NUM _SPOT _LIGHT _SHADOWS )
# define SPOT _LIGHT _MAP _INDEX NUM _SPOT _LIGHT _MAPS
# else
# define SPOT _LIGHT _MAP _INDEX ( UNROLLED _LOOP _INDEX - NUM _SPOT _LIGHT _SHADOWS + NUM _SPOT _LIGHT _SHADOWS _WITH _MAPS )
# endif
# if ( SPOT _LIGHT _MAP _INDEX < NUM _SPOT _LIGHT _MAPS )
spotLightCoord = vSpotLightCoord [ i ] . xyz / vSpotLightCoord [ i ] . w ;
inSpotLightMap = all ( lessThan ( abs ( spotLightCoord * 2. - 1. ) , vec3 ( 1.0 ) ) ) ;
spotColor = texture2D ( spotLightMap [ SPOT _LIGHT _MAP _INDEX ] , spotLightCoord . xy ) ;
directLight . color = inSpotLightMap ? directLight . color * spotColor . rgb : directLight . color ;
# endif
# undef SPOT _LIGHT _MAP _INDEX
# if defined ( USE _SHADOWMAP ) && ( UNROLLED _LOOP _INDEX < NUM _SPOT _LIGHT _SHADOWS )
spotLightShadow = spotLightShadows [ i ] ;
directLight . color *= ( directLight . visible && receiveShadow ) ? getShadow ( spotShadowMap [ i ] , spotLightShadow . shadowMapSize , spotLightShadow . shadowIntensity , spotLightShadow . shadowBias , spotLightShadow . shadowRadius , vSpotLightCoord [ i ] ) : 1.0 ;
# endif
RE _Direct ( directLight , geometryPosition , geometryNormal , geometryViewDir , geometryClearcoatNormal , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if ( NUM _DIR _LIGHTS > 0 ) && defined ( RE _Direct )
DirectionalLight directionalLight ;
# if defined ( USE _SHADOWMAP ) && NUM _DIR _LIGHT _SHADOWS > 0
DirectionalLightShadow directionalLightShadow ;
# endif
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _DIR _LIGHTS ; i ++ ) {
directionalLight = directionalLights [ i ] ;
getDirectionalLightInfo ( directionalLight , directLight ) ;
# if defined ( USE _SHADOWMAP ) && ( UNROLLED _LOOP _INDEX < NUM _DIR _LIGHT _SHADOWS )
directionalLightShadow = directionalLightShadows [ i ] ;
directLight . color *= ( directLight . visible && receiveShadow ) ? getShadow ( directionalShadowMap [ i ] , directionalLightShadow . shadowMapSize , directionalLightShadow . shadowIntensity , directionalLightShadow . shadowBias , directionalLightShadow . shadowRadius , vDirectionalShadowCoord [ i ] ) : 1.0 ;
# endif
RE _Direct ( directLight , geometryPosition , geometryNormal , geometryViewDir , geometryClearcoatNormal , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if ( NUM _RECT _AREA _LIGHTS > 0 ) && defined ( RE _Direct _RectArea )
RectAreaLight rectAreaLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _RECT _AREA _LIGHTS ; i ++ ) {
rectAreaLight = rectAreaLights [ i ] ;
RE _Direct _RectArea ( rectAreaLight , geometryPosition , geometryNormal , geometryViewDir , geometryClearcoatNormal , material , reflectedLight ) ;
}
# pragma unroll _loop _end
# endif
# if defined ( RE _IndirectDiffuse )
vec3 iblIrradiance = vec3 ( 0.0 ) ;
vec3 irradiance = getAmbientLightIrradiance ( ambientLightColor ) ;
# if defined ( USE _LIGHT _PROBES )
irradiance += getLightProbeIrradiance ( lightProbe , geometryNormal ) ;
# endif
# if ( NUM _HEMI _LIGHTS > 0 )
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _HEMI _LIGHTS ; i ++ ) {
irradiance += getHemisphereLightIrradiance ( hemisphereLights [ i ] , geometryNormal ) ;
}
# pragma unroll _loop _end
# endif
# endif
# if defined ( RE _IndirectSpecular )
vec3 radiance = vec3 ( 0.0 ) ;
vec3 clearcoatRadiance = vec3 ( 0.0 ) ;
# endif ` ,rq= ` # if defined ( RE _IndirectDiffuse )
# ifdef USE _LIGHTMAP
vec4 lightMapTexel = texture2D ( lightMap , vLightMapUv ) ;
vec3 lightMapIrradiance = lightMapTexel . rgb * lightMapIntensity ;
irradiance += lightMapIrradiance ;
# endif
# if defined ( USE _ENVMAP ) && defined ( STANDARD ) && defined ( ENVMAP _TYPE _CUBE _UV )
iblIrradiance += getIBLIrradiance ( geometryNormal ) ;
# endif
# endif
# if defined ( USE _ENVMAP ) && defined ( RE _IndirectSpecular )
# ifdef USE _ANISOTROPY
radiance += getIBLAnisotropyRadiance ( geometryViewDir , geometryNormal , material . roughness , material . anisotropyB , material . anisotropy ) ;
# else
radiance += getIBLRadiance ( geometryViewDir , geometryNormal , material . roughness ) ;
# endif
# ifdef USE _CLEARCOAT
clearcoatRadiance += getIBLRadiance ( geometryViewDir , geometryClearcoatNormal , material . clearcoatRoughness ) ;
# endif
# endif ` ,sq= ` # if defined ( RE _IndirectDiffuse )
RE _IndirectDiffuse ( irradiance , geometryPosition , geometryNormal , geometryViewDir , geometryClearcoatNormal , material , reflectedLight ) ;
# endif
# if defined ( RE _IndirectSpecular )
RE _IndirectSpecular ( radiance , iblIrradiance , clearcoatRadiance , geometryPosition , geometryNormal , geometryViewDir , geometryClearcoatNormal , material , reflectedLight ) ;
# endif ` ,aq= ` # if defined ( USE _LOGDEPTHBUF )
gl _FragDepth = vIsPerspective == 0.0 ? gl _FragCoord . z : log2 ( vFragDepth ) * logDepthBufFC * 0.5 ;
# endif ` ,oq= ` # if defined ( USE _LOGDEPTHBUF )
uniform float logDepthBufFC ;
varying float vFragDepth ;
varying float vIsPerspective ;
# endif ` ,lq= ` # ifdef USE _LOGDEPTHBUF
varying float vFragDepth ;
varying float vIsPerspective ;
# endif ` ,uq= ` # ifdef USE _LOGDEPTHBUF
vFragDepth = 1.0 + gl _Position . w ;
vIsPerspective = float ( isPerspectiveMatrix ( projectionMatrix ) ) ;
# endif ` ,cq= ` # ifdef USE _MAP
vec4 sampledDiffuseColor = texture2D ( map , vMapUv ) ;
# ifdef DECODE _VIDEO _TEXTURE
sampledDiffuseColor = sRGBTransferEOTF ( sampledDiffuseColor ) ;
# endif
diffuseColor *= sampledDiffuseColor ;
# endif ` ,hq= ` # ifdef USE _MAP
uniform sampler2D map ;
# endif ` ,fq= ` # if defined ( USE _MAP ) || defined ( USE _ALPHAMAP )
# if defined ( USE _POINTS _UV )
vec2 uv = vUv ;
# else
vec2 uv = ( uvTransform * vec3 ( gl _PointCoord . x , 1.0 - gl _PointCoord . y , 1 ) ) . xy ;
# endif
# endif
# ifdef USE _MAP
diffuseColor *= texture2D ( map , uv ) ;
# endif
# ifdef USE _ALPHAMAP
diffuseColor . a *= texture2D ( alphaMap , uv ) . g ;
# endif ` ,dq= ` # if defined ( USE _POINTS _UV )
varying vec2 vUv ;
# else
# if defined ( USE _MAP ) || defined ( USE _ALPHAMAP )
uniform mat3 uvTransform ;
# endif
# endif
# ifdef USE _MAP
uniform sampler2D map ;
# endif
# ifdef USE _ALPHAMAP
uniform sampler2D alphaMap ;
# endif ` ,Aq= ` float metalnessFactor = metalness ;
# ifdef USE _METALNESSMAP
vec4 texelMetalness = texture2D ( metalnessMap , vMetalnessMapUv ) ;
metalnessFactor *= texelMetalness . b ;
# endif ` ,pq= ` # ifdef USE _METALNESSMAP
uniform sampler2D metalnessMap ;
# endif ` ,mq= ` # ifdef USE _INSTANCING _MORPH
float morphTargetInfluences [ MORPHTARGETS _COUNT ] ;
float morphTargetBaseInfluence = texelFetch ( morphTexture , ivec2 ( 0 , gl _InstanceID ) , 0 ) . r ;
for ( int i = 0 ; i < MORPHTARGETS _COUNT ; i ++ ) {
morphTargetInfluences [ i ] = texelFetch ( morphTexture , ivec2 ( i + 1 , gl _InstanceID ) , 0 ) . r ;
}
# endif ` ,gq= ` # if defined ( USE _MORPHCOLORS )
vColor *= morphTargetBaseInfluence ;
for ( int i = 0 ; i < MORPHTARGETS _COUNT ; i ++ ) {
# if defined ( USE _COLOR _ALPHA )
if ( morphTargetInfluences [ i ] != 0.0 ) vColor += getMorph ( gl _VertexID , i , 2 ) * morphTargetInfluences [ i ] ;
# elif defined ( USE _COLOR )
if ( morphTargetInfluences [ i ] != 0.0 ) vColor += getMorph ( gl _VertexID , i , 2 ) . rgb * morphTargetInfluences [ i ] ;
# endif
}
# endif ` ,vq= ` # ifdef USE _MORPHNORMALS
objectNormal *= morphTargetBaseInfluence ;
for ( int i = 0 ; i < MORPHTARGETS _COUNT ; i ++ ) {
if ( morphTargetInfluences [ i ] != 0.0 ) objectNormal += getMorph ( gl _VertexID , i , 1 ) . xyz * morphTargetInfluences [ i ] ;
}
# endif ` ,_q= ` # ifdef USE _MORPHTARGETS
# ifndef USE _INSTANCING _MORPH
uniform float morphTargetBaseInfluence ;
uniform float morphTargetInfluences [ MORPHTARGETS _COUNT ] ;
# endif
uniform sampler2DArray morphTargetsTexture ;
uniform ivec2 morphTargetsTextureSize ;
vec4 getMorph ( const in int vertexIndex , const in int morphTargetIndex , const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS _TEXTURE _STRIDE + offset ;
int y = texelIndex / morphTargetsTextureSize . x ;
int x = texelIndex - y * morphTargetsTextureSize . x ;
ivec3 morphUV = ivec3 ( x , y , morphTargetIndex ) ;
return texelFetch ( morphTargetsTexture , morphUV , 0 ) ;
}
# endif ` ,yq= ` # ifdef USE _MORPHTARGETS
transformed *= morphTargetBaseInfluence ;
for ( int i = 0 ; i < MORPHTARGETS _COUNT ; i ++ ) {
if ( morphTargetInfluences [ i ] != 0.0 ) transformed += getMorph ( gl _VertexID , i , 0 ) . xyz * morphTargetInfluences [ i ] ;
}
# endif ` ,xq= ` float faceDirection = gl _FrontFacing ? 1.0 : - 1.0 ;
# ifdef FLAT _SHADED
vec3 fdx = dFdx ( vViewPosition ) ;
vec3 fdy = dFdy ( vViewPosition ) ;
vec3 normal = normalize ( cross ( fdx , fdy ) ) ;
# else
vec3 normal = normalize ( vNormal ) ;
# ifdef DOUBLE _SIDED
normal *= faceDirection ;
# endif
# endif
# if defined ( USE _NORMALMAP _TANGENTSPACE ) || defined ( USE _CLEARCOAT _NORMALMAP ) || defined ( USE _ANISOTROPY )
# ifdef USE _TANGENT
mat3 tbn = mat3 ( normalize ( vTangent ) , normalize ( vBitangent ) , normal ) ;
# else
mat3 tbn = getTangentFrame ( - vViewPosition , normal ,
# if defined ( USE _NORMALMAP )
vNormalMapUv
# elif defined ( USE _CLEARCOAT _NORMALMAP )
vClearcoatNormalMapUv
# else
vUv
# endif
) ;
# endif
# if defined ( DOUBLE _SIDED ) && ! defined ( FLAT _SHADED )
tbn [ 0 ] *= faceDirection ;
tbn [ 1 ] *= faceDirection ;
# endif
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
# ifdef USE _TANGENT
mat3 tbn2 = mat3 ( normalize ( vTangent ) , normalize ( vBitangent ) , normal ) ;
# else
mat3 tbn2 = getTangentFrame ( - vViewPosition , normal , vClearcoatNormalMapUv ) ;
# endif
# if defined ( DOUBLE _SIDED ) && ! defined ( FLAT _SHADED )
tbn2 [ 0 ] *= faceDirection ;
tbn2 [ 1 ] *= faceDirection ;
# endif
# endif
vec3 nonPerturbedNormal = normal ; ` ,bq= ` # ifdef USE _NORMALMAP _OBJECTSPACE
normal = texture2D ( normalMap , vNormalMapUv ) . xyz * 2.0 - 1.0 ;
# ifdef FLIP _SIDED
normal = - normal ;
# endif
# ifdef DOUBLE _SIDED
normal = normal * faceDirection ;
# endif
normal = normalize ( normalMatrix * normal ) ;
# elif defined ( USE _NORMALMAP _TANGENTSPACE )
vec3 mapN = texture2D ( normalMap , vNormalMapUv ) . xyz * 2.0 - 1.0 ;
mapN . xy *= normalScale ;
normal = normalize ( tbn * mapN ) ;
# elif defined ( USE _BUMPMAP )
normal = perturbNormalArb ( - vViewPosition , normal , dHdxy _fwd ( ) , faceDirection ) ;
# endif ` ,Sq= ` # ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif ` ,wq= ` # ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif ` ,Tq= ` # ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# ifdef USE _TANGENT
vTangent = normalize ( transformedTangent ) ;
vBitangent = normalize ( cross ( vNormal , vTangent ) * tangent . w ) ;
# endif
# endif ` ,Mq= ` # ifdef USE _NORMALMAP
uniform sampler2D normalMap ;
uniform vec2 normalScale ;
# endif
# ifdef USE _NORMALMAP _OBJECTSPACE
uniform mat3 normalMatrix ;
# endif
# if ! defined ( USE _TANGENT ) && ( defined ( USE _NORMALMAP _TANGENTSPACE ) || defined ( USE _CLEARCOAT _NORMALMAP ) || defined ( USE _ANISOTROPY ) )
mat3 getTangentFrame ( vec3 eye _pos , vec3 surf _norm , vec2 uv ) {
vec3 q0 = dFdx ( eye _pos . xyz ) ;
vec3 q1 = dFdy ( eye _pos . xyz ) ;
vec2 st0 = dFdx ( uv . st ) ;
vec2 st1 = dFdy ( uv . st ) ;
vec3 N = surf _norm ;
vec3 q1perp = cross ( q1 , N ) ;
vec3 q0perp = cross ( N , q0 ) ;
vec3 T = q1perp * st0 . x + q0perp * st1 . x ;
vec3 B = q1perp * st0 . y + q0perp * st1 . y ;
float det = max ( dot ( T , T ) , dot ( B , B ) ) ;
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt ( det ) ;
return mat3 ( T * scale , B * scale , N ) ;
}
# endif ` ,Eq= ` # ifdef USE _CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal ;
# endif ` ,Cq= ` # ifdef USE _CLEARCOAT _NORMALMAP
vec3 clearcoatMapN = texture2D ( clearcoatNormalMap , vClearcoatNormalMapUv ) . xyz * 2.0 - 1.0 ;
clearcoatMapN . xy *= clearcoatNormalScale ;
clearcoatNormal = normalize ( tbn2 * clearcoatMapN ) ;
# endif ` ,Nq= ` # ifdef USE _CLEARCOATMAP
uniform sampler2D clearcoatMap ;
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
uniform sampler2D clearcoatNormalMap ;
uniform vec2 clearcoatNormalScale ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap ;
# endif ` ,Rq= ` # ifdef USE _IRIDESCENCEMAP
uniform sampler2D iridescenceMap ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
uniform sampler2D iridescenceThicknessMap ;
# endif ` ,Dq= ` # ifdef OPAQUE
diffuseColor . a = 1.0 ;
# endif
# ifdef USE _TRANSMISSION
diffuseColor . a *= material . transmissionAlpha ;
# endif
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ; ` ,Pq= ` vec3 packNormalToRGB ( const in vec3 normal ) {
return normalize ( normal ) * 0.5 + 0.5 ;
}
vec3 unpackRGBToNormal ( const in vec3 rgb ) {
return 2.0 * rgb . xyz - 1.0 ;
}
const float PackUpscale = 256. / 255. ; const float UnpackDownscale = 255. / 256. ; const float ShiftRight8 = 1. / 256. ;
const float Inv255 = 1. / 255. ;
const vec4 PackFactors = vec4 ( 1.0 , 256.0 , 256.0 * 256.0 , 256.0 * 256.0 * 256.0 ) ;
const vec2 UnpackFactors2 = vec2 ( UnpackDownscale , 1.0 / PackFactors . g ) ;
const vec3 UnpackFactors3 = vec3 ( UnpackDownscale / PackFactors . rg , 1.0 / PackFactors . b ) ;
const vec4 UnpackFactors4 = vec4 ( UnpackDownscale / PackFactors . rgb , 1.0 / PackFactors . a ) ;
vec4 packDepthToRGBA ( const in float v ) {
if ( v <= 0.0 )
return vec4 ( 0. , 0. , 0. , 0. ) ;
if ( v >= 1.0 )
return vec4 ( 1. , 1. , 1. , 1. ) ;
float vuf ;
float af = modf ( v * PackFactors . a , vuf ) ;
float bf = modf ( vuf * ShiftRight8 , vuf ) ;
float gf = modf ( vuf * ShiftRight8 , vuf ) ;
return vec4 ( vuf * Inv255 , gf * PackUpscale , bf * PackUpscale , af ) ;
}
vec3 packDepthToRGB ( const in float v ) {
if ( v <= 0.0 )
return vec3 ( 0. , 0. , 0. ) ;
if ( v >= 1.0 )
return vec3 ( 1. , 1. , 1. ) ;
float vuf ;
float bf = modf ( v * PackFactors . b , vuf ) ;
float gf = modf ( vuf * ShiftRight8 , vuf ) ;
return vec3 ( vuf * Inv255 , gf * PackUpscale , bf ) ;
}
vec2 packDepthToRG ( const in float v ) {
if ( v <= 0.0 )
return vec2 ( 0. , 0. ) ;
if ( v >= 1.0 )
return vec2 ( 1. , 1. ) ;
float vuf ;
float gf = modf ( v * 256. , vuf ) ;
return vec2 ( vuf * Inv255 , gf ) ;
}
float unpackRGBAToDepth ( const in vec4 v ) {
return dot ( v , UnpackFactors4 ) ;
}
float unpackRGBToDepth ( const in vec3 v ) {
return dot ( v , UnpackFactors3 ) ;
}
float unpackRGToDepth ( const in vec2 v ) {
return v . r * UnpackFactors2 . r + v . g * UnpackFactors2 . g ;
}
vec4 pack2HalfToRGBA ( const in vec2 v ) {
vec4 r = vec4 ( v . x , fract ( v . x * 255.0 ) , v . y , fract ( v . y * 255.0 ) ) ;
return vec4 ( r . x - r . y / 255.0 , r . y , r . z - r . w / 255.0 , r . w ) ;
}
vec2 unpackRGBATo2Half ( const in vec4 v ) {
return vec2 ( v . x + ( v . y / 255.0 ) , v . z + ( v . w / 255.0 ) ) ;
}
float viewZToOrthographicDepth ( const in float viewZ , const in float near , const in float far ) {
return ( viewZ + near ) / ( near - far ) ;
}
float orthographicDepthToViewZ ( const in float depth , const in float near , const in float far ) {
return depth * ( near - far ) - near ;
}
float viewZToPerspectiveDepth ( const in float viewZ , const in float near , const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ) ;
}
float perspectiveDepthToViewZ ( const in float depth , const in float near , const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far ) ;
} ` ,Lq= ` # ifdef PREMULTIPLIED _ALPHA
gl _FragColor . rgb *= gl _FragColor . a ;
# endif ` ,Uq= ` vec4 mvPosition = vec4 ( transformed , 1.0 ) ;
# ifdef USE _BATCHING
mvPosition = batchingMatrix * mvPosition ;
# endif
# ifdef USE _INSTANCING
mvPosition = instanceMatrix * mvPosition ;
# endif
mvPosition = modelViewMatrix * mvPosition ;
gl _Position = projectionMatrix * mvPosition ; ` ,Bq= ` # ifdef DITHERING
gl _FragColor . rgb = dithering ( gl _FragColor . rgb ) ;
# endif ` ,Oq= ` # ifdef DITHERING
vec3 dithering ( vec3 color ) {
float grid _position = rand ( gl _FragCoord . xy ) ;
vec3 dither _shift _RGB = vec3 ( 0.25 / 255.0 , - 0.25 / 255.0 , 0.25 / 255.0 ) ;
dither _shift _RGB = mix ( 2.0 * dither _shift _RGB , - 2.0 * dither _shift _RGB , grid _position ) ;
return color + dither _shift _RGB ;
}
# endif ` ,Iq= ` float roughnessFactor = roughness ;
# ifdef USE _ROUGHNESSMAP
vec4 texelRoughness = texture2D ( roughnessMap , vRoughnessMapUv ) ;
roughnessFactor *= texelRoughness . g ;
# endif ` ,Fq= ` # ifdef USE _ROUGHNESSMAP
uniform sampler2D roughnessMap ;
# endif ` ,kq= ` # if NUM _SPOT _LIGHT _COORDS > 0
varying vec4 vSpotLightCoord [ NUM _SPOT _LIGHT _COORDS ] ;
# endif
# if NUM _SPOT _LIGHT _MAPS > 0
uniform sampler2D spotLightMap [ NUM _SPOT _LIGHT _MAPS ] ;
# endif
# ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0
uniform sampler2D directionalShadowMap [ NUM _DIR _LIGHT _SHADOWS ] ;
varying vec4 vDirectionalShadowCoord [ NUM _DIR _LIGHT _SHADOWS ] ;
struct DirectionalLightShadow {
float shadowIntensity ;
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform DirectionalLightShadow directionalLightShadows [ NUM _DIR _LIGHT _SHADOWS ] ;
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
uniform sampler2D spotShadowMap [ NUM _SPOT _LIGHT _SHADOWS ] ;
struct SpotLightShadow {
float shadowIntensity ;
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform SpotLightShadow spotLightShadows [ NUM _SPOT _LIGHT _SHADOWS ] ;
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
uniform sampler2D pointShadowMap [ NUM _POINT _LIGHT _SHADOWS ] ;
varying vec4 vPointShadowCoord [ NUM _POINT _LIGHT _SHADOWS ] ;
struct PointLightShadow {
float shadowIntensity ;
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
float shadowCameraNear ;
float shadowCameraFar ;
} ;
uniform PointLightShadow pointLightShadows [ NUM _POINT _LIGHT _SHADOWS ] ;
# endif
float texture2DCompare ( sampler2D depths , vec2 uv , float compare ) {
return step ( compare , unpackRGBAToDepth ( texture2D ( depths , uv ) ) ) ;
}
vec2 texture2DDistribution ( sampler2D shadow , vec2 uv ) {
return unpackRGBATo2Half ( texture2D ( shadow , uv ) ) ;
}
float VSMShadow ( sampler2D shadow , vec2 uv , float compare ) {
float occlusion = 1.0 ;
vec2 distribution = texture2DDistribution ( shadow , uv ) ;
float hard _shadow = step ( compare , distribution . x ) ;
if ( hard _shadow != 1.0 ) {
float distance = compare - distribution . x ;
float variance = max ( 0.00000 , distribution . y * distribution . y ) ;
float softness _probability = variance / ( variance + distance * distance ) ; softness _probability = clamp ( ( softness _probability - 0.3 ) / ( 0.95 - 0.3 ) , 0.0 , 1.0 ) ; occlusion = clamp ( max ( hard _shadow , softness _probability ) , 0.0 , 1.0 ) ;
}
return occlusion ;
}
float getShadow ( sampler2D shadowMap , vec2 shadowMapSize , float shadowIntensity , float shadowBias , float shadowRadius , vec4 shadowCoord ) {
float shadow = 1.0 ;
shadowCoord . xyz /= shadowCoord . w ;
shadowCoord . z += shadowBias ;
bool inFrustum = shadowCoord . x >= 0.0 && shadowCoord . x <= 1.0 && shadowCoord . y >= 0.0 && shadowCoord . y <= 1.0 ;
bool frustumTest = inFrustum && shadowCoord . z <= 1.0 ;
if ( frustumTest ) {
# if defined ( SHADOWMAP _TYPE _PCF )
vec2 texelSize = vec2 ( 1.0 ) / shadowMapSize ;
float dx0 = - texelSize . x * shadowRadius ;
float dy0 = - texelSize . y * shadowRadius ;
float dx1 = + texelSize . x * shadowRadius ;
float dy1 = + texelSize . y * shadowRadius ;
float dx2 = dx0 / 2.0 ;
float dy2 = dy0 / 2.0 ;
float dx3 = dx1 / 2.0 ;
float dy3 = dy1 / 2.0 ;
shadow = (
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx0 , dy0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx1 , dy0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx2 , dy2 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy2 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx3 , dy2 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx0 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx2 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx3 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx1 , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx2 , dy3 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy3 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx3 , dy3 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx0 , dy1 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( 0.0 , dy1 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , shadowCoord . xy + vec2 ( dx1 , dy1 ) , shadowCoord . z )
) * ( 1.0 / 17.0 ) ;
# elif defined ( SHADOWMAP _TYPE _PCF _SOFT )
vec2 texelSize = vec2 ( 1.0 ) / shadowMapSize ;
float dx = texelSize . x ;
float dy = texelSize . y ;
vec2 uv = shadowCoord . xy ;
vec2 f = fract ( uv * shadowMapSize + 0.5 ) ;
uv -= f * texelSize ;
shadow = (
texture2DCompare ( shadowMap , uv , shadowCoord . z ) +
texture2DCompare ( shadowMap , uv + vec2 ( dx , 0.0 ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , uv + vec2 ( 0.0 , dy ) , shadowCoord . z ) +
texture2DCompare ( shadowMap , uv + texelSize , shadowCoord . z ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , 0.0 ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , 0.0 ) , shadowCoord . z ) ,
f . x ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , dy ) , shadowCoord . z ) ,
f . x ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( 0.0 , - dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 0.0 , 2.0 * dy ) , shadowCoord . z ) ,
f . y ) +
mix ( texture2DCompare ( shadowMap , uv + vec2 ( dx , - dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( dx , 2.0 * dy ) , shadowCoord . z ) ,
f . y ) +
mix ( mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , - dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , - dy ) , shadowCoord . z ) ,
f . x ) ,
mix ( texture2DCompare ( shadowMap , uv + vec2 ( - dx , 2.0 * dy ) , shadowCoord . z ) ,
texture2DCompare ( shadowMap , uv + vec2 ( 2.0 * dx , 2.0 * dy ) , shadowCoord . z ) ,
f . x ) ,
f . y )
) * ( 1.0 / 9.0 ) ;
# elif defined ( SHADOWMAP _TYPE _VSM )
shadow = VSMShadow ( shadowMap , shadowCoord . xy , shadowCoord . z ) ;
# else
shadow = texture2DCompare ( shadowMap , shadowCoord . xy , shadowCoord . z ) ;
# endif
}
return mix ( 1.0 , shadow , shadowIntensity ) ;
}
vec2 cubeToUV ( vec3 v , float texelSizeY ) {
vec3 absV = abs ( v ) ;
float scaleToCube = 1.0 / max ( absV . x , max ( absV . y , absV . z ) ) ;
absV *= scaleToCube ;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ) ;
vec2 planar = v . xy ;
float almostATexel = 1.5 * texelSizeY ;
float almostOne = 1.0 - almostATexel ;
if ( absV . z >= almostOne ) {
if ( v . z > 0.0 )
planar . x = 4.0 - v . x ;
} else if ( absV . x >= almostOne ) {
float signX = sign ( v . x ) ;
planar . x = v . z * signX + 2.0 * signX ;
} else if ( absV . y >= almostOne ) {
float signY = sign ( v . y ) ;
planar . x = v . x + 2.0 * signY + 2.0 ;
planar . y = v . z * signY - 2.0 ;
}
return vec2 ( 0.125 , 0.25 ) * planar + vec2 ( 0.375 , 0.75 ) ;
}
float getPointShadow ( sampler2D shadowMap , vec2 shadowMapSize , float shadowIntensity , float shadowBias , float shadowRadius , vec4 shadowCoord , float shadowCameraNear , float shadowCameraFar ) {
float shadow = 1.0 ;
vec3 lightToPosition = shadowCoord . xyz ;
float lightToPositionLength = length ( lightToPosition ) ;
if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ) ; dp += shadowBias ;
vec3 bd3D = normalize ( lightToPosition ) ;
vec2 texelSize = vec2 ( 1.0 ) / ( shadowMapSize * vec2 ( 4.0 , 2.0 ) ) ;
# if defined ( SHADOWMAP _TYPE _PCF ) || defined ( SHADOWMAP _TYPE _PCF _SOFT ) || defined ( SHADOWMAP _TYPE _VSM )
vec2 offset = vec2 ( - 1 , 1 ) * shadowRadius * texelSize . y ;
shadow = (
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xyy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yyy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xyx , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yyx , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xxy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yxy , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . xxx , texelSize . y ) , dp ) +
texture2DCompare ( shadowMap , cubeToUV ( bd3D + offset . yxx , texelSize . y ) , dp )
) * ( 1.0 / 9.0 ) ;
# else
shadow = texture2DCompare ( shadowMap , cubeToUV ( bd3D , texelSize . y ) , dp ) ;
# endif
}
return mix ( 1.0 , shadow , shadowIntensity ) ;
}
# endif ` ,zq= ` # if NUM _SPOT _LIGHT _COORDS > 0
uniform mat4 spotLightMatrix [ NUM _SPOT _LIGHT _COORDS ] ;
varying vec4 vSpotLightCoord [ NUM _SPOT _LIGHT _COORDS ] ;
# endif
# ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0
uniform mat4 directionalShadowMatrix [ NUM _DIR _LIGHT _SHADOWS ] ;
varying vec4 vDirectionalShadowCoord [ NUM _DIR _LIGHT _SHADOWS ] ;
struct DirectionalLightShadow {
float shadowIntensity ;
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform DirectionalLightShadow directionalLightShadows [ NUM _DIR _LIGHT _SHADOWS ] ;
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
struct SpotLightShadow {
float shadowIntensity ;
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
} ;
uniform SpotLightShadow spotLightShadows [ NUM _SPOT _LIGHT _SHADOWS ] ;
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
uniform mat4 pointShadowMatrix [ NUM _POINT _LIGHT _SHADOWS ] ;
varying vec4 vPointShadowCoord [ NUM _POINT _LIGHT _SHADOWS ] ;
struct PointLightShadow {
float shadowIntensity ;
float shadowBias ;
float shadowNormalBias ;
float shadowRadius ;
vec2 shadowMapSize ;
float shadowCameraNear ;
float shadowCameraFar ;
} ;
uniform PointLightShadow pointLightShadows [ NUM _POINT _LIGHT _SHADOWS ] ;
# endif
# endif ` ,Gq= ` # if ( defined ( USE _SHADOWMAP ) && ( NUM _DIR _LIGHT _SHADOWS > 0 || NUM _POINT _LIGHT _SHADOWS > 0 ) ) || ( NUM _SPOT _LIGHT _COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection ( transformedNormal , viewMatrix ) ;
vec4 shadowWorldPosition ;
# endif
# if defined ( USE _SHADOWMAP )
# if NUM _DIR _LIGHT _SHADOWS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _DIR _LIGHT _SHADOWS ; i ++ ) {
shadowWorldPosition = worldPosition + vec4 ( shadowWorldNormal * directionalLightShadows [ i ] . shadowNormalBias , 0 ) ;
vDirectionalShadowCoord [ i ] = directionalShadowMatrix [ i ] * shadowWorldPosition ;
}
# pragma unroll _loop _end
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHT _SHADOWS ; i ++ ) {
shadowWorldPosition = worldPosition + vec4 ( shadowWorldNormal * pointLightShadows [ i ] . shadowNormalBias , 0 ) ;
vPointShadowCoord [ i ] = pointShadowMatrix [ i ] * shadowWorldPosition ;
}
# pragma unroll _loop _end
# endif
# endif
# if NUM _SPOT _LIGHT _COORDS > 0
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _SPOT _LIGHT _COORDS ; i ++ ) {
shadowWorldPosition = worldPosition ;
# if ( defined ( USE _SHADOWMAP ) && UNROLLED _LOOP _INDEX < NUM _SPOT _LIGHT _SHADOWS )
shadowWorldPosition . xyz += shadowWorldNormal * spotLightShadows [ i ] . shadowNormalBias ;
# endif
vSpotLightCoord [ i ] = spotLightMatrix [ i ] * shadowWorldPosition ;
}
# pragma unroll _loop _end
# endif ` ,qq= ` float getShadowMask ( ) {
float shadow = 1.0 ;
# ifdef USE _SHADOWMAP
# if NUM _DIR _LIGHT _SHADOWS > 0
DirectionalLightShadow directionalLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _DIR _LIGHT _SHADOWS ; i ++ ) {
directionalLight = directionalLightShadows [ i ] ;
shadow *= receiveShadow ? getShadow ( directionalShadowMap [ i ] , directionalLight . shadowMapSize , directionalLight . shadowIntensity , directionalLight . shadowBias , directionalLight . shadowRadius , vDirectionalShadowCoord [ i ] ) : 1.0 ;
}
# pragma unroll _loop _end
# endif
# if NUM _SPOT _LIGHT _SHADOWS > 0
SpotLightShadow spotLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _SPOT _LIGHT _SHADOWS ; i ++ ) {
spotLight = spotLightShadows [ i ] ;
shadow *= receiveShadow ? getShadow ( spotShadowMap [ i ] , spotLight . shadowMapSize , spotLight . shadowIntensity , spotLight . shadowBias , spotLight . shadowRadius , vSpotLightCoord [ i ] ) : 1.0 ;
}
# pragma unroll _loop _end
# endif
# if NUM _POINT _LIGHT _SHADOWS > 0
PointLightShadow pointLight ;
# pragma unroll _loop _start
for ( int i = 0 ; i < NUM _POINT _LIGHT _SHADOWS ; i ++ ) {
pointLight = pointLightShadows [ i ] ;
shadow *= receiveShadow ? getPointShadow ( pointShadowMap [ i ] , pointLight . shadowMapSize , pointLight . shadowIntensity , pointLight . shadowBias , pointLight . shadowRadius , vPointShadowCoord [ i ] , pointLight . shadowCameraNear , pointLight . shadowCameraFar ) : 1.0 ;
}
# pragma unroll _loop _end
# endif
# endif
return shadow ;
} ` ,Vq= ` # ifdef USE _SKINNING
mat4 boneMatX = getBoneMatrix ( skinIndex . x ) ;
mat4 boneMatY = getBoneMatrix ( skinIndex . y ) ;
mat4 boneMatZ = getBoneMatrix ( skinIndex . z ) ;
mat4 boneMatW = getBoneMatrix ( skinIndex . w ) ;
# endif ` ,jq= ` # ifdef USE _SKINNING
uniform mat4 bindMatrix ;
uniform mat4 bindMatrixInverse ;
uniform highp sampler2D boneTexture ;
mat4 getBoneMatrix ( const in float i ) {
int size = textureSize ( boneTexture , 0 ) . x ;
int j = int ( i ) * 4 ;
int x = j % size ;
int y = j / size ;
vec4 v1 = texelFetch ( boneTexture , ivec2 ( x , y ) , 0 ) ;
vec4 v2 = texelFetch ( boneTexture , ivec2 ( x + 1 , y ) , 0 ) ;
vec4 v3 = texelFetch ( boneTexture , ivec2 ( x + 2 , y ) , 0 ) ;
vec4 v4 = texelFetch ( boneTexture , ivec2 ( x + 3 , y ) , 0 ) ;
return mat4 ( v1 , v2 , v3 , v4 ) ;
}
# endif ` ,Hq= ` # ifdef USE _SKINNING
vec4 skinVertex = bindMatrix * vec4 ( transformed , 1.0 ) ;
vec4 skinned = vec4 ( 0.0 ) ;
skinned += boneMatX * skinVertex * skinWeight . x ;
skinned += boneMatY * skinVertex * skinWeight . y ;
skinned += boneMatZ * skinVertex * skinWeight . z ;
skinned += boneMatW * skinVertex * skinWeight . w ;
transformed = ( bindMatrixInverse * skinned ) . xyz ;
# endif ` ,Wq= ` # ifdef USE _SKINNING
mat4 skinMatrix = mat4 ( 0.0 ) ;
skinMatrix += skinWeight . x * boneMatX ;
skinMatrix += skinWeight . y * boneMatY ;
skinMatrix += skinWeight . z * boneMatZ ;
skinMatrix += skinWeight . w * boneMatW ;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix ;
objectNormal = vec4 ( skinMatrix * vec4 ( objectNormal , 0.0 ) ) . xyz ;
# ifdef USE _TANGENT
objectTangent = vec4 ( skinMatrix * vec4 ( objectTangent , 0.0 ) ) . xyz ;
# endif
# endif ` , $ q= ` float specularStrength ;
# ifdef USE _SPECULARMAP
vec4 texelSpecular = texture2D ( specularMap , vSpecularMapUv ) ;
specularStrength = texelSpecular . r ;
# else
specularStrength = 1.0 ;
# endif ` ,Xq= ` # ifdef USE _SPECULARMAP
uniform sampler2D specularMap ;
# endif ` ,Yq= ` # if defined ( TONE _MAPPING )
gl _FragColor . rgb = toneMapping ( gl _FragColor . rgb ) ;
# endif ` ,Qq= ` # ifndef saturate
# define saturate ( a ) clamp ( a , 0.0 , 1.0 )
# endif
uniform float toneMappingExposure ;
vec3 LinearToneMapping ( vec3 color ) {
return saturate ( toneMappingExposure * color ) ;
}
vec3 ReinhardToneMapping ( vec3 color ) {
color *= toneMappingExposure ;
return saturate ( color / ( vec3 ( 1.0 ) + color ) ) ;
}
vec3 CineonToneMapping ( vec3 color ) {
color *= toneMappingExposure ;
color = max ( vec3 ( 0.0 ) , color - 0.004 ) ;
return pow ( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ) , vec3 ( 2.2 ) ) ;
}
vec3 RRTAndODTFit ( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537 ;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081 ;
return a / b ;
}
vec3 ACESFilmicToneMapping ( vec3 color ) {
const mat3 ACESInputMat = mat3 (
vec3 ( 0.59719 , 0.07600 , 0.02840 ) , vec3 ( 0.35458 , 0.90834 , 0.13383 ) ,
vec3 ( 0.04823 , 0.01566 , 0.83777 )
) ;
const mat3 ACESOutputMat = mat3 (
vec3 ( 1.60475 , - 0.10208 , - 0.00327 ) , vec3 ( - 0.53108 , 1.10813 , - 0.07276 ) ,
vec3 ( - 0.07367 , - 0.00605 , 1.07602 )
) ;
color *= toneMappingExposure / 0.6 ;
color = ACESInputMat * color ;
color = RRTAndODTFit ( color ) ;
color = ACESOutputMat * color ;
return saturate ( color ) ;
}
const mat3 LINEAR _REC2020 _TO _LINEAR _SRGB = mat3 (
vec3 ( 1.6605 , - 0.1246 , - 0.0182 ) ,
vec3 ( - 0.5876 , 1.1329 , - 0.1006 ) ,
vec3 ( - 0.0728 , - 0.0083 , 1.1187 )
) ;
const mat3 LINEAR _SRGB _TO _LINEAR _REC2020 = mat3 (
vec3 ( 0.6274 , 0.0691 , 0.0164 ) ,
vec3 ( 0.3293 , 0.9195 , 0.0880 ) ,
vec3 ( 0.0433 , 0.0113 , 0.8956 )
) ;
vec3 agxDefaultContrastApprox ( vec3 x ) {
vec3 x2 = x * x ;
vec3 x4 = x2 * x2 ;
return + 15.5 * x4 * x2
- 40.14 * x4 * x
+ 31.96 * x4
- 6.868 * x2 * x
+ 0.4298 * x2
+ 0.1191 * x
- 0.00232 ;
}
vec3 AgXToneMapping ( vec3 color ) {
const mat3 AgXInsetMatrix = mat3 (
vec3 ( 0.856627153315983 , 0.137318972929847 , 0.11189821299995 ) ,
vec3 ( 0.0951212405381588 , 0.761241990602591 , 0.0767994186031903 ) ,
vec3 ( 0.0482516061458583 , 0.101439036467562 , 0.811302368396859 )
) ;
const mat3 AgXOutsetMatrix = mat3 (
vec3 ( 1.1271005818144368 , - 0.1413297634984383 , - 0.14132976349843826 ) ,
vec3 ( - 0.11060664309660323 , 1.157823702216272 , - 0.11060664309660294 ) ,
vec3 ( - 0.016493938717834573 , - 0.016493938717834257 , 1.2519364065950405 )
) ;
const float AgxMinEv = - 12.47393 ; const float AgxMaxEv = 4.026069 ;
color *= toneMappingExposure ;
color = LINEAR _SRGB _TO _LINEAR _REC2020 * color ;
color = AgXInsetMatrix * color ;
color = max ( color , 1e-10 ) ; color = log2 ( color ) ;
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ) ;
color = clamp ( color , 0.0 , 1.0 ) ;
color = agxDefaultContrastApprox ( color ) ;
color = AgXOutsetMatrix * color ;
color = pow ( max ( vec3 ( 0.0 ) , color ) , vec3 ( 2.2 ) ) ;
color = LINEAR _REC2020 _TO _LINEAR _SRGB * color ;
color = clamp ( color , 0.0 , 1.0 ) ;
return color ;
}
vec3 NeutralToneMapping ( vec3 color ) {
const float StartCompression = 0.8 - 0.04 ;
const float Desaturation = 0.15 ;
color *= toneMappingExposure ;
float x = min ( color . r , min ( color . g , color . b ) ) ;
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04 ;
color -= offset ;
float peak = max ( color . r , max ( color . g , color . b ) ) ;
if ( peak < StartCompression ) return color ;
float d = 1. - StartCompression ;
float newPeak = 1. - d * d / ( peak + d - StartCompression ) ;
color *= newPeak / peak ;
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ) ;
return mix ( color , vec3 ( newPeak ) , g ) ;
}
vec3 CustomToneMapping ( vec3 color ) { return color ; } ` ,Kq= ` # ifdef USE _TRANSMISSION
material . transmission = transmission ;
material . transmissionAlpha = 1.0 ;
material . thickness = thickness ;
material . attenuationDistance = attenuationDistance ;
material . attenuationColor = attenuationColor ;
# ifdef USE _TRANSMISSIONMAP
material . transmission *= texture2D ( transmissionMap , vTransmissionMapUv ) . r ;
# endif
# ifdef USE _THICKNESSMAP
material . thickness *= texture2D ( thicknessMap , vThicknessMapUv ) . g ;
# endif
vec3 pos = vWorldPosition ;
vec3 v = normalize ( cameraPosition - pos ) ;
vec3 n = inverseTransformDirection ( normal , viewMatrix ) ;
vec4 transmitted = getIBLVolumeRefraction (
n , v , material . roughness , material . diffuseColor , material . specularColor , material . specularF90 ,
pos , modelMatrix , viewMatrix , projectionMatrix , material . dispersion , material . ior , material . thickness ,
material . attenuationColor , material . attenuationDistance ) ;
material . transmissionAlpha = mix ( material . transmissionAlpha , transmitted . a , material . transmission ) ;
totalDiffuse = mix ( totalDiffuse , transmitted . rgb , material . transmission ) ;
# endif ` ,Zq= ` # ifdef USE _TRANSMISSION
uniform float transmission ;
uniform float thickness ;
uniform float attenuationDistance ;
uniform vec3 attenuationColor ;
# ifdef USE _TRANSMISSIONMAP
uniform sampler2D transmissionMap ;
# endif
# ifdef USE _THICKNESSMAP
uniform sampler2D thicknessMap ;
# endif
uniform vec2 transmissionSamplerSize ;
uniform sampler2D transmissionSamplerMap ;
uniform mat4 modelMatrix ;
uniform mat4 projectionMatrix ;
varying vec3 vWorldPosition ;
float w0 ( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ) ;
}
float w1 ( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ) ;
}
float w2 ( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ) ;
}
float w3 ( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a ) ;
}
float g0 ( float a ) {
return w0 ( a ) + w1 ( a ) ;
}
float g1 ( float a ) {
return w2 ( a ) + w3 ( a ) ;
}
float h0 ( float a ) {
return - 1.0 + w1 ( a ) / ( w0 ( a ) + w1 ( a ) ) ;
}
float h1 ( float a ) {
return 1.0 + w3 ( a ) / ( w2 ( a ) + w3 ( a ) ) ;
}
vec4 bicubic ( sampler2D tex , vec2 uv , vec4 texelSize , float lod ) {
uv = uv * texelSize . zw + 0.5 ;
vec2 iuv = floor ( uv ) ;
vec2 fuv = fract ( uv ) ;
float g0x = g0 ( fuv . x ) ;
float g1x = g1 ( fuv . x ) ;
float h0x = h0 ( fuv . x ) ;
float h1x = h1 ( fuv . x ) ;
float h0y = h0 ( fuv . y ) ;
float h1y = h1 ( fuv . y ) ;
vec2 p0 = ( vec2 ( iuv . x + h0x , iuv . y + h0y ) - 0.5 ) * texelSize . xy ;
vec2 p1 = ( vec2 ( iuv . x + h1x , iuv . y + h0y ) - 0.5 ) * texelSize . xy ;
vec2 p2 = ( vec2 ( iuv . x + h0x , iuv . y + h1y ) - 0.5 ) * texelSize . xy ;
vec2 p3 = ( vec2 ( iuv . x + h1x , iuv . y + h1y ) - 0.5 ) * texelSize . xy ;
return g0 ( fuv . y ) * ( g0x * textureLod ( tex , p0 , lod ) + g1x * textureLod ( tex , p1 , lod ) ) +
g1 ( fuv . y ) * ( g0x * textureLod ( tex , p2 , lod ) + g1x * textureLod ( tex , p3 , lod ) ) ;
}
vec4 textureBicubic ( sampler2D sampler , vec2 uv , float lod ) {
vec2 fLodSize = vec2 ( textureSize ( sampler , int ( lod ) ) ) ;
vec2 cLodSize = vec2 ( textureSize ( sampler , int ( lod + 1.0 ) ) ) ;
vec2 fLodSizeInv = 1.0 / fLodSize ;
vec2 cLodSizeInv = 1.0 / cLodSize ;
vec4 fSample = bicubic ( sampler , uv , vec4 ( fLodSizeInv , fLodSize ) , floor ( lod ) ) ;
vec4 cSample = bicubic ( sampler , uv , vec4 ( cLodSizeInv , cLodSize ) , ceil ( lod ) ) ;
return mix ( fSample , cSample , fract ( lod ) ) ;
}
vec3 getVolumeTransmissionRay ( const in vec3 n , const in vec3 v , const in float thickness , const in float ior , const in mat4 modelMatrix ) {
vec3 refractionVector = refract ( - v , normalize ( n ) , 1.0 / ior ) ;
vec3 modelScale ;
modelScale . x = length ( vec3 ( modelMatrix [ 0 ] . xyz ) ) ;
modelScale . y = length ( vec3 ( modelMatrix [ 1 ] . xyz ) ) ;
modelScale . z = length ( vec3 ( modelMatrix [ 2 ] . xyz ) ) ;
return normalize ( refractionVector ) * thickness * modelScale ;
}
float applyIorToRoughness ( const in float roughness , const in float ior ) {
return roughness * clamp ( ior * 2.0 - 2.0 , 0.0 , 1.0 ) ;
}
vec4 getTransmissionSample ( const in vec2 fragCoord , const in float roughness , const in float ior ) {
float lod = log2 ( transmissionSamplerSize . x ) * applyIorToRoughness ( roughness , ior ) ;
return textureBicubic ( transmissionSamplerMap , fragCoord . xy , lod ) ;
}
vec3 volumeAttenuation ( const in float transmissionDistance , const in vec3 attenuationColor , const in float attenuationDistance ) {
if ( isinf ( attenuationDistance ) ) {
return vec3 ( 1.0 ) ;
} else {
vec3 attenuationCoefficient = - log ( attenuationColor ) / attenuationDistance ;
vec3 transmittance = exp ( - attenuationCoefficient * transmissionDistance ) ; return transmittance ;
}
}
vec4 getIBLVolumeRefraction ( const in vec3 n , const in vec3 v , const in float roughness , const in vec3 diffuseColor ,
const in vec3 specularColor , const in float specularF90 , const in vec3 position , const in mat4 modelMatrix ,
const in mat4 viewMatrix , const in mat4 projMatrix , const in float dispersion , const in float ior , const in float thickness ,
const in vec3 attenuationColor , const in float attenuationDistance ) {
vec4 transmittedLight ;
vec3 transmittance ;
# ifdef USE _DISPERSION
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion ;
vec3 iors = vec3 ( ior - halfSpread , ior , ior + halfSpread ) ;
for ( int i = 0 ; i < 3 ; i ++ ) {
vec3 transmissionRay = getVolumeTransmissionRay ( n , v , thickness , iors [ i ] , modelMatrix ) ;
vec3 refractedRayExit = position + transmissionRay ;
vec4 ndcPos = projMatrix * viewMatrix * vec4 ( refractedRayExit , 1.0 ) ;
vec2 refractionCoords = ndcPos . xy / ndcPos . w ;
refractionCoords += 1.0 ;
refractionCoords /= 2.0 ;
vec4 transmissionSample = getTransmissionSample ( refractionCoords , roughness , iors [ i ] ) ;
transmittedLight [ i ] = transmissionSample [ i ] ;
transmittedLight . a += transmissionSample . a ;
transmittance [ i ] = diffuseColor [ i ] * volumeAttenuation ( length ( transmissionRay ) , attenuationColor , attenuationDistance ) [ i ] ;
}
transmittedLight . a /= 3.0 ;
# else
vec3 transmissionRay = getVolumeTransmissionRay ( n , v , thickness , ior , modelMatrix ) ;
vec3 refractedRayExit = position + transmissionRay ;
vec4 ndcPos = projMatrix * viewMatrix * vec4 ( refractedRayExit , 1.0 ) ;
vec2 refractionCoords = ndcPos . xy / ndcPos . w ;
refractionCoords += 1.0 ;
refractionCoords /= 2.0 ;
transmittedLight = getTransmissionSample ( refractionCoords , roughness , ior ) ;
transmittance = diffuseColor * volumeAttenuation ( length ( transmissionRay ) , attenuationColor , attenuationDistance ) ;
# endif
vec3 attenuatedColor = transmittance * transmittedLight . rgb ;
vec3 F = EnvironmentBRDF ( n , v , specularColor , specularF90 , roughness ) ;
float transmittanceFactor = ( transmittance . r + transmittance . g + transmittance . b ) / 3.0 ;
return vec4 ( ( 1.0 - F ) * attenuatedColor , 1.0 - ( 1.0 - transmittedLight . a ) * transmittanceFactor ) ;
}
# endif ` ,Jq= ` # if defined ( USE _UV ) || defined ( USE _ANISOTROPY )
varying vec2 vUv ;
# endif
# ifdef USE _MAP
varying vec2 vMapUv ;
# endif
# ifdef USE _ALPHAMAP
varying vec2 vAlphaMapUv ;
# endif
# ifdef USE _LIGHTMAP
varying vec2 vLightMapUv ;
# endif
# ifdef USE _AOMAP
varying vec2 vAoMapUv ;
# endif
# ifdef USE _BUMPMAP
varying vec2 vBumpMapUv ;
# endif
# ifdef USE _NORMALMAP
varying vec2 vNormalMapUv ;
# endif
# ifdef USE _EMISSIVEMAP
varying vec2 vEmissiveMapUv ;
# endif
# ifdef USE _METALNESSMAP
varying vec2 vMetalnessMapUv ;
# endif
# ifdef USE _ROUGHNESSMAP
varying vec2 vRoughnessMapUv ;
# endif
# ifdef USE _ANISOTROPYMAP
varying vec2 vAnisotropyMapUv ;
# endif
# ifdef USE _CLEARCOATMAP
varying vec2 vClearcoatMapUv ;
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
varying vec2 vClearcoatNormalMapUv ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv ;
# endif
# ifdef USE _IRIDESCENCEMAP
varying vec2 vIridescenceMapUv ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv ;
# endif
# ifdef USE _SHEEN _COLORMAP
varying vec2 vSheenColorMapUv ;
# endif
# ifdef USE _SHEEN _ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv ;
# endif
# ifdef USE _SPECULARMAP
varying vec2 vSpecularMapUv ;
# endif
# ifdef USE _SPECULAR _COLORMAP
varying vec2 vSpecularColorMapUv ;
# endif
# ifdef USE _SPECULAR _INTENSITYMAP
varying vec2 vSpecularIntensityMapUv ;
# endif
# ifdef USE _TRANSMISSIONMAP
uniform mat3 transmissionMapTransform ;
varying vec2 vTransmissionMapUv ;
# endif
# ifdef USE _THICKNESSMAP
uniform mat3 thicknessMapTransform ;
varying vec2 vThicknessMapUv ;
# endif ` ,eV= ` # if defined ( USE _UV ) || defined ( USE _ANISOTROPY )
varying vec2 vUv ;
# endif
# ifdef USE _MAP
uniform mat3 mapTransform ;
varying vec2 vMapUv ;
# endif
# ifdef USE _ALPHAMAP
uniform mat3 alphaMapTransform ;
varying vec2 vAlphaMapUv ;
# endif
# ifdef USE _LIGHTMAP
uniform mat3 lightMapTransform ;
varying vec2 vLightMapUv ;
# endif
# ifdef USE _AOMAP
uniform mat3 aoMapTransform ;
varying vec2 vAoMapUv ;
# endif
# ifdef USE _BUMPMAP
uniform mat3 bumpMapTransform ;
varying vec2 vBumpMapUv ;
# endif
# ifdef USE _NORMALMAP
uniform mat3 normalMapTransform ;
varying vec2 vNormalMapUv ;
# endif
# ifdef USE _DISPLACEMENTMAP
uniform mat3 displacementMapTransform ;
varying vec2 vDisplacementMapUv ;
# endif
# ifdef USE _EMISSIVEMAP
uniform mat3 emissiveMapTransform ;
varying vec2 vEmissiveMapUv ;
# endif
# ifdef USE _METALNESSMAP
uniform mat3 metalnessMapTransform ;
varying vec2 vMetalnessMapUv ;
# endif
# ifdef USE _ROUGHNESSMAP
uniform mat3 roughnessMapTransform ;
varying vec2 vRoughnessMapUv ;
# endif
# ifdef USE _ANISOTROPYMAP
uniform mat3 anisotropyMapTransform ;
varying vec2 vAnisotropyMapUv ;
# endif
# ifdef USE _CLEARCOATMAP
uniform mat3 clearcoatMapTransform ;
varying vec2 vClearcoatMapUv ;
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
uniform mat3 clearcoatNormalMapTransform ;
varying vec2 vClearcoatNormalMapUv ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform ;
varying vec2 vClearcoatRoughnessMapUv ;
# endif
# ifdef USE _SHEEN _COLORMAP
uniform mat3 sheenColorMapTransform ;
varying vec2 vSheenColorMapUv ;
# endif
# ifdef USE _SHEEN _ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform ;
varying vec2 vSheenRoughnessMapUv ;
# endif
# ifdef USE _IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform ;
varying vec2 vIridescenceMapUv ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform ;
varying vec2 vIridescenceThicknessMapUv ;
# endif
# ifdef USE _SPECULARMAP
uniform mat3 specularMapTransform ;
varying vec2 vSpecularMapUv ;
# endif
# ifdef USE _SPECULAR _COLORMAP
uniform mat3 specularColorMapTransform ;
varying vec2 vSpecularColorMapUv ;
# endif
# ifdef USE _SPECULAR _INTENSITYMAP
uniform mat3 specularIntensityMapTransform ;
varying vec2 vSpecularIntensityMapUv ;
# endif
# ifdef USE _TRANSMISSIONMAP
uniform mat3 transmissionMapTransform ;
varying vec2 vTransmissionMapUv ;
# endif
# ifdef USE _THICKNESSMAP
uniform mat3 thicknessMapTransform ;
varying vec2 vThicknessMapUv ;
# endif ` ,tV= ` # if defined ( USE _UV ) || defined ( USE _ANISOTROPY )
vUv = vec3 ( uv , 1 ) . xy ;
# endif
# ifdef USE _MAP
vMapUv = ( mapTransform * vec3 ( MAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3 ( ALPHAMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3 ( LIGHTMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _AOMAP
vAoMapUv = ( aoMapTransform * vec3 ( AOMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3 ( BUMPMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3 ( NORMALMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3 ( DISPLACEMENTMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3 ( EMISSIVEMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3 ( METALNESSMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3 ( ROUGHNESSMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3 ( ANISOTROPYMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3 ( CLEARCOATMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3 ( CLEARCOAT _NORMALMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3 ( CLEARCOAT _ROUGHNESSMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3 ( IRIDESCENCEMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3 ( IRIDESCENCE _THICKNESSMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _SHEEN _COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3 ( SHEEN _COLORMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _SHEEN _ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3 ( SHEEN _ROUGHNESSMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3 ( SPECULARMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _SPECULAR _COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3 ( SPECULAR _COLORMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _SPECULAR _INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3 ( SPECULAR _INTENSITYMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3 ( TRANSMISSIONMAP _UV , 1 ) ) . xy ;
# endif
# ifdef USE _THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3 ( THICKNESSMAP _UV , 1 ) ) . xy ;
# endif ` ,nV= ` # if defined ( USE _ENVMAP ) || defined ( DISTANCE ) || defined ( USE _SHADOWMAP ) || defined ( USE _TRANSMISSION ) || NUM _SPOT _LIGHT _COORDS > 0
vec4 worldPosition = vec4 ( transformed , 1.0 ) ;
# ifdef USE _BATCHING
worldPosition = batchingMatrix * worldPosition ;
# endif
# ifdef USE _INSTANCING
worldPosition = instanceMatrix * worldPosition ;
# endif
worldPosition = modelMatrix * worldPosition ;
# endif ` ;const iV= ` varying vec2 vUv ;
uniform mat3 uvTransform ;
void main ( ) {
vUv = ( uvTransform * vec3 ( uv , 1 ) ) . xy ;
gl _Position = vec4 ( position . xy , 1.0 , 1.0 ) ;
} ` ,rV= ` uniform sampler2D t2D ;
uniform float backgroundIntensity ;
varying vec2 vUv ;
void main ( ) {
vec4 texColor = texture2D ( t2D , vUv ) ;
# ifdef DECODE _VIDEO _TEXTURE
texColor = vec4 ( mix ( pow ( texColor . rgb * 0.9478672986 + vec3 ( 0.0521327014 ) , vec3 ( 2.4 ) ) , texColor . rgb * 0.0773993808 , vec3 ( lessThanEqual ( texColor . rgb , vec3 ( 0.04045 ) ) ) ) , texColor . w ) ;
# endif
texColor . rgb *= backgroundIntensity ;
gl _FragColor = texColor ;
# include < tonemapping _fragment >
# include < colorspace _fragment >
} ` ,sV= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
} ` ,aV= ` # ifdef ENVMAP _TYPE _CUBE
uniform samplerCube envMap ;
# elif defined ( ENVMAP _TYPE _CUBE _UV )
uniform sampler2D envMap ;
# endif
uniform float flipEnvMap ;
uniform float backgroundBlurriness ;
uniform float backgroundIntensity ;
uniform mat3 backgroundRotation ;
varying vec3 vWorldDirection ;
# include < cube _uv _reflection _fragment >
void main ( ) {
# ifdef ENVMAP _TYPE _CUBE
vec4 texColor = textureCube ( envMap , backgroundRotation * vec3 ( flipEnvMap * vWorldDirection . x , vWorldDirection . yz ) ) ;
# elif defined ( ENVMAP _TYPE _CUBE _UV )
vec4 texColor = textureCubeUV ( envMap , backgroundRotation * vWorldDirection , backgroundBlurriness ) ;
# else
vec4 texColor = vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
# endif
texColor . rgb *= backgroundIntensity ;
gl _FragColor = texColor ;
# include < tonemapping _fragment >
# include < colorspace _fragment >
} ` ,oV= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
} ` ,lV= ` uniform samplerCube tCube ;
uniform float tFlip ;
uniform float opacity ;
varying vec3 vWorldDirection ;
void main ( ) {
vec4 texColor = textureCube ( tCube , vec3 ( tFlip * vWorldDirection . x , vWorldDirection . yz ) ) ;
gl _FragColor = texColor ;
gl _FragColor . a *= opacity ;
# include < tonemapping _fragment >
# include < colorspace _fragment >
} ` ,uV= ` # include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
varying vec2 vHighPrecisionZW ;
void main ( ) {
# include < uv _vertex >
# include < batching _vertex >
# include < skinbase _vertex >
# include < morphinstance _vertex >
# ifdef USE _DISPLACEMENTMAP
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinnormal _vertex >
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vHighPrecisionZW = gl _Position . zw ;
} ` ,cV= ` # if DEPTH _PACKING == 3200
uniform float opacity ;
# endif
# include < common >
# include < packing >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
varying vec2 vHighPrecisionZW ;
void main ( ) {
vec4 diffuseColor = vec4 ( 1.0 ) ;
# include < clipping _planes _fragment >
# if DEPTH _PACKING == 3200
diffuseColor . a = opacity ;
# endif
# include < map _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < logdepthbuf _fragment >
float fragCoordZ = 0.5 * vHighPrecisionZW [ 0 ] / vHighPrecisionZW [ 1 ] + 0.5 ;
# if DEPTH _PACKING == 3200
gl _FragColor = vec4 ( vec3 ( 1.0 - fragCoordZ ) , opacity ) ;
# elif DEPTH _PACKING == 3201
gl _FragColor = packDepthToRGBA ( fragCoordZ ) ;
# elif DEPTH _PACKING == 3202
gl _FragColor = vec4 ( packDepthToRGB ( fragCoordZ ) , 1.0 ) ;
# elif DEPTH _PACKING == 3203
gl _FragColor = vec4 ( packDepthToRG ( fragCoordZ ) , 0.0 , 1.0 ) ;
# endif
} ` ,hV= ` # define DISTANCE
varying vec3 vWorldPosition ;
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < batching _vertex >
# include < skinbase _vertex >
# include < morphinstance _vertex >
# ifdef USE _DISPLACEMENTMAP
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinnormal _vertex >
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < worldpos _vertex >
# include < clipping _planes _vertex >
vWorldPosition = worldPosition . xyz ;
} ` ,fV= ` # define DISTANCE
uniform vec3 referencePosition ;
uniform float nearDistance ;
uniform float farDistance ;
varying vec3 vWorldPosition ;
# include < common >
# include < packing >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( 1.0 ) ;
# include < clipping _planes _fragment >
# include < map _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
float dist = length ( vWorldPosition - referencePosition ) ;
dist = ( dist - nearDistance ) / ( farDistance - nearDistance ) ;
dist = saturate ( dist ) ;
gl _FragColor = packDepthToRGBA ( dist ) ;
} ` ,dV= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
} ` ,AV= ` uniform sampler2D tEquirect ;
varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vec3 direction = normalize ( vWorldDirection ) ;
vec2 sampleUV = equirectUv ( direction ) ;
gl _FragColor = texture2D ( tEquirect , sampleUV ) ;
# include < tonemapping _fragment >
# include < colorspace _fragment >
} ` ,pV= ` uniform float scale ;
attribute float lineDistance ;
varying float vLineDistance ;
# include < common >
# include < uv _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
vLineDistance = scale * lineDistance ;
# include < uv _vertex >
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
} ` ,mV= ` uniform vec3 diffuse ;
uniform float opacity ;
uniform float dashSize ;
uniform float totalSize ;
varying float vLineDistance ;
# include < common >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
if ( mod ( vLineDistance , totalSize ) > dashSize ) {
discard ;
}
vec3 outgoingLight = vec3 ( 0.0 ) ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
outgoingLight = diffuseColor . rgb ;
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
} ` ,gV= ` # include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < envmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < batching _vertex >
# if defined ( USE _ENVMAP ) || defined ( USE _SKINNING )
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# endif
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < worldpos _vertex >
# include < envmap _vertex >
# include < fog _vertex >
} ` ,vV= ` uniform vec3 diffuse ;
uniform float opacity ;
# ifndef FLAT _SHADED
varying vec3 vNormal ;
# endif
# include < common >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _pars _fragment >
# include < fog _pars _fragment >
# include < specularmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < specularmap _fragment >
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
# ifdef USE _LIGHTMAP
vec4 lightMapTexel = texture2D ( lightMap , vLightMapUv ) ;
reflectedLight . indirectDiffuse += lightMapTexel . rgb * lightMapIntensity * RECIPROCAL _PI ;
# else
reflectedLight . indirectDiffuse += vec3 ( 1.0 ) ;
# endif
# include < aomap _fragment >
reflectedLight . indirectDiffuse *= diffuseColor . rgb ;
vec3 outgoingLight = reflectedLight . indirectDiffuse ;
# include < envmap _fragment >
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,_V= ` # define LAMBERT
varying vec3 vViewPosition ;
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < envmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < normal _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < normal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < envmap _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,yV= ` # define LAMBERT
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform float opacity ;
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _pars _fragment >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < normal _pars _fragment >
# include < lights _lambert _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < specularmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < specularmap _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < emissivemap _fragment >
# include < lights _lambert _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + totalEmissiveRadiance ;
# include < envmap _fragment >
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,xV= ` # define MATCAP
varying vec3 vViewPosition ;
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < color _pars _vertex >
# include < displacementmap _pars _vertex >
# include < fog _pars _vertex >
# include < normal _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < normal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
vViewPosition = - mvPosition . xyz ;
} ` ,bV= ` # define MATCAP
uniform vec3 diffuse ;
uniform float opacity ;
uniform sampler2D matcap ;
varying vec3 vViewPosition ;
# include < common >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < fog _pars _fragment >
# include < normal _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
vec3 viewDir = normalize ( vViewPosition ) ;
vec3 x = normalize ( vec3 ( viewDir . z , 0.0 , - viewDir . x ) ) ;
vec3 y = cross ( viewDir , x ) ;
vec2 uv = vec2 ( dot ( x , normal ) , dot ( y , normal ) ) * 0.495 + 0.5 ;
# ifdef USE _MATCAP
vec4 matcapColor = texture2D ( matcap , uv ) ;
# else
vec4 matcapColor = vec4 ( vec3 ( mix ( 0.2 , 0.8 , uv . y ) ) , 1.0 ) ;
# endif
vec3 outgoingLight = diffuseColor . rgb * matcapColor . rgb ;
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,SV= ` # define NORMAL
# if defined ( FLAT _SHADED ) || defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP _TANGENTSPACE )
varying vec3 vViewPosition ;
# endif
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < normal _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphinstance _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < normal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# if defined ( FLAT _SHADED ) || defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP _TANGENTSPACE )
vViewPosition = - mvPosition . xyz ;
# endif
} ` ,wV= ` # define NORMAL
uniform float opacity ;
# if defined ( FLAT _SHADED ) || defined ( USE _BUMPMAP ) || defined ( USE _NORMALMAP _TANGENTSPACE )
varying vec3 vViewPosition ;
# endif
# include < packing >
# include < uv _pars _fragment >
# include < normal _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( 0.0 , 0.0 , 0.0 , opacity ) ;
# include < clipping _planes _fragment >
# include < logdepthbuf _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
gl _FragColor = vec4 ( packNormalToRGB ( normal ) , diffuseColor . a ) ;
# ifdef OPAQUE
gl _FragColor . a = 1.0 ;
# endif
} ` ,TV= ` # define PHONG
varying vec3 vViewPosition ;
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < envmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < normal _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < morphcolor _vertex >
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphinstance _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < normal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < envmap _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,MV= ` # define PHONG
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform vec3 specular ;
uniform float shininess ;
uniform float opacity ;
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _pars _fragment >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < normal _pars _fragment >
# include < lights _phong _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < specularmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < specularmap _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < emissivemap _fragment >
# include < lights _phong _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + reflectedLight . directSpecular + reflectedLight . indirectSpecular + totalEmissiveRadiance ;
# include < envmap _fragment >
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,EV= ` # define STANDARD
varying vec3 vViewPosition ;
# ifdef USE _TRANSMISSION
varying vec3 vWorldPosition ;
# endif
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < normal _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < normal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
# ifdef USE _TRANSMISSION
vWorldPosition = worldPosition . xyz ;
# endif
} ` ,CV= ` # define STANDARD
# ifdef PHYSICAL
# define IOR
# define USE _SPECULAR
# endif
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform float roughness ;
uniform float metalness ;
uniform float opacity ;
# ifdef IOR
uniform float ior ;
# endif
# ifdef USE _SPECULAR
uniform float specularIntensity ;
uniform vec3 specularColor ;
# ifdef USE _SPECULAR _COLORMAP
uniform sampler2D specularColorMap ;
# endif
# ifdef USE _SPECULAR _INTENSITYMAP
uniform sampler2D specularIntensityMap ;
# endif
# endif
# ifdef USE _CLEARCOAT
uniform float clearcoat ;
uniform float clearcoatRoughness ;
# endif
# ifdef USE _DISPERSION
uniform float dispersion ;
# endif
# ifdef USE _IRIDESCENCE
uniform float iridescence ;
uniform float iridescenceIOR ;
uniform float iridescenceThicknessMinimum ;
uniform float iridescenceThicknessMaximum ;
# endif
# ifdef USE _SHEEN
uniform vec3 sheenColor ;
uniform float sheenRoughness ;
# ifdef USE _SHEEN _COLORMAP
uniform sampler2D sheenColorMap ;
# endif
# ifdef USE _SHEEN _ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap ;
# endif
# endif
# ifdef USE _ANISOTROPY
uniform vec2 anisotropyVector ;
# ifdef USE _ANISOTROPYMAP
uniform sampler2D anisotropyMap ;
# endif
# endif
varying vec3 vViewPosition ;
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < iridescence _fragment >
# include < cube _uv _reflection _fragment >
# include < envmap _common _pars _fragment >
# include < envmap _physical _pars _fragment >
# include < fog _pars _fragment >
# include < lights _pars _begin >
# include < normal _pars _fragment >
# include < lights _physical _pars _fragment >
# include < transmission _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < clearcoat _pars _fragment >
# include < iridescence _pars _fragment >
# include < roughnessmap _pars _fragment >
# include < metalnessmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < roughnessmap _fragment >
# include < metalnessmap _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < clearcoat _normal _fragment _begin >
# include < clearcoat _normal _fragment _maps >
# include < emissivemap _fragment >
# include < lights _physical _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 totalDiffuse = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse ;
vec3 totalSpecular = reflectedLight . directSpecular + reflectedLight . indirectSpecular ;
# include < transmission _fragment >
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance ;
# ifdef USE _SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3 ( material . sheenColor ) ;
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect ;
# endif
# ifdef USE _CLEARCOAT
float dotNVcc = saturate ( dot ( geometryClearcoatNormal , geometryViewDir ) ) ;
vec3 Fcc = F _Schlick ( material . clearcoatF0 , material . clearcoatF90 , dotNVcc ) ;
outgoingLight = outgoingLight * ( 1.0 - material . clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material . clearcoat ;
# endif
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,NV= ` # define TOON
varying vec3 vViewPosition ;
# include < common >
# include < batching _pars _vertex >
# include < uv _pars _vertex >
# include < displacementmap _pars _vertex >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < normal _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < shadowmap _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < normal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < displacementmap _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
vViewPosition = - mvPosition . xyz ;
# include < worldpos _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,RV= ` # define TOON
uniform vec3 diffuse ;
uniform vec3 emissive ;
uniform float opacity ;
# include < common >
# include < packing >
# include < dithering _pars _fragment >
# include < color _pars _fragment >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < aomap _pars _fragment >
# include < lightmap _pars _fragment >
# include < emissivemap _pars _fragment >
# include < gradientmap _pars _fragment >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < normal _pars _fragment >
# include < lights _toon _pars _fragment >
# include < shadowmap _pars _fragment >
# include < bumpmap _pars _fragment >
# include < normalmap _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
ReflectedLight reflectedLight = ReflectedLight ( vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) , vec3 ( 0.0 ) ) ;
vec3 totalEmissiveRadiance = emissive ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < color _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
# include < normal _fragment _begin >
# include < normal _fragment _maps >
# include < emissivemap _fragment >
# include < lights _toon _fragment >
# include < lights _fragment _begin >
# include < lights _fragment _maps >
# include < lights _fragment _end >
# include < aomap _fragment >
vec3 outgoingLight = reflectedLight . directDiffuse + reflectedLight . indirectDiffuse + totalEmissiveRadiance ;
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
# include < dithering _fragment >
} ` ,DV= ` uniform float size ;
uniform float scale ;
# include < common >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
# ifdef USE _POINTS _UV
varying vec2 vUv ;
uniform mat3 uvTransform ;
# endif
void main ( ) {
# ifdef USE _POINTS _UV
vUv = ( uvTransform * vec3 ( uv , 1 ) ) . xy ;
# endif
# include < color _vertex >
# include < morphinstance _vertex >
# include < morphcolor _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < project _vertex >
gl _PointSize = size ;
# ifdef USE _SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix ( projectionMatrix ) ;
if ( isPerspective ) gl _PointSize *= ( scale / - mvPosition . z ) ;
# endif
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < worldpos _vertex >
# include < fog _vertex >
} ` ,PV= ` uniform vec3 diffuse ;
uniform float opacity ;
# include < common >
# include < color _pars _fragment >
# include < map _particle _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
vec3 outgoingLight = vec3 ( 0.0 ) ;
# include < logdepthbuf _fragment >
# include < map _particle _fragment >
# include < color _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
outgoingLight = diffuseColor . rgb ;
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
} ` ,LV= ` # include < common >
# include < batching _pars _vertex >
# include < fog _pars _vertex >
# include < morphtarget _pars _vertex >
# include < skinning _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < shadowmap _pars _vertex >
void main ( ) {
# include < batching _vertex >
# include < beginnormal _vertex >
# include < morphinstance _vertex >
# include < morphnormal _vertex >
# include < skinbase _vertex >
# include < skinnormal _vertex >
# include < defaultnormal _vertex >
# include < begin _vertex >
# include < morphtarget _vertex >
# include < skinning _vertex >
# include < project _vertex >
# include < logdepthbuf _vertex >
# include < worldpos _vertex >
# include < shadowmap _vertex >
# include < fog _vertex >
} ` ,UV= ` uniform vec3 color ;
uniform float opacity ;
# include < common >
# include < packing >
# include < fog _pars _fragment >
# include < bsdfs >
# include < lights _pars _begin >
# include < logdepthbuf _pars _fragment >
# include < shadowmap _pars _fragment >
# include < shadowmask _pars _fragment >
void main ( ) {
# include < logdepthbuf _fragment >
gl _FragColor = vec4 ( color , opacity * ( 1.0 - getShadowMask ( ) ) ) ;
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
} ` ,BV= ` uniform float rotation ;
uniform vec2 center ;
# include < common >
# include < uv _pars _vertex >
# include < fog _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
void main ( ) {
# include < uv _vertex >
vec4 mvPosition = modelViewMatrix [ 3 ] ;
vec2 scale = vec2 ( length ( modelMatrix [ 0 ] . xyz ) , length ( modelMatrix [ 1 ] . xyz ) ) ;
# ifndef USE _SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix ( projectionMatrix ) ;
if ( isPerspective ) scale *= - mvPosition . z ;
# endif
vec2 alignedPosition = ( position . xy - ( center - vec2 ( 0.5 ) ) ) * scale ;
vec2 rotatedPosition ;
rotatedPosition . x = cos ( rotation ) * alignedPosition . x - sin ( rotation ) * alignedPosition . y ;
rotatedPosition . y = sin ( rotation ) * alignedPosition . x + cos ( rotation ) * alignedPosition . y ;
mvPosition . xy += rotatedPosition ;
gl _Position = projectionMatrix * mvPosition ;
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
} ` ,OV= ` uniform vec3 diffuse ;
uniform float opacity ;
# include < common >
# include < uv _pars _fragment >
# include < map _pars _fragment >
# include < alphamap _pars _fragment >
# include < alphatest _pars _fragment >
# include < alphahash _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
void main ( ) {
vec4 diffuseColor = vec4 ( diffuse , opacity ) ;
# include < clipping _planes _fragment >
vec3 outgoingLight = vec3 ( 0.0 ) ;
# include < logdepthbuf _fragment >
# include < map _fragment >
# include < alphamap _fragment >
# include < alphatest _fragment >
# include < alphahash _fragment >
outgoingLight = diffuseColor . rgb ;
# include < opaque _fragment >
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
2026-03-09 22:42:36 +01:00
} ` ,ei={alphahash_fragment:rG,alphahash_pars_fragment:sG,alphamap_fragment:aG,alphamap_pars_fragment:oG,alphatest_fragment:lG,alphatest_pars_fragment:uG,aomap_fragment:cG,aomap_pars_fragment:hG,batching_pars_vertex:fG,batching_vertex:dG,begin_vertex:AG,beginnormal_vertex:pG,bsdfs:mG,iridescence_fragment:gG,bumpmap_pars_fragment:vG,clipping_planes_fragment:_G,clipping_planes_pars_fragment:yG,clipping_planes_pars_vertex:xG,clipping_planes_vertex:bG,color_fragment:SG,color_pars_fragment:wG,color_pars_vertex:TG,color_vertex:MG,common:EG,cube_uv_reflection_fragment:CG,defaultnormal_vertex:NG,displacementmap_pars_vertex:RG,displacementmap_vertex:DG,emissivemap_fragment:PG,emissivemap_pars_fragment:LG,colorspace_fragment:UG,colorspace_pars_fragment:BG,envmap_fragment:OG,envmap_common_pars_fragment:IG,envmap_pars_fragment:FG,envmap_pars_vertex:kG,envmap_physical_pars_fragment:QG,envmap_vertex:zG,fog_vertex:GG,fog_pars_vertex:qG,fog_fragment:VG,fog_pars_fragment:jG,gradientmap_pars_fragment:HG,lightmap_pars_fragment:WG,lights_lambert_fragment: $ G,lights_lambert_pars_fragment:XG,lights_pars_begin:YG,lights_toon_fragment:KG,lights_toon_pars_fragment:ZG,lights_phong_fragment:JG,lights_phong_pars_fragment:eq,lights_physical_fragment:tq,lights_physical_pars_fragment:nq,lights_fragment_begin:iq,lights_fragment_maps:rq,lights_fragment_end:sq,logdepthbuf_fragment:aq,logdepthbuf_pars_fragment:oq,logdepthbuf_pars_vertex:lq,logdepthbuf_vertex:uq,map_fragment:cq,map_pars_fragment:hq,map_particle_fragment:fq,map_particle_pars_fragment:dq,metalnessmap_fragment:Aq,metalnessmap_pars_fragment:pq,morphinstance_vertex:mq,morphcolor_vertex:gq,morphnormal_vertex:vq,morphtarget_pars_vertex:_q,morphtarget_vertex:yq,normal_fragment_begin:xq,normal_fragment_maps:bq,normal_pars_fragment:Sq,normal_pars_vertex:wq,normal_vertex:Tq,normalmap_pars_fragment:Mq,clearcoat_normal_fragment_begin:Eq,clearcoat_normal_fragment_maps:Cq,clearcoat_pars_fragment:Nq,iridescence_pars_fragment:Rq,opaque_fragment:Dq,packing:Pq,premultiplied_alpha_fragment:Lq,project_vertex:Uq,dithering_fragment:Bq,dithering_pars_fragment:Oq,roughnessmap_fragment:Iq,roughnessmap_pars_fragment:Fq,shadowmap_pars_fragment:kq,shadowmap_pars_vertex:zq,shadowmap_vertex:Gq,shadowmask_pars_fragment:qq,skinbase_vertex:Vq,skinning_pars_vertex:jq,skinning_vertex:Hq,skinnormal_vertex:Wq,specularmap_fragment: $ q,specularmap_pars_fragment:Xq,tonemapping_fragment:Yq,tonemapping_pars_fragment:Qq,transmission_fragment:Kq,transmission_pars_fragment:Zq,uv_pars_fragment:Jq,uv_pars_vertex:eV,uv_vertex:tV,worldpos_vertex:nV,background_vert:iV,background_frag:rV,backgroundCube_vert:sV,backgroundCube_frag:aV,cube_vert:oV,cube_frag:lV,depth_vert:uV,depth_frag:cV,distanceRGBA_vert:hV,distanceRGBA_frag:fV,equirect_vert:dV,equirect_frag:AV,linedashed_vert:pV,linedashed_frag:mV,meshbasic_vert:gV,meshbasic_frag:vV,meshlambert_vert:_V,meshlambert_frag:yV,meshmatcap_vert:xV,meshmatcap_frag:bV,meshnormal_vert:SV,meshnormal_frag:wV,meshphong_vert:TV,meshphong_frag:MV,meshphysical_vert:EV,meshphysical_frag:CV,meshtoon_vert:NV,meshtoon_frag:RV,points_vert:DV,points_frag:PV,shadow_vert:LV,shadow_frag:UV,sprite_vert:BV,sprite_frag:OV},nn={common:{diffuse:{value:new cn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xn},alphaMap:{value:null},alphaMapTransform:{value:new Xn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xn}},envmap:{envMap:{value:null},envMapRotation:{value:new Xn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xn},normalScale:{value:new bt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xn},displacementScale:{value:1},displacementBias:{value:0}},emissi
2026-03-09 22:33:09 +01:00
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: $ a,depthTest:!1,depthWrite:!1})}function zN(){return new Qa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cM(),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: $ a,depthTest:!1,depthWrite:!1})}function GN(){return new Qa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cM(),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: $ a,depthTest:!1,depthWrite:!1})}function cM(){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 ) ;
}
2026-03-09 22:42:36 +01:00
` }function WV(i){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,h=u===Oh||u===Ih,m=u===Xo||u===Yo;if(h||m){let v=e.get(l);const x=v!==void 0?v.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==x)return t===null&&(t=new FN(i)),v=h?t.fromEquirectangular(l,v):t.fromCubemap(l,v),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),v.texture;if(v!==void 0)return v.texture;{const S=l.image;return h&&S&&S.height>0||m&&S&&r(S)?(t===null&&(t=new FN(i)),v=h?t.fromEquirectangular(l):t.fromCubemap(l),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),l.addEventListener("dispose",s),v.texture):null}}}return l}function r(l){let u=0;const h=6;for(let m=0;m<h;m++)l[m]!==void 0&&u++;return u===h}function s(l){const u=l.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function $ V(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&Uf("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function XV(i,e,t,n){const r={},s=new WeakMap;function a(v){const x=v.target;x.index!==null&&e.remove(x.index);for(const T in x.attributes)e.remove(x.attributes[T]);x.removeEventListener("dispose",a),delete r[x.id];const S=s.get(x);S&&(e.remove(S),s.delete(x)),n.releaseStatesOfGeometry(x),x.isInstancedBufferGeometry===!0&&delete x._maxInstanceCount,t.memory.geometries--}function l(v,x){return r[x.id]===!0||(x.addEventListener("dispose",a),r[x.id]=!0,t.memory.geometries++),x}function u(v){const x=v.attributes;for(const S in x)e.update(x[S],i.ARRAY_BUFFER)}function h(v){const x=[],S=v.index,T=v.attributes.position;let N=0;if(S!==null){const O=S.array;N=S.version;for(let U=0,I=O.length;U<I;U+=3){const j=O[U+0],z=O[U+1],G=O[U+2];x.push(j,z,z,G,G,j)}}else if(T!==void 0){const O=T.array;N=T.version;for(let U=0,I=O.length/3-1;U<I;U+=3){const j=U+0,z=U+1,G=U+2;x.push(j,z,z,G,G,j)}}else return;const C=new(G7(x)?KT:QT)(x,1);C.version=N;const E=s.get(v);E&&e.remove(E),s.set(v,C)}function m(v){const x=s.get(v);if(x){const S=v.index;S!==null&&x.version<S.version&&h(v)}else h(v);return s.get(v)}return{get:l,update:u,getWireframeAttribute:m}}function YV(i,e,t){let n;function r(x){n=x}let s,a;function l(x){s=x.type,a=x.bytesPerElement}function u(x,S){i.drawElements(n,S,s,x*a),t.update(S,n,1)}function h(x,S,T){T!==0&&(i.drawElementsInstanced(n,S,s,x*a,T),t.update(S,n,T))}function m(x,S,T){if(T===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,S,0,s,x,0,T);let C=0;for(let E=0;E<T;E++)C+=S[E];t.update(C,n,1)}function v(x,S,T,N){if(T===0)return;const C=e.get("WEBGL_multi_draw");if(C===null)for(let E=0;E<x.length;E++)h(x[E]/a,S[E],N[E]);else{C.multiDrawElementsInstancedWEBGL(n,S,0,s,x,0,N,0,T);let E=0;for(let O=0;O<T;O++)E+=S[O]*N[O];t.update(E,n,1)}}this.setMode=r,this.setIndex=l,this.render=u,this.renderInstances=h,this.renderMultiDraw=m,this.renderMultiDrawInstances=v}function QV(i){const e={geometries:0,textures:0},t={fra
2026-03-09 22:33:09 +01:00
` ),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const l=a+1;n.push( ` $ { l === e ? ">" : " " } $ { l } : $ { t [ a ] } ` )}return n.join( `
` )}const QN=new Xn;function Wj(i){li._getMatrix(QN,li.workingColorSpace,i);const e= ` mat3 ( $ { QN . elements . map ( t => t . toFixed ( 4 ) ) } ) ` ;switch(li.getTransfer(i)){case r_:return[e,"LinearTransferOETF"];case Fi:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function KN(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:( \d +)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+ `
` +r+ `
` +Hj(i.getShaderSource(e),a)}else return r}function $ j(i,e){const t=Wj(e);return[ ` vec4 $ { i } ( vec4 value ) { ` , ` return $ { t [ 1 ] } ( vec4 ( value . rgb * $ { t [ 0 ] } , value . a ) ) ; ` ,"}"].join( `
2026-03-09 22:42:36 +01:00
` )}function Xj(i,e){let t;switch(e){case U7:t="Linear";break;case B7:t="Reinhard";break;case O7:t="Cineon";break;case I7:t="ACESFilmic";break;case F7:t="AgX";break;case k7:t="Neutral";break;case HF:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const W2=new pe;function Yj(){li.getLuminanceCoefficients(W2);const i=W2.x.toFixed(4),e=W2.y.toFixed(4),t=W2.z.toFixed(4);return["float luminance( const in vec3 rgb ) {", ` const vec3 weights = vec3 ( $ { i } , $ { e } , $ { t } ) ; ` ," return dot( weights, rgb );","}"].join( `
2026-03-09 22:33:09 +01:00
` )}function Qj(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gm).join( `
` )}function Kj(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join( `
` )}function Zj(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let l=1;s.type===i.FLOAT_MAT2&&(l=2),s.type===i.FLOAT_MAT3&&(l=3),s.type===i.FLOAT_MAT4&&(l=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:l}}return t}function gm(i){return i!==""}function ZN(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function JN(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Jj=/^[ \t ]*#include +<([ \w \d ./]+)>/gm;function tw(i){return i.replace(Jj,tH)}const eH=new Map;function tH(i,e){let t=ei[e];if(t===void 0){const n=eH.get(e);if(n!==void 0)t=ei[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return tw(t)}const nH=/#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 e5(i){return i.replace(nH,iH)}function iH(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/ \[ \s *i \s * \] /g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function t5(i){let e= ` precision $ { i . precision } float ;
precision $ { i . precision } int ;
precision $ { i . precision } sampler2D ;
precision $ { i . precision } samplerCube ;
precision $ { i . precision } sampler3D ;
precision $ { i . precision } sampler2DArray ;
precision $ { i . precision } sampler2DShadow ;
precision $ { i . precision } samplerCubeShadow ;
precision $ { i . precision } sampler2DArrayShadow ;
precision $ { i . precision } isampler2D ;
precision $ { i . precision } isampler3D ;
precision $ { i . precision } isamplerCube ;
precision $ { i . precision } isampler2DArray ;
precision $ { i . precision } usampler2D ;
precision $ { i . precision } usampler3D ;
precision $ { i . precision } usamplerCube ;
precision $ { i . precision } usampler2DArray ;
` ;return i.precision==="highp"?e+= `
# define HIGH _PRECISION ` :i.precision==="mediump"?e+= `
# define MEDIUM _PRECISION ` :i.precision==="lowp"&&(e+= `
# define LOW _PRECISION ` ),e}function rH(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===ST?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===zF?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===vo&&(e="SHADOWMAP_TYPE_VSM"),e}function sH(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Xo:case Yo:e="ENVMAP_TYPE_CUBE";break;case ed:e="ENVMAP_TYPE_CUBE_UV";break}return e}function aH(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Yo:e="ENVMAP_MODE_REFRACTION";break}return e}function oH(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Dg:e="ENVMAP_BLENDING_MULTIPLY";break;case P7:e="ENVMAP_BLENDING_MIX";break;case L7:e="ENVMAP_BLENDING_ADD";break}return e}function lH(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function uH(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,l=t.fragmentShader;const u=rH(t),h=sH(t),m=aH(t),v=oH(t),x=lH(t),S=Qj(t),T=Kj(s),N=r.createProgram();let C,E,O=t.glslVersion?"#version "+t.glslVersion+ `
` :"";t.isRawShaderMaterial?(C=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T].filter(gm).join( `
` ),C.length>0&&(C+= `
` ),E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T].filter(gm).join( `
` ),E.length>0&&(E+= `
` )):(C=[t5(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+m:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",
` ].filter(gm).join( `
` ),E=[t5(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+m:"",t.envMap?"#define "+v:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ya?"#define TONE_MAPPING":"",t.toneMapping!==Ya?ei.tonemapping_pars_fragment:"",t.toneMapping!==Ya?Xj("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ei.colorspace_pars_fragment, $ j("linearToOutputTexel",t.outputColorSpace),Yj(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"", `
` ].filter(gm).join( `
` )),a=tw(a),a=ZN(a,t),a=JN(a,t),l=tw(l),l=ZN(l,t),l=JN(l,t),a=e5(a),l=e5(l),t.isRawShaderMaterial!==!0&&(O= ` # version 300 es
` ,C=[S,"#define attribute in","#define varying out","#define texture2D texture"].join( `
` )+ `
` +C,E=["#define varying in",t.glslVersion===Y8?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Y8?"":"#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( `
` )+ `
2026-03-09 22:42:36 +01:00
` +E);const U=O+C+a,I=O+E+l,j=YN(r,r.VERTEX_SHADER,U),z=YN(r,r.FRAGMENT_SHADER,I);r.attachShader(N,j),r.attachShader(N,z),t.index0AttributeName!==void 0?r.bindAttribLocation(N,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(N,0,"position"),r.linkProgram(N);function G(Q){if(i.debug.checkShaderErrors){const J=r.getProgramInfoLog(N).trim(),ie=r.getShaderInfoLog(j).trim(),le=r.getShaderInfoLog(z).trim();let re=!0,Z=!0;if(r.getProgramParameter(N,r.LINK_STATUS)===!1)if(re=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,N,j,z);else{const ne=KN(r,j,"vertex"),de=KN(r,z,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(N,r.VALIDATE_STATUS)+ `
2026-03-09 22:33:09 +01:00
Material Name : ` +Q.name+ `
Material Type : ` +Q.type+ `
Program Info Log : ` +J+ `
2026-03-09 22:42:36 +01:00
` +ne+ `
` +de)}else J!==""?console.warn("THREE.WebGLProgram: Program Info Log:",J):(ie===""||le==="")&&(Z=!1);Z&&(Q.diagnostics={runnable:re,programLog:J,vertexShader:{log:ie,prefix:C},fragmentShader:{log:le,prefix:E}})}r.deleteShader(j),r.deleteShader(z),H=new zv(r,N),q=Zj(r,N)}let H;this.getUniforms=function(){return H===void 0&&G(this),H};let q;this.getAttributes=function(){return q===void 0&&G(this),q};let V=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(N,Vj)),V},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(N),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jj++,this.cacheKey=e,this.usedTimes=1,this.program=N,this.vertexShader=j,this.fragmentShader=z,this}let cH=0;class hH{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new fH(e),t.set(e,n)),n}}class fH{constructor(e){this.id=cH++,this.code=e,this.usedTimes=0}}function dH(i,e,t,n,r,s,a){const l=new YT,u=new hH,h=new Set,m=[],v=r.logarithmicDepthBuffer,x=r.vertexTextures;let S=r.precision;const T={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function N(q){return h.add(q),q===0?"uv": ` uv$ { q } ` }function C(q,V,Q,J,ie){const le=J.fog,re=ie.geometry,Z=q.isMeshStandardMaterial?J.environment:null,ne=(q.isMeshStandardMaterial?t:e).get(q.envMap||Z),de=ne&&ne.mapping===ed?ne.image.height:null,be=T[q.type];q.precision!==null&&(S=r.getMaxPrecision(q.precision),S!==q.precision&&console.warn("THREE.WebGLProgram.getParameters:",q.precision,"not supported, using",S,"instead."));const Te=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,ae=Te!==void 0?Te.length:0;let Me=0;re.morphAttributes.position!==void 0&&(Me=1),re.morphAttributes.normal!==void 0&&(Me=2),re.morphAttributes.color!==void 0&&(Me=3);let Ve,Ce,Fe,tt;if(be){const Kt=Fa[be];Ve=Kt.vertexShader,Ce=Kt.fragmentShader}else Ve=q.vertexShader,Ce=q.fragmentShader,u.update(q),Fe=u.getVertexShaderID(q),tt=u.getFragmentShaderID(q);const je=i.getRenderTarget(),Rt=i.state.buffers.depth.getReversed(),Et=ie.isInstancedMesh===!0,Ft=ie.isBatchedMesh===!0,Ut=!!q.map,Ke=!!q.matcap,ht=!!ne,fe=!!q.aoMap, $ t=!!q.lightMap,_t=!!q.bumpMap,Gt=!!q.normalMap,yt=!!q.displacementMap,Ht=!!q.emissiveMap,pt=!!q.metalnessMap,Ae=!!q.roughnessMap,k=q.anisotropy>0,xe=q.clearcoat>0,Oe=q.dispersion>0,Ue=q.iridescence>0,ee=q.sheen>0,we=q.transmission>0,Re=k&&!!q.anisotropyMap,We=xe&&!!q.clearcoatMap,Se=xe&&!!q.clearcoatNormalMap,Le=xe&&!!q.clearcoatRoughnessMap,ct=Ue&&!!q.iridescenceMap,Dt=Ue&&!!q.iridescenceThicknessMap,It=ee&&!!q.sheenColorMap,lt=ee&&!!q.sheenRoughnessMap,jt=!!q.specularMap,Jt=!!q.specularColorMap,In=!!q.specularIntensityMap,me=we&&!!q.transmissionMap,Bt=we&&!!q.thicknessMap,ot=!!q.gradientMap,Tt=!!q.alphaMap,Wt=q.alphaTest>0,Yt=!!q.alphaHash,pn=!!q.extensions;let $ e=Ya;q.toneMapped&&(je===null||je.isXRRenderTarget===!0)&&( $ e=i.toneMappin
2026-03-09 22:33:09 +01:00
gl _Position = vec4 ( position , 1.0 ) ;
} ` ,wH= ` uniform sampler2D shadow _pass ;
uniform vec2 resolution ;
uniform float radius ;
# include < packing >
void main ( ) {
const float samples = float ( VSM _SAMPLES ) ;
float mean = 0.0 ;
float squared _mean = 0.0 ;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ) ;
float uvStart = samples <= 1.0 ? 0.0 : - 1.0 ;
for ( float i = 0.0 ; i < samples ; i ++ ) {
float uvOffset = uvStart + i * uvStride ;
# ifdef HORIZONTAL _PASS
vec2 distribution = unpackRGBATo2Half ( texture2D ( shadow _pass , ( gl _FragCoord . xy + vec2 ( uvOffset , 0.0 ) * radius ) / resolution ) ) ;
mean += distribution . x ;
squared _mean += distribution . y * distribution . y + distribution . x * distribution . x ;
# else
float depth = unpackRGBAToDepth ( texture2D ( shadow _pass , ( gl _FragCoord . xy + vec2 ( 0.0 , uvOffset ) * radius ) / resolution ) ) ;
mean += depth ;
squared _mean += depth * depth ;
# endif
}
mean = mean / samples ;
squared _mean = squared _mean / samples ;
float std _dev = sqrt ( squared _mean - mean * mean ) ;
gl _FragColor = pack2HalfToRGBA ( vec2 ( mean , std _dev ) ) ;
2026-03-09 22:42:36 +01:00
} ` ;function TH(i,e,t){let n=new Og;const r=new bt,s=new bt,a=new On,l=new Oz({depthPacking:KF}),u=new Iz,h={},m=t.maxTextureSize,v={[El]:or,[or]:El,[as]:as},x=new Qa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new bt},radius:{value:4}},vertexShader:SH,fragmentShader:wH}),S=x.clone();S.defines.HORIZONTAL_PASS=1;const T=new Hi;T.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const N=new Oi(T,x),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ST;let E=this.type;this.render=function(z,G,H){if(C.enabled===!1||C.autoUpdate===!1&&C.needsUpdate===!1||z.length===0)return;const q=i.getRenderTarget(),V=i.getActiveCubeFace(),Q=i.getActiveMipmapLevel(),J=i.state;J.setBlending( $ a),J.buffers.color.setClear(1,1,1,1),J.buffers.depth.setTest(!0),J.setScissorTest(!1);const ie=E!==vo&&this.type===vo,le=E===vo&&this.type!==vo;for(let re=0,Z=z.length;re<Z;re++){const ne=z[re],de=ne.shadow;if(de===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(de.autoUpdate===!1&&de.needsUpdate===!1)continue;r.copy(de.mapSize);const be=de.getFrameExtents();if(r.multiply(be),s.copy(de.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(s.x=Math.floor(m/be.x),r.x=s.x*be.x,de.mapSize.x=s.x),r.y>m&&(s.y=Math.floor(m/be.y),r.y=s.y*be.y,de.mapSize.y=s.y)),de.map===null||ie===!0||le===!0){const ae=this.type!==vo?{minFilter:dr,magFilter:dr}:{};de.map!==null&&de.map.dispose(),de.map=new Fh(r.x,r.y,ae),de.map.texture.name=ne.name+".shadowMap",de.camera.updateProjectionMatrix()}i.setRenderTarget(de.map),i.clear();const Te=de.getViewportCount();for(let ae=0;ae<Te;ae++){const Me=de.getViewport(ae);a.set(s.x*Me.x,s.y*Me.y,s.x*Me.z,s.y*Me.w),J.viewport(a),de.updateMatrices(ne,ae),n=de.getFrustum(),I(G,H,de.camera,ne,this.type)}de.isPointLightShadow!==!0&&this.type===vo&&O(de,H),de.needsUpdate=!1}E=this.type,C.needsUpdate=!1,i.setRenderTarget(q,V,Q)};function O(z,G){const H=e.update(N);x.defines.VSM_SAMPLES!==z.blurSamples&&(x.defines.VSM_SAMPLES=z.blurSamples,S.defines.VSM_SAMPLES=z.blurSamples,x.needsUpdate=!0,S.needsUpdate=!0),z.mapPass===null&&(z.mapPass=new Fh(r.x,r.y)),x.uniforms.shadow_pass.value=z.map.texture,x.uniforms.resolution.value=z.mapSize,x.uniforms.radius.value=z.radius,i.setRenderTarget(z.mapPass),i.clear(),i.renderBufferDirect(G,null,H,x,N,null),S.uniforms.shadow_pass.value=z.mapPass.texture,S.uniforms.resolution.value=z.mapSize,S.uniforms.radius.value=z.radius,i.setRenderTarget(z.map),i.clear(),i.renderBufferDirect(G,null,H,S,N,null)}function U(z,G,H,q){let V=null;const Q=H.isPointLight===!0?z.customDistanceMaterial:z.customDepthMaterial;if(Q!==void 0)V=Q;else if(V=H.isPointLight===!0?u:l,i.localClippingEnabled&&G.clipShadows===!0&&Array.isArray(G.clippingPlanes)&&G.clippingPlanes.length!==0||G.displacementMap&&G.displacementScale!==0||G.alphaMap&&G.alphaTest>0||G.map&&G.alphaTest>0){const J=V.uuid,ie=G.uuid;let le=h[J];le===void 0&&(le={},h[J]=le);let re=le[ie];re===void 0&&(re=V.clone(),le[ie]=re,G.addEventListener("dispose",j)),V=re}if(V.visible=G.visible,V.wireframe=G.wireframe,q===vo?V.side=G.shadowSide!==null?G.shadowSide:G.side:V.side=G.shadowSide!==null?G.shadowSide:v[G.side],V.alphaMap=G.alphaMap,V.alphaTest=G.alphaTest,V.map=G.map,V.clipShadows=G.clipShadows,V.clippingPlanes=G.clippingPlanes,V.clipIntersection=G.clipIntersection,V.displacementMap=G.displacementMap,V.displacementScale=G.displacementScale,V.displacementBias=G.displacementBias,V.wireframeLinewidth=G.wireframeLinewidth,V.linewidth=G.linewidth,H.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const J=i.properties.get(V);J.light=H}return V}function I(z,G,H,q,V){if(z.visible===!1)return;if(z.layers.test(G.layers)&&(z.isMesh||z.isLine||z.isPoints)&&(z.castShadow||z.receiveShadow&&V===vo)&&(!z.frustumCulled||n.intersectsObject(z))){z.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,z.matrixWorld);const ie=e.update(z),le=z.material;if(Array.isArray(le)){const re=ie.groups;for(let Z=0,ne=re.length;Z<ne;Z++){const de=re[Z],be=le[de.materialIndex];if(be&&be.visible){const Te=U(z,be,
2026-03-09 22:33:09 +01:00
void main ( ) {
gl _Position = vec4 ( position , 1.0 ) ;
} ` ,PH= `
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 ;
}
2026-03-09 22:42:36 +01:00
} ` ;class LH{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new ms,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Qa({vertexShader:DH,fragmentShader:PH,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Oi(new by(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class UH extends Bc{constructor(e,t){super();const n=this;let r=null,s=1,a=null,l="local-floor",u=1,h=null,m=null,v=null,x=null,S=null,T=null;const N=new LH,C=t.getContextAttributes();let E=null,O=null;const U=[],I=[],j=new bt;let z=null;const G=new va;G.viewport=new On;const H=new va;H.viewport=new On;const q=[G,H],V=new Zz;let Q=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ce){let Fe=U[Ce];return Fe===void 0&&(Fe=new P3,U[Ce]=Fe),Fe.getTargetRaySpace()},this.getControllerGrip=function(Ce){let Fe=U[Ce];return Fe===void 0&&(Fe=new P3,U[Ce]=Fe),Fe.getGripSpace()},this.getHand=function(Ce){let Fe=U[Ce];return Fe===void 0&&(Fe=new P3,U[Ce]=Fe),Fe.getHandSpace()};function ie(Ce){const Fe=I.indexOf(Ce.inputSource);if(Fe===-1)return;const tt=U[Fe];tt!==void 0&&(tt.update(Ce.inputSource,Ce.frame,h||a),tt.dispatchEvent({type:Ce.type,data:Ce.inputSource}))}function le(){r.removeEventListener("select",ie),r.removeEventListener("selectstart",ie),r.removeEventListener("selectend",ie),r.removeEventListener("squeeze",ie),r.removeEventListener("squeezestart",ie),r.removeEventListener("squeezeend",ie),r.removeEventListener("end",le),r.removeEventListener("inputsourceschange",re);for(let Ce=0;Ce<U.length;Ce++){const Fe=I[Ce];Fe!==null&&(I[Ce]=null,U[Ce].disconnect(Fe))}Q=null,J=null,N.reset(),e.setRenderTarget(E),S=null,x=null,v=null,r=null,O=null,Ve.stop(),n.isPresenting=!1,e.setPixelRatio(z),e.setSize(j.width,j.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ce){s=Ce,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ce){l=Ce,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(Ce){h=Ce},this.getBaseLayer=function(){return x!==null?x:S},this.getBinding=function(){return v},this.getFrame=function(){return T},this.getSession=function(){return r},this.setSession=async function(Ce){if(r=Ce,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",ie),r.addEventListener("selectstart",ie),r.addEventListener("selectend",ie),r.addEventListener("squeeze",ie),r.addEventListener("squeezestart",ie),r.addEventListener("squeezeend",ie),r.addEventListener("end",le),r.addEventListener("inputsourceschange",re),C.xrCompatible!==!0&&await t.makeXRCompatible(),z=e.getPixelRatio(),e.getSize(j),r.enabledFeatures!==void 0&&r.enabledFeatures.includes("layers")){let tt=null,je=null,Rt=null;C.depth&&(Rt=C.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,tt=C.stencil?uu:tu,je=C.stencil?lu:Nr);const Et={colorFormat:t.RGBA8,depthFormat:Rt,scaleFactor:s};v=new XRWebGLBinding(r,t),x=v.createProjectionLayer(Et),r.updateRenderState({layers:[x]}),e.setPixelRatio(1),e.setSize(x.textureWidth,x.textureHeight,!1),O=new Fh(x.textureWidth,x.textureHeight,{format:ks,type:ra,depthTexture:new Ic(x.textureWidth,x.textureHeight,je,void 0,void 0,void 0,void 0,void 0,void 0,tt),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:x.ignoreDepthValues===!1})}else{const tt={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:s};S=new XRWebGLLayer(r,t,tt),r.updateRenderState({baseLayer:S}),e.setPixelRatio(1),e.setSize(S.framebuffer
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function vW(i,e){return dW(i)||mW(i,e)||_W(i,e)||gW()}function _W(i,e){if(i){if(typeof i=="string")return f5(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?f5(i,e):void 0}}var yW=pW(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,a=s===void 0?!0:s,l=t.onChange,u=l===void 0?function(h,m){}:l;AW(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=a,this.onChange=u});function _s(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,a=s===void 0?{}:s,l=i.aliases,u=l===void 0?{}:l,h=i.init,m=h===void 0?function(){}:h,v=i.update,x=v===void 0?function(){}:v,S=Object.keys(r).map(function(T){return new yW(T,r[T])});return function T(){for(var N=arguments.length,C=new Array(N),E=0;E<N;E++)C[E]=arguments[E];var O=!!(this instanceof T&&this.constructor),U=O?C.shift():void 0,I=C[0],j=I===void 0?{}:I,z=Object.assign({},t instanceof Function?t(j):t,{initialised:!1}),G={};function H(Q){return q(Q,j),V(),H}var q=function(J,ie){m.call(H,J,z,ie),z.initialised=!0},V=fW(function(){z.initialised&&(x.call(H,z,G),G={})},1);return S.forEach(function(Q){H[Q.name]=J(Q);function J(ie){var le=ie.name,re=ie.triggerUpdate,Z=re===void 0?!1:re,ne=ie.onChange,de=ne===void 0?function(ae,Me){}:ne,be=ie.defaultVal,Te=be===void 0?null:be;return function(ae){var Me=z[le];if(!arguments.length)return Me;var Ve=ae===void 0?Te:ae;return z[le]=Ve,de.call(H,Ve,z,Me),!G.hasOwnProperty(le)&&(G[le]=Me),Z&&V(),H}}}),Object.keys(a).forEach(function(Q){H[Q]=function(){for(var J,ie=arguments.length,le=new Array(ie),re=0;re<ie;re++)le[re]=arguments[re];return(J=a[Q]).call.apply(J,[H,z].concat(le))}}),Object.entries(u).forEach(function(Q){var J=vW(Q,2),ie=J[0],le=J[1];return H[ie]=H[le]}),H.resetProps=function(){return S.forEach(function(Q){H[Q.name](Q.defaultVal)}),H},H.resetProps(),z._rerender=V,O&&U&&H(U),H}}var os=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),
2026-03-09 22:33:09 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function QX(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function KX(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zX(i)}function Tw(i,e){return Tw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Tw(i,e)}function Hv(i,e){return FX(i)||XX(i,e)||rP(i,e)||YX()}function nP(i){return kX(i)|| $ X(i)||rP(i)||QX()}function ZX(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function iP(i){var e=ZX(i,"string");return typeof e=="symbol"?e:e+""}function rP(i,e){if(i){if(typeof i=="string")return ww(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?ww(i,e):void 0}}var sP=function(e){e instanceof Array?e.forEach(sP):(e.map&&e.map.dispose(),e.dispose())},aP=function(e){e.geometry&&e.geometry.dispose(),e.material&&sP(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(aP)},rR=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),aP(t)}};function oP(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function JX(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),a=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-a*180/Math.PI-(a<-Math.PI/2?360:0),r}}function xf(i){return i*Math.PI/180}var lP=function(e){return 1-(xM(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},F3=function(e){return Math.max(0,Math.min(1,lP(e)))},sR=function(e){return .5-xM.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},eY=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Ec().domain([1,0]).range([t,n]).clamp(!0),s=Ec().domain([F3(t),F3(n)]).range([1,0]).clamp(!0),a=function(v){return s(F3(r(v)))},l=e.array,u=0,h=l.length;u<h;u+=2)l[u+1]=a(l[u+1]);e.needsUpdate=!0},aR=function(e,t,n,r){var s=Math.pow(2,e),a=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),l=(90-r)/180;t&&(l=Math.max(0,Math.min(1,lP(l))));var u=Math.floor(l*s);return[a,u]},Mw=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,l=[],u=Math.pow(2,e),h=360/u,m=180/u,v=s===void 0?u-1:s,x=a===void 0?u-1:a,S=n,T=Math.min(u-1,v);S<=T;S++)for(var N=r,C=Math.min(u-1,x);N<=C;N++){var E=N,O=m;if(t){E=N===0?N:sR(N/u)*u;var U=N+1===u?N+1:sR((N+1)/u)*u;O=(U-E)*180/u}var I=-180+(S+.5)*h,j=90-(E*180/u+O/2),z=O;l.push({x:S,y:N,lng:I,lat:j,latLen:z})}return l},tY=6,nY=7,iY=3,rY=90,Hl=new WeakMap,Mh=new WeakMap,k3=new WeakMap,tv=new WeakMap,Go=new WeakMap,B_=new WeakMap,JA=new WeakMap,bf=new WeakMap,nv=new WeakSet,sY=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,a=r.minLevel,l=a===void 0?0:a,u=r.maxLevel,h=u===void 0?17:u,m=r.mercatorProjection,v=m===void 0?!0:m;return qX(this,e),n=GX(this,e),VX(n,nv),gh(n,Hl,void 0),gh(n,Mh,void 0),gh(n,k3,void 0),gh(n,tv,void 0),gh(n,Go,{}),gh(n,B_,void 0),gh(n,JA,void 0),gh(n,bf,void 0),pA(n,"minLevel",void 0),pA(n,"maxLevel",void 0),pA(n,"thresholds",nP(new Array(30)).map(function(x,S){return 8/Math.pow(2,S)})),pA(n,"curvatureResolution",5),pA(n,"tileMargin",0),pA(n,"clearTiles",function(){Object.values(hi(Go,n)).forEach(function(x){x.forEach(function(S){S.obj&&(n.remove(S.obj),rR(S.obj),delete S.obj)})}),vh(Go,n,{})}),vh(Hl,n,t),n.tileUrl=s,vh(Mh,n,v),n.minLevel=l,n.maxLevel=h,n.level=0,n.add(vh(bf,n,new Oi(new bu(hi(Hl,n)*.99,180,90),new cd({color:0})))),hi(bf,n).visible=!1,hi(bf,n).material.polygonOffset=!0,hi(bf,n).material.polygonO
2026-03-09 22:33:09 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}var s,a=!0,l=!1;return{s:function(){t=t.call(i)},n:function(){var u=t.next();return a=u.done,u},e:function(u){l=!0,s=u},f:function(){try{a||t.return==null||t.return()}finally{if(l)throw s}}}}function I_(i){return I_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},I_(i)}function DY(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Rw(i,e)}function dP(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dP=function(){return!!i})()}function PY(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function LY(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function UY(){throw new TypeError( ` Invalid attempt to destructure non - iterable instance .
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function BY(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function OY(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MY(i)}function Rw(i,e){return Rw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Rw(i,e)}function Jp(i,e){return wY(i)||LY(i,e)||bM(i,e)||UY()}function IY(i){return TY(i)||PY(i)||bM(i)||BY()}function bM(i,e){if(i){if(typeof i=="string")return Nw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?Nw(i,e):void 0}}var uR=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var a=kh(s,r)*180/Math.PI;if(a>t)for(var l=vM(r,s),u=r.length>2||s.length>2?cg(r[2]||0,s[2]||0):null,h=u?function(x){return[].concat(IY(l(x)),[u(x)])}:l,m=1/Math.ceil(a/t),v=m;v<1;)n.push(h(v)),v+=m}n.push(r=s)}),n},Dw=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Hi,Float32BufferAttribute:Si},FY=new Dw.BufferGeometry().setAttribute?"setAttribute":"addAttribute",AP=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;CY(this,e),n=EY(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var a=({Point:m,MultiPoint:v,LineString:x,MultiLineString:S,Polygon:T,MultiPolygon:N}[t.type]||function(){return[]})(t.coordinates,r),l=[],u=[],h=0;a.forEach(function(C){var E=l.length;em({indices:l,vertices:u},C),n.addGroup(E,l.length-E,h++)}),l.length&&n.setIndex(l),u.length&&n[FY]("position",new Dw.Float32BufferAttribute(u,3));function m(C,E){var O=z3(C[1],C[0],E+(C[2]||0)),U=[];return[{vertices:O,indices:U}]}function v(C,E){var O={vertices:[],indices:[]};return C.map(function(U){return m(U,E)}).forEach(function(U){var I=Jp(U,1),j=I[0];em(O,j)}),[O]}function x(C,E){for(var O=uR(C,s).map(function(H){var q=Jp(H,3),V=q[0],Q=q[1],J=q[2],ie=J===void 0?0:J;return z3(Q,V,E+ie)}),U=O_([O]),I=U.vertices,j=Math.round(I.length/3),z=[],G=1;G<j;G++)z.push(G-1,G);return[{vertices:I,indices:z}]}function S(C,E){var O={vertices:[],indices:[]};return C.map(function(U){return x(U,E)}).forEach(function(U){var I=Jp(U,1),j=I[0];em(O,j)}),[O]}function T(C,E){for(var O=C.map(function(re){return uR(re,s).map(function(Z){var ne=Jp(Z,3),de=ne[0],be=ne[1],Te=ne[2],ae=Te===void 0?0:Te;return z3(be,de,E+ae)})}),U=O_(O),I=U.vertices,j=U.holes,z=j[0]||1/0,G=I.slice(0,z*3),H=I.slice(z*3),q=new Set(j),V=Math.round(I.length/3),Q=[],J=[],ie=1;ie<V;ie++)q.has(ie)||(ie<z?Q.push(ie-1,ie):J.push(ie-1-z,ie-z));var le=[{indices:Q,vertices:G}];return j.length&&le.push({indices:J,vertices:H}),le}function N(C,E){var O={vertices:[],indices:[]},U={vertices:[],indices:[]};C.map(function(j){return T(j,E)}).forEach(function(j){var z=Jp(j,2),G=z[0],H=z[1];em(O,G),H&&em(U,H)});var I=[O];return U.vertices.length&&I.push(U),I}return n}return DY(e,i),NY(e)})(Dw.BufferGeometry);function em(i,e){var t=Math.round(i.vertices.length/3);cR(i.vertices,e.vertices),cR(i.indices,e.indices.map(function(n){return n+t}))}function cR(i,e){var t=RY(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function z3(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function kY(i,e,t=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(a){if(a.normalized||a.isInterleavedBufferAttribute){const l=new Float32Array(a.count*a.itemS
2026-03-09 22:33:09 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function NQ(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function RQ(i,e){return yQ(i)||EQ(i,e)||vP(i,e)||CQ()}function DQ(i){return xQ(i)||MQ(i)||vP(i)||NQ()}function PQ(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function LQ(i){var e=PQ(i,"string");return typeof e=="symbol"?e:e+""}function vP(i,e){if(i){if(typeof i=="string")return Uw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?Uw(i,e):void 0}}var gA=new WeakMap,tm=new WeakMap,vA=new WeakMap,G3=new WeakMap,q3=new WeakMap,V3=new WeakMap,UQ=(function(){function i(){SQ(this,i),mA(this,gA,new Map),mA(this,tm,new Map),mA(this,vA,function(e){return e}),mA(this,G3,function(){return{}}),mA(this,q3,function(){}),mA(this,V3,function(){})}return TQ(i,[{key:"getObj",value:function(t){return Js(gA,this).get(Js(vA,this).call(this,t))}},{key:"getData",value:function(t){return Js(tm,this).get(t)}},{key:"entries",value:function(){return DQ(Js(tm,this).entries()).map(function(t){var n=RQ(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return sv(vA,this,Lt(t)),this}},{key:"onCreateObj",value:function(t){return sv(G3,this,t),this}},{key:"onUpdateObj",value:function(t){return sv(q3,this,t),this}},{key:"onRemoveObj",value:function(t){return sv(V3,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!Js(gA,n).has(Js(vA,n).call(n,s))}).forEach(function(s){var a=Js(G3,n).call(n,s);Js(gA,n).set(Js(vA,n).call(n,s),a),Js(tm,n).set(a,s)});var r=new Map(t.map(function(s){return[Js(vA,n).call(n,s),s]}));return Js(gA,this).forEach(function(s,a){r.has(a)?Js(q3,n).call(n,s,r.get(a)):(Js(V3,n).call(n,s,a),Js(gA,n).delete(a),Js(tm,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})(),Wv={exports:{}},BQ=Wv.exports,gR;function OQ(){return gR||(gR=1,(function(i,e){(function(t,n){i.exports=n()})(BQ,function(){return(function(t){function n(s){if(r[s])return r[s].exports;var a=r[s]={exports:{},id:s,loaded:!1};return t[s].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)})([function(t,n,r){var s=r(1),a=(function(){function l(u,h,m){u===void 0&&(u=NaN),h===void 0&&(h=NaN),m===void 0&&(m=!1),this._minFPS=h,this._maxFPS=u,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new s.default,this._onPause=new s.default,this._onTick=new s.default,this._onTickOncePerFrame=new s.default,m||this.resume()}return l.prototype.updateOnce=function(u){u(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},l.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},l.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},l.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(l.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"timeScale",{get:function(){return this._timeScale},set:function(u){this._timeScale!==u&&(this._timeScale=u)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onResume",{get:function(){return this._onResume
2026-03-09 22:33:09 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function IK(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function FK(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return NK(i)}function Iw(i,e){return Iw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Iw(i,e)}function Wl(i,e){return EK(i)||BK(i,e)||bP(i,e)||OK()}function W3(i){return CK(i)||UK(i)||bP(i)||IK()}function bP(i,e){if(i){if(typeof i=="string")return Ow(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?Ow(i,e):void 0}}function kK(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=zK(i,n),s=og(r),a=GK(i,n),l=[].concat(W3(s),W3(a)),u={type:"Polygon",coordinates:i},h=qD(u),m=Wl(h,2),v=Wl(m[0],2),x=v[0],S=v[1],T=Wl(m[1],2),N=T[0],C=T[1],E=x>N||C>=89||S<=-89,O=[];if(E){var U=MK(l).triangles(),I=new Map(l.map(function(ne,de){var be=Wl(ne,2),Te=be[0],ae=be[1];return["".concat(Te,"-").concat(ae),de]}));U.features.forEach(function(ne){var de,be=ne.geometry.coordinates[0].slice(0,3).reverse(),Te=[];if(be.forEach(function(Me){var Ve=Wl(Me,2),Ce=Ve[0],Fe=Ve[1],tt="".concat(Ce,"-").concat(Fe);I.has(tt)&&Te.push(I.get(tt))}),Te.length===3){if(Te.some(function(Me){return Me<s.length})){var ae=ne.properties.circumcenter;if(!Fw(ae,u,E))return}(de=O).push.apply(de,Te)}})}else if(a.length)for(var q=pg.from(l),V=function(de){var be,Te=[2,1,0].map(function(Ve){return q.triangles[de+Ve]}),ae=Te.map(function(Ve){return l[Ve]});if(Te.some(function(Ve){return Ve<s.length})){var Me=[0,1].map(function(Ve){return KW(ae,function(Ce){return Ce[Ve]})});if(!Fw(Me,u,E))return 1}(be=O).push.apply(be,W3(Te))},Q=0,J=q.triangles.length;Q<J;Q+=3)V(Q);else{var j=O_(r),z=j.vertices,G=j.holes,H=G===void 0?[]:G;O=oY(z,H,2)}var ie=Ec(h_(l,function(ne){return ne[0]}),[0,1]),le=Ec(h_(l,function(ne){return ne[1]}),[0,1]),re=l.map(function(ne){var de=Wl(ne,2),be=de[0],Te=de[1];return[ie(be),le(Te)]}),Z={points:l,indices:O,uvs:re};return{contour:r,triangles:Z}}function zK(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var a=kh(s,r)*180/Math.PI;if(a>e)for(var l=vM(r,s),u=1/Math.ceil(a/e),h=u;h<1;)n.push(l(h)),h+=u}n.push(r=s)}),n})}function GK(i,e){var t={type:"Polygon",coordinates:i},n=qD(t),r=Wl(n,2),s=Wl(r[0],2),a=s[0],l=s[1],u=Wl(r[1],2),h=u[0],m=u[1];if(Math.min(Math.abs(h-a),Math.abs(m-l))<e)return[];var v=a>h||m>=89||l<=-89;return qK(e,{minLng:a,maxLng:h,minLat:l,maxLat:m}).filter(function(x){return Fw(x,t,v)})}function qK(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,a=Math.round(Math.pow(360/i,2)/Math.PI),l=(1+Math.sqrt(5))/2,u=function(E){return E/l*360%360-180},h=function(E){return Math.acos(2*E/a-1)/Math.PI*180-90},m=function(E){return a*(Math.cos((E+90)*Math.PI/180)+1)/2},v=[s!==void 0?Math.ceil(m(s)):0,r!==void 0?Math.floor(m(r)):a-1],x=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(C){return C<=n}:n===void 0?function(C){return C>=t}:n>=t?function(C){return C>=t&&C<=n}:function(C){return C>=t||C<=n},S=[],T=v[0];T<=v[1];T++){var N=u(T);x(N)&&S.push([N,h(T)])}return S}function Fw(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?xX(e,i):tK(i,e)}var $ v=window.THREE?window.THREE:{BufferGeometry:Hi,Float32BufferAttribute:Si},NR=new $ v.BufferGeometry().setAttribute?"setAttribute":"addAttribute",CM=(function(i){function e(t,n,r,s,a,l,u){var h;DK(this,e),h=RK(this,e),h.type="ConicPolygonGeometry",h.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:a,includeSides:l,curvatureResolution:u},n=n||0,r=r||1,s=s!==void 0?s:!0,a=a!==void 0?a:!0,l=l!==void 0?l:!0,u=u||5;var m=kK(t,{resolution:u}),v=m.contour,x=m.triangles,S=og(x.uvs),T=[],N=[],C=[],E=0,O=function(G){var H=Math.round(T.length/3),q=C.length;T=T.
2026-03-09 22:33:09 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function YK(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function QK(i,e){if(i==null)return{};var t,n,r=KK(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function KK(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function ZK(i,e){return jK(i)|| $ K(i,e)||SP(i,e)||XK()}function JK(i){return HK(i)||WK(i)||SP(i)||YK()}function eZ(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function tZ(i){var e=eZ(i,"string");return typeof e=="symbol"?e:e+""}function SP(i,e){if(i){if(typeof i=="string")return kw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?kw(i,e):void 0}}var nZ=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),s=i.reduce(function(l,u){var h=l,m=u;return r.forEach(function(v,x){var S=v.keyAccessor,T=v.isProp,N;if(T){var C=m,E=C[S],O=QK(C,[S].map(tZ));N=E,m=O}else N=S(m,x);x+1<r.length?(h.hasOwnProperty(N)||(h[N]={}),h=h[N]):t?(h.hasOwnProperty(N)||(h[N]=[]),h[N].push(m)):h[N]=m}),l},{});t instanceof Function&&(function l(u){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;h===r.length?Object.keys(u).forEach(function(m){return u[m]=t(u[m])}):Object.values(u).forEach(function(m){return l(m,h+1)})})(s);var a=s;return n&&(a=[],(function l(u){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];h.length===r.length?a.push({keys:h,vals:u}):Object.entries(u).forEach(function(m){var v=ZK(m,2),x=v[0],S=v[1];return l(S,[].concat(JK(h),[x]))})})(s),e instanceof Array&&e.length===0&&a.length===1&&(a[0].keys=[])),a}),_i=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r="";function s(Je){return e.locateFile?e.locateFile(Je,r):r+Je}var a;typeof document<"u"&&document.currentScript&&(r=document.currentScript.src),r.indexOf("blob:")!==0?r=r.substr(0,r.lastIndexOf("/")+1):r="",a=function(dt,Vt,xt){var A=new XMLHttpRequest;A.open("GET",dt,!0),A.responseType="arraybuffer",A.onload=function(){if(A.status==200||A.status==0&&A.response){Vt(A.response);return}var Vn=jt(dt);if(Vn){Vt(Vn.buffer);return}xt()},A.onerror=xt,A.send(null)};var l=e.print||console.log.bind(console),u=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&e.arguments;var h=0,m=function(Je){h=Je},v=function(){return h},x=8;function S(Je,dt,Vt,xt){switch(Vt=Vt||"i8",Vt.charAt(Vt.length-1)==="*"&&(Vt="i32"),Vt){case"i1":J[Je>>0]=dt;break;case"i8":J[Je>>0]=dt;break;case"i16":le[Je>>1]=dt;break;case"i32":re[Je>>2]=dt;break;case"i64":Ue=[dt>>>0,(Oe=dt,+ht(Oe)>=1?Oe>0?(_t(+ $ t(Oe/4294967296),4294967295)|0)>>>0:~~+fe((Oe-+(~~Oe>>>0))/4294967296)>>>0:0)],re[Je>>2]=Ue[0],re[Je+4>>2]=Ue[1];break;case"float":Z[Je>>2]=dt;break;case"double":ne[Je>>3]=dt;break;default:qn("invalid type for setValue: "+Vt)}}function T(Je,dt,Vt){switch(dt=dt||"i8",dt.charAt(dt.length-1)==="*"&&(dt="i32"),dt){case"i1":return J[Je>>0];case"i8":return J[Je>>0];case"i16":return le[Je>>1];case"i32":return re[Je>>2];case"i64":return re[Je>>2];case"float":return Z[Je>>2];case"double":return ne[Je>>3];default:qn("invalid type for getValue: "+dt)}return null}var N=!1;function C(Je,dt){Je||qn("Assertion failed: "+dt)}function E(Je){var dt=e["_"+Je];return C(dt,"Cannot call unknown function "+Je+", make sure it is exported
2026-03-09 22:33:09 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
2026-03-09 22:42:36 +01:00
* / c o n s t j Z = [ " a l p h a M a p " , " a l p h a T e s t " , " a n i s o t r o p y " , " a n i s o t r o p y M a p " , " a n i s o t r o p y R o t a t i o n " , " a o M a p " , " a t t e n u a t i o n C o l o r " , " a t t e n u a t i o n D i s t a n c e " , " b u m p M a p " , " c l e a r c o a t " , " c l e a r c o a t M a p " , " c l e a r c o a t N o r m a l M a p " , " c l e a r c o a t N o r m a l S c a l e " , " c l e a r c o a t R o u g h n e s s " , " c o l o r " , " d i s p e r s i o n " , " d i s p l a c e m e n t M a p " , " e m i s s i v e " , " e m i s s i v e M a p " , " e n v M a p " , " g r a d i e n t M a p " , " i o r " , " i r i d e s c e n c e " , " i r i d e s c e n c e I O R " , " i r i d e s c e n c e M a p " , " i r i d e s c e n c e T h i c k n e s s M a p " , " l i g h t M a p " , " m a p " , " m a t c a p " , " m e t a l n e s s " , " m e t a l n e s s M a p " , " n o r m a l M a p " , " n o r m a l S c a l e " , " o p a c i t y " , " r o u g h n e s s " , " r o u g h n e s s M a p " , " s h e e n " , " s h e e n C o l o r " , " s h e e n C o l o r M a p " , " s h e e n R o u g h n e s s M a p " , " s h i n i n e s s " , " s p e c u l a r " , " s p e c u l a r C o l o r " , " s p e c u l a r C o l o r M a p " , " s p e c u l a r I n t e n s i t y " , " s p e c u l a r I n t e n s i t y M a p " , " s p e c u l a r M a p " , " t h i c k n e s s " , " t r a n s m i s s i o n " , " t r a n s m i s s i o n M a p " ] ; c l a s s H Z { c o n s t r u c t o r ( e ) { t h i s . r e n d e r O b j e c t s = n e w W e a k M a p , t h i s . h a s N o d e = t h i s . c o n t a i n s N o d e ( e ) , t h i s . h a s A n i m a t i o n = e . o b j e c t . i s S k i n n e d M e s h = = = ! 0 , t h i s . r e f r e s h U n i f o r m s = j Z , t h i s . r e n d e r I d = 0 } f i r s t I n i t i a l i z a t i o n ( e ) { r e t u r n t h i s . r e n d e r O b j e c t s . h a s ( e ) = = = ! 1 ? ( t h i s . g e t R e n d e r O b j e c t D a t a ( e ) , ! 0 ) : ! 1 } g e t R e n d e r O b j e c t D a t a ( e ) { l e t t = t h i s . r e n d e r O b j e c t s . g e t ( e ) ; i f ( t = = = v o i d 0 ) { c o n s t { g e o m e t r y : n , m a t e r i a l : r , o b j e c t : s } = e ; i f ( t = { m a t e r i a l : t h i s . g e t M a t e r i a l D a t a ( r ) , g e o m e t r y : { a t t r i b u t e s : t h i s . g e t A t t r i b u t e s D a t a ( n . a t t r i b u t e s ) , i n d e x V e r s i o n : n . i n d e x ? n . i n d e x . v e r s i o n : n u l l , d r a w R a n g e : { s t a r t : n . d r a w R a n g e . s t a r t , c o u n t : n . d r a w R a n g e . c o u n t } } , w o r l d M a t r i x : s . m a t r i x W o r l d . c l o n e ( ) } , s . c e n t e r & & ( t . c e n t e r = s . c e n t e r . c l o n e ( ) ) , s . m o r p h T a r g e t I n f l u e n c e s & & ( t . m o r p h T a r g e t I n f l u e n c e s = s . m o r p h T a r g e t I n f l u e n c e s . s l i c e ( ) ) , e . b u n d l e ! = = n u l l & & ( t . v e r s i o n = e . b u n d l e . v e r s i o n ) , t . m a t e r i a l . t r a n s m i s s i o n > 0 ) { c o n s t { w i d t h : a , h e i g h t : l } = e . c o n t e x t ; t . b u f f e r W i d t h = a , t . b u f f e r H e i g h t = l } t h i s . r e n d e r O b j e c t s . s e t ( e , t ) } r e t u r n t } g e t A t t r i b u t e s D a t a ( e ) { c o n s t t = { } ; f o r ( c o n s t n i n e ) { c o n s t r = e [ n ] ; t [ n ] = { v e r s i o n : r . v e r s i o n } } r e t u r n t } c o n t a i n s N o d e ( e ) { c o n s t t = e . m a t e r i a l ; f o r ( c o n s t n i n t ) i f ( t [ n ] & & t [ n ] . i s N o d e ) r e t u r n ! 0 ; r e t u r n e . r e n d e r e r . n o d e s . m o d e l V i e w M a t r i x ! = = n u l l | | e . r e n d e r e r . n o d e s . m o d e l N o r m a l V i e w M a t r i x ! = = n u l l } g e t M a t e r i a l D a t a ( e ) { c o n s t t = { } ; f o r ( c o n s t n o f t h i s . r e f r e s h U n i f o r m s ) { c o n s t r = e [ n ] ; r ! = n u l l & & ( t y p e o f r = = " o b j e c t " & & r . c l o n e ! = = v o i d 0 ? r . i s T e x t u r e = = = ! 0 ? t [ n ] = { i d : r . i d , v e r s i o n : r . v e r s i o n } : t [ n ] = r . c l o n e ( ) : t [ n ] = r ) } r e t u r n t } e q u a l s ( e ) { c o n s t { o b j e c t : t , m a t e r i a l : n , g e o m e t r y : r } = e , s = t h i s . g e t R e n d e r O b j e c t D a t a ( e ) ; i f ( s . w o r l d M a t r i x . e q u a l s ( t . m a t r i x W o r l d ) ! = = ! 0 ) r e t u r n s . w o r l d M a t r i x . c o p y ( t . m a t r i x W o r l d ) , ! 1 ; c o n s t a = s . m a t e r i a l ; f o r ( c o n s t N i n a ) { c o n s t C = a [ N ] , E = n [ N ] ; i f ( C . e q u a l s ! = = v o i d 0 ) { i f ( C . e q u a l s ( E ) = = = ! 1 ) r e t u r n C . c o p y ( E ) , ! 1 } e l s e i f ( E . i s T e x t u r e = = = ! 0 ) { i f ( C . i d ! = = E . i d | | C . v e r s i o n ! = = E . v e r s i o n ) r e t u r n C . i d = E . i d , C . v e r s i o n = E . v e r s i o n , ! 1 } e l s e i f ( C ! = = E ) r e t u r n a [ N ] = E , ! 1 } i f ( a . t r a n s m i s s i o n > 0 ) { c o n s t { w i d t h : N , h e i g h t : C } = e . c o n t e x t ; i f ( s . b u f f e r W i d t h ! = = N | | s . b u f f e r H e i g h t ! = = C ) r e t u r n s . b u f f e r W i d t h = N , s . b u f f e r H e i g h t = C , ! 1 } c o n s t l = s . g e o m e t r y , u = r . a t t r i b u t e s , h = l . a t t r i b u t e s , m = O b j e c t . k e y s ( h ) , v = O b j e c t . k e y s ( u ) ; i f ( m . l e n g t h ! = = v . l e n g t h ) r e t u r n s . g e o m e t r y . a t t r i b u t e s = t h i s . g e t A t t r i b u t e s D a t a ( u ) , ! 1 ; f o r ( c o n s t N o f m ) { c o n s t C = h [ N ] , E = u [ N ] ; i f ( E = = = v o i d 0 ) r e t u r n d e l e t e h [ N ] , ! 1 ; i f ( C . v e r s i o n ! = = E . v e r s i o n ) r e t u r n C . v e r s i o n = E . v e r s i o n , ! 1 } c o n s t x = r . i n d e x , S = l . i n d e x V e r s i o n , T = x ? x . v e r s i o n : n u l l ; i f ( S ! = = T ) r e t u r n l . i n d e x V e r s i o n = T , ! 1 ; i f ( l . d r a w R a n g e . s t a r t ! = = r . d r a w R a n g e . s t a r t | | l . d r a w R a n g e . c o u n t ! = = r . d r a w R a n g e . c o u n t ) r e t u r n l . d r a w R a n g e . s t a r t = r . d r a w R a n g e . s t a r t , l . d r a w R a n g e . c o u n t = r . d r a w R a n g e . c o u n t , ! 1 ; i f ( s . m o r p h T a r g e t I n f l u e n c e s ) { l e t N = ! 1 ; f o r ( l e t C = 0 ; C < s . m o r p h T a r g e t I n f l u e n c e s . l e n g t h ; C + + ) s . m o r p h T a r g e t I n f l u e n c e s [ C ] ! = = t . m o r p h T a r g e t I n f l u e n c e s [ C ] & & ( N = ! 0 ) ; i f ( N ) r e t u r n ! 0 } r e t u r n s . c e n t e r & & s . c e n t e r . e q u a l s ( t . c e n t e r ) = = = ! 1 ? ( s . c e n t e r . c o p y ( t . c e n t e r ) , ! 0 ) : ( e . b u n d l e ! = = n u l l & & ( s . v e r s i o n = e . b u n d l e . v e r s i o n ) , ! 0 ) } n e e d s R e f r e s h ( e , t ) { i f ( t h i s . h a s N o d e | | t h i s . h a s A n i m a t i o n | | t h i s . f i r s t I n i t i a l i z a t i o n ( e ) ) r e t u r n ! 0 ; c o n s t { r e n d e r I d : n } = t ; i f ( t h i s . r e n d e r I d ! = = n ) r e t u r n t h i s . r e n d e r I d = n , ! 0 ; c o n s t r = e . o b j e c t . s t a t i c = = = ! 0 , s = e . b u n d l e ! = = n u l l & & e . b u n d l e . s t a t i c = = = ! 0 & & t h i s . g e t R e n d e r O b j e c t D a t a ( e ) . v e r s i o n = = = e . b u n d l e . v e r s i o n ; r e t u r n r | | s ? ! 1 : t h i s . e q u a l s ( e ) ! = = ! 0 } } f u n c t i o n v g ( i , e = 0 ) { l e t t = 3 7 3 5 9 2 8 5 5 9 ^ e , n = 1 1 0 3 5 4 7 9 9 1 ^ e ; i f ( i i n s t a n c e o f A r r a y ) f o r ( l e t r = 0 , s ; r < i . l e n g t h ; r + + ) s = i [ r ] , t = M a t h . i m u l ( t ^ s , 2 6 5 4 4 3 5 7 6 1 ) , n = M a t h . i m u l ( n ^ s , 1 5 9 7 3 3 4 6 7 7 ) ; e l s e f o r ( l e t r = 0 , s ; r < i . l e n g t h ; r + + ) s = i . c h a r C o d e A t ( r ) , t = M a t h . i m u l ( t ^ s , 2 6 5 4 4 3 5 7 6 1
2026-03-09 22:33:09 +01:00
$ { e . tab } if ( $ { m } ) {
` ).addFlowTab();let v=a.build(e,n);if(v&&(u?v=h+" = "+v+";":v="return "+v+";"),e.removeFlowTab().addFlowCode(e.tab+" "+v+ `
` +e.tab+"}"),l!==null){e.addFlowCode( ` else {
` ).addFlowTab();let x=l.build(e,n);x&&(u?x=h+" = "+x+";":x="return "+x+";"),e.removeFlowTab().addFlowCode(e.tab+" "+x+ `
` +e.tab+ ` }
` )}else e.addFlowCode( `
2026-03-09 22:42:36 +01:00
` );return e.format(h,n,t)}}const zs=gt(bJ);mt("select",zs);const n9=(...i)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),zs(...i));mt("cond",n9);class i9 extends Nn{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const n=this.node.build(e);return e.setContext(t),n}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const r=this.node.build(e,t);return e.setContext(n),r}}const Fy=gt(i9),r9=(i,e)=>Fy(i,{label:e});mt("context",Fy);mt("label",r9);class Yv extends Nn{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:n}=this,r=e.getVarFromNode(this,n,e.getVectorType(this.getNodeType(e))),s=e.getPropertyName(r),a=t.build(e,r.type);return e.addLineFlowCode( ` $ { s } = $ { a } ` ,this),s}}const s9=gt(Yv);mt("toVar",(...i)=>s9(...i).append());const a9=i=>(console.warn('TSL: "temp" is deprecated. Use ".toVar()" instead.'),s9(i));mt("temp",a9);class SJ extends Nn{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(n===void 0){const r=this.name,s=this.getNodeType(e);t.varying=n=e.getVaryingFromNode(this,r,s),t.node=this.node}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),n=this.setupVarying(e),r=e.shaderStage==="fragment"&&t.reassignPosition===!0&&e.context.needsPositionReassign;if(t.propertyName===void 0||r){const s=this.getNodeType(e),a=e.getPropertyName(n,zw.VERTEX);e.flowNodeFromShaderStage(zw.VERTEX,this.node,s,a),t.propertyName=a,r?t.reassignPosition=!1:t.reassignPosition===void 0&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(n)}}const to=gt(SJ),o9=i=>to(i);mt("varying",to);mt("vertexStage",o9);const l9=Ze(([i])=>{const e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Ui(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),u9=Ze(([i])=>{const e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Ui(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Vg="WorkingColorSpace",rE="OutputColorSpace";class jg extends Zr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===Vg?li.workingColorSpace:t===rE?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let s=t;return li.enabled===!1||n===r||!n||!r||(li.getTransfer(n)===Fi&&(s=_n(l9(s.rgb),s.a)),li.getPrimaries(n)!==li.getPrimaries(r)&&(s=_n(ua(li._getMatrix(new Xn,n,r)).mul(s.rgb),s.a)),li.getTransfer(r)===Fi&&(s=_n(u9(s.rgb),s.a))),s}}const c9=i=>wt(new jg(wt(i),Vg,rE)),h9=i=>wt(new jg(wt(i),rE,Vg)),f9=(i,e)=>wt(new jg(wt(i),Vg,e)),sE=(i,e)=>wt(new jg(wt(i),e,Vg)),wJ=(i,e,t)=>wt(new jg(wt(i),e,t));mt("toOutputColorSpace",c9);mt("toWorkingColorSpace",h9);mt("workingToColorSpace",f9);mt("colorSpaceToWorking",sE);let TJ=class extends dd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNod
2026-03-09 22:33:09 +01:00
` :"")+e.tab+z+ ` {
` ).addFlowTab()}const s=r.build(e,"void"),a=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode( `
` +e.tab+s);for(let l=0,u=this.params.length-1;l<u;l++)e.addFlowCode((l===0?"":e.tab)+ ` }
2026-03-09 22:42:36 +01:00
` ).removeFlowTab();return e.addFlowTab(),a}}const Bi=(...i)=>wt(new Tee(Qf(i,"int"))).append(),Mee=()=>zh("continue").append(),NU=()=>zh("break").append(),Eee=(...i)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),Bi(...i)),X3=new WeakMap,po=new On,kR=Ze(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{const a=Ee(bU).mul(t).add(s),l=a.div(n),u=a.sub(l.mul(n));return Ir(i,As(u,l)).depth(r).mul(e)});function Cee(i){const e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0;let a=X3.get(i);if(a===void 0||a.count!==s){let O=function(){C.dispose(),X3.delete(i),i.removeEventListener("dispose",O)};var l=O;a!==void 0&&a.texture.dispose();const u=i.morphAttributes.position||[],h=i.morphAttributes.normal||[],m=i.morphAttributes.color||[];let v=0;e===!0&&(v=1),t===!0&&(v=2),n===!0&&(v=3);let x=i.attributes.position.count*v,S=1;const T=4096;x>T&&(S=Math.ceil(x/T),x=T);const N=new Float32Array(x*S*4*s),C=new XT(N,x,S,s);C.type= $ r,C.needsUpdate=!0;const E=v*4;for(let U=0;U<s;U++){const I=u[U],j=h[U],z=m[U],G=x*S*4*U;for(let H=0;H<I.count;H++){const q=H*E;e===!0&&(po.fromBufferAttribute(I,H),N[G+q+0]=po.x,N[G+q+1]=po.y,N[G+q+2]=po.z,N[G+q+3]=0),t===!0&&(po.fromBufferAttribute(j,H),N[G+q+4]=po.x,N[G+q+5]=po.y,N[G+q+6]=po.z,N[G+q+7]=0),n===!0&&(po.fromBufferAttribute(z,H),N[G+q+8]=po.x,N[G+q+9]=po.y,N[G+q+10]=po.z,N[G+q+11]=z.itemSize===4?po.w:1)}}a={count:s,texture:C,stride:v,size:new bt(x,S)},X3.set(i,a),i.addEventListener("dispose",O)}return a}class Nee extends Nn{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=yn(1),this.updateType=Qn.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,r=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,s=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,a=s!==void 0?s.length:0,{texture:l,stride:u,size:h}=Cee(t);n===!0&&zr.mulAssign(this.morphBaseInfluence),r===!0&&Ja.mulAssign(this.morphBaseInfluence);const m=Ee(h.width);Bi(a,({i:v})=>{const x=ye(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?x.assign(Ir(this.mesh.morphTexture,As(Ee(v).add(1),Ee(Kg))).r):x.assign(zi("morphTargetInfluences","float").element(v).toVar()),n===!0&&zr.addAssign(kR({bufferMap:l,influence:x,stride:u,width:m,depth:v,offset:Ee(0)})),r===!0&&Ja.addAssign(kR({bufferMap:l,influence:x,stride:u,width:m,depth:v,offset:Ee(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const RU=gt(Nee);class W0 extends Nn{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Ree extends W0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class Dee extends i9{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=Ie().toVar("directDiffuse"),r=Ie().toVar("directSpecular"),s=Ie().toVar("indirectDiffuse"),a=Ie().toVar("indirectSpecular"),l={directDiffuse:n,directSpecular:r,indirectDiffuse:s,indirectSpecular:a};return{radiance:Ie().toVar("radiance"),irradiance:Ie().toVar("irradiance"),iblIrradiance:Ie().toVar("iblIrradiance"),ambientOcclusion:ye(1).toVar("ambientOcclusion"),reflectedLight:l,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const DU=gt(Dee);class Pee extends W0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let im,rm;class ss extends Nn{static get type(){return"S
` ,t==="property"?l:e.format( ` $ { l } ( ) ` ,s,t)}}const CB=(i,e=[],t="")=>{for(let s=0;s<e.length;s++){const a=e[s];typeof a=="function"&&(e[s]=a.functionNode)}const n=wt(new EB(i,e,t)),r=(...s)=>n.call(...s);return r.functionNode=n,r},ure=(i,e)=>CB(i,e,"glsl"),cre=(i,e)=>CB(i,e,"wgsl");class hre extends Nn{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new Bc,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:ye()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=VP(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=jP(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const e_=gt(hre);class NB extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const r=t(...n);return this.set(e,r),r}}}class fre{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const t_=new NB;class dre extends Nn{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new NB,this._output=e_(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return n[e]===void 0?n[e]=e_(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):n[e]===void 0?(n[e]=e_(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}
2026-03-09 22:33:09 +01:00
` ,s= `
2026-03-09 22:42:36 +01:00
return { ... output , ` +n+" };",a=r+this.codeNode.code+s;return this._method=new Function(...e,a),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[OP(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Cy(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const Are=gt(dre);function RB(i){let e;const t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Xr.z).negate()}const NE=Ze(([i,e],t)=>{const n=RB(t);return Uc(i,e,n)}),RE=Ze(([i],e)=>{const t=RB(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Cg=Ze(([i,e])=>_n(e.toFloat().mix(Tg.rgb,i.toVec3()),Tg.a));function pre(i,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Cg(i,NE(e,t))}function mre(i,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Cg(i,RE(e))}let wf=null,Tf=null;class gre extends Nn{static get type(){return"RangeNode"}constructor(e=ye(),t=ye()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Rh(this.minNode.value)),n=e.getTypeLength(Rh(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const r=this.minNode.value,s=this.maxNode.value,a=e.getTypeLength(Rh(r)),l=e.getTypeLength(Rh(s));wf=wf||new On,Tf=Tf||new On,wf.setScalar(0),Tf.setScalar(0),a===1?wf.setScalar(r):r.isColor?wf.set(r.r,r.g,r.b,1):wf.set(r.x,r.y,r.z||0,r.w||0),l===1?Tf.setScalar(s):s.isColor?Tf.set(s.r,s.g,s.b,1):Tf.set(s.x,s.y,s.z||0,s.w||0);const u=4,h=u*t.count,m=new Float32Array(h);for(let x=0;x<h;x++){const S=x%u,T=wf.getComponent(S),N=Tf.getComponent(S);m[x]=x0.lerp(T,N,Math.random())}const v=this.getNodeType(e);if(t.count<=4096)n= $ g(m,"vec4",t.count).element(Kg).convert(v);else{const x=new Bg(m,4);e.geometry.setAttribute("__range"+this.id,x),n=K_(x).convert(v)}}else n=ye(0);return n}}const vre=gt(gre);class _re extends Nn{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(console.warn( ` ComputeBuiltinNode : Compute built - in value $ { n } can not be accessed in the $ { e . shaderStage } stage ` ),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const Qy=(i,e)=>wt(new _re(i,e)),yre=Qy("numWorkgroups","uvec3"),xre=Qy("workgroupId","uvec3"),bre=Qy("localId","uvec3"),Sre=Qy("subgroupSize","uint");class wre extends Nn{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode( ` // ${t}Barrier
` ):e.addLineFlowCode( ` $ { t } Barrier ( ) ` ,this)}}const DE=gt(wre),Tre=()=>DE("workgroup").append(),Mre=()=>DE("storage").append(),Ere=()=>DE("texture").append();class Cre extends dd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const r=e.context.assign;if(n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}class Nre extends Nn{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e}label(e){return this.name=e,this}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return ` $ { this . scope } Array ` }element(e){return wt(new Cre(this,e))}generate(e){return e.getScopedArray(this.name|| ` $ { this . scope } Array _$ { this . id } ` ,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const Rre=(i,e)=>wt(new Nre("Workgroup",i,e));class Rs extends Zr{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,r=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=r}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),r=this.getInputType(e),s=this.pointerNode,a=this.valueNode,l=[];l.push( ` & $ { s . build ( e , r ) } ` ),l.push(a.build(e,r));const u= ` $ { e . getMethod ( t , n ) } ( $ { l . join ( ", " ) } ) ` ;if(this.storeNode!==null){const h=this.storeNode.build(e,r);e.addLineFlowCode( ` $ { h } = $ { u } ` ,this)}else e.addLineFlowCode(u,this)}}Rs.ATOMIC_LOAD="atomicLoad";Rs.ATOMIC_STORE="atomicStore";Rs.ATOMIC_ADD="atomicAdd";Rs.ATOMIC_SUB="atomicSub";Rs.ATOMIC_MAX="atomicMax";Rs.ATOMIC_MIN="atomicMin";Rs.ATOMIC_AND="atomicAnd";Rs.ATOMIC_OR="atomicOr";Rs.ATOMIC_XOR="atomicXor";const Dre=gt(Rs),zc=(i,e,t,n=null)=>{const r=Dre(i,e,t,n);return r.append(),r},Pre=(i,e,t=null)=>zc(Rs.ATOMIC_STORE,i,e,t),Lre=(i,e,t=null)=>zc(Rs.ATOMIC_ADD,i,e,t),Ure=(i,e,t=null)=>zc(Rs.ATOMIC_SUB,i,e,t),Bre=(i,e,t=null)=>zc(Rs.ATOMIC_MAX,i,e,t),Ore=(i,e,t=null)=>zc(Rs.ATOMIC_MIN,i,e,t),Ire=(i,e,t=null)=>zc(Rs.ATOMIC_AND,i,e,t),Fre=(i,e,t=null)=>zc(Rs.ATOMIC_OR,i,e,t),kre=(i,e,t=null)=>zc(Rs.ATOMIC_XOR,i,e,t);let Av;function Jg(i){Av=Av||new WeakMap;let e=Av.get(i);return e===void 0&&Av.set(i,e={}),e}function PE(i){const e=Jg(i);return e.shadowMatrix||(e.shadowMatrix=yn("mat4").setGroup(Ln).onRenderUpdate(()=>(i.castShadow!==!0&&i.shadow.updateMatrices(i),i.shadow.matrix)))}function DB(i){const e=Jg(i);if(e.projectionUV===void 0){const t=PE(i).mul(Tc);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function LE(i){const e=Jg(i);return e.position||(e.position=yn(new pe).setGroup(Ln).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function PB(i){const e=Jg(i);return e.targetPosition||(e.targetPosition=yn(new pe).setGroup(Ln).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function Ky(i){const e=Jg(i);return e.viewPosition||(e.viewPosition=yn(new pe).setGroup(Ln).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new pe,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const UE=i=>no.transformDirection(LE(i).sub(PB(i))),zre=i=>i.sort((e,t)=>e.id-t.id),Gre=(i,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},lS=new WeakMap;class BE extends Nn{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Ie().toVar("totalDiffuse"),this.totalSpecularNode=Ie().toVar("totalSpecular"),this.outgoingLightNode=Ie().toVar("outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=[],t=this._lights;for(let n=0;n<t.length;n++)e.push(t[n].id);return Cy(e)}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getSelf().getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getDataFromNode(this);for(const n of t.nodes)n.build(e)}setupLightsNode(e){const t=[],n=this._lightNode
2026-03-09 22:33:09 +01:00
` ),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}buildFunctionNode(e){const t=new EB,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let a=0;const l=Object.values(this);return{next:()=>({value:l[a],done:a++>=l.length})}}};for(const a of t.inputs)n[a.name]=new sB(a.type,a.name);e.layout=null;const r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowStagesNode(e,t=null){const n=this.flow,r=this.vars,s=this.cache,a=this.buildStage,l=this.stack,u={code:""};this.flow=u,this.vars={},this.cache=new cS,this.stack=Zv();for(const h of Gw)this.setBuildStage(h),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.cache=s,this.stack=l,this.setBuildStage(a),u}getFunctionOperator(){return null}flowChildNode(e,t=null){const n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){const s=this.shaderStage;this.setShaderStage(e);const a=this.flowChildNode(t,n);return r!==null&&(a.code+= ` $ { this . tab + r } = $ { a . result } ;
` ),this.flowCode[e]=this.flowCode[e]+a.code,this.setShaderStage(s),a}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t){return ` $ { this . getType ( e ) } $ { t } ` }getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const r of n)t+= ` $ { this . getVar ( r . type , r . name ) } ; ` ;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const r of t)n+=r.code+ `
` ;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){console.warn("Abstract function.")}build(){const{object:e,material:t,renderer:n}=this;if(t!==null){let r=n.library.fromMaterial(t);r===null&&(console.error( ` NodeMaterial : Material "${t.type}" is not compatible . ` ),r=new qr),r.build(this)}else this.addFlow("compute",e);for(const r of Gw){this.setBuildStage(r),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const s of qw){this.setShaderStage(s);const a=this.flowNodes[s];for(const l of a)r==="generate"?this.flowNode(l):l.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if(t==="float"||t==="int"||t==="uint")return new zae(e);if(t==="vec2"||t==="ivec2"||t==="uvec2")return new Gae(e);if(t==="vec3"||t==="ivec3"||t==="uvec3")return new qae(e);if(t==="vec4"||t==="ivec4"||t==="uvec4")return new Vae(e);if(t==="color")return new jae(e);if(t==="mat3")return new Hae(e);if(t==="mat4")return new Wae(e);throw new Error( ` Uniform "${t}" not declared . ` )}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;const r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9? ` $ { this . getType ( n ) } ( $ { e } [ 0 ] . xyz , $ { e } [ 1 ] . xyz , $ { e } [ 2 ] . xyz ) ` :r===9&&s===4? ` $ { this . getType ( n ) } ( $ { e } [ 0 ] . xy , $ { e } [ 1 ] . xy ) ` :r>4||s>4||s===0?e:r===s? ` $ { this . getType ( n ) } ( $ { e } ) ` :r>s?this.format( ` $ { e } . $ { "xyz" . slice ( 0 , s ) } ` ,this.getTypeFromLength(s,this.getComponentType(t)),n):s===4&&r>1? ` $ { this . getType ( n ) } ( $ { this . format ( e , t , "vec3" ) } , 1.0 ) ` :r===2? ` $ { this . getType ( n ) } ( $ { this . format ( e , t , "vec2" ) } , 0.0 ) ` :(r===1&&s>1&&t!==this.getComponentType(n)&&(e= ` $ { this . getType ( this . getComponentType ( n ) ) } ( $ { e } ) ` ), ` $ { this . getType ( n ) } ( $ { e } ) ` )}getSignature(){return ` // Three.js r${F0} - Node System
2026-03-09 22:42:36 +01:00
` }createNodeMaterial(e="NodeMaterial"){throw new Error( ` THREE . NodeBuilder : createNodeMaterial ( ) was deprecated . Use new $ { e } ( ) instead . ` )}}class x6{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===Qn.FRAME){const{frameMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&r.set(n,this.frameId)}else if(t===Qn.RENDER){const{renderMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&r.set(n,this.renderId)}else t===Qn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===Qn.FRAME){const{frameMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&r.set(n,this.frameId)}else if(t===Qn.RENDER){const{renderMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&r.set(n,this.renderId)}else t===Qn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===Qn.FRAME){const{frameMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.frameId&&e.update(this)!==!1&&r.set(n,this.frameId)}else if(t===Qn.RENDER){const{renderMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.renderId&&e.update(this)!==!1&&r.set(n,this.renderId)}else t===Qn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class qE{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}}qE.isNodeFunctionInput=!0;class Jae extends md{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,r=UE(this.light),s=e.context.reflectedLight;t.direct({lightDirection:r,lightColor:n,reflectedLight:s},e.stack,e)}}const mS=new jn,vv=new jn;let hm=null;class eoe extends md{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=yn(new pe).setGroup(Ln),this.halfWidth=yn(new pe).setGroup(Ln),this.updateType=Qn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;vv.identity(),mS.copy(t.matrixWorld),mS.premultiply(n),vv.extractRotation(mS),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(vv),this.halfHeight.value.applyMatrix4(vv)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=fi(hm.LTC_FLOAT_1),n=fi(hm.LTC_FLOAT_2)):(t=fi(hm.LTC_HALF_1),n=fi(hm.LTC_HALF_2));const{colorNode:r,light:s}=this,a=e.context.lightingModel,l=Ky(s),u=e.context.reflectedLight;a.directRectArea({lightColor:r,lightPosition:l,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:u,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){hm=e}}class JB extends md{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=yn(0).setGroup(Ln),this.penumbraCosNode=yn(0).setGroup(Ln),this.cutoffDistanceNode=yn(0).setGroup(Ln),this.decayExponentNode=yn(0).setGroup(Ln)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return Uc(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:r,decayExponentNode:s,light:a}=this,l=Ky(a).sub(Xr),u=l.normalize(),h=u.dot(UE(a)),m=this.getSpotAttenuation(h),v=l.length(),x=IE({lightDi
2026-03-09 22:33:09 +01:00
Message : $ { e . message } ` ;e.reason&&(t+= `
Reason : $ { e . reason } ` ),console.error(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:r,camera:s,renderList:a}=e,l=this._currentRenderContext,u=this._bundles.get(r,s),h=this.backend.get(u);h.renderContexts===void 0&&(h.renderContexts=new Set);const m=r.version!==h.version,v=h.renderContexts.has(l)===!1||m;if(h.renderContexts.add(l),v){this.backend.beginBundle(l),(h.renderObjects===void 0||m)&&(h.renderObjects=[]),this._currentRenderBundle=u;const x=a.opaque;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(l,u),h.version=r.version}else{const{renderObjects:x}=h;for(let S=0,T=x.length;S<T;S++){const N=x[S];this._nodes.needsRefresh(N)&&(this._nodes.updateBefore(N),this._nodes.updateForRender(N),this._bindings.updateForRender(N),this._nodes.updateAfter(N))}}this.backend.addBundle(l,u)}render(e,t){if(this._initialized===!1)return console.warn("THREE.Renderer: .render() called before the backend is initialized. Try using .renderAsync() instead."),this.renderAsync(e,t);this._renderScene(e,t)}_getFrameBufferTarget(){const{currentToneMapping:e,currentColorSpace:t}=this;if(e!==Ya===!1&&t!==Mo===!1)return null;const{width:s,height:a}=this.getDrawingBufferSize(_v),{depth:l,stencil:u}=this;let h=this._frameBufferTarget;return h===null&&(h=new qh(s,a,{depthBuffer:l,stencilBuffer:u,type:Gs,format:ks,colorSpace:Mo,generateMipmaps:!1,minFilter:ps,magFilter:ps,samples:this.samples}),h.isPostProcessingRenderTarget=!0,this._frameBufferTarget=h),h.depthBuffer=l,h.stencilBuffer=u,h.setSize(s,a),h.viewport.copy(this._viewport),h.scissor.copy(this._scissor),h.viewport.multiplyScalar(this._pixelRatio),h.scissor.multiplyScalar(this._pixelRatio),h.scissorTest=this._scissorTest,h}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;const r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,a=s.renderId,l=this._currentRenderContext,u=this._currentRenderObjectFunction,h=e.isScene===!0?e:w6,m=this._renderTarget,v=this._activeCubeFace,x=this._activeMipmapLevel;let S;r!==null?(S=r,this.setRenderTarget(S)):S=m;const T=this._renderContexts.get(e,t,S);this._currentRenderContext=T,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls;const N=this.coordinateSystem;t.coordinateSystem!==N&&(t.coordinateSystem=N,t.updateProjectionMatrix()),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld();let C=this._viewport,E=this._scissor,O=this._pixelRatio;S!==null&&(C=S.viewport,E=S.scissor,O=1),this.getDrawingBufferSize(_v),vS.set(0,0,_v.width,_v.height);const U=C.minDepth===void 0?0:C.minDepth,I=C.maxDepth===void 0?1:C.maxDepth;T.viewportValue.copy(C).multiplyScalar(O).floor(),T.viewportValue.width>>=x,T.viewportValue.height>>=x,T.viewportValue.minDepth=U,T.viewportValue.maxDepth=I,T.viewport=T.viewportValue.equals(vS)===!1,T.scissorValue.copy(E).multiplyScalar(O).floor(),T.scissor=this._scissorTest&&T.scissorValue.equals(vS)===!1,T.scissorValue.width>>=x,T.scissorValue.height>>=x,T.clippingContext||(T.clippingContext=new ry),T.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,S),yv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),_S.setFromProjectionMatrix(yv,N);const j=this._renderLists.get(e,t);if(j.begin(),this._projectObject(e,t,0,j,T.clippingContext),j.finish(),this.sortObjects===!0&&j.sort(this._opaqueSort,this._transparentSort),S!==null){this._textures.updateRenderTarget(S,x);const Q=this._textures.get(S);T.textures=Q.textures,T.depthTexture=Q.depthTexture,T.width=Q.width,T.height=Q.height,T.renderTarget=S,T.depth=S.depthBuffer,T.stencil=S.stencilBuffer}else T.textures=null,T.depthTexture=null,T.width=this.domElement.width,T.height=this.domElement.height,T.depth=this.depth,T.stencil=this.stencil;T.width>>=x,T.height>>=x,T.activeCubeFace=v,T.activeMipmapLevel=x,T.occlusionQueryCount=j.occlusionQueryCount,this._background.update(h,j,T),this.backend.beginRender(
precision highp float ;
precision highp int ;
precision highp sampler2D ;
precision highp sampler3D ;
precision highp samplerCube ;
precision highp sampler2DArray ;
precision highp usampler2D ;
precision highp usampler3D ;
precision highp usamplerCube ;
precision highp usampler2DArray ;
precision highp isampler2D ;
precision highp isampler3D ;
precision highp isamplerCube ;
precision highp isampler2DArray ;
precision lowp sampler2DShadow ;
` ;class Moe extends ZB{constructor(e,t){super(e,t,new uoe),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]},this.useComparisonMethod=!0}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==To}getMethod(e){return woe[e]||e}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),r=[];for(const a of t.inputs)r.push(this.getType(a.type)+" "+a.name);return ` $ { this . getType ( t . type ) } $ { t . name } ( $ { r . join ( ", " ) } ) {
$ { n . vars }
$ { n . code }
return $ { n . result } ;
} ` }setupPBO(e){const t=e.value;if(t.pbo===void 0){const n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,a=t.array.constructor.name.toLowerCase().includes("int");let l=a?k0:Lg;s===2?l=a?z0:id:s===3?l=a? $ F:Pg:s===4&&(l=a?G0:ks);const u={Float32Array: $ r,Uint8Array:ra,Uint16Array:bl,Uint32Array:Nr,Int8Array:Hf,Int16Array:Wf,Int32Array:Ns,Uint8ClampedArray:ra},h=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let m=Math.ceil(r/s/h);h*m*s<r&&m++;const v=h*m*s,x=new n.constructor(v);x.set(n,0),t.array=x;const S=new Kk(t.array,h,m,l,u[t.array.constructor.name]|| $ r);S.needsUpdate=!0,S.isPBOTexture=!0;const T=new pu(S,null,null);T.setPrecision("high"),t.pboNode=T,t.pbo=T.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.label)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?t.charAt(0)+"_"+e.name:super.getPropertyName(e,t)}generatePBO(e){const{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){const m=this.renderer.backend.get(r);m.pbo=r.pbo}const s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.label),a=this.getPropertyName(s);this.increaseUsage(n);const l=n.build(this,"uint"),u=this.getDataFromNode(e);let h=u.propertyName;if(h===void 0){const m=this.getVarFromNode(e);h=this.getPropertyName(m);const v=this.getDataFromNode(t);let x=v.propertySizeName;x===void 0&&(x=h+"Size",this.getVarFromNode(t,x,"uint"),this.addLineFlowCode( ` $ { x } = uint ( textureSize ( $ { a } , 0 ) . x ) ` ,e),v.propertySizeName=x);const{itemSize:S}=r,T="."+fd.join("").slice(0,S),N= ` ivec2 ( $ { l } % $ { x } , $ { l } / $ { x } ) ` ,C=this.generateTextureLoad(null,a,N,null,"0");let E="vec4";r.pbo.type===Nr?E="uvec4":r.pbo.type===Ns&&(E="ivec4"),this.addLineFlowCode( ` $ { h } = $ { E } ( $ { C } ) $ { T } ` ,e),u.propertyName=h}return h}generateTextureLoad(e,t,n,r,s="0"){return r? ` texelFetch ( $ { t } , ivec3 ( $ { n } , $ { r } ) , $ { s } ) ` : ` texelFetch ( $ { t } , $ { n } , $ { s } ) ` }generateTexture(e,t,n,r){return e.isDepthTexture? ` texture ( $ { t } , $ { n } ) . x ` :(r&&(n= ` vec3 ( $ { n } , $ { r } ) ` ), ` texture ( $ { t } , $ { n } ) ` )}generateTextureLevel(e,t,n,r){return ` textureLod ( $ { t } , $ { n } , $ { r } ) ` }generateTextureBias(e,t,n,r){return ` texture ( $ { t } , $ { n } , $ { r } ) ` }generateTextureGrad(e,t,n,r){return ` textureGrad ( $ { t } , $ { n } , $ { r [ 0 ] } , $ { r [ 1 ] } ) ` }generateTextureCompare(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return ` texture ( $ { t } , vec3 ( $ { n } , $ { r } ) ) ` ;console.error( ` WebGPURenderer : THREE . DepthTexture . compareFunction ( ) does not support $ { a } shader . ` )}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const r of n)t.push( ` $ { this . getVar ( r . type , r . name ) } ; ` );return t.join( `
` )}getUniforms(e){const t=this.uniforms[e],n=[],r={};for(const a of t){let l=null,u=!1;if(a.type==="texture"){const m=a.node.value;let v="";m.isDataTexture===!0&&(m.type===Nr?v="u":m.type===Ns&&(v="i")),m.compareFunction?l= ` sampler2DShadow $ { a . name } ; ` :m.isDataArrayTexture===!0||m.isCompressedArrayTexture===!0?l= ` $ { v } sampler2DArray $ { a . name } ; ` :l= ` $ { v } sampler2D $ { a . name } ; ` }else if(a.type==="cubeTexture")l= ` samplerCube $ { a . name } ; ` ;else if(a.type==="texture3D")l= ` sampler3D $ { a . name } ; ` ;else if(a.type==="buffer"){const m=a.node,v=this.getType(m.bufferType),x=m.bufferCount,S=x>0?x:"";l= ` $ { m . name } {
$ { v } $ { a . name } [ $ { S } ] ;
} ;
` }else l= ` $ { this . getVectorType ( a . type ) } $ { this . getPropertyName ( a , e ) } ; ` ,u=!0;const h=a.node.precision;if(h!==null&&(l=Toe[h]+" "+l),u){l=" "+l;const m=a.groupNode.name;(r[m]||(r[m]=[])).push(l)}else l="uniform "+l,n.push(l)}let s="";for(const a in r){const l=r[a];s+=this._getGLSLUniformStruct(e+"_"+a,l.join( `
` ))+ `
` }return s+=n.join( `
` ),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Ns){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const n=this.getAttributesArray();let r=0;for(const s of n)t+= ` layout ( location = $ { r ++ } ) in $ { s . type } $ { s . name } ;
` }return t}getStructMembers(e){const t=[],n=e.getMemberTypes();for(let r=0;r<n.length;r++){const s=n[r];t.push( ` layout ( location = $ { r } ) out $ { s } m$ { r } ; ` )}return t.join( `
` )}getStructs(e){const t=[],n=this.structs[e];if(n.length===0)return ` layout ( location = 0 ) out vec4 fragColor ;
` ;for(let r=0,s=n.length;r<s;r++){const a=n[r];let l= `
` ;l+=this.getStructMembers(a),l+= `
` ,t.push(l)}return t.join( `
` )}getVaryings(e){let t="";const n=this.varyings;if(e==="vertex"||e==="compute")for(const r of n){e==="compute"&&(r.needsInterpolation=!0);const s=this.getType(r.type),a=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+= ` $ { a } $ { r . needsInterpolation ? "out" : "/*out*/" } $ { s } $ { r . name } ;
` }else if(e==="fragment"){for(const r of n)if(r.needsInterpolation){const s=this.getType(r.type),a=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+= ` $ { a } in $ { s } $ { r . name } ;
` }}for(const r of this.builtins[e])t+= ` $ { r } ;
` ;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return ` uint ( gl _InstanceID ) % $ { this . object . workgroupSize . reduce ( ( n , r ) => n * r , 1 ) } u ` }getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){const r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(n!==void 0)for(const{name:r,behavior:s}of n.values())t.push( ` # extension $ { r } : $ { s } ` );return t.join( `
` )}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=T6[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){const r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}T6[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push( ` out float gl _ClipDistance [ $ { e } ] ` )}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let n=0;n<e.length;n++){const r=e[n],s=this.getPropertyName(r.attributeNode);t+= ` $ { r . varyingName } = $ { s } ;
` }return t}_getGLSLUniformStruct(e,t){return `
layout ( std140 ) uniform $ { e } {
$ { t }
} ; ` }_getGLSLVertexCode(e){return ` # version 300 es
$ { this . getSignature ( ) }
// extensions
$ { e . extensions }
// precision
$ { M6 }
// uniforms
$ { e . uniforms }
// varyings
$ { e . varyings }
// attributes
$ { e . attributes }
// codes
$ { e . codes }
void main ( ) {
// vars
$ { e . vars }
// transforms
$ { e . transforms }
// flow
$ { e . flow }
gl _PointSize = 1.0 ;
}
` }_getGLSLFragmentCode(e){return ` # version 300 es
$ { this . getSignature ( ) }
// precision
$ { M6 }
// uniforms
$ { e . uniforms }
// varyings
$ { e . varyings }
// codes
$ { e . codes }
$ { e . structs }
void main ( ) {
// vars
$ { e . vars }
// flow
$ { e . flow }
}
` }buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let n= ` // code
` ;n+=this.flowCode[t];const r=this.flowNodes[t],s=r[r.length-1];for(const l of r){const u=this.getFlowData(l),h=l.name;h&&(n.length>0&&(n+= `
` ),n+= ` // flow -> ${h}
` ),n+= ` $ { u . code }
` ,l===s&&t!=="compute"&&(n+= ` // result
2026-03-09 22:42:36 +01:00
` ,t==="vertex"?(n+="gl_Position = ",n+= ` $ { u . result } ; ` ):t==="fragment"&&(l.outputNode.isOutputStructNode||(n+="fragColor = ",n+= ` $ { u . result } ; ` )))}const a=e[t];a.extensions=this.getExtensions(t),a.uniforms=this.getUniforms(t),a.attributes=this.getAttributes(t),a.varyings=this.getVaryings(t),a.vars=this.getVars(t),a.structs=this.getStructs(t),a.codes=this.getCodes(t),a.transforms=this.getTransforms(t),a.flow=n}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),a=this.getDataFromNode(e,n,this.globalCache);let l=a.uniformGPU;if(l===void 0){const u=e.groupNode,h=u.name,m=this.getBindGroupArray(h,n);if(t==="texture")l=new Zy(s.name,s.node,u),m.push(l);else if(t==="cubeTexture")l=new aO(s.name,s.node,u),m.push(l);else if(t==="texture3D")l=new oO(s.name,s.node,u),m.push(l);else if(t==="buffer"){e.name= ` NodeBuffer _$ { e . id } ` ,s.name= ` buffer$ { e . id } ` ;const v=new rO(e,u);v.name=e.name,m.push(v),l=v}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let x=v[h];x===void 0&&(x=new sO(n+"_"+h,u),v[h]=x,m.push(x)),l=this.getNodeUniform(s,t),x.addUniform(l)}a.uniformGPU=l}return s}}let yS=null,EA=null;class lO{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}createSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}isOccluded(){}async resolveTimestampAsync(){}async waitForGPU(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return yS=yS||new bt,this.renderer.getDrawingBufferSize(yS)}setScissorTest(){}getClearColor(){const e=this.renderer;return EA=EA||new TE,e.getClearColor(EA),EA.getRGB(EA,this.renderer.currentColorSpace),EA}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:q7(),"setAttribute"in e&&e.setAttribute("data-engine", ` three . js r$ { F0 } webgpu ` ),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let Eoe=0;class Coe{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return ` $ { this . baseId } | $ { this . activeBufferIndex } ` }get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class Noe{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:r}=n,s=e.array,a=e.usage||r.STATIC_DRAW,l=e.isInterleavedBufferAttribute?e.data:e,u=n.get(l);let h=u.bufferGPU;h===void 0&&(h=this._createBuffer(r,t,s,a),u.bufferGPU=h,u.bufferType=t,u.version=l.version);let m;if(s instanceof Float32Array)m=r.FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?m=r.HALF_FLOAT:m=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)m=r.SHORT;else if(s instanceof Uint32Array)m=r.UNSIGNED_INT;else if(s instanceof Int32Array)m=r.INT;else if(s instanceof Int8Array)m=r.BYTE;else if(s instanceof Uint8Array)m=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)
2026-03-09 22:33:09 +01:00
` ),r=[],s=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let l=s;l<a;l++){const u=l+1;r.push( ` $ { u === t ? ">" : " " } $ { u } : $ { n [ l ] } ` )}return r.join( `
` )}_getShaderErrors(e,t,n){const r=e.getShaderParameter(t,e.COMPILE_STATUS),s=e.getShaderInfoLog(t).trim();if(r&&s==="")return"";const a=/ERROR: 0:( \d +)/.exec(s);if(a){const l=parseInt(a[1]);return n.toUpperCase()+ `
` +s+ `
` +this._handleSource(e.getShaderSource(t),l)}else return s}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const r=this.gl,s=r.getProgramInfoLog(e).trim();if(r.getProgramParameter(e,r.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(r,e,n,t);else{const a=this._getShaderErrors(r,n,"vertex"),l=this._getShaderErrors(r,t,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(e,r.VALIDATE_STATUS)+ `
Program Info Log : ` +s+ `
` +a+ `
` +l)}else s!==""&&console.warn("THREE.WebGLProgram: Program Info Log:",s)}}_completeCompile(e,t){const{state:n,gl:r}=this,s=this.get(t),{programGPU:a,fragmentShader:l,vertexShader:u}=s;r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,u),n.useProgram(a);const h=e.getBindings();this._setupBindings(h,a),this.set(t,{programGPU:a})}createComputePipeline(e,t){const{state:n,gl:r}=this,s={stage:"fragment",code: ` # version 300 es
precision highp float ;
void main ( ) { } ` };this.createProgram(s);const{computeProgram:a}=e,l=r.createProgram(),u=this.get(s).shaderGPU,h=this.get(a).shaderGPU,m=a.transforms,v=[],x=[];for(let C=0;C<m.length;C++){const E=m[C];v.push(E.varyingName),x.push(E.attributeNode)}r.attachShader(l,u),r.attachShader(l,h),r.transformFeedbackVaryings(l,v,r.SEPARATE_ATTRIBS),r.linkProgram(l),r.getProgramParameter(l,r.LINK_STATUS)===!1&&this._logProgramError(l,u,h),n.useProgram(l),this._setupBindings(t,l);const S=a.attributes,T=[],N=[];for(let C=0;C<S.length;C++){const E=S[C].node.attribute;T.push(E),this.has(E)||this.attributeUtils.createAttribute(E,r.ARRAY_BUFFER)}for(let C=0;C<x.length;C++){const E=x[C].attribute;this.has(E)||this.attributeUtils.createAttribute(E,r.ARRAY_BUFFER);const O=this.get(E);N.push(O)}this.set(e,{programGPU:l,transformBuffers:N,attributes:T})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(const s of t){this.set(s,{textures:r,uniformBuffers:n});for(const a of s.bindings)a.isUniformBuffer&&n++,a.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this,n=this.get(e);let r=n.uniformBuffers,s=n.textures;for(const a of e.bindings)if(a.isUniformsGroup||a.isUniformBuffer){const l=a.buffer,u=t.createBuffer();t.bindBuffer(t.UNIFORM_BUFFER,u),t.bufferData(t.UNIFORM_BUFFER,l,t.DYNAMIC_DRAW),this.set(a,{index:r++,bufferGPU:u})}else if(a.isSampledTexture){const{textureGPU:l,glTextureType:u}=this.get(a.texture);this.set(a,{index:s++,textureGPU:l,glTextureType:u})}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const r=this.get(e).bufferGPU,s=e.buffer;t.bindBuffer(t.UNIFORM_BUFFER,r),t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW)}}createIndexAttribute(e){const t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){const t=Object.keys(R6).filter(r=>R6[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,n=null,r=null,s=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}_setFramebuffer(e){const{gl:t,state:n}=this;let r=null;if(e.textures!==null){const s=e.renderTarget,a=this.get(s),{samples:l,depthBuffer:u,stencilBuffer:h}=s,m=s.isWebGLCubeRenderTarget===!0,v=s.isRenderTarget3D===!0,x=s.isRenderTargetArray===!0;let S=a.msaaFrameBuffer,T=a.depthRenderbuffer;const N=rB(e);let C;if(m?(a.cubeFramebuffers||(a.cubeFramebuffers={}),C=a.cubeFramebuffers[N]):(a.framebuffers||(a.framebuffers={}),C=a.framebuffers[N]),C===void 0){C=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,C);const E=e.textures;if(m){a.cubeFramebuffers[N]=C;const{textureGPU:O}=this.get(E[0]),U=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+U,O,0)}else{a.framebuffers[N]=C;for(let O=0;O<E.length;O++){const U=E[O],I=this.get(U);I.renderTarget=e.renderTarget,I.cacheKey=N;const j=t.COLOR_ATTACHMENT0+O;if(v||x){const z=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,j,I.textureGPU,0,z)}else t.framebufferTexture2D(t.FRAMEBUFFER,j,t.TEXTURE_2D,I.textureGPU,0)}n.drawBuffers(e,C)}if(e.depthTexture!==null){const O=this.get(e.depthTexture),U=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;O.renderTarget=e.renderTarget,O.cacheKey=N,t.framebufferTexture2D(t.FRAMEBUFFER,U,t.TEXTURE_2D,O.textureGPU,0)}}if(l>0){if(S===void 0){const E=[];S=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,S);const O=[],U=e.textures;for(let I=0;I<U.length;I++){if(O[I]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,O[I]),E.push(t.COLOR_ATTACH
struct VarysStruct {
@ builtin ( position ) Position : vec4 < f32 > ,
@ location ( 0 ) vTex : vec2 < f32 >
} ;
@ vertex
fn main ( @ builtin ( vertex _index ) vertexIndex : u32 ) - > VarysStruct {
var Varys : VarysStruct ;
var pos = array < vec2 < f32 > , 4 > (
vec2 < f32 > ( - 1.0 , 1.0 ) ,
vec2 < f32 > ( 1.0 , 1.0 ) ,
vec2 < f32 > ( - 1.0 , - 1.0 ) ,
vec2 < f32 > ( 1.0 , - 1.0 )
) ;
var tex = array < vec2 < f32 > , 4 > (
vec2 < f32 > ( 0.0 , 0.0 ) ,
vec2 < f32 > ( 1.0 , 0.0 ) ,
vec2 < f32 > ( 0.0 , 1.0 ) ,
vec2 < f32 > ( 1.0 , 1.0 )
) ;
Varys . vTex = tex [ vertexIndex ] ;
Varys . Position = vec4 < f32 > ( pos [ vertexIndex ] , 0.0 , 1.0 ) ;
return Varys ;
}
` ,n= `
@ group ( 0 ) @ binding ( 0 )
var imgSampler : sampler ;
@ group ( 0 ) @ binding ( 1 )
var img : texture _2d < f32 > ;
@ fragment
fn main ( @ location ( 0 ) vTex : vec2 < f32 > ) - > @ location ( 0 ) vec4 < f32 > {
return textureSample ( img , imgSampler , vTex ) ;
}
` ,r= `
@ group ( 0 ) @ binding ( 0 )
var imgSampler : sampler ;
@ group ( 0 ) @ binding ( 1 )
var img : texture _2d < f32 > ;
@ fragment
fn main ( @ location ( 0 ) vTex : vec2 < f32 > ) - > @ location ( 0 ) vec4 < f32 > {
return textureSample ( img , imgSampler , vec2 ( vTex . x , 1.0 - vTex . y ) ) ;
}
` ;this.mipmapSampler=e.createSampler({minFilter:If.Linear}),this.flipYSampler=e.createSampler({minFilter:If.Nearest}),this.transferPipelines={},this.flipYPipelines={},this.mipmapVertexShaderModule=e.createShaderModule({label:"mipmapVertex",code:t}),this.mipmapFragmentShaderModule=e.createShaderModule({label:"mipmapFragment",code:n}),this.flipYFragmentShaderModule=e.createShaderModule({label:"flipYFragment",code:r})}getTransferPipeline(e){let t=this.transferPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label: ` mipmap - $ { e } ` ,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.mipmapFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology: $ A.TriangleStrip,stripIndexFormat:U0.Uint32},layout:"auto"}),this.transferPipelines[e]=t),t}getFlipYPipeline(e){let t=this.flipYPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label: ` flipY - $ { e } ` ,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.flipYFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology: $ A.TriangleStrip,stripIndexFormat:U0.Uint32},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,n=0){const r=t.format,{width:s,height:a}=t.size,l=this.getTransferPipeline(r),u=this.getFlipYPipeline(r),h=this.device.createTexture({size:{width:s,height:a,depthOrArrayLayers:1},format:r,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),m=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:Ia.TwoD,baseArrayLayer:n}),v=h.createView({baseMipLevel:0,mipLevelCount:1,dimension:Ia.TwoD,baseArrayLayer:0}),x=this.device.createCommandEncoder({}),S=(T,N,C)=>{const E=T.getBindGroupLayout(0),O=this.device.createBindGroup({layout:E,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:N}]}),U=x.beginRenderPass({colorAttachments:[{view:C,loadOp:Wr.Clear,storeOp:ta.Store,clearValue:[0,0,0,0]}]});U.setPipeline(T),U.setBindGroup(0,O),U.draw(4,1,0,0),U.end()};S(l,m,v),S(u,v,m),this.device.queue.submit([x.finish()]),h.destroy()}generateMipmaps(e,t,n=0){const r=this.get(e);r.useCount===void 0&&(r.useCount=0,r.layers=[]);const s=r.layers[n]||this._mipmapCreateBundles(e,t,n),a=this.device.createCommandEncoder({});this._mipmapRunBundles(a,s),this.device.queue.submit([a.finish()]),r.useCount!==0&&(r.layers[n]=s),r.useCount++}_mipmapCreateBundles(e,t,n){const r=this.getTransferPipeline(t.format),s=r.getBindGroupLayout(0);let a=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:Ia.TwoD,baseArrayLayer:n});const l=[];for(let u=1;u<t.mipLevelCount;u++){const h=this.device.createBindGroup({layout:s,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:a}]}),m=e.createView({baseMipLevel:u,mipLevelCount:1,dimension:Ia.TwoD,baseArrayLayer:n}),v={colorAttachments:[{view:m,loadOp:Wr.Clear,storeOp:ta.Store,clearValue:[0,0,0,0]}]},x=this.device.createRenderBundleEncoder({colorFormats:[t.format]});x.setPipeline(r),x.setBindGroup(0,h),x.draw(4,1,0,0),l.push({renderBundles:[x.finish()],passDescriptor:v}),a=m}return l}_mipmapRunBundles(e,t){const n=t.length;for(let r=0;r<n;r++){const s=t[r],a=e.beginRenderPass(s.passDescriptor);a.executeBundles(s.renderBundles),a.end()}}}const Voe={[GT]:"never",[Ay]:"less",[qT]:"equal",[py]:"less-equal",[VT]:"greater",[HT]:"greater-equal",[WT]:"always",[jT]:"not-equal"},joe=[0,1,3,2,4,5];class Hoe{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this.colorBuffer=null,this.depthTexture=new Ic,this.depthTexture.name="depthBuffer"}createSampler(e){const t=this.backend,n=t.device,r=t.get(e),s={addressModeU:this._convertAddressMode(e.wrapS),addressModeV:this._convertAddressMode(e.wrapT),addressModeW:this._convertAddressMode(e.wrapR),magFilter:this._convertFilterMode(e.magFilter),minFilter:this._convertFilterMode(e.minFilter),mipmapFilter:this._convertFilterMode(e.minFilter),maxAnisotropy:1};s.magFilter===If.Linear&&s.minFilter===If.Linear&&s.mipmapFilter===If.Linear&&(s.maxAnisotropy=e.anisotropy),e.isDepth
fn tsl _biquadraticTexture ( map : texture _2d < f32 > , coord : vec2f , iRes : vec2u , level : u32 ) - > vec4f {
let res = vec2f ( iRes ) ;
let uvScaled = coord * res ;
let uvWrapping = ( ( uvScaled % res ) + res ) % res ;
// https://www.shadertoy.com/view/WtyXRy
let uv = uvWrapping - 0.5 ;
let iuv = floor ( uv ) ;
let f = fract ( uv ) ;
let rg1 = textureLoad ( map , vec2u ( iuv + vec2 ( 0.5 , 0.5 ) ) % iRes , level ) ;
let rg2 = textureLoad ( map , vec2u ( iuv + vec2 ( 1.5 , 0.5 ) ) % iRes , level ) ;
let rg3 = textureLoad ( map , vec2u ( iuv + vec2 ( 0.5 , 1.5 ) ) % iRes , level ) ;
let rg4 = textureLoad ( map , vec2u ( iuv + vec2 ( 1.5 , 1.5 ) ) % iRes , level ) ;
return mix ( mix ( rg1 , rg2 , f . x ) , mix ( rg3 , rg4 , f . x ) , f . y ) ;
}
` )},wm={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>"};typeof navigator<"u"&&/Windows/g.test(navigator.userAgent)&&(jo.pow_float=new rs("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),jo.pow_vec2=new rs("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[jo.pow_float]),jo.pow_vec3=new rs("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[jo.pow_float]),jo.pow_vec4=new rs("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[jo.pow_float]),wm.pow_float="tsl_pow_float",wm.pow_vec2="tsl_pow_vec2",wm.pow_vec3="tsl_pow_vec3",wm.pow_vec4="tsl_pow_vec4");let uO="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(uO+= ` diagnostic ( off , derivative _uniformity ) ;
` );class ele extends ZB{constructor(e,t){super(e,t,new Qoe),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==To}_generateTextureSample(e,t,n,r,s=this.shaderStage){return s==="fragment"?r? ` textureSample ( $ { t } , $ { t } _sampler , $ { n } , $ { r } ) ` : ` textureSample ( $ { t } , $ { t } _sampler , $ { n } ) ` :this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n):this.generateTextureLod(e,t,n,r,"0")}_generateVideoSample(e,t,n=this.shaderStage){if(n==="fragment")return ` textureSampleBaseClampToEdge ( $ { e } , $ { e } _sampler , vec2 < f32 > ( $ { t } . x , 1.0 - $ { t } . y ) ) ` ;console.error( ` WebGPURenderer : THREE . VideoTexture does not support $ { n } shader . ` )}_generateTextureSampleLevel(e,t,n,r,s,a=this.shaderStage){return(a==="fragment"||a==="compute")&&this.isUnfilterable(e)===!1? ` textureSampleLevel ( $ { t } , $ { t } _sampler , $ { n } , $ { r } ) ` :this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,r):this.generateTextureLod(e,t,n,s,r)}generateWrapFunction(e){const t= ` tsl _coord _$ { B6 [ e . wrapS ] } S _$ { B6 [ e . wrapT ] } _$ { e . isData3DTexture ? "3d" : "2d" } T ` ;let n=I6[t];if(n===void 0){const r=[],s=e.isData3DTexture?"vec3f":"vec2f";let a= ` fn $ { t } ( coord : $ { s } ) - > $ { s } {
return $ { s } (
` ;const l=(u,h)=>{u===td?(r.push(jo.repeatWrapping_float),a+= ` tsl _repeatWrapping _float ( coord . $ { h } ) ` ):u===Yl?(r.push(jo.clampWrapping_float),a+= ` tsl _clampWrapping _float ( coord . $ { h } ) ` ):u===nd?(r.push(jo.mirrorWrapping_float),a+= ` tsl _mirrorWrapping _float ( coord . $ { h } ) ` ):(a+= ` coord . $ { h } ` ,console.warn( ` WebGPURenderer : Unsupported texture wrap type "${u}" for vertex shader . ` ))};l(e.wrapS,"x"),a+= ` ,
` ,l(e.wrapT,"y"),e.isData3DTexture&&(a+= ` ,
` ,l(e.wrapR,"z")),a+= `
) ;
}
` ,I6[t]=n=new rs(a,r)}return n.build(this),t}generateTextureDimension(e,t,n){const r=this.getDataFromNode(e,this.shaderStage,this.globalCache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let a,l;const{primarySamples:u}=this.renderer.backend.utils.getTextureSampleData(e),h=u>1;e.isData3DTexture?l="vec3<u32>":l="vec2<u32>",h||e.isVideoTexture||e.isStorageTexture?a=t:a= ` $ { t } $ { n ? ` , u32( ${ n } ) ` : "" } ` ,s=new Yv(new Qv( ` textureDimensions ( $ { a } ) ` ,l)),r.dimensionsSnippet[n]=s,(e.isDataArrayTexture||e.isData3DTexture)&&(r.arrayLayerCount=new Yv(new Qv( ` textureNumLayers ( $ { t } ) ` ,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new Yv(new Qv("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r="0u"){this._include("biquadraticTexture");const s=this.generateWrapFunction(e),a=this.generateTextureDimension(e,t,r);return ` tsl _biquadraticTexture ( $ { t } , $ { s } ( $ { n } ) , $ { a } , u32 ( $ { r } ) ) ` }generateTextureLod(e,t,n,r,s="0u"){const a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s),u=e.isData3DTexture?"vec3":"vec2",h= ` $ { u } < u32 > ( $ { a } ( $ { n } ) * $ { u } < f32 > ( $ { l } ) ) ` ;return this.generateTextureLoad(e,t,h,r,s)}generateTextureLoad(e,t,n,r,s="0u"){return e.isVideoTexture===!0||e.isStorageTexture===!0? ` textureLoad ( $ { t } , $ { n } ) ` :r? ` textureLoad ( $ { t } , $ { n } , $ { r } , u32 ( $ { s } ) ) ` : ` textureLoad ( $ { t } , $ { n } , u32 ( $ { s } ) ) ` }generateTextureStore(e,t,n,r){return ` textureStore ( $ { t } , $ { n } , $ { r } ) ` }isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.isDataTexture===!0&&e.type=== $ r||this.isSampleCompare(e)===!1&&e.minFilter===dr&&e.magFilter===dr||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s=this.shaderStage){let a=null;return e.isVideoTexture===!0?a=this._generateVideoSample(t,n,s):this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,"0",s):a=this._generateTextureSample(e,t,n,r,s),a}generateTextureGrad(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return ` textureSampleGrad ( $ { t } , $ { t } _sampler , $ { n } , $ { r [ 0 ] } , $ { r [ 1 ] } ) ` ;console.error( ` WebGPURenderer : THREE . TextureNode . gradient ( ) does not support $ { a } shader . ` )}generateTextureCompare(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return ` textureSampleCompare ( $ { t } , $ { t } _sampler , $ { n } , $ { r } ) ` ;console.error( ` WebGPURenderer : THREE . DepthTexture . compareFunction ( ) does not support $ { a } shader . ` )}generateTextureLevel(e,t,n,r,s,a=this.shaderStage){let l=null;return e.isVideoTexture===!0?l=this._generateVideoSample(t,n,a):l=this._generateTextureSampleLevel(e,t,n,r,s,a),l}generateTextureBias(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return ` textureSampleBias ( $ { t } , $ { t } _sampler , $ { n } , $ { r } ) ` ;console.error( ` WebGPURenderer : THREE . TextureNode . biasNode does not support $ { a } shader . ` )}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return ` varyings . $ { e . name } ` }else if(e.isNodeUniform===!0){const n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"? ` NodeBuffer _$ { e . id } . $ { n } ` :e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}_getUniformGroupCount(e){return Object.keys(this.uniforms[e]).length}getFunctionOperator(e){const t=Zoe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?ia.READ_ONLY:e.access}getStorageAccess(e,t){return Koe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),a=this.getDataFromNode(e,n,this.globalCache);if(a.uniformGPU===void 0){let l;const u=e.groupNode,h=u.name,m=this.getBindGroupArray(h,n);if(t==="texture"||t==="cubeTexture"||t==="storageTexture"||t==="texture3D"){let v=null;const x=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?v=new Zy(s.name,s.node,u,x):t==="cubeTexture"?v=new aO(s.name,s.node,u,x):t==="texture3D"
$ { n . vars }
$ { n . code }
` ;return n.result&&(s+= ` return $ { n . result } ;
` ),s+= `
}
` ,s}getInstanceIndex(){return this.shaderStage==="vertex"?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4<f32>")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],n=this.directives[e];if(n!==void 0)for(const r of n)t.push( ` enable $ { r } ; ` );return t.join( `
` )}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances", ` array < f32 , $ { e } > ` ,"vertex")}getBuiltins(e){const t=[],n=this.builtins[e];if(n!==void 0)for(const{name:r,property:s,type:a}of n.values())t.push( ` @ builtin ( $ { r } ) $ { s } : $ { a } ` );return t.join( ` ,
` )}getScopedArray(e,t,n,r){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:r}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:n,scope:r,bufferType:s,bufferCount:a}of this.scopedArrays.values()){const l=this.getType(s);t.push( ` var < $ { r } > $ { n } : array < $ { l } , $ { a } > ; ` )}return t.join( `
` )}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","id","vec3<u32>","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3<u32>","attribute"),this.getBuiltin("local_invocation_id","localId","vec3<u32>","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3<u32>","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),e==="vertex"||e==="compute"){const n=this.getBuiltins("attribute");n&&t.push(n);const r=this.getAttributesArray();for(let s=0,a=r.length;s<a;s++){const l=r[s],u=l.name,h=this.getType(l.type);t.push( ` @ location ( $ { s } ) $ { u } : $ { h } ` )}}return t.join( ` ,
` )}getStructMembers(e){const t=[],n=e.getMemberTypes();for(let s=0;s<n.length;s++){const a=n[s];t.push( ` @ location ( $ { s } ) m$ { s } : $ { a } < f32 > ` )}const r=this.getBuiltins("output");return r&&t.push(" "+r),t.join( ` ,
` )}getStructs(e){const t=[],n=this.structs[e];for(let r=0,s=n.length;r<s;r++){const a=n[r],l=a.name;let u= ` struct $ { l } {
` ;u+=this.getStructMembers(a),u+= `
} ` ,t.push(u),t.push( `
var < private > output : $ { l } ;
` )}return t.join( `
` )}getVar(e,t){return ` var $ { t } : $ { this . getType ( e ) } ` }getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const r of n)t.push( ` $ { this . getVar ( r . type , r . name ) } ; ` );return `
$ { t . join ( `
` )}
` }getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","Vertex","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){const s=this.varyings,a=this.vars[e];for(let l=0;l<s.length;l++){const u=s[l];if(u.needsInterpolation){let h= ` @ location ( $ { l } ) ` ;/^(int|uint|ivec|uvec)/.test(u.type)&&(h+=" @interpolate( flat )"),t.push( ` $ { h } $ { u . name } : $ { this . getType ( u . type ) } ` )}else e==="vertex"&&a.includes(u)===!1&&a.push(u)}}const n=this.getBuiltins(e);n&&t.push(n);const r=t.join( ` ,
` );return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}getUniforms(e){const t=this.uniforms[e],n=[],r=[],s=[],a={};for(const u of t){const h=u.groupNode.name,m=this.bindingsIndexes[h];if(u.type==="texture"||u.type==="cubeTexture"||u.type==="storageTexture"||u.type==="texture3D"){const v=u.node.value;(e==="fragment"||e==="compute")&&this.isUnfilterable(v)===!1&&u.node.isStorageTextureNode!==!0&&(this.isSampleCompare(v)?n.push( ` @ binding ( $ { m . binding ++ } ) @ group ( $ { m . group } ) var $ { u . name } _sampler : sampler _comparison ; ` ):n.push( ` @ binding ( $ { m . binding ++ } ) @ group ( $ { m . group } ) var $ { u . name } _sampler : sampler ; ` ));let x,S="";const{primarySamples:T}=this.renderer.backend.utils.getTextureSampleData(v);if(T>1&&(S="_multisampled"),v.isCubeTexture===!0)x="texture_cube<f32>";else if(v.isDataArrayTexture===!0||v.isCompressedArrayTexture===!0)x="texture_2d_array<f32>";else if(v.isDepthTexture===!0)x= ` texture _depth$ { S } _2d ` ;else if(v.isVideoTexture===!0)x="texture_external";else if(v.isData3DTexture===!0)x="texture_3d<f32>";else if(u.node.isStorageTextureNode===!0){const N=aT(v),C=this.getStorageAccess(u.node,e);x= ` texture _storage _2d < $ { N } , $ { C } > ` }else{const N=this.getComponentTypeFromTexture(v).charAt(0);x= ` texture$ { S } _2d < $ { N } 32 > ` }n.push( ` @ binding ( $ { m . binding ++ } ) @ group ( $ { m . group } ) var $ { u . name } : $ { x } ; ` )}else if(u.type==="buffer"||u.type==="storageBuffer"||u.type==="indirectStorageBuffer"){const v=u.node,x=this.getType(v.bufferType),S=v.bufferCount,T=S>0&&u.type==="buffer"?", "+S:"",N=v.isAtomic? ` atomic < $ { x } > ` : ` $ { x } ` ,C= ` $ { u . name } : array < $ { N } $ { T } >
` ,E=v.isStorageBufferNode? ` storage , $ { this . getStorageAccess ( v , e ) } ` :"uniform";r.push(this._getWGSLStructBinding("NodeBuffer_"+v.id,C,E,m.binding++,m.group))}else{const v=this.getType(this.getVectorType(u.type)),x=u.groupNode.name;(a[x]||(a[x]={index:m.binding++,id:m.group,snippets:[]})).snippets.push( ` $ { u . name } : $ { v } ` )}}for(const u in a){const h=a[u];s.push(this._getWGSLStructBinding(u,h.snippets.join( ` ,
` ),"uniform",h.index,h.id))}let l=n.join( `
` );return l+=r.join( `
` ),l+=s.join( `
` ),l}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){const n=e[t];n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.structs=this.getStructs(t),n.vars=this.getVars(t),n.codes=this.getCodes(t),n.directives=this.getDirectives(t),n.scopedArrays=this.getScopedArrays(t);let r= ` // code
` ;r+=this.flowCode[t];const s=this.flowNodes[t],a=s[s.length-1],l=a.outputNode,u=l!==void 0&&l.isOutputStructNode===!0;for(const h of s){const m=this.getFlowData(h),v=h.name;if(v&&(r.length>0&&(r+= `
` ),r+= ` // flow -> ${v}
` ),r+= ` $ { m . code }
` ,h===a&&t!=="compute"){if(r+= ` // result
` ,t==="vertex")r+= ` varyings . Vertex = $ { m . result } ; ` ;else if(t==="fragment")if(u)n.returnType=l.nodeType,r+= ` return $ { m . result } ; ` ;else{let x=" @location(0) color: vec4<f32>";const S=this.getBuiltins("output");S&&(x+= ` ,
` +S),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",x),n.structs+= `
var < private > output : OutputStruct ;
` ,r+= ` output . color = $ { m . result } ;
return output ; ` }}}n.flow=r}this.material!==null?(this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment)):this.computeShader=this._getWGSLComputeCode(e.compute,(this.object.workgroupSize||[64]).join(", "))}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getType(e){return Joe[e]||e}isAvailable(e){let t=O6[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),O6[e]=t),t}_getWGSLMethod(e){return jo[e]!==void 0&&this._include(e),wm[e]}_include(e){const t=jo[e];return t.build(this),this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(t),t}_getWGSLVertexCode(e){return ` $ { this . getSignature ( ) }
// directives
$ { e . directives }
// uniforms
$ { e . uniforms }
// varyings
$ { e . varyings }
var < private > varyings : VaryingsStruct ;
// codes
$ { e . codes }
@ vertex
fn main ( $ { e . attributes } ) - > VaryingsStruct {
// vars
$ { e . vars }
// flow
$ { e . flow }
return varyings ;
}
` }_getWGSLFragmentCode(e){return ` $ { this . getSignature ( ) }
// global
$ { uO }
// uniforms
$ { e . uniforms }
// structs
$ { e . structs }
// codes
$ { e . codes }
@ fragment
fn main ( $ { e . varyings } ) - > $ { e . returnType } {
// vars
$ { e . vars }
// flow
$ { e . flow }
}
` }_getWGSLComputeCode(e,t){return ` $ { this . getSignature ( ) }
// directives
$ { e . directives }
// system
var < private > instanceIndex : u32 ;
// locals
$ { e . scopedArrays }
// uniforms
$ { e . uniforms }
// codes
$ { e . codes }
@ compute @ workgroup _size ( $ { t } )
fn main ( $ { e . attributes } ) {
// system
instanceIndex = id . x + id . y * numWorkgroups . x * u32 ( $ { t } ) + id . z * numWorkgroups . x * numWorkgroups . y * u32 ( $ { t } ) ;
// vars
$ { e . vars }
// flow
$ { e . flow }
}
` }_getWGSLStruct(e,t){return `
struct $ { e } {
$ { t }
} ; ` }_getWGSLStructBinding(e,t,n,r=0,s=0){const a=e+"Struct";return ` $ { this . _getWGSLStruct ( a , t ) }
@ binding ( $ { r } ) @ group ( $ { s } )
2026-03-09 22:42:36 +01:00
var < $ { n } > $ { e } : $ { a } ; ` }}class tle{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=Be.Depth24PlusStencil8:e.depth&&(t=Be.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const s=this.backend.renderer,a=s.getRenderTarget();t=a?a.samples:s.samples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return $ A.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return $ A.LineList;if(e.isLine)return $ A.LineStrip;if(e.isMesh)return $ A.TriangleList}getSampleCount(e){let t=1;return e>1&&(t=Math.pow(2,Math.floor(Math.log2(e))),t===2&&(t=4)),t}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.samples)}getPreferredCanvasFormat(){return navigator.userAgent.includes("Quest")?Be.BGRA8Unorm:navigator.gpu.getPreferredCanvasFormat()}}const nle=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]),ile=new Map([[H7,["float16"]]]),rle=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class sle{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),r=this.backend,s=r.get(n);let a=s.buffer;if(a===void 0){const l=r.device;let u=n.array;if(e.normalized===!1&&(u.constructor===Int16Array||u.constructor===Uint16Array)){const m=new Uint32Array(u.length);for(let v=0;v<u.length;v++)m[v]=u[v];u=m}if(n.array=u,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3){u=new u.constructor(n.count*4);for(let m=0;m<n.count;m++)u.set(n.array.subarray(m*3,m*3+3),m*4);n.itemSize=4,n.array=u}const h=u.byteLength+(4-u.byteLength%4)%4;a=l.createBuffer({label:n.name,size:h,usage:t,mappedAtCreation:!0}),new u.constructor(a.getMappedRange()).set(u),a.unmap(),s.buffer=a}}updateAttribute(e){const t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t).buffer,a=t.array,l=this._isTypedArray(a),u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(s,0,a,0);else{const h=l?1:a.BYTES_PER_ELEMENT;for(let m=0,v=u.length;m<v;m++){const x=u[m],S=x.start*h,T=x.count*h;r.queue.writeBuffer(s,0,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){const s=t[r],a=s.array.BYTES_PER_ELEMENT,l=this._getBufferAttribute(s);let u=n.get(l);if(u===void 0){let v,x;s.isInterleavedBufferAttribute===!0?(v=s.data.stride*a,x=s.data.isInstancedInterleavedBuffer?bv.Instance:bv.Vertex):(v=s.itemSize*a,x=s.isInstancedBufferAttribute?bv.Instance:bv.Vertex),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(v=4),u={arrayStride:v,attributes:[],stepMode:x},n.set(l,u)}const h=this._getVertexFormat(s),m=s.isInterleavedBufferAttribute===!0?s.offset*a:0;u.attributes.push({shaderLocation:r,offset:m,format:h})}return Array.from(n.values())}destroyAttribute(e){const t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,n=t.device,s=t.get(this._getBufferAttribute(e)).buffer,a=s.size,l=n.createBuffer({label: ` $ { e . name } _readback ` ,size:a,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),u=n.createCommandEncoder({label: ` readback _encoder _$ { e . name } ` });u.copyBufferToBuffe
2026-03-09 22:33:09 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
2026-03-09 22:42:36 +01:00
* / $ . B R D F _ G G X ; $ . B R D F _ L a m b e r t ; $ . B a s i c S h a d o w F i l t e r ; $ . B r e a k ; $ . C o n t i n u e ; $ . D F G A p p r o x ; $ . D _ G G X ; $ . D i s c a r d ; $ . E P S I L O N ; $ . F _ S c h l i c k ; c o n s t h l e = $ . F n ; $ . I N F I N I T Y ; c o n s t f l e = $ . I f , d l e = $ . L o o p ; $ . N o d e S h a d e r S t a g e ; $ . N o d e T y p e ; $ . N o d e U p d a t e T y p e ; $ . N o d e A c c e s s ; $ . P C F S h a d o w F i l t e r ; $ . P C F S o f t S h a d o w F i l t e r ; $ . P I ; $ . P I 2 ; $ . R e t u r n ; $ . S c h l i c k _ t o _ F 0 ; $ . S c r i p t a b l e N o d e R e s o u r c e s ; $ . S h a d e r N o d e ; $ . T B N V i e w M a t r i x ; $ . V S M S h a d o w F i l t e r ; $ . V _ G G X _ S m i t h C o r r e l a t e d ; $ . a b s ; $ . a c e s F i l m i c T o n e M a p p i n g ; $ . a c o s ; $ . a d d ; $ . a d d N o d e E l e m e n t ; $ . a g x T o n e M a p p i n g ; $ . a l l ; $ . a l p h a T ; $ . a n d ; $ . a n i s o t r o p y ; $ . a n i s o t r o p y B ; $ . a n i s o t r o p y T ; $ . a n y ; $ . a p p e n d ; $ . a r r a y B u f f e r ; c o n s t A l e = $ . a s i n ; $ . a s s i g n ; $ . a t a n ; $ . a t a n 2 ; $ . a t o m i c A d d ; $ . a t o m i c A n d ; $ . a t o m i c F u n c ; $ . a t o m i c M a x ; $ . a t o m i c M i n ; $ . a t o m i c O r ; $ . a t o m i c S t o r e ; $ . a t o m i c S u b ; $ . a t o m i c X o r ; $ . a t t e n u a t i o n C o l o r ; $ . a t t e n u a t i o n D i s t a n c e ; $ . a t t r i b u t e ; $ . a t t r i b u t e A r r a y ; $ . b a c k g r o u n d B l u r r i n e s s ; $ . b a c k g r o u n d I n t e n s i t y ; $ . b a c k g r o u n d R o t a t i o n ; $ . b a t c h ; $ . b i l l b o a r d i n g ; $ . b i t A n d ; $ . b i t N o t ; $ . b i t O r ; $ . b i t X o r ; $ . b i t a n g e n t G e o m e t r y ; $ . b i t a n g e n t L o c a l ; $ . b i t a n g e n t V i e w ; $ . b i t a n g e n t W o r l d ; $ . b i t c a s t ; $ . b l e n d B u r n ; $ . b l e n d C o l o r ; $ . b l e n d D o d g e ; $ . b l e n d O v e r l a y ; $ . b l e n d S c r e e n ; $ . b l u r ; $ . b o o l ; $ . b u f f e r ; $ . b u f f e r A t t r i b u t e ; $ . b u m p M a p ; $ . b u r n ; $ . b v e c 2 ; $ . b v e c 3 ; $ . b v e c 4 ; $ . b y p a s s ; $ . c a c h e ; $ . c a l l ; $ . c a m e r a F a r ; $ . c a m e r a N e a r ; $ . c a m e r a N o r m a l M a t r i x ; $ . c a m e r a P o s i t i o n ; $ . c a m e r a P r o j e c t i o n M a t r i x ; $ . c a m e r a P r o j e c t i o n M a t r i x I n v e r s e ; $ . c a m e r a V i e w M a t r i x ; $ . c a m e r a W o r l d M a t r i x ; $ . c b r t ; $ . c d l ; $ . c e i l ; $ . c h e c k e r ; $ . c i n e o n T o n e M a p p i n g ; $ . c l a m p ; $ . c l e a r c o a t ; $ . c l e a r c o a t R o u g h n e s s ; $ . c o d e ; $ . c o l o r ; $ . c o l o r S p a c e T o W o r k i n g ; $ . c o l o r T o D i r e c t i o n ; $ . c o m p u t e ; $ . c o n d ; $ . c o n t e x t ; $ . c o n v e r t ; $ . c o n v e r t C o l o r S p a c e ; $ . c o n v e r t T o T e x t u r e ; c o n s t p l e = $ . c o s ; $ . c r o s s ; $ . c u b e T e x t u r e ; $ . d F d x ; $ . d F d y ; $ . d a s h S i z e ; $ . d e f a u l t B u i l d S t a g e s ; $ . d e f a u l t S h a d e r S t a g e s ; $ . d e f i n e d ; $ . d e g r e e s ; $ . d e l t a T i m e ; $ . d e n s i t y F o g ; $ . d e n s i t y F o g F a c t o r ; $ . d e p t h ; $ . d e p t h P a s s ; $ . d i f f e r e n c e ; $ . d i f f u s e C o l o r ; $ . d i r e c t P o i n t L i g h t ; $ . d i r e c t i o n T o C o l o r ; $ . d i s p e r s i o n ; $ . d i s t a n c e ; $ . d i v ; $ . d o d g e ; $ . d o t ; $ . d r a w I n d e x ; $ . d y n a m i c B u f f e r A t t r i b u t e ; $ . e l e m e n t ; $ . e m i s s i v e ; $ . e q u a l ; $ . e q u a l s ; $ . e q u i r e c t U V ; c o n s t m l e = $ . e x p ; $ . e x p 2 ; $ . e x p r e s s i o n ; $ . f a c e D i r e c t i o n ; $ . f a c e F o r w a r d ; $ . f a c e f o r w a r d ; c o n s t g l e = $ . f l o a t ; $ . f l o o r ; $ . f o g ; $ . f r a c t ; $ . f r a m e G r o u p ; $ . f r a m e I d ; $ . f r o n t F a c i n g ; $ . f w i d t h ; $ . g a i n ; $ . g a p S i z e ; $ . g e t C o n s t N o d e T y p e ; $ . g e t C u r r e n t S t a c k ; $ . g e t D i r e c t i o n ; $ . g e t D i s t a n c e A t t e n u a t i o n ; $ . g e t G e o m e t r y R o u g h n e s s ; $ . g e t N o r m a l F r o m D e p t h ; $ . g e t P a r a l l a x C o r r e c t N o r m a l ; $ . g e t R o u g h n e s s ; $ . g e t S c r e e n P o s i t i o n ; $ . g e t S h I r r a d i a n c e A t ; $ . g e t T e x t u r e I n d e x ; $ . g e t V i e w P o s i t i o n ; $ . g l s l ; $ . g l s l F n ; $ . g r a y s c a l e ; $ . g r e a t e r T h a n ; $ . g r e a t e r T h a n E q u a l ; $ . h a s h ; $ . h i g h p M o d e l N o r m a l V i e w M a t r i x ; $ . h i g h p M o d e l V i e w M a t r i x ; $ . h u e ; $ . i n s t a n c e ; c o n s t v l e = $ . i n s t a n c e I n d e x ; $ . i n s t a n c e d A r r a y ; $ . i n s t a n c e d B u f f e r A t t r i b u t e ; $ . i n s t a n c e d D y n a m i c B u f f e r A t t r i b u t e ; $ . i n s t a n c e d M e s h ; $ . i n t ; $ . i n v e r s e S q r t ; $ . i n v e r s e s q r t ; $ . i n v o c a t i o n L o c a l I n d e x ; $ . i n v o c a t i o n S u b g r o u p I n d e x ; $ . i o r ; $ . i r i d e s c e n c e ; $ . i r i d e s c e n c e I O R ; $ . i r i d e s c e n c e T h i c k n e s s ; $ . i v e c 2 ; $ . i v e c 3 ; $ . i v e c 4 ; $ . j s ; $ . l a b e l ; $ . l e n g t h ; $ . l e n g t h S q ; $ . l e s s T h a n ; $ . l e s s T h a n E q u a l ; $ . l i g h t P o s i t i o n ; $ . l i g h t T a r g e t D i r e c t i o n ; $ . l i g h t T a r g e t P o s i t i o n ; $ . l i g h t V i e w P o s i t i o n ; $ . l i g h t i n g C o n t e x t ; $ . l i g h t s ; $ . l i n e a r D e p t h ; $ . l i n e a r T o n e M a p p i n g ; $ . l o c a l I d ; $ . l o g ; $ . l o g 2 ; $ . l o g a r i t h m i c D e p t h T o V i e w Z ; $ . l o o p ; $ . l u m i n a n c e ; $ . m e d i u m p M o d e l V i e w M a t r i x ; $ . m a t 2 ; $ . m a t 3 ; $ . m a t 4 ; $ . m a t c a p U V ; $ . m a t e r i a l A O ; $ . m a t e r i a l A l p h a T e s t ; $ . m a t e r i a l A n i s o t r o p y ; $ . m a t e r i a l A n i s o t r o p y V e c t o r ; $ . m a t e r i a l A t t e n u a t i o n C o l o r ; $ . m a t e r i a l A t t e n u a t i o n D i s t a n c e ; $ . m a t e r i a l C l e a r c o a t ; $ . m a t e r i a l C l e a r c o a t N o r m a l ; $ . m a t e r i a l C l e a r c o a t R o u g h n e s s ; $ . m a t e r i a l C o l o r ; $ . m a t e r i a l D i s p e r s i o n ; $ . m a t e r i a l E m i s s i v e ; $ . m a t e r i a l I O R ; $ . m a t e r i a l I r i d e s c e n c e ; $ . m a t e r i a l I r i d e s c e n c e I O R ; $ . m a t e r i a l I r i d e s c e n c e T h i c k n e s s ; $ . m a t e r i a l L i g h t M a p ; $ . m a t e r i a l L i n e D a s h O f f s e t ; $ . m a t e r i a l L i n e D a s h S i z e ; $ . m a t e r i a l L i n e G a p S i z e ; $ . m a t e r i a l L i n e S c a l e ; $ . m a t e r i a l L i n e W i d t h ; $ . m a t e r i a l M e t a l n e s s ; $ . m a t e r i a l N o r m a l ; $ . m a t e r i a l O p a c i t y ; $ . m a t e r i a l P o i n t W i d t h ; $ . m a t e r i a l R e f e r e n c e ; $ . m a t e r i a l R e f l e c t i v i t y ; $ . m a t e r i a l R e f r a c t i o n R a t i o ; $ . m a t e r i a l R o t a t i o n ; $ . m a t e r i a l R o u g h n e s s ; $ . m a t e r i a l S h e e n ; $ . m a t e r i a l S h e e n R o u g h n e s s ; $ . m a t e r i a l S h i n i n e s s ; $ . m a t e r i a l S p e c u l a r ; $ . m a t e r i a l S p e c u l a r C o l o r ; $ . m a t e r i a l S p e c u l a r I n t e n s i t y ; $ . m a t e r i a l S p e c u l a r S t r e n g t h ; $ . m a t e r i a l T h i c k n e s s ; $ . m a t e r i a l T r a n s m i s s i o n ; $ . m a x ; $ . m a x M i p L e v e l ; $ . m e t a l n e s s ; $ . m i n ; $ . m i x ; $ . m i x E l e m e n t ; $ . m o d ; $ . m o d I n t ; $ . m o d e l D i r e c t i o n ; $ . m o d e l N o r m a l M a t r
2026-03-09 22:33:09 +01:00
# include < common >
# include < color _pars _vertex >
# include < fog _pars _vertex >
# include < logdepthbuf _pars _vertex >
# include < clipping _planes _pars _vertex >
uniform float linewidth ;
uniform vec2 resolution ;
attribute vec3 instanceStart ;
attribute vec3 instanceEnd ;
attribute vec3 instanceColorStart ;
attribute vec3 instanceColorEnd ;
# ifdef WORLD _UNITS
varying vec4 worldPos ;
varying vec3 worldStart ;
varying vec3 worldEnd ;
# ifdef USE _DASH
varying vec2 vUv ;
# endif
# else
varying vec2 vUv ;
# endif
# ifdef USE _DASH
uniform float dashScale ;
attribute float instanceDistanceStart ;
attribute float instanceDistanceEnd ;
varying float vLineDistance ;
# endif
void trimSegment ( const in vec4 start , inout vec4 end ) {
// trim end segment so it terminates between the camera plane and the near plane
// conservative estimate of the near plane
float a = projectionMatrix [ 2 ] [ 2 ] ; // 3nd entry in 3th column
float b = projectionMatrix [ 3 ] [ 2 ] ; // 3nd entry in 4th column
float nearEstimate = - 0.5 * b / a ;
float alpha = ( nearEstimate - start . z ) / ( end . z - start . z ) ;
end . xyz = mix ( start . xyz , end . xyz , alpha ) ;
}
void main ( ) {
# ifdef USE _COLOR
vColor . xyz = ( position . y < 0.5 ) ? instanceColorStart : instanceColorEnd ;
# endif
# ifdef USE _DASH
vLineDistance = ( position . y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd ;
vUv = uv ;
# endif
float aspect = resolution . x / resolution . y ;
// camera space
vec4 start = modelViewMatrix * vec4 ( instanceStart , 1.0 ) ;
vec4 end = modelViewMatrix * vec4 ( instanceEnd , 1.0 ) ;
# ifdef WORLD _UNITS
worldStart = start . xyz ;
worldEnd = end . xyz ;
# else
vUv = uv ;
# endif
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
// perhaps there is a more elegant solution -- WestLangley
bool perspective = ( projectionMatrix [ 2 ] [ 3 ] == - 1.0 ) ; // 4th entry in the 3rd column
if ( perspective ) {
if ( start . z < 0.0 && end . z >= 0.0 ) {
trimSegment ( start , end ) ;
} else if ( end . z < 0.0 && start . z >= 0.0 ) {
trimSegment ( end , start ) ;
}
}
// clip space
vec4 clipStart = projectionMatrix * start ;
vec4 clipEnd = projectionMatrix * end ;
// ndc space
vec3 ndcStart = clipStart . xyz / clipStart . w ;
vec3 ndcEnd = clipEnd . xyz / clipEnd . w ;
// direction
vec2 dir = ndcEnd . xy - ndcStart . xy ;
// account for clip-space aspect ratio
dir . x *= aspect ;
dir = normalize ( dir ) ;
# ifdef WORLD _UNITS
vec3 worldDir = normalize ( end . xyz - start . xyz ) ;
vec3 tmpFwd = normalize ( mix ( start . xyz , end . xyz , 0.5 ) ) ;
vec3 worldUp = normalize ( cross ( worldDir , tmpFwd ) ) ;
vec3 worldFwd = cross ( worldDir , worldUp ) ;
worldPos = position . y < 0.5 ? start : end ;
// height offset
float hw = linewidth * 0.5 ;
worldPos . xyz += position . x < 0.0 ? hw * worldUp : - hw * worldUp ;
// don't extend the line if we're rendering dashes because we
// won't be rendering the endcaps
# ifndef USE _DASH
// cap extension
worldPos . xyz += position . y < 0.5 ? - hw * worldDir : hw * worldDir ;
// add width to the box
worldPos . xyz += worldFwd * hw ;
// endcaps
if ( position . y > 1.0 || position . y < 0.0 ) {
worldPos . xyz -= worldFwd * 2.0 * hw ;
}
# endif
// project the worldpos
vec4 clip = projectionMatrix * worldPos ;
// shift the depth of the projected points so the line
// segments overlap neatly
vec3 clipPose = ( position . y < 0.5 ) ? ndcStart : ndcEnd ;
clip . z = clipPose . z * clip . w ;
# else
vec2 offset = vec2 ( dir . y , - dir . x ) ;
// undo aspect ratio adjustment
dir . x /= aspect ;
offset . x /= aspect ;
// sign flip
if ( position . x < 0.0 ) offset *= - 1.0 ;
// endcaps
if ( position . y < 0.0 ) {
offset += - dir ;
} else if ( position . y > 1.0 ) {
offset += dir ;
}
// adjust for linewidth
offset *= linewidth ;
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
offset /= resolution . y ;
// select end
vec4 clip = ( position . y < 0.5 ) ? clipStart : clipEnd ;
// back to clip space
offset *= clip . w ;
clip . xy += offset ;
# endif
gl _Position = clip ;
vec4 mvPosition = ( position . y < 0.5 ) ? start : end ; // this is an approximation
# include < logdepthbuf _vertex >
# include < clipping _planes _vertex >
# include < fog _vertex >
}
` ,fragmentShader: `
uniform vec3 diffuse ;
uniform float opacity ;
uniform float linewidth ;
# ifdef USE _DASH
uniform float dashOffset ;
uniform float dashSize ;
uniform float gapSize ;
# endif
varying float vLineDistance ;
# ifdef WORLD _UNITS
varying vec4 worldPos ;
varying vec3 worldStart ;
varying vec3 worldEnd ;
# ifdef USE _DASH
varying vec2 vUv ;
# endif
# else
varying vec2 vUv ;
# endif
# include < common >
# include < color _pars _fragment >
# include < fog _pars _fragment >
# include < logdepthbuf _pars _fragment >
# include < clipping _planes _pars _fragment >
vec2 closestLineToLine ( vec3 p1 , vec3 p2 , vec3 p3 , vec3 p4 ) {
float mua ;
float mub ;
vec3 p13 = p1 - p3 ;
vec3 p43 = p4 - p3 ;
vec3 p21 = p2 - p1 ;
float d1343 = dot ( p13 , p43 ) ;
float d4321 = dot ( p43 , p21 ) ;
float d1321 = dot ( p13 , p21 ) ;
float d4343 = dot ( p43 , p43 ) ;
float d2121 = dot ( p21 , p21 ) ;
float denom = d2121 * d4343 - d4321 * d4321 ;
float numer = d1343 * d4321 - d1321 * d4343 ;
mua = numer / denom ;
mua = clamp ( mua , 0.0 , 1.0 ) ;
mub = ( d1343 + d4321 * ( mua ) ) / d4343 ;
mub = clamp ( mub , 0.0 , 1.0 ) ;
return vec2 ( mua , mub ) ;
}
void main ( ) {
# include < clipping _planes _fragment >
# ifdef USE _DASH
if ( vUv . y < - 1.0 || vUv . y > 1.0 ) discard ; // discard endcaps
if ( mod ( vLineDistance + dashOffset , dashSize + gapSize ) > dashSize ) discard ; // todo - FIX
# endif
float alpha = opacity ;
# ifdef WORLD _UNITS
// Find the closest points on the view ray and the line segment
vec3 rayEnd = normalize ( worldPos . xyz ) * 1e5 ;
vec3 lineDir = worldEnd - worldStart ;
vec2 params = closestLineToLine ( worldStart , worldEnd , vec3 ( 0.0 , 0.0 , 0.0 ) , rayEnd ) ;
vec3 p1 = worldStart + lineDir * params . x ;
vec3 p2 = rayEnd * params . y ;
vec3 delta = p1 - p2 ;
float len = length ( delta ) ;
float norm = len / linewidth ;
# ifndef USE _DASH
# ifdef USE _ALPHA _TO _COVERAGE
float dnorm = fwidth ( norm ) ;
alpha = 1.0 - smoothstep ( 0.5 - dnorm , 0.5 + dnorm , norm ) ;
# else
if ( norm > 0.5 ) {
discard ;
}
# endif
# endif
# else
# ifdef USE _ALPHA _TO _COVERAGE
// artifacts appear on some hardware if a derivative is taken within a conditional
float a = vUv . x ;
float b = ( vUv . y > 0.0 ) ? vUv . y - 1.0 : vUv . y + 1.0 ;
float len2 = a * a + b * b ;
float dlen = fwidth ( len2 ) ;
if ( abs ( vUv . y ) > 1.0 ) {
alpha = 1.0 - smoothstep ( 1.0 - dlen , 1.0 + dlen , len2 ) ;
}
# else
if ( abs ( vUv . y ) > 1.0 ) {
float a = vUv . x ;
float b = ( vUv . y > 0.0 ) ? vUv . y - 1.0 : vUv . y + 1.0 ;
float len2 = a * a + b * b ;
if ( len2 > 1.0 ) discard ;
}
# endif
# endif
vec4 diffuseColor = vec4 ( diffuse , alpha ) ;
# include < logdepthbuf _fragment >
# include < color _fragment >
gl _FragColor = vec4 ( diffuseColor . rgb , alpha ) ;
# include < tonemapping _fragment >
# include < colorspace _fragment >
# include < fog _fragment >
# include < premultiplied _alpha _fragment >
}
2026-03-09 22:42:36 +01:00
` };class HE extends Qa{constructor(e){super({type:"LineMaterial",uniforms:my.clone(Fa.line.uniforms),vertexShader:Fa.line.vertexShader,fragmentShader:Fa.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const CS=new On,k6=new pe,z6=new pe,Os=new On,Is=new On,zl=new On,NS=new pe,RS=new jn,Fs=new eG,G6=new pe,Tv=new Oc,Mv=new ud,Gl=new On;let Xl,Jf;function q6(i,e,t){return Gl.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Gl.multiplyScalar(1/Gl.w),Gl.x=Jf/t.width,Gl.y=Jf/t.height,Gl.applyMatrix4(i.projectionMatrixInverse),Gl.multiplyScalar(1/Gl.w),Math.abs(Math.max(Gl.x,Gl.y))}function wle(i,e){const t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,r.count);for(let l=0,u=a;l<u;l++){Fs.start.fromBufferAttribute(r,l),Fs.end.fromBufferAttribute(s,l),Fs.applyMatrix4(t);const h=new pe,m=new pe;Xl.distanceSqToSegment(Fs.start,Fs.end,m,h),m.distanceTo(h)<Jf*.5&&e.push({point:m,pointOnLine:h,distance:Xl.origin.distanceTo(m),object:i,face:null,faceIndex:l,uv:null,uv1:null})}}function Tle(i,e,t){const n=e.projectionMatrix,s=i.material.resolution,a=i.matrixWorld,l=i.geometry,u=l.attributes.instanceStart,h=l.attributes.instanceEnd,m=Math.min(l.instanceCount,u.count),v=-e.near;Xl.at(1,zl),zl.w=1,zl.applyMatrix4(e.matrixWorldInverse),zl.applyMatrix4(n),zl.multiplyScalar(1/zl.w),zl.x*=s.x/2,zl.y*=s.y/2,zl.z=0,NS.copy(zl),RS.multiplyMatrices(e.matrixWorldInverse,a);for(let x=0,S=m;x<S;x++){if(Os.fromBufferAttribute(u,x),Is.fromBufferAttribute(h,x),Os.w=1,Is.w=1,Os.applyMatrix4(RS),Is.applyMatrix4(RS),Os.z>v&&Is.z>v)continue;if(Os.z>v){const U=Os.z-Is.z,I=(Os.z-v)/U;Os.lerp(Is,I)}else if(Is.z>v){const U=Is.z-Os.z,I=(Is.z-v)/U;Is.lerp(Os,I)}Os.applyMatrix4(n),Is.applyMatrix4(n),Os.multiplyScalar(1/Os.w),Is.multiplyScalar(1/Is.w),Os.x*=s.x/2,Os.y*=s.y/2,Is.x*=s.x/2,Is.y*=s.y/2,Fs.start.copy(Os),Fs.start.z=0,Fs.end.copy(Is),Fs.end.z=0;const N=Fs.closestPointToPointParameter(NS,!0);Fs.at(N,G6);const C=x0.lerp(Os.z,Is.z,N),E=C>=-1&&C<=1,O=NS.distanceTo(G6)<Jf*.5;if(E&&O){Fs.start.fromBufferAttribute(u,x),Fs.end.fromBufferAttribute(h,x),Fs.start.applyMatrix4(a),Fs.end.applyMatrix4(a);const U=new pe,I=new pe;Xl.distanceSqToSegment(Fs.start,Fs.end,I,U),t.push({point:I,pointOnLine:U,distance:Xl.origin.distanceTo(I),object:i,face:null,faceIndex:x,uv:null,uv1:null})}}}class Mle extends Oi{constructor(e=new hO,t=new HE({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,l=0,u=t.count;a<u;a++,l+=2)k6.fromBufferAttribu
2026-03-09 22:33:09 +01:00
` )l=0,u-=s;else{const v=Rle(m,r,l,u,t);l+=v.offsetX,a.push(v.path)}}return a}function Rle(i,e,t,n,r){const s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}const a=new tG;let l,u,h,m,v,x,S,T;if(s.o){const N=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let C=0,E=N.length;C<E;)switch(N[C++]){case"m":l=N[C++]*e+t,u=N[C++]*e+n,a.moveTo(l,u);break;case"l":l=N[C++]*e+t,u=N[C++]*e+n,a.lineTo(l,u);break;case"q":h=N[C++]*e+t,m=N[C++]*e+n,v=N[C++]*e+t,x=N[C++]*e+n,a.quadraticCurveTo(v,x,h,m);break;case"b":h=N[C++]*e+t,m=N[C++]*e+n,v=N[C++]*e+t,x=N[C++]*e+n,S=N[C++]*e+t,T=N[C++]*e+n,a.bezierCurveTo(v,x,S,T,h,m);break}}return{offsetX:s.ha*e,path:a}}function oT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Dle(i){if(Array.isArray(i))return i}function Ple(i){if(Array.isArray(i))return oT(i)}function dO(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Lle(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function j6(i,e,t,n,r,s,a){try{var l=i[s](a),u=l.value}catch(h){return void t(h)}l.done?e(u):Promise.resolve(u).then(n,r)}function Ule(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function a(u){j6(s,n,r,a,l,"next",u)}function l(u){j6(s,n,r,a,l,"throw",u)}a(void 0)})}}function Jy(i,e,t){return e=B0(e),Vle(i, $ E()?Reflect.construct(e,t||[],B0(i).constructor):e.apply(i,t))}function Ble(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ex(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function dm(i,e){return i.get(dO(i,e))}function DS(i,e,t){Ble(i,e),e.set(i,t)}function PS(i,e,t){return i.set(dO(i,e),t),t}function WE(i,e,t){if( $ E())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function Ole(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,AO(n.key),n)}}function tx(i,e,t){return e&&Ole(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ds(i,e,t){return(e=AO(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function lT(){return lT=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=jle(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},lT.apply(null,arguments)}function B0(i){return B0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},B0(i)}function nx(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&cT(i,e)}function $ E(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return( $ E=function(){return!!i})()}function Ile(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Fle(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function kle(){throw new TypeError( ` Invalid attempt to destructure non - iterable instance .
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function zle(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function H6(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ki(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?H6(Object(t),!0).forEach(function(n){Ds(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):H6(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Gle(i,e){if(i==null)return{};var t,n,r=qle(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function qle(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function Vle(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lle(i)}function uT(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(S,T,N,C){var E=T&&T.prototype instanceof l?T:l,O=Object.create(E.prototype);return go(O,"_invoke",(function(U,I,j){var z,G,H,q=0,V=j||[],Q=!1,J={p:0,n:0,v:i,a:ie,f:ie.bind(i,4),d:function(le,re){return z=le,G=0,H=i,J.n=re,a}};function ie(le,re){for(G=le,H=re,e=0;!Q&&q&&!Z&&e<V.length;e++){var Z,ne=V[e],de=J.p,be=ne[2];le>3?(Z=be===re)&&(H=ne[(G=ne[4])?5:(G=3,3)],ne[4]=ne[5]=i):ne[0]<=de&&((Z=le<2&&de<ne[1])?(G=0,J.v=re,J.n=ne[1]):de<be&&(Z=le<3||ne[0]>re||re>be)&&(ne[4]=le,ne[5]=re,J.n=be,G=0))}if(Z||le>1)return a;throw Q=!0,re}return function(le,re,Z){if(q>1)throw TypeError("Generator is already running");for(Q&&re===1&&ie(re,Z),G=re,H=Z;(e=G<2?i:H)||!Q;){z||(G?G<3?(G>1&&(J.n=-1),ie(G,H)):J.n=H:J.v=H);try{if(q=2,z){if(G||(le="next"),e=z[le]){if(!(e=e.call(z,H)))throw TypeError("iterator result is not an object");if(!e.done)return e;H=e.value,G<2&&(G=0)}else G===1&&(e=z.return)&&e.call(z),G<2&&(H=TypeError("The iterator does not provide a '"+le+"' method"),G=1);z=i}else if((e=(Q=J.n<0)?H:U.call(I,J))!==a)break}catch(ne){z=i,G=1,H=ne}finally{q=1}}return{value:e,done:Q}}})(S,N,C),!0),O}var a={};function l(){}function u(){}function h(){}e=Object.getPrototypeOf;var m=[][n]?e(e([][n]())):(go(e={},n,function(){return this}),e),v=h.prototype=l.prototype=Object.create(m);function x(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,h):(S.__proto__=h,go(S,r,"GeneratorFunction")),S.prototype=Object.create(v),S}return u.prototype=h,go(v,"constructor",h),go(h,"constructor",u),u.displayName="GeneratorFunction",go(h,r,"GeneratorFunction"),go(v),go(v,r,"Generator"),go(v,n,function(){return this}),go(v,"toString",function(){return"[object Generator]"}),(uT=function(){return{w:s,m:x}})()}function go(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}go=function(s,a,l,u){function h(m,v){go(s,m,function(x){return this._invoke(m,v,x)})}a?r?r(s,a,{value:l,enumerable:!u,configurable:!u,writable:!u}):s[a]=l:(h("next",0),h("throw",1),h("return",2))},go(i,e,t,n)}function cT(i,e){return cT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},cT(i,e)}function Ar(i,e){return Dle(i)||Fle(i,e)||pO(i,e)||kle()}function jle(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=B0(i))!==null;);return i}function LS(i,e,t,n){var r=lT(B0(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function ji(i){return Ple(i)||Ile(i)||pO(i)||zle()}function Hle(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@
2026-03-09 22:33:09 +01:00
uniform float hollowRadius ;
varying vec3 vVertexWorldPosition ;
varying vec3 vVertexNormal ;
varying float vCameraDistanceToObjCenter ;
varying float vVertexAngularDistanceToHollowRadius ;
void main ( ) {
vVertexNormal = normalize ( normalMatrix * normal ) ;
vVertexWorldPosition = ( modelMatrix * vec4 ( position , 1.0 ) ) . xyz ;
vec4 objCenterViewPosition = modelViewMatrix * vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
vCameraDistanceToObjCenter = length ( objCenterViewPosition ) ;
float edgeAngle = atan ( hollowRadius / vCameraDistanceToObjCenter ) ;
float vertexAngle = acos ( dot ( normalize ( modelViewMatrix * vec4 ( position , 1.0 ) ) , normalize ( objCenterViewPosition ) ) ) ;
vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle ;
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
} ` , $ le= `
uniform vec3 color ;
uniform float coefficient ;
uniform float power ;
uniform float hollowRadius ;
varying vec3 vVertexNormal ;
varying vec3 vVertexWorldPosition ;
varying float vCameraDistanceToObjCenter ;
varying float vVertexAngularDistanceToHollowRadius ;
void main ( ) {
if ( vCameraDistanceToObjCenter < hollowRadius ) discard ; // inside the hollowRadius
if ( vVertexAngularDistanceToHollowRadius < 0.0 ) discard ; // frag position is within the hollow radius
vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition ;
vec3 viewCameraToVertex = ( viewMatrix * vec4 ( worldCameraToVertex , 0.0 ) ) . xyz ;
viewCameraToVertex = normalize ( viewCameraToVertex ) ;
float intensity = pow (
coefficient + dot ( vVertexNormal , viewCameraToVertex ) ,
power
) ;
gl _FragColor = vec4 ( color , intensity ) ;
2026-03-09 22:42:36 +01:00
} ` ;function Xle(i,e,t,n){return new Ng.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:Wle,fragmentShader: $ le,uniforms:{coefficient:{value:i},color:{value:new Ng.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function Yle(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var a=i.attributes.normal.array[r],l=i.attributes.position.array[r];n[r]=l+a*e}return t.setAttribute("position",new Ng.BufferAttribute(n,3)),t}var Qle=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,a=s===void 0?"gold":s,l=r.size,u=l===void 0?2:l,h=r.coefficient,m=h===void 0?.5:h,v=r.power,x=v===void 0?1:v,S=r.hollowRadius,T=S===void 0?0:S,N=r.backside,C=N===void 0?!0:N;ex(this,e),n=Jy(this,e);var E=Yle(t,u),O=Xle(m,a,x,T);return C&&(O.side=Ng.BackSide),n.geometry=E,n.material=O,n}return nx(e,i),tx(e)})(Ng.Mesh),ql=window.THREE?window.THREE:{Color:cn,Group:qa,LineBasicMaterial:q0,LineSegments:Y7,Mesh:Oi,MeshPhongMaterial:oD,SphereGeometry:bu,SRGBColorSpace:bn,TextureLoader:oM},vO=_s({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Ki(e.globeObj),Ki(e.tileEngine),Ki(e.graticulesObj)}},stateInit:function(){var e=new ql.MeshPhongMaterial({color:0}),t=new ql.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new sY(ar),r=new ql.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new ql.LineSegments(new AP(SX(),ar,2),new ql.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){Ki(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new ql.SphereGeometry(ar,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new ql.TextureLoader().load(e.globeImageUrl,function(l){l.colorSpace=ql.SRGBColorSpace,n.map=l,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new ql.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new ql.TextureLoader().load(e.bumpImageUrl,function(l){n.bumpMap=l,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Ki(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var a=e.atmosphereObj=new Qle(e.globeObj.geometry,{color:e.atmosphereColor,size:ar*e.atmosphereAltitude,hollowRadius:ar,coefficient:.1,power:3.5});a.visible=!!e.showAtmosphere,a.__globeObjType="atmosphere",e.scene.add(a)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),yu=function(e){return isNaN(e)?parseInt(Sn(e).toHex(),16):e},Ml=function(e){return e&&isNaN(e)?sd(e).opacity:1},Gh=function(e){var t=arguments.length>1&&arg
2026-03-09 22:33:09 +01:00
` .concat(ei.common, `
` ).concat(ei.logdepthbuf_pars_vertex, `
uniform float dashTranslate ;
attribute vec4 color ;
varying vec4 vColor ;
attribute float relDistance ;
varying float vRelDistance ;
void main ( ) {
// pass through colors and distances
vColor = color ;
vRelDistance = relDistance + dashTranslate ;
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
` ).concat(ei.logdepthbuf_vertex, `
}
` ),fragmentShader: `
` .concat(ei.logdepthbuf_pars_fragment, `
uniform float dashOffset ;
uniform float dashSize ;
uniform float gapSize ;
varying vec4 vColor ;
varying float vRelDistance ;
void main ( ) {
// ignore pixels in the gap
if ( vRelDistance < dashOffset ) discard ;
if ( mod ( vRelDistance - dashOffset , dashSize + gapSize ) > dashSize ) discard ;
// set px color: [r, g, b, a], interpolated between vertices
gl _FragColor = vColor ;
` ).concat(ei.logdepthbuf_fragment, `
}
` )}},hT=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=( ` attribute float surfaceRadius ;
varying float vSurfaceRadius ;
varying vec3 vPos ;
` +e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join( `
` )),e.fragmentShader=( ` uniform float uSurfaceRadius ;
varying float vSurfaceRadius ;
varying vec3 vPos ;
` +e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join( `
` )),e},Jle=function(e){return e.vertexShader= `
attribute float r ;
const float PI = 3.1415926535897932384626433832795 ;
float toRad ( in float a ) {
return a * PI / 180.0 ;
}
vec3 Polar2Cartesian ( in vec3 c ) { // [lat, lng, r]
float phi = toRad ( 90.0 - c . x ) ;
float theta = toRad ( 90.0 - c . y ) ;
float r = c . z ;
return vec3 ( // x,y,z
r * sin ( phi ) * cos ( theta ) ,
r * cos ( phi ) ,
r * sin ( phi ) * sin ( theta )
) ;
}
vec2 Cartesian2Polar ( in vec3 p ) {
float r = sqrt ( p . x * p . x + p . y * p . y + p . z * p . z ) ;
float phi = acos ( p . y / r ) ;
float theta = atan ( p . z , p . x ) ;
return vec2 ( // lat,lng
90.0 - phi * 180.0 / PI ,
90.0 - theta * 180.0 / PI - ( theta < - PI / 2.0 ? 360.0 : 0.0 )
) ;
}
` .concat(e.vertexShader.replace("}", `
vec3 pos = Polar2Cartesian ( vec3 ( Cartesian2Polar ( position ) , r ) ) ;
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( pos , 1.0 ) ;
}
` ), `
2026-03-09 22:42:36 +01:00
` ),e},YE=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},eue=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},tue=["stroke"],gl=window.THREE?window.THREE:{BufferGeometry:Hi,CubicBezierCurve3:Z7,Curve:Nl,Group:qa,Line:_y,Mesh:Oi,NormalBlending:Xa,ShaderMaterial:Qa,TubeGeometry:sM,Vector3:pe},nue=C0.default||C0,xO=_s({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new nue,sharedMaterial:new gl.ShaderMaterial(ki(ki({},yO()),{},{transparent:!0,blending:gl.NormalBlending}))}},init:function(e,t){Ki(e),t.scene=e,t.dataMapper=new io(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new gl.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=Ar(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r,u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l})})},update:function(e){var t=Lt(e.arcStartLat),n=Lt(e.arcStartLng),r=Lt(e.arcStartAltitude),s=Lt(e.arcEndLat),a=Lt(e.arcEndLng),l=Lt(e.arcEndAltitude),u=Lt(e.arcAltitude),h=Lt(e.arcAltitudeAutoScale),m=Lt(e.arcStroke),v=Lt(e.arcColor),x=Lt(e.arcDashLength),S=Lt(e.arcDashGap),T=Lt(e.arcDashInitialGap),N=Lt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(U,I){var j=m(I),z=j!=null;if(!U.children.length||z!==(U.children[0].type==="Mesh")){Ki(U);var G=z?new gl.Mesh:new gl.Line(new gl.BufferGeometry);G.material=e.sharedMaterial.clone(),U.add(G)}var H=U.children[0];Object.assign(H.material.uniforms,{dashSize:{value:x(I)},gapSize:{value:S(I)},dashOffset:{value:T(I)}});var q=N(I);H.__dashAnimateStep=q>0?1e3/q:0;var V=E(v(I),e.arcCurveResolution,z?e.arcCircularResolution+1:1),Q=O(e.arcCurveResolution,z?e.arcCircularResolution+1:1,!0);H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",Q);var J=function(Z){var ne=U.__currentTargetD=Z,de=ne.stroke,be=Gle(ne,tue),Te=C(be);z?(H.geometry&&H.geometry.dispose(),H.geometry=new gl.TubeGeometry(Te,e.arcCurveResolution,de/2,e.arcCircularResolution),H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",Q)):H.geometry.setFromPoints(Te.getPoints(e.arcCurveResolution))},ie={stroke:j,alt:u(I),altAutoScale:+h(I),startLat:+t(I),startLng:+n(I),startAlt:+r(I),endLat:+s(I),endLng:+a(I),endAlt:+l(I)},le=U.__currentTargetD||Object.assign({},ie,{altAutoScale:-.001});Object.keys(ie).some(function(re){return le[re]!==ie[re]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?J(ie):e.tweenGroup.add(new la(le).to(ie,e.arcsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start()))}).digest(e.arcsData);function C(U){var I=U.alt,j=U.altAutoScale,z=U.startLat,G=U.startLng,H=U.startAlt,q=U.endLat,V=U.endLng,Q=U.endAlt,J=function(tt){var je=Ar(tt,3),Rt=je[0],Et=je[1],Ft=je[2],Ut=Zo(Et,Rt,Ft),Ke=Ut.x,ht=Ut.y,fe=Ut.z;return new gl.Vector3(Ke,ht,fe)},ie=[G,z],le=[V,q],re=I;if(re==null&&(re=kh(ie,le)/2*j+Math
2026-03-09 22:33:09 +01:00
\ r
Permission is hereby granted , free of charge , to any person obtaining a copy of the fonts accompanying this license ( "Fonts" ) and associated documentation files ( the "Font Software" ) , to reproduce and distribute the Font Software , including without limitation the rights to use , copy , merge , publish , distribute , and / or sell copies of the Font Software , and to permit persons to whom the Font Software is furnished to do so , subject to the following conditions : \ r
\ r
The above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces . \ r
\ r
The Font Software may be modified , altered , or added to , and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts , only if the fonts are renamed to names not containing the word "MgOpen" , or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator . \ r
\ r
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name . \ r
\ r
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself . \ r
\ r
2026-03-09 22:42:36 +01:00
THE FONT SOFTWARE IS PROVIDED "AS IS" , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT , PATENT , TRADEMARK , OR OTHER RIGHT . IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER LIABILITY , INCLUDING ANY GENERAL , SPECIAL , INDIRECT , INCIDENTAL , OR CONSEQUENTIAL DAMAGES , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE . ` ,manufacturer_name:"Μ agenta ltd",font_sub_family_name:"Regular"},Mue=-334,Eue="Helvetiker",Cue=1522,Nue=50,Rue={glyphs:vue,cssFontWeight:_ue,ascender:yue,underlinePosition:xue,cssFontStyle:bue,boundingBox:Sue,resolution:wue,original_font_information:Tue,descender:Mue,familyName:Eue,lineHeight:Cue,underlineThickness:Nue},vl=ki(ki({},window.THREE?window.THREE:{BoxGeometry:Vh,CircleGeometry:yy,DoubleSide:as,Group:qa,Mesh:Oi,MeshLambertMaterial:Fc,TextGeometry:V6,Vector3:pe}),{},{Font:Cle,TextGeometry:V6}),DO=_s({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:Rue,onChange:function(e,t){t.font=new vl.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Ki(e),t.scene=e,t.tweenGroup=r;var s=new vl.CircleGeometry(1,32);t.dataMapper=new io(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var a=new vl.MeshLambertMaterial;a.side=as;var l=new vl.Group;l.add(new vl.Mesh(s,a));var u=new vl.Mesh(void 0,a);l.add(u);var h=new vl.Mesh;return h.visible=!1,u.add(h),l.__globeObjType="label",l})},update:function(e){var t=Lt(e.labelLat),n=Lt(e.labelLng),r=Lt(e.labelAltitude),s=Lt(e.labelText),a=Lt(e.labelSize),l=Lt(e.labelRotation),u=Lt(e.labelColor),h=Lt(e.labelIncludeDot),m=Lt(e.labelDotRadius),v=Lt(e.labelDotOrientation),x=new Set(["right","top","bottom"]),S=2*Math.PI*ar/360;e.dataMapper.onUpdateObj(function(T,N){var C=Ar(T.children,2),E=C[0],O=C[1],U=Ar(O.children,1),I=U[0],j=u(N),z=Ml(j);O.material.color.set(yu(j)),O.material.transparent=z<1,O.material.opacity=z;var G=h(N),H=v(N);!G||!x.has(H)&&(H="bottom");var q=G?+m(N)*S:1e-12;E.scale.x=E.scale.y=q;var V=+a(N)*S;if(O.geometry&&O.geometry.dispose(),O.geometry=new vl.TextGeometry(s(N),{font:e.font,size:V,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),I.geometry&&I.geometry.dispose(),O.geometry.computeBoundingBox(),I.geometry=WE(vl.BoxGeometry,ji(new vl.Vector3().subVectors(O.geometry.boundingBox.max,O.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),H!=="right"&&O.geometry.center(),G){var Q=q+V/2;H==="right"&&(O.position.x=Q),O.position.y={right:-V/2,top:Q+V/2,bottom:-Q-V/2}[H]}var J=function(Z){var ne=T.__currentTargetD=Z,de=ne.lat,be=ne.lng,Te=ne.alt,ae=ne.rot,Me=ne.scale;Object.assign(T.position,Zo(de,be,Te)),T.lookAt(e.scene.localToWorld(new vl.Vector3(0,0,0))),T.rotateY(Math.PI),T.rotateZ(-ae*Math.PI/180),T.scale.x=T.scale.y=T.scale.z=Me},ie={lat:+t(N),lng:+n(N),alt:+r(N),rot:+l(N),scale:1},le=T.__currentTargetD||Object.assign({},ie,{scale:1e-12});Object.keys(ie).some(function(re){return le[re]!==ie[re]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?J(ie):e.tweenGroup.add(new la(le).to(ie,e.labelsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start()))}).digest(e.labelsData)}}),Due=ki(ki({},window.THREE?window.THREE:{}),{},{CSS2DObject:kH}),PO=_s({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{defa
2026-03-09 22:33:09 +01:00
varying vec2 vUv ;
void main ( ) {
vUv = uv ;
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
} ` ,fragmentShader: `
uniform float opacity ;
uniform sampler2D tDiffuse ;
varying vec2 vUv ;
void main ( ) {
vec4 texel = texture2D ( tDiffuse , vUv ) ;
gl _FragColor = opacity * texel ;
} ` };class ix{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Zce=new Ig(-1,1,1,-1,0,1);class Jce extends Hi{constructor(){super(),this.setAttribute("position",new Si([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Si([0,2,0,0,2,0],2))}}const ehe=new Jce;class the{constructor(e){this._mesh=new Oi(ehe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Zce)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class nhe extends ix{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Qa?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=my.clone(e.uniforms),this.material=new Qa({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new the(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class o7 extends ix{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,l;this.inverse?(a=0,l=1):(a=1,l=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(l),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class ihe extends ix{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class rhe{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new bt);this._width=n.width,this._height=n.height,t=new Fh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Gs}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new nhe(Kce),this.copyPass.material.blending= $ a,this.clock=new hD}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const l=this.renderer.getContext(),u=this.renderer.state.buffers.stencil;u.setFunc(l.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function p7(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Gde(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?p7(Object(t),!0).forEach(function(n){Fde(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):p7(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function qde(i,e){return Ide(i)||kde(i,e)||Hde(i,e)||zde()}function Vde(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function jde(i){var e=Vde(i,"string");return typeof e=="symbol"?e:e+""}function cy(i){"@babel/helpers - typeof";return cy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cy(i)}function Hde(i,e){if(i){if(typeof i=="string")return A7(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?A7(i,e):void 0}}var _T=function(e){if(cy(e)!=="object")return e;var t=hI(e);if(t.props){var n;t.props=Gde({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(_T):_T(t.props.children))}return t},Wde=function(e){return tI(hI(e))}, $ de=function(e,t){delete t.__k,Ode(_T(e),t)};function Xde(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var Yde= ` . float - tooltip - kap {
position : absolute ;
width : max - content ; /* prevent shrinking near right edge */
max - width : max ( 50 % , 150 px ) ;
padding : 3 px 5 px ;
border - radius : 3 px ;
font : 12 px sans - serif ;
color : # eee ;
background : rgba ( 0 , 0 , 0 , 0.6 ) ;
pointer - events : none ;
}
` ;Xde(Yde);var Qde=_s({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,a=!!e&&cy(e)==="object"&&!!e.node&&typeof e.node=="function",l=Mde(a?e.node():e);l.style("position")==="static"&&l.style("position","relative"),t.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(h){var m=qde(h,2),v=m[0],x=m[1];return t.tooltipEl.style(v,x)}),t.tooltipEl.style("left","-10000px").style("display","none");var u="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,l.on("mousemove.".concat(u),function(h){t.mouseInside=!0;var m=Cde(h),v=l.node(),x=v.offsetWidth,S=v.offsetHeight,T=[t.offsetX===null||t.offsetX===void 0?"-".concat(m[0]/x*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?S>130&&S-m[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",m[0]+"px").style("top",m[1]+"px").style("transform","translate(".concat(T.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(u),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(u),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):Wde(e.content)?(e.tooltipEl.text(""), $ de(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function Kde(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var Zde= ` . scene - nav - info {
position : absolute ;
bottom : 5 px ;
width : 100 % ;
text - align : center ;
color : slategrey ;
opacity : 0.7 ;
font - size : 10 px ;
font - family : sans - serif ;
pointer - events : none ;
user - select : none ;
}
. scene - container canvas : focus {
outline : none ;
} ` ;Kde(Zde);function yT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Jde(i){if(Array.isArray(i))return i}function eAe(i){if(Array.isArray(i))return yT(i)}function tAe(i,e,t){return(e=lAe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function nAe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function iAe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function rAe(){throw new TypeError( ` Invalid attempt to destructure non - iterable instance .
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function sAe(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function aAe(i,e){return Jde(i)||iAe(i,e)||fI(i,e)||rAe()}function Cf(i){return eAe(i)||nAe(i)||fI(i)||sAe()}function oAe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function lAe(i){var e=oAe(i,"string");return typeof e=="symbol"?e:e+""}function fI(i,e){if(i){if(typeof i=="string")return yT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?yT(i,e):void 0}}var xr=window.THREE?window.THREE:{WebGLRenderer:FH,Scene:ZT,PerspectiveCamera:va,Raycaster:Jz,SRGBColorSpace:bn,TextureLoader:oM,Vector2:bt,Vector3:pe,Box3:Oc,Color:cn,Mesh:Oi,SphereGeometry:bu,MeshBasicMaterial:cd,BackSide:or,Clock:hD},dI=_s({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.clock.getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(a){return a.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(a,l){return e.hoverOrderComparator(a.object,l.object)});var s=r.find(function(a){return e.hoverFilter(a.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&Lt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var a=t,l=n||{x:0,y:0,z:0};if(!r)m(a),v(l);else{var u=Object.assign({},s.position),h=x();e.tweenGroup.add(new la(u).to(a,r).easing(os.Quadratic.Out).onUpdate(m).start()),e.tweenGroup.add(new la(h).to(l,r/3).easing(os.Quadratic.Out).onUpdate(v).start())}return this}return Object.assign({},s.position,{lookAt:x()});function m(S){var T=S.x,N=S.y,C=S.z;T!==void 0&&(s.position.x=T),N!==void 0&&(s.position.y=N),C!==void 0&&(s.position.z=C)}function v(S){var T=new xr.Vector3(S.x,S.y,S.z);e.controls.enabled&&e.controls.target?e.controls.target=T:s.lookAt(T)}function x(){return Object.assign(new xr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),a=3;a<r;a++)s[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.lengt
2026-03-09 22:33:09 +01:00
cursor : pointer ;
} ` ;uAe(cAe);function xT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function hAe(i){if(Array.isArray(i))return xT(i)}function n1(i,e,t){return(e=gAe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fAe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function dAe(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-09 22:42:36 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function m7(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function zf(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m7(Object(t),!0).forEach(function(n){n1(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):m7(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function AAe(i,e){if(i==null)return{};var t,n,r=pAe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function pAe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function ox(i){return hAe(i)||fAe(i)||vAe(i)||dAe()}function mAe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function gAe(i){var e=mAe(i,"string");return typeof e=="symbol"?e:e+""}function vAe(i,e){if(i){if(typeof i=="string")return xT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array $ /.test(t)?xT(i,e):void 0}}function AI(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(a,l){l[i][r](a)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var a=s[i],l=arguments.length,u=new Array(l>1?l-1:0),h=1;h<l;h++)u[h-1]=arguments[h];var m=a[r].apply(a,u);return m===a?this:m}}}}var _Ae=["rendererConfig","waitForGlobeReady"],pm=zf(zf({},window.THREE?window.THREE:{AmbientLight:cD,DirectionalLight:uD,Vector2:bt,REVISION:F0}),{},{CSS2DRenderer:zH}),pI=AI("globe",OO),yAe=Object.assign.apply(Object,ox(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tile