Files
4.0/dist/electron/static/sdk/index.js

9274 lines
3.4 MiB
JavaScript
Raw Normal View History

2025-07-03 17:39:09 +08:00
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.96
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
var Zxe=Object.create;var sN=Object.defineProperty;var Jxe=Object.getOwnPropertyDescriptor;var Qxe=Object.getOwnPropertyNames;var eCe=Object.getPrototypeOf,tCe=Object.prototype.hasOwnProperty;var m_=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var $o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pX=(e,t)=>{for(var n in t)sN(e,n,{get:t[n],enumerable:!0})},nCe=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Qxe(t))!tCe.call(e,o)&&o!==n&&sN(e,o,{get:()=>t[o],enumerable:!(i=Jxe(t,o))||i.enumerable});return e};var Qc=(e,t,n)=>(n=e!=null?Zxe(eCe(e)):{},nCe(t||!e||!e.__esModule?sN(n,"default",{value:e,enumerable:!0}):n,e));var yX=$o((zyt,gX)=>{var vm=function(e){e==null&&(e=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};vm.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};vm.prototype.init_by_array=function(e,t){var n,i,o;for(this.init_seed(19650218),n=1,i=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+e[i]+i,this.mt[n]>>>=0,n++,i++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648};vm.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[e&1];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[e&1];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0};vm.prototype.random_int31=function(){return this.random_int()>>>1};vm.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};vm.prototype.random=function(){return this.random_int()*(1/4294967296)};vm.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};vm.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};gX.exports=vm});var IX=$o((bC,EC)=>{/*! https://mths.be/punycode v1.4.0 by @mathias */(function(e){var t=typeof bC=="object"&&bC&&!bC.nodeType&&bC,n=typeof EC=="object"&&EC&&!EC.nodeType&&EC,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(e=i);var o,r=2147483647,s=36,a=1,c=26,u=38,f=700,d=72,p=128,_="-",m=/^xn--/,x=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=s-a,E=Math.floor,S=String.fromCharCode,w;function D(U){throw new RangeError(A[U])}function R(U,z){for(var V=U.length,Y=[];V--;)Y[V]=z(U[V]);return Y}function M(U,z){var V=U.split("@"),Y="";V.length>1&&(Y=V[0]+"@",U=V[1]),U=U.replace(C,".");var j=U.split("."),$=R(j,z).join(".");return Y+$}function L(U){for(var z=[],V=0,Y=U.length,j,$;V<Y;)j=U.charCodeAt(V++),j>=55296&&j<=56319&&V<Y?($=U.charCodeAt(V++),($&64512)==56320?z.push(((j&1023)<<10)+($&1023)+65536):(z.push(j),V--)):z.push(j);return z}function N(U
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.11
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/(function(e,t){"use strict";typeof NP=="object"&&NP.exports?NP.exports=t():typeof define=="function"&&define.amd?define(t):e.IPv6=t(e)})(OX,function(e){"use strict";var t=e&&e.IPv6;function n(o){var r=o.toLowerCase(),s=r.split(":"),a=s.length,c=8;s[0]===""&&s[1]===""&&s[2]===""?(s.shift(),s.shift()):s[0]===""&&s[1]===""?s.shift():s[a-1]===""&&s[a-2]===""&&s.pop(),a=s.length,s[a-1].indexOf(".")!==-1&&(c=7);var u;for(u=0;u<a&&s[u]!=="";u++);if(u<c)for(s.splice(u,1,"0000");s.length<c;)s.splice(u,0,"0000");for(var f,d=0;d<c;d++){f=s[d].split("");for(var p=0;p<3&&(f[0]==="0"&&f.length>1);p++)f.splice(0,1);s[d]=f.join("")}var _=-1,m=0,x=0,C=-1,A=!1;for(d=0;d<c;d++)A?s[d]==="0"?x+=1:(A=!1,x>m&&(_=C,m=x)):s[d]==="0"&&(A=!0,C=d,x=1);x>m&&(_=C,m=x),m>1&&s.splice(_,m,""),a=s.length;var T="";for(s[0]===""&&(T=":"),d=0;d<a&&(T+=s[d],d!==a-1);d++)T+=":";return s[a-1]===""&&(T+=":"),T}function i(){return e.IPv6===this&&(e.IPv6=t),this}return{best:n,noConflict:i}})});var BX=$o((MX,FP)=>{/*!
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.19.11
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/(function(e,t){"use strict";typeof FP=="object"&&FP.exports?FP.exports=t():typeof define=="function"&&define.amd?define(t):e.SecondLevelDomains=t(e)})(MX,function(e){"use strict";var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow l
* URI.js - Mutating URLs
*
* Version: 1.19.11
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/(function(e,t){"use strict";typeof VP=="object"&&VP.exports?VP.exports=t(IX(),RX(),BX()):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(LX,function(e,t,n,i){"use strict";var o=i&&i.URI;function r(b,v){var P=arguments.length>=1,B=arguments.length>=2;if(!(this instanceof r))return P?B?new r(b,v):new r(b):new r;if(b===void 0){if(P)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?b=location.href+"":b=""}if(b===null&&P)throw new TypeError("null is not a valid argument for URI");return this.href(b),v!==void 0?this.absoluteTo(v):this}function s(b){return/^[0-9]+$/.test(b)}r.version="1.19.11";var a=r.prototype,c=Object.prototype.hasOwnProperty;function u(b){return b.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(b){return b===void 0?"Undefined":String(Object.prototype.toString.call(b)).slice(8,-1)}function d(b){return f(b)==="Array"}function p(b,v){var P={},B,F;if(f(v)==="RegExp")P=null;else if(d(v))for(B=0,F=v.length;B<F;B++)P[v[B]]=!0;else P[v]=!0;for(B=0,F=b.length;B<F;B++){var k=P&&P[b[B]]!==void 0||!P&&v.test(b[B]);k&&(b.splice(B,1),F--,B--)}return b}function _(b,v){var P,B;if(d(v)){for(P=0,B=v.length;P<B;P++)if(!_(b,v[P]))return!1;return!0}var F=f(v);for(P=0,B=b.length;P<B;P++)if(F==="RegExp"){if(typeof b[P]=="string"&&b[P].match(v))return!0}else if(b[P]===v)return!0;return!1}function m(b,v){if(!d(b)||!d(v)||b.length!==v.length)return!1;b.sort(),v.sort();for(var P=0,B=b.length;P<B;P++)if(b[P]!==v[P])return!1;return!0}function x(b){var v=/^\/+|\/+$/g;return b.replace(v,"")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var f=Object.hasOwnProperty,d=Object.setPrototypeOf,p=Object.isFrozen,_=Object.getPrototypeOf,m=Object.getOwnPropertyDescriptor,x=Object.freeze,C=Object.seal,A=Object.create,T=typeof Reflect<"u"&&Reflect,E=T.apply,S=T.construct;E||(E=function(xt,pe,Be){return xt.apply(pe,Be)}),x||(x=function(xt){return xt}),C||(C=function(xt){return xt}),S||(S=function(xt,pe){return i(xt,o(pe))});var w=B(Array.prototype.forEach),D=B(Array.prototype.pop),R=B(Array.prototype.push),M=B(String.prototype.toLowerCase),L=B(String.prototype.match),N=B(String.prototype.replace),g=B(String.prototype.indexOf),b=B(String.prototype.trim),v=B(RegExp.prototype.test),P=F(TypeError);function B(Ke){return function(xt){for(var pe=arguments.length,Be=new Array(pe>1?pe-1:0),ne=1;ne<pe;ne++)Be[ne-1]=arguments[ne];return E(Ke,xt,Be)}}function F(Ke){return function(){for(var xt=arguments.length,pe=new Array(xt),Be=0;Be<xt;Be++)pe[Be]=arguments[Be];return S(Ke,pe)}}function k(Ke,xt,pe){pe=pe||M,d&&d(Ke,null);for(var Be=xt.length;Be--;){var ne=xt[Be];if(typeof ne=="string"){var Ce=pe(ne);Ce!==ne&&(p(xt)||(xt[Be]=Ce),ne=Ce)}Ke[ne]=!0}return Ke}function U(Ke){var xt=A(null),pe;for(pe in Ke)E(f,Ke,[pe])&&(xt[pe]=Ke[pe]);return xt}function z(Ke,xt){for(;Ke!==null;){var pe=m(Ke,xt);if(pe){if(pe.get)return B(pe.get);if(typeof pe.value=="function")return B(pe.value)}Ke=_(Ke)}function Be(ne){return console.warn("fallback value for",ne),null}return Be}var V=x(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Y=x(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=x(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$=x(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G=x(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),K=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),J=x(["#text"]),ce=x(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","colo
`+Ac),ns&&(Ac=N(Ac,Rn," "),Ac=N(Ac,xn," ")),ze&&Lf?ze.createHTML(Ac):Ac},xt.setConfig=function(Xn){Rt(Xn),mC=!0},xt.clearConfig=function(){h_=null,mC=!1},xt.isValidAttribute=function(Xn,Me,Vt){h_||Rt({});var bn=Ts(Xn),Ko=Ts(Me);return fX(bn,Ko,Vt)},xt.addHook=function(Xn,Me){typeof Me=="function"&&(At[Xn]=At[Xn]||[],R(At[Xn],Me))},xt.removeHook=function(Xn){if(At[Xn])return D(At[Xn])},xt.removeHooks=function(Xn){At[Xn]&&(At[Xn]=[])},xt.removeAllHooks=function(){At={}},xt}var yt=yi();return yt})});var YZ=$o((ENt,h2)=>{"use strict";h2.exports=z1;h2.exports.default=z1;function z1(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=WZ(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,c,u,f,d,p,_;if(i&&(r=ive(e,t,r,n)),e.length>80*n){a=u=e[0],c=f=e[1];for(var m=n;m<o;m+=n)d=e[m],p=e[m+1],d<a&&(a=d),p<c&&(c=p),d>u&&(u=d),p>f&&(f=p);_=Math.max(u-a,f-c),_=_!==0?32767/_:0}return kE(r,s,n,a,c,_,0),s}function WZ(e,t,n,i,o){var r,s;if(o===d2(e,t,n,i)>0)for(r=t;r<n;r+=i)s=GZ(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=GZ(r,e[r],e[r+1],s);return s&&H1(s,s.next)&&(zE(s),s=s.next),s}function z0(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(H1(n,n.next)||Yr(n.prev,n,n.next)===0)){if(zE(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function kE(e,t,n,i,o,r,s){if(!!e){!s&&r&&cve(e,i,o,r);for(var a=e,c,u;e.prev!==e.next;){if(c=e.prev,u=e.next,r?eve(e,i,o,r):Qwe(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),zE(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=tve(z0(e),t,n),kE(e,t,n,i,o,r,2)):s===2&&nve(e,t,n,i,o,r):kE(z0(e),t,n,i,o,r,1);break}}}}function Qwe(e){var t=e.prev,n=e,i=e.next;if(Yr(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,c=n.y,u=i.y,f=o<r?o<s?o:s:r<s?r:s,d=a<c?a<u?a:u:c<u?c:u,p=o>r?o>s?o:s:r>s?r:s,_=a>c?a>u?a:u:c>u?c:u,m=i.next;m!==t;){if(m.x>=f&&m.x<=p&&m.y>=d&&m.y<=_&&nA(o,a,r,c,s,u,m.x,m.y)&&Yr(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function eve(e,t,n,i){var o=e.prev,r=e,s=e.next;if(Yr(o,r,s)>=0)return!1;for(var a=o.x,c=r.x,u=s.x,f=o.y,d=r.y,p=s.y,_=a<c?a<u?a:u:c<u?c:u,m=f<d?f<p?f:p:d<p?d:p,x=a>c?a>u?a:u:c>u?c:u,C=f>d?f>p?f:p:d>p?d:p,A=u2(_,m,t,n,i),T=u2(x,C,t,n,i),E=e.prevZ,S=e.nextZ;E&&E.z>=A&&S&&S.z<=T;){if(E.x>=_&&E.x<=x&&E.y>=m&&E.y<=C&&E!==o&&E!==s&&nA(a,f,c,d,u,p,E.x,E.y)&&Yr(E.prev,E,E.next)>=0||(E=E.prevZ,S.x>=_&&S.x<=x&&S.y>=m&&S.y<=C&&S!==o&&S!==s&&nA(a,f,c,d,u,p,S.x,S.y)&&Yr(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;E&&E.z>=A;){if(E.x>=_&&E.x<=x&&E.y>=m&&E.y<=C&&E!==o&&E!==s&&nA(a,f,c,d,u,p,E.x,E.y)&&Yr(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;S&&S.z<=T;){if(S.x>=_&&S.x<=x&&S.y>=m&&S.y<=C&&S!==o&&S!==s&&nA(a,f,c,d,u,p,S.x,S.y)&&Yr(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function tve(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!H1(o,r)&&jZ(o,i,i.next,r)&&UE(o,r)&&UE(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),zE(i),zE(i.next),i=e=r),i=i.next}while(i!==e);return z0(i)}function nve(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&fve(s,a)){var c=qZ(s,a);s=z0(s,s.next),c=z0(c,c.next),kE(s,t,n,i,o,r,0),kE(c,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function ive(e,t,n,i){var o=[],r,s,a,c,u;for(r=0,s=t.length;r<s;r++)a=t[r]*i,c=r<s-1?t[r+1]*i:e.length,u=WZ(e,a,c,i,!1),u===u.next&&(u.steiner=!0),o.push(uve(u));for(o.sort(ove),r=0;r<o.length;r++)n=rve(o[r],n);return n}function ove(e,t){return e.x-t.x}function rve(e,t){var n=sve(e,t);if(!n)return t;var i=qZ(n,e);return z0(i,i.next),z0(n,n.next)}function sve(e,t){var n=t,i=e.x,o=e.y,r=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>r&&(r=a,s=n.x<n.next.x?n:n.next,a===i))return s}n=n.next}while(n!==t);if(!s)return null;var c=s,u=s.x,f=s.y,d=1/0,p;n=s;do i>=n.x&&n.x>=u&&i!==n.x&&nA(o<f?i:r,o,u,f,o<f?r:i,o,n.x,n.y)&&(p=Math.abs(o-n.y)/(i-n.x),UE(n,e)&&(p<d||p===d&&(n.x>s.x||n.x===s.x&&ave(s,n)))&&(s=n,d=p)),n=n.next;while(n!==c);return s}function ave(e,t){return Yr(e.prev,e,t.prev)<0&&Yr(t.next,e,e.next)<0}function cve(e,t,n,i){var o=e;do o.z===0&&(o.z=u2(o.x,o.y,t,n,i)),o.prevZ=
* protobuf.js v6.10.2 (c) 2016, daniel wirtz
* compiled fri, 08 jul 2022 16:17:13 utc
* licensed under the bsd-3-clause license
* see: https://github.com/dcodeio/protobuf.js for details
*/(function(undefined){"use strict";(function(t,n,i){function o(s){var a=n[s];return a||t[s][0].call(a=n[s]={exports:{}},o,a,a.exports),a.exports}var r=o(i[0]);r.util.global.protobuf=r,typeof define=="function"&&define.amd&&define(["long"],function(s){return s&&s.isLong&&(r.util.Long=s,r.configure()),r}),typeof module=="object"&&module&&module.exports&&(module.exports=r)})({1:[function(e,t,n){"use strict";t.exports=i;function i(o,r){for(var s=new Array(arguments.length-1),a=0,c=2,u=!0;c<arguments.length;)s[a++]=arguments[c++];return new Promise(function(d,p){s[a]=function(m){if(u)if(u=!1,m)p(m);else{for(var x=new Array(arguments.length-1),C=0;C<x.length;)x[C++]=arguments[C];d.apply(null,x)}};try{o.apply(r||null,s)}catch(_){u&&(u=!1,p(_))}})}},{}],2:[function(e,t,n){"use strict";var i=n;i.length=function(u){var f=u.length;if(!f)return 0;for(var d=0;--f%4>1&&u.charAt(f)==="=";)++d;return Math.ceil(u.length*3)/4-d};for(var o=new Array(64),r=new Array(123),s=0;s<64;)r[o[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(u,f,d){for(var p=null,_=[],m=0,x=0,C;f<d;){var A=u[f++];switch(x){case 0:_[m++]=o[A>>2],C=(A&3)<<4,x=1;break;case 1:_[m++]=o[C|A>>4],C=(A&15)<<2,x=2;break;case 2:_[m++]=o[C|A>>6],_[m++]=o[A&63],x=0;break}m>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,_)),m=0)}return x&&(_[m++]=o[C],_[m++]=61,x===1&&(_[m++]=61)),p?(m&&p.push(String.fromCharCode.apply(String,_.slice(0,m))),p.join("")):String.fromCharCode.apply(String,_.slice(0,m))};var a="invalid encoding";i.decode=function(u,f,d){for(var p=d,_=0,m,x=0;x<u.length;){var C=u.charCodeAt(x++);if(C===61&&_>1)break;if((C=r[C])===undefined)throw Error(a);switch(_){case 0:m=C,_=1;break;case 1:f[d++]=m<<2|(C&48)>>4,m=C,_=2;break;case 2:f[d++]=(m&15)<<4|(C&60)>>2,m=C,_=3;break;case 3:f[d++]=(m&3)<<6|C,_=0;break}}if(_===1)throw Error(a);return d-p},i.test=function(u){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u)}},{}],3:[function(e,t,n){"use strict";t.exports=i;function i(){this._listeners={}}i.prototype.on=function(r,s,a){return(this._listeners[r]||(this._listeners[r]=[])).push({fn:s,ctx:a||this}),this},i.prototype.off=function(r,s){if(r===undefined)this._listeners={};else if(s===undefined)this._listeners[r]=[];else for(var a=this._listeners[r],c=0;c<a.length;)a[c].fn===s?a.splice(c,1):++c;return this},i.prototype.emit=function(r){var s=this._listeners[r];if(s){for(var a=[],c=1;c<arguments.length;)a.push(arguments[c++]);for(c=0;c<s.length;)s[c].fn.apply(s[c++].ctx,a)}return this}},{}],4:[function(e,t,n){"use strict";t.exports=i(i);function i(c){return typeof Float32Array<"u"?function(){var u=new Float32Array([-0]),f=new Uint8Array(u.buffer),d=f[3]===128;function p(C,A,T){u[0]=C,A[T]=f[0],A[T+1]=f[1],A[T+2]=f[2],A[T+3]=f[3]}function _(C,A,T){u[0]=C,A[T]=f[3],A[T+1]=f[2],A[T+2]=f[1],A[T+3]=f[0]}c.writeFloatLE=d?p:_,c.writeFloatBE=d?_:p;function m(C,A){return f[0]=C[A],f[1]=C[A+1],f[2]=C[A+2],f[3]=C[A+3],u[0]}function x(C,A){return f[3]=C[A],f[2]=C[A+1],f[1]=C[A+2],f[0]=C[A+3],u[0]}c.readFloatLE=d?m:x,c.readFloatBE=d?x:m}():function(){function u(d,p,_,m){var x=p<0?1:0;if(x&&(p=-p),p===0)d(1/p>0?0:2147483648,_,m);else if(isNaN(p))d(2143289344,_,m);else if(p>34028234663852886e22)d((x<<31|2139095040)>>>0,_,m);else if(p<11754943508222875e-54)d((x<<31|Math.round(p/1401298464324817e-60))>>>0,_,m);else{var C=Math.floor(Math.log(p)/Math.LN2),A=Math.round(p*Math.pow(2,-C)*8388608)&8388607;d((x<<31|C+127<<23|A)>>>0,_,m)}}c.writeFloatLE=u.bind(null,o),c.writeFloatBE=u.bind(null,r);function f(d,p,_){var m=d(p,_),x=(m>>31)*2+1,C=m>>>23&255,A=m&8388607;return C===255?A?NaN:x*(1/0):C===0?x*1401298464324817e-60*A:x*Math.pow(2,C-150)*(A+8388608)}c.readFloatLE=f.bind(null,s),c.readFloatBE=f.bind(null,a)}(),typeof Float64Array<"u"?function(){var u=new Float64Array([-0]),f=new Uint8Array(u.buffer),d=f[7]===128;function p(C,A,T){u[0]=C,A[T]=f[0],A[T+1]=f[1],A[T+2]=f[2],A[T+3]=f[3],A[T+4]=f[4],A[T+5]=f[5],A[T+6]=f[6],A[T+7]=f[7]}function _(C,A,T){u[0]=C,A[T]=f[7],A[T+1]=f[6],A[T+2]=f[5],A[T+3]=f[4],A[T+4]=f[3],A[T+5]=f[2],A[T+6]=f[1],A
`;break;case"r":pe+="\r";break;case"t":pe+=" ";break;case"b":pe+="\b";break;case"f":pe+="\f";break;case"v":pe+="\v";break;default:pe+=Ce}else pe+=Ce;return ne||R('Unclosed quote after "'+pe+'"',G),{type:o,value:pe,raw:Be+pe+Be}},en=function(){var pe=de(G),Be=G,ne;for(z(pe)?G++:R("Unexpected "+ce(G),G);G<oe&&(pe=de(G),V(pe));)G++;return ne=$.slice(Be,G),P.hasOwnProperty(ne)?{type:o,value:P[ne],raw:ne}:ne===B?{type:r}:{type:n,name:ne}},jt=function(pe){for(var Be,ne=[],Ce,Le=!1,qe=0;G<oe;)if(le(),Be=de(G),Be===pe){Le=!0,G++,pe===A&&qe&&qe>=ne.length&&R("Unexpected token "+String.fromCharCode(pe),G);break}else if(Be===_){if(G++,qe++,qe!==ne.length){if(pe===A)R("Unexpected token ,",G);else if(pe===E)for(var st=ne.length;st<qe;st++)ne.push(null)}}else Ce=ge(),(!Ce||Ce.type===t)&&R("Expected comma",G),ne.push(Ce);return Le||R("Expected "+String.fromCharCode(pe),G),ne},Et=function(){var pe,Be;for(pe=de(G),pe===C?Be=Mt():Be=en(),le(),pe=de(G);pe===p||pe===T||pe===C;)G++,pe===p?(le(),Be={type:i,computed:!1,object:Be,property:en()}):pe===T?(Be={type:i,computed:!0,object:Be,property:ge()},le(),pe=de(G),pe!==E&&R("Unclosed [",G),G++):pe===C&&(Be={type:s,arguments:jt(A),callee:Be}),le(),pe=de(G);return Be},Mt=function(){G++;var pe=ge();if(le(),de(G)===A)return G++,pe;R("Unclosed (",G)},yi=function(){return G++,{type:d,elements:jt(E)}},yt=[],Ke,xt;G<oe;)Ke=de(G),Ke===w||Ke===_?G++:(xt=ge())?yt.push(xt):G<oe&&R('Unexpected "'+ce(G)+'"',G);return yt.length===1?yt[0]:{type:t,body:yt}};if(Y.version="0.3.5",Y.toString=function(){return"JavaScript Expression Parser (JSEP) v"+Y.version},Y.addUnaryOp=function($){return b=Math.max($.length,b),L[$]=M,this},Y.addBinaryOp=function($,G){return v=Math.max($.length,v),N[$]=G,this},Y.addLiteral=function($,G){return P[$]=G,this},Y.removeUnaryOp=function($){return delete L[$],$.length===b&&(b=g(L)),this},Y.removeAllUnaryOps=function(){return L={},b=0,this},Y.removeBinaryOp=function($){return delete N[$],$.length===v&&(v=g(N)),this},Y.removeAllBinaryOps=function(){return N={},v=0,this},Y.removeLiteral=function($){return delete P[$],this},Y.removeAllLiterals=function(){return P={},this},typeof ww>"u"){var j=e.jsep;e.jsep=Y,Y.noConflict=function(){return e.jsep===Y&&(e.jsep=j),Y}}else typeof aO<"u"&&aO.exports?ww=aO.exports=Y:ww.parse=Y})(ww)});var cae=$o((rNn,aae)=>{"use strict";aae.exports=hGe;var $w=1e20;function hGe(e,t){t||(t={});var n=t.cutoff==null?.25:t.cutoff,i=t.radius==null?8:t.radius,o=t.channel||0,r,s,a,c,u,f,d,p,_,m,x;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");r=t.width,s=t.height,c=e,t.stride?f=t.stride:f=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(p=e,d=p.getContext("2d"),r=p.width,s=p.height,_=d.getImageData(0,0,r,s),c=_.data,f=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(p=e.canvas,d=e,r=p.width,s=p.height,_=d.getImageData(0,0,r,s),c=_.data,f=4):window.ImageData&&e instanceof window.ImageData&&(_=e,r=e.width,s=e.height,c=_.data,f=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&c instanceof window.Uint8ClampedArray||window.Uint8Array&&c instanceof window.Uint8Array)for(u=c,c=Array(r*s),m=0,x=Math.floor(u.length/f);m<x;m++)c[m]=u[m*f+o]/255;else if(f!==1)throw Error("Raw data can have only 1 value per pixel");var C=Array(r*s),A=Array(r*s),T=Array(a),E=Array(a),S=Array(a+1),w=Array(a);for(m=0,x=r*s;m<x;m++){var D=c[m];C[m]=D===1?0:D===0?$w:Math.pow(Math.max(0,.5-D),2),A[m]=D===1?$w:D===0?0:Math.pow(Math.max(0,D-.5),2)}rae(C,r,s,T,E,w,S),rae(A,r,s,T,E,w,S);var R=window.Float32Array?new Float32Array(r*s):new Array(r*s);for(m=0,x=r*s;m<x;m++)R[m]=Math.min(Math.max(1-((C[m]-A[m])/i+n),0),1);return R}function rae(e,t,n,i,o,r,s){for(var a=0;a<t;a++){for(var c=0;c<n;c++)i[c]=e[c*t+a];for(sae(i,o,r,s,n),c=0;c<n;c++)e[c*t+a]=o[c]}for(c=0;c<n;c++){for(a=0;a<t;a++)i[a]=e[c*t+a];for(sae(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function sae(e,t,n,i,o){n[0]=0,i[0]=-$w,i[1]=+$w;for(var r=1,s=0;r<o;r++){for(var a=(
NoSleep enabled for older iOS devices. This can interrupt
active or long-running network requests from completing successfully.
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3)):this.noSleepVideo.play()}disable(){iY?this.noSleepTimer&&(console.warn(`
NoSleep now disabled for older iOS devices.
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}};sye.exports=oY});var mP=$o(Kc=>{"use strict";var _gt=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function ggt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Kc.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var i in n)ggt(n,i)&&(e[i]=n[i])}}return e};Kc.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var ygt={arraySet:function(e,t,n,i,o){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+i),o);return}for(var r=0;r<i;r++)e[o+r]=t[n+r]},flattenChunks:function(e){var t,n,i,o,r,s;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(s=new Uint8Array(i),o=0,t=0,n=e.length;t<n;t++)r=e[t],s.set(r,o),o+=r.length;return s}},xgt={arraySet:function(e,t,n,i,o){for(var r=0;r<i;r++)e[o+r]=t[n+r]},flattenChunks:function(e){return[].concat.apply([],e)}};Kc.setTyped=function(e){e?(Kc.Buf8=Uint8Array,Kc.Buf16=Uint16Array,Kc.Buf32=Int32Array,Kc.assign(Kc,ygt)):(Kc.Buf8=Array,Kc.Buf16=Array,Kc.Buf32=Array,Kc.assign(Kc,xgt))};Kc.setTyped(_gt)});var lye=$o((QWi,cye)=>{"use strict";function Cgt(e,t,n,i){for(var o=e&65535|0,r=e>>>16&65535|0,s=0;n!==0;){s=n>2e3?2e3:n,n-=s;do o=o+t[i++]|0,r=r+o|0;while(--s);o%=65521,r%=65521}return o|r<<16|0}cye.exports=Cgt});var fye=$o((e7i,uye)=>{"use strict";function Agt(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var Tgt=Agt();function bgt(e,t,n,i){var o=Tgt,r=i+n;e^=-1;for(var s=i;s<r;s++)e=e>>>8^o[(e^t[s])&255];return e^-1}uye.exports=bgt});var hye=$o((t7i,dye)=>{"use strict";var EL=30,Egt=12;dye.exports=function(t,n){var i,o,r,s,a,c,u,f,d,p,_,m,x,C,A,T,E,S,w,D,R,M,L,N,g;i=t.state,o=t.next_in,N=t.input,r=o+(t.avail_in-5),s=t.next_out,g=t.output,a=s-(n-t.avail_out),c=s+(t.avail_out-257),u=i.dmax,f=i.wsize,d=i.whave,p=i.wnext,_=i.window,m=i.hold,x=i.bits,C=i.lencode,A=i.distcode,T=(1<<i.lenbits)-1,E=(1<<i.distbits)-1;e:do{x<15&&(m+=N[o++]<<x,x+=8,m+=N[o++]<<x,x+=8),S=C[m&T];t:for(;;){if(w=S>>>24,m>>>=w,x-=w,w=S>>>16&255,w===0)g[s++]=S&65535;else if(w&16){D=S&65535,w&=15,w&&(x<w&&(m+=N[o++]<<x,x+=8),D+=m&(1<<w)-1,m>>>=w,x-=w),x<15&&(m+=N[o++]<<x,x+=8,m+=N[o++]<<x,x+=8),S=A[m&E];n:for(;;){if(w=S>>>24,m>>>=w,x-=w,w=S>>>16&255,w&16){if(R=S&65535,w&=15,x<w&&(m+=N[o++]<<x,x+=8,x<w&&(m+=N[o++]<<x,x+=8)),R+=m&(1<<w)-1,R>u){t.msg="invalid distance too far back",i.mode=EL;break e}if(m>>>=w,x-=w,w=s-a,R>w){if(w=R-w,w>d&&i.sane){t.msg="invalid distance too far back",i.mode=EL;break e}if(M=0,L=_,p===0){if(M+=f-w,w<D){D-=w;do g[s++]=_[M++];while(--w);M=s-R,L=g}}else if(p<w){if(M+=f+p-w,w-=p,w<D){D-=w;do g[s++]=_[M++];while(--w);if(M=0,p<D){w=p,D-=w;do g[s++]=_[M++];while(--w);M=s-R,L=g}}}else if(M+=p-w,w<D){D-=w;do g[s++]=_[M++];while(--w);M=s-R,L=g}for(;D>2;)g[s++]=L[M++],g[s++]=L[M++],g[s++]=L[M++],D-=3;D&&(g[s++]=L[M++],D>1&&(g[s++]=L[M++]))}else{M=s-R;do g[s++]=g[M++],g[s++]=g[M++],g[s++]=g[M++],D-=3;while(D>2);D&&(g[s++]=g[M++],D>1&&(g[s++]=g[M++]))}}else if((w&64)===0){S=A[(S&65535)+(m&(1<<w)-1)];continue n}else{t.msg="invalid distance code",i.mode=EL;break e}break}}else if((w&64)===0){S=C[(S&65535)+(m&(1<<w)-1)];continue t}else if(w&32){i.mode=Egt;break e}else{t.msg="invalid literal/length code",i.mode=EL;break e}break}}while(o<r&&s<c);D=x>>3,o-=D,x-=D<<3,m&=(1<<x)-1,t.next_in=o,t.next_out=s,t.avail_in=o<r?5+(r-o):5-(o-r),t.avail_out=s<c?257+(c-s):257-(s-c),i.hold=m,i.bits=x}});var Cye=$o((n7i,xye)=>{"use strict";var mye=mP(),jb=15,pye=852,_ye=592,gye=0,rY=1,yye=2,Sgt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],wgt=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],vgt=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Dgt=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,
${this.stack.toString()}`),e};y0.throwInstantiationError=function(){throw new y0("This function defines an interface and should not be called directly.")};var Ae=y0;var bs={};bs.typeOf={};function rCe(e){return`${e} is required, actual value was undefined`}function xC(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}bs.defined=function(e,t){if(!l(t))throw new Ae(rCe(e))};bs.typeOf.func=function(e,t){if(typeof t!="function")throw new Ae(xC(typeof t,"function",e))};bs.typeOf.string=function(e,t){if(typeof t!="string")throw new Ae(xC(typeof t,"string",e))};bs.typeOf.number=function(e,t){if(typeof t!="number")throw new Ae(xC(typeof t,"number",e))};bs.typeOf.number.lessThan=function(e,t,n){if(bs.typeOf.number(e,t),t>=n)throw new Ae(`Expected ${e} to be less than ${n}, actual value was ${t}`)};bs.typeOf.number.lessThanOrEquals=function(e,t,n){if(bs.typeOf.number(e,t),t>n)throw new Ae(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};bs.typeOf.number.greaterThan=function(e,t,n){if(bs.typeOf.number(e,t),t<=n)throw new Ae(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};bs.typeOf.number.greaterThanOrEquals=function(e,t,n){if(bs.typeOf.number(e,t),t<n)throw new Ae(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};bs.typeOf.object=function(e,t){if(typeof t!="object")throw new Ae(xC(typeof t,"object",e))};bs.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new Ae(xC(typeof t,"boolean",e))};bs.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new Ae(xC(typeof t,"bigint",e))};bs.typeOf.number.equals=function(e,t,n,i){if(bs.typeOf.number(e,n),bs.typeOf.number(t,i),n!==i)throw new Ae(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};var wu=bs;function _X(e,t){return e??t}_X.EMPTY_OBJECT=Object.freeze({});var y=_X;var Dm=Qc(yX(),1);var bt={};bt.EPSILON1=.1;bt.EPSILON2=.01;bt.EPSILON3=.001;bt.EPSILON4=1e-4;bt.EPSILON5=1e-5;bt.EPSILON6=1e-6;bt.EPSILON7=1e-7;bt.EPSILON8=1e-8;bt.EPSILON9=1e-9;bt.EPSILON10=1e-10;bt.EPSILON11=1e-11;bt.EPSILON12=1e-12;bt.EPSILON13=1e-13;bt.EPSILON14=1e-14;bt.EPSILON15=1e-15;bt.EPSILON16=1e-16;bt.EPSILON17=1e-17;bt.EPSILON18=1e-18;bt.EPSILON19=1e-19;bt.EPSILON20=1e-20;bt.EPSILON21=1e-21;bt.GRAVITATIONALPARAMETER=3986004418e5;bt.SOLAR_RADIUS=6955e5;bt.LUNAR_RADIUS=1737400;bt.SIXTY_FOUR_KILOBYTES=64*1024;bt.FOUR_GIGABYTES=4*1024*1024*1024;bt.sign=y(Math.sign,function(t){return t=+t,t===0||t!==t?t:t>0?1:-1});bt.signNotZero=function(e){return e<0?-1:1};bt.toSNorm=function(e,t){return t=y(t,255),Math.round((bt.clamp(e,-1,1)*.5+.5)*t)};bt.fromSNorm=function(e,t){return t=y(t,255),bt.clamp(e,0,t)/t*2-1};bt.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:bt.clamp((e-t)/n,0,1)};bt.sinh=y(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});bt.cosh=y(Math.cosh,function(t){return(Math.exp(t)+Math.exp(-t))/2});bt.lerp=function(e,t,n){return(1-n)*e+n*t};bt.PI=Math.PI;bt.ONE_OVER_PI=1/Math.PI;bt.PI_OVER_TWO=Math.PI/2;bt.PI_OVER_THREE=Math.PI/3;bt.PI_OVER_FOUR=Math.PI/4;bt.PI_OVER_SIX=Math.PI/6;bt.THREE_PI_OVER_TWO=3*Math.PI/2;bt.TWO_PI=2*Math.PI;bt.ONE_OVER_TWO_PI=1/(2*Math.PI);bt.RADIANS_PER_DEGREE=Math.PI/180;bt.DEGREES_PER_RADIAN=180/Math.PI;bt.RADIANS_PER_ARCSECOND=bt.RADIANS_PER_DEGREE/3600;bt.toRadians=function(e){return e*bt.RADIANS_PER_DEGREE};bt.toDegrees=function(e){return e*bt.DEGREES_PER_RADIAN};bt.convertLongitudeRange=function(e){let t=bt.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};bt.clampToLatitudeRange=function(e){return bt.clamp(e,-1*bt.PI_OVER_TWO,bt.PI_OVER_TWO)};bt.negativePiToPi=function(e){return e>=-bt.PI&&e<=bt.PI?e:bt.zeroToTwoPi(e+bt.PI)-bt.PI};bt.zeroToTwoPi=function(e){if(e>=0&&e<=bt.TWO_PI)return e;let t=bt.mod(e,bt.TWO_PI);return Math.abs(t)<bt.EPSILON14&&Math.abs(e)>bt.EPSILON14?bt.TWO_PI:t};bt.mod=function(e,t){return bt.sign(e)===bt.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t};bt.equalsEpsilon=function(e,t,n,i){n=y(n,0),i=y(i,n);let o=Math.abs(e-t);return o<=i||o<=n*Math.max(Math.abs(e),Math.abs(t))};bt.lessThan=function(e,t,n){retu
(${this[1]}, ${this[4]}, ${this[7]})
(${this[2]}, ${this[5]}, ${this[8]})`};var Q=ft;function Bt(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0),this.w=y(i,0)}Bt.fromElements=function(e,t,n,i,o){return l(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new Bt(e,t,n,i)};Bt.fromColor=function(e,t){return l(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new Bt(e.red,e.green,e.blue,e.alpha)};Bt.clone=function(e,t){if(!!l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Bt(e.x,e.y,e.z,e.w)};Bt.packedLength=4;Bt.pack=function(e,t,n){return n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};Bt.unpack=function(e,t,n){return t=y(t,0),l(n)||(n=new Bt),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};Bt.packArray=function(e,t){let n=e.length,i=n*4;l(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)Bt.pack(e[o],t,o*4);return t};Bt.unpackArray=function(e,t){let n=e.length;l(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){let o=i/4;t[o]=Bt.unpack(e,i,t[o])}return t};Bt.fromArray=Bt.unpack;Bt.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)};Bt.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)};Bt.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n};Bt.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n};Bt.clamp=function(e,t,n,i){let o=I.clamp(e.x,t.x,n.x),r=I.clamp(e.y,t.y,n.y),s=I.clamp(e.z,t.z,n.z),a=I.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i};Bt.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};Bt.magnitude=function(e){return Math.sqrt(Bt.magnitudeSquared(e))};var LP=new Bt;Bt.distance=function(e,t){return Bt.subtract(e,t,LP),Bt.magnitude(LP)};Bt.distanceSquared=function(e,t){return Bt.subtract(e,t,LP),Bt.magnitudeSquared(LP)};Bt.normalize=function(e,t){let n=Bt.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t};Bt.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};Bt.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n};Bt.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n};Bt.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};Bt.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};Bt.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};Bt.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};Bt.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};Bt.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var SX=new Bt;Bt.lerp=function(e,t,n,i){return Bt.multiplyByScalar(t,n,SX),i=Bt.multiplyByScalar(e,1-n,i),Bt.add(SX,i,i)};var BCe=new Bt;Bt.mostOrthogonalAxis=function(e,t){let n=Bt.normalize(e,BCe);return Bt.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=Bt.clone(Bt.UNIT_X,t):t=Bt.clone(Bt.UNIT_W,t):n.z<=n.w?t=Bt.clone(Bt.UNIT_Z,t):t=Bt.clone(Bt.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=Bt.clone(Bt.UNIT_Y,t):t=Bt.clone(Bt.UNIT_W,t):n.z<=n.w?t=Bt.clone(Bt.UNIT_Z,t):t=Bt.clone(Bt.UNIT_W,t),t};Bt.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};Bt.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]};Bt.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&I.equalsEpsilon(e.x,t.x,n,i)&&I.equalsEpsilon(e.y,t.y,n,i)&&I.equalsEpsilon(e.z,t.z,n,i)&&I.equalsEpsilon(e.w,t.w,n,i)};Bt.ZERO=Object.freeze(new Bt(0,0,0,0));Bt.ONE=Object.freeze(new Bt(1,1,1,1));Bt.UNIT_X=Object.freeze(new Bt(1,0,0,0));Bt.UNIT_Y=Object.freeze(new Bt(0,1,0,0));Bt.UNIT_Z=Object.freeze(new Bt(0,0,1,0));Bt.UNIT_W=Object.freeze(new Bt(0,0,0,1));Bt.prototype.clone=function(e){return Bt.clone(this,e)};Bt.prototype.equals=function(e){return Bt.equals(this,e)};Bt.prototype.equalsEpsilon=function(e,t,n){return Bt.equalsEpsilon(this,e,t,n)};Bt.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w}
${this.stack.toString()}`),e};var he=lE;function ct(e,t,n,i,o,r,s,a,c,u,f,d,p,_,m,x){this[0]=y(e,0),this[1]=y(o,0),this[2]=y(c,0),this[3]=y(p,0),this[4]=y(t,0),this[5]=y(r,0),this[6]=y(u,0),this[7]=y(_,0),this[8]=y(n,0),this[9]=y(s,0),this[10]=y(f,0),this[11]=y(m,0),this[12]=y(i,0),this[13]=y(a,0),this[14]=y(d,0),this[15]=y(x,0)}ct.packedLength=16;ct.pack=function(e,t,n){return n=y(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t};ct.unpack=function(e,t,n){return t=y(t,0),l(n)||(n=new ct),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n};ct.packArray=function(e,t){let n=e.length,i=n*16;l(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)ct.pack(e[o],t,o*16);return t};ct.unpackArray=function(e,t){let n=e.length;l(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){let o=i/16;t[o]=ct.unpack(e,i,t[o])}return t};ct.clone=function(e,t){if(!!l(e))return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new ct(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])};ct.fromArray=ct.unpack;ct.fromColumnMajorArray=function(e,t){return ct.clone(e,t)};ct.fromRowMajorArray=function(e,t){return l(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new ct(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])};ct.fromRotationTranslation=function(e,t,n){return t=y(t,h.ZERO),l(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new ct(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)};ct.fromTranslationQuaternionRotationScale=function(e,t,n,i){l(i)||(i=new ct);let o=n.x,r=n.y,s=n.z,a=t.x*t.x,c=t.x*t.y,u=t.x*t.z,f=t.x*t.w,d=t.y*t.y,p=t.y*t.z,_=t.y*t.w,m=t.z*t.z,x=t.z*t.w,C=t.w*t.w,A=a-d-m+C,T=2*(c-x),E=2*(u+_),S=2*(c+x),w=-a+d-m+C,D=2*(p-f),R=2*(u-_),M=2*(p+f),L=-a-d+m+C;return i[0]=A*o,i[1]=S*o,i[2]=R*o,i[3]=0,i[4]=T*r,i[5]=w*r,i[6]=M*r,i[7]=0,i[8]=E*s,i[9]=D*s,i[10]=L*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};ct.fromTranslationRotationScale=function(e,t){return ct.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};ct.fromTranslation=function(e,t){return ct.fromRotationTranslation(Q.IDENTITY,e,t)};ct.fromScale=function(e,t){return l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new ct(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};ct.fromUniformScale=function(e,t){return l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new ct(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};ct.fromRotation=function(e,t){return l(t)||(t=new ct),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var AC=new h,TC=new h,uE=new h;ct.fromCamera=function(e,t){let n=e.position,i=e.direction,o=e.up;h.normalize(i,AC),h.normalize(h.cross(AC,o,TC),TC),h.normalize(h.cross(TC,AC,uE),uE);let r=TC.x,s=TC.y,a=TC.z,c=AC.x,u=AC.y,f=AC.z,d=uE.x,p=uE.y,_=uE.z,m=n.x,x=n.y,C=n.z,A=r*-m+s*-x+a*-C,T=d*-m+p*-x+_*-C,E=c*m+u*x+f*C;return l(t)?(t[0]=r,t[1]=d,t[2]=-c,t[3]=0,t[4]=s,t[5]=p,t[6]=-u,t[7]=0,t[8]=a,t[9]=_,t[10]=-f,t[11]=0,t[12]=A,t[13]=T,t[14]=E,t[15]=1,t):new ct(r,s,a,A,d,p,_,T,-c,-u,-f,E,0,0,0,1)};ct.computePerspectiveFieldOfView=function(e,t,n,i,o){let r=Math.tan(e*.5),s=1/r,a=s/t,c=(i+n)/(n-i),u=2*i*n/(n-i);return o[
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};var O=ct;function li(e,t,n,i){this.west=y(e,0),this.south=y(t,0),this.east=y(n,0),this.north=y(i,0)}Object.defineProperties(li.prototype,{width:{get:function(){return li.computeWidth(this)}},height:{get:function(){return li.computeHeight(this)}}});li.packedLength=4;li.pack=function(e,t,n){return n=y(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};li.unpack=function(e,t,n){return t=y(t,0),l(n)||(n=new li),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};li.computeWidth=function(e){let t=e.east,n=e.west;return t<n&&(t+=I.TWO_PI),t-n};li.computeHeight=function(e){return e.north-e.south};li.fromDegrees=function(e,t,n,i,o){return e=I.toRadians(y(e,0)),t=I.toRadians(y(t,0)),n=I.toRadians(y(n,0)),i=I.toRadians(y(i,0)),l(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new li(e,t,n,i)};li.fromRadians=function(e,t,n,i,o){return l(o)?(o.west=y(e,0),o.south=y(t,0),o.east=y(n,0),o.north=y(i,0),o):new li(e,t,n,i)};li.fromCartographicArray=function(e,t){let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let c=0,u=e.length;c<u;c++){let f=e[c];n=Math.min(n,f.longitude),i=Math.max(i,f.longitude),s=Math.min(s,f.latitude),a=Math.max(a,f.latitude);let d=f.longitude>=0?f.longitude:f.longitude+I.TWO_PI;o=Math.min(o,d),r=Math.max(r,d)}return i-n>r-o&&(n=o,i=r,i>I.PI&&(i=i-I.TWO_PI),n>I.PI&&(n=n-I.TWO_PI)),l(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new li(n,s,i,a)};li.fromCartesianArray=function(e,t,n){t=y(t,se.WGS84);let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let u=0,f=e.length;u<f;u++){let d=t.cartesianToCartographic(e[u]);i=Math.min(i,d.longitude),o=Math.max(o,d.longitude),a=Math.min(a,d.latitude),c=Math.max(c,d.latitude);let p=d.longitude>=0?d.longitude:d.longitude+I.TWO_PI;r=Math.min(r,p),s=Math.max(s,p)}return o-i>s-r&&(i=r,o=s,o>I.PI&&(o=o-I.TWO_PI),i>I.PI&&(i=i-I.TWO_PI)),l(n)?(n.west=i,n.south=a,n.east=o,n.north=c,n):new li(i,a,o,c)};li.clone=function(e,t){if(!!l(e))return l(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new li(e.west,e.south,e.east,e.north)};li.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||l(e)&&l(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n};li.prototype.clone=function(e){return li.clone(this,e)};li.prototype.equals=function(e){return li.equals(this,e)};li.equals=function(e,t){return e===t||l(e)&&l(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north};li.prototype.equalsEpsilon=function(e,t){return li.equalsEpsilon(this,e,t)};li.validate=function(e){};li.southwest=function(e,t){return l(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new _e(e.west,e.south)};li.northwest=function(e,t){return l(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new _e(e.west,e.north)};li.northeast=function(e,t){return l(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new _e(e.east,e.north)};li.southeast=function(e,t){return l(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new _e(e.east,e.south)};li.center=function(e,t){let n=e.east,i=e.west;n<i&&(n+=I.TWO_PI);let o=I.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return l(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new _e(o,r)};li.intersection=function(e,t,n){let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=I.TWO_PI:r<s&&i>0&&(r+=I.TWO_PI),i<o&&s<0?s+=I.TWO_PI:r<s&&o<0&&(o+=I.TWO_PI);let a=I.negativePiToPi(Math.max(o,s)),c=I.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&c<=a)return;let u=Math.max(e.south,t.south),f=Math.min(e.north,t.north);if(!(u>=f))return l(n)?(n.west=a,n.south=u,n.east=c,n.north=f,n):new li(a,u,c,f)};li.simpleIntersection=function(e,t,n){let i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),s=Math.min(e.north,t.north);if(!(o>=s||i>=r))return l(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new li(i,o,r,s)};li.union=function(e,t,n){l
`);for(let i=0;i<n.length;++i){let o=n[i],r=o.indexOf(": ");if(r>0){let s=o.substring(0,r),a=o.substring(r+2);t[s]=a}}return t}var PN=PAe;function UX(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=PN(this.responseHeaders))}UX.prototype.toString=function(){let e="Request has failed.";return l(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};var p_=UX;function _E(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(_E.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});_E.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);let n=this;return function(){n.removeEventListener(e,t)}};_E.prototype.removeEventListener=function(e,t){let n=this._listeners,i=this._scopes,o=-1;for(let r=0;r<n.length;r++)if(n[r]===e&&i[r]===t){o=r;break}return o!==-1?(this._insideRaiseEvent?(this._toRemove.push(o),n[o]=void 0,i[o]=void 0):(n.splice(o,1),i.splice(o,1)),!0):!1};function IAe(e,t){return t-e}_E.prototype.raiseEvent=function(){this._insideRaiseEvent=!0;let e,t=this._listeners,n=this._scopes,i=t.length;for(e=0;e<i;e++){let r=t[e];l(r)&&t[e].apply(n[e],arguments)}let o=this._toRemove;if(i=o.length,i>0){for(o.sort(IAe),e=0;e<i;e++){let r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};var xe=_E;function C0(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(C0.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){let t=this._length;if(e<t){let n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}});function IN(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}C0.prototype.reserve=function(e){e=y(e,this._length),this._array.length=e};C0.prototype.heapify=function(e){e=y(e,0);let t=this._length,n=this._comparator,i=this._array,o=-1,r=!0;for(;r;){let s=2*(e+1),a=s-1;a<t&&n(i[a],i[e])<0?o=a:o=e,s<t&&n(i[s],i[o])<0&&(o=s),o!==e?(IN(i,o,e),e=o):r=!1}};C0.prototype.resort=function(){let e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};C0.prototype.insert=function(e){let t=this._array,n=this._comparator,i=this._maximumLength,o=this._length++;for(o<t.length?t[o]=e:t.push(e);o!==0;){let s=Math.floor((o-1)/2);if(n(t[o],t[s])<0)IN(t,o,s),o=s;else break}let r;return l(i)&&this._length>i&&(r=t[i],this._length=i),r};C0.prototype.pop=function(e){if(e=y(e,0),this._length===0)return;let t=this._array,n=t[e];return IN(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};var ON=C0;function OAe(e,t){return e.priority-t.priority}var Co={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0},SC=20,za=new ON({comparator:OAe});za.maximumLength=SC;za.reserve(SC);var oh=[],Im={},RAe=typeof document<"u"?new Mi.default(document.location.href):new Mi.default,UP=new xe;function dr(){}dr.maximumRequests=50;dr.maximumRequestsPerServer=6;dr.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18};dr.throttleRequests=!0;dr.debugShowStatistics=!1;dr.requestCompletedEvent=UP;Object.defineProperties(dr,{statistics:{get:function(){return Co}},priorityHeapLength:{get:function(){return SC},set:function(e){if(e<SC)for(;za.length>e;){let t=za.pop();A0(t)}SC=e,za.maximumLength=e,za.reserve(e)}}});function zX(e){l(e.priorityFunction)&&(e.priority=e.priorityFunction())}dr.serverHasOpenSlots=function(e,t){t=y(t,1);let n=y(dr.requestsByServer[e],dr.maximumRequestsPerServer);return Im[e]+t<=n};dr.heapHasOpenSlots=function(e){return za.length+e<=SC};function HX(e){return e.state===Wi.UNISSUED&&(e.state=Wi.ISSUED,e.deferred=Es()),e.deferred.promise}function MAe(e){return function(t){if(e.state===Wi.CANCE
(${this[1]}, ${this[3]})`};var lo=mn;var To={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};To.getMathType=function(e){switch(e){case To.SCALAR:return Number;case To.VEC2:return W;case To.VEC3:return h;case To.VEC4:return ae;case To.MAT2:return lo;case To.MAT3:return Q;case To.MAT4:return O}};To.getNumberOfComponents=function(e){switch(e){case To.SCALAR:return 1;case To.VEC2:return 2;case To.VEC3:return 3;case To.VEC4:case To.MAT2:return 4;case To.MAT3:return 9;case To.MAT4:return 16}};To.getAttributeLocationCount=function(e){switch(e){case To.SCALAR:case To.VEC2:case To.VEC3:case To.VEC4:return 1;case To.MAT2:return 2;case To.MAT3:return 3;case To.MAT4:return 4}};To.getGlslType=function(e){switch(e){case To.SCALAR:return"float";case To.VEC2:return"vec2";case To.VEC3:return"vec3";case To.VEC4:return"vec4";case To.MAT2:return"mat2";case To.MAT3:return"mat3";case To.MAT4:return"mat4"}};var Cn=Object.freeze(To);var a$=1/256,c$=256,zo={};zo.octEncodeInRange=function(e,t,n){if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){let i=n.x,o=n.y;n.x=(1-Math.abs(o))*I.signNotZero(i),n.y=(1-Math.abs(i))*I.signNotZero(o)}return n.x=I.toSNorm(n.x,t),n.y=I.toSNorm(n.y,t),n};zo.octEncode=function(e,t){return zo.octEncodeInRange(e,255,t)};var vE=new W,l$=new Uint8Array(1);function h1(e){return l$[0]=e,l$[0]}zo.octEncodeToCartesian4=function(e,t){return zo.octEncodeInRange(e,65535,vE),t.x=h1(vE.x*a$),t.y=h1(vE.x),t.z=h1(vE.y*a$),t.w=h1(vE.y),t};zo.octDecodeInRange=function(e,t,n,i){if(i.x=I.fromSNorm(e,n),i.y=I.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){let o=i.x;i.x=(1-Math.abs(i.y))*I.signNotZero(o),i.y=(1-Math.abs(o))*I.signNotZero(i.y)}return h.normalize(i,i)};zo.octDecode=function(e,t,n){return zo.octDecodeInRange(e,t,255,n)};zo.octDecodeFromCartesian4=function(e,t){let n=e.x,i=e.y,o=e.z,r=e.w,s=n*c$+i,a=o*c$+r;return zo.octDecodeInRange(s,a,65535,t)};zo.octPackFloat=function(e){return 256*e.x+e.y};var EF=new W;zo.octEncodeFloat=function(e){return zo.octEncode(e,EF),zo.octPackFloat(EF)};zo.octDecodeFloat=function(e,t){let n=e/256,i=Math.floor(n),o=(n-i)*256;return zo.octDecode(i,o,t)};zo.octPack=function(e,t,n,i){let o=zo.octEncodeFloat(e),r=zo.octEncodeFloat(t),s=zo.octEncode(n,EF);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};zo.octUnpack=function(e,t,n,i){let o=e.x/65536,r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;let a=Math.floor(o),c=(o-a)*65536;zo.octDecodeFloat(s,t),zo.octDecodeFloat(c,n),zo.octDecode(r,a,i)};zo.compressTextureCoordinates=function(e){let t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};zo.decompressTextureCoordinates=function(e,t){let n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function bF(e){return e>>1^-(e&1)}zo.zigZagDeltaDecode=function(e,t,n){let i=e.length,o=0,r=0,s=0;for(let a=0;a<i;++a)o+=bF(e[a]),r+=bF(t[a]),e[a]=o,t[a]=r,l(n)&&(s+=bF(n[a]),n[a]=s)};zo.dequantize=function(e,t,n,i){let o=Cn.getNumberOfComponents(n),r;switch(t){case X.BYTE:r=127;break;case X.UNSIGNED_BYTE:r=255;break;case X.SHORT:r=32767;break;case X.UNSIGNED_SHORT:r=65535;break;case X.INT:r=2147483647;break;case X.UNSIGNED_INT:r=4294967295;break}let s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let c=0;c<o;c++){let u=a*o+c;s[u]=Math.max(e[u]/r,-1)}return s};zo.decodeRGB565=function(e,t){let n=e.length;l(t)||(t=new Float32Array(n*3));let i=(1<<5)-1,o=(1<<6)-1,r=1/31,s=1/63;for(let a=0;a<n;a++){let c=e[a],u=c>>11,f=c>>5&o,d=c&i,p=3*a;t[p]=u*r,t[p+1]=f*s,t[p+2]=d*r}return t};var ui=zo;var m1={};m1.getHeight=function(e,t,n){return(e-n)*t+n};var TEe=new h;m1.getPosition=function(e,t,n,i,o){let r=t.cartesianToCartographic(e,TEe),s=m1.getHeight(r.height,n,i);return h.fromRadians(r.longitude,r.latitude,s,t,o)};var Fl=m1;var bEe={NONE:0,BITS12:1},Ta=Object.freeze(bEe);var P0=new h,EEe=new h,Du=new W,p1=new O,SEe=new O,wEe=Math.pow(2,12);function Wa(e,t,n,i,o,r,s,a,c,u){let f=Ta.NONE,d,p;if(l(t)&&l(n)&&l(i)&&l(o)){let _=t.minimum,m=t.maximum,x=h.subtract(m,_,EEe),C=i-n;Math.max(h.maximumComponent(x),C)<wEe-1?f=Ta.BI
${o}`),t}var E_=ZEe;function S_(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=y(r,0),this.retry=!1,this.error=s}S_.reportError=function(e,t,n,i,o,r,s,a){let c=e;return l(e)?(c.provider=t,c.message=i,c.x=o,c.y=r,c.level=s,c.retry=!1,c.error=a,++c.timesRetried):c=new S_(t,i,o,r,s,0,a),n.numberOfListeners>0?n.raiseEvent(c):console.log(`An error occurred in "${t.constructor.name}": ${E_(i)}`),c};S_.handleError=function(e,t,n,i,o,r,s,a,c){Ui("TileProviderError.handleError","TileProviderError.handleError was deprecated in CesiumJS 1.96 and will be removed in 1.97. Use TileProviderError.reportError instead.");let u=S_.reportError(e,t,n,i,o,r,s,c);return u.retry&&l(a)&&a(),u};S_.reportSuccess=function(e){l(e)&&(e.timesRetried=-1)};S_.handleSuccess=function(e){Ui("TileProviderError.handleSuccess","TileProviderError.handleSuccess was deprecated in CesiumJS 1.96 and will be removed in 1.97. Use TileProviderError.reportSuccess instead."),S_.reportSuccess(e)};var bi=S_;function w_(e){if(e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,se.WGS84),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1),this._projection=new bo(this._ellipsoid),l(e.rectangleSouthwestInMeters)&&l(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{let i=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new W(-i,-i),this._rectangleNortheastInMeters=new W(i,i)}let t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new me(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(w_.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});w_.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};w_.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};w_.prototype.rectangleToNativeRectangle=function(e,t){let n=this._projection,i=n.project(me.southwest(e)),o=n.project(me.northeast(e));return l(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new me(i.x,i.y,o.x,o.y)};w_.prototype.tileXYToNativeRectangle=function(e,t,n,i){let o=this.getNumberOfXTilesAtLevel(n),r=this.getNumberOfYTilesAtLevel(n),s=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,a=this._rectangleSouthwestInMeters.x+e*s,c=this._rectangleSouthwestInMeters.x+(e+1)*s,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,f=this._rectangleNortheastInMeters.y-t*u,d=this._rectangleNortheastInMeters.y-(t+1)*u;return l(i)?(i.west=a,i.south=d,i.east=c,i.north=f,i):new me(a,d,c,f)};w_.prototype.tileXYToRectangle=function(e,t,n,i){let o=this.tileXYToNativeRectangle(e,t,n,i),r=this._projection,s=r.unproject(new W(o.west,o.south)),a=r.unproject(new W(o.east,o.north));return o.west=s.longitude,o.south=s.latitude,o.east=a.longitude,o.north=a.latitude,o};w_.prototype.positionToTileXY=function(e,t,n){let i=this._rectangle;if(!me.contains(i,e))return;let o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,d=this._projection.project(e),p=d.x-this._rectangleSouthwestInMeters.x,_=this._rectangleNortheastInMeters.y-d.y,m=p/a|0;m>=o&&(m=o-1);let x=_/u|0;return x>=r&&(x=r-1),l(n)?(n.x=m,n.y=x,n):new W(m,x)};var ws=w_;var JEe=15;function VC(e){this._resource=void 0,this._credit=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._maxLevel=void 0,this._terrainDataStructure=void 0,this._ready=!1,this._width=void 0,this._height=void 0,this._encoding=void 0;let t=e.token;this._hasAvailability=!1,this._tilesAvailable=void 0,this._tilesAvailablityLoaded=void 0,this
wmi\xD6\xF0\x9Ck\x93\xA1\xBDNu\xE0A[\xDF@V\f\xD9\xBBr\x9B\x81|3S\xEEOl\xD4q\xB0{\xC0\x7FEVZ\xADwUe\v3\x92*\xACl5\xC50s\xF83>mF8J\xB4\xDD\xF0.\xDDu\xDA\x8CDt"\xFAa"\f3"So\xAF9D\v\x8C9\xD99L\xB9\xBF\x7F\xAB\\\x8CP_\x9F"ux\xE9\x07q\x91h;\xC1\xC4\x9B\x7F\xF0<VqH\x82'UfYNe\x98u\xA3aF}a?A\0\x9F\xD7\xB44M\xCE\x87F\xB0\xD5\xB8\x8A'{\x8B\xDC+\xBBMg0\xC8\xD1\xF6\\\x8FP\xFA[/F\x9Bn5/'C.\xEB
\f^\xA5s\x1Be4\xE5l.jC'c#U\xA9?q{gC}:\xAF\xCD\xE2TU\x9C\xFDK\xC6\xE2\x9F/(\xED\xCB\\\xC6-f\x07\x88\xA7;/*"N\xB0k.\xDD\r\x95}}G\xBAC\xB2\xB2+>M\xAA>}\xE6\xCEI\x89\xC6\xE6x\fa1-\xA4O\xA5~q \x88\xEC\r1\xE8N\v\0nPh}=\b\r\x95\xA6n\xA3h\x97$[k\xF3#\xF3\xB6s\xB3\r\v@\xC0\x9F\xD8Q]\xFA".j\xDFI\0\xB9\xA0wU\xC6\xEFj\xBF{GL\x7F\x83\xEE\xDC\xDCF\x85\xA9\xADS\x07+S4\x07\xFF\x94Y\xE48\xE81\x83N\xB9XFk\xCB-#\x86\x92p\x005\x88"\xCF1\xB2&/\xE7\xC3u-6,rt\xB0#G\xB7\xD3\xD1&\x857r\xE2\0\x8CD\xCF\xDA3-\xDE\`\x86i#i*|\xCDKQ\r\x95T9w.)\xEA\x1B\xA6P\xA2j\x8FoP\x99\\>T\xFB\xEFP[\v\x07E\x89m(w7\xDB\x8EJfJo\x99 \xE5p\xE2\xB9q~\fmI-z\xFEr\xC7\xF2Y0\x8F\xBB]s\xE5\xC9 \xEAx\xEC \x90\xF0\x8A\x7FB|G\`\xB0\xBD&\xB7q\xB6\xC7\x9F\xD13\x82=\xD3\xAB\xEEc\x99\xC8+S\xA0D\\q\xC6\xCCD2O<\xCA\xC0)=R\xD3aX\xA9}e\xB4\xDC\xCF\r\xF4=\xF1\b\xA9B\xDA# \xD8\xBF^PI\xF8M\xC0\xCBGLO\xF7{+\xD8\xC51\x92;\xB5o\xDCl\r\x92\x88\xD1\x9E\xDB?\xE2\xE9\xDA_\xD4\x84\xE2FaZ\xDEU\xCF\xA4\0\xBE\xFD\xCEg\xF1Ji\x97\xE6 H\xD8]\x7F~\xAEq N\xAE\xC0V\xA9\x91<\x82r\xE7v\xEC)I\xD6]-\x83\xE3\xDB6\xA9;f\x97\x87j\xD5\xB6=P^R\xB9K\xC7sWx\xC9\xF4.Y\x07\x95\x93o\xD0KW>''\xC7\`\xDB;\xED\x9ASD>?\x8D\x92mw\xA2
\xEB?R\xA8\xC6U^1I7\x85\xF4\xC5&-\xA9\xBF\x8B'T\xDA\xC3j \xE5*x\xB0\xD6\x90pr\xAA\x8Bh\xBD\x88\xF7_H\xB1~\xC0XL?f\xF9>\xE1e\xC0p\xA7\xCF8i\xAF\xF0VldI\x9C'\xADxtO\xC2\x87\xDEV9\0\xDAw\v\xCB-\x1B\x89\xFB5O\xF5\bQ\`\xC1
ZGM&30x\xDA\xC0\x9CFG\xE2[y\`In7gS
>\xE9\xECF9\xB2\xF14\r\xC6\x84Sun\xE1\fY\xD9\xDE)\x85{II\xA5wy\xBEIV.6\xE7\v:\xBBOb{\xD2M1\x95/\xBD8{\xA8O!\xE1\xECFpv\x95})"x\x88
\x90\xDD\x9D\\\xDA\xDEQ\xCF\xF0\xFCYRe|3\xDF\xF3H\xDA\xBB*u\xDB\`\xB2\xD4\xFC\xED\x1B\xEC\x7F5\xA8\xFF(1\x07-\xC8\xDC\x88F|\x8A["`);function Xf(e){let t=e;typeof t!="string"&&!(t instanceof Fe)&&(t=e.url);let n=Fe.createIfNeeded(t);n.appendForwardSlash(),this._resource=n,this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=I.EPSILON12,this.providers={},this.key=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={};let i=this;this._readyPromise=r1e(this).then(function(){return i.getQuadTreePacket("",i._quadPacketVersion)}).then(function(){return!0}).catch(function(o){let r=`An error occurred while accessing ${mQ(i,"",1).url}.`;return Promise.reject(new he(r))})}Object.defineProperties(Xf.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}},readyPromise:{get:function(){return this._readyPromise}}});Xf.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){let r=1<<o,s=0;dl(t,r)?dl(e,r)&&(s|=1):(s|=2,dl(e,r)||(s|=1)),i+=s}return i};Xf.quadKeyToTileXY=function(e){let t=0,n=0,i=e.length-1;for(let o=i;o>=0;--o){let r=1<<o,s=+e[i-o];dl(s,2)?dl(s,1)||(t|=r):(n|=r,dl(s,1)&&(t|=r))}return{x:t,y:n,level:i}};Xf.prototype.isValid=function(e){let t=this.getTileInformationFromQuadKey(e);if(l(t))return t!==null;let n=!0,i=e,o;for(;i.length>1;)if(o=i.substring(i.length-1),i=i.substring(0,i.length-1),t=this.getTileInformationFromQuadKey(i),l(t)){!t.hasSubtree()&&!t.hasChild(parseInt(o))&&(n=!1);break}else if(t===null){n=!1;break}return n};var hQ=new uo("decodeGoogleEarthEnterprisePacket");Xf.prototype.getQuadTreePacket=function(e,t,n){t=y(t,1),e=y(e,"");let o=mQ(this,e,t,n).fetchArrayBuffer();if(!l(o))return;let r=this._tileInfo,s=this.key;return o.then(function(a){return hQ.scheduleTask({buffer:a,quadKey:e,type:"Metadata",key:s},[a]).then(function(u){let f,d=-1;if(e!==""){d=e.length+1;let m=u[e];f=r[e],f._bits|=m._bits,delete u[e]}let p=Object.keys(u);p.sort(function(m,x){return m.length-x.length});let _=p.length;for(let m=0;m<_;++m){let x=p[m];if(u[x]!==null){let A=Q2.clone(u[x]),T=x.length;if(T===d)A.setParent(f);else if(T>1){let E=r[x.substring(0,x.length-1)];A.setParent(E)}r[x]=A}else r[x]=null}})})};Xf.prototype.populateSubtree=function(e,t,n,i){let o=Xf.tileXYToQuadKey(e,t,n);return n3(this,o,i)};function n3(e,t,n){let i=e._tileInfo,o=t,r=i[o];if(l(r)&&(!r.hasSubtree()||r.hasChildren()))return r;for(;r===void 0&&o.length>1;)o=o.substring(0,o.length-1),r=i[o];let s,a=e._subtreePromises,c=a[o];if(l(c))return c.then(function(){return s=new Mr({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),n3(e,t,s)});if(!l(r)||!r.hasSubtree())return Promise.reject(new he(`Couldn't load metadata for tile ${t}`));if(c=e.getQuadTreePacket(o,r.cnodeVersion,n),!!l(c))return a[o]=c,c.then(function(){return s=new Mr({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),n3(e,t,s)}).finally(function(){delete a[o]})}Xf.prototype.getTileInformation=function(e,t,n){let i=Xf.tileXYToQuadKey(e,t,n);return this._tileInfo[i]};Xf.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]};function mQ(e,t,n,i){return e._resource.getDerivedResource({url:`flatfile?q2-0${t}-q.${n.toString()}`,request:i})}var e3,t3;function r1e(e){let t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!l(t3)){let n=Pn("ThirdParty/google-earth-dbroot-parser.js"),i=window.cesiumGoogleEarthDbRootParser;t3=mE(n).then(function(){e3=window.cesiumGoogleEarthDbRootParser(rS),l(i)?window.cesiumGoogleEarthDbRootParser=i:delete window.cesiumGoogleEarthDbRootParser})}return t3.then(function(){return t.fetchArrayBuffer()}).then(function(n){let i=e3.EncryptedDbRootProto.decode(new Uint8Array(n)),o=i.encryptionData,r=o.byteOffset,s=r+o.byteLength,a=e.key=o.buffer.slice(r,s);o=i.dbrootData,r=o.byteOffset,s=r+o.byte
varying vec3 v_normalEC;
varying vec3 v_tangentEC;
varying vec3 v_bitangentEC;
varying vec2 v_st;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.tangentToEyeMatrix = tangentToEyeMatrix;
materialInput.positionToEyeEC = positionToEyeEC;
materialInput.st = v_st;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var SV=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 normal;
attribute vec3 tangent;
attribute vec3 bitangent;
attribute vec2 st;
attribute float batchId;
varying vec3 v_positionEC;
varying vec3 v_normalEC;
varying vec3 v_tangentEC;
varying vec3 v_bitangentEC;
varying vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
v_tangentEC = czm_normal * tangent;
v_bitangentEC = czm_normal * bitangent;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var wV=`varying vec3 v_positionEC;
varying vec3 v_normalEC;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var vV=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 normal;
attribute float batchId;
varying vec3 v_positionEC;
varying vec3 v_normalEC;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var DV=`varying vec3 v_positionEC;
varying vec3 v_normalEC;
varying vec2 v_st;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = positionToEyeEC;
materialInput.st = v_st;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var PV=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 normal;
attribute vec2 st;
attribute float batchId;
varying vec3 v_positionEC;
varying vec3 v_normalEC;
varying vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var UBe={ADD:Z.FUNC_ADD,SUBTRACT:Z.FUNC_SUBTRACT,REVERSE_SUBTRACT:Z.FUNC_REVERSE_SUBTRACT,MIN:Z.MIN,MAX:Z.MAX},Bc=Object.freeze(UBe);var zBe={ZERO:Z.ZERO,ONE:Z.ONE,SOURCE_COLOR:Z.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:Z.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:Z.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:Z.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:Z.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:Z.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:Z.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:Z.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:Z.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:Z.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:Z.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:Z.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:Z.SRC_ALPHA_SATURATE},sr=Object.freeze(zBe);var HBe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Bc.ADD,equationAlpha:Bc.ADD,functionSourceRgb:sr.SOURCE_ALPHA,functionSourceAlpha:sr.ONE,functionDestinationRgb:sr.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:sr.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Bc.ADD,equationAlpha:Bc.ADD,functionSourceRgb:sr.ONE,functionSourceAlpha:sr.ONE,functionDestinationRgb:sr.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:sr.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:Bc.ADD,equationAlpha:Bc.ADD,functionSourceRgb:sr.SOURCE_ALPHA,functionSourceAlpha:sr.ONE,functionDestinationRgb:sr.ONE,functionDestinationAlpha:sr.ONE})},Hn=Object.freeze(HBe);var GBe={FRONT:Z.FRONT,BACK:Z.BACK,FRONT_AND_BACK:Z.FRONT_AND_BACK},So=Object.freeze(GBe);function NA(e){e=y(e,y.EMPTY_OBJECT),this.material=e.material,this.translucent=y(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=y(e.closed,!1)}Object.defineProperties(NA.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}});NA.prototype.getFragmentShaderSource=function(){let e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),l(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
`)};NA.prototype.isTranslucent=function(){return l(this.material)&&this.material.isTranslucent()||!l(this.material)&&this.translucent};NA.prototype.getRenderState=function(){let e=this.isTranslucent(),t=mt(this.renderState,!1);return e?(t.depthMask=!1,t.blending=Hn.ALPHA_BLEND):t.depthMask=!0,t};NA.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=Hn.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:So.BACK}),l(n)&&(i=Dt(n,i,!0)),i};var Mo=NA;var Nr={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_maximumSamples:0,_highpFloatSupported:!1,_highpIntSupported:!1};Object.defineProperties(Nr,{maximumCombinedTextureImageUnits:{get:function(){return Nr._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return Nr._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return Nr._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return Nr._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return Nr._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return Nr._maximumTextureSize}},maximumVaryingVectors:{get:function(){return Nr._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return Nr._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return Nr._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return Nr._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return Nr._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return Nr._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return Nr._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return Nr._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return Nr._maximumViewportWidth}},maximumViewportHeight:{get:function(){return Nr._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return Nr._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return Nr._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return Nr._maximumColorAttachments}},maximumSamples:{get:function(){return Nr._maximumSamples}},highpFloatSupported:{get:function(){return Nr._highpFloatSupported}},highpIntSupported:{get:function(){return Nr._highpIntSupported}}});var sn=Nr;function NI(e,t,n,i,o,r,s,a,c,u,f){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=s,this._internalFormat=o,this._pixelFormat=r,this._size=a,this._preMultiplyAlpha=c,this._flipY=u,this._initialized=f}Object.defineProperties(NI.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});NI.prototype.copyFrom=function(e){let t=y(e.xOffset,0),n=y(e.yOffset,0),i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);let a=i.width,c=i.height,u=i.arrayBufferView,f=this._size,d=this._pixelFormat,p=this._internalFormat,_=this._pixelDatatype,m=this._preMultiplyAlpha,x=this._flipY,C=y(e.skipColorSpaceConversion,!1),A=4;l(u)&&(A=It.alignmentInBytes(d,_,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,A),C?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let T=!1;if(!this._initialized){if(t===0&&n===0&&a===f&&c===f)l(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),x&&(u=It.flipY(u,d,_,f,f)),o.texImage2D(s,0,p,f,f,0,d,lt.toWe
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var OV=`uniform sampler2D image;
uniform float strength;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
vec2 centerPixel = fract(repeat * st);
float centerBump = texture2D(image, centerPixel).channel;
float imageWidth = float(imageDimensions.x);
vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));
float rightBump = texture2D(image, rightPixel).channel;
float imageHeight = float(imageDimensions.y);
vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));
float topBump = texture2D(image, leftPixel).channel;
vec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
material.normal = normalEC;
material.diffuse = vec3(0.01);
return material;
}
`;var RV=`uniform vec4 lightColor;
uniform vec4 darkColor;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);
float scaledWidth = fract(repeat.s * st.s);
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
float scaledHeight = fract(repeat.t * st.t);
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
float value = min(scaledWidth, scaledHeight);
vec4 currentColor = mix(lightColor, darkColor, b);
vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);
color = czm_gammaCorrect(color);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var MV=`uniform vec4 lightColor;
uniform vec4 darkColor;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));
vec4 color = mix(lightColor, darkColor, b);
color = czm_gammaCorrect(color);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var BV=`uniform sampler2D heights;
uniform sampler2D colors;
float getHeight(int idx, float invTexSize)
{
vec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);
#ifdef OES_texture_float
return texture2D(heights, uv).x;
#else
return czm_unpackFloat(texture2D(heights, uv));
#endif
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float height = materialInput.height;
float invTexSize = 1.0 / float(heightsDimensions.x);
float minHeight = getHeight(0, invTexSize);
float maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);
if (height < minHeight || height > maxHeight) {
material.diffuse = vec3(0.0);
material.alpha = 0.0;
return material;
}
int idxBelow = 0;
int idxAbove = heightsDimensions.x;
float heightBelow = minHeight;
float heightAbove = maxHeight;
const int maxIterations = 16;
for (int i = 0; i < maxIterations; i++) {
if (idxBelow >= idxAbove - 1) {
break;
}
int idxMid = (idxBelow + idxAbove) / 2;
float heightTex = getHeight(idxMid, invTexSize);
if (height > heightTex) {
idxBelow = idxMid;
heightBelow = heightTex;
} else {
idxAbove = idxMid;
heightAbove = heightTex;
}
}
float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);
vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);
vec4 color = texture2D(colors, colorUv);
if (color.a > 0.0)
{
color.rgb /= color.a;
}
color.rgb = czm_gammaCorrect(color.rgb);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var LV=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
uniform vec4 color;
uniform float spacing;
uniform float width;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float distanceToContour = mod(materialInput.height, spacing);
#ifdef GL_OES_standard_derivatives
float dxc = abs(dFdx(materialInput.height));
float dyc = abs(dFdy(materialInput.height));
float dF = max(dxc, dyc) * czm_pixelRatio * width;
float alpha = (distanceToContour < dF) ? 1.0 : 0.0;
#else
float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;
#endif
vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var NV=`uniform sampler2D image;
uniform float minimumHeight;
uniform float maximumHeight;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);
vec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var FV=`uniform vec4 fadeInColor;
uniform vec4 fadeOutColor;
uniform float maximumDistance;
uniform bool repeat;
uniform vec2 fadeDirection;
uniform vec2 time;
float getTime(float t, float coord)
{
float scalar = 1.0 / maximumDistance;
float q = distance(t, coord) * scalar;
if (repeat)
{
float r = distance(t, coord + 1.0) * scalar;
float s = distance(t, coord - 1.0) * scalar;
q = min(min(r, s), q);
}
return clamp(q, 0.0, 1.0);
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float s = getTime(time.x, st.s) * fadeDirection.s;
float t = getTime(time.y, st.t) * fadeDirection.t;
float u = length(vec2(s, t));
vec4 color = mix(fadeInColor, fadeOutColor, u);
color = czm_gammaCorrect(color);
material.emission = color.rgb;
material.alpha = color.a;
return material;
}
`;var VV=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
uniform vec4 color;
uniform float cellAlpha;
uniform vec2 lineCount;
uniform vec2 lineThickness;
uniform vec2 lineOffset;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float scaledWidth = fract(lineCount.s * st.s - lineOffset.s);
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
float scaledHeight = fract(lineCount.t * st.t - lineOffset.t);
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
float value;
#ifdef GL_OES_standard_derivatives
const float fuzz = 1.2;
vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;
vec2 dx = abs(dFdx(st));
vec2 dy = abs(dFdy(st));
vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;
value = min(
smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),
smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));
#else
const float fuzz = 0.05;
vec2 range = 0.5 - (lineThickness * 0.05);
value = min(
1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),
1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));
#endif
float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));
float sRim = smoothstep(0.8, 1.0, dRim);
value *= (1.0 - sRim);
vec4 halfColor;
halfColor.rgb = color.rgb * 0.5;
halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));
halfColor = czm_gammaCorrect(halfColor);
material.diffuse = halfColor.rgb;
material.emission = halfColor.rgb;
material.alpha = halfColor.a;
return material;
}
`;var kV=`uniform sampler2D image;
uniform float strength;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 textureValue = texture2D(image, fract(repeat * materialInput.st));
vec3 normalTangentSpace = textureValue.channels;
normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;
normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);
normalTangentSpace = normalize(normalTangentSpace);
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
material.normal = normalEC;
return material;
}
`;var UV=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
uniform vec4 color;
float getPointOnLine(vec2 p0, vec2 p1, float x)
{
float slope = (p0.y - p1.y) / (p0.x - p1.x);
return slope * (x - p0.x) + p0.y;
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
#ifdef GL_OES_standard_derivatives
float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;
#else
float base = 0.975;
#endif
vec2 center = vec2(1.0, 0.5);
float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);
float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);
float halfWidth = 0.15;
float s = step(0.5 - halfWidth, st.t);
s *= 1.0 - step(0.5 + halfWidth, st.t);
s *= 1.0 - step(base, st.s);
float t = step(base, materialInput.st.s);
t *= 1.0 - step(ptOnUpperLine, st.t);
t *= step(ptOnLowerLine, st.t);
float dist;
if (st.s < base)
{
float d1 = abs(st.t - (0.5 - halfWidth));
float d2 = abs(st.t - (0.5 + halfWidth));
dist = min(d1, d2);
}
else
{
float d1 = czm_infinity;
if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)
{
d1 = abs(st.s - base);
}
float d2 = abs(st.t - ptOnUpperLine);
float d3 = abs(st.t - ptOnLowerLine);
dist = min(min(d1, d2), d3);
}
vec4 outsideColor = vec4(0.0);
vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));
vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);
outColor = czm_gammaCorrect(outColor);
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var zV=`uniform vec4 color;
uniform vec4 gapColor;
uniform float dashLength;
uniform float dashPattern;
varying float v_polylineAngle;
const float maskLength = 16.0;
mat2 rotate(float rad) {
float c = cos(rad);
float s = sin(rad);
return mat2(
c, s,
-s, c
);
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));
float maskIndex = floor(dashPosition * maskLength);
float maskTest = floor(dashPattern / pow(2.0, maskIndex));
vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;
if (fragColor.a < 0.005) {
discard;
}
fragColor = czm_gammaCorrect(fragColor);
material.emission = fragColor.rgb;
material.alpha = fragColor.a;
return material;
}
`;var HV=`uniform vec4 color;
uniform float glowPower;
uniform float taperPower;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);
if (taperPower <= 0.99999) {
glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));
}
vec4 fragColor;
fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);
fragColor.a = clamp(0.0, 1.0, glow) * color.a;
fragColor = czm_gammaCorrect(fragColor);
material.emission = fragColor.rgb;
material.alpha = fragColor.a;
return material;
}
`;var GV=`uniform vec4 color;
uniform vec4 outlineColor;
uniform float outlineWidth;
varying float v_width;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;
float b = step(0.5 - halfInteriorWidth, st.t);
b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);
float d1 = abs(st.t - (0.5 - halfInteriorWidth));
float d2 = abs(st.t - (0.5 + halfInteriorWidth));
float dist = min(d1, d2);
vec4 currentColor = mix(outlineColor, color, b);
vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);
outColor = czm_gammaCorrect(outColor);
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var WV=`uniform vec4 color;
uniform vec4 rimColor;
uniform float width;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));
float s = smoothstep(1.0 - width, 1.0, d);
vec4 outColor = czm_gammaCorrect(color);
vec4 outRimColor = czm_gammaCorrect(rimColor);
material.diffuse = outColor.rgb;
material.emission = outRimColor.rgb * s;
material.alpha = mix(outColor.a, outRimColor.a, s);
return material;
}
`;var jV=`uniform sampler2D image;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var qV=`uniform vec4 evenColor;
uniform vec4 oddColor;
uniform float offset;
uniform float repeat;
uniform bool horizontal;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));
float value = fract((coord - offset) * (repeat * 0.5));
float dist = min(value, min(abs(value - 0.5), 1.0 - value));
vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));
vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);
color = czm_gammaCorrect(color);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var YV=`uniform sampler2D specularMap;
uniform sampler2D normalMap;
uniform vec4 baseWaterColor;
uniform vec4 blendColor;
uniform float frequency;
uniform float animationSpeed;
uniform float amplitude;
uniform float specularIntensity;
uniform float fadeFactor;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float time = czm_frameNumber * animationSpeed;
float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);
float specularMapValue = texture2D(specularMap, materialInput.st).r;
vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);
vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));
normalTangentSpace.xy /= fade;
normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);
normalTangentSpace = normalize(normalTangentSpace);
float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);
material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;
material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);
material.diffuse += (0.1 * tsPerturbationRatio);
material.diffuse = material.diffuse;
material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);
material.specular = specularIntensity;
material.shininess = 10.0;
return material;
}
`;function tt(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=y(e.minificationFilter,tn.LINEAR),this._magnificationFilter=y(e.magnificationFilter,wo.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,WBe(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),l(tt._uniformList[this.type])||(tt._uniformList[this.type]=Object.keys(this._uniforms))}tt._uniformList={};tt.fromType=function(e,t){let n=new tt({fabric:{type:e}});if(l(t))for(let i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};tt.prototype.isTranslucent=function(){if(l(this.translucent))return typeof this.translucent=="function"?this.translucent():this.translucent;let e=!0,t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){let o=t[i];if(typeof o=="function"?e=e&&o():e=e&&o,!e)break}return e};tt.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n,i=this._loadedImages,o=i.length;for(t=0;t<o;++t){let c=i[t];n=c.id;let u=c.image,f;Array.isArray(u)&&(f=u.slice(1,u.length).map(function(x){return x.bufferView}),u=u[0]);let d=new Nn({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter}),p;l(u.internalFormat)?p=new Zt({context:e,pixelFormat:u.internalFormat,width:u.width,height:u.height,source:{arrayBufferView:u.bufferView,mipLevels:f},sampler:d}):p=new Zt({context:e,source:u,sampler:d});let _=this._textures[n];l(_)&&_!==this._defaultTexture&&_.destroy(),this._textures[n]=p;let m=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(m)){let x=this.uniforms[m];x.x=p._width,x.y=p._height}}i.length=0;let r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){let c=r[t];n=c.id;let u=c.images,f=new ml({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new Nn({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=f}r.length=0;let s=this._updateFunctions;for(o=s.length,t=0;t<o;++t)s[t](this,e);let a=this.materials;for(let c in a)a.hasOwnProperty(c)&&a[c].update(e)};tt.prototype.isDestroyed=function(){return!1};tt.prototype.destroy=function(){let e=this._textures;for(let n in e)if(e.hasOwnProperty(n)){let i=e[n];i!==this._defaultTexture&&i.destroy()}let t=this.materials;for(let n in t)t.hasOwnProperty(n)&&t[n].destroy();return fe(this)};function WBe(e,t){e=y(e,y.EMPTY_OBJECT),t._strict=y(e.strict,!1),t._count=y(e.count,0),t._template=mt(y(e.fabric,y.EMPTY_OBJECT)),t._template.uniforms=mt(y(t._template.uniforms,y.EMPTY_OBJECT)),t._template.materials=mt(y(t._template.materials,y.EMPTY_OBJECT)),t.type=l(t._template.type)?t._template.type:hi(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n,i=tt._materialCache.getMaterial(t.type);if(l(i)){let r=mt(i.fabric,!0);t._template=Dt(t._template,r,!0),n=i.translucent}XBe(t),l(i)||tt._materialCache.addMaterial(t.type,t),$Be(t),eLe(t),nLe(t);let o=t._translucentFunctions.length===0?!0:void 0;if(n=y(n,o),n=y(e.translucent,n),l(n))if(typeof n=="function"){let r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function XV(e,t,n,i){if(l(e)){for(let o in e)if(e.hasOwnProperty(o)){let r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function ine(e,t){}function jBe(e,t){}var qBe=["type","materials","uniforms","components","source"],YBe=["diffuse","specular","shininess","normal","emission","alpha"];function XBe(e){let t=e._template,n=t.uniforms,i=t.materials,o=t.components;XV(t,qBe,ine,!0),XV(o,YBe,ine,!0);let r=[];for(let s in i)i.hasOwnProperty(s)&&r.push(s);XV(n,r,jBe,!1)}function KBe(e,t){let n=t._template.materials;for(let i in n)if(n.hasOwnProperty(i)&&e.indexOf(i)>-1)return!0;return!1}function $Be(e){let t=e._template.components,n=e._template.source;if(l(n))e.shaderSource+=`${n}
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
{
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
`,l(t)){let i=Object.keys(e._template.materials).length>0;for(let o in t)if(t.hasOwnProperty(o))if(o==="diffuse"||o==="emission"){let s=i&&KBe(t[o],e)?t[o]:`czm_gammaCorrect(${t[o]})`;e.shaderSource+=`material.${o} = ${s};
`}else o==="alpha"?e.shaderSource+=`material.alpha = ${t.alpha};
`:e.shaderSource+=`material.${o} = ${t[o]};
`}e.shaderSource+=`return material;
}
`}}var one={mat2:lo,mat3:Q,mat4:O},ZBe=/\.ktx2$/i;function JBe(e){let t;return function(n,i){let o=n.uniforms,r=o[e],s=t!==r,a=!l(r)||r===tt.DefaultImageId;t=r;let c=n._textures[e],u,f;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&l(c)&&(c!==i.defaultTexture&&c.destroy(),c=void 0),!l(c)||c===i.defaultTexture){let p=new Nn({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});c=new Zt({context:i,source:r,sampler:p}),n._textures[e]=c;return}c.copyFrom({source:r})}else l(c)||(n._textures[e]=i.defaultTexture);return}if(r instanceof Zt&&r!==c){n._texturePaths[e]=void 0;let p=n._textures[e];l(p)&&p!==n._defaultTexture&&p.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=r._width,f.y=r._height);return}if(s&&l(c)&&a&&(c!==n._defaultTexture&&c.destroy(),c=void 0),l(c)||(n._texturePaths[e]=void 0,c=n._textures[e]=n._defaultTexture,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=c._width,f.y=c._height)),a)return;let d=r instanceof Fe;if(!l(n._texturePaths[e])||d&&r.url!==n._texturePaths[e].url||!d&&r!==n._texturePaths[e]){if(typeof r=="string"||d){let p=d?r:Fe.createIfNeeded(r),_;ZBe.test(p.url)?_=Mc(p.url):_=p.fetchImage(),Promise.resolve(_).then(function(m){n._loadedImages.push({id:e,image:m})}).catch(function(){l(c)&&c!==n._defaultTexture&&c.destroy(),n._textures[e]=n._defaultTexture})}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:r});n._texturePaths[e]=r}}}function QBe(e){return function(t,n){let i=t.uniforms[e];if(i instanceof ml){let r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(l(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===tt.DefaultCubeMapId)return;let o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){let r=[Fe.createIfNeeded(i.positiveX).fetchImage(),Fe.createIfNeeded(i.negativeX).fetchImage(),Fe.createIfNeeded(i.positiveY).fetchImage(),Fe.createIfNeeded(i.negativeY).fetchImage(),Fe.createIfNeeded(i.positiveZ).fetchImage(),Fe.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function eLe(e){let t=e._template.uniforms;for(let n in t)t.hasOwnProperty(n)&&rne(e,n)}function rne(e,t){let n=e._strict,i=e._template.uniforms,o=i[t],r=tLe(o),s;if(r==="channels")s=FS(e,t,o,!1);else{if(r==="sampler2D"){let u=`${t}Dimensions`;iLe(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},rne(e,u))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){let u=`uniform ${r} ${t};`;e.shaderSource=u+e.shaderSource}let c=`${t}_${e._count++}`;if(s=FS(e,t,c),e.uniforms[t]=o,r==="sampler2D")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(JBe(t));else if(r==="samplerCube")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(QBe(t));else if(r.indexOf("mat")!==-1){let u=new one[r];e._uniforms[c]=function(){return one[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[c]=function(){return e.uniforms[t]}}}function tLe(e){let t=e.type;if(!l(t)){let n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof Fe||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===tt.DefaultCubeMapId?t="samplerCube":t="sampler2D";else if(n==="object")if(Array.isArray(e))(e.length===4||e.length===9||e.length===16)&&(t=`mat${Math.sqrt(e.length)}`);else{let i=0;for(let o in e)e.hasOwnProperty(o)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:i===6&&(t="samplerCube")}}return t}function nLe(e){let t=e._strict,n=e._template.materials;for(let i in n)if(n.hasOwnProperty(i)){let o=new tt({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=Dt(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);let r="czm_getMaterial",s=`${r}_${e._count++}`;FS(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;let a=
varying vec3 v_normalEC;
varying vec4 v_color;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
vec4 color = czm_gammaCorrect(v_color);
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getDefaultMaterial(materialInput);
material.diffuse = color.rgb;
material.alpha = color.a;
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
}
`;var $V=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 normal;
attribute vec4 color;
attribute float batchId;
varying vec3 v_positionEC;
varying vec3 v_normalEC;
varying vec4 v_color;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
v_color = color;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var VS=`varying vec4 v_color;
void main()
{
gl_FragColor = czm_gammaCorrect(v_color);
}
`;var ZV=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec4 color;
attribute float batchId;
varying vec4 v_color;
void main()
{
vec4 p = czm_computePosition();
v_color = color;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;function rp(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.flat,!1),o=i?ZV:$V,r=i?VS:KV,s=i?rp.FLAT_VERTEX_FORMAT:rp.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,o),this._fragmentShaderSource=y(e.fragmentShaderSource,r),this._renderState=Mo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=y(e.faceForward,!n)}Object.defineProperties(rp.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});rp.VERTEX_FORMAT=Ve.POSITION_AND_NORMAL;rp.FLAT_VERTEX_FORMAT=Ve.POSITION_ONLY;rp.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;rp.prototype.isTranslucent=Mo.prototype.isTranslucent;rp.prototype.getRenderState=Mo.prototype.getRenderState;var Bn=rp;function FA(e){this._definitionChanged=new xe,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(FA.prototype,{isConstant:{get:function(){return q.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ue("color")});FA.prototype.getType=function(e){return"Color"};FA.prototype.getValue=function(e,t){return l(t)||(t={}),t.color=q.getValueOrClonedDefault(this._color,e,H.WHITE,t.color),t};FA.prototype.equals=function(e){return this===e||e instanceof FA&&q.equals(this._color,e._color)};var Qt=FA;var Fr={CULL:1,OCCLUDE:2,EXECUTE_IN_CLOSEST_FRUSTUM:4,DEBUG_SHOW_BOUNDING_VOLUME:8,CAST_SHADOWS:16,RECEIVE_SHADOWS:32,PICK_ONLY:64,DEPTH_FOR_TRANSLUCENT_CLASSIFICATION:128};function kS(e){e=y(e,y.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=y(e.primitiveType,He.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=y(e.offset,0),this._instanceCount=y(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._flags=0,this.cull=y(e.cull,!0),this.occlude=y(e.occlude,!0),this.executeInClosestFrustum=y(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.castShadows=y(e.castShadows,!1),this.receiveShadows=y(e.receiveShadows,!1),this.pickOnly=y(e.pickOnly,!1),this.depthForTranslucentClassification=y(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Ja(e,t){return(e._flags&t)===t}function og(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(kS.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return Ja(this,Fr.CULL)},set:function(e){Ja(this,Fr.CULL)!==e&&(og(this,Fr.CULL,e),this.dirty=!0)}},occlude:{get:function(){return Ja(this,Fr.OCCLUDE)},set:function(e){Ja(this,Fr.OCCLUDE)!==e&&(og(this,Fr.OCCLUDE,e),this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},of
${d}`:`${Uu}Fragment shader translation failed.`)}throw e.deleteProgram(s),new he(`Fragment shader failed to compile. Compile log: ${c}`)}if(!e.getShaderParameter(o,e.COMPILE_STATUS)){if(c=e.getShaderInfoLog(o),console.error(`${Uu}Vertex shader compile log: ${c}`),l(f)){let d=f.getTranslatedShaderSource(o);console.error(d!==""?`${Uu}Translated vertex shader source:
${d}`:`${Uu}Vertex shader translation failed.`)}throw e.deleteProgram(s),new he(`Vertex shader failed to compile. Compile log: ${c}`)}throw c=e.getProgramInfoLog(s),console.error(`${Uu}Shader program link log: ${c}`),l(f)&&(console.error(`${Uu}Translated vertex shader source:
${f.getTranslatedShaderSource(o)}`),console.error(`${Uu}Translated fragment shader source:
${f.getTranslatedShaderSource(r)}`)),e.deleteProgram(s),new he(`Program failed to link. Link log: ${c}`)}let u=t._logShaderCompilation;return u&&(c=e.getShaderInfoLog(o),l(c)&&c.length>0&&console.log(`${Uu}Vertex shader compile log: ${c}`)),u&&(c=e.getShaderInfoLog(r),l(c)&&c.length>0&&console.log(`${Uu}Fragment shader compile log: ${c}`)),u&&(c=e.getProgramInfoLog(s),l(c)&&c.length>0&&console.log(`${Uu}Shader program link log: ${c}`)),s}function CLe(e,t,n){let i={};for(let o=0;o<n;++o){let r=e.getActiveAttrib(t,o),s=e.getAttribLocation(t,r.name);i[r.name]={name:r.name,type:r.type,index:s}}return i}function ALe(e,t){let n={},i=[],o=[],r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){let a=e.getActiveUniform(t,s),c="[0]",u=a.name.indexOf(c,a.name.length-c.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(u.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){let f=e.getUniformLocation(t,u);if(f!==null){let d=QV(e,a,u,f);n[u]=d,i.push(d),d._setSampler&&o.push(d)}}else{let f,d,p,_,m=u.indexOf("[");if(m>=0){if(f=n[u.slice(0,m)],!l(f))continue;d=f._locations,d.length<=1&&(p=f.value,_=e.getUniformLocation(t,u),_!==null&&(d.push(_),p.push(e.getUniform(t,_))))}else{d=[];for(let x=0;x<a.size;++x)_=e.getUniformLocation(t,`${u}[${x}]`),_!==null&&d.push(_);f=tk(e,a,u,d),n[u]=f,i.push(f),f._setSampler&&o.push(f)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function TLe(e,t){let n=[],i=[];for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=o,a=e._duplicateUniformNames[s];l(a)&&(r.name=a,s=a);let c=gy[s];l(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function bLe(e,t,n){e.useProgram(t);let i=0,o=n.length;for(let r=0;r<o;++r)i=n[r]._setSampler(i);return e.useProgram(null),i}function UI(e){l(e._program)||Wne(e)}function Wne(e){let t=e._program,n=e._gl,i=xLe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=ALe(n,i),s=TLe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=CLe(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=bLe(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,c,u,f){let d=e._vertexShaderText,p=e._fragmentShaderText,_=/ ! = /g;e._vertexShaderText=a.replace(_," != "),e._fragmentShaderText=c.replace(_," != ");try{Wne(e),u(e._program)}catch(m){e._vertexShaderText=d,e._fragmentShaderText=p;let C=/(?:Compile|Link) error: ([^]*)/.exec(m.message);f(C?C[1]:m.message)}})}sp.prototype._bind=function(){UI(this),this._gl.useProgram(this._program)};sp.prototype._setUniforms=function(e,t,n){let i,o;if(l(e)){let a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){let c=a[o];c.value=e[c.name]()}}let r=this._automaticUniforms;for(i=r.length,o=0;o<i;++o){let a=r[o];a.uniform.value=a.automaticUniform.getValue(t)}let s=this._uniforms;for(i=s.length,o=0;o<i;++o)s[o].set();if(n){let a=this._gl,c=this._program;a.validateProgram(c)}};sp.prototype.isDestroyed=function(){return!1};sp.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};sp.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),fe(this)};var gn=sp;function ELe(e,t){let n=/#define OUTPUT_DECLARATION/,i=e.split(`
`);if(/#version 300 es/g.test(e))return e;let o=-1,r,s;for(r=0;r<i.length;++r)if(s=i[r],n.test(s)){o=r;break}if(o===-1)throw new Ae("Could not find a #define OUTPUT_DECLARATION!");let a=[];for(r=0;r<10;r++){let x=`gl_FragData\\[${r}\\]`,C=`czm_out${r}`;new RegExp(x,"g").test(e)&&(jne(C,a),Ph(x,C,i),i.splice(o,0,`layout(location = ${r}) out vec4 ${C};`),o+=1)}let c="czm_fragColor";wLe("gl_FragColor",i)&&(jne(c,a),Ph("gl_FragColor",c,i),i.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);let u=DLe(a,i),f={};for(r=0;r<i.length;r++){s=i[r];for(let x in u)u.hasOwnProperty(x)&&new RegExp(`(layout)[^]+(out)[^]+(${x})[^]+`,"g").test(s)&&(f[s]=x)}for(let x in f)if(f.hasOwnProperty(x)){let C=f[x],A=i.indexOf(x),T=u[C],E=T.length;for(let S=0;S<E;S++)i.splice(A,0,T[S]);A+=E+1;for(let S=E-1;S>=0;S--)i.splice(A,0,`#endif //${T[S]}`)}let d="WEBGL_2",p=`#define ${d}`,_="#version 300 es",m=!1;for(r=0;r<i.length;r++)if(/#version/.test(i[r])){i[r]=_,m=!0;break}return m||i.splice(0,0,_),i.splice(1,0,p),nk("EXT_draw_buffers",d,i),nk("EXT_frag_depth",d,i),nk("OES_standard_derivatives",d,i),Ph("texture2D","texture",i),Ph("texture3D","texture",i),Ph("textureCube","texture",i),Ph("gl_FragDepthEXT","gl_FragDepth",i),t?Ph("varying","in",i):(Ph("attribute","in",i),Ph("varying","out",i)),vLe(i)}function Ph(e,t,n){let i=`(^|[^\\w])(${e})($|[^\\w])`,o=new RegExp(i,"g"),r=n.length;for(let s=0;s<r;++s){let a=n[s];n[s]=a.replace(o,`$1${t}$3`)}}function SLe(e,t,n){let i=n.length;for(let o=0;o<i;++o){let r=n[o];n[o]=r.replace(e,t)}}function wLe(e,t){let n=`(^|[^\\w])(${e})($|[^\\w])`,i=new RegExp(n,"g"),o=t.length;for(let r=0;r<o;++r){let s=t[r];if(i.test(s))return!0}return!1}function vLe(e){let t="",n=e.length;for(let i=0;i<n;++i)t+=`${e[i]}
`;return t}function jne(e,t){t.indexOf(e)===-1&&t.push(e)}function DLe(e,t){let n={},i=e.length,o=[];for(let r=0;r<t.length;++r){let s=t[r],a=/(#ifdef|#if)/g.test(s),c=/#else/g.test(s),u=/#endif/g.test(s);if(a)o.push(s);else if(c){let d=o[o.length-1].replace("ifdef","ifndef");/if/g.test(d)&&(d=d.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),o.pop(),o.push(d)}else if(u)o.pop();else if(!/layout/g.test(s))for(let f=0;f<i;++f){let d=e[f];s.indexOf(d)!==-1&&(l(n[d])?n[d]=n[d].filter(function(p){return o.indexOf(p)>=0}):n[d]=o.slice())}}return n}function nk(e,t,n){let i=`#extension\\s+GL_${e}\\s+:\\s+[a-zA-Z0-9]+\\s*$`;SLe(new RegExp(i,"g"),"",n),Ph(`GL_${e}`,t,n)}var ik=ELe;var ok=`const float czm_degreesPerRadian = 57.29577951308232;
`;var rk=`const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
`;var sk=`const float czm_epsilon1 = 0.1;
`;var ak=`const float czm_epsilon2 = 0.01;
`;var ck=`const float czm_epsilon3 = 0.001;
`;var lk=`const float czm_epsilon4 = 0.0001;
`;var uk=`const float czm_epsilon5 = 0.00001;
`;var fk=`const float czm_epsilon6 = 0.000001;
`;var dk=`const float czm_epsilon7 = 0.0000001;
`;var hk=`const float czm_infinity = 5906376272000.0;
`;var mk=`const float czm_oneOverPi = 0.3183098861837907;
`;var pk=`const float czm_oneOverTwoPi = 0.15915494309189535;
`;var _k=`const float czm_passCesium3DTile = 4.0;
`;var gk=`const float czm_passCesium3DTileClassification = 5.0;
`;var yk=`const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
`;var xk=`const float czm_passClassification = 7.0;
`;var Ck=`const float czm_passCompute = 1.0;
`;var Ak=`const float czm_passEnvironment = 0.0;
`;var Tk=`const float czm_passGlobe = 2.0;
`;var bk=`const float czm_passOpaque = 7.0;
`;var Ek=`const float czm_passOverlay = 9.0;
`;var Sk=`const float czm_passTerrainClassification = 3.0;
`;var wk=`const float czm_passTranslucent = 8.0;
`;var vk=`const float czm_pi = 3.141592653589793;
`;var Dk=`const float czm_piOverFour = 0.7853981633974483;
`;var Pk=`const float czm_piOverSix = 0.5235987755982988;
`;var Ik=`const float czm_piOverThree = 1.0471975511965976;
`;var Ok=`const float czm_piOverTwo = 1.5707963267948966;
`;var Rk=`const float czm_radiansPerDegree = 0.017453292519943295;
`;var Mk=`const float czm_sceneMode2D = 2.0;
`;var Bk=`const float czm_sceneMode3D = 3.0;
`;var Lk=`const float czm_sceneModeColumbusView = 1.0;
`;var Nk=`const float czm_sceneModeMorphing = 0.0;
`;var Fk=`const float czm_solarRadius = 695500000.0;
`;var Vk=`const float czm_threePiOver2 = 4.71238898038469;
`;var kk=`const float czm_twoPi = 6.283185307179586;
`;var Uk=`const float czm_webMercatorMaxLatitude = 1.4844222297453324;
`;var zk=`struct czm_depthRangeStruct
{
float near;
float far;
};
`;var Hk=`struct czm_material
{
vec3 diffuse;
float specular;
float shininess;
vec3 normal;
vec3 emission;
float alpha;
};
`;var Gk=`struct czm_materialInput
{
float s;
vec2 st;
vec3 str;
vec3 normalEC;
mat3 tangentToEyeMatrix;
vec3 positionToEyeEC;
float height;
float slope;
float aspect;
};
`;var Wk=`struct czm_modelMaterial {
vec3 diffuse;
float alpha;
vec3 specular;
float roughness;
vec3 normalEC;
float occlusion;
vec3 emissive;
};
`;var jk=`struct czm_modelVertexOutput {
vec3 positionMC;
float pointSize;
};
`;var qk=`struct czm_pbrParameters
{
vec3 diffuseColor;
float roughness;
vec3 f0;
};
`;var Yk=`struct czm_ray
{
vec3 origin;
vec3 direction;
};
`;var Xk=`struct czm_raySegment
{
float start;
float stop;
};
const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);
const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);
`;var Kk=`struct czm_shadowParameters
{
#ifdef USE_CUBE_MAP_SHADOW
vec3 texCoords;
#else
vec2 texCoords;
#endif
float depthBias;
float depth;
float nDotL;
vec2 texelStepSize;
float normalShadingSmooth;
float darkness;
};
`;var $k=`vec3 czm_acesTonemapping(vec3 color) {
float g = 0.985;
float a = 0.065;
float b = 0.0001;
float c = 0.433;
float d = 0.238;
color = (color * (color + a) - b) / (color * (g * color + c) + d);
color = clamp(color, 0.0, 1.0);
return color;
}
`;var Zk=`float czm_alphaWeight(float a)
{
float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));
}
`;var Jk=`vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)
{
float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);
float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);
val1 = val1 * (1.0 - val2);
val1 = val1 * val1 * (3.0 - (2.0 * val1));
val1 = pow(val1, 0.5);
vec4 midColor = (color1 + color2) * 0.5;
return mix(midColor, currentColor, val1);
}
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)
{
return czm_antialias(color1, color2, currentColor, dist, 0.1);
}
`;var Qk=`vec2 czm_approximateSphericalCoordinates(vec3 normal) {
float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);
float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);
return vec2(latitudeApproximation, longitudeApproximation);
}
`;var eU=`bool czm_backFacing()
{
return gl_FrontFacing == false;
}
`;var tU=`float czm_branchFreeTernary(bool comparison, float a, float b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
vec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
vec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
vec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
`;var nU=`vec4 czm_cascadeColor(vec4 weights)
{
return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +
vec4(0.0, 1.0, 0.0, 1.0) * weights.y +
vec4(0.0, 0.0, 1.0, 1.0) * weights.z +
vec4(1.0, 0.0, 1.0, 1.0) * weights.w;
}
`;var iU=`uniform vec4 shadowMap_cascadeDistances;
float czm_cascadeDistance(vec4 weights)
{
return dot(shadowMap_cascadeDistances, weights);
}
`;var oU=`uniform mat4 shadowMap_cascadeMatrices[4];
mat4 czm_cascadeMatrix(vec4 weights)
{
return shadowMap_cascadeMatrices[0] * weights.x +
shadowMap_cascadeMatrices[1] * weights.y +
shadowMap_cascadeMatrices[2] * weights.z +
shadowMap_cascadeMatrices[3] * weights.w;
}
`;var rU=`uniform vec4 shadowMap_cascadeSplits[2];
vec4 czm_cascadeWeights(float depthEye)
{
vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));
vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);
return near * far;
}
`;var sU=`vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
{
vec3 p = mix(position2D.xyz, position3D.xyz, time);
return vec4(p, 1.0);
}
`;var aU=`vec4 czm_computePosition();
`;var cU=`vec2 cordic(float angle)
{
vec2 vector = vec2(6.0725293500888267e-1, 0.0);
float sense = (angle < 0.0) ? -1.0 : 1.0;
mat2 rotation = mat2(1.0, sense, -sense, 1.0);
vector = rotation * vector;
angle -= sense * 7.8539816339744828e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
float factor = sense * 5.0e-1;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 4.6364760900080609e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 2.5e-1;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 2.4497866312686414e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.25e-1;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.2435499454676144e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 6.25e-2;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 6.2418809995957350e-2;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.125e-2;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.1239833430268277e-2;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.5625e-2;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.5623728620476831e-2;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 7.8125e-3;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 7.8123410601011111e-3;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.90625e-3;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.9062301319669718e-3;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.953125e-3;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.9531225164788188e-3;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 9.765625e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 9.7656218955931946e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 4.8828125e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 4.8828121119489829e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 2.44140625e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 2.4414062014936177e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.220703125e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.2207031189367021e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 6.103515625e-5;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 6.1035156174208773e-5;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.0517578125e-5;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.0517578115526096e-5;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.52587890625e-5;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.5258789061315762e-5;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 7.62939453125e-6;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 7.6293945311019700e-6;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.814697265625e-6;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.8146972656064961e-6;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.9073486328125e-6;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.9073486328101870e-6;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 9.5367431640625e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 9.5367431640596084e-7;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 4.76837158203125e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 4.7683715820308884e-7;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 2.384185791015625e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 2.3841857910155797e-7;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.1920928955078125e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
return vector;
}
vec2 czm_cosineAndSine(float angle)
{
if (angle < -czm_piOverTwo || angle > czm_piOverTwo)
{
if (angle < 0.0)
{
return -cordic(angle + czm_pi);
}
else
{
return -cordic(angle - czm_pi);
}
}
else
{
return cordic(angle);
}
}
`;var lU=`vec2 czm_decompressTextureCoordinates(float encoded)
{
float temp = encoded / 4096.0;
float xZeroTo4095 = floor(temp);
float stx = xZeroTo4095 / 4095.0;
float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;
return vec2(stx, sty);
}
`;var uU=`czm_pbrParameters czm_defaultPbrMaterial()
{
czm_pbrParameters results;
results.diffuseColor = vec3(1.0);
results.roughness = 1.0;
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
results.f0 = REFLECTANCE_DIELECTRIC;
return results;
}
`;var fU=`#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
varying float v_WindowZ;
#endif
vec4 czm_depthClamp(vec4 coords)
{
#ifndef LOG_DEPTH
#ifdef GL_EXT_frag_depth
v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;
coords.z = 0.0;
#else
coords.z = min(coords.z, coords.w);
#endif
#endif
return coords;
}
`;var dU=`mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
{
vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));
vec3 tangentEC = normalize(czm_normal3D * tangentMC);
vec3 bitangentEC = normalize(cross(normalEC, tangentEC));
return mat3(
tangentEC.x, tangentEC.y, tangentEC.z,
bitangentEC.x, bitangentEC.y, bitangentEC.z,
normalEC.x, normalEC.y, normalEC.z);
}
`;var hU=`bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)
{
vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;
return (dot(scaled, scaled) <= 1.0);
}
`;var mU=`vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)
{
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
}
`;var pU=`bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {
return all(lessThanEqual(abs(left - right), vec4(epsilon)));
}
bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {
return all(lessThanEqual(abs(left - right), vec3(epsilon)));
}
bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {
return all(lessThanEqual(abs(left - right), vec2(epsilon)));
}
bool czm_equalsEpsilon(float left, float right, float epsilon) {
return (abs(left - right) <= epsilon);
}
`;var _U=`vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)
{
vec4 p = positionEC;
vec4 zEyeOffset = normalize(p) * eyeOffset.z;
p.xy += eyeOffset.xy + zEyeOffset.xy;
p.z += zEyeOffset.z;
return p;
}
`;var gU=`vec4 czm_eyeToWindowCoordinates(vec4 positionEC)
{
vec4 q = czm_projection * positionEC;
q.xyz /= q.w;
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;
return q;
}
`;var yU=`float czm_fastApproximateAtan(float x) {
return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);
}
float czm_fastApproximateAtan(float x, float y) {
float t = abs(x);
float opposite = abs(y);
float adjacent = max(t, opposite);
opposite = min(t, opposite);
t = czm_fastApproximateAtan(opposite / adjacent);
t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);
t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);
t = czm_branchFreeTernary(y < 0.0, -t, t);
return t;
}
`;var xU=`vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)
{
float scalar = distanceToCamera * czm_fogDensity;
float fog = 1.0 - exp(-(scalar * scalar));
return mix(color, fogColor, fog);
}
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)
{
float scalar = distanceToCamera * czm_fogDensity;
float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));
return mix(color, fogColor, fog);
}
`;var CU=`vec3 czm_gammaCorrect(vec3 color) {
#ifdef HDR
color = pow(color, vec3(czm_gamma));
#endif
return color;
}
vec4 czm_gammaCorrect(vec4 color) {
#ifdef HDR
color.rgb = pow(color.rgb, vec3(czm_gamma));
#endif
return color;
}
`;var AU=`vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
{
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
}
`;var TU=`czm_material czm_getDefaultMaterial(czm_materialInput materialInput)
{
czm_material material;
material.diffuse = vec3(0.0);
material.specular = 0.0;
material.shininess = 1.0;
material.normal = materialInput.normalEC;
material.emission = vec3(0.0);
material.alpha = 1.0;
return material;
}
`;var bU=`float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
{
return max(dot(lightDirectionEC, normalEC), 0.0);
}
`;var EU=`float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)
{
vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);
float specular = max(dot(toReflectedLight, toEyeEC), 0.0);
return pow(specular, max(shininess, czm_epsilon2));
}
`;var SU=`vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)
{
float cosAngle = cos(angleInRadians);
float sinAngle = sin(angleInRadians);
vec2 s0 = vec2(1.0/17.0, 0.0);
vec2 s1 = vec2(-1.0/29.0, 0.0);
vec2 s2 = vec2(1.0/101.0, 1.0/59.0);
vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);
s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));
s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));
s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));
s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));
vec2 uv0 = (uv/103.0) + (time * s0);
vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);
vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);
vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);
uv0 = fract(uv0);
uv1 = fract(uv1);
uv2 = fract(uv2);
uv3 = fract(uv3);
vec4 noise = (texture2D(normalMap, uv0)) +
(texture2D(normalMap, uv1)) +
(texture2D(normalMap, uv2)) +
(texture2D(normalMap, uv3));
return ((noise / 4.0) - 0.5) * 2.0;
}
`;var wU=`const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 czm_HSBToRGB(vec3 hsb)
{
vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);
return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);
}
`;var vU=`vec3 hueToRGB(float hue)
{
float r = abs(hue * 6.0 - 3.0) - 1.0;
float g = 2.0 - abs(hue * 6.0 - 2.0);
float b = 2.0 - abs(hue * 6.0 - 4.0);
return clamp(vec3(r, g, b), 0.0, 1.0);
}
vec3 czm_HSLToRGB(vec3 hsl)
{
vec3 rgb = hueToRGB(hsl.x);
float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;
return (rgb - 0.5) * c + hsl.z;
}
`;var DU=`vec3 czm_hue(vec3 rgb, float adjustment)
{
const mat3 toYIQ = mat3(0.299, 0.587, 0.114,
0.595716, -0.274453, -0.321263,
0.211456, -0.522591, 0.311135);
const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,
1.0, -0.2721, -0.6474,
1.0, -1.107, 1.7046);
vec3 yiq = toYIQ * rgb;
float hue = atan(yiq.z, yiq.y) + adjustment;
float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);
vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));
return toRGB * color;
}
`;var PU=`vec3 czm_inverseGamma(vec3 color) {
return pow(color, vec3(1.0 / czm_gamma));
}
`;var IU=`bool czm_isEmpty(czm_raySegment interval)
{
return (interval.stop < 0.0);
}
`;var OU=`bool czm_isFull(czm_raySegment interval)
{
return (interval.start == 0.0 && interval.stop == czm_infinity);
}
`;var RU=`float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)
{
float sinLatitude = sin(latitude);
float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));
return (mercatorY - southMercatorY) * oneOverMercatorHeight;
}
`;var MU=`vec3 czm_linearToSrgb(vec3 linearIn)
{
return pow(linearIn, vec3(1.0/2.2));
}
vec4 czm_linearToSrgb(vec4 linearIn)
{
vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));
return vec4(srgbOut, linearIn.a);
}
`;var BU=`float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {
return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);
}
`;var LU=`float czm_luminance(vec3 rgb)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
return dot(rgb, W);
}
`;var NU=`float czm_metersPerPixel(vec4 positionEC, float pixelRatio)
{
float width = czm_viewport.z;
float height = czm_viewport.w;
float pixelWidth;
float pixelHeight;
float top = czm_frustumPlanes.x;
float bottom = czm_frustumPlanes.y;
float left = czm_frustumPlanes.z;
float right = czm_frustumPlanes.w;
if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)
{
float frustumWidth = right - left;
float frustumHeight = top - bottom;
pixelWidth = frustumWidth / width;
pixelHeight = frustumHeight / height;
}
else
{
float distanceToPixel = -positionEC.z;
float inverseNear = 1.0 / czm_currentFrustum.x;
float tanTheta = top * inverseNear;
pixelHeight = 2.0 * distanceToPixel * tanTheta / height;
tanTheta = right * inverseNear;
pixelWidth = 2.0 * distanceToPixel * tanTheta / width;
}
return max(pixelWidth, pixelHeight) * pixelRatio;
}
float czm_metersPerPixel(vec4 positionEC)
{
return czm_metersPerPixel(positionEC, czm_pixelRatio);
}
`;var FU=`vec4 czm_modelToWindowCoordinates(vec4 position)
{
vec4 q = czm_modelViewProjection * position;
q.xyz /= q.w;
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;
return q;
}
`;var VU=`vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
vec3 target = left * right;
float leftLuminance = dot(left, W);
float rightLuminance = dot(right, W);
float targetLuminance = dot(target, W);
return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;
}
`;var kU=`float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)
{
float valueAtMin = nearFarScalar.y;
float valueAtMax = nearFarScalar.w;
float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;
float farDistanceSq = nearFarScalar.z * nearFarScalar.z;
float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);
t = pow(clamp(t, 0.0, 1.0), 0.2);
return mix(valueAtMin, valueAtMax, t);
}
`;var UU=`vec3 czm_octDecode(vec2 encoded, float range)
{
if (encoded.x == 0.0 && encoded.y == 0.0) {
return vec3(0.0, 0.0, 0.0);
}
encoded = encoded / range * 2.0 - 1.0;
vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));
if (v.z < 0.0)
{
v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);
}
return normalize(v);
}
vec3 czm_octDecode(vec2 encoded)
{
return czm_octDecode(encoded, 255.0);
}
vec3 czm_octDecode(float encoded)
{
float temp = encoded / 256.0;
float x = floor(temp);
float y = (temp - x) * 256.0;
return czm_octDecode(vec2(x, y));
}
void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)
{
float temp = encoded.x / 65536.0;
float x = floor(temp);
float encodedFloat1 = (temp - x) * 65536.0;
temp = encoded.y / 65536.0;
float y = floor(temp);
float encodedFloat2 = (temp - y) * 65536.0;
vector1 = czm_octDecode(encodedFloat1);
vector2 = czm_octDecode(encodedFloat2);
vector3 = czm_octDecode(vec2(x, y));
}
`;var zU=`vec4 czm_packDepth(float depth)
{
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
return enc;
}
`;var HU=`vec3 lambertianDiffuse(vec3 diffuseColor)
{
return diffuseColor / czm_pi;
}
vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
{
return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);
}
float smithVisibilityG1(float NdotV, float roughness)
{
float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
{
return (
smithVisibilityG1(NdotL, roughness) *
smithVisibilityG1(NdotV, roughness)
);
}
float GGX(float roughness, float NdotH)
{
float roughnessSquared = roughness * roughness;
float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;
return roughnessSquared / (czm_pi * f * f);
}
vec3 czm_pbrLighting(
vec3 positionEC,
vec3 normalEC,
vec3 lightDirectionEC,
vec3 lightColorHdr,
czm_pbrParameters pbrParameters
)
{
vec3 v = -normalize(positionEC);
vec3 l = normalize(lightDirectionEC);
vec3 h = normalize(v + l);
vec3 n = normalEC;
float NdotL = clamp(dot(n, l), 0.001, 1.0);
float NdotV = abs(dot(n, v)) + 0.001;
float NdotH = clamp(dot(n, h), 0.0, 1.0);
float LdotH = clamp(dot(l, h), 0.0, 1.0);
float VdotH = clamp(dot(v, h), 0.0, 1.0);
vec3 f0 = pbrParameters.f0;
float reflectance = max(max(f0.r, f0.g), f0.b);
vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
vec3 F = fresnelSchlick2(f0, f90, VdotH);
float alpha = pbrParameters.roughness;
float G = smithVisibilityGGX(alpha, NdotL, NdotV);
float D = GGX(alpha, NdotH);
vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);
vec3 diffuseColor = pbrParameters.diffuseColor;
vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);
return (diffuseContribution + specularContribution) * NdotL * lightColorHdr;
}
`;var GU=`czm_pbrParameters czm_pbrMetallicRoughnessMaterial(
vec3 baseColor,
float metallic,
float roughness
)
{
czm_pbrParameters results;
roughness = clamp(roughness, 0.0, 1.0);
results.roughness = roughness * roughness;
metallic = clamp(metallic, 0.0, 1.0);
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);
results.f0 = f0;
results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);
return results;
}
`;var WU=`czm_pbrParameters czm_pbrSpecularGlossinessMaterial(
vec3 diffuse,
vec3 specular,
float glossiness
)
{
czm_pbrParameters results;
float roughness = 1.0 - glossiness;
results.roughness = roughness * roughness;
results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));
results.f0 = specular;
return results;
}
`;var jU=`float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)
{
return czm_getLambertDiffuse(lightDirectionEC, material.normal);
}
float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)
{
return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);
}
vec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);
if (czm_sceneMode == czm_sceneMode3D) {
diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);
}
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
vec3 materialDiffuse = material.diffuse * 0.5;
vec3 ambient = materialDiffuse;
vec3 color = ambient + material.emission;
color += materialDiffuse * diffuse * czm_lightColor;
color += material.specular * specular * czm_lightColor;
return vec4(color, material.alpha);
}
vec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
vec3 ambient = vec3(0.0);
vec3 color = ambient + material.emission;
color += material.diffuse * diffuse * czm_lightColor;
color += material.specular * specular * czm_lightColor;
return vec4(color, material.alpha);
}
`;var qU=`float czm_planeDistance(vec4 plane, vec3 point) {
return (dot(plane.xyz, point) + plane.w);
}
float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {
return (dot(planeNormal, point) + planeDistance);
}
`;var YU=`vec3 czm_pointAlongRay(czm_ray ray, float time)
{
return ray.origin + (time * ray.direction);
}
`;var XU=`czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)
{
vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;
vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;
q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;
float q2 = dot(q, q);
float qw = dot(q, w);
if (q2 > 1.0)
{
if (qw >= 0.0)
{
return czm_emptyRaySegment;
}
else
{
float qw2 = qw * qw;
float difference = q2 - 1.0;
float w2 = dot(w, w);
float product = w2 * difference;
if (qw2 < product)
{
return czm_emptyRaySegment;
}
else if (qw2 > product)
{
float discriminant = qw * qw - product;
float temp = -qw + sqrt(discriminant);
float root0 = temp / w2;
float root1 = difference / temp;
if (root0 < root1)
{
czm_raySegment i = czm_raySegment(root0, root1);
return i;
}
else
{
czm_raySegment i = czm_raySegment(root1, root0);
return i;
}
}
else
{
float root = sqrt(difference / w2);
czm_raySegment i = czm_raySegment(root, root);
return i;
}
}
}
else if (q2 < 1.0)
{
float difference = q2 - 1.0;
float w2 = dot(w, w);
float product = w2 * difference;
float discriminant = qw * qw - product;
float temp = -qw + sqrt(discriminant);
czm_raySegment i = czm_raySegment(0.0, temp / w2);
return i;
}
else
{
if (qw < 0.0)
{
float w2 = dot(w, w);
czm_raySegment i = czm_raySegment(0.0, -qw / w2);
return i;
}
else
{
return czm_emptyRaySegment;
}
}
}
`;var KU=`czm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius)
{
vec3 o = ray.origin;
vec3 d = ray.direction;
vec3 oc = o - center;
float a = dot(d, d);
float b = 2.0 * dot(d, oc);
float c = dot(oc, oc) - (radius * radius);
float det = (b * b) - (4.0 * a * c);
if (det < 0.0) {
return czm_emptyRaySegment;
}
float sqrtDet = sqrt(det);
float t0 = (-b - sqrtDet) / (2.0 * a);
float t1 = (-b + sqrtDet) / (2.0 * a);
czm_raySegment result = czm_raySegment(t0, t1);
return result;
}
`;var $U=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
{
return czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);
}
`;var ZU=`float czm_readNonPerspective(float value, float oneOverW) {
return value * oneOverW;
}
vec2 czm_readNonPerspective(vec2 value, float oneOverW) {
return value * oneOverW;
}
vec3 czm_readNonPerspective(vec3 value, float oneOverW) {
return value * oneOverW;
}
vec4 czm_readNonPerspective(vec4 value, float oneOverW) {
return value * oneOverW;
}
`;var JU=`float czm_reverseLogDepth(float logZ)
{
#ifdef LOG_DEPTH
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;
float depthFromNear = pow(2.0, log2Depth) - 1.0;
return far * (1.0 - near / (depthFromNear + near)) / (far - near);
#endif
return logZ;
}
`;var QU=`const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec3 czm_RGBToHSB(vec3 rgb)
{
vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));
vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));
float d = q.x - min(q.w, q.y);
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);
}
`;var e4=`vec3 RGBtoHCV(vec3 rgb)
{
vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);
vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);
float c = q.x - min(q.w, q.y);
float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);
return vec3(h, c, q.x);
}
vec3 czm_RGBToHSL(vec3 rgb)
{
vec3 hcv = RGBtoHCV(rgb);
float l = hcv.z - hcv.y * 0.5;
float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);
return vec3(hcv.x, s, l);
}
`;var t4=`vec3 czm_RGBToXYZ(vec3 rgb)
{
const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,
0.3576, 0.7152, 0.1192,
0.1805, 0.0722, 0.9505);
vec3 xyz = RGB2XYZ * rgb;
vec3 Yxy;
Yxy.r = xyz.g;
float temp = dot(vec3(1.0), xyz);
Yxy.gb = xyz.rg / temp;
return Yxy;
}
`;var n4=`float czm_round(float value) {
return floor(value + 0.5);
}
vec2 czm_round(vec2 value) {
return floor(value + 0.5);
}
vec3 czm_round(vec3 value) {
return floor(value + 0.5);
}
vec4 czm_round(vec4 value) {
return floor(value + 0.5);
}
`;var i4=`vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)
{
direction /= dot(vec3(1.0), abs(direction));
vec2 rev = abs(direction.zx) - vec2(1.0);
vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,
direction.z < 0.0 ? rev.y : -rev.y);
vec2 uv = direction.y < 0.0 ? neg : direction.xz;
vec2 coord = 0.5 * uv + vec2(0.5);
vec2 pixel = 1.0 / textureSize;
if (lod > 0.0)
{
float scale = 1.0 / pow(2.0, lod);
float offset = ((textureSize.y + 1.0) / textureSize.x);
coord.x *= offset;
coord *= scale;
coord.x += offset + pixel.x;
coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;
}
else
{
coord.x *= (textureSize.y / textureSize.x);
}
#ifndef OES_texture_float_linear
vec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;
vec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;
vec3 color3 = texture2D(projectedMap, coord + pixel).rgb;
vec3 color4 = texture2D(projectedMap, coord).rgb;
vec2 texturePosition = coord * textureSize;
float fu = fract(texturePosition.x);
float fv = fract(texturePosition.y);
vec3 average1 = mix(color4, color2, fu);
vec3 average2 = mix(color1, color3, fu);
vec3 color = mix(average1, average2, fv);
#else
vec3 color = texture2D(projectedMap, coord).rgb;
#endif
return color;
}
vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {
float currentLod = floor(lod + 0.5);
float nextLod = min(currentLod + 1.0, maxLod);
vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);
vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);
return mix(colorNextLod, colorCurrentLod, nextLod - lod);
}
`;var o4=`vec3 czm_saturation(vec3 rgb, float adjustment)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
vec3 intensity = vec3(dot(rgb, W));
return mix(intensity, rgb, adjustment);
}
`;var r4=`float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)
{
return czm_unpackDepth(textureCube(shadowMap, d));
}
float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)
{
#ifdef USE_SHADOW_DEPTH_TEXTURE
return texture2D(shadowMap, uv).r;
#else
return czm_unpackDepth(texture2D(shadowMap, uv));
#endif
}
float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)
{
return step(depth, czm_sampleShadowMap(shadowMap, uv));
}
float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)
{
return step(depth, czm_sampleShadowMap(shadowMap, uv));
}
`;var s4=`float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)
{
#ifdef USE_NORMAL_SHADING
#ifdef USE_NORMAL_SHADING_SMOOTH
float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);
#else
float strength = step(0.0, nDotL);
#endif
visibility *= strength;
#endif
visibility = max(visibility, darkness);
return visibility;
}
#ifdef USE_CUBE_MAP_SHADOW
float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)
{
float depthBias = shadowParameters.depthBias;
float depth = shadowParameters.depth;
float nDotL = shadowParameters.nDotL;
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
float darkness = shadowParameters.darkness;
vec3 uvw = shadowParameters.texCoords;
depth -= depthBias;
float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
}
#else
float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)
{
float depthBias = shadowParameters.depthBias;
float depth = shadowParameters.depth;
float nDotL = shadowParameters.nDotL;
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
float darkness = shadowParameters.darkness;
vec2 uv = shadowParameters.texCoords;
depth -= depthBias;
#ifdef USE_SOFT_SHADOWS
vec2 texelStepSize = shadowParameters.texelStepSize;
float radius = 1.0;
float dx0 = -texelStepSize.x * radius;
float dy0 = -texelStepSize.y * radius;
float dx1 = texelStepSize.x * radius;
float dy1 = texelStepSize.y * radius;
float visibility = (
czm_shadowDepthCompare(shadowMap, uv, depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)
) * (1.0 / 9.0);
#else
float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);
#endif
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
}
#endif
`;var a4=`float czm_signNotZero(float value)
{
return value >= 0.0 ? 1.0 : -1.0;
}
vec2 czm_signNotZero(vec2 value)
{
return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));
}
vec3 czm_signNotZero(vec3 value)
{
return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));
}
vec4 czm_signNotZero(vec4 value)
{
return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));
}
`;var c4=`vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])
{
vec3 L00 = coefficients[0];
vec3 L1_1 = coefficients[1];
vec3 L10 = coefficients[2];
vec3 L11 = coefficients[3];
vec3 L2_2 = coefficients[4];
vec3 L2_1 = coefficients[5];
vec3 L20 = coefficients[6];
vec3 L21 = coefficients[7];
vec3 L22 = coefficients[8];
float x = normal.x;
float y = normal.y;
float z = normal.z;
return
L00
+ L1_1 * y
+ L10 * z
+ L11 * x
+ L2_2 * (y * x)
+ L2_1 * (y * z)
+ L20 * (3.0 * z * z - 1.0)
+ L21 * (z * x)
+ L22 * (x * x - y * y);
}
`;var l4=`vec3 czm_srgbToLinear(vec3 srgbIn)
{
return pow(srgbIn, vec3(2.2));
}
vec4 czm_srgbToLinear(vec4 srgbIn)
{
vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));
return vec4(linearOut, srgbIn.a);
}
`;var u4=`mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)
{
vec3 normal = normalize(normalEC);
vec3 tangent = normalize(tangentEC);
vec3 bitangent = normalize(bitangentEC);
return mat3(tangent.x , tangent.y , tangent.z,
bitangent.x, bitangent.y, bitangent.z,
normal.x , normal.y , normal.z);
}
`;var f4=`vec4 czm_transformPlane(vec4 plane, mat4 transform) {
vec4 transformedPlane = transform * plane;
float normalMagnitude = length(transformedPlane.xyz);
return transformedPlane / normalMagnitude;
}
`;var d4=`vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
{
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
return vec4(highDifference + lowDifference, 1.0);
}
`;var h4=`vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);
if (czm_sceneMode == czm_sceneMode3D) {
diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);
}
diffuse = clamp(diffuse, 0.0, 1.0);
float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);
vec3 materialDiffuse = material.diffuse * 0.5;
vec3 ambient = materialDiffuse;
vec3 color = ambient + material.emission;
color += materialDiffuse * diffuse * czm_lightColor;
color += material.specular * specular * czm_lightColor;
return vec4(color, material.alpha);
}
`;var m4=`mat2 czm_transpose(mat2 matrix)
{
return mat2(
matrix[0][0], matrix[1][0],
matrix[0][1], matrix[1][1]);
}
mat3 czm_transpose(mat3 matrix)
{
return mat3(
matrix[0][0], matrix[1][0], matrix[2][0],
matrix[0][1], matrix[1][1], matrix[2][1],
matrix[0][2], matrix[1][2], matrix[2][2]);
}
mat4 czm_transpose(mat4 matrix)
{
return mat4(
matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);
}
`;var p4=`float czm_unpackDepth(vec4 packedDepth)
{
return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
}
`;var _4=`float czm_unpackFloat(vec4 packedFloat)
{
packedFloat = floor(packedFloat * 255.0 + 0.5);
float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;
float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;
if (exponent == -127.0)
{
return 0.0;
}
float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);
float result = sign * exp2(exponent - 23.0) * mantissa;
return result;
}
`;var g4=`int czm_unpackUint(float packedValue) {
float rounded = czm_round(packedValue * 255.0);
return int(rounded);
}
int czm_unpackUint(vec2 packedValue) {
vec2 rounded = czm_round(packedValue * 255.0);
return int(dot(rounded, vec2(1.0, 256.0)));
}
int czm_unpackUint(vec3 packedValue) {
vec3 rounded = czm_round(packedValue * 255.0);
return int(dot(rounded, vec3(1.0, 256.0, 65536.0)));
}
int czm_unpackUint(vec4 packedValue) {
vec4 rounded = czm_round(packedValue * 255.0);
return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));
}
`;var y4=`float czm_valueTransform(float offset, float scale, float value) {
return scale * value + offset;
}
vec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) {
return scale * value + offset;
}
vec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) {
return scale * value + offset;
}
vec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) {
return scale * value + offset;
}
mat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) {
return matrixCompMult(scale, value) + offset;
}
mat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) {
return matrixCompMult(scale, value) + offset;
}
mat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) {
return matrixCompMult(scale, value) + offset;
}
`;var x4=`#ifdef LOG_DEPTH
varying float v_depthFromNearPlusOne;
#ifdef SHADOW_MAP
varying vec3 v_logPositionEC;
#endif
#endif
vec4 czm_updatePositionDepth(vec4 coords) {
#if defined(LOG_DEPTH)
#ifdef SHADOW_MAP
vec3 logPositionEC = (czm_inverseProjection * coords).xyz;
v_logPositionEC = logPositionEC;
#endif
coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;
#endif
return coords;
}
void czm_vertexLogDepth()
{
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;
gl_Position = czm_updatePositionDepth(gl_Position);
#endif
}
void czm_vertexLogDepth(vec4 clipCoords)
{
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;
czm_updatePositionDepth(clipCoords);
#endif
}
`;var C4=`vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
{
float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;
float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;
float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
vec4 q = vec4(x, y, z, 1.0);
q /= fragmentCoordinate.w;
if (!(czm_inverseProjection == mat4(0.0)))
{
q = czm_inverseProjection * q;
}
else
{
float top = czm_frustumPlanes.x;
float bottom = czm_frustumPlanes.y;
float left = czm_frustumPlanes.z;
float right = czm_frustumPlanes.w;
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
q.x = (q.x * (right - left) + left + right) * 0.5;
q.y = (q.y * (top - bottom) + bottom + top) * 0.5;
q.z = (q.z * (near - far) - near - far) * 0.5;
q.w = 1.0;
}
return q;
}
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
{
#ifdef LOG_DEPTH
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;
float depthFromNear = pow(2.0, log2Depth) - 1.0;
float depthFromCamera = depthFromNear + near;
vec4 windowCoord = vec4(fragmentCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);
vec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);
eyeCoordinate.w = 1.0 / depthFromCamera;
return eyeCoordinate;
#else
vec4 windowCoord = vec4(fragmentCoordinateXY, depthOrLogDepth, 1.0);
vec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);
#endif
return eyeCoordinate;
}
`;var A4=`#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
varying float v_WindowZ;
#endif
void czm_writeDepthClamp()
{
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
gl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
#endif
}
`;var T4=`#ifdef LOG_DEPTH
varying float v_depthFromNearPlusOne;
#ifdef POLYGON_OFFSET
uniform vec2 u_polygonOffset;
#endif
#endif
void czm_writeLogDepth(float depth)
{
#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH)
if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {
discard;
}
#ifdef POLYGON_OFFSET
float factor = u_polygonOffset[0];
float units = u_polygonOffset[1];
#ifdef GL_OES_standard_derivatives
float x = dFdx(depth);
float y = dFdy(depth);
float m = sqrt(x * x + y * y);
depth += m * factor;
#endif
#endif
gl_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;
#ifdef POLYGON_OFFSET
gl_FragDepthEXT += czm_epsilon7 * units;
#endif
#endif
}
void czm_writeLogDepth() {
#ifdef LOG_DEPTH
czm_writeLogDepth(v_depthFromNearPlusOne);
#endif
}
`;var b4=`float czm_writeNonPerspective(float value, float w) {
return value * w;
}
vec2 czm_writeNonPerspective(vec2 value, float w) {
return value * w;
}
vec3 czm_writeNonPerspective(vec3 value, float w) {
return value * w;
}
vec4 czm_writeNonPerspective(vec4 value, float w) {
return value * w;
}
`;var E4=`vec3 czm_XYZToRGB(vec3 Yxy)
{
const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,
-1.5371, 1.8760, -0.2040,
-0.4985, 0.0416, 1.0572);
vec3 xyz;
xyz.r = Yxy.r * Yxy.g / Yxy.b;
xyz.g = Yxy.r;
xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;
return XYZ2RGB * xyz;
}
`;var US={czm_degreesPerRadian:ok,czm_depthRange:rk,czm_epsilon1:sk,czm_epsilon2:ak,czm_epsilon3:ck,czm_epsilon4:lk,czm_epsilon5:uk,czm_epsilon6:fk,czm_epsilon7:dk,czm_infinity:hk,czm_oneOverPi:mk,czm_oneOverTwoPi:pk,czm_passCesium3DTile:_k,czm_passCesium3DTileClassification:gk,czm_passCesium3DTileClassificationIgnoreShow:yk,czm_passClassification:xk,czm_passCompute:Ck,czm_passEnvironment:Ak,czm_passGlobe:Tk,czm_passOpaque:bk,czm_passOverlay:Ek,czm_passTerrainClassification:Sk,czm_passTranslucent:wk,czm_pi:vk,czm_piOverFour:Dk,czm_piOverSix:Pk,czm_piOverThree:Ik,czm_piOverTwo:Ok,czm_radiansPerDegree:Rk,czm_sceneMode2D:Mk,czm_sceneMode3D:Bk,czm_sceneModeColumbusView:Lk,czm_sceneModeMorphing:Nk,czm_solarRadius:Fk,czm_threePiOver2:Vk,czm_twoPi:kk,czm_webMercatorMaxLatitude:Uk,czm_depthRangeStruct:zk,czm_material:Hk,czm_materialInput:Gk,czm_modelMaterial:Wk,czm_modelVertexOutput:jk,czm_pbrParameters:qk,czm_ray:Yk,czm_raySegment:Xk,czm_shadowParameters:Kk,czm_acesTonemapping:$k,czm_alphaWeight:Zk,czm_antialias:Jk,czm_approximateSphericalCoordinates:Qk,czm_backFacing:eU,czm_branchFreeTernary:tU,czm_cascadeColor:nU,czm_cascadeDistance:iU,czm_cascadeMatrix:oU,czm_cascadeWeights:rU,czm_columbusViewMorph:sU,czm_computePosition:aU,czm_cosineAndSine:cU,czm_decompressTextureCoordinates:lU,czm_defaultPbrMaterial:uU,czm_depthClamp:fU,czm_eastNorthUpToEyeCoordinates:dU,czm_ellipsoidContainsPoint:hU,czm_ellipsoidWgs84TextureCoordinates:mU,czm_equalsEpsilon:pU,czm_eyeOffset:_U,czm_eyeToWindowCoordinates:gU,czm_fastApproximateAtan:yU,czm_fog:xU,czm_gammaCorrect:CU,czm_geodeticSurfaceNormal:AU,czm_getDefaultMaterial:TU,czm_getLambertDiffuse:bU,czm_getSpecular:EU,czm_getWaterNoise:SU,czm_HSBToRGB:wU,czm_HSLToRGB:vU,czm_hue:DU,czm_inverseGamma:PU,czm_isEmpty:IU,czm_isFull:OU,czm_latitudeToWebMercatorFraction:RU,czm_linearToSrgb:MU,czm_lineDistance:BU,czm_luminance:LU,czm_metersPerPixel:NU,czm_modelToWindowCoordinates:FU,czm_multiplyWithColorBalance:VU,czm_nearFarScalar:kU,czm_octDecode:UU,czm_packDepth:zU,czm_pbrLighting:HU,czm_pbrMetallicRoughnessMaterial:GU,czm_pbrSpecularGlossinessMaterial:WU,czm_phong:jU,czm_planeDistance:qU,czm_pointAlongRay:YU,czm_rayEllipsoidIntersectionInterval:XU,czm_raySphereIntersectionInterval:KU,czm_readDepth:$U,czm_readNonPerspective:ZU,czm_reverseLogDepth:JU,czm_RGBToHSB:QU,czm_RGBToHSL:e4,czm_RGBToXYZ:t4,czm_round:n4,czm_sampleOctahedralProjection:i4,czm_saturation:o4,czm_shadowDepthCompare:r4,czm_shadowVisibility:s4,czm_signNotZero:a4,czm_sphericalHarmonics:c4,czm_srgbToLinear:l4,czm_tangentToEyeSpaceMatrix:u4,czm_transformPlane:f4,czm_translateRelativeToEye:d4,czm_translucentPhong:h4,czm_transpose:m4,czm_unpackDepth:p4,czm_unpackFloat:_4,czm_unpackUint:g4,czm_valueTransform:y4,czm_vertexLogDepth:x4,czm_windowToEyeCoordinates:C4,czm_writeDepthClamp:A4,czm_writeLogDepth:T4,czm_writeNonPerspective:b4,czm_XYZToRGB:E4};function qne(e){return e=e.replace(/\/\/.*/g,""),e.replace(/\/\*\*[\s\S]*?\*\//gm,function(t){let n=t.match(/\n/gm).length,i="";for(let o=0;o<n;++o)i+=`
`;return i})}function Yne(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return l(i)||(t=qne(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function Xne(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);l(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&ea._czmBuiltinsAndUniforms.hasOwnProperty(i)){let o=Yne(i,ea._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),Xne(o,t)}}))}function PLe(e){let t=[],n=[];for(;e.length>0;){let o=e.pop();n.push(o),o.requiredBy.length===0&&t.push(o)}for(;t.length>0;){let o=t.shift();e.push(o);for(let r=0;r<o.dependsOn.length;++r){let s=o.dependsOn[r],a=s.requiredBy.indexOf(o);s.requiredBy.splice(a,1),s.requiredBy.length===0&&t.push(s)}}let i=[];for(let o=0;o<n.length;++o)n[o].requiredBy.length!==0&&i.push(n[o])}function ILe(e){let t=[],n=Yne("main",e,t);Xne(n,t),PLe(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
`;return i.replace(n.glslSource,"")}function Kne(e,t,n){let i,o,r="",s=e.sources;if(l(s))for(i=0,o=s.length;i<o;++i)r+=`
#line 0
${s[i]}`;r=qne(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(_,m){return a=m,`
`});let c=[];r=r.replace(/#extension.*\n/gm,function(_){return c.push(_),`
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");let u=e.pickColorQualifier;l(u)&&(r=ea.createPickFragmentShaderSource(r,u));let f="";l(a)&&(f=`#version ${a}
`);let d=c.length;for(i=0;i<d;i++)f+=c[i];t&&(f+=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
precision highp int;
#else
precision mediump float;
precision mediump int;
#define highp mediump
#endif
`);let p=e.defines;if(l(p))for(i=0,o=p.length;i<o;++i){let _=p[i];_.length!==0&&(f+=`#define ${_}
`)}return n.webgl2&&(f+=`#define OUTPUT_DECLARATION
`),n.textureFloatLinear&&(f+=`#define OES_texture_float_linear
`),n.floatingPointTexture&&(f+=`#define OES_texture_float
`),e.includeBuiltIns&&(f+=ILe(r)),f+=`
#line 0
`,f+=r,n.webgl2&&(f=ik(f,t,!0)),f}function ea(e){e=y(e,y.EMPTY_OBJECT);let t=e.pickColorQualifier;this.defines=l(e.defines)?e.defines.slice(0):[],this.sources=l(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=y(e.includeBuiltIns,!0)}ea.prototype.clone=function(){return new ea({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};ea.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};ea.prototype.createCombinedVertexShader=function(e){return Kne(this,!1,e)};ea.prototype.createCombinedFragmentShader=function(e){return Kne(this,!0,e)};ea._czmBuiltinsAndUniforms={};for(let e in US)US.hasOwnProperty(e)&&(ea._czmBuiltinsAndUniforms[e]=US[e]);for(let e in gy)if(gy.hasOwnProperty(e)){let t=gy[e];typeof t.getDeclaration=="function"&&(ea._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}ea.createPickVertexShaderSource=function(e){return`${ea.replaceMain(e,"czm_old_main")}
attribute vec4 pickColor;
varying vec4 czm_pickColor;
void main()
{
czm_old_main();
czm_pickColor = pickColor;
}`};ea.createPickFragmentShaderSource=function(e,t){let n=ea.replaceMain(e,"czm_old_main"),i=`${t} vec4 czm_pickColor;
void main()
{
czm_old_main();
if (gl_FragColor.a == 0.0) {
discard;
}
gl_FragColor = czm_pickColor;
}`;return`${n}
${i}`};function OLe(e,t){let n=e.defines,i=n.length;for(let o=0;o<i;++o)if(n[o]===t)return!0;return!1}function $ne(e,t){let n=e.sources,i=n.length;for(let o=0;o<i;++o)if(n[o].indexOf(t)!==-1)return!0;return!1}function Zne(e,t){let n=t.length;for(let i=0;i<n;++i){let o=t[i];if($ne(e,o))return o}}var RLe=["v_normalEC","v_normal"];ea.findNormalVarying=function(e){return $ne(e,"#ifdef HAS_NORMALS")?OLe(e,"HAS_NORMALS")?"v_normalEC":void 0:Zne(e,RLe)};var MLe=["v_positionEC"];ea.findPositionVarying=function(e){return Zne(e,MLe)};var je=ea;var S4=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute float batchId;
#ifdef EXTRUDED_GEOMETRY
attribute vec3 extrudeDirection;
uniform float u_globeMinimumAltitude;
#endif // EXTRUDED_GEOMETRY
#ifdef PER_INSTANCE_COLOR
varying vec4 v_color;
#endif // PER_INSTANCE_COLOR
#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
varying vec4 v_sphericalExtents;
#else // SPHERICAL
varying vec2 v_inversePlaneExtents;
varying vec4 v_westPlane;
varying vec4 v_southPlane;
#endif // SPHERICAL
varying vec3 v_uvMinAndSphericalLongitudeRotation;
varying vec3 v_uMaxAndInverseDistance;
varying vec3 v_vMaxAndInverseDistance;
#endif // TEXTURE_COORDINATES
void main()
{
vec4 position = czm_computePosition();
#ifdef EXTRUDED_GEOMETRY
float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));
delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;
position = position + vec4(extrudeDirection * delta, 0.0);
#endif
#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
v_sphericalExtents = czm_batchTable_sphericalExtents(batchId);
v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);
#else // SPHERICAL
#ifdef COLUMBUS_VIEW_2D
vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);
vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);
vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));
bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;
planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);
planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);
idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;
idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));
planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);
planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;
vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;
vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;
#else // COLUMBUS_VIEW_2D
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;
vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;
vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;
#endif // COLUMBUS_VIEW_2D
vec3 eastWard = southEastCorner - southWestCorner;
float eastExtent = length(eastWard);
eastWard /= eastExtent;
vec3 northWard = northWestCorner - southWestCorner;
float northExtent = length(northWard);
northWard /= northExtent;
v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));
v_southPlane = vec4(northWard, -dot(northWard, southWestCorner));
v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);
#endif // SPHERICAL
vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);
vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);
v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);
v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);
v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;
#endif // TEXTURE_COORDINATES
#ifdef PER_INSTANCE_COLOR
v_color = czm_batchTable_color(batchId);
#endif
gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);
}
`;var VA=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
void main(void)
{
#ifdef VECTOR_TILE
gl_FragColor = czm_gammaCorrect(u_highlightColor);
#else
gl_FragColor = vec4(1.0);
#endif
czm_writeDepthClamp();
}
`;var Jne={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};Jne.NUMBER_OF_CLASSIFICATION_TYPES=3;var Ei=Object.freeze(Jne);var BLe={NEVER:Z.NEVER,LESS:Z.LESS,EQUAL:Z.EQUAL,LESS_OR_EQUAL:Z.LEQUAL,GREATER:Z.GREATER,NOT_EQUAL:Z.NOTEQUAL,GREATER_OR_EQUAL:Z.GEQUAL,ALWAYS:Z.ALWAYS},pl=Object.freeze(BLe);var zI={STREAM_DRAW:Z.STREAM_DRAW,STATIC_DRAW:Z.STATIC_DRAW,DYNAMIC_DRAW:Z.DYNAMIC_DRAW,validate:function(e){return e===zI.STREAM_DRAW||e===zI.STATIC_DRAW||e===zI.DYNAMIC_DRAW}},We=Object.freeze(zI);function zu(e){e=y(e,y.EMPTY_OBJECT);let t=e.context._gl,n=e.bufferTarget,i=e.typedArray,o=e.sizeInBytes,r=e.usage,s=l(i);s&&(o=i.byteLength);let a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=hi(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}zu.createVertexBuffer=function(e){return new zu({context:e.context,bufferTarget:Z.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};zu.createIndexBuffer=function(e){let t=e.context,n=e.indexDatatype,i=Ge.getSizeInBytes(n),o=new zu({context:t,bufferTarget:Z.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),r=o.sizeInBytes/i;return Object.defineProperties(o,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return r}}}),o};Object.defineProperties(zu.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});zu.prototype._getBuffer=function(){return this._buffer};zu.prototype.copyFromArrayView=function(e,t){t=y(t,0);let n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};zu.prototype.copyFromBuffer=function(e,t,n,i){let o=Z.COPY_READ_BUFFER,r=Z.COPY_WRITE_BUFFER,s=this._gl;s.bindBuffer(r,this._buffer),s.bindBuffer(o,e._buffer),s.copyBufferSubData(o,r,t,n,i),s.bindBuffer(r,null),s.bindBuffer(o,null)};zu.prototype.getBufferData=function(e,t,n,i){t=y(t,0),n=y(n,0);let o=this._gl,r=Z.COPY_READ_BUFFER;o.bindBuffer(r,this._buffer),o.getBufferSubData(r,t,e,n,i),o.bindBuffer(r,null)};zu.prototype.isDestroyed=function(){return!1};zu.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),fe(this)};var Pt=zu;function LLe(e,t,n,i){let o=l(t.vertexBuffer),r=l(t.value),s=t.value?t.value.length:t.componentsPerAttribute,a={index:y(t.index,n),enabled:y(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:y(t.componentDatatype,X.FLOAT),normalize:y(t.normalize,!1),offsetInBytes:y(t.offsetInBytes,0),strideInBytes:y(t.strideInBytes,0),instanceDivisor:y(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(c){let u=this.index;c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),c.vertexAttribPointer(u,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),c.enableVertexAttribArray(u),this.instanceDivisor>0&&(i.glVertexAttribDivisor(u,this.instanceDivisor),i._vertexAttribDivisors[u]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(c){c.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(c){c.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(c){c.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(c){c.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(c){c.vertexAttrib4fv(this.index,this.value)};break}a.disableVertexAttribArray=function(c){}}e.push(a)}function eie(e,t,n){for(let i=0;i<t.length;++i){let o=t[i];o.enabled&&o.vertexAttrib(e)}l(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function ap(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer,r,s=[],a=1,c=!1,u=!1,f=i.length;for(r=0;r<f;++r)LLe(s,i[r],r,t);for(f=s.length,r=0;r<f;++r){let p=s[r];if(l(p.vertexBuffer)&&p
vec2 computeSt(float batchId)
{
float stepX = batchTextureStep.x;
float centerX = batchTextureStep.y;
float numberOfAttributes = float(${t});
return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5);
}
`:`uniform vec4 batchTextureStep;
uniform vec2 batchTextureDimensions;
vec2 computeSt(float batchId)
{
float stepX = batchTextureStep.x;
float centerX = batchTextureStep.y;
float stepY = batchTextureStep.z;
float centerY = batchTextureStep.w;
float numberOfAttributes = float(${t});
float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x);
float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x);
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
}
`}function $Le(e){return e===1?"float":`vec${e}`}function ZLe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function JLe(e,t){let i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=$Le(o),a=ZLe(o),c=e._offsets[t],u=`${s} ${r}(float batchId)
{
vec2 st = computeSt(batchId);
st.x += batchTextureStep.x * float(${c});
`;return e._packFloats&&i.componentDatatype!==lt.UNSIGNED_BYTE?u+=`vec4 textureValue;
textureValue.x = czm_unpackFloat(texture2D(batchTexture, st));
textureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0)));
textureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0)));
textureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0)));
`:u+=` vec4 textureValue = texture2D(batchTexture, st);
`,u+=` ${s} value = textureValue${a};
`,e._pixelDatatype===lt.UNSIGNED_BYTE&&i.componentDatatype===X.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0;
`:e._pixelDatatype===lt.FLOAT&&i.componentDatatype===X.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0;
`),u+=` return value;
}
`,u}cp.prototype.getVertexShaderCallback=function(){let e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
`;t+=`${KLe(this)}
`;let n=e.length;for(let i=0;i<n;++i)t+=JLe(this,i);return function(i){let o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
${t}
${s}`}};cp.prototype.isDestroyed=function(){return!1};cp.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),fe(this)};var HS=cp;function QLe(e,t,n){let i=!n,o=e.length,r;if(!i&&o>1){let s=e[0].modelMatrix;for(r=1;r<o;++r)if(!O.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)l(e[r].geometry)&&di.transformToWorldCoordinates(e[r]);else O.multiplyTransformation(t,e[0].modelMatrix,t)}function w4(e,t){let n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new Ie({componentDatatype:X.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});let r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function eNe(e){let t=e.length;for(let n=0;n<t;++n){let i=e[n];l(i.geometry)?w4(i.geometry,n):l(i.westHemisphereGeometry)&&l(i.eastHemisphereGeometry)&&(w4(i.westHemisphereGeometry,n),w4(i.eastHemisphereGeometry,n))}}function tNe(e){let t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix,c,u,f,d=t.length;for(c=0;c<d;++c)if(l(t[c].geometry)){f=t[c].geometry.primitiveType;break}if(QLe(t,a,o),!o)for(c=0;c<d;++c)l(t[c].geometry)&&di.splitLongitude(t[c]);if(eNe(t),r)for(c=0;c<d;++c){let _=t[c];l(_.geometry)?(di.reorderForPostVertexCache(_.geometry),di.reorderForPreVertexCache(_.geometry)):l(_.westHemisphereGeometry)&&l(_.eastHemisphereGeometry)&&(di.reorderForPostVertexCache(_.westHemisphereGeometry),di.reorderForPreVertexCache(_.westHemisphereGeometry),di.reorderForPostVertexCache(_.eastHemisphereGeometry),di.reorderForPreVertexCache(_.eastHemisphereGeometry))}let p=di.combineInstances(t);for(d=p.length,c=0;c<d;++c){u=p[c];let _=u.attributes;if(o)for(let m in _)_.hasOwnProperty(m)&&_[m].componentDatatype===X.DOUBLE&&di.encodeAttribute(u,m,`${m}3DHigh`,`${m}3DLow`);else for(let m in _)if(_.hasOwnProperty(m)&&_[m].componentDatatype===X.DOUBLE){let x=`${m}3D`,C=`${m}2D`;di.projectTo2D(u,m,x,C,n),l(u.boundingSphere)&&m==="position"&&(u.boundingSphereCV=re.fromVertices(u.attributes.position2D.values)),di.encodeAttribute(u,x,`${x}High`,`${x}Low`),di.encodeAttribute(u,C,`${C}High`,`${C}Low`)}s&&di.compressVertices(u)}if(!i){let _=[];for(d=p.length,c=0;c<d;++c)u=p[c],_=_.concat(di.fitToUnsignedShortIndices(u));p=_}return p}function v4(e,t,n,i){let o,r,s,a=i.length-1;if(a>=0){let u=i[a];o=u.offset+u.count,s=u.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;let c=e.length;for(let u=0;u<c;++u){let d=e[u][t];if(!l(d))continue;let p=d.indices.length;o+p>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:p}),o+=p}}function nNe(e,t){let n=[];return v4(e,"geometry",t,n),v4(e,"westHemisphereGeometry",t,n),v4(e,"eastHemisphereGeometry",t,n),n}var lp={};lp.combineGeometry=function(e){let t,n,i=e.instances,o=i.length,r,s,a=!1;o>0&&(t=tNe(e),t.length>0&&(n=di.createAttributeLocations(t[0]),e.createPickOffsets&&(r=nNe(i,t))),l(i[0].attributes)&&l(i[0].attributes.offset)&&(s=new Array(o),a=!0));let c=new Array(o),u=new Array(o);for(let f=0;f<o;++f){let d=i[f],p=d.geometry;l(p)&&(c[f]=p.boundingSphere,u[f]=p.boundingSphereCV,a&&(s[f]=d.geometry.offsetAttribute));let _=d.eastHemisphereGeometry,m=d.westHemisphereGeometry;l(_)&&l(m)&&(l(_.boundingSphere)&&l(m.boundingSphere)&&(c[f]=re.union(_.boundingSphere,m.boundingSphere)),l(_.boundingSphereCV)&&l(m.boundingSphereCV)&&(u[f]=re.union(_.boundingSphereCV,m.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:c,boundingSpheresCV:u}};function iNe(e,t){let n=e.attributes;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];l(o)&&l(o.values)&&t.push(o.values.buffer)}l(e.indices)&&t.push(e.indices.buffer)}function oNe(e,t){let n=e.length;for(let i=0;i<n;++i)iNe(e[i],t)}function rNe(e){let t=1,n=e.length;for(let i=0;i<n;i++){let o=e[i];if(++t,!l(o))continue;let r=o.attributes;t+=7+2*re.packedLength+(l(o.indices)?o.indices.length:0);for(let s in r)if(r.hasOwnProperty(s)&&l(r[s])){let a=r[s];t+=5+a.values.length}}return t}lp.packCreateGeometryResults=funct
`),l(e.rtcCenter)?(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,""),t=t.replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,""),o+=`uniform mat4 u_modifiedModelView;
`,r+=`attribute vec4 position;
`,s+=`${c}
{
return u_modifiedModelView * position;
}
`,t=t.replace(/czm_modelViewRelativeToEye\s+\*\s+/g,""),t=t.replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?s+=`${c}
{
return czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
}
`:(r+=`attribute vec3 ${a}2DHigh;
attribute vec3 ${a}2DLow;
`,s+=`${c}
{
vec4 p;
if (czm_morphTime == 1.0)
{
p = czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
}
else if (czm_morphTime == 0.0)
{
p = czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy);
}
else
{
p = czm_columbusViewMorph(
czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy),
czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow),
czm_morphTime);
}
return p;
}
`)}return[o,r,t,s].join(`
`)};Vr._appendShowToShader=function(e,t){return l(e._batchTableAttributeIndices.show)?`${je.replaceMain(t,"czm_non_show_main")}
void main()
{
czm_non_show_main();
gl_Position *= czm_batchTable_show(batchId);
}`:t};Vr._updateColorAttribute=function(e,t,n){if(!l(e._batchTableAttributeIndices.color)&&!l(e._batchTableAttributeIndices.depthFailColor)||t.search(/attribute\s+vec4\s+color;/g)===-1)return t;let i=t;return i=i.replace(/attribute\s+vec4\s+color;/g,""),n?i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),i};function rie(e){return`${je.replaceMain(e,"czm_non_pick_main")}
varying vec4 v_pickColor;
void main()
{
czm_non_pick_main();
v_pickColor = czm_batchTable_pickColor(batchId);
}`}function sie(e){return`varying vec4 v_pickColor;
${e}`}Vr._updatePickColorAttribute=function(e){let t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t};Vr._appendOffsetToShader=function(e,t){if(!l(e._batchTableAttributeIndices.offset))return t;let n=`attribute float batchId;
`;n+="attribute float applyOffset;";let i=t.replace(/attribute\s+float\s+batchId;/g,n),o=`vec4 $1 = czm_computePosition();
`;return o+=` if (czm_sceneMode == czm_sceneMode3D)
`,o+=` {
`,o+=" $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",o+=` }
`,o+=` else
`,o+=` {
`,o+=" $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",o+=` }
`,i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,o),i};Vr._appendDistanceDisplayConditionToShader=function(e,t,n){if(!l(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let i=je.replaceMain(t,"czm_non_distanceDisplayCondition_main"),o=`void main()
{
czm_non_distanceDisplayCondition_main();
vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);
vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);
vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);
float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);
`;return n?o+=` vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
`:o+=` vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);
vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);
vec4 centerRTE;
if (czm_morphTime == 1.0)
{
centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
}
else if (czm_morphTime == 0.0)
{
centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);
}
else
{
centerRTE = czm_columbusViewMorph(
czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),
czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),
czm_morphTime);
}
`,o+=` float radiusSq = boundingSphereRadius * boundingSphereRadius;
float distanceSq;
if (czm_sceneMode == czm_sceneMode2D)
{
distanceSq = czm_eyeHeight2D.y - radiusSq;
}
else
{
distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq;
}
distanceSq = max(distanceSq, 0.0);
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0;
gl_Position *= show;
}`,`${i}
${o}`};function aie(e,t){if(!e.compressVertices)return t;let n=t.search(/attribute\s+vec3\s+normal;/g)!==-1,i=t.search(/attribute\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;let o=t.search(/attribute\s+vec3\s+tangent;/g)!==-1,r=t.search(/attribute\s+vec3\s+bitangent;/g)!==-1,s=i&&n?2:1;s+=o||r?1:0;let a=s>1?`vec${s}`:"float",c="compressedAttributes",u=`attribute ${a} ${c};`,f="",d="";i&&(f+=`vec2 st;
`,d+=` st = czm_decompressTextureCoordinates(${s>1?`${c}.x`:c});
`),n&&o&&r?(f+=`vec3 normal;
vec3 tangent;
vec3 bitangent;
`,d+=` czm_octDecode(${c}.${i?"yz":"xy"}, normal, tangent, bitangent);
`):(n&&(f+=`vec3 normal;
`,d+=` normal = czm_octDecode(${c}${s>1?`.${i?"y":"x"}`:""});
`),o&&(f+=`vec3 tangent;
`,d+=` tangent = czm_octDecode(${c}.${i&&n?"z":"y"});
`),r&&(f+=`vec3 bitangent;
`,d+=` bitangent = czm_octDecode(${c}.${i&&n?"z":"y"});
`));let p=t;p=p.replace(/attribute\s+vec3\s+normal;/g,""),p=p.replace(/attribute\s+vec2\s+st;/g,""),p=p.replace(/attribute\s+vec3\s+tangent;/g,""),p=p.replace(/attribute\s+vec3\s+bitangent;/g,""),p=je.replaceMain(p,"czm_non_compressed_main");let _=`void main()
{
${d} czm_non_compressed_main();
}`;return[u,f,p,_].join(`
`)}function gNe(e){let t=je.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
czm_non_depth_clamp_main();
gl_Position = czm_depthClamp(gl_Position);}
`,t}function yNe(e){let t=je.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
czm_non_depth_clamp_main();
#if defined(GL_EXT_frag_depth)
#if defined(LOG_DEPTH)
czm_writeLogDepth();
#else
czm_writeDepthClamp();
#endif
#endif
}
`,t=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
${t}`,t}function cie(e,t){let n=e.vertexAttributes}function xNe(e,t){return function(){return e[t]}}var D4=Math.max(Kt.hardwareConcurrency-1,1),GI,CNe=new uo("combineGeometry");function ANe(e,t){let n,i,o,r,s=e._instanceIds;if(e._state===ss.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let a=e._numberOfInstances=n.length,c=[],u=[];for(o=0;o<a;++o)i=n[o].geometry,s.push(n[o].id),u.push({moduleName:i._workerName,geometry:i});if(!l(GI))for(GI=new Array(D4),o=0;o<D4;o++)GI[o]=new uo("createGeometry");let f;for(u=hV(u,D4),o=0;o<u.length;o++){let d=0,p=u[o],_=p.length;for(r=0;r<_;++r)f=p[r],i=f.geometry,l(i.constructor.pack)&&(f.offset=d,d+=y(i.constructor.packedLength,i.packedLength));let m;if(d>0){let x=new Float64Array(d);for(m=[x.buffer],r=0;r<_;++r)f=p[r],i=f.geometry,l(i.constructor.pack)&&(i.constructor.pack(i,x,f.offset),f.geometry=x)}c.push(GI[o].scheduleTask({subTasks:u[o]},m))}e._state=ss.CREATING,Promise.all(c).then(function(d){e._createGeometryResults=d,e._state=ss.CREATED}).catch(function(d){jS(e,t,ss.FAILED,d)})}else if(e._state===ss.CREATED){let a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let c=t.scene3DOnly,u=t.mapProjection,f=CNe.scheduleTask(GS.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:c,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},a),a);e._createGeometryResults=void 0,e._state=ss.COMBINING,Promise.resolve(f).then(function(d){let p=GS.unpackCombineGeometryResults(d);e._geometries=p.geometries,e._attributeLocations=p.attributeLocations,e.modelMatrix=O.clone(p.modelMatrix,e.modelMatrix),e._pickOffsets=p.pickOffsets,e._offsetInstanceExtend=p.offsetInstanceExtend,e._instanceBoundingSpheres=p.boundingSpheres,e._instanceBoundingSpheresCV=p.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=ss.COMBINED):jS(e,t,ss.FAILED,void 0)}).catch(function(d){jS(e,t,ss.FAILED,d)})}}function TNe(e,t){let n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds,s,a,c=0;for(a=0;a<i;a++){s=n[a];let p=s.geometry,_;l(p.attributes)&&l(p.primitiveType)?_=mNe(p):_=p.constructor.createGeometry(p),o[c++]=pNe(s,_),r.push(s.id)}o.length=c;let u=t.scene3DOnly,f=t.mapProjection,d=GS.combineGeometry({instances:o,ellipsoid:f.ellipsoid,projection:f,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:u,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=d.geometries,e._attributeLocations=d.attributeLocations,e.modelMatrix=O.clone(d.modelMatrix,e.modelMatrix),e._pickOffsets=d.pickOffsets,e._offsetInstanceExtend=d.offsetInstanceExtend,e._instanceBoundingSpheres=d.boundingSpheres,e._instanceBoundingSpheresCV=d.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=ss.COMBINED):jS(e,t,ss.FAILED,void 0)}function bNe(e,t){let n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!l(n)){e._recomputeBoundingSpheres=!1;return}let i,o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length,a=e._tempBoundingSpheres;if(!l(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new re;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let x=a[i],C=e._batchTable.getBatchedAttribute(i,n,new h);x=r[i].clone(x),yie(x,C,o[i])}let c=[],u=[],f=[];for(i=0;i<s;++i){let x=a[i];x.center.x-x.radius>0||re.intersectPlane(x,Fn.ORIGIN_ZX_PLANE)!==Dn.INTERSECTING?c.push(x):(u.push(x),f.push(x))}let d=c[0],p=f[0],_=u[0];for(i=1;i<c.length;i++)d=re.union(d,c[i]);for(i=1;i<f.length;i++)p=re.union(p,f[i]);for(i=1;i<u.length;i++)_=re.union(_,u[i]);let m=[];for(l(d)&&m.push(d),l(p)&&m.push(p),l(_)&&m.push(_),i=0;i<m.length;i++){let x=m[i].clone(e._boundingSpheres[
#extension GL_EXT_frag_depth : enable
#endif
#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
varying vec4 v_sphericalExtents;
#else // SPHERICAL
varying vec2 v_inversePlaneExtents;
varying vec4 v_westPlane;
varying vec4 v_southPlane;
#endif // SPHERICAL
varying vec3 v_uvMinAndSphericalLongitudeRotation;
varying vec3 v_uMaxAndInverseDistance;
varying vec3 v_vMaxAndInverseDistance;
#endif // TEXTURE_COORDINATES
#ifdef PER_INSTANCE_COLOR
varying vec4 v_color;
#endif
#ifdef NORMAL_EC
vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {
vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);
return eyeCoordinate.xyz / eyeCoordinate.w;
}
vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {
vec2 glFragCoordXY = gl_FragCoord.xy;
float upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
float downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));
bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);
float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);
float useDownOrLeft = float(useUpOrRight == 0.0);
vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);
vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);
return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;
}
#endif // NORMAL_EC
void main(void)
{
#ifdef REQUIRES_EC
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
#endif
#ifdef REQUIRES_WC
vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;
vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;
#endif
#ifdef TEXTURE_COORDINATES
vec2 uv;
#ifdef SPHERICAL
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);
sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;
uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;
#else // SPHERICAL
uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;
uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;
#endif // SPHERICAL
#endif // TEXTURE_COORDINATES
#ifdef PICK
#ifdef CULL_FRAGMENTS
if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {
gl_FragColor.a = 1.0;
czm_writeDepthClamp();
}
#else // CULL_FRAGMENTS
gl_FragColor.a = 1.0;
#endif // CULL_FRAGMENTS
#else // PICK
#ifdef CULL_FRAGMENTS
if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {
discard;
}
#endif
#ifdef NORMAL_EC
vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));
vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));
vec3 normalEC = normalize(cross(leftRight, downUp));
#endif
#ifdef PER_INSTANCE_COLOR
vec4 color = czm_gammaCorrect(v_color);
#ifdef FLAT
gl_FragColor = color;
#else // FLAT
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
czm_material material = czm_getDefaultMaterial(materialInput);
material.diffuse = color.rgb;
material.alpha = color.a;
gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
#endif // FLAT
gl_FragColor.rgb *= gl_FragColor.a;
#else // PER_INSTANCE_COLOR
czm_materialInput materialInput;
#ifdef USES_NORMAL_EC
materialInput.normalEC = normalEC;
#endif
#ifdef USES_POSITION_TO_EYE_EC
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
#endif
#ifdef USES_TANGENT_TO_EYE
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);
#endif
#ifdef USES_ST
materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;
materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;
#endif
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else // FLAT
gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
#endif // FLAT
gl_FragColor.rgb *= gl_FragColor.a;
#endif // PER_INSTANCE_COLOR
czm_writeDepthClamp();
#endif // PICK
}
`;function Hu(e,t,n){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};let i=new I4;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;let o=new I4;if(o.requiresTextureCoordinates=e,n instanceof Bn)i.requiresNormalEC=!n.flat;else{let r=`${n.material.shaderSource}
${n.fragmentShaderSource}`;i.normalEC=r.indexOf("materialInput.normalEC")!==-1||r.indexOf("czm_getDefaultMaterial")!==-1,i.positionToEyeEC=r.indexOf("materialInput.positionToEyeEC")!==-1,i.tangentToEyeMatrix=r.indexOf("materialInput.tangentToEyeMatrix")!==-1,i.st=r.indexOf("materialInput.st")!==-1}this._colorShaderDependencies=i,this._pickShaderDependencies=o,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}Hu.prototype.createFragmentShader=function(e){let t=this._appearance,n=this._colorShaderDependencies,i=[];!e&&!this._planarExtents&&i.push("SPHERICAL"),n.requiresEC&&i.push("REQUIRES_EC"),n.requiresWC&&i.push("REQUIRES_WC"),n.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),n.requiresNormalEC&&i.push("NORMAL_EC"),t instanceof Bn&&i.push("PER_INSTANCE_COLOR"),n.normalEC&&i.push("USES_NORMAL_EC"),n.positionToEyeEC&&i.push("USES_POSITION_TO_EYE_EC"),n.tangentToEyeMatrix&&i.push("USES_TANGENT_TO_EYE"),n.st&&i.push("USES_ST"),t.flat&&i.push("FLAT");let o="";return t instanceof Bn||(o=t.material.shaderSource),new je({defines:i,sources:[o,WI]})};Hu.prototype.createPickFragmentShader=function(e){let t=this._pickShaderDependencies,n=["PICK"];return!e&&!this._planarExtents&&n.push("SPHERICAL"),t.requiresEC&&n.push("REQUIRES_EC"),t.requiresWC&&n.push("REQUIRES_WC"),t.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),new je({defines:n,sources:[WI],pickColorQualifier:"varying"})};Hu.prototype.createVertexShader=function(e,t,n,i){return wie(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Hu.prototype.createPickVertexShader=function(e,t,n,i){return wie(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};var xie=new h,Cie=new _e,Aie={high:0,low:0};function wie(e,t,n,i,o,r,s,a){let c=i.slice();if(a.eastMostYhighDefine===""){let u=Cie;u.longitude=I.PI,u.latitude=0,u.height=0;let f=s.project(u,xie),d=xi.encode(f.x,Aie);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${d.high.toFixed(`${d.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${d.low.toFixed(`${d.low}`.length+1)}`;let p=Cie;p.longitude=-I.PI,p.latitude=0,p.height=0;let _=s.project(p,xie);d=xi.encode(_.x,Aie),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${d.high.toFixed(`${d.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${d.low.toFixed(`${d.low}`.length+1)}`}return n&&(c.push(a.eastMostYhighDefine),c.push(a.eastMostYlowDefine),c.push(a.westMostYhighDefine),c.push(a.westMostYlowDefine)),l(r)&&r instanceof Bn&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new je({defines:c,sources:[o]})}function I4(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}Object.defineProperties(I4.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}
`,r=` extrudeDirection = czm_octDecode(${n}, 65535.0);
`,s=t;s=s.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),s=je.replaceMain(s,"czm_non_compressed_main");let a=`void main()
{
${r} czm_non_compressed_main();
}`;return[i,o,s,a].join(`
`)}}function nFe(e,t){let n=t.context,i=e._primitive,o=S4;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=ii._appendDistanceDisplayConditionToShader(i,o),o=ii._modifyShaderPosition(e,o,t.scene3DOnly),o=ii._updateColorAttribute(i,o);let r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=tFe(i,o));let a=e._extruded?"EXTRUDED_GEOMETRY":"",c=new je({defines:[a],sources:[o]}),u=new je({sources:[VA]}),f=e._primitive._attributeLocations,d=new nd(s,r,e.appearance);if(e._spStencil=gn.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f}),e._primitive.allowPicking){let m=je.createPickVertexShaderSource(o);m=ii._appendShowToShader(i,m),m=ii._updatePickColorAttribute(m);let x=d.createPickFragmentShader(!1),C=d.createPickVertexShader([a],m,!1,t.mapProjection);if(e._spPick=gn.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:C,fragmentShaderSource:x,attributeLocations:f}),s){let A=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!l(A)){let T=d.createPickFragmentShader(!0),E=d.createPickVertexShader([a],m,!0,t.mapProjection);A=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:E,fragmentShaderSource:T,attributeLocations:f})}e._spPick2D=A}}else e._spPick=gn.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});o=ii._appendShowToShader(i,o),c=new je({defines:[a],sources:[o]}),e._sp=gn.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});let p=d.createFragmentShader(!1),_=d.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=gn.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:_,fragmentShaderSource:p,attributeLocations:f}),s){let m=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!l(m)){let x=d.createFragmentShader(!0),C=d.createVertexShader([a],o,!0,t.mapProjection);m=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:C,fragmentShaderSource:x,attributeLocations:f})}e._spColor2D=m}}function iFe(e,t){let n=e._primitive,i=n._va.length*2;t.length=i;let o,r,s,a=0,c=n._batchTable.getUniformMapCallback()(e._uniformMap),u=e._needs2DShader;for(o=0;o<i;o+=2){let _=n._va[a++];r=t[o],l(r)||(r=t[o]=new pt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=_,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Se.TERRAIN_CLASSIFICATION,s=pt.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=Se.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],l(r)||(r=t[o+1]=new pt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=_,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Se.TERRAIN_CLASSIFICATION;let x=e.appearance.material;if(l(x)&&(c=Dt(c,x._uniforms)),r.uniformMap=c,s=pt.shallowClone(r,r.derivedCommands.tileset),s.pass=Se.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let C=pt.shallowClone(r,r.derivedCommands.appearance2D);C.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=C,C=pt.shallowClone(s,s.derivedCommands.appearance2D),C.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=C}}let f=e._commandsIgnoreShow,d=e._spStencil,p=0;i=f.length=i/2;for(let _=0;_<i;++_){let m=f[_]=pt.shallowClone(t[p],f[_]);m.shaderProgram=d,m.pass=Se.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,p+=2}}function oFe(e,t){let n=e._usePickOffsets,i=e._primitive,o=i._va.length*2,r,s=0,a;n&&(r=i._pickOffsets,o=r.length*2),t.length=o;let c,u,f,d=0,p=i._batchTable.getUniformMapCallback()(e._uniformMap),_=e._needs2DShader;for(c=0;c<o;c+=2){let m=i._va[d++];if(n&&(a=r[s++],m=i._va[a.index]),u=t[c],l(u)||(u=t[c]=new pt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=m,u.renderState=e._rsStencilDepthPass,u.shaderProgram=e._sp,u.uniformMap=p,u.pass=Se.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=pt.shallowClone(u,u.derivedCommands.tileset),f.renderState=e._rsStencilDepthPass3DTiles,f.pass=Se.CE
#extension GL_EXT_frag_depth : enable
#endif
varying vec4 v_startPlaneNormalEcAndHalfWidth;
varying vec4 v_endPlaneNormalEcAndBatchId;
varying vec4 v_rightPlaneEC;
varying vec4 v_endEcAndStartEcX;
varying vec4 v_texcoordNormalizationAndStartEcYZ;
#ifdef PER_INSTANCE_COLOR
varying vec4 v_color;
#endif
void main(void)
{
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
vec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);
if (logDepthOrDepth == 0.0) {
#ifdef DEBUG_SHOW_VOLUME
gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
eyeCoordinate /= eyeCoordinate.w;
float halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
float distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);
float distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
#ifdef DEBUG_SHOW_VOLUME
gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
vec3 alignedPlaneNormal;
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);
#ifdef PER_INSTANCE_COLOR
gl_FragColor = czm_gammaCorrect(v_color);
#else // PER_INSTANCE_COLOR
float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);
s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;
float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);
czm_materialInput materialInput;
materialInput.s = s;
materialInput.st = vec2(s, t);
materialInput.str = vec3(s, t, 0.0);
czm_material material = czm_getMaterial(materialInput);
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#endif // PER_INSTANCE_COLOR
gl_FragColor.rgb *= gl_FragColor.a;
czm_writeDepthClamp();
}
`;var N4=`varying vec3 v_forwardDirectionEC;
varying vec3 v_texcoordNormalizationAndHalfWidth;
varying float v_batchId;
#ifdef PER_INSTANCE_COLOR
varying vec4 v_color;
#else
varying vec2 v_alignedPlaneDistances;
varying float v_texcoordT;
#endif
float rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {
return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);
}
void main(void)
{
vec4 eyeCoordinate = gl_FragCoord;
eyeCoordinate /= eyeCoordinate.w;
#ifdef PER_INSTANCE_COLOR
gl_FragColor = czm_gammaCorrect(v_color);
#else // PER_INSTANCE_COLOR
float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);
float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);
distanceFromStart = max(0.0, distanceFromStart);
distanceFromEnd = max(0.0, distanceFromEnd);
float s = distanceFromStart / (distanceFromStart + distanceFromEnd);
s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;
czm_materialInput materialInput;
materialInput.s = s;
materialInput.st = vec2(s, v_texcoordT);
materialInput.str = vec3(s, v_texcoordT, 0.0);
czm_material material = czm_getMaterial(materialInput);
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#endif // PER_INSTANCE_COLOR
}
`;var F4=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec4 startHiAndForwardOffsetX;
attribute vec4 startLoAndForwardOffsetY;
attribute vec4 startNormalAndForwardOffsetZ;
attribute vec4 endNormalAndTextureCoordinateNormalizationX;
attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
attribute vec4 startHiLo2D;
attribute vec4 offsetAndRight2D;
attribute vec4 startEndNormals2D;
attribute vec2 texcoordNormalization2D;
attribute float batchId;
varying vec3 v_forwardDirectionEC;
varying vec3 v_texcoordNormalizationAndHalfWidth;
varying float v_batchId;
#ifdef WIDTH_VARYING
varying float v_width;
#endif
#ifdef ANGLE_VARYING
varying float v_polylineAngle;
#endif
#ifdef PER_INSTANCE_COLOR
varying vec4 v_color;
#else
varying vec2 v_alignedPlaneDistances;
varying float v_texcoordT;
#endif
void main()
{
v_batchId = batchId;
vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));
vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);
vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
vec4 startPlane2D;
vec4 startPlane3D;
startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
startPlane2D.w = -dot(startPlane2D.xyz, posEc2D);
startPlane3D.w = -dot(startPlane3D.xyz, posEc3D);
vec4 rightPlane2D;
vec4 rightPlane3D;
rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);
rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);
posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);
posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);
posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));
vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));
vec4 endPlane2D;
vec4 endPlane3D;
endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
endPlane2D.w = -dot(endPlane2D.xyz, posEc2D);
endPlane3D.w = -dot(endPlane3D.xyz, posEc3D);
v_forwardDirectionEC = normalize(endEC - startEC);
vec2 cleanTexcoordNormalization2D;
cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);
cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));
vec2 cleanTexcoordNormalization3D;
cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;
cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));
v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);
#ifdef PER_INSTANCE_COLOR
v_color = czm_batchTable_color(batchId);
#else // PER_INSTANCE_COLOR
v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);
v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);
#endif // PER_INSTANCE_COLOR
#ifdef WIDTH_VARYING
float width = czm_batchTable_width(batchId);
float halfWidth = width * 0.5;
v_width = width;
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
#else
float halfWidth = 0.5 * czm_batchTable_width(batchId);
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
#endif
vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);
float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));
float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);
vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection));
vec3 normalEC = normalize(cross(planeDirection, upOrDown));
vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));
geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
positionEc3D.xyz += geodeticSurfaceNormal;
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC;
vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);
absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));
absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));
planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);
upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection));
normalEC = normalize(cross(planeDirection, upOrDown));
geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));
geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
positionEc2D.xyz += geodeticSurfaceNormal;
normalEC *= sign(texcoordNormalization2D.x);
#ifndef PER_INSTANCE_COLOR
v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);
#endif
positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC;
gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);
#ifdef ANGLE_VARYING
vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
#endif
}
`;var V4=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
#ifndef COLUMBUS_VIEW_2D
attribute vec4 startHiAndForwardOffsetX;
attribute vec4 startLoAndForwardOffsetY;
attribute vec4 startNormalAndForwardOffsetZ;
attribute vec4 endNormalAndTextureCoordinateNormalizationX;
attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
#else
attribute vec4 startHiLo2D;
attribute vec4 offsetAndRight2D;
attribute vec4 startEndNormals2D;
attribute vec2 texcoordNormalization2D;
#endif
attribute float batchId;
varying vec4 v_startPlaneNormalEcAndHalfWidth;
varying vec4 v_endPlaneNormalEcAndBatchId;
varying vec4 v_rightPlaneEC;
varying vec4 v_endEcAndStartEcX;
varying vec4 v_texcoordNormalizationAndStartEcYZ;
#ifdef WIDTH_VARYING
varying float v_width;
#endif
#ifdef ANGLE_VARYING
varying float v_polylineAngle;
#endif
#ifdef PER_INSTANCE_COLOR
varying vec4 v_color;
#endif
void main()
{
#ifdef COLUMBUS_VIEW_2D
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;
vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);
vec3 ecEnd = forwardDirectionEC + ecStart;
forwardDirectionEC = normalize(forwardDirectionEC);
v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
vec4 startPlaneEC;
startPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
vec4 endPlaneEC;
endPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);
v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;
#else // COLUMBUS_VIEW_2D
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;
vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);
vec3 ecEnd = ecStart + offset;
vec3 forwardDirectionEC = normalize(offset);
vec4 startPlaneEC;
startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
vec4 endPlaneEC;
endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;
#endif // COLUMBUS_VIEW_2D
v_endEcAndStartEcX.xyz = ecEnd;
v_endEcAndStartEcX.w = ecStart.x;
v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;
#ifdef PER_INSTANCE_COLOR
v_color = czm_batchTable_color(batchId);
#endif // PER_INSTANCE_COLOR
vec4 positionRelativeToEye = czm_computePosition();
vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye;
float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));
float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);
vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection));
vec3 normalEC = normalize(cross(planeDirection, upOrDown));
upOrDown = cross(forwardDirectionEC, normalEC);
upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;
upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;
upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;
positionEC.xyz += upOrDown;
v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));
float width = czm_batchTable_width(batchId);
#ifdef WIDTH_VARYING
v_width = width;
#endif
v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;
v_startPlaneNormalEcAndHalfWidth.w = width * 0.5;
v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;
v_endPlaneNormalEcAndBatchId.w = batchId;
width = width * max(0.0, czm_metersPerPixel(positionEC));
width = width / dot(normalEC, v_rightPlaneEC.xyz);
#ifdef COLUMBUS_VIEW_2D
normalEC *= sign(texcoordNormalization2D.x);
#else
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
#endif
positionEC.xyz += width * normalEC;
gl_Position = czm_depthClamp(czm_projection * positionEC);
#ifdef ANGLE_VARYING
vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
#endif
}
`;var k4=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 prevPosition3DHigh;
attribute vec3 prevPosition3DLow;
attribute vec3 nextPosition3DHigh;
attribute vec3 nextPosition3DLow;
attribute vec2 expandAndWidth;
attribute vec4 color;
attribute float batchId;
varying vec4 v_color;
void main()
{
float expandDir = expandAndWidth.x;
float width = abs(expandAndWidth.y) + 0.5;
bool usePrev = expandAndWidth.y < 0.0;
vec4 p = czm_computePosition();
vec4 prev = czm_computePrevPosition();
vec4 next = czm_computeNextPosition();
float angle;
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
gl_Position = czm_viewportOrthographic * positionWC;
v_color = color;
}
`;var id=`void clipLineSegmentToNearPlane(
vec3 p0,
vec3 p1,
out vec4 positionWC,
out bool clipped,
out bool culledByNearPlane,
out vec4 clippedPositionEC)
{
culledByNearPlane = false;
clipped = false;
vec3 p0ToP1 = p1 - p0;
float magnitude = length(p0ToP1);
vec3 direction = normalize(p0ToP1);
float endPoint0Distance = czm_currentFrustum.x + p0.z;
float denominator = -direction.z;
if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)
{
culledByNearPlane = true;
}
else if (endPoint0Distance > 0.0)
{
float t = endPoint0Distance / denominator;
if (t < 0.0 || t > magnitude)
{
culledByNearPlane = true;
}
else
{
p0 = p0 + t * direction;
p0.z = min(p0.z, -czm_currentFrustum.x);
clipped = true;
}
}
clippedPositionEC = vec4(p0, 1.0);
positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);
}
vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)
{
#ifdef POLYLINE_DASH
vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);
vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);
vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);
vec2 lineDir;
if (usePrevious) {
lineDir = normalize(positionWindow.xy - previousWindow.xy);
}
else {
lineDir = normalize(nextWindow.xy - positionWindow.xy);
}
angle = atan(lineDir.x, lineDir.y) - 1.570796327;
angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;
#endif
vec4 clippedPrevWC, clippedPrevEC;
bool prevSegmentClipped, prevSegmentCulled;
clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);
vec4 clippedNextWC, clippedNextEC;
bool nextSegmentClipped, nextSegmentCulled;
clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);
bool segmentClipped, segmentCulled;
vec4 clippedPositionWC, clippedPositionEC;
clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);
if (segmentCulled)
{
return vec4(0.0, 0.0, 0.0, 1.0);
}
vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);
vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);
if (prevSegmentCulled)
{
directionToPrevWC = -directionToNextWC;
}
else if (nextSegmentCulled)
{
directionToNextWC = -directionToPrevWC;
}
vec2 thisSegmentForwardWC, otherSegmentForwardWC;
if (usePrevious)
{
thisSegmentForwardWC = -directionToPrevWC;
otherSegmentForwardWC = directionToNextWC;
}
else
{
thisSegmentForwardWC = directionToNextWC;
otherSegmentForwardWC = -directionToPrevWC;
}
vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);
vec2 leftWC = thisSegmentLeftWC;
float expandWidth = width * 0.5;
if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))
{
vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);
vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;
float leftSumLength = length(leftSumWC);
leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);
vec2 u = -thisSegmentForwardWC;
vec2 v = leftWC;
float sinAngle = abs(u.x * v.y - u.y * v.x);
expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);
}
vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;
return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;
}
vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)
{
vec4 positionEC = czm_modelViewRelativeToEye * position;
vec4 prevEC = czm_modelViewRelativeToEye * previous;
vec4 nextEC = czm_modelViewRelativeToEye * next;
return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);
}
`;var U4=`${id}
${k4}`,_Fe=VS;Kt.isInternetExplorer()||(U4=`#define CLIP_POLYLINE
${U4}`);function Cy(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=!1,i=Cy.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,U4),this._fragmentShaderSource=y(e.fragmentShaderSource,_Fe),this._renderState=Mo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Cy.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});Cy.VERTEX_FORMAT=Ve.POSITION_ONLY;Cy.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;Cy.prototype.isTranslucent=Mo.prototype.isTranslucent;Cy.prototype.getRenderState=Mo.prototype.getRenderState;var Ps=Cy;var z4=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 prevPosition3DHigh;
attribute vec3 prevPosition3DLow;
attribute vec3 nextPosition3DHigh;
attribute vec3 nextPosition3DLow;
attribute vec2 expandAndWidth;
attribute vec2 st;
attribute float batchId;
varying float v_width;
varying vec2 v_st;
varying float v_polylineAngle;
void main()
{
float expandDir = expandAndWidth.x;
float width = abs(expandAndWidth.y) + 0.5;
bool usePrev = expandAndWidth.y < 0.0;
vec4 p = czm_computePosition();
vec4 prev = czm_computePrevPosition();
vec4 next = czm_computeNextPosition();
float angle;
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
gl_Position = czm_viewportOrthographic * positionWC;
v_width = width;
v_st.s = st.s;
v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
v_polylineAngle = angle;
}
`;var qS=`#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
varying vec2 v_st;
void main()
{
czm_materialInput materialInput;
vec2 st = v_st;
st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
materialInput.s = st.s;
materialInput.st = st;
materialInput.str = vec3(st, 0.0);
czm_material material = czm_getMaterial(materialInput);
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#ifdef VECTOR_TILE
gl_FragColor *= u_highlightColor;
#endif
czm_writeLogDepth();
}
`;var H4=`${id}
${z4}`,gFe=qS;Kt.isInternetExplorer()||(H4=`#define CLIP_POLYLINE
${H4}`);function Ay(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=!1,i=Ay.VERTEX_FORMAT;this.material=l(e.material)?e.material:Bo.fromType(Bo.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,H4),this._fragmentShaderSource=y(e.fragmentShaderSource,gFe),this._renderState=Mo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Ay.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&(e=`#define POLYLINE_DASH
${e}`),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});Ay.VERTEX_FORMAT=Ve.POSITION_AND_ST;Ay.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;Ay.prototype.isTranslucent=Mo.prototype.isTranslucent;Ay.prototype.getRenderState=Mo.prototype.getRenderState;var Qa=Ay;function up(e){e=y(e,y.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;l(t)||(t=new Qa),this.appearance=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Ei.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1;let n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);let r=this._error;l(r)?o(r):i(this)}}),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=Nie(!1),this._renderState3DTiles=Nie(!0),this._renderStateMorph=Ze.fromCache({cull:{enabled:!0,face:So.FRONT},depthTest:{enabled:!0},blending:Hn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(up.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});up.initializeTerrainHeights=function(){return ki.initialize()};function yFe(e,t,n){let i=t.context,o=e._primitive,r=o._attributeLocations,s=o._batchTable.getVertexShaderCallback()(V4);s=ii._appendShowToShader(o,s),s=ii._appendDistanceDisplayConditionToShader(o,s),s=ii._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(F4);a=ii._appendShowToShader(o,a),a=ii._appendDistanceDisplayConditionToShader(o,a),a=ii._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()(L4),u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`],f="",d="";l(n.material)?(d=l(n.material)?n.material.shaderSource:"",d.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&u.push("ANGLE_VARYING"),d.search(/varying\s+float\s+v_width;/g)!==-1&&u.push("WIDTH_VARYING")):f="PER_INSTANCE_COLOR",u.push(f);let p=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",f]:[f],_=new je({defines:u,sources:[s]}),m=new je({defines:p,sources:[d,c]});e._sp=gn.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:_,fragmentShaderSource:m,attributeLocations:r});let x=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!l(x)){let A=new je({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});x=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:A,fragmentShaderSource:m,attributeLocations:r})}e._sp2D=x;let C=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!l(C)){let A=new je({defines:u.concat([`MAX_TERRAIN_HEIGHT ${ki._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});c=o._batchTable.getVertexShaderCallback()(N4);let T=new je({defines:p,sources:[d,c]});C=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:A,fragmentShaderSource:T,attributeLoca
uniform float originalSize;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
uniform sampler2D texture4;
uniform sampler2D texture5;
const float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));
const float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));
const float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));
const float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));
void main()
{
vec2 uv = v_textureCoordinates;
vec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);
vec2 pixel = 1.0 / textureSize;
float mipLevel = 0.0;
if (uv.x - pixel.x > (textureSize.y / textureSize.x))
{
mipLevel = 1.0;
if (uv.y - pixel.y > yMipLevel1)
{
mipLevel = 2.0;
if (uv.y - pixel.y * 3.0 > yMipLevel2)
{
mipLevel = 3.0;
if (uv.y - pixel.y * 5.0 > yMipLevel3)
{
mipLevel = 4.0;
if (uv.y - pixel.y * 7.0 > yMipLevel4)
{
mipLevel = 5.0;
}
}
}
}
}
if (mipLevel > 0.0)
{
float scale = pow(2.0, mipLevel);
uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);
uv.x *= ((textureSize.x - 2.0) / textureSize.y);
uv.x -= 1.0 + pixel.x;
uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));
uv *= scale;
}
else
{
uv.x *= (textureSize.x / textureSize.y);
}
if(mipLevel == 0.0)
{
gl_FragColor = texture2D(texture0, uv);
}
else if(mipLevel == 1.0)
{
gl_FragColor = texture2D(texture1, uv);
}
else if(mipLevel == 2.0)
{
gl_FragColor = texture2D(texture2, uv);
}
else if(mipLevel == 3.0)
{
gl_FragColor = texture2D(texture3, uv);
}
else if(mipLevel == 4.0)
{
gl_FragColor = texture2D(texture4, uv);
}
else if(mipLevel == 5.0)
{
gl_FragColor = texture2D(texture5, uv);
}
else
{
gl_FragColor = vec4(0.0);
}
}
`;var K4=`varying vec3 v_cubeMapCoordinates;
uniform samplerCube cubeMap;
void main()
{
vec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);
#ifdef RGBA_NORMALIZED
gl_FragColor = vec4(rgba.rgb, 1.0);
#else
float m = rgba.a * 16.0;
vec3 r = rgba.rgb * m;
gl_FragColor = vec4(r * r, 1.0);
#endif
}
`;var $4=`attribute vec4 position;
attribute vec3 cubeMapCoordinates;
varying vec3 v_cubeMapCoordinates;
void main()
{
gl_Position = position;
v_cubeMapCoordinates = cubeMapCoordinates;
}
`;function Dy(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1;let t=this;this._readyPromise=new Promise((n,i)=>{t._completeLoadFromCache=o=>{Z4(this),this._texture=o,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,n()},t._failLoad=o=>{i(o)},t._completeLoad=()=>{this._ready=!0,n()}})}Object.defineProperties(Dy.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}}});Dy.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};var XFe=new h(1,0,0),KFe=new h(0,0,1),$Fe=new h(-1,0,0),ZFe=new h(0,0,-1),KI=new h(0,1,0),JFe=new h(0,-1,0),Kie=[KI,$Fe,KFe,JFe,XFe,KI,ZFe,KI,KI],$ie=Kie.length,Zie=new Float32Array($ie*3),Yie=0;for(let e=0;e<$ie;++e,Yie+=3)h.pack(Kie[e],Zie,Yie);var QFe=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),e2e=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function t2e(e){let t=Pt.createVertexBuffer({context:e,typedArray:QFe,usage:We.STATIC_DRAW}),n=Pt.createVertexBuffer({context:e,typedArray:Zie,usage:We.STATIC_DRAW}),i=Pt.createIndexBuffer({context:e,typedArray:e2e,usage:We.STATIC_DRAW,indexDatatype:Ge.UNSIGNED_SHORT}),o=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:X.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:X.FLOAT}];return new Ii({context:e,attributes:o,indexBuffer:i})}function Xie(e){return function(){return e}}function Z4(e){e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();let t,n,i=e._cubeMaps;if(l(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();let o=e._mipTextures;if(l(o))for(n=o.length,t=0;t<n;++t)o[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}Dy.prototype.update=function(e){let t=e.context;if(!Dy.isSupported(t)||(l(this._texture)&&l(this._va)&&Z4(this),l(this._texture)))return;if(!l(this._texture)&&!this._loading){let _=e.context.textureCache.getTexture(this._url);l(_)&&this._completeLoadFromCache(_)}let n=this._cubeMapBuffers;if(!l(n)&&!this._loading){let _=this;Mc(this._url).then(function(m){_._cubeMapBuffers=m,_._loading=!1}).catch(function(m){_._failLoad(m)}),this._loading=!0}if(!l(this._cubeMapBuffers))return;let i=[],o=n[0].positiveX.pixelDatatype;l(o)?i.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?lt.HALF_FLOAT:lt.FLOAT;let r=It.RGBA,s=new je({defines:i,sources:[K4]});this._va=t2e(t),this._sp=gn.fromCache({context:t,vertexShaderSource:$4,fragmentShaderSource:s,attributeLocations:{position:0,cubeMapCoordinates:1}});let a=Math.min(n.length,6);this._maximumMipmapLevel=a-1;let c=this._cubeMaps=new Array(a),u=this._mipTextures=new Array(a),f=n[0].positiveX.width*2,d={originalSize:function(){return f}};for(let _=0;_<a;++_){let m=n[_].positiveY;n[_].positiveY=n[_].negativeY,n[_].negativeY=m;let x=c[_]=new ml({context:t,source:n[_],pixelDatatype:o}),C=c[_].width*2,A=u[_]=new Zt({context:t,width:C,height:C,pixelDatatype:o,pixelFormat:r}),T=new Oh({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:Xie(x)},outputTexture:A,persists:!0,owner:this});e.commandList.push(T),d[`texture${_}`]=Xie(A)}this._texture=new Zt({context:t,width:f*1.5+2,height:f,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);let p=new Oh({fragmentShaderSource:X4,uniformMap:d,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(p),this._completeLoad()};Dy.prototype.isDestroyed=function(){return!1};Dy.prototype.destroy=function(){return Z4(this),this._texture=this._texture&&this._texture.destroy(),fe(this)};var ju=Dy;function yl(e){e=y(e,y.EMPTY_OBJECT);let t=l(e.imageBasedLightingFactor)?W.cl
vec2 computeSt(float batchId)
{
float stepX = tile_textureStep.x;
float centerX = tile_textureStep.y;
return vec2(centerX + (batchId * stepX), 0.5);
}
`:`uniform vec4 tile_textureStep;
uniform vec2 tile_textureDimensions;
vec2 computeSt(float batchId)
{
float stepX = tile_textureStep.x;
float centerX = tile_textureStep.y;
float stepY = tile_textureStep.z;
float centerY = tile_textureStep.w;
float xId = mod(batchId, tile_textureDimensions.x);
float yId = floor(batchId / tile_textureDimensions.x);
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
}
`}Lo.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;let i=this;return function(o){let r=ooe(o,n,!1),s;return sn.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand;
`),s+=`uniform sampler2D tile_batchTexture;
varying vec4 tile_featureColor;
varying vec2 tile_featureSt;
void main()
{
vec2 st = computeSt(${t});
vec4 featureProperties = texture2D(tile_batchTexture, st);
tile_color(featureProperties);
float show = ceil(featureProperties.a);
gl_Position *= show;
`,e&&(s+=` bool isStyleTranslucent = (featureProperties.a != 1.0);
if (czm_pass == czm_passTranslucent)
{
if (!isStyleTranslucent && !tile_translucentCommand)
{
gl_Position *= 0.0;
}
}
else
{
if (isStyleTranslucent)
{
gl_Position *= 0.0;
}
}
`),s+=` tile_featureColor = featureProperties;
tile_featureSt = st;
}`):s=`varying vec2 tile_featureSt;
void main()
{
tile_color(vec4(1.0));
tile_featureSt = computeSt(${t});
}`,`${r}
${w2e(i)}${s}`}};function noe(e,t){return e=je.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend;
void tile_color(vec4 tile_featureColor)
{
tile_main();
tile_featureColor = czm_gammaCorrect(tile_featureColor);
gl_FragColor.a *= tile_featureColor.a;
float highlight = ceil(tile_colorBlend);
gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
}
`:`${e}void tile_color(vec4 tile_featureColor)
{
tile_main();
}
`}function v2e(e,t){let n=`texture2D(${t}`,i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let u=o;u<e.length;++u){let f=e.charAt(u);if(f==="(")++s;else if(f===")"&&(--s,s===0)){r=u+1;break}}let c=`tile_diffuse_final(${e.slice(o,r)}, tile_diffuse)`;e=e.slice(0,o)+c+e.slice(r),i=o+c.length,o=e.indexOf(n,i)}return e}function ooe(e,t,n){if(!l(t))return noe(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`),o=e.match(i);if(!l(o))return noe(e,n);let r=o[0],s=o[2];e=je.replaceMain(e,"tile_main"),e=e.replace(r,"");let a=`bool isWhite(vec3 color)
{
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
}
vec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse)
{
vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend);
vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse;
return vec4(diffuse.rgb, sourceDiffuse.a);
}
`,c=` tile_featureColor = czm_gammaCorrect(tile_featureColor);
gl_FragColor.a *= tile_featureColor.a;
float highlight = ceil(tile_colorBlend);
gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
`,u;if(s==="vec3"||s==="vec4"){let f=s==="vec3"?`vec4(${t}, 1.0)`:t,d=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,d),u=` vec4 source = ${f};
tile_diffuse = tile_diffuse_final(source, tile_featureColor);
tile_main();
`}else s==="sampler2D"&&(e=v2e(e,t),u=` tile_diffuse = tile_featureColor;
tile_main();
`);return e=`uniform float tile_colorBlend;
vec4 tile_diffuse = vec4(1.0);
${a}${r}
${e}
void tile_color(vec4 tile_featureColor)
{
${u}`,n&&(e+=c),e+=`}
`,e}Lo.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=ooe(i,t,!0),sn.maximumVertexTextureImageUnits>0?(i+=`uniform sampler2D tile_pickTexture;
varying vec2 tile_featureSt;
varying vec4 tile_featureColor;
void main()
{
tile_color(tile_featureColor);
`,n&&(i+=` gl_FragColor.rgb *= gl_FragColor.a;
`),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand;
`),i+=`uniform sampler2D tile_pickTexture;
uniform sampler2D tile_batchTexture;
varying vec2 tile_featureSt;
void main()
{
vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt);
if (featureProperties.a == 0.0) {
discard;
}
`,e&&(i+=` bool isStyleTranslucent = (featureProperties.a != 1.0);
if (czm_pass == czm_passTranslucent)
{
if (!isStyleTranslucent && !tile_translucentCommand)
{
discard;
}
}
else
{
if (isStyleTranslucent)
{
discard;
}
}
`),i+=` tile_color(featureProperties);
`,n&&(i+=` gl_FragColor.rgb *= gl_FragColor.a;
`),i+=`}
`),i}};Lo.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=je.replaceMain(e,"tile_main"),sn.maximumVertexTextureImageUnits>0?e+=`uniform sampler2D tile_pickTexture;
varying vec2 tile_featureSt;
varying vec4 tile_featureColor;
void main()
{
tile_main();
gl_FragColor = tile_featureColor;
gl_FragColor.rgb *= gl_FragColor.a;
}`:e+=`uniform sampler2D tile_batchTexture;
uniform sampler2D tile_pickTexture;
varying vec2 tile_featureSt;
void main()
{
tile_main();
vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt);
if (featureProperties.a == 0.0) {
discard;
}
gl_FragColor = featureProperties;
gl_FragColor.rgb *= gl_FragColor.a;
}
`,e}};function D2e(e){let t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===qu.HIGHLIGHT)return 0;if(n===qu.REPLACE)return 1;if(n===qu.MIX)return I.clamp(i,I.EPSILON4,1)}Lo.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;let e=this;return function(t){return Dt(t,{tile_batchTexture:function(){return y(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return D2e(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};Lo.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};var rg={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};Lo.prototype.addDerivedCommands=function(e,t){let n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s._skipLevelOfDetail&&s._hasMixedContent&&e.context.stencilBuffer,c=P2e(this);for(let u=t;u<i;++u){let f=n[u];if(f.pass===Se.COMPUTE)continue;let d=f.derivedCommands.tileset;(!l(d)||f.dirty)&&(d={},f.derivedCommands.tileset=d,d.originalCommand=I2e(f),f.dirty=!1);let p=d.originalCommand;c!==rg.ALL_OPAQUE&&f.pass!==Se.TRANSLUCENT&&(l(d.translucent)||(d.translucent=O2e(p))),c!==rg.ALL_TRANSLUCENT&&f.pass!==Se.TRANSLUCENT&&(l(d.opaque)||(d.opaque=R2e(p)),a&&(r||(l(d.zback)||(d.zback=B2e(e.context,p)),s._backfaceCommands.push(d.zback)),(!l(d.stencil)||o._selectionDepth!==N2e(d.stencil))&&(f.renderState.depthMask?d.stencil=L2e(p,o._selectionDepth):d.stencil=d.opaque)));let _=a?d.stencil:d.opaque,m=d.translucent;f.pass!==Se.TRANSLUCENT?(c===rg.ALL_OPAQUE&&(n[u]=_),c===rg.ALL_TRANSLUCENT&&(n[u]=m),c===rg.OPAQUE_AND_TRANSLUCENT&&(n[u]=_,n.push(m))):n[u]=p}};function P2e(e){let t=e._batchTexture.translucentFeaturesLength;return t===0?rg.ALL_OPAQUE:t===e.featuresLength?rg.ALL_TRANSLUCENT:rg.OPAQUE_AND_TRANSLUCENT}function I2e(e){let t=pt.shallowClone(e),n=t.pass===Se.TRANSLUCENT;return t.uniformMap=l(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function O2e(e){let t=pt.shallowClone(e);return t.pass=Se.TRANSLUCENT,t.renderState=F2e(e.renderState),t}function R2e(e){let t=pt.shallowClone(e);return t.renderState=V2e(e.renderState),t}function M2e(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!l(n)){let i=t.fragmentShaderSource.clone();i.defines=l(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),i.sources.unshift(`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
`),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function B2e(e,t){let n=pt.shallowClone(t),i=mt(n.renderState,!0);i.cull.enabled=!0,i.cull.face=So.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=On.setCesium3DTileBit(),i.stencilMask=On.CESIUM_3D_TILE_MASK,n.renderState=Ze.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=mt(t.uniformMap);let o=new W(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=M2e(e,t.shaderProgram),n}function L2e(e,t){let n=pt.shallowClone(e),i=mt(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=On.SKIP_LOD_MASK,i.stencilTest.reference=On.CESIUM_3D_TILE_MASK|t<<On.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=$i.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=ln.REPLACE,i.stencilTest.backFunction=$i.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=ln.REPLACE,i.stencilMask=On.CESIUM_3D_TILE_MASK|On.SKIP_LOD_MASK,n.renderState=Ze.fromCache(i),n}function N2e(e){return(e.renderState.stencilTest.reference&On.SKIP_LOD_MASK)>>>On.SKIP_LOD_BIT_SHIFT}function F2e(e){let t=mt(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=Hn.ALPHA_BLEND,t.stencilTest=On.setCesium3DTileBit(),t.stencilMask=On.CESIUM_3D_TILE_MASK,Ze.fromCache(t)}function V2e(e){let t=mt(e,!0);return t.stencilTest=On.setCesium3DTileBit(),t.stencilMask=On.CESIUM_3D_TILE_MASK,Ze.fromCache(t)}Lo.prototype.update=function(e,t){this._batchTexture.update(e,t)};Lo.prototype.isDestroyed=function(){return!1};Lo.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),fe(this)};var Zl=Lo;function Jl(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Jl.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return l(this._color)||(this._color=new H),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(!!l(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}});Jl.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Jl.prototype.getPropertyNames=function(e){return Ui("Cesium3DTileFeature.getPropertyNames","Cesium3DTileFeature.getPropertyNames was deprecated in CesiumJS 1.95 and will be removed in 1.98. Use Cesium3DTileFeature.getPropertyIds instead"),this._content.batchTable.getPropertyIds(this._batchId,e)};Jl.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Jl.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Jl.getPropertyInherited=function(e,t,n){let i=e.batchTable;if(l(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}let o=e.metadata;if(l(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}let r=e.tile,s=r.metadata;if(l(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(l(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),l(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}let c=l(e.group)?e.group.metadata:void 0;if(l(c)){if(c.hasPropertyBySemantic(n))return c.getPropertyBySemantic(n);if(c.hasProperty(n))return c.getPropert
${i.message}`),e._readyPromise.reject(new he(o))}};oo.parseBuffers=function(e,t){let n=e._loadResources;we.buffer(e.gltfInternal,function(i,o){if(l(i.extras._pipeline.source))n.buffers[o]=i.extras._pipeline.source;else if(l(t)){let r=e._resource.getDerivedResource({url:i.uri});++n.pendingBufferLoads,r.fetchArrayBuffer().then(t(e,o)).catch(oo.getFailedLoadFunction(e,"buffer",r.url))}})};var G3e=new h,W3e=new h;oo.computeBoundingSphere=function(e){let t=e.gltfInternal,n=t.nodes,i=t.meshes,o=t.scenes[t.scene].nodes,r=o.length,s=[],a=new h(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),c=new h(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let f=0;f<r;++f){let d=n[o[f]];for(d._transformToRoot=oo.getTransform(d),s.push(d);s.length>0;){d=s.pop();let p=d._transformToRoot,_=d.mesh;if(l(_)){let C=i[_].primitives,A=C.length;for(let T=0;T<A;++T){let E=C[T].attributes.POSITION;if(l(E)){let S=oo.getAccessorMinMax(t,E);if(l(S.min)&&l(S.max)){let w=h.fromArray(S.min,0,G3e),D=h.fromArray(S.max,0,W3e);O.multiplyByPoint(p,w,w),O.multiplyByPoint(p,D,D),h.minimumByComponent(a,w,a),h.maximumByComponent(c,D,c)}}}}let m=d.children;if(l(m)){let x=m.length;for(let C=0;C<x;++C){let A=n[m[C]];A._transformToRoot=oo.getTransform(A),O.multiplyTransformation(p,A._transformToRoot,A._transformToRoot),s.push(A)}}delete d._transformToRoot}}let u=re.fromCornerPoints(a,c);return e.forwardAxis===fi.Z&&re.transformWithoutScale(u,fi.Z_UP_TO_X_UP,u),e._upAxis===fi.Y?re.transformWithoutScale(u,fi.Y_UP_TO_Z_UP,u):e._upAxis===fi.X&&re.transformWithoutScale(u,fi.X_UP_TO_Z_UP,u),u};function j3e(e,t){return we.techniqueAttribute(e,function(n,i){if(n.semantic===t)return i})}function q3e(e,t){let n=e.accessors,i=e.materials,o=e.extensions.KHR_techniques_webgl,r=o.techniques,s=o.programs,a=o.shaders,c=t.targets,u=t.attributes;for(let m in c)if(c.hasOwnProperty(m)){let x=c[m];for(let C in x)C!=="extras"&&(u[`${C}_${m}`]=x[C])}let f=i[t.material],d=r[f.extensions.KHR_techniques_webgl.technique],p=s[d.program],_=a[p.vertexShader];for(let m in u)if(u.hasOwnProperty(m)&&!l(j3e(d,m))){let x=u[m],C=n[x],A=m.toLowerCase();A.charAt(0)==="_"&&(A=A.slice(1));let T=`a_${A}`;d.attributes[T]={semantic:m,type:C.componentType};let E=_.extras._pipeline,S=E.source;S=`attribute ${oo.getShaderVariable(C.type)} ${T};
${S}`,E.source=S}}oo.ensureSemanticExistence=function(e){return we.mesh(e,function(t){we.meshPrimitive(t,function(n){q3e(e,n)})}),e};oo.createAttributeLocations=function(e,t){let n={},i=!1,o=1;if(we.techniqueAttribute(e,function(r,s){/pos/i.test(s)&&!i?(n[s]=0,i=!0):n[s]=o++}),l(t))for(let r in t)t.hasOwnProperty(r)&&(n[r]=o++);return n};oo.getAccessorMinMax=function(e,t){let n=e.accessors[t],i=n.extensions,o=n.min,r=n.max;if(l(i)){let s=i.WEB3D_quantized_attributes;l(s)&&(o=s.decodedMin,r=s.decodedMax)}return{min:o,max:r}};function moe(e,t,n,i){return _r(e,"KHR_techniques_webgl")?function(o,r){if(o.semantic===n&&(!i||!l(o.node)))return r}:function(o,r){let s=t.parameters[o];if(s.semantic===n&&(!i||!l(s.node)))return r}}oo.getAttributeOrUniformBySemantic=function(e,t,n,i){return we.technique(e,function(o){if(l(n)&&o.program!==n)return;let r=we.techniqueAttribute(o,moe(e,o,t,i));return l(r)?r:we.techniqueUniform(o,moe(e,o,t,i))})};oo.getDiffuseAttributeOrUniform=function(e,t){let n=oo.getAttributeOrUniformBySemantic(e,"COLOR_0",t);return l(n)||(n=oo.getAttributeOrUniformBySemantic(e,"_3DTILESDIFFUSE",t)),n};var Y3e=new h,X3e=new ke,K3e=new h;oo.getTransform=function(e,t){return l(e.matrix)?O.fromColumnMajorArray(e.matrix,t):O.fromTranslationQuaternionRotationScale(h.fromArray(e.translation,0,Y3e),ke.unpack(e.rotation,0,X3e),h.fromArray(e.scale,0,K3e),t)};oo.getUsedExtensions=function(e){let t=e.extensionsUsed,n={};if(l(t)){let i=t.length;for(let o=0;o<i;o++){let r=t[o];n[r]=!0}}return n};oo.getRequiredExtensions=function(e){let t=e.extensionsRequired,n={};if(l(t)){let i=t.length;for(let o=0;o<i;o++){let r=t[o];n[r]=!0}}return n};oo.supportedExtensions={AGI_articulations:!0,CESIUM_RTC:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_binary_glTF:!0,KHR_texture_basisu:!0,KHR_draco_mesh_compression:!0,KHR_materials_common:!0,KHR_techniques_webgl:!0,KHR_materials_unlit:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0};oo.checkSupportedExtensions=function(e,t){for(let n in e)if(e.hasOwnProperty(n)){if(!oo.supportedExtensions[n])throw new he(`Unsupported glTF Extension: ${n}`);if(n==="EXT_texture_webp"&&t===!1)throw new he("Loaded model requires WebP but browser does not support it.")}};oo.checkSupportedGlExtensions=function(e,t){if(l(e)){let n=e.length;for(let i=0;i<n;i++){let o=e[i];if(o!=="OES_element_index_uint")throw new he(`Unsupported WebGL Extension: ${o}`);if(!t.elementIndexUint)throw new he("OES_element_index_uint WebGL extension is not enabled.")}}};function uz(e,t,n){t+="(?!\\w)",t=new RegExp(t,"g");let i=e.search(t);return e.replace(t,function(o,r){return i===r?o:n})}function $3e(e,t){let i=e.accessors[t].extensions;if(l(i))return i.WEB3D_quantized_attributes}function poe(e,t,n){let i=t.material,o=e.materials[i];if(!_r(e,"KHR_techniques_webgl")||!l(o.extensions)||!l(o.extensions.KHR_techniques_webgl))return;let r=o.extensions.KHR_techniques_webgl.technique,a=e.extensions.KHR_techniques_webgl.techniques[r];return we.techniqueAttribute(a,function(c,u){if(c.semantic===n)return u})}oo.modifyShaderForDracoQuantizedAttributes=function(e,t,n,i){let o={};for(let r in i)if(i.hasOwnProperty(r)){let s=i[r],a=s.quantization;if(!l(a))continue;let c=poe(e,t,r);r.charAt(0)==="_"&&(r=r.substring(1));let u=`gltf_u_dec_${r.toLowerCase()}`;if(!l(o[u])){let f=`gltf_decoded_${r}`,d=c.replace("a_","gltf_a_dec_"),p=s.componentsPerAttribute;n=uz(n,c,d);let _;a.octEncoded?_="vec3":p>1?_=`vec${p}`:_="float",n=`${_} ${d};
${n}`;let m=p===3&&r==="COLOR_0";m&&(n=uz(n,d,`vec4(${d}, 1.0)`));let x="";if(a.octEncoded){let C=`${u}_rangeConstant`;n=`uniform float ${C};
${n}`,x=`
void main() {
${d} = czm_octDecode(${c}.xy, ${C}).zxy;
${f}();
}
`}else{let C=`${u}_normConstant`,A=`${u}_min`;n=`uniform float ${C};
uniform ${_} ${A};
${n}`,x=`
void main() {
${d} = ${A} + ${c}${m?".xyz":""} * ${C};
${f}();
}
`}n=je.replaceMain(n,f),n+=x}}return{shader:n}};oo.modifyShaderForQuantizedAttributes=function(e,t,n){let i={},o=t.attributes;for(let r in o)if(o.hasOwnProperty(r)){let s=poe(e,t,r),a=t.attributes[r];r.charAt(0)==="_"&&(r=r.substring(1));let c=`gltf_u_dec_${r.toLowerCase()}`,u=`${c}_scale`,f=`${c}_translate`;if(!l(i[c])&&!l(i[u])){let d=$3e(e,a);if(l(d)){let p=d.decodeMatrix,_=`gltf_decoded_${r}`,m=s.replace("a_","gltf_a_dec_"),x=Math.floor(Math.sqrt(p.length));n=uz(n,s,m);let C;x>2?C=`vec${x-1}`:C="float",n=`${C} ${m};
${n}`;let A="";x===5?(n=`uniform mat4 ${u};
${n}`,n=`uniform vec4 ${f};
${n}`,A=`
void main() {
${m} = ${u} * ${s} + ${f};
${_}();
}
`,i[u]={mat:4},i[f]={vec:4}):(n=`uniform mat${x} ${c};
${n}`,A=`
void main() {
${m} = ${C}(${c} * vec${x}(${s},1.0));
${_}();
}
`,i[c]={mat:x}),n=je.replaceMain(n,_),n+=A}}}return{shader:n,uniforms:i}};function KA(e){let t={value:e,clone:function(n,i){return n},func:function(){return t.value}};return t}function iO(e){let t={value:W.fromArray(e),clone:W.clone,func:function(){return t.value}};return t}function oO(e){let t={value:h.fromArray(e),clone:h.clone,func:function(){return t.value}};return t}function $A(e){let t={value:ae.fromArray(e),clone:ae.clone,func:function(){return t.value}};return t}function fz(e){let t={value:lo.fromColumnMajorArray(e),clone:lo.clone,func:function(){return t.value}};return t}function dz(e){let t={value:Q.fromColumnMajorArray(e),clone:Q.clone,func:function(){return t.value}};return t}function nO(e){let t={value:O.fromColumnMajorArray(e),clone:O.clone,func:function(){return t.value}};return t}function rO(e,t,n){this._value=void 0,this._textureId=e.index,this._textures=t,this._defaultTexture=n}Object.defineProperties(rO.prototype,{value:{get:function(){if(!l(this._value)){let e=this._textures[this._textureId];if(l(e))this._value=e;else return this._defaultTexture}return this._value},set:function(e){this._value=e}}});rO.prototype.clone=function(e){return e};rO.prototype.func=void 0;function Z3e(e,t,n){let i=new rO(e,t,n);return i.func=function(){return i.value},i}var va={};va[Z.FLOAT]=KA;va[Z.FLOAT_VEC2]=iO;va[Z.FLOAT_VEC3]=oO;va[Z.FLOAT_VEC4]=$A;va[Z.INT]=KA;va[Z.INT_VEC2]=iO;va[Z.INT_VEC3]=oO;va[Z.INT_VEC4]=$A;va[Z.BOOL]=KA;va[Z.BOOL_VEC2]=iO;va[Z.BOOL_VEC3]=oO;va[Z.BOOL_VEC4]=$A;va[Z.FLOAT_MAT2]=fz;va[Z.FLOAT_MAT3]=dz;va[Z.FLOAT_MAT4]=nO;va[Z.SAMPLER_2D]=Z3e;oo.createUniformFunction=function(e,t,n,i){return va[e](t,n,i)};function J3e(e){return[e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]]}function Q3e(e){return[e[20],e[21],e[22],e[23]]}oo.createUniformsForDracoQuantizedAttributes=function(e){let t={};for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],o=i.quantization;if(!l(o))continue;n.charAt(0)==="_"&&(n=n.substring(1));let r=`gltf_u_dec_${n.toLowerCase()}`;if(o.octEncoded){let u=`${r}_rangeConstant`,f=(1<<o.quantizationBits)-1;t[u]=KA(f).func;continue}let s=`${r}_normConstant`,a=o.range/(1<<o.quantizationBits);t[s]=KA(a).func;let c=`${r}_min`;switch(i.componentsPerAttribute){case 1:t[c]=KA(o.minValues).func;break;case 2:t[c]=iO(o.minValues).func;break;case 3:t[c]=oO(o.minValues).func;break;case 4:t[c]=$A(o.minValues).func;break}}return t};oo.createUniformsForQuantizedAttributes=function(e,t,n){let i=e.accessors,o={},r={},s=t.attributes;for(let a in s)if(s.hasOwnProperty(a)){let c=s[a],u=i[c],f=u.extensions;if(a.charAt(0)==="_"&&(a=a.substring(1)),l(f)){let d=f.WEB3D_quantized_attributes;if(l(d)){let p=d.decodeMatrix,_=`gltf_u_dec_${a.toLowerCase()}`,m,x;switch(u.type){case Cn.SCALAR:r[_]=fz(p).func,o[_]=!0;break;case Cn.VEC2:r[_]=dz(p).func,o[_]=!0;break;case Cn.VEC3:r[_]=nO(p).func,o[_]=!0;break;case Cn.VEC4:m=`${_}_scale`,x=`${_}_translate`,r[m]=nO(J3e(p)).func,r[x]=$A(Q3e(p)).func,o[m]=!0,o[x]=!0;break}}}}for(let a in n)if(n.hasOwnProperty(a)&&!o[a]){let c=n[a];l(c.mat)&&(c.mat===2?r[a]=fz(lo.IDENTITY).func:c.mat===3?r[a]=dz(Q.IDENTITY).func:c.mat===4&&(r[a]=nO(O.IDENTITY).func)),l(c.vec)&&c.vec===4&&(r[a]=$A([0,0,0,0]).func)}return r};var XA=new h,eVe={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){let n=new O;return function(){return l(t._rtcCenter)?(O.getTranslation(e.model,XA),h.add(XA,t._rtcCenter,XA),O.multiplyByPoint(e.view,XA,XA),O.setTranslation(e.modelView,XA,n)):e.modelView}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelV
`,A=`precision highp float;
`,T=u!=="CONSTANT",E={u_modelViewMatrix:{semantic:_r(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:Z.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:Z.FLOAT_MAT4}};T&&(E.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:Z.FLOAT_MAT3}),m&&(E.u_jointMatrix={count:p,semantic:"JOINTMATRIX",type:Z.FLOAT_MAT4});let S,w=!1;for(let z in d)if(d.hasOwnProperty(z)&&z!=="transparent"&&z!=="doubleSided"){let V=_oe(z,d[z]);S=`u_${z.toLowerCase()}`,!w&&V===Z.SAMPLER_2D&&(w=!0),E[S]={type:V}}if(l(E.u_diffuse)&&(E.u_diffuse.semantic="_3DTILESDIFFUSE"),l(o))for(let z in o)o.hasOwnProperty(z)&&(S=`u_${z}`,E[S]=o[z]);for(S in E)if(E.hasOwnProperty(S)){let z=E[S],V=l(z.count)?`[${z.count}]`:"";z.type!==Z.FLOAT_MAT3&&z.type!==Z.FLOAT_MAT4||z.useInFragment?(A+=`uniform ${my(z.type)} ${S}${V};
`,delete z.useInFragment):C+=`uniform ${my(z.type)} ${S}${V};
`}let D="";m&&(D+=` mat4 skinMatrix =
a_weight.x * u_jointMatrix[int(a_joint.x)] +
a_weight.y * u_jointMatrix[int(a_joint.y)] +
a_weight.z * u_jointMatrix[int(a_joint.z)] +
a_weight.w * u_jointMatrix[int(a_joint.w)];
`);let R={a_position:{semantic:"POSITION"}};C+=`attribute vec3 a_position;
`,C+=`varying vec3 v_positionEC;
`,m?D+=` vec4 pos = u_modelViewMatrix * skinMatrix * vec4(a_position,1.0);
`:D+=` vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
`,D+=` v_positionEC = pos.xyz;
`,D+=` gl_Position = u_projectionMatrix * pos;
`,A+=`varying vec3 v_positionEC;
`,T&&(R.a_normal={semantic:"NORMAL"},C+=`attribute vec3 a_normal;
`,C+=`varying vec3 v_normal;
`,m?D+=` v_normal = u_normalMatrix * mat3(skinMatrix) * a_normal;
`:D+=` v_normal = u_normalMatrix * a_normal;
`,A+=`varying vec3 v_normal;
`);let M;w&&(R.a_texcoord_0={semantic:"TEXCOORD_0"},M="v_texcoord_0",C+=`attribute vec2 a_texcoord_0;
`,C+=`varying vec2 ${M};
`,D+=` ${M} = a_texcoord_0;
`,A+=`varying vec2 ${M};
`),m&&(R.a_joint={semantic:"JOINTS_0"},R.a_weight={semantic:"WEIGHTS_0"},C+=`attribute vec4 a_joint;
`,C+=`attribute vec4 a_weight;
`),x&&(R.a_vertexColor={semantic:"COLOR_0"},C+=`attribute vec4 a_vertexColor;
`,C+=`varying vec4 v_vertexColor;
`,D+=` v_vertexColor = a_vertexColor;
`,A+=`varying vec4 v_vertexColor;
`),r&&(R.a_batchId={semantic:"_BATCHID"},C+=`attribute float a_batchId;
`);let L=T&&(u==="BLINN"||u==="PHONG")&&l(E.u_specular)&&l(E.u_shininess)&&E.u_shininess>0,N=!1,g=!1,b="";for(let z in f)if(f.hasOwnProperty(z)){let V=f[z],Y=V.type.toLowerCase(),j=V.baseName;b+=` {
`;let $=`u_${j}Color`;if(Y==="ambient")g=!0,b+=` ambientLight += ${$};
`;else if(T){N=!0;let G=`v_${j}Direction`,K=`v_${j}Position`;Y!=="point"&&(C+=`varying vec3 ${G};
`,A+=`varying vec3 ${G};
`,D+=` ${G} = mat3(u_${j}Transform) * vec3(0.,0.,1.);
`,Y==="directional"&&(b+=` vec3 l = normalize(${G});
`)),Y!=="directional"?(C+=`varying vec3 ${K};
`,A+=`varying vec3 ${K};
`,D+=` ${K} = u_${j}Transform[3].xyz;
`,b+=` vec3 VP = ${K} - v_positionEC;
`,b+=` vec3 l = normalize(VP);
`,b+=` float range = length(VP);
`,b+=` float attenuation = 1.0 / (u_${j}Attenuation.x + `,b+=`(u_${j}Attenuation.y * range) + `,b+=`(u_${j}Attenuation.z * range * range));
`):b+=` float attenuation = 1.0;
`,Y==="spot"&&(b+=` float spotDot = dot(l, normalize(${G}));
`,b+=` if (spotDot < cos(u_${j}FallOff.x * 0.5))
`,b+=` {
`,b+=` attenuation = 0.0;
`,b+=` }
`,b+=` else
`,b+=` {
`,b+=` attenuation *= max(0.0, pow(spotDot, u_${j}FallOff.y));
`,b+=` }
`),b+=` diffuseLight += ${$}* max(dot(normal,l), 0.) * attenuation;
`,L&&(u==="BLINN"?(b+=` vec3 h = normalize(l + viewDir);
`,b+=` float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;
`):(b+=` vec3 reflectDir = reflect(-l, normal);
`,b+=` float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;
`),b+=` specularLight += ${$} * specularIntensity;
`)}b+=` }
`}g||(b+=` ambientLight += vec3(0.2, 0.2, 0.2);
`),!N&&u!=="CONSTANT"&&(A+=`#ifdef USE_CUSTOM_LIGHT_COLOR
`,A+=`uniform vec3 gltf_lightColor;
`,A+=`#endif
`,b+=`#ifndef USE_CUSTOM_LIGHT_COLOR
`,b+=` vec3 lightColor = czm_lightColor;
`,b+=`#else
`,b+=` vec3 lightColor = gltf_lightColor;
`,b+=`#endif
`,b+=` vec3 l = normalize(czm_lightDirectionEC);
`,b+=` diffuseLight += lightColor * max(dot(normal,l), 0.2);
`,L&&(u==="BLINN"?(b+=` vec3 h = normalize(l + viewDir);
`,b+=` float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));
`):(b+=` vec3 reflectDir = reflect(-l, normal);
`,b+=` float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));
`),b+=` specularLight += lightColor * specularIntensity;
`)),C+=`void main(void) {
`,C+=D,C+=`}
`,A+=`void main(void) {
`;let v=` vec3 color = vec3(0.0, 0.0, 0.0);
`;T&&(A+=` vec3 normal = normalize(v_normal);
`,i.doubleSided&&(A+=` if (czm_backFacing())
`,A+=` {
`,A+=` normal = -normal;
`,A+=` }
`));let P;u!=="CONSTANT"?(l(E.u_diffuse)&&(E.u_diffuse.type===Z.SAMPLER_2D?A+=` vec4 diffuse = texture2D(u_diffuse, ${M});
`:A+=` vec4 diffuse = u_diffuse;
`,A+=` vec3 diffuseLight = vec3(0.0, 0.0, 0.0);
`,v+=` color += diffuse.rgb * diffuseLight;
`),L&&(E.u_specular.type===Z.SAMPLER_2D?A+=` vec3 specular = texture2D(u_specular, ${M}).rgb;
`:A+=` vec3 specular = u_specular.rgb;
`,A+=` vec3 specularLight = vec3(0.0, 0.0, 0.0);
`,v+=` color += specular * specularLight;
`),l(E.u_transparency)?P=` gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);
`:P=` gl_FragColor = vec4(color * diffuse.a, diffuse.a);
`):l(E.u_transparency)?P=` gl_FragColor = vec4(color * u_transparency, u_transparency);
`:P=` gl_FragColor = vec4(color, 1.0);
`,x&&(v+=` color *= v_vertexColor.rgb;
`),l(E.u_emission)&&(E.u_emission.type===Z.SAMPLER_2D?A+=` vec3 emission = texture2D(u_emission, ${M}).rgb;
`:A+=` vec3 emission = u_emission.rgb;
`,v+=` color += emission;
`),(l(E.u_ambient)||u!=="CONSTANT")&&(l(E.u_ambient)?E.u_ambient.type===Z.SAMPLER_2D?A+=` vec3 ambient = texture2D(u_ambient, ${M}).rgb;
`:A+=` vec3 ambient = u_ambient.rgb;
`:A+=` vec3 ambient = diffuse.rgb;
`,v+=` color += ambient * ambientLight;
`),A+=` vec3 viewDir = -normalize(v_positionEC);
`,A+=` vec3 ambientLight = vec3(0.0, 0.0, 0.0);
`,A+=b,A+=v,A+=P,A+=`}
`;let B=Go(a,{type:Z.VERTEX_SHADER,extras:{_pipeline:{source:C,extension:".glsl"}}}),F=Go(a,{type:Z.FRAGMENT_SHADER,extras:{_pipeline:{source:A,extension:".glsl"}}}),k=Go(c,{fragmentShader:F,vertexShader:B});return Go(s,{attributes:R,program:k,uniforms:E})}function _oe(e,t){let n;switch(l(t.value)?n=t.value:l(t.index)?n=[t.index]:n=t,e){case"ambient":return n.length===1?Z.SAMPLER_2D:Z.FLOAT_VEC4;case"diffuse":return n.length===1?Z.SAMPLER_2D:Z.FLOAT_VEC4;case"emission":return n.length===1?Z.SAMPLER_2D:Z.FLOAT_VEC4;case"specular":return n.length===1?Z.SAMPLER_2D:Z.FLOAT_VEC4;case"shininess":return Z.FLOAT;case"transparency":return Z.FLOAT;case"transparent":return Z.BOOL;case"doubleSided":return Z.BOOL}}function oVe(e,t){let n="";n+=`technique:${e.technique};`;let i=e.values,o=Object.keys(i).sort(),r=o.length;for(let a=0;a<r;++a){let c=o[a];i.hasOwnProperty(c)&&(n+=`${c}:${_oe(c,i[c])}`,n+=";")}let s=y(e.jointCount,0);if(n+=`${s.toString()};`,l(t)){let a=t.skinning;s>0&&(n+=`${a.type};`),n+=t.hasVertexColors}return n}function rVe(e){let t=e.extensions.KHR_materials_common;if(!l(t)||!l(t.lights))return;let n=t.lights,i=n.length;for(let o=0;o<i;o++){let r=n[o];if(r.type==="ambient"){l(r.ambient)||(r.ambient={});let s=r.ambient;l(s.color)||(s.color=[1,1,1])}else if(r.type==="directional"){l(r.directional)||(r.directional={});let s=r.directional;l(s.color)||(s.color=[1,1,1])}else if(r.type==="point"){l(r.point)||(r.point={});let s=r.point;l(s.color)||(s.color=[1,1,1]),s.constantAttenuation=y(s.constantAttenuation,1),s.linearAttenuation=y(s.linearAttenuation,0),s.quadraticAttenuation=y(s.quadraticAttenuation,0)}else if(r.type==="spot"){l(r.spot)||(r.spot={});let s=r.spot;l(s.color)||(s.color=[1,1,1]),s.constantAttenuation=y(s.constantAttenuation,1),s.fallOffAngle=y(s.fallOffAngle,3.14159265),s.fallOffExponent=y(s.fallOffExponent,0),s.linearAttenuation=y(s.linearAttenuation,0),s.quadraticAttenuation=y(s.quadraticAttenuation,0)}}}var Ew=tVe;function sVe(e,t){if(t=y(t,y.EMPTY_OBJECT),_r(e,"KHR_techniques_webgl")||!l(e.materials)||e.materials.length===0)return e;l(e.extensions)||(e.extensions={}),l(e.extensionsUsed)||(e.extensionsUsed=[]),l(e.extensionsRequired)||(e.extensionsRequired=[]),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl");let n=wn.splitIncompatibleMaterials(e);return we.material(e,function(i,o){let r={},s=fVe(e,i,o,r,n,t);l(i.extensions)||(i.extensions={}),i.extensions.KHR_techniques_webgl={values:r,technique:s}}),wn.ensureSemanticExistence(e),e}function aVe(e){return l(e.extensions)&&l(e.extensions.KHR_materials_pbrSpecularGlossiness)}function By(e,t,n,i,o){let r,s=n[t];return l(s)&&l(s.texCoord)&&s.texCoord===1&&(i=i.replace("0","1")),l(n[`${t}Offset`])?(r=`${t}Coord`,o.fragmentShaderMain+=` vec2 ${r} = computeTexCoord(${i}, ${t}Offset, ${t}Rotation, ${t}Scale);
`):r=i,r}var cVe=[0,0],lVe=[0],uVe=[1,1];function hz(e,t,n){if(e.indexOf("Texture")===-1||!l(t.extensions)||!l(t.extensions.KHR_texture_transform))return;let i=`u_${e}`,o=t.extensions.KHR_texture_transform;n[`${i}Offset`]=y(o.offset,cVe),n[`${i}Rotation`]=y(o.rotation,lVe),n[`${i}Scale`]=y(o.scale,uVe),l(t.texCoord)&&l(o.texCoord)&&(n[i].texCoord=o.texCoord)}function fVe(e,t,n,i,o,r){let s=y(r.addBatchIdToGeneratedShaders,!1),a=e.extensions.KHR_techniques_webgl,c=a.techniques,u=a.shaders,f=a.programs,d=aVe(t),p,_,m;if(!d){let Pe=t.pbrMetallicRoughness;if(l(Pe))for(_ in Pe)Pe.hasOwnProperty(_)&&(m=Pe[_],p=`u_${_}`,i[p]=m,hz(_,m,i));else i.u_baseColorFactor=[1,1,1,1]}if(d){let Pe=t.extensions.KHR_materials_pbrSpecularGlossiness;for(_ in Pe)Pe.hasOwnProperty(_)&&(m=Pe[_],p=`u_${_}`,i[p]=m,hz(_,m,i))}for(let Pe in t)t.hasOwnProperty(Pe)&&(Pe.indexOf("Texture")>=0||Pe.indexOf("Factor")>=0)&&(m=t[Pe],p=`u_${Pe}`,i[p]=m,hz(Pe,m,i));let x=`precision highp float;
`,C=`precision highp float;
`,A;l(e.skins)&&(A=e.skins[0]);let T=l(A)?A.joints:[],E=T.length,S=o[n],w,D=!1,R=!1,M=!1,L=!1,N=!1,g=!1,b=!1,v=!1,P=!1;l(S)&&(w=S.skinning,D=w.skinned&&T.length>0,R=S.hasVertexColors,M=S.hasMorphTargets,L=S.hasNormals,N=S.hasTangents,g=S.hasTexCoords,b=S.hasTexCoord1,v=S.hasOutline);let B;M&&we.mesh(e,function(Pe){we.meshPrimitive(Pe,function(Qe){if(Qe.material===n){let Yt=Qe.targets;l(Yt)&&(B=Yt)}})});let F={u_modelViewMatrix:{semantic:_r(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:Z.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:Z.FLOAT_MAT4}};l(t.extensions)&&l(t.extensions.KHR_materials_unlit)&&(P=!0),L&&(F.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:Z.FLOAT_MAT3}),D&&(F.u_jointMatrix={count:E,semantic:"JOINTMATRIX",type:Z.FLOAT_MAT4}),M&&(F.u_morphWeights={count:B.length,semantic:"MORPHWEIGHTS",type:Z.FLOAT});let k=t.alphaMode;l(k)&&k==="MASK"&&(F.u_alphaCutoff={semantic:"ALPHACUTOFF",type:Z.FLOAT});for(p in i)i.hasOwnProperty(p)&&(F[p]={type:dVe(p)});let U=y(F.u_baseColorTexture,F.u_baseColorFactor);l(U)&&(U.semantic="_3DTILESDIFFUSE");for(p in F)if(F.hasOwnProperty(p)){let Pe=F[p],Qe=l(Pe.count)?`[${Pe.count}]`:"";Pe.type!==Z.FLOAT_MAT3&&Pe.type!==Z.FLOAT_MAT4&&p!=="u_morphWeights"||Pe.useInFragment?(C+=`uniform ${my(Pe.type)} ${p}${Qe};
`,delete Pe.useInFragment):x+=`uniform ${my(Pe.type)} ${p}${Qe};
`}v&&(C+=`uniform sampler2D u_outlineTexture;
`);let z="";D&&(z+=` mat4 skinMatrix =
a_weight.x * u_jointMatrix[int(a_joint.x)] +
a_weight.y * u_jointMatrix[int(a_joint.y)] +
a_weight.z * u_jointMatrix[int(a_joint.z)] +
a_weight.w * u_jointMatrix[int(a_joint.w)];
`);let V={a_position:{semantic:"POSITION"}};if(v&&(V.a_outlineCoordinates={semantic:"_OUTLINE_COORDINATES"}),x+=`attribute vec3 a_position;
`,L&&(x+=`varying vec3 v_positionEC;
`),v&&(x+=`attribute vec3 a_outlineCoordinates;
`,x+=`varying vec3 v_outlineCoordinates;
`),z+=` vec3 weightedPosition = a_position;
`,L&&(z+=` vec3 weightedNormal = a_normal;
`),N&&(z+=` vec4 weightedTangent = a_tangent;
`),M)for(let Pe=0;Pe<B.length;Pe++){let Qe=B[Pe];for(let Yt in Qe)if(Qe.hasOwnProperty(Yt)&&Yt!=="extras"){let en=`a_${Yt}_${Pe}`;V[en]={semantic:`${Yt}_${Pe}`},x+=`attribute vec3 ${en};
`,Yt==="POSITION"?z+=` weightedPosition += u_morphWeights[${Pe}] * ${en};
`:Yt==="NORMAL"?z+=` weightedNormal += u_morphWeights[${Pe}] * ${en};
`:N&&Yt==="TANGENT"&&(z+=` weightedTangent.xyz += u_morphWeights[${Pe}] * ${en};
`)}}D?z+=` vec4 position = skinMatrix * vec4(weightedPosition, 1.0);
`:z+=` vec4 position = vec4(weightedPosition, 1.0);
`,z+=` position = u_modelViewMatrix * position;
`,L&&(z+=` v_positionEC = position.xyz;
`),z+=` gl_Position = u_projectionMatrix * position;
`,v&&(z+=` v_outlineCoordinates = a_outlineCoordinates;
`),L&&(V.a_normal={semantic:"NORMAL"},x+=`attribute vec3 a_normal;
`,P||(x+=`varying vec3 v_normal;
`,D?z+=` v_normal = u_normalMatrix * mat3(skinMatrix) * weightedNormal;
`:z+=` v_normal = u_normalMatrix * weightedNormal;
`,C+=`varying vec3 v_normal;
`),C+=`varying vec3 v_positionEC;
`),N&&(V.a_tangent={semantic:"TANGENT"},x+=`attribute vec4 a_tangent;
`,x+=`varying vec4 v_tangent;
`,z+=` v_tangent.xyz = u_normalMatrix * weightedTangent.xyz;
`,z+=` v_tangent.w = weightedTangent.w;
`,C+=`varying vec4 v_tangent;
`),v&&(C+=`varying vec3 v_outlineCoordinates;
`);let Y="",j,$,G,K,J,ce,de,oe;if(g){if(V.a_texcoord_0={semantic:"TEXCOORD_0"},j="v_texcoord_0",x+=`attribute vec2 a_texcoord_0;
`,x+=`varying vec2 ${j};
`,z+=` ${j} = a_texcoord_0;
`,C+=`varying vec2 ${j};
`,b){V.a_texcoord_1={semantic:"TEXCOORD_1"};let Qe=j.replace("0","1");x+=`attribute vec2 a_texcoord_1;
`,x+=`varying vec2 ${Qe};
`,z+=` ${Qe} = a_texcoord_1;
`,C+=`varying vec2 ${Qe};
`}let Pe={fragmentShaderMain:Y};$=By(e,"u_normalTexture",i,j,Pe),G=By(e,"u_baseColorTexture",i,j,Pe),K=By(e,"u_specularGlossinessTexture",i,j,Pe),J=By(e,"u_diffuseTexture",i,j,Pe),ce=By(e,"u_metallicRoughnessTexture",i,j,Pe),de=By(e,"u_occlusionTexture",i,j,Pe),oe=By(e,"u_emissiveTexture",i,j,Pe),Y=Pe.fragmentShaderMain}D&&(V.a_joint={semantic:"JOINTS_0"},V.a_weight={semantic:"WEIGHTS_0"},x+=`attribute vec4 a_joint;
`,x+=`attribute vec4 a_weight;
`),R&&(V.a_vertexColor={semantic:"COLOR_0"},x+=`attribute vec4 a_vertexColor;
`,x+=`varying vec4 v_vertexColor;
`,z+=` v_vertexColor = a_vertexColor;
`,C+=`varying vec4 v_vertexColor;
`),s&&(V.a_batchId={semantic:"_BATCHID"},x+=`attribute float a_batchId;
`),x+=`void main(void)
{
`,x+=z,x+=`}
`,L&&!P&&(C+=`const float M_PI = 3.141592653589793;
`,C+=`vec3 lambertianDiffuse(vec3 diffuseColor)
{
return diffuseColor / M_PI;
}
`,C+=`vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
{
return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);
}
`,C+=`vec3 fresnelSchlick(float metalness, float VdotH)
{
return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);
}
`,C+=`float smithVisibilityG1(float NdotV, float roughness)
{
float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
`,C+=`float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
{
return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);
}
`,C+=`float GGX(float roughness, float NdotH)
{
float roughnessSquared = roughness * roughness;
float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;
return roughnessSquared / (M_PI * f * f);
}
`),C+=`vec3 SRGBtoLINEAR3(vec3 srgbIn)
{
return pow(srgbIn, vec3(2.2));
}
`,C+=`vec4 SRGBtoLINEAR4(vec4 srgbIn)
{
vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));
return vec4(linearOut, srgbIn.a);
}
`,C+=`vec3 applyTonemapping(vec3 linearIn)
{
#ifndef HDR
return czm_acesTonemapping(linearIn);
#else
return linearIn;
#endif
}
`,C+=`vec3 LINEARtoSRGB(vec3 linearIn)
{
#ifndef HDR
return pow(linearIn, vec3(1.0/2.2));
#else
return linearIn;
#endif
}
`,C+=`vec2 computeTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale)
{
rotation = -rotation;
mat3 transform = mat3(
cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0,
-sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0,
offset.x, offset.y, 1.0);
vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy;
return transformedTexCoords;
}
`,C+=`#ifdef USE_IBL_LIGHTING
`,C+=`uniform vec2 gltf_iblFactor;
`,C+=`#endif
`,C+=`#ifdef USE_CUSTOM_LIGHT_COLOR
`,C+=`uniform vec3 gltf_lightColor;
`,C+=`#endif
`,C+=`void main(void)
{
`,C+=Y,L&&!P&&(C+=` vec3 ng = normalize(v_normal);
`,C+=` vec3 positionWC = vec3(czm_inverseView * vec4(v_positionEC, 1.0));
`,l(i.u_normalTexture)?N?(C+=` vec3 t = normalize(v_tangent.xyz);
`,C+=` vec3 b = normalize(cross(ng, t) * v_tangent.w);
`,C+=` mat3 tbn = mat3(t, b, ng);
`,C+=` vec3 n = texture2D(u_normalTexture, ${$}).rgb;
`,C+=` n = normalize(tbn * (2.0 * n - 1.0));
`):(C=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
${C}`,C+=`#ifdef GL_OES_standard_derivatives
`,C+=` vec3 pos_dx = dFdx(v_positionEC);
`,C+=` vec3 pos_dy = dFdy(v_positionEC);
`,C+=` vec3 tex_dx = dFdx(vec3(${$},0.0));
`,C+=` vec3 tex_dy = dFdy(vec3(${$},0.0));
`,C+=` vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
`,C+=` t = normalize(t - ng * dot(ng, t));
`,C+=` vec3 b = normalize(cross(ng, t));
`,C+=` mat3 tbn = mat3(t, b, ng);
`,C+=` vec3 n = texture2D(u_normalTexture, ${$}).rgb;
`,C+=` n = normalize(tbn * (2.0 * n - 1.0));
`,C+=`#else
`,C+=` vec3 n = ng;
`,C+=`#endif
`):C+=` vec3 n = ng;
`,t.doubleSided&&(C+=` if (czm_backFacing())
`,C+=` {
`,C+=` n = -n;
`,C+=` }
`)),l(i.u_baseColorTexture)?(C+=` vec4 baseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, ${G}));
`,l(i.u_baseColorFactor)&&(C+=` baseColorWithAlpha *= u_baseColorFactor;
`)):l(i.u_baseColorFactor)?C+=` vec4 baseColorWithAlpha = u_baseColorFactor;
`:C+=` vec4 baseColorWithAlpha = vec4(1.0);
`,R&&(C+=` baseColorWithAlpha *= v_vertexColor;
`),C+=` vec3 baseColor = baseColorWithAlpha.rgb;
`,L&&!P?(d?(l(i.u_specularGlossinessTexture)?(C+=` vec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, ${K}));
`,C+=` vec3 specular = specularGlossiness.rgb;
`,C+=` float glossiness = specularGlossiness.a;
`,l(i.u_specularFactor)&&(C+=` specular *= u_specularFactor;
`),l(i.u_glossinessFactor)&&(C+=` glossiness *= u_glossinessFactor;
`)):(l(i.u_specularFactor)?C+=` vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));
`:C+=` vec3 specular = vec3(1.0);
`,l(i.u_glossinessFactor)?C+=` float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);
`:C+=` float glossiness = 1.0;
`),l(i.u_diffuseTexture)?(C+=` vec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, ${J}));
`,l(i.u_diffuseFactor)&&(C+=` diffuse *= u_diffuseFactor;
`)):l(i.u_diffuseFactor)?C+=` vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));
`:C+=` vec4 diffuse = vec4(1.0);
`,C+=` baseColorWithAlpha.a = diffuse.a;
`):l(i.u_metallicRoughnessTexture)?(C+=` vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, ${ce}).rgb;
`,C+=` float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
`,C+=` float roughness = clamp(metallicRoughness.g, 0.04, 1.0);
`,l(i.u_metallicFactor)&&(C+=` metalness *= u_metallicFactor;
`),l(i.u_roughnessFactor)&&(C+=` roughness *= u_roughnessFactor;
`)):(l(i.u_metallicFactor)?C+=` float metalness = clamp(u_metallicFactor, 0.0, 1.0);
`:C+=` float metalness = 1.0;
`,l(i.u_roughnessFactor)?C+=` float roughness = clamp(u_roughnessFactor, 0.04, 1.0);
`:C+=` float roughness = 1.0;
`),C+=` vec3 v = -normalize(v_positionEC);
`,C+=`#ifndef USE_CUSTOM_LIGHT_COLOR
`,C+=` vec3 lightColorHdr = czm_lightColorHdr;
`,C+=`#else
`,C+=` vec3 lightColorHdr = gltf_lightColor;
`,C+=`#endif
`,C+=` vec3 l = normalize(czm_lightDirectionEC);
`,C+=` vec3 h = normalize(v + l);
`,C+=` float NdotL = clamp(dot(n, l), 0.001, 1.0);
`,C+=` float NdotV = abs(dot(n, v)) + 0.001;
`,C+=` float NdotH = clamp(dot(n, h), 0.0, 1.0);
`,C+=` float LdotH = clamp(dot(l, h), 0.0, 1.0);
`,C+=` float VdotH = clamp(dot(v, h), 0.0, 1.0);
`,C+=` vec3 f0 = vec3(0.04);
`,d?(C+=` float roughness = 1.0 - glossiness;
`,C+=` vec3 diffuseColor = diffuse.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));
`,C+=` vec3 specularColor = specular;
`):(C+=` vec3 diffuseColor = baseColor * (1.0 - metalness) * (1.0 - f0);
`,C+=` vec3 specularColor = mix(f0, baseColor, metalness);
`),C+=` float alpha = roughness * roughness;
`,C+=` float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
`,C+=` vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
`,C+=` vec3 r0 = specularColor.rgb;
`,C+=` vec3 F = fresnelSchlick2(r0, r90, VdotH);
`,C+=` float G = smithVisibilityGGX(alpha, NdotL, NdotV);
`,C+=` float D = GGX(alpha, NdotH);
`,C+=` vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);
`,C+=` vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);
`,C+=` vec3 color = NdotL * lightColorHdr * (diffuseContribution + specularContribution);
`,C+=`#if defined(USE_IBL_LIGHTING) && !defined(DIFFUSE_IBL) && !defined(SPECULAR_IBL)
`,C+=` vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));
`,C+=` float vertexRadius = length(positionWC);
`,C+=` float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);
`,C+=` float reflectionDotNadir = dot(r, normalize(positionWC));
`,C+=` r.x = -r.x;
`,C+=` r = -normalize(czm_temeToPseudoFixed * r);
`,C+=` r.x = -r.x;
`,C+=` float inverseRoughness = 1.04 - roughness;
`,C+=` inverseRoughness *= inverseRoughness;
`,C+=` vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;
`,C+=` float atmosphereHeight = 0.05;
`,C+=` float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);
`,C+=` float blendRegionOffset = roughness * -1.0;
`,C+=` float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);
`,C+=` float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);
`,C+=` float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);
`,C+=` float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);
`,C+=` vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);
`,C+=` vec3 nadirColor = belowHorizonColor * 0.5;
`,C+=` vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);
`,C+=` vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);
`,C+=` vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);
`,C+=` vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);
`,C+=` float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;
`,C+=` float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));
`,C+=` vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);
`,C+=` float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);
`,C+=` vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);
`,C+=` specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);
`,C+=` specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);
`,C+=`#ifdef USE_SUN_LUMINANCE
`,C+=` float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), normalize(positionWC * -1.0)), 0.001, 1.0);
`,C+=` float S = acos(LdotZenith);
`,C+=` float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), normalize(positionWC * -1.0)), 0.001, 1.0);
`,C+=` float gamma = acos(NdotL);
`,C+=` float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));
`,C+=` float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));
`,C+=` float luminance = gltf_luminanceAtZenith * (numerator / denominator);
`,C+=`#endif
`,C+=` vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;
`,C+=` vec3 IBLColor = (diffuseIrradiance * diffuseColor * gltf_iblFactor.x) + (specularIrradiance * SRGBtoLINEAR3(specularColor * brdfLut.x + brdfLut.y) * gltf_iblFactor.y);
`,C+=` float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);
`,C+=` vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);
`,C+=` IBLColor *= lightColor;
`,C+=`#ifdef USE_SUN_LUMINANCE
`,C+=` color += IBLColor * luminance;
`,C+=`#else
`,C+=` color += IBLColor;
`,C+=`#endif
`,C+=`#elif defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
`,C+=` const mat3 yUpToZUp = mat3(-1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0);
`,C+=` vec3 cubeDir = normalize(yUpToZUp * gltf_iblReferenceFrameMatrix * normalize(reflect(-v, n)));
`,C+=`#ifdef DIFFUSE_IBL
`,C+=`#ifdef CUSTOM_SPHERICAL_HARMONICS
`,C+=` vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, gltf_sphericalHarmonicCoefficients);
`,C+=`#else
`,C+=` vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);
`,C+=`#endif
`,C+=`#else
`,C+=` vec3 diffuseIrradiance = vec3(0.0);
`,C+=`#endif
`,C+=`#ifdef SPECULAR_IBL
`,C+=` vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;
`,C+=`#ifdef CUSTOM_SPECULAR_IBL
`,C+=` vec3 specularIBL = czm_sampleOctahedralProjection(gltf_specularMap, gltf_specularMapSize, cubeDir, roughness * gltf_maxSpecularLOD, gltf_maxSpecularLOD);
`,C+=`#else
`,C+=` vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);
`,C+=`#endif
`,C+=` specularIBL *= F * brdfLut.x + brdfLut.y;
`,C+=`#else
`,C+=` vec3 specularIBL = vec3(0.0);
`,C+=`#endif
`,C+=` color += diffuseIrradiance * diffuseColor + specularColor * specularIBL;
`,C+=`#endif
`):C+=` vec3 color = baseColor;
`,P||(l(i.u_occlusionTexture)&&(C+=` color *= texture2D(u_occlusionTexture, ${de}).r;
`),l(i.u_emissiveTexture)?(C+=` vec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, ${oe}).rgb);
`,l(i.u_emissiveFactor)&&(C+=` emissive *= u_emissiveFactor;
`),C+=` color += emissive;
`):l(i.u_emissiveFactor)&&(C+=` color += u_emissiveFactor;
`)),P||(C+=` color = applyTonemapping(color);
`),C+=` color = LINEARtoSRGB(color);
`,v&&(C+=` float outlineness = max(
`,C+=` texture2D(u_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r,
`,C+=` max(
`,C+=` texture2D(u_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r,
`,C+=` texture2D(u_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r));
`,C+=` color = mix(color, vec3(0.0, 0.0, 0.0), outlineness);
`),l(k)?k==="MASK"?(C+=` if (baseColorWithAlpha.a < u_alphaCutoff) {
`,C+=` discard;
`,C+=` }
`,C+=` gl_FragColor = vec4(color, 1.0);
`):k==="BLEND"?C+=` gl_FragColor = vec4(color, baseColorWithAlpha.a);
`:C+=` gl_FragColor = vec4(color, 1.0);
`:C+=` gl_FragColor = vec4(color, 1.0);
`,C+=`}
`;let le=Go(u,{type:Z.VERTEX_SHADER,extras:{_pipeline:{source:x,extension:".glsl"}}}),ge=Go(u,{type:Z.FRAGMENT_SHADER,extras:{_pipeline:{source:C,extension:".glsl"}}}),De=Go(f,{fragmentShader:ge,vertexShader:le});return Go(c,{attributes:V,program:De,uniforms:F})}function dVe(e){if(e.indexOf("Offset")!==-1)return Z.FLOAT_VEC2;if(e.indexOf("Rotation")!==-1)return Z.FLOAT;if(e.indexOf("Scale")!==-1)return Z.FLOAT_VEC2;if(e.indexOf("Texture")!==-1)return Z.SAMPLER_2D;switch(e){case"u_baseColorFactor":return Z.FLOAT_VEC4;case"u_metallicFactor":return Z.FLOAT;case"u_roughnessFactor":return Z.FLOAT;case"u_emissiveFactor":return Z.FLOAT_VEC3;case"u_diffuseFactor":return Z.FLOAT_VEC4;case"u_specularFactor":return Z.FLOAT_VEC3;case"u_glossinessFactor":return Z.FLOAT}}var Sw=sVe;function hVe(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var rd=hVe;var sO=`attribute vec3 position;
attribute float a_batchId;
uniform mat4 u_modifiedModelViewProjection;
void main()
{
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
}
`;var ZA=Qc(goe(),1);var mVe={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18},Lt=Object.freeze(mVe);function sd(e,t){this._expression=e,e=vVe(e,t),e=PVe(DVe(e)),ZA.default.addBinaryOp("=~",0),ZA.default.addBinaryOp("!~",0);let n;try{n=(0,ZA.default)(e)}catch(i){throw new he(i)}this._runtimeAst=ji(this,n)}Object.defineProperties(sd.prototype,{expression:{get:function(){return this._expression}}});var oi={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new W],cartesian3Array:[new h],cartesian4Array:[new ae],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);let e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new W),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new h),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new ae),this.cartesian4Array[this.cartesian4Index++]}};sd.prototype.evaluate=function(e,t){oi.reset();let n=this._runtimeAst.evaluate(e);return t instanceof H&&n instanceof ae?H.fromCartesian4(n,t):n instanceof W||n instanceof h||n instanceof ae?n.clone(t):n};sd.prototype.evaluateColor=function(e,t){oi.reset();let n=this._runtimeAst.evaluate(e);return H.fromCartesian4(n,t)};sd.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
{
return ${o};
}
`,o};sd.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};sd.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var pVe=["!","-","+"],yoe=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],uO=/\${(.*?)}/g,_Ve=/\\/g,gVe="@#%",yVe=/@#%/g,fO=new H,dO={abs:Ws(Math.abs),sqrt:Ws(Math.sqrt),cos:Ws(Math.cos),sin:Ws(Math.sin),tan:Ws(Math.tan),acos:Ws(Math.acos),asin:Ws(Math.asin),atan:Ws(Math.atan),radians:Ws(I.toRadians),degrees:Ws(I.toDegrees),sign:Ws(I.sign),floor:Ws(Math.floor),ceil:Ws(Math.ceil),round:Ws(Math.round),exp:Ws(Math.exp),exp2:Ws(CVe),log:Ws(Math.log),log2:Ws(AVe),fract:Ws(xVe),length:TVe,normalize:bVe},hO={atan2:cO(Math.atan2,!1),pow:cO(Math.pow,!1),min:cO(Math.min,!0),max:cO(Math.max,!0),distance:EVe,dot:SVe,cross:wVe},_z={clamp:xoe(I.clamp,!0),mix:xoe(I.lerp,!0)};function xVe(e){return e-Math.floor(e)}function CVe(e){return Math.pow(2,e)}function AVe(e){return I.log2(e)}function Ws(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof W)return W.fromElements(e(n.x),e(n.y),oi.getCartesian2());if(n instanceof h)return h.fromElements(e(n.x),e(n.y),e(n.z),oi.getCartesian3());if(n instanceof ae)return ae.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),oi.getCartesian4());throw new he(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function cO(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof W)return W.fromElements(e(i.x,o),e(i.y,o),oi.getCartesian2());if(i instanceof h)return h.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),oi.getCartesian3());if(i instanceof ae)return ae.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),oi.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof W&&o instanceof W)return W.fromElements(e(i.x,o.x),e(i.y,o.y),oi.getCartesian2());if(i instanceof h&&o instanceof h)return h.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),oi.getCartesian3());if(i instanceof ae&&o instanceof ae)return ae.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),oi.getCartesian4());throw new he(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function xoe(e,t){return function(n,i,o,r){if(t&&typeof r=="number"){if(typeof i=="number"&&typeof o=="number")return e(i,o,r);if(i instanceof W&&o instanceof W)return W.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),oi.getCartesian2());if(i instanceof h&&o instanceof h)return h.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),oi.getCartesian3());if(i instanceof ae&&o instanceof ae)return ae.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),e(i.w,o.w,r),oi.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof W&&o instanceof W&&r instanceof W)return W.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),oi.getCartesian2());if(i instanceof h&&o instanceof h&&r instanceof h)return h.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),oi.getCartesian3());if(i instanceof ae&&o instanceof ae&&r instanceof ae)return ae.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),e(i.w,o.w,r.w),oi.getCartesian4());throw new he(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function TVe(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof W)return W.magnitude(t);if(t instanceof h)return h.magnitude(t);if(t instanceof ae)return ae.magnitude(t);throw new he(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function bVe(e,t){if(typeof t=="number")return 1;if(t instanceof W)return W.normalize(t,oi.getCartesian2());if(t instanceof h)return h.normalize(t,oi.getCartesian3());if(t instanceof ae)return ae.normalize(t,oi.getCartesian4());throw new he(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function EVe(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof W
{
czm_non_pick_main();
gl_FragColor = ${o};
}
`,e._spPick=gn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}let a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(sO),c=n.getFragmentShaderCallback(!1,void 0,!0)(VA);o=n.getPickId();let u=new je({sources:[a]}),f=new je({defines:["VECTOR_TILE"],sources:[c]});e._sp=gn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),u=new je({sources:[sO]}),f=new je({defines:["VECTOR_TILE"],sources:[VA]}),e._spStencil=gn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),c=je.replaceMain(c,"czm_non_pick_main"),c=`${c}
void main()
{
czm_non_pick_main();
gl_FragColor = ${o};
}
`;let d=new je({sources:[a]}),p=new je({defines:["VECTOR_TILE"],sources:[c]});e._spPick=gn.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:i})}function Eoe(e){let t=e?$i.EQUAL:$i.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:ln.KEEP,zFail:ln.DECREMENT_WRAP,zPass:ln.KEEP},backFunction:t,backOperation:{fail:ln.KEEP,zFail:ln.INCREMENT_WRAP,zPass:ln.KEEP},reference:On.CESIUM_3D_TILE_MASK,mask:On.CESIUM_3D_TILE_MASK},stencilMask:On.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:pl.LESS_OR_EQUAL},depthMask:!1}}var XVe={stencilTest:{enabled:!0,frontFunction:$i.NOT_EQUAL,frontOperation:{fail:ln.ZERO,zFail:ln.ZERO,zPass:ln.ZERO},backFunction:$i.NOT_EQUAL,backOperation:{fail:ln.ZERO,zFail:ln.ZERO,zPass:ln.ZERO},reference:0,mask:On.CLASSIFICATION_MASK},stencilMask:On.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Hn.PRE_MULTIPLIED_ALPHA_BLEND},KVe={stencilTest:{enabled:!0,frontFunction:$i.NOT_EQUAL,frontOperation:{fail:ln.ZERO,zFail:ln.ZERO,zPass:ln.ZERO},backFunction:$i.NOT_EQUAL,backOperation:{fail:ln.ZERO,zFail:ln.ZERO,zPass:ln.ZERO},reference:0,mask:On.CLASSIFICATION_MASK},stencilMask:On.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function $Ve(e){l(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Ze.fromCache(Eoe(!1)),e._rsStencilDepthPass3DTiles=Ze.fromCache(Eoe(!0)),e._rsColorPass=Ze.fromCache(XVe),e._rsPickPass=Ze.fromCache(KVe))}var Ny=new O,Soe=new h;function ZVe(e,t){if(l(e._uniformMap))return;let n={u_modifiedModelViewProjection:function(){let i=t.uniformState.view,o=t.uniformState.projection;return O.clone(i,Ny),O.multiplyByPoint(Ny,e._center,Soe),O.setTranslation(Ny,Soe,Ny),O.multiply(o,Ny,Ny),Ny},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function gz(e,t,n,i,o,r,s){let a=e.constructor.BYTES_PER_ELEMENT,c=r.length;for(let u=0;u<c;++u){let f=r[u],d=s[f],p=i[d],_=o[d],m=new e.constructor(e.buffer,a*p,_);t.set(m,n),i[d]=n,n+=_}return n}function JVe(e,t){let n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length),a=t.pop(),c=[a],u=gz(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=u;t.length>0;){let f=t.pop();if(H.equals(f.color,a.color))u=gz(n,s,u,i,o,f.batchIds,r),a.batchIds=a.batchIds.concat(f.batchIds),a.count=u-a.offset;else{let d=u;u=gz(n,s,u,i,o,f.batchIds,r),f.offset=d,f.count=u-d,c.push(f),a=f}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=c}function yz(e,t,n,i,o,r,s){let a=e.bytesPerIndex,c=r.length;for(let u=0;u<c;++u){let f=r[u],d=s[f],p=i[d],_=o[d];t.copyFromBuffer(e,p*a,n*a,_*a),i[d]=n,n+=_}return n}function QVe(e,t){let n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp,r=t.pop(),s=[r],a=e._va.indexBuffer,c=e._vaSwap.indexBuffer,u=yz(a,c,0,n,i,r.batchIds,o);for(r.offset=0,r.count=u;t.length>0;){let d=t.pop();if(H.equals(d.color,r.color))u=yz(a,c,u,n,i,d.batchIds,o),r.batchIds=r.batchIds.concat(d.batchIds),r.count=u-r.offset;else{let p=u;u=yz(a,c,u,n,i,d.batchIds,o),d.offset=p,d.count=u-p,s.push(d),r=d}}let f=e._va;e._va=e._vaSwap,e._vaSwap=f,e._batchedIndices=s}function eke(e,t){return t.color.toRgba()-e.color.toRgba()}function tke(e,t){if(!e._batchDirty)return!1;let n=e._batchedIndices,i=n.length,o=!1,r={};for(let s=0;s<i;++s){let c=n[s].color.toRgba();if(l(r[c])){o=!0;break}else r[c]=!0}if(!o)return e._batchDirty=!1,!1;if(o&&!e.forceRebatch&&e._framesSinceLastRebatch<120){++e._framesSinceLastRebatch;return}return n.sort(eke),t.webgl2?QVe(e,n):JVe(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function nke(e,t){let n=tke(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(l(i)&&!n&&i.length===s)return;i.length=s;let a=e._va,c=e._sp,u=y(e._modelMatrix,O.IDENTITY),f=e._uniformMap,d=e._boundingVolume;for(let p=0;p<r;++p){let _=o[p].offset,m=o[p].count,x=i[p*2];l(x)||(x=i[p*2]=new pt({owner:e})),x.vertexArray=a,x.modelMatrix=u,x.offset=_,x.count=m,x.renderState=e._rsStencilDepthPass,x.
`,a=`${r} * vec4(${n}, 1.0)`;else{let _=wn.getAttributeOrUniformBySemantic(t,"PROJECTION"),m=wn.getAttributeOrUniformBySemantic(t,"MODELVIEW");l(m)||(m=wn.getAttributeOrUniformBySemantic(t,"CESIUM_RTC_MODELVIEW")),s=`uniform mat4 ${m};
uniform mat4 ${_};
`,a=`${_} * ${m} * vec4(${n}, 1.0)`}let c=` vec4 positionInClipCoords = ${a};
`,u=`attribute vec3 ${n};
attribute float ${i};
${s}void main() {
${c} gl_Position = czm_depthClamp(positionInClipCoords);
}
`,f=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
void main()
{
gl_FragColor = vec4(1.0);
czm_writeDepthClamp();
}
`;e.extensionsUsed.WEB3D_quantized_attributes&&(u=yke(u,e));let d=voe(u,e._vertexShaderLoaded),p=voe(f,e._classificationShaderLoaded);e._shaderProgram={vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:o}}function Cke(){return{POSITION:0,_BATCHID:1}}function Ake(e){if(!e._loadResources.finishedBuffersCreation()||l(e._vertexArray))return;let n=e._buffers,i=e.gltf,o=i.accessors,a=i.meshes[0].primitives[0],c=Cke(),u={};we.meshPrimitiveAttribute(a,function(d,p){let _=c[p];if(l(_)){let m=o[d];u[p]={index:_,vertexBuffer:n[m.bufferView],componentsPerAttribute:Hs(m.type),componentDatatype:m.componentType,offsetInBytes:m.byteOffset,strideInBytes:Gs(i,m)}}});let f;if(l(a.indices)){let d=o[a.indices];f=n[d.bufferView]}e._vertexArray={attributes:u,indexBuffer:f}}var Doe={PROJECTION:function(e,t){return wn.getGltfSemanticUniforms().PROJECTION(e,t)},MODELVIEW:function(e,t){return wn.getGltfSemanticUniforms().MODELVIEW(e,t)},CESIUM_RTC_MODELVIEW:function(e,t){return wn.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(e,t)},MODELVIEWPROJECTION:function(e,t){return wn.getGltfSemanticUniforms().MODELVIEWPROJECTION(e,t)}};function Tke(e,t){if(l(e._uniformMap))return;let n={};we.technique(e.gltf,function(i){we.techniqueUniform(i,function(o,r){!l(o.semantic)||!l(Doe[o.semantic])||(n[r]=Doe[o.semantic](t.uniformState,e))})}),e._uniformMap=n}function bke(e,t){return wn.createUniformsForQuantizedAttributes(e.gltf,t,e._quantizedUniforms)}function Eke(e,t){switch(e.mode){case He.TRIANGLES:return t/3;case He.TRIANGLE_STRIP:case He.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function Ske(e){let t=e._batchTable,n=e._uniformMap,i=e._vertexArray,o=e.gltf,r=o.accessors,a=o.meshes[0].primitives[0],c=r[a.indices],u=a.attributes.POSITION,f=wn.getAccessorMinMax(o,u),d=re.fromCornerPoints(h.fromArray(f.min),h.fromArray(f.max)),p,_;if(l(c)?(_=c.count,p=c.byteOffset/Ge.getSizeInBytes(c.componentType)):(_=r[a.attributes.POSITION].count,p=0),e._trianglesLength+=Eke(a,_),l(e._uniformMapLoaded)&&(n=e._uniformMapLoaded(n)),e.extensionsUsed.WEB3D_quantized_attributes){let Y=bke(e,a);n=Dt(n,Y)}let m=i.attributes.POSITION,x=m.componentDatatype,C=m.vertexBuffer,A=C.byteOffset,T=C.byteLength/X.getSizeInBytes(x),E=X.createArrayBufferView(x,C.buffer,A,T);m=i.attributes._BATCHID,x=m.componentDatatype,C=m.vertexBuffer,A=C.byteOffset,T=C.byteLength/X.getSizeInBytes(x);let S=X.createArrayBufferView(x,C.buffer,A,T),w=i.indexBuffer.typedArray,D;i.indexBuffer.indexDatatype===Ge.UNSIGNED_SHORT?D=new Uint16Array(w.buffer,w.byteOffset,w.byteLength/Uint16Array.BYTES_PER_ELEMENT):D=new Uint32Array(w.buffer,w.byteOffset,w.byteLength/Uint32Array.BYTES_PER_ELEMENT),E=E.slice(),S=S.slice(),D=D.slice(p,p+_);let R=[],M=[],L=[],N=[],g=S[D[0]];R.push(g),L.push(0);let b,v,P,B=D.length;for(let Y=1;Y<B;++Y)b=S[D[Y]],b!==g&&(v=L[L.length-1],P=Y-v,R.push(b),M.push(P),L.push(Y),N.push(new rd({offset:v,count:P,batchIds:[g],color:H.WHITE})),g=b);v=L[L.length-1],P=B-v,M.push(P),N.push(new rd({offset:v,count:P,batchIds:[g],color:H.WHITE}));let F=e._shaderProgram,k=F.vertexShaderSource,U=F.fragmentShaderSource,z=F.attributeLocations,V=l(e._pickIdLoaded)?e._pickIdLoaded():void 0;e._primitive=new Fy({classificationType:e._classificationType,positions:E,indices:D,indexOffsets:L,indexCounts:M,batchIds:R,vertexBatchIds:S,batchedIndices:N,batchTable:t,boundingVolume:new re,_vertexShaderSource:k,_fragmentShaderSource:U,_attributeLocations:z,_uniformMap:n,_pickId:V,_modelMatrix:new O,_boundingSphere:d}),e._buffers=void 0,e._vertexArray=void 0,e._shaderProgram=void 0,e._uniformMap=void 0}function wke(e){if(!e._loadResources.finished()||l(e._primitive))return;let o=e.gltf.nodes[0];e._nodeMatrix=wn.getTransform(o,e._nodeMatrix),Ske(e)}function Poe(e,t){let n=t.context;wn.checkSupportedGlExtensions(e.gltf.glExtensionsUsed,n),gke(e),xke(e),Ake(e),Tke(e,n),wke(e)}var vke=new ae,xz=new O;function Dke(e,t,n,i){let o=e._computedModelMatrix;if(e._mode!==te.SCENE3D&&!e._ignoreCommands){let s=O.getColumn(o,3,vke);if(!ae.equals(s,ae.UNIT_W))o=Ut.basisTo2D(i,o,xz),e._rtcCenter=e._rtcCenter3D;else{let
vec4 clippingPlanesEdgeColor = vec4(1.0);
clippingPlanesEdgeColor.rgb = ${n}.rgb;
float clippingPlanesEdgeWidth = ${n}.a;
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth)
{
gl_FragColor = clippingPlanesEdgeColor;
}
`}var Pw=Lke;var Nke=new W;function Fke(e,t){let n=e.unionClippingRegions,i=e.length,o=na.useFloatTexture(t),r=na.getTextureResolution(e,t,Nke),s=r.x,a=r.y,c=o?Uke(s,a):zke(s,a);return c+=`
`,c+=n?Vke(i):kke(i),c}function Vke(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
{
vec4 position = czm_windowToEyeCoordinates(fragCoord);
vec3 clipNormal = vec3(0.0);
vec3 clipPosition = vec3(0.0);
float clipAmount;
float pixelWidth = czm_metersPerPixel(position);
bool breakAndDiscard = false;
for (int i = 0; i < ${e}; ++i)
{
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
clipNormal = clippingPlane.xyz;
clipPosition = -clippingPlane.w * clipNormal;
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
if (amount <= 0.0)
{
breakAndDiscard = true;
break;
}
}
if (breakAndDiscard) {
discard;
}
return clipAmount;
}
`}function kke(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
{
bool clipped = true;
vec4 position = czm_windowToEyeCoordinates(fragCoord);
vec3 clipNormal = vec3(0.0);
vec3 clipPosition = vec3(0.0);
float clipAmount = 0.0;
float pixelWidth = czm_metersPerPixel(position);
for (int i = 0; i < ${e}; ++i)
{
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
clipNormal = clippingPlane.xyz;
clipPosition = -clippingPlane.w * clipNormal;
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
clipAmount = max(amount, clipAmount);
clipped = clipped && (amount <= 0.0);
}
if (clipped)
{
discard;
}
return clipAmount;
}
`}function Uke(e,t){let n=1/e,i=1/t,o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
{
int pixY = clippingPlaneNumber / ${e};
int pixX = clippingPlaneNumber - (pixY * ${e});
float u = (float(pixX) + 0.5) * ${o};
float v = (float(pixY) + 0.5) * ${r};
vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));
return czm_transformPlane(plane, transform);
}
`}function zke(e,t){let n=1/e,i=1/t,o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
{
int clippingPlaneStartIndex = clippingPlaneNumber * 2;
int pixY = clippingPlaneStartIndex / ${e};
int pixX = clippingPlaneStartIndex - (pixY * ${e});
float u = (float(pixX) + 0.5) * ${o};
float v = (float(pixY) + 0.5) * ${r};
vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
vec4 plane;
plane.xyz = czm_octDecode(oct, 65535.0);
plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + ${o}, v)));
return czm_transformPlane(plane, transform);
}
`}var Vy=Fke;var Hke={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},Is=Object.freeze(Hke);function pO(){}var Gke=/^data\:/i;function Woe(e,t){let n=e.gltfInternal,i=n.buffers,r=n.bufferViews[t.bufferView],s=i[r.buffer],a=r.byteOffset+t.byteOffset,c=t.count*Hs(t.type),u=Gke.test(s.uri)?"":s.uri;return`${e.cacheKey}//${u}/${a}/${c}`}var zoe={};pO.getAnimationParameterValues=function(e,t){let n=Woe(e,t),i=zoe[n];if(!l(i)){let o=e.gltfInternal,r=o.buffers,a=o.bufferViews[t.bufferView],c=a.buffer,f=r[c].extras._pipeline.source,d=t.componentType,p=t.type,_=Hs(p),m=t.count,x=Gs(o,t);i=new Array(m);let C=y(t.byteOffset,0),A=a.byteOffset+C;for(let T=0;T<m;T++){let E=X.createArrayBufferView(d,f.buffer,f.byteOffset+A,_);p==="SCALAR"?i[T]=E[0]:p==="VEC3"?i[T]=h.fromArray(E):p==="VEC4"&&(i[T]=ke.unpack(E)),A+=x}l(e.cacheKey)&&(zoe[n]=i)}return i};var Hoe={};function Wke(e,t,n){return`${e.cacheKey}//${t}/${n}`}function eT(e){this._spline=e,this._lastTimeIndex=0}eT.prototype.findTimeInterval=Eo.prototype.findTimeInterval;eT.prototype.evaluate=function(e,t){let n=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),i=this._spline.times,o=e>=i[n+1]?i[n+1]:i[n];return this._spline.evaluate(o,t)};Object.defineProperties(eT.prototype,{times:{get:function(){return this._spline.times}}});eT.prototype.wrapTime=function(e){return this._spline.wrapTime(e)};eT.prototype.clampTime=function(e){return this._spline.clampTime(e)};pO.getAnimationSpline=function(e,t,n,i,o,r,s,a){let c=Wke(e,t,i),u=Hoe[c];if(!l(u)){let f=r,d=a;f.length===1&&d.length===1?u=new FE(d[0]):(o.interpolation==="LINEAR"||o.interpolation==="STEP")&&(s==="translation"||s==="scale"?u=new v_({times:f,points:d}):s==="rotation"?u=new AS({times:f,points:d}):s==="weights"&&(u=new R3({times:f,weights:d})),l(u)&&o.interpolation==="STEP"&&(u=new eT(u))),l(e.cacheKey)&&(Hoe[c]=u)}return u};var Goe={};pO.getSkinInverseBindMatrices=function(e,t){let n=Woe(e,t),i=Goe[n];if(!l(i)){let o=e.gltfInternal,r=o.buffers,s=o.bufferViews,a=t.bufferView,c=s[a],u=c.buffer,d=r[u].extras._pipeline.source,p=t.componentType,_=t.type,m=t.count,x=Gs(o,t),C=c.byteOffset+t.byteOffset,A=Hs(_);if(i=new Array(m),p===Z.FLOAT&&_===Cn.MAT4)for(let T=0;T<m;++T){let E=X.createArrayBufferView(p,d.buffer,d.byteOffset+C,A);i[T]=O.fromArray(E),C+=x}Goe[n]=i}return i};var tT=pO;var jke={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},vr=Object.freeze(jke);var Da=Object.freeze({STOPPED:0,ANIMATING:1});function joe(e,t,n){this._name=n.name,this._startTime=ee.clone(e.startTime),this._delay=y(e.delay,0),this._stopTime=e.stopTime,this.removeOnStop=y(e.removeOnStop,!1),this._multiplier=y(e.multiplier,1),this._reverse=y(e.reverse,!1),this._loop=y(e.loop,vr.NONE),this._animationTime=e.animationTime,this._prevAnimationDelta=void 0,this.start=new xe,this.update=new xe,this.stop=new xe,this._state=Da.STOPPED,this._runtimeAnimation=n,this._computedStartTime=void 0,this._duration=void 0;let i=this;this._raiseStartEvent=function(){i.start.raiseEvent(t,i)},this._updateEventTime=0,this._raiseUpdateEvent=function(){i.update.raiseEvent(t,i,i._updateEventTime)},this._raiseStopEvent=function(){i.stop.raiseEvent(t,i)}}Object.defineProperties(joe.prototype,{name:{get:function(){return this._name}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}},animationTime:{get:function(){return this._animationTime}}});var Az=joe;function Tp(e){this.animationAdded=new xe,this.animationRemoved=new xe,this.animateWhilePaused=!1,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}Object.defineProperties(Tp.prototype,{length:{get:function(){return this._scheduledAnimations.length}}});function Tz(e,t,n){let i=e._model,r=i._runtime.animations[t],s=new Az(n,i,r);return e._scheduledAnimations.push(s),e.animationAdded.raiseEvent(i,s),s}Tp.prototype.add=function(e){e=y(e,y.EMPTY_OBJECT);let n=this._model._runtime.anim
void main()
{
#ifndef SHADOW_MAP
if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
#endif
czm_splitter_main();
}
`,t},addUniforms:function(t,n){n.czm_splitDirection=function(){return t.splitDirection}}},ky=tUe;var nUe=new h,ug=wn.ModelState,iUe="model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01",oUe=I.EPSILON16;function Fz(e,t){e._cachedGltf=t}function Rw(e){this._gltf=e.gltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}Object.defineProperties(Rw.prototype,{gltf:{set:function(e){this._gltf=e},get:function(){return this._gltf}}});Rw.prototype.makeReady=function(e){this.gltf=e;let t=this.modelsToLoad,n=t.length;for(let i=0;i<n;++i){let o=t[i];o.isDestroyed()||Fz(o,this)}this.modelsToLoad=void 0,this.ready=!0};var dg={},Koe={};function ra(e){e=y(e,y.EMPTY_OBJECT);let t=e.cacheKey;this._cacheKey=t,this._cachedGltf=void 0,this._releaseGltfJson=y(e.releaseGltfJson,!1);let n;if(l(t)&&l(dg[t])&&dg[t].ready)n=dg[t],++n.count;else{let s=e.gltf;if(l(s)){if(s instanceof ArrayBuffer&&(s=new Uint8Array(s)),s instanceof Uint8Array){let a=ag(s);n=new Rw({gltf:a,ready:!0})}else n=new Rw({gltf:e.gltf,ready:!0});n.count=1,l(t)&&(dg[t]=n)}}Fz(this,n);let i=y(e.basePath,"");this._resource=Fe.createIfNeeded(i);let o=e.credit;typeof o=="string"&&(o=new _n(o)),this._credit=o,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=y(e.showCreditsOnScreen,!1),this.show=y(e.show,!0),this.silhouetteColor=y(e.silhouetteColor,H.RED),this._silhouetteColor=new H,this._silhouetteColorPreviousAlpha=1,this._normalAttributeName=void 0,this.silhouetteSize=y(e.silhouetteSize,0),this.modelMatrix=O.clone(y(e.modelMatrix,O.IDENTITY)),this._modelMatrix=O.clone(this.modelMatrix),this._clampedModelMatrix=void 0,this.scale=y(e.scale,1),this._scale=this.scale,this.minimumPixelSize=y(e.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=e.maximumScale,this._maximumScale=this.maximumScale,this.id=e.id,this._id=e.id,this.heightReference=y(e.heightReference,et.NONE),this._heightReference=this.heightReference,this._heightChanged=!1,this._removeUpdateHeightCallback=void 0;let r=e.scene;this._scene=r,l(r)&&l(r.terrainProviderChanged)&&(this._terrainProviderChangedCallback=r.terrainProviderChanged.addEventListener(function(){this._heightChanged=!0},this)),this._pickObject=e.pickObject,this._allowPicking=y(e.allowPicking,!0),this._ready=!1,this._readyPromise=Es(),this.activeAnimations=new bz(this),this.clampAnimations=y(e.clampAnimations,!0),this._defaultTexture=void 0,this._incrementallyLoadTextures=y(e.incrementallyLoadTextures,!0),this._asynchronous=y(e.asynchronous,!0),this.shadows=y(e.shadows,vn.ENABLED),this._shadows=this.shadows,this.color=H.clone(y(e.color,H.WHITE)),this._colorPreviousAlpha=1,this.colorBlendMode=y(e.colorBlendMode,ia.HIGHLIGHT),this.colorBlendAmount=y(e.colorBlendAmount,.5),this._colorShadingEnabled=!1,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._clippingPlanesState=0,this.referenceMatrix=void 0,this.backFaceCulling=y(e.backFaceCulling,!0),this.showOutline=y(e.showOutline,!0),this.splitDirection=y(e.splitDirection,Os.NONE),this._splittingEnabled=!1,this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=y(e.debugWireframe,!1),this._debugWireframe=!1,this._distanceDisplayCondition=e.distanceDisplayCondition,this._addBatchIdToGeneratedShaders=e.addBatchIdToGeneratedShaders,this._precreatedAttributes=e.precreatedAttributes,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=y(e.ignoreCommands,!1),this._requestType=e.requestType,this._upAxis=y(e.upAxis,fi.Y),this._gltfForwardAxis=fi.Z,this._forwardAxis=e.forwardAxis,this.cull=y(e.cull,!0),this.opaquePass=y(e.opaquePass,Se.OPAQUE),this._computedModelMatrix=new O,this._clippingPlanesMatrix=O.clone(O.IDENTITY),this._iblReferenceFrameMatrix=Q.clone(Q.IDENTITY),this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new re,this._state=ug.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,th
uniform float gltf_colorBlend;
void main()
{
gltf_blend_main();
gl_FragColor.rgb = mix(gl_FragColor.rgb, gltf_color.rgb, gltf_colorBlend);
float highlight = ceil(gltf_colorBlend);
gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight);
gl_FragColor.a *= gltf_color.a;
}
`,e}function Bw(e,t,n){return l(n)&&(e=n(e,t)),e}var Gz=function(){this.programToCreate=void 0,this.model=void 0,this.context=void 0};Gz.prototype.set=function(e,t,n){this.programToCreate=e,this.model=t,this.context=n};Gz.prototype.execute=function(){hre(this.programToCreate,this.model,this.context)};function hre(e,t,n){let i=e.programId,o=e.techniqueId,r=t._sourcePrograms[i],s=t._rendererResources.sourceShaders,a=s[r.vertexShader],c=s[r.fragmentShader],u=t._quantizedVertexShaders;if(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader){let m=u[i];l(m)||(m=dre(a,i,t),u[i]=m),a=m}let f=Bw(a,i,t._vertexShaderLoaded),d=Bw(c,i,t._fragmentShaderLoaded);l(t._uniformMapLoaded)||(d=`uniform vec4 czm_pickColor;
${d}`);let p=t._imageBasedLighting,_=p.enabled;if(_&&(d=`#define USE_IBL_LIGHTING
${d}`),l(t._lightColor)&&(d=`#define USE_CUSTOM_LIGHT_COLOR
${d}`),(t._sourceVersion!=="2.0"||t._sourceKHRTechniquesWebGL)&&(d=je.replaceMain(d,"non_gamma_corrected_main"),d=`${d}
void main() {
non_gamma_corrected_main();
gl_FragColor = czm_gammaCorrect(gl_FragColor);
}
`),ju.isSupported(n)){let m=p.useSphericalHarmonicCoefficients,x=p.useSpecularEnvironmentMaps;(m||x||_)&&(d=`uniform mat3 gltf_iblReferenceFrameMatrix;
${d}`),l(p.sphericalHarmonicCoefficients)?d=`#define DIFFUSE_IBL
#define CUSTOM_SPHERICAL_HARMONICS
uniform vec3 gltf_sphericalHarmonicCoefficients[9];
${d}`:p.useDefaultSphericalHarmonics&&(d=`#define DIFFUSE_IBL
${d}`),l(p.specularEnvironmentMapAtlas)&&p.specularEnvironmentMapAtlas.ready?d=`#define SPECULAR_IBL
#define CUSTOM_SPECULAR_IBL
uniform sampler2D gltf_specularMap;
uniform vec2 gltf_specularMapSize;
uniform float gltf_maxSpecularLOD;
${d}`:p.useDefaultSpecularMaps&&(d=`#define SPECULAR_IBL
${d}`)}l(p.luminanceAtZenith)&&(d=`#define USE_SUN_LUMINANCE
uniform float gltf_luminanceAtZenith;
${d}`),mre(i,o,d,f,t,n)}function SUe(e,t,n){let i=e.programId,o=e.techniqueId,r=t._sourcePrograms[i],s=t._rendererResources.sourceShaders,a=t._quantizedVertexShaders,c=t.clippingPlanes,u=kz(t),f=s[r.vertexShader],d=s[r.fragmentShader];(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader)&&(f=a[i]);let p=d;Vz(t)&&(p=ra._modifyShaderForColor(p)),u&&(p=D4e(p,c,n)),t.splitDirection!==Os.NONE&&(p=ky.modifyFragmentShader(p));let _=Bw(f,i,t._vertexShaderLoaded),m=Bw(p,i,t._fragmentShaderLoaded);l(t._uniformMapLoaded)||(m=`uniform vec4 czm_pickColor;
${m}`);let x=t._imageBasedLighting,C=x.enabled;if(C&&(m=`#define USE_IBL_LIGHTING
${m}`),l(t._lightColor)&&(m=`#define USE_CUSTOM_LIGHT_COLOR
${m}`),(t._sourceVersion!=="2.0"||t._sourceKHRTechniquesWebGL)&&(m=je.replaceMain(m,"non_gamma_corrected_main"),m=`${m}
void main() {
non_gamma_corrected_main();
gl_FragColor = czm_gammaCorrect(gl_FragColor);
}
`),ju.isSupported(n)){let A=x.useSphericalHarmonicCoefficients,T=x.useSpecularEnvironmentMaps;(A||T||C)&&(m=`uniform mat3 gltf_iblReferenceFrameMatrix;
${m}`),l(x.sphericalHarmonicCoefficients)?m=`#define DIFFUSE_IBL
#define CUSTOM_SPHERICAL_HARMONICS
uniform vec3 gltf_sphericalHarmonicCoefficients[9];
${m}`:x.useDefaultSphericalHarmonics&&(m=`#define DIFFUSE_IBL
${m}`),l(x.specularEnvironmentMapAtlas)&&x.specularEnvironmentMapAtlas.ready?m=`#define SPECULAR_IBL
#define CUSTOM_SPECULAR_IBL
uniform sampler2D gltf_specularMap;
uniform vec2 gltf_specularMapSize;
uniform float gltf_maxSpecularLOD;
${m}`:x.useDefaultSpecularMaps&&(m=`#define SPECULAR_IBL
${m}`)}l(x.luminanceAtZenith)&&(m=`#define USE_SUN_LUMINANCE
uniform float gltf_luminanceAtZenith;
${m}`),mre(i,o,m,_,t,n)}function mre(e,t,n,i,o,r){let s=o._sourceTechniques[t],a=wn.createAttributeLocations(s,o._precreatedAttributes);o._rendererResources.programs[e]=gn.fromCache({context:r,vertexShaderSource:i,fragmentShaderSource:n,attributeLocations:a})}var Joe=new Gz;function wUe(e,t){let n=e._loadResources,i=n.programsToCreate;if(n.pendingShaderLoads!==0||n.pendingBufferLoads!==0)return;let o=t.context;if(e.asynchronous)for(;i.length>0&&(Joe.set(i.peek(),e,o),!!t.jobScheduler.execute(Joe,Is.PROGRAM));)i.dequeue();else for(;i.length>0;)hre(i.dequeue(),e,o)}function vUe(e,t){return function(n){e.texturesToCreate.enqueue({id:t.id,image:n,bufferView:void 0}),--e.pendingBufferViewToImage}}function DUe(e){let t=e._loadResources;if(t.pendingBufferLoads===0)for(;t.texturesToCreateFromBufferView.length>0;){let n=t.texturesToCreateFromBufferView.dequeue(),i=e.gltfInternal,o=i.bufferViews[n.bufferView],r=i.textures[n.id].source,s=wn.getFailedLoadFunction(e,"image",`id: ${n.id}, bufferView: ${n.bufferView}`);if(n.mimeType==="image/ktx2"){let a=new Uint8Array(t.getBuffer(o));Mc(a).then(lre(e,n.id,r)).catch(s),++e._loadResources.pendingTextureLoads}else{let a=vUe(t,n);J0({uint8Array:t.getBuffer(o),format:n.mimeType,flipY:!1,skipColorSpaceConversion:!0}).then(a).catch(s),++t.pendingBufferViewToImage}}}function PUe(e){let t=e._loadResources;if(t.createSamplers){t.createSamplers=!1;let n=e._rendererResources.samplers;we.sampler(e.gltfInternal,function(i,o){n[o]=new Nn({wrapS:i.wrapS,wrapT:i.wrapT,minificationFilter:i.minFilter,magnificationFilter:i.magFilter})})}}var Wz=function(){this.gltfTexture=void 0,this.model=void 0,this.context=void 0};Wz.prototype.set=function(e,t,n){this.gltfTexture=e,this.model=t,this.context=n};Wz.prototype.execute=function(){pre(this.gltfTexture,this.model,this.context)};function pre(e,t,n){let o=t.gltfInternal.textures[e.id],s=t._rendererResources.samplers[o.sampler];l(s)||(s=new Nn({wrapS:Gn.REPEAT,wrapT:Gn.REPEAT}));let a=!1,c=t.gltfInternal.materials,u=c.length;for(let E=0;E<u;++E){let S=c[E];if(l(S.extensions)&&l(S.extensions.KHR_techniques_webgl)){let w=S.extensions.KHR_techniques_webgl.values;for(let D in w)if(w.hasOwnProperty(D)&&D.indexOf("Texture")!==-1){let R=w[D];if(R.index===e.id&&l(R.extensions)&&l(R.extensions.KHR_texture_transform)){a=!0;break}}}if(a)break}let f=s.wrapS,d=s.wrapT,p=s.minificationFilter;a&&p!==tn.LINEAR&&p!==tn.NEAREST&&(p===tn.NEAREST_MIPMAP_NEAREST||p===tn.NEAREST_MIPMAP_LINEAR?p=tn.NEAREST:p=tn.LINEAR,s=new Nn({wrapS:s.wrapS,wrapT:s.wrapT,minificationFilter:p,magnificationFilter:s.magnificationFilter}));let _=e.internalFormat,m=!(l(_)&&It.isCompressedFormat(_))&&(p===tn.NEAREST_MIPMAP_NEAREST||p===tn.NEAREST_MIPMAP_LINEAR||p===tn.LINEAR_MIPMAP_NEAREST||p===tn.LINEAR_MIPMAP_LINEAR),x=m||f===Gn.REPEAT||f===Gn.MIRRORED_REPEAT||d===Gn.REPEAT||d===Gn.MIRRORED_REPEAT,C,A,T=e.image;if(l(_)){C=!I.isPowerOfTwo(e.width)||!I.isPowerOfTwo(e.height),!n.webgl2&&It.isCompressedFormat(_)&&C&&x&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly. See the Model.js constructor documentation for more information.");let E=s.minificationFilter;!l(e.mipLevels)&&(p===tn.NEAREST_MIPMAP_NEAREST||p===tn.NEAREST_MIPMAP_LINEAR)?E=tn.NEAREST:!l(e.mipLevels)&&(p===tn.LINEAR_MIPMAP_NEAREST||p===tn.LINEAR_MIPMAP_LINEAR)&&(E=tn.LINEAR),s=new Nn({wrapS:s.wrapS,wrapT:s.wrapT,minificationFilter:E,magnificationFilter:s.magnificationFilter}),A=new Zt({context:n,source:{arrayBufferView:e.bufferView,mipLevels:e.mipLevels},width:e.width,height:e.height,pixelFormat:_,sampler:s})}else if(l(T)){if(C=!I.isPowerOfTwo(T.width)||!I.isPowerOfTwo(T.height),x&&C){let E=document.createElement("canvas");E.width=I.nextPowerOfTwo(T.width),E.height=I.nextPowerOfTwo(T.height),E.getContext("2d").drawImage(T,0,0,T.width,T.height,0,0,E.width,E.height),T=E}A=new Zt({context:n,source:T,pixelFormat:o.internalFormat,pixelDatatype:o.type,sampler:s,flipY:!1,skipColorSpaceConversion:!0}),m&&A.generateMipmap()}l(A)&&(t._render
void main()
{
gltf_silhouette_main();
vec3 n = normalize(czm_normal3D * ${r});
n.x *= czm_projection[0][0];
n.y *= czm_projection[1][1];
vec4 clip = gl_Position;
clip.xy += n.xy * clip.w * gltf_silhouetteSize * czm_pixelRatio / czm_viewport.z;
gl_Position = clip;
}`;let s=`uniform vec4 gltf_silhouetteColor;
void main()
{
gl_FragColor = czm_gammaCorrect(gltf_silhouetteColor);
}`;return gn.fromCache({context:n.context,vertexShaderSource:i,fragmentShaderSource:s,attributeLocations:o})}function xre(e,t){return are(t.context)&&e.silhouetteSize>0&&e.silhouetteColor.alpha>0&&l(e._normalAttributeName)}function S4e(e){let t=e._nodeCommands,n=t.length;for(let i=0;i<n;++i)if(t[i].command.pass===Se.TRANSLUCENT)return!0;return!1}function Lz(e){return e.color.alpha>0&&e.color.alpha<1}function Cre(e){return e.color.alpha===0}function rre(e,t){return Math.floor(e)!==Math.floor(t)||Math.ceil(e)!==Math.ceil(t)}var w4e=0;function v4e(e,t){let n=++w4e%255,i=S4e(e)||Lz(e)||e.silhouetteColor.alpha<1,o=e._rendererResources.silhouettePrograms,r=t.scene3DOnly,s=e._nodeCommands,a=s.length;for(let c=0;c<a;++c){let u=s[c],f=u.command,d=Lz(e)?u.translucentCommand:f,p=pt.shallowClone(d),_=mt(d.renderState);_.stencilTest={enabled:!0,frontFunction:Z.ALWAYS,backFunction:Z.ALWAYS,reference:n,mask:-1,frontOperation:{fail:Z.KEEP,zFail:Z.KEEP,zPass:Z.REPLACE},backOperation:{fail:Z.KEEP,zFail:Z.KEEP,zPass:Z.REPLACE}},Cre(e)&&(_.colorMask={red:!1,green:!1,blue:!1,alpha:!1},_.depthMask=!1),_=Ze.fromCache(_),p.renderState=_,u.silhouetteModelCommand=p;let m=pt.shallowClone(f);_=mt(f.renderState,!0),_.depthTest.enabled=!0,_.cull.enabled=!1,i&&(m.pass=Se.TRANSLUCENT,_.depthMask=!1,_.blending=Hn.ALPHA_BLEND),_.stencilTest={enabled:!0,frontFunction:Z.NOTEQUAL,backFunction:Z.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:Z.KEEP,zFail:Z.KEEP,zPass:Z.KEEP},backOperation:{fail:Z.KEEP,zFail:Z.KEEP,zPass:Z.KEEP}},_=Ze.fromCache(_);let x=f.shaderProgram,C=b4e(e,x),A=o[C];l(A)||(A=E4e(e,x,t),o[C]=A);let T=Dt(f.uniformMap,{gltf_silhouetteColor:YUe(e),gltf_silhouetteSize:XUe(e)});if(m.renderState=_,m.shaderProgram=A,m.uniformMap=T,m.castShadows=!1,m.receiveShadows=!1,u.silhouetteColorCommand=m,!r){let E=u.command2D,S=pt.shallowClone(p);S.boundingVolume=E.boundingVolume,S.modelMatrix=E.modelMatrix,u.silhouetteModelCommand2D=S;let w=pt.shallowClone(m);S.boundingVolume=E.boundingVolume,S.modelMatrix=E.modelMatrix,u.silhouetteColorCommand2D=w}}}function D4e(e,t,n){return e=je.replaceMain(e,"gltf_clip_main"),e+=`${ra._getClippingFunction(t,n)}
`,e+=`uniform highp sampler2D gltf_clippingPlanes;
uniform mat4 gltf_clippingPlanesMatrix;
uniform vec4 gltf_clippingPlanesEdgeStyle;
void main()
{
gltf_clip_main();
${Pw("gltf_clippingPlanes","gltf_clippingPlanesMatrix","gltf_clippingPlanesEdgeStyle")}}
`,e}function Are(e,t,n){if(!xre(e,t))return;let i=e._nodeCommands,o=i.length>0&&(rre(e.color.alpha,e._colorPreviousAlpha)||rre(e.silhouetteColor.alpha,e._silhouetteColorPreviousAlpha)||!l(i[0].silhouetteModelCommand));e._colorPreviousAlpha=e.color.alpha,e._silhouetteColorPreviousAlpha=e.silhouetteColor.alpha,(o||n)&&v4e(e,t)}function P4e(e,t){let n=e._clippingPlanes;l(n)&&n.owner===e&&n.enabled&&n.update(t)}var Bz=new re;function I4e(e,t,n){return Bz.center=e,Bz.radius=t,n.camera.getPixelSize(Bz,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}var oa=new h,Ow=new _e;function O4e(e,t){let n=e.scale;if(e.minimumPixelSize!==0){let i=t.context,o=Math.max(i.drawingBufferWidth,i.drawingBufferHeight),r=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;if(oa.x=r[12],oa.y=r[13],oa.z=r[14],l(e._rtcCenter)&&h.add(e._rtcCenter,oa,oa),e._mode!==te.SCENE3D){let f=t.mapProjection,d=f.ellipsoid.cartesianToCartographic(oa,Ow);f.project(d,oa),h.fromElements(oa.z,oa.x,oa.y,oa)}let s=e.boundingSphereInternal.radius,a=I4e(oa,s,t),c=1/a;Math.min(c*(2*s),o)<e.minimumPixelSize&&(n=e.minimumPixelSize*a/(2*e._initialRadius))}return l(e.maximumScale)?Math.min(e.maximumScale,n):n}function Tre(e){l(e._cacheKey)&&l(e._cachedGltf)&&--e._cachedGltf.count===0&&delete dg[e._cacheKey],e._cachedGltf=void 0}function Nz(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.sourceShaders=void 0,this.silhouettePrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function fg(e){for(let t in e)e.hasOwnProperty(t)&&e[t].destroy()}function R4e(e){fg(e.buffers),fg(e.vertexArrays),fg(e.programs),fg(e.silhouettePrograms),fg(e.textures)}Nz.prototype.release=function(){if(--this.count===0)return l(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],R4e(this),fe(this)};function sre(e,t,n){return function(i){if(e.heightReference===et.RELATIVE_TO_GROUND){let r=t.cartesianToCartographic(i,Ow);r.height+=n.height,t.cartographicToCartesian(r,i)}let o=e._clampedModelMatrix;O.clone(e.modelMatrix,o),o[12]=i.x,o[13]=i.y,o[14]=i.z,e._heightChanged=!0}}function M4e(e){l(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);let t=e._scene;if(!l(t)||!l(t.globe)||e.heightReference===et.NONE){e._clampedModelMatrix=void 0;return}let n=t.globe,i=n.ellipsoid,o=e.modelMatrix;oa.x=o[12],oa.y=o[13],oa.z=o[14];let r=i.cartesianToCartographic(oa);l(e._clampedModelMatrix)||(e._clampedModelMatrix=O.clone(o,new O));let s=n._surface;e._removeUpdateHeightCallback=s.updateHeight(r,sre(e,i,r));let a=n.getHeight(r);if(l(a)){let c=sre(e,i,r);_e.clone(r,Ow),Ow.height=a,i.cartographicToCartesian(Ow,oa),c(oa)}}var B4e=new h,L4e=new _e;function N4e(e,t){let n,i=e.distanceDisplayCondition,o=i.near*i.near,r=i.far*i.far;if(t.mode===te.SCENE2D)n=(t.camera.frustum.right-t.camera.frustum.left)*.5,n=n*n;else{let s=O.getTranslation(e.modelMatrix,B4e);if(t.mode===te.COLUMBUS_VIEW){let a=t.mapProjection,u=a.ellipsoid.cartesianToCartographic(s,L4e);s=a.project(u,s),h.fromElements(s.z,s.x,s.y,s)}n=h.distanceSquared(s,t.camera.positionWC)}return n>=o&&n<=r}var F4e=new O,V4e=new Q,k4e=new O;ra.prototype.update=function(e){if(e.mode===te.MORPHING)return;if(!Kt.supportsWebP.initialized){Kt.supportsWebP.initialize();return}let t=e.context;this._defaultTexture=t.defaultTexture;let n=Kt.supportsWebP();if(this._state===ug.NEEDS_LOAD&&l(this.gltfInternal)){let A,T=this.cacheKey;if(l(T)){t.cache.modelRendererResourceCache=y(t.cache.modelRendererResourceCache,{});let E=t.cache.modelRendererResourceCache;if(A=E[this.cacheKey],l(A)){if(!A.ready)return;++A.count,this._loadRendererResourcesFromCache=!0}else A=new Nz(t,T),A.count=1,E[this.cacheKey]=A;this._cachedRendererResources=A}else A=new Nz(t),A.count=1,this._cachedRendererResources=A;if(this._state=ug.LOADING,this._state!==ug.FAILED){let E=this.gltfInternal.extensions;if(l(E)&&l(E.CESIUM_RTC)){let S=h.fromArray(E.CESIUM_RTC.center);if(!h.equals(S,h.ZERO)){this._rtcCen
${t.message}`);let n=new he(e);return l(t)&&(n.stack=`Original stack:
${t.stack}
Handler stack:
${n.stack}`),n};zi.prototype.isDestroyed=function(){return!1};zi.prototype.destroy=function(){return this.unload(),fe(this)};var Pze={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},un=Object.freeze(Pze);function Cl(e){e=y(e,y.EMPTY_OBJECT);let t=e.typedArray,n=e.resource,i=e.cacheKey;this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=un.UNLOADED,this._promise=void 0}l(Object.create)&&(Cl.prototype=Object.create(zi.prototype),Cl.prototype.constructor=Cl);Object.defineProperties(Cl.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});Cl.prototype.load=function(){return l(this._typedArray)?this._promise=Promise.resolve(this):this._promise=Ize(this),this._promise};function Ize(e){let t=e._resource;return e._state=un.LOADING,Cl._fetchArrayBuffer(t).then(function(n){if(!e.isDestroyed())return e._typedArray=new Uint8Array(n),e._state=un.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=un.FAILED;let i=`Failed to load external buffer: ${t.url}`;return Promise.reject(e.getError(i,n))})}Cl._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};Cl.prototype.unload=function(){this._typedArray=void 0};var $wn=function(){"use strict";var e="B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gIUUUEU9gVUUUUUB9gLUUUUB9gD99UE99Ie8aDILEVOLEVLRRRRRWWVBOOBEdddLVE9wEIIVIEBEOWEUEC+Q/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBO8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBRe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBWA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBdl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBQk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBKl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBXe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBZA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBhL79iv9rBodWEBCEKDqxQ+f9Q8aDBK/EpE8jU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrBJ+KJJBC+gEv86BBAVCJDFCBCJDZnJJJB8aDNAItMBAVCJDFADALZ+TJJJB8aKABAEFHRABCEFHEAVALFCBCBCJDAL9rALCfE0eZnJJJB8aAVAVCJDFALZ+TJJJBHWCJ/ABAL9uHODNAItMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAWCJLFCBCJDZnJJJB8aAdAIAQ9rAQAdFAI6eHKADAQAL2FHXDNALtMBAKCSFGOC9wgHMAOCL4CIFCD4HpCBHSAXHZAEHhINDNAKtMBAWASFrBBHoCBHEAZHOINAWCJLFAEFAOrBBGaAo9rGoCETAoCkTCk91CR4786BBAOALFHOAaHoAECEFGEAK9HMBKKDNARAh9rAp6MBAhCBApZnJJJBGcApFHEDNAMtMBCBHxAWCJLFHqINARAE9rCk6MDAWCJLFAxFGlrBDHoCUHODNAlrBEGaAlrBBGkvCfEgMBCBHaAoCfEgMBCBHoDNAlrBIMBAlrBLMBAlrBVMBAlrBOMBAlrBRMBAlrBWMBAlrBdMBAlrBQMBAlrBKMBAlrBXMBAlrBMMBCBHaAlrBpMECBHoCUCBAlrBSeHOKCBHaKDNDNDNDNCLCDCECWAOCZ6GheAkCfEgGkCD0CLvAaCfEgGaCD0FAoCfEgGoCD0FAlrBIGyCD0FAlrBLG8aCD0FAlrBVGeCD0FAlrBOG3CD0FAlrBRG5CD0FAlrBWG8eCD0FAlrBdG8fCD0FAlrBQGACD0FAlrBKGHCD0FAlrBXGGCD0FAlrBMG8jCD0FAlrBpG8kCD0FAlrBSG8lCD0FG8mAOCZAheG8n6GOeAkCp0CWvAaCp0FAoCp0FAyCp0FA8aCp0FAeCp0FA3Cp0FA5Cp0FA8eCp0FA8fCp0FAACp0FAHCp0FAGCp0FA8jCp0FA8kCp0FA8lCp0FA8mA8nAOe6GoeGyCUFpDIEBKAcAxCO4FGaAarBBCDCIAoeAxCI4COgTv86BBAyCW9HMEAEAl8pBB83BBAECWFAlCWF8pBB83BBAECZFHEXDKAcAxCO4FGaAarBBCEAxCI4COgTv86BBKCDCLCWCEAheAOeAoeH8aCUAyTCU7HaCBH5AqHeINAEH3A8aHoAeHECBHOINAErBBGhAaAhAaCfEgGk6eAOCfEgAyTvHOAECEFHEAoCUFGoMBKA3AO86BBAeA8aFHeA3CEFHEA5A8aFG5CZ6MBKDNAlrBBGOAk6MBA3AO86BEA3CDFHEKDNAlrBEGOAk6MBAEAO86BBAECEFHEKDNAlrBDGOAk6MBAEAO86BBAECEFHEKDNAlrBIGOAk6MBAEAO86BBAECEFHEKDNAlrBLGOAk6MBAEAO86BBAECEFHEKDNAlrBVGOAk6MBAEAO86BBAECEFHEKDNAlrBOGOAk6MBAEAO86BBAECEFHEKDNAlrBRGOAk6MBAEAO86BBAECEFHEKDNAlrBWGOAk6MBAEAO86BBAECEFHEKDNAlrBdGOAk6MBAEAO86BBAECEFHEKDNAlrBQGOAk6MBAEAO86BBAECEFHEKDNAlrBKGOAk6MBAEAO86BBAECEFHEKDNAlrBXGOAk6MBAEAO86BBAECEFHEKDNAlrBMGOAk6MBAEAO86BBAECEFHEKDNAlrBpGOAk6MBAEAO86BBAECEFHEKAlrBSGOAk6MBAEAO86BBAECEFHEKAqCZFHqAxCZFGxAM6MBKKAEtMBAZCEFHZAEHhASCEFGSALsMDXEKKCBHOXIKAWAXAKCUFAL2FALZ+TJJJB8aAKAQFGQAI6MBKKCBHOARAE9rCAALALCA6e6MBDNALC8f0MBAECBCAAL9rGOZnJJJBAOFHEKAEAWCJDFALZ+TJJJBALFAB9rH
`,a+=`czm_instanced_modelViewProjection = czm_projection * czm_instanced_modelView;
`):m==="MODELVIEWINVERSETRANSPOSE"&&(x="czm_instanced_modelViewInverseTranspose",s+=`mat3 czm_instanced_modelViewInverseTranspose;
`,a+=`czm_instanced_modelViewInverseTranspose = mat3(czm_instanced_modelView);
`);let C=new RegExp(`uniform.*${_}.*`);r=r.replace(C,""),C=new RegExp(`${_}\\b`,"g"),r=r.replace(C,x)}let c=`uniform mat4 czm_instanced_modifiedModelView;
uniform mat4 czm_instanced_nodeTransform;
`,u,f,d;o?(u=`attribute float a_batchId;
`,f="",d=""):(u="",f=`attribute vec4 pickColor;
varying vec4 v_pickColor;
`,d=` v_pickColor = pickColor;
`);let p=`${c+s}mat4 czm_instanced_modelView;
attribute vec4 czm_modelMatrixRow0;
attribute vec4 czm_modelMatrixRow1;
attribute vec4 czm_modelMatrixRow2;
${u}${f}${r}void main()
{
mat4 czm_instanced_model = mat4(czm_modelMatrixRow0.x, czm_modelMatrixRow1.x, czm_modelMatrixRow2.x, 0.0, czm_modelMatrixRow0.y, czm_modelMatrixRow1.y, czm_modelMatrixRow2.y, 0.0, czm_modelMatrixRow0.z, czm_modelMatrixRow1.z, czm_modelMatrixRow2.z, 0.0, czm_modelMatrixRow0.w, czm_modelMatrixRow1.w, czm_modelMatrixRow2.w, 1.0);
czm_instanced_modelView = czm_instanced_modifiedModelView * czm_instanced_model * czm_instanced_nodeTransform;
${a} czm_instancing_main();
${d}}
`;if(o){let _=e._model.gltfInternal,m=wn.getDiffuseAttributeOrUniform(_,n);p=e._batchTable.getVertexShaderCallback(!0,"a_batchId",m)(p)}return p}}function c8e(e){return function(t,n){let i=e._batchTable;if(l(i)){let o=e._model.gltfInternal,r=wn.getDiffuseAttributeOrUniform(o,n);t=i.getFragmentShaderCallback(!0,r,!1)(t)}else t=`varying vec4 v_pickColor;
${t}`;return t}}function l8e(e,t){return function(){return O.multiply(t.uniformState.view,e._rtcTransform,e._rtcModelView)}}function u8e(e){return function(){return e.computedMatrix}}function f8e(e,t){return function(n,i,o){n=mt(n),n.czm_instanced_modifiedModelView=l8e(e,t),n.czm_instanced_nodeTransform=u8e(o);let r=use(e,i);for(let s in r)r.hasOwnProperty(s)&&delete n[s];return l(e._batchTable)&&(n=e._batchTable.getUniformMapCallback()(n)),n}}function d8e(e){return function(t,n){if(l(e._batchTable)){let i=e._model.gltfInternal,o=wn.getDiffuseAttributeOrUniform(i,n);t=e._batchTable.getVertexShaderCallback(!0,"a_batchId",o)(t),t=`uniform float a_batchId
;${t}`}return t}}function h8e(e){return function(t,n){let i=e._batchTable;if(l(i)){let o=e._model.gltfInternal,r=wn.getDiffuseAttributeOrUniform(o,n);t=i.getFragmentShaderCallback(!0,r,!1)(t)}else t=`uniform vec4 czm_pickColor;
${t}`;return t}}function m8e(e){return function(t){return l(e._batchTable)&&(t=e._batchTable.getUniformMapCallback()(t)),t}}function fse(e){let t=e._instances,n=e.length,i=e._center,o=12,r=e._vertexBufferTypedArray;l(r)||(r=new Float32Array(n*o)),e._dynamic&&(e._vertexBufferTypedArray=r);for(let s=0;s<n;++s){let a=t[s]._modelMatrix,c=O.clone(a,dH);c[12]-=i.x,c[13]-=i.y,c[14]-=i.z;let u=s*o;r[u+0]=c[0],r[u+1]=c[4],r[u+2]=c[8],r[u+3]=c[12],r[u+4]=c[1],r[u+5]=c[5],r[u+6]=c[9],r[u+7]=c[13],r[u+8]=c[2],r[u+9]=c[6],r[u+10]=c[10],r[u+11]=c[14]}return r}function p8e(e,t){let n,i=e._instances,o=e.length,r=e._dynamic,s=l(e._batchTable);if(s){let c=new Uint16Array(o);for(n=0;n<o;++n)c[n]=i[n]._instanceId;e._batchIdBuffer=Pt.createVertexBuffer({context:t,typedArray:c,usage:We.STATIC_DRAW})}if(!s){let c=new Uint8Array(o*4);for(n=0;n<o;++n){let f=e._pickIds[n].color,d=n*4;c[d]=H.floatToByte(f.red),c[d+1]=H.floatToByte(f.green),c[d+2]=H.floatToByte(f.blue),c[d+3]=H.floatToByte(f.alpha)}e._pickIdBuffer=Pt.createVertexBuffer({context:t,typedArray:c,usage:We.STATIC_DRAW})}let a=fse(e);e._vertexBuffer=Pt.createVertexBuffer({context:t,typedArray:a,usage:r?We.STREAM_DRAW:We.STATIC_DRAW})}function _8e(e){let t=fse(e);e._vertexBuffer.copyFromArrayView(t)}function g8e(e,t){let n=e._instances,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createPickId(n[r]);return o}function y8e(e,t){let n=e._instancingSupported;n||Ui("cpuModelInstancing","Support for rendering instanced models on the CPU has been deprecated and will be removed in CesiumJS 1.97.");let i=l(e._batchTable),o=e._allowPicking,r={url:e._url,requestType:e._requestType,gltf:e._gltf,basePath:e._basePath,shadows:e._shadows,cacheKey:void 0,asynchronous:e._asynchronous,allowPicking:o,incrementallyLoadTextures:e._incrementallyLoadTextures,upAxis:e._upAxis,forwardAxis:e._forwardAxis,precreatedAttributes:void 0,vertexShaderLoaded:void 0,fragmentShaderLoaded:void 0,uniformMapLoaded:void 0,pickIdLoaded:e._pickIdLoaded,ignoreCommands:!0,opaquePass:e._opaquePass,imageBasedLighting:e._imageBasedLighting,showOutline:e.showOutline,showCreditsOnScreen:e.showCreditsOnScreen};if(i||(e._pickIds=g8e(e,t)),n){p8e(e,t);let s=12,a=X.getSizeInBytes(X.FLOAT),c={czm_modelMatrixRow0:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:X.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:a*s,instanceDivisor:1},czm_modelMatrixRow1:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:X.FLOAT,normalize:!1,offsetInBytes:a*4,strideInBytes:a*s,instanceDivisor:1},czm_modelMatrixRow2:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:X.FLOAT,normalize:!1,offsetInBytes:a*8,strideInBytes:a*s,instanceDivisor:1}};i&&(c.a_batchId={index:0,vertexBuffer:e._batchIdBuffer,componentsPerAttribute:1,componentDatatype:X.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),i||(c.pickColor={index:0,vertexBuffer:e._pickIdBuffer,componentsPerAttribute:4,componentDatatype:X.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),r.precreatedAttributes=c,r.vertexShaderLoaded=a8e(e),r.fragmentShaderLoaded=c8e(e),r.uniformMapLoaded=f8e(e,t),l(e._url)&&(r.cacheKey=`${e._url.getUrlComponent()}#instanced`)}else r.vertexShaderLoaded=d8e(e),r.fragmentShaderLoaded=h8e(e),r.uniformMapLoaded=m8e(e,t);l(e._url)?e._model=hg.fromGltf(r):e._model=new hg(r)}function x8e(e,t){if(e._debugWireframe!==e.debugWireframe||t){e._debugWireframe=e.debugWireframe;let n=e.debugWireframe?He.LINES:He.TRIANGLES,i=e._drawCommands,o=i.length;for(let r=0;r<o;++r)i[r].primitiveType=n}}function C8e(e){let t=mt(e,!0);return t.cull.enabled=!1,Ze.fromCache(t)}function A8e(e,t){if(e._backFaceCulling!==e.backFaceCulling||t){e._backFaceCulling=e.backFaceCulling;let n=e._drawCommands,i=n.length,o;if(!l(e._disableCullingRenderStates))for(e._disableCullingRenderStates=new Array(i),e._renderStates=new Array(i),o=0;o<i;++o){let r=n[o].renderState,s=C8e(r);e._disableCullingRenderStates[o]=s,e._renderStates[o]=r}for(o=0;o<i;++o)n[o].renderState=e._
`));let n=/czm_3dtiles_builtin_property_(\w+)/g,i=n.exec(e);for(;i!==null;){let o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function yH(e,t){let n=e.numberOfAttributes;for(let i=0;i<n;++i){let o=e.getAttribute(i);if(o.index===t)return o}}var J8e={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function Q8e(e,t,n){let i,o,r,s=t.context,a=l(n),c=e._isQuantized,u=e._isQuantizedDraco,f=e._isOctEncoded16P,d=e._isOctEncodedDraco,p=e._isRGB565,_=e._isTranslucent,m=e._hasColors,x=e._hasNormals,C=e._hasBatchIds,A=e._backFaceCulling,T=e._normalShading,E=e._drawCommand.vertexArray,S=e.clippingPlanes,w=e._attenuation,D,R,M,L=_,N=mt(J8e),g={},b=e._styleableShaderAttributes;for(o in b)b.hasOwnProperty(o)&&(r=b[o],N[o]=`czm_3dtiles_property_${r.location}`,g[r.location]=r);if(a){let oe={translucent:!1},le="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";D=n.getColorShaderFunction(`getColorFromStyle${le}`,N,oe),R=n.getShowShaderFunction(`getShowFromStyle${le}`,N,oe),M=n.getPointSizeShaderFunction(`getPointSizeFromStyle${le}`,N,oe),l(D)&&oe.translucent&&(L=!0)}e._styleTranslucent=L;let v=l(D),P=l(R),B=l(M),F=e.isClipped,k=[],U=[];v&&(_H(D,k),gH(D,U)),P&&(_H(R,k),gH(R,U)),B&&(_H(M,k),gH(M,U));let z=U.indexOf("COLOR")>=0,V=U.indexOf("NORMAL")>=0;if(V&&!x)throw new he("Style references the NORMAL semantic but the point cloud does not have normals");for(o in b)if(b.hasOwnProperty(o)){r=b[o];let oe=k.indexOf(r.location)>=0,le=yH(E,r.location);le.enabled=oe}let Y=m&&(!v||z);if(m){let oe=yH(E,PO);oe.enabled=Y}let j=x&&(T||A||V);if(x){let oe=yH(E,xH);oe.enabled=j}let $={a_position:yse};Y&&($.a_color=PO),j&&($.a_normal=xH),C&&($.a_batchId=xse);let G="",K=k.length;for(i=0;i<K;++i){let oe=k[i];r=g[oe];let le=r.componentCount,ge=`czm_3dtiles_property_${oe}`,De;le===1?De="float":De=`vec${le}`,G+=`attribute ${De} ${ge};
`,$[ge]=r.location}Z8e(e,t);let J=`attribute vec3 a_position;
varying vec4 v_color;
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
uniform vec4 u_constantColor;
uniform vec4 u_highlightColor;
`;J+=`float u_pointSize;
float tiles3d_tileset_time;
`,w&&(J+=`float u_geometricError;
float u_depthMultiplier;
`),J+=G,Y&&(_?J+=`attribute vec4 a_color;
`:p?J+=`attribute float a_color;
const float SHIFT_RIGHT_11 = 1.0 / 2048.0;
const float SHIFT_RIGHT_5 = 1.0 / 32.0;
const float SHIFT_LEFT_11 = 2048.0;
const float SHIFT_LEFT_5 = 32.0;
const float NORMALIZE_6 = 1.0 / 64.0;
const float NORMALIZE_5 = 1.0 / 32.0;
`:J+=`attribute vec3 a_color;
`),j&&(f||d?J+=`attribute vec2 a_normal;
`:J+=`attribute vec3 a_normal;
`),C&&(J+=`attribute float a_batchId;
`),(c||u||d)&&(J+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange;
`),v&&(J+=D),P&&(J+=R),B&&(J+=M),J+=`void main()
{
u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x;
tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y;
`,w&&(J+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z;
u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w;
`),Y?_?J+=` vec4 color = a_color;
`:p?J+=` float compressed = a_color;
float r = floor(compressed * SHIFT_RIGHT_11);
compressed -= r * SHIFT_LEFT_11;
float g = floor(compressed * SHIFT_RIGHT_5);
compressed -= g * SHIFT_LEFT_5;
float b = compressed;
vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5);
vec4 color = vec4(rgb, 1.0);
`:J+=` vec4 color = vec4(a_color, 1.0);
`:J+=` vec4 color = u_constantColor;
`,c||u?J+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz;
`:J+=` vec3 position = a_position;
`,J+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0));
`,j?(f?J+=` vec3 normal = czm_octDecode(a_normal);
`:d?J+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy;
`:J+=` vec3 normal = a_normal;
`,J+=` vec3 normalEC = czm_normal * normal;
`):J+=` vec3 normal = vec3(1.0);
`,v&&(J+=` color = getColorFromStyle(position, position_absolute, color, normal);
`),P&&(J+=` float show = float(getShowFromStyle(position, position_absolute, color, normal));
`),B?J+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio;
`:w?J+=` vec4 positionEC = czm_modelView * vec4(position, 1.0);
float depth = -positionEC.z;
gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize);
`:J+=` gl_PointSize = u_pointSize;
`,J+=` color = color * u_highlightColor;
`,j&&T&&(J+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC);
diffuseStrength = max(diffuseStrength, 0.4);
color.xyz *= diffuseStrength * czm_lightColor;
`),J+=` v_color = color;
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
`,j&&A&&(J+=` float visible = step(-normalEC.z, 0.0);
gl_Position *= visible;
gl_PointSize *= visible;
`),P&&(J+=` gl_Position.w *= float(show);
gl_PointSize *= float(show);
`),J+=`}
`;let ce=`varying vec4 v_color;
`;F&&(ce+=`uniform highp sampler2D u_clippingPlanes;
uniform mat4 u_clippingPlanesMatrix;
uniform vec4 u_clippingPlanesEdgeStyle;
`,ce+=`
`,ce+=Vy(S,s),ce+=`
`),ce+=`void main()
{
gl_FragColor = czm_gammaCorrect(v_color);
`,F&&(ce+=Pw("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),ce+=`}
`,e.splitDirection!==Os.NONE&&(ce=ky.modifyFragmentShader(ce)),l(e._vertexShaderLoaded)&&(J=e._vertexShaderLoaded(J)),l(e._fragmentShaderLoaded)&&(ce=e._fragmentShaderLoaded(ce));let de=e._drawCommand;l(de.shaderProgram)&&de.shaderProgram.destroy(),de.shaderProgram=gn.fromCache({context:s,vertexShaderSource:J,fragmentShaderSource:ce,attributeLocations:$});try{de.shaderProgram._bind()}catch{throw new he("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function e5e(e,t){if(e._decodingState===qy.READY)return!1;if(e._decodingState===qy.NEEDS_DECODE){let n=e._parsedContent,i=n.draco,o=eu.decodePointCloud(i,t);l(o)&&(e._decodingState=qy.DECODING,o.then(function(r){e._decodingState=qy.READY;let s=l(r.POSITION)?r.POSITION.array:void 0,a=l(r.RGB)?r.RGB.array:void 0,c=l(r.RGBA)?r.RGBA.array:void 0,u=l(r.NORMAL)?r.NORMAL.array:void 0,f=l(r.BATCH_ID)?r.BATCH_ID.array:void 0,d=l(s)&&l(r.POSITION.data.quantization),p=l(u)&&l(r.NORMAL.data.quantization);if(d){let C=r.POSITION.data.quantization,A=C.range;e._quantizedVolumeScale=h.fromElements(A,A,A),e._quantizedVolumeOffset=h.unpack(C.minValues),e._quantizedRange=(1<<C.quantizationBits)-1,e._isQuantizedDraco=!0}p&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let _=n.styleableProperties,m=i.batchTableProperties;for(let C in m)if(m.hasOwnProperty(C)){let A=r[C];l(_)||(_={}),_[C]={typedArray:A.array,componentCount:A.data.componentsPerAttribute}}l(s)&&(n.positions={typedArray:s});let x=y(c,a);l(x)&&(n.colors={typedArray:x}),l(u)&&(n.normals={typedArray:u}),l(f)&&(n.batchIds={typedArray:f}),n.styleableProperties=_}).catch(function(r){e._decodingState=qy.FAILED,e._rejectReadyPromise(r)}))}return!0}var t5e=new ae,n5e=new h;Hw.prototype.update=function(e){let t=e.context;if(e5e(this,t))return;let i=!1,o=!O.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),l(this._drawCommand)||($8e(this,e),o=!0,i=!0,this._resolveReadyPromise(),this._parsedContent=void 0),o){O.clone(this.modelMatrix,this._modelMatrix);let u=this._drawCommand.modelMatrix;if(O.clone(this._modelMatrix,u),l(this._rtcCenter)&&O.multiplyByTranslation(u,this._rtcCenter,u),l(this._quantizedVolumeOffset)&&O.multiplyByTranslation(u,this._quantizedVolumeOffset,u),e.mode!==te.SCENE3D){let d=e.mapProjection,p=O.getColumn(u,3,t5e);ae.equals(p,ae.UNIT_W)||Ut.basisTo2D(d,u,u)}let f=this._drawCommand.boundingVolume;if(re.clone(this._boundingSphere,f),this._cull){let d=f.center;O.multiplyByPoint(u,d,d);let p=O.getScale(u,n5e);f.radius*=h.maximumComponent(p)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,i=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,i=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,i=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,i=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,i=!0);let r=this.splitDirection!==Os.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&Q8e(this,e,this._style),this._drawCommand.castShadows=vn.castShadows(this.shadows),this._drawCommand.receiveShadows=vn.receiveShadows(this.shadows);let s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?Se.TRANSLUCENT:this._opaquePass;let a=e.commandList,c=e.passes;(c.render||c.pick)&&a.push(this._drawCommand)};Hw.prototype.isDestroyed=function(){return!1};Hw.prototype.destroy=function(){let e=this._drawCommand;return l(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),fe(this)};var Gw=Hw;function CH(e,t,n){let i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function IO(e,t,n){let i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function fd(e){e=y(e,y.EMPTY_
uniform sampler2D u_pointCloud_colorGBuffer;
uniform sampler2D u_pointCloud_depthGBuffer;
uniform vec2 u_distanceAndEdlStrength;
varying vec2 v_textureCoordinates;
vec2 neighborContribution(float log2Depth, vec2 offset)
{
float dist = u_distanceAndEdlStrength.x;
vec2 texCoordOrig = v_textureCoordinates + offset * dist;
vec2 texCoord0 = v_textureCoordinates + offset * floor(dist);
vec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);
float depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));
float depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));
if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {
return vec2(0.0);
}
float depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));
vec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);
return vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);
}
void main()
{
float depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);
eyeCoordinate /= eyeCoordinate.w;
float log2Depth = log2(-eyeCoordinate.z);
if (depthOrLogDepth == 0.0)
{
discard;
}
vec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);
vec2 texelSize = 1.0 / czm_viewport.zw;
vec2 responseAndCount = vec2(0.0);
responseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));
responseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));
responseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));
responseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));
float response = responseAndCount.x / responseAndCount.y;
float strength = u_distanceAndEdlStrength.y;
float shade = exp(-response * 300.0 * strength);
color.rgb *= shade;
gl_FragColor = vec4(color);
gl_FragDepthEXT = depthOrLogDepth;
}
`;function rT(){this._framebuffer=new qi({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(rT.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});function i5e(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}var bH=new W;function o5e(e,t){let n=new je({defines:["LOG_DEPTH_WRITE"],sources:[TH]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return bH.x=e._radius,bH.y=e._strength,bH}},o=Ze.fromCache({blending:Hn.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:On.setCesium3DTileBit(),stencilMask:On.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:Se.CESIUM_3D_TILE,owner:e}),e._clearCommand=new Fi({framebuffer:e.framebuffer,color:new H(0,0,0,0),depth:1,renderState:Ze.fromCache(),pass:Se.CESIUM_3D_TILE,owner:e})}function r5e(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),o5e(e,t)}function Cse(e){return e.drawBuffers&&e.fragmentDepth}rT.isSupported=Cse;function s5e(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!l(n)){let i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources=o.sources.map(function(r){return r=je.replaceMain(r,"czm_point_cloud_post_process_main"),r=r.replace(/gl_FragColor/g,"gl_FragData[0]"),r}),o.sources.unshift(`#extension GL_EXT_draw_buffers : enable
`),o.sources.push(`void main()
{
czm_point_cloud_post_process_main();
#ifdef LOG_DEPTH
czm_writeLogDepth();
gl_FragData[1] = czm_packDepth(gl_FragDepthEXT);
#else
gl_FragData[1] = czm_packDepth(gl_FragCoord.z);
#endif
}`),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}rT.prototype.update=function(e,t,n,i){if(!Cse(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,r5e(this,e.context);let o,r=e.commandList,s=r.length;for(o=t;o<s;++o){let u=r[o];if(u.primitiveType!==He.POINTS||u.pass===Se.TRANSLUCENT)continue;let f,d,p=u.derivedCommands.pointCloudProcessor;l(p)&&(f=p.command,d=p.originalShaderProgram),(!l(f)||u.dirty||d!==u.shaderProgram||f.framebuffer!==this.framebuffer)&&(f=pt.shallowClone(u,f),f.framebuffer=this.framebuffer,f.shaderProgram=s5e(e.context,u.shaderProgram),f.castShadows=!1,f.receiveShadows=!1,l(p)||(p={command:f,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=p),p.originalShaderProgram=u.shaderProgram),r[o]=f}let a=this._clearCommand,c=this._drawCommand;c.boundingVolume=i,r.push(c),r.push(a)};rT.prototype.isDestroyed=function(){return!1};rT.prototype.destroy=function(){return i5e(this),fe(this)};var Yy=rT;function Ase(e){let t=y(e,{});this.attenuation=y(t.attenuation,!1),this.geometricErrorScale=y(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=y(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=y(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=y(t.eyeDomeLightingRadius,1),this.backFaceCulling=y(t.backFaceCulling,!1),this.normalShading=y(t.normalShading,!0)}Ase.isSupported=function(e){return Yy.isSupported(e.context)};var Fh=Ase;function Dp(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._metadata=void 0,this._pickId=void 0,this._batchTable=void 0,this._styleDirty=!1,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._pointCloud=new Gw({arrayBuffer:i,byteOffset:o,cull:!1,opaquePass:Se.CESIUM_3D_TILE,vertexShaderLoaded:a5e(this),fragmentShaderLoaded:c5e(this),uniformMapLoaded:l5e(this),batchTableLoaded:u5e(this),pickIdLoaded:f5e(this)})}Object.defineProperties(Dp.prototype,{featuresLength:{get:function(){return l(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return this._pointCloud.pointsLength}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return this._pointCloud.geometryByteLength}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return l(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._pointCloud.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function a5e(e){return function(t){return l(e._batchTable)?e._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(t):t}}function c5e(e){return function(t){return l(e._batchTable)?e._batchTable.getFragmentShaderCallback(!1,void 0,!1)(t):`uniform vec4 czm_pickColor;
${t}`}}function l5e(e){return function(t){return l(e._batchTable)?e._batchTable.getUniformMapCallback()(t):Dt(t,{czm_pickColor:function(){return e._pickId.color}})}}function u5e(e){return function(t,n,i){e._batchTable=new Zl(e,t,n,i)}}function f5e(e){return function(){return l(e._batchTable)?e._batchTable.getPickId():"czm_pickColor"}}function d5e(e){let t=e._tileset.pointCloudShading,n=e._tile.contentBoundingVolume.boundingSphere.volume(),i=I.cbrt(n/e.pointsLength),o=e._tile.geometricError;return o===0&&(l(t)&&l(t.baseResolution)?o=t.baseResolution:o=i),o}function h5e(e){let t=e.featuresLength;if(!l(e._features)&&t>0){let n=new Array(t);for(let i=0;i<t;++i)n[i]=new $r(e,i);e._features=n}}Dp.prototype.hasProperty=function(e,t){return l(this._batchTable)?this._batchTable.hasProperty(e,t):!1};Dp.prototype.getFeature=function(e){if(!l(this._batchTable))return;let t=this.featuresLength;return h5e(this),this._features[e]};Dp.prototype.applyDebugSettings=function(e,t){this._pointCloud.color=e?t:H.WHITE};Dp.prototype.applyStyle=function(e){l(this._batchTable)?this._batchTable.applyStyle(e):this._styleDirty=!0};var m5e=new Fh;Dp.prototype.update=function(e,t){let n=this._pointCloud,i=y(e.pointCloudShading,m5e),o=this._tile,r=this._batchTable,s=t.mode,a=e.clippingPlanes;!l(this._pickId)&&!l(r)&&(this._pickId=t.context.createPickId({primitive:e,content:this})),l(r)&&r.update(e,t);let c;l(o._contentBoundingVolume)?c=s===te.SCENE3D?o._contentBoundingVolume.boundingSphere:o._contentBoundingVolume2D.boundingSphere:c=s===te.SCENE3D?o._boundingVolume.boundingSphere:o._boundingVolume2D.boundingSphere;let u=this._styleDirty;this._styleDirty=!1,n.clippingPlanesOriginMatrix=e.clippingPlanesOriginMatrix,n.style=l(r)?void 0:e.style,n.styleDirty=u,n.modelMatrix=o.computedTransform,n.time=e.timeSinceLoad,n.shadows=e.shadows,n.boundingSphere=c,n.clippingPlanes=a,n.isClipped=l(a)&&a.enabled&&o._isClipped,n.clippingPlanesDirty=o.clippingPlanesDirty,n.attenuation=i.attenuation,n.backFaceCulling=i.backFaceCulling,n.normalShading=i.normalShading,n.geometricError=d5e(this),n.geometricErrorScale=i.geometricErrorScale,n.splitDirection=e.splitDirection,l(i)&&l(i.maximumAttenuation)?n.maximumAttenuation=i.maximumAttenuation:o.refine===Zr.ADD?n.maximumAttenuation=5:n.maximumAttenuation=e.maximumScreenSpaceError,n.update(t)};Dp.prototype.isDestroyed=function(){return!1};Dp.prototype.destroy=function(){return this._pickId=this._pickId&&this._pickId.destroy(),this._pointCloud=this._pointCloud&&this._pointCloud.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),fe(this)};var EH=Dp;function Pp(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._readyPromise=p5e(this,i)}Object.defineProperties(Pp.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function p5e(e,t){return e._tileset.loadTileset(e._resource,t,e._tile),Promise.resolve(e)}Pp.prototype.hasProperty=function(e,t){return!1};Pp.prototype.getFeature=function(e){};Pp.prototype.applyDebugSettings=function(e,t){};Pp.prototype.applyStyle=function(e){};Pp.prototype.update=function(e,t){};Pp.prototype.isDestroyed=function(){return!1};Pp.prototype.destroy=function(){return fe(this)};var SH=Pp;function qs(e,t,n,i){let o=qs._verifyAttributes(t);n=y(n,0);let r=[],s={},a,c,u=o.length;for(let d=0;d<u;++d){let p=o[d];if(p.vertexBuffer){r.push(p);continue}c=p.usage,a=s[c],l(a
#extension GL_OES_standard_derivatives : enable
#endif
uniform sampler2D u_atlas;
#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
varying vec2 v_textureCoordinates;
varying vec4 v_pickColor;
varying vec4 v_color;
#ifdef SDF
varying vec4 v_outlineColor;
varying float v_outlineWidth;
#endif
#ifdef FRAGMENT_DEPTH_CHECK
varying vec4 v_textureCoordinateBounds;
varying vec4 v_originTextureCoordinateAndTranslate;
varying vec4 v_compressed;
varying mat2 v_rotationMatrix;
const float SHIFT_LEFT12 = 4096.0;
const float SHIFT_LEFT1 = 2.0;
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
const float SHIFT_RIGHT1 = 1.0 / 2.0;
float getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)
{
vec2 lookupVector = imageSize * (depthLookupST - adjustedST);
lookupVector = v_rotationMatrix * lookupVector;
vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y));
vec2 translation = v_originTextureCoordinateAndTranslate.zw;
if (applyTranslate)
{
translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));
}
vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));
if (logDepthOrDepth == 0.0)
{
return 0.0;
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
return eyeCoordinate.z / eyeCoordinate.w;
}
#endif
#ifdef SDF
float getDistance(vec2 position)
{
return texture2D(u_atlas, position).r;
}
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
{
float distance = getDistance(position);
if (outlineWidth > 0.0)
{
float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);
float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);
float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);
return vec4(sdfColor.rgb, sdfColor.a * alpha);
}
else
{
float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
return vec4(v_color.rgb, v_color.a * alpha);
}
}
#endif
void main()
{
vec4 color = texture2D(u_atlas, v_textureCoordinates);
#ifdef SDF
float outlineWidth = v_outlineWidth;
vec4 outlineColor = v_outlineColor;
float distance = getDistance(v_textureCoordinates);
#ifdef GL_OES_standard_derivatives
float smoothing = fwidth(distance);
vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));
vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
color = (center + color1 + color2 + color3 + color4)/5.0;
#else
float smoothing = 1.0/32.0;
color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
#endif
color = czm_gammaCorrect(color);
#else
color = czm_gammaCorrect(color);
color *= czm_gammaCorrect(v_color);
#endif
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
if (color.a < 0.005)
{
discard;
}
#else
#ifdef OPAQUE
if (color.a < 0.995)
{
discard;
}
#else
if (color.a >= 0.995)
{
discard;
}
#endif
#endif
#ifdef VECTOR_TILE
color *= u_highlightColor;
#endif
gl_FragColor = color;
#ifdef LOG_DEPTH
czm_writeLogDepth();
#endif
#ifdef FRAGMENT_DEPTH_CHECK
float temp = v_compressed.y;
temp = temp * SHIFT_RIGHT1;
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
bool enableDepthTest = temp2 != 0.0;
bool applyTranslate = floor(temp) != 0.0;
if (enableDepthTest) {
temp = v_compressed.z;
temp = temp * SHIFT_RIGHT12;
vec2 dimensions;
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
dimensions.x = floor(temp);
temp = v_compressed.w;
temp = temp * SHIFT_RIGHT12;
vec2 imageSize;
imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;
imageSize.x = floor(temp);
vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;
adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);
float epsilonEyeDepth = v_compressed.x + czm_epsilon1;
float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);
if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)
{
float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize);
if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)
{
float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize);
if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)
{
discard;
}
}
}
}
#endif
}
`;var DH=`#ifdef INSTANCED
attribute vec2 direction;
#endif
attribute vec4 positionHighAndScale;
attribute vec4 positionLowAndRotation;
attribute vec4 compressedAttribute0;
attribute vec4 compressedAttribute1;
attribute vec4 compressedAttribute2;
attribute vec4 eyeOffset;
attribute vec4 scaleByDistance;
attribute vec4 pixelOffsetScaleByDistance;
attribute vec4 compressedAttribute3;
attribute vec2 sdf;
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
attribute vec4 textureCoordinateBoundsOrLabelTranslate;
#endif
#ifdef VECTOR_TILE
attribute float a_batchId;
#endif
varying vec2 v_textureCoordinates;
#ifdef FRAGMENT_DEPTH_CHECK
varying vec4 v_textureCoordinateBounds;
varying vec4 v_originTextureCoordinateAndTranslate;
varying vec4 v_compressed;
varying mat2 v_rotationMatrix;
#endif
varying vec4 v_pickColor;
varying vec4 v_color;
#ifdef SDF
varying vec4 v_outlineColor;
varying float v_outlineWidth;
#endif
const float UPPER_BOUND = 32768.0;
const float SHIFT_LEFT16 = 65536.0;
const float SHIFT_LEFT12 = 4096.0;
const float SHIFT_LEFT8 = 256.0;
const float SHIFT_LEFT7 = 128.0;
const float SHIFT_LEFT5 = 32.0;
const float SHIFT_LEFT3 = 8.0;
const float SHIFT_LEFT2 = 4.0;
const float SHIFT_LEFT1 = 2.0;
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
const float SHIFT_RIGHT8 = 1.0 / 256.0;
const float SHIFT_RIGHT7 = 1.0 / 128.0;
const float SHIFT_RIGHT5 = 1.0 / 32.0;
const float SHIFT_RIGHT3 = 1.0 / 8.0;
const float SHIFT_RIGHT2 = 1.0 / 4.0;
const float SHIFT_RIGHT1 = 1.0 / 2.0;
vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
{
vec2 halfSize = imageSize * scale * 0.5;
halfSize *= ((direction * 2.0) - 1.0);
vec2 originTranslate = origin * abs(halfSize);
#if defined(ROTATION) || defined(ALIGNED_AXIS)
if (validAlignedAxis || rotation != 0.0)
{
float angle = rotation;
if (validAlignedAxis)
{
vec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
}
float cosTheta = cos(angle);
float sinTheta = sin(angle);
rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
halfSize = rotationMatrix * halfSize;
}
else
{
rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
}
#endif
mpp = czm_metersPerPixel(positionEC);
positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);
positionEC.xy += (translate + pixelOffset) * mpp;
return positionEC;
}
#ifdef VERTEX_DEPTH_CHECK
float getGlobeDepth(vec4 positionEC)
{
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);
float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));
if (globeDepth == 0.0)
{
return 0.0;
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
return eyeCoordinate.z / eyeCoordinate.w;
}
#endif
void main()
{
vec3 positionHigh = positionHighAndScale.xyz;
vec3 positionLow = positionLowAndRotation.xyz;
float scale = positionHighAndScale.w;
#if defined(ROTATION) || defined(ALIGNED_AXIS)
float rotation = positionLowAndRotation.w;
#else
float rotation = 0.0;
#endif
float compressed = compressedAttribute0.x;
vec2 pixelOffset;
pixelOffset.x = floor(compressed * SHIFT_RIGHT7);
compressed -= pixelOffset.x * SHIFT_LEFT7;
pixelOffset.x -= UPPER_BOUND;
vec2 origin;
origin.x = floor(compressed * SHIFT_RIGHT5);
compressed -= origin.x * SHIFT_LEFT5;
origin.y = floor(compressed * SHIFT_RIGHT3);
compressed -= origin.y * SHIFT_LEFT3;
#ifdef FRAGMENT_DEPTH_CHECK
vec2 depthOrigin = origin.xy;
#endif
origin -= vec2(1.0);
float show = floor(compressed * SHIFT_RIGHT2);
compressed -= show * SHIFT_LEFT2;
#ifdef INSTANCED
vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);
vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);
vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;
#else
vec2 direction;
direction.x = floor(compressed * SHIFT_RIGHT1);
direction.y = compressed - direction.x * SHIFT_LEFT1;
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);
#endif
float temp = compressedAttribute0.y * SHIFT_RIGHT8;
pixelOffset.y = -(floor(temp) - UPPER_BOUND);
vec2 translate;
translate.y = (temp - floor(temp)) * SHIFT_LEFT16;
temp = compressedAttribute0.z * SHIFT_RIGHT8;
translate.x = floor(temp) - UPPER_BOUND;
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
translate.y -= UPPER_BOUND;
temp = compressedAttribute1.x * SHIFT_RIGHT8;
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
vec2 imageSize = vec2(floor(temp), temp2);
#ifdef FRAGMENT_DEPTH_CHECK
float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
float applyTranslate = 0.0;
if (labelHorizontalOrigin != 0.0)
{
applyTranslate = 1.0;
labelHorizontalOrigin -= 2.0;
depthOrigin.x = labelHorizontalOrigin + 1.0;
}
depthOrigin = vec2(1.0) - (depthOrigin * 0.5);
#endif
#ifdef EYE_DISTANCE_TRANSLUCENCY
vec4 translucencyByDistance;
translucencyByDistance.x = compressedAttribute1.z;
translucencyByDistance.z = compressedAttribute1.w;
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
temp = compressedAttribute1.y * SHIFT_RIGHT8;
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
#endif
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
temp = compressedAttribute3.w;
temp = temp * SHIFT_RIGHT12;
vec2 dimensions;
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
dimensions.x = floor(temp);
#endif
#ifdef ALIGNED_AXIS
vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));
temp = compressedAttribute2.z * SHIFT_RIGHT5;
bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;
#else
vec3 alignedAxis = vec3(0.0);
bool validAlignedAxis = false;
#endif
vec4 pickColor;
vec4 color;
temp = compressedAttribute2.y;
temp = temp * SHIFT_RIGHT8;
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor.r = floor(temp);
temp = compressedAttribute2.x;
temp = temp * SHIFT_RIGHT8;
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
color.r = floor(temp);
temp = compressedAttribute2.z * SHIFT_RIGHT8;
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
temp = floor(temp) * SHIFT_RIGHT8;
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor /= 255.0;
color.a = floor(temp);
color /= 255.0;
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
vec4 positionEC = czm_modelViewRelativeToEye * p;
#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)
float eyeDepth = positionEC.z;
#endif
positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);
positionEC.xyz *= show;
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
float lengthSq;
if (czm_sceneMode == czm_sceneMode2D)
{
lengthSq = czm_eyeHeight2D.y;
}
else
{
lengthSq = dot(positionEC.xyz, positionEC.xyz);
}
#endif
#ifdef EYE_DISTANCE_SCALING
float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);
scale *= distanceScale;
translate *= distanceScale;
if (scale == 0.0)
{
positionEC.xyz = vec3(0.0);
}
#endif
float translucency = 1.0;
#ifdef EYE_DISTANCE_TRANSLUCENCY
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
if (translucency == 0.0)
{
positionEC.xyz = vec3(0.0);
}
#endif
#ifdef EYE_DISTANCE_PIXEL_OFFSET
float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);
pixelOffset *= pixelOffsetScale;
#endif
#ifdef DISTANCE_DISPLAY_CONDITION
float nearSq = compressedAttribute3.x;
float farSq = compressedAttribute3.y;
if (lengthSq < nearSq || lengthSq > farSq)
{
positionEC.xyz = vec3(0.0);
}
#endif
mat2 rotationMatrix;
float mpp;
#ifdef DISABLE_DEPTH_DISTANCE
float disableDepthTestDistance = compressedAttribute3.z;
#endif
#ifdef VERTEX_DEPTH_CHECK
if (lengthSq < disableDepthTestDistance) {
float depthsilon = 10.0;
vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;
vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
float globeDepth1 = getGlobeDepth(pEC1);
if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)
{
vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
float globeDepth2 = getGlobeDepth(pEC2);
if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)
{
vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
float globeDepth3 = getGlobeDepth(pEC3);
if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)
{
positionEC.xyz = vec3(0.0);
}
}
}
}
#endif
positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
gl_Position = czm_projection * positionEC;
v_textureCoordinates = textureCoordinates;
#ifdef LOG_DEPTH
czm_vertexLogDepth();
#endif
#ifdef DISABLE_DEPTH_DISTANCE
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
{
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
}
if (disableDepthTestDistance != 0.0)
{
float zclip = gl_Position.z / gl_Position.w;
bool clipped = (zclip < -1.0 || zclip > 1.0);
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
{
gl_Position.z = -gl_Position.w;
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = 1.0;
#endif
}
}
#endif
#ifdef FRAGMENT_DEPTH_CHECK
if (sizeInMeters) {
translate /= mpp;
dimensions /= mpp;
imageSize /= mpp;
}
#if defined(ROTATION) || defined(ALIGNED_AXIS)
v_rotationMatrix = rotationMatrix;
#else
v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
#endif
float enableDepthCheck = 0.0;
if (lengthSq < disableDepthTestDistance)
{
enableDepthCheck = 1.0;
}
float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));
float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));
float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));
float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));
v_compressed.x = eyeDepth;
v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;
v_compressed.z = dw * SHIFT_LEFT12 + dh;
v_compressed.w = iw * SHIFT_LEFT12 + ih;
v_originTextureCoordinateAndTranslate.xy = depthOrigin;
v_originTextureCoordinateAndTranslate.zw = translate;
v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;
#endif
#ifdef SDF
vec4 outlineColor;
float outlineWidth;
temp = sdf.x;
temp = temp * SHIFT_RIGHT8;
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor.r = floor(temp);
temp = sdf.y;
temp = temp * SHIFT_RIGHT8;
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor.a = floor(temp);
outlineColor /= 255.0;
v_outlineWidth = outlineWidth / 255.0;
v_outlineColor = outlineColor;
v_outlineColor.a *= translucency;
#endif
v_pickColor = pickColor;
v_color = color;
v_color.a *= translucency;
}
`;var Pa={},x5e=new ae(0,0,0,1),ic=new ae,C5e=new it,PH=new W,IH=new W;Pa.wgs84ToWindowCoordinates=function(e,t,n){return Pa.wgs84WithEyeOffsetToWindowCoordinates(e,t,h.ZERO,n)};var Tse=new ae,bse=new h;function jw(e,t,n,i){let o=n.viewMatrix,r=O.multiplyByVector(o,ae.fromElements(e.x,e.y,e.z,1,Tse),Tse),s=h.multiplyComponents(t,h.normalize(r,bse),bse);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,O.multiplyByVector(n.frustum.projectionMatrix,r,i)}var A5e=new _e(Math.PI,I.PI_OVER_TWO),T5e=new h,b5e=new h;Pa.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){let o=e.frameState,r=Pa.computeActualWgs84Position(o,t,x5e);if(!l(r))return;let s=e.canvas,a=C5e;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;let c=e.camera,u=!1;if(o.mode===te.SCENE2D){let f=e.mapProjection,d=A5e,p=f.project(d,T5e),_=h.clone(c.position,b5e),m=c.frustum.clone(),x=O.computeViewportTransformation(a,0,1,new O),C=c.frustum.projectionMatrix,A=c.positionWC.y,T=h.fromElements(I.sign(A)*p.x-A,0,-c.positionWC.x),E=Ut.pointToGLWindowCoordinates(C,x,T);if(A===0||E.x<=0||E.x>=s.clientWidth)u=!0;else{if(E.x>s.clientWidth*.5){a.width=E.x,c.frustum.right=p.x-A,ic=jw(r,n,c,ic),Pa.clipToGLWindowCoordinates(a,ic,PH),a.x+=E.x,c.position.x=-c.position.x;let S=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-S,ic=jw(r,n,c,ic),Pa.clipToGLWindowCoordinates(a,ic,IH)}else{a.x+=E.x,a.width-=E.x,c.frustum.left=-p.x-A,ic=jw(r,n,c,ic),Pa.clipToGLWindowCoordinates(a,ic,PH),a.x=a.x-a.width,c.position.x=-c.position.x;let S=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-S,ic=jw(r,n,c,ic),Pa.clipToGLWindowCoordinates(a,ic,IH)}h.clone(_,c.position),c.frustum=m.clone(),i=W.clone(PH,i),(i.x<0||i.x>s.clientWidth)&&(i.x=IH.x)}}if(o.mode!==te.SCENE2D||u){if(ic=jw(r,n,c,ic),ic.z<0&&!(c.frustum instanceof In)&&!(c.frustum instanceof _s))return;i=Pa.clipToGLWindowCoordinates(a,ic,i)}return i.y=s.clientHeight-i.y,i};Pa.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=Pa.wgs84ToWindowCoordinates(e,t,n),!!l(n))return Pa.transformWindowToDrawingBuffer(e,n,n)};var Ip=new h,E5e=new _e;Pa.computeActualWgs84Position=function(e,t,n){let i=e.mode;if(i===te.SCENE3D)return h.clone(t,n);let o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,E5e);if(!l(r))return;if(o.project(r,Ip),i===te.COLUMBUS_VIEW)return h.fromElements(Ip.z,Ip.x,Ip.y,n);if(i===te.SCENE2D)return h.fromElements(0,Ip.x,Ip.y,n);let s=e.morphTime;return h.fromElements(I.lerp(Ip.z,t.x,s),I.lerp(Ip.x,t.y,s),I.lerp(Ip.y,t.z,s),n)};var Ese=new h,Sse=new h,wse=new O;Pa.clipToGLWindowCoordinates=function(e,t,n){return h.divideByScalar(t,t.w,Ese),O.computeViewportTransformation(e,0,1,wse),O.multiplyByPoint(wse,Ese,Sse),W.fromCartesian3(Sse,n)};Pa.transformWindowToDrawingBuffer=function(e,t,n){let i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return W.fromElements(t.x*o,t.y*r,n)};var S5e=new ae,vse=new ae;Pa.drawingBufferToWgs84Coordinates=function(e,t,n,i){let r=e.context.uniformState,s=r.currentFrustum,a=s.x,c=s.y;if(e.frameState.useLogDepth){let _=n*r.log2FarDepthFromNearPlusOne,m=Math.pow(2,_)-1;n=c*(1-a/(m+a))/(c-a)}let u=e.view.passState.viewport,f=ae.clone(ae.UNIT_W,S5e);f.x=(t.x-u.x)/u.width*2-1,f.y=(t.y-u.y)/u.height*2-1,f.z=n*2-1,f.w=1;let d,p=e.camera.frustum;if(!l(p.fovy))l(p._offCenterFrustum)&&(p=p._offCenterFrustum),d=vse,d.x=(f.x*(p.right-p.left)+p.left+p.right)*.5,d.y=(f.y*(p.top-p.bottom)+p.bottom+p.top)*.5,d.z=(f.z*(a-c)-a-c)*.5,d.w=1,d=O.multiplyByVector(r.inverseView,d,d);else{d=O.multiplyByVector(r.inverseViewProjection,f,vse);let _=1/d.w;h.multiplyByScalar(d,_,d)}return h.fromCartesian4(d,i)};var Oo=Pa;function Yi(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;l(n)&&(n=$t.clone(n)),l(i)&&(i=$t.clone(i)),l(o)&&(o=$t.clone(o)),l(r)&&(r=Wt.clone(r)),this._show=y(e.show,!0),this._position=h.clone(y(e.position,h.ZERO)),this._actualPosition=h.clone(this._position),this._pixelOffset=W.clone(y(e.pixelOffset,W.ZERO)),this._translate=new W(0,0),this.
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(billboard_texture, v_textureCoordinates);
}
`,i=t.createViewportQuadCommand(n,{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=Se.OVERLAY,i}var uGe=[];of.prototype.update=function(e){if(VH(this),!this.show)return;let t=this._billboards,n=t.length,i=e.context;this._instanced=i.instancedArrays,Wo=this._instanced?$5e:K5e,OH=this._instanced?J5e:Z5e;let o=this._textureAtlas;if(!l(o)){o=this._textureAtlas=new sT({context:i});for(let M=0;M<n;++M)t[M]._loadImage()}let r=o.textureCoordinates;if(r.length===0)return;aGe(this,e),t=this._billboards,n=t.length;let s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,c=this._propertiesChanged,u=o.guid,f=this._createVertexArray||this._textureAtlasGUID!==u;this._textureAtlasGUID=u;let d,p=e.passes,_=p.pick;if(f||!_&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let M=0;M<FH;++M)c[M]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=eGe(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),d=this._vaf.writers;for(let M=0;M<n;++M){let L=this._billboards[M];L._dirty=!1,sGe(this,e,r,d,L)}this._vaf.commit(OH(i))}this._billboardsToUpdateIndex=0}else if(a>0){let M=uGe;M.length=0,(c[Xw]||c[j5e]||c[W5e])&&M.push(qse),(c[Yw]||c[Fse]||c[H5e]||c[G5e]||c[z5e])&&(M.push(Jse),this._instanced&&M.push(NH)),(c[Yw]||c[q5e]||c[zse])&&(M.push(Qse),M.push(LH)),(c[Yw]||c[kse])&&M.push(LH),c[Vse]&&M.push(NH),c[Use]&&M.push(eae),c[Hse]&&M.push(tae),(c[Gse]||c[Y5e]||c[Yw]||c[Xw])&&M.push(nae),(c[Yw]||c[Xw])&&M.push(iae),c[Wse]&&M.push(oae);let L=M.length;if(d=this._vaf.writers,a/n>.1){for(let N=0;N<a;++N){let g=s[N];g._dirty=!1;for(let b=0;b<L;++b)M[b](this,e,r,d,g)}this._vaf.commit(OH(i))}else{for(let N=0;N<a;++N){let g=s[N];g._dirty=!1;for(let b=0;b<L;++b)M[b](this,e,r,d,g);this._instanced?this._vaf.subCommit(g._index,1):this._vaf.subCommit(g._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>n*1.5&&(s.length=n),!l(this._vaf)||!l(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,re.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m,x=O.IDENTITY;e.mode===te.SCENE3D?(x=this.modelMatrix,m=re.clone(this._baseVolumeWC,this._boundingVolume)):m=re.clone(this._baseVolume2D,this._boundingVolume),cGe(this,e,m);let C=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,C){this._blendOption===lr.OPAQUE||this._blendOption===lr.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ze.fromCache({depthTest:{enabled:!0,func:Z.LESS},depthMask:!0}):this._rsOpaque=void 0;let M=this._blendOption===lr.TRANSLUCENT;this._blendOption===lr.TRANSLUCENT||this._blendOption===lr.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ze.fromCache({depthTest:{enabled:!0,func:M?Z.LEQUAL:Z.LESS},depthMask:M,blending:Hn.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let A,T,E,S,w,D=sn.maximumVertexTextureImageUnits>0;if(C||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){A=DH,T=vH,w=[],l(this._batchTable)&&(w.push("VECTOR_TILE"),A=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(A),T=this._batchTable.getFragmentShaderCallback(!1,void 0)(T)),E=new je({defines:w,sources:[A]}),this._instanced&&E.defines.push("INSTANCED"),this._shaderRotation&&E.defines.push("ROTATION"),this._shaderAlignedAxis&&E.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&E.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&E.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderP
`),n="";for(let i=0;i<t.length;i++){let o=t[i],r=fae.test(o.charAt(0)),s=yGe(o,fae),a=0,c="";for(let u=0;u<s.length;++u){let f=s[u],d=f.Type===ys.BRACKETS?CGe(f.Word):xGe(f.Word);r?f.Type===ys.RTL?(c=d+c,a=0):f.Type===ys.LTR?(c=Qw(c,a,f.Word),a+=f.Word.length):(f.Type===ys.WEAK||f.Type===ys.BRACKETS)&&(f.Type===ys.WEAK&&s[u-1].Type===ys.BRACKETS?c=d+c:s[u-1].Type===ys.RTL?(c=d+c,a=0):s.length>u+1?s[u+1].Type===ys.RTL?(c=d+c,a=0):(c=Qw(c,a,f.Word),a+=f.Word.length):c=Qw(c,0,d)):f.Type===ys.RTL?c=Qw(c,a,d):f.Type===ys.LTR?(c+=f.Word,a=c.length):(f.Type===ys.WEAK||f.Type===ys.BRACKETS)&&(u>0&&s[u-1].Type===ys.RTL?s.length>u+1?s[u+1].Type===ys.RTL?c=Qw(c,a,d):(c+=f.Word,a=c.length):c+=f.Word:(c+=f.Word,a=c.length))}n+=c,i<t.length-1&&(n+=`
`)}return n}var lT=Rp;var FO=Qc(hae(),1);function SGe(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function wGe(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}var vGe=1.2,pae="ID_WHITE_PIXEL",kH=new W(4,4),DGe=new it(1,1,1,1);function PGe(e){let t=document.createElement("canvas");t.width=kH.x,t.height=kH.y;let n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(pae,t)}var rf={};function IGe(e,t,n,i,o,r,s){return rf.font=t,rf.fillColor=n,rf.strokeColor=i,rf.strokeWidth=o,rf.padding=Ia.PADDING,s===si.CENTER?rf.textBaseline="middle":s===si.TOP?rf.textBaseline="top":rf.textBaseline="bottom",rf.fill=r===Dr.FILL||r===Dr.FILL_AND_OUTLINE,rf.stroke=r===Dr.OUTLINE||r===Dr.FILL_AND_OUTLINE,rf.backgroundColor=H.BLACK,dS(e,rf)}function UH(e,t){t.textureInfo=void 0,t.dimensions=void 0;let n=t.billboard;l(n)&&(n.show=!1,n.image=void 0,l(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function OGe(e,t,n,i){i.index=e.addImageSync(t,n)}var RGe=new FO.default;function MGe(e,t){let n=t._renderedText,i=RGe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length,a,c,u;if(t._relativeSize=t._fontSize/Ia.FONT_SIZE,o<s)for(c=o;c<s;++c)UH(e,r[c]);r.length=o;let f=t._showBackground&&n.split(`
`).join("").length>0,d=t._backgroundBillboard,p=e._backgroundBillboardCollection;f?(l(d)||(d=p.add({collection:e,image:pae,imageSubRegion:DGe}),t._backgroundBillboard=d),d.color=t._backgroundColor,d.show=t._show,d.position=t._position,d.eyeOffset=t._eyeOffset,d.pixelOffset=t._pixelOffset,d.horizontalOrigin=Ki.LEFT,d.verticalOrigin=t._verticalOrigin,d.heightReference=t._heightReference,d.scale=t.totalScale,d.pickPrimitive=t,d.id=t._id,d.translucencyByDistance=t._translucencyByDistance,d.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,d.scaleByDistance=t._scaleByDistance,d.distanceDisplayCondition=t._distanceDisplayCondition,d.disableDepthTestDistance=t._disableDepthTestDistance):l(d)&&(p.remove(d),t._backgroundBillboard=d=void 0);let _=e._glyphTextureCache;for(u=0;u<o;++u){let m=i[u],x=t._verticalOrigin,C=JSON.stringify([m,t._fontFamily,t._fontStyle,t._fontWeight,+x]),A=_[C];if(!l(A)){let T=`${t._fontStyle} ${t._fontWeight} ${Ia.FONT_SIZE}px ${t._fontFamily}`,E=IGe(m,T,H.WHITE,H.WHITE,0,Dr.FILL,x);if(A=new wGe(e,-1,E.dimensions),_[C]=A,E.width>0&&E.height>0){let S=(0,LO.default)(E,{cutoff:Ia.CUTOFF,radius:Ia.RADIUS}),w=E.getContext("2d"),D=E.width,R=E.height,M=w.getImageData(0,0,D,R);for(let L=0;L<D;L++)for(let N=0;N<R;N++){let g=N*D+L,b=S[g]*255,v=g*4;M.data[v+0]=b,M.data[v+1]=b,M.data[v+2]=b,M.data[v+3]=b}w.putImageData(M,0,0),m!==" "&&OGe(e._textureAtlas,C,E,A)}}if(a=r[u],l(a)?A.index===-1?UH(e,a):l(a.textureInfo)&&(a.textureInfo=void 0):(a=new SGe,r[u]=a),a.textureInfo=A,a.dimensions=A.dimensions,A.index!==-1){let T=a.billboard,E=e._spareBillboards;l(T)||(E.length>0?T=E.pop():(T=e._billboardCollection.add({collection:e}),T._labelDimensions=new W,T._labelTranslate=new W),a.billboard=T),T.show=t._show,T.position=t._position,T.eyeOffset=t._eyeOffset,T.pixelOffset=t._pixelOffset,T.horizontalOrigin=Ki.LEFT,T.verticalOrigin=t._verticalOrigin,T.heightReference=t._heightReference,T.scale=t.totalScale,T.pickPrimitive=t,T.id=t._id,T.image=C,T.translucencyByDistance=t._translucencyByDistance,T.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,T.scaleByDistance=t._scaleByDistance,T.distanceDisplayCondition=t._distanceDisplayCondition,T.disableDepthTestDistance=t._disableDepthTestDistance,T._batchIndex=t._batchIndex,T.outlineColor=t.outlineColor,t.style===Dr.FILL_AND_OUTLINE?(T.color=t._fillColor,T.outlineWidth=t.outlineWidth):t.style===Dr.FILL?(T.color=t._fillColor,T.outlineWidth=0):t.style===Dr.OUTLINE&&(T.color=H.TRANSPARENT,T.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function mae(e,t,n){return t===Ki.CENTER?-e/2:t===Ki.RIGHT?-(e+n.x):n.x}var Pr=new W,BGe=new W;function LGe(e){let t=e._glyphs,n=e._renderedText,i,o,r=0,s=0,a=[],c=Number.NEGATIVE_INFINITY,u=0,f=1,d,p=t.length,_=e._backgroundBillboard,m=W.clone(l(_)?e._backgroundPadding:W.ZERO,BGe);for(m.x/=e._relativeSize,m.y/=e._relativeSize,d=0;d<p;++d)n.charAt(d)===`
`?(a.push(r),++f,r=0):(i=t[d],o=i.dimensions,u=Math.max(u,o.height-o.descent),c=Math.max(c,o.descent),r+=o.width-o.minx,d<p-1&&(r+=t[d+1].dimensions.minx),s=Math.max(s,r));a.push(r);let x=u+c,C=e.totalScale,A=e._horizontalOrigin,T=e._verticalOrigin,E=0,S=a[E],w=mae(S,A,m),D=(l(e._lineHeight)?e._lineHeight:vGe*e._fontSize)/e._relativeSize,R=D*(f-1),M=s,L=x+R;l(_)&&(M+=m.x*2,L+=m.y*2,_._labelHorizontalOrigin=A),Pr.x=w*C,Pr.y=0;let N=!0,g=0;for(d=0;d<p;++d)if(n.charAt(d)===`
`)++E,g+=D,S=a[E],w=mae(S,A,m),Pr.x=w*C,N=!0;else if(i=t[d],o=i.dimensions,T===si.TOP?(Pr.y=o.height-u-m.y,Pr.y+=Ia.PADDING):T===si.CENTER?Pr.y=(R+o.height-u)/2:T===si.BASELINE?(Pr.y=R,Pr.y-=Ia.PADDING):(Pr.y=R+c+m.y,Pr.y-=Ia.PADDING),Pr.y=(Pr.y-o.descent-g)*C,N&&(Pr.x-=Ia.PADDING*C,N=!1),l(i.billboard)&&(i.billboard._setTranslate(Pr),i.billboard._labelDimensions.x=M,i.billboard._labelDimensions.y=L,i.billboard._labelHorizontalOrigin=A),d<p-1){let b=t[d+1];Pr.x+=(o.width-o.minx+b.dimensions.minx)*C}if(l(_)&&n.split(`
`).join("").length>0&&(A===Ki.CENTER?w=-s/2-m.x:A===Ki.RIGHT?w=-(s+m.x*2):w=0,Pr.x=w*C,T===si.TOP?Pr.y=x-u-c:T===si.CENTER?Pr.y=(x-u)/2-c:T===si.BASELINE?Pr.y=-m.y-c:Pr.y=0,Pr.y=Pr.y*C,_.width=M,_.height=L,_._setTranslate(Pr),_._labelTranslate=W.clone(Pr,_._labelTranslate)),e.heightReference===et.CLAMP_TO_GROUND)for(d=0;d<p;++d){i=t[d];let b=i.billboard;l(b)&&(b._labelTranslate=W.clone(Pr,b._labelTranslate))}}function _ae(e,t){let n=t._glyphs;for(let i=0,o=n.length;i<o;++i)UH(e,n[i]);l(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,l(t._removeCallbackFunc)&&t._removeCallbackFunc(),fe(t)}function kh(e){e=y(e,y.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._backgroundBillboardCollection=new hd({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new hd({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=H.clone(H.WHITE),this.show=y(e.show,!0),this.modelMatrix=O.clone(y(e.modelMatrix,O.IDENTITY)),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,lr.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(kh.prototype,{length:{get:function(){return this._labels.length}}});kh.prototype.add=function(e){let t=new lT(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};kh.prototype.remove=function(e){if(l(e)&&e._labelCollection===this){let t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),_ae(this,e),!0}return!1};kh.prototype.removeAll=function(){let e=this._labels;for(let t=0,n=e.length;t<n;++t)_ae(this,e[t]);e.length=0};kh.prototype.contains=function(e){return l(e)&&e._labelCollection===this};kh.prototype.get=function(e){return this._labels[e]};kh.prototype.update=function(e){if(!this.show)return;let t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;let i=e.context;l(this._textureAtlas)||(this._textureAtlas=new sT({context:i}),t.textureAtlas=this._textureAtlas),l(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new sT({context:i,initialSize:kH}),n.textureAtlas=this._backgroundTextureAtlas,PGe(this._backgroundTextureAtlas));let o=this._labelsToUpdate.length;for(let s=0;s<o;++s){let a=this._labelsToUpdate[s];if(a.isDestroyed())continue;let c=a._glyphs.length;a._rebindAllGlyphs&&(MGe(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(LGe(a),a._repositionAllGlyphs=!1);let u=a._glyphs.length-c;this._totalGlyphCount+=u}let r=n.length>0?lr.TRANSLUCENT:this.blendOption;t.blendOption=r,n.blendOption=r,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};kh.prototype.isDestroyed=function(){return!1};kh.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),fe(this)};var xg=kh;var zH=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 position2DHigh;
attribute vec3 position2DLow;
attribute vec3 prevPosition3DHigh;
attribute vec3 prevPosition3DLow;
attribute vec3 prevPosition2DHigh;
attribute vec3 prevPosition2DLow;
attribute vec3 nextPosition3DHigh;
attribute vec3 nextPosition3DLow;
attribute vec3 nextPosition2DHigh;
attribute vec3 nextPosition2DLow;
attribute vec4 texCoordExpandAndBatchIndex;
varying vec2 v_st;
varying float v_width;
varying vec4 v_pickColor;
varying float v_polylineAngle;
void main()
{
float texCoord = texCoordExpandAndBatchIndex.x;
float expandDir = texCoordExpandAndBatchIndex.y;
bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;
float batchTableIndex = texCoordExpandAndBatchIndex.w;
vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);
float width = widthAndShow.x + 0.5;
float show = widthAndShow.y;
if (width < 1.0)
{
show = 0.0;
}
vec4 pickColor = batchTable_getPickColor(batchTableIndex);
vec4 p, prev, next;
if (czm_morphTime == 1.0)
{
p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);
prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);
next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);
}
else if (czm_morphTime == 0.0)
{
p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);
prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);
next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);
}
else
{
p = czm_columbusViewMorph(
czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),
czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),
czm_morphTime);
prev = czm_columbusViewMorph(
czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),
czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),
czm_morphTime);
next = czm_columbusViewMorph(
czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),
czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),
czm_morphTime);
}
#ifdef DISTANCE_DISPLAY_CONDITION
vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);
vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);
vec3 centerLow = centerLowAndRadius.xyz;
float radius = centerLowAndRadius.w;
vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);
float lengthSq;
if (czm_sceneMode == czm_sceneMode2D)
{
lengthSq = czm_eyeHeight2D.y;
}
else
{
vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);
lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);
}
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
if (lengthSq < nearSq || lengthSq > farSq)
{
show = 0.0;
}
#endif
float polylineAngle;
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);
gl_Position = czm_viewportOrthographic * positionWC * show;
v_st.s = texCoord;
v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);
v_width = width;
v_pickColor = pickColor;
v_polylineAngle = polylineAngle;
}
`;function ru(e,t){e=y(e,y.EMPTY_OBJECT),this._show=y(e.show,!0),this._width=y(e.width,1),this._loop=y(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,l(this._material)||(this._material=Bo.fromType(Bo.ColorType,{color:new H(1,1,1,1)}));let n=e.positions;l(n)||(n=[]),this._positions=n,this._actualPositions=or(n,h.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(h.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;l(t)&&(i=O.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=mo.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(yae),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=re.fromPoints(this._actualPositions),this._boundingVolumeWC=re.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new re}var gae=ru.POSITION_INDEX=0,NGe=ru.SHOW_INDEX=1,FGe=ru.WIDTH_INDEX=2,VGe=ru.MATERIAL_INDEX=3,ev=ru.POSITION_SIZE_INDEX=4,kGe=ru.DISTANCE_DISPLAY_CONDITION=5,yae=ru.NUMBER_OF_PROPERTIES=6;function Mp(e,t){++e._propertiesChanged[t];let n=e._polylineCollection;l(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(ru.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,Mp(this,NGe))}},positions:{get:function(){return this._positions},set:function(e){let t=or(e,h.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(h.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Mp(this,ev),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=re.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=re.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),Mp(this,gae),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,Mp(this,VGe))}},width:{get:function(){return this._width},set:function(e){let t=this._width;e!==t&&(this._width=e,Mp(this,FGe))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!h.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(h.clone(t[0]))):t.length>2&&h.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Mp(this,ev)}}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!l(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){Wt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=Wt.clone(e,this._distanceDisplayCondition),Mp(this,kGe))}}});ru.prototype.update=function(){let e=O.IDENTITY;l(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);let t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[gae]>0||this._propertiesChanged[ev]>0;if((!O.equals(e,this._modelMatrix)||i)&&(this._segments=mo.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=re.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=O.clone(e,this._modelMatrix),this._segments.positions.length!==t)Mp(this,ev);else{let o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Mp(this,ev);break}}};ru.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};ru.prototype._clean=function(){this._dirty=!1;let e=this._propertiesChanged;for(let t=0;t<yae-1;++t)e[t]=0};ru.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=t
`,this.material.shaderSource,qS]}),r=t.getVertexShaderCallback()(zH),s=new je({defines:i,sources:[id,r]});this.shaderProgram=gn.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:Tl})};function Rae(e){return h.dot(h.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Fn.ORIGIN_ZX_PLANE)===Dn.INTERSECTING}zh.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===te.SCENE3D||!Rae(e))return t=e._actualPositions.length,t*4-4;let n=0,i=e._segments.lengths;t=i.length;for(let o=0;o<t;++o)n+=i[o]*4-4;return n};var Bs=new h,sf=new h,af=new h,kO=new h,ZGe=new ae,JGe=new W;zh.prototype.write=function(e,t,n,i,o,r,s,a){let c=this.mode,u=a.ellipsoid.maximumRadius*I.PI,f=this.polylines,d=f.length;for(let p=0;p<d;++p){let _=f[p],m=_.width,x=_.show&&m>0,C=_._index,A=this.getSegments(_,a),T=A.positions,E=A.lengths,S=T.length,w=_.getPickId(s).color,D=0,R=0,M;for(let k=0;k<S;++k){k===0?_._loop?M=T[S-2]:(M=kO,h.subtract(T[0],T[1],M),h.add(T[0],M,M)):M=T[k-1],h.clone(M,sf),h.clone(T[k],Bs),k===S-1?_._loop?M=T[1]:(M=kO,h.subtract(T[S-1],T[S-2],M),h.add(T[S-1],M,M)):M=T[k+1],h.clone(M,af);let U=E[D];k===R+U&&(R+=U,++D);let z=k-R===0,V=k===R+E[D]-1;c===te.SCENE2D&&(sf.z=0,Bs.z=0,af.z=0),(c===te.SCENE2D||c===te.MORPHING)&&(z||V)&&u-Math.abs(Bs.x)<1&&((Bs.x<0&&sf.x>0||Bs.x>0&&sf.x<0)&&h.clone(Bs,sf),(Bs.x<0&&af.x>0||Bs.x>0&&af.x<0)&&h.clone(Bs,af));let Y=z?2:0,j=V?2:4;for(let $=Y;$<j;++$){xi.writeElements(Bs,e,n),xi.writeElements(sf,e,n+6),xi.writeElements(af,e,n+12);let G=$-2<0?-1:1;t[o]=k/(S-1),t[o+1]=2*($%2)-1,t[o+2]=G,t[o+3]=C,n+=6*3,o+=4}}let L=ZGe;L.x=H.floatToByte(w.red),L.y=H.floatToByte(w.green),L.z=H.floatToByte(w.blue),L.w=H.floatToByte(w.alpha);let N=JGe;N.x=m,N.y=x?1:0;let g=c===te.SCENE2D?_._boundingVolume2D:_._boundingVolumeWC,b=xi.fromCartesian(g.center,vae),v=b.high,P=ae.fromElements(b.low.x,b.low.y,b.low.z,g.radius,Dae),B=Pae;B.x=0,B.y=Number.MAX_VALUE;let F=_.distanceDisplayCondition;l(F)&&(B.x=F.near,B.y=F.far),r.setBatchedAttribute(C,0,N),r.setBatchedAttribute(C,1,L),r.attributes.length>2&&(r.setBatchedAttribute(C,2,v),r.setBatchedAttribute(C,3,P),r.setBatchedAttribute(C,4,B))}};var QGe=new h,e6e=new h,t6e=new h,bae=new h;zh.prototype.writeForMorph=function(e,t){let n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r<o;++r){let s=i[r],a=s._segments.positions,c=s._segments.lengths,u=a.length,f=0,d=0;for(let p=0;p<u;++p){let _;p===0?s._loop?_=a[u-2]:(_=bae,h.subtract(a[0],a[1],_),h.add(a[0],_,_)):_=a[p-1],_=O.multiplyByPoint(n,_,e6e);let m=O.multiplyByPoint(n,a[p],QGe),x;p===u-1?s._loop?x=a[1]:(x=bae,h.subtract(a[u-1],a[u-2],x),h.add(a[u-1],x,x)):x=a[p+1],x=O.multiplyByPoint(n,x,t6e);let C=c[f];p===d+C&&(d+=C,++f);let A=p-d===0,T=p===d+c[f]-1,E=A?2:0,S=T?2:4;for(let w=E;w<S;++w)xi.writeElements(m,e,t),xi.writeElements(_,e,t+6),xi.writeElements(x,e,t+12),t+=6*3}}};var n6e=new Array(1);zh.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new HH(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],c=0;a.length>0&&(c=a[a.length-1]+1);let u=this.polylines,f=u.length;for(let d=0;d<f;++d){let p=u[d];p._locatorBuckets=[];let _;if(this.mode===te.SCENE3D){_=n6e;let x=p._actualPositions.length;if(x>0)_[0]=x;else continue}else _=p._segments.lengths;let m=_.length;if(m>0){let x=0;for(let C=0;C<m;++C){let A=_[C]-1;for(let T=0;T<A;++T)c+4>I.SIXTY_FOUR_KILOBYTES&&(p._locatorBuckets.push({locator:r,count:x}),x=0,t.push(4),a=[],e.push(a),c=0,r.count=s,s=0,i=0,r=new HH(0,0,this),n[++o]=[r]),a.push(c,c+2,c+1),a.push(c+1,c+2,c+3),x+=6,s+=6,i+=6,c+=4}p._locatorBuckets.push({locator:r,count:x}),c+4>I.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),c=0,r.count=s,i=0,s=0,r=new HH(0,0,this),n[++o]=[r])}p._clean()}return r.count=s,i};zh.prototype.getPolylineStartIndex=function(e){let t=this.polylines,n=0,i=t.length;for(let o=0;o<i;++o){let r=t[o];if(r===e)break;n+=r._actualLength}return n};var uT={positions:void 0,lengths:void 0},Eae=new Array(1),i6e=new h,o6e=new _e;zh.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===te.SCENE3D)return Eae[0]=n.lengt
attribute vec4 previousPosition;
attribute vec4 nextPosition;
attribute vec2 expandAndWidth;
attribute float a_batchId;
uniform mat4 u_modifiedModelView;
void main()
{
float expandDir = expandAndWidth.x;
float width = abs(expandAndWidth.y) + 0.5;
bool usePrev = expandAndWidth.y < 0.0;
vec4 p = u_modifiedModelView * currentPosition;
vec4 prev = u_modifiedModelView * previousPosition;
vec4 next = u_modifiedModelView * nextPosition;
float angle;
vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);
gl_Position = czm_viewportOrthographic * positionWC;
}
`;function pd(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(e.ellipsoid,se.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=H.clone(H.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=F6e(this),this._verticesPromise=void 0}Object.defineProperties(pd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function E6e(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+me.packedLength+se.packedLength+h.packedLength,a=new Float64Array(s),c=0;return a[c++]=n,a[c++]=i,me.pack(t,a,c),c+=me.packedLength,se.pack(o,a,c),c+=se.packedLength,h.pack(r,a,c),a}var S6e=new uo("createVectorTilePolylines",5),fT={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function w6e(e,t){if(!l(e._va)&&!l(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;l(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=E6e(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=e._verticesPromise=S6e.scheduleTask(c,a);return l(u)?u.then(function(f){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._currentPositions=new Float32Array(f.currentPositions),e._previousPositions=new Float32Array(f.previousPositions),e._nextPositions=new Float32Array(f.nextPositions),e._expandAndWidth=new Float32Array(f.expandAndWidth),e._vertexBatchIds=new Uint16Array(f.batchIds);let d=f.indexDatatype;e._indices=d===Ge.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function v6e(e,t){if(e._ready&&!l(e._va)){let n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices,c=i.byteLength+n.byteLength+o.byteLength;c+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=c;let u=Pt.createVertexBuffer({context:t,typedArray:i,usage:We.STATIC_DRAW}),f=Pt.createVertexBuffer({context:t,typedArray:n,usage:We.STATIC_DRAW}),d=Pt.createVertexBuffer({context:t,typedArray:o,usage:We.STATIC_DRAW}),p=Pt.createVertexBuffer({context:t,typedArray:r,usage:We.STATIC_DRAW}),_=Pt.createVertexBuffer({context:t,typedArray:s,usage:We.STATIC_DRAW}),m=Pt.createIndexBuffer({context:t,typedArray:a,usage:We.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?Ge.UNSIGNED_SHORT:Ge.UNSIGNED_INT}),x=[{index:fT.previousPosition,vertexBuffer:u,componentDatatype:X.FLOAT,componentsPerAttribute:3},{index:fT.currentPosition,vertexBuffer:f,componentDatatype:X.FLOAT,componentsPerAttribute:3},{index:fT.nextPosition,vertexBuffer:d,componentDatatype:X.FLOAT,componentsPerAttribute:3},{index:fT.expandAndWidth,vertexBuffer:p,componentDatatype:X.FLOAT,componentsPerAttribute:2},{index:fT.a_batchId,vertexBuffer:_,componentDatatype:X.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Ii({context:t,attributes:x,indexBuffer:m}),e._po
void main()
{
gl_FragColor = u_highlightColor;
}
`;function O6e(e,t){if(l(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(KH),o=n.getFragmentShaderCallback(!1,void 0,!1)(I6e),r=new je({defines:["VECTOR_TILE",Kt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[id,i]}),s=new je({defines:["VECTOR_TILE"],sources:[o]});e._sp=gn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:fT})}function R6e(e,t){if(!l(e._command)){let n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new pt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:Se.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}pd.getPolylinePositions=function(e,t){let n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!l(n)||!l(i))return;let r,s,a=n.length,c=0,u=0;for(r=0;r<a;++r)n[r]===t&&(c+=o[r+1]-o[r]);if(c===0)return;let f=new Float64Array(c*3);for(r=0;r<a;++r)if(n[r]===t){let d=o[r],p=o[r+1]-d;for(s=0;s<p;++s){let _=(d+s)*3;f[u++]=i[_],f[u++]=i[_+1],f[u++]=i[_+2]}}return f};pd.prototype.getPositions=function(e){return pd.getPolylinePositions(this,e)};pd.prototype.createFeatures=function(e,t){let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o];t[r]=new $r(e,r)}};pd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function M6e(e,t){let n=e._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.show=!0,s.color=H.WHITE}}var B6e=new H,L6e=H.WHITE,N6e=!0;pd.prototype.applyStyle=function(e,t){if(!l(e)){M6e(this,t);return}let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.color=l(e.color)?e.color.evaluateColor(s,B6e):L6e,s.show=l(e.show)?e.show.evaluate(s):N6e}};function F6e(e){return new Promise(function(t,n){e._update=function(i,o){let r=o.context,s=w6e(i,r);if(D6e(i,r),O6e(i,r),P6e(i),i._ready){let a=o.passes;(a.render||a.pick)&&R6e(i,o)}!l(s)||s.then(function(){v6e(i,r),t()}).catch(function(a){n(a)})}})}pd.prototype.update=function(e){this._update(this,e)};pd.prototype.isDestroyed=function(){return!1};pd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),fe(this)};var rv=pd;var $H=`attribute vec3 startEllipsoidNormal;
attribute vec3 endEllipsoidNormal;
attribute vec4 startPositionAndHeight;
attribute vec4 endPositionAndHeight;
attribute vec4 startFaceNormalAndVertexCorner;
attribute vec4 endFaceNormalAndHalfWidth;
attribute float a_batchId;
uniform mat4 u_modifiedModelView;
uniform vec2 u_minimumMaximumVectorHeights;
varying vec4 v_startPlaneEC;
varying vec4 v_endPlaneEC;
varying vec4 v_rightPlaneEC;
varying float v_halfWidth;
varying vec3 v_volumeUpEC;
void main()
{
float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251);
float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd));
vec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;
vec3 right = normalize(cross(forward, startEllipsoidNormal));
vec4 position = vec4(startPositionAndHeight.xyz, 1.0);
position.xyz += forward * isEnd;
v_volumeUpEC = czm_normal * normalize(cross(right, forward));
float offset;
vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);
offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);
offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;
position.xyz += offset * ellipsoidNormal;
position = u_modifiedModelView * position;
right = czm_normal * right;
vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);
scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));
vec3 miterPushNormal = czm_normal * normalize(scratchNormal);
offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position));
offset = offset / dot(miterPushNormal, right);
position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));
gl_Position = czm_depthClamp(czm_projection * position);
position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);
vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;
v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));
v_rightPlaneEC = vec4(right, -dot(right, position.xyz));
position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);
vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;
v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));
v_halfWidth = endFaceNormalAndHalfWidth.w;
}
`;var ZH=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
varying vec4 v_startPlaneEC;
varying vec4 v_endPlaneEC;
varying vec4 v_rightPlaneEC;
varying float v_halfWidth;
varying vec3 v_volumeUpEC;
uniform vec4 u_highlightColor;
void main()
{
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
if (logDepthOrDepth == 0.0) {
#ifdef DEBUG_SHOW_VOLUME
gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
eyeCoordinate /= eyeCoordinate.w;
float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);
halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);
float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
#ifdef DEBUG_SHOW_VOLUME
gl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
gl_FragColor = u_highlightColor;
czm_writeDepthClamp();
}
`;function Lp(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(e.ellipsoid,se.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new W(ki._defaultMinTerrainHeight,ki._defaultMaxTerrainHeight),this._boundingVolume=to.fromRectangle(e.rectangle,ki._defaultMinTerrainHeight,ki._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=H.clone(H.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=Z6e(this),this._verticesPromise=void 0}Object.defineProperties(Lp.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function V6e(e,t,n){let i=ki.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;let a=e._boundingVolume,c=e._rectangle;to.fromRectangle(c,o,r,n,a)}function k6e(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+me.packedLength+se.packedLength+h.packedLength,a=new Float64Array(s),c=0;return a[c++]=n,a[c++]=i,me.pack(t,a,c),c+=me.packedLength,se.pack(o,a,c),c+=se.packedLength,h.pack(r,a,c),a}var U6e=new uo("createVectorTileClampedPolylines"),Ag={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function z6e(e,t){if(!l(e._va)&&!l(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;l(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=k6e(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=e._verticesPromise=U6e.scheduleTask(c,a);return l(u)?u.then(function(f){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(f.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(f.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(f.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(f.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(f.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(f.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(f.vertexBatchIds);let d=f.indexDatatype;e._indices=d===Ge.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function H6e(e,t){if(e._ready&&!l(e._va)){let n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,u=e._indices,f=n.byteLength+i.byteLength;f+=o.byteLength+r.byteLength,f+=s.byteLength+a.byteLength,f+=c.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=f;let d=Pt.createVertexBuffer({c
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
#endif
czm_modelMaterial defaultModelMaterial()
{
czm_modelMaterial material;
material.diffuse = vec3(0.0);
material.specular = vec3(1.0);
material.roughness = 1.0;
material.occlusion = 1.0;
material.normalEC = vec3(0.0, 0.0, 1.0);
material.emissive = vec3(0.0);
material.alpha = 1.0;
return material;
}
vec4 handleAlpha(vec3 color, float alpha)
{
#ifdef ALPHA_MODE_MASK
if (alpha < u_alphaCutoff) {
discard;
}
#endif
return vec4(color, alpha);
}
SelectedFeature selectedFeature;
void main()
{
#ifdef HAS_MODEL_SPLITTER
modelSplitterStage();
#endif
czm_modelMaterial material = defaultModelMaterial();
ProcessedAttributes attributes;
geometryStage(attributes);
FeatureIds featureIds;
featureIdStage(featureIds, attributes);
Metadata metadata;
MetadataClass metadataClass;
metadataStage(metadata, metadataClass, attributes);
#ifdef HAS_SELECTED_FEATURE_ID
selectedFeatureIdStage(selectedFeature, featureIds);
#endif
#ifndef CUSTOM_SHADER_REPLACE_MATERIAL
materialStage(material, attributes, selectedFeature);
#endif
#ifdef HAS_CUSTOM_FRAGMENT_SHADER
customShaderStage(material, attributes, featureIds, metadata, metadataClass);
#endif
lightingStage(material, attributes);
#ifdef HAS_SELECTED_FEATURE_ID
cpuStylingStage(material, selectedFeature);
#endif
#ifdef HAS_MODEL_COLOR
modelColorStage(material);
#endif
#ifdef HAS_PRIMITIVE_OUTLINE
primitiveOutlineStage(material);
#endif
vec4 color = handleAlpha(material.diffuse, material.alpha);
#ifdef HAS_CLIPPING_PLANES
modelClippingPlanesStage(color);
#endif
#if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)
silhouetteStage(color);
#endif
gl_FragColor = color;
}
`;var m8=`precision highp float;
czm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {
czm_modelVertexOutput vsOutput;
vsOutput.positionMC = positionMC;
vsOutput.pointSize = 1.0;
return vsOutput;
}
void main()
{
ProcessedAttributes attributes;
initializeAttributes(attributes);
#ifdef USE_DEQUANTIZATION
dequantizationStage(attributes);
#endif
#ifdef HAS_MORPH_TARGETS
morphTargetsStage(attributes);
#endif
#ifdef HAS_SKINNING
skinningStage(attributes);
#endif
#ifdef HAS_PRIMITIVE_OUTLINE
primitiveOutlineStage();
#endif
#ifdef HAS_BITANGENTS
attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);
#endif
FeatureIds featureIds;
featureIdStage(featureIds, attributes);
#ifdef HAS_SELECTED_FEATURE_ID
SelectedFeature feature;
selectedFeatureIdStage(feature, featureIds);
cpuStylingStage(attributes.positionMC, feature);
#endif
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
mat4 modelView = czm_modelView3D;
mat3 normal = czm_normal3D;
#else
mat4 modelView = czm_modelView;
mat3 normal = czm_normal;
#endif
#ifdef HAS_INSTANCING
#ifdef USE_LEGACY_INSTANCING
mat4 instanceModelView;
mat3 instanceModelViewInverseTranspose;
legacyInstancingStage(attributes, instanceModelView, instanceModelViewInverseTranspose);
modelView = instanceModelView;
normal = instanceModelViewInverseTranspose;
#else
instancingStage(attributes);
#endif
#ifdef USE_PICKING
v_pickColor = a_pickColor;
#endif
#endif
Metadata metadata;
MetadataClass metadataClass;
metadataStage(metadata, metadataClass, attributes);
#ifdef HAS_CUSTOM_VERTEX_SHADER
czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);
customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass);
#endif
vec4 positionClip = geometryStage(attributes, modelView, normal);
#ifdef HAS_SILHOUETTE
silhouetteStage(attributes, positionClip);
#endif
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
float show = pointCloudShowStylingStage(attributes, metadata);
#else
float show = 1.0;
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
v_pointCloudColor = pointCloudColorStylingStage(attributes, metadata);
#endif
#ifdef PRIMITIVE_TYPE_POINTS
#ifdef HAS_CUSTOM_VERTEX_SHADER
gl_PointSize = vsOutput.pointSize;
#elif defined(HAS_POINT_CLOUD_POINT_SIZE_STYLE) || defined(HAS_POINT_CLOUD_ATTENUATION)
gl_PointSize = pointCloudPointSizeStylingStage(attributes, metadata);
#else
gl_PointSize = 1.0;
#endif
gl_PointSize *= show;
#endif
gl_Position = show * positionClip;
}
`;function dn(){}dn.getFailedLoadFunction=function(e,t,n){return function(i){let o=`Failed to load ${t}: ${n}`;l(i)&&(o+=`
${i.message}`);let r=new he(o);return l(i)&&(r.stack=`Original stack:
${i.stack}
Handler stack:
${r.stack}`),Promise.reject(r)}};dn.getNodeTransform=function(e){return l(e.matrix)?e.matrix:O.fromTranslationQuaternionRotationScale(l(e.translation)?e.translation:h.ZERO,l(e.rotation)?e.rotation:ke.IDENTITY,l(e.scale)?e.scale:h.ONE)};dn.getAttributeBySemantic=function(e,t,n){let i=e.attributes,o=i.length;for(let r=0;r<o;++r){let s=i[r],a=l(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};dn.getAttributeByName=function(e,t){let n=e.attributes,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.name===t)return r}};dn.getFeatureIdsByLabel=function(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(i.positionalLabel===t||i.label===t)return i}};dn.hasQuantizedAttributes=function(e){if(!l(e))return!1;for(let t=0;t<e.length;t++){let n=e[t];if(l(n.quantization))return!0}return!1};dn.getAttributeInfo=function(e){let t=e.semantic,n=e.setIndex,i,o=!1;l(t)?(i=yn.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());let r=/^color_\d+$/.test(i),s=e.type,a=Cn.getGlslType(s);r&&(a="vec4");let c=l(e.quantization),u;return c&&(u=r?"vec4":Cn.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};var a7e=new h,c7e=new h;dn.getPositionMinMax=function(e,t,n){let i=dn.getAttributeBySemantic(e,"POSITION"),o=i.max,r=i.min;return l(n)&&l(t)&&(r=h.add(r,t,c7e),o=h.add(o,n,a7e)),{min:r,max:o}};dn.getAxisCorrectionMatrix=function(e,t,n){return n=O.clone(O.IDENTITY,n),e===fi.Y?n=O.clone(fi.Y_UP_TO_Z_UP,n):e===fi.X&&(n=O.clone(fi.X_UP_TO_Z_UP,n)),t===fi.Z&&(n=O.multiplyTransformation(n,fi.Z_UP_TO_X_UP,n)),n};var l7e=new Q;dn.getCullFace=function(e,t){if(!He.isTriangles(t))return So.BACK;let n=O.getMatrix3(e,l7e);return Q.determinant(n)<0?So.FRONT:So.BACK};dn.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};function qO(e,t){let n=e.shaderBuilder;n.addVertexLines([m8]),n.addFragmentLines([h8]);let i=e.model,o=t.context,r=u7e(e),s=new Ii({context:o,indexBuffer:r,attributes:e.attributes});i._pipelineResources.push(s);let a=n.buildShaderProgram(t.context);i._pipelineResources.push(a);let c=e.alphaOptions.pass,u=i.sceneGraph,f=O.multiplyTransformation(u.computedModelMatrix,e.runtimeNode.computedTransform,new O),d;t.mode!==te.SCENE3D&&!t.scene3DOnly&&i._projectTo2D?d=e.runtimePrimitive.boundingSphere2D:d=re.transform(e.boundingSphere,f,e.boundingSphere);let p=mt(Ze.fromCache(e.renderStateOptions),!0);i.opaquePass===Se.CESIUM_3D_TILE&&(p.stencilTest=On.setCesium3DTileBit(),p.stencilMask=On.CESIUM_3D_TILE_MASK),p.cull.face=dn.getCullFace(f,e.primitiveType),p=Ze.fromCache(p);let _=e.count,m=new pt({boundingVolume:d,modelMatrix:f,uniformMap:e.uniformMap,renderState:p,vertexArray:s,shaderProgram:a,cull:i.cull,pass:c,count:_,pickId:e.pickId,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:i.debugShowBoundingVolume,castShadows:vn.castShadows(i.shadows),receiveShadows:vn.receiveShadows(i.shadows)}),x=i.hasSilhouette(t);return new d8({primitiveRenderResources:e,command:m,useSilhouetteCommands:x})}function u7e(e){let t=e.wireframeIndexBuffer;if(l(t))return t;let n=e.indices;if(!!l(n))return n.buffer}var p8=`vec3 proceduralIBL(
vec3 positionEC,
vec3 normalEC,
vec3 lightDirectionEC,
vec3 lightColorHdr,
czm_pbrParameters pbrParameters
) {
vec3 v = -positionEC;
vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));
vec3 vWC = -normalize(positionWC);
vec3 l = normalize(lightDirectionEC);
vec3 n = normalEC;
vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));
float NdotL = clamp(dot(n, l), 0.001, 1.0);
float NdotV = abs(dot(n, v)) + 0.001;
float vertexRadius = length(positionWC);
float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);
float reflectionDotNadir = dot(r, normalize(positionWC));
r.x = -r.x;
r = -normalize(czm_temeToPseudoFixed * r);
r.x = -r.x;
vec3 diffuseColor = pbrParameters.diffuseColor;
float roughness = pbrParameters.roughness;
vec3 specularColor = pbrParameters.f0;
float inverseRoughness = 1.04 - roughness;
inverseRoughness *= inverseRoughness;
vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;
float atmosphereHeight = 0.05;
float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);
float blendRegionOffset = roughness * -1.0;
float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);
float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);
float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);
float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);
vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);
vec3 nadirColor = belowHorizonColor * 0.5;
vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);
vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);
vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);
vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);
float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;
float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));
vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);
float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);
vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);
specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);
specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);
#ifdef USE_SUN_LUMINANCE
float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);
float S = acos(LdotZenith);
float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);
float gamma = acos(NdotL);
float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));
float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));
float luminance = model_luminanceAtZenith * (numerator / denominator);
#endif
vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;
vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);
float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);
vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);
iblColor *= lightColor;
#ifdef USE_SUN_LUMINANCE
iblColor *= luminance;
#endif
return iblColor;
}
vec3 textureIBL(
vec3 positionEC,
vec3 normalEC,
vec3 lightDirectionEC,
czm_pbrParameters pbrParameters
) {
vec3 diffuseColor = pbrParameters.diffuseColor;
float roughness = pbrParameters.roughness;
vec3 specularColor = pbrParameters.f0;
vec3 v = -positionEC;
vec3 n = normalEC;
vec3 l = normalize(lightDirectionEC);
vec3 h = normalize(v + l);
float NdotV = abs(dot(n, v)) + 0.001;
float VdotH = clamp(dot(v, h), 0.0, 1.0);
const mat3 yUpToZUp = mat3(
-1.0, 0.0, 0.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0
);
vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n)));
#ifdef DIFFUSE_IBL
#ifdef CUSTOM_SPHERICAL_HARMONICS
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients);
#else
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);
#endif
#else
vec3 diffuseIrradiance = vec3(0.0);
#endif
#ifdef SPECULAR_IBL
vec3 r0 = specularColor.rgb;
float reflectance = max(max(r0.r, r0.g), r0.b);
vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
vec3 F = fresnelSchlick2(r0, r90, VdotH);
vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;
#ifdef CUSTOM_SPECULAR_IBL
vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);
#else
vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);
#endif
specularIBL *= F * brdfLut.x + brdfLut.y;
#else
vec3 specularIBL = vec3(0.0);
#endif
return diffuseColor * diffuseIrradiance + specularColor * specularIBL;
}
vec3 imageBasedLightingStage(
vec3 positionEC,
vec3 normalEC,
vec3 lightDirectionEC,
vec3 lightColorHdr,
czm_pbrParameters pbrParameters
) {
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
return textureIBL(
positionEC,
normalEC,
lightDirectionEC,
pbrParameters
);
#else
return proceduralIBL(
positionEC,
normalEC,
lightDirectionEC,
lightColorHdr,
pbrParameters
);
#endif
}
`;var Qy={VERTEX:0,FRAGMENT:1,BOTH:2};Qy.includesVertexShader=function(e){return e===Qy.VERTEX||e===Qy.BOTH};Qy.includesFragmentShader=function(e){return e===Qy.FRAGMENT||e===Qy.BOTH};var Oe=Object.freeze(Qy);var _8={};_8.name="ImageBasedLightingPipelineStage";_8.process=function(e,t,n){let i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,Oe.FRAGMENT),o.addUniform("vec2","model_iblFactor",Oe.FRAGMENT),ju.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",Oe.FRAGMENT),l(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,Oe.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,Oe.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",Oe.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,Oe.FRAGMENT),l(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,Oe.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,Oe.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",Oe.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",Oe.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",Oe.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,Oe.FRAGMENT)),l(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,Oe.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",Oe.FRAGMENT)),o.addFragmentLines([p8]);let r={model_iblFactor:function(){return i.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return i.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return i.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return i.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return i.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=Dt(r,e.uniformMap)};var g8=_8;var f7e=I.EPSILON16;function hT(e){e=y(e,y.EMPTY_OBJECT);let t=e.stage,n=e.runtimeArticulation;this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties(hT.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){e=I.clamp(e,this.minimumValue,this.maximumValue),I.equalsEpsilon(this._currentValue,e,f7e)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});var d7e=new h,y8=new Q;hT.prototype.applyStageToMatrix=function(e){let t=this.type,n=this.currentValue,i=d7e,o;switch(t){case rl.XROTATE:o=Q.fromRotationX(I.toRadians(n),y8),e=O.multiplyByMatrix3(e,o,e);break;case rl.YROTATE:o=Q.fromRotationY(I.toRadians(n),y8),e=O.multiplyByMatrix3(e,o,e);break;case rl.ZROTATE:o=Q.fromRotationZ(I.toRadians(n),y8),e=O.multiplyByMatrix3(e,o,e);break;case rl.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=O.multiplyByTranslation(e,i,e);break;case rl.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=O.multiplyByTranslation(e,i,e);break;case rl.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=O.multiplyByTranslation(e,i,e);break;case rl.XSCALE:i.x=n,i.y=1,i.z=1,e=O.multiplyByScale(e,i,e);break;case rl.YSCALE:i.x=1,i.y=n,i.z=1,e=O.multiplyByScale(e,i,e);break;case rl.ZSCALE:i.x=1,i.y=1,i.z=n,e=O.multiplyByScale(e,i,e);break;case rl.UNIFORMSCALE:e=O.multiplyByUniformScale(e,n,e);break;default:break}return e};function ex(e){e=y(e,y.EMPTY_OBJECT);let t=e.articulation,n=e.sceneGraph;this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeN
{
material.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);
float highlight = ceil(model_colorBlend);
material.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);
material.alpha *= model_color.a;
}
`;var kp={};kp.name="ModelColorPipelineStage";kp.COLOR_UNIFORM_NAME="model_color";kp.COLOR_BLEND_UNIFORM_NAME="model_colorBlend";kp.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,Oe.FRAGMENT),i.addFragmentLines([x8]);let o={},r=t.color;r.alpha===0&&!t.hasSilhouette(n)&&(e.renderStateOptions.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),r.alpha<1&&(e.alphaOptions.pass=Se.TRANSLUCENT),i.addUniform("vec4",kp.COLOR_UNIFORM_NAME,Oe.FRAGMENT),o[kp.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",kp.COLOR_BLEND_UNIFORM_NAME,Oe.FRAGMENT),o[kp.COLOR_BLEND_UNIFORM_NAME]=function(){return ia.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=Dt(o,e.uniformMap)};var mT=kp;var C8=`#ifdef USE_CLIPPING_PLANES_FLOAT_TEXTURE
vec4 getClippingPlane(
highp sampler2D packedClippingPlanes,
int clippingPlaneNumber,
mat4 transform
) {
int pixY = clippingPlaneNumber / CLIPPING_PLANES_TEXTURE_WIDTH;
int pixX = clippingPlaneNumber - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));
return czm_transformPlane(plane, transform);
}
#else
vec4 getClippingPlane(
highp sampler2D packedClippingPlanes,
int clippingPlaneNumber,
mat4 transform
) {
int clippingPlaneStartIndex = clippingPlaneNumber * 2;
int pixY = clippingPlaneStartIndex / CLIPPING_PLANES_TEXTURE_WIDTH;
int pixX = clippingPlaneStartIndex - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
vec4 plane;
plane.xyz = czm_octDecode(oct, 65535.0);
plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + pixelWidth, v)));
return czm_transformPlane(plane, transform);
}
#endif
float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix) {
vec4 position = czm_windowToEyeCoordinates(fragCoord);
vec3 clipNormal = vec3(0.0);
vec3 clipPosition = vec3(0.0);
float pixelWidth = czm_metersPerPixel(position);
#ifdef UNION_CLIPPING_REGIONS
float clipAmount;
#else
float clipAmount = 0.0;
bool clipped = true;
#endif
for (int i = 0; i < CLIPPING_PLANES_LENGTH; ++i) {
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
clipNormal = clippingPlane.xyz;
clipPosition = -clippingPlane.w * clipNormal;
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
#ifdef UNION_CLIPPING_REGIONS
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
if (amount <= 0.0) {
discard;
}
#else
clipAmount = max(amount, clipAmount);
clipped = clipped && (amount <= 0.0);
#endif
}
#ifndef UNION_CLIPPING_REGIONS
if (clipped) {
discard;
}
#endif
return clipAmount;
}
void modelClippingPlanesStage(inout vec4 color)
{
float clipDistance = clip(gl_FragCoord, model_clippingPlanes, model_clippingPlanesMatrix);
vec4 clippingPlanesEdgeColor = vec4(1.0);
clippingPlanesEdgeColor.rgb = model_clippingPlanesEdgeStyle.rgb;
float clippingPlanesEdgeWidth = model_clippingPlanesEdgeStyle.a;
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) {
color = clippingPlanesEdgeColor;
}
}
`;var A8={};A8.name="ModelClippingPlanesPipelineStage";var _7e=new W;A8.process=function(e,t,n){let i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,Oe.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,Oe.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,Oe.FRAGMENT),na.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,Oe.FRAGMENT);let s=na.getTextureResolution(i,o,_7e);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,Oe.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,Oe.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",Oe.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",Oe.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",Oe.FRAGMENT),r.addFragmentLines([C8]);let a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){let c=H.clone(i.edgeColor);return c.alpha=i.edgeWidth,c},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=Dt(a,e.uniformMap)};var T8=A8;function mv(e,t){this._model=e,this._runtimeNode=t}Object.defineProperties(mv.prototype,{name:{get:function(){return this._runtimeNode._name}},id:{get:function(){return this._runtimeNode._id}},show:{get:function(){return this._runtimeNode.show},set:function(e){this._runtimeNode.show=e}},matrix:{get:function(){return this._runtimeNode.transform},set:function(e){l(e)?(this._runtimeNode.transform=e,this._runtimeNode.userAnimated=!0,this._model._userAnimationDirty=!0):(this._runtimeNode.transform=this.originalMatrix,this._runtimeNode.userAnimated=!1)}},originalMatrix:{get:function(){return this._runtimeNode.originalTransform}}});var b8=`mat4 getInstancingTransform()
{
mat4 instancingTransform;
#ifdef HAS_INSTANCE_MATRICES
instancingTransform = mat4(
a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0,
a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0,
a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0,
a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0
);
#else
vec3 translation = vec3(0.0, 0.0, 0.0);
vec3 scale = vec3(1.0, 1.0, 1.0);
#ifdef HAS_INSTANCE_TRANSLATION
translation = a_instanceTranslation;
#endif
#ifdef HAS_INSTANCE_SCALE
scale = a_instanceScale;
#endif
instancingTransform = mat4(
scale.x, 0.0, 0.0, 0.0,
0.0, scale.y, 0.0, 0.0,
0.0, 0.0, scale.z, 0.0,
translation.x, translation.y, translation.z, 1.0
);
#endif
return instancingTransform;
}
#ifdef USE_2D_INSTANCING
mat4 getInstancingTransform2D()
{
mat4 instancingTransform2D;
#ifdef HAS_INSTANCE_MATRICES
instancingTransform2D = mat4(
a_instancingTransform2DRow0.x, a_instancingTransform2DRow1.x, a_instancingTransform2DRow2.x, 0.0,
a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0,
a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0,
a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0
);
#else
vec3 translation2D = vec3(0.0, 0.0, 0.0);
vec3 scale = vec3(1.0, 1.0, 1.0);
#ifdef HAS_INSTANCE_TRANSLATION
translation2D = a_instanceTranslation2D;
#endif
#ifdef HAS_INSTANCE_SCALE
scale = a_instanceScale;
#endif
instancingTransform2D = mat4(
scale.x, 0.0, 0.0, 0.0,
0.0, scale.y, 0.0, 0.0,
0.0, 0.0, scale.z, 0.0,
translation2D.x, translation2D.y, translation2D.z, 1.0
);
#endif
return instancingTransform2D;
}
#endif
`;var E8=`void instancingStage(inout ProcessedAttributes attributes)
{
vec3 positionMC = attributes.positionMC;
mat4 instancingTransform = getInstancingTransform();
attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;
#ifdef USE_2D_INSTANCING
mat4 instancingTransform2D = getInstancingTransform2D();
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
#endif
}
`;var S8=`void legacyInstancingStage(
inout ProcessedAttributes attributes,
out mat4 instanceModelView,
out mat3 instanceModelViewInverseTranspose)
{
vec3 positionMC = attributes.positionMC;
mat4 instancingTransform = getInstancingTransform();
mat4 instanceModel = instancingTransform * u_instance_nodeTransform;
instanceModelView = u_instance_modifiedModelView;
instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);
attributes.positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;
#ifdef USE_2D_INSTANCING
mat4 instancingTransform2D = getInstancingTransform2D();
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
#endif
}
`;var YO=new O,g7e=new O,y7e=new O,gv={};gv.name="InstancingPipelineStage";gv.process=function(e,t,n){let i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines([b8]);let s=e.model,a=s.sceneGraph,c=n.mode!==te.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,u=[];B7e(e,n,i,u,c),L7e(e,n,i,u);let f={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,Oe.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",Oe.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",Oe.VERTEX),f.u_instance_modifiedModelView=function(){let d=O.multiplyTransformation(s.modelMatrix,a.components.transform,YO);return c?O.multiplyTransformation(n.context.uniformState.view3D,d,YO):(n.mode!==te.SCENE3D&&(d=Ut.basisTo2D(n.mapProjection,d,YO)),O.multiplyTransformation(n.context.uniformState.view,d,YO))},f.u_instance_nodeTransform=function(){return O.multiplyTransformation(a.axisCorrectionMatrix,e.runtimeNode.computedTransform,g7e)},r.addVertexLines([S8])):r.addVertexLines([E8]),c){r.addDefine("USE_2D_INSTANCING",void 0,Oe.VERTEX),r.addUniform("mat4","u_modelView2D",Oe.VERTEX);let d=n.context,p=O.fromTranslation(e.instancingReferencePoint2D,new O);f.u_modelView2D=function(){return O.multiplyTransformation(d.uniformState.view,p,y7e)}}e.uniformMap=Dt(f,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,u)};var _v=new O,x7e=new h;function C7e(e,t,n,i,o){let r=O.multiplyTransformation(t,e,_v);return r=O.multiplyTransformation(r,n,_v),o=Ut.basisTo2D(i.mapProjection,r,o),o}function A7e(e,t,n,i,o){let r=O.fromTranslation(e,_v),s=O.multiplyTransformation(t,r,_v);s=O.multiplyTransformation(s,n,_v);let a=O.getTranslation(s,x7e);return o=Oo.computeActualWgs84Position(i,a,o),o}function sce(e,t,n){let i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=O.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=O.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=O.clone(o.computedModelMatrix,t),t=O.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=O.clone(O.IDENTITY,n))}var ace=new O,cce=new O,T7e=new O,b7e=new h;function E7e(e,t,n,i){let o=ace,r=cce;sce(t,o,r);let s=t.instancingReferencePoint2D,a=e.length;for(let c=0;c<a;c++){let u=e[c],f=C7e(u,o,r,n,T7e),d=O.getTranslation(f,b7e),p=h.subtract(d,s,d);i[c]=O.setTranslation(f,p,i[c])}return i}function S7e(e,t,n,i){let o=ace,r=cce;sce(t,o,r);let s=t.instancingReferencePoint2D,a=e.length;for(let c=0;c<a;c++){let u=e[c],f=A7e(u,o,r,n,u);i[c]=h.subtract(f,s,i[c])}return i}var w7e=new h,v7e=new h;function D7e(e,t){let n=e.model.sceneGraph.computedModelMatrix,i=O.multiplyByPoint(n,e.instancingTranslationMin,w7e),o=Oo.computeActualWgs84Position(t,i,i),r=O.multiplyByPoint(n,e.instancingTranslationMax,v7e),s=Oo.computeActualWgs84Position(t,r,r);return h.lerp(o,s,.5,new h)}function v8(e){let n=e.length,i=new Float32Array(n*12);for(let o=0;o<n;o++){let r=e[o],s=12*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8],i[s+3]=r[12],i[s+4]=r[1],i[s+5]=r[5],i[s+6]=r[9],i[s+7]=r[13],i[s+8]=r[2],i[s+9]=r[6],i[s+10]=r[10],i[s+11]=r[14]}return i}function P7e(e){let n=e.length,i=new Float32Array(n*3);for(let o=0;o<n;o++){let r=e[o],s=3*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8]}return i}var I7e=new h,O7e=new ke,R7e=new h;function lce(e,t,n){let i=new Array(t),o=dn.getAttributeBySemantic(e,xs.TRANSLATION),r=dn.getAttributeBySemantic(e,xs.ROTATION),s=dn.getAttributeBySemantic(e,xs.SCALE),a=new h(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new h(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=l(o),f=l(r),d=l(s),p=u?o.typedArray:new Float32Array(t*3),_=f?r.typedArray:new Float32Array(t*4),m;d?m=s.typedArray:(m=new Float32Array(t*3),m.fill(1));for(let x=0;x<t;x++){let C=new h(p[x*3],p[x*3+1],p[x*3+2],I7e);h.maximumByComponent(a,C,a),h.minimumByComponent(c,C,c);let A=new ke(_[x*4],_[x*4+1],_[x*4+2],f?_[x*4+3]:1,O7e),T=new h(m[x*3],m[x*3+1],m[x*3+2],R7e),E=O.fromTranslationQuaternionRotationScale(C,A,T,new O);i[x]=E}return n.instancingTranslationMax=a,n.instancingTranslationMin=c,i}f
inout czm_modelVertexOutput vsOutput,
inout ProcessedAttributes attributes,
FeatureIds featureIds,
Metadata metadata,
MetadataClass metadataClass
) {
VertexInput vsInput;
initializeInputStruct(vsInput, attributes);
vsInput.featureIds = featureIds;
vsInput.metadata = metadata;
vsInput.metadataClass = metadataClass;
vertexMain(vsInput, vsOutput);
attributes.positionMC = vsOutput.positionMC;
}
`;var V8=`void customShaderStage(
inout czm_modelMaterial material,
ProcessedAttributes attributes,
FeatureIds featureIds,
Metadata metadata,
MetadataClass metadataClass
) {
FragmentInput fsInput;
initializeInputStruct(fsInput, attributes);
fsInput.featureIds = featureIds;
fsInput.metadata = metadata;
fsInput.metadataClass = metadataClass;
fragmentMain(fsInput, material);
}
`;var k8=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
}
`;var U8=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
{
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
setFeatureIdVaryings();
}
`;var _i={};_i.name="FeatureIdPipelineStage";_i.STRUCT_ID_FEATURE_IDS_VS="FeatureIdsVS";_i.STRUCT_ID_FEATURE_IDS_FS="FeatureIdsFS";_i.STRUCT_NAME_FEATURE_IDS="FeatureIds";_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS="initializeFeatureIdsVS";_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS="initializeFeatureIdsFS";_i.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS="initializeFeatureIdAliasesVS";_i.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS="initializeFeatureIdAliasesFS";_i.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS="void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)";_i.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES="void initializeFeatureIdAliases(inout FeatureIds featureIds)";_i.FUNCTION_ID_SET_FEATURE_ID_VARYINGS="setFeatureIdVaryings";_i.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS="void setFeatureIdVaryings()";_i.process=function(e,t,n){let i=e.shaderBuilder;F7e(i);let o=e.runtimeNode.node.instances;l(o)&&V7e(e,o,n),k7e(e,t,n),i.addVertexLines([U8]),i.addFragmentLines([k8])};function F7e(e){e.addStruct(_i.STRUCT_ID_FEATURE_IDS_VS,_i.STRUCT_NAME_FEATURE_IDS,Oe.VERTEX),e.addStruct(_i.STRUCT_ID_FEATURE_IDS_FS,_i.STRUCT_NAME_FEATURE_IDS,Oe.FRAGMENT),e.addFunction(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,_i.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Oe.VERTEX),e.addFunction(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,_i.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Oe.FRAGMENT),e.addFunction(_i.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,_i.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Oe.VERTEX),e.addFunction(_i.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,_i.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Oe.FRAGMENT),e.addFunction(_i.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,_i.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,Oe.VERTEX)}function V7e(e,t,n){let i=t.featureIds,o=t.attributes[0].count;for(let r=0;r<i.length;r++){let s=i[r],a=s.positionalLabel;s instanceof fn.FeatureIdAttribute?U7e(e,s,a):mce(e,s,a,o,1,n);let c=s.label;l(c)&&pce(e,a,c,Oe.BOTH)}}function k7e(e,t,n){let i=t.featureIds,r=dn.getAttributeBySemantic(t,yn.POSITION).count;for(let s=0;s<i.length;s++){let a=i[s],c=a.positionalLabel,u=Oe.BOTH;a instanceof fn.FeatureIdAttribute?z7e(e,a,c):a instanceof fn.FeatureIdImplicitRange?mce(e,a,c,r,void 0,n):(H7e(e,a,c,s,n),u=Oe.FRAGMENT);let f=a.label;l(f)&&pce(e,c,f,u)}}function U7e(e,t,n){let i=e.shaderBuilder;i.addStructField(_i.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(_i.STRUCT_ID_FEATURE_IDS_FS,"int",n);let o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,c=`featureIds.${n} = int(czm_round(${s}));`,u=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(_i.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function z7e(e,t,n){let i=e.shaderBuilder;i.addStructField(_i.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(_i.STRUCT_ID_FEATURE_IDS_FS,"int",n);let o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=[`featureIds.${n} = int(czm_round(attributes.${r}${o}));`];i.addFunctionLines(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function mce(e,t,n,i,o,r){G7e(e,t,i,o,r);let s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);let c=`v_implicit_${n}`;s.addVarying("float",c),s.addStructField(_i.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(_i.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(_i.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(_i.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function H7e(e,t,n,i,o){let r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return y(a.texture,o.context.defaultTexture)};let c=a.channels,u=e.shaderBuilder;u.addStructField(_i.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,Oe.FRAGMENT);let f=`v_texCoord
{
initializeMetadata(metadata, metadataClass, attributes);
}
`;var H8=`void metadataStage(out Metadata metadata, out MetadataClass metadataClass, ProcessedAttributes attributes)
{
initializeMetadata(metadata, metadataClass, attributes);
setMetadataVaryings();
}
`;var Si={};Si.name="MetadataPipelineStage";Si.STRUCT_ID_METADATA_VS="MetadataVS";Si.STRUCT_ID_METADATA_FS="MetadataFS";Si.STRUCT_NAME_METADATA="Metadata";Si.STRUCT_ID_METADATACLASS_VS="MetadataClassVS";Si.STRUCT_ID_METADATACLASS_FS="MetadataClassFS";Si.STRUCT_NAME_METADATACLASS="MetadataClass";Si.FUNCTION_ID_INITIALIZE_METADATA_VS="initializeMetadataVS";Si.FUNCTION_ID_INITIALIZE_METADATA_FS="initializeMetadataFS";Si.FUNCTION_SIGNATURE_INITIALIZE_METADATA="void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, ProcessedAttributes attributes)";Si.FUNCTION_ID_SET_METADATA_VARYINGS="setMetadataVaryings";Si.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS="void setMetadataVaryings()";Si.METADATACLASS_FIELDS=[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}];Si.process=function(e,t,n){let{shaderBuilder:i,model:o}=e,r=y(o.structuralMetadata,{}),{propertyAttributes:s,propertyTextures:a}=r,c=new Set;l(s)&&Y7e(c,t,s),l(a)&&$7e(c,a),j7e(i,c),q7e(i),i.addVertexLines([H8]),i.addFragmentLines([z8]),l(s)&&X7e(e,t,s),l(a)&&Z7e(e,a)};function j7e(e,t){let n=Si.METADATACLASS_FIELDS;for(let i of t){let o=`${i}MetadataClass`,r=`${o}VS`,s=`${o}FS`;e.addStruct(r,o,Oe.VERTEX),e.addStruct(s,o,Oe.FRAGMENT);for(let a=0;a<n.length;a++){let c=n[a].shaderName;e.addStructField(r,i,c),e.addStructField(s,i,c)}}}function q7e(e){e.addStruct(Si.STRUCT_ID_METADATA_VS,Si.STRUCT_NAME_METADATA,Oe.VERTEX),e.addStruct(Si.STRUCT_ID_METADATA_FS,Si.STRUCT_NAME_METADATA,Oe.FRAGMENT),e.addStruct(Si.STRUCT_ID_METADATACLASS_VS,Si.STRUCT_NAME_METADATACLASS,Oe.VERTEX),e.addStruct(Si.STRUCT_ID_METADATACLASS_FS,Si.STRUCT_NAME_METADATACLASS,Oe.FRAGMENT),e.addFunction(Si.FUNCTION_ID_INITIALIZE_METADATA_VS,Si.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Oe.VERTEX),e.addFunction(Si.FUNCTION_ID_INITIALIZE_METADATA_FS,Si.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Oe.FRAGMENT),e.addFunction(Si.FUNCTION_ID_SET_METADATA_VARYINGS,Si.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,Oe.VERTEX)}function XO(e,t){for(let n=0;n<e.length;n++){let i=e[n].properties;for(let o in i)if(i.hasOwnProperty(o)){let r=i[o];t(o,r)}}}function Y7e(e,t,n){let{getAttributeByName:i,getAttributeInfo:o}=dn;function r(s,a){let c=i(t,a.attribute),f=o(c).glslType;e.add(f)}XO(n,r)}function X7e(e,t,n){let{getAttributeByName:i,getAttributeInfo:o}=dn;function r(s,a){let c=i(t,a.attribute),u=o(c);K7e(e,u,s,a)}XO(n,r)}function K7e(e,t,n,i){let o=dn.sanitizeGlslIdentifier(n),r=t.variableName,s=t.glslType,a=e.shaderBuilder;a.addStructField(Si.STRUCT_ID_METADATA_VS,s,o),a.addStructField(Si.STRUCT_ID_METADATA_FS,s,o);let c=`${s}MetadataClass`;a.addStructField(Si.STRUCT_ID_METADATACLASS_VS,c,o),a.addStructField(Si.STRUCT_ID_METADATACLASS_FS,c,o);let u=`attributes.${r}`;i.hasValueTransform&&(u=_ce(u,{renderResources:e,glslType:s,metadataVariable:o,shaderDestination:Oe.BOTH,offset:i.offset,scale:i.scale}));let f=`metadata.${o} = ${u};`;a.addFunctionLines(Si.FUNCTION_ID_INITIALIZE_METADATA_VS,[f]),a.addFunctionLines(Si.FUNCTION_ID_INITIALIZE_METADATA_FS,[f]);let d=Si.METADATACLASS_FIELDS;for(let p=0;p<d.length;p++){let{specName:_,shaderName:m}=d[p],x=i.classProperty[_];if(!l(x))continue;let C=`metadataClass.${o}.${m} = ${s}(${x});`;a.addFunctionLines(Si.FUNCTION_ID_INITIALIZE_METADATA_VS,[C]),a.addFunctionLines(Si.FUNCTION_ID_INITIALIZE_METADATA_FS,[C])}}function $7e(e,t){function n(i,o){let r=o.getGlslType();e.add(r)}XO(t,n)}function Z7e(e,t){function n(i,o){o.isGpuCompatible()&&J7e(e,i,o)}XO(t,n)}function J7e(e,t,n){let i=n.textureReader,r=`u_propertyTexture_${i.index}`;e.uniformMap.hasOwnProperty(r)||Q7e(e,r,i);let s=dn.sanitizeGlslIdentifier(t),a=n.getGlslType(),c=e.shaderBuilder;c.addStructField(Si.STRUCT_ID_METADATA_FS,a,s);let u=`${a}MetadataClass`;c.addStructField(Si.STRUCT_ID_METADATACLASS_FS,u,s);let d=`attributes.texCoord_${i.texCoord}`,p=i.channels,_=`texture2D(${r}, ${d}).${p}`;_=n.unpackInShader(_),n.hasValueTransform&&(_=_ce(_,{renderResources:e,glslType:a,metadataVariable:s,shaderDestination:
{
bool styleTranslucent = (featureColor.a != 1.0);
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
{
#ifdef HAS_SILHOUETTE
positionMC *= float(model_silhouettePass);
#else
positionMC *= 0.0;
#endif
}
else if (czm_pass != czm_passTranslucent && styleTranslucent)
{
positionMC *= 0.0;
}
}
void cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)
{
float show = ceil(feature.color.a);
positionMC *= show;
#ifdef HAS_SELECTED_FEATURE_ID_ATTRIBUTE
filterByPassType(positionMC, feature.color);
#endif
}
`;var j8=`void filterByPassType(vec4 featureColor)
{
bool styleTranslucent = (featureColor.a != 1.0);
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
{
#ifdef HAS_SILHOUETTE
if(!model_silhouettePass) {
discard;
}
#else
discard;
#endif
}
else if (czm_pass != czm_passTranslucent && styleTranslucent)
{
discard;
}
}
void cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)
{
vec4 featureColor = feature.color;
if (featureColor.a == 0.0)
{
discard;
}
#ifdef HAS_SELECTED_FEATURE_ID_TEXTURE
filterByPassType(featureColor);
#endif
featureColor = czm_gammaCorrect(featureColor);
float highlight = ceil(model_colorBlend);
material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);
material.alpha *= featureColor.a;
}
`;var q8={};q8.name="CPUStylingPipelineStage";q8.process=function(e,t,n){let i=e.model,o=e.shaderBuilder;o.addVertexLines([W8]),o.addFragmentLines([j8]),o.addDefine("USE_CPU_STYLING",void 0,Oe.BOTH),l(i.color)||(o.addUniform("float",mT.COLOR_BLEND_UNIFORM_NAME,Oe.FRAGMENT),e.uniformMap[mT.COLOR_BLEND_UNIFORM_NAME]=function(){return ia.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",Oe.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===Se.TRANSLUCENT};let r=i.featureTables[i.featureTableId],s=bl.getStyleCommandsNeeded(r.featuresLength,r.batchTexture.translucentFeaturesLength);s===bl.ALL_TRANSLUCENT&&(e.alphaOptions.pass=Se.TRANSLUCENT),e.styleCommandsNeeded=s};var Y8=q8;var Eg={};Eg.name="DequantizationPipelineStage";Eg.FUNCTION_ID_DEQUANTIZATION_STAGE_VS="dequantizationStage";Eg.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS="void dequantizationStage(inout ProcessedAttributes attributes)";Eg.process=function(e,t,n){let i=e.shaderBuilder;i.addFunction(Eg.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,Eg.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,Oe.VERTEX),i.addDefine("USE_DEQUANTIZATION",void 0,Oe.VERTEX);let o=t.attributes;for(let r=0;r<o.length;r++){let s=o[r],a=s.quantization;if(!l(a))continue;let c=dn.getAttributeInfo(s);dje(i,c),fje(e,c)}};function fje(e,t){let n=e.shaderBuilder,i=e.uniformMap,o=t.variableName,r=t.attribute.quantization;if(r.octEncoded){let s=`model_normalizationRange_${o}`;n.addUniform("float",s,Oe.VERTEX),i[s]=function(){return r.normalizationRange}}else{let s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,c=t.glslType;n.addUniform(c,s,Oe.VERTEX),n.addUniform(c,a,Oe.VERTEX);let u=r.quantizedVolumeOffset,f=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(u=xce(u,0),f=xce(f,1)),i[s]=function(){return u},i[a]=function(){return f}}}function xce(e,t){return e instanceof ae?e:new ae(e.x,e.y,e.z,t)}function dje(e,t){let n=t.variableName,i=t.attribute.quantization,o;i.octEncoded?o=hje(n,i):o=mje(n),e.addFunctionLines(Eg.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function hje(e,t){let n=`attributes.${e}`,i=`a_quantized_${e}`,o=`model_normalizationRange_${e}`,r=t.octEncodedZXY?".zxy":".xyz";return`${n} = czm_octDecode(${i}, ${o})${r};`}function mje(e){let t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}var X8=Eg;var K8=`void geometryStage(out ProcessedAttributes attributes)
{
attributes.positionMC = v_positionMC;
attributes.positionEC = v_positionEC;
#ifdef COMPUTE_POSITION_WC_CUSTOM_SHADER
attributes.positionWC = v_positionWC;
#endif
#ifdef HAS_NORMALS
attributes.normalEC = normalize(v_normalEC);
#endif
#ifdef HAS_TANGENTS
attributes.tangentEC = normalize(v_tangentEC);
#endif
#ifdef HAS_BITANGENTS
attributes.bitangentEC = normalize(v_bitangentEC);
#endif
setDynamicVaryings(attributes);
}
`;var $8=`vec4 geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)
{
vec4 computedPosition;
vec3 positionMC = attributes.positionMC;
v_positionMC = positionMC;
v_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
vec3 position2D = attributes.position2D;
vec3 positionEC = (u_modelView2D * vec4(position2D, 1.0)).xyz;
computedPosition = czm_projection * vec4(positionEC, 1.0);
#else
computedPosition = czm_projection * vec4(v_positionEC, 1.0);
#endif
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE)
v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
#endif
#ifdef HAS_NORMALS
v_normalEC = normal * attributes.normalMC;
#endif
#ifdef HAS_TANGENTS
v_tangentEC = normalize(normal * attributes.tangentMC);
#endif
#ifdef HAS_BITANGENTS
v_bitangentEC = normalize(normal * attributes.bitangentMC);
#endif
setDynamicVaryings(attributes);
return computedPosition;
}
`;var Sg={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};Sg.is3DTiles=function(e){switch(e){case Sg.TILE_GLTF:case Sg.TILE_B3DM:case Sg.TILE_I3DM:case Sg.TILE_PNTS:case Sg.TILE_GEOJSON:return!0;case Sg.GLTF:return!1}};var aa=Object.freeze(Sg);var KO=`vec2 computeSt(float featureId)
{
float stepX = model_textureStep.x;
float centerX = model_textureStep.y;
#ifdef MULTILINE_BATCH_TEXTURE
float stepY = model_textureStep.z;
float centerY = model_textureStep.w;
float xId = mod(featureId, model_textureDimensions.x);
float yId = floor(featureId / model_textureDimensions.x);
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
#else
return vec2(centerX + (featureId * stepX), 0.5);
#endif
}
void selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)
{
int featureId = featureIds.SELECTED_FEATURE_ID;
if (featureId < model_featuresLength)
{
vec2 featureSt = computeSt(float(featureId));
feature.id = featureId;
feature.st = featureSt;
feature.color = texture2D(model_batchTexture, featureSt);
}
else
{
feature.id = model_featuresLength + 1;
feature.st = vec2(0.0);
feature.color = vec4(1.0);
}
#ifdef HAS_NULL_FEATURE_ID
if (featureId == model_nullFeatureId) {
feature.id = featureId;
feature.st = vec2(0.0);
feature.color = vec4(1.0);
}
#endif
}
`;var yd={};yd.name="SelectedFeatureIdPipelineStage";yd.STRUCT_ID_SELECTED_FEATURE="SelectedFeature";yd.STRUCT_NAME_SELECTED_FEATURE="SelectedFeature";yd.FUNCTION_ID_FEATURE_VARYINGS_VS="updateFeatureStructVS";yd.FUNCTION_ID_FEATURE_VARYINGS_FS="updateFeatureStructFS";yd.FUNCTION_SIGNATURE_UPDATE_FEATURE="void updateFeatureStruct(inout SelectedFeature feature)";yd.process=function(e,t,n){let i=e.shaderBuilder;e.hasPropertyTable=!0;let o=e.model,r=e.runtimeNode.node,s=pje(o,r,t),a=s.shaderDestination;i.addDefine("HAS_SELECTED_FEATURE_ID",void 0,a),i.addDefine("SELECTED_FEATURE_ID",s.variableName,a),i.addDefine(s.featureIdDefine,void 0,a),_je(i);let c=s.featureIds.nullFeatureId,u=e.uniformMap;l(c)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),u.model_nullFeatureId=function(){return c}),s.shaderDestination===Oe.BOTH&&i.addVertexLines([KO]),i.addFragmentLines([KO])};function Cce(e){return e instanceof fn.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function Ace(e){return e instanceof fn.FeatureIdTexture?Oe.FRAGMENT:Oe.BOTH}function pje(e,t,n){let i,o;return l(t.instances)&&(o=dn.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(o))?(i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:Ace(o),featureIdDefine:Cce(o)}):(o=dn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:Ace(o),featureIdDefine:Cce(o)})}function _je(e){e.addStructField(yd.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(yd.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(yd.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}var _T=yd;var rr={};rr.name="GeometryPipelineStage";rr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS="ProcessedAttributesVS";rr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS="ProcessedAttributesFS";rr.STRUCT_NAME_PROCESSED_ATTRIBUTES="ProcessedAttributes";rr.FUNCTION_ID_INITIALIZE_ATTRIBUTES="initializeAttributes";rr.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES="void initializeAttributes(out ProcessedAttributes attributes)";rr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS="setDynamicVaryingsVS";rr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS="setDynamicVaryingsFS";rr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS="void setDynamicVaryings(inout ProcessedAttributes attributes)";rr.process=function(e,t,n){let i=e.shaderBuilder;i.addStruct(rr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",Oe.VERTEX),i.addStruct(rr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",Oe.FRAGMENT),i.addStruct(_T.STRUCT_ID_SELECTED_FEATURE,_T.STRUCT_NAME_SELECTED_FEATURE,Oe.BOTH),i.addFunction(rr.FUNCTION_ID_INITIALIZE_ATTRIBUTES,rr.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,Oe.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(rr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(rr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(rr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,rr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Oe.VERTEX),i.addFunction(rr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,rr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Oe.FRAGMENT);let o=e.model;o.type===aa.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,Oe.FRAGMENT);let s=n.mode!==te.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,a=l(e.runtimeNode.node.instances),c=s&&!a,u=t.attributes.length;for(let f=0;f<u;f++){let d=t.attributes[f],p=Cn.getAttributeLocationCount(d.type),_=d.semantic===yn.POSITION,m;p>1?(m=e.attributeIndex,e.attributeIndex+=p):_&&!c?m=0:m=e.attributeIndex++,gje(e,d,m,p,s,a)}wje(i,t.attributes),t.primitiveType===He.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines([$8]),i.addFragmentLines([K8])};function gje(e,t,n,i,o,r){let s=e.shaderBuilder,a=dn.getAttributeInfo(t),c=o&&!r;i>1?Cje(e,t,n,i):xje(e,t,n,c),Tje(s,a,c),Aje(s,a),l(t.semantic)&&yje(s,t),bje(s,a,o),Eje(s,a,c),Sje(s,a)}function yje(e,t){let n=t.semantic,i=t.setIndex;switch(n){case yn.NORMAL:e.addDefine("HAS_NORMALS");break;case yn.TANGENT:e.addDefine("HAS_TANGENTS");break;ca
vec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)
{
czm_pbrParameters pbrParameters;
pbrParameters.diffuseColor = inputMaterial.diffuse;
pbrParameters.f0 = inputMaterial.specular;
pbrParameters.roughness = inputMaterial.roughness;
#ifdef USE_CUSTOM_LIGHT_COLOR
vec3 lightColorHdr = model_lightColorHdr;
#else
vec3 lightColorHdr = czm_lightColorHdr;
#endif
vec3 color = inputMaterial.diffuse;
#ifdef HAS_NORMALS
color = czm_pbrLighting(
attributes.positionEC,
inputMaterial.normalEC,
czm_lightDirectionEC,
lightColorHdr,
pbrParameters
);
#ifdef USE_IBL_LIGHTING
color += imageBasedLightingStage(
attributes.positionEC,
inputMaterial.normalEC,
czm_lightDirectionEC,
lightColorHdr,
pbrParameters
);
#endif
#endif
color *= inputMaterial.occlusion;
color += inputMaterial.emissive;
#ifndef HDR
color = czm_acesTonemapping(color);
#endif
return color;
}
#endif
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
{
vec3 color = vec3(0.0);
#ifdef LIGHTING_PBR
color = computePbrLighting(material, attributes);
#else // unlit
color = material.diffuse;
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
color = czm_gammaCorrect(color);
#elif !defined(HDR)
color = czm_linearToSrgb(color);
#endif
material.diffuse = color;
}
`;var vje={UNLIT:0,PBR:1},wg=Object.freeze(vje);var Q8={};Q8.name="LightingPipelineStage";Q8.process=function(e,t){let n=e.model,i=e.lightingOptions,o=e.shaderBuilder;if(l(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,Oe.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",Oe.FRAGMENT);let s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===wg.PBR?o.addDefine("LIGHTING_PBR",void 0,Oe.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,Oe.FRAGMENT),o.addFragmentLines([J8])};var e5=Q8;var t5=`bool isDefaultStyleColor(vec3 color)
{
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
}
vec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)
{
vec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);
vec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;
return color;
}
vec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)
{
return vec2(textureTransform * vec3(texCoord, 1.0));
}
#ifdef HAS_NORMALS
vec3 computeNormal(ProcessedAttributes attributes)
{
vec3 ng = attributes.normalEC;
vec3 normal = ng;
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
vec2 normalTexCoords = TEXCOORD_NORMAL;
#ifdef HAS_NORMAL_TEXTURE_TRANSFORM
normalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);
#endif
#ifdef HAS_BITANGENTS
vec3 t = attributes.tangentEC;
vec3 b = attributes.bitangentEC;
mat3 tbn = mat3(t, b, ng);
vec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;
normal = normalize(tbn * (2.0 * n - 1.0));
#elif defined(GL_OES_standard_derivatives)
vec3 positionEC = attributes.positionEC;
vec3 pos_dx = dFdx(positionEC);
vec3 pos_dy = dFdy(positionEC);
vec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));
vec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
t = normalize(t - ng * dot(ng, t));
vec3 b = normalize(cross(ng, t));
mat3 tbn = mat3(t, b, ng);
vec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;
normal = normalize(tbn * (2.0 * n - 1.0));
#endif
#endif
#ifdef HAS_DOUBLE_SIDED_MATERIAL
if (czm_backFacing()) {
normal = -normal;
}
#endif
return normal;
}
#endif
void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
{
#ifdef HAS_NORMALS
material.normalEC = computeNormal(attributes);
#endif
vec4 baseColorWithAlpha = vec4(1.0);
#ifdef HAS_BASE_COLOR_TEXTURE
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
#endif
baseColorWithAlpha = czm_srgbToLinear(texture2D(u_baseColorTexture, baseColorTexCoords));
#ifdef HAS_BASE_COLOR_FACTOR
baseColorWithAlpha *= u_baseColorFactor;
#endif
#elif defined(HAS_BASE_COLOR_FACTOR)
baseColorWithAlpha = u_baseColorFactor;
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
baseColorWithAlpha = v_pointCloudColor;
#elif defined(HAS_COLOR_0)
vec4 color = attributes.color_0;
#ifdef HAS_SRGB_COLOR
color = czm_srgbToLinear(color);
#endif
baseColorWithAlpha *= color;
#endif
material.diffuse = baseColorWithAlpha.rgb;
material.alpha = baseColorWithAlpha.a;
#ifdef USE_CPU_STYLING
material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);
#endif
#ifdef HAS_OCCLUSION_TEXTURE
vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM
occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);
#endif
material.occlusion = texture2D(u_occlusionTexture, occlusionTexCoords).r;
#endif
#ifdef HAS_EMISSIVE_TEXTURE
vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;
#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM
emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);
#endif
vec3 emissive = czm_srgbToLinear(texture2D(u_emissiveTexture, emissiveTexCoords).rgb);
#ifdef HAS_EMISSIVE_FACTOR
emissive *= u_emissiveFactor;
#endif
material.emissive = emissive;
#elif defined(HAS_EMISSIVE_FACTOR)
material.emissive = u_emissiveFactor;
#endif
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE
vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM
specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);
#endif
vec4 specularGlossiness = czm_srgbToLinear(texture2D(u_specularGlossinessTexture, specularGlossinessTexCoords));
vec3 specular = specularGlossiness.rgb;
float glossiness = specularGlossiness.a;
#ifdef HAS_SPECULAR_FACTOR
specular *= u_specularFactor;
#endif
#ifdef HAS_GLOSSINESS_FACTOR
glossiness *= u_glossinessFactor;
#endif
#else
#ifdef HAS_SPECULAR_FACTOR
vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));
#else
vec3 specular = vec3(1.0);
#endif
#ifdef HAS_GLOSSINESS_FACTOR
float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);
#else
float glossiness = 1.0;
#endif
#endif
#ifdef HAS_DIFFUSE_TEXTURE
vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;
#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM
diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);
#endif
vec4 diffuse = czm_srgbToLinear(texture2D(u_diffuseTexture, diffuseTexCoords));
#ifdef HAS_DIFFUSE_FACTOR
diffuse *= u_diffuseFactor;
#endif
#elif defined(HAS_DIFFUSE_FACTOR)
vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));
#else
vec4 diffuse = vec4(1.0);
#endif
czm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(
diffuse.rgb,
specular,
glossiness
);
material.diffuse = parameters.diffuseColor;
material.alpha = diffuse.a;
material.specular = parameters.f0;
material.roughness = parameters.roughness;
#elif defined(LIGHTING_PBR)
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE
vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM
metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);
#endif
vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
float roughness = clamp(metallicRoughness.g, 0.04, 1.0);
#ifdef HAS_METALLIC_FACTOR
metalness *= u_metallicFactor;
#endif
#ifdef HAS_ROUGHNESS_FACTOR
roughness *= u_roughnessFactor;
#endif
#else
#ifdef HAS_METALLIC_FACTOR
float metalness = clamp(u_metallicFactor, 0.0, 1.0);
#else
float metalness = 1.0;
#endif
#ifdef HAS_ROUGHNESS_FACTOR
float roughness = clamp(u_roughnessFactor, 0.04, 1.0);
#else
float roughness = 1.0;
#endif
#endif
czm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(
material.diffuse,
metalness,
roughness
);
material.diffuse = parameters.diffuseColor;
material.specular = parameters.f0;
material.roughness = parameters.roughness;
#endif
}
`;var Dje=fn.Material,n5=fn.MetallicRoughness,i5=fn.SpecularGlossiness,xv={};xv.name="MaterialPipelineStage";xv.process=function(e,t,n){let i=t.material,o=e.uniformMap,r=e.shaderBuilder,s=n.context.defaultTexture,a=n.context.defaultNormalTexture,c=n.context.defaultEmissiveTexture;Pje(i,o,r,s,a,c),l(i.specularGlossiness)?Ije(i,o,r,s):Oje(i,o,r,s);let u=dn.getAttributeBySemantic(t,yn.NORMAL),f=e.lightingOptions;i.unlit||!u?f.lightingModel=wg.UNLIT:f.lightingModel=wg.PBR;let p=e.model.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=p;let _=e.alphaOptions;i.alphaMode===mg.BLEND?_.pass=Se.TRANSLUCENT:i.alphaMode===mg.MASK&&(_.alphaCutoff=i.alphaCutoff),r.addFragmentLines([t5]),i.doubleSided&&r.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,Oe.FRAGMENT)};function Tce(e,t,n,i,o){let r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,Oe.FRAGMENT);let s=`${i}Transform`;e.addUniform("mat3",s,Oe.FRAGMENT),t[s]=function(){return n.transform}}function vg(e,t,n,i,o,r){e.addUniform("sampler2D",i,Oe.FRAGMENT),t[i]=function(){return y(n.texture,r)};let s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,Oe.FRAGMENT);let c=`v_texCoord_${n.texCoord}`,u=`TEXCOORD_${o}`;e.addDefine(u,c,Oe.FRAGMENT);let f=n.transform;l(f)&&!Q.equals(f,Q.IDENTITY)&&Tce(e,t,n,i,o)}function Pje(e,t,n,i,o,r){let s=e.emissiveTexture;l(s)&&vg(n,t,s,"u_emissiveTexture","EMISSIVE",r);let a=e.emissiveFactor;l(a)&&!h.equals(a,Dje.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",Oe.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,Oe.FRAGMENT));let c=e.normalTexture;l(c)&&vg(n,t,c,"u_normalTexture","NORMAL",o);let u=e.occlusionTexture;l(u)&&vg(n,t,u,"u_occlusionTexture","OCCLUSION",i)}function Ije(e,t,n,i){let o=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,Oe.FRAGMENT);let r=o.diffuseTexture;l(r)&&vg(n,t,r,"u_diffuseTexture","DIFFUSE",i);let s=o.diffuseFactor;l(s)&&!ae.equals(s,i5.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",Oe.FRAGMENT),t.u_diffuseFactor=function(){return o.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,Oe.FRAGMENT));let a=o.specularGlossinessTexture;l(a)&&vg(n,t,a,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);let c=o.specularFactor;l(c)&&!h.equals(c,i5.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",Oe.FRAGMENT),t.u_specularFactor=function(){return o.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,Oe.FRAGMENT));let u=o.glossinessFactor;l(u)&&u!==i5.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",Oe.FRAGMENT),t.u_glossinessFactor=function(){return o.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,Oe.FRAGMENT))}function Oje(e,t,n,i){let o=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,Oe.FRAGMENT);let r=o.baseColorTexture;l(r)&&vg(n,t,r,"u_baseColorTexture","BASE_COLOR",i);let s=o.baseColorFactor;l(s)&&!ae.equals(s,n5.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",Oe.FRAGMENT),t.u_baseColorFactor=function(){return o.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,Oe.FRAGMENT));let a=o.metallicRoughnessTexture;l(a)&&vg(n,t,a,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);let c=o.metallicFactor;l(c)&&c!==n5.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",Oe.FRAGMENT),t.u_metallicFactor=function(){return o.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,Oe.FRAGMENT));let u=o.roughnessFactor;l(u)&&u!==n5.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",Oe.FRAGMENT),t.u_roughnessFactor=function(){return o.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,Oe.FRAGMENT))}xv._processTexture=vg;xv._processTextureTransform=Tce;var o5=xv;var r5=`void morphTargetsStage(inout ProcessedAttributes attributes)
{
vec3 positionMC = attributes.positionMC;
attributes.positionMC = getMorphedPosition(positionMC);
#ifdef HAS_NORMALS
vec3 normalMC = attributes.normalMC;
attributes.normalMC = getMorphedNormal(normalMC);
#endif
#ifdef HAS_TANGENTS
vec3 tangentMC = attributes.tangentMC;
attributes.tangentMC = getMorphedTangent(tangentMC);
#endif
}
`;var zr={};zr.name="MorphTargetsPipelineStage";zr.FUNCTION_ID_GET_MORPHED_POSITION="getMorphedPosition";zr.FUNCTION_SIGNATURE_GET_MORPHED_POSITION="vec3 getMorphedPosition(in vec3 position)";zr.FUNCTION_ID_GET_MORPHED_NORMAL="getMorphedNormal";zr.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL="vec3 getMorphedNormal(in vec3 normal)";zr.FUNCTION_ID_GET_MORPHED_TANGENT="getMorphedTangent";zr.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT="vec3 getMorphedTangent(in vec3 tangent)";zr.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,Oe.VERTEX),Fje(n);let i=t.morphTargets.length;for(let a=0;a<i;a++){let c=t.morphTargets[a].attributes,u=c.length;for(let f=0;f<u;f++){let d=c[f],p=d.semantic;p!==yn.POSITION&&p!==yn.NORMAL&&p!==yn.TANGENT||(Mje(e,d,e.attributeIndex,a),e.attributeIndex++)}}Vje(n);let r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,Oe.VERTEX),n.addVertexLines([r5]);let s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=Dt(s,e.uniformMap)};var Rje={attributeString:void 0,functionId:void 0};function Mje(e,t,n,i){let o=e.shaderBuilder;Bje(e,t,n);let r=Lje(t,Rje);Nje(o,r,i)}function Bje(e,t,n){let i={index:n,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:Cn.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function Lje(e,t){switch(e.semantic){case yn.POSITION:t.attributeString="Position",t.functionId=zr.FUNCTION_ID_GET_MORPHED_POSITION;break;case yn.NORMAL:t.attributeString="Normal",t.functionId=zr.FUNCTION_ID_GET_MORPHED_NORMAL;break;case yn.TANGENT:t.attributeString="Tangent",t.functionId=zr.FUNCTION_ID_GET_MORPHED_TANGENT;break;default:break}return t}function Nje(e,t,n){let i=t.attributeString,o=`a_target${i}_${n}`,r=`morphed${i} += u_morphWeights[${n}] * a_target${i}_${n};`;e.addAttribute("vec3",o),e.addFunctionLines(t.functionId,[r])}function Fje(e){e.addFunction(zr.FUNCTION_ID_GET_MORPHED_POSITION,zr.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,Oe.VERTEX);let t="vec3 morphedPosition = position;";e.addFunctionLines(zr.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(zr.FUNCTION_ID_GET_MORPHED_NORMAL,zr.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,Oe.VERTEX);let n="vec3 morphedNormal = normal;";e.addFunctionLines(zr.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(zr.FUNCTION_ID_GET_MORPHED_TANGENT,zr.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,Oe.VERTEX);let i="vec3 morphedTangent = tangent;";e.addFunctionLines(zr.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function Vje(e){let t="return morphedPosition;";e.addFunctionLines(zr.FUNCTION_ID_GET_MORPHED_POSITION,[t]);let n="return morphedNormal;";e.addFunctionLines(zr.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);let i="return morphedTangent;";e.addFunctionLines(zr.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}var s5=zr;var a5={};a5.name="PickingPipelineStage";a5.process=function(e,t,n){let i=n.context,o=e.runtimeNode,r=e.shaderBuilder,s=e.model,a=o.node.instances;if(e.hasPropertyTable)kje(e,t,a,i);else if(l(a))Uje(e,i);else{let c=bce(e),u=i.createPickId(c);s._pipelineResources.push(u),s._pickIds.push(u),r.addUniform("vec4","czm_pickColor",Oe.FRAGMENT);let f=e.uniformMap;f.czm_pickColor=function(){return u.color},e.pickId="czm_pickColor"}};function bce(e,t){let n=e.model,i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive},o;if(aa.is3DTiles(n.type)){let r=n.content;o={content:r,primitive:r.tileset,detail:i}}else o={primitive:n,detail:i};return o.id=n.id,l(t)&&(o.instanceId=t),o}function kje(e,t,n){let i=e.model,o,r,s=i.featureIdLabel,a=i.instanceFeatureIdLabel;l(i.featureTableId)?o=i.featureTableId:l(n)?(r=dn.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=dn.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);let c=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",Oe.FRAGMENT);let f=c.batchTexture;e.uniformMap.model_pickTexture=function(){return y(f.pickTexture,f.defaultTexture)},e.pickId="((selectedFeature.id < int(model_feature
float pointSize = model_pointCloudParameters.x;
float geometricError = model_pointCloudParameters.y;
float depthMultiplier = model_pointCloudParameters.z;
float depth = -positionEC.z;
return min((geometricError / depth) * depthMultiplier, pointSize);
}
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
float pointCloudShowStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
float tiles3d_tileset_time = model_pointCloudParameters.w;
return float(getShowFromStyle(attributes, metadata, tiles3d_tileset_time));
}
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
vec4 pointCloudColorStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
float tiles3d_tileset_time = model_pointCloudParameters.w;
return getColorFromStyle(attributes, metadata, tiles3d_tileset_time);
}
#endif
#ifdef HAS_POINT_CLOUD_POINT_SIZE_STYLE
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
float tiles3d_tileset_time = model_pointCloudParameters.w;
return float(getPointSizeFromStyle(attributes, metadata, tiles3d_tileset_time));
}
#elif defined(HAS_POINT_CLOUD_ATTENUATION)
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
return getPointSizeFromAttenuation(v_positionEC);
}
#endif
`;var zje=new ae,d5={};d5.name="PointCloudStylingPipelineStage";d5.process=function(e,t,n){let i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=l(s)?s.propertyAttributes:void 0,c=l(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,u=!l(a)&&c;if(l(r)&&!u){let x=jje(a),C=qje(r,x);Yje(i,C);let T=Xje(C).indexOf("normalMC")>=0,E=dn.getAttributeBySemantic(t,yn.NORMAL);if(T&&!E)throw new he("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,Oe.VERTEX),C.styleTranslucent&&(e.alphaOptions.pass=Se.TRANSLUCENT)}let f=o.pointCloudShading;o._attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,Oe.VERTEX);let d,p,_;aa.is3DTiles(o.type)&&(p=!0,d=o.content,_=d.tile.refine===Zr.ADD),i.addUniform("vec4","model_pointCloudParameters",Oe.VERTEX),i.addVertexLines([l5]);let m=e.uniformMap;m.model_pointCloudParameters=function(){let x=zje,C=1;p&&(C=_?5:d.tileset.maximumScreenSpaceError),x.x=y(f.maximumAttenuation,C),x.x*=n.pixelRatio;let A=Hje(e,t,f,d);x.y=A*f.geometricErrorScale;let T=n.context,E=n.camera.frustum,S;return n.mode===te.SCENE2D||E instanceof In?S=Number.POSITIVE_INFINITY:S=T.drawingBufferHeight/n.camera.frustum.sseDenominator,x.z=S,p&&(x.w=d.tileset.timeSinceLoad),x}};var Ece=new h;function Hje(e,t,n,i){if(l(i)){let f=i.tile.geometricError;if(f>0)return f}if(l(n.baseResolution))return n.baseResolution;let o=dn.getAttributeBySemantic(t,yn.POSITION),r=o.count,s=e.runtimeNode.transform,a=h.subtract(o.max,o.min,Ece);a=O.multiplyByPointAsVector(s,a,Ece);let c=a.x*a.y*a.z;return I.cbrt(c/r)}var Gje={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},Wje={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function jje(e){let t=mt(Wje);if(!l(e))return t;for(let n=0;n<e.length;n++){let o=e[n].properties;for(let r in o)o.hasOwnProperty(r)&&(t[r]=`metadata.${r}`)}return t}var u5="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function qje(e,t){let n=Gje,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${u5})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${u5})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${u5})`,t,i),n.styleTranslucent=l(n.colorStyleFunction)&&i.translucent,n}function Yje(e,t){let n=t.colorStyleFunction;l(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,Oe.BOTH),e.addVertexLines([n]),e.addVarying("vec4","v_pointCloudColor"));let i=t.showStyleFunction;l(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,Oe.VERTEX),e.addVertexLines([i]));let o=t.pointSizeStyleFunction;l(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,Oe.VERTEX),e.addVertexLines([o]))}function f5(e,t){let n=/attributes\.(\w+)/g,i=n.exec(e);for(;i!==null;){let o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function Xje(e){let t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return l(t)&&f5(t,o),l(n)&&f5(n,o),l(i)&&f5(i,o),o}var h5=d5;var m5=`void primitiveOutlineStage() {
v_outlineCoordinates = a_outlineCoordinates;
}
`;var p5=`void primitiveOutlineStage(inout czm_modelMaterial material) {
if (!model_showOutline) {
return;
}
float outlineX =
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;
float outlineY =
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;
float outlineZ =
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r;
float outlineness = max(outlineX, max(outlineY, outlineZ));
material.diffuse = mix(material.diffuse, model_outlineColor.rgb, model_outlineColor.a * outlineness);
}
`;var _5={};_5.name="PrimitiveOutlinePipelineStage";_5.process=function(e,t,n){let i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,Oe.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");let r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:Cn.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",Oe.FRAGMENT);let a=Np.createTexture(n.context);o.model_outlineTexture=function(){return a};let c=e.model;i.addUniform("vec4","model_outlineColor",Oe.FRAGMENT),o.model_outlineColor=function(){return c.outlineColor},i.addUniform("bool","model_showOutline",Oe.FRAGMENT),o.model_showOutline=function(){return c.showOutline},i.addVertexLines([m5]),i.addFragmentLines([p5])};var g5=_5;var zp={};zp.name="PrimitiveStatisticsPipelineStage";zp.process=function(e,t,n){let i=e.model,o=i.statistics;Sce(o,t),wce(o,e.runtimePrimitive),vce(o,t),Dce(o,t.material),Pce(o,t.featureIds),Ice(o,i)};function Sce(e,t){let n=l(t.indices)?t.indices.count:dn.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===He.POINTS?e.pointsLength+=n:He.isTriangles(i)&&(e.trianglesLength+=Kje(i,n));let o=t.attributes,r=o.length;for(let c=0;c<r;c++){let u=o[c];if(l(u.buffer)){let f=l(u.typedArray);e.addBuffer(u.buffer,f)}}let s=t.outlineCoordinates;l(s)&&l(s.buffer)&&e.addBuffer(s.buffer,!1);let a=t.indices;if(l(a)&&l(a.buffer)){let c=l(a.typedArray);e.addBuffer(a.buffer,c)}}function Kje(e,t){switch(e){case He.TRIANGLES:return t/3;case He.TRIANGLE_STRIP:case He.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function wce(e,t){let n=t.positionBuffer2D;l(n)&&e.addBuffer(n,!0)}function vce(e,t){let n=t.morphTargets;if(!l(n))return;let i=!1,o=n.length;for(let r=0;r<o;r++){let s=n[r].attributes,a=s.length;for(let c=0;c<a;c++){let u=s[c];l(u.buffer)&&e.addBuffer(u.buffer,i)}}}function Dce(e,t){let n=$je(t),i=n.length;for(let o=0;o<i;o++){let r=n[o];l(r)&&l(r.texture)&&e.addTexture(r.texture)}}function $je(e){let t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return l(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function Pce(e,t){let n=t.length;for(let i=0;i<n;i++){let o=t[i];if(o instanceof fn.FeatureIdTexture){let r=o.textureReader;l(r.texture)&&e.addTexture(r.texture)}}}function Ice(e,t){let n=t.structuralMetadata;l(n)&&(Zje(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);let i=t.featureTables;if(!l(i))return;let o=i.length;for(let r=0;r<o;r++){let s=i[r];e.addBatchTexture(s.batchTexture)}}function Zje(e,t){let n=t.propertyTextures;if(!l(n))return;let i=n.length;for(let o=0;o<i;o++){let s=n[o].properties;for(let a in s)if(s.hasOwnProperty(a)){let u=s[a].textureReader;l(u.texture)&&e.addTexture(u.texture)}}}zp._countGeometry=Sce;zp._count2DPositions=wce;zp._countMorphTargetAttributes=vce;zp._countMaterialTextures=Dce;zp._countFeatureIdTextures=Pce;zp._countBinaryMetadata=Ice;var y5=zp;var Jje=new O,Qje=new O,x5={};x5.name="SceneMode2DPipelineStage";x5.process=function(e,t,n){let i=dn.getAttributeBySemantic(t,yn.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=O.multiplyTransformation(s,a,Jje),u=nqe(e,c,n),f=e.runtimePrimitive;f.boundingSphere2D=u;let d=e.runtimeNode.node.instances;if(l(d))return;if(l(i.typedArray)){let x=rqe(i,c,u,n);f.positionBuffer2D=x,r._modelResources.push(x),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,Oe.VERTEX),o.addUniform("mat4","u_modelView2D",Oe.VERTEX);let p=O.fromTranslation(u.center,new O),_=n.context,m={u_modelView2D:function(){return O.multiplyTransformation(_.uniformState.view,p,Qje)}};e.uniformMap=Dt(m,e.uniformMap)};var eqe=new h,tqe=new h;function nqe(e,t,n){let i=O.multiplyByPoint(t,e.positionMin,eqe),o=Oo.computeActualWgs84Position(n,i,i),r=
{
mat4 skinningMatrix = getSkinningMatrix();
mat3 skinningMatrixMat3 = mat3(skinningMatrix);
vec4 positionMC = vec4(attributes.positionMC, 1.0);
attributes.positionMC = vec3(skinningMatrix * positionMC);
#ifdef HAS_NORMALS
vec3 normalMC = attributes.normalMC;
attributes.normalMC = skinningMatrixMat3 * normalMC;
#endif
#ifdef HAS_TANGENTS
vec3 tangentMC = attributes.tangentMC;
attributes.tangentMC = skinningMatrixMat3 * tangentMC;
#endif
}
`;var Wh={};Wh.name="SkinningPipelineStage";Wh.FUNCTION_ID_GET_SKINNING_MATRIX="getSkinningMatrix";Wh.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX="mat4 getSkinningMatrix()";Wh.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,Oe.VERTEX),aqe(n,t);let i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,Oe.VERTEX),n.addVertexLines([A5]);let r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=Dt(r,e.uniformMap)};function sqe(e){let t=-1,n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];(r.semantic===yn.JOINTS||r.semantic===yn.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function aqe(e,t){e.addFunction(Wh.FUNCTION_ID_GET_SKINNING_MATRIX,Wh.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,Oe.VERTEX);let n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(Wh.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o,r=["x","y","z","w"],s=sqe(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){let c=r[o],u=`skinnedMatrix += a_weights_${i}.${c} * u_jointMatrices[int(a_joints_${i}.${c})];`;e.addFunctionLines(Wh.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}let a="return skinnedMatrix;";e.addFunctionLines(Wh.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}var T5=Wh;var b5={};b5.name="WireframePipelineStage";b5.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,Oe.FRAGMENT);let o=e.model,r=cqe(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r;let s=!1;o.statistics.addBuffer(r,s);let a=e.primitiveType,c=e.count;e.primitiveType=He.LINES,e.count=LI.getWireframeIndicesCount(a,c)};function cqe(e,t,n){let o=dn.getAttributeBySemantic(e,yn.POSITION).count,r=n.context.webgl2,s;if(l(t)){let f=t.buffer,d=t.count;l(f)&&r?(s=f.sizeInBytes===d?new Uint8Array(d):Ge.createTypedArray(o,d),f.getBufferData(s)):s=t.typedArray}let a=e.primitiveType,c=LI.createWireframeIndices(a,o,s),u=Ge.fromSizeInBytes(c.BYTES_PER_ELEMENT);return Pt.createIndexBuffer({context:n.context,typedArray:c,usage:We.STATIC_DRAW,indexDatatype:u})}var E5=b5;function Cv(e){e=y(e,y.EMPTY_OBJECT);let t=e.primitive,n=e.node,i=e.model;this.primitive=t,this.node=n,this.model=i,this.pipelineStages=[],this.drawCommand=void 0,this.boundingSphere=void 0,this.boundingSphere2D=void 0,this.positionBuffer2D=void 0,this.updateStages=[]}Cv.prototype.configurePipeline=function(e){let t=this.pipelineStages;t.length=0;let n=this.primitive,i=this.node,o=this.model,r=o.customShader,s=o.style,a=e.context.webgl2,u=e.mode!==te.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,f=l(n.morphTargets)&&n.morphTargets.length>0,d=l(i.skin),p=l(r),m=!(p&&l(r.fragmentShaderText))||r.mode!==tx.REPLACE_MATERIAL,x=dn.hasQuantizedAttributes(n.attributes),C=o.debugWireframe&&He.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),A=o.pointCloudShading,T=l(A)&&A.attenuation,E=n.primitiveType===He.POINTS&&(l(s)||T),S=o._enableShowOutline&&l(n.outlineCoordinates),w=lqe(o,i,n);u&&t.push(C5),t.push(Z8),C&&t.push(E5),f&&t.push(s5),d&&t.push(T5),E&&t.push(h5),x&&t.push(X8),m&&t.push(o5),t.push(pT),t.push(bg),w.hasPropertyTable&&(t.push(_T),t.push(N8),t.push(Y8)),p&&t.push(G8),t.push(e5),o.allowPicking&&t.push(c5),S&&t.push(g5),t.push(B8),t.push(y5)};function lqe(e,t,n){let i;return l(t.instances)&&(i=dn.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(i))?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:(i=dn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),l(i)?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}function gT(e){e=y(e,y.EMPTY_OBJECT),this._sceneGraph=e.sceneGraph;let t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],uqe(this)}Object.defineProperties(gT.prototype,{skin:{get:function(){return this._skin}},sceneGraph:{get:function(){return this._sceneGraph}},inverseBindMatrices:{get:function(){return this._inverseBindMatrices}},joints:{get:function(){return this._joints}},jointMatrices:{get:function(){return this._jointMatrices}}});function uqe(e){let t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;let i=
`),r=new je({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
`),a=new je({defines:this._fragmentShaderParts.defineLines,sources:[s]});return gn.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};ca.prototype.clone=function(){return mt(this,!0)};function fqe(e){let t=[],n=[],i,o=e._vertexShaderParts.structIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.structIds,i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function dqe(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function hqe(e){let t=[],n=[],i,o=e._vertexShaderParts.functionIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.functionIds,i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function ZO(e){this.shaderBuilder=new ca,this.model=e,this.uniformMap={},this.alphaOptions=new $O,this.renderStateOptions=Ze.getState(Ze.fromCache({depthTest:{enabled:!0,func:pl.LESS_OR_EQUAL}}))}var S5=`void silhouetteStage(inout vec4 color) {
if(model_silhouettePass) {
color = czm_gammaCorrect(model_silhouetteColor);
}
}
`;var w5=`void silhouetteStage(in ProcessedAttributes attributes, inout vec4 positionClip) {
#ifdef HAS_NORMALS
if(model_silhouettePass) {
vec3 normal = normalize(czm_normal3D * attributes.normalMC);
normal.x *= czm_projection[0][0];
normal.y *= czm_projection[1][1];
positionClip.xy += normal.xy * positionClip.w * model_silhouetteSize * czm_pixelRatio / czm_viewport.z;
}
#endif
}
`;var Av={};Av.name="ModelSilhouettePipelineStage";Av.silhouettesLength=0;Av.process=function(e,t,n){l(t._silhouetteId)||(t._silhouetteId=++Av.silhouettesLength);let i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,Oe.BOTH),i.addVertexLines([w5]),i.addFragmentLines([S5]),i.addUniform("vec4","model_silhouetteColor",Oe.FRAGMENT),i.addUniform("float","model_silhouetteSize",Oe.VERTEX),i.addUniform("bool","model_silhouettePass",Oe.BOTH);let o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=Dt(o,e.uniformMap)};var v5=Av;var D5=`void modelSplitterStage()
{
#ifndef SHADOW_MAP
if (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
#endif
}
`;var CT={};CT.name="ModelSplitterPipelineStage";CT.SPLIT_DIRECTION_UNIFORM_NAME="model_splitDirection";CT.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,Oe.FRAGMENT),i.addFragmentLines([D5]);let o={};i.addUniform("float",CT.SPLIT_DIRECTION_UNIFORM_NAME,Oe.FRAGMENT),o[CT.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=Dt(o,e.uniformMap)};var P5=CT;function JO(e,t){this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=mt(e.uniformMap),this.alphaOptions=mt(e.alphaOptions),this.renderStateOptions=mt(e.renderStateOptions,!0),this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0,this.instancingTranslationMax=void 0,this.instancingTranslationMin=void 0,this.instancingReferencePoint2D=void 0}function QO(e){e=y(e,y.EMPTY_OBJECT),this.lightingModel=y(e.lightingModel,wg.UNLIT)}function eR(e,t){this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.hasPropertyTable=!1,this.uniformMap=mt(e.uniformMap),this.alphaOptions=mt(e.alphaOptions),this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;let n=t.primitive;this.count=l(n.indices)?n.indices.count:dn.getAttributeBySemantic(n,"POSITION").count,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;let i=dn.getPositionMinMax(n,e.instancingTranslationMin,e.instancingTranslationMax);this.positionMin=h.clone(i.min,new h),this.positionMax=h.clone(i.max,new h),this.boundingSphere=re.fromCornerPoints(this.positionMin,this.positionMax,new re),this.lightingOptions=new QO,this.pickId=void 0,this.renderStateOptions=mt(e.renderStateOptions,!0),this.styleCommandsNeeded=void 0}function sc(e){e=y(e,y.EMPTY_OBJECT);let t=e.modelComponents;this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=O.clone(O.IDENTITY),this._computedModelMatrix2D=O.clone(O.IDENTITY),this._axisCorrectionMatrix=dn.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new O),this._runtimeArticulations={},mqe(this)}Object.defineProperties(sc.prototype,{components:{get:function(){return this._components}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},axisCorrectionMatrix:{get:function(){return this._axisCorrectionMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}});function mqe(e){let t=e._components,n=t.scene,o=e._model.modelMatrix;Mce(e,o);let r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let T=0;T<s;T++){let E=r[T],S=new ex({articulation:E,sceneGraph:e}),w=S.name;a[w]=S}let c=t.nodes,u=c.length;e._runtimeNodes=new Array(u);let d=n.nodes.length,p=O.IDENTITY;for(let T=0;T<d;T++){let E=n.nodes[T],S=Bce(e,E,p);e._rootNodes.push(S)}let _=t.skins,m=e._runtimeSkins,x=_.length;for(let T=0;T<x;T++){let E=_[T];m.push(new gT({skin:E,sceneGraph:e}))}let C=e._skinnedNodes,A=C.length;for(let T=0;T<A;T++){let E=C[T],S=e._runtimeNodes[E],D=c[E].skin.index;S._runtimeSkin=m[D],S.updateJointMatrices()}e.applyArticulations()}function Mce(e,t){let n=e._components,i=e._model;e._computedModelMatrix=O.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=O.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=O.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}var pqe=new h;function _qe(e,t){let n=e._computedModelMatrix,i=O.getTranslation(n,pqe);if(!h.equals(i,h.ZERO))e._computedModelMatrix2D=Ut.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{let o=e.boundingSphere.center,r=Ut.wgs84To2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedMo
Geometric error: ${e.geometricError}`,o++),t.debugShowRenderingStatistics&&(i+=`
Commands: ${e.commandsLength}`,o++,e.content.pointsLength>0&&(i+=`
Points: ${e.content.pointsLength}`,o++),e.content.trianglesLength>0&&(i+=`
Triangles: ${e.content.trianglesLength}`,o++),i+=`
Features: ${e.content.featuresLength}`,o++),t.debugShowMemoryUsage&&(i+=`
Texture Memory: ${Ele(e.content.texturesByteLength)}`,i+=`
Geometry Memory: ${Ele(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+=`
Urls:`;let s=e.content.innerContentUrls;for(let a=0;a<s.length;a++)i+=`
- ${s[a]}`;o+=s.length}else i+=`
Url: ${e._contentHeader.uri}`,o++;let r={text:i.substring(1),position:n,font:`${19-o}px sans-serif`,showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(r)}function kKe(e,t){let n,i,o=e._selectedTiles,r=o.length,s=e._emptyTiles,a=s.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(l(e.debugPickedTile)){let c=l(e.debugPickPosition)?e.debugPickPosition:fG(e.debugPickedTile),u=dG(e.debugPickedTile,e,c);u.pixelOffset=new W(15,-15)}}else{for(n=0;n<r;++n)i=o[n],dG(i,e,fG(i));for(n=0;n<a;++n)i=s[n],(i.hasTilesetContent||i.hasImplicitContent)&&dG(i,e,fG(i))}e._tileDebugLabels.update(t)}function UKe(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;let i=n.isRender,o=e._statistics,r=t.commandList,s=r.length,a=e._selectedTiles,c=a.length,u=e._emptyTiles,f=u.length,d=e.tileVisible,p,_,m=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,m&&(l(e._stencilClearCommand)||(e._stencilClearCommand=new Fi({stencil:0,pass:Se.CESIUM_3D_TILE,renderState:Ze.fromCache({stencilMask:On.SKIP_LOD_MASK})})),r.push(e._stencilClearCommand));let x=r.length;for(p=0;p<c;++p)_=a[p],i&&d.raiseEvent(_),_.update(e,t,n),o.incrementSelectionCounts(_.content),++o.selected;for(p=0;p<f;++p)_=u[p],_.update(e,t,n);let C=r.length-x;if(e._backfaceCommands.trim(),m){let A=e._backfaceCommands.values,T=A.length;for(r.length+=T,p=C-1;p>=0;--p)r[x+T+p]=r[x+p];for(p=0;p<T;++p)r[x+p]=A[p]}C=r.length-s,o.numberOfCommands=C,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&C>0&&e._pointCloudEyeDomeLighting.update(t,s,e.pointCloudShading,e.boundingSphere),i&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(l(e._tileDebugLabels)||(e._tileDebugLabels=new xg),kKe(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var Sle=[];function zKe(e,t){let n=t,i=Sle;for(i.push(t);i.length>0;){t=i.pop();let o=t.children,r=o.length;for(let s=0;s<r;++s)i.push(o[s]);t!==n&&(HKe(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function wle(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function HKe(e,t){e._cache.unloadTile(e,t,wle),t.destroy()}la.prototype.trimLoadedTiles=function(){this._cache.trim()};function GKe(e,t){let n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;dx.clone(n,i);let c=o!==s||r!==a;c&&t.afterRender.push(function(){e.loadProgress.raiseEvent(o,r)}),e._tilesLoaded=n.numberOfPendingRequests===0&&n.numberOfTilesProcessing===0&&n.numberOfAttemptedRequests===0,c&&e._tilesLoaded&&(t.afterRender.push(function(){e.allTilesLoaded.raiseEvent()}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){e.initialTilesLoaded.raiseEvent()})))}function WKe(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function jKe(e,t){(t.frameNumber!==e._updatedModelMatrixFrame||!l(e._previousModelMatrix))&&(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!O.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=O.clone(e.modelMatrix,e._previousModelMatrix)))}function qKe(e,t,n,i){if(t.mode===te.MORPHING||!e.ready)return!1;let o=e._statistics;o.clear();let r=i.isRender;++e._updatedVisibilityFrame,WKe(e),jKe(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;let s=i.traversal.selectTiles(e,t);if(i.requestTiles&&RKe(e),UKe(e,t,i),dx.clone(o,n),r){let a=e._credits;if(l(a)&&o.selected!==0){let c=a.length;for(let
varying vec4 v_outlineColor;
varying float v_innerPercent;
varying float v_pixelDistance;
varying vec4 v_pickColor;
void main()
{
float distanceToCenter = length(gl_PointCoord - vec2(0.5));
float maxDistance = max(0.0, 0.5 - v_pixelDistance);
float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);
float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);
vec4 color = mix(v_outlineColor, v_color, innerAlpha);
color.a *= wholeAlpha;
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
if (color.a < 0.005)
{
discard;
}
#else
#ifdef OPAQUE
if (color.a < 0.995)
{
discard;
}
#else
if (color.a >= 0.995)
{
discard;
}
#endif
#endif
gl_FragColor = czm_gammaCorrect(color);
czm_writeLogDepth();
}
`;var gG=`uniform float u_maxTotalPointSize;
attribute vec4 positionHighAndSize;
attribute vec4 positionLowAndOutline;
attribute vec4 compressedAttribute0;
attribute vec4 compressedAttribute1;
attribute vec4 scaleByDistance;
attribute vec3 distanceDisplayConditionAndDisableDepth;
varying vec4 v_color;
varying vec4 v_outlineColor;
varying float v_innerPercent;
varying float v_pixelDistance;
varying vec4 v_pickColor;
const float SHIFT_LEFT8 = 256.0;
const float SHIFT_RIGHT8 = 1.0 / 256.0;
void main()
{
vec3 positionHigh = positionHighAndSize.xyz;
vec3 positionLow = positionLowAndOutline.xyz;
float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;
float totalSize = positionHighAndSize.w + outlineWidthBothSides;
float outlinePercent = outlineWidthBothSides / totalSize;
totalSize *= czm_pixelRatio;
totalSize += 3.0;
float temp = compressedAttribute1.x * SHIFT_RIGHT8;
float show = floor(temp);
#ifdef EYE_DISTANCE_TRANSLUCENCY
vec4 translucencyByDistance;
translucencyByDistance.x = compressedAttribute1.z;
translucencyByDistance.z = compressedAttribute1.w;
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
temp = compressedAttribute1.y * SHIFT_RIGHT8;
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
#endif
vec4 color;
vec4 outlineColor;
vec4 pickColor;
temp = compressedAttribute0.z * SHIFT_RIGHT8;
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor.r = floor(temp);
temp = compressedAttribute0.x * SHIFT_RIGHT8;
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
color.r = floor(temp);
temp = compressedAttribute0.y * SHIFT_RIGHT8;
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor.r = floor(temp);
temp = compressedAttribute0.w * SHIFT_RIGHT8;
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor = pickColor / 255.0;
temp = floor(temp) * SHIFT_RIGHT8;
outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor /= 255.0;
color.a = floor(temp);
color /= 255.0;
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
vec4 positionEC = czm_modelViewRelativeToEye * p;
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
float lengthSq;
if (czm_sceneMode == czm_sceneMode2D)
{
lengthSq = czm_eyeHeight2D.y;
}
else
{
lengthSq = dot(positionEC.xyz, positionEC.xyz);
}
#endif
#ifdef EYE_DISTANCE_SCALING
totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);
#endif
totalSize = min(totalSize, u_maxTotalPointSize);
if (totalSize < 1.0)
{
positionEC.xyz = vec3(0.0);
totalSize = 1.0;
}
float translucency = 1.0;
#ifdef EYE_DISTANCE_TRANSLUCENCY
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
if (translucency < 0.004)
{
positionEC.xyz = vec3(0.0);
}
#endif
#ifdef DISTANCE_DISPLAY_CONDITION
float nearSq = distanceDisplayConditionAndDisableDepth.x;
float farSq = distanceDisplayConditionAndDisableDepth.y;
if (lengthSq < nearSq || lengthSq > farSq) {
positionEC.xyz = vec3(0.0, 0.0, 1.0);
}
#endif
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
#ifdef DISABLE_DEPTH_DISTANCE
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
{
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
}
if (disableDepthTestDistance != 0.0)
{
float zclip = gl_Position.z / gl_Position.w;
bool clipped = (zclip < -1.0 || zclip > 1.0);
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
{
gl_Position.z = -gl_Position.w;
#ifdef LOG_DEPTH
czm_vertexLogDepth(vec4(czm_currentFrustum.x));
#endif
}
}
#endif
v_color = color;
v_color.a *= translucency * show;
v_outlineColor = outlineColor;
v_outlineColor.a *= translucency * show;
v_innerPercent = 1.0 - outlinePercent;
v_pixelDistance = 2.0 / totalSize;
gl_PointSize = totalSize * show;
gl_Position *= show;
v_pickColor = pickColor;
}
`;var u$e=Ma.SHOW_INDEX,CG=Ma.POSITION_INDEX,kle=Ma.COLOR_INDEX,f$e=Ma.OUTLINE_COLOR_INDEX,d$e=Ma.OUTLINE_WIDTH_INDEX,h$e=Ma.PIXEL_SIZE_INDEX,Ule=Ma.SCALE_BY_DISTANCE_INDEX,zle=Ma.TRANSLUCENCY_BY_DISTANCE_INDEX,Hle=Ma.DISTANCE_DISPLAY_CONDITION_INDEX,m$e=Ma.DISABLE_DEPTH_DISTANCE_INDEX,AG=Ma.NUMBER_OF_PROPERTIES,lc={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function hf(e){e=y(e,y.EMPTY_OBJECT),this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(AG),this._maxPixelSize=1,this._baseVolume=new re,this._baseVolumeWC=new re,this._baseVolume2D=new re,this._boundingVolume=new re,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=y(e.show,!0),this.modelMatrix=O.clone(y(e.modelMatrix,O.IDENTITY)),this._modelMatrix=O.clone(O.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,lr.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=te.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW,We.STATIC_DRAW];let t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(hf.prototype,{length:{get:function(){return TG(this),this._pointPrimitives.length}}});function Gle(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}hf.prototype.add=function(e){let t=new Ma(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};hf.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};hf.prototype.removeAll=function(){Gle(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function TG(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;let t=[],n=e._pointPrimitives,i=n.length;for(let o=0,r=0;o<i;++o){let s=n[o];s&&(s._index=r++,t.push(s))}e._pointPrimitives=t}}hf.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};hf.prototype.contains=function(e){return l(e)&&e._pointPrimitiveCollection===this};hf.prototype.get=function(e){return TG(this),this._pointPrimitives[e]};hf.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<AG;++i){let o=n[i]===0?We.STATIC_DRAW:We.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function p$e(e,t,n){return new Xy(e,[{index:lc.positionHighAndSize,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[CG]},{index:lc.positionLowAndShow,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[CG]},{index:lc.compressedAttribute0,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[kle]},{index:lc.compressedAttribute1,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[zle]},{index:lc.scaleByDistance,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[Ule]},{index:lc.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:X.FLOAT,usage:n[Hle]}],t)}var yG=new xi;function Wle(e,t,n,i){let o=i._index,r=i._getActualPosition();e._mode===te.SCENE3D&&(re.expand(e._baseVolume,r,e._baseVolume),e._boundingVolume
attribute vec2 textureCoordinates;
varying vec2 v_textureCoordinates;
void main()
{
gl_Position = position;
v_textureCoordinates = textureCoordinates;
}
`;function JM(e){this._context=e}var pD,knt=new pt({primitiveType:He.TRIANGLES}),Unt=new Fi({color:new H(0,0,0,0)});function znt(e,t){return new nc({context:e,colorTextures:[t],destroyAttachments:!1})}function Hnt(e,t){return gn.fromCache({context:e,vertexShaderSource:mD,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function Gnt(e,t){return(!l(pD)||pD.viewport.width!==e||pD.viewport.height!==t)&&(pD=Ze.fromCache({viewport:new it(0,0,e,t)})),pD}JM.prototype.execute=function(e){l(e.preExecute)&&e.preExecute(e);let t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=l(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=l(e.shaderProgram)?e.shaderProgram:Hnt(o,e.fragmentShaderSource),a=znt(o,t),c=Gnt(n,i),u=e.uniformMap,f=Unt;f.framebuffer=a,f.renderState=c,f.execute(o);let d=knt;d.vertexArray=r,d.renderState=c,d.shaderProgram=s,d.uniformMap=u,d.framebuffer=a,d.execute(o),a.destroy(),e.persists||(s.destroy(),l(e.vertexArray)&&r.destroy()),l(e.postExecute)&&e.postExecute(t)};JM.prototype.isDestroyed=function(){return!1};JM.prototype.destroy=function(){return fe(this)};var hW=JM;function Wnt(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}var Rl=Wnt;function Hd(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(Hd.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});Hd.prototype.replaceShaderProgram=function(e){return l(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};Hd.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource,i=e.attributeLocations;typeof t=="string"&&(t=new je({sources:[t]})),typeof n=="string"&&(n=new je({sources:[n]}));let o=t.createCombinedVertexShader(this._context),r=n.createCombinedFragmentShader(this._context),s=o+r+JSON.stringify(i),a;if(l(this._shaders[s]))a=this._shaders[s],delete this._shadersToRelease[s];else{let c=this._context,u=new gn({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:t,vertexShaderText:o,fragmentShaderSource:n,fragmentShaderText:r,attributeLocations:i});a={cache:this,shaderProgram:u,keyword:s,derivedKeywords:[],count:0},u._cachedShader=a,this._shaders[s]=a,++this._numberOfShaders}return++a.count,a.shaderProgram};Hd.prototype.replaceDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(l(r)){mW(this,r);let s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};Hd.prototype.getDerivedShaderProgram=function(e,t){let n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(!!l(o))return o.shaderProgram};Hd.prototype.createDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=n.vertexShaderSource,s=n.fragmentShaderSource,a=n.attributeLocations;typeof r=="string"&&(r=new je({sources:[r]})),typeof s=="string"&&(s=new je({sources:[s]}));let c=this._context,u=r.createCombinedVertexShader(c),f=s.createCombinedFragmentShader(c),d=new gn({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:f,attributeLocations:a}),p={cache:this,shaderProgram:d,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),d._cachedShader=p,this._shaders[o]=p,d};function mW(e,t){let n=t.derivedKeywords,i=n.length;for(let o=0;o<i;++o){let r=n[o]+t.keyword,s=e._shaders[r];mW(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}Hd.prototype.destroyReleasedShaderPrograms=function(){let e=this._shadersToRelease;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];mW(this,n),--this._numberOfShaders}this._shadersToRelease={}};Hd.prototype.releaseShaderProgram=function(e){if(l(e)){let t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};Hd.prototype.isDestroyed=function(){return!1};Hd.prototype.destroy=function(){let e=this._shaders;for(let t in e)e.has
varying vec2 v_textureCoordinates;
float sampleTexture(vec2 offset) {
`;return e===0?n+=` vec4 color = texture2D(colorTexture, v_textureCoordinates + offset);
return czm_luminance(color.rgb);
`:n+=` return texture2D(colorTexture, v_textureCoordinates + offset).r;
`,n+=`}
`,n+=`uniform vec2 colorTextureDimensions;
uniform vec2 minMaxLuminance;
uniform sampler2D previousLuminance;
void main() {
float color = 0.0;
float xStep = 1.0 / colorTextureDimensions.x;
float yStep = 1.0 / colorTextureDimensions.y;
int count = 0;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
vec2 offset;
offset.x = -xStep + float(i) * xStep;
offset.y = -yStep + float(j) * yStep;
if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) {
continue;
}
color += sampleTexture(offset);
++count;
}
}
if (count > 0) {
color /= float(count);
}
`,e===t-1&&(n+=` float previous = texture2D(previousLuminance, vec2(0.5)).r;
color = clamp(color, minMaxLuminance.x, minMaxLuminance.y);
color = previous + (color - previous) / (60.0 * 1.5);
color = clamp(color, minMaxLuminance.x, minMaxLuminance.y);
`),n+=` gl_FragColor = vec4(color);
}
`,n}function kit(e,t){ape(e);let n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(Vit(r,i),{framebuffer:n[r].framebuffer,uniformMap:Fit(e,r)});e._commands=o}Mx.prototype.clear=function(e){let t=this._framebuffers;if(!l(t))return;let n=this._clearCommand;l(n)||(n=this._clearCommand=new Fi({color:new H(0,0,0,0),framebuffer:void 0}));let i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};Mx.prototype.update=function(e){let t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,Nit(this,e),kit(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;let i=this._framebuffers,o=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=o};Mx.prototype.execute=function(e,t){this._colorTexture=t;let n=this._commands;if(!l(n))return;let i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};Mx.prototype.isDestroyed=function(){return!1};Mx.prototype.destroy=function(){return spe(this),ape(this),fe(this)};var vW=Mx;var Uit={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"},DW=Object.freeze(Uit);function yD(e){}yD.prototype.isReady=function(){return!0};yD.prototype.shouldDiscardImage=function(e){return yD.EMPTY_IMAGE===e};var QM;Object.defineProperties(yD,{EMPTY_IMAGE:{get:function(){return l(QM)||(QM=new Image,QM.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),QM}}});var eB=yD;function pa(e){e=y(e,y.EMPTY_OBJECT);let t=e.key;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._key=t,this._resource=Fe.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=y(e.mapStyle,DW.AERIAL),this._culture=y(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,l(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new eB),this._proxy=e.proxy,this._credit=new _n(`<a href="http://www.bing.com"><img src="${pa.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new ws({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new xe,this._ready=!1;let n=this._tileProtocol;l(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";let i=this._resource.getDerivedResource({url:`REST/v1/Imagery/Metadata/${this._mapStyle}`,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:n}}),o=this,r;function s(d){if(d.resourceSets.length!==1)return a();let p=d.resourceSets[0].resources[0];o._tileWidth=p.imageWidth,o._tileHeight=p.imageHeight,o._maximumLevel=p.zoomMax-1,o._imageUrlSubdomains=p.imageUrlSubdomains,o._imageUrlTemplate=p.imageUrl;let _=o._attributionList=p.imageryProviders;_||(_=o._attributionList=[]);for(let m=0,x=_.length;m<x;++m){let C=_[m];if(C.credit instanceof _n)break;C.credit=new _n(C.attribution);let A=C.coverageAreas;for(let T=0,E=C.coverageAreas.length;T<E;++T){let S=A[T],w=S.bbox;S.bbox=new me(I.toRadians(w[1]),I.toRadians(w[0]),I.toRadians(w[3]),I.toRadians(w[2]))}}return o._ready=!0,bi.reportSuccess(r),Promise.resolve(!0)}function a(d){let p=`An error occurred while accessing ${i.url}.`;return r=bi.reportError(r,o,o._errorEvent,p,void 0,void 0,void 0),r.retry?u():Promise.reject(new he(p))}let c=i.url;function u(){let d=i.fet
const float M_PI = 3.141592653589793;
float vdcRadicalInverse(int i)
{
float r;
float base = 2.0;
float value = 0.0;
float invBase = 1.0 / base;
float invBi = invBase;
for (int x = 0; x < 100; x++)
{
if (i <= 0)
{
break;
}
r = mod(float(i), base);
value += r * invBi;
invBi *= invBase;
i = int(float(i) * invBase);
}
return value;
}
vec2 hammersley2D(int i, int N)
{
return vec2(float(i) / float(N), vdcRadicalInverse(i));
}
vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)
{
float a = roughness * roughness;
float phi = 2.0 * M_PI * xi.x;
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 tangentX = normalize(cross(upVector, N));
vec3 tangentY = cross(N, tangentX);
return tangentX * H.x + tangentY * H.y + N * H.z;
}
float G1_Smith(float NdotV, float k)
{
return NdotV / (NdotV * (1.0 - k) + k);
}
float G_Smith(float roughness, float NdotV, float NdotL)
{
float k = roughness * roughness / 2.0;
return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);
}
vec2 integrateBrdf(float roughness, float NdotV)
{
vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);
float A = 0.0;
float B = 0.0;
const int NumSamples = 1024;
for (int i = 0; i < NumSamples; i++)
{
vec2 xi = hammersley2D(i, NumSamples);
vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));
vec3 L = 2.0 * dot(V, H) * H - V;
float NdotL = clamp(L.z, 0.0, 1.0);
float NdotH = clamp(H.z, 0.0, 1.0);
float VdotH = clamp(dot(V, H), 0.0, 1.0);
if (NdotL > 0.0)
{
float G = G_Smith(roughness, NdotV, NdotL);
float G_Vis = G * VdotH / (NdotH * NdotV);
float Fc = pow(1.0 - VdotH, 5.0);
A += (1.0 - Fc) * G_Vis;
B += Fc * G_Vis;
}
}
return vec2(A, B) / float(NumSamples);
}
void main()
{
gl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
}
`;function xD(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(xD.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function Xit(e,t,n){let i=t.createViewportQuadCommand(OW,{framebuffer:n,renderState:Ze.fromCache({viewport:new it(0,0,256,256)})});e._drawCommand=i}xD.prototype.update=function(e){if(!l(this._colorTexture)){let t=e.context,n=new Zt({context:t,width:256,height:256,pixelFormat:It.RGBA,pixelDatatype:lt.UNSIGNED_BYTE,sampler:Nn.NEAREST});this._colorTexture=n;let i=new nc({context:t,colorTextures:[n],destroyAttachments:!1});Xit(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};xD.prototype.isDestroyed=function(){return!1};xD.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),fe(this)};var RW=xD;var fpe={};function Kit(e,t,n){let i,o,r;if(e instanceof io){let s=Math.tan(.5*e.fovy);return i=e.near,o=e.near*s,r=e.aspectRatio*o,Math.max(t*i/r,n*i/o)}else if(e instanceof Gl)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}var $it=new h,cpe=new h;function dpe(e,t,n,i){if(l(i)&&n(.5)>i){let o=n(0),r=n(1),s=n(.5),a=s-o,c=s-r;return function(u){let f=n(u);if(u<=.5){let p=(f-o)/a;return I.lerp(e,-I.PI_OVER_TWO,p)}let d=(f-r)/c;return I.lerp(-I.PI_OVER_TWO,t,1-d)}}return function(o){return I.lerp(e,t,o)}}function BW(e,t,n,i,o){let r=o,s=Math.max(n,i);if(!l(r)){let a=e.position,c=t,u=e.up,f=e.right,d=e.frustum,p=h.subtract(a,c,$it),_=h.magnitude(h.multiplyByScalar(u,h.dot(p,u),cpe)),m=h.magnitude(h.multiplyByScalar(f,h.dot(p,f),cpe));r=Math.min(Kit(d,_,m)*.2,1e9)}if(s<r){let u=-Math.pow((r-n)*1e6,.125),f=Math.pow((r-i)*1e6,1/8);return function(d){let p=d*(f-u)+u;return-Math.pow(p,8)/1e6+r}}return function(a){return I.lerp(n,i,a)}}function CD(e,t){return I.equalsEpsilon(e,I.TWO_PI,I.EPSILON11)&&(e=0),t>e+Math.PI?e+=I.TWO_PI:t<e-Math.PI&&(e-=I.TWO_PI),e}var hpe=new h;function Zit(e,t,n,i,o,r,s,a){let c=e.camera,u=h.clone(c.position,hpe),f=c.pitch,d=CD(c.heading,i),p=CD(c.roll,r),_=BW(c,n,u.z,n.z,s),m=dpe(f,o,_,a);function x(C){let A=C.time/t;c.setView({orientation:{heading:I.lerp(d,i,A),pitch:m(A),roll:I.lerp(p,r,A)}}),W.lerp(u,n,A,c.position),c.position.z=_(A)}return x}function Jit(e,t){e.longitude<t.longitude?e.longitude+=I.TWO_PI:t.longitude+=I.TWO_PI}function Qit(e,t){let n=e.longitude-t.longitude;n<-I.PI?e.longitude+=I.TWO_PI:n>I.PI&&(t.longitude+=I.TWO_PI)}var eot=new _e,tot=new _e;function not(e,t,n,i,o,r,s,a,c,u){let f=e.camera,p=e.mapProjection.ellipsoid,_=_e.clone(f.positionCartographic,eot),m=f.pitch,x=CD(f.heading,i),C=CD(f.roll,r),A=p.cartesianToCartographic(n,tot);_.longitude=I.zeroToTwoPi(_.longitude),A.longitude=I.zeroToTwoPi(A.longitude);let T=!1;if(l(a)){let D=I.zeroToTwoPi(a),R=Math.min(_.longitude,A.longitude),M=Math.max(_.longitude,A.longitude),L=D>=R&&D<=M;if(l(c)){let N=Math.abs(_.longitude-A.longitude),g=I.TWO_PI-N;(L?N:g)<(L?g:N)*c&&!L&&(T=!0)}else L||(T=!0)}T?Jit(_,A):Qit(_,A);let E=BW(f,n,_.height,A.height,s),S=dpe(m,o,E,u);function w(){let D=_.longitude,R=A.longitude,M=_.latitude,L=A.latitude;return function(g){let b=g.time/t,v=h.fromRadians(I.lerp(D,R,b),I.lerp(M,L,b),E(b),p);f.setView({destination:v,orientation:{heading:I.lerp(x,i,b),pitch:S(b),roll:I.lerp(C,r,b)}})}}return w()}function iot(e,t,n,i,o,r,s){let a=e.camera,c=h.clone(a.position,hpe),u=CD(a.heading,i),f=a.frustum.right-a.frustum.left,d=BW(a,n,f,n.z,s);function p(_){let m=_.time/t;a.setView({orientation:{heading:I.lerp(u,i,m)}}),W.lerp(c,n,m,a.position);let x=d(m),C=a.frustum,A=C.top/C.right,T=(x-(C.right-C.left))*.5;C.right+=T,C.left-=T,C.top=A*C.right,C.bottom=-C.top}return p}var lpe=new _e,oot=new h;function MW(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function upe(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}fpe.createTween=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=t.destination,i=e.mode;if(i===te.MORPHING)return MW();let o=y(t.convert,!0),
{
return ${f};
}
`}return r=`${i} ${e}
{
${r} return ${i}(1.0);
}
`,r};Eb.prototype.getVariables=function(){let e=[],t=this._runtimeConditions;if(!l(t)||t.length===0)return e;let n=t.length;for(let i=0;i<n;++i){let o=t[i];e.push.apply(e,o.condition.getVariables()),e.push.apply(e,o.expression.getVariables())}return e=e.filter(function(i,o,r){return r.indexOf(i)===o}),e};var jW=Eb;function i0(e){if(this._style={},this._ready=!1,this._show=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._labelColor=void 0,this._labelOutlineColor=void 0,this._labelOutlineWidth=void 0,this._font=void 0,this._labelStyle=void 0,this._labelText=void 0,this._backgroundColor=void 0,this._backgroundPadding=void 0,this._backgroundEnabled=void 0,this._scaleByDistance=void 0,this._translucencyByDistance=void 0,this._distanceDisplayCondition=void 0,this._heightOffset=void 0,this._anchorLineEnabled=void 0,this._anchorLineColor=void 0,this._image=void 0,this._disableDepthTestDistance=void 0,this._horizontalOrigin=void 0,this._verticalOrigin=void 0,this._labelHorizontalOrigin=void 0,this._labelVerticalOrigin=void 0,this._meta=void 0,this._colorShaderFunction=void 0,this._showShaderFunction=void 0,this._pointSizeShaderFunction=void 0,this._colorShaderFunctionReady=!1,this._showShaderFunctionReady=!1,this._pointSizeShaderFunctionReady=!1,this._colorShaderTranslucent=!1,typeof e=="string"||e instanceof Fe){let t=Fe.createIfNeeded(e),n=this;this._readyPromise=t.fetchJson(e).then(function(i){return kpe(n,i),n})}else kpe(this,e),this._readyPromise=Promise.resolve(this)}function kpe(e,t){t=y(mt(t,!0),e._style),e._style=t,e.show=t.show,e.color=t.color,e.pointSize=t.pointSize,e.pointOutlineColor=t.pointOutlineColor,e.pointOutlineWidth=t.pointOutlineWidth,e.labelColor=t.labelColor,e.labelOutlineColor=t.labelOutlineColor,e.labelOutlineWidth=t.labelOutlineWidth,e.labelStyle=t.labelStyle,e.font=t.font,e.labelText=t.labelText,e.backgroundColor=t.backgroundColor,e.backgroundPadding=t.backgroundPadding,e.backgroundEnabled=t.backgroundEnabled,e.scaleByDistance=t.scaleByDistance,e.translucencyByDistance=t.translucencyByDistance,e.distanceDisplayCondition=t.distanceDisplayCondition,e.heightOffset=t.heightOffset,e.anchorLineEnabled=t.anchorLineEnabled,e.anchorLineColor=t.anchorLineColor,e.image=t.image,e.disableDepthTestDistance=t.disableDepthTestDistance,e.horizontalOrigin=t.horizontalOrigin,e.verticalOrigin=t.verticalOrigin,e.labelHorizontalOrigin=t.labelHorizontalOrigin,e.labelVerticalOrigin=t.labelVerticalOrigin;let n={};if(l(t.meta)){let i=t.defines,o=y(t.meta,y.EMPTY_OBJECT);for(let r in o)o.hasOwnProperty(r)&&(n[r]=new Bh(o[r],i))}e._meta=n,e._ready=!0}function Ar(e,t){let n=y(e._style,y.EMPTY_OBJECT).defines;if(l(t)){if(typeof t=="boolean"||typeof t=="number")return new Bh(String(t));if(typeof t=="string")return new Bh(t,n);if(l(t.conditions))return new jW(t,n)}else return;return t}function Tr(e){if(l(e)){if(l(e.expression))return e.expression;if(l(e.conditionsExpression))return mt(e.conditionsExpression,!0)}else return;return e}Object.defineProperties(i0.prototype,{style:{get:function(){return this._style}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},show:{get:function(){return this._show},set:function(e){this._show=Ar(this,e),this._style.show=Tr(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=Ar(this,e),this._style.color=Tr(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=Ar(this,e),this._style.pointSize=Tr(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Ar(this,e),this._style.pointOutlineColor=Tr(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=Ar(this,e),this._style.pointOutlineWidth=Tr(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColo
uniform vec3 u_noiseTextureDimensions;
uniform float u_noiseDetail;
varying vec2 v_offset;
varying vec3 v_maximumSize;
varying vec4 v_color;
varying float v_slice;
varying float v_brightness;
float wrap(float value, float rangeLength) {
if(value < 0.0) {
float absValue = abs(value);
float modValue = mod(absValue, rangeLength);
return mod(rangeLength - modValue, rangeLength);
}
return mod(value, rangeLength);
}
vec3 wrapVec(vec3 value, float rangeLength) {
return vec3(wrap(value.x, rangeLength),
wrap(value.y, rangeLength),
wrap(value.z, rangeLength));
}
float textureSliceWidth = u_noiseTextureDimensions.x;
float noiseTextureRows = u_noiseTextureDimensions.y;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
float textureSliceWidthSquared = textureSliceWidth * textureSliceWidth;
vec2 inverseNoiseTextureDimensions = vec2(noiseTextureRows / textureSliceWidthSquared,
inverseNoiseTextureRows / textureSliceWidth);
vec2 voxelToUV(vec3 voxelIndex) {
vec3 wrappedIndex = wrapVec(voxelIndex, textureSliceWidth);
float column = mod(wrappedIndex.z, textureSliceWidth * inverseNoiseTextureRows);
float row = floor(wrappedIndex.z / textureSliceWidth * noiseTextureRows);
float xPixelCoord = wrappedIndex.x + column * textureSliceWidth;
float yPixelCoord = wrappedIndex.y + row * textureSliceWidth;
return vec2(xPixelCoord, yPixelCoord) * inverseNoiseTextureDimensions;
}
vec4 lerpSamplesX(vec3 voxelIndex, float x) {
vec2 uv0 = voxelToUV(voxelIndex);
vec2 uv1 = voxelToUV(voxelIndex + vec3(1.0, 0.0, 0.0));
vec4 sample0 = texture2D(u_noiseTexture, uv0);
vec4 sample1 = texture2D(u_noiseTexture, uv1);
return mix(sample0, sample1, x);
}
vec4 sampleNoiseTexture(vec3 position) {
vec3 recenteredPos = position + vec3(textureSliceWidth / 2.0);
vec3 lerpValue = fract(recenteredPos);
vec3 voxelIndex = floor(recenteredPos);
vec4 xLerp00 = lerpSamplesX(voxelIndex, lerpValue.x);
vec4 xLerp01 = lerpSamplesX(voxelIndex + vec3(0.0, 0.0, 1.0), lerpValue.x);
vec4 xLerp10 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 0.0), lerpValue.x);
vec4 xLerp11 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 1.0), lerpValue.x);
vec4 yLerp0 = mix(xLerp00, xLerp10, lerpValue.y);
vec4 yLerp1 = mix(xLerp01, xLerp11, lerpValue.y);
return mix(yLerp0, yLerp1, lerpValue.z);
}
bool intersectSphere(vec3 origin, vec3 dir, float slice,
out vec3 point, out vec3 normal) {
float A = dot(dir, dir);
float B = dot(origin, dir);
float C = dot(origin, origin) - 0.25;
float discriminant = (B * B) - (A * C);
if(discriminant < 0.0) {
return false;
}
float root = sqrt(discriminant);
float t = (-B - root) / A;
if(t < 0.0) {
t = (-B + root) / A;
}
point = origin + t * dir;
if(slice >= 0.0) {
point.z = (slice / 2.0) - 0.5;
if(length(point) > 0.5) {
return false;
}
}
normal = normalize(point);
point -= czm_epsilon2 * normal;
return true;
}
bool intersectEllipsoid(vec3 origin, vec3 dir, vec3 center, vec3 scale, float slice,
out vec3 point, out vec3 normal) {
if(scale.x <= 0.01 || scale.y < 0.01 || scale.z < 0.01) {
return false;
}
vec3 o = (origin - center) / scale;
vec3 d = dir / scale;
vec3 p, n;
bool intersected = intersectSphere(o, d, slice, p, n);
if(intersected) {
point = (p * scale) + center;
normal = n;
}
return intersected;
}
vec2 phaseShift2D(vec2 p, vec2 freq) {
return (czm_pi / 2.0) * sin(freq.yx * p.yx);
}
vec2 phaseShift3D(vec3 p, vec2 freq) {
return phaseShift2D(p.xy, freq) + czm_pi * vec2(sin(freq.x * p.z));
}
const float T0 = 0.6;
const float k = 0.1;
const float C0 = 0.8;
const float FX0 = 0.6;
const float FY0 = 0.6;
const int octaves = 5;
float T(vec3 point) {
vec2 sum = vec2(0.0);
float Ci = C0;
vec2 FXY = vec2(FX0, FY0);
vec2 PXY = vec2(0.0);
for(int i = 1; i <= octaves; i++) {
PXY = phaseShift3D(point, FXY);
Ci *= 0.707;
FXY *= 2.0;
vec2 sinTerm = sin(FXY * point.xy + PXY);
sum += Ci * sinTerm + vec2(T0);
}
return k * sum.x * sum.y;
}
const float a = 0.5;
const float t = 0.4;
const float s = 0.25;
float I(float Id, float Is, float It) {
return (1.0 - a) * ((1.0 - t) * ((1.0 - s) * Id + s * Is) + t * It) + a;
}
const vec3 lightDir = normalize(vec3(0.2, -1.0, 0.7));
vec4 drawCloud(vec3 rayOrigin, vec3 rayDir, vec3 cloudCenter, vec3 cloudScale, float cloudSlice,
float brightness) {
vec3 cloudPoint, cloudNormal;
if(!intersectEllipsoid(rayOrigin, rayDir, cloudCenter, cloudScale, cloudSlice,
cloudPoint, cloudNormal)) {
return vec4(0.0);
}
float Id = clamp(dot(cloudNormal, -lightDir), 0.0, 1.0);
float Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0);
float It = T(cloudPoint);
float intensity = I(Id, Is, It);
vec3 color = vec3(intensity * clamp(brightness, 0.1, 1.0));
vec4 noise = sampleNoiseTexture(u_noiseDetail * cloudPoint);
float W = noise.x;
float W2 = noise.y;
float W3 = noise.z;
float ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);
float TR = pow(ndDot, 3.0) - W;
TR *= 1.3;
float minusDot = 0.5 - ndDot;
TR -= min(minusDot * W2, 0.0);
TR -= 0.8 * (minusDot + 0.25) * W3;
float shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);
shading = clamp(shading + 0.2, 0.3, 1.0);
vec3 finalColor = mix(vec3(0.5), shading * color, 1.15);
return vec4(finalColor, clamp(TR, 0.0, 1.0)) * v_color;
}
void main() {
#ifdef DEBUG_BILLBOARDS
gl_FragColor = vec4(0.0, 0.5, 0.5, 1.0);
#endif
vec2 coordinate = v_maximumSize.xy * v_offset;
vec3 ellipsoidScale = 0.82 * v_maximumSize;
vec3 ellipsoidCenter = vec3(0.0);
float zOffset = max(ellipsoidScale.z - 10.0, 0.0);
vec3 eye = vec3(0, 0, -10.0 - zOffset);
vec3 rayDir = normalize(vec3(coordinate, 1.0) - eye);
vec3 rayOrigin = eye;
#ifdef DEBUG_ELLIPSOIDS
vec3 point, normal;
if(intersectEllipsoid(rayOrigin, rayDir, ellipsoidCenter, ellipsoidScale, v_slice,
point, normal)) {
gl_FragColor = v_brightness * v_color;
}
#else
#ifndef DEBUG_BILLBOARDS
vec4 cloud = drawCloud(rayOrigin, rayDir,
ellipsoidCenter, ellipsoidScale, v_slice, v_brightness);
if(cloud.w < 0.01) {
discard;
}
gl_FragColor = cloud;
#endif
#endif
}
`;var $W=`#ifdef INSTANCED
attribute vec2 direction;
#endif
attribute vec4 positionHighAndScaleX;
attribute vec4 positionLowAndScaleY;
attribute vec4 packedAttribute0;
attribute vec4 packedAttribute1;
attribute vec4 color;
varying vec2 v_offset;
varying vec3 v_maximumSize;
varying vec4 v_color;
varying float v_slice;
varying float v_brightness;
void main() {
vec3 positionHigh = positionHighAndScaleX.xyz;
vec3 positionLow = positionLowAndScaleY.xyz;
vec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);
float show = packedAttribute0.x;
float brightness = packedAttribute0.y;
vec2 coordinates = packedAttribute0.wz;
vec3 maximumSize = packedAttribute1.xyz;
float slice = packedAttribute1.w;
#ifdef INSTANCED
vec2 dir = direction;
#else
vec2 dir = coordinates;
#endif
vec2 offset = dir - vec2(0.5, 0.5);
vec2 scaledOffset = scale * offset;
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
vec4 positionEC = czm_modelViewRelativeToEye * p;
positionEC.xy += scaledOffset;
positionEC.xyz *= show;
gl_Position = czm_projection * positionEC;
v_offset = offset;
v_maximumSize = maximumSize;
v_color = color;
v_slice = slice;
v_brightness = brightness;
}
`;var ZW=`uniform vec3 u_noiseTextureDimensions;
uniform float u_noiseDetail;
uniform vec3 u_noiseOffset;
varying vec2 v_position;
float textureSliceWidth = u_noiseTextureDimensions.x;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
float wrap(float value, float rangeLength) {
if(value < 0.0) {
float absValue = abs(value);
float modValue = mod(absValue, rangeLength);
return mod(rangeLength - modValue, rangeLength);
}
return mod(value, rangeLength);
}
vec3 wrapVec(vec3 value, float rangeLength) {
return vec3(wrap(value.x, rangeLength),
wrap(value.y, rangeLength),
wrap(value.z, rangeLength));
}
vec3 random3(vec3 p) {
float dot1 = dot(p, vec3(127.1, 311.7, 932.8));
float dot2 = dot(p, vec3(269.5, 183.3, 421.4));
return fract(vec3(sin(dot1 - dot2), cos(dot1 * dot2), dot1 * dot2));
}
vec3 getWorleyCellPoint(vec3 centerCell, vec3 offset, float freq) {
vec3 cell = centerCell + offset;
cell = wrapVec(cell, textureSliceWidth / u_noiseDetail);
cell += floor(u_noiseOffset / u_noiseDetail);
vec3 p = offset + random3(cell);
return p;
}
float worleyNoise(vec3 p, float freq) {
vec3 centerCell = floor(p * freq);
vec3 pointInCell = fract(p * freq);
float shortestDistance = 1000.0;
for(float z = -1.0; z <= 1.0; z++) {
for(float y = -1.0; y <= 1.0; y++) {
for(float x = -1.0; x <= 1.0; x++) {
vec3 offset = vec3(x, y, z);
vec3 point = getWorleyCellPoint(centerCell, offset, freq);
float distance = length(pointInCell - point);
if(distance < shortestDistance) {
shortestDistance = distance;
}
}
}
}
return shortestDistance;
}
const float MAX_FBM_ITERATIONS = 10.0;
float worleyFBMNoise(vec3 p, float octaves, float scale) {
float noise = 0.0;
float freq = 1.0;
float persistence = 0.625;
for(float i = 0.0; i < MAX_FBM_ITERATIONS; i++) {
if(i >= octaves) {
break;
}
noise += worleyNoise(p * scale, freq * scale) * persistence;
persistence *= 0.5;
freq *= 2.0;
}
return noise;
}
void main() {
float x = mod(v_position.x, textureSliceWidth);
float y = mod(v_position.y, textureSliceWidth);
float sliceRow = floor(v_position.y / textureSliceWidth);
float z = floor(v_position.x / textureSliceWidth) + sliceRow * inverseNoiseTextureRows * textureSliceWidth;
vec3 position = vec3(x, y, z);
position /= u_noiseDetail;
float worley0 = clamp(worleyFBMNoise(position, 3.0, 1.0), 0.0, 1.0);
float worley1 = clamp(worleyFBMNoise(position, 3.0, 2.0), 0.0, 1.0);
float worley2 = clamp(worleyFBMNoise(position, 3.0, 3.0), 0.0, 1.0);
gl_FragColor = vec4(worley0, worley1, worley2, 1.0);
}
`;var JW=`uniform vec3 u_noiseTextureDimensions;
attribute vec2 position;
varying vec2 v_position;
void main()
{
gl_Position = vec4(position, 0.1, 1.0);
float textureSliceWidth = u_noiseTextureDimensions.x;
float noiseTextureRows = u_noiseTextureDimensions.y;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
vec2 transformedPos = (position * 0.5) + vec2(0.5);
transformedPos *= textureSliceWidth;
transformedPos.x *= textureSliceWidth * inverseNoiseTextureRows;
transformedPos.y *= noiseTextureRows;
v_position = transformedPos;
}
`;function Gd(e,t){if(e=y(e,y.EMPTY_OBJECT),this._show=y(e.show,!0),this._position=h.clone(y(e.position,h.ZERO)),!l(e.scale)&&l(e.maximumSize))this._maximumSize=h.clone(e.maximumSize),this._scale=new W(this._maximumSize.x,this._maximumSize.y);else{this._scale=W.clone(y(e.scale,new W(20,12)));let n=new h(this._scale.x,this._scale.y,Math.min(this._scale.x,this._scale.y)/1.5);this._maximumSize=h.clone(y(e.maximumSize,n))}this._slice=y(e.slice,-1),this._color=H.clone(y(e.color,H.WHITE)),this._brightness=y(e.brightness,1),this._cloudCollection=t,this._index=-1}var jrt=Gd.SHOW_INDEX=0,qrt=Gd.POSITION_INDEX=1,Yrt=Gd.SCALE_INDEX=2,Xrt=Gd.MAXIMUM_SIZE_INDEX=3,Krt=Gd.SLICE_INDEX=4,$rt=Gd.BRIGHTNESS_INDEX=5,Zrt=Gd.COLOR_INDEX=6;Gd.NUMBER_OF_PROPERTIES=7;function Bx(e,t){let n=e._cloudCollection;l(n)&&(n._updateCloud(e,t),e._dirty=!0)}Object.defineProperties(Gd.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,Bx(this,jrt))}},position:{get:function(){return this._position},set:function(e){let t=this._position;h.equals(t,e)||(h.clone(e,t),Bx(this,qrt))}},scale:{get:function(){return this._scale},set:function(e){let t=this._scale;W.equals(t,e)||(W.clone(e,t),Bx(this,Yrt))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){let t=this._maximumSize;h.equals(t,e)||(h.clone(e,t),Bx(this,Xrt))}},color:{get:function(){return this._color},set:function(e){let t=this._color;H.equals(t,e)||(H.clone(e,t),Bx(this,Zrt))}},slice:{get:function(){return this._slice},set:function(e){this._slice!==e&&(this._slice=e,Bx(this,Krt))}},brightness:{get:function(){return this._brightness},set:function(e){this._brightness!==e&&(this._brightness=e,Bx(this,$rt))}}});Gd.prototype._destroy=function(){this._cloudCollection=void 0};var Wd=Gd;var gu,lB=new h,Jrt={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},Qrt={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},est=Wd.SHOW_INDEX,tst=Wd.POSITION_INDEX,nst=Wd.SCALE_INDEX,ist=Wd.MAXIMUM_SIZE_INDEX,ost=Wd.SLICE_INDEX,rst=Wd.BRIGHTNESS_INDEX,sst=Wd.NUMBER_OF_PROPERTIES,ast=Wd.COLOR_INDEX;function jd(e){e=y(e,y.EMPTY_OBJECT),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(sst),this._noiseTexture=void 0,this._textureSliceWidth=128,this._noiseTextureRows=4,this.noiseDetail=y(e.noiseDetail,16),this.noiseOffset=h.clone(y(e.noiseOffset,h.ZERO)),this._loading=!1,this._ready=!1;let t=this;this._uniforms={u_noiseTexture:function(){return t._noiseTexture},u_noiseTextureDimensions:Upe(t),u_noiseDetail:function(){return t.noiseDetail}},this._vaNoise=void 0,this._spNoise=void 0,this._spCreated=!1,this._sp=void 0,this._rs=void 0,this.show=y(e.show,!0),this._colorCommands=[],this.debugBillboards=y(e.debugBillboards,!1),this._compiledDebugBillboards=!1,this.debugEllipsoids=y(e.debugEllipsoids,!1),this._compiledDebugEllipsoids=!1}function Upe(e){return function(){return lB.x=e._textureSliceWidth,lB.y=e._noiseTextureRows,lB.z=1/e._noiseTextureRows,lB}}Object.defineProperties(jd.prototype,{length:{get:function(){return e7(this),this._clouds.length}}});function zpe(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}jd.prototype.add=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.cloudType,cB.CUMULUS),n;return t===cB.CUMULUS&&(n=new Wd(e,this),n._index=this._clouds.length,this._clouds.push(n),this._createVertexArray=!0),n};jd.prototype.remove=function(e){return this.contains(e)?(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};jd.prototype.removeAll=function(){zpe(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0};function e7(e){if(e._cloudsRemoved){e._cloudsRemoved=!1;let t=[],n=e._clouds,i=n.length;for(let o=0,r=0;o<i;++o){let s=n[o];l(s)&&(n._index=r++,t.push(s))}e._clouds=t}}jd.prototype._updateCloud=function(e,t){e._dirty||
`,n}function Uat(){let e="";e+=_c(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),e+=_c(".cesium-credit-lightbox",{"background-color":"#303336",color:RD,position:"relative","min-height":`${Nat}px`,margin:"auto"}),e+=_c(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:RD}),e+=_c(".cesium-credit-lightbox > ul > li a:hover",{color:m7}),e+=_c(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=_c(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=_c(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=_c(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:RD}),e+=_c(".cesium-credit-lightbox-close:hover",{color:m7}),e+=_c(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=_c(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=_c(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=_c(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:RD}),e+=_c(".cesium-credit-expand-link:hover",{color:m7}),e+=_c(".cesium-credit-text",{color:RD}),e+=_c(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});let t=document.head,n=document.createElement("style");n.innerHTML=e,t.insertBefore(n,t.firstChild)}function Gr(e,t,n){let i=this;n=y(n,document.body);let o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);let r=document.createElement("div");r.className="cesium-credit-lightbox",o.appendChild(r);function s(m){r.contains(m.target)||i.hideLightbox()}o.addEventListener("click",s,!1);let a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);let c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="&times;",c.className="cesium-credit-lightbox-close",r.appendChild(c);let u=document.createElement("ul");r.appendChild(u);let f=document.createElement("div");f.className="cesium-credit-logoContainer",f.style.display="inline",e.appendChild(f);let d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);let p=document.createElement("a");p.className="cesium-credit-expand-link",p.onclick=this.showLightbox.bind(this),p.textContent="Data attribution",e.appendChild(p),Uat();let _=_n.clone(Gr.cesiumCredit);this._delimiter=y(t," \u2022 "),this._screenContainer=d,this._cesiumCreditContainer=f,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=p,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=_,this._previousCesiumCredit=void 0,this._currentCesiumCredit=_,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new zt,lightboxCredits:new zt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function h_e(e,t,n,i){i=y(i,1);let o=t.get(n.id);if(l(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{let r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new f_e(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}Gr.prototype.addCredit=function(e){if(e._isIon){l(this._defaultCredit)||(this._defaultCredit=_n.clone(m_e())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,h_e(this,t,e)};Gr.prototype.addDefaultCredit=function(e){let t=this._defaultCredits;Fat(t,e)||t.push(e)};Gr.prototype.removeDefaultCredit=function(e){let t=this._defaultCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};Gr.prototype.showLightbox=functio
`;else switch(t==="st"&&(i="vec2"),i){case"float":r=`vec4 getColor() { return vec4(vec3(${o}), 1.0); }
`;break;case"vec2":r=`vec4 getColor() { return vec4(${o}, 0.0, 1.0); }
`;break;case"vec3":r=`vec4 getColor() { return vec4(${o}, 1.0); }
`;break;case"vec4":r=`vec4 getColor() { return ${o}; }
`;break}let s=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute float batchId;
${n?"":`attribute ${i} ${t};
`}varying ${i} ${o};
void main()
{
vec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);
${n?`${o} = czm_batchTable_${t}(batchId);
`:`${o} = ${t};
`}gl_Position = czm_modelViewProjectionRelativeToEye * p;
}`,a=`varying ${i} ${o};
${r}
void main()
{
gl_FragColor = getColor();
}`;this.material=void 0,this.translucent=y(e.translucent,!1),this._vertexShaderSource=y(e.vertexShaderSource,s),this._fragmentShaderSource=y(e.fragmentShaderSource,a),this._renderState=Mo.getDefaultRenderState(!1,!1,e.renderState),this._closed=y(e.closed,!1),this._attributeName=t,this._glslDatatype=i}Object.defineProperties(MD.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},attributeName:{get:function(){return this._attributeName}},glslDatatype:{get:function(){return this._glslDatatype}}});MD.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;MD.prototype.isTranslucent=Mo.prototype.isTranslucent;MD.prototype.getRenderState=Mo.prototype.getRenderState;var zat=MD;function yB(e){e=y(e,y.EMPTY_OBJECT),this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=y(e.color,H.CYAN),this._updateOnChange=y(e.updateOnChange,!0),this.show=y(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}var Hat=new h,Gat=new Q,Wat=new ke,jat=new io,qat=new Gl,Yat=new In,Xat=new _s,Kat=new H,$at=[1,1e5];yB.prototype.update=function(e){if(!this.show)return;let t=this._planesPrimitives,n=this._outlinePrimitives,i,o;if(this._updateOnChange){for(o=t.length,i=0;i<o;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(t.length===0){let r=this._camera,s=r.frustum,a;s instanceof io?a=jat:s instanceof Gl?a=qat:s instanceof In?a=Yat:a=Xat,a=s.clone(a);let c,u=this._frustumSplits;!l(u)||u.length<=1?(u=$at,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,c=1):c=u.length-1;let f=r.positionWC,d=r.directionWC,p=r.upWC,_=r.rightWC;_=h.negate(_,Hat);let m=Gat;Q.setColumn(m,0,_,m),Q.setColumn(m,1,p,m),Q.setColumn(m,2,d,m);let x=ke.fromRotationMatrix(m,Wat);for(t.length=n.length=c,i=0;i<c;++i)a.near=u[i],a.far=u[i+1],t[i]=new ii({geometryInstances:new kt({geometry:new iS({origin:f,orientation:x,frustum:a,_drawNearPlane:i===0}),attributes:{color:on.fromColor(H.fromAlpha(this._color,.1,Kat))},id:this.id,pickPrimitive:this}),appearance:new Bn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new ii({geometryInstances:new kt({geometry:new Z2({origin:f,orientation:x,frustum:a,_drawNearPlane:i===0}),attributes:{color:on.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new Bn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};yB.prototype.isDestroyed=function(){return!1};yB.prototype.destroy=function(){let e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return fe(this)};var r0=yB;function p_e(){this._cachedShowFrustumsShaders={}}function Zat(e){let t={},n=e.vertexAttributes;for(let i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function Jat(e,t){let n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(f){f=je.replaceMain(f,"czm_Debug_main");let d=/gl_FragData\[(\d+)\]/g,p;for(;(p=d.exec(f))!==null;)r.indexOf(p[1])===-1&&r.push(p[1]);return f});let s=r.length,a="";a+=`uniform vec3 debugShowCommandsColor;
`,a+=`uniform vec3 debugShowFrustumsColor;
`,a+=`void main()
{
czm_Debug_main();
`;let c;if(s>0)for(c=0;c<s;++c)a+=` gl_FragData[${r[c]}].rgb *= debugShowCommandsColor;
`,a+=` gl_FragData[${r[c]}].rgb *= debugShowFrustumsColor;
`;else a+=` gl_FragColor.rgb *= debugShowCommandsColor;
`,a+=` gl_FragColor.rgb *= debugShowFrustumsColor;
`;a+="}",o.sources.push(a);let u=Zat(i);return gn.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}var BD=new H;function Qat(e,t){let n;return l(t.uniformMap)?n=t.uniformMap:n={},l(n.debugShowCommandsColor)||l(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(l(t._debugColor)||(t._debugColor=H.fromRandom()),t._debugColor):H.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(BD.red=t.debugOverlappingFrustums&1<<0?1:0,BD.green=t.debugOverlappingFrustums&1<<1?1:0,BD.blue=t.debugOverlappingFrustums&1<<2?1:0,BD.alpha=1,BD):H.WHITE}),n}var ect=new pt;p_e.prototype.executeDebugShowFrustumsCommand=function(e,t,n){let i=t.shaderProgram.id,o=this._cachedShowFrustumsShaders[i];l(o)||(o=Jat(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);let r=pt.shallowClone(t,ect);r.shaderProgram=o,r.uniformMap=Qat(e,t),r.execute(e.context,n)};var _7=p_e;function xB(e){e=y(e,y.EMPTY_OBJECT),this.length=y(e.length,1e7),this._length=void 0,this.width=y(e.width,2),this._width=void 0,this.show=y(e.show,!0),this.modelMatrix=O.clone(y(e.modelMatrix,O.IDENTITY)),this._modelMatrix=new O,this.id=e.id,this._id=void 0,this._primitive=void 0}xB.prototype.update=function(e){if(!!this.show){if(!l(this._primitive)||!O.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=O.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,l(this._primitive)&&this._primitive.destroy(),this.modelMatrix[12]===0&&this.modelMatrix[13]===0&&this.modelMatrix[14]===0&&(this.modelMatrix[14]=.01);let t=new kt({geometry:new iy({positions:[h.ZERO,h.UNIT_X],width:this.width,vertexFormat:Ps.VERTEX_FORMAT,colors:[H.RED,H.RED],arcType:Sn.NONE}),modelMatrix:O.multiplyByUniformScale(this.modelMatrix,this.length,new O),id:this.id,pickPrimitive:this}),n=new kt({geometry:new iy({positions:[h.ZERO,h.UNIT_Y],width:this.width,vertexFormat:Ps.VERTEX_FORMAT,colors:[H.GREEN,H.GREEN],arcType:Sn.NONE}),modelMatrix:O.multiplyByUniformScale(this.modelMatrix,this.length,new O),id:this.id,pickPrimitive:this}),i=new kt({geometry:new iy({positions:[h.ZERO,h.UNIT_Z],width:this.width,vertexFormat:Ps.VERTEX_FORMAT,colors:[H.BLUE,H.BLUE],arcType:Sn.NONE}),modelMatrix:O.multiplyByUniformScale(this.modelMatrix,this.length,new O),id:this.id,pickPrimitive:this});this._primitive=new ii({geometryInstances:[t,n,i],appearance:new Ps,asynchronous:!1})}this._primitive.update(e)}};xB.prototype.isDestroyed=function(){return!1};xB.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),fe(this)};var g7=xB;var y7=`varying vec4 positionEC;
void main()
{
vec3 position;
vec3 direction;
if (czm_orthographicIn3D == 1.0)
{
vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;
vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y);
vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x);
position = vec3(mix(minPlane, maxPlane, uv), 0.0);
direction = vec3(0.0, 0.0, -1.0);
}
else
{
position = vec3(0.0);
direction = normalize(positionEC.xyz);
}
czm_ray ray = czm_ray(position, direction);
vec3 ellipsoid_center = czm_view[3].xyz;
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
if (!czm_isEmpty(intersection))
{
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
else
{
discard;
}
czm_writeLogDepth();
}
`;var x7=`attribute vec4 position;
varying vec4 positionEC;
void main()
{
positionEC = czm_modelView * position;
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
}
`;function ND(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=y(e,0)}var LD=Kt.supportsTypedArrays()?new Float32Array(12):[],__e=new h,g_e=new h,C7=new h,y_e=new h,CB=new h;function tct(e,t){let n=e.radii,i=t.camera,o,r,s;if(i.frustum instanceof In)o=h.ZERO,r=i.rightWC,s=i.upWC;else{let d=i.positionWC,p=h.multiplyComponents(e.oneOverRadii,d,__e),_=h.normalize(p,g_e),m=h.normalize(h.cross(h.UNIT_Z,p,C7),C7),x=h.normalize(h.cross(_,m,y_e),y_e),C=h.magnitude(p),A=Math.sqrt(C*C-1);o=h.multiplyByScalar(_,1/C,__e);let T=A/C;r=h.multiplyByScalar(m,T,g_e),s=h.multiplyByScalar(x,T,C7)}let a=h.add(o,s,CB);h.subtract(a,r,a),h.multiplyComponents(n,a,a),h.pack(a,LD,0);let c=h.subtract(o,s,CB);h.subtract(c,r,c),h.multiplyComponents(n,c,c),h.pack(c,LD,3);let u=h.add(o,s,CB);h.add(u,r,u),h.multiplyComponents(n,u,u),h.pack(u,LD,6);let f=h.subtract(o,s,CB);return h.add(f,r,f),h.multiplyComponents(n,f,f),h.pack(f,LD,9),LD}ND.prototype.update=function(e){if(this._mode=e.mode,e.mode!==te.SCENE3D)return;let t=e.context,n=e.mapProjection.ellipsoid.radii,i=new se(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(l(this._command)||(this._rs=Ze.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new pt({renderState:this._rs,boundingVolume:new re(h.ZERO,i.maximumRadius),pass:Se.OPAQUE,owner:this})),!l(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;let s=new je({sources:[x7]}),a=new je({sources:[y7]});if(o){let c=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
`;a.sources.push(c),a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")}this._sp=gn.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}let r=tct(i,e);if(l(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{let s=new vt({attributes:{position:new Ie({componentDatatype:X.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:He.TRIANGLES});this._va=Ii.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:We.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};ND.prototype.execute=function(e,t){this._mode===te.SCENE3D&&this._command.execute(e,t)};ND.prototype.isDestroyed=function(){return!1};ND.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};var A7=ND;function FD(){}var nct=/\bgl_FragDepthEXT\b/,ict=/\bdiscard\b/;function oct(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!l(n)){let i=t._attributeLocations,o=t.fragmentShaderSource,r,s=!1,a=o.sources,c=a.length;for(r=0;r<c;++r)if(nct.test(a[r])||ict.test(a[r])){s=!0;break}let u=!1,f=o.defines;for(c=f.length,r=0;r<c;++r)if(f[r]==="LOG_DEPTH"){u=!0;break}let d;!s&&!u?(d=`void main()
{
gl_FragColor = vec4(1.0);
}
`,o=new je({sources:[d]})):!s&&u&&(d=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
void main()
{
gl_FragColor = vec4(1.0);
czm_writeLogDepth();
}
`,o=new je({defines:["LOG_DEPTH"],sources:[d]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function rct(e,t){let n=e._depthOnlyRenderStateCache,i=n[t.id];if(!l(i)){let o=Ze.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=Ze.fromCache(o),n[t.id]=i}return i}FD.createDepthOnlyDerivedCommand=function(e,t,n,i){l(i)||(i={});let o,r;return l(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=pt.shallowClone(t,i.depthOnlyCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=oct(n,t.shaderProgram),i.depthOnlyCommand.renderState=rct(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};var sct=/\s+czm_writeLogDepth\(/,act=/\s+czm_vertexLogDepth\(/,cct=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function lct(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!l(n)){let i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=l(o.defines)?o.defines.slice(0):[],o.defines.push("LOG_DEPTH"),r.defines=l(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH");let s,a,c=!1,u=o.sources,f=u.length;for(s=0;s<f;++s)if(act.test(u[s])){c=!0;break}if(!c){for(s=0;s<f;++s)u[s]=je.replaceMain(u[s],"czm_log_depth_main");a=`
void main()
{
czm_log_depth_main();
czm_vertexLogDepth();
}
`,u.push(a)}for(u=r.sources,f=u.length,c=!1,s=0;s<f;++s)sct.test(u[s])&&(c=!0);r.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(c=!0);let d=!0;for(s=0;s<f;++s)cct.test(u[s])&&(d=!1);let p="";if(d&&(p+=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
`),!c){for(s=0;s<f;s++)u[s]=je.replaceMain(u[s],"czm_log_depth_main");p+=`
void main()
{
czm_log_depth_main();
czm_writeLogDepth();
}
`}u.push(p),n=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}FD.createLogDepthCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=pt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=lct(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function uct(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!l(i)){let o=t._attributeLocations,r=t.fragmentShaderSource,s=r.sources,a=s.length,c=`void main()
{
czm_non_pick_main();
if (gl_FragColor.a == 0.0) {
discard;
}
gl_FragColor = ${n};
}
`,u=new Array(a+1);for(let f=0;f<a;++f)u[f]=je.replaceMain(s[f],"czm_non_pick_main");u[a]=c,r=new je({sources:u,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function fct(e,t){let n=e.picking.pickRenderStateCache,i=n[t.id];if(!l(i)){let o=Ze.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=Ze.fromCache(o),n[t.id]=i}return i}FD.createPickDerivedCommand=function(e,t,n,i){l(i)||(i={});let o,r;return l(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=pt.shallowClone(t,i.pickCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=uct(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=fct(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function dct(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!l(n)){let i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=l(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=l(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}FD.createHdrCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=pt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=dct(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};var kx=FD;function AB(e){this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;let t=this;function n(i){let o=i.alpha;if(!l(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=I.toRadians(o),t._beta=I.toRadians(i.beta),t._gamma=I.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}var hct=new ke,x_e=new ke,mct=new Q;function pct(e,t,n,i){let o=e.direction,r=e.right,s=e.up,a=ke.fromAxisAngle(o,n,x_e),c=ke.fromAxisAngle(r,i,hct),u=ke.multiply(c,a,c),f=ke.fromAxisAngle(s,t,x_e);ke.multiply(f,u,u);let d=Q.fromQuaternion(u,mct);Q.multiplyByVector(d,r,r),Q.multiplyByVector(d,s,s),Q.multiplyByVector(d,o,o)}AB.prototype.update=function(){if(!l(this._alpha))return;l(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);let e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;pct(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};AB.prototype.isDestroyed=function(){return!1};AB.prototype.destroy=function(){return this._removeListener(),fe(this)};var T7=AB;function _ct(e){this.direction=h.clone(e.direction),this.color=H.clone(y(e.color,H.WHITE)),this.intensity=y(e.intensity,1)}var gct=_ct;var TB=`#ifdef WRITE_DEPTH
#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
#endif
uniform vec3 u_radii;
uniform vec3 u_oneOverEllipsoidRadiiSquared;
varying vec3 v_positionEC;
vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)
{
vec3 positionEC = czm_pointAlongRay(ray, intersection);
vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;
vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));
vec3 sphericalNormal = normalize(positionMC / u_radii);
vec3 normalMC = geodeticNormal * side;
vec3 normalEC = normalize(czm_normal * normalMC);
vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);
vec3 positionToEyeEC = -positionEC;
czm_materialInput materialInput;
materialInput.s = st.s;
materialInput.st = st;
materialInput.str = (positionMC + u_radii) / u_radii;
materialInput.normalEC = normalEC;
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getMaterial(materialInput);
#ifdef ONLY_SUN_LIGHTING
return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);
#else
return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
void main()
{
float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;
vec3 direction = normalize(v_positionEC);
vec3 ellipsoidCenter = czm_modelView[3].xyz;
float t1 = -1.0;
float t2 = -1.0;
float b = -2.0 * dot(direction, ellipsoidCenter);
float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;
float discriminant = b * b - 4.0 * c;
if (discriminant >= 0.0) {
t1 = (-b - sqrt(discriminant)) * 0.5;
t2 = (-b + sqrt(discriminant)) * 0.5;
}
if (t1 < 0.0 && t2 < 0.0) {
discard;
}
float t = min(t1, t2);
if (t < 0.0) {
t = 0.0;
}
czm_ray ray = czm_ray(t * direction, direction);
vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);
if (czm_isEmpty(intersection))
{
discard;
}
vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);
vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);
gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);
gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);
#ifdef WRITE_DEPTH
#ifdef GL_EXT_frag_depth
t = (intersection.start != 0.0) ? intersection.start : intersection.stop;
vec3 positionEC = czm_pointAlongRay(ray, t);
vec4 positionCC = czm_projection * vec4(positionEC, 1.0);
#ifdef LOG_DEPTH
czm_writeLogDepth(1.0 + positionCC.w);
#else
float z = positionCC.z / positionCC.w;
float n = czm_depthRange.near;
float f = czm_depthRange.far;
gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;
#endif
#endif
#endif
}
`;var bB=`attribute vec3 position;
uniform vec3 u_radii;
varying vec3 v_positionEC;
void main()
{
vec4 p = vec4(u_radii * position, 1.0);
v_positionEC = (czm_modelView * p).xyz;
gl_Position = czm_modelViewProjection * p;
gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);
czm_vertexLogDepth();
}
`;var b7={position:0};function EB(e){e=y(e,y.EMPTY_OBJECT),this.center=h.clone(y(e.center,h.ZERO)),this._center=new h,this.radii=h.clone(e.radii),this._radii=new h,this._oneOverEllipsoidRadiiSquared=new h,this._boundingSphere=new re,this.modelMatrix=O.clone(y(e.modelMatrix,O.IDENTITY)),this._modelMatrix=new O,this._computedModelMatrix=new O,this.show=y(e.show,!0),this.material=y(e.material,Bo.fromType(Bo.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.onlySunLighting=y(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=y(e.depthTestEnabled,!0),this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new pt({owner:y(e._owner,this)}),this._pickCommand=new pt({owner:y(e._owner,this),pickOnly:!0});let t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function yct(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(l(t))return t;let n=Pu.createGeometry(Pu.fromDimensions({dimensions:new h(2,2,2),vertexFormat:Ve.POSITION_ONLY}));return t=Ii.fromGeometry({context:e,geometry:n,attributeLocations:b7,bufferUsage:We.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}var C_e=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
`;EB.prototype.update=function(e){if(!this.show||e.mode!==te.SCENE3D||!l(this.center)||!l(this.radii))return;let t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!l(this._rs)||i)&&(this._translucent=n,this._rs=Ze.fromCache({cull:{enabled:!0,face:So.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?Hn.ALPHA_BLEND:void 0})),l(this._va)||(this._va=yct(t));let o=!1,r=this.radii;if(!h.equals(this._radii,r)){h.clone(r,this._radii);let x=this._oneOverEllipsoidRadiiSquared;x.x=1/(r.x*r.x),x.y=1/(r.y*r.y),x.z=1/(r.z*r.z),o=!0}(!O.equals(this.modelMatrix,this._modelMatrix)||!h.equals(this.center,this._center))&&(O.clone(this.modelMatrix,this._modelMatrix),h.clone(this.center,this._center),O.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(h.clone(h.ZERO,this._boundingSphere.center),this._boundingSphere.radius=h.maximumComponent(r),re.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));let s=this._material!==this.material;this._material=this.material,this._material.update(t);let a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;let c=e.useLogDepth,u=this._useLogDepth!==c;this._useLogDepth=c;let f=this._colorCommand,d,p;(s||a||i||u)&&(d=new je({sources:[bB]}),p=new je({sources:[this.material.shaderSource,TB]}),this.onlySunLighting&&p.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&p.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),p.defines.push("LOG_DEPTH"),p.sources.push(C_e)),this._sp=gn.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:b7}),f.vertexArray=this._va,f.renderState=this._rs,f.shaderProgram=this._sp,f.uniformMap=Dt(this._uniforms,this.material._uniforms),f.executeInClosestFrustum=n);let _=e.commandList,m=e.passes;if(m.render&&(f.boundingVolume=this._boundingSphere,f.debugShowBoundingVolume=this.debugShowBoundingVolume,f.modelMatrix=this._computedModelMatrix,f.pass=n?Se.TRANSLUCENT:Se.OPAQUE,_.push(f)),m.pick){let x=this._pickCommand;(!l(this._pickId)||this._id!==this.id)&&(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(s||a||!l(this._pickSP)||u)&&(d=new je({sources:[bB]}),p=new je({sources:[this.material.shaderSource,TB],pickColorQualifier:"uniform"}),this.onlySunLighting&&p.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&p.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),p.defines.push("LOG_DEPTH"),p.sources.push(C_e)),this._pickSP=gn.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:b7}),x.vertexArray=this._va,x.renderState=this._rs,x.shaderProgram=this._pickSP,x.uniformMap=Dt(Dt(this._uniforms,this._pickUniforms),this.material._uniforms),x.executeInClosestFrustum=n),x.boundingVolume=this._boundingSphere,x.modelMatrix=this._computedModelMatrix,x.pass=n?Se.TRANSLUCENT:Se.OPAQUE,_.push(x)}};EB.prototype.isDestroyed=function(){return!1};EB.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),fe(this)};var E7=EB;var S7=`varying vec3 v_positionMC;
varying vec3 v_positionEC;
varying vec2 v_st;
void main()
{
czm_materialInput materialInput;
vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
materialInput.s = v_st.s;
materialInput.st = v_st;
materialInput.str = vec3(v_st, 0.0);
materialInput.normalEC = normalEC;
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);
vec3 positionToEyeEC = -v_positionEC;
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var w7=`attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec2 st;
attribute float batchId;
varying vec3 v_positionMC;
varying vec3 v_positionEC;
varying vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
v_positionMC = position3DHigh + position3DLow;
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;function Ux(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=y(e.aboveGround,!1);this.material=l(e.material)?e.material:Bo.fromType(Bo.ColorType),this.translucent=y(e.translucent,!0),this._vertexShaderSource=y(e.vertexShaderSource,w7),this._fragmentShaderSource=y(e.fragmentShaderSource,S7),this._renderState=Mo.getDefaultRenderState(t,!n,e.renderState),this._closed=!1,this._flat=y(e.flat,!1),this._faceForward=y(e.faceForward,n),this._aboveGround=n}Object.defineProperties(Ux.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return Ux.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}});Ux.VERTEX_FORMAT=Ve.POSITION_AND_ST;Ux.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;Ux.prototype.isTranslucent=Mo.prototype.isTranslucent;Ux.prototype.getRenderState=Mo.prototype.getRenderState;var xct=Ux;function A_e(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}var SB=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],um=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7];for(let e=0;e<um.length;++e)um[e]*=1e6;var T_e=um[1],v7=um[um.length-1];for(let e=0;e<um.length;++e)um[e]=(um[e]-v7)/(T_e-v7);var _a=0;function Cct(e){let t=SB,n=t.length;if(e<t[0])return _a=0,_a;if(e>t[n-1])return _a=n-2,_a;if(e>=t[_a]){if(_a+1<n&&e<t[_a+1])return _a;if(_a+2<n&&e<t[_a+2])return++_a,_a}else if(_a-1>=0&&e>=t[_a-1])return--_a,_a;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return _a=i,_a}var Act=new h;A_e.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;let n=e.camera,i=n.positionCartographic;if(!l(i)||i.height>8e5||e.mode!==te.SCENE3D){e.fog.enabled=!1;return}let o=i.height,r=Cct(o),s=I.clamp((o-SB[r])/(SB[r+1]-SB[r]),0,1),a=I.lerp(um[r],um[r+1],s),c=this.density*1e6,u=c/T_e*v7;a=a*(c-u)*1e-6;let f=h.normalize(n.positionWC,Act),d=Math.abs(h.dot(n.directionWC,f));a*=1-d,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};var D7=A_e;function Bl(e){this._scene=e.scene,this.samplingWindow=y(e.samplingWindow,Bl.defaultSettings.samplingWindow),this.quietPeriod=y(e.quietPeriod,Bl.defaultSettings.quietPeriod),this.warmupPeriod=y(e.warmupPeriod,Bl.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=y(e.minimumFrameRateDuringWarmup,Bl.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=y(e.minimumFrameRateAfterWarmup,Bl.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new xe,this._nominalFrameRate=new xe,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;let t=this;this._preUpdateRemoveListener=this._scene.preUpdate.addEventListener(function(o,r){Tct(t,r)}),this._hiddenPropertyName=document.hidden!==void 0?"hidden":document.mozHidden!==void 0?"mozHidden":document.msHidden!==void 0?"msHidden":document.webkitHidden!==void 0?"webkitHidden":void 0;let n=document.hidden!==void 0?"visibilitychange":document.mozHidden!==void 0?"mozvisibilitychange":document.msHidden!==void 0?"msvisibilitychange":document.webkitHidden!==void 0?"webkitvisibilitychange":void 0;function i(){bct(t)}this._visibilityChangeRemoveListener=void 0,l(n)&&(document.addEventListener(n,i,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(n,i,!1)})}Bl.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuring
#if TEXTURE_UNITS > 0
uniform sampler2D u_dayTextures[TEXTURE_UNITS];
uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];
uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];
#ifdef APPLY_ALPHA
uniform float u_dayTextureAlpha[TEXTURE_UNITS];
#endif
#ifdef APPLY_DAY_NIGHT_ALPHA
uniform float u_dayTextureNightAlpha[TEXTURE_UNITS];
uniform float u_dayTextureDayAlpha[TEXTURE_UNITS];
#endif
#ifdef APPLY_SPLIT
uniform float u_dayTextureSplit[TEXTURE_UNITS];
#endif
#ifdef APPLY_BRIGHTNESS
uniform float u_dayTextureBrightness[TEXTURE_UNITS];
#endif
#ifdef APPLY_CONTRAST
uniform float u_dayTextureContrast[TEXTURE_UNITS];
#endif
#ifdef APPLY_HUE
uniform float u_dayTextureHue[TEXTURE_UNITS];
#endif
#ifdef APPLY_SATURATION
uniform float u_dayTextureSaturation[TEXTURE_UNITS];
#endif
#ifdef APPLY_GAMMA
uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];
#endif
#ifdef APPLY_IMAGERY_CUTOUT
uniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];
#endif
#ifdef APPLY_COLOR_TO_ALPHA
uniform vec4 u_colorsToAlpha[TEXTURE_UNITS];
#endif
uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];
#endif
#ifdef SHOW_REFLECTIVE_OCEAN
uniform sampler2D u_waterMask;
uniform vec4 u_waterMaskTranslationAndScale;
uniform float u_zoomedOutOceanSpecularIntensity;
#endif
#ifdef SHOW_OCEAN_WAVES
uniform sampler2D u_oceanNormalMap;
#endif
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
uniform vec2 u_lightingFadeDistance;
#endif
#ifdef TILE_LIMIT_RECTANGLE
uniform vec4 u_cartographicLimitRectangle;
#endif
#ifdef GROUND_ATMOSPHERE
uniform vec2 u_nightFadeDistance;
#endif
#ifdef ENABLE_CLIPPING_PLANES
uniform highp sampler2D u_clippingPlanes;
uniform mat4 u_clippingPlanesMatrix;
uniform vec4 u_clippingPlanesEdgeStyle;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
uniform float u_minimumBrightness;
#endif
#ifdef COLOR_CORRECT
uniform vec3 u_hsbShift;
#endif
#ifdef HIGHLIGHT_FILL_TILE
uniform vec4 u_fillHighlightColor;
#endif
#ifdef TRANSLUCENT
uniform vec4 u_frontFaceAlphaByDistance;
uniform vec4 u_backFaceAlphaByDistance;
uniform vec4 u_translucencyRectangle;
#endif
#ifdef UNDERGROUND_COLOR
uniform vec4 u_undergroundColor;
uniform vec4 u_undergroundColorAlphaByDistance;
#endif
#ifdef ENABLE_VERTEX_LIGHTING
uniform float u_lambertDiffuseMultiplier;
#endif
varying vec3 v_positionMC;
varying vec3 v_positionEC;
varying vec3 v_textureCoordinates;
varying vec3 v_normalMC;
varying vec3 v_normalEC;
#ifdef APPLY_MATERIAL
varying float v_height;
varying float v_slope;
varying float v_aspect;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
varying float v_distance;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
varying vec3 v_atmosphereRayleighColor;
varying vec3 v_atmosphereMieColor;
varying float v_atmosphereOpacity;
#endif
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
float interpolateByDistance(vec4 nearFarScalar, float distance)
{
float startDistance = nearFarScalar.x;
float startValue = nearFarScalar.y;
float endDistance = nearFarScalar.z;
float endValue = nearFarScalar.w;
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
return mix(startValue, endValue, t);
}
#endif
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)
vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
{
return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
}
#endif
#ifdef TRANSLUCENT
bool inTranslucencyRectangle()
{
return
v_textureCoordinates.x > u_translucencyRectangle.x &&
v_textureCoordinates.x < u_translucencyRectangle.z &&
v_textureCoordinates.y > u_translucencyRectangle.y &&
v_textureCoordinates.y < u_translucencyRectangle.w;
}
#endif
vec4 sampleAndBlend(
vec4 previousColor,
sampler2D textureToSample,
vec2 tileTextureCoordinates,
vec4 textureCoordinateRectangle,
vec4 textureCoordinateTranslationAndScale,
float textureAlpha,
float textureNightAlpha,
float textureDayAlpha,
float textureBrightness,
float textureContrast,
float textureHue,
float textureSaturation,
float textureOneOverGamma,
float split,
vec4 colorToAlpha,
float nightBlend)
{
vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);
#endif
vec2 translation = textureCoordinateTranslationAndScale.xy;
vec2 scale = textureCoordinateTranslationAndScale.zw;
vec2 textureCoordinates = tileTextureCoordinates * scale + translation;
vec4 value = texture2D(textureToSample, textureCoordinates);
vec3 color = value.rgb;
float alpha = value.a;
#ifdef APPLY_COLOR_TO_ALPHA
vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);
colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);
alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);
#endif
#if !defined(APPLY_GAMMA)
vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));
color = tempColor.rgb;
alpha = tempColor.a;
#else
color = pow(color, vec3(textureOneOverGamma));
#endif
#ifdef APPLY_SPLIT
float splitPosition = czm_splitPosition;
if (split < 0.0 && gl_FragCoord.x > splitPosition) {
alpha = 0.0;
}
else if (split > 0.0 && gl_FragCoord.x < splitPosition) {
alpha = 0.0;
}
#endif
#ifdef APPLY_BRIGHTNESS
color = mix(vec3(0.0), color, textureBrightness);
#endif
#ifdef APPLY_CONTRAST
color = mix(vec3(0.5), color, textureContrast);
#endif
#ifdef APPLY_HUE
color = czm_hue(color, textureHue);
#endif
#ifdef APPLY_SATURATION
color = czm_saturation(color, textureSaturation);
#endif
float sourceAlpha = alpha * textureAlpha;
float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);
outAlpha += sign(outAlpha) - 1.0;
vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;
return vec4(outColor, max(outAlpha, 0.0));
}
vec3 colorCorrect(vec3 rgb) {
#ifdef COLOR_CORRECT
vec3 hsb = czm_RGBToHSB(rgb);
hsb.x += u_hsbShift.x;
hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;
rgb = czm_HSBToRGB(hsb);
#endif
return rgb;
}
vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);
const float fExposure = 2.0;
vec3 computeEllipsoidPosition()
{
float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);
vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);
xy *= czm_viewport.zw * mpp * 0.5;
vec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));
czm_ray ray = czm_ray(vec3(0.0), direction);
vec3 ellipsoid_center = czm_view[3].xyz;
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);
return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;
}
void main()
{
#ifdef TILE_LIMIT_RECTANGLE
if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||
v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)
{
discard;
}
#endif
#ifdef ENABLE_CLIPPING_PLANES
float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);
#endif
#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)
vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));
vec3 normalEC = czm_normal3D * normalMC;
#endif
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);
#else
float nightBlend = 0.0;
#endif
vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);
#ifdef SHOW_TILE_BOUNDARIES
if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||
v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))
{
color = vec4(1.0, 0.0, 0.0, 1.0);
}
#endif
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
float cameraDist;
if (czm_sceneMode == czm_sceneMode2D)
{
cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;
}
else if (czm_sceneMode == czm_sceneModeColumbusView)
{
cameraDist = -czm_view[3].z;
}
else
{
cameraDist = length(czm_view[3]);
}
float fadeOutDist = u_lightingFadeDistance.x;
float fadeInDist = u_lightingFadeDistance.y;
if (czm_sceneMode != czm_sceneMode3D) {
vec3 radii = czm_ellipsoidRadii;
float maxRadii = max(radii.x, max(radii.y, radii.z));
fadeOutDist -= maxRadii;
fadeInDist -= maxRadii;
}
float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);
#else
float fade = 0.0;
#endif
#ifdef SHOW_REFLECTIVE_OCEAN
vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;
vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;
vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;
waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;
float mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;
if (mask > 0.0)
{
mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);
vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);
vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));
color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);
}
#endif
#ifdef APPLY_MATERIAL
czm_materialInput materialInput;
materialInput.st = v_textureCoordinates.st;
materialInput.normalEC = normalize(v_normalEC);
materialInput.positionToEyeEC = -v_positionEC;
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));
materialInput.slope = v_slope;
materialInput.height = v_height;
materialInput.aspect = v_aspect;
czm_material material = czm_getMaterial(materialInput);
vec4 materialColor = vec4(material.diffuse, material.alpha);
color = alphaBlend(materialColor, color);
#endif
#ifdef ENABLE_VERTEX_LIGHTING
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + 0.3, 0.0, 1.0);
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
#elif defined(ENABLE_DAYNIGHT_SHADING)
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);
diffuseIntensity = mix(1.0, diffuseIntensity, fade);
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
#else
vec4 finalColor = color;
#endif
#ifdef ENABLE_CLIPPING_PLANES
vec4 clippingPlanesEdgeColor = vec4(1.0);
clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;
float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;
if (clipDistance < clippingPlanesEdgeWidth)
{
finalColor = clippingPlanesEdgeColor;
}
#endif
#ifdef HIGHLIGHT_FILL_TILE
finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);
#endif
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
vec3 atmosphereLightDirection = czm_sunDirectionWC;
#else
vec3 atmosphereLightDirection = czm_lightDirectionWC;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
if (!czm_backFacing())
{
bool dynamicLighting = false;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
dynamicLighting = true;
#endif
vec3 rayleighColor;
vec3 mieColor;
float opacity;
vec3 positionWC;
vec3 lightDirection;
#ifdef PER_FRAGMENT_GROUND_ATMOSPHERE
positionWC = computeEllipsoidPosition();
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
computeAtmosphereScattering(
positionWC,
lightDirection,
rayleighColor,
mieColor,
opacity
);
#else
positionWC = v_positionMC;
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
rayleighColor = v_atmosphereRayleighColor;
mieColor = v_atmosphereMieColor;
opacity = v_atmosphereOpacity;
#endif
rayleighColor = colorCorrect(rayleighColor);
mieColor = colorCorrect(mieColor);
vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
#ifdef FOG
vec3 fogColor = groundAtmosphereColor.rgb;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);
fogColor *= darken;
#endif
#ifndef HDR
fogColor.rgb = czm_acesTonemapping(fogColor.rgb);
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
#endif
const float modifier = 0.15;
finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a);
#else
const float transmittanceModifier = 0.5;
float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0);
vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
float fadeInDist = u_nightFadeDistance.x;
float fadeOutDist = u_nightFadeDistance.y;
float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0);
float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0);
vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken);
finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity);
#endif
#ifndef HDR
finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb);
#else
finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6);
#endif
finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade);
#endif
}
#endif
#ifdef UNDERGROUND_COLOR
if (czm_backFacing())
{
float distanceFromEllipsoid = max(czm_eyeHeight, 0.0);
float distance = max(v_distance - distanceFromEllipsoid, 0.0);
float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);
vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);
finalColor = alphaBlend(undergroundColor, finalColor);
}
#endif
#ifdef TRANSLUCENT
if (inTranslucencyRectangle())
{
vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;
finalColor.a *= interpolateByDistance(alphaByDistance, v_distance);
}
#endif
gl_FragColor = finalColor;
}
#ifdef SHOW_REFLECTIVE_OCEAN
float waveFade(float edge0, float edge1, float x)
{
float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
return pow(1.0 - y, 5.0);
}
float linearFade(float edge0, float edge1, float x)
{
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
}
const float oceanFrequencyLowAltitude = 825000.0;
const float oceanAnimationSpeedLowAltitude = 0.004;
const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;
const float oceanSpecularIntensity = 0.5;
const float oceanFrequencyHighAltitude = 125000.0;
const float oceanAnimationSpeedHighAltitude = 0.008;
const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)
{
vec3 positionToEyeEC = -positionEyeCoordinates;
float positionToEyeECLength = length(positionToEyeEC);
vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));
float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);
#ifdef SHOW_OCEAN_WAVES
float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;
vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);
vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);
time = czm_frameNumber * oceanAnimationSpeedLowAltitude;
noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);
vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);
float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);
float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);
vec3 normalTangentSpace =
(highAltitudeFade * normalTangentSpaceHighAltitude) +
(lowAltitudeFade * normalTangentSpaceLowAltitude);
normalTangentSpace = normalize(normalTangentSpace);
normalTangentSpace.xy *= waveIntensity;
normalTangentSpace = normalize(normalTangentSpace);
#else
vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);
#endif
vec3 normalEC = enuToEye * normalTangentSpace;
const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);
float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;
vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);
#ifdef SHOW_OCEAN_WAVES
float tsPerturbationRatio = normalTangentSpace.z;
vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);
#else
vec3 nonDiffuseHighlight = vec3(0.0);
#endif
float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);
float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);
float specular = specularIntensity * surfaceReflectance;
#ifdef HDR
specular *= 1.4;
float e = 0.2;
float d = 3.3;
float c = 1.7;
vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));
#else
vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;
#endif
return vec4(color, imageryColor.a);
}
#endif // #ifdef SHOW_REFLECTIVE_OCEAN
`;var M7=`#ifdef QUANTIZATION_BITS12
attribute vec4 compressed0;
attribute float compressed1;
#else
attribute vec4 position3DAndHeight;
attribute vec4 textureCoordAndEncodedNormals;
#endif
#ifdef GEODETIC_SURFACE_NORMALS
attribute vec3 geodeticSurfaceNormal;
#endif
#ifdef EXAGGERATION
uniform vec2 u_terrainExaggerationAndRelativeHeight;
#endif
uniform vec3 u_center3D;
uniform mat4 u_modifiedModelView;
uniform mat4 u_modifiedModelViewProjection;
uniform vec4 u_tileRectangle;
uniform vec2 u_southAndNorthLatitude;
uniform vec2 u_southMercatorYAndOneOverHeight;
varying vec3 v_positionMC;
varying vec3 v_positionEC;
varying vec3 v_textureCoordinates;
varying vec3 v_normalMC;
varying vec3 v_normalEC;
#ifdef APPLY_MATERIAL
varying float v_slope;
varying float v_aspect;
varying float v_height;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
varying float v_distance;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE)
varying vec3 v_atmosphereRayleighColor;
varying vec3 v_atmosphereMieColor;
varying float v_atmosphereOpacity;
#endif
vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);
float get2DYPositionFraction(vec2 textureCoordinates);
vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)
{
return u_modifiedModelViewProjection * vec4(position, 1.0);
}
float get2DMercatorYPositionFraction(vec2 textureCoordinates)
{
const float maxTileWidth = 0.003068;
float positionFraction = textureCoordinates.y;
float southLatitude = u_southAndNorthLatitude.x;
float northLatitude = u_southAndNorthLatitude.y;
if (northLatitude - southLatitude > maxTileWidth)
{
float southMercatorY = u_southMercatorYAndOneOverHeight.x;
float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;
float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);
currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);
positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);
}
return positionFraction;
}
float get2DGeographicYPositionFraction(vec2 textureCoordinates)
{
return textureCoordinates.y;
}
vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)
{
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
return u_modifiedModelViewProjection * rtcPosition2D;
}
vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)
{
return getPositionPlanarEarth(position, 0.0, textureCoordinates);
}
vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)
{
return getPositionPlanarEarth(position, height, textureCoordinates);
}
vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)
{
vec3 position3DWC = position + u_center3D;
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);
return czm_modelViewProjection * morphPosition;
}
#ifdef QUANTIZATION_BITS12
uniform vec2 u_minMaxHeight;
uniform mat4 u_scaleAndBias;
#endif
void main()
{
#ifdef QUANTIZATION_BITS12
vec2 xy = czm_decompressTextureCoordinates(compressed0.x);
vec2 zh = czm_decompressTextureCoordinates(compressed0.y);
vec3 position = vec3(xy, zh.x);
float height = zh.y;
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);
height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;
position = (u_scaleAndBias * vec4(position, 1.0)).xyz;
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
float encodedNormal = compressed1;
#elif defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
float encodedNormal = 0.0;
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)
float webMercatorT = textureCoordinates.y;
float encodedNormal = compressed0.w;
#else
float webMercatorT = textureCoordinates.y;
float encodedNormal = 0.0;
#endif
#else
vec3 position = position3DAndHeight.xyz;
float height = position3DAndHeight.w;
vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = textureCoordAndEncodedNormals.z;
float encodedNormal = textureCoordAndEncodedNormals.w;
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
float webMercatorT = textureCoordinates.y;
float encodedNormal = textureCoordAndEncodedNormals.z;
#elif defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = textureCoordAndEncodedNormals.z;
float encodedNormal = 0.0;
#else
float webMercatorT = textureCoordinates.y;
float encodedNormal = 0.0;
#endif
#endif
vec3 position3DWC = position + u_center3D;
#ifdef GEODETIC_SURFACE_NORMALS
vec3 ellipsoidNormal = geodeticSurfaceNormal;
#else
vec3 ellipsoidNormal = normalize(position3DWC);
#endif
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
float exaggeration = u_terrainExaggerationAndRelativeHeight.x;
float relativeHeight = u_terrainExaggerationAndRelativeHeight.y;
float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;
float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);
newHeight = max(newHeight, -minRadius);
vec3 offset = ellipsoidNormal * (newHeight - height);
position += offset;
position3DWC += offset;
height = newHeight;
#endif
gl_Position = getPosition(position, height, textureCoordinates);
v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;
v_positionMC = position3DWC;
v_textureCoordinates = vec3(textureCoordinates, webMercatorT);
#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
vec3 normalMC = czm_octDecode(encodedNormal);
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;
vec3 rejection = normalMC - projection;
normalMC = normalize(projection + rejection * exaggeration);
#endif
v_normalMC = normalMC;
v_normalEC = czm_normal3D * v_normalMC;
#endif
#if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))
bool dynamicLighting = false;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
dynamicLighting = true;
#endif
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
vec3 atmosphereLightDirection = czm_sunDirectionWC;
#else
vec3 atmosphereLightDirection = czm_lightDirectionWC;
#endif
vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));
computeAtmosphereScattering(
position3DWC,
lightDirection,
v_atmosphereRayleighColor,
v_atmosphereMieColor,
v_atmosphereOpacity
);
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);
#endif
#ifdef APPLY_MATERIAL
float northPoleZ = czm_ellipsoidRadii.z;
vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);
vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));
float dotProd = abs(dot(ellipsoidNormal, v_normalMC));
v_slope = acos(dotProd);
vec3 normalRejected = ellipsoidNormal * dotProd;
vec3 normalProjected = v_normalMC - normalRejected;
vec3 aspectVector = normalize(normalProjected);
v_aspect = acos(dot(aspectVector, vectorEastMC));
float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);
v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);
v_height = height;
#endif
}
`;var zx=`uniform vec3 u_radiiAndDynamicAtmosphereColor;
uniform float u_atmosphereLightIntensity;
uniform float u_atmosphereRayleighScaleHeight;
uniform float u_atmosphereMieScaleHeight;
uniform float u_atmosphereMieAnisotropy;
uniform vec3 u_atmosphereRayleighCoefficient;
uniform vec3 u_atmosphereMieCoefficient;
const float ATMOSPHERE_THICKNESS = 111e3;
const int PRIMARY_STEPS = 16;
const int LIGHT_STEPS = 4;
void computeScattering(
czm_ray primaryRay,
float primaryRayLength,
vec3 lightDirection,
float atmosphereInnerRadius,
out vec3 rayleighColor,
out vec3 mieColor,
out float opacity
) {
rayleighColor = vec3(0.0);
mieColor = vec3(0.0);
opacity = 0.0;
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
vec3 origin = vec3(0.0);
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
return;
}
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
float rayStepLength = (primaryRayAtmosphereIntersect.stop - primaryRayAtmosphereIntersect.start) / float(PRIMARY_STEPS);
float rayPositionLength = primaryRayAtmosphereIntersect.start;
vec3 rayleighAccumulation = vec3(0.0);
vec3 mieAccumulation = vec3(0.0);
vec2 opticalDepth = vec2(0.0);
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);
for (int i = 0; i < PRIMARY_STEPS; i++) {
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
opticalDepth += sampleDensity;
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
float lightPositionLength = 0.0;
vec2 lightOpticalDepth = vec2(0.0);
for (int j = 0; j < LIGHT_STEPS; j++) {
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
lightPositionLength += lightStepLength;
}
vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
rayleighAccumulation += sampleDensity.x * attenuation;
mieAccumulation += sampleDensity.y * attenuation;
rayPositionLength += rayStepLength;
}
rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;
mieColor = u_atmosphereMieCoefficient * mieAccumulation;
opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));
}
vec4 computeAtmosphereColor(
vec3 positionWC,
vec3 lightDirection,
vec3 rayleighColor,
vec3 mieColor,
float opacity
) {
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
float cosAngleSq = cosAngle * cosAngle;
float G = u_atmosphereMieAnisotropy;
float GSq = G * G;
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
vec3 rayleigh = rayleighPhase * rayleighColor;
vec3 mie = miePhase * mieColor;
vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;
return vec4(color, opacity);
}
`;var wB=`void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
float atmosphereInnerRadius = length(positionWC);
computeScattering(
primaryRay,
length(cameraToPositionWC),
lightDirection,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
}
`;function wct(e,t,n,i,o){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o}function B7(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function vct(e){let t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",n="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }",o;switch(e){case te.SCENE3D:o=t;break;case te.SCENE2D:case te.COLUMBUS_VIEW:o=n;break;case te.MORPHING:o=i;break}return o}function Dct(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}B7.prototype.getShaderProgram=function(e){let t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,o=e.applyBrightness,r=e.applyContrast,s=e.applyHue,a=e.applySaturation,c=e.applyGamma,u=e.applyAlpha,f=e.applyDayNightAlpha,d=e.applySplit,p=e.showReflectiveOcean,_=e.showOceanWaves,m=e.enableLighting,x=e.dynamicAtmosphereLighting,C=e.dynamicAtmosphereLightingFromSun,A=e.showGroundAtmosphere,T=e.perFragmentGroundAtmosphere,E=e.hasVertexNormals,S=e.useWebMercatorProjection,w=e.enableFog,D=e.enableClippingPlanes,R=e.clippingPlanes,M=e.clippedByBoundaries,L=e.hasImageryLayerCutout,N=e.colorCorrect,g=e.highlightFillTile,b=e.colorToAlpha,v=e.hasGeodeticSurfaceNormals,P=e.hasExaggeration,B=e.showUndergroundColor,F=e.translucent,k=0,U="",V=n.renderedMesh.encoding;V.quantization===Ta.BITS12&&(k=1,U="QUANTIZATION_BITS12");let j=0,$="";M&&(j=1,$="TILE_LIMIT_RECTANGLE");let G=0,K="";L&&(G=1,K="APPLY_IMAGERY_CUTOUT");let J=t.mode,ce=J|o<<2|r<<3|s<<4|a<<5|c<<6|u<<7|p<<8|_<<9|m<<10|x<<11|C<<12|A<<13|T<<14|E<<15|S<<16|w<<17|k<<18|d<<19|D<<20|j<<21|G<<22|N<<23|g<<24|b<<25|v<<26|P<<27|B<<28|F<<29|f<<30,de=0;l(R)&&R.length>0&&(de=D?R.clippingPlanesState:0);let oe=n.surfaceShader;if(l(oe)&&oe.numberOfDayTextures===i&&oe.flags===ce&&oe.material===this.material&&oe.clippingShaderState===de)return oe.shaderProgram;let le=this._shadersByTexturesFlags[i];if(l(le)||(le=this._shadersByTexturesFlags[i]=[]),oe=le[ce],!l(oe)||oe.material!==this.material||oe.clippingShaderState!==de){let ge=this.baseVertexShaderSource.clone(),De=this.baseFragmentShaderSource.clone();de!==0&&De.sources.unshift(Vy(R,t.context)),ge.defines.push(U),De.defines.push(`TEXTURE_UNITS ${i}`,$,K),o&&De.defines.push("APPLY_BRIGHTNESS"),r&&De.defines.push("APPLY_CONTRAST"),s&&De.defines.push("APPLY_HUE"),a&&De.defines.push("APPLY_SATURATION"),c&&De.defines.push("APPLY_GAMMA"),u&&De.defines.push("APPLY_ALPHA"),f&&De.defines.push("APPLY_DAY_NIGHT_ALPHA"),p&&(De.defines.push("SHOW_REFLECTIVE_OCEAN"),ge.defines.push("SHOW_REFLECTIVE_OCEAN")),_&&De.defines.push("SHOW_OCEAN_WAVES"),b&&De.defines.push("APPLY_COLOR_TO_ALPHA"),B&&(ge.defines.push("UNDERGROUND_COLOR"),De.defines.push("UNDERGROUND_COLOR")),F&&(ge.defines.push("TRANSLUCENT"),De.defines.push("TRANSLUCENT")),m&&(E?(ge.defines.push("ENABLE_VERTEX_LIGHTING"),De.defines.push("ENABLE_VERTEX_LIGHTING")):(ge.defines.push("ENABLE_DAYNIGHT_SHADING"),De.defines.push("ENABLE_DAYNIGHT_SHADING"))),x&&(ge.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),De.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),C&&(ge.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),De.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),A&&(ge.defines.push("GROUND_ATMOSPHERE"),De.defines.push("GROUND_ATMOSPHERE"),T&&(ge.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),De.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),ge.defines.push("INCLUDE_WEB_MERCATOR_Y"),De.defines.push("INCLUDE_WEB_MERCATOR_Y"),w&&(ge.defines.push("FOG"),De.defines.push("FOG")),d&&De.defines.pus
{
vec4 color = initialColor;
`;L&&(Re+=` vec4 cutoutAndColorResult;
bool texelUnclipped;
`);for(let Qe=0;Qe<i;++Qe)L?Re+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${Qe}];
texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
cutoutAndColorResult = sampleAndBlend(
`:Re+=` color = sampleAndBlend(
`,Re+=` color,
u_dayTextures[${Qe}],
u_dayTextureUseWebMercatorT[${Qe}] ? textureCoordinates.xz : textureCoordinates.xy,
u_dayTextureTexCoordsRectangle[${Qe}],
u_dayTextureTranslationAndScale[${Qe}],
${u?`u_dayTextureAlpha[${Qe}]`:"1.0"},
${f?`u_dayTextureNightAlpha[${Qe}]`:"1.0"},
${f?`u_dayTextureDayAlpha[${Qe}]`:"1.0"},
${o?`u_dayTextureBrightness[${Qe}]`:"0.0"},
${r?`u_dayTextureContrast[${Qe}]`:"0.0"},
${s?`u_dayTextureHue[${Qe}]`:"0.0"},
${a?`u_dayTextureSaturation[${Qe}]`:"0.0"},
${c?`u_dayTextureOneOverGamma[${Qe}]`:"0.0"},
${d?`u_dayTextureSplit[${Qe}]`:"0.0"},
${b?`u_colorsToAlpha[${Qe}]`:"vec4(0.0)"},
nightBlend );
`,L&&(Re+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
`);Re+=` return color;
}`,De.sources.push(Re),ge.sources.push(vct(J)),ge.sources.push(Dct(S));let Pe=gn.fromCache({context:t.context,vertexShaderSource:ge,fragmentShaderSource:De,attributeLocations:V.getAttributeLocations()});oe=le[ce]=new wct(i,ce,this.material,Pe,de)}return n.surfaceShader=oe,oe.shaderProgram};B7.prototype.destroy=function(){let e,t,n=this._shadersByTexturesFlags;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];if(!l(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],l(t)&&t.shaderProgram.destroy())}return fe(this)};var L7=B7;var Pct={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},Vi=Object.freeze(Pct);var Ict={START:0,LOADING:1,DONE:2,FAILED:3},Ba=Object.freeze(Ict);var Oct={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},nr=Object.freeze(Oct);function br(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new ae(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new h,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=nr.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new re,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(br.prototype,{eligibleForUnloading:{get:function(){let e=this.terrainState,n=!(e===nr.RECEIVING||e===nr.TRANSFORMING),i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){let s=i[o];n=!l(s.loadingImagery)||s.loadingImagery.state!==Vi.TRANSITIONING}return n}},renderedMesh:{get:function(){if(l(this.vertexArray))return this.mesh;if(l(this.fill))return this.fill.mesh}}});var Rct=new _e;function N7(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(l(t)&&t!==te.SCENE3D){let c=n.ellipsoid.cartesianToCartographic(s,Rct);s=n.project(c,r),s=h.fromElements(s.z,s.x,s.y,r)}return s}var Mct=new h,Bct=new h,Lct=new h;br.prototype.pick=function(e,t,n,i,o){let r=this.renderedMesh;if(!l(r))return;let s=r.vertices,a=r.indices,c=r.encoding,u=a.length,f=Number.MAX_VALUE;for(let d=0;d<u;d+=3){let p=a[d],_=a[d+1],m=a[d+2],x=N7(c,t,n,s,p,Mct),C=N7(c,t,n,s,_,Bct),A=N7(c,t,n,s,m,Lct),T=Do.rayTriangleParametric(e,x,C,A,i);l(T)&&T<f&&T>=0&&(f=T)}return f!==Number.MAX_VALUE?ri.getPoint(e,f,o):void 0};br.prototype.freeResources=function(){l(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=nr.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();let e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()};br.prototype.freeVertexArray=function(){br._freeVertexArray(this.vertexArray),this.vertexArray=void 0,br._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};br.initialize=function(e,t,n){let i=e.data;l(i)||(i=e.data=new br),e.state===Ba.START&&(Nct(e,t,n),e.state=Ba.LOADING)};br.processStateMachine=function(e,t,n,i,o,r,s){br.initialize(e,n,i);let a=e.data;if(e.state===Ba.LOADING&&Fct(e,t,n,i,o,r),s)return;let c=e.renderable;e.renderable=l(a.vertexArray);let u=a.terrainState===nr.READY;e.upsampledFromParent=l(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();let f=a.processImagery(e,n,t);if(u&&f){let d=e._loadedCallbacks,p={};for(let _ in d)d.hasOwnProperty(_)&&(d[_](e)||(p[_]=d[_]));e._loadedCallbacks=p,e.state=Ba.DONE}c&&(e.renderable=!0)};br.prototype.processImagery=function(e,t,n,i){let o=e.data,r=e.upsampledFromParent,s=!1,a=!0,c=o.imagery,u,f;for(u=0,f=c.length;u<f;++u){let d=c[u];if(!l(d.loadingImagery)){r=!1;continue}if(d.loadingImagery.state===Vi.PLACEHOLDER){let _=d.loadingImagery.imageryLayer;if(_.imageryProvider.ready){d.freeResources(),c.splice(u,1),_._createTileImagerySkeletons(e,t,u),--u,f=c.length;continue}else r=!1}let p=d.processStateMachine(e,n,i);a=a&&p,s=s||p||l(d.readyImagery),r=r&&l(d.loadingImagery)&&(d.loadingImagery.state===Vi.FAILED||d.loadingImagery.state===Vi.INVA
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(u_texture, v_textureCoordinates);
}
`;var V7=`attribute vec4 position;
attribute float webMercatorT;
uniform vec2 u_textureDimensions;
varying vec2 v_textureCoordinates;
void main()
{
v_textureCoordinates = vec2(position.x, webMercatorT);
gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));
}
`;function Ob(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,i!==0){let r=t/2|0,s=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,s,a)}this.state=Vi.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!l(o)&&e.imageryProvider.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}Ob.createPlaceholder=function(e){let t=new Ob(e,0,0,0);return t.addReference(),t.state=Vi.PLACEHOLDER,t};Ob.prototype.addReference=function(){++this.referenceCount};Ob.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),l(this.parent)&&this.parent.releaseReference(),l(this.image)&&l(this.image.destroy)&&this.image.destroy(),l(this.texture)&&this.texture.destroy(),l(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),fe(this),0):this.referenceCount};Ob.prototype.processStateMachine=function(e,t,n){this.state===Vi.UNLOADED&&!n&&(this.state=Vi.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===Vi.RECEIVED&&(this.state=Vi.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));let i=this.state===Vi.READY&&t&&!this.texture;(this.state===Vi.TEXTURE_LOADED||i)&&(this.state=Vi.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};var vB=Ob;function k7(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}k7.prototype.freeResources=function(){l(this.readyImagery)&&this.readyImagery.releaseReference(),l(this.loadingImagery)&&this.loadingImagery.releaseReference()};k7.prototype.processStateMachine=function(e,t,n){let i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===Vi.READY)return l(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this),!0;let r=i.parent,s;for(;l(r)&&(r.state!==Vi.READY||!this.useWebMercatorT&&!l(r.texture));)r.state!==Vi.FAILED&&r.state!==Vi.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(l(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,l(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===Vi.FAILED||i.state===Vi.INVALID?l(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};var DB=k7;function _o(e,t){this._imageryProvider=e,t=y(t,y.EMPTY_OBJECT),this.alpha=y(t.alpha,y(e.defaultAlpha,1)),this.nightAlpha=y(t.nightAlpha,y(e.defaultNightAlpha,1)),this.dayAlpha=y(t.dayAlpha,y(e.defaultDayAlpha,1)),this.brightness=y(t.brightness,y(e.defaultBrightness,_o.DEFAULT_BRIGHTNESS)),this.contrast=y(t.contrast,y(e.defaultContrast,_o.DEFAULT_CONTRAST)),this.hue=y(t.hue,y(e.defaultHue,_o.DEFAULT_HUE)),this.saturation=y(t.saturation,y(e.defaultSaturation,_o.DEFAULT_SATURATION)),this.gamma=y(t.gamma,y(e.defaultGamma,_o.DEFAULT_GAMMA)),this.splitDirection=y(t.splitDirection,y(e.defaultSplit,_o.DEFAULT_SPLIT)),this.minificationFilter=y(t.minificationFilter,y(e.defaultMinificationFilter,_o.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=y(t.magnificationFilter,y(e.defaultMagnificationFilter,_o.DEFAULT_MAGNIFICATION_FILTER)),this.show=y(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=y(t.rectangle,me.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new DB(vB.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=y(t.colorToAlphaThreshold,_o.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(_o.prototype,{imagery
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(colorTexture, v_textureCoordinates);
}
`;var Lb=`uniform highp sampler2D u_depthTexture;
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);
}
`;function dm(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new qi({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new qi({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new qi,this._tempCopyDepthFramebuffer=new qi,this._updateDepthFramebuffer=new qi({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new it,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}Object.defineProperties(dm.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}});function out(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function nge(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;let r=!it.equals(e._viewport,o.viewport),s=r!==e._useScissorTest;e._useScissorTest=r,it.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=it.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._rs)||!it.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=Ze.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Ze.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Hn.ALPHA_BLEND}),e._rsUpdate=Ze.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:$i.EQUAL,frontOperation:{fail:ln.KEEP,zFail:ln.KEEP,zPass:ln.KEEP},backFunction:$i.NEVER,reference:On.CESIUM_3D_TILE_MASK,mask:On.CESIUM_3D_TILE_MASK}})),l(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(Lb,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,l(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(Pf,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,l(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(Lb,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,l(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(Pf,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,l(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new Fi({color:new H(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}dm.prototype.update=function(e,t,n,i,o,r){let s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?lt.HALF_FLOAT:lt.FLOAT:lt.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,c),this._copyDepthFramebuffer.update(e,s,a),nge(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};dm.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};dm.prototype.executeCopyDepth=function(e,t){l(this._copyDepthCommand)&&(this.p
{
gl_FragColor = vec4(1.0);
}
`;t.sources=[n]}function lj(e,t){let n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=je.replaceMain(n[r],"czm_globe_translucency_main");let o=`
uniform sampler2D u_classificationTexture;
void main()
{
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
#ifdef MANUAL_DEPTH_TEST
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));
if (logDepthOrDepth != 0.0)
{
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
float depthEC = eyeCoordinate.z / eyeCoordinate.w;
if (v_positionEC.z < depthEC)
{
discard;
}
}
#endif
czm_globe_translucency_main();
vec4 classificationColor = texture2D(u_classificationTexture, st);
if (classificationColor.a > 0.0)
{
// Reverse premultiplication process to get the correct composited result of the classification primitives
classificationColor.rgb /= classificationColor.a;
}
gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a);
}
`;n.push(o)}function hge(e,t){lj(e,t),If(e.defines,"GROUND_ATMOSPHERE"),If(t.defines,"GROUND_ATMOSPHERE"),If(e.defines,"FOG"),If(t.defines,"FOG")}function _ut(e,t){lj(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function gut(e,t){hge(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function sge(e,t){let n=`uniform sampler2D u_classificationTexture;
void main()
{
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
vec4 pickColor = texture2D(u_classificationTexture, st);
if (pickColor == vec4(0.0))
{
discard;
}
gl_FragColor = pickColor;
}
`;t.sources=[n]}function yut(e,t,n,i,o,r){if(!l(o))return t;if(!i&&l(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!l(s)){let a=t._attributeLocations,c=t.vertexShaderSource.clone(),u=t.fragmentShaderSource.clone();c.defines=l(c.defines)?c.defines.slice(0):[],u.defines=l(u.defines)?u.defines.slice(0):[],o(c,u),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:a})}return s}function xut(e){e.cull.face=So.BACK,e.cull.enabled=!0}function Cut(e){e.cull.face=So.FRONT,e.cull.enabled=!0}function Aut(e){e.cull.face=So.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Tut(e){e.cull.face=So.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function but(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function age(e){e.cull.face=So.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=Hn.ALPHA_BLEND}function cge(e){e.cull.face=So.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=Hn.ALPHA_BLEND}function Eut(e){e.cull.face=So.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function Sut(e){e.cull.face=So.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function wut(e,t,n,i,o){if(!l(i))return e;if(!n&&l(t))return t;let r=o[e.id];if(!l(r)){let s=Ze.getState(e);i(s),r=Ze.fromCache(s),o[e.id]=r}return r}function Nb(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function vut(e,t,n,i,o){return l(o)?!i&&l(n)?n:Dt(t,o(e),!1):t}function Kd(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function Dut(){return[new Kd({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:mut,getRenderStateFunction:xut,getUniformMapFunction:void 0}),new Kd({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:put,getRenderStateFunction:Cut,getUniformMapFunction:void 0}),new Kd({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:cj,getRenderStateFunction:Aut,getUniformMapFunction:void 0}),new Kd({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:cj,getRenderStateFunction:Tut,getUniformMapFunction:void 0}),new Kd({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:cj,getRenderStateFunction:but,getUniformMapFunction:void 0}),new Kd({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:lj,getRenderStateFunction:age,getUniformMapFunction:Nb}),new Kd({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:hge,getRenderStateFunction:cge,getUniformMapFunction:Nb}),new Kd({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:_ut,getRenderStateFunction:age,getUniformMapFunction:Nb}),new Kd({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:gut,getRenderStateFunction:cge,getUniformMapFunction:Nb}),new Kd({pass:Se.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:sge,getRenderStateFunction:Eut,getUniformMapFunction:Nb}),new Kd({pass:Se.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:sge,getRenderStateFunction:Sut,getUniformMapFunction:Nb})]}var lge=new Array(Wx),uge=new Array(Wx);jx.prototype.updateDerivedCommands=function(e,t){let n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)uge[o]=this._derivedCommandPacks[n[o]],lge[o]=dge[n[o]];Put(this,e,i,n,lge,uge,t)}};function Put(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency,c=e._derivedCommandsDirty;if(t.dirty||!l(a)||c){t.dirty=!1,l(a)||(a={},t.derivedCommands.globeTranslucency=a);let u=s.frameNumber,f=y(a.uniformMapDirtyFrame,0),d=y(a.shaderProgramDirtyFrame,0),p=y(a.renderStateDirtyFrame,0),_=a.uniformMap!==t.uniformMap,m=a.shaderProgramId!==t.shaderProgram.id,x=a.renderStateId!==t.renderState.id;_&&(a.uniformMapDirtyFrame=u),m&&(a.shaderProgramDirtyFrame=u),x&&(a.renderStateDirtyFrame=u),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let C=0;C<n;++C){let A=r[C],T=i[C],E=o[C],S=a[E],w,D,R;l(S)?(w=S.uniformMap,D=S.shaderProg
uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform sampler2D classifiedTexture;
varying vec2 v_textureCoordinates;
void main()
{
vec4 color = texture2D(colorTexture, v_textureCoordinates);
if (color.a == 0.0)
{
discard;
}
bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));
#ifdef UNCLASSIFIED
vec4 highlightColor = czm_invertClassificationColor;
if (isClassified)
{
discard;
}
#else
vec4 highlightColor = vec4(1.0);
if (!isClassified)
{
discard;
}
#endif
gl_FragColor = color * highlightColor;
gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;
}
`,Wut=`uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
void main()
{
vec4 color = texture2D(colorTexture, v_textureCoordinates);
if (color.a == 0.0)
{
discard;
}
#ifdef UNCLASSIFIED
gl_FragColor = color * czm_invertClassificationColor;
#else
gl_FragColor = color;
#endif
}
`;hm.prototype.update=function(e,t,n){let i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;let r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,c=!l(i)||i.width!==s||i.height!==a;if((c||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),l(this._previousFramebuffer)||(this._depthStencilTexture=new Zt({context:e,width:s,height:a,pixelFormat:It.DEPTH_STENCIL,pixelDatatype:lt.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new dd({context:e,width:s,height:a,format:ou.DEPTH24_STENCIL8,numSamples:t})))),!l(this._fbo.framebuffer)||c||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,f;l(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),f=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,f=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),l(f)&&this._fbo.setDepthStencilRenderbuffer(f),this._fbo.update(e,s,a,t),l(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(u),this._fboClassified.update(e,s,a))}if(l(this._rsUnclassified)||(this._rsUnclassified=Ze.fromCache(Uut),this._rsClassified=Ze.fromCache(zut),this._rsDefault=Ze.fromCache(Hut)),!l(this._unclassifiedCommand)||o||r){l(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());let u=l(this._previousFramebuffer)?Wut:Gut,f=new je({defines:["UNCLASSIFIED"],sources:[u]}),d=new je({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(f,{renderState:l(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(d,{renderState:l(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),l(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),l(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(Pf,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};hm.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};hm.prototype.clear=function(e,t){l(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};hm.prototype.executeClassified=function(e,t){if(!l(this._previousFramebuffer)){let n=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)};hm.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};hm.prototype.isDestroyed=function(){return!1};hm.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),l(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),fe(this)};var jB=hm;function qB(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(qB.prototype,{total:{get:function(){return this._total}}});function a0(e){let t=new Array(Is.NUMBER_OF_JOB_TYPES);t[Is.TEXTURE]=new qB(l(e)?e
#extension GL_EXT_draw_buffers : enable
#endif
uniform vec4 u_bgColor;
uniform sampler2D u_depthTexture;
varying vec2 v_textureCoordinates;
void main()
{
if (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)
{
#ifdef MRT
gl_FragData[0] = u_bgColor;
gl_FragData[1] = vec4(u_bgColor.a);
#else
gl_FragColor = u_bgColor;
#endif
return;
}
discard;
}
`;var pj=`uniform sampler2D u_opaque;
uniform sampler2D u_accumulation;
uniform sampler2D u_revealage;
varying vec2 v_textureCoordinates;
void main()
{
vec4 opaque = texture2D(u_opaque, v_textureCoordinates);
vec4 accum = texture2D(u_accumulation, v_textureCoordinates);
float r = texture2D(u_revealage, v_textureCoordinates).r;
#ifdef MRT
vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);
#else
vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);
#endif
gl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;
if (opaque != czm_backgroundColor)
{
gl_FragColor.a = 1.0;
}
}
`;function o_(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;let t=e.colorBufferFloat&&e.depthTexture&&e.floatBlend;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new qi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new qi({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new qi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new qi({createColorAttachments:!1}),this._opaqueClearCommand=new Fi({color:new H(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new Fi({color:new H(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new Fi({color:new H(0,0,0,0),owner:this}),this._alphaClearCommand=new Fi({color:new H(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new it,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function gge(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function _j(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function yge(e){gge(e),_j(e)}function Zut(e,t,n,i){gge(e),e._accumulationTexture=new Zt({context:t,width:n,height:i,pixelFormat:It.RGBA,pixelDatatype:lt.FLOAT});let o=new Float32Array(n*i*4);e._revealageTexture=new Zt({context:t,pixelFormat:It.RGBA,pixelDatatype:lt.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function Jut(e,t){_j(e);let n=Z.FRAMEBUFFER_COMPLETE,i=!0,o=e._accumulationTexture.width,r=e._accumulationTexture.height;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,o,r),(e._translucentFBO.status!==n||e._adjustTranslucentFBO.status!==n)&&(_j(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,o,r),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,o,r);let s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,c=e._adjustTranslucentFBO.status===n,u=e._adjustAlphaFBO.status===n;(!s||!a||!c||!u)&&(yge(e),e._translucentMultipassSupport=!1,i=!1)}return i}o_.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();let r=this._opaqueTexture.width,s=this._opaqueTexture.height,a=this._accumulationTexture,c=!l(a)||a.width!==r||a.height!==s||i!==this._useHDR,u=this._numSamples!==o;if((c||u)&&(this._numSamples=o,Zut(this,e,r,s)),(!l(this._translucentFBO.framebuffer)||c||u)&&!Jut(this,e))return;this._useHDR=i;let f=this,d,p;l(this._compositeCommand)||(d=new je({sources:[pj]}),this._translucentMRTSupport&&d.defines.push("MRT"),p={u_opaque:function(){return f._opaqueTexture},u_accumulation:function(){return f._accumulationText
float ai = czm_gl_FragColor.a;
float wzi = czm_alphaWeight(ai);
gl_FragData[0] = vec4(Ci * wzi, ai);
gl_FragData[1] = vec4(ai * wzi);
`,sft=` vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;
float ai = czm_gl_FragColor.a;
float wzi = czm_alphaWeight(ai);
gl_FragColor = vec4(Ci, ai) * wzi;
`,aft=` float ai = czm_gl_FragColor.a;
gl_FragColor = vec4(ai);
`;function yj(e,t,n,i){let o=e.shaderCache.getDerivedShaderProgram(t,n);if(!l(o)){let r=t._attributeLocations,s=t.fragmentShaderSource.clone();s.sources=s.sources.map(function(a){return a=je.replaceMain(a,"czm_translucent_main"),a=a.replace(/gl_FragColor/g,"czm_gl_FragColor"),a=a.replace(/\bdiscard\b/g,"czm_discard = true"),a=a.replace(/czm_phong/g,"czm_translucentPhong"),a}),s.sources.splice(0,0,`${i.indexOf("gl_FragData")!==-1?`#extension GL_EXT_draw_buffers : enable
`:""}vec4 czm_gl_FragColor;
bool czm_discard = false;
`),s.sources.push(`void main()
{
czm_translucent_main();
if (czm_discard)
{
discard;
}
${i}}
`),o=e.shaderCache.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:s,attributeLocations:r})}return o}function cft(e,t){return yj(e,t,"translucentMRT",rft)}function lft(e,t){return yj(e,t,"translucentMultipass",sft)}function uft(e,t){return yj(e,t,"alphaMultipass",aft)}o_.prototype.createDerivedCommands=function(e,t,n){if(l(n)||(n={}),this._translucentMRTSupport){let i,o;l(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState),n.translucentCommand=pt.shallowClone(e,n.translucentCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=cft(t,e.shaderProgram),n.translucentCommand.renderState=nft(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o)}else{let i,o,r,s;l(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=pt.shallowClone(e,n.translucentCommand),n.alphaCommand=pt.shallowClone(e,n.alphaCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=lft(t,e.shaderProgram),n.translucentCommand.renderState=ift(this,t,e.renderState),n.alphaCommand.shaderProgram=uft(t,e.shaderProgram),n.alphaCommand.renderState=oft(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o,n.alphaCommand.shaderProgram=r,n.alphaCommand.renderState=s)}return n};function fft(e,t,n,i,o,r){let s,a,c,u=t.context,f=t.frameState.useLogDepth,d=t._hdr,p=i.framebuffer,_=o.length,m=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(u,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(u,i);let x=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,c=0;c<_;++c)s=o[c],s=f?s.derivedCommands.logDepth.command:s,s=d?s.derivedCommands.hdr.command:s,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,x);for(l(r)&&(s=r.unclassifiedCommand,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,x)),i.framebuffer=e._alphaFBO.framebuffer,c=0;c<_;++c)s=o[c],s=f?s.derivedCommands.logDepth.command:s,s=d?s.derivedCommands.hdr.command:s,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,x);l(r)&&(s=r.unclassifiedCommand,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,x)),i.framebuffer=p}function dft(e,t,n,i,o,r){let s=t.context,a=t.frameState.useLogDepth,c=t._hdr,u=i.framebuffer,f=o.length,d=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);let p=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let _,m;for(let x=0;x<f;++x)_=o[x],_=a?_.derivedCommands.logDepth.command:_,_=c?_.derivedCommands.hdr.command:_,m=d&&_.receiveShadows?_.derivedCommands.oit.shadows.translucentCommand:_.derivedCommands.oit.translucentCommand,n(m,t,s,i,p);l(r)&&(_=r.unclassifiedCommand,m=d&&_.receiveShadows?_.derivedCommands.oit.shadows.translucentCommand:_.derivedCommands.oit.translucentCommand,n(m,t,s,i,p)),i.framebuffer=u}o_.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){dft(this,e,t,n,i,o);return}fft(this,e,t,n,i,o)};o_.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};o_.prototype.clear=function(e,t,n){let i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,H.clone(n,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer,(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.f
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);
}
`;e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:Ze.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}Xx.prototype.update=function(e,t){Sft(this,e,t),wft(this,e,t)};var vft=new ae,Dft=new ae(1,1/255,1/65025,1/16581375);Xx.prototype.getDepth=function(e,t,n){if(!l(this.framebuffer))return;let i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=ae.unpack(i,0,vft);return ae.divideByScalar(o,255,o),ae.dot(o,Dft)};Xx.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};Xx.prototype.isDestroyed=function(){return!1};Xx.prototype.destroy=function(){return this._framebuffer.destroy(),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=l(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),fe(this)};var Aj=Xx;function qD(){this._framebuffer=new qi({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(qD.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function Pft(e){e._framebuffer.destroy()}function Ift(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);let o=new Rl(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new it},o.viewport=new it,e._passState=o}qD.prototype.update=function(e,t,n){let i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&Ift(this,e);let r=this.framebuffer,s=this._passState;return s.framebuffer=r,s.viewport.width=i,s.viewport.height=o,s.scissorTest.rectangle.x=t.x,s.scissorTest.rectangle.y=o-t.y,s.scissorTest.rectangle.width=1,s.scissorTest.rectangle.height=1,s};qD.prototype.isDestroyed=function(){return!1};qD.prototype.destroy=function(){return Pft(this),fe(this)};var Tj=qD;function XD(e){let t=new Rl(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new it},t.viewport=new it,this._context=e,this._fb=new qi({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}XD.prototype.begin=function(e,t){let n=this._context,i=t.width,o=t.height;return it.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=o,this._fb.update(n,i,o),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=o,this._passState};var YD=new H;XD.prototype.end=function(e){let t=y(e.width,1),n=y(e.height,1),i=this._context,o=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.max(t,n),s=r*r,a=Math.floor(t*.5),c=Math.floor(n*.5),u=0,f=0,d=0,p=-1;for(let _=0;_<s;++_){if(-a<=u&&u<=a&&-c<=f&&f<=c){let m=4*((c-f)*t+u+a);YD.red=H.byteToFloat(o[m]),YD.green=H.byteToFloat(o[m+1]),YD.blue=H.byteToFloat(o[m+2]),YD.alpha=H.byteToFloat(o[m+3]);let x=i.getObjectByPickColor(YD);if(l(x))return x}if(u===f||u<0&&-u===f||u>0&&u===1-f){let m=d;d=-p,p=m}u+=d,f+=p}};XD.prototype.isDestroyed=function(){return!1};XD.prototype.destroy=function(){return this._fb.destroy(),fe(this)};var bj=XD;function r_(){this._numSamples=1,this._colorFramebuffer=new qi({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new qi({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new H(0,0,0,0),this._clearCommand=new Fi({color:new H(0,0,0,0),depth:1,owner:this})}function Oft(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(r_.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});r_.prototype.update=function(e,t,n,i){let o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?lt.HALF_FLOAT:lt.FLOAT:lt.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};r_.prototype.clear=function(e,t,n){H.clone(n,this._clearCommand.color),H.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFra
void main()
{
czm_shadow_cast_main();
v_positionEC = (czm_inverseProjection * gl_Position).xyz;
}`;o.push(c)}return new je({defines:i,sources:o})};Kx.createShadowCastFragmentShader=function(e,t,n,i){let o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=je.findPositionVarying(e),a=l(s);a||(s="v_positionEC");let c=r.length;for(let f=0;f<c;++f)r[f]=je.replaceMain(r[f],"czm_shadow_cast_main");let u="";return t&&(a||(u+=`varying vec3 v_positionEC;
`),u+=`uniform vec4 shadowMap_lightPositionEC;
`),i?u+=`void main()
{
`:u+=`void main()
{
czm_shadow_cast_main();
if (gl_FragColor.a == 0.0)
{
discard;
}
`,t?u+=` float distance = length(${s});
if (distance >= shadowMap_lightPositionEC.w)
{
discard;
}
distance /= shadowMap_lightPositionEC.w; // radius
gl_FragColor = czm_packDepth(distance);
`:n?u+=` gl_FragColor = vec4(1.0);
`:u+=` gl_FragColor = czm_packDepth(gl_FragCoord.z);
`,u+=`}
`,r.push(u),new je({defines:o,sources:r})};Kx.getShadowReceiveShaderKeyword=function(e,t,n,i){let o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,c=e._numberOfCascades>1,u=e.debugCascadeColors,f=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${c}${u}${f}${t}${n}${i}`};Kx.createShadowReceiveVertexShader=function(e,t,n){let i=e.defines.slice(0),o=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new je({defines:i,sources:o})};Kx.createShadowReceiveFragmentShader=function(e,t,n,i,o){let r=je.findNormalVarying(e),s=!i&&l(r)||i&&o,a=je.findPositionVarying(e),c=l(a),u=t._usesDepthTexture,f=t._polygonOffsetSupported,d=t._isPointLight,p=t._isSpotLight,_=t._numberOfCascades>1,m=t.debugCascadeColors,x=t.softShadows,C=d?t._pointBias:i?t._terrainBias:t._primitiveBias,A=e.defines.slice(0),T=e.sources.slice(0),E=T.length;for(let D=0;D<E;++D)T[D]=je.replaceMain(T[D],"czm_shadow_receive_main");d?A.push("USE_CUBE_MAP_SHADOW"):u&&A.push("USE_SHADOW_DEPTH_TEXTURE"),x&&!d&&A.push("USE_SOFT_SHADOWS"),_&&n&&i&&(s?A.push("ENABLE_VERTEX_LIGHTING"):A.push("ENABLE_DAYNIGHT_SHADING")),n&&C.normalShading&&s&&(A.push("USE_NORMAL_SHADING"),C.normalShadingSmooth>0&&A.push("USE_NORMAL_SHADING_SMOOTH"));let S="";d?S+=`uniform samplerCube shadowMap_textureCube;
`:S+=`uniform sampler2D shadowMap_texture;
`;let w;return c?w=` return vec4(${a}, 1.0);
`:w=`#ifndef LOG_DEPTH
return czm_windowToEyeCoordinates(gl_FragCoord);
#else
return vec4(v_logPositionEC, 1.0);
#endif
`,S+=`uniform mat4 shadowMap_matrix;
uniform vec3 shadowMap_lightDirectionEC;
uniform vec4 shadowMap_lightPositionEC;
uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness;
uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth;
#ifdef LOG_DEPTH
varying vec3 v_logPositionEC;
#endif
vec4 getPositionEC()
{
${w}}
vec3 getNormalEC()
{
${s?` return normalize(${r});
`:` return vec3(1.0);
`}}
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL)
{
${C.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x;
float normalOffsetScale = 1.0 - nDotL;
vec3 offset = normalOffset * normalOffsetScale * normalEC;
positionEC.xyz += offset;
`:""}}
`,S+=`void main()
{
czm_shadow_receive_main();
vec4 positionEC = getPositionEC();
vec3 normalEC = getNormalEC();
float depth = -positionEC.z;
`,S+=` czm_shadowParameters shadowParameters;
shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
`,i?S+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0);
`:f||(S+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015);
`),d?S+=` vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz;
float distance = length(directionEC);
directionEC = normalize(directionEC);
float radius = shadowMap_lightPositionEC.w;
// Stop early if the fragment is beyond the point light radius
if (distance > radius)
{
return;
}
vec3 directionWC = czm_inverseViewRotation * directionEC;
shadowParameters.depth = distance / radius;
shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
shadowParameters.texCoords = directionWC;
float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters);
`:p?S+=` vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz);
float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
applyNormalOffset(positionEC, normalEC, nDotL);
vec4 shadowPosition = shadowMap_matrix * positionEC;
// Spot light uses a perspective projection, so perform the perspective divide
shadowPosition /= shadowPosition.w;
// Stop early if the fragment is not in the shadow bounds
if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0))))
{
return;
}
shadowParameters.texCoords = shadowPosition.xy;
shadowParameters.depth = shadowPosition.z;
shadowParameters.nDotL = nDotL;
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
`:_?S+=` float maxDepth = shadowMap_cascadeSplits[1].w;
// Stop early if the eye depth exceeds the last cascade
if (depth > maxDepth)
{
return;
}
// Get the cascade based on the eye-space depth
vec4 weights = czm_cascadeWeights(depth);
// Apply normal offset
float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0);
applyNormalOffset(positionEC, normalEC, nDotL);
// Transform position into the cascade
vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC;
// Get visibility
shadowParameters.texCoords = shadowPosition.xy;
shadowParameters.depth = shadowPosition.z;
shadowParameters.nDotL = nDotL;
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
// Fade out shadows that are far away
float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z;
float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0);
visibility = mix(visibility, 1.0, fade);
${m?` // Draw cascade colors for debugging
gl_FragColor *= czm_cascadeColor(weights);
`:""}`:S+=` float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0);
applyNormalOffset(positionEC, normalEC, nDotL);
vec4 shadowPosition = shadowMap_matrix * positionEC;
// Stop early if the fragment is not in the shadow bounds
if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0))))
{
return;
}
shadowParameters.texCoords = shadowPosition.xy;
shadowParameters.depth = shadowPosition.z;
shadowParameters.nDotL = nDotL;
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
`,S+=` gl_FragColor.rgb *= visibility;
}
`,T.push(S),new je({defines:A,sources:T})};var c0=Kx;function mm(e){e=y(e,y.EMPTY_OBJECT);let t=e.context;this._enabled=y(e.enabled,!0),this._softShadows=y(e.softShadows,!1),this._normalOffset=y(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=y(e.fromLightSource,!0),this.darkness=y(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=y(e.fadingEnabled,!0),this.maximumDistance=y(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(Kt.isInternetExplorer()||Kt.isEdge()||(Kt.isChrome()||Kt.isFirefox())&&Kt.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new O,this._shadowMapTexture=void 0,this._lightDirectionEC=new h,this._lightPositionEC=new ae,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new eL,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new re,this._isPointLight=y(e.isPointLight,!1),this._pointLightRadius=y(e.pointLightRadius,100),this._cascadesEnabled=this._isPointLight?!1:y(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?y(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new W,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new _s:l(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new ae,new ae],this._cascadeMatrices=[new O,new O,new O,new O],this._cascadeDistances=new ae;let i;this._isPointLight?i=6:this._cascadesEnabled?i=this._numberOfCascades:i=1,this._passes=new Array(i);for(let o=0;o<i;++o)this._passes[o]=new Rft(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,Sj(this),this._clearCommand=new Fi({depth:1,color:new H}),this._clearPassState=new Rl(t),this._size=y(e.size,2048),this.size=this._size}mm.MAXIMUM_DISTANCE=2e4;function Rft(e){this.camera=new eL,this.passState=new Rl(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function Ej(e,t){return Ze.fromCache({cull:{enabled:!0,face:So.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function Sj(e){let t=!e._usesDepthTexture;e._primitiveRenderState=Ej(t,e._primitiveBias),e._terrainRenderState=Ej(t,e._terrainBias),e._pointRenderState=Ej(t,e._pointBias)}mm.prototype.debugCreateRenderStates=function(){Sj(this)};Object.defineProperties(mm.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){Vft(this,e)}},outOfView:{
varying vec2 v_textureCoordinates;
void main()
{
vec2 uv = v_textureCoordinates;
vec3 dir;
if (uv.y < 0.5)
{
if (uv.x < 0.333)
{
dir.x = -1.0;
dir.y = uv.x * 6.0 - 1.0;
dir.z = uv.y * 4.0 - 1.0;
}
else if (uv.x < 0.666)
{
dir.y = -1.0;
dir.x = uv.x * 6.0 - 3.0;
dir.z = uv.y * 4.0 - 1.0;
}
else
{
dir.z = -1.0;
dir.x = uv.x * 6.0 - 5.0;
dir.y = uv.y * 4.0 - 1.0;
}
}
else
{
if (uv.x < 0.333)
{
dir.x = 1.0;
dir.y = uv.x * 6.0 - 1.0;
dir.z = uv.y * 4.0 - 3.0;
}
else if (uv.x < 0.666)
{
dir.y = 1.0;
dir.x = uv.x * 6.0 - 3.0;
dir.z = uv.y * 4.0 - 3.0;
}
else
{
dir.z = 1.0;
dir.x = uv.x * 6.0 - 5.0;
dir.y = uv.y * 4.0 - 3.0;
}
}
float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir));
gl_FragColor = vec4(vec3(shadow), 1.0);
}
`:n=`uniform sampler2D shadowMap_texture;
varying vec2 v_textureCoordinates;
void main()
{
${e._usesDepthTexture?` float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r;
`:` float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates));
`} gl_FragColor = vec4(vec3(shadow), 1.0);
}
`;let i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=Se.OVERLAY,i}function zft(e,t){let n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=kft;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;l(a)||(a=Uft(e,n),e._debugShadowViewCommand=a),(!l(a.renderState)||!it.equals(a.renderState.viewport,s))&&(a.renderState=Ze.fromCache({viewport:it.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}var pm=new Array(8);pm[0]=new ae(-1,-1,-1,1);pm[1]=new ae(1,-1,-1,1);pm[2]=new ae(1,1,-1,1);pm[3]=new ae(-1,1,-1,1);pm[4]=new ae(-1,-1,1,1);pm[5]=new ae(1,-1,1,1);pm[6]=new ae(1,1,1,1);pm[7]=new ae(-1,1,1,1);var l0=new O,vj=new Array(8);for(let e=0;e<8;++e)vj[e]=new ae;function Hft(e,t){let n=new kt({geometry:new Fm({minimum:new h(-.5,-.5,-.5),maximum:new h(.5,.5,.5)}),attributes:{color:on.fromColor(t)}}),i=new kt({geometry:new uy({radius:.5}),attributes:{color:on.fromColor(t)}});return new ii({geometryInstances:[n,i],appearance:new Bn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var Gft=[H.RED,H.GREEN,H.BLUE,H.MAGENTA],Wft=new h;function jft(e,t){zft(e,t);let n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new r0({camera:e._sceneCamera,color:H.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new r0({camera:e._shadowMapCamera,color:H.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let i=0;i<e._numberOfCascades;++i)n&&(e._debugCascadeFrustums[i]=e._debugCascadeFrustums[i]&&e._debugCascadeFrustums[i].destroy(),e._debugCascadeFrustums[i]=new r0({camera:e._passes[i].camera,color:Gft[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!l(e._debugLightFrustum)||e._needsUpdate){let i=e._shadowMapCamera.positionWC,o=ke.IDENTITY,r=e._pointLightRadius*2,s=h.fromElements(r,r,r,Wft),a=O.fromTranslationQuaternionRotationScale(i,o,s,l0);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=Hft(a,H.YELLOW)}e._debugLightFrustum.update(t)}else(!l(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new r0({camera:e._shadowMapCamera,color:H.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function eL(){this.viewMatrix=new O,this.inverseViewMatrix=new O,this.frustum=void 0,this.positionCartographic=new _e,this.positionWC=new h,this.directionWC=h.clone(h.UNIT_Z),this.upWC=h.clone(h.UNIT_Y),this.rightWC=h.clone(h.UNIT_X),this.viewProjectionMatrix=new O}eL.prototype.clone=function(e){O.clone(e.viewMatrix,this.viewMatrix),O.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),_e.clone(e.positionCartographic,this.positionCartographic),h.clone(e.positionWC,this.positionWC),h.clone(e.directionWC,this.directionWC),h.clone(e.upWC,this.upWC),h.clone(e.rightWC,this.rightWC)};var qft=new O(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);eL.prototype.getViewProjection=function(){let e=this.viewMatrix,t=this.frustum.projectionMatrix;return O.multiply(t,e,this.viewProjectionMatrix),O.multiply(qft,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var Yft=new Array(5),Xft=new io,Kft=new Array(4),Dge=new h,Pge=new h;function $ft(e,t){let n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades,a,c=r-o,u=r/o,f=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,f=.9);let p=Kft,_=Yft;for(_[0]=o,_[s]=r,a=0;a<s;++a){let N=(a+1)/s,g=o*Math.pow(u,N),b=o+c*N,v=I.lerp(b,g,f);_[a+1]=v,p[a]=v-_[a]}if(d){for(a=0;a<s;++a)p[a]=Math.min(p[a],e._maximumCascadeDistances[a]);let N=_[0];for(a=0;a<s-1;++a)N+=p[a],_[a+1]=N}ae.unpack(_,0,e._cascadeSplits[0]),ae.unpack(_,
uniform sampler2D u_translucentDepthTexture;
varying vec2 v_textureCoordinates;
void main()
{
float opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;
float translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;
translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
gl_FragColor = czm_packDepth(translucentDepth);
}
`;var $D=`uniform sampler2D colorTexture;
#ifdef DEBUG_SHOW_DEPTH
uniform sampler2D u_packedTranslucentDepth;
#endif
varying vec2 v_textureCoordinates;
void main()
{
#ifdef DEBUG_SHOW_DEPTH
if (v_textureCoordinates.x < 0.5)
{
gl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));
gl_FragColor.a = 1.0;
}
#else
vec4 color = texture2D(colorTexture, v_textureCoordinates);
#ifdef PICK
if (color == vec4(0.0))
{
discard;
}
#else
color.rgb /= color.a;
#endif
gl_FragColor = color;
#endif
}
`;var fdt=!1;function u0(e){this._drawClassificationFBO=new qi({createDepthAttachments:!1}),this._accumulationFBO=new qi({createDepthAttachments:!1}),this._packFBO=new qi,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new Fi({color:new H(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new Fi({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new it,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}Object.defineProperties(u0.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function Rge(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function Mge(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function ddt(e,t,n,i){Rge(e),e._translucentDepthStencilTexture=new Zt({context:t,width:n,height:i,pixelFormat:It.DEPTH_STENCIL,pixelDatatype:lt.UNSIGNED_INT_24_8,sampler:Nn.NEAREST})}function hdt(e,t,n,i){Mge(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,n,i),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,n,i),e._packFBO.update(t,n,i)}function mdt(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;let o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;e._drawClassificationFBO.isDirty(o,r)&&(ddt(e,t,o,r),hdt(e,t,o,r));let s,a;if(l(e._packDepthCommand)||(s=new je({sources:[Dj]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!l(e._compositeCommand)){s=new je({sources:[$D]}),a={colorTexture:function(){return e._textureToComposite}},fdt&&(s.defines=["DEBUG_SHOW_DEPTH"],a.u_packedTranslucentDepth=function(){return e._packFBO.getColorTexture()}),e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});let f=e._compositeCommand,d=f.shaderProgram,p=t.shaderCache.createDerivedShaderProgram(d,"pick",{vertexShaderSource:d.vertexShaderSource,fragmentShaderSource:new je({sources:s.sources,defines:["PICK"]}),attributeLocations:d._attributeLocations}),_=pt.shallowClone(f);_.shaderProgram=p,f.derivedCommands.pick=_}l(e._copyCommand)||(s=new je({sources:[$D]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),l(e._accumulateCommand)||(s=new je({sources:[$D]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;let c=!it.equals(e._viewport,n.viewport),u=c!==e._useScissorTest;e._useScissorTest=c,it.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=it.clone(n.viewport,e._scissorRectangle),u=!0),(!l(e._rsDepth)||!it.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=Ze.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!l(e._rsAccumulate)||!it.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=Ze.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:$i.EQUAL,reference:On.CESIUM_3D_TILE_MASK}})),l(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!l(e._rsComp)||!it.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rs
uniform sampler2D czm_idTexture;
uniform sampler2D czm_selectedIdTexture;
uniform float czm_selectedIdTextureStep;
varying vec2 v_textureCoordinates;
bool czm_selected(vec2 offset)
{
bool selected = false;
vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset);
for (int i = 0; i < ${o}; ++i)
{
vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5));
if (all(equal(id, selectedId)))
{
return true;
}
}
return false;
}
bool czm_selected()
{
return czm_selected(vec2(0.0));
}
${n}`}let i=new je({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function tht(e){let t=e._sampleMode,n,i;t===$d.LINEAR?(n=tn.LINEAR,i=wo.LINEAR):(n=tn.NEAREST,i=wo.NEAREST);let o=e._sampler;(!l(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new Nn({wrapS:Gn.CLAMP_TO_EDGE,wrapT:Gn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function nht(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function iht(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function oht(e,t){let n,i,o,r=e._texturesToRelease,s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;let a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){let d=a[n];o=d.name;let p=d.source;e._actualUniforms[o]=new Zt({context:t,source:p})}a.length=0;let c=e._dirtyUniforms;if(c.length===0&&!l(e._texturePromise)){e._ready=!0;return}if(c.length===0||l(e._texturePromise))return;s=c.length;let u=e._uniforms,f=[];for(n=0;n<s;++n){o=c[n];let d=u[o],p=e._textureCache.getStageByName(d);if(l(p))e._actualUniforms[o]=iht(e,d);else if(typeof d=="string"){let _=new Fe({url:d});f.push(_.fetchImage().then(nht(e,o)))}else e._texturesToCreate.push({name:o,source:d})}c.length=0,f.length>0?(e._ready=!1,e._texturePromise=Promise.all(f).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function Kge(e){l(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();let t=e._textureCache;if(!l(t))return;let n=e._uniforms,i=e._actualUniforms;for(let o in i)i.hasOwnProperty(o)&&i[o]instanceof Zt&&(l(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function rht(e){let t=l(e._selected)?e._selected.length:0,n=l(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,l(e._selected)&&l(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):l(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&l(e._combinedSelected)){if(!l(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}function sht(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;let n=e._combinedSelected;if(!l(n))return;let i,o,r=0,s=n.length;for(i=0;i<s;++i)o=n[i],l(o.pickIds)?r+=o.pickIds.length:l(o.pickId)&&++r;if(s===0||r===0){let f=new Uint8Array(4);f[0]=255,f[1]=255,f[2]=255,f[3]=255,e._selectedIdTexture=new Zt({context:t,pixelFormat:It.RGBA,pixelDatatype:lt.UNSIGNED_BYTE,source:{arrayBufferView:f,width:1,height:1},sampler:Nn.NEAREST});return}let a,c=0,u=new Uint8Array(r*4);for(i=0;i<s;++i)if(o=n[i],l(o.pickIds)){let f=o.pickIds,d=f.length;for(let p=0;p<d;++p)a=f[p].color,u[c]=H.floatToByte(a.red),u[c+1]=H.floatToByte(a.green),u[c+2]=H.floatToByte(a.blue),u[c+3]=H.floatToByte(a.alpha),c+=4}else l(o.pickId)&&(a=o.pickId.color,u[c]=H.floatToByte(a.red),u[c+1]=H.floatToByte(a.green),u[c+2]=H.floatToByte(a.blue),u[c+3]=H.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new Zt({context:t,pixelFormat:It.RGBA,pixelDatatype:lt.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:Nn.NEAREST})}Zx.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&Kge(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=rht(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=l(this._selected)?this._selected.length:0,this._parentSelectedLength=l(this._parentSelected)?this._parentSelected.length:0,sht(this,e),Qdt(this),oht(this,e),eht(this,e),th
varying vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif
void main()
{
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
color /= texture2D(autoExposure, vec2(0.5)).r;
#endif
color = czm_acesTonemapping(color);
color = czm_inverseGamma(color);
gl_FragColor = vec4(color, fragmentColor.a);
}
`;var Lj=`uniform sampler2D randomTexture;
uniform sampler2D depthTexture;
uniform float intensity;
uniform float bias;
uniform float lengthCap;
uniform float stepSize;
uniform float frustumLength;
varying vec2 v_textureCoordinates;
vec4 clipToEye(vec2 uv, float depth)
{
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);
posEC = posEC / posEC.w;
return posEC;
}
vec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)
{
vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);
vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);
vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);
vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);
vec3 up = posInCamera.xyz - posInCameraUp.xyz;
vec3 down = posInCameraDown.xyz - posInCamera.xyz;
vec3 left = posInCamera.xyz - posInCameraLeft.xyz;
vec3 right = posInCameraRight.xyz - posInCamera.xyz;
vec3 DX = length(left) < length(right) ? left : right;
vec3 DY = length(up) < length(down) ? up : down;
return normalize(cross(DY, DX));
}
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
vec4 posInCamera = clipToEye(v_textureCoordinates, depth);
if (posInCamera.z > frustumLength)
{
gl_FragColor = vec4(1.0);
return;
}
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));
float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));
float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));
float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));
vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);
float ao = 0.0;
vec2 sampleDirection = vec2(1.0, 0.0);
float gapAngle = 90.0 * czm_radiansPerDegree;
float randomVal = texture2D(randomTexture, v_textureCoordinates).x;
for (int i = 0; i < 4; i++)
{
float newGapAngle = gapAngle * (float(i) + randomVal);
float cosVal = cos(newGapAngle);
float sinVal = sin(newGapAngle);
vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);
float localAO = 0.0;
float localStepSize = stepSize;
for (int j = 0; j < 6; j++)
{
vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;
if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)
{
break;
}
float stepDepthInfo = czm_readDepth(depthTexture, newCoords);
vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);
vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;
float len = length(diffVec);
if (len > lengthCap)
{
break;
}
float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );
float weight = len / lengthCap;
weight = 1.0 - weight * weight;
if (dotVal < bias)
{
dotVal = 0.0;
}
localAO = max(localAO, dotVal * weight);
localStepSize += stepSize;
}
ao += localAO;
}
ao /= 4.0;
ao = 1.0 - clamp(ao, 0.0, 1.0);
ao = pow(ao, intensity);
gl_FragColor = vec4(vec3(ao), 1.0);
}
`;var Nj=`uniform sampler2D colorTexture;
uniform sampler2D ambientOcclusionTexture;
uniform bool ambientOcclusionOnly;
varying vec2 v_textureCoordinates;
void main(void)
{
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
vec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;
gl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;
}
`;var Fj=`uniform sampler2D colorTexture;
uniform float gradations;
varying vec2 v_textureCoordinates;
void main(void)
{
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
#ifdef CZM_SELECTED_FEATURE
if (czm_selected()) {
gl_FragColor = vec4(rgb, 1.0);
return;
}
#endif
float luminance = czm_luminance(rgb);
float darkness = luminance * gradations;
darkness = (darkness - fract(darkness)) / gradations;
gl_FragColor = vec4(vec3(darkness), 1.0);
}
`;var Vj=`uniform sampler2D colorTexture;
uniform sampler2D bloomTexture;
uniform bool glowOnly;
varying vec2 v_textureCoordinates;
void main(void)
{
vec4 color = texture2D(colorTexture, v_textureCoordinates);
#ifdef CZM_SELECTED_FEATURE
if (czm_selected()) {
gl_FragColor = color;
return;
}
#endif
vec4 bloom = texture2D(bloomTexture, v_textureCoordinates);
gl_FragColor = glowOnly ? bloom : bloom + color;
}
`;var kj=`uniform sampler2D colorTexture;
uniform float brightness;
varying vec2 v_textureCoordinates;
void main(void)
{
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
vec3 target = vec3(0.0);
gl_FragColor = vec4(mix(target, rgb, brightness), 1.0);
}
`;var Uj=`uniform sampler2D colorTexture;
uniform float contrast;
uniform float brightness;
varying vec2 v_textureCoordinates;
void main(void)
{
vec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;
sceneColor = czm_RGBToHSB(sceneColor);
sceneColor.z += brightness;
sceneColor = czm_HSBToRGB(sceneColor);
float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));
sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);
gl_FragColor = vec4(sceneColor, 1.0);
}
`;var zj=`uniform sampler2D colorTexture;
uniform sampler2D blurTexture;
uniform sampler2D depthTexture;
uniform float focalDistance;
varying vec2 v_textureCoordinates;
vec4 toEye(vec2 uv, float depth)
{
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);
posInCamera = posInCamera / posInCamera.w;
return posInCamera;
}
float computeDepthBlur(float depth)
{
float f;
if (depth < focalDistance)
{
f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);
}
else
{
f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);
f = pow(f, 0.1);
}
f *= f;
f = clamp(f, 0.0, 1.0);
return pow(f, 0.5);
}
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
vec4 posInCamera = toEye(v_textureCoordinates, depth);
float d = computeDepthBlur(-posInCamera.z);
gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);
}
`;var Hj=`uniform sampler2D depthTexture;
varying vec2 v_textureCoordinates;
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
gl_FragColor = vec4(vec3(depth), 1.0);
}
`;var Gj=`uniform sampler2D depthTexture;
uniform float length;
uniform vec4 color;
varying vec2 v_textureCoordinates;
void main(void)
{
float directions[3];
directions[0] = -1.0;
directions[1] = 0.0;
directions[2] = 1.0;
float scalars[3];
scalars[0] = 3.0;
scalars[1] = 10.0;
scalars[2] = 3.0;
float padx = czm_pixelRatio / czm_viewport.z;
float pady = czm_pixelRatio / czm_viewport.w;
#ifdef CZM_SELECTED_FEATURE
bool selected = false;
for (int i = 0; i < 3; ++i)
{
float dir = directions[i];
selected = selected || czm_selected(vec2(-padx, dir * pady));
selected = selected || czm_selected(vec2(padx, dir * pady));
selected = selected || czm_selected(vec2(dir * padx, -pady));
selected = selected || czm_selected(vec2(dir * padx, pady));
if (selected)
{
break;
}
}
if (!selected)
{
gl_FragColor = vec4(color.rgb, 0.0);
return;
}
#endif
float horizEdge = 0.0;
float vertEdge = 0.0;
for (int i = 0; i < 3; ++i)
{
float dir = directions[i];
float scale = scalars[i];
horizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;
horizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;
vertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;
vertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;
}
float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);
gl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);
}
`;var Wj=`uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif
void main()
{
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture2D(autoExposure, vec2(0.5)).r;
color /= exposure;
#endif
const float A = 0.22;
const float B = 0.30;
const float C = 0.10;
const float D = 0.20;
const float E = 0.01;
const float F = 0.30;
const float white = 11.2;
vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;
float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;
c = czm_inverseGamma(c / w);
gl_FragColor = vec4(c, fragmentColor.a);
}
`;var jj=`varying vec2 v_textureCoordinates;
uniform sampler2D colorTexture;
const float fxaaQualitySubpix = 0.5;
const float fxaaQualityEdgeThreshold = 0.125;
const float fxaaQualityEdgeThresholdMin = 0.0833;
void main()
{
vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;
vec4 color = FxaaPixelShader(
v_textureCoordinates,
colorTexture,
fxaaQualityRcpFrame,
fxaaQualitySubpix,
fxaaQualityEdgeThreshold,
fxaaQualityEdgeThresholdMin);
float alpha = texture2D(colorTexture, v_textureCoordinates).a;
gl_FragColor = vec4(color.rgb, alpha);
}
`;var Ub=`#define SAMPLES 8
uniform float delta;
uniform float sigma;
uniform float direction;
uniform sampler2D colorTexture;
#ifdef USE_STEP_SIZE
uniform float stepSize;
#else
uniform vec2 step;
#endif
varying vec2 v_textureCoordinates;
void main()
{
vec2 st = v_textureCoordinates;
vec2 dir = vec2(1.0 - direction, direction);
#ifdef USE_STEP_SIZE
vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));
#else
vec2 step = step;
#endif
vec3 g;
g.x = 1.0 / (sqrt(czm_twoPi) * sigma);
g.y = exp((-0.5 * delta * delta) / (sigma * sigma));
g.z = g.y * g.y;
vec4 result = texture2D(colorTexture, st) * g.x;
for (int i = 1; i < SAMPLES; ++i)
{
g.xy *= g.yz;
vec2 offset = float(i) * dir * step;
result += texture2D(colorTexture, st - offset) * g.x;
result += texture2D(colorTexture, st + offset) * g.x;
}
gl_FragColor = result;
}
`;var qj=`uniform sampler2D colorTexture;
uniform sampler2D dirtTexture;
uniform sampler2D starTexture;
uniform vec2 dirtTextureDimensions;
uniform float distortion;
uniform float ghostDispersal;
uniform float haloWidth;
uniform float dirtAmount;
uniform float earthRadius;
uniform float intensity;
varying vec2 v_textureCoordinates;
#define DISTANCE_TO_SPACE 6500000.0
vec4 getNDCFromWC(vec3 WC, float earthRadius)
{
vec4 positionEC = czm_view * vec4(WC, 1.0);
positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
}
float isInEarth(vec2 texcoord, vec2 sceneSize)
{
vec2 NDC = texcoord * 2.0 - 1.0;
vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);
vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);
NDC.xy -= earthPosSC.xy;
float X = abs(NDC.x) * sceneSize.x;
float Y = abs(NDC.y) * sceneSize.y;
return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));
}
vec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)
{
vec2 sceneSize = czm_viewport.zw;
vec3 color;
if(isSpace)
{
color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;
color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;
color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;
}
else
{
color.r = texture2D(tex, texcoord + direction * distortion.r).r;
color.g = texture2D(tex, texcoord + direction * distortion.g).g;
color.b = texture2D(tex, texcoord + direction * distortion.b).b;
}
return vec4(clamp(color, 0.0, 1.0), 0.0);
}
void main(void)
{
vec4 originalColor = texture2D(colorTexture, v_textureCoordinates);
vec3 rgb = originalColor.rgb;
bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;
vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);
vec4 sunPositionEC = czm_view * sunPos;
vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);
sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);
if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))
{
gl_FragColor = originalColor;
return;
}
vec2 texcoord = vec2(1.0) - v_textureCoordinates;
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
vec2 invPixelSize = 1.0 / pixelSize;
vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);
vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;
vec3 direction = normalize(vec3(ghostVec, 0.0));
vec4 result = vec4(0.0);
vec4 ghost = vec4(0.0);
for (int i = 0; i < 4; ++i)
{
vec2 offset = fract(texcoord + ghostVec * float(i));
ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);
}
result += ghost;
vec2 haloVec = normalize(ghostVec) * haloWidth;
float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));
weightForHalo = pow(1.0 - weightForHalo, 5.0);
result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;
vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;
if (dirtTexCoords.x > 1.0)
{
dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);
}
if (dirtTexCoords.y > 1.0)
{
dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);
}
result += dirtAmount * texture2D(dirtTexture, dirtTexCoords);
float camrot = czm_view[0].z + czm_view[1].y;
float cosValue = cos(camrot);
float sinValue = sin(camrot);
mat3 rotation = mat3(
cosValue, -sinValue, 0.0,
sinValue, cosValue, 0.0,
0.0, 0.0, 1.0
);
vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);
vec3 st2 = vec3((rotation * st1).xy, 1.0);
vec3 st3 = st2 * 0.5 + vec3(0.5);
vec2 lensStarTexcoord = st3.xy;
float weightForLensFlare = length(vec3(sunPos.xy, 0.0));
float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);
if (!isSpace)
{
result *= oneMinusWeightForLensFlare * intensity * 0.2;
}
else
{
result *= oneMinusWeightForLensFlare * intensity;
result *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;
}
result += texture2D(colorTexture, v_textureCoordinates);
gl_FragColor = result;
}
`;var Yj=`uniform sampler2D colorTexture;
uniform vec3 white;
varying vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif
void main()
{
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture2D(autoExposure, vec2(0.5)).r;
color /= exposure;
#endif
color = (color * (1.0 + color / white)) / (1.0 + color);
color = czm_inverseGamma(color);
gl_FragColor = vec4(color, fragmentColor.a);
}
`;var Xj=`uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
float rand(vec2 co)
{
return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);
}
void main(void)
{
float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
vec3 green = vec3(0.0, 1.0, 0.0);
gl_FragColor = vec4((noiseValue + rgb) * green, 1.0);
}
`;var Kj=`uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif
void main()
{
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture2D(autoExposure, vec2(0.5)).r;
color /= exposure;
#endif
color = color / (1.0 + color);
color = czm_inverseGamma(color);
gl_FragColor = vec4(color, fragmentColor.a);
}
`;var $j=`uniform sampler2D colorTexture;
uniform sampler2D silhouetteTexture;
varying vec2 v_textureCoordinates;
void main(void)
{
vec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);
vec4 color = texture2D(colorTexture, v_textureCoordinates);
gl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);
}
`;/**
* @license
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/var Zj=`#if (FXAA_QUALITY_PRESET == 10)
#define FXAA_QUALITY_PS 3
#define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY_P1 3.0
#define FXAA_QUALITY_P2 12.0
#endif
#if (FXAA_QUALITY_PRESET == 11)
#define FXAA_QUALITY_PS 4
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 3.0
#define FXAA_QUALITY_P3 12.0
#endif
#if (FXAA_QUALITY_PRESET == 12)
#define FXAA_QUALITY_PS 5
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 4.0
#define FXAA_QUALITY_P4 12.0
#endif
#if (FXAA_QUALITY_PRESET == 13)
#define FXAA_QUALITY_PS 6
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 4.0
#define FXAA_QUALITY_P5 12.0
#endif
#if (FXAA_QUALITY_PRESET == 14)
#define FXAA_QUALITY_PS 7
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 4.0
#define FXAA_QUALITY_P6 12.0
#endif
#if (FXAA_QUALITY_PRESET == 15)
#define FXAA_QUALITY_PS 8
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY_P7 12.0
#endif
#if (FXAA_QUALITY_PRESET == 20)
#define FXAA_QUALITY_PS 3
#define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY_P1 2.0
#define FXAA_QUALITY_P2 8.0
#endif
#if (FXAA_QUALITY_PRESET == 21)
#define FXAA_QUALITY_PS 4
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 8.0
#endif
#if (FXAA_QUALITY_PRESET == 22)
#define FXAA_QUALITY_PS 5
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 8.0
#endif
#if (FXAA_QUALITY_PRESET == 23)
#define FXAA_QUALITY_PS 6
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 8.0
#endif
#if (FXAA_QUALITY_PRESET == 24)
#define FXAA_QUALITY_PS 7
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 3.0
#define FXAA_QUALITY_P6 8.0
#endif
#if (FXAA_QUALITY_PRESET == 25)
#define FXAA_QUALITY_PS 8
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY_P7 8.0
#endif
#if (FXAA_QUALITY_PRESET == 26)
#define FXAA_QUALITY_PS 9
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 4.0
#define FXAA_QUALITY_P8 8.0
#endif
#if (FXAA_QUALITY_PRESET == 27)
#define FXAA_QUALITY_PS 10
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 4.0
#define FXAA_QUALITY_P9 8.0
#endif
#if (FXAA_QUALITY_PRESET == 28)
#define FXAA_QUALITY_PS 11
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY_P9 4.0
#define FXAA_QUALITY_P10 8.0
#endif
#if (FXAA_QUALITY_PRESET == 29)
#define FXAA_QUALITY_PS 12
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY_P11 8.0
#endif
#if (FXAA_QUALITY_PRESET == 39)
#define FXAA_QUALITY_PS 12
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.0
#define FXAA_QUALITY_P2 1.0
#define FXAA_QUALITY_P3 1.0
#define FXAA_QUALITY_P4 1.0
#define FXAA_QUALITY_P5 1.5
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY_P11 8.0
#endif
#define FxaaBool bool
#define FxaaFloat float
#define FxaaFloat2 vec2
#define FxaaFloat3 vec3
#define FxaaFloat4 vec4
#define FxaaHalf float
#define FxaaHalf2 vec2
#define FxaaHalf3 vec3
#define FxaaHalf4 vec4
#define FxaaInt2 vec2
#define FxaaTex sampler2D
#define FxaaSat(x) clamp(x, 0.0, 1.0)
#define FxaaTexTop(t, p) texture2D(t, p)
#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
FxaaFloat4 FxaaPixelShader(
FxaaFloat2 pos,
FxaaTex tex,
FxaaFloat2 fxaaQualityRcpFrame,
FxaaFloat fxaaQualitySubpix,
FxaaFloat fxaaQualityEdgeThreshold,
FxaaFloat fxaaQualityEdgeThresholdMin
) {
FxaaFloat2 posM;
posM.x = pos.x;
posM.y = pos.y;
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
#define lumaM rgbyM.y
FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
FxaaFloat maxSM = max(lumaS, lumaM);
FxaaFloat minSM = min(lumaS, lumaM);
FxaaFloat maxESM = max(lumaE, maxSM);
FxaaFloat minESM = min(lumaE, minSM);
FxaaFloat maxWN = max(lumaN, lumaW);
FxaaFloat minWN = min(lumaN, lumaW);
FxaaFloat rangeMax = max(maxWN, maxESM);
FxaaFloat rangeMin = min(minWN, minESM);
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
FxaaFloat range = rangeMax - rangeMin;
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
FxaaBool earlyExit = range < rangeMaxClamped;
if(earlyExit)
return rgbyM;
FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaNS = lumaN + lumaS;
FxaaFloat lumaWE = lumaW + lumaE;
FxaaFloat subpixRcpRange = 1.0/range;
FxaaFloat subpixNSWE = lumaNS + lumaWE;
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
FxaaFloat lumaNESE = lumaNE + lumaSE;
FxaaFloat lumaNWNE = lumaNW + lumaNE;
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
FxaaFloat lumaNWSW = lumaNW + lumaSW;
FxaaFloat lumaSWSE = lumaSW + lumaSE;
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
FxaaBool horzSpan = edgeHorz >= edgeVert;
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
if(!horzSpan) lumaN = lumaW;
if(!horzSpan) lumaS = lumaE;
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
FxaaFloat gradientN = lumaN - lumaM;
FxaaFloat gradientS = lumaS - lumaM;
FxaaFloat lumaNN = lumaN + lumaM;
FxaaFloat lumaSS = lumaS + lumaM;
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
if(pairN) lengthSign = -lengthSign;
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
FxaaFloat2 posB;
posB.x = posM.x;
posB.y = posM.y;
FxaaFloat2 offNP;
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
if(!horzSpan) posB.x += lengthSign * 0.5;
if( horzSpan) posB.y += lengthSign * 0.5;
FxaaFloat2 posN;
posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
FxaaFloat2 posP;
posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
FxaaFloat subpixE = subpixC * subpixC;
FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
if(!pairN) lumaNN = lumaSS;
FxaaFloat gradientScaled = gradient * 1.0/4.0;
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
FxaaFloat subpixF = subpixD * subpixE;
FxaaBool lumaMLTZero = lumaMM < 0.0;
lumaEndN -= lumaNN * 0.5;
lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
FxaaBool doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
#if (FXAA_QUALITY_PS > 3)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
#if (FXAA_QUALITY_PS > 4)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
#if (FXAA_QUALITY_PS > 5)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
#if (FXAA_QUALITY_PS > 6)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
#if (FXAA_QUALITY_PS > 7)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
#if (FXAA_QUALITY_PS > 8)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
#if (FXAA_QUALITY_PS > 9)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
#if (FXAA_QUALITY_PS > 10)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
#if (FXAA_QUALITY_PS > 11)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
#if (FXAA_QUALITY_PS > 12)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
FxaaFloat dstN = posM.x - posN.x;
FxaaFloat dstP = posP.x - posM.x;
if(!horzSpan) dstN = posM.y - posN.y;
if(!horzSpan) dstP = posP.y - posM.y;
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
FxaaFloat spanLength = (dstP + dstN);
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
FxaaFloat spanLengthRcp = 1.0/spanLength;
FxaaBool directionN = dstN < dstP;
FxaaFloat dst = min(dstN, dstP);
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
FxaaFloat subpixG = subpixF * subpixF;
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
}
`;function Jx(e){e=y(e,y.EMPTY_OBJECT),this._stages=e.stages,this._inputPreviousStageTexture=y(e.inputPreviousStageTexture,!0);let t=e.name;l(t)||(t=hi()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}Object.defineProperties(Jx.prototype,{ready:{get:function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)if(!e[n].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){let t=this._stages,n=t.length;for(let i=0;i<n;++i)t[i].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});Jx.prototype._isSupported=function(e){let t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0};Jx.prototype.get=function(e){return this._stages[e]};function aht(e){let t=l(e._selected)?e._selected.length:0,n=l(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,l(e._selected)&&l(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):l(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&l(e._combinedSelected)){if(!l(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}Jx.prototype.update=function(e,t){this._selectedDirty=aht(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=l(this._selected)?this._selected.length:0,this._parentSelectedLength=l(this._parentSelected)?this._parentSelected.length:0;let n=this._stages,i=n.length;for(let o=0;o<i;++o){let r=n[o];this._selectedDirty&&(r.parentSelected=this._combinedSelected),r.update(e,t)}};Jx.prototype.isDestroyed=function(){return!1};Jx.prototype.destroy=function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return fe(this)};var Cu=Jx;var ts={};function rL(e){let o=`#define USE_STEP_SIZE
${Ub}`,r=new ir({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:$d.LINEAR}),s=new ir({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:$d.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(c){let u=r.uniforms,f=s.uniforms;u.delta=f.delta=c}},sigma:{get:function(){return r.uniforms.sigma},set:function(c){let u=r.uniforms,f=s.uniforms;u.sigma=f.sigma=c}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(c){let u=r.uniforms,f=s.uniforms;u.stepSize=f.stepSize=c}}}),new Cu({name:e,stages:[r,s],uniforms:a})}ts.createBlurStage=function(){return rL("czm_blur")};ts.createDepthOfFieldStage=function(){let e=rL("czm_depth_of_field_blur"),t=new ir({name:"czm_depth_of_field_composite",fragmentShader:zj,uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(i){t.uniforms.focalDistance=i}},delta:{get:function(){return e.uniforms.delta},set:function(i){e.uniforms.delta=i}},sigma:{get:function(){return e.uniforms.sigma},set:function(i){e.uniforms.sigma=i}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(i){e.uniforms.stepSize=i}}}),new Cu({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};ts.isDepthOfFieldSupported=function(e){return e.context.depthTexture};ts.createEdgeDetectionStage=function(){let e=hi();return new ir({name:`czm_edge_detection_${e}`,fragmentShader:Gj,uniforms:{length:.25,color:H.clone(H.BLACK)}})};ts.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function cht(e){if(!l(e))return ts.createEdgeDetectionStage();let t=new Cu({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={},i="",o="";for(let a=0;a<e.length;++a)i+=`uniform sampler2D edgeTexture${a};
`,o+=` vec4 edge${a} = texture2D(edgeTexture${a}, v_textureCoordinates);
if (edge${a}.a > 0.0)
{
color = edge${a};
break;
}
`,n[`edgeTexture${a}`]=e[a].name;let r=`${i}varying vec2 v_textureCoordinates;
void main() {
vec4 color = vec4(0.0);
for (int i = 0; i < ${e.length}; i++)
{
${o} }
gl_FragColor = color;
}
`,s=new ir({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new Cu({name:"czm_edge_detection_composite",stages:[t,s]})}ts.createSilhouetteStage=function(e){let t=cht(e),n=new ir({name:"czm_silhouette_color_edges",fragmentShader:$j,uniforms:{silhouetteTexture:t.name}});return new Cu({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};ts.isSilhouetteSupported=function(e){return e.context.depthTexture};ts.createBloomStage=function(){let e=new ir({name:"czm_bloom_contrast_bias",fragmentShader:Uj,uniforms:{contrast:128,brightness:-.3}}),t=rL("czm_bloom_blur"),n=new Cu({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new ir({name:"czm_bloom_generate_composite",fragmentShader:Vj,uniforms:{glowOnly:!1,bloomTexture:n.name}}),o={};return Object.defineProperties(o,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(r){i.uniforms.glowOnly=r}},contrast:{get:function(){return e.uniforms.contrast},set:function(r){e.uniforms.contrast=r}},brightness:{get:function(){return e.uniforms.brightness},set:function(r){e.uniforms.brightness=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}}}),new Cu({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};ts.createAmbientOcclusionStage=function(){let e=new ir({name:"czm_ambient_occlusion_generate",fragmentShader:Lj,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=rL("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;let n=new Cu({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new ir({name:"czm_ambient_occlusion_composite",fragmentShader:Nj,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),o={};return Object.defineProperties(o,{intensity:{get:function(){return e.uniforms.intensity},set:function(r){e.uniforms.intensity=r}},bias:{get:function(){return e.uniforms.bias},set:function(r){e.uniforms.bias=r}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(r){e.uniforms.lengthCap=r}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(r){e.uniforms.stepSize=r}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(r){e.uniforms.frustumLength=r}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(r){e.uniforms.randomTexture=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(r){i.uniforms.ambientOcclusionOnly=r}}}),new Cu({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};ts.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var lht=`#define FXAA_QUALITY_PRESET 39
${Zj}
${jj}`;ts.createFXAAStage=function(){return new ir({name:"czm_FXAA",fragmentShader:lht,sampleMode:$d.LINEAR})};ts.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=Bj,new ir({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};ts.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=Wj,new ir({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};ts.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=Kj,new ir({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};ts.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=Yj,new ir({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:H.WHITE,autoExposure:void 0}})};ts.createAutoExposureStage=function(){return new vW};ts.createBlackAndWhiteStage=function(){return new ir({name:"czm_black_and_white",fragmentShader:Fj,uniforms:{gradations:5}})};ts.createBrightnessStage=function(){return new ir({name:"czm_brightness",fragmentShader:kj,uniforms:{brightness:.5}})};ts.createNightVisionStage=function(){return new ir({name:"czm_night_vision",fragmentShader:Xj})};ts.createDepthViewStage=function(){return new ir({name:"czm_depth_view",fragmentShader:Hj})};ts.createLensFlareStage=function(){return new ir({name:"czm_lens_flare",fragmentShader:qj,uniforms:{dirtTexture:Pn("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:Pn("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:se.WGS84.maximumRadius}})};var gm=ts;function s_(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function eP(e){for(;l(e.length);)e=e.get(e.length-1);return e.name}function Jj(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;let r=n[i.name]={};if(l(o)){let a=e.getStageByName(o);r[eP(a)]=!0}let s=i.uniforms;if(l(s)){let a=Object.getOwnPropertyNames(s),c=a.length;for(let u=0;u<c;++u){let f=s[a[u]];if(typeof f=="string"){let d=e.getStageByName(f);l(d)&&(r[eP(d)]=!0)}}}return i.name}function QD(e,t,n,i,o){if(l(i.enabled)&&!i.enabled||l(i._isSupported)&&!i._isSupported(t))return o;let r=o,s=!l(i.inputPreviousStageTexture)||i.inputPreviousStageTexture,a=o,c=i.length;for(let d=0;d<c;++d){let p=i.get(d);l(p.length)?a=QD(e,t,n,p,o):a=Jj(e,t,n,p,o),s&&(o=a)}let u,f;if(s)for(u=1;u<c;++u)f=eP(i.get(u)),l(n[f])||(n[f]={}),n[f][r]=!0;else for(u=1;u<c;++u){f=eP(i.get(u));let d=n[f];for(let p=0;p<u;++p)d[eP(i.get(p))]=!0}return a}function uht(e,t){let n={};if(l(e.ambientOcclusion)){let i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa,a=QD(e,t,n,i,void 0);a=QD(e,t,n,o,a),a=Jj(e,t,n,r,a),a=QD(e,t,n,e,a),Jj(e,t,n,s,a)}else QD(e,t,n,e,void 0);return n}function fht(e,t,n){let o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,c=o._pixelDatatype,u=o._clearColor,f,d,p=e._framebuffers,_=p.length;for(f=0;f<_;++f){if(d=p[f],r!==d.textureScale||s!==d.forcePowerOfTwo||a!==d.pixelFormat||c!==d.pixelDatatype||!H.equals(u,d.clearColor))continue;let m=d.stages,x=m.length,C=!1;for(let A=0;A<x;++A)if(n[m[A]]){C=!0;break}if(!C)break}return l(d)&&f<_?(d.stages.push(t),d):(d={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:c,clearColor:u,stages:[t],buffer:new qi({pixelFormat:a,pixelDatatype:c}),clear:void 0},p.push(d),d)}function dht(e,t){let n=uht(e._collection,t);for(let i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=fht(e,i,n[i]))}function Qj(e){let t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function hht(e,t){let n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){let a=o[s],c=a.textureScale,u=Math.ceil(n*c),f=Math.ceil(i*c),d=Math.min(u,f);a.forcePowerOfTwo&&(I.isPowerOfTwo(d)||(d=I.nextPowerOfTwo(d)),u=d,f=d),a.buffer.update(t,u,f),a.clear=new Fi({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}s_.prototype.updateDependencies=function(){this._updateDependencies=!0};s_.prototype.update=function(e){let t=this._collection,n=this._updateDependencies,i=l(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=l(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=l(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=l(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!l(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(Qj(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&dht(this,e);let c=e.drawingBufferWidth,u=e.drawingBufferHeight,f=this._width!==
uniform sampler2D colorTexture2;
uniform vec2 center;
uniform float radius;
varying vec2 v_textureCoordinates;
void main()
{
vec4 color0 = texture2D(colorTexture, v_textureCoordinates);
vec4 color1 = texture2D(colorTexture2, v_textureCoordinates);
float x = length(gl_FragCoord.xy - center) / radius;
float t = smoothstep(0.5, 0.8, x);
gl_FragColor = mix(color0 + color1, color1, t);
}
`;var bq=`uniform sampler2D colorTexture;
uniform float avgLuminance;
uniform float threshold;
uniform float offset;
varying vec2 v_textureCoordinates;
float key(float avg)
{
float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));
return max(0.0, guess) + 0.1;
}
void main()
{
vec4 color = texture2D(colorTexture, v_textureCoordinates);
vec3 xyz = czm_RGBToXYZ(color.rgb);
float luminance = xyz.r;
float scaledLum = key(avgLuminance) * luminance / avgLuminance;
float brightLum = max(scaledLum - threshold, 0.0);
float brightness = brightLum / (offset + brightLum);
xyz.r = brightness;
gl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);
}
`;function a_(){this._sceneFramebuffer=new KD;let e=.125,t=new Array(6);t[0]=new ir({fragmentShader:Pf,textureScale:e,forcePowerOfTwo:!0,sampleMode:$d.LINEAR});let n=t[1]=new ir({fragmentShader:bq,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new W,t[2]=new ir({fragmentShader:Ub,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new ir({fragmentShader:Ub,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new ir({fragmentShader:Pf,sampleMode:$d.LINEAR}),this._uCenter=new W,this._uRadius=void 0,t[5]=new ir({fragmentShader:Tq,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new Cu({stages:t});let o=new tP(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}a_.prototype.get=function(e){return this._stages.get(e)};a_.prototype.getStageByName=function(e){let t=this._stages.length;for(let n=0;n<t;++n){let i=this._stages.get(n);if(i.name===e)return i}};var kpt=new ae,B0e=new W,Upt=new W,L0e=new O;function zpt(e,t,n){let i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection,c=O.computeViewportTransformation(n,0,1,L0e),u=O.multiplyByPoint(r,o,kpt),f=Ut.pointToGLWindowCoordinates(s,c,o,B0e);u.x+=I.SOLAR_RADIUS;let d=Ut.pointToGLWindowCoordinates(a,c,u,u),p=W.magnitude(W.subtract(d,f,d))*30*2,_=Upt;_.x=p,_.y=p,e._uCenter=W.clone(f,e._uCenter),e._uRadius=Math.max(_.x,_.y)*.15;let m=t.drawingBufferWidth,x=t.drawingBufferHeight,C=e._stages,A=C.get(0),T=A.outputTexture.width,E=A.outputTexture.height,S=new it;S.width=T,S.height=E,c=O.computeViewportTransformation(S,0,1,L0e),f=Ut.pointToGLWindowCoordinates(s,c,o,B0e),_.x*=T/m,_.y*=E/x;let w=A.scissorRectangle;w.x=Math.max(f.x-_.x*.5,0),w.y=Math.max(f.y-_.y*.5,0),w.width=Math.min(_.x,m),w.height=Math.min(_.y,x);for(let D=1;D<4;++D)it.clone(w,C.get(D).scissorRectangle)}a_.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};a_.prototype.update=function(e){let t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);let o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),zpt(this,t,n),o};a_.prototype.execute=function(e){let t=this._sceneFramebuffer.framebuffer.getColorTexture(0),n=this._stages,i=n.length;n.get(0).execute(e,t);for(let o=1;o<i;++o)n.get(o).execute(e,n.get(o-1).outputTexture)};a_.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(Pf,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};a_.prototype.isDestroyed=function(){return!1};a_.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),fe(this)};var Eq=a_;var _L=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function yo(e){e=y(e,y.EMPTY_OBJECT);let t=e.canvas,n=e.creditContainer,i=e.creditViewport,o=mt(e.contextOptions);l(o)||(o={}),l(o.webgl)||(o.webgl={}),o.webgl.powerPreference=y(o.webgl.powerPreference,"high-performance");let r=l(n),s=new TW(t,o);r||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0 0 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",t.parentNode.appendChild(n)),l(i)||(i=t.parentNode),this._id=hi(),this._jobScheduler=new dj,this._frameState=new I7(s,new p7(n," \u2022 ",i),this._jobScheduler),this._frameState.scene3DOnly=y(e.scene3DOnly,
{
float startDistance = nearFarScalar.x;
float startValue = nearFarScalar.y;
float endDistance = nearFarScalar.z;
float endValue = nearFarScalar.w;
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
return mix(startValue, endValue, t);
}
vec3 getLightDirection(vec3 positionWC)
{
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirection =
positionWC * float(lightEnum == 0.0) +
czm_lightDirectionWC * float(lightEnum == 1.0) +
czm_sunDirectionWC * float(lightEnum == 2.0);
return normalize(lightDirection);
}
void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe)
{
float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;
float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0;
float distanceAdjustMax = czm_ellipsoidRadii.x;
float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0;
float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0);
float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;
float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
underTranslucentGlobe = 0.0;
#if defined(GLOBE_TRANSLUCENT)
czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);
if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {
vec3 direction = normalize(positionWC);
czm_ray ellipsoidRay = czm_ray(positionWC, -direction);
czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii);
vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start);
float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));
opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth));
vec3 horizonColor = vec3(0.1, 0.2, 0.3);
vec3 nearColor = vec3(0.0);
rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity);
underTranslucentGlobe = 1.0;
return;
}
#endif
computeScattering(
primaryRay,
length(cameraToPositionWC),
lightDirection,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);
float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;
opacity *= pow(nightAlpha, 0.5);
}
`;var Oq=`varying vec3 v_outerPositionWC;
uniform vec3 u_hsbShift;
#ifndef PER_FRAGMENT_ATMOSPHERE
varying vec3 v_mieColor;
varying vec3 v_rayleighColor;
varying float v_opacity;
varying float v_translucent;
#endif
void main (void)
{
vec3 lightDirection = getLightDirection(v_outerPositionWC);
vec3 mieColor;
vec3 rayleighColor;
float opacity;
float translucent;
#ifdef PER_FRAGMENT_ATMOSPHERE
computeAtmosphereScattering(
v_outerPositionWC,
lightDirection,
rayleighColor,
mieColor,
opacity,
translucent
);
#else
mieColor = v_mieColor;
rayleighColor = v_rayleighColor;
opacity = v_opacity;
translucent = v_translucent;
#endif
vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity);
#ifndef HDR
color.rgb = czm_acesTonemapping(color.rgb);
color.rgb = czm_inverseGamma(color.rgb);
#endif
#ifdef COLOR_CORRECT
vec3 hsb = czm_RGBToHSB(color.rgb);
hsb.x += u_hsbShift.x;
hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;
color.rgb = czm_HSBToRGB(hsb);
#endif
if (translucent == 0.0) {
color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);
}
gl_FragColor = color;
}
`;var Rq=`attribute vec4 position;
varying vec3 v_outerPositionWC;
#ifndef PER_FRAGMENT_ATMOSPHERE
varying vec3 v_mieColor;
varying vec3 v_rayleighColor;
varying float v_opacity;
varying float v_translucent;
#endif
void main(void)
{
vec4 positionWC = czm_model * position;
vec3 lightDirection = getLightDirection(positionWC.xyz);
#ifndef PER_FRAGMENT_ATMOSPHERE
computeAtmosphereScattering(
positionWC.xyz,
lightDirection,
v_rayleighColor,
v_mieColor,
v_opacity,
v_translucent
);
#endif
v_outerPositionWC = positionWC.xyz;
gl_Position = czm_modelViewProjection * position;
}
`;function Hb(e){e=y(e,se.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;let t=1.025,n=h.multiplyByScalar(e.radii,t,new h);this._scaleMatrix=O.fromScale(n),this._modelMatrix=new O,this._command=new pt({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new h(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new h(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new h;let i=new h;i.x=e.maximumRadius*t,i.y=e.maximumRadius,i.z=0,this._radiiAndDynamicAtmosphereColor=i;let o=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return o._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return o._hueSaturationBrightness.x=o.hueShift,o._hueSaturationBrightness.y=o.saturationShift,o._hueSaturationBrightness.z=o.brightnessShift,o._hueSaturationBrightness},u_atmosphereLightIntensity:function(){return o.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return o.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return o.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return o.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return o.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return o.atmosphereMieAnisotropy}}}Object.defineProperties(Hb.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});Hb.prototype.setDynamicAtmosphereColor=function(e,t){let n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};var Mq=new O;Hb.prototype.update=function(e,t){if(!this.show)return;let n=e.mode;if(n!==te.SCENE3D&&n!==te.MORPHING||!e.passes.render)return;let i=O.fromRotationTranslation(e.context.uniformState.inverseViewRotation,h.ZERO,Mq),o=O.multiplyTransformation(i,fi.Y_UP_TO_Z_UP,Mq),r=O.multiply(this._scaleMatrix,o,Mq);O.clone(r,this._modelMatrix);let s=e.context,a=D_t(this),c=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||c||!l(t)||!t.show,f=this._command;if(!l(f.vertexArray)){let p=Sa.createGeometry(new Sa({radii:new h(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ve.POSITION_ONLY}));f.vertexArray=Ii.fromGeometry({context:s,geometry:p,attributeLocations:di.createAttributeLocations(p),bufferUsage:We.STATIC_DRAW}),f.renderState=Ze.fromCache({cull:{enabled:!0,face:So.FRONT},blending:Hn.ALPHA_BLEND,depthMask:!1})}let d=a|u<<2|c<<3;if(d!==this._flags){this._flags=d;let p=[];a&&p.push("COLOR_CORRECT"),u&&p.push("PER_FRAGMENT_ATMOSPHERE"),c&&p.push("GLOBE_TRANSLUCENT");let _=new je({defines:p,sources:[zx,gL,Rq]}),m=new je({defines:p,sources:[zx,gL,Oq]});this._spSkyAtmosphere=gn.fromCache({context:s,vertexShaderSource:_,fragmentShaderSource:m}),f.shaderProgram=this._spSkyAtmosphere}return f};function D_t(e){return!(I.equalsEpsilon(e.hueShift,0,I.EPSILON7)&&I.equalsEpsilon(e.saturationShift,0,I.EPSILON7)&&I.equalsEpsilon(e.brightnessShift,0,I.EPSILON7))}Hb.prototype.isDestroyed=function(){return!1};Hb.prototype.destroy=function(){let e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),fe(this)};var Bq=Hb;var Lq=`uniform samplerCube u_cubeMap;
varying vec3 v_texCoord;
void main()
{
vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
}
`;var Nq=`attribute vec3 position;
varying vec3 v_texCoord;
void main()
{
vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
gl_Position = czm_projection * vec4(p, 1.0);
v_texCoord = position.xyz;
}
`;function yL(e){this.sources=e.sources,this._sources=void 0,this.show=y(e.show,!0),this._command=new pt({modelMatrix:O.clone(O.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}yL.prototype.update=function(e,t){let n=this;if(!this.show||e.mode!==te.SCENE3D&&e.mode!==te.MORPHING||!e.passes.render)return;let i=e.context;if(this._sources!==this.sources){this._sources=this.sources;let r=this.sources;typeof r.positiveX=="string"?bW(i,this._sources).then(function(s){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=s}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new ml({context:i,source:r}))}let o=this._command;if(!l(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};let r=Pu.createGeometry(Pu.fromDimensions({dimensions:new h(2,2,2),vertexFormat:Ve.POSITION_ONLY})),s=this._attributeLocations=di.createAttributeLocations(r);o.vertexArray=Ii.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:We.STATIC_DRAW}),o.renderState=Ze.fromCache({blending:Hn.ALPHA_BLEND})}if(!l(o.shaderProgram)||this._useHdr!==t){let r=new je({defines:[t?"HDR":""],sources:[Lq]});o.shaderProgram=gn.fromCache({context:i,vertexShaderSource:Nq,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(!!l(this._cubeMap))return o};yL.prototype.isDestroyed=function(){return!1};yL.prototype.destroy=function(){let e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),fe(this)};var Fq=yL;function Vq(e){e=y(e,1),this._radius=y(e,1)}Object.defineProperties(Vq.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}});Vq.prototype.emit=function(e){let t=I.randomBetween(0,I.TWO_PI),n=I.randomBetween(0,I.PI),i=I.randomBetween(0,this._radius),o=i*Math.cos(t)*Math.sin(n),r=i*Math.sin(t)*Math.sin(n),s=i*Math.cos(n);e.position=h.fromElements(o,r,s,e.position),e.velocity=h.normalize(e.position,e.velocity)};var P_t=Vq;function cP(){}cP.prototype.evaluate=function(e,t){Ae.throwInstantiationError()};cP.prototype.evaluateColor=function(e,t){Ae.throwInstantiationError()};cP.prototype.getShaderFunction=function(e,t,n,i){Ae.throwInstantiationError()};cP.prototype.getVariables=function(){Ae.throwInstantiationError()};var I_t=cP;var kq=`uniform sampler2D u_texture;
varying vec2 v_textureCoordinates;
void main()
{
vec4 color = texture2D(u_texture, v_textureCoordinates);
gl_FragColor = czm_gammaCorrect(color);
}
`;var Uq=`uniform float u_radiusTS;
varying vec2 v_textureCoordinates;
vec2 rotate(vec2 p, vec2 direction)
{
return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);
}
vec4 addBurst(vec2 position, vec2 direction, float lengthScalar)
{
vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);
float radius = length(rotatedPosition) * lengthScalar;
float burst = 1.0 - smoothstep(0.0, 0.55, radius);
return vec4(burst);
}
void main()
{
float lengthScalar = 2.0 / sqrt(2.0);
vec2 position = v_textureCoordinates - vec2(0.5);
float radius = length(position) * lengthScalar;
float surface = step(radius, u_radiusTS);
vec4 color = vec4(vec2(1.0), surface + 0.2, surface);
float glow = 1.0 - smoothstep(0.0, 0.55, radius);
color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;
vec4 burst = vec4(0.0);
burst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar);
burst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar);
burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar);
burst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar);
burst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar);
burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar);
color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;
gl_FragColor = clamp(color, vec4(0.0), vec4(1.0));
}
`;var zq=`attribute vec2 direction;
uniform float u_size;
varying vec2 v_textureCoordinates;
void main()
{
vec4 position;
if (czm_morphTime == 1.0)
{
position = vec4(czm_sunPositionWC, 1.0);
}
else
{
position = vec4(czm_sunPositionColumbusView.zxy, 1.0);
}
vec4 positionEC = czm_view * position;
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
vec2 halfSize = vec2(u_size * 0.5);
halfSize *= ((direction * 2.0) - 1.0);
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);
v_textureCoordinates = direction;
}
`;function uP(){this.show=!0,this._drawCommand=new pt({primitiveType:He.TRIANGLES,boundingVolume:new re,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new re,this._boundingVolume2D=new re,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1,this._useHdr=void 0;let e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}Object.defineProperties(uP.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});var O_t=new W,R_t=new W,M_t=new ae,lP=new ae;uP.prototype.update=function(e,t,n){if(!this.show)return;let i=e.mode;if(i===te.SCENE2D||i===te.MORPHING||!e.passes.render)return;let o=e.context,r=t.viewport.width,s=t.viewport.height;if(!l(this._texture)||r!==this._drawingBufferWidth||s!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=r,this._drawingBufferHeight=s,this._glowFactorDirty=!1,this._useHdr=n;let S=Math.max(r,s);S=Math.pow(2,Math.ceil(Math.log(S)/Math.log(2))-2),S=Math.max(1,S);let w=n?o.halfFloatingPointTexture?lt.HALF_FLOAT:lt.FLOAT:lt.UNSIGNED_BYTE;this._texture=new Zt({context:o,width:S,height:S,pixelFormat:It.RGBA,pixelDatatype:w}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;let D=this,R={u_radiusTS:function(){return D._radiusTS}};this._commands.computeCommand=new Oh({fragmentShaderSource:Uq,outputTexture:this._texture,uniformMap:R,persists:!1,owner:this,postExecute:function(){D._commands.computeCommand=void 0}})}let a=this._drawCommand;if(!l(a.vertexArray)){let S={direction:0},w=new Uint8Array(4*2);w[0]=0,w[1]=0,w[2]=255,w[3]=0,w[4]=255,w[5]=255,w[6]=0,w[7]=255;let D=Pt.createVertexBuffer({context:o,typedArray:w,usage:We.STATIC_DRAW}),R=[{index:S.direction,vertexBuffer:D,componentsPerAttribute:2,normalize:!0,componentDatatype:X.UNSIGNED_BYTE}],M=Pt.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:We.STATIC_DRAW,indexDatatype:Ge.UNSIGNED_SHORT});a.vertexArray=new Ii({context:o,attributes:R,indexBuffer:M}),a.shaderProgram=gn.fromCache({context:o,vertexShaderSource:zq,fragmentShaderSource:kq,attributeLocations:S}),a.renderState=Ze.fromCache({blending:Hn.ALPHA_BLEND}),a.uniformMap=this._uniformMap}let c=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,f=this._boundingVolume,d=this._boundingVolume2D;h.clone(c,f.center),d.center.x=u.z,d.center.y=u.x,d.center.z=u.y,f.radius=I.SOLAR_RADIUS+I.SOLAR_RADIUS*this._glowLengthTS,d.radius=f.radius,i===te.SCENE3D?re.clone(f,a.boundingVolume):i===te.COLUMBUS_VIEW&&re.clone(d,a.boundingVolume);let p=Oo.computeActualWgs84Position(e,c,lP),_=h.magnitude(h.subtract(p,e.camera.position,lP)),m=o.uniformState.projection,x=M_t;x.x=0,x.y=0,x.z=-_,x.w=1;let C=O.multiplyByVector(m,x,lP),A=Oo.clipToGLWindowCoordinates(t.viewport,C,O_t);x.x=I.SOLAR_RADIUS;let T=O.multiplyByVector(m,x,lP),E=Oo.clipToGLWindowCoordinates(t.viewport,T,R_t);return this._size=W.magnitude(W.subtract(E,A,lP)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};uP.prototype.isDestroyed=function(){return!1};uP.prototype.destroy=function(){let e=this._drawCommand;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),fe(this)};var Hq=uP;function Gb(){}Gb.prototype.boundingVolume=void 0;Gb.prototype.boundingSphere=void 0;Gb.prototype.distanceToCamera=function(e){Ae.throwInstantiationError()};Gb.prototype.intersectPlane=function(e){Ae.throwInstantiationError()};Gb.prototype.createDebugVolume=function(e){Ae.throwInstantiationError()};var B_t=Gb;function fP(e){e=y(e,y.EMPTY_OBJECT),this._tilingScheme=l(e.tilingScheme)?e.tilingScheme:new vo({ellipsoid:e.ellipsoid}),this._color=y(e.co
${e}`}function k_t(e){return function(t){return Dt(t,{czm_pickColor:function(){return e._pickId.color}})}}function U_t(){return"czm_pickColor"}oC.prototype.makeStyleDirty=function(){this._styleDirty=!0};oC.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};var z_t=new ee;function qq(e){let t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function iC(e,t){return e._intervals.indexOf(t.start)}function H_t(e,t){let n=e._intervals,i=e._clock,o=qq(e);if(o===0)return;let r=e._getAverageLoadTime(),s=ee.addSeconds(i.currentTime,r*o,z_t),a=n.indexOf(s),c=iC(e,t);return a===c&&(o>=0?++a:--a),n.get(a)}function G_t(e){let t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function W_t(e,t,n){let i=qq(e),o=iC(e,t),r=iC(e,n);return i>=0?o>=r:o<=r}function j_t(e,t){return function(n){let i=l(n.message)?n.message:n.toString();e.frameFailed.numberOfListeners>0?e.frameFailed.raiseEvent({uri:t,message:i}):(console.log(`A frame failed to load: ${t}`),console.log(`Error: ${i}`))}}function q_t(e,t,n){let i=iC(e,t),o=e._frames,r=o[i];if(!l(r)){let s=t.data.transform,a=l(s)?O.fromArray(s):void 0,c=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:fo(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},o[i]=r,Fe.fetchArrayBuffer({url:c}).then(function(u){return r.pointCloud=new Gw({arrayBuffer:u,cull:!0,fragmentShaderLoaded:V_t,uniformMapLoaded:k_t(e),pickIdLoaded:U_t}),r.pointCloud.readyPromise}).catch(j_t(e,c))}return r}function Y_t(e,t){e._runningSum+=t,e._runningSum-=e._runningSamples[e._runningIndex],e._runningSamples[e._runningIndex]=t,e._runningLength=Math.min(e._runningLength+1,e._runningSamples.length),e._runningIndex=(e._runningIndex+1)%e._runningSamples.length,e._runningAverage=e._runningSum/e._runningLength}function X_t(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);let o=t.pointCloud;if(l(o)&&!t.ready){let r=i.commandList,s=r.length;if(W0e(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){let a=(fo()-t.timestamp)/1e3;Y_t(e,a)}}t.touchedFrameNumber=i.frameNumber}var K_t=new O;function $_t(e,t){let n=e.shading;return l(n)&&l(n.baseResolution)?n.baseResolution:l(t.boundingSphere)?I.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function Z_t(e){let t=e.shading;return l(t)&&l(t.maximumAttenuation)?t.maximumAttenuation:10}var J_t=new Fh;function W0e(e,t,n,i){let o=y(e.shading,J_t),r=t.pointCloud,s=y(t.transform,O.IDENTITY);r.modelMatrix=O.multiplyTransformation(e.modelMatrix,s,K_t),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=$_t(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=Z_t(e),r.update(i),t.touchedFrameNumber=i.frameNumber}function jq(e,t,n,i){let o=q_t(e,t,i);X_t(e,o,n,i)}function Q_t(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function j0e(e,t){let n=e._frames,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(l(r)&&(!l(t)||t(r))){let s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),l(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function egt(e,t){let n=iC(e,t),i=e._frames[n];if(l(i)&&i.ready)return i}function G0e(e,t,n,i,o){return l(n)?n.ready?!0:(jq(e,t,i,o),n.ready):!1}function tgt(e,t,n,i,o){let r,s,a,c=e._intervals,u=e._frames,f=iC(e,n),d=iC(e,t);if(f>=d){for(r=f;r>=d;--r)if(s=c.get(r),a=u[r],G0e(e,s,a,i,o))return s}else for(r=f;r<=d;++r)if(s=c.get(r),a=u[r],G0e(e,s,a,i,o))return s;return t}function ngt(e,t,n){let i=e._frames,o=i.length;for(let r=0;r<o;++r){let s=i[r];l(s)&&l(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}var Wb={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};oC.prototype.update=function(e){if(e.mode===te.MORPHING||!this.show)return;l(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),l(this._load
void main()
{
czm_materialInput materialInput;
materialInput.s = v_textureCoordinates.s;
materialInput.st = v_textureCoordinates;
materialInput.str = vec3(v_textureCoordinates, 0.0);
materialInput.normalEC = vec3(0.0, 0.0, -1.0);
czm_material material = czm_getMaterial(materialInput);
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
}
`;function CL(e,t){this.show=!0,l(e)||(e=new it),this.rectangle=it.clone(e),l(t)||(t=Bo.fromType(Bo.ColorType,{color:new H(1,1,1,1)})),this.material=t,this._material=void 0,this._overlayCommand=void 0,this._rs=void 0}CL.prototype.update=function(e){if(!this.show)return;let t=this._rs;if((!l(t)||!it.equals(t.viewport,this.rectangle))&&(this._rs=Ze.fromCache({blending:Hn.ALPHA_BLEND,viewport:this.rectangle})),e.passes.render){let i=e.context;if(this._material!==this.material||!l(this._overlayCommand)){this._material=this.material,l(this._overlayCommand)&&this._overlayCommand.shaderProgram.destroy();let o=new je({sources:[this._material.shaderSource,Yq]});this._overlayCommand=i.createViewportQuadCommand(o,{renderState:this._rs,uniformMap:this._material._uniforms,owner:this}),this._overlayCommand.pass=Se.OVERLAY}this._material.update(i),this._overlayCommand.renderState=this._rs,this._overlayCommand.uniformMap=this._material._uniforms,e.commandList.push(this._overlayCommand)}};CL.prototype.isDestroyed=function(){return!1};CL.prototype.destroy=function(){return l(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),fe(this)};var igt=CL;var dP;typeof ko<"u"&&(dP=ko);(function(){/*!
* Knockout JavaScript library v3.5.1
* (c) The Knockout.js team - http://knockoutjs.com/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/(function(){(function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,o=t.jQuery,r=t.JSON;o||typeof jQuery>"u"||(o=jQuery),function(s){s(t.ko={})}(function(s,a){function c(g,b){return g===null||typeof g in x?g===b:!1}function u(g,b){var v;return function(){v||(v=m.a.setTimeout(function(){v=e,g()},b))}}function f(g,b){var v;return function(){clearTimeout(v),v=m.a.setTimeout(g,b)}}function d(g,b){b&&b!=="change"?b==="beforeChange"?this.pc(g):this.gb(g,b):this.qc(g)}function p(g,b){b!==null&&b.s&&b.s()}function _(g,b){var v=this.qd,P=v[S];P.ra||(this.Qb&&this.mb[b]?(v.uc(b,g,this.mb[b]),this.mb[b]=null,--this.Qb):P.I[b]||v.uc(b,g,P.J?{da:g}:v.$c(g)),g.Ja&&g.gd())}var m=typeof s<"u"?s:{};m.b=function(g,b){for(var v=g.split("."),P=m,B=0;B<v.length-1;B++)P=P[v[B]];P[v[v.length-1]]=b},m.L=function(g,b,v){g[b]=v},m.version="3.5.1",m.b("version",m.version),m.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},m.a=function(){function g(G,K){for(var J in G)B.call(G,J)&&K(J,G[J])}function b(G,K){if(K)for(var J in K)B.call(K,J)&&(G[J]=K[J]);return G}function v(G,K){return G.__proto__=K,G}function P(G,K,J,ce){var de=G[K].match(j)||[];m.a.D(J.match(j),function(oe){m.a.Na(de,oe,ce)}),G[K]=de.join(" ")}var B=Object.prototype.hasOwnProperty,F={__proto__:[]}instanceof Array,k=typeof Symbol=="function",U={},z={};U[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],U.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),g(U,function(G,K){if(K.length)for(var J=0,ce=K.length;J<ce;J++)z[K[J]]=G});var V={propertychange:!0},Y=n&&function(){for(var G=3,K=n.createElement("div"),J=K.getElementsByTagName("i");K.innerHTML="<!--[if gt IE "+ ++G+"]><i></i><![endif]-->",J[0];);return 4<G?G:e}(),j=/\S+/g,$;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(G,K,J){for(var ce=0,de=G.length;ce<de;ce++)K.call(J,G[ce],ce,G)},A:typeof Array.prototype.indexOf=="function"?function(G,K){return Array.prototype.indexOf.call(G,K)}:function(G,K){for(var J=0,ce=G.length;J<ce;J++)if(G[J]===K)return J;return-1},Lb:function(G,K,J){for(var ce=0,de=G.length;ce<de;ce++)if(K.call(J,G[ce],ce,G))return G[ce];return e},Pa:function(G,K){var J=m.a.A(G,K);0<J?G.splice(J,1):J===0&&G.shift()},wc:function(G){var K=[];return G&&m.a.D(G,function(J){0>m.a.A(K,J)&&K.push(J)}),K},Mb:function(G,K,J){var ce=[];if(G)for(var de=0,oe=G.length;de<oe;de++)ce.push(K.call(J,G[de],de));return ce},jb:function(G,K,J){var ce=[];if(G)for(var de=0,oe=G.length;de<oe;de++)K.call(J,G[de],de)&&ce.push(G[de]);return ce},Nb:function(G,K){if(K instanceof Array)G.push.apply(G,K);else for(var J=0,ce=K.length;J<ce;J++)G.push(K[J]);return G},Na:function(G,K,J){var ce=m.a.A(m.a.bc(G),K);0>ce?J&&G.push(K):J||G.splice(ce,1)},Ba:F,extend:b,setPrototypeOf:v,Ab:F?v:b,P:g,Ga:function(G,K,J){if(!G)return G;var ce={},de;for(de in G)B.call(G,de)&&(ce[de]=K.call(J,G[de],de,G));return ce},Tb:function(G){for(;G.firstChild;)m.removeNode(G.firstChild)},Yb:function(G){G=m.a.la(G);for(var K=(G[0]&&G[0].ownerDocument||n).createElement("div"),J=0,ce=G.length;J<ce;J++)K.appendChild(m.oa(G[J]));return K},Ca:function(G,K){for(var J=0,ce=G.length,de=[];J<ce;J++){var oe=G[J].cloneNode(!0);de.push(K?m.oa(oe):oe)}return de},va:function(G,K){if(m.a.Tb(G),K)for(var J=0,ce=K.length;J<ce;J++)G.appendChild(K[J])},Xc:function(G,K){var J=G.nodeType?[G]:G;if(0<J.length){for(var ce=J[0],de=ce.parentNode,oe=0,le=K.length;oe<le;oe++)de.insertBefore(K[oe],ce);for(oe=0,le=J.length;oe<le;oe++)m.removeNode(J[oe])}},Ua:function(G,K){if(G.length){for(K=K.nodeType===8&&K.parentNode||K;G.length&&G[0].parentNode!==K;)G.splice(0,1);for(;1<G.length&&G[G.length-1].parentNode!==K;)G.length--;if(1<G.length){var J=G[0],ce=G[G.length-1];for(G.length=0;J!==ce;)G.push(J),J=J.nextSibling;G.push(ce)}}return G},Zc:function(G,K){7>Y?G.setAttribute("selected",K):G.selected=K},Db:function(G){return G===null||G===e?"":G.trim?G.trim():G.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(G,K){return G=G||"
,`;var z=[],V=U.match(P),Y,j=[],$=0;if(1<V.length){for(var G=0,K;K=V[G];++G){var J=K.charCodeAt(0);if(J===44){if(0>=$){z.push(Y&&j.length?{key:Y,value:j.join("")}:{unknown:Y||j.join("")}),Y=$=0,j=[];continue}}else if(J===58){if(!$&&!Y&&j.length===1){Y=j.pop();continue}}else{if(J===47&&1<K.length&&(K.charCodeAt(1)===47||K.charCodeAt(1)===42))continue;J===47&&G&&1<K.length?(J=V[G-1].match(B))&&!F[J[0]]&&(U=U.substr(U.indexOf(K)+1),V=U.match(P),G=-1,K="/"):J===40||J===123||J===91?++$:J===41||J===125||J===93?--$:Y||j.length||J!==34&&J!==39||(K=K.slice(1,-1))}j.push(K)}if(0<$)throw Error("Unbalanced parentheses, braces, or brackets")}return z}var b=["true","false","null","undefined"],v=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,P=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),B=/[\])"'A-Za-z0-9_$]+$/,F={in:1,return:1,typeof:1},k={};return{Ra:[],wa:k,ac:g,vb:function(U,z){function V(J,ce){var de;if(!G){var oe=m.getBindingHandler(J);if(oe&&oe.preprocess&&!(ce=oe.preprocess(ce,J,V)))return;(oe=k[J])&&(de=ce,0<=m.a.A(b,de)?de=!1:(oe=de.match(v),de=oe===null?!1:oe[1]?"Object("+oe[1]+")"+oe[2]:de),oe=de),oe&&j.push("'"+(typeof k[J]=="string"?k[J]:J)+"':function(_z){"+de+"=_z}")}$&&(ce="function(){return "+ce+" }"),Y.push("'"+J+"':"+ce)}z=z||{};var Y=[],j=[],$=z.valueAccessors,G=z.bindingParams,K=typeof U=="string"?g(U):U;return m.a.D(K,function(J){V(J.key||J.unknown,J.value)}),j.length&&V("_ko_property_writers","{"+j.join(",")+" }"),Y.join(",")},Id:function(U,z){for(var V=0;V<U.length;V++)if(U[V].key==z)return!0;return!1},eb:function(U,z,V,Y,j){U&&m.O(U)?!m.Za(U)||j&&U.v()===Y||U(Y):(U=z.get("_ko_property_writers"))&&U[V]&&U[V](Y)}}}(),m.b("expressionRewriting",m.m),m.b("expressionRewriting.bindingRewriteValidators",m.m.Ra),m.b("expressionRewriting.parseObjectLiteral",m.m.ac),m.b("expressionRewriting.preProcessBindings",m.m.vb),m.b("expressionRewriting._twoWayBindings",m.m.wa),m.b("jsonExpressionRewriting",m.m),m.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",m.m.vb),function(){function g(V){return V.nodeType==8&&F.test(B?V.text:V.nodeValue)}function b(V){return V.nodeType==8&&k.test(B?V.text:V.nodeValue)}function v(V,Y){for(var j=V,$=1,G=[];j=j.nextSibling;){if(b(j)&&(m.a.g.set(j,z,!0),$--,$===0))return G;G.push(j),g(j)&&$++}if(!Y)throw Error("Cannot find closing comment tag to match: "+V.nodeValue);return null}function P(V,Y){var j=v(V,Y);return j?0<j.length?j[j.length-1].nextSibling:V.nextSibling:null}var B=n&&n.createComment("test").text==="<!--test-->",F=B?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=B?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,U={ul:!0,ol:!0},z="__ko_matchedEndComment__";m.h={ea:{},childNodes:function(V){return g(V)?v(V):V.childNodes},Ea:function(V){if(g(V)){V=m.h.childNodes(V);for(var Y=0,j=V.length;Y<j;Y++)m.removeNode(V[Y])}else m.a.Tb(V)},va:function(V,Y){if(g(V)){m.h.Ea(V);for(var j=V.nextSibling,$=0,G=Y.length;$<G;$++)j.parentNode.insertBefore(Y[$],j)}else m.a.va(V,Y)},Vc:function(V,Y){var j;g(V)?(j=V.nextSibling,V=V.parentNode):j=V.firstChild,j?Y!==j&&V.insertBefore(Y,j):V.appendChild(Y)},Wb:function(V,Y,j){j?(j=j.nextSibling,g(V)&&(V=V.parentNode),j?Y!==j&&V.insertBefore(Y,j):V.appendChild(Y)):m.h.Vc(V,Y)},firstChild:function(V){if(g(V))return!V.nextSibling||b(V.nextSibling)?null:V.nextSibling;if(V.firstChild&&b(V.firstChild))throw Error("Found invalid end comment, as the first child of "+V);return V.firstChild},nextSibling:function(V){if(g(V)&&(V=P(V)),V.nextSibling&&b(V.nextSibling)){var Y=V.nextSibling;if(b(Y)&&!m.a.g.get(Y,z))throw Error("Found end comment without a matching opening comment, as child of "+V);return null}return V.nextSibling},Cd:g,Vd:function(V){return(V=(B?V.text:V.nodeValue).match(F))?V[1]:null},Sc:function(V){if(U[m.a.R(V)]){var Y=V.firstChild;if(Y)do if(Y.nodeType===1){var j;j=Y.firstChild;var $=null;if(j)do if($)$.push(j);else if(g(j)){var G=P(j,!0);G?j=G:$=[j]}else b(j)&&($=[j]);while(j=j.nextSibling);if(j=$)for($=Y.nextSibling,G=0;G<j.length;G++)$?V.insertBefore(j[G],$):V.appendChild(j[G])}while(Y=Y.nextSibling)}}}}(),m.b("virtualElements",m.h),m.b("virtualElements.allowedBindings",m.h.ea),m.b("virtualElements.emptyNode",m.h.Ea),m.b("virtualElements.insertAfter",m.h.Wb),m.b("virtualElements.prepend",m.h.Vc),m.b("virtualElements.setDomNodeChildren",m.h.va),function(){m.ga=function(){this.nd={}},m.a.extend(m.ga.prototype,{nodeHasBindings:function(g){switch(g.nodeType){case 1:return g.getAttribute("data-bind")!=null||m.j.getComponentNameForNode(g);case 8:return m.h.Cd(g);default:return!1}},getBindings:function(g,b){var v=this.getBindingsString(g,b),v=v?this.parseBindingsString(v,b,g):null;return m.j.tc(v,g,b,!1)},getBindingAccessors:function(g,b){var v=this.getBindingsString(g,b),v=v?this.parseBindingsString(v,b,g,{val
Bindings value: `+g+`
Message: `+V.message,V}}}),m.ga.instance=new m.ga}(),m.b("bindingProvider",m.ga),function(){function g(oe){var le=(oe=m.a.g.get(oe,de))&&oe.N;le&&(oe.N=null,le.Tc())}function b(oe,le,ge){this.node=oe,this.yc=le,this.kb=[],this.H=!1,le.N||m.a.K.za(oe,g),ge&&ge.N&&(ge.N.kb.push(oe),this.Kb=ge)}function v(oe){return function(){return oe}}function P(oe){return oe()}function B(oe){return m.a.Ga(m.u.G(oe),function(le,ge){return function(){return oe()[ge]}})}function F(oe,le,ge){return typeof oe=="function"?B(oe.bind(null,le,ge)):m.a.Ga(oe,v)}function k(oe,le){return B(this.getBindings.bind(this,oe,le))}function U(oe,le){var ge=m.h.firstChild(le);if(ge){var De,Re=m.ga.instance,Pe=Re.preprocessNode;if(Pe){for(;De=ge;)ge=m.h.nextSibling(De),Pe.call(Re,De);ge=m.h.firstChild(le)}for(;De=ge;)ge=m.h.nextSibling(De),z(oe,De)}m.i.ma(le,m.i.H)}function z(oe,le){var ge=oe,De=le.nodeType===1;De&&m.h.Sc(le),(De||m.ga.instance.nodeHasBindings(le))&&(ge=Y(le,null,oe).bindingContextForDescendants),ge&&!J[m.a.R(le)]&&U(ge,le)}function V(oe){var le=[],ge={},De=[];return m.a.P(oe,function Re(Pe){if(!ge[Pe]){var Qe=m.getBindingHandler(Pe);Qe&&(Qe.after&&(De.push(Pe),m.a.D(Qe.after,function(Yt){if(oe[Yt]){if(m.a.A(De,Yt)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+De.join(", "));Re(Yt)}}),De.length--),le.push({key:Pe,Mc:Qe})),ge[Pe]=!0}}),le}function Y(oe,le,ge){var De=m.a.g.Ub(oe,de,{}),Re=De.hd;if(!le){if(Re)throw Error("You cannot apply bindings multiple times to the same element.");De.hd=!0}Re||(De.context=ge),De.Zb||(De.Zb={});var Pe;if(le&&typeof le!="function")Pe=le;else{var Qe=m.ga.instance,Yt=Qe.getBindingAccessors||k,en=m.$(function(){return(Pe=le?le(ge,oe):Yt.call(Qe,oe,ge))&&(ge[$]&&ge[$](),ge[K]&&ge[K]()),Pe},null,{l:oe});Pe&&en.ja()||(en=null)}var jt=ge,Et;if(Pe){var Mt=function(){return m.a.Ga(en?en():Pe,P)},yi=en?function(yt){return function(){return P(en()[yt])}}:function(yt){return Pe[yt]};Mt.get=function(yt){return Pe[yt]&&P(yi(yt))},Mt.has=function(yt){return yt in Pe},m.i.H in Pe&&m.i.subscribe(oe,m.i.H,function(){var yt=(0,Pe[m.i.H])();if(yt){var Ke=m.h.childNodes(oe);Ke.length&&yt(Ke,m.Ec(Ke[0]))}}),m.i.pa in Pe&&(jt=m.i.Cb(oe,ge),m.i.subscribe(oe,m.i.pa,function(){var yt=(0,Pe[m.i.pa])();yt&&m.h.firstChild(oe)&&yt(oe)})),De=V(Pe),m.a.D(De,function(yt){var Ke=yt.Mc.init,xt=yt.Mc.update,pe=yt.key;if(oe.nodeType===8&&!m.h.ea[pe])throw Error("The binding '"+pe+"' cannot be used with virtual elements");try{typeof Ke=="function"&&m.u.G(function(){var Be=Ke(oe,yi(pe),Mt,jt.$data,jt);if(Be&&Be.controlsDescendantBindings){if(Et!==e)throw Error("Multiple bindings ("+Et+" and "+pe+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");Et=pe}}),typeof xt=="function"&&m.$(function(){xt(oe,yi(pe),Mt,jt.$data,jt)},null,{l:oe})}catch(Be){throw Be.message='Unable to process binding "'+pe+": "+Pe[pe]+`"
Message: `+Be.message,Be}})}return De=Et===e,{shouldBindDescendants:De,bindingContextForDescendants:De&&jt}}function j(oe,le){return oe&&oe instanceof m.fa?oe:new m.fa(oe,e,e,le)}var $=m.a.Da("_subscribable"),G=m.a.Da("_ancestorBindingInfo"),K=m.a.Da("_dataDependency");m.c={};var J={script:!0,textarea:!0,template:!0};m.getBindingHandler=function(oe){return m.c[oe]};var ce={};m.fa=function(oe,le,ge,De,Re){function Pe(){var yi=jt?en():en,yt=m.a.f(yi);return le?(m.a.extend(Qe,le),G in le&&(Qe[G]=le[G])):(Qe.$parents=[],Qe.$root=yt,Qe.ko=m),Qe[$]=Et,Yt?yt=Qe.$data:(Qe.$rawData=yi,Qe.$data=yt),ge&&(Qe[ge]=yt),De&&De(Qe,le,yt),le&&le[$]&&!m.S.o().Vb(le[$])&&le[$](),Mt&&(Qe[K]=Mt),Qe.$data}var Qe=this,Yt=oe===ce,en=Yt?e:oe,jt=typeof en=="function"&&!m.O(en),Et,Mt=Re&&Re.dataDependency;Re&&Re.exportDependencies?Pe():(Et=m.xb(Pe),Et.v(),Et.ja()?Et.equalityComparer=null:Qe[$]=e)},m.fa.prototype.createChildContext=function(oe,le,ge,De){if(!De&&le&&typeof le=="object"&&(De=le,le=De.as,ge=De.extend),le&&De&&De.noChildContext){var Re=typeof oe=="function"&&!m.O(oe);return new m.fa(ce,this,null,function(Pe){ge&&ge(Pe),Pe[le]=Re?oe():oe},De)}return new m.fa(oe,this,le,function(Pe,Qe){Pe.$parentContext=Qe,Pe.$parent=Qe.$data,Pe.$parents=(Qe.$parents||[]).slice(0),Pe.$parents.unshift(Pe.$parent),ge&&ge(Pe)},De)},m.fa.prototype.extend=function(oe,le){return new m.fa(ce,this,null,function(ge){m.a.extend(ge,typeof oe=="function"?oe(ge):oe)},le)};var de=m.a.g.Z();b.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},b.prototype.sd=function(oe){m.a.Pa(this.kb,oe),!this.kb.length&&this.H&&this.Cc()},b.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,m.a.K.yb(this.node,g),m.i.ma(this.node,m.i.pa),this.Tc())},m.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(oe,le,ge,De,Re){var Pe=m.a.g.Ub(oe,de,{});return Pe.Fa||(Pe.Fa=new m.T),Re&&Re.notifyImmediately&&Pe.Zb[le]&&m.u.G(ge,De,[oe]),Pe.Fa.subscribe(ge,De,le)},ma:function(oe,le){var ge=m.a.g.get(oe,de);if(ge&&(ge.Zb[le]=!0,ge.Fa&&ge.Fa.notifySubscribers(oe,le),le==m.i.H)){if(ge.N)ge.N.Cc();else if(ge.N===e&&ge.Fa&&ge.Fa.Wa(m.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(oe,le){var ge=m.a.g.Ub(oe,de,{});return ge.N||(ge.N=new b(oe,ge,le[G])),le[G]==ge?le:le.extend(function(De){De[G]=ge})}},m.Td=function(oe){return(oe=m.a.g.get(oe,de))&&oe.context},m.ib=function(oe,le,ge){return oe.nodeType===1&&m.h.Sc(oe),Y(oe,le,j(ge))},m.ld=function(oe,le,ge){return ge=j(ge),m.ib(oe,F(le,ge,oe),ge)},m.Oa=function(oe,le){le.nodeType!==1&&le.nodeType!==8||U(j(oe),le)},m.vc=function(oe,le,ge){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(le=n.body,!le)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!le||le.nodeType!==1&&le.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");z(j(oe,ge),le)},m.Dc=function(oe){return!oe||oe.nodeType!==1&&oe.nodeType!==8?e:m.Td(oe)},m.Ec=function(oe){return(oe=m.Dc(oe))?oe.$data:e},m.b("bindingHandlers",m.c),m.b("bindingEvent",m.i),m.b("bindingEvent.subscribe",m.i.subscribe),m.b("bindingEvent.startPossiblyAsyncContentBinding",m.i.Cb),m.b("applyBindings",m.vc),m.b("applyBindingsToDescendants",m.Oa),m.b("applyBindingAccessorsToNode",m.ib),m.b("applyBindingsToNode",m.ld),m.b("contextFor",m.Dc),m.b("dataFor",m.Ec)}(),function(g){function b(k,U){var z=Object.prototype.hasOwnProperty.call(B,k)?B[k]:g,V;z?z.subscribe(U):(z=B[k]=new m.T,z.subscribe(U),v(k,function(Y,j){var $=!(!j||!j.synchronous);F[k]={definition:Y,Gd:$},delete B[k],V||$?z.notifySubscribers(Y):m.na.zb(function(){z.notifySubscribers(Y)})}),V=!0)}function v(k,U){P("getConfig",[k],function(z){z?P("loadComponent",[k,z],function(V){U(V,z)}):U(null,null)})}function P(k,U,z,V){V||(V=m.j.loaders.slice(0));var Y=V.shift();if(Y){var j=Y[k];if(j){var $=!1;if(j.apply(Y,U.concat(function(G){$?z(null):G!==null?z(G):P(k,U,z,V)}))!==g&&($=!0,!Y.suppressLoaderExceptions))throw Error("Componen
* @license
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
* Copyright (c) Steve Sanderson
* MIT license
*/var Xq="__knockoutObservables",Kq="__knockoutSubscribable";function q0e(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=Y0e(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===Xq||o===Kq)&&!(o in i)){var r=e[o],s=r instanceof Array,a=n.isObservable(r)?r:s?n.observableArray(r):n.observable(r);Object.defineProperty(e,o,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[o]=a,s&&sgt(n,a)}}),e}function Y0e(e,t){var n=e[Xq];return!n&&t&&(n={},Object.defineProperty(e,Xq,{value:n})),n}function rgt(e,t,n){var i=this,o={owner:e,deferEvaluation:!0};if(typeof n=="function")o.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if(typeof n.get!="function")throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');o.read=n.get,o.write=n.set}return e[t]=i.computed(o),q0e.call(i,e,[t]),e}function sgt(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=agt(e,t,i))})}function agt(e,t,n){var i=cgt(e,n);return i.subscribe(t)}function cgt(e,t){var n=t[Kq];if(!n){n=new e.subscribable,Object.defineProperty(t,Kq,{value:n});var i={};lgt(t,n,i),ugt(e,t,n,i)}return n}function lgt(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(i){var o=e[i];e[i]=function(){var r=o.apply(this,arguments);return n.pause!==!0&&t.notifySubscribers(this),r}})}function ugt(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(o){Object.defineProperty(t,o,{enumerable:!1,value:function(){var r;i.pause=!0;try{r=e.observableArray.fn[o].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),r}})})}function X0e(e,t){if(!e)return null;var n=Y0e(e,!1);return n&&n[t]||null}function fgt(e,t){var n=X0e(e,t);n&&n.valueHasMutated()}function dgt(e){e.track=q0e,e.getObservable=X0e,e.valueHasMutated=fgt,e.defineProperty=rgt}var $q={attachToKo:dgt};var K0e="http://www.w3.org/2000/svg",$0e="cesium-svgPath-svg",hgt={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){let i=document.createElementNS(K0e,"svg:svg");i.setAttribute("class",$0e);let o=document.createElementNS(K0e,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){let r=e.unwrap(n());o.setAttribute("d",e.unwrap(r.path));let s=e.unwrap(r.width),a=e.unwrap(r.height);i.setAttribute("width",s),i.setAttribute("height",a),i.setAttribute("viewBox",`0 0 ${s} ${a}`),r.css&&i.setAttribute("class",`${$0e} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},Zq=hgt;$q.attachToKo(hP);Zq.register(hP);var be=hP;var GWi=new Uint8Array([0]),Xc=[171,75,84,88,32,50,48,187,13,10,26,10],Jq,Qq,eY,AL,Z0e,tY,J0e,Q0e;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Jq||(Jq={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Qq||(Qq={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(eY||(eY={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(AL||(AL={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Z0e||(Z0e={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(tY||(tY={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(J0e||(J0e={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Q0e||(Q0e={}));var nY=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Jq.NONE,this.levels=[],this.
varying vec2 v_textureCoordinates;
void main()
{
float z_window = czm_unpackDepth(texture2D(u_depthTexture, v_textureCoordinates));
z_window = czm_reverseLogDepth(z_window);
float n_range = czm_depthRange.near;
float f_range = czm_depthRange.far;
float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);
float scale = pow(z_ndc * 0.5 + 0.5, 8.0);
gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);
}
`;var uC="http://www.w3.org/2000/svg",Exe="http://www.w3.org/1999/xlink",ML,CP=H.fromCssColorString("rgba(247,250,255,0.384)"),BL=H.fromCssColorString("rgba(143,191,255,0.216)"),yY=H.fromCssColorString("rgba(153,197,255,0.098)"),LL=H.fromCssColorString("rgba(255,255,255,0.086)"),m0t=H.fromCssColorString("rgba(255,255,255,0.267)"),p0t=H.fromCssColorString("rgba(255,255,255,0)"),Txe=H.fromCssColorString("rgba(66,67,68,0.3)"),bxe=H.fromCssColorString("rgba(0,0,0,0.5)");function h0(e){return H.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}var AP={animation_pathReset:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"},animation_pathPause:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"},animation_pathPlay:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathPlayReverse:{tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathLoop:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"},animation_pathClock:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",d:"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"},animation_pathWingButton:{tagName:"path",d:"m
${m}`:l(_)?_:m}),this.buttonImageUrl=void 0,be.defineProperty(this,"buttonImageUrl",function(){let d=this.selectedImagery;if(l(d))return d.iconUrl}),this.selectedImagery=void 0;let c=be.observable();this._currentImageryProviders=[],be.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(d){if(c()===d){this.dropDownVisible=!1;return}let p,_=this._currentImageryProviders,m=_.length,x=this._globe.imageryLayers,C=!1;for(p=0;p<m;p++){let A=x.length;for(let T=0;T<A;T++){let E=x.get(T);if(E.imageryProvider===_[p]){x.remove(E),C=!0;break}}}if(l(d)){let A=d.creationCommand();if(Array.isArray(A)){let T=A.length;for(p=T-1;p>=0;p--)x.addImageryProvider(A[p],0);this._currentImageryProviders=A.slice(0)}else if(this._currentImageryProviders=[A],C)x.addImageryProvider(A,0);else{let T=x.get(0);l(T)&&x.remove(T),x.addImageryProvider(A,0)}}c(d),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;let u=be.observable();be.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(d){if(u()===d){this.dropDownVisible=!1;return}let p;l(d)&&(p=d.creationCommand()),this._globe.depthTestAgainstTerrain=!(p instanceof Y0),this._globe.terrainProvider=p,u(d),this.dropDownVisible=!1}});let f=this;this._toggleDropDown=Qn(function(){f.dropDownVisible=!f.dropDownVisible}),this.selectedImagery=y(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=y(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(wxe.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});var EY=wxe;function FL(e,t){e=ci(e);let n=new EY(t),i=document.createElement("button");i.type="button",i.className="cesium-button cesium-toolbar-button",i.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(i);let o=document.createElement("img");o.setAttribute("draggable","false"),o.className="cesium-baseLayerPicker-selected",o.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(o);let r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);let s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);let a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);let c=document.createElement("div");c.className="cesium-baseLayerPicker-category",a.appendChild(c);let u=document.createElement("div");u.className="cesium-baseLayerPicker-categoryTitle",u.setAttribute("data-bind","text: name"),c.appendChild(u);let f=document.createElement("div");f.className="cesium-baseLayerPicker-choices",f.setAttribute("data-bind","foreach: providers"),c.appendChild(f);let d=document.createElement("div");d.className="cesium-baseLayerPicker-item",d.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),f.appendChild(d);let p=document.createElement("img");p.className="cesium-baseLayerPicker-itemIcon",p.setAttribute("data-bind","attr: { src: iconUrl }"),p.setAttribute("draggable","false"),d.appendChild(p);let _=document.createElement("div");_.className="cesium-baseLayerPicker-itemLabel",_.setAttribute("data-bind","text: name"),d.appendChild(_);let m=document.createElement("div");m.className="cesium-baseLayerPicker-sectionTitle",m.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),m.innerHTML="Terrain",r.appendChild(m);let x=document.createElement("div");x.className="cesium-baseLayerPicker-section",x.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(x);let C=document.createElement("div");C.className="cesium-baseLayerPicker-c
http://www.esri.com`,category:"Other",creationFunction:function(){return new Rx({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new ya({name:"ESRI World Street Map",iconUrl:Pn("Widgets/Images/ImageryProviders/esriWorldStreetMap.png"),tooltip:`This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.
http://www.esri.com`,category:"Other",creationFunction:function(){return new Rx({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new ya({name:"ESRI National Geographic",iconUrl:Pn("Widgets/Images/ImageryProviders/esriNationalGeographic.png"),tooltip:`This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.
http://www.esri.com`,category:"Other",creationFunction:function(){return new Rx({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new ya({name:"Open\xADStreet\xADMap",iconUrl:Pn("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:`OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.
http://www.openstreetmap.org`,category:"Other",creationFunction:function(){return new WD({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new ya({name:"Stamen Watercolor",iconUrl:Pn("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new WD({url:"https://stamen-tiles.a.ssl.fastly.net/watercolor/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new ya({name:"Stamen Toner",iconUrl:Pn("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`A high contrast black and white map.
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new WD({url:"https://stamen-tiles.a.ssl.fastly.net/toner/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new ya({name:"Sentinel-2",iconUrl:Pn("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",category:"Cesium ion",creationFunction:function(){return new Nx({assetId:3954})}})),e.push(new ya({name:"Blue Marble",iconUrl:Pn("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return new Nx({assetId:3845})}})),e.push(new ya({name:"Earth at night",iconUrl:Pn("Widgets/Images/ImageryProviders/earthAtNight.png"),tooltip:"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",category:"Cesium ion",creationFunction:function(){return new Nx({assetId:3812})}})),e.push(new ya({name:"Natural Earth\xA0II",iconUrl:Pn("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return new Pb({url:Pn("Assets/Textures/NaturalEarthII")})}})),e}var wY=T0t;function b0t(){let e=[];return e.push(new ya({name:"WGS84 Ellipsoid",iconUrl:Pn("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new Y0}})),e.push(new ya({name:"Cesium World Terrain",iconUrl:Pn("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",category:"Cesium ion",creationFunction:function(){return O2({requestWaterMask:!0,requestVertexNormals:!0})}})),e}var vY=b0t;function E0t(e){return function(t){let n=e._scene.pick(t.position);l(n)&&n.primitive instanceof bd&&(e.tileset=n.primitive),e.pickActive=!1}}function Pxe(e,t){t?e._eventHandler.setInputAction(function(n){let i=e._scene.pick(n.endPosition);l(i)&&i.primitive instanceof bd&&(e.tileset=i.primitive)},$n.MOUSE_MOVE):(e._eventHandler.removeInputAction($n.MOUSE_MOVE),e.picking=e.picking)}var S0t={maximumFractionDigits:3};function TP(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,S0t):Math.round(t).toLocaleString()}function bP(e,t){if(!l(e))return"";let n=t?e._statisticsPerPass[Hr.PICK]:e._statisticsPerPass[Hr.RENDER],i='<ul class="cesium-cesiumInspector-statistics">';return i+=`<li><strong>Visited: </strong>${n.visited.toLocaleString()}</li><li><strong>Selected: </strong>${n.selected.toLocaleString()}</li><li><strong>Commands: </strong>${n.numberOfCommands.toLocaleString()}</li>`,i+="</ul>",t||(i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Requests: </strong>${n.numberOfPendingRequests.toLocaleString()}</li><li><strong>Attempted: </strong>${n.numberOfAttemptedRequests.toLocaleString()}</li><li><strong>Processing: </strong>${n.numberOfTilesProcessing.toLocaleString()}</li><li><strong>Content Ready: </strong>${n.numberOfTilesWithContentReady.toLocaleString()}</li><li><strong>Total: </strong>${n.numberOfTilesTotal.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Features Selected: </strong>${n.numberOfFeaturesSelected.toLocaleString()}</li><li><strong>Features Loaded: </strong>${n.numberOfFeaturesLoaded.toLocaleString()}</li><li><strong>Points Selected: </strong>${n.numberOfPointsSelected.toLocaleString()}</li><li><strong>Points Loaded: </strong>${n.numberOfPointsLoaded.toLocaleString()}</li><li><strong>Triangles Selected: </strong>${n.numberOfTrianglesSelected.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Tiles styled: </strong>${n.numberOfTilesStyled.toLocaleString()}</li><li><strong>Features styled: </strong>${n.numberOfFeaturesStyled.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Children Union Culled: </strong>${n.numberOfTilesCulledWithChildrenUnion.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Geometry Memory (MB): </strong>${TP(n.geometryByteLength)}</li><li><strong>Texture Memory (MB): </strong>${TP(n.texturesByteLength)}</li><li><strong>Batch Table Memory (MB): </strong>${TP(n.batchTableByteLength)}</li>`,i+="</ul>"),i}function Ixe(){let e=Qo.statistics;return`
<ul class="cesium-cesiumInspector-statistics">
<li><strong>Geometry Memory (MB): </strong>${TP(e.geometryByteLength)}</li>
<li><strong>Texture Memory (MB): </strong>${TP(e.texturesByteLength)}</li>
</ul>
`}var w0t=[{text:"Highlight",value:qu.HIGHLIGHT},{text:"Replace",value:qu.REPLACE},{text:"Mix",value:qu.MIX}],Dxe=new H(1,1,0,.4),v0t=new H,VL=new H;function xa(e,t){let n=this,i=e.canvas;this._eventHandler=new Qf(i),this._scene=e,this._performanceContainer=t,this._canvas=i,this._performanceDisplay=new Yx({container:t}),this._statisticsText="",this._pickStatisticsText="",this._resourceCacheStatisticsText="",this._editorError="",this.performance=!1,this.showStatistics=!0,this.showPickStatistics=!0,this.showResourceCacheStatistics=!1,this.inspectorVisible=!0,this.tilesetVisible=!1,this.displayVisible=!1,this.updateVisible=!1,this.loggingVisible=!1,this.styleVisible=!1,this.tileDebugLabelsVisible=!1,this.optimizationVisible=!1,this.styleString="{}",this._tileset=void 0,this._feature=void 0,this._tile=void 0,be.track(this,["performance","inspectorVisible","_statisticsText","_pickStatisticsText","_resourceCacheStatisticsText","_editorError","showPickStatistics","showStatistics","showResourceCacheStatistics","tilesetVisible","displayVisible","updateVisible","loggingVisible","styleVisible","optimizationVisible","tileDebugLabelsVisible","styleString","_feature","_tile"]),this._properties=be.observable({}),this.properties=[],be.defineProperty(this,"properties",function(){let V=[],Y=n._properties();for(let j in Y)Y.hasOwnProperty(j)&&V.push(j);return V});let o=be.observable();be.defineProperty(this,"dynamicScreenSpaceError",{get:function(){return o()},set:function(V){o(V),l(n._tileset)&&(n._tileset.dynamicScreenSpaceError=V)}}),this.dynamicScreenSpaceError=!1;let r=be.observable();be.defineProperty(this,"colorBlendMode",{get:function(){return r()},set:function(V){r(V),l(n._tileset)&&(n._tileset.colorBlendMode=V,n._scene.requestRender())}}),this.colorBlendMode=qu.HIGHLIGHT;let s=be.observable(),a=be.observable();be.defineProperty(this,"picking",{get:function(){return a()},set:function(V){a(V),V?n._eventHandler.setInputAction(function(Y){let j=e.pick(Y.endPosition);if(j instanceof $r?(n.feature=j,n.tile=j.content.tile):l(j)&&l(j.content)?(n.feature=void 0,n.tile=j.content.tile):(n.feature=void 0,n.tile=void 0),!!l(n._tileset)){if(s&&l(j)&&l(j.content)){let $;e.pickPositionSupported&&($=e.pickPosition(Y.endPosition),l($)&&(n._tileset.debugPickPosition=$)),n._tileset.debugPickedTile=j.content.tile}else n._tileset.debugPickedTile=void 0;n._scene.requestRender()}},$n.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction($n.MOUSE_MOVE))}}),this.picking=!0;let c=be.observable();be.defineProperty(this,"colorize",{get:function(){return c()},set:function(V){c(V),l(n._tileset)&&(n._tileset.debugColorizeTiles=V,n._scene.requestRender())}}),this.colorize=!1;let u=be.observable();be.defineProperty(this,"wireframe",{get:function(){return u()},set:function(V){u(V),l(n._tileset)&&(n._tileset.debugWireframe=V,n._scene.requestRender())}}),this.wireframe=!1;let f=be.observable();be.defineProperty(this,"showBoundingVolumes",{get:function(){return f()},set:function(V){f(V),l(n._tileset)&&(n._tileset.debugShowBoundingVolume=V,n._scene.requestRender())}}),this.showBoundingVolumes=!1;let d=be.observable();be.defineProperty(this,"showContentBoundingVolumes",{get:function(){return d()},set:function(V){d(V),l(n._tileset)&&(n._tileset.debugShowContentBoundingVolume=V,n._scene.requestRender())}}),this.showContentBoundingVolumes=!1;let p=be.observable();be.defineProperty(this,"showRequestVolumes",{get:function(){return p()},set:function(V){p(V),l(n._tileset)&&(n._tileset.debugShowViewerRequestVolume=V,n._scene.requestRender())}}),this.showRequestVolumes=!1;let _=be.observable();be.defineProperty(this,"freezeFrame",{get:function(){return _()},set:function(V){_(V),l(n._tileset)&&(n._tileset.debugFreezeFrame=V,n._scene.debugShowFrustumPlanes=V,n._scene.requestRender())}}),this.freezeFrame=!1,be.defineProperty(this,"showOnlyPickedTileDebugLabel",{get:function(){return s()},set:function(V){s(V),l(n._tileset)&&(n._tileset.debugPickedTileLabelOnly=V,n._scene.requestRender())}}),this.showOnlyPickedTileDebugLabel=!1;let m=be.observable();be.def
`),c=a.length,u;if(t.shiftKey)for(u=0;u<c;++u)a[u][0]===" "&&(a[u][1]===" "?(a[u]=a[u].substr(2),r-=2):(a[u]=a[u].substr(1),r-=1));else for(u=0;u<c;++u)a[u]=` ${a[u]}`,r+=2;let f=a.join(`
`);n.value=n.value.slice(0,i)+f+n.value.slice(o),n.selectionStart=i!==o?i:r,n.selectionEnd=r}else t.ctrlKey&&(t.keyCode===10||t.keyCode===13)&&this.compileStyle();return!0};xa.prototype._update=function(){let e=this._tileset;if(this.performance&&this._performanceDisplay.update(),l(e)){if(e.isDestroyed()){this.tile=void 0,this.feature=void 0,this.tileset=void 0;return}let t=e.style;this._style!==e.style&&(this._shouldStyle?(e.style=this._style,this._shouldStyle=!1):(this._style=t,this.styleString=JSON.stringify(t.style,null," ")))}this.showStatistics&&(this._statisticsText=bP(e,!1),this._pickStatisticsText=bP(e,!0),this._resourceCacheStatisticsText=Ixe())};xa.prototype.isDestroyed=function(){return!1};xa.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();let e=this;return this._definedProperties.forEach(function(t){be.getObservable(e,t).dispose()}),fe(this)};xa.getStatistics=bP;var PY=xa;function kL(e,t){e=ci(e);let n=document.createElement("div"),i=document.createElement("div");i.setAttribute("data-bind","visible: performance");let o=new PY(t,i);this._viewModel=o,this._container=e,this._element=n;let r=document.createElement("div");r.textContent="3D Tiles Inspector",r.className="cesium-cesiumInspector-button",r.setAttribute("data-bind","click: toggleInspector"),n.appendChild(r),n.className="cesium-cesiumInspector cesium-3DTilesInspector",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'),e.appendChild(n);let s=document.createElement("div");this._panel=s,s.className="cesium-cesiumInspector-dropDown",n.appendChild(s);let a=cC.createSection,c=cC.createCheckbox,u=a(s,"Tileset","tilesetVisible","toggleTileset"),f=a(s,"Display","displayVisible","toggleDisplay"),d=a(s,"Update","updateVisible","toggleUpdate"),p=a(s,"Logging","loggingVisible","toggleLogging"),_=a(s,"Tile Debug Labels","tileDebugLabelsVisible","toggleTileDebugLabels"),m=a(s,"Style","styleVisible","toggleStyle"),x=a(s,"Optimization","optimizationVisible","toggleOptimization"),C=document.createElement("div");C.className="field-group";let A=document.createElement("label");A.className="field-label",A.appendChild(document.createTextNode("Properties: "));let T=document.createElement("div");T.setAttribute("data-bind","text: properties"),C.appendChild(A),C.appendChild(T),u.appendChild(C),u.appendChild(IY("togglePickTileset","Pick Tileset","pickActive")),u.appendChild(IY("trimTilesCache","Trim Tiles Cache")),u.appendChild(c("Enable Picking","picking")),f.appendChild(c("Colorize","colorize")),f.appendChild(c("Wireframe","wireframe")),f.appendChild(c("Bounding Volumes","showBoundingVolumes")),f.appendChild(c("Content Volumes","showContentBoundingVolumes")),f.appendChild(c("Request Volumes","showRequestVolumes")),f.appendChild(c("Point Cloud Shading","pointCloudShading"));let E=document.createElement("div");E.setAttribute("data-bind","visible: pointCloudShading"),E.appendChild(eh("geometricErrorScale",0,2,.01,"Geometric Error Scale")),E.appendChild(eh("maximumAttenuation",0,32,1,"Maximum Attenuation")),E.appendChild(eh("baseResolution",0,1,.01,"Base Resolution")),E.appendChild(c("Eye Dome Lighting (EDL)","eyeDomeLighting")),f.appendChild(E);let S=document.createElement("div");S.setAttribute("data-bind","visible: eyeDomeLighting"),S.appendChild(eh("eyeDomeLightingStrength",0,2,.1,"EDL Strength")),S.appendChild(eh("eyeDomeLightingRadius",0,4,.1,"EDL Radius")),E.appendChild(S),d.appendChild(c("Freeze Frame","freezeFrame")),d.appendChild(c("Dynamic Screen Space Error","dynamicScreenSpaceError"));let w=document.createElement("div");w.appendChild(eh("maximumScreenSpaceError",0,128,1,"Maximum Screen Space Error")),d.appendChild(w);let D=document.createElement("div");D.setAttribute("data-bind","visible: dynamicScreenSpaceError"),D.appendChild(eh("dynamicScreenSpaceErrorDensitySliderValue",0,1,.005,"Screen Space Error Density","dynamicScreenSpaceErrorDensity")),D.appendChild(eh("dynamicScreenSpaceErrorFactor",1,10,.1,"Screen Space Error Factor")),d.appendC
${t}
${m}`);let x=document.createElement("div");x.className="cesium-widget-errorPanel-message-details collapsed";let C=document.createElement("span");C.className="cesium-widget-errorPanel-more-details",C.appendChild(document.createTextNode("See more...")),x.appendChild(C),x.onclick=function(A){x.removeChild(C),x.appendChild(document.createTextNode(m)),x.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",x.onclick=void 0},a.appendChild(x)}_.innerHTML=`<p>${t}</p>`}let d=document.createElement("div");d.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(d);let p=document.createElement("button");p.setAttribute("type","button"),p.className="cesium-button",p.appendChild(document.createTextNode("OK")),p.onclick=function(){l(c)&&l(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(o)},d.appendChild(p),i.appendChild(o)};fC.prototype.isDestroyed=function(){return!1};fC.prototype.destroy=function(){l(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),fe(this)};fC.prototype.resize=function(){let e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,Rxe(this),Mxe(this),this._scene.requestRender())};fC.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();let e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};var LY=fC;function zL(e,t){l(t)||(t=document.body),t=ci(t);let n=this,i=be.observable(os.fullscreen),o=be.observable(os.enabled),r=t.ownerDocument;this.isFullscreen=void 0,be.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,be.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&os.enabled)}}),this.tooltip=void 0,be.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=Qn(function(){os.fullscreen?os.exitFullscreen():os.requestFullscreen(n._fullscreenElement)},be.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=y(ci(e),r.body),this._callback=function(){i(os.fullscreen)},r.addEventListener(os.changeEventName,this._callback)}Object.defineProperties(zL.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){this._fullscreenElement=e}},command:{get:function(){return this._command}}});zL.prototype.isDestroyed=function(){return!1};zL.prototype.destroy=function(){document.removeEventListener(os.changeEventName,this._callback),fe(this)};var NY=zL;var R0t="M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z",M0t="M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.
with responseMessage: ${JSON.stringify(r)}`,t(r)}})}}var Iyt=Pyt;var mQi="1.96";var export_Tween=no.default;var export_Uri=Mi.default;var export_bitmap_sdf=LO.default;var export_dompurify=qP.default;var export_earcut=G1.default;var export_grapheme_splitter=FO.default;var export_jsep=ZA.default;var export_lerc=iye.default;var export_mersenne_twister=Dm.default;var export_nosleep=bL.default;var export_pako=_xe.default;var export_rbush=bI.default;export{mg as AlphaMode,B8 as AlphaPipelineStage,AY as Animation,bY as AnimationViewModel,Mo as Appearance,ki as ApproximateTerrainHeights,tSe as ArcGISTiledElevationTerrainProvider,Rx as ArcGisMapServerImageryProvider,Sn as ArcType,rl as ArticulationStageType,zt as AssociativeArray,ui as AttributeCompression,Cn as AttributeType,vW as AutoExposure,gb as Autolinker,gy as AutomaticUniforms,fi as Axis,PC as AxisAlignedBoundingBox,I5 as B3dmLoader,Cw as B3dmParser,SY as BaseLayerPicker,EY as BaseLayerPickerViewModel,HS as BatchTable,xl as BatchTableHierarchy,Jo as BatchTexture,N8 as BatchTexturePipelineStage,jz as Batched3DModel3DTileContent,er as Billboard,hd as BillboardCollection,hl as BillboardGraphics,bV as BillboardVisualizer,sSe as BingMapsGeocoderService,PW as BingMapsImageryProvider,DW as BingMapsStyle,Bc as BlendEquation,sr as BlendFunction,lr as BlendOption,Hn as BlendingState,it as BoundingRectangle,re as BoundingSphere,Ot as BoundingSphereState,Yit as BoxEmitter,Pu as BoxGeometry,Y4 as BoxGeometryUpdater,XS as BoxGraphics,Fm as BoxOutlineGeometry,RW as BrdfLutGenerator,Pt as Buffer,Cl as BufferLoader,We as BufferUsage,Y8 as CPUStylingPipelineStage,_p as CallbackProperty,Yo as Camera,WW as CameraEventAggregator,po as CameraEventType,LW as CameraFlightPath,W as Cartesian2,h as Cartesian3,ae as Cartesian4,_e as Cartographic,MF as CartographicGeocoderService,BSe as CatmullRomSpline,Py as Cesium3DContentGroup,mR as Cesium3DTile,Zl as Cesium3DTileBatchTable,qu as Cesium3DTileColorBlendMode,zrt as Cesium3DTileContent,Sv as Cesium3DTileContentFactory,fr as Cesium3DTileContentState,Oa as Cesium3DTileContentType,$r as Cesium3DTileFeature,Ql as Cesium3DTileFeatureTable,Xh as Cesium3DTileOptimizationHint,rG as Cesium3DTileOptimizations,Hr as Cesium3DTilePass,lm as Cesium3DTilePassState,Ky as Cesium3DTilePointFeature,Zr as Cesium3DTileRefine,bD as Cesium3DTileStyle,uG as Cesium3DTileStyleEngine,OY as Cesium3DTilesInspector,PY as Cesium3DTilesInspectorViewModel,bd as Cesium3DTileset,sG as Cesium3DTilesetCache,cw as Cesium3DTilesetGraphics,lG as Cesium3DTilesetHeatmap,oG as Cesium3DTilesetMetadata,sR as Cesium3DTilesetMostDetailedTraversal,dx as Cesium3DTilesetStatistics,Ig as Cesium3DTilesetTraversal,mG as Cesium3DTilesetVisualizer,BY as CesiumInspector,MY as CesiumInspectorViewModel,FF as CesiumTerrainProvider,LY as CesiumWidget,wu as Check,CR as CheckerboardMaterialProperty,YW as CircleEmitter,Fwe as CircleGeometry,zwe as CircleOutlineGeometry,Cz as ClassificationModel,YI as ClassificationPrimitive,Ei as ClassificationType,Fi as ClearCommand,vw as ClippingPlane,na as ClippingPlaneCollection,Hm as Clock,hs as ClockRange,Zo as ClockStep,_Y as ClockViewModel,Tst as CloudCollection,cB as CloudType,H as Color,ia as ColorBlendMode,on as ColorGeometryInstanceAttribute,Qt as ColorMaterialProperty,Qgt as Command,X as ComponentDatatype,qz as Composite3DTileContent,JKe as CompositeEntityCollection,bR as CompositeMaterialProperty,cc as CompositePositionProperty,Sl as CompositeProperty,a2 as CompressedTextureBuffer,Oh as ComputeCommand,hW as ComputeEngine,jW as ConditionsExpression,Est as ConeEmitter,Kl as ConstantPositionProperty,Pi as ConstantProperty,FE as ConstantSpline,lf as ContentMetadata,TW as Context,sn as ContextLimits,g2 as CoplanarPolygonGeometry,U0 as CoplanarPolygonGeometryLibrary,yh as CoplanarPolygonOutlineGeometry,ho as CornerType,XE as CorridorGeometry,go as CorridorGeometryLibrary,_G as CorridorGeometryUpdater,$S as CorridorGraphics,P2 as CorridorOutlineGeometry,_n as Credit,p7 as CreditDisplay,ml as CubeMap,tg as CubeMapFace,CE as CubicRealPolynomial,So as CullFace,Ya as Cull