2026-03-07 01:56:14 +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 b7 ( i ) { return i && i . _ _esModule && Object . prototype . hasOwnProperty . call ( i , "default" ) ? i . default : i } var $b = { exports : { } } , $p = { } ; / * *
* @ 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 .
2026-03-07 02:07:49 +01:00
* /var BC;function SF(){if(BC)return $p;BC=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 $p.Fragment=e,$p.jsx=t,$p.jsxs=t,$p}var OC;function TF(){return OC||(OC=1,$b.exports=SF()),$b.exports}var W=TF(),Xb={exports:{}},Xp={},Yb={exports:{}},Qb={};/ * *
2026-03-07 01:56:14 +01:00
* @ 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-07 02:07:49 +01:00
* / v a r I C ; f u n c t i o n w F ( ) { r e t u r n I C | | ( I C = 1 , ( f u n c t i o n ( i ) { f u n c t i o n e ( Q , l e ) { v a r d e = Q . l e n g t h ; Q . p u s h ( l e ) ; e : f o r ( ; 0 < d e ; ) { v a r T e = d e - 1 > > > 1 , S e = Q [ T e ] ; i f ( 0 < r ( S e , l e ) ) Q [ T e ] = l e , Q [ d e ] = S e , d e = T e ; e l s e b r e a k e } } f u n c t i o n t ( Q ) { r e t u r n Q . l e n g t h = = = 0 ? n u l l : Q [ 0 ] } f u n c t i o n n ( Q ) { i f ( Q . l e n g t h = = = 0 ) r e t u r n n u l l ; v a r l e = Q [ 0 ] , d e = Q . p o p ( ) ; i f ( d e ! = = l e ) { Q [ 0 ] = d e ; e : f o r ( v a r T e = 0 , S e = Q . l e n g t h , u e = S e > > > 1 ; T e < u e ; ) { v a r b e = 2 * ( T e + 1 ) - 1 , W e = Q [ b e ] , E e = b e + 1 , G e = Q [ E e ] ; i f ( 0 > r ( W e , d e ) ) E e < S e & & 0 > r ( G e , W e ) ? ( Q [ T e ] = G e , Q [ E e ] = d e , T e = E e ) : ( Q [ T e ] = W e , Q [ b e ] = d e , T e = b e ) ; e l s e i f ( E e < S e & & 0 > r ( G e , d e ) ) Q [ T e ] = G e , Q [ E e ] = d e , T e = E e ; e l s e b r e a k e } } r e t u r n l e } f u n c t i o n r ( Q , l e ) { v a r d e = Q . s o r t I n d e x - l e . s o r t I n d e x ; r e t u r n d e ! = = 0 ? d e : Q . i d - l 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 = [ ] , g = 1 , v = n u l l , x = 3 , S = ! 1 , w = ! 1 , R = ! 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 , B = 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 , L = 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 O ( Q ) { f o r ( v a r l e = t ( h ) ; l e ! = = n u l l ; ) { i f ( l e . c a l l b a c k = = = n u l l ) n ( h ) ; e l s e i f ( l e . s t a r t T i m e < = Q ) n ( h ) , l e . s o r t I n d e x = l e . e x p i r a t i o n T i m e , e ( u , l e ) ; e l s e b r e a k ; l e = t ( h ) } } f u n c t i o n z ( Q ) { i f ( R = ! 1 , O ( Q ) , ! w ) i f ( t ( u ) ! = = n u l l ) w = ! 0 , G | | ( G = ! 0 , e e ( ) ) ; e l s e { v a r l e = t ( h ) ; l e ! = = n u l l & & t e ( z , l e . s t a r t T i m e - Q ) } } v a r G = ! 1 , k = - 1 , H = 5 , F = - 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 ( ) - F < H ) } f u n c t i o n Y ( ) { i f ( C = ! 1 , G ) { v a r Q = i . u n s t a b l e _ n o w ( ) ; F = Q ; v a r l e = ! 0 ; t r y { e : { w = ! 1 , R & & ( R = ! 1 , B ( k ) , k = - 1 ) , S = ! 0 ; v a r d e = x ; t r y { t : { f o r ( O ( Q ) , v = t ( u ) ; v ! = = n u l l & & ! ( v . e x p i r a t i o n T i m e > Q & & V ( ) ) ; ) { v a r T e = v . c a l l b a c k ; i f ( 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 = n u l l , x = v . p r i o r i t y L e v e l ; v a r S e = T e ( v . e x p i r a t i o n T i m e < = Q ) ; i f ( Q = i . u n s t a b l e _ n o w ( ) , t y p e o f S e = = " f u n c t i o n " ) { v . c a l l b a c k = S e , O ( Q ) , l e = ! 0 ; b r e a k t } v = = = t ( u ) & & n ( u ) , O ( Q ) } e l s e n ( u ) ; v = t ( u ) } i f ( v ! = = n u l l ) l e = ! 0 ; e l s e { v a r u e = t ( h ) ; u e ! = = n u l l & & t e ( z , u e . s t a r t T i m e - Q ) , l 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 } l e = v o i d 0 } } f i n a l l y { l e ? e e ( ) : G = ! 1 } } } v a r e e ; i f ( t y p e o f L = = " f u n c t i o n " ) e e = f u n c t i o n ( ) { L ( Y ) } ; 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 n e = n e w M e s s a g e C h a n n e l , s e = n e . p o r t 2 ; n e . p o r t 1 . o n m e s s a g e = Y , e e = f u n c t i o n ( ) { s e . p o s t M e s s a g e ( n u l l ) } } e l s e e e = f u n c t i o n ( ) { E ( Y , 0 ) } ; f u n c t i o n t e ( Q , l e ) { k = E ( f u n c t i o n ( ) { Q ( i . u n s t a b l e _ n o w ( ) ) } , l 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 ( Q ) { Q . 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 ( Q ) { 0 > Q | | 1 2 5 < Q ? 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 < Q ? M a t h . f l o o r ( 1 e 3 / Q ) : 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 ( Q ) { 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 l e = 3 ; b r e a k ; d e f a u l t : l e = x } v a r d e = x ; x = l e ; t r y { r e t u r n Q ( ) } 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 ( Q , l e ) { s w i t c h ( Q ) { 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 : Q = 3 } v a r d e = x ; x = Q ; t r y { r e t u r n l 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 ( Q , l e , d e ) { v a r T 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 ? T e + d e : T e ) : d e = T e , Q ) { c a s e 1 : v a r S e = - 1 ; b r e a k ; c a s e 2 : S e = 2 5 0 ; b r e a k ; c a s e 5 : S e = 1 0 7 3 7 4 1 8 2 3 ; b r e a k ; c a s e 4 : S e = 1 e 4 ; b r e a k ; d e f a u l t : S e = 5 e 3 } r e t u r n S e = d e + S e , Q = { i d : g + + , c a l l b a c k : l e , p r i o r i t y L e v e l : Q , 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 : S e , s o r t I n d e x : - 1 } , d e > T e ? ( Q . s o r t I n d e x = d e , e ( h , Q ) , t ( u ) = = = n u l l & & Q = = = t ( h ) & & ( R ? ( B ( k ) , k = - 1 ) : R = ! 0 , t e ( z , d e - T e ) ) ) : ( Q . s o r t I n d e x = S e , e ( u , Q ) , w | | S | | ( w = ! 0 , G | | ( G = ! 0 , e e ( ) ) ) ) , Q } , 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 ( Q ) { v a r l e = x ; r e t u r n f u n c t i o n ( ) { v a r d e = x ; x = l e ; t r y { r e t u r n Q . 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 } } } } ) ( Q b ) ) , Q b } v a r F C ; f u n c t i o n M F ( ) { r e t u r n F C | | ( F C = 1 , Y b . e x p o r t s = w F ( ) ) , Y b . e x p o r t s } v a r K b = { e x p o r t s : { } } , J n = { } ; / * *
2026-03-07 01:56:14 +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-07 02:07:49 +01:00
* /var kC;function EF(){if(kC)return Jn;kC=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"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function S(ue){return ue===null||typeof ue!="object"?null:(ue=x&&ue[x]||ue["@@iterator"],typeof ue=="function"?ue:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,C={};function E(ue,be,We){this.props=ue,this.context=be,this.refs=C,this.updater=We||w}E.prototype.isReactComponent={},E.prototype.setState=function(ue,be){if(typeof ue!="object"&&typeof ue!="function"&&ue!=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,ue,be,"setState")},E.prototype.forceUpdate=function(ue){this.updater.enqueueForceUpdate(this,ue,"forceUpdate")};function B(){}B.prototype=E.prototype;function L(ue,be,We){this.props=ue,this.context=be,this.refs=C,this.updater=We||w}var O=L.prototype=new B;O.constructor=L,R(O,E.prototype),O.isPureReactComponent=!0;var z=Array.isArray;function G(){}var k={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function F(ue,be,We){var Ee=We.ref;return{$$typeof:i,type:ue,key:be,ref:Ee!==void 0?Ee:null,props:We}}function V(ue,be){return F(ue.type,be,ue.props)}function Y(ue){return typeof ue=="object"&&ue!==null&&ue.$$typeof===i}function ee(ue){var be={"=":"=0",":":"=2"};return"$"+ue.replace(/ [ = : ] / g , function ( We ) { return be [ We ] } ) } var ne = /\/+/g ; function se ( ue , be ) { return typeof ue == "object" && ue !== null && ue . key != null ? ee ( "" + ue . key ) : be . toString ( 36 ) } function te ( ue ) { switch ( ue . status ) { case "fulfilled" : return ue . value ; case "rejected" : throw ue . reason ; default : switch ( typeof ue . status == "string" ? ue . then ( G , G ) : ( ue . status = "pending" , ue . then ( function ( be ) { ue . status === "pending" && ( ue . status = "fulfilled" , ue . value = be ) } , function ( be ) { ue . status === "pending" && ( ue . status = "rejected" , ue . reason = be ) } ) ) , ue . status ) { case "fulfilled" : return ue . value ; case "rejected" : throw ue . reason } } throw ue } function Q ( ue , be , We , Ee , Ge ) { var ye = typeof ue ; ( ye === "undefined" || ye === "boolean" ) && ( ue = null ) ; var Pe = ! 1 ; if ( ue === null ) Pe = ! 0 ; else switch ( ye ) { case "bigint" : case "string" : case "number" : Pe = ! 0 ; break ; case "object" : switch ( ue . $$typeof ) { case i : case e : Pe = ! 0 ; break ; case g : return Pe = ue . _init , Q ( Pe ( ue . _payload ) , be , We , Ee , Ge ) } } if ( Pe ) return Ge = Ge ( ue ) , Pe = Ee === "" ? "." + se ( ue , 0 ) : Ee , z ( Ge ) ? ( We = "" , Pe != null && ( We = Pe . replace ( ne , "$&/" ) + "/" ) , Q ( Ge , be , We , "" , function ( Tt ) { return Tt } ) ) : Ge != null && ( Y ( Ge ) && ( Ge = V ( Ge , We + ( Ge . key == null || ue && ue . key === Ge . key ? "" : ( "" + Ge . key ) . replace ( ne , "$&/" ) + "/" ) + Pe ) ) , be . push ( Ge ) ) , 1 ; Pe = 0 ; var pt = Ee === "" ? "." : Ee + ":" ; if ( z ( ue ) ) for ( var vt = 0 ; vt < ue . length ; vt ++ ) Ee = ue [ vt ] , ye = pt + se ( Ee , vt ) , Pe += Q ( Ee , be , We , ye , Ge ) ; else if ( vt = S ( ue ) , typeof vt == "function" ) for ( ue = vt . call ( ue ) , vt = 0 ; ! ( Ee = ue . next ( ) ) . done ; ) Ee = Ee . value , ye = pt + se ( Ee , vt ++ ) , Pe += Q ( Ee , be , We , ye , Ge ) ; else if ( ye === "object" ) { if ( typeof ue . then == "function" ) return Q ( te ( ue ) , be , We , Ee , Ge ) ; throw be = String ( ue ) , Error ( "Objects are not valid as a React child (found: " + ( be === "[object Object]" ? "object with keys {" + Object . keys ( ue ) . join ( ", " ) + "}" : be ) + "). If you meant to render a collection of children, use an array instead." ) } return Pe } function le ( ue , be , We ) { if ( ue == null ) return ue ; var Ee = [ ] , Ge = 0 ; return Q ( ue , Ee , "" , "" , function ( ye ) { return be . call ( We , ye , Ge ++ ) } ) , Ee } function de ( ue ) { if ( ue . _status === - 1 ) { var be = ue . _result ; be = be ( ) , be . then ( function ( We ) { ( ue . _status === 0 || ue . _status === - 1 ) && ( ue . _status = 1 , ue . _result = We ) } , function ( We ) { ( ue . _status === 0 || ue . _status === - 1 ) && ( ue . _status = 2 , ue . _result = We ) } ) , ue . _status === - 1 && ( ue . _status = 0 , ue . _result = be ) } if ( ue . _status === 1 ) return ue . _result . default ; throw ue . _result } var Te = typeof reportError == "function" ? reportError : function ( ue ) { if ( typeof window == "object" && typeof window . ErrorEvent == "function" ) { var be = new
2026-03-07 01:56:14 +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 .
2026-03-07 02:07:49 +01:00
* /var GC;function CF(){if(GC)return Zs;GC=1;var i=_w();function e(u){var h="https:/ / react . dev / errors / "+u;if(1<arguments.length){h+=" ? args [ ] = "+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+=" & args [ ] = "+encodeURIComponent(arguments[g])}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,g){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:g}}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 Zs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Zs.createPortal=function(u,h){var g=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,g)},Zs.flushSync=function(u){var h=a.T,g=n.p;try{if(a.T=null,n.p=2,u)return u()}finally{a.T=h,n.p=g,n.d.f()}},Zs.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))},Zs.prefetchDNS=function(u){typeof u==" string "&&n.d.D(u)},Zs.preinit=function(u,h){if(typeof u==" string "&&h&&typeof h.as==" string "){var g=h.as,v=l(g,h.crossOrigin),x=typeof h.integrity==" string "?h.integrity:void 0,S=typeof h.fetchPriority==" string "?h.fetchPriority:void 0;g===" style "?n.d.S(u,typeof h.precedence==" string "?h.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:S}):g===" script "&&n.d.X(u,{crossOrigin:v,integrity:x,fetchPriority:S,nonce:typeof h.nonce==" string "?h.nonce:void 0})}},Zs.preinitModule=function(u,h){if(typeof u==" string ")if(typeof h==" object "&&h!==null){if(h.as==null||h.as===" script "){var g=l(h.as,h.crossOrigin);n.d.M(u,{crossOrigin:g,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)},Zs.preload=function(u,h){if(typeof u==" string "&&typeof h==" object "&&h!==null&&typeof h.as==" string "){var g=h.as,v=l(g,h.crossOrigin);n.d.L(u,g,{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})}},Zs.preloadModule=function(u,h){if(typeof u==" string ")if(h){var g=l(h.as,h.crossOrigin);n.d.m(u,{as:typeof h.as==" string "&&h.as!==" script "?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity==" string "?h.integrity:void 0})}else n.d.m(u)},Zs.requestFormReset=function(u){n.d.r(u)},Zs.unstable_batchedUpdates=function(u,h){return u(h)},Zs.useFormState=function(u,h,g){return a.H.useFormState(u,h,g)},Zs.useFormStatus=function(){return a.H.useHostTransitionStatus()},Zs.version=" 19.2 . 4 ",Zs}var qC;function RF(){if(qC)return Zb.exports;qC=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 ( ) , Zb . exports = CF ( ) , Zb . exports } / * *
2026-03-07 01:56:14 +01:00
* @ 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-07 02:07:49 +01:00
* /var VC;function NF(){if(VC)return Xp;VC=1;var i=MF(),e=_w(),t=RF();function n(o){var c="https:/ / react . dev / errors / "+o;if(1<arguments.length){c+=" ? args [ ] = "+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)c+=" & args [ ] = "+encodeURIComponent(arguments[m])}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,m=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(m=c.return),o=c.return;while(o)}return c.tag===3?m: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 m=o,b=c;;){var D=m.return;if(D===null)break;var P=D.alternate;if(P===null){if(b=D.return,b!==null){m=b;continue}break}if(D.child===P.child){for(P=D.child;P;){if(P===m)return u(D),o;if(P===b)return u(D),c;P=P.sibling}throw Error(n(188))}if(m.return!==b.return)m=D,b=P;else{for(var $=!1,re=D.child;re;){if(re===m){$=!0,m=D,b=P;break}if(re===b){$=!0,b=D,m=P;break}re=re.sibling}if(!$){for(re=P.child;re;){if(re===m){$=!0,m=P,b=D;break}if(re===b){$=!0,b=P,m=D;break}re=re.sibling}if(!$)throw Error(n(189))}}if(m.alternate!==b)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?o:c}function g(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=g(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 "),w=Symbol.for(" react . portal "),R=Symbol.for(" react . fragment "),C=Symbol.for(" react . strict _mode "),E=Symbol.for(" react . profiler "),B=Symbol.for(" react . consumer "),L=Symbol.for(" react . context "),O=Symbol.for(" react . forward _ref "),z=Symbol.for(" react . suspense "),G=Symbol.for(" react . suspense _list "),k=Symbol.for(" react . memo "),H=Symbol.for(" react . lazy "),F=Symbol.for(" react . activity "),V=Symbol.for(" react . memo _cache _sentinel "),Y=Symbol.iterator;function ee(o){return o===null||typeof o!=" object "?null:(o=Y&&o[Y]||o[" @ @ iterator "],typeof o==" function "?o:null)}var ne=Symbol.for(" react . client . reference ");function se(o){if(o==null)return null;if(typeof o==" function ")return o.$$typeof===ne?null:o.displayName||o.name||null;if(typeof o==" string ")return o;switch(o){case R:return" Fragment ";case E:return" Profiler ";case C:return" StrictMode ";case z:return" Suspense ";case G:return" SuspenseList ";case F:return" Activity "}if(typeof o==" object ")switch(o.$$typeof){case w:return" Portal ";case L:return o.displayName||" Context ";case B:return(o._context.displayName||" Context ")+" . Consumer ";case O:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||" ",o=o!==" "?" ForwardRef ( "+o+" ) ":" ForwardRef "),o;case k:return c=o.displayName||null,c!==null?c:se(o.type)||" Memo ";case H:c=o._payload,o=o._init;try{return se(o(c))}catch{}}return null}var te=Array.isArray,Q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Te=[],Se=-1;function ue(o){return{current:o}}function be(o){0>Se||(o.current=Te[Se],Te[Se]=null,Se--)}function We(o,c){Se++,Te[Se]=o.current,o.current=c}var Ee=ue(null),Ge=ue(null),ye=ue(null),Pe=ue(null);function pt(o,c){switch(We(ye,c),We(Ge,o),We(Ee,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?rC(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=rC(c),o=sC(c,o);else switch(o){case" svg ":o=1;break;case" math " : o = 2 ; break ; default : o = 0 } } be ( Ee ) , We ( Ee , o ) } function vt ( ) { be ( Ee ) , be ( Ge ) , be ( ye ) } function Tt ( o ) { o . memoizedState !== null && We ( Pe , o ) ; var c = Ee . current , m = sC ( c , o . type ) ; c !
2026-03-07 01:56:14 +01:00
at ` )?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return `
2026-03-07 02:07:49 +01:00
` +Qe+o+it}var Ft=!1;function ct(o,c){if(!o||Ft)return"";Ft=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(c){var St=function(){throw Error()};if(Object.defineProperty(St.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(St,[])}catch(tt){var et=tt}Reflect.construct(o,[],St)}else{try{St.call()}catch(tt){et=tt}o.call(St.prototype)}}else{try{throw Error()}catch(tt){et=tt}(St=o())&&typeof St.catch=="function"&&St.catch(function(){})}}catch(tt){if(tt&&et&&typeof tt.stack=="string")return[tt.stack,et.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 P=b.DetermineComponentFrameRoot(), $ =P[0],re=P[1];if( $ &&re){var we= $ .split( `
2026-03-07 01:56:14 +01:00
` ),Je=re.split( `
` );for(D=b=0;b<we.length&&!we[b].includes("DetermineComponentFrameRoot");)b++;for(;D<Je.length&&!Je[D].includes("DetermineComponentFrameRoot");)D++;if(b===we.length||D===Je.length)for(b=we.length-1,D=Je.length-1;1<=b&&0<=D&&we[b]!==Je[D];)D--;for(;1<=b&&0<=D;b--,D--)if(we[b]!==Je[D]){if(b!==1||D!==1)do if(b--,D--,0>D||we[b]!==Je[D]){var ut= `
2026-03-07 02:07:49 +01:00
` +we[b].replace(" at new "," at ");return o.displayName&&ut.includes("<anonymous>")&&(ut=ut.replace("<anonymous>",o.displayName)),ut}while(1<=b&&0<=D);break}}}finally{Ft=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?he(m):""}function Dt(o,c){switch(o.tag){case 26:case 27:case 5:return he(o.type);case 16:return he("Lazy");case 13:return o.child!==c&&c!==null?he("Suspense Fallback"):he("Suspense");case 19:return he("SuspenseList");case 0:case 15:return ct(o.type,!1);case 11:return ct(o.type.render,!1);case 1:return ct(o.type,!0);case 31:return he("Activity");default:return""}}function gt(o){try{var c="",m=null;do c+=Dt(o,m),m=o,o=o.return;while(o);return c}catch(b){return `
2026-03-07 01:56:14 +01:00
Error generating stack : ` +b.message+ `
2026-03-07 02:07:49 +01:00
` +b.stack}}var tn=Object.prototype.hasOwnProperty,yt=i.unstable_scheduleCallback,fe=i.unstable_cancelCallback,X=i.unstable_shouldYield,oe=i.unstable_requestPaint,Me=i.unstable_now,Fe=i.unstable_getCurrentPriorityLevel,ze=i.unstable_ImmediatePriority,Et=i.unstable_UserBlockingPriority,Rt=i.unstable_NormalPriority,Ht=i.unstable_LowPriority,Xt=i.unstable_IdlePriority,_t=i.log,Zt=i.unstable_setDisableYieldValue,sn=null,jt=null;function kt(o){if(typeof _t=="function"&&Zt(o),jt&&typeof jt.setStrictMode=="function")try{jt.setStrictMode(sn,o)}catch{}}var qt=Math.clz32?Math.clz32:ge,In=Math.log,Mi=Math.LN2;function ge(o){return o>>>=0,o===0?32:31-(In(o)/Mi|0)|0}var Wt=256,nt=262144,xt=4194304;function $ t(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 zt(o,c,m){var b=o.pendingLanes;if(b===0)return 0;var D=0,P=o.suspendedLanes, $ =o.pingedLanes;o=o.warmLanes;var re=b&134217727;return re!==0?(b=re&~P,b!==0?D= $ t(b):( $ &=re, $ !==0?D= $ t( $ ):m||(m=re&~o,m!==0&&(D= $ t(m))))):(re=b&~P,re!==0?D= $ t(re): $ !==0?D= $ t( $ ):m||(m=b&~o,m!==0&&(D= $ t(m)))),D===0?0:c!==0&&c!==D&&(c&P)===0&&(P=D&-D,m=c&-c,P>=m||P===32&&(m&4194048)!==0)?c:D}function xn(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function qi(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 rr(){var o=xt;return xt<<=1,(xt&62914560)===0&&(xt=4194304),o}function pn(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function $ i(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Jr(o,c,m,b,D,P){var $ =o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var re=o.entanglements,we=o.expirationTimes,Je=o.hiddenUpdates;for(m= $ &~m;0<m;){var ut=31-qt(m),St=1<<ut;re[ut]=0,we[ut]=-1;var et=Je[ut];if(et!==null)for(Je[ut]=null,ut=0;ut<et.length;ut++){var tt=et[ut];tt!==null&&(tt.lane&=-536870913)}m&=~St}b!==0&&Ze(o,b,0),P!==0&&D===0&&o.tag!==0&&(o.suspendedLanes|=P&~( $ &~c))}function Ze(o,c,m){o.pendingLanes|=c,o.suspendedLanes&=~c;var b=31-qt(c);o.entangledLanes|=c,o.entanglements[b]=o.entanglements[b]|1073741824|m&261930}function At(o,c){var m=o.entangledLanes|=c;for(o=o.entanglements;m;){var b=31-qt(m),D=1<<b;D&c|o[b]&c&&(o[b]|=c),m&=~D}}function Ot(o,c){var m=c&-c;return m=(m&42)!==0?1:st(m),(m&(o.suspendedLanes|c))!==0?0:m}function st(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 d(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function J(){var o=le.p;return o!==0?o:(o=window.event,o===void 0?32:CC(o.type))}function $ n(o,c){var m=le.p;try{return le.p=o,c()}finally{le.p=m}}var Gn=Math.random().toString(36).slice(2),Xn="__reactFiber $ "+Gn,un="__reactProps $ "+Gn,qn="__reactContainer $ "+Gn,Hs="__reactEvents $ "+Gn,li="__reactListeners $ "+Gn,Fn="__reactHandles $ "+Gn,cs="__reactResources $ "
` ).replace(jI,"")}function nC(o,c){return c=tC(c),tC(o)===c}function Ji(o,c,m,b,D,P){switch(m){case"children":typeof b=="string"?c==="body"||c==="textarea"&&b===""||pi(o,b):(typeof b=="number"||typeof b=="bigint")&&c!=="body"&&pi(o,""+b);break;case"className":_i(o,"class",b);break;case"tabIndex":_i(o,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":_i(o,m,b);break;case"style":Zh(o,b,P);break;case"data":if(c!=="object"){_i(o,"data",b);break}case"src":case"href":if(b===""&&(c!=="a"||m!=="href")){o.removeAttribute(m);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){o.removeAttribute(m);break}b=Wc(""+b),o.setAttribute(m,b);break;case"action":case"formAction":if(typeof b=="function"){o.setAttribute(m,"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 P=="function"&&(m==="formAction"?(c!=="input"&&Ji(o,c,"name",D.name,D,null),Ji(o,c,"formEncType",D.formEncType,D,null),Ji(o,c,"formMethod",D.formMethod,D,null),Ji(o,c,"formTarget",D.formTarget,D,null)):(Ji(o,c,"encType",D.encType,D,null),Ji(o,c,"method",D.method,D,null),Ji(o,c,"target",D.target,D,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){o.removeAttribute(m);break}b=Wc(""+b),o.setAttribute(m,b);break;case"onClick":b!=null&&(o.onclick=Po);break;case"onScroll":b!=null&&vi("scroll",o);break;case"onScrollEnd":b!=null&&vi("scrollend",o);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(m=b.__html,m!=null){if(D.children!=null)throw Error(n(60));o.innerHTML=m}}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}m=Wc(""+b),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);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(m,""+b):o.removeAttribute(m);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(m,""):o.removeAttribute(m);break;case"capture":case"download":b===!0?o.setAttribute(m,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(m,b):o.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?o.setAttribute(m,b):o.removeAttribute(m);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?o.removeAttribute(m):o.setAttribute(m,b);break;case"popover":vi("beforetoggle",o),vi("toggle",o),ci(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-07 01:56:14 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
2026-03-07 02:07:49 +01:00
* / c o n s t V 0 = " 1 7 2 " , X o = { R O T A T E : 0 , D O L L Y : 1 , P A N : 2 } , G d = { 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 } , S 7 = 0 , V S = 1 , T 7 = 2 , U F = 0 , y w = 1 , B F = 2 , x o = 3 , N l = 0 , h r = 1 , a s = 2 , Q a = 0 , K a = 1 , a 0 = 2 , o 0 = 3 , l 0 = 4 , x w = 5 , E o = 1 0 0 , b w = 1 0 1 , S w = 1 0 2 , w 7 = 1 0 3 , M 7 = 1 0 4 , T w = 2 0 0 , w w = 2 0 1 , M w = 2 0 2 , E w = 2 0 3 , q m = 2 0 4 , V m = 2 0 5 , C w = 2 0 6 , R w = 2 0 7 , N w = 2 0 8 , D w = 2 0 9 , P w = 2 1 0 , O F = 2 1 1 , I F = 2 1 2 , F F = 2 1 3 , k F = 2 1 4 , H m = 0 , j m = 1 , W m = 2 , k h = 3 , $ m = 4 , X m = 5 , Y m = 6 , Q m = 7 , L g = 0 , E 7 = 1 , C 7 = 2 , Z a = 0 , R 7 = 1 , N 7 = 2 , D 7 = 3 , P 7 = 4 , z F = 5 , L 7 = 6 , U 7 = 7 , L w = 3 0 0 , Q o = 3 0 1 , K o = 3 0 2 , z h = 3 0 3 , G h = 3 0 4 , s A = 3 0 6 , a A = 1 e 3 , e u = 1 0 0 1 , o A = 1 0 0 2 , m r = 1 0 0 3 , s _ = 1 0 0 4 , t u = 1 0 0 5 , g s = 1 0 0 6 , J d = 1 0 0 7 , V a = 1 0 0 8 , G F = 1 0 0 8 , a a = 1 0 0 9 , Q f = 1 0 1 0 , K f = 1 0 1 1 , w l = 1 0 1 2 , N s = 1 0 1 3 , R r = 1 0 1 4 , $ r = 1 0 1 5 , G s = 1 0 1 6 , A y = 1 0 1 7 , d y = 1 0 1 8 , A u = 1 0 2 0 , p y = 3 5 9 0 2 , U w = 1 0 2 1 , U g = 1 0 2 2 , k s = 1 0 2 3 , B w = 1 0 2 4 , O w = 1 0 2 5 , a u = 1 0 2 6 , d u = 1 0 2 7 , B g = 1 0 2 8 , H 0 = 1 0 2 9 , l A = 1 0 3 0 , j 0 = 1 0 3 1 , q F = 1 0 3 2 , W 0 = 1 0 3 3 , Z f = 3 3 7 7 6 , B h = 3 3 7 7 7 , O h = 3 3 7 7 8 , I h = 3 3 7 7 9 , K m = 3 5 8 4 0 , Z m = 3 5 8 4 1 , J m = 3 5 8 4 2 , e g = 3 5 8 4 3 , t g = 3 6 1 9 6 , u 0 = 3 7 4 9 2 , c 0 = 3 7 4 9 6 , h 0 = 3 7 8 0 8 , f 0 = 3 7 8 0 9 , A 0 = 3 7 8 1 0 , d 0 = 3 7 8 1 1 , p 0 = 3 7 8 1 2 , m 0 = 3 7 8 1 3 , g 0 = 3 7 8 1 4 , v 0 = 3 7 8 1 5 , _ 0 = 3 7 8 1 6 , y 0 = 3 7 8 1 7 , x 0 = 3 7 8 1 8 , b 0 = 3 7 8 1 9 , S 0 = 3 7 8 2 0 , T 0 = 3 7 8 2 1 , J f = 3 6 4 9 2 , H S = 3 6 4 9 4 , j S = 3 6 4 9 5 , I w = 3 6 2 8 3 , n g = 3 6 2 8 4 , i g = 3 6 2 8 5 , r g = 3 6 2 8 6 , V F = 0 , H F = 1 , j C = 2 , j F = 3 2 0 0 , W F = 3 2 0 1 , D c = 0 , B 7 = 1 , C o = " " , _ n = " s r g b " , R o = " s r g b - l i n e a r " , a _ = " l i n e a r " , V i = " s r g b " , $ F = 0 , U f = 7 6 8 0 , X F = 7 6 8 1 , Y F = 7 6 8 2 , Q F = 7 6 8 3 , K F = 3 4 0 5 5 , Z F = 3 4 0 5 6 , J F = 5 3 8 6 , e k = 5 1 2 , t k = 5 1 3 , n k = 5 1 4 , i k = 5 1 5 , r k = 5 1 6 , s k = 5 1 7 , a k = 5 1 8 , W S = 5 1 9 , F w = 5 1 2 , m y = 5 1 3 , k w = 5 1 4 , g y = 5 1 5 , z w = 5 1 6 , G w = 5 1 7 , q w = 5 1 8 , V w = 5 1 9 , o _ = 3 5 0 4 4 , q d = 3 5 0 4 8 , W C = " 3 0 0 e s " , H a = 2 e 3 , p u = 2 0 0 1 ; c l a s s z 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 J 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 $ C = 1 2 3 4 5 6 7 ; c o n s t E m = M a t h . P I / 1 8 0 , w 0 = 1 8 0 / M a t h . P I ; f u n c t i o n o 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 ( J s [ i & 2 5 5 ] + J s [ i > > 8 & 2 5 5 ] + J s [ i > > 1 6 & 2 5 5 ] + J s [ i > > 2 4 & 2 5 5 ] + " - " + J s [ e & 2 5 5 ] + J s [ e > > 8 & 2 5 5 ] + " - " + J s [ e > > 1 6 & 1 5 | 6 4 ] + J s [ e > > 2 4 & 2 5 5 ] + " - " + J s [ t & 6 3 | 1 2 8 ] + J s [ t > > 8 & 2 5 5 ] + " - " + J s [ t > > 1 6 & 2 5 5 ] + J s [ t > > 2 4 & 2 5 5 ] + J s [ n & 2 5 5 ] + J s [ n > > 8 & 2 5 5 ] + J s [ n > > 1 6 & 2 5 5 ] + J 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 n 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 H w ( i , e ) { r e t u r n ( i % e + e ) % e } f u n c t i o n o 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 l 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 C m ( i , e , t ) { r e t u r n ( 1 - t ) * i + t * e } f u n c t i o n u k ( i , e , t , n ) { r e t u r n C m ( i , e , 1 - M a t h . e x p ( - t * n ) ) } f u n c t i o n c k ( i , e = 1 ) { r e t u r n e - M a t h . a b s ( H w ( i , e * 2 ) - e ) } f u n c t i o n h 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 f k ( i , e ,
2026-03-07 01:56:14 +01:00
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
} ` ,Hk= ` void main ( ) {
gl _FragColor = vec4 ( 1.0 , 0.0 , 0.0 , 1.0 ) ;
2026-03-07 02:07:49 +01:00
} ` ;class Ja extends ua{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Vk,this.fragmentShader=Hk,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=E0(e.uniforms),this.uniformsGroups=qk(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 _y extends vr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kn,this.projectionMatrix=new kn,this.projectionMatrixInverse=new kn,this.coordinateSystem=Ha}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 yh=new ce,u5=new ft,c5=new ft;class ya extends _y{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=w0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Em*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return w0*2*Math.atan(Math.tan(Em*.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){yh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yh.x,yh.y).multiplyScalar(-e/yh.z),yh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(yh.x,yh.y).multiplyScalar(-e/yh.z)}getViewSize(e,t){return this.getViewBounds(e,u5,c5),t.subVectors(c5,u5)}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-07 01:56:14 +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-07 02:07:49 +01:00
` },r=new $ h(5,5,5),s=new Ja({name:"CubemapFromEquirect",uniforms:E0(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:hr,blending:Qa});s.uniforms.tEquirect.value=t;const a=new zi(r,s),l=t.minFilter;return t.minFilter===Va&&(t.minFilter=gs),new q7(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 Yw extends vr{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 la,this.environmentIntensity=1,this.environmentRotation=new la,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 Qw{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=o_,this.updateRanges=[],this.version=0,this.uuid=ou()}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=ou()),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=ou()),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 ga=new ce;class nu{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++)ga.fromBufferAttribute(this,t),ga.applyMatrix4(e),this.setXYZ(t,ga.x,ga.y,ga.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ga.fromBufferAttribute(this,t),ga.applyNormalMatrix(e),this.setXYZ(t,ga.x,ga.y,ga.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ga.fromBufferAttribute(this,t),ga.transformDirection
2026-03-07 01:56:14 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
* / f u n c t i o n o 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 Z z ( 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 , g = 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 , g ) , 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 g = 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 , g ) ; e l s e { v . s o r t ( ( S , w ) = > S . s t a r t - w . 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 w = v [ x ] , R = v [ S ] ; R . s t a r t < = w . s t a r t + w . c o u n t + 1 ? w . c o u n t = M a t h . m a x ( w . c o u n t , R . s t a r t + R . c o u n t - w . s t a r t ) : ( + + x , v [ x ] = R ) } v . l e n g t h = x + 1 ; f o r ( l e t S = 0 , w = v . l e n g t h ; S < w ; S + + ) { c o n s t R = v [ S ] ; i . b u f f e r S u b D a t a ( h , R . s t a r t * g . B Y T E S _ P E R _ E L E M E N T , g , R . s t a r t , R . 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 g = e . g e t ( l ) ; ( ! g | | g . 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 J z = ` # i f d e f U S E _ A L P H A H A S H
if ( diffuseColor . a < getAlphaHashThreshold ( vPosition ) ) discard ;
# endif ` ,eG= ` # 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 ` ,tG= ` # ifdef USE _ALPHAMAP
diffuseColor . a *= texture2D ( alphaMap , vAlphaMapUv ) . g ;
# endif ` ,nG= ` # ifdef USE _ALPHAMAP
uniform sampler2D alphaMap ;
# endif ` ,iG= ` # 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 ` ,rG= ` # ifdef USE _ALPHATEST
uniform float alphaTest ;
# endif ` ,sG= ` # 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 ` ,aG= ` # ifdef USE _AOMAP
uniform sampler2D aoMap ;
uniform float aoMapIntensity ;
# endif ` ,oG= ` # 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 ` ,lG= ` # ifdef USE _BATCHING
mat4 batchingMatrix = getBatchingMatrix ( getIndirectIndex ( gl _DrawID ) ) ;
# endif ` ,uG= ` vec3 transformed = vec3 ( position ) ;
# ifdef USE _ALPHAHASH
vPosition = vec3 ( position ) ;
# endif ` ,cG= ` vec3 objectNormal = vec3 ( normal ) ;
# ifdef USE _TANGENT
vec3 objectTangent = vec3 ( tangent . xyz ) ;
# endif ` ,hG= ` 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`,fG=`#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 ` ,AG= ` # 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 ` ,dG= ` # 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 ` ,pG= ` # if NUM _CLIPPING _PLANES > 0
varying vec3 vClipPosition ;
uniform vec4 clippingPlanes [ NUM _CLIPPING _PLANES ] ;
# endif ` ,mG= ` # if NUM _CLIPPING _PLANES > 0
varying vec3 vClipPosition ;
# endif ` ,gG= ` # if NUM _CLIPPING _PLANES > 0
vClipPosition = - mvPosition . xyz ;
# endif ` ,vG= ` # if defined ( USE _COLOR _ALPHA )
diffuseColor *= vColor ;
# elif defined ( USE _COLOR )
diffuseColor . rgb *= vColor ;
# endif ` ,_G= ` # if defined ( USE _COLOR _ALPHA )
varying vec4 vColor ;
# elif defined ( USE _COLOR )
varying vec3 vColor ;
# endif ` ,yG= ` # if defined ( USE _COLOR _ALPHA )
varying vec4 vColor ;
# elif defined ( USE _COLOR ) || defined ( USE _INSTANCING _COLOR ) || defined ( USE _BATCHING _COLOR )
varying vec3 vColor ;
# endif ` ,xG= ` # 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 ` ,bG= ` # 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`,SG=`#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 ` ,TG= ` 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 ` ,wG= ` # ifdef USE _DISPLACEMENTMAP
uniform sampler2D displacementMap ;
uniform float displacementScale ;
uniform float displacementBias ;
# endif ` ,MG= ` # ifdef USE _DISPLACEMENTMAP
transformed += normalize ( objectNormal ) * ( texture2D ( displacementMap , vDisplacementMapUv ) . x * displacementScale + displacementBias ) ;
# endif ` ,EG= ` # ifdef USE _EMISSIVEMAP
vec4 emissiveColor = texture2D ( emissiveMap , vEmissiveMapUv ) ;
# ifdef DECODE _VIDEO _TEXTURE _EMISSIVE
emissiveColor = sRGBTransferEOTF ( emissiveColor ) ;
# endif
totalEmissiveRadiance *= emissiveColor . rgb ;
# endif ` ,CG= ` # ifdef USE _EMISSIVEMAP
uniform sampler2D emissiveMap ;
# endif ` ,RG="gl_FragColor = linearToOutputTexel( gl_FragColor );",NG= ` 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 ) ;
} ` ,DG= ` # 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 ` ,PG= ` # 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 ` ,LG= ` # 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 ` ,UG= ` # 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 ` ,BG= ` # 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 ` ,OG= ` # ifdef USE _FOG
vFogDepth = - mvPosition . z ;
# endif ` ,IG= ` # ifdef USE _FOG
varying float vFogDepth ;
# endif ` ,FG= ` # 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 ` ,kG= ` # ifdef USE _FOG
uniform vec3 fogColor ;
varying float vFogDepth ;
# ifdef FOG _EXP2
uniform float fogDensity ;
# else
uniform float fogNear ;
uniform float fogFar ;
# endif
# endif ` ,zG= ` # 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
} ` ,GG= ` # ifdef USE _LIGHTMAP
uniform sampler2D lightMap ;
uniform float lightMapIntensity ;
# endif ` ,qG= ` LambertMaterial material ;
material . diffuseColor = diffuseColor . rgb ;
material . specularStrength = specularStrength ; ` ,VG= ` 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 ` ,HG= ` 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 ` ,jG= ` # 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 ` ,WG= ` ToonMaterial material ;
material . diffuseColor = diffuseColor . rgb ; ` , $ G= ` 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 ` ,XG= ` BlinnPhongMaterial material ;
material . diffuseColor = diffuseColor . rgb ;
material . specularColor = specular ;
material . specularShininess = shininess ;
material . specularStrength = specularStrength ; ` ,YG= ` 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 ` ,QG= ` 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 ` ,KG= ` 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 ) ;
} ` ,ZG= `
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 ` ,JG= ` # 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 ` ,eq= ` # 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 ` ,tq= ` # if defined ( USE _LOGDEPTHBUF )
gl _FragDepth = vIsPerspective == 0.0 ? gl _FragCoord . z : log2 ( vFragDepth ) * logDepthBufFC * 0.5 ;
# endif ` ,nq= ` # if defined ( USE _LOGDEPTHBUF )
uniform float logDepthBufFC ;
varying float vFragDepth ;
varying float vIsPerspective ;
# endif ` ,iq= ` # ifdef USE _LOGDEPTHBUF
varying float vFragDepth ;
varying float vIsPerspective ;
# endif ` ,rq= ` # ifdef USE _LOGDEPTHBUF
vFragDepth = 1.0 + gl _Position . w ;
vIsPerspective = float ( isPerspectiveMatrix ( projectionMatrix ) ) ;
# endif ` ,sq= ` # ifdef USE _MAP
vec4 sampledDiffuseColor = texture2D ( map , vMapUv ) ;
# ifdef DECODE _VIDEO _TEXTURE
sampledDiffuseColor = sRGBTransferEOTF ( sampledDiffuseColor ) ;
# endif
diffuseColor *= sampledDiffuseColor ;
# endif ` ,aq= ` # ifdef USE _MAP
uniform sampler2D map ;
# endif ` ,oq= ` # 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 ` ,lq= ` # 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 ` ,uq= ` float metalnessFactor = metalness ;
# ifdef USE _METALNESSMAP
vec4 texelMetalness = texture2D ( metalnessMap , vMetalnessMapUv ) ;
metalnessFactor *= texelMetalness . b ;
# endif ` ,cq= ` # ifdef USE _METALNESSMAP
uniform sampler2D metalnessMap ;
# endif ` ,hq= ` # 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 ` ,fq= ` # 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 ` ,Aq= ` # 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 ` ,dq= ` # 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 ` ,pq= ` # 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 ` ,mq= ` 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 ; ` ,gq= ` # 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 ` ,vq= ` # ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif ` ,_q= ` # ifndef FLAT _SHADED
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
# endif ` ,yq= ` # ifndef FLAT _SHADED
vNormal = normalize ( transformedNormal ) ;
# ifdef USE _TANGENT
vTangent = normalize ( transformedTangent ) ;
vBitangent = normalize ( cross ( vNormal , vTangent ) * tangent . w ) ;
# endif
# endif ` ,xq= ` # 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 ` ,bq= ` # ifdef USE _CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal ;
# endif ` ,Sq= ` # ifdef USE _CLEARCOAT _NORMALMAP
vec3 clearcoatMapN = texture2D ( clearcoatNormalMap , vClearcoatNormalMapUv ) . xyz * 2.0 - 1.0 ;
clearcoatMapN . xy *= clearcoatNormalScale ;
clearcoatNormal = normalize ( tbn2 * clearcoatMapN ) ;
# endif ` ,Tq= ` # 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 ` ,wq= ` # ifdef USE _IRIDESCENCEMAP
uniform sampler2D iridescenceMap ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
uniform sampler2D iridescenceThicknessMap ;
# endif ` ,Mq= ` # ifdef OPAQUE
diffuseColor . a = 1.0 ;
# endif
# ifdef USE _TRANSMISSION
diffuseColor . a *= material . transmissionAlpha ;
# endif
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ; ` ,Eq= ` 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 ) ;
} ` ,Cq= ` # ifdef PREMULTIPLIED _ALPHA
gl _FragColor . rgb *= gl _FragColor . a ;
# endif ` ,Rq= ` 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 ; ` ,Nq= ` # ifdef DITHERING
gl _FragColor . rgb = dithering ( gl _FragColor . rgb ) ;
# endif ` ,Dq= ` # 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 ` ,Pq= ` float roughnessFactor = roughness ;
# ifdef USE _ROUGHNESSMAP
vec4 texelRoughness = texture2D ( roughnessMap , vRoughnessMapUv ) ;
roughnessFactor *= texelRoughness . g ;
# endif ` ,Lq= ` # ifdef USE _ROUGHNESSMAP
uniform sampler2D roughnessMap ;
# endif ` ,Uq= ` # 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 ` ,Bq= ` # 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 ` ,Oq= ` # 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 ` ,Iq= ` 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 ;
} ` ,Fq= ` # ifdef USE _SKINNING
mat4 boneMatX = getBoneMatrix ( skinIndex . x ) ;
mat4 boneMatY = getBoneMatrix ( skinIndex . y ) ;
mat4 boneMatZ = getBoneMatrix ( skinIndex . z ) ;
mat4 boneMatW = getBoneMatrix ( skinIndex . w ) ;
# endif ` ,kq= ` # 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 ` ,zq= ` # 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 ` ,Gq= ` # 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 ` ,qq= ` float specularStrength ;
# ifdef USE _SPECULARMAP
vec4 texelSpecular = texture2D ( specularMap , vSpecularMapUv ) ;
specularStrength = texelSpecular . r ;
# else
specularStrength = 1.0 ;
# endif ` ,Vq= ` # ifdef USE _SPECULARMAP
uniform sampler2D specularMap ;
# endif ` ,Hq= ` # if defined ( TONE _MAPPING )
gl _FragColor . rgb = toneMapping ( gl _FragColor . rgb ) ;
# endif ` ,jq= ` # 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 ; } ` ,Wq= ` # 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 ` , $ q= ` # 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 ` ,Xq= ` # 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 ` ,Yq= ` # 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 ` ,Qq= ` # 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 ` ,Kq= ` # 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 Zq= ` varying vec2 vUv ;
uniform mat3 uvTransform ;
void main ( ) {
vUv = ( uvTransform * vec3 ( uv , 1 ) ) . xy ;
gl _Position = vec4 ( position . xy , 1.0 , 1.0 ) ;
} ` ,Jq= ` 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 >
} ` ,eV= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
} ` ,tV= ` # 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 >
} ` ,nV= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
} ` ,iV= ` 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 >
} ` ,rV= ` # 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 ;
} ` ,sV= ` # 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
} ` ,aV= ` # 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 ;
} ` ,oV= ` # 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 ) ;
} ` ,lV= ` varying vec3 vWorldDirection ;
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
} ` ,uV= ` 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 >
} ` ,cV= ` 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 >
} ` ,hV= ` 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 >
} ` ,fV= ` # 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 >
} ` ,AV= ` 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 >
} ` ,dV= ` # 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 >
} ` ,pV= ` # 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 >
} ` ,mV= ` # 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 ;
} ` ,gV= ` # 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 >
} ` ,vV= ` # 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
} ` ,_V= ` # 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
} ` ,yV= ` # 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 >
} ` ,xV= ` # 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 >
} ` ,bV= ` # 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
} ` ,SV= ` # 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 >
} ` ,TV= ` # 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 >
} ` ,wV= ` # 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 >
} ` ,MV= ` 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 >
} ` ,EV= ` 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 >
} ` ,CV= ` # 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 >
} ` ,RV= ` 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 >
} ` ,NV= ` 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 >
} ` ,DV= ` 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-07 02:07:49 +01:00
} ` ,Zn={alphahash_fragment:Jz,alphahash_pars_fragment:eG,alphamap_fragment:tG,alphamap_pars_fragment:nG,alphatest_fragment:iG,alphatest_pars_fragment:rG,aomap_fragment:sG,aomap_pars_fragment:aG,batching_pars_vertex:oG,batching_vertex:lG,begin_vertex:uG,beginnormal_vertex:cG,bsdfs:hG,iridescence_fragment:fG,bumpmap_pars_fragment:AG,clipping_planes_fragment:dG,clipping_planes_pars_fragment:pG,clipping_planes_pars_vertex:mG,clipping_planes_vertex:gG,color_fragment:vG,color_pars_fragment:_G,color_pars_vertex:yG,color_vertex:xG,common:bG,cube_uv_reflection_fragment:SG,defaultnormal_vertex:TG,displacementmap_pars_vertex:wG,displacementmap_vertex:MG,emissivemap_fragment:EG,emissivemap_pars_fragment:CG,colorspace_fragment:RG,colorspace_pars_fragment:NG,envmap_fragment:DG,envmap_common_pars_fragment:PG,envmap_pars_fragment:LG,envmap_pars_vertex:UG,envmap_physical_pars_fragment:jG,envmap_vertex:BG,fog_vertex:OG,fog_pars_vertex:IG,fog_fragment:FG,fog_pars_fragment:kG,gradientmap_pars_fragment:zG,lightmap_pars_fragment:GG,lights_lambert_fragment:qG,lights_lambert_pars_fragment:VG,lights_pars_begin:HG,lights_toon_fragment:WG,lights_toon_pars_fragment: $ G,lights_phong_fragment:XG,lights_phong_pars_fragment:YG,lights_physical_fragment:QG,lights_physical_pars_fragment:KG,lights_fragment_begin:ZG,lights_fragment_maps:JG,lights_fragment_end:eq,logdepthbuf_fragment:tq,logdepthbuf_pars_fragment:nq,logdepthbuf_pars_vertex:iq,logdepthbuf_vertex:rq,map_fragment:sq,map_pars_fragment:aq,map_particle_fragment:oq,map_particle_pars_fragment:lq,metalnessmap_fragment:uq,metalnessmap_pars_fragment:cq,morphinstance_vertex:hq,morphcolor_vertex:fq,morphnormal_vertex:Aq,morphtarget_pars_vertex:dq,morphtarget_vertex:pq,normal_fragment_begin:mq,normal_fragment_maps:gq,normal_pars_fragment:vq,normal_pars_vertex:_q,normal_vertex:yq,normalmap_pars_fragment:xq,clearcoat_normal_fragment_begin:bq,clearcoat_normal_fragment_maps:Sq,clearcoat_pars_fragment:Tq,iridescence_pars_fragment:wq,opaque_fragment:Mq,packing:Eq,premultiplied_alpha_fragment:Cq,project_vertex:Rq,dithering_fragment:Nq,dithering_pars_fragment:Dq,roughnessmap_fragment:Pq,roughnessmap_pars_fragment:Lq,shadowmap_pars_fragment:Uq,shadowmap_pars_vertex:Bq,shadowmap_vertex:Oq,shadowmask_pars_fragment:Iq,skinbase_vertex:Fq,skinning_pars_vertex:kq,skinning_vertex:zq,skinnormal_vertex:Gq,specularmap_fragment:qq,specularmap_pars_fragment:Vq,tonemapping_fragment:Hq,tonemapping_pars_fragment:jq,transmission_fragment:Wq,transmission_pars_fragment: $ q,uv_pars_fragment:Xq,uv_pars_vertex:Yq,uv_vertex:Qq,worldpos_vertex:Kq,background_vert:Zq,background_frag:Jq,backgroundCube_vert:eV,backgroundCube_frag:tV,cube_vert:nV,cube_frag:iV,depth_vert:rV,depth_frag:sV,distanceRGBA_vert:aV,distanceRGBA_frag:oV,equirect_vert:lV,equirect_frag:uV,linedashed_vert:cV,linedashed_frag:hV,meshbasic_vert:fV,meshbasic_frag:AV,meshlambert_vert:dV,meshlambert_frag:pV,meshmatcap_vert:mV,meshmatcap_frag:gV,meshnormal_vert:vV,meshnormal_frag:_V,meshphong_vert:yV,meshphong_frag:xV,meshphysical_vert:bV,meshphysical_frag:SV,meshtoon_vert:TV,meshtoon_frag:wV,points_vert:MV,points_frag:EV,shadow_vert:CV,shadow_frag:RV,sprite_vert:NV,sprite_frag:DV},Qt={common:{diffuse:{value:new an(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vn}},envmap:{envMap:{value:null},envMapRotation:{value:new Vn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vn},normalScale:{value:new ft(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vn},displacementScale:{value:1},displacementBias:{value:0}},emissi
2026-03-07 01:56:14 +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 ) ;
}
}
2026-03-07 02:07:49 +01:00
` ,blending:Qa,depthTest:!1,depthWrite:!1})}function I5(){return new Ja({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:oM(),fragmentShader: `
2026-03-07 01:56:14 +01:00
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 ) ;
}
2026-03-07 02:07:49 +01:00
` ,blending:Qa,depthTest:!1,depthWrite:!1})}function F5(){return new Ja({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:oM(),fragmentShader: `
2026-03-07 01:56:14 +01:00
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:Qa,depthTest:!1,depthWrite:!1})}function oM(){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-07 02:07:49 +01:00
` }function GV(i){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,h=u===zh||u===Gh,g=u===Qo||u===Ko;if(h||g){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 B5(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||g&&S&&r(S)?(t===null&&(t=new B5(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 g=0;g<h;g++)l[g]!==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 qV(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&&kf("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function VV(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 w in x.attributes)e.remove(x.attributes[w]);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,w=v.attributes.position;let R=0;if(S!==null){const B=S.array;R=S.version;for(let L=0,O=B.length;L<O;L+=3){const z=B[L+0],G=B[L+1],k=B[L+2];x.push(z,G,G,k,k,z)}}else if(w!==void 0){const B=w.array;R=w.version;for(let L=0,O=B.length/3-1;L<O;L+=3){const z=L+0,G=L+1,k=L+2;x.push(z,G,G,k,k,z)}}else return;const C=new(O7(x)?Xw: $ w)(x,1);C.version=R;const E=s.get(v);E&&e.remove(E),s.set(v,C)}function g(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:g}}function HV(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,w){w!==0&&(i.drawElementsInstanced(n,S,s,x*a,w),t.update(S,n,w))}function g(x,S,w){if(w===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,S,0,s,x,0,w);let C=0;for(let E=0;E<w;E++)C+=S[E];t.update(C,n,1)}function v(x,S,w,R){if(w===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],R[E]);else{C.multiDrawElementsInstancedWEBGL(n,S,0,s,x,0,R,0,w);let E=0;for(let B=0;B<w;B++)E+=S[B]*R[B];t.update(E,n,1)}}this.setMode=r,this.setIndex=l,this.render=u,this.renderInstances=h,this.renderMultiDraw=g,this.renderMultiDrawInstances=v}function jV(i){const e={geometries:0,textures:0},t={fra
2026-03-07 01:56:14 +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( `
2026-03-07 02:07:49 +01:00
` )}const $ 5=new Vn;function GH(i){ai._getMatrix( $ 5,ai.workingColorSpace,i);const e= ` mat3 ( $ { $5 . elements . map ( t => t . toFixed ( 4 ) ) } ) ` ;switch(ai.getTransfer(i)){case a_:return[e,"LinearTransferOETF"];case Vi:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function X5(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()+ `
2026-03-07 01:56:14 +01:00
` +r+ `
` +zH(i.getShaderSource(e),a)}else return r}function qH(i,e){const t=GH(e);return[ ` vec4 $ { i } ( vec4 value ) { ` , ` return $ { t [ 1 ] } ( vec4 ( value . rgb * $ { t [ 0 ] } , value . a ) ) ; ` ,"}"].join( `
2026-03-07 02:07:49 +01:00
` )}function VH(i,e){let t;switch(e){case R7:t="Linear";break;case N7:t="Reinhard";break;case D7:t="Cineon";break;case P7:t="ACESFilmic";break;case L7:t="AgX";break;case U7:t="Neutral";break;case zF:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const $ 2=new ce;function HH(){ai.getLuminanceCoefficients( $ 2);const i= $ 2.x.toFixed(4),e= $ 2.y.toFixed(4),t= $ 2.z.toFixed(4);return["float luminance( const in vec3 rgb ) {", ` const vec3 weights = vec3 ( $ { i } , $ { e } , $ { t } ) ; ` ," return dot( weights, rgb );","}"].join( `
2026-03-07 01:56:14 +01:00
` )}function jH(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_m).join( `
` )}function WH(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join( `
2026-03-07 02:07:49 +01:00
` )}function $ H(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 _m(i){return i!==""}function Y5(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 Q5(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const XH=/^[ \t ]*#include +<([ \w \d ./]+)>/gm;function ZS(i){return i.replace(XH,QH)}const YH=new Map;function QH(i,e){let t=Zn[e];if(t===void 0){const n=YH.get(e);if(n!==void 0)t=Zn[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 ZS(t)}const KH=/#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 K5(i){return i.replace(KH,ZH)}function ZH(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 Z5(i){let e= ` precision $ { i . precision } float ;
2026-03-07 01:56:14 +01:00
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 JH(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===yw?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===BF?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===xo&&(e="SHADOWMAP_TYPE_VSM"),e}function ej(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Qo:case Ko:e="ENVMAP_TYPE_CUBE";break;case sA:e="ENVMAP_TYPE_CUBE_UV";break}return e}function tj(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Ko:e="ENVMAP_MODE_REFRACTION";break}return e}function nj(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Lg:e="ENVMAP_BLENDING_MULTIPLY";break;case E7:e="ENVMAP_BLENDING_MIX";break;case C7:e="ENVMAP_BLENDING_ADD";break}return e}function ij(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 rj(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,l=t.fragmentShader;const u=JH(t),h=ej(t),g=tj(t),v=nj(t),x=ij(t),S=jH(t),w=WH(s),R=r.createProgram();let C,E,B=t.glslVersion?"#version "+t.glslVersion+ `
` :"";t.isRawShaderMaterial?(C=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(_m).join( `
` ),C.length>0&&(C+= `
` ),E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(_m).join( `
` ),E.length>0&&(E+= `
2026-03-07 02:07:49 +01:00
` )):(C=[Z5(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,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 "+g:"",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":"",
2026-03-07 01:56:14 +01:00
` ].filter(_m).join( `
2026-03-07 02:07:49 +01:00
` ),E=[Z5(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,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 "+g:"",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!==Za?"#define TONE_MAPPING":"",t.toneMapping!==Za?Zn.tonemapping_pars_fragment:"",t.toneMapping!==Za?VH("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Zn.colorspace_pars_fragment,qH("linearToOutputTexel",t.outputColorSpace),HH(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"", `
2026-03-07 01:56:14 +01:00
` ].filter(_m).join( `
2026-03-07 02:07:49 +01:00
` )),a=ZS(a),a=Y5(a,t),a=Q5(a,t),l=ZS(l),l=Y5(l,t),l=Q5(l,t),a=K5(a),l=K5(l),t.isRawShaderMaterial!==!0&&(B= ` # version 300 es
2026-03-07 01:56:14 +01:00
` ,C=[S,"#define attribute in","#define varying out","#define texture2D texture"].join( `
` )+ `
2026-03-07 02:07:49 +01:00
` +C,E=["#define varying in",t.glslVersion===WC?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===WC?"":"#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-07 01:56:14 +01:00
` )+ `
2026-03-07 02:07:49 +01:00
` +E);const L=B+C+a,O=B+E+l,z=W5(r,r.VERTEX_SHADER,L),G=W5(r,r.FRAGMENT_SHADER,O);r.attachShader(R,z),r.attachShader(R,G),t.index0AttributeName!==void 0?r.bindAttribLocation(R,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(R,0,"position"),r.linkProgram(R);function k(Y){if(i.debug.checkShaderErrors){const ee=r.getProgramInfoLog(R).trim(),ne=r.getShaderInfoLog(z).trim(),se=r.getShaderInfoLog(G).trim();let te=!0,Q=!0;if(r.getProgramParameter(R,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,R,z,G);else{const le=X5(r,z,"vertex"),de=X5(r,G,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(R,r.VALIDATE_STATUS)+ `
2026-03-07 01:56:14 +01:00
Material Name : ` +Y.name+ `
Material Type : ` +Y.type+ `
Program Info Log : ` +ee+ `
2026-03-07 02:07:49 +01:00
` +le+ `
` +de)}else ee!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ee):(ne===""||se==="")&&(Q=!1);Q&&(Y.diagnostics={runnable:te,programLog:ee,vertexShader:{log:ne,prefix:C},fragmentShader:{log:se,prefix:E}})}r.deleteShader(z),r.deleteShader(G),H=new qv(r,R),F= $ H(r,R)}let H;this.getUniforms=function(){return H===void 0&&k(this),H};let F;this.getAttributes=function(){return F===void 0&&k(this),F};let V=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(R,FH)),V},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(R),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=kH++,this.cacheKey=e,this.usedTimes=1,this.program=R,this.vertexShader=z,this.fragmentShader=G,this}let sj=0;class aj{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 oj(e),t.set(e,n)),n}}class oj{constructor(e){this.id=sj++,this.code=e,this.usedTimes=0}}function lj(i,e,t,n,r,s,a){const l=new Ww,u=new aj,h=new Set,g=[],v=r.logarithmicDepthBuffer,x=r.vertexTextures;let S=r.precision;const w={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 R(F){return h.add(F),F===0?"uv": ` uv$ { F } ` }function C(F,V,Y,ee,ne){const se=ee.fog,te=ne.geometry,Q=F.isMeshStandardMaterial?ee.environment:null,le=(F.isMeshStandardMaterial?t:e).get(F.envMap||Q),de=le&&le.mapping===sA?le.image.height:null,Te=w[F.type];F.precision!==null&&(S=r.getMaxPrecision(F.precision),S!==F.precision&&console.warn("THREE.WebGLProgram.getParameters:",F.precision,"not supported, using",S,"instead."));const Se=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,ue=Se!==void 0?Se.length:0;let be=0;te.morphAttributes.position!==void 0&&(be=1),te.morphAttributes.normal!==void 0&&(be=2),te.morphAttributes.color!==void 0&&(be=3);let We,Ee,Ge,ye;if(Te){const pn=Ga[Te];We=pn.vertexShader,Ee=pn.fragmentShader}else We=F.vertexShader,Ee=F.fragmentShader,u.update(F),Ge=u.getVertexShaderID(F),ye=u.getFragmentShaderID(F);const Pe=i.getRenderTarget(),pt=i.state.buffers.depth.getReversed(),vt=ne.isInstancedMesh===!0,Tt=ne.isBatchedMesh===!0,It=!!F.map,Qe=!!F.matcap,it=!!le,he=!!F.aoMap,Ft=!!F.lightMap,ct=!!F.bumpMap,Dt=!!F.normalMap,gt=!!F.displacementMap,tn=!!F.emissiveMap,yt=!!F.metalnessMap,fe=!!F.roughnessMap,X=F.anisotropy>0,oe=F.clearcoat>0,Me=F.dispersion>0,Fe=F.iridescence>0,ze=F.sheen>0,Et=F.transmission>0,Rt=X&&!!F.anisotropyMap,Ht=oe&&!!F.clearcoatMap,Xt=oe&&!!F.clearcoatNormalMap,_t=oe&&!!F.clearcoatRoughnessMap,Zt=Fe&&!!F.iridescenceMap,sn=Fe&&!!F.iridescenceThicknessMap,jt=ze&&!!F.sheenColorMap,kt=ze&&!!F.sheenRoughnessMap,qt=!!F.specularMap,In=!!F.specularColorMap,Mi=!!F.specularIntensityMap,ge=Et&&!!F.transmissionMap,Wt=Et&&!!F.thicknessMap,nt=!!F.gradientMap,xt=!!F.alphaMap, $ t=F.alphaTest>0,zt=!!F.alphaHash,xn=!!F.extensions;let qi=Za;F.toneMapped&&(Pe===null||Pe.isXRRenderTarget===!0)&&(qi=i.tone
2026-03-07 01:56:14 +01:00
gl _Position = vec4 ( position , 1.0 ) ;
} ` ,_j= ` 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-07 02:07:49 +01:00
} ` ;function yj(i,e,t){let n=new Fg;const r=new ft,s=new ft,a=new Pn,l=new Dz({depthPacking:WF}),u=new Pz,h={},g=t.maxTextureSize,v={[Nl]:hr,[hr]:Nl,[as]:as},x=new Ja({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ft},radius:{value:4}},vertexShader:vj,fragmentShader:_j}),S=x.clone();S.defines.HORIZONTAL_PASS=1;const w=new Ki;w.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const R=new zi(w,x),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=yw;let E=this.type;this.render=function(G,k,H){if(C.enabled===!1||C.autoUpdate===!1&&C.needsUpdate===!1||G.length===0)return;const F=i.getRenderTarget(),V=i.getActiveCubeFace(),Y=i.getActiveMipmapLevel(),ee=i.state;ee.setBlending(Qa),ee.buffers.color.setClear(1,1,1,1),ee.buffers.depth.setTest(!0),ee.setScissorTest(!1);const ne=E!==xo&&this.type===xo,se=E===xo&&this.type!==xo;for(let te=0,Q=G.length;te<Q;te++){const le=G[te],de=le.shadow;if(de===void 0){console.warn("THREE.WebGLShadowMap:",le,"has no shadow.");continue}if(de.autoUpdate===!1&&de.needsUpdate===!1)continue;r.copy(de.mapSize);const Te=de.getFrameExtents();if(r.multiply(Te),s.copy(de.mapSize),(r.x>g||r.y>g)&&(r.x>g&&(s.x=Math.floor(g/Te.x),r.x=s.x*Te.x,de.mapSize.x=s.x),r.y>g&&(s.y=Math.floor(g/Te.y),r.y=s.y*Te.y,de.mapSize.y=s.y)),de.map===null||ne===!0||se===!0){const ue=this.type!==xo?{minFilter:mr,magFilter:mr}:{};de.map!==null&&de.map.dispose(),de.map=new qh(r.x,r.y,ue),de.map.texture.name=le.name+".shadowMap",de.camera.updateProjectionMatrix()}i.setRenderTarget(de.map),i.clear();const Se=de.getViewportCount();for(let ue=0;ue<Se;ue++){const be=de.getViewport(ue);a.set(s.x*be.x,s.y*be.y,s.x*be.z,s.y*be.w),ee.viewport(a),de.updateMatrices(le,ue),n=de.getFrustum(),O(k,H,de.camera,le,this.type)}de.isPointLightShadow!==!0&&this.type===xo&&B(de,H),de.needsUpdate=!1}E=this.type,C.needsUpdate=!1,i.setRenderTarget(F,V,Y)};function B(G,k){const H=e.update(R);x.defines.VSM_SAMPLES!==G.blurSamples&&(x.defines.VSM_SAMPLES=G.blurSamples,S.defines.VSM_SAMPLES=G.blurSamples,x.needsUpdate=!0,S.needsUpdate=!0),G.mapPass===null&&(G.mapPass=new qh(r.x,r.y)),x.uniforms.shadow_pass.value=G.map.texture,x.uniforms.resolution.value=G.mapSize,x.uniforms.radius.value=G.radius,i.setRenderTarget(G.mapPass),i.clear(),i.renderBufferDirect(k,null,H,x,R,null),S.uniforms.shadow_pass.value=G.mapPass.texture,S.uniforms.resolution.value=G.mapSize,S.uniforms.radius.value=G.radius,i.setRenderTarget(G.map),i.clear(),i.renderBufferDirect(k,null,H,S,R,null)}function L(G,k,H,F){let V=null;const Y=H.isPointLight===!0?G.customDistanceMaterial:G.customDepthMaterial;if(Y!==void 0)V=Y;else if(V=H.isPointLight===!0?u:l,i.localClippingEnabled&&k.clipShadows===!0&&Array.isArray(k.clippingPlanes)&&k.clippingPlanes.length!==0||k.displacementMap&&k.displacementScale!==0||k.alphaMap&&k.alphaTest>0||k.map&&k.alphaTest>0){const ee=V.uuid,ne=k.uuid;let se=h[ee];se===void 0&&(se={},h[ee]=se);let te=se[ne];te===void 0&&(te=V.clone(),se[ne]=te,k.addEventListener("dispose",z)),V=te}if(V.visible=k.visible,V.wireframe=k.wireframe,F===xo?V.side=k.shadowSide!==null?k.shadowSide:k.side:V.side=k.shadowSide!==null?k.shadowSide:v[k.side],V.alphaMap=k.alphaMap,V.alphaTest=k.alphaTest,V.map=k.map,V.clipShadows=k.clipShadows,V.clippingPlanes=k.clippingPlanes,V.clipIntersection=k.clipIntersection,V.displacementMap=k.displacementMap,V.displacementScale=k.displacementScale,V.displacementBias=k.displacementBias,V.wireframeLinewidth=k.wireframeLinewidth,V.linewidth=k.linewidth,H.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const ee=i.properties.get(V);ee.light=H}return V}function O(G,k,H,F,V){if(G.visible===!1)return;if(G.layers.test(k.layers)&&(G.isMesh||G.isLine||G.isPoints)&&(G.castShadow||G.receiveShadow&&V===xo)&&(!G.frustumCulled||n.intersectsObject(G))){G.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,G.matrixWorld);const ne=e.update(G),se=G.material;if(Array.isArray(se)){const te=ne.groups;for(let Q=0,le=te.length;Q<le;Q++){const de=te[Q],Te=se[de.materialIndex];if(Te&&Te.visible){const
2026-03-07 01:56:14 +01:00
void main ( ) {
gl _Position = vec4 ( position , 1.0 ) ;
} ` ,Ej= `
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-07 02:07:49 +01:00
} ` ;class Cj{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new vs,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 Ja({vertexShader:Mj,fragmentShader:Ej,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new zi(new Ty(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Rj extends zc{constructor(e,t){super();const n=this;let r=null,s=1,a=null,l="local-floor",u=1,h=null,g=null,v=null,x=null,S=null,w=null;const R=new Cj,C=t.getContextAttributes();let E=null,B=null;const L=[],O=[],z=new ft;let G=null;const k=new ya;k.viewport=new Pn;const H=new ya;H.viewport=new Pn;const F=[k,H],V=new $ z;let Y=null,ee=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ge=L[Ee];return Ge===void 0&&(Ge=new D3,L[Ee]=Ge),Ge.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ge=L[Ee];return Ge===void 0&&(Ge=new D3,L[Ee]=Ge),Ge.getGripSpace()},this.getHand=function(Ee){let Ge=L[Ee];return Ge===void 0&&(Ge=new D3,L[Ee]=Ge),Ge.getHandSpace()};function ne(Ee){const Ge=O.indexOf(Ee.inputSource);if(Ge===-1)return;const ye=L[Ge];ye!==void 0&&(ye.update(Ee.inputSource,Ee.frame,h||a),ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function se(){r.removeEventListener("select",ne),r.removeEventListener("selectstart",ne),r.removeEventListener("selectend",ne),r.removeEventListener("squeeze",ne),r.removeEventListener("squeezestart",ne),r.removeEventListener("squeezeend",ne),r.removeEventListener("end",se),r.removeEventListener("inputsourceschange",te);for(let Ee=0;Ee<L.length;Ee++){const Ge=O[Ee];Ge!==null&&(O[Ee]=null,L[Ee].disconnect(Ge))}Y=null,ee=null,R.reset(),e.setRenderTarget(E),S=null,x=null,v=null,r=null,B=null,We.stop(),n.isPresenting=!1,e.setPixelRatio(G),e.setSize(z.width,z.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){l=Ee,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(Ee){h=Ee},this.getBaseLayer=function(){return x!==null?x:S},this.getBinding=function(){return v},this.getFrame=function(){return w},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",ne),r.addEventListener("selectstart",ne),r.addEventListener("selectend",ne),r.addEventListener("squeeze",ne),r.addEventListener("squeezestart",ne),r.addEventListener("squeezeend",ne),r.addEventListener("end",se),r.addEventListener("inputsourceschange",te),C.xrCompatible!==!0&&await t.makeXRCompatible(),G=e.getPixelRatio(),e.getSize(z),r.enabledFeatures!==void 0&&r.enabledFeatures.includes("layers")){let ye=null,Pe=null,pt=null;C.depth&&(pt=C.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ye=C.stencil?du:au,Pe=C.stencil?Au:Rr);const vt={colorFormat:t.RGBA8,depthFormat:pt,scaleFactor:s};v=new XRWebGLBinding(r,t),x=v.createProjectionLayer(vt),r.updateRenderState({layers:[x]}),e.setPixelRatio(1),e.setSize(x.textureWidth,x.textureHeight,!1),B=new qh(x.textureWidth,x.textureHeight,{format:ks,type:aa,depthTexture:new qc(x.textureWidth,x.textureHeight,Pe,void 0,void 0,void 0,void 0,void 0,void 0,ye),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:x.ignoreDepthValues===!1})}else{const ye={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:s};S=new XRWebGLLayer(r,t,ye),r.updateRenderState({baseLayer:S}),e.setPixelRatio(1),e.setSize(S.framebuff
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function AW(i,e){return lW(i)||hW(i,e)||dW(i,e)||fW()}function dW(i,e){if(i){if(typeof i=="string")return u6(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)?u6(i,e):void 0}}var pW=cW(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,g){}:l;uW(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=a,this.onChange=u});function xs(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,g=h===void 0?function(){}:h,v=i.update,x=v===void 0?function(){}:v,S=Object.keys(r).map(function(w){return new pW(w,r[w])});return function w(){for(var R=arguments.length,C=new Array(R),E=0;E<R;E++)C[E]=arguments[E];var B=!!(this instanceof w&&this.constructor),L=B?C.shift():void 0,O=C[0],z=O===void 0?{}:O,G=Object.assign({},t instanceof Function?t(z):t,{initialised:!1}),k={};function H(Y){return F(Y,z),V(),H}var F=function(ee,ne){g.call(H,ee,G,ne),G.initialised=!0},V=oW(function(){G.initialised&&(x.call(H,G,k),k={})},1);return S.forEach(function(Y){H[Y.name]=ee(Y);function ee(ne){var se=ne.name,te=ne.triggerUpdate,Q=te===void 0?!1:te,le=ne.onChange,de=le===void 0?function(ue,be){}:le,Te=ne.defaultVal,Se=Te===void 0?null:Te;return function(ue){var be=G[se];if(!arguments.length)return be;var We=ue===void 0?Se:ue;return G[se]=We,de.call(H,We,G,be),!k.hasOwnProperty(se)&&(k[se]=be),Q&&V(),H}}}),Object.keys(a).forEach(function(Y){H[Y]=function(){for(var ee,ne=arguments.length,se=new Array(ne),te=0;te<ne;te++)se[te]=arguments[te];return(ee=a[Y]).call.apply(ee,[H,G].concat(se))}}),Object.entries(u).forEach(function(Y){var ee=AW(Y,2),ne=ee[0],se=ee[1];return H[ne]=H[se]}),H.resetProps=function(){return S.forEach(function(Y){H[Y.name](Y.defaultVal)}),H},H.resetProps(),G._rerender=V,B&&L&&H(L),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
2026-03-07 01:56:14 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function jX(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function WX(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 BX(i)}function bT(i,e){return bT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},bT(i,e)}function $ v(i,e){return LX(i)||VX(i,e)||JD(i,e)||HX()}function KD(i){return UX(i)||qX(i)||JD(i)||jX()}function $ X(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 ZD(i){var e= $ X(i,"string");return typeof e=="symbol"?e:e+""}function JD(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}}var eP=function(e){e instanceof Array?e.forEach(eP):(e.map&&e.map.dispose(),e.dispose())},tP=function(e){e.geometry&&e.geometry.dispose(),e.material&&eP(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(tP)},tR=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),tP(t)}};function nP(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 XX(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 Mf(i){return i*Math.PI/180}var iP=function(e){return 1-(vM(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},I3=function(e){return Math.max(0,Math.min(1,iP(e)))},nR=function(e){return .5-vM.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},YX=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=Pc().domain([1,0]).range([t,n]).clamp(!0),s=Pc().domain([I3(t),I3(n)]).range([1,0]).clamp(!0),a=function(v){return s(I3(r(v)))},l=e.array,u=0,h=l.length;u<h;u+=2)l[u+1]=a(l[u+1]);e.needsUpdate=!0},iR=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,iP(l))));var u=Math.floor(l*s);return[a,u]},ST=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,g=180/u,v=s===void 0?u-1:s,x=a===void 0?u-1:a,S=n,w=Math.min(u-1,v);S<=w;S++)for(var R=r,C=Math.min(u-1,x);R<=C;R++){var E=R,B=g;if(t){E=R===0?R:nR(R/u)*u;var L=R+1===u?R+1:nR((R+1)/u)*u;B=(L-E)*180/u}var O=-180+(S+.5)*h,z=90-(E*180/u+B/2),G=B;l.push({x:S,y:R,lng:O,lat:z,latLen:G})}return l},QX=6,KX=7,ZX=3,JX=90,Ql=new WeakMap,Nh=new WeakMap,F3=new WeakMap,nv=new WeakMap,Vo=new WeakMap,I_=new WeakMap,r0=new WeakMap,Ef=new WeakMap,iv=new WeakSet,eY=(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,g=r.mercatorProjection,v=g===void 0?!0:g;return IX(this,e),n=OX(this,e),FX(n,iv),xh(n,Ql,void 0),xh(n,Nh,void 0),xh(n,F3,void 0),xh(n,nv,void 0),xh(n,Vo,{}),xh(n,I_,void 0),xh(n,r0,void 0),xh(n,Ef,void 0),yd(n,"minLevel",void 0),yd(n,"maxLevel",void 0),yd(n,"thresholds",KD(new Array(30)).map(function(x,S){return 8/Math.pow(2,S)})),yd(n,"curvatureResolution",5),yd(n,"tileMargin",0),yd(n,"clearTiles",function(){Object.values(fi(Vo,n)).forEach(function(x){x.forEach(function(S){S.obj&&(n.remove(S.obj),tR(S.obj),delete S.obj)})}),bh(Vo,n,{})}),bh(Ql,n,t),n.tileUrl=s,bh(Nh,n,v),n.minLevel=l,n.maxLevel=h,n.level=0,n.add(bh(Ef,n,new zi(new Eu(fi(Ql,n)*.99,180,90),new pA({color:0})))),fi(Ef,n).visible=!1,fi(Ef,n).material.polygonOffset=!0,fi(Ef,n).material.polygonO
2026-03-07 01:56:14 +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 k_(i){return k_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k_(i)}function MY(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&&ET(i,e)}function lP(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lP=function(){return!!i})()}function EY(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function CY(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(g){h=!0,r=g}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function RY(){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 NY(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function DY(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 xY(i)}function ET(i,e){return ET=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ET(i,e)}function nm(i,e){return _Y(i)||CY(i,e)||_M(i,e)||RY()}function PY(i){return yY(i)||EY(i)||_M(i)||NY()}function _M(i,e){if(i){if(typeof i=="string")return MT(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)?MT(i,e):void 0}}var aR=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=Vh(s,r)*180/Math.PI;if(a>t)for(var l=pM(r,s),u=r.length>2||s.length>2?fg(r[2]||0,s[2]||0):null,h=u?function(x){return[].concat(PY(l(x)),[u(x)])}:l,g=1/Math.ceil(a/t),v=g;v<1;)n.push(h(v)),v+=g}n.push(r=s)}),n},CT=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:wi},LY=new CT.BufferGeometry().setAttribute?"setAttribute":"addAttribute",uP=(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;SY(this,e),n=bY(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var a=({Point:g,MultiPoint:v,LineString:x,MultiLineString:S,Polygon:w,MultiPolygon:R}[t.type]||function(){return[]})(t.coordinates,r),l=[],u=[],h=0;a.forEach(function(C){var E=l.length;im({indices:l,vertices:u},C),n.addGroup(E,l.length-E,h++)}),l.length&&n.setIndex(l),u.length&&n[LY]("position",new CT.Float32BufferAttribute(u,3));function g(C,E){var B=k3(C[1],C[0],E+(C[2]||0)),L=[];return[{vertices:B,indices:L}]}function v(C,E){var B={vertices:[],indices:[]};return C.map(function(L){return g(L,E)}).forEach(function(L){var O=nm(L,1),z=O[0];im(B,z)}),[B]}function x(C,E){for(var B=aR(C,s).map(function(H){var F=nm(H,3),V=F[0],Y=F[1],ee=F[2],ne=ee===void 0?0:ee;return k3(Y,V,E+ne)}),L=F_([B]),O=L.vertices,z=Math.round(O.length/3),G=[],k=1;k<z;k++)G.push(k-1,k);return[{vertices:O,indices:G}]}function S(C,E){var B={vertices:[],indices:[]};return C.map(function(L){return x(L,E)}).forEach(function(L){var O=nm(L,1),z=O[0];im(B,z)}),[B]}function w(C,E){for(var B=C.map(function(te){return aR(te,s).map(function(Q){var le=nm(Q,3),de=le[0],Te=le[1],Se=le[2],ue=Se===void 0?0:Se;return k3(Te,de,E+ue)})}),L=F_(B),O=L.vertices,z=L.holes,G=z[0]||1/0,k=O.slice(0,G*3),H=O.slice(G*3),F=new Set(z),V=Math.round(O.length/3),Y=[],ee=[],ne=1;ne<V;ne++)F.has(ne)||(ne<G?Y.push(ne-1,ne):ee.push(ne-1-G,ne-G));var se=[{indices:Y,vertices:k}];return z.length&&se.push({indices:ee,vertices:H}),se}function R(C,E){var B={vertices:[],indices:[]},L={vertices:[],indices:[]};C.map(function(z){return w(z,E)}).forEach(function(z){var G=nm(z,2),k=G[0],H=G[1];im(B,k),H&&im(L,H)});var O=[B];return L.vertices.length&&O.push(L),O}return n}return MY(e,i),TY(e)})(CT.BufferGeometry);function im(i,e){var t=Math.round(i.vertices.length/3);oR(i.vertices,e.vertices),oR(i.indices,e.indices.map(function(n){return n+t}))}function oR(i,e){var t=wY(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 k3(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 UY(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
2026-03-07 01:56:14 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function TQ(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function wQ(i,e){return pQ(i)||bQ(i,e)||AP(i,e)||SQ()}function MQ(i){return mQ(i)||xQ(i)||AP(i)||TQ()}function EQ(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 CQ(i){var e=EQ(i,"string");return typeof e=="symbol"?e:e+""}function AP(i,e){if(i){if(typeof i=="string")return DT(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)?DT(i,e):void 0}}var bd=new WeakMap,rm=new WeakMap,Sd=new WeakMap,z3=new WeakMap,G3=new WeakMap,q3=new WeakMap,RQ=(function(){function i(){vQ(this,i),xd(this,bd,new Map),xd(this,rm,new Map),xd(this,Sd,function(e){return e}),xd(this,z3,function(){return{}}),xd(this,G3,function(){}),xd(this,q3,function(){})}return yQ(i,[{key:"getObj",value:function(t){return ta(bd,this).get(ta(Sd,this).call(this,t))}},{key:"getData",value:function(t){return ta(rm,this).get(t)}},{key:"entries",value:function(){return MQ(ta(rm,this).entries()).map(function(t){var n=wQ(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return av(Sd,this,Mt(t)),this}},{key:"onCreateObj",value:function(t){return av(z3,this,t),this}},{key:"onUpdateObj",value:function(t){return av(G3,this,t),this}},{key:"onRemoveObj",value:function(t){return av(q3,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!ta(bd,n).has(ta(Sd,n).call(n,s))}).forEach(function(s){var a=ta(z3,n).call(n,s);ta(bd,n).set(ta(Sd,n).call(n,s),a),ta(rm,n).set(a,s)});var r=new Map(t.map(function(s){return[ta(Sd,n).call(n,s),s]}));return ta(bd,this).forEach(function(s,a){r.has(a)?ta(G3,n).call(n,s,r.get(a)):(ta(q3,n).call(n,s,a),ta(bd,n).delete(a),ta(rm,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})(),Xv={exports:{}},NQ=Xv.exports,dR;function DQ(){return dR||(dR=1,(function(i,e){(function(t,n){i.exports=n()})(NQ,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,g){u===void 0&&(u=NaN),h===void 0&&(h=NaN),g===void 0&&(g=!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,g||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-07 01:56:14 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function PK(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function LK(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 TK(i)}function UT(i,e){return UT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},UT(i,e)}function Kl(i,e){return bK(i)||NK(i,e)||gP(i,e)||DK()}function j3(i){return SK(i)||RK(i)||gP(i)||PK()}function gP(i,e){if(i){if(typeof i=="string")return LT(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)?LT(i,e):void 0}}function UK(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=BK(i,n),s=ug(r),a=OK(i,n),l=[].concat(j3(s),j3(a)),u={type:"Polygon",coordinates:i},h=ID(u),g=Kl(h,2),v=Kl(g[0],2),x=v[0],S=v[1],w=Kl(g[1],2),R=w[0],C=w[1],E=x>R||C>=89||S<=-89,B=[];if(E){var L=xK(l).triangles(),O=new Map(l.map(function(le,de){var Te=Kl(le,2),Se=Te[0],ue=Te[1];return["".concat(Se,"-").concat(ue),de]}));L.features.forEach(function(le){var de,Te=le.geometry.coordinates[0].slice(0,3).reverse(),Se=[];if(Te.forEach(function(be){var We=Kl(be,2),Ee=We[0],Ge=We[1],ye="".concat(Ee,"-").concat(Ge);O.has(ye)&&Se.push(O.get(ye))}),Se.length===3){if(Se.some(function(be){return be<s.length})){var ue=le.properties.circumcenter;if(!BT(ue,u,E))return}(de=B).push.apply(de,Se)}})}else if(a.length)for(var F=gg.from(l),V=function(de){var Te,Se=[2,1,0].map(function(We){return F.triangles[de+We]}),ue=Se.map(function(We){return l[We]});if(Se.some(function(We){return We<s.length})){var be=[0,1].map(function(We){return WW(ue,function(Ee){return Ee[We]})});if(!BT(be,u,E))return 1}(Te=B).push.apply(Te,j3(Se))},Y=0,ee=F.triangles.length;Y<ee;Y+=3)V(Y);else{var z=F_(r),G=z.vertices,k=z.holes,H=k===void 0?[]:k;B=nY(G,H,2)}var ne=Pc(A_(l,function(le){return le[0]}),[0,1]),se=Pc(A_(l,function(le){return le[1]}),[0,1]),te=l.map(function(le){var de=Kl(le,2),Te=de[0],Se=de[1];return[ne(Te),se(Se)]}),Q={points:l,indices:B,uvs:te};return{contour:r,triangles:Q}}function BK(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var a=Vh(s,r)*180/Math.PI;if(a>e)for(var l=pM(r,s),u=1/Math.ceil(a/e),h=u;h<1;)n.push(l(h)),h+=u}n.push(r=s)}),n})}function OK(i,e){var t={type:"Polygon",coordinates:i},n=ID(t),r=Kl(n,2),s=Kl(r[0],2),a=s[0],l=s[1],u=Kl(r[1],2),h=u[0],g=u[1];if(Math.min(Math.abs(h-a),Math.abs(g-l))<e)return[];var v=a>h||g>=89||l<=-89;return IK(e,{minLng:a,maxLng:h,minLat:l,maxLat:g}).filter(function(x){return BT(x,t,v)})}function IK(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},g=function(E){return a*(Math.cos((E+90)*Math.PI/180)+1)/2},v=[s!==void 0?Math.ceil(g(s)):0,r!==void 0?Math.floor(g(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=[],w=v[0];w<=v[1];w++){var R=u(w);x(R)&&S.push([R,h(w)])}return S}function BT(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?mX(e,i):QQ(i,e)}var Yv=window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:wi},MR=new Yv.BufferGeometry().setAttribute?"setAttribute":"addAttribute",wM=(function(i){function e(t,n,r,s,a,l,u){var h;MK(this,e),h=wK(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 g=UK(t,{resolution:u}),v=g.contour,x=g.triangles,S=ug(x.uvs),w=[],R=[],C=[],E=0,B=function(k){var H=Math.round(w.length/3),F=C.length;w=
2026-03-07 01:56:14 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function HK(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function jK(i,e){if(i==null)return{};var t,n,r=WK(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 WK(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 $ K(i,e){return kK(i)||qK(i,e)||vP(i,e)||VK()}function XK(i){return zK(i)||GK(i)||vP(i)||HK()}function YK(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 QK(i){var e=YK(i,"string");return typeof e=="symbol"?e:e+""}function vP(i,e){if(i){if(typeof i=="string")return OT(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)?OT(i,e):void 0}}var KK=(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,g=u;return r.forEach(function(v,x){var S=v.keyAccessor,w=v.isProp,R;if(w){var C=g,E=C[S],B=jK(C,[S].map(QK));R=E,g=B}else R=S(g,x);x+1<r.length?(h.hasOwnProperty(R)||(h[R]={}),h=h[R]):t?(h.hasOwnProperty(R)||(h[R]=[]),h[R].push(g)):h[R]=g}),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(g){return u[g]=t(u[g])}):Object.values(u).forEach(function(g){return l(g,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(g){var v= $ K(g,2),x=v[0],S=v[1];return l(S,[].concat(XK(h),[x]))})})(s),e instanceof Array&&e.length===0&&a.length===1&&(a[0].keys=[])),a}),Si=(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(Ze){return e.locateFile?e.locateFile(Ze,r):r+Ze}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(At,Ot,st){var d=new XMLHttpRequest;d.open("GET",At,!0),d.responseType="arraybuffer",d.onload=function(){if(d.status==200||d.status==0&&d.response){Ot(d.response);return}var $ n=qt(At);if( $ n){Ot( $ n.buffer);return}st()},d.onerror=st,d.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,g=function(Ze){h=Ze},v=function(){return h},x=8;function S(Ze,At,Ot,st){switch(Ot=Ot||"i8",Ot.charAt(Ot.length-1)==="*"&&(Ot="i32"),Ot){case"i1":ee[Ze>>0]=At;break;case"i8":ee[Ze>>0]=At;break;case"i16":se[Ze>>1]=At;break;case"i32":te[Ze>>2]=At;break;case"i64":Fe=[At>>>0,(Me=At,+it(Me)>=1?Me>0?(ct(+Ft(Me/4294967296),4294967295)|0)>>>0:~~+he((Me-+(~~Me>>>0))/4294967296)>>>0:0)],te[Ze>>2]=Fe[0],te[Ze+4>>2]=Fe[1];break;case"float":Q[Ze>>2]=At;break;case"double":le[Ze>>3]=At;break;default:Jr("invalid type for setValue: "+Ot)}}function w(Ze,At,Ot){switch(At=At||"i8",At.charAt(At.length-1)==="*"&&(At="i32"),At){case"i1":return ee[Ze>>0];case"i8":return ee[Ze>>0];case"i16":return se[Ze>>1];case"i32":return te[Ze>>2];case"i64":return te[Ze>>2];case"float":return Q[Ze>>2];case"double":return le[Ze>>3];default:Jr("invalid type for getValue: "+At)}return null}var R=!1;function C(Ze,At){Ze||Jr("Assertion failed: "+At)}function E(Ze){var At=e["_"+Ze];return C(At,"Cannot call unknown function "+Ze+", make sure it is expo
2026-03-07 01:56:14 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
2026-03-07 02:07:49 +01:00
* / c o n s t k 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 z 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 = k 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 R i n a ) { c o n s t C = a [ R ] , E = n [ R ] ; 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 [ R ] = 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 : R , 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 ! = = R | | 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 = R , 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 , g = 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 ( g . 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 R o f g ) { c o n s t C = h [ R ] , E = u [ R ] ; i f ( E = = = v o i d 0 ) r e t u r n d e l e t e h [ R ] , ! 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 , w = x ? x . v e r s i o n : n u l l ; i f ( S ! = = w ) r e t u r n l . i n d e x V e r s i o n = w , ! 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 R = ! 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 ] & & ( R = ! 0 ) ; i f ( R ) 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 y 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-07 01:56:14 +01:00
$ { e . tab } if ( $ { g } ) {
` ).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-07 02:07:49 +01:00
` );return e.format(h,n,t)}}const zs=lt(gJ);ot("select",zs);const KL=(...i)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),zs(...i));ot("cond",KL);class ZL extends Mn{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 zy=lt(ZL),JL=(i,e)=>zy(i,{label:e});ot("context",zy);ot("label",JL);class Kv extends Mn{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 e9=lt(Kv);ot("toVar",(...i)=>e9(...i).append());const t9=i=>(console.warn('TSL: "temp" is deprecated. Use ".toVar()" instead.'),e9(i));ot("temp",t9);class vJ extends Mn{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,IT.VERTEX);e.flowNodeFromShaderStage(IT.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 ro=lt(vJ),n9=i=>ro(i);ot("varying",ro);ot("vertexStage",n9);const i9=je(([i])=>{const e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Fi(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),r9=je(([i])=>{const e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Fi(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),jg="WorkingColorSpace",tE="OutputColorSpace";class Wg 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===jg?ai.workingColorSpace:t===tE?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 ai.enabled===!1||n===r||!n||!r||(ai.getTransfer(n)===Vi&&(s=dn(i9(s.rgb),s.a)),ai.getPrimaries(n)!==ai.getPrimaries(r)&&(s=dn(ha(ai._getMatrix(new Vn,n,r)).mul(s.rgb),s.a)),ai.getTransfer(r)===Vi&&(s=dn(r9(s.rgb),s.a))),s}}const s9=i=>dt(new Wg(dt(i),jg,tE)),a9=i=>dt(new Wg(dt(i),tE,jg)),o9=(i,e)=>dt(new Wg(dt(i),jg,e)),nE=(i,e)=>dt(new Wg(dt(i),e,jg)),_J=(i,e,t)=>dt(new Wg(dt(i),e,t));ot("toOutputColorSpace",s9);ot("toWorkingColorSpace",a9);ot("workingToColorSpace",o9);ot("colorSpaceToWorking",nE);let yJ=class extends vA{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
` :"")+e.tab+G+ ` {
2026-03-07 01:56:14 +01:00
` ).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-07 02:07:49 +01:00
` ).removeFlowTab();return e.addFlowTab(),a}}const ki=(...i)=>dt(new yee(tA(i,"int"))).append(),xee=()=>Hh("continue").append(),TU=()=>Hh("break").append(),bee=(...i)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),ki(...i)), $ 3=new WeakMap,vo=new Pn,OR=je(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{const a=xe(gU).mul(t).add(s),l=a.div(n),u=a.sub(l.mul(n));return Fr(i,ms(u,l)).depth(r).mul(e)});function See(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= $ 3.get(i);if(a===void 0||a.count!==s){let B=function(){C.dispose(), $ 3.delete(i),i.removeEventListener("dispose",B)};var l=B;a!==void 0&&a.texture.dispose();const u=i.morphAttributes.position||[],h=i.morphAttributes.normal||[],g=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 w=4096;x>w&&(S=Math.ceil(x/w),x=w);const R=new Float32Array(x*S*4*s),C=new jw(R,x,S,s);C.type= $ r,C.needsUpdate=!0;const E=v*4;for(let L=0;L<s;L++){const O=u[L],z=h[L],G=g[L],k=x*S*4*L;for(let H=0;H<O.count;H++){const F=H*E;e===!0&&(vo.fromBufferAttribute(O,H),R[k+F+0]=vo.x,R[k+F+1]=vo.y,R[k+F+2]=vo.z,R[k+F+3]=0),t===!0&&(vo.fromBufferAttribute(z,H),R[k+F+4]=vo.x,R[k+F+5]=vo.y,R[k+F+6]=vo.z,R[k+F+7]=0),n===!0&&(vo.fromBufferAttribute(G,H),R[k+F+8]=vo.x,R[k+F+9]=vo.y,R[k+F+10]=vo.z,R[k+F+11]=G.itemSize===4?vo.w:1)}}a={count:s,texture:C,stride:v,size:new ft(x,S)}, $ 3.set(i,a),i.addEventListener("dispose",B)}return a}class Tee extends Mn{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=gn(1),this.updateType=jn.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}=See(t);n===!0&&Gr.mulAssign(this.morphBaseInfluence),r===!0&&no.mulAssign(this.morphBaseInfluence);const g=xe(h.width);ki(a,({i:v})=>{const x=ve(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?x.assign(Fr(this.mesh.morphTexture,ms(xe(v).add(1),xe(Jg))).r):x.assign(ji("morphTargetInfluences","float").element(v).toVar()),n===!0&&Gr.addAssign(OR({bufferMap:l,influence:x,stride:u,width:g,depth:v,offset:xe(0)})),r===!0&&no.addAssign(OR({bufferMap:l,influence:x,stride:u,width:g,depth:v,offset:xe(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 wU=lt(Tee);class K0 extends Mn{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class wee extends K0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class Mee extends ZL{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=De().toVar("directDiffuse"),r=De().toVar("directSpecular"),s=De().toVar("indirectDiffuse"),a=De().toVar("indirectSpecular"),l={directDiffuse:n,directSpecular:r,indirectDiffuse:s,indirectSpecular:a};return{radiance:De().toVar("radiance"),irradiance:De().toVar("irradiance"),iblIrradiance:De().toVar("iblIrradiance"),ambientOcclusion:ve(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 MU=lt(Mee);class Eee extends K0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let am,om;class ss extends Mn{static get type(){return"S
` ,t==="property"?l:e.format( ` $ { l } ( ) ` ,s,t)}}const SB=(i,e=[],t="")=>{for(let s=0;s<e.length;s++){const a=e[s];typeof a=="function"&&(e[s]=a.functionNode)}const n=dt(new bB(i,e,t)),r=(...s)=>n.call(...s);return r.functionNode=n,r},rre=(i,e)=>SB(i,e,"glsl"),sre=(i,e)=>SB(i,e,"wgsl");class are extends Mn{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new zc,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:ve()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=FP(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=kP(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 n_=lt(are);class TB 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 ore{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 i_=new TB;class lre extends Mn{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new TB,this._output=n_(),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]=n_(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]=n_(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-07 01:56:14 +01:00
` ,s= `
2026-03-07 02:07:49 +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=[DP(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Ny(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 ure=lt(lre);function wB(i){let e;const t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Xr.z).negate()}const ME=je(([i,e],t)=>{const n=wB(t);return kc(i,e,n)}),EE=je(([i],e)=>{const t=wB(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Ng=je(([i,e])=>dn(e.toFloat().mix(Eg.rgb,i.toVec3()),Eg.a));function cre(i,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Ng(i,ME(e,t))}function hre(i,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Ng(i,EE(e))}let Rf=null,Nf=null;class fre extends Mn{static get type(){return"RangeNode"}constructor(e=ve(),t=ve()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Uh(this.minNode.value)),n=e.getTypeLength(Uh(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(Uh(r)),l=e.getTypeLength(Uh(s));Rf=Rf||new Pn,Nf=Nf||new Pn,Rf.setScalar(0),Nf.setScalar(0),a===1?Rf.setScalar(r):r.isColor?Rf.set(r.r,r.g,r.b,1):Rf.set(r.x,r.y,r.z||0,r.w||0),l===1?Nf.setScalar(s):s.isColor?Nf.set(s.r,s.g,s.b,1):Nf.set(s.x,s.y,s.z||0,s.w||0);const u=4,h=u*t.count,g=new Float32Array(h);for(let x=0;x<h;x++){const S=x%u,w=Rf.getComponent(S),R=Nf.getComponent(S);g[x]=M0.lerp(w,R,Math.random())}const v=this.getNodeType(e);if(t.count<=4096)n=Yg(g,"vec4",t.count).element(Jg).convert(v);else{const x=new Ig(g,4);e.geometry.setAttribute("__range"+this.id,x),n=J_(x).convert(v)}}else n=ve(0);return n}}const Are=lt(fre);class dre extends Mn{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 Zy=(i,e)=>dt(new dre(i,e)),pre=Zy("numWorkgroups","uvec3"),mre=Zy("workgroupId","uvec3"),gre=Zy("localId","uvec3"),vre=Zy("subgroupSize","uint");class _re extends Mn{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 CE=lt(_re),yre=()=>CE("workgroup").append(),xre=()=>CE("storage").append(),bre=()=>CE("texture").append();class Sre extends vA{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 Tre extends Mn{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 dt(new Sre(this,e))}generate(e){return e.getScopedArray(this.name|| ` $ { this . scope } Array _$ { this . id } ` ,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const wre=(i,e)=>dt(new Tre("Workgroup",i,e));class Ds 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)}}Ds.ATOMIC_LOAD="atomicLoad";Ds.ATOMIC_STORE="atomicStore";Ds.ATOMIC_ADD="atomicAdd";Ds.ATOMIC_SUB="atomicSub";Ds.ATOMIC_MAX="atomicMax";Ds.ATOMIC_MIN="atomicMin";Ds.ATOMIC_AND="atomicAnd";Ds.ATOMIC_OR="atomicOr";Ds.ATOMIC_XOR="atomicXor";const Mre=lt(Ds),jc=(i,e,t,n=null)=>{const r=Mre(i,e,t,n);return r.append(),r},Ere=(i,e,t=null)=>jc(Ds.ATOMIC_STORE,i,e,t),Cre=(i,e,t=null)=>jc(Ds.ATOMIC_ADD,i,e,t),Rre=(i,e,t=null)=>jc(Ds.ATOMIC_SUB,i,e,t),Nre=(i,e,t=null)=>jc(Ds.ATOMIC_MAX,i,e,t),Dre=(i,e,t=null)=>jc(Ds.ATOMIC_MIN,i,e,t),Pre=(i,e,t=null)=>jc(Ds.ATOMIC_AND,i,e,t),Lre=(i,e,t=null)=>jc(Ds.ATOMIC_OR,i,e,t),Ure=(i,e,t=null)=>jc(Ds.ATOMIC_XOR,i,e,t);let pv;function t1(i){pv=pv||new WeakMap;let e=pv.get(i);return e===void 0&&pv.set(i,e={}),e}function RE(i){const e=t1(i);return e.shadowMatrix||(e.shadowMatrix=gn("mat4").setGroup(Rn).onRenderUpdate(()=>(i.castShadow!==!0&&i.shadow.updateMatrices(i),i.shadow.matrix)))}function MB(i){const e=t1(i);if(e.projectionUV===void 0){const t=RE(i).mul(Nc);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function NE(i){const e=t1(i);return e.position||(e.position=gn(new ce).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function EB(i){const e=t1(i);return e.targetPosition||(e.targetPosition=gn(new ce).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function Jy(i){const e=t1(i);return e.viewPosition||(e.viewPosition=gn(new ce).setGroup(Rn).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ce,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const DE=i=>so.transformDirection(NE(i).sub(EB(i))),Bre=i=>i.sort((e,t)=>e.id-t.id),Ore=(i,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},oS=new WeakMap;class PE extends Mn{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=De().toVar("totalDiffuse"),this.totalSpecularNode=De().toVar("totalSpecular"),this.outgoingLightNode=De().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 Ny(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-07 01:56:14 +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 bB,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 eB(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 uS,this.stack=e_();for(const h of FT)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 Vr),r.build(this)}else this.addFlow("compute",e);for(const r of FT){this.setBuildStage(r),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const s of kT){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 Bae(e);if(t==="vec2"||t==="ivec2"||t==="uvec2")return new Oae(e);if(t==="vec3"||t==="ivec3"||t==="uvec3")return new Iae(e);if(t==="vec4"||t==="ivec4"||t==="uvec4")return new Fae(e);if(t==="color")return new kae(e);if(t==="mat3")return new zae(e);if(t==="mat4")return new Gae(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${V0} - Node System
2026-03-07 02:07:49 +01:00
` }createNodeMaterial(e="NodeMaterial"){throw new Error( ` THREE . NodeBuilder : createNodeMaterial ( ) was deprecated . Use new $ { e } ( ) instead . ` )}}class vN{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===jn.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===jn.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===jn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===jn.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===jn.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===jn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===jn.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===jn.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===jn.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 kE{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}}kE.isNodeFunctionInput=!0;class Xae extends xA{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,r=DE(this.light),s=e.context.reflectedLight;t.direct({lightDirection:r,lightColor:n,reflectedLight:s},e.stack,e)}}const pS=new kn,_v=new kn;let dm=null;class Yae extends xA{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=gn(new ce).setGroup(Rn),this.halfWidth=gn(new ce).setGroup(Rn),this.updateType=jn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;_v.identity(),pS.copy(t.matrixWorld),pS.premultiply(n),_v.extractRotation(pS),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(_v),this.halfHeight.value.applyMatrix4(_v)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=Ai(dm.LTC_FLOAT_1),n=Ai(dm.LTC_FLOAT_2)):(t=Ai(dm.LTC_HALF_1),n=Ai(dm.LTC_HALF_2));const{colorNode:r,light:s}=this,a=e.context.lightingModel,l=Jy(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){dm=e}}class XB extends xA{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=gn(0).setGroup(Rn),this.penumbraCosNode=gn(0).setGroup(Rn),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(0).setGroup(Rn)}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 kc(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:r,decayExponentNode:s,light:a}=this,l=Jy(a).sub(Xr),u=l.normalize(),h=u.dot(DE(a)),g=this.getSpotAttenuation(h),v=l.length(),x=UE({lightDi
2026-03-07 01:56:14 +01:00
Message : $ { e . message } ` ;e.reason&&(t+= `
2026-03-07 02:07:49 +01:00
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 g=r.version!==h.version,v=h.renderContexts.has(l)===!1||g;if(h.renderContexts.add(l),v){this.backend.beginBundle(l),(h.renderObjects===void 0||g)&&(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,w=x.length;S<w;S++){const R=x[S];this._nodes.needsRefresh(R)&&(this._nodes.updateBefore(R),this._nodes.updateForRender(R),this._bindings.updateForRender(R),this._nodes.updateAfter(R))}}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!==Za===!1&&t!==Ro===!1)return null;const{width:s,height:a}=this.getDrawingBufferSize(yv),{depth:l,stencil:u}=this;let h=this._frameBufferTarget;return h===null&&(h=new Wh(s,a,{depthBuffer:l,stencilBuffer:u,type:Gs,format:ks,colorSpace:Ro,generateMipmaps:!1,minFilter:gs,magFilter:gs,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:xN,g=this._renderTarget,v=this._activeCubeFace,x=this._activeMipmapLevel;let S;r!==null?(S=r,this.setRenderTarget(S)):S=g;const w=this._renderContexts.get(e,t,S);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls;const R=this.coordinateSystem;t.coordinateSystem!==R&&(t.coordinateSystem=R,t.updateProjectionMatrix()),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld();let C=this._viewport,E=this._scissor,B=this._pixelRatio;S!==null&&(C=S.viewport,E=S.scissor,B=1),this.getDrawingBufferSize(yv),gS.set(0,0,yv.width,yv.height);const L=C.minDepth===void 0?0:C.minDepth,O=C.maxDepth===void 0?1:C.maxDepth;w.viewportValue.copy(C).multiplyScalar(B).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=L,w.viewportValue.maxDepth=O,w.viewport=w.viewportValue.equals(gS)===!1,w.scissorValue.copy(E).multiplyScalar(B).floor(),w.scissor=this._scissorTest&&w.scissorValue.equals(gS)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new ay),w.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,S),xv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),vS.setFromProjectionMatrix(xv,R);const z=this._renderLists.get(e,t);if(z.begin(),this._projectObject(e,t,0,z,w.clippingContext),z.finish(),this.sortObjects===!0&&z.sort(this._opaqueSort,this._transparentSort),S!==null){this._textures.updateRenderTarget(S,x);const Y=this._textures.get(S);w.textures=Y.textures,w.depthTexture=Y.depthTexture,w.width=Y.width,w.height=Y.height,w.renderTarget=S,w.depth=S.depthBuffer,w.stencil=S.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=this.domElement.width,w.height=this.domElement.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=v,w.activeMipmapLevel=x,w.occlusionQueryCount=z.occlusionQueryCount,this._background.update(h,z,w),this.backend.beginRender(
2026-03-07 01:56:14 +01:00
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 xoe extends $ B{constructor(e,t){super(e,t,new roe),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]},this.useComparisonMethod=!0}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Co}getMethod(e){return _oe[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?H0:Bg;s===2?l=a?j0:lA:s===3?l=a?qF:Ug:s===4&&(l=a?W0:ks);const u={Float32Array: $ r,Uint8Array:aa,Uint16Array:wl,Uint32Array:Rr,Int8Array:Qf,Int16Array:Kf,Int32Array:Ns,Uint8ClampedArray:aa},h=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let g=Math.ceil(r/s/h);h*g*s<r&&g++;const v=h*g*s,x=new n.constructor(v);x.set(n,0),t.array=x;const S=new Wk(t.array,h,g,l,u[t.array.constructor.name]|| $ r);S.needsUpdate=!0,S.isPBOTexture=!0;const w=new yu(S,null,null);w.setPrecision("high"),t.pboNode=w,t.pbo=w.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 g=this.renderer.backend.get(r);g.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 g=this.getVarFromNode(e);h=this.getPropertyName(g);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,w="."+gA.join("").slice(0,S),R= ` ivec2 ( $ { l } % $ { x } , $ { l } / $ { x } ) ` ,C=this.generateTextureLoad(null,a,R,null,"0");let E="vec4";r.pbo.type===Rr?E="uvec4":r.pbo.type===Ns&&(E="ivec4"),this.addLineFlowCode( ` $ { h } = $ { E } ( $ { C } ) $ { w } ` ,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 g=a.node.value;let v="";g.isDataTexture===!0&&(g.type===Rr?v="u":g.type===Ns&&(v="i")),g.compareFunction?l= ` sampler2DShadow $ { a . name } ; ` :g.isDataArrayTexture===!0||g.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 g=a.node,v=this.getType(g.bufferType),x=g.bufferCount,S=x>0?x:"";l= ` $ { g . 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=yoe[h]+" "+l),u){l=" "+l;const g=a.groupNode.name;(r[g]||(r[g]=[])).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=bN[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)}bN[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
$ { SN }
// 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
$ { SN }
// 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-07 02:07:49 +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,g=this.getBindGroupArray(h,n);if(t==="texture")l=new ex(s.name,s.node,u),g.push(l);else if(t==="cubeTexture")l=new tO(s.name,s.node,u),g.push(l);else if(t==="texture3D")l=new nO(s.name,s.node,u),g.push(l);else if(t==="buffer"){e.name= ` NodeBuffer _$ { e . id } ` ,s.name= ` buffer$ { e . id } ` ;const v=new JB(e,u);v.name=e.name,g.push(v),l=v}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let x=v[h];x===void 0&&(x=new eO(n+"_"+h,u),v[h]=x,g.push(x)),l=this.getNodeUniform(s,t),x.addUniform(l)}a.uniformGPU=l}return s}}let _S=null,Pd=null;class iO{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 _S=_S||new ft,this.renderer.getDrawingBufferSize(_S)}setScissorTest(){}getClearColor(){const e=this.renderer;return Pd=Pd||new bE,e.getClearColor(Pd),Pd.getRGB(Pd,this.renderer.currentColorSpace),Pd}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:I7(),"setAttribute"in e&&e.setAttribute("data-engine", ` three . js r$ { V0 } 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 boe=0;class Soe{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 Toe{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 g;if(s instanceof Float32Array)g=r.FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)g=r.SHORT;else if(s instanceof Uint32Array)g=r.UNSIGNED_INT;else if(s instanceof Int32Array)g=r.INT;else if(s instanceof Int8Array)g=r.BYTE;else if(s instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)
2026-03-07 01:56:14 +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 ;
2026-03-07 02:07:49 +01:00
void main ( ) { } ` };this.createProgram(s);const{computeProgram:a}=e,l=r.createProgram(),u=this.get(s).shaderGPU,h=this.get(a).shaderGPU,g=a.transforms,v=[],x=[];for(let C=0;C<g.length;C++){const E=g[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,w=[],R=[];for(let C=0;C<S.length;C++){const E=S[C].node.attribute;w.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 B=this.get(E);R.push(B)}this.set(e,{programGPU:l,transformBuffers:R,attributes:w})}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(EN).filter(r=>EN[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,g=s.isWebGLCubeRenderTarget===!0,v=s.isRenderTarget3D===!0,x=s.isRenderTargetArray===!0;let S=a.msaaFrameBuffer,w=a.depthRenderbuffer;const R=JU(e);let C;if(g?(a.cubeFramebuffers||(a.cubeFramebuffers={}),C=a.cubeFramebuffers[R]):(a.framebuffers||(a.framebuffers={}),C=a.framebuffers[R]),C===void 0){C=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,C);const E=e.textures;if(g){a.cubeFramebuffers[R]=C;const{textureGPU:B}=this.get(E[0]),L=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+L,B,0)}else{a.framebuffers[R]=C;for(let B=0;B<E.length;B++){const L=E[B],O=this.get(L);O.renderTarget=e.renderTarget,O.cacheKey=R;const z=t.COLOR_ATTACHMENT0+B;if(v||x){const G=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,z,O.textureGPU,0,G)}else t.framebufferTexture2D(t.FRAMEBUFFER,z,t.TEXTURE_2D,O.textureGPU,0)}n.drawBuffers(e,C)}if(e.depthTexture!==null){const B=this.get(e.depthTexture),L=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;B.renderTarget=e.renderTarget,B.cacheKey=R,t.framebufferTexture2D(t.FRAMEBUFFER,L,t.TEXTURE_2D,B.textureGPU,0)}}if(l>0){if(S===void 0){const E=[];S=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,S);const B=[],L=e.textures;for(let O=0;O<L.length;O++){if(B[O]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,B[O]),E.push(t.COLOR_ATTACH
2026-03-07 01:56:14 +01:00
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:qf.Linear}),this.flipYSampler=e.createSampler({minFilter:qf.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:Zd.TriangleStrip,stripIndexFormat:k0.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:Zd.TriangleStrip,stripIndexFormat:k0.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}),g=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:n}),v=h.createView({baseMipLevel:0,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:0}),x=this.device.createCommandEncoder({}),S=(w,R,C)=>{const E=w.getBindGroupLayout(0),B=this.device.createBindGroup({layout:E,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:R}]}),L=x.beginRenderPass({colorAttachments:[{view:C,loadOp:Wr.Clear,storeOp:ia.Store,clearValue:[0,0,0,0]}]});L.setPipeline(w),L.setBindGroup(0,B),L.draw(4,1,0,0),L.end()};S(l,g,v),S(u,v,g),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:za.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}]}),g=e.createView({baseMipLevel:u,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:n}),v={colorAttachments:[{view:g,loadOp:Wr.Clear,storeOp:ia.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=g}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 Foe={[Fw]:"never",[my]:"less",[kw]:"equal",[gy]:"less-equal",[zw]:"greater",[qw]:"greater-equal",[Vw]:"always",[Gw]:"not-equal"},koe=[0,1,3,2,4,5];class zoe{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this.colorBuffer=null,this.depthTexture=new qc,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===qf.Linear&&s.minFilter===qf.Linear&&s.mipmapFilter===qf.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 ) ;
}
` )},Mm={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)&&(Wo.pow_float=new rs("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),Wo.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 ) ); }",[Wo.pow_float]),Wo.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 ) ); }",[Wo.pow_float]),Wo.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 ) ); }",[Wo.pow_float]),Mm.pow_float="tsl_pow_float",Mm.pow_vec2="tsl_pow_vec2",Mm.pow_vec3="tsl_pow_vec3",Mm.pow_vec4="tsl_pow_vec4");let rO="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(rO+= ` diagnostic ( off , derivative _uniformity ) ;
` );class Yoe extends $ B{constructor(e,t){super(e,t,new joe),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Co}_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 _$ { PN [ e . wrapS ] } S _$ { PN [ e . wrapT ] } _$ { e . isData3DTexture ? "3d" : "2d" } T ` ;let n=UN[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===aA?(r.push(Wo.repeatWrapping_float),a+= ` tsl _repeatWrapping _float ( coord . $ { h } ) ` ):u===eu?(r.push(Wo.clampWrapping_float),a+= ` tsl _clampWrapping _float ( coord . $ { h } ) ` ):u===oA?(r.push(Wo.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+= `
) ;
}
` ,UN[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 Kv(new Zv( ` textureDimensions ( $ { a } ) ` ,l)),r.dimensionsSnippet[n]=s,(e.isDataArrayTexture||e.isData3DTexture)&&(r.arrayLayerCount=new Kv(new Zv( ` textureNumLayers ( $ { t } ) ` ,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new Kv(new Zv("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===mr&&e.magFilter===mr||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= $ oe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?sa.READ_ONLY:e.access}getStorageAccess(e,t){return Woe[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,g=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 ex(s.name,s.node,u,x):t==="cubeTexture"?v=new tO(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,g=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 ( $ { g . binding ++ } ) @ group ( $ { g . group } ) var $ { u . name } _sampler : sampler _comparison ; ` ):n.push( ` @ binding ( $ { g . binding ++ } ) @ group ( $ { g . group } ) var $ { u . name } _sampler : sampler ; ` ));let x,S="";const{primarySamples:w}=this.renderer.backend.utils.getTextureSampleData(v);if(w>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 R=iw(v),C=this.getStorageAccess(u.node,e);x= ` texture _storage _2d < $ { R } , $ { C } > ` }else{const R=this.getComponentTypeFromTexture(v).charAt(0);x= ` texture$ { S } _2d < $ { R } 32 > ` }n.push( ` @ binding ( $ { g . binding ++ } ) @ group ( $ { g . 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,w=S>0&&u.type==="buffer"?", "+S:"",R=v.isAtomic? ` atomic < $ { x } > ` : ` $ { x } ` ,C= ` $ { u . name } : array < $ { R } $ { w } >
` ,E=v.isStorageBufferNode? ` storage , $ { this . getStorageAccess ( v , e ) } ` :"uniform";r.push(this._getWGSLStructBinding("NodeBuffer_"+v.id,C,E,g.binding++,g.group))}else{const v=this.getType(this.getVectorType(u.type)),x=u.groupNode.name;(a[x]||(a[x]={index:g.binding++,id:g.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 g=this.getFlowData(h),v=h.name;if(v&&(r.length>0&&(r+= `
` ),r+= ` // flow -> ${v}
` ),r+= ` $ { g . code }
` ,h===a&&t!=="compute"){if(r+= ` // result
` ,t==="vertex")r+= ` varyings . Vertex = $ { g . result } ; ` ;else if(t==="fragment")if(u)n.returnType=l.nodeType,r+= ` return $ { g . 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 = $ { g . 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 Xoe[e]||e}isAvailable(e){let t=LN[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),LN[e]=t),t}_getWGSLMethod(e){return Wo[e]!==void 0&&this._include(e),Mm[e]}_include(e){const t=Wo[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
$ { rO }
// 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-07 02:07:49 +01:00
var < $ { n } > $ { e } : $ { a } ; ` }}class Qoe{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=Ne.Depth24PlusStencil8:e.depth&&(t=Ne.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 Zd.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Zd.LineList;if(e.isLine)return Zd.LineStrip;if(e.isMesh)return Zd.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")?Ne.BGRA8Unorm:navigator.gpu.getPreferredCanvasFormat()}}const Koe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]),Zoe=new Map([[z7,["float16"]]]),Joe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class ele{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 g=new Uint32Array(u.length);for(let v=0;v<u.length;v++)g[v]=u[v];u=g}if(n.array=u,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3){u=new u.constructor(n.count*4);for(let g=0;g<n.count;g++)u.set(n.array.subarray(g*3,g*3+3),g*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 g=0,v=u.length;g<v;g++){const x=u[g],S=x.start*h,w=x.count*h;r.queue.writeBuffer(s,0,a,S,w)}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?Sv.Instance:Sv.Vertex):(v=s.itemSize*a,x=s.isInstancedBufferAttribute?Sv.Instance:Sv.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),g=s.isInterleavedBufferAttribute===!0?s.offset*a:0;u.attributes.push({shaderLocation:r,offset:g,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-07 01:56:14 +01:00
* @ license
* Copyright 2010 - 2024 Three . js Authors
* SPDX - License - Identifier : MIT
2026-03-07 02:07:49 +01:00
* / j . B R D F _ G G X ; j . B R D F _ L a m b e r t ; j . B a s i c S h a d o w F i l t e r ; j . B r e a k ; j . C o n t i n u e ; j . D F G A p p r o x ; j . D _ G G X ; j . D i s c a r d ; j . E P S I L O N ; j . F _ S c h l i c k ; c o n s t a l e = j . F n ; j . I N F I N I T Y ; c o n s t o l e = j . I f , l l e = j . L o o p ; j . N o d e S h a d e r S t a g e ; j . N o d e T y p e ; j . N o d e U p d a t e T y p e ; j . N o d e A c c e s s ; j . P C F S h a d o w F i l t e r ; j . P C F S o f t S h a d o w F i l t e r ; j . P I ; j . P I 2 ; j . R e t u r n ; j . S c h l i c k _ t o _ F 0 ; j . S c r i p t a b l e N o d e R e s o u r c e s ; j . S h a d e r N o d e ; j . T B N V i e w M a t r i x ; j . V S M S h a d o w F i l t e r ; j . V _ G G X _ S m i t h C o r r e l a t e d ; j . a b s ; j . a c e s F i l m i c T o n e M a p p i n g ; j . a c o s ; j . a d d ; j . a d d N o d e E l e m e n t ; j . a g x T o n e M a p p i n g ; j . a l l ; j . a l p h a T ; j . a n d ; j . a n i s o t r o p y ; j . a n i s o t r o p y B ; j . a n i s o t r o p y T ; j . a n y ; j . a p p e n d ; j . a r r a y B u f f e r ; c o n s t u l e = j . a s i n ; j . a s s i g n ; j . a t a n ; j . a t a n 2 ; j . a t o m i c A d d ; j . a t o m i c A n d ; j . a t o m i c F u n c ; j . a t o m i c M a x ; j . a t o m i c M i n ; j . a t o m i c O r ; j . a t o m i c S t o r e ; j . a t o m i c S u b ; j . a t o m i c X o r ; j . a t t e n u a t i o n C o l o r ; j . a t t e n u a t i o n D i s t a n c e ; j . a t t r i b u t e ; j . a t t r i b u t e A r r a y ; j . b a c k g r o u n d B l u r r i n e s s ; j . b a c k g r o u n d I n t e n s i t y ; j . b a c k g r o u n d R o t a t i o n ; j . b a t c h ; j . b i l l b o a r d i n g ; j . b i t A n d ; j . b i t N o t ; j . b i t O r ; j . b i t X o r ; j . b i t a n g e n t G e o m e t r y ; j . b i t a n g e n t L o c a l ; j . b i t a n g e n t V i e w ; j . b i t a n g e n t W o r l d ; j . b i t c a s t ; j . b l e n d B u r n ; j . b l e n d C o l o r ; j . b l e n d D o d g e ; j . b l e n d O v e r l a y ; j . b l e n d S c r e e n ; j . b l u r ; j . b o o l ; j . b u f f e r ; j . b u f f e r A t t r i b u t e ; j . b u m p M a p ; j . b u r n ; j . b v e c 2 ; j . b v e c 3 ; j . b v e c 4 ; j . b y p a s s ; j . c a c h e ; j . c a l l ; j . c a m e r a F a r ; j . c a m e r a N e a r ; j . c a m e r a N o r m a l M a t r i x ; j . c a m e r a P o s i t i o n ; j . c a m e r a P r o j e c t i o n M a t r i x ; j . 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 ; j . c a m e r a V i e w M a t r i x ; j . c a m e r a W o r l d M a t r i x ; j . c b r t ; j . c d l ; j . c e i l ; j . c h e c k e r ; j . c i n e o n T o n e M a p p i n g ; j . c l a m p ; j . c l e a r c o a t ; j . c l e a r c o a t R o u g h n e s s ; j . c o d e ; j . c o l o r ; j . c o l o r S p a c e T o W o r k i n g ; j . c o l o r T o D i r e c t i o n ; j . c o m p u t e ; j . c o n d ; j . c o n t e x t ; j . c o n v e r t ; j . c o n v e r t C o l o r S p a c e ; j . c o n v e r t T o T e x t u r e ; c o n s t c l e = j . c o s ; j . c r o s s ; j . c u b e T e x t u r e ; j . d F d x ; j . d F d y ; j . d a s h S i z e ; j . d e f a u l t B u i l d S t a g e s ; j . d e f a u l t S h a d e r S t a g e s ; j . d e f i n e d ; j . d e g r e e s ; j . d e l t a T i m e ; j . d e n s i t y F o g ; j . d e n s i t y F o g F a c t o r ; j . d e p t h ; j . d e p t h P a s s ; j . d i f f e r e n c e ; j . d i f f u s e C o l o r ; j . d i r e c t P o i n t L i g h t ; j . d i r e c t i o n T o C o l o r ; j . d i s p e r s i o n ; j . d i s t a n c e ; j . d i v ; j . d o d g e ; j . d o t ; j . d r a w I n d e x ; j . d y n a m i c B u f f e r A t t r i b u t e ; j . e l e m e n t ; j . e m i s s i v e ; j . e q u a l ; j . e q u a l s ; j . e q u i r e c t U V ; c o n s t h l e = j . e x p ; j . e x p 2 ; j . e x p r e s s i o n ; j . f a c e D i r e c t i o n ; j . f a c e F o r w a r d ; j . f a c e f o r w a r d ; c o n s t f l e = j . f l o a t ; j . f l o o r ; j . f o g ; j . f r a c t ; j . f r a m e G r o u p ; j . f r a m e I d ; j . f r o n t F a c i n g ; j . f w i d t h ; j . g a i n ; j . g a p S i z e ; j . g e t C o n s t N o d e T y p e ; j . g e t C u r r e n t S t a c k ; j . g e t D i r e c t i o n ; j . g e t D i s t a n c e A t t e n u a t i o n ; j . g e t G e o m e t r y R o u g h n e s s ; j . g e t N o r m a l F r o m D e p t h ; j . g e t P a r a l l a x C o r r e c t N o r m a l ; j . g e t R o u g h n e s s ; j . g e t S c r e e n P o s i t i o n ; j . g e t S h I r r a d i a n c e A t ; j . g e t T e x t u r e I n d e x ; j . g e t V i e w P o s i t i o n ; j . g l s l ; j . g l s l F n ; j . g r a y s c a l e ; j . g r e a t e r T h a n ; j . g r e a t e r T h a n E q u a l ; j . h a s h ; j . 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 ; j . h i g h p M o d e l V i e w M a t r i x ; j . h u e ; j . i n s t a n c e ; c o n s t A l e = j . i n s t a n c e I n d e x ; j . i n s t a n c e d A r r a y ; j . i n s t a n c e d B u f f e r A t t r i b u t e ; j . 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 ; j . i n s t a n c e d M e s h ; j . i n t ; j . i n v e r s e S q r t ; j . i n v e r s e s q r t ; j . i n v o c a t i o n L o c a l I n d e x ; j . i n v o c a t i o n S u b g r o u p I n d e x ; j . i o r ; j . i r i d e s c e n c e ; j . i r i d e s c e n c e I O R ; j . i r i d e s c e n c e T h i c k n e s s ; j . i v e c 2 ; j . i v e c 3 ; j . i v e c 4 ; j . j s ; j . l a b e l ; j . l e n g t h ; j . l e n g t h S q ; j . l e s s T h a n ; j . l e s s T h a n E q u a l ; j . l i g h t P o s i t i o n ; j . l i g h t T a r g e t D i r e c t i o n ; j . l i g h t T a r g e t P o s i t i o n ; j . l i g h t V i e w P o s i t i o n ; j . l i g h t i n g C o n t e x t ; j . l i g h t s ; j . l i n e a r D e p t h ; j . l i n e a r T o n e M a p p i n g ; j . l o c a l I d ; j . l o g ; j . l o g 2 ; j . l o g a r i t h m i c D e p t h T o V i e w Z ; j . l o o p ; j . l u m i n a n c e ; j . m e d i u m p M o d e l V i e w M a t r i x ; j . m a t 2 ; j . m a t 3 ; j . m a t 4 ; j . m a t c a p U V ; j . m a t e r i a l A O ; j . m a t e r i a l A l p h a T e s t ; j . m a t e r i a l A n i s o t r o p y ; j . m a t e r i a l A n i s o t r o p y V e c t o r ; j . m a t e r i a l A t t e n u a t i o n C o l o r ; j . 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 ; j . m a t e r i a l C l e a r c o a t ; j . m a t e r i a l C l e a r c o a t N o r m a l ; j . 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 ; j . m a t e r i a l C o l o r ; j . m a t e r i a l D i s p e r s i o n ; j . m a t e r i a l E m i s s i v e ; j . m a t e r i a l I O R ; j . m a t e r i a l I r i d e s c e n c e ; j . m a t e r i a l I r i d e s c e n c e I O R ; j . 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 ; j . m a t e r i a l L i g h t M a p ; j . m a t e r i a l L i n e D a s h O f f s e t ; j . m a t e r i a l L i n e D a s h S i z e ; j . m a t e r i a l L i n e G a p S i z e ; j . m a t e r i a l L i n e S c a l e ; j . m a t e r i a l L i n e W i d t h ; j . m a t e r i a l M e t a l n e s s ; j . m a t e r i a l N o r m a l ; j . m a t e r i a l O p a c i t y ; j . m a t e r i a l P o i n t W i d t h ; j . m a t e r i a l R e f e r e n c e ; j . m a t e r i a l R e f l e c t i v i t y ; j . m a t e r i a l R e f r a c t i o n R a t i o ; j . m a t e r i a l R o t a t i o n ; j . m a t e r i a l R o u g h n e s s ; j . m a t e r i a l S h e e n ; j . m a t e r i a l S h e e n R o u g h n e s s ; j . m a t e r i a l S h i n i n e s s ; j . m a t e r i a l S p e c u l a r ; j . m a t e r i a l S p e c u l a r C o l o r ; j . 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 ; j . m a t e r i a l S p e c u l a r S t r e n g t h ; j . m a t e r i a l T h i c k n e s s ; j . m a t e r i a l T r a n s m i s s i o n ; j . m a x ; j . m a x M i p L e v e l ; j . m e t a l n e s s ; j . m i n ; j . m i x ; j . m i x E l e m e n t ; j . m o d ; j . m o d I n t ; j . m o d e l D i r e c t i o n ; j . m o d e l N o r m a l M a t r
2026-03-07 01:56:14 +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-07 02:07:49 +01:00
` };class qE extends Ja{constructor(e){super({type:"LineMaterial",uniforms:vy.clone(Ga.line.uniforms),vertexShader:Ga.line.vertexShader,fragmentShader:Ga.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 ES=new Pn,ON=new ce,IN=new ce,Os=new Pn,Is=new Pn,jl=new Pn,CS=new ce,RS=new kn,Fs=new Yz,FN=new ce,Mv=new Gc,Ev=new dA,Wl=new Pn;let Jl,rA;function kN(i,e,t){return Wl.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Wl.multiplyScalar(1/Wl.w),Wl.x=rA/t.width,Wl.y=rA/t.height,Wl.applyMatrix4(i.projectionMatrixInverse),Wl.multiplyScalar(1/Wl.w),Math.abs(Math.max(Wl.x,Wl.y))}function _le(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 ce,g=new ce;Jl.distanceSqToSegment(Fs.start,Fs.end,g,h),g.distanceTo(h)<rA*.5&&e.push({point:g,pointOnLine:h,distance:Jl.origin.distanceTo(g),object:i,face:null,faceIndex:l,uv:null,uv1:null})}}function yle(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,g=Math.min(l.instanceCount,u.count),v=-e.near;Jl.at(1,jl),jl.w=1,jl.applyMatrix4(e.matrixWorldInverse),jl.applyMatrix4(n),jl.multiplyScalar(1/jl.w),jl.x*=s.x/2,jl.y*=s.y/2,jl.z=0,CS.copy(jl),RS.multiplyMatrices(e.matrixWorldInverse,a);for(let x=0,S=g;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 L=Os.z-Is.z,O=(Os.z-v)/L;Os.lerp(Is,O)}else if(Is.z>v){const L=Is.z-Os.z,O=(Is.z-v)/L;Is.lerp(Os,O)}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 R=Fs.closestPointToPointParameter(CS,!0);Fs.at(R,FN);const C=M0.lerp(Os.z,Is.z,R),E=C>=-1&&C<=1,B=CS.distanceTo(FN)<rA*.5;if(E&&B){Fs.start.fromBufferAttribute(u,x),Fs.end.fromBufferAttribute(h,x),Fs.start.applyMatrix4(a),Fs.end.applyMatrix4(a);const L=new ce,O=new ce;Jl.distanceSqToSegment(Fs.start,Fs.end,O,L),t.push({point:O,pointOnLine:L,distance:Jl.origin.distanceTo(O),object:i,face:null,faceIndex:x,uv:null,uv1:null})}}}class xle extends zi{constructor(e=new aO,t=new qE({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)ON.fromBufferAttribu
2026-03-07 01:56:14 +01:00
` )l=0,u-=s;else{const v=wle(g,r,l,u,t);l+=v.offsetX,a.push(v.path)}}return a}function wle(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 Qz;let l,u,h,g,v,x,S,w;if(s.o){const R=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let C=0,E=R.length;C<E;)switch(R[C++]){case"m":l=R[C++]*e+t,u=R[C++]*e+n,a.moveTo(l,u);break;case"l":l=R[C++]*e+t,u=R[C++]*e+n,a.lineTo(l,u);break;case"q":h=R[C++]*e+t,g=R[C++]*e+n,v=R[C++]*e+t,x=R[C++]*e+n,a.quadraticCurveTo(v,x,h,g);break;case"b":h=R[C++]*e+t,g=R[C++]*e+n,v=R[C++]*e+t,x=R[C++]*e+n,S=R[C++]*e+t,w=R[C++]*e+n,a.bezierCurveTo(v,x,S,w,h,g);break}}return{offsetX:s.ha*e,path:a}}function rw(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 Mle(i){if(Array.isArray(i))return i}function Ele(i){if(Array.isArray(i))return rw(i)}function lO(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 Cle(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function GN(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 Rle(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function a(u){GN(s,n,r,a,l,"next",u)}function l(u){GN(s,n,r,a,l,"throw",u)}a(void 0)})}}function tx(i,e,t){return e=z0(e),Fle(i,HE()?Reflect.construct(e,t||[],z0(i).constructor):e.apply(i,t))}function Nle(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function nx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function mm(i,e){return i.get(lO(i,e))}function NS(i,e,t){Nle(i,e),e.set(i,t)}function DS(i,e,t){return i.set(lO(i,e),t),t}function VE(i,e,t){if(HE())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 Dle(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,uO(n.key),n)}}function ix(i,e,t){return e&&Dle(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ps(i,e,t){return(e=uO(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function sw(){return sw=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=kle(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},sw.apply(null,arguments)}function z0(i){return z0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},z0(i)}function rx(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&&ow(i,e)}function HE(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HE=function(){return!!i})()}function Ple(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Lle(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(g){h=!0,r=g}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function Ule(){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 Ble(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function qN(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 Hi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qN(Object(t),!0).forEach(function(n){Ps(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):qN(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ole(i,e){if(i==null)return{};var t,n,r=Ile(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 Ile(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 Fle(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 Cle(i)}function aw(){/*! 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,w,R,C){var E=w&&w.prototype instanceof l?w:l,B=Object.create(E.prototype);return yo(B,"_invoke",(function(L,O,z){var G,k,H,F=0,V=z||[],Y=!1,ee={p:0,n:0,v:i,a:ne,f:ne.bind(i,4),d:function(se,te){return G=se,k=0,H=i,ee.n=te,a}};function ne(se,te){for(k=se,H=te,e=0;!Y&&F&&!Q&&e<V.length;e++){var Q,le=V[e],de=ee.p,Te=le[2];se>3?(Q=Te===te)&&(H=le[(k=le[4])?5:(k=3,3)],le[4]=le[5]=i):le[0]<=de&&((Q=se<2&&de<le[1])?(k=0,ee.v=te,ee.n=le[1]):de<Te&&(Q=se<3||le[0]>te||te>Te)&&(le[4]=se,le[5]=te,ee.n=Te,k=0))}if(Q||se>1)return a;throw Y=!0,te}return function(se,te,Q){if(F>1)throw TypeError("Generator is already running");for(Y&&te===1&&ne(te,Q),k=te,H=Q;(e=k<2?i:H)||!Y;){G||(k?k<3?(k>1&&(ee.n=-1),ne(k,H)):ee.n=H:ee.v=H);try{if(F=2,G){if(k||(se="next"),e=G[se]){if(!(e=e.call(G,H)))throw TypeError("iterator result is not an object");if(!e.done)return e;H=e.value,k<2&&(k=0)}else k===1&&(e=G.return)&&e.call(G),k<2&&(H=TypeError("The iterator does not provide a '"+se+"' method"),k=1);G=i}else if((e=(Y=ee.n<0)?H:L.call(O,ee))!==a)break}catch(le){G=i,k=1,H=le}finally{F=1}}return{value:e,done:Y}}})(S,R,C),!0),B}var a={};function l(){}function u(){}function h(){}e=Object.getPrototypeOf;var g=[][n]?e(e([][n]())):(yo(e={},n,function(){return this}),e),v=h.prototype=l.prototype=Object.create(g);function x(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,h):(S.__proto__=h,yo(S,r,"GeneratorFunction")),S.prototype=Object.create(v),S}return u.prototype=h,yo(v,"constructor",h),yo(h,"constructor",u),u.displayName="GeneratorFunction",yo(h,r,"GeneratorFunction"),yo(v),yo(v,r,"Generator"),yo(v,n,function(){return this}),yo(v,"toString",function(){return"[object Generator]"}),(aw=function(){return{w:s,m:x}})()}function yo(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}yo=function(s,a,l,u){function h(g,v){yo(s,g,function(x){return this._invoke(g,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))},yo(i,e,t,n)}function ow(i,e){return ow=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ow(i,e)}function gr(i,e){return Mle(i)||Lle(i,e)||cO(i,e)||Ule()}function kle(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=z0(i))!==null;);return i}function PS(i,e,t,n){var r=sw(z0(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Qi(i){return Ele(i)||Ple(i)||cO(i)||Ble()}function zle(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 T
2026-03-07 01:56:14 +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 ) ;
} ` ,qle= `
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-07 02:07:49 +01:00
} ` ;function Vle(i,e,t,n){return new Dg.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:Gle,fragmentShader:qle,uniforms:{coefficient:{value:i},color:{value:new Dg.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function Hle(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 Dg.BufferAttribute(n,3)),t}var jle=(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,g=h===void 0?.5:h,v=r.power,x=v===void 0?1:v,S=r.hollowRadius,w=S===void 0?0:S,R=r.backside,C=R===void 0?!0:R;nx(this,e),n=tx(this,e);var E=Hle(t,u),B=Vle(g,a,x,w);return C&&(B.side=Dg.BackSide),n.geometry=E,n.material=B,n}return rx(e,i),ix(e)})(Dg.Mesh), $ l=window.THREE?window.THREE:{Color:an,Group:ja,LineBasicMaterial: $ 0,LineSegments:H7,Mesh:zi,MeshPhongMaterial:nD,SphereGeometry:Eu,SRGBColorSpace:_n,TextureLoader:rM},AO=xs({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){nr(e.globeObj),nr(e.tileEngine),nr(e.graticulesObj)}},stateInit:function(){var e=new $ l.MeshPhongMaterial({color:0}),t=new $ l.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new eY(cr),r=new $ l.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new $ l.LineSegments(new uP(vX(),cr,2),new $ l.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){nr(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 $ l.SphereGeometry(cr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new $ l.TextureLoader().load(e.globeImageUrl,function(l){l.colorSpace= $ l.SRGBColorSpace,n.map=l,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new $ l.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new $ l.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),nr(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var a=e.atmosphereObj=new jle(e.globeObj.geometry,{color:e.atmosphereColor,size:cr*e.atmosphereAltitude,hollowRadius:cr,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())}}),wu=function(e){return isNaN(e)?parseInt(yn(e).toHex(),16):e},Rl=function(e){return e&&isNaN(e)?cA(e).opacity:1},jh=function(e){var t=arguments.length>1&&arg
2026-03-07 01:56:14 +01:00
` .concat(Zn.common, `
` ).concat(Zn.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(Zn.logdepthbuf_vertex, `
}
` ),fragmentShader: `
` .concat(Zn.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(Zn.logdepthbuf_fragment, `
}
` )}},lw=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},Xle=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-07 02:07:49 +01:00
` ),e},WE=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},Yle=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)}}},Qle=["stroke"],yl=window.THREE?window.THREE:{BufferGeometry:Ki,CubicBezierCurve3: $ 7,Curve:Pl,Group:ja,Line:xy,Mesh:zi,NormalBlending:Ka,ShaderMaterial:Ja,TubeGeometry:nM,Vector3:ce},Kle=L0.default||L0,mO=xs({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 Kle,sharedMaterial:new yl.ShaderMaterial(Hi(Hi({},pO()),{},{transparent:!0,blending:yl.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new yl.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(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=Mt(e.arcStartLat),n=Mt(e.arcStartLng),r=Mt(e.arcStartAltitude),s=Mt(e.arcEndLat),a=Mt(e.arcEndLng),l=Mt(e.arcEndAltitude),u=Mt(e.arcAltitude),h=Mt(e.arcAltitudeAutoScale),g=Mt(e.arcStroke),v=Mt(e.arcColor),x=Mt(e.arcDashLength),S=Mt(e.arcDashGap),w=Mt(e.arcDashInitialGap),R=Mt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(L,O){var z=g(O),G=z!=null;if(!L.children.length||G!==(L.children[0].type==="Mesh")){nr(L);var k=G?new yl.Mesh:new yl.Line(new yl.BufferGeometry);k.material=e.sharedMaterial.clone(),L.add(k)}var H=L.children[0];Object.assign(H.material.uniforms,{dashSize:{value:x(O)},gapSize:{value:S(O)},dashOffset:{value:w(O)}});var F=R(O);H.__dashAnimateStep=F>0?1e3/F:0;var V=E(v(O),e.arcCurveResolution,G?e.arcCircularResolution+1:1),Y=B(e.arcCurveResolution,G?e.arcCircularResolution+1:1,!0);H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",Y);var ee=function(Q){var le=L.__currentTargetD=Q,de=le.stroke,Te=Ole(le,Qle),Se=C(Te);G?(H.geometry&&H.geometry.dispose(),H.geometry=new yl.TubeGeometry(Se,e.arcCurveResolution,de/2,e.arcCircularResolution),H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",Y)):H.geometry.setFromPoints(Se.getPoints(e.arcCurveResolution))},ne={stroke:z,alt:u(O),altAutoScale:+h(O),startLat:+t(O),startLng:+n(O),startAlt:+r(O),endLat:+s(O),endLng:+a(O),endAlt:+l(O)},se=L.__currentTargetD||Object.assign({},ne,{altAutoScale:-.001});Object.keys(ne).some(function(te){return se[te]!==ne[te]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?ee(ne):e.tweenGroup.add(new ca(se).to(ne,e.arcsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(ee).start()))}).digest(e.arcsData);function C(L){var O=L.alt,z=L.altAutoScale,G=L.startLat,k=L.startLng,H=L.startAlt,F=L.endLat,V=L.endLng,Y=L.endAlt,ee=function(ye){var Pe=gr(ye,3),pt=Pe[0],vt=Pe[1],Tt=Pe[2],It=el(vt,pt,Tt),Qe=It.x,it=It.y,he=It.z;return new yl.Vector3(Qe,it,he)},ne=[k,G],se=[V,F],te=O;if(te==null&&(te=Vh(ne,se)/2*z+
2026-03-07 01:56:14 +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-07 02:07:49 +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"},xue=-334,bue="Helvetiker",Sue=1522,Tue=50,wue={glyphs:Aue,cssFontWeight:due,ascender:pue,underlinePosition:mue,cssFontStyle:gue,boundingBox:vue,resolution:_ue,original_font_information:yue,descender:xue,familyName:bue,lineHeight:Sue,underlineThickness:Tue},xl=Hi(Hi({},window.THREE?window.THREE:{BoxGeometry: $ h,CircleGeometry:by,DoubleSide:as,Group:ja,Mesh:zi,MeshLambertMaterial:Vc,TextGeometry:zN,Vector3:ce}),{},{Font:Sle,TextGeometry:zN}),MO=xs({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:wue,onChange:function(e,t){t.font=new xl.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;nr(e),t.scene=e,t.tweenGroup=r;var s=new xl.CircleGeometry(1,32);t.dataMapper=new ao(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var a=new xl.MeshLambertMaterial;a.side=as;var l=new xl.Group;l.add(new xl.Mesh(s,a));var u=new xl.Mesh(void 0,a);l.add(u);var h=new xl.Mesh;return h.visible=!1,u.add(h),l.__globeObjType="label",l})},update:function(e){var t=Mt(e.labelLat),n=Mt(e.labelLng),r=Mt(e.labelAltitude),s=Mt(e.labelText),a=Mt(e.labelSize),l=Mt(e.labelRotation),u=Mt(e.labelColor),h=Mt(e.labelIncludeDot),g=Mt(e.labelDotRadius),v=Mt(e.labelDotOrientation),x=new Set(["right","top","bottom"]),S=2*Math.PI*cr/360;e.dataMapper.onUpdateObj(function(w,R){var C=gr(w.children,2),E=C[0],B=C[1],L=gr(B.children,1),O=L[0],z=u(R),G=Rl(z);B.material.color.set(wu(z)),B.material.transparent=G<1,B.material.opacity=G;var k=h(R),H=v(R);!k||!x.has(H)&&(H="bottom");var F=k?+g(R)*S:1e-12;E.scale.x=E.scale.y=F;var V=+a(R)*S;if(B.geometry&&B.geometry.dispose(),B.geometry=new xl.TextGeometry(s(R),{font:e.font,size:V,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),O.geometry&&O.geometry.dispose(),B.geometry.computeBoundingBox(),O.geometry=VE(xl.BoxGeometry,Qi(new xl.Vector3().subVectors(B.geometry.boundingBox.max,B.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),H!=="right"&&B.geometry.center(),k){var Y=F+V/2;H==="right"&&(B.position.x=Y),B.position.y={right:-V/2,top:Y+V/2,bottom:-Y-V/2}[H]}var ee=function(Q){var le=w.__currentTargetD=Q,de=le.lat,Te=le.lng,Se=le.alt,ue=le.rot,be=le.scale;Object.assign(w.position,el(de,Te,Se)),w.lookAt(e.scene.localToWorld(new xl.Vector3(0,0,0))),w.rotateY(Math.PI),w.rotateZ(-ue*Math.PI/180),w.scale.x=w.scale.y=w.scale.z=be},ne={lat:+t(R),lng:+n(R),alt:+r(R),rot:+l(R),scale:1},se=w.__currentTargetD||Object.assign({},ne,{scale:1e-12});Object.keys(ne).some(function(te){return se[te]!==ne[te]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?ee(ne):e.tweenGroup.add(new ca(se).to(ne,e.labelsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(ee).start()))}).digest(e.labelsData)}}),Mue=Hi(Hi({},window.THREE?window.THREE:{}),{},{CSS2DObject:Uj}),EO=xs({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{d
2026-03-07 01:56:14 +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 ;
2026-03-07 02:07:49 +01:00
} ` };class sx{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 $ ce=new kg(-1,1,1,-1,0,1);class Xce extends Ki{constructor(){super(),this.setAttribute("position",new wi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new wi([0,2,0,0,2,0],2))}}const Yce=new Xce;class Qce{constructor(e){this._mesh=new zi(Yce,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh, $ ce)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Kce extends sx{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Ja?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=vy.clone(e.uniforms),this.material=new Ja({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 Qce(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 r7 extends sx{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 Zce extends sx{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Jce{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new ft);this._width=n.width,this._height=n.height,t=new qh(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 Kce(Wce),this.copyPass.material.blending=Qa,this.clock=new aD}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
2026-03-07 01:56:14 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function f7(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 OAe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?f7(Object(t),!0).forEach(function(n){LAe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):f7(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function IAe(i,e){return PAe(i)||UAe(i,e)||zAe(i,e)||BAe()}function FAe(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 kAe(i){var e=FAe(i,"string");return typeof e=="symbol"?e:e+""}function fy(i){"@babel/helpers - typeof";return fy=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},fy(i)}function zAe(i,e){if(i){if(typeof i=="string")return h7(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)?h7(i,e):void 0}}var mw=function(e){if(fy(e)!=="object")return e;var t=aI(e);if(t.props){var n;t.props=OAe({},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(mw):mw(t.props.children))}return t},GAe=function(e){return QO(aI(e))},qAe=function(e,t){delete t.__k,DAe(mw(e),t)};function VAe(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 HAe= ` . 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 ;
}
` ;VAe(HAe);var jAe=xs({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&&fy(e)==="object"&&!!e.node&&typeof e.node=="function",l=xAe(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 g=IAe(h,2),v=g[0],x=g[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 g=SAe(h),v=l.node(),x=v.offsetWidth,S=v.offsetHeight,w=[t.offsetX===null||t.offsetX===void 0?"-".concat(g[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-g[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",g[0]+"px").style("top",g[1]+"px").style("transform","translate(".concat(w.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):GAe(e.content)?(e.tooltipEl.text(""),qAe(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 WAe(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 $ Ae= ` . 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 ;
} ` ;WAe( $ Ae);function gw(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 XAe(i){if(Array.isArray(i))return i}function YAe(i){if(Array.isArray(i))return gw(i)}function QAe(i,e,t){return(e=ide(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function KAe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ZAe(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(g){h=!0,r=g}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function JAe(){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 ede(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function tde(i,e){return XAe(i)||ZAe(i,e)||oI(i,e)||JAe()}function Lf(i){return YAe(i)||KAe(i)||oI(i)||ede()}function nde(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 ide(i){var e=nde(i,"string");return typeof e=="symbol"?e:e+""}function oI(i,e){if(i){if(typeof i=="string")return gw(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)?gw(i,e):void 0}}var br=window.THREE?window.THREE:{WebGLRenderer:Lj,Scene:Yw,PerspectiveCamera:ya,Raycaster:Xz,SRGBColorSpace:_n,TextureLoader:rM,Vector2:ft,Vector3:ce,Box3:Gc,Color:an,Mesh:zi,SphereGeometry:Eu,MeshBasicMaterial:pA,BackSide:hr,Clock:aD},lI=xs({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&&Mt(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)g(a),v(l);else{var u=Object.assign({},s.position),h=x();e.tweenGroup.add(new ca(u).to(a,r).easing(os.Quadratic.Out).onUpdate(g).start()),e.tweenGroup.add(new ca(h).to(l,r/3).easing(os.Quadratic.Out).onUpdate(v).start())}return this}return Object.assign({},s.position,{lookAt:x()});function g(S){var w=S.x,R=S.y,C=S.z;w!==void 0&&(s.position.x=w),R!==void 0&&(s.position.y=R),C!==void 0&&(s.position.z=C)}function v(S){var w=new br.Vector3(S.x,S.y,S.z);e.controls.enabled&&e.controls.target?e.controls.target=w:s.lookAt(w)}function x(){return Object.assign(new br.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-07 01:56:14 +01:00
cursor : pointer ;
} ` ;rde(sde);function vw(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 ade(i){if(Array.isArray(i))return vw(i)}function r1(i,e,t){return(e=fde(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ode(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function lde(){throw new TypeError( ` Invalid attempt to spread non - iterable instance .
2026-03-07 02:07:49 +01:00
In order to be iterable , non - array objects must have a [ Symbol . iterator ] ( ) method . ` )}function A7(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 jf(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?A7(Object(t),!0).forEach(function(n){r1(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):A7(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function ude(i,e){if(i==null)return{};var t,n,r=cde(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 cde(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 ux(i){return ade(i)||ode(i)||Ade(i)||lde()}function hde(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 fde(i){var e=hde(i,"string");return typeof e=="symbol"?e:e+""}function Ade(i,e){if(i){if(typeof i=="string")return vw(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)?vw(i,e):void 0}}function uI(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 g=a[r].apply(a,u);return g===a?this:g}}}}var dde=["rendererConfig","waitForGlobeReady"],vm=jf(jf({},window.THREE?window.THREE:{AmbientLight:sD,DirectionalLight:rD,Vector2:ft,REVISION:V0}),{},{CSS2DRenderer:Bj}),cI=uI("globe",DO),pde=Object.assign.apply(Object,ux(["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