Files
4.0/static/sdk/Cesium.js

9274 lines
3.4 MiB
JavaScript
Raw Permalink 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 Cesium=(()=>{var cAe=Object.create;var N1=Object.defineProperty;var lAe=Object.getOwnPropertyDescriptor;var uAe=Object.getOwnPropertyNames;var fAe=Object.getPrototypeOf,dAe=Object.prototype.hasOwnProperty;var B_=(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 nr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yH=(e,t)=>{for(var n in t)N1(e,n,{get:t[n],enumerable:!0})},CX=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of uAe(t))!dAe.call(e,o)&&o!==n&&N1(e,o,{get:()=>t[o],enumerable:!(i=lAe(t,o))||i.enumerable});return e};var pl=(e,t,n)=>(n=e!=null?cAe(fAe(e)):{},CX(t||!e||!e.__esModule?N1(n,"default",{value:e,enumerable:!0}):n,e)),hAe=e=>CX(N1({},"__esModule",{value:!0}),e);var bX=nr((Wyt,TX)=>{var Qm=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)};Qm.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}};Qm.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};Qm.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};Qm.prototype.random_int31=function(){return this.random_int()>>>1};Qm.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};Qm.prototype.random=function(){return this.random_int()*(1/4294967296)};Qm.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};Qm.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};TX.exports=Qm});var LX=nr((iA,oA)=>{/*! https://mths.be/punycode v1.4.0 by @mathias */(function(e){var t=typeof iA=="object"&&iA&&!iA.nodeType&&iA,n=typeof oA=="object"&&oA&&!oA.nodeType&&oA,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)+($&10
* 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 W1=="object"&&W1.exports?W1.exports=t():typeof define=="function"&&define.amd?define(t):e.IPv6=t(e)})(NX,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 kX=nr((VX,j1)=>{/*!
* 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 j1=="object"&&j1.exports?j1.exports=t():typeof define=="function"&&define.amd?define(t):e.SecondLevelDomains=t(e)})(VX,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 q1=="object"&&q1.exports?q1.exports=t(LX(),FX(),kX()):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(UX,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
`+Pc),os&&(Pc=N(Pc,Bn," "),Pc=N(Pc,Cn," ")),ze&&sd?ze.createHTML(Pc):Pc},xt.setConfig=function($n){Rt($n),YC=!0},xt.clearConfig=function(){M_=null,YC=!1},xt.isValidAttribute=function($n,Me,Vt){M_||Rt({});var bn=Ps($n),tr=Ps(Me);return _X(bn,tr,Vt)},xt.addHook=function($n,Me){typeof Me=="function"&&(At[$n]=At[$n]||[],R(At[$n],Me))},xt.removeHook=function($n){if(At[$n])return D(At[$n])},xt.removeHooks=function($n){At[$n]&&(At[$n]=[])},xt.removeAllHooks=function(){At={}},xt}var yt=Ai();return yt})});var oJ=nr((vNt,m5)=>{"use strict";m5.exports=tO;m5.exports.default=tO;function tO(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=tJ(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,c,u,f,d,p,_;if(i&&(r=cDe(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 JS(r,s,n,a,c,_,0),s}function tJ(e,t,n,i,o){var r,s;if(o===h5(e,t,n,i)>0)for(r=t;r<n;r+=i)s=eJ(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=eJ(r,e[r],e[r+1],s);return s&&nO(s,s.next)&&(ew(s),s=s.next),s}function Ny(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(nO(n,n.next)||Zr(n.prev,n,n.next)===0)){if(ew(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function JS(e,t,n,i,o,r,s){if(!!e){!s&&r&&hDe(e,i,o,r);for(var a=e,c,u;e.prev!==e.next;){if(c=e.prev,u=e.next,r?rDe(e,i,o,r):oDe(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),ew(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=sDe(Ny(e),t,n),JS(e,t,n,i,o,r,2)):s===2&&aDe(e,t,n,i,o,r):JS(Ny(e),t,n,i,o,r,1);break}}}}function oDe(e){var t=e.prev,n=e,i=e.next;if(Zr(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<=_&&GA(o,a,r,c,s,u,m.x,m.y)&&Zr(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function rDe(e,t,n,i){var o=e.prev,r=e,s=e.next;if(Zr(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=f5(_,m,t,n,i),T=f5(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&&GA(a,f,c,d,u,p,E.x,E.y)&&Zr(E.prev,E,E.next)>=0||(E=E.prevZ,S.x>=_&&S.x<=x&&S.y>=m&&S.y<=C&&S!==o&&S!==s&&GA(a,f,c,d,u,p,S.x,S.y)&&Zr(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&&GA(a,f,c,d,u,p,E.x,E.y)&&Zr(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&&GA(a,f,c,d,u,p,S.x,S.y)&&Zr(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function sDe(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!nO(o,r)&&nJ(o,i,i.next,r)&&QS(o,r)&&QS(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),ew(i),ew(i.next),i=e=r),i=i.next}while(i!==e);return Ny(i)}function aDe(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&_De(s,a)){var c=iJ(s,a);s=Ny(s,s.next),c=Ny(c,c.next),JS(s,t,n,i,o,r,0),JS(c,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function cDe(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=tJ(e,a,c,i,!1),u===u.next&&(u.steiner=!0),o.push(pDe(u));for(o.sort(lDe),r=0;r<o.length;r++)n=uDe(o[r],n);return n}function lDe(e,t){return e.x-t.x}function uDe(e,t){var n=fDe(e,t);if(!n)return t;var i=iJ(n,e);return Ny(i,i.next),Ny(n,n.next)}function fDe(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&&GA(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),QS(n,e)&&(p<d||p===d&&(n.x>s.x||n.x===s.x&&dDe(s,n)))&&(s=n,d=p)),n=n.next;while(n!==c);return s}function dDe(e,t){return Zr(e.prev,e,t.prev)<0&&Zr(t.next,e,e.next)<0}function hDe(e,t,n,i){var o=e;do o.z===0&&(o.z=f5(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}},tn=function(){var pe=he(G),Be=G,ne;for(z(pe)?G++:R("Unexpected "+ce(G),G);G<oe&&(pe=he(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=he(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=he(G),pe===C?Be=Bt():Be=tn(),le(),pe=he(G);pe===p||pe===T||pe===C;)G++,pe===p?(le(),Be={type:i,computed:!1,object:Be,property:tn()}):pe===T?(Be={type:i,computed:!0,object:Be,property:ge()},le(),pe=he(G),pe!==E&&R("Unclosed [",G),G++):pe===C&&(Be={type:s,arguments:jt(A),callee:Be}),le(),pe=he(G);return Be},Bt=function(){G++;var pe=ge();if(le(),he(G)===A)return G++,pe;R("Unclosed (",G)},Ai=function(){return G++,{type:d,elements:jt(E)}},yt=[],Ke,xt;G<oe;)Ke=he(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 pv>"u"){var j=e.jsep;e.jsep=Y,Y.noConflict=function(){return e.jsep===Y&&(e.jsep=j),Y}}else typeof lN<"u"&&lN.exports?pv=lN.exports=Y:pv.parse=Y})(pv)});var Uae=nr((cNn,kae)=>{"use strict";kae.exports=ZGe;var Nv=1e20;function ZGe(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?Nv:Math.pow(Math.max(0,.5-D),2),A[m]=D===1?Nv:D===0?0:Math.pow(Math.max(0,D-.5),2)}Fae(C,r,s,T,E,w,S),Fae(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 Fae(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(Vae(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(Vae(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function Vae(e,t,n,i,o){n[0]=0,i[0]=-Nv,i[1]=+Nv;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(){zY?this.noSleepTimer&&(console.warn(`
NoSleep now disabled for older iOS devices.
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}};uxe.exports=HY});var x1=nr(fl=>{"use strict";var wgt=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function vgt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}fl.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)vgt(n,i)&&(e[i]=n[i])}}return e};fl.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Dgt={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}},Pgt={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)}};fl.setTyped=function(e){e?(fl.Buf8=Uint8Array,fl.Buf16=Uint16Array,fl.Buf32=Int32Array,fl.assign(fl,Dgt)):(fl.Buf8=Array,fl.Buf16=Array,fl.Buf32=Array,fl.assign(fl,Pgt))};fl.setTyped(wgt)});var hxe=nr((n7i,dxe)=>{"use strict";function Igt(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}dxe.exports=Igt});var pxe=nr((i7i,mxe)=>{"use strict";function Ogt(){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 Rgt=Ogt();function Mgt(e,t,n,i){var o=Rgt,r=i+n;e^=-1;for(var s=i;s<r;s++)e=e>>>8^o[(e^t[s])&255];return e^-1}mxe.exports=Mgt});var gxe=nr((o7i,_xe)=>{"use strict";var nz=30,Bgt=12;_xe.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=nz;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=nz;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=nz;break e}break}}else if((w&64)===0){S=C[(S&65535)+(m&(1<<w)-1)];continue t}else if(w&32){i.mode=Bgt;break e}else{t.msg="invalid literal/length code",i.mode=nz;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 Exe=nr((r7i,bxe)=>{"use strict";var yxe=x1(),hS=15,xxe=852,Cxe=592,Axe=0,GY=1,Txe=2,Lgt=[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],Ngt=[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],Fgt=[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],Vgt=[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};_y.throwInstantiationError=function(){throw new _y("This function defines an interface and should not be called directly.")};var Ae=_y;var Is={};Is.typeOf={};function _Ae(e){return`${e} is required, actual value was undefined`}function JC(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Is.defined=function(e,t){if(!l(t))throw new Ae(_Ae(e))};Is.typeOf.func=function(e,t){if(typeof t!="function")throw new Ae(JC(typeof t,"function",e))};Is.typeOf.string=function(e,t){if(typeof t!="string")throw new Ae(JC(typeof t,"string",e))};Is.typeOf.number=function(e,t){if(typeof t!="number")throw new Ae(JC(typeof t,"number",e))};Is.typeOf.number.lessThan=function(e,t,n){if(Is.typeOf.number(e,t),t>=n)throw new Ae(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Is.typeOf.number.lessThanOrEquals=function(e,t,n){if(Is.typeOf.number(e,t),t>n)throw new Ae(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Is.typeOf.number.greaterThan=function(e,t,n){if(Is.typeOf.number(e,t),t<=n)throw new Ae(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Is.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Is.typeOf.number(e,t),t<n)throw new Ae(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};Is.typeOf.object=function(e,t){if(typeof t!="object")throw new Ae(JC(typeof t,"object",e))};Is.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new Ae(JC(typeof t,"boolean",e))};Is.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new Ae(JC(typeof t,"bigint",e))};Is.typeOf.number.equals=function(e,t,n,i){if(Is.typeOf.number(e,n),Is.typeOf.number(t,i),n!==i)throw new Ae(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};var Ql=Is;function AX(e,t){return e??t}AX.EMPTY_OBJECT=Object.freeze({});var y=AX;var Eh=pl(bX(),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 Lt(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0),this.w=y(i,0)}Lt.fromElements=function(e,t,n,i,o){return l(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new Lt(e,t,n,i)};Lt.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 Lt(e.red,e.green,e.blue,e.alpha)};Lt.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 Lt(e.x,e.y,e.z,e.w)};Lt.packedLength=4;Lt.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};Lt.unpack=function(e,t,n){return t=y(t,0),l(n)||(n=new Lt),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};Lt.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)Lt.pack(e[o],t,o*4);return t};Lt.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]=Lt.unpack(e,i,t[o])}return t};Lt.fromArray=Lt.unpack;Lt.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)};Lt.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)};Lt.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};Lt.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};Lt.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};Lt.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};Lt.magnitude=function(e){return Math.sqrt(Lt.magnitudeSquared(e))};var G1=new Lt;Lt.distance=function(e,t){return Lt.subtract(e,t,G1),Lt.magnitude(G1)};Lt.distanceSquared=function(e,t){return Lt.subtract(e,t,G1),Lt.magnitudeSquared(G1)};Lt.normalize=function(e,t){let n=Lt.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t};Lt.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};Lt.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};Lt.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};Lt.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};Lt.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};Lt.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};Lt.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};Lt.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};Lt.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 IX=new Lt;Lt.lerp=function(e,t,n,i){return Lt.multiplyByScalar(t,n,IX),i=Lt.multiplyByScalar(e,1-n,i),Lt.add(IX,i,i)};var jAe=new Lt;Lt.mostOrthogonalAxis=function(e,t){let n=Lt.normalize(e,jAe);return Lt.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=Lt.clone(Lt.UNIT_X,t):t=Lt.clone(Lt.UNIT_W,t):n.z<=n.w?t=Lt.clone(Lt.UNIT_Z,t):t=Lt.clone(Lt.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=Lt.clone(Lt.UNIT_Y,t):t=Lt.clone(Lt.UNIT_W,t):n.z<=n.w?t=Lt.clone(Lt.UNIT_Z,t):t=Lt.clone(Lt.UNIT_W,t),t};Lt.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};Lt.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]};Lt.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)};Lt.ZERO=Object.freeze(new Lt(0,0,0,0));Lt.ONE=Object.freeze(new Lt(1,1,1,1));Lt.UNIT_X=Object.freeze(new Lt(1,0,0,0));Lt.UNIT_Y=Object.freeze(new Lt(0,1,0,0));Lt.UNIT_Z=Object.freeze(new Lt(0,0,1,0));Lt.UNIT_W=Object.freeze(new Lt(0,0,0,1));Lt.prototype.clone=function(e){return Lt.clone(this,e)};Lt.prototype.equals=function(e){return Lt.equals(this,e)};Lt.prototype.equalsEpsilon=function(e,t,n){return Lt.equalsEpsilon(this,e,t,n)};Lt.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w}
${this.stack.toString()}`),e};var de=DS;function lt(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)}lt.packedLength=16;lt.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};lt.unpack=function(e,t,n){return t=y(t,0),l(n)||(n=new lt),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};lt.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)lt.pack(e[o],t,o*16);return t};lt.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]=lt.unpack(e,i,t[o])}return t};lt.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 lt(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])};lt.fromArray=lt.unpack;lt.fromColumnMajorArray=function(e,t){return lt.clone(e,t)};lt.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 lt(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])};lt.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 lt(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)};lt.fromTranslationQuaternionRotationScale=function(e,t,n,i){l(i)||(i=new lt);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};lt.fromTranslationRotationScale=function(e,t){return lt.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};lt.fromTranslation=function(e,t){return lt.fromRotationTranslation(Q.IDENTITY,e,t)};lt.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 lt(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};lt.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 lt(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};lt.fromRotation=function(e,t){return l(t)||(t=new lt),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 tA=new h,nA=new h,PS=new h;lt.fromCamera=function(e,t){let n=e.position,i=e.direction,o=e.up;h.normalize(i,tA),h.normalize(h.cross(tA,o,nA),nA),h.normalize(h.cross(nA,tA,PS),PS);let r=nA.x,s=nA.y,a=nA.z,c=tA.x,u=tA.y,f=tA.z,d=PS.x,p=PS.y,_=PS.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 lt(r,s,a,A,d,p,_,T,-c,-u,-f,E,0,0,0,1)};lt.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=lt;function fi(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(fi.prototype,{width:{get:function(){return fi.computeWidth(this)}},height:{get:function(){return fi.computeHeight(this)}}});fi.packedLength=4;fi.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};fi.unpack=function(e,t,n){return t=y(t,0),l(n)||(n=new fi),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};fi.computeWidth=function(e){let t=e.east,n=e.west;return t<n&&(t+=I.TWO_PI),t-n};fi.computeHeight=function(e){return e.north-e.south};fi.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 fi(e,t,n,i)};fi.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 fi(e,t,n,i)};fi.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 fi(n,s,i,a)};fi.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 fi(i,a,o,c)};fi.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 fi(e.west,e.south,e.east,e.north)};fi.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};fi.prototype.clone=function(e){return fi.clone(this,e)};fi.prototype.equals=function(e){return fi.equals(this,e)};fi.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};fi.prototype.equalsEpsilon=function(e,t){return fi.equalsEpsilon(this,e,t)};fi.validate=function(e){};fi.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)};fi.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)};fi.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)};fi.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)};fi.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)};fi.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 fi(a,u,c,f)};fi.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 fi(i,o,r,s)};fi.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 K1=UTe;function jX(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=K1(this.responseHeaders))}jX.prototype.toString=function(){let e="Request has failed.";return l(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};var ep=jX;function IS(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(IS.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});IS.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);let n=this;return function(){n.removeEventListener(e,t)}};IS.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 zTe(e,t){return t-e}IS.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(zTe),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=IS;function gy(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(gy.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 kH(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}gy.prototype.reserve=function(e){e=y(e,this._length),this._array.length=e};gy.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?(kH(i,o,e),e=o):r=!1}};gy.prototype.resort=function(){let e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};gy.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)kH(t,o,s),o=s;else break}let r;return l(i)&&this._length>i&&(r=t[i],this._length=i),r};gy.prototype.pop=function(e){if(e=y(e,0),this._length===0)return;let t=this._array,n=t[e];return kH(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};var $1=gy;function HTe(e,t){return e.priority-t.priority}var So={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0},uA=20,Ja=new $1({comparator:HTe});Ja.maximumLength=uA;Ja.reserve(uA);var vh=[],tp={},GTe=typeof document<"u"?new Mi.default(document.location.href):new Mi.default,Z1=new xe;function _r(){}_r.maximumRequests=50;_r.maximumRequestsPerServer=6;_r.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18};_r.throttleRequests=!0;_r.debugShowStatistics=!1;_r.requestCompletedEvent=Z1;Object.defineProperties(_r,{statistics:{get:function(){return So}},priorityHeapLength:{get:function(){return uA},set:function(e){if(e<uA)for(;Ja.length>e;){let t=Ja.pop();yy(t)}uA=e,Ja.maximumLength=e,Ja.reserve(e)}}});function qX(e){l(e.priorityFunction)&&(e.priority=e.priorityFunction())}_r.serverHasOpenSlots=function(e,t){t=y(t,1);let n=y(_r.requestsByServer[e],_r.maximumRequestsPerServer);return tp[e]+t<=n};_r.heapHasOpenSlots=function(e){return Ja.length+e<=uA};function YX(e){return e.state===Hi.UNISSUED&&(e.state=Hi.ISSUED,e.deferred=xs()),e.deferred.promise}function WTe(e){return function(t){if(e.state===Hi.CANCE
(${this[1]}, ${this[3]})`};var so=mn;var Do={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};Do.getMathType=function(e){switch(e){case Do.SCALAR:return Number;case Do.VEC2:return W;case Do.VEC3:return h;case Do.VEC4:return ae;case Do.MAT2:return so;case Do.MAT3:return Q;case Do.MAT4:return O}};Do.getNumberOfComponents=function(e){switch(e){case Do.SCALAR:return 1;case Do.VEC2:return 2;case Do.VEC3:return 3;case Do.VEC4:case Do.MAT2:return 4;case Do.MAT3:return 9;case Do.MAT4:return 16}};Do.getAttributeLocationCount=function(e){switch(e){case Do.SCALAR:case Do.VEC2:case Do.VEC3:case Do.VEC4:return 1;case Do.MAT2:return 2;case Do.MAT3:return 3;case Do.MAT4:return 4}};Do.getGlslType=function(e){switch(e){case Do.SCALAR:return"float";case Do.VEC2:return"vec2";case Do.VEC3:return"vec3";case Do.VEC4:return"vec4";case Do.MAT2:return"mat2";case Do.MAT3:return"mat3";case Do.MAT4:return"mat4"}};var xn=Object.freeze(Do);var d$=1/256,h$=256,jo={};jo.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};jo.octEncode=function(e,t){return jo.octEncodeInRange(e,255,t)};var zS=new W,m$=new Uint8Array(1);function SI(e){return m$[0]=e,m$[0]}jo.octEncodeToCartesian4=function(e,t){return jo.octEncodeInRange(e,65535,zS),t.x=SI(zS.x*d$),t.y=SI(zS.x),t.z=SI(zS.y*d$),t.w=SI(zS.y),t};jo.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)};jo.octDecode=function(e,t,n){return jo.octDecodeInRange(e,t,255,n)};jo.octDecodeFromCartesian4=function(e,t){let n=e.x,i=e.y,o=e.z,r=e.w,s=n*h$+i,a=o*h$+r;return jo.octDecodeInRange(s,a,65535,t)};jo.octPackFloat=function(e){return 256*e.x+e.y};var P8=new W;jo.octEncodeFloat=function(e){return jo.octEncode(e,P8),jo.octPackFloat(P8)};jo.octDecodeFloat=function(e,t){let n=e/256,i=Math.floor(n),o=(n-i)*256;return jo.octDecode(i,o,t)};jo.octPack=function(e,t,n,i){let o=jo.octEncodeFloat(e),r=jo.octEncodeFloat(t),s=jo.octEncode(n,P8);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};jo.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;jo.octDecodeFloat(s,t),jo.octDecodeFloat(c,n),jo.octDecode(r,a,i)};jo.compressTextureCoordinates=function(e){let t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};jo.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 D8(e){return e>>1^-(e&1)}jo.zigZagDeltaDecode=function(e,t,n){let i=e.length,o=0,r=0,s=0;for(let a=0;a<i;++a)o+=D8(e[a]),r+=D8(t[a]),e[a]=o,t[a]=r,l(n)&&(s+=D8(n[a]),n[a]=s)};jo.dequantize=function(e,t,n,i){let o=xn.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};jo.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 li=jo;var wI={};wI.getHeight=function(e,t,n){return(e-n)*t+n};var MSe=new h;wI.getPosition=function(e,t,n,i,o){let r=t.cartesianToCartographic(e,MSe),s=wI.getHeight(r.height,n,i);return h.fromRadians(r.longitude,r.latitude,s,t,o)};var Cl=wI;var BSe={NONE:0,BITS12:1},ia=Object.freeze(BSe);var Sy=new h,LSe=new h,Xu=new W,vI=new O,NSe=new O,FSe=Math.pow(2,12);function nc(e,t,n,i,o,r,s,a,c,u){let f=ia.NONE,d,p;if(l(t)&&l(n)&&l(i)&&l(o)){let _=t.minimum,m=t.maximum,x=h.subtract(m,_,LSe),C=i-n;Math.max(h.maximumComponent(x),C)<FSe-1?f=ia.BI
${o}`),t}var ap=cwe;function q_(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}q_.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 q_(t,i,o,r,s,0,a),n.numberOfListeners>0?n.raiseEvent(c):console.log(`An error occurred in "${t.constructor.name}": ${ap(i)}`),c};q_.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=q_.reportError(e,t,n,i,o,r,s,c);return u.retry&&l(a)&&a(),u};q_.reportSuccess=function(e){l(e)&&(e.timesRetried=-1)};q_.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."),q_.reportSuccess(e)};var bi=q_;function Y_(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 xo(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(Y_.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Y_.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Y_.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Y_.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)};Y_.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)};Y_.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};Y_.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 As=Y_;var lwe=15;function bA(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 Cd(e){let t=e;typeof t!="string"&&!(t instanceof Ne)&&(t=e.url);let n=Ne.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=rIe(this).then(function(){return i.getQuadTreePacket("",i._quadPacketVersion)}).then(function(){return!0}).catch(function(o){let r=`An error occurred while accessing ${IQ(i,"",1).url}.`;return Promise.reject(new de(r))})}Object.defineProperties(Cd.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}}});Cd.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){let r=1<<o,s=0;zc(t,r)?zc(e,r)&&(s|=1):(s|=2,zc(e,r)||(s|=1)),i+=s}return i};Cd.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];zc(s,2)?zc(s,1)||(t|=r):(n|=r,zc(s,1)&&(t|=r))}return{x:t,y:n,level:i}};Cd.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 PQ=new ao("decodeGoogleEarthEnterprisePacket");Cd.prototype.getQuadTreePacket=function(e,t,n){t=y(t,1),e=y(e,"");let o=IQ(this,e,t,n).fetchArrayBuffer();if(!l(o))return;let r=this._tileInfo,s=this.key;return o.then(function(a){return PQ.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=vO.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}})})};Cd.prototype.populateSubtree=function(e,t,n,i){let o=Cd.tileXYToQuadKey(e,t,n);return q5(this,o,i)};function q5(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 Dr({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),q5(e,t,s)});if(!l(r)||!r.hasSubtree())return Promise.reject(new de(`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 Dr({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),q5(e,t,s)}).finally(function(){delete a[o]})}Cd.prototype.getTileInformation=function(e,t,n){let i=Cd.tileXYToQuadKey(e,t,n);return this._tileInfo[i]};Cd.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]};function IQ(e,t,n,i){return e._resource.getDerivedResource({url:`flatfile?q2-0${t}-q.${n.toString()}`,request:i})}var W5,j5;function rIe(e){let t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!l(j5)){let n=Pn("ThirdParty/google-earth-dbroot-parser.js"),i=window.cesiumGoogleEarthDbRootParser;j5=cA(n).then(function(){W5=window.cesiumGoogleEarthDbRootParser(oT),l(i)?window.cesiumGoogleEarthDbRootParser=i:delete window.cesiumGoogleEarthDbRootParser})}return j5.then(function(){return t.fetchArrayBuffer()}).then(function(n){let i=W5.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 wR=`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 vR=`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 DR=`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 PR=`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 IR=`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 SLe={ADD:Z.FUNC_ADD,SUBTRACT:Z.FUNC_SUBTRACT,REVERSE_SUBTRACT:Z.FUNC_REVERSE_SUBTRACT,MIN:Z.MIN,MAX:Z.MAX},uc=Object.freeze(SLe);var wLe={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},rr=Object.freeze(wLe);var vLe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:uc.ADD,equationAlpha:uc.ADD,functionSourceRgb:rr.SOURCE_ALPHA,functionSourceAlpha:rr.ONE,functionDestinationRgb:rr.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:rr.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:uc.ADD,equationAlpha:uc.ADD,functionSourceRgb:rr.ONE,functionSourceAlpha:rr.ONE,functionDestinationRgb:rr.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:rr.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:uc.ADD,equationAlpha:uc.ADD,functionSourceRgb:rr.SOURCE_ALPHA,functionSourceAlpha:rr.ONE,functionDestinationRgb:rr.ONE,functionDestinationAlpha:rr.ONE})},zn=Object.freeze(vLe);var DLe={FRONT:Z.FRONT,BACK:Z.BACK,FRONT_AND_BACK:Z.FRONT_AND_BACK},Ao=Object.freeze(DLe);function MT(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(MT.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}}});MT.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(`
`)};MT.prototype.isTranslucent=function(){return l(this.material)&&this.material.isTranslucent()||!l(this.material)&&this.translucent};MT.prototype.getRenderState=function(){let e=this.isTranslucent(),t=ht(this.renderState,!1);return e?(t.depthMask=!1,t.blending=zn.ALPHA_BLEND):t.depthMask=!0,t};MT.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=zn.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:Ao.BACK}),l(n)&&(i=Dt(n,i,!0)),i};var Mo=MT;var Ur={_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(Ur,{maximumCombinedTextureImageUnits:{get:function(){return Ur._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return Ur._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return Ur._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return Ur._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return Ur._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return Ur._maximumTextureSize}},maximumVaryingVectors:{get:function(){return Ur._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return Ur._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return Ur._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return Ur._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return Ur._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return Ur._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return Ur._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return Ur._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return Ur._maximumViewportWidth}},maximumViewportHeight:{get:function(){return Ur._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return Ur._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return Ur._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return Ur._maximumColorAttachments}},maximumSamples:{get:function(){return Ur._maximumSamples}},highpFloatSupported:{get:function(){return Ur._highpFloatSupported}},highpIntSupported:{get:function(){return Ur._highpIntSupported}}});var rn=Ur;function OR(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(OR.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});OR.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,ct.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 NR=`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 FR=`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 VR=`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 kR=`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 UR=`#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 zR=`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 HR=`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 GR=`#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 WR=`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 jR=`#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 qR=`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 YR=`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 XR=`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 KR=`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 $R=`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 ZR=`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 JR=`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,en.LINEAR),this._magnificationFilter=y(e.magnificationFilter,To.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,PLe(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 Ln({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 Wc({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new Ln({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 PLe(e,t){e=y(e,y.EMPTY_OBJECT),t._strict=y(e.strict,!1),t._count=y(e.count,0),t._template=ht(y(e.fabric,y.EMPTY_OBJECT)),t._template.uniforms=ht(y(t._template.uniforms,y.EMPTY_OBJECT)),t._template.materials=ht(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=ht(i.fabric,!0);t._template=Dt(t._template,r,!0),n=i.translucent}MLe(t),l(i)||tt._materialCache.addMaterial(t.type,t),LLe(t),kLe(t),zLe(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 jG(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 Bne(e,t){}function ILe(e,t){}var OLe=["type","materials","uniforms","components","source"],RLe=["diffuse","specular","shininess","normal","emission","alpha"];function MLe(e){let t=e._template,n=t.uniforms,i=t.materials,o=t.components;jG(t,OLe,Bne,!0),jG(o,RLe,Bne,!0);let r=[];for(let s in i)i.hasOwnProperty(s)&&r.push(s);jG(n,r,ILe,!1)}function BLe(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 LLe(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&&BLe(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 Lne={mat2:so,mat3:Q,mat4:O},NLe=/\.ktx2$/i;function FLe(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 Ln({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 Ne;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:Ne.createIfNeeded(r),_;NLe.test(p.url)?_=sc(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 VLe(e){return function(t,n){let i=t.uniforms[e];if(i instanceof Wc){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=[Ne.createIfNeeded(i.positiveX).fetchImage(),Ne.createIfNeeded(i.negativeX).fetchImage(),Ne.createIfNeeded(i.positiveY).fetchImage(),Ne.createIfNeeded(i.negativeY).fetchImage(),Ne.createIfNeeded(i.positiveZ).fetchImage(),Ne.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function kLe(e){let t=e._template.uniforms;for(let n in t)t.hasOwnProperty(n)&&Nne(e,n)}function Nne(e,t){let n=e._strict,i=e._template.uniforms,o=i[t],r=ULe(o),s;if(r==="channels")s=Uw(e,t,o,!1);else{if(r==="sampler2D"){let u=`${t}Dimensions`;HLe(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},Nne(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=Uw(e,t,c),e.uniforms[t]=o,r==="sampler2D")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(FLe(t));else if(r==="samplerCube")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(VLe(t));else if(r.indexOf("mat")!==-1){let u=new Lne[r];e._uniforms[c]=function(){return Lne[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[c]=function(){return e.uniforms[t]}}}function ULe(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 Ne||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 zLe(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++}`;Uw(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 eM=`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 BT=`varying vec4 v_color;
void main()
{
gl_FragColor = czm_gammaCorrect(v_color);
}
`;var tM=`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 vp(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?tM:eM,r=i?BT:QR,s=i?vp.FLAT_VERTEX_FORMAT:vp.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(vp.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}}});vp.VERTEX_FORMAT=Fe.POSITION_AND_NORMAL;vp.FLAT_VERTEX_FORMAT=Fe.POSITION_ONLY;vp.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;vp.prototype.isTranslucent=Mo.prototype.isTranslucent;vp.prototype.getRenderState=Mo.prototype.getRenderState;var Mn=vp;function LT(e){this._definitionChanged=new xe,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(LT.prototype,{isConstant:{get:function(){return q.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ue("color")});LT.prototype.getType=function(e){return"Color"};LT.prototype.getValue=function(e,t){return l(t)||(t={}),t.color=q.getValueOrClonedDefault(this._color,e,H.WHITE,t.color),t};LT.prototype.equals=function(e){return this===e||e instanceof LT&&q.equals(this._color,e._color)};var Jt=LT;var zr={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 zw(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 fc(e,t){return(e._flags&t)===t}function Og(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(zw.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 fc(this,zr.CULL)},set:function(e){fc(this,zr.CULL)!==e&&(Og(this,zr.CULL,e),this.dirty=!0)}},occlude:{get:function(){return fc(this,zr.OCCLUDE)},set:function(e){fc(this,zr.OCCLUDE)!==e&&(Og(this,zr.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}`:`${df}Fragment shader translation failed.`)}throw e.deleteProgram(s),new de(`Fragment shader failed to compile. Compile log: ${c}`)}if(!e.getShaderParameter(o,e.COMPILE_STATUS)){if(c=e.getShaderInfoLog(o),console.error(`${df}Vertex shader compile log: ${c}`),l(f)){let d=f.getTranslatedShaderSource(o);console.error(d!==""?`${df}Translated vertex shader source:
${d}`:`${df}Vertex shader translation failed.`)}throw e.deleteProgram(s),new de(`Vertex shader failed to compile. Compile log: ${c}`)}throw c=e.getProgramInfoLog(s),console.error(`${df}Shader program link log: ${c}`),l(f)&&(console.error(`${df}Translated vertex shader source:
${f.getTranslatedShaderSource(o)}`),console.error(`${df}Translated fragment shader source:
${f.getTranslatedShaderSource(r)}`)),e.deleteProgram(s),new de(`Program failed to link. Link log: ${c}`)}let u=t._logShaderCompilation;return u&&(c=e.getShaderInfoLog(o),l(c)&&c.length>0&&console.log(`${df}Vertex shader compile log: ${c}`)),u&&(c=e.getShaderInfoLog(r),l(c)&&c.length>0&&console.log(`${df}Fragment shader compile log: ${c}`)),u&&(c=e.getProgramInfoLog(s),l(c)&&c.length>0&&console.log(`${df}Shader program link log: ${c}`)),s}function oNe(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 rNe(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=nM(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=iM(e,a,u,d),n[u]=f,i.push(f),f._setSampler&&o.push(f)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function sNe(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=Rg[s];l(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function aNe(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 oM(e){l(e._program)||Tie(e)}function Tie(e){let t=e._program,n=e._gl,i=iNe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=rNe(n,i),s=sNe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=oNe(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=aNe(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{Tie(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)}})}Dp.prototype._bind=function(){oM(this),this._gl.useProgram(this._program)};Dp.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)}};Dp.prototype.isDestroyed=function(){return!1};Dp.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Dp.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),fe(this)};var _n=Dp;function cNe(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)&&(bie(C,a),nm(x,C,i),i.splice(o,0,`layout(location = ${r}) out vec4 ${C};`),o+=1)}let c="czm_fragColor";uNe("gl_FragColor",i)&&(bie(c,a),nm("gl_FragColor",c,i),i.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);let u=dNe(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),XG("EXT_draw_buffers",d,i),XG("EXT_frag_depth",d,i),XG("OES_standard_derivatives",d,i),nm("texture2D","texture",i),nm("texture3D","texture",i),nm("textureCube","texture",i),nm("gl_FragDepthEXT","gl_FragDepth",i),t?nm("varying","in",i):(nm("attribute","in",i),nm("varying","out",i)),fNe(i)}function nm(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 lNe(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 uNe(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 fNe(e){let t="",n=e.length;for(let i=0;i<n;++i)t+=`${e[i]}
`;return t}function bie(e,t){t.indexOf(e)===-1&&t.push(e)}function dNe(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 XG(e,t,n){let i=`#extension\\s+GL_${e}\\s+:\\s+[a-zA-Z0-9]+\\s*$`;lNe(new RegExp(i,"g"),"",n),nm(`GL_${e}`,t,n)}var rM=cNe;var sM=`const float czm_degreesPerRadian = 57.29577951308232;
`;var aM=`const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
`;var cM=`const float czm_epsilon1 = 0.1;
`;var lM=`const float czm_epsilon2 = 0.01;
`;var uM=`const float czm_epsilon3 = 0.001;
`;var fM=`const float czm_epsilon4 = 0.0001;
`;var dM=`const float czm_epsilon5 = 0.00001;
`;var hM=`const float czm_epsilon6 = 0.000001;
`;var mM=`const float czm_epsilon7 = 0.0000001;
`;var pM=`const float czm_infinity = 5906376272000.0;
`;var _M=`const float czm_oneOverPi = 0.3183098861837907;
`;var gM=`const float czm_oneOverTwoPi = 0.15915494309189535;
`;var yM=`const float czm_passCesium3DTile = 4.0;
`;var xM=`const float czm_passCesium3DTileClassification = 5.0;
`;var CM=`const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
`;var AM=`const float czm_passClassification = 7.0;
`;var TM=`const float czm_passCompute = 1.0;
`;var bM=`const float czm_passEnvironment = 0.0;
`;var EM=`const float czm_passGlobe = 2.0;
`;var SM=`const float czm_passOpaque = 7.0;
`;var wM=`const float czm_passOverlay = 9.0;
`;var vM=`const float czm_passTerrainClassification = 3.0;
`;var DM=`const float czm_passTranslucent = 8.0;
`;var PM=`const float czm_pi = 3.141592653589793;
`;var IM=`const float czm_piOverFour = 0.7853981633974483;
`;var OM=`const float czm_piOverSix = 0.5235987755982988;
`;var RM=`const float czm_piOverThree = 1.0471975511965976;
`;var MM=`const float czm_piOverTwo = 1.5707963267948966;
`;var BM=`const float czm_radiansPerDegree = 0.017453292519943295;
`;var LM=`const float czm_sceneMode2D = 2.0;
`;var NM=`const float czm_sceneMode3D = 3.0;
`;var FM=`const float czm_sceneModeColumbusView = 1.0;
`;var VM=`const float czm_sceneModeMorphing = 0.0;
`;var kM=`const float czm_solarRadius = 695500000.0;
`;var UM=`const float czm_threePiOver2 = 4.71238898038469;
`;var zM=`const float czm_twoPi = 6.283185307179586;
`;var HM=`const float czm_webMercatorMaxLatitude = 1.4844222297453324;
`;var GM=`struct czm_depthRangeStruct
{
float near;
float far;
};
`;var WM=`struct czm_material
{
vec3 diffuse;
float specular;
float shininess;
vec3 normal;
vec3 emission;
float alpha;
};
`;var jM=`struct czm_materialInput
{
float s;
vec2 st;
vec3 str;
vec3 normalEC;
mat3 tangentToEyeMatrix;
vec3 positionToEyeEC;
float height;
float slope;
float aspect;
};
`;var qM=`struct czm_modelMaterial {
vec3 diffuse;
float alpha;
vec3 specular;
float roughness;
vec3 normalEC;
float occlusion;
vec3 emissive;
};
`;var YM=`struct czm_modelVertexOutput {
vec3 positionMC;
float pointSize;
};
`;var XM=`struct czm_pbrParameters
{
vec3 diffuseColor;
float roughness;
vec3 f0;
};
`;var KM=`struct czm_ray
{
vec3 origin;
vec3 direction;
};
`;var $M=`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 ZM=`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 JM=`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 QM=`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 eB=`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 tB=`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 nB=`bool czm_backFacing()
{
return gl_FrontFacing == false;
}
`;var iB=`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 oB=`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 rB=`uniform vec4 shadowMap_cascadeDistances;
float czm_cascadeDistance(vec4 weights)
{
return dot(shadowMap_cascadeDistances, weights);
}
`;var sB=`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 aB=`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 cB=`vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
{
vec3 p = mix(position2D.xyz, position3D.xyz, time);
return vec4(p, 1.0);
}
`;var lB=`vec4 czm_computePosition();
`;var uB=`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 fB=`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 dB=`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 hB=`#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 mB=`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 pB=`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 _B=`vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)
{
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
}
`;var gB=`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 yB=`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 xB=`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 CB=`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 AB=`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 TB=`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 bB=`vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
{
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
}
`;var EB=`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 SB=`float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
{
return max(dot(lightDirectionEC, normalEC), 0.0);
}
`;var wB=`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 vB=`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 DB=`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 PB=`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 IB=`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 OB=`vec3 czm_inverseGamma(vec3 color) {
return pow(color, vec3(1.0 / czm_gamma));
}
`;var RB=`bool czm_isEmpty(czm_raySegment interval)
{
return (interval.stop < 0.0);
}
`;var MB=`bool czm_isFull(czm_raySegment interval)
{
return (interval.start == 0.0 && interval.stop == czm_infinity);
}
`;var BB=`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 LB=`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 NB=`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 FB=`float czm_luminance(vec3 rgb)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
return dot(rgb, W);
}
`;var VB=`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 kB=`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 UB=`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 zB=`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 HB=`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 GB=`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 WB=`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 jB=`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 qB=`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 YB=`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 XB=`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 KB=`vec3 czm_pointAlongRay(czm_ray ray, float time)
{
return ray.origin + (time * ray.direction);
}
`;var $B=`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 ZB=`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 JB=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
{
return czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);
}
`;var QB=`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 eL=`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 tL=`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 nL=`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 iL=`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 oL=`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 rL=`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 sL=`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 aL=`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 cL=`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 lL=`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 uL=`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 fL=`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 dL=`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 hL=`vec4 czm_transformPlane(vec4 plane, mat4 transform) {
vec4 transformedPlane = transform * plane;
float normalMagnitude = length(transformedPlane.xyz);
return transformedPlane / normalMagnitude;
}
`;var mL=`vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
{
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
return vec4(highDifference + lowDifference, 1.0);
}
`;var pL=`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 _L=`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 gL=`float czm_unpackDepth(vec4 packedDepth)
{
return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
}
`;var yL=`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 xL=`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 CL=`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 AL=`#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 TL=`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 bL=`#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 EL=`#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 SL=`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 wL=`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 NT={czm_degreesPerRadian:sM,czm_depthRange:aM,czm_epsilon1:cM,czm_epsilon2:lM,czm_epsilon3:uM,czm_epsilon4:fM,czm_epsilon5:dM,czm_epsilon6:hM,czm_epsilon7:mM,czm_infinity:pM,czm_oneOverPi:_M,czm_oneOverTwoPi:gM,czm_passCesium3DTile:yM,czm_passCesium3DTileClassification:xM,czm_passCesium3DTileClassificationIgnoreShow:CM,czm_passClassification:AM,czm_passCompute:TM,czm_passEnvironment:bM,czm_passGlobe:EM,czm_passOpaque:SM,czm_passOverlay:wM,czm_passTerrainClassification:vM,czm_passTranslucent:DM,czm_pi:PM,czm_piOverFour:IM,czm_piOverSix:OM,czm_piOverThree:RM,czm_piOverTwo:MM,czm_radiansPerDegree:BM,czm_sceneMode2D:LM,czm_sceneMode3D:NM,czm_sceneModeColumbusView:FM,czm_sceneModeMorphing:VM,czm_solarRadius:kM,czm_threePiOver2:UM,czm_twoPi:zM,czm_webMercatorMaxLatitude:HM,czm_depthRangeStruct:GM,czm_material:WM,czm_materialInput:jM,czm_modelMaterial:qM,czm_modelVertexOutput:YM,czm_pbrParameters:XM,czm_ray:KM,czm_raySegment:$M,czm_shadowParameters:ZM,czm_acesTonemapping:JM,czm_alphaWeight:QM,czm_antialias:eB,czm_approximateSphericalCoordinates:tB,czm_backFacing:nB,czm_branchFreeTernary:iB,czm_cascadeColor:oB,czm_cascadeDistance:rB,czm_cascadeMatrix:sB,czm_cascadeWeights:aB,czm_columbusViewMorph:cB,czm_computePosition:lB,czm_cosineAndSine:uB,czm_decompressTextureCoordinates:fB,czm_defaultPbrMaterial:dB,czm_depthClamp:hB,czm_eastNorthUpToEyeCoordinates:mB,czm_ellipsoidContainsPoint:pB,czm_ellipsoidWgs84TextureCoordinates:_B,czm_equalsEpsilon:gB,czm_eyeOffset:yB,czm_eyeToWindowCoordinates:xB,czm_fastApproximateAtan:CB,czm_fog:AB,czm_gammaCorrect:TB,czm_geodeticSurfaceNormal:bB,czm_getDefaultMaterial:EB,czm_getLambertDiffuse:SB,czm_getSpecular:wB,czm_getWaterNoise:vB,czm_HSBToRGB:DB,czm_HSLToRGB:PB,czm_hue:IB,czm_inverseGamma:OB,czm_isEmpty:RB,czm_isFull:MB,czm_latitudeToWebMercatorFraction:BB,czm_linearToSrgb:LB,czm_lineDistance:NB,czm_luminance:FB,czm_metersPerPixel:VB,czm_modelToWindowCoordinates:kB,czm_multiplyWithColorBalance:UB,czm_nearFarScalar:zB,czm_octDecode:HB,czm_packDepth:GB,czm_pbrLighting:WB,czm_pbrMetallicRoughnessMaterial:jB,czm_pbrSpecularGlossinessMaterial:qB,czm_phong:YB,czm_planeDistance:XB,czm_pointAlongRay:KB,czm_rayEllipsoidIntersectionInterval:$B,czm_raySphereIntersectionInterval:ZB,czm_readDepth:JB,czm_readNonPerspective:QB,czm_reverseLogDepth:eL,czm_RGBToHSB:tL,czm_RGBToHSL:nL,czm_RGBToXYZ:iL,czm_round:oL,czm_sampleOctahedralProjection:rL,czm_saturation:sL,czm_shadowDepthCompare:aL,czm_shadowVisibility:cL,czm_signNotZero:lL,czm_sphericalHarmonics:uL,czm_srgbToLinear:fL,czm_tangentToEyeSpaceMatrix:dL,czm_transformPlane:hL,czm_translateRelativeToEye:mL,czm_translucentPhong:pL,czm_transpose:_L,czm_unpackDepth:gL,czm_unpackFloat:yL,czm_unpackUint:xL,czm_valueTransform:CL,czm_vertexLogDepth:AL,czm_windowToEyeCoordinates:TL,czm_writeDepthClamp:bL,czm_writeLogDepth:EL,czm_writeNonPerspective:SL,czm_XYZToRGB:wL};function Eie(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 Sie(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return l(i)||(t=Eie(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function wie(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&&aa._czmBuiltinsAndUniforms.hasOwnProperty(i)){let o=Sie(i,aa._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),wie(o,t)}}))}function hNe(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 mNe(e){let t=[],n=Sie("main",e,t);wie(n,t),hNe(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
`;return i.replace(n.glslSource,"")}function vie(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=Eie(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=aa.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+=mNe(r)),f+=`
#line 0
`,f+=r,n.webgl2&&(f=rM(f,t,!0)),f}function aa(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)}aa.prototype.clone=function(){return new aa({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};aa.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};aa.prototype.createCombinedVertexShader=function(e){return vie(this,!1,e)};aa.prototype.createCombinedFragmentShader=function(e){return vie(this,!0,e)};aa._czmBuiltinsAndUniforms={};for(let e in NT)NT.hasOwnProperty(e)&&(aa._czmBuiltinsAndUniforms[e]=NT[e]);for(let e in Rg)if(Rg.hasOwnProperty(e)){let t=Rg[e];typeof t.getDeclaration=="function"&&(aa._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}aa.createPickVertexShaderSource=function(e){return`${aa.replaceMain(e,"czm_old_main")}
attribute vec4 pickColor;
varying vec4 czm_pickColor;
void main()
{
czm_old_main();
czm_pickColor = pickColor;
}`};aa.createPickFragmentShaderSource=function(e,t){let n=aa.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 pNe(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 Die(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 Pie(e,t){let n=t.length;for(let i=0;i<n;++i){let o=t[i];if(Die(e,o))return o}}var _Ne=["v_normalEC","v_normal"];aa.findNormalVarying=function(e){return Die(e,"#ifdef HAS_NORMALS")?pNe(e,"HAS_NORMALS")?"v_normalEC":void 0:Pie(e,_Ne)};var gNe=["v_positionEC"];aa.findPositionVarying=function(e){return Pie(e,gNe)};var je=aa;var vL=`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 lx=`#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 Iie={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};Iie.NUMBER_OF_CLASSIFICATION_TYPES=3;var Ei=Object.freeze(Iie);var yNe={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},jc=Object.freeze(yNe);var DL={STREAM_DRAW:Z.STREAM_DRAW,STATIC_DRAW:Z.STATIC_DRAW,DYNAMIC_DRAW:Z.DYNAMIC_DRAW,validate:function(e){return e===DL.STREAM_DRAW||e===DL.STATIC_DRAW||e===DL.DYNAMIC_DRAW}},We=Object.freeze(DL);function hf(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}hf.createVertexBuffer=function(e){return new hf({context:e.context,bufferTarget:Z.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};hf.createIndexBuffer=function(e){let t=e.context,n=e.indexDatatype,i=Ge.getSizeInBytes(n),o=new hf({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(hf.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});hf.prototype._getBuffer=function(){return this._buffer};hf.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)};hf.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)};hf.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)};hf.prototype.isDestroyed=function(){return!1};hf.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),fe(this)};var Pt=hf;function xNe(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 Rie(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 Pp(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)xNe(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 BNe(e){return e===1?"float":`vec${e}`}function LNe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function NNe(e,t){let i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=BNe(o),a=LNe(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!==ct.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===ct.UNSIGNED_BYTE&&i.componentDatatype===X.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0;
`:e._pixelDatatype===ct.FLOAT&&i.componentDatatype===X.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0;
`),u+=` return value;
}
`,u}Ip.prototype.getVertexShaderCallback=function(){let e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
`;t+=`${MNe(this)}
`;let n=e.length;for(let i=0;i<n;++i)t+=NNe(this,i);return function(i){let o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
${t}
${s}`}};Ip.prototype.isDestroyed=function(){return!1};Ip.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),fe(this)};var FT=Ip;function FNe(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 KG(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 VNe(e){let t=e.length;for(let n=0;n<t;++n){let i=e[n];l(i.geometry)?KG(i.geometry,n):l(i.westHemisphereGeometry)&&l(i.eastHemisphereGeometry)&&(KG(i.westHemisphereGeometry,n),KG(i.eastHemisphereGeometry,n))}}function kNe(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(FNe(t,a,o),!o)for(c=0;c<d;++c)l(t[c].geometry)&&di.splitLongitude(t[c]);if(VNe(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 $G(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 UNe(e,t){let n=[];return $G(e,"geometry",t,n),$G(e,"westHemisphereGeometry",t,n),$G(e,"eastHemisphereGeometry",t,n),n}var Op={};Op.combineGeometry=function(e){let t,n,i=e.instances,o=i.length,r,s,a=!1;o>0&&(t=kNe(e),t.length>0&&(n=di.createAttributeLocations(t[0]),e.createPickOffsets&&(r=UNe(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 zNe(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 HNe(e,t){let n=e.length;for(let i=0;i<n;++i)zNe(e[i],t)}function GNe(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}Op.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(`
`)};Hr._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};Hr._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 Fie(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 Vie(e){return`varying vec4 v_pickColor;
${e}`}Hr._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};Hr._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};Hr._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 kie(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 tFe(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 nFe(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 Uie(e,t){let n=e.vertexAttributes}function iFe(e,t){return function(){return e[t]}}var ZG=Math.max(Kt.hardwareConcurrency-1,1),IL,oFe=new ao("combineGeometry");function rFe(e,t){let n,i,o,r,s=e._instanceIds;if(e._state===Qr.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(IL))for(IL=new Array(ZG),o=0;o<ZG;o++)IL[o]=new ao("createGeometry");let f;for(u=yR(u,ZG),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(IL[o].scheduleTask({subTasks:u[o]},m))}e._state=Qr.CREATING,Promise.all(c).then(function(d){e._createGeometryResults=d,e._state=Qr.CREATED}).catch(function(d){Ww(e,t,Qr.FAILED,d)})}else if(e._state===Qr.CREATED){let a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let c=t.scene3DOnly,u=t.mapProjection,f=oFe.scheduleTask(VT.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=Qr.COMBINING,Promise.resolve(f).then(function(d){let p=VT.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=Qr.COMBINED):Ww(e,t,Qr.FAILED,void 0)}).catch(function(d){Ww(e,t,Qr.FAILED,d)})}}function sFe(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)?_=JNe(p):_=p.constructor.createGeometry(p),o[c++]=QNe(s,_),r.push(s.id)}o.length=c;let u=t.scene3DOnly,f=t.mapProjection,d=VT.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=Qr.COMBINED):Ww(e,t,Qr.FAILED,void 0)}function aFe(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),$ie(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 mf(e,t,n){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};let i=new QG;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;let o=new QG;if(o.requiresTextureCoordinates=e,n instanceof Mn)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}mf.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 Mn&&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 Mn||(o=t.material.shaderSource),new je({defines:i,sources:[o,jw]})};mf.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:[jw],pickColorQualifier:"varying"})};mf.prototype.createVertexShader=function(e,t,n,i){return ooe(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};mf.prototype.createPickVertexShader=function(e,t,n,i){return ooe(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};var Zie=new h,Jie=new _e,Qie={high:0,low:0};function ooe(e,t,n,i,o,r,s,a){let c=i.slice();if(a.eastMostYhighDefine===""){let u=Jie;u.longitude=I.PI,u.latitude=0,u.height=0;let f=s.project(u,Zie),d=yi.encode(f.x,Qie);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=Jie;p.longitude=-I.PI,p.latitude=0,p.height=0;let _=s.project(p,Zie);d=yi.encode(_.x,Qie),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 Mn&&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 QG(){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(QG.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 UFe(e,t){let n=t.context,i=e._primitive,o=vL;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=ei._appendDistanceDisplayConditionToShader(i,o),o=ei._modifyShaderPosition(e,o,t.scene3DOnly),o=ei._updateColorAttribute(i,o);let r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=kFe(i,o));let a=e._extruded?"EXTRUDED_GEOMETRY":"",c=new je({defines:[a],sources:[o]}),u=new je({sources:[lx]}),f=e._primitive._attributeLocations,d=new pf(s,r,e.appearance);if(e._spStencil=_n.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f}),e._primitive.allowPicking){let m=je.createPickVertexShaderSource(o);m=ei._appendShowToShader(i,m),m=ei._updatePickColorAttribute(m);let x=d.createPickFragmentShader(!1),C=d.createPickVertexShader([a],m,!1,t.mapProjection);if(e._spPick=_n.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=_n.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});o=ei._appendShowToShader(i,o),c=new je({defines:[a],sources:[o]}),e._sp=_n.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=_n.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 zFe(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 mt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=_,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Se.TERRAIN_CLASSIFICATION,s=mt.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 mt({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=mt.shallowClone(r,r.derivedCommands.tileset),s.pass=Se.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let C=mt.shallowClone(r,r.derivedCommands.appearance2D);C.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=C,C=mt.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[_]=mt.shallowClone(t[p],f[_]);m.shaderProgram=d,m.pass=Se.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,p+=2}}function HFe(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 mt({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=mt.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 LL=`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 NL=`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 FL=`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 VL=`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 _f=`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 o6=`${_f}
${VL}`,e2e=BT;Kt.isInternetExplorer()||(o6=`#define CLIP_POLYLINE
${o6}`);function dx(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=!1,i=dx.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,o6),this._fragmentShaderSource=y(e.fragmentShaderSource,e2e),this._renderState=Mo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(dx.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}}});dx.VERTEX_FORMAT=Fe.POSITION_ONLY;dx.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;dx.prototype.isTranslucent=Mo.prototype.isTranslucent;dx.prototype.getRenderState=Mo.prototype.getRenderState;var bs=dx;var kL=`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 zT=`#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 r6=`${_f}
${kL}`,t2e=zT;Kt.isInternetExplorer()||(r6=`#define CLIP_POLYLINE
${r6}`);function hx(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=!1,i=hx.VERTEX_FORMAT;this.material=l(e.material)?e.material:Bo.fromType(Bo.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,r6),this._fragmentShaderSource=y(e.fragmentShaderSource,t2e),this._renderState=Mo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(hx.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}}});hx.VERTEX_FORMAT=Fe.POSITION_AND_ST;hx.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;hx.prototype.isTranslucent=Mo.prototype.isTranslucent;hx.prototype.getRenderState=Mo.prototype.getRenderState;var Na=hx;function Rp(e){e=y(e,y.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;l(t)||(t=new Na),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=moe(!1),this._renderState3DTiles=moe(!0),this._renderStateMorph=Ze.fromCache({cull:{enabled:!0,face:Ao.FRONT},depthTest:{enabled:!0},blending:zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(Rp.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}}});Rp.initializeTerrainHeights=function(){return ki.initialize()};function n2e(e,t,n){let i=t.context,o=e._primitive,r=o._attributeLocations,s=o._batchTable.getVertexShaderCallback()(FL);s=ei._appendShowToShader(o,s),s=ei._appendDistanceDisplayConditionToShader(o,s),s=ei._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(NL);a=ei._appendShowToShader(o,a),a=ei._appendDistanceDisplayConditionToShader(o,a),a=ei._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()(BL),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=_n.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()(LL);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 GL=`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 WL=`attribute vec4 position;
attribute vec3 cubeMapCoordinates;
varying vec3 v_cubeMapCoordinates;
void main()
{
gl_Position = position;
v_cubeMapCoordinates = cubeMapCoordinates;
}
`;function _x(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=>{l6(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(_x.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}}});_x.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};var R2e=new h(1,0,0),M2e=new h(0,0,1),B2e=new h(-1,0,0),L2e=new h(0,0,-1),jL=new h(0,1,0),N2e=new h(0,-1,0),voe=[jL,B2e,M2e,N2e,R2e,jL,L2e,jL,jL],Doe=voe.length,Poe=new Float32Array(Doe*3),Soe=0;for(let e=0;e<Doe;++e,Soe+=3)h.pack(voe[e],Poe,Soe);var F2e=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),V2e=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 k2e(e){let t=Pt.createVertexBuffer({context:e,typedArray:F2e,usage:We.STATIC_DRAW}),n=Pt.createVertexBuffer({context:e,typedArray:Poe,usage:We.STATIC_DRAW}),i=Pt.createIndexBuffer({context:e,typedArray:V2e,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 Pi({context:e,attributes:o,indexBuffer:i})}function woe(e){return function(){return e}}function l6(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}_x.prototype.update=function(e){let t=e.context;if(!_x.isSupported(t)||(l(this._texture)&&l(this._va)&&l6(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;sc(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?ct.HALF_FLOAT:ct.FLOAT;let r=It.RGBA,s=new je({defines:i,sources:[GL]});this._va=k2e(t),this._sp=_n.fromCache({context:t,vertexShaderSource:WL,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 Wc({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 Sd({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:woe(x)},outputTexture:A,persists:!0,owner:this});e.commandList.push(T),d[`texture${_}`]=woe(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 Sd({fragmentShaderSource:HL,uniformMap:d,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(p),this._completeLoad()};_x.prototype.isDestroyed=function(){return!1};_x.prototype.destroy=function(){return l6(this),this._texture=this._texture&&this._texture.destroy(),fe(this)};var fu=_x;function Xc(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));
}
`}No.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;let i=this;return function(o){let r=Noe(o,n,!1),s;return rn.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}
${u3e(i)}${s}`}};function Boe(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 f3e(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 Noe(e,t,n){if(!l(t))return Boe(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`),o=e.match(i);if(!l(o))return Boe(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=f3e(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}No.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=Noe(i,t,!0),rn.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}};No.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=je.replaceMain(e,"tile_main"),rn.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 d3e(e){let t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===du.HIGHLIGHT)return 0;if(n===du.REPLACE)return 1;if(n===du.MIX)return I.clamp(i,I.EPSILON4,1)}No.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 d3e(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};No.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};var kg={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};No.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=h3e(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=m3e(f),f.dirty=!1);let p=d.originalCommand;c!==kg.ALL_OPAQUE&&f.pass!==Se.TRANSLUCENT&&(l(d.translucent)||(d.translucent=p3e(p))),c!==kg.ALL_TRANSLUCENT&&f.pass!==Se.TRANSLUCENT&&(l(d.opaque)||(d.opaque=_3e(p)),a&&(r||(l(d.zback)||(d.zback=y3e(e.context,p)),s._backfaceCommands.push(d.zback)),(!l(d.stencil)||o._selectionDepth!==C3e(d.stencil))&&(f.renderState.depthMask?d.stencil=x3e(p,o._selectionDepth):d.stencil=d.opaque)));let _=a?d.stencil:d.opaque,m=d.translucent;f.pass!==Se.TRANSLUCENT?(c===kg.ALL_OPAQUE&&(n[u]=_),c===kg.ALL_TRANSLUCENT&&(n[u]=m),c===kg.OPAQUE_AND_TRANSLUCENT&&(n[u]=_,n.push(m))):n[u]=p}};function h3e(e){let t=e._batchTexture.translucentFeaturesLength;return t===0?kg.ALL_OPAQUE:t===e.featuresLength?kg.ALL_TRANSLUCENT:kg.OPAQUE_AND_TRANSLUCENT}function m3e(e){let t=mt.shallowClone(e),n=t.pass===Se.TRANSLUCENT;return t.uniformMap=l(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function p3e(e){let t=mt.shallowClone(e);return t.pass=Se.TRANSLUCENT,t.renderState=A3e(e.renderState),t}function _3e(e){let t=mt.shallowClone(e);return t.renderState=T3e(e.renderState),t}function g3e(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 y3e(e,t){let n=mt.shallowClone(t),i=ht(n.renderState,!0);i.cull.enabled=!0,i.cull.face=Ao.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=ht(t.uniformMap);let o=new W(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=g3e(e,t.shaderProgram),n}function x3e(e,t){let n=mt.shallowClone(e),i=ht(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=Yi.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=ln.REPLACE,i.stencilTest.backFunction=Yi.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 C3e(e){return(e.renderState.stencilTest.reference&On.SKIP_LOD_MASK)>>>On.SKIP_LOD_BIT_SHIFT}function A3e(e){let t=ht(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=zn.ALPHA_BLEND,t.stencilTest=On.setCesium3DTileBit(),t.stencilMask=On.CESIUM_3D_TILE_MASK,Ze.fromCache(t)}function T3e(e){let t=ht(e,!0);return t.stencilTest=On.setCesium3DTileBit(),t.stencilMask=On.CESIUM_3D_TILE_MASK,Ze.fromCache(t)}No.prototype.update=function(e,t){this._batchTexture.update(e,t)};No.prototype.isDestroyed=function(){return!1};No.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),fe(this)};var Bl=No;function hu(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(hu.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)}}});hu.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};hu.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)};hu.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};hu.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};hu.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 de(o))}};fo.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(fo.getFailedLoadFunction(e,"buffer",r.url))}})};var vVe=new h,DVe=new h;fo.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=fo.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=fo.getAccessorMinMax(t,E);if(l(S.min)&&l(S.max)){let w=h.fromArray(S.min,0,vVe),D=h.fromArray(S.max,0,DVe);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=fo.getTransform(A),O.multiplyTransformation(p,A._transformToRoot,A._transformToRoot),s.push(A)}}delete d._transformToRoot}}let u=re.fromCornerPoints(a,c);return e.forwardAxis===ui.Z&&re.transformWithoutScale(u,ui.Z_UP_TO_X_UP,u),e._upAxis===ui.Y?re.transformWithoutScale(u,ui.Y_UP_TO_Z_UP,u):e._upAxis===ui.X&&re.transformWithoutScale(u,ui.X_UP_TO_Z_UP,u),u};function PVe(e,t){return we.techniqueAttribute(e,function(n,i){if(n.semantic===t)return i})}function IVe(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(PVe(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 ${fo.getShaderVariable(C.type)} ${T};
${S}`,E.source=S}}fo.ensureSemanticExistence=function(e){return we.mesh(e,function(t){we.meshPrimitive(t,function(n){IVe(e,n)})}),e};fo.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};fo.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 qoe(e,t,n,i){return dr(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}}fo.getAttributeOrUniformBySemantic=function(e,t,n,i){return we.technique(e,function(o){if(l(n)&&o.program!==n)return;let r=we.techniqueAttribute(o,qoe(e,o,t,i));return l(r)?r:we.techniqueUniform(o,qoe(e,o,t,i))})};fo.getDiffuseAttributeOrUniform=function(e,t){let n=fo.getAttributeOrUniformBySemantic(e,"COLOR_0",t);return l(n)||(n=fo.getAttributeOrUniformBySemantic(e,"_3DTILESDIFFUSE",t)),n};var OVe=new h,RVe=new ke,MVe=new h;fo.getTransform=function(e,t){return l(e.matrix)?O.fromColumnMajorArray(e.matrix,t):O.fromTranslationQuaternionRotationScale(h.fromArray(e.translation,0,OVe),ke.unpack(e.rotation,0,RVe),h.fromArray(e.scale,0,MVe),t)};fo.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};fo.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};fo.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};fo.checkSupportedExtensions=function(e,t){for(let n in e)if(e.hasOwnProperty(n)){if(!fo.supportedExtensions[n])throw new de(`Unsupported glTF Extension: ${n}`);if(n==="EXT_texture_webp"&&t===!1)throw new de("Loaded model requires WebP but browser does not support it.")}};fo.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 de(`Unsupported WebGL Extension: ${o}`);if(!t.elementIndexUint)throw new de("OES_element_index_uint WebGL extension is not enabled.")}}};function h6(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 BVe(e,t){let i=e.accessors[t].extensions;if(l(i))return i.WEB3D_quantized_attributes}function Yoe(e,t,n){let i=t.material,o=e.materials[i];if(!dr(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})}fo.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=Yoe(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=h6(n,c,d);let _;a.octEncoded?_="vec3":p>1?_=`vec${p}`:_="float",n=`${_} ${d};
${n}`;let m=p===3&&r==="COLOR_0";m&&(n=h6(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}};fo.modifyShaderForQuantizedAttributes=function(e,t,n){let i={},o=t.attributes;for(let r in o)if(o.hasOwnProperty(r)){let s=Yoe(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=BVe(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=h6(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 ab(e){let t={value:e,clone:function(n,i){return n},func:function(){return t.value}};return t}function sN(e){let t={value:W.fromArray(e),clone:W.clone,func:function(){return t.value}};return t}function aN(e){let t={value:h.fromArray(e),clone:h.clone,func:function(){return t.value}};return t}function cb(e){let t={value:ae.fromArray(e),clone:ae.clone,func:function(){return t.value}};return t}function m6(e){let t={value:so.fromColumnMajorArray(e),clone:so.clone,func:function(){return t.value}};return t}function p6(e){let t={value:Q.fromColumnMajorArray(e),clone:Q.clone,func:function(){return t.value}};return t}function rN(e){let t={value:O.fromColumnMajorArray(e),clone:O.clone,func:function(){return t.value}};return t}function cN(e,t,n){this._value=void 0,this._textureId=e.index,this._textures=t,this._defaultTexture=n}Object.defineProperties(cN.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}}});cN.prototype.clone=function(e){return e};cN.prototype.func=void 0;function LVe(e,t,n){let i=new cN(e,t,n);return i.func=function(){return i.value},i}var Fa={};Fa[Z.FLOAT]=ab;Fa[Z.FLOAT_VEC2]=sN;Fa[Z.FLOAT_VEC3]=aN;Fa[Z.FLOAT_VEC4]=cb;Fa[Z.INT]=ab;Fa[Z.INT_VEC2]=sN;Fa[Z.INT_VEC3]=aN;Fa[Z.INT_VEC4]=cb;Fa[Z.BOOL]=ab;Fa[Z.BOOL_VEC2]=sN;Fa[Z.BOOL_VEC3]=aN;Fa[Z.BOOL_VEC4]=cb;Fa[Z.FLOAT_MAT2]=m6;Fa[Z.FLOAT_MAT3]=p6;Fa[Z.FLOAT_MAT4]=rN;Fa[Z.SAMPLER_2D]=LVe;fo.createUniformFunction=function(e,t,n,i){return Fa[e](t,n,i)};function NVe(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 FVe(e){return[e[20],e[21],e[22],e[23]]}fo.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]=ab(f).func;continue}let s=`${r}_normConstant`,a=o.range/(1<<o.quantizationBits);t[s]=ab(a).func;let c=`${r}_min`;switch(i.componentsPerAttribute){case 1:t[c]=ab(o.minValues).func;break;case 2:t[c]=sN(o.minValues).func;break;case 3:t[c]=aN(o.minValues).func;break;case 4:t[c]=cb(o.minValues).func;break}}return t};fo.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 xn.SCALAR:r[_]=m6(p).func,o[_]=!0;break;case xn.VEC2:r[_]=p6(p).func,o[_]=!0;break;case xn.VEC3:r[_]=rN(p).func,o[_]=!0;break;case xn.VEC4:m=`${_}_scale`,x=`${_}_translate`,r[m]=rN(NVe(p)).func,r[x]=cb(FVe(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]=m6(so.IDENTITY).func:c.mat===3?r[a]=p6(Q.IDENTITY).func:c.mat===4&&(r[a]=rN(O.IDENTITY).func)),l(c.vec)&&c.vec===4&&(r[a]=cb([0,0,0,0]).func)}return r};var sb=new h,VVe={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,sb),h.add(sb,t._rtcCenter,sb),O.multiplyByPoint(e.view,sb,sb),O.setTranslation(e.modelView,sb,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:dr(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=Xoe(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 ${vg(z.type)} ${S}${V};
`,delete z.useInFragment):C+=`uniform ${vg(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=Fo(a,{type:Z.VERTEX_SHADER,extras:{_pipeline:{source:C,extension:".glsl"}}}),F=Fo(a,{type:Z.FRAGMENT_SHADER,extras:{_pipeline:{source:A,extension:".glsl"}}}),k=Fo(c,{fragmentShader:F,vertexShader:B});return Fo(s,{attributes:R,program:k,uniforms:E})}function Xoe(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 HVe(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}:${Xoe(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 GVe(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 lb=kVe;function WVe(e,t){if(t=y(t,y.EMPTY_OBJECT),dr(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=Sn.splitIncompatibleMaterials(e);return we.material(e,function(i,o){let r={},s=KVe(e,i,o,r,n,t);l(i.extensions)||(i.extensions={}),i.extensions.KHR_techniques_webgl={values:r,technique:s}}),Sn.ensureSemanticExistence(e),e}function jVe(e){return l(e.extensions)&&l(e.extensions.KHR_materials_pbrSpecularGlossiness)}function yx(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 qVe=[0,0],YVe=[0],XVe=[1,1];function _6(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,qVe),n[`${i}Rotation`]=y(o.rotation,YVe),n[`${i}Scale`]=y(o.scale,XVe),l(t.texCoord)&&l(o.texCoord)&&(n[i].texCoord=o.texCoord)}function KVe(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=jVe(t),p,_,m;if(!d){let Pe=t.pbrMetallicRoughness;if(l(Pe))for(_ in Pe)Pe.hasOwnProperty(_)&&(m=Pe[_],p=`u_${_}`,i[p]=m,_6(_,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,_6(_,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,_6(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(et){if(et.material===n){let Yt=et.targets;l(Yt)&&(B=Yt)}})});let F={u_modelViewMatrix:{semantic:dr(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:$Ve(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],et=l(Pe.count)?`[${Pe.count}]`:"";Pe.type!==Z.FLOAT_MAT3&&Pe.type!==Z.FLOAT_MAT4&&p!=="u_morphWeights"||Pe.useInFragment?(C+=`uniform ${vg(Pe.type)} ${p}${et};
`,delete Pe.useInFragment):x+=`uniform ${vg(Pe.type)} ${p}${et};
`}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 et=B[Pe];for(let Yt in et)if(et.hasOwnProperty(Yt)&&Yt!=="extras"){let tn=`a_${Yt}_${Pe}`;V[tn]={semantic:`${Yt}_${Pe}`},x+=`attribute vec3 ${tn};
`,Yt==="POSITION"?z+=` weightedPosition += u_morphWeights[${Pe}] * ${tn};
`:Yt==="NORMAL"?z+=` weightedNormal += u_morphWeights[${Pe}] * ${tn};
`:N&&Yt==="TANGENT"&&(z+=` weightedTangent.xyz += u_morphWeights[${Pe}] * ${tn};
`)}}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,he,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 et=j.replace("0","1");x+=`attribute vec2 a_texcoord_1;
`,x+=`varying vec2 ${et};
`,z+=` ${et} = a_texcoord_1;
`,C+=`varying vec2 ${et};
`}let Pe={fragmentShaderMain:Y};$=yx(e,"u_normalTexture",i,j,Pe),G=yx(e,"u_baseColorTexture",i,j,Pe),K=yx(e,"u_specularGlossinessTexture",i,j,Pe),J=yx(e,"u_diffuseTexture",i,j,Pe),ce=yx(e,"u_metallicRoughnessTexture",i,j,Pe),he=yx(e,"u_occlusionTexture",i,j,Pe),oe=yx(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, ${he}).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=Fo(u,{type:Z.VERTEX_SHADER,extras:{_pipeline:{source:x,extension:".glsl"}}}),ge=Fo(u,{type:Z.FRAGMENT_SHADER,extras:{_pipeline:{source:C,extension:".glsl"}}}),De=Fo(f,{fragmentShader:ge,vertexShader:le});return Fo(c,{attributes:V,program:De,uniforms:F})}function $Ve(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 ub=WVe;function ZVe(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var yf=ZVe;var mv=`attribute vec3 position;
attribute float a_batchId;
uniform mat4 u_modifiedModelViewProjection;
void main()
{
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
}
`;var xx=pl(Koe(),1);var JVe={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},Mt=Object.freeze(JVe);function wd(e,t){this._expression=e,e=fke(e,t),e=hke(dke(e)),xx.default.addBinaryOp("=~",0),xx.default.addBinaryOp("!~",0);let n;try{n=(0,xx.default)(e)}catch(i){throw new de(i)}this._runtimeAst=Xi(this,n)}Object.defineProperties(wd.prototype,{expression:{get:function(){return this._expression}}});var ri={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++]}};wd.prototype.evaluate=function(e,t){ri.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};wd.prototype.evaluateColor=function(e,t){ri.reset();let n=this._runtimeAst.evaluate(e);return H.fromCartesian4(n,t)};wd.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
{
return ${o};
}
`,o};wd.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};wd.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var QVe=["!","-","+"],$oe=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],dN=/\${(.*?)}/g,eke=/\\/g,tke="@#%",nke=/@#%/g,hN=new H,mN={abs:qs(Math.abs),sqrt:qs(Math.sqrt),cos:qs(Math.cos),sin:qs(Math.sin),tan:qs(Math.tan),acos:qs(Math.acos),asin:qs(Math.asin),atan:qs(Math.atan),radians:qs(I.toRadians),degrees:qs(I.toDegrees),sign:qs(I.sign),floor:qs(Math.floor),ceil:qs(Math.ceil),round:qs(Math.round),exp:qs(Math.exp),exp2:qs(oke),log:qs(Math.log),log2:qs(rke),fract:qs(ike),length:ske,normalize:ake},pN={atan2:uN(Math.atan2,!1),pow:uN(Math.pow,!1),min:uN(Math.min,!0),max:uN(Math.max,!0),distance:cke,dot:lke,cross:uke},x6={clamp:Zoe(I.clamp,!0),mix:Zoe(I.lerp,!0)};function ike(e){return e-Math.floor(e)}function oke(e){return Math.pow(2,e)}function rke(e){return I.log2(e)}function qs(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),ri.getCartesian2());if(n instanceof h)return h.fromElements(e(n.x),e(n.y),e(n.z),ri.getCartesian3());if(n instanceof ae)return ae.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),ri.getCartesian4());throw new de(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function uN(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),ri.getCartesian2());if(i instanceof h)return h.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),ri.getCartesian3());if(i instanceof ae)return ae.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),ri.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),ri.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),ri.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),ri.getCartesian4());throw new de(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function Zoe(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),ri.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),ri.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),ri.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),ri.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),ri.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),ri.getCartesian4());throw new de(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function ske(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 de(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function ake(e,t){if(typeof t=="number")return 1;if(t instanceof W)return W.normalize(t,ri.getCartesian2());if(t instanceof h)return h.normalize(t,ri.getCartesian3());if(t instanceof ae)return ae.normalize(t,ri.getCartesian4());throw new de(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function cke(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=_n.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}let a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(mv),c=n.getFragmentShaderCallback(!1,void 0,!0)(lx);o=n.getPickId();let u=new je({sources:[a]}),f=new je({defines:["VECTOR_TILE"],sources:[c]});e._sp=_n.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),u=new je({sources:[mv]}),f=new je({defines:["VECTOR_TILE"],sources:[lx]}),e._spStencil=_n.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=_n.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:i})}function nre(e){let t=e?Yi.EQUAL:Yi.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:jc.LESS_OR_EQUAL},depthMask:!1}}var Rke={stencilTest:{enabled:!0,frontFunction:Yi.NOT_EQUAL,frontOperation:{fail:ln.ZERO,zFail:ln.ZERO,zPass:ln.ZERO},backFunction:Yi.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:zn.PRE_MULTIPLIED_ALPHA_BLEND},Mke={stencilTest:{enabled:!0,frontFunction:Yi.NOT_EQUAL,frontOperation:{fail:ln.ZERO,zFail:ln.ZERO,zPass:ln.ZERO},backFunction:Yi.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 Bke(e){l(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Ze.fromCache(nre(!1)),e._rsStencilDepthPass3DTiles=Ze.fromCache(nre(!0)),e._rsColorPass=Ze.fromCache(Rke),e._rsPickPass=Ze.fromCache(Mke))}var Ax=new O,ire=new h;function Lke(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,Ax),O.multiplyByPoint(Ax,e._center,ire),O.setTranslation(Ax,ire,Ax),O.multiply(o,Ax,Ax),Ax},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function C6(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 Nke(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=C6(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=C6(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=C6(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 A6(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 Fke(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=A6(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=A6(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=A6(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 Vke(e,t){return t.color.toRgba()-e.color.toRgba()}function kke(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(Vke),t.webgl2?Fke(e,n):Nke(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function Uke(e,t){let n=kke(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 mt({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 _=Sn.getAttributeOrUniformBySemantic(t,"PROJECTION"),m=Sn.getAttributeOrUniformBySemantic(t,"MODELVIEW");l(m)||(m=Sn.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=nUe(u,e));let d=rre(u,e._vertexShaderLoaded),p=rre(f,e._classificationShaderLoaded);e._shaderProgram={vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:o}}function oUe(){return{POSITION:0,_BATCHID:1}}function rUe(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=oUe(),u={};we.meshPrimitiveAttribute(a,function(d,p){let _=c[p];if(l(_)){let m=o[d];u[p]={index:_,vertexBuffer:n[m.bufferView],componentsPerAttribute:Bs(m.type),componentDatatype:m.componentType,offsetInBytes:m.byteOffset,strideInBytes:Ls(i,m)}}});let f;if(l(a.indices)){let d=o[a.indices];f=n[d.bufferView]}e._vertexArray={attributes:u,indexBuffer:f}}var sre={PROJECTION:function(e,t){return Sn.getGltfSemanticUniforms().PROJECTION(e,t)},MODELVIEW:function(e,t){return Sn.getGltfSemanticUniforms().MODELVIEW(e,t)},CESIUM_RTC_MODELVIEW:function(e,t){return Sn.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(e,t)},MODELVIEWPROJECTION:function(e,t){return Sn.getGltfSemanticUniforms().MODELVIEWPROJECTION(e,t)}};function sUe(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(sre[o.semantic])||(n[r]=sre[o.semantic](t.uniformState,e))})}),e._uniformMap=n}function aUe(e,t){return Sn.createUniformsForQuantizedAttributes(e.gltf,t,e._quantizedUniforms)}function cUe(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 lUe(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=Sn.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+=cUe(a,_),l(e._uniformMapLoaded)&&(n=e._uniformMapLoaded(n)),e.extensionsUsed.WEB3D_quantized_attributes){let Y=aUe(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 yf({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 yf({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 Wg({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 uUe(e){if(!e._loadResources.finished()||l(e._primitive))return;let o=e.gltf.nodes[0];e._nodeMatrix=Sn.getTransform(o,e._nodeMatrix),lUe(e)}function are(e,t){let n=t.context;Sn.checkSupportedGlExtensions(e.gltf.glExtensionsUsed,n),tUe(e),iUe(e),rUe(e),sUe(e,n),uUe(e)}var fUe=new ae,T6=new O;function dUe(e,t,n,i){let o=e._computedModelMatrix;if(e._mode!==te.SCENE3D&&!e._ignoreCommands){let s=O.getColumn(o,3,fUe);if(!ae.equals(s,ae.UNIT_W))o=Ut.basisTo2D(i,o,T6),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 mb=xUe;var CUe=new W;function AUe(e,t){let n=e.unionClippingRegions,i=e.length,o=Ys.useFloatTexture(t),r=Ys.getTextureResolution(e,t,CUe),s=r.x,a=r.y,c=o?EUe(s,a):SUe(s,a);return c+=`
`,c+=n?TUe(i):bUe(i),c}function TUe(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 bUe(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 EUe(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 SUe(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 qg=AUe;var wUe={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},Es=Object.freeze(wUe);function yN(){}var vUe=/^data\:/i;function Tre(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*Bs(t.type),u=vUe.test(s.uri)?"":s.uri;return`${e.cacheKey}//${u}/${a}/${c}`}var xre={};yN.getAnimationParameterValues=function(e,t){let n=Tre(e,t),i=xre[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,_=Bs(p),m=t.count,x=Ls(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)&&(xre[n]=i)}return i};var Cre={};function DUe(e,t,n){return`${e.cacheKey}//${t}/${n}`}function pb(e){this._spline=e,this._lastTimeIndex=0}pb.prototype.findTimeInterval=Co.prototype.findTimeInterval;pb.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(pb.prototype,{times:{get:function(){return this._spline.times}}});pb.prototype.wrapTime=function(e){return this._spline.wrapTime(e)};pb.prototype.clampTime=function(e){return this._spline.clampTime(e)};yN.getAnimationSpline=function(e,t,n,i,o,r,s,a){let c=DUe(e,t,i),u=Cre[c];if(!l(u)){let f=r,d=a;f.length===1&&d.length===1?u=new zA(d[0]):(o.interpolation==="LINEAR"||o.interpolation==="STEP")&&(s==="translation"||s==="scale"?u=new lp({times:f,points:d}):s==="rotation"?u=new gT({times:f,points:d}):s==="weights"&&(u=new WO({times:f,weights:d})),l(u)&&o.interpolation==="STEP"&&(u=new pb(u))),l(e.cacheKey)&&(Cre[c]=u)}return u};var Are={};yN.getSkinInverseBindMatrices=function(e,t){let n=Tre(e,t),i=Are[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=Ls(o,t),C=c.byteOffset+t.byteOffset,A=Bs(_);if(i=new Array(m),p===Z.FLOAT&&_===xn.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}Are[n]=i}return i};var Tx=yN;var PUe={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},yr=Object.freeze(PUe);var la=Object.freeze({STOPPED:0,ANIMATING:1});function bre(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,yr.NONE),this._animationTime=e.animationTime,this._prevAnimationDelta=void 0,this.start=new xe,this.update=new xe,this.stop=new xe,this._state=la.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(bre.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 xN=bre;function Up(e){this.animationAdded=new xe,this.animationRemoved=new xe,this.animateWhilePaused=!1,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}Object.defineProperties(Up.prototype,{length:{get:function(){return this._scheduledAnimations.length}}});function b6(e,t,n){let i=e._model,r=i._runtime.animations[t],s=new xN(n,i,r);return e._scheduledAnimations.push(s),e.animationAdded.raiseEvent(i,s),s}Up.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}}},Yg=kUe;var UUe=new h,Xg=Sn.ModelState,zUe="model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01",HUe=I.EPSILON16;function B6(e,t){e._cachedGltf=t}function Cv(e){this._gltf=e.gltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}Object.defineProperties(Cv.prototype,{gltf:{set:function(e){this._gltf=e},get:function(){return this._gltf}}});Cv.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()||B6(o,this)}this.modelsToLoad=void 0,this.ready=!0};var $g={},vre={};function fa(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($g[t])&&$g[t].ready)n=$g[t],++n.count;else{let s=e.gltf;if(l(s)){if(s instanceof ArrayBuffer&&(s=new Uint8Array(s)),s instanceof Uint8Array){let a=Fp(s);n=new Cv({gltf:a,ready:!0})}else n=new Cv({gltf:e.gltf,ready:!0});n.count=1,l(t)&&($g[t]=n)}}B6(this,n);let i=y(e.basePath,"");this._resource=Ne.createIfNeeded(i);let o=e.credit;typeof o=="string"&&(o=new pn(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,Qe.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=xs(),this.activeAnimations=new AN(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,Xs.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,Ss.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,ui.Y),this._gltfForwardAxis=ui.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=Xg.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 Tv(e,t,n){return l(n)&&(e=n(e,t)),e}var U6=function(){this.programToCreate=void 0,this.model=void 0,this.context=void 0};U6.prototype.set=function(e,t,n){this.programToCreate=e,this.model=t,this.context=n};U6.prototype.execute=function(){jre(this.programToCreate,this.model,this.context)};function jre(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=Wre(a,i,t),u[i]=m),a=m}let f=Tv(a,i,t._vertexShaderLoaded),d=Tv(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);
}
`),fu.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}`),qre(i,o,d,f,t,n)}function l4e(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=N6(t),f=s[r.vertexShader],d=s[r.fragmentShader];(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader)&&(f=a[i]);let p=d;L6(t)&&(p=fa._modifyShaderForColor(p)),u&&(p=dze(p,c,n)),t.splitDirection!==Ss.NONE&&(p=Yg.modifyFragmentShader(p));let _=Tv(f,i,t._vertexShaderLoaded),m=Tv(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);
}
`),fu.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}`),qre(i,o,m,_,t,n)}function qre(e,t,n,i,o,r){let s=o._sourceTechniques[t],a=Sn.createAttributeLocations(s,o._precreatedAttributes);o._rendererResources.programs[e]=_n.fromCache({context:r,vertexShaderSource:i,fragmentShaderSource:n,attributeLocations:a})}var Ire=new U6;function u4e(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&&(Ire.set(i.peek(),e,o),!!t.jobScheduler.execute(Ire,Es.PROGRAM));)i.dequeue();else for(;i.length>0;)jre(i.dequeue(),e,o)}function f4e(e,t){return function(n){e.texturesToCreate.enqueue({id:t.id,image:n,bufferView:void 0}),--e.pendingBufferViewToImage}}function d4e(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=Sn.getFailedLoadFunction(e,"image",`id: ${n.id}, bufferView: ${n.bufferView}`);if(n.mimeType==="image/ktx2"){let a=new Uint8Array(t.getBuffer(o));sc(a).then(zre(e,n.id,r)).catch(s),++e._loadResources.pendingTextureLoads}else{let a=f4e(t,n);hg({uint8Array:t.getBuffer(o),format:n.mimeType,flipY:!1,skipColorSpaceConversion:!0}).then(a).catch(s),++t.pendingBufferViewToImage}}}function h4e(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 Ln({wrapS:i.wrapS,wrapT:i.wrapT,minificationFilter:i.minFilter,magnificationFilter:i.magFilter})})}}var z6=function(){this.gltfTexture=void 0,this.model=void 0,this.context=void 0};z6.prototype.set=function(e,t,n){this.gltfTexture=e,this.model=t,this.context=n};z6.prototype.execute=function(){Yre(this.gltfTexture,this.model,this.context)};function Yre(e,t,n){let o=t.gltfInternal.textures[e.id],s=t._rendererResources.samplers[o.sampler];l(s)||(s=new Ln({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!==en.LINEAR&&p!==en.NEAREST&&(p===en.NEAREST_MIPMAP_NEAREST||p===en.NEAREST_MIPMAP_LINEAR?p=en.NEAREST:p=en.LINEAR,s=new Ln({wrapS:s.wrapS,wrapT:s.wrapT,minificationFilter:p,magnificationFilter:s.magnificationFilter}));let _=e.internalFormat,m=!(l(_)&&It.isCompressedFormat(_))&&(p===en.NEAREST_MIPMAP_NEAREST||p===en.NEAREST_MIPMAP_LINEAR||p===en.LINEAR_MIPMAP_NEAREST||p===en.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===en.NEAREST_MIPMAP_NEAREST||p===en.NEAREST_MIPMAP_LINEAR)?E=en.NEAREST:!l(e.mipLevels)&&(p===en.LINEAR_MIPMAP_NEAREST||p===en.LINEAR_MIPMAP_LINEAR)&&(E=en.LINEAR),s=new Ln({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 _n.fromCache({context:n.context,vertexShaderSource:i,fragmentShaderSource:s,attributeLocations:o})}function Zre(e,t){return kre(t.context)&&e.silhouetteSize>0&&e.silhouetteColor.alpha>0&&l(e._normalAttributeName)}function lze(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 R6(e){return e.color.alpha>0&&e.color.alpha<1}function Jre(e){return e.color.alpha===0}function Fre(e,t){return Math.floor(e)!==Math.floor(t)||Math.ceil(e)!==Math.ceil(t)}var uze=0;function fze(e,t){let n=++uze%255,i=lze(e)||R6(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=R6(e)?u.translucentCommand:f,p=mt.shallowClone(d),_=ht(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}},Jre(e)&&(_.colorMask={red:!1,green:!1,blue:!1,alpha:!1},_.depthMask=!1),_=Ze.fromCache(_),p.renderState=_,u.silhouetteModelCommand=p;let m=mt.shallowClone(f);_=ht(f.renderState,!0),_.depthTest.enabled=!0,_.cull.enabled=!1,i&&(m.pass=Se.TRANSLUCENT,_.depthMask=!1,_.blending=zn.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=aze(e,x),A=o[C];l(A)||(A=cze(e,x,t),o[C]=A);let T=Dt(f.uniformMap,{gltf_silhouetteColor:O4e(e),gltf_silhouetteSize:R4e(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=mt.shallowClone(p);S.boundingVolume=E.boundingVolume,S.modelMatrix=E.modelMatrix,u.silhouetteModelCommand2D=S;let w=mt.shallowClone(m);S.boundingVolume=E.boundingVolume,S.modelMatrix=E.modelMatrix,u.silhouetteColorCommand2D=w}}}function dze(e,t,n){return e=je.replaceMain(e,"gltf_clip_main"),e+=`${fa._getClippingFunction(t,n)}
`,e+=`uniform highp sampler2D gltf_clippingPlanes;
uniform mat4 gltf_clippingPlanesMatrix;
uniform vec4 gltf_clippingPlanesEdgeStyle;
void main()
{
gltf_clip_main();
${mb("gltf_clippingPlanes","gltf_clippingPlanesMatrix","gltf_clippingPlanesEdgeStyle")}}
`,e}function Qre(e,t,n){if(!Zre(e,t))return;let i=e._nodeCommands,o=i.length>0&&(Fre(e.color.alpha,e._colorPreviousAlpha)||Fre(e.silhouetteColor.alpha,e._silhouetteColorPreviousAlpha)||!l(i[0].silhouetteModelCommand));e._colorPreviousAlpha=e.color.alpha,e._silhouetteColorPreviousAlpha=e.silhouetteColor.alpha,(o||n)&&fze(e,t)}function hze(e,t){let n=e._clippingPlanes;l(n)&&n.owner===e&&n.enabled&&n.update(t)}var O6=new re;function mze(e,t,n){return O6.center=e,O6.radius=t,n.camera.getPixelSize(O6,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}var ua=new h,xv=new _e;function pze(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(ua.x=r[12],ua.y=r[13],ua.z=r[14],l(e._rtcCenter)&&h.add(e._rtcCenter,ua,ua),e._mode!==te.SCENE3D){let f=t.mapProjection,d=f.ellipsoid.cartesianToCartographic(ua,xv);f.project(d,ua),h.fromElements(ua.z,ua.x,ua.y,ua)}let s=e.boundingSphereInternal.radius,a=mze(ua,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 ese(e){l(e._cacheKey)&&l(e._cachedGltf)&&--e._cachedGltf.count===0&&delete $g[e._cacheKey],e._cachedGltf=void 0}function M6(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 Kg(e){for(let t in e)e.hasOwnProperty(t)&&e[t].destroy()}function _ze(e){Kg(e.buffers),Kg(e.vertexArrays),Kg(e.programs),Kg(e.silhouettePrograms),Kg(e.textures)}M6.prototype.release=function(){if(--this.count===0)return l(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],_ze(this),fe(this)};function Vre(e,t,n){return function(i){if(e.heightReference===Qe.RELATIVE_TO_GROUND){let r=t.cartesianToCartographic(i,xv);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 gze(e){l(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);let t=e._scene;if(!l(t)||!l(t.globe)||e.heightReference===Qe.NONE){e._clampedModelMatrix=void 0;return}let n=t.globe,i=n.ellipsoid,o=e.modelMatrix;ua.x=o[12],ua.y=o[13],ua.z=o[14];let r=i.cartesianToCartographic(ua);l(e._clampedModelMatrix)||(e._clampedModelMatrix=O.clone(o,new O));let s=n._surface;e._removeUpdateHeightCallback=s.updateHeight(r,Vre(e,i,r));let a=n.getHeight(r);if(l(a)){let c=Vre(e,i,r);_e.clone(r,xv),xv.height=a,i.cartographicToCartesian(xv,ua),c(ua)}}var yze=new h,xze=new _e;function Cze(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,yze);if(t.mode===te.COLUMBUS_VIEW){let a=t.mapProjection,u=a.ellipsoid.cartesianToCartographic(s,xze);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 Aze=new O,Tze=new Q,bze=new O;fa.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===Xg.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 M6(t,T),A.count=1,E[this.cacheKey]=A;this._cachedRendererResources=A}else A=new M6(t),A.count=1,this._cachedRendererResources=A;if(this._state=Xg.LOADING,this._state!==Xg.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 de(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 hHe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},un=Object.freeze(hHe);function Zc(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)&&(Zc.prototype=Object.create(zi.prototype),Zc.prototype.constructor=Zc);Object.defineProperties(Zc.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});Zc.prototype.load=function(){return l(this._typedArray)?this._promise=Promise.resolve(this):this._promise=mHe(this),this._promise};function mHe(e){let t=e._resource;return e._state=un.LOADING,Zc._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))})}Zc._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};Zc.prototype.unload=function(){this._typedArray=void 0};var Qwn=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=Sn.getDiffuseAttributeOrUniform(_,n);p=e._batchTable.getVertexShaderCallback(!0,"a_batchId",m)(p)}return p}}function q8e(e){return function(t,n){let i=e._batchTable;if(l(i)){let o=e._model.gltfInternal,r=Sn.getDiffuseAttributeOrUniform(o,n);t=i.getFragmentShaderCallback(!0,r,!1)(t)}else t=`varying vec4 v_pickColor;
${t}`;return t}}function Y8e(e,t){return function(){return O.multiply(t.uniformState.view,e._rtcTransform,e._rtcModelView)}}function X8e(e){return function(){return e.computedMatrix}}function K8e(e,t){return function(n,i,o){n=ht(n),n.czm_instanced_modifiedModelView=Y8e(e,t),n.czm_instanced_nodeTransform=X8e(o);let r=Hse(e,i);for(let s in r)r.hasOwnProperty(s)&&delete n[s];return l(e._batchTable)&&(n=e._batchTable.getUniformMapCallback()(n)),n}}function $8e(e){return function(t,n){if(l(e._batchTable)){let i=e._model.gltfInternal,o=Sn.getDiffuseAttributeOrUniform(i,n);t=e._batchTable.getVertexShaderCallback(!0,"a_batchId",o)(t),t=`uniform float a_batchId
;${t}`}return t}}function Z8e(e){return function(t,n){let i=e._batchTable;if(l(i)){let o=e._model.gltfInternal,r=Sn.getDiffuseAttributeOrUniform(o,n);t=i.getFragmentShaderCallback(!0,r,!1)(t)}else t=`uniform vec4 czm_pickColor;
${t}`;return t}}function J8e(e){return function(t){return l(e._batchTable)&&(t=e._batchTable.getUniformMapCallback()(t)),t}}function Gse(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,Q6);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 Q8e(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=Gse(e);e._vertexBuffer=Pt.createVertexBuffer({context:t,typedArray:a,usage:r?We.STREAM_DRAW:We.STATIC_DRAW})}function e5e(e){let t=Gse(e);e._vertexBuffer.copyFromArrayView(t)}function t5e(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 n5e(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=t5e(e,t)),n){Q8e(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=j8e(e),r.fragmentShaderLoaded=q8e(e),r.uniformMapLoaded=K8e(e,t),l(e._url)&&(r.cacheKey=`${e._url.getUrlComponent()}#instanced`)}else r.vertexShaderLoaded=$8e(e),r.fragmentShaderLoaded=Z8e(e),r.uniformMapLoaded=J8e(e,t);l(e._url)?e._model=zp.fromGltf(r):e._model=new zp(r)}function i5e(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 o5e(e){let t=ht(e,!0);return t.cull.enabled=!1,Ze.fromCache(t)}function r5e(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=o5e(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 i9(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 N5e={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 F5e(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=ht(N5e),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&&(t9(D,k),n9(D,U)),P&&(t9(R,k),n9(R,U)),B&&(t9(M,k),n9(M,U));let z=U.indexOf("COLOR")>=0,V=U.indexOf("NORMAL")>=0;if(V&&!x)throw new de("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=i9(E,r.location);le.enabled=oe}let Y=m&&(!v||z);if(m){let oe=i9(E,qN);oe.enabled=Y}let j=x&&(T||A||V);if(x){let oe=i9(E,o9);oe.enabled=j}let $={a_position:$se};Y&&($.a_color=qN),j&&($.a_normal=o9),C&&($.a_batchId=Zse);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}L5e(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+=qg(S,s),ce+=`
`),ce+=`void main()
{
gl_FragColor = czm_gammaCorrect(v_color);
`,F&&(ce+=mb("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),ce+=`}
`,e.splitDirection!==Ss.NONE&&(ce=Yg.modifyFragmentShader(ce)),l(e._vertexShaderLoaded)&&(J=e._vertexShaderLoaded(J)),l(e._fragmentShaderLoaded)&&(ce=e._fragmentShaderLoaded(ce));let he=e._drawCommand;l(he.shaderProgram)&&he.shaderProgram.destroy(),he.shaderProgram=_n.fromCache({context:s,vertexShaderSource:J,fragmentShaderSource:ce,attributeLocations:$});try{he.shaderProgram._bind()}catch{throw new de("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function V5e(e,t){if(e._decodingState===Dx.READY)return!1;if(e._decodingState===Dx.NEEDS_DECODE){let n=e._parsedContent,i=n.draco,o=Nl.decodePointCloud(i,t);l(o)&&(e._decodingState=Dx.DECODING,o.then(function(r){e._decodingState=Dx.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=Dx.FAILED,e._rejectReadyPromise(r)}))}return!0}var k5e=new ae,U5e=new h;Iv.prototype.update=function(e){let t=e.context;if(V5e(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)||(B5e(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,k5e);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,U5e);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!==Ss.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&F5e(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)};Iv.prototype.isDestroyed=function(){return!1};Iv.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 xb=Iv;function r9(e,t,n){let i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function YN(e,t,n){let i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function Rd(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 Ab(){this._framebuffer=new Gi({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(Ab.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 z5e(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}var s9=new W;function H5e(e,t){let n=new je({defines:["LOG_DEPTH_WRITE"],sources:[KN]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return s9.x=e._radius,s9.y=e._strength,s9}},o=Ze.fromCache({blending:zn.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 G5e(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),H5e(e,t)}function Jse(e){return e.drawBuffers&&e.fragmentDepth}Ab.isSupported=Jse;function W5e(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}Ab.prototype.update=function(e,t,n,i){if(!Jse(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,G5e(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=mt.shallowClone(u,f),f.framebuffer=this.framebuffer,f.shaderProgram=W5e(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)};Ab.prototype.isDestroyed=function(){return!1};Ab.prototype.destroy=function(){return z5e(this),fe(this)};var t0=Ab;function Qse(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)}Qse.isSupported=function(e){return t0.isSupported(e.context)};var Md=Qse;function Yp(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 xb({arrayBuffer:i,byteOffset:o,cull:!1,opaquePass:Se.CESIUM_3D_TILE,vertexShaderLoaded:j5e(this),fragmentShaderLoaded:q5e(this),uniformMapLoaded:Y5e(this),batchTableLoaded:X5e(this),pickIdLoaded:K5e(this)})}Object.defineProperties(Yp.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 j5e(e){return function(t){return l(e._batchTable)?e._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(t):t}}function q5e(e){return function(t){return l(e._batchTable)?e._batchTable.getFragmentShaderCallback(!1,void 0,!1)(t):`uniform vec4 czm_pickColor;
${t}`}}function Y5e(e){return function(t){return l(e._batchTable)?e._batchTable.getUniformMapCallback()(t):Dt(t,{czm_pickColor:function(){return e._pickId.color}})}}function X5e(e){return function(t,n,i){e._batchTable=new Bl(e,t,n,i)}}function K5e(e){return function(){return l(e._batchTable)?e._batchTable.getPickId():"czm_pickColor"}}function $5e(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 Z5e(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 Gr(e,i);e._features=n}}Yp.prototype.hasProperty=function(e,t){return l(this._batchTable)?this._batchTable.hasProperty(e,t):!1};Yp.prototype.getFeature=function(e){if(!l(this._batchTable))return;let t=this.featuresLength;return Z5e(this),this._features[e]};Yp.prototype.applyDebugSettings=function(e,t){this._pointCloud.color=e?t:H.WHITE};Yp.prototype.applyStyle=function(e){l(this._batchTable)?this._batchTable.applyStyle(e):this._styleDirty=!0};var J5e=new Md;Yp.prototype.update=function(e,t){let n=this._pointCloud,i=y(e.pointCloudShading,J5e),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=$5e(this),n.geometricErrorScale=i.geometricErrorScale,n.splitDirection=e.splitDirection,l(i)&&l(i.maximumAttenuation)?n.maximumAttenuation=i.maximumAttenuation:o.refine===Wr.ADD?n.maximumAttenuation=5:n.maximumAttenuation=e.maximumScreenSpaceError,n.update(t)};Yp.prototype.isDestroyed=function(){return!1};Yp.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 $N=Yp;function Xp(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=Q5e(this,i)}Object.defineProperties(Xp.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 Q5e(e,t){return e._tileset.loadTileset(e._resource,t,e._tile),Promise.resolve(e)}Xp.prototype.hasProperty=function(e,t){return!1};Xp.prototype.getFeature=function(e){};Xp.prototype.applyDebugSettings=function(e,t){};Xp.prototype.applyStyle=function(e){};Xp.prototype.update=function(e,t){};Xp.prototype.isDestroyed=function(){return!1};Xp.prototype.destroy=function(){return fe(this)};var ZN=Xp;function Ks(e,t,n,i){let o=Ks._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 QN=`#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 Ua={},iGe=new ae(0,0,0,1),hc=new ae,oGe=new it,c9=new W,l9=new W;Ua.wgs84ToWindowCoordinates=function(e,t,n){return Ua.wgs84WithEyeOffsetToWindowCoordinates(e,t,h.ZERO,n)};var eae=new ae,tae=new h;function Rv(e,t,n,i){let o=n.viewMatrix,r=O.multiplyByVector(o,ae.fromElements(e.x,e.y,e.z,1,eae),eae),s=h.multiplyComponents(t,h.normalize(r,tae),tae);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 rGe=new _e(Math.PI,I.PI_OVER_TWO),sGe=new h,aGe=new h;Ua.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){let o=e.frameState,r=Ua.computeActualWgs84Position(o,t,iGe);if(!l(r))return;let s=e.canvas,a=oGe;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=rGe,p=f.project(d,sGe),_=h.clone(c.position,aGe),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,hc=Rv(r,n,c,hc),Ua.clipToGLWindowCoordinates(a,hc,c9),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,hc=Rv(r,n,c,hc),Ua.clipToGLWindowCoordinates(a,hc,l9)}else{a.x+=E.x,a.width-=E.x,c.frustum.left=-p.x-A,hc=Rv(r,n,c,hc),Ua.clipToGLWindowCoordinates(a,hc,c9),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,hc=Rv(r,n,c,hc),Ua.clipToGLWindowCoordinates(a,hc,l9)}h.clone(_,c.position),c.frustum=m.clone(),i=W.clone(c9,i),(i.x<0||i.x>s.clientWidth)&&(i.x=l9.x)}}if(o.mode!==te.SCENE2D||u){if(hc=Rv(r,n,c,hc),hc.z<0&&!(c.frustum instanceof In)&&!(c.frustum instanceof ls))return;i=Ua.clipToGLWindowCoordinates(a,hc,i)}return i.y=s.clientHeight-i.y,i};Ua.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=Ua.wgs84ToWindowCoordinates(e,t,n),!!l(n))return Ua.transformWindowToDrawingBuffer(e,n,n)};var Kp=new h,cGe=new _e;Ua.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,cGe);if(!l(r))return;if(o.project(r,Kp),i===te.COLUMBUS_VIEW)return h.fromElements(Kp.z,Kp.x,Kp.y,n);if(i===te.SCENE2D)return h.fromElements(0,Kp.x,Kp.y,n);let s=e.morphTime;return h.fromElements(I.lerp(Kp.z,t.x,s),I.lerp(Kp.x,t.y,s),I.lerp(Kp.y,t.z,s),n)};var nae=new h,iae=new h,oae=new O;Ua.clipToGLWindowCoordinates=function(e,t,n){return h.divideByScalar(t,t.w,nae),O.computeViewportTransformation(e,0,1,oae),O.multiplyByPoint(oae,nae,iae),W.fromCartesian3(iae,n)};Ua.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 lGe=new ae,rae=new ae;Ua.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,lGe);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=rae,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,rae);let _=1/d.w;h.multiplyByScalar(d,_,d)}return h.fromCartesian4(d,i)};var Oo=Ua;function Ki(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 XGe=[];bf.prototype.update=function(e){if(g9(this),!this.show)return;let t=this._billboards,n=t.length,i=e.context;this._instanced=i.instancedArrays,$o=this._instanced?BGe:MGe,u9=this._instanced?NGe:LGe;let o=this._textureAtlas;if(!l(o)){o=this._textureAtlas=new Px({context:i});for(let M=0;M<n;++M)t[M]._loadImage()}let r=o.textureCoordinates;if(r.length===0)return;jGe(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<_9;++M)c[M]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=VGe(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,WGe(this,e,r,d,L)}this._vaf.commit(u9(i))}this._billboardsToUpdateIndex=0}else if(a>0){let M=XGe;M.length=0,(c[Lv]||c[PGe]||c[DGe])&&M.push(Eae),(c[Bv]||c[pae]||c[wGe]||c[vGe]||c[SGe])&&(M.push(Iae),this._instanced&&M.push(p9)),(c[Bv]||c[IGe]||c[xae])&&(M.push(Oae),M.push(m9)),(c[Bv]||c[gae])&&M.push(m9),c[_ae]&&M.push(p9),c[yae]&&M.push(Rae),c[Cae]&&M.push(Mae),(c[Aae]||c[OGe]||c[Bv]||c[Lv])&&M.push(Bae),(c[Bv]||c[Lv])&&M.push(Lae),c[Tae]&&M.push(Nae);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(u9(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),qGe(this,e,m);let C=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,C){this._blendOption===sr.OPAQUE||this._blendOption===sr.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ze.fromCache({depthTest:{enabled:!0,func:Z.LESS},depthMask:!0}):this._rsOpaque=void 0;let M=this._blendOption===sr.TRANSLUCENT;this._blendOption===sr.TRANSLUCENT||this._blendOption===sr.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ze.fromCache({depthTest:{enabled:!0,func:M?Z.LEQUAL:Z.LESS},depthMask:M,blending:zn.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let A,T,E,S,w,D=rn.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=QN,T=JN,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=Gae.test(o.charAt(0)),s=n6e(o,Gae),a=0,c="";for(let u=0;u<s.length;++u){let f=s[u],d=f.Type===vs.BRACKETS?o6e(f.Word):i6e(f.Word);r?f.Type===vs.RTL?(c=d+c,a=0):f.Type===vs.LTR?(c=Uv(c,a,f.Word),a+=f.Word.length):(f.Type===vs.WEAK||f.Type===vs.BRACKETS)&&(f.Type===vs.WEAK&&s[u-1].Type===vs.BRACKETS?c=d+c:s[u-1].Type===vs.RTL?(c=d+c,a=0):s.length>u+1?s[u+1].Type===vs.RTL?(c=d+c,a=0):(c=Uv(c,a,f.Word),a+=f.Word.length):c=Uv(c,0,d)):f.Type===vs.RTL?c=Uv(c,a,d):f.Type===vs.LTR?(c+=f.Word,a=c.length):(f.Type===vs.WEAK||f.Type===vs.BRACKETS)&&(u>0&&s[u-1].Type===vs.RTL?s.length>u+1?s[u+1].Type===vs.RTL?c=Uv(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 Ox=Zp;var zv=pl(jae(),1);function l6e(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function u6e(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}var f6e=1.2,Yae="ID_WHITE_PIXEL",y9=new W(4,4),d6e=new it(1,1,1,1);function h6e(e){let t=document.createElement("canvas");t.width=y9.x,t.height=y9.y;let n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(Yae,t)}var Sf={};function m6e(e,t,n,i,o,r,s){return Sf.font=t,Sf.fillColor=n,Sf.strokeColor=i,Sf.strokeWidth=o,Sf.padding=ha.PADDING,s===si.CENTER?Sf.textBaseline="middle":s===si.TOP?Sf.textBaseline="top":Sf.textBaseline="bottom",Sf.fill=r===Cr.FILL||r===Cr.FILL_AND_OUTLINE,Sf.stroke=r===Cr.OUTLINE||r===Cr.FILL_AND_OUTLINE,Sf.backgroundColor=H.BLACK,uT(e,Sf)}function x9(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 p6e(e,t,n,i){i.index=e.addImageSync(t,n)}var _6e=new zv.default;function g6e(e,t){let n=t._renderedText,i=_6e.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length,a,c,u;if(t._relativeSize=t._fontSize/ha.FONT_SIZE,o<s)for(c=o;c<s;++c)x9(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:Yae,imageSubRegion:d6e}),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=qi.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} ${ha.FONT_SIZE}px ${t._fontFamily}`,E=m6e(m,T,H.WHITE,H.WHITE,0,Cr.FILL,x);if(A=new u6e(e,-1,E.dimensions),_[C]=A,E.width>0&&E.height>0){let S=(0,Fv.default)(E,{cutoff:ha.CUTOFF,radius:ha.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!==" "&&p6e(e._textureAtlas,C,E,A)}}if(a=r[u],l(a)?A.index===-1?x9(e,a):l(a.textureInfo)&&(a.textureInfo=void 0):(a=new l6e,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=qi.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===Cr.FILL_AND_OUTLINE?(T.color=t._fillColor,T.outlineWidth=t.outlineWidth):t.style===Cr.FILL?(T.color=t._fillColor,T.outlineWidth=0):t.style===Cr.OUTLINE&&(T.color=H.TRANSPARENT,T.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function qae(e,t,n){return t===qi.CENTER?-e/2:t===qi.RIGHT?-(e+n.x):n.x}var Br=new W,y6e=new W;function x6e(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,y6e);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=qae(S,A,m),D=(l(e._lineHeight)?e._lineHeight:f6e*e._fontSize)/e._relativeSize,R=D*(f-1),M=s,L=x+R;l(_)&&(M+=m.x*2,L+=m.y*2,_._labelHorizontalOrigin=A),Br.x=w*C,Br.y=0;let N=!0,g=0;for(d=0;d<p;++d)if(n.charAt(d)===`
`)++E,g+=D,S=a[E],w=qae(S,A,m),Br.x=w*C,N=!0;else if(i=t[d],o=i.dimensions,T===si.TOP?(Br.y=o.height-u-m.y,Br.y+=ha.PADDING):T===si.CENTER?Br.y=(R+o.height-u)/2:T===si.BASELINE?(Br.y=R,Br.y-=ha.PADDING):(Br.y=R+c+m.y,Br.y-=ha.PADDING),Br.y=(Br.y-o.descent-g)*C,N&&(Br.x-=ha.PADDING*C,N=!1),l(i.billboard)&&(i.billboard._setTranslate(Br),i.billboard._labelDimensions.x=M,i.billboard._labelDimensions.y=L,i.billboard._labelHorizontalOrigin=A),d<p-1){let b=t[d+1];Br.x+=(o.width-o.minx+b.dimensions.minx)*C}if(l(_)&&n.split(`
`).join("").length>0&&(A===qi.CENTER?w=-s/2-m.x:A===qi.RIGHT?w=-(s+m.x*2):w=0,Br.x=w*C,T===si.TOP?Br.y=x-u-c:T===si.CENTER?Br.y=(x-u)/2-c:T===si.BASELINE?Br.y=-m.y-c:Br.y=0,Br.y=Br.y*C,_.width=M,_.height=L,_._setTranslate(Br),_._labelTranslate=W.clone(Br,_._labelTranslate)),e.heightReference===Qe.CLAMP_TO_GROUND)for(d=0;d<p;++d){i=t[d];let b=i.billboard;l(b)&&(b._labelTranslate=W.clone(Br,b._labelTranslate))}}function Xae(e,t){let n=t._glyphs;for(let i=0,o=n.length;i<o;++i)x9(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 _m(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 Ef({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new Ef({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,sr.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(_m.prototype,{length:{get:function(){return this._labels.length}}});_m.prototype.add=function(e){let t=new Ox(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};_m.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),Xae(this,e),!0}return!1};_m.prototype.removeAll=function(){let e=this._labels;for(let t=0,n=e.length;t<n;++t)Xae(this,e[t]);e.length=0};_m.prototype.contains=function(e){return l(e)&&e._labelCollection===this};_m.prototype.get=function(e){return this._labels[e]};_m.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 Px({context:i}),t.textureAtlas=this._textureAtlas),l(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new Px({context:i,initialSize:y9}),n.textureAtlas=this._backgroundTextureAtlas,h6e(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&&(g6e(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(x6e(a),a._repositionAllGlyphs=!1);let u=a._glyphs.length-c;this._totalGlyphCount+=u}let r=n.length>0?sr.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)};_m.prototype.isDestroyed=function(){return!1};_m.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 Jp=_m;var rF=`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 bu(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=ir(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=uo.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array($ae),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 Kae=bu.POSITION_INDEX=0,C6e=bu.SHOW_INDEX=1,A6e=bu.WIDTH_INDEX=2,T6e=bu.MATERIAL_INDEX=3,Hv=bu.POSITION_SIZE_INDEX=4,b6e=bu.DISTANCE_DISPLAY_CONDITION=5,$ae=bu.NUMBER_OF_PROPERTIES=6;function Qp(e,t){++e._propertiesChanged[t];let n=e._polylineCollection;l(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(bu.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,Qp(this,C6e))}},positions:{get:function(){return this._positions},set:function(e){let t=ir(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)&&Qp(this,Hv),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),Qp(this,Kae),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,Qp(this,T6e))}},width:{get:function(){return this._width},set:function(e){let t=this._width;e!==t&&(this._width=e,Qp(this,A6e))}},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,Qp(this,Hv)}}},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),Qp(this,b6e))}}});bu.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[Kae]>0||this._propertiesChanged[Hv]>0;if((!O.equals(e,this._modelMatrix)||i)&&(this._segments=uo.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)Qp(this,Hv);else{let o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Qp(this,Hv);break}}};bu.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};bu.prototype._clean=function(){this._dirty=!1;let e=this._propertiesChanged;for(let t=0;t<$ae-1;++t)e[t]=0};bu.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=t
`,this.material.shaderSource,zT]}),r=t.getVertexShaderCallback()(rF),s=new je({defines:i,sources:[_f,r]});this.shaderProgram=_n.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:zl})};function uce(e){return h.dot(h.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Fn.ORIGIN_ZX_PLANE)===Dn.INTERSECTING}gm.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===te.SCENE3D||!uce(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 Vs=new h,wf=new h,vf=new h,aF=new h,L6e=new ae,N6e=new W;gm.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=aF,h.subtract(T[0],T[1],M),h.add(T[0],M,M)):M=T[k-1],h.clone(M,wf),h.clone(T[k],Vs),k===S-1?_._loop?M=T[1]:(M=aF,h.subtract(T[S-1],T[S-2],M),h.add(T[S-1],M,M)):M=T[k+1],h.clone(M,vf);let U=E[D];k===R+U&&(R+=U,++D);let z=k-R===0,V=k===R+E[D]-1;c===te.SCENE2D&&(wf.z=0,Vs.z=0,vf.z=0),(c===te.SCENE2D||c===te.MORPHING)&&(z||V)&&u-Math.abs(Vs.x)<1&&((Vs.x<0&&wf.x>0||Vs.x>0&&wf.x<0)&&h.clone(Vs,wf),(Vs.x<0&&vf.x>0||Vs.x>0&&vf.x<0)&&h.clone(Vs,vf));let Y=z?2:0,j=V?2:4;for(let $=Y;$<j;++$){yi.writeElements(Vs,e,n),yi.writeElements(wf,e,n+6),yi.writeElements(vf,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=L6e;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=N6e;N.x=m,N.y=x?1:0;let g=c===te.SCENE2D?_._boundingVolume2D:_._boundingVolumeWC,b=yi.fromCartesian(g.center,rce),v=b.high,P=ae.fromElements(b.low.x,b.low.y,b.low.z,g.radius,sce),B=ace;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 F6e=new h,V6e=new h,k6e=new h,tce=new h;gm.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]:(_=tce,h.subtract(a[0],a[1],_),h.add(a[0],_,_)):_=a[p-1],_=O.multiplyByPoint(n,_,V6e);let m=O.multiplyByPoint(n,a[p],F6e),x;p===u-1?s._loop?x=a[1]:(x=tce,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,k6e);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)yi.writeElements(m,e,t),yi.writeElements(_,e,t+6),yi.writeElements(x,e,t+12),t+=6*3}}};var U6e=new Array(1);gm.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new C9(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){_=U6e;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 C9(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 C9(0,0,this),n[++o]=[r])}p._clean()}return r.count=s,i};gm.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 Sb={positions:void 0,lengths:void 0},nce=new Array(1),z6e=new h,H6e=new _e;gm.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===te.SCENE3D)return nce[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 Nd(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=A9e(this),this._verticesPromise=void 0}Object.defineProperties(Nd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function c9e(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 l9e=new ao("createVectorTilePolylines",5),wb={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function u9e(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=c9e(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=l9e.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 f9e(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:wb.previousPosition,vertexBuffer:u,componentDatatype:X.FLOAT,componentsPerAttribute:3},{index:wb.currentPosition,vertexBuffer:f,componentDatatype:X.FLOAT,componentsPerAttribute:3},{index:wb.nextPosition,vertexBuffer:d,componentDatatype:X.FLOAT,componentsPerAttribute:3},{index:wb.expandAndWidth,vertexBuffer:p,componentDatatype:X.FLOAT,componentsPerAttribute:2},{index:wb.a_batchId,vertexBuffer:_,componentDatatype:X.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Pi({context:t,attributes:x,indexBuffer:m}),e._po
void main()
{
gl_FragColor = u_highlightColor;
}
`;function p9e(e,t){if(l(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(uF),o=n.getFragmentShaderCallback(!1,void 0,!1)(m9e),r=new je({defines:["VECTOR_TILE",Kt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[_f,i]}),s=new je({defines:["VECTOR_TILE"],sources:[o]});e._sp=_n.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:wb})}function _9e(e,t){if(!l(e._command)){let n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new mt({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)}Nd.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};Nd.prototype.getPositions=function(e){return Nd.getPolylinePositions(this,e)};Nd.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 Gr(e,r)}};Nd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function g9e(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 y9e=new H,x9e=H.WHITE,C9e=!0;Nd.prototype.applyStyle=function(e,t){if(!l(e)){g9e(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,y9e):x9e,s.show=l(e.show)?e.show.evaluate(s):C9e}};function A9e(e){return new Promise(function(t,n){e._update=function(i,o){let r=o.context,s=u9e(i,r);if(d9e(i,r),p9e(i,r),h9e(i),i._ready){let a=o.passes;(a.render||a.pick)&&_9e(i,o)}!l(s)||s.then(function(){f9e(i,r),t()}).catch(function(a){n(a)})}})}Nd.prototype.update=function(e){this._update(this,e)};Nd.prototype.isDestroyed=function(){return!1};Nd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),fe(this)};var vb=Nd;var fF=`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 dF=`#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 t_(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=$i.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=L9e(this),this._verticesPromise=void 0}Object.defineProperties(t_.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function T9e(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;$i.fromRectangle(c,o,r,n,a)}function b9e(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 E9e=new ao("createVectorTileClampedPolylines"),a0={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function S9e(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=b9e(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=E9e.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 w9e(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 EF=`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 de(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=gn.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());let r=/^color_\d+$/.test(i),s=e.type,a=xn.getGlslType(s);r&&(a="vec4");let c=l(e.quantization),u;return c&&(u=r?"vec4":xn.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};var j7e=new h,q7e=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,q7e),o=h.add(o,n,j7e)),{min:r,max:o}};dn.getAxisCorrectionMatrix=function(e,t,n){return n=O.clone(O.IDENTITY,n),e===ui.Y?n=O.clone(ui.Y_UP_TO_Z_UP,n):e===ui.X&&(n=O.clone(ui.X_UP_TO_Z_UP,n)),t===ui.Z&&(n=O.multiplyTransformation(n,ui.Z_UP_TO_X_UP,n)),n};var Y7e=new Q;dn.getCullFace=function(e,t){if(!He.isTriangles(t))return Ao.BACK;let n=O.getMatrix3(e,Y7e);return Q.determinant(n)<0?Ao.FRONT:Ao.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 tD(e,t){let n=e.shaderBuilder;n.addVertexLines([EF]),n.addFragmentLines([bF]);let i=e.model,o=t.context,r=X7e(e),s=new Pi({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=ht(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 mt({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 TF({primitiveRenderResources:e,command:m,useSilhouetteCommands:x})}function X7e(e){let t=e.wireframeIndexBuffer;if(l(t))return t;let n=e.indices;if(!!l(n))return n.buffer}var SF=`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 Mx={VERTEX:0,FRAGMENT:1,BOTH:2};Mx.includesVertexShader=function(e){return e===Mx.VERTEX||e===Mx.BOTH};Mx.includesFragmentShader=function(e){return e===Mx.FRAGMENT||e===Mx.BOTH};var Oe=Object.freeze(Mx);var M9={};M9.name="ImageBasedLightingPipelineStage";M9.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),fu.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([SF]);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 wF=M9;var K7e=I.EPSILON16;function Bx(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(Bx.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,K7e)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});var $7e=new h,B9=new Q;Bx.prototype.applyStageToMatrix=function(e){let t=this.type,n=this.currentValue,i=$7e,o;switch(t){case Lc.XROTATE:o=Q.fromRotationX(I.toRadians(n),B9),e=O.multiplyByMatrix3(e,o,e);break;case Lc.YROTATE:o=Q.fromRotationY(I.toRadians(n),B9),e=O.multiplyByMatrix3(e,o,e);break;case Lc.ZROTATE:o=Q.fromRotationZ(I.toRadians(n),B9),e=O.multiplyByMatrix3(e,o,e);break;case Lc.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=O.multiplyByTranslation(e,i,e);break;case Lc.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=O.multiplyByTranslation(e,i,e);break;case Lc.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=O.multiplyByTranslation(e,i,e);break;case Lc.XSCALE:i.x=n,i.y=1,i.z=1,e=O.multiplyByScale(e,i,e);break;case Lc.YSCALE:i.x=1,i.y=n,i.z=1,e=O.multiplyByScale(e,i,e);break;case Lc.ZSCALE:i.x=1,i.y=1,i.z=n,e=O.multiplyByScale(e,i,e);break;case Lc.UNIFORMSCALE:e=O.multiplyByUniformScale(e,n,e);break;default:break}return e};function c0(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 r_={};r_.name="ModelColorPipelineStage";r_.COLOR_UNIFORM_NAME="model_color";r_.COLOR_BLEND_UNIFORM_NAME="model_colorBlend";r_.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,Oe.FRAGMENT),i.addFragmentLines([vF]);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",r_.COLOR_UNIFORM_NAME,Oe.FRAGMENT),o[r_.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",r_.COLOR_BLEND_UNIFORM_NAME,Oe.FRAGMENT),o[r_.COLOR_BLEND_UNIFORM_NAME]=function(){return Xs.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=Dt(o,e.uniformMap)};var Lx=r_;var DF=`#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 L9={};L9.name="ModelClippingPlanesPipelineStage";var eje=new W;L9.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),Ys.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,Oe.FRAGMENT);let s=Ys.getTextureResolution(i,o,eje);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([DF]);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 PF=L9;function Rb(e,t){this._model=e,this._runtimeNode=t}Object.defineProperties(Rb.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 IF=`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 OF=`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 RF=`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 MF=new O,tje=new O,nje=new O,oD={};oD.name="InstancingPipelineStage";oD.process=function(e,t,n){let i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines([IF]);let s=e.model,a=s.sceneGraph,c=n.mode!==te.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,u=[];yje(e,n,i,u,c),xje(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,MF);return c?O.multiplyTransformation(n.context.uniformState.view3D,d,MF):(n.mode!==te.SCENE3D&&(d=Ut.basisTo2D(n.mapProjection,d,MF)),O.multiplyTransformation(n.context.uniformState.view,d,MF))},f.u_instance_nodeTransform=function(){return O.multiplyTransformation(a.axisCorrectionMatrix,e.runtimeNode.computedTransform,tje)},r.addVertexLines([RF])):r.addVertexLines([OF]),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,nje)}}e.uniformMap=Dt(f,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,u)};var iD=new O,ije=new h;function oje(e,t,n,i,o){let r=O.multiplyTransformation(t,e,iD);return r=O.multiplyTransformation(r,n,iD),o=Ut.basisTo2D(i.mapProjection,r,o),o}function rje(e,t,n,i,o){let r=O.fromTranslation(e,iD),s=O.multiplyTransformation(t,r,iD);s=O.multiplyTransformation(s,n,iD);let a=O.getTranslation(s,ije);return o=Oo.computeActualWgs84Position(i,a,o),o}function Vce(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 kce=new O,Uce=new O,sje=new O,aje=new h;function cje(e,t,n,i){let o=kce,r=Uce;Vce(t,o,r);let s=t.instancingReferencePoint2D,a=e.length;for(let c=0;c<a;c++){let u=e[c],f=oje(u,o,r,n,sje),d=O.getTranslation(f,aje),p=h.subtract(d,s,d);i[c]=O.setTranslation(f,p,i[c])}return i}function lje(e,t,n,i){let o=kce,r=Uce;Vce(t,o,r);let s=t.instancingReferencePoint2D,a=e.length;for(let c=0;c<a;c++){let u=e[c],f=rje(u,o,r,n,u);i[c]=h.subtract(f,s,i[c])}return i}var uje=new h,fje=new h;function dje(e,t){let n=e.model.sceneGraph.computedModelMatrix,i=O.multiplyByPoint(n,e.instancingTranslationMin,uje),o=Oo.computeActualWgs84Position(t,i,i),r=O.multiplyByPoint(n,e.instancingTranslationMax,fje),s=Oo.computeActualWgs84Position(t,r,r);return h.lerp(o,s,.5,new h)}function F9(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 hje(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 mje=new h,pje=new ke,_je=new h;function zce(e,t,n){let i=new Array(t),o=dn.getAttributeBySemantic(e,ds.TRANSLATION),r=dn.getAttributeBySemantic(e,ds.ROTATION),s=dn.getAttributeBySemantic(e,ds.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],mje);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,pje),T=new h(m[x*3],m[x*3+1],m[x*3+2],_je),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 UF=`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 zF=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
}
`;var HF=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
{
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
setFeatureIdVaryings();
}
`;var gi={};gi.name="FeatureIdPipelineStage";gi.STRUCT_ID_FEATURE_IDS_VS="FeatureIdsVS";gi.STRUCT_ID_FEATURE_IDS_FS="FeatureIdsFS";gi.STRUCT_NAME_FEATURE_IDS="FeatureIds";gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS="initializeFeatureIdsVS";gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS="initializeFeatureIdsFS";gi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS="initializeFeatureIdAliasesVS";gi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS="initializeFeatureIdAliasesFS";gi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS="void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)";gi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES="void initializeFeatureIdAliases(inout FeatureIds featureIds)";gi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS="setFeatureIdVaryings";gi.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS="void setFeatureIdVaryings()";gi.process=function(e,t,n){let i=e.shaderBuilder;Aje(i);let o=e.runtimeNode.node.instances;l(o)&&Tje(e,o,n),bje(e,t,n),i.addVertexLines([HF]),i.addFragmentLines([zF])};function Aje(e){e.addStruct(gi.STRUCT_ID_FEATURE_IDS_VS,gi.STRUCT_NAME_FEATURE_IDS,Oe.VERTEX),e.addStruct(gi.STRUCT_ID_FEATURE_IDS_FS,gi.STRUCT_NAME_FEATURE_IDS,Oe.FRAGMENT),e.addFunction(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,gi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Oe.VERTEX),e.addFunction(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,gi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Oe.FRAGMENT),e.addFunction(gi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,gi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Oe.VERTEX),e.addFunction(gi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,gi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Oe.FRAGMENT),e.addFunction(gi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,gi.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,Oe.VERTEX)}function Tje(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?Eje(e,s,a):qce(e,s,a,o,1,n);let c=s.label;l(c)&&Yce(e,a,c,Oe.BOTH)}}function bje(e,t,n){let i=t.featureIds,r=dn.getAttributeBySemantic(t,gn.POSITION).count;for(let s=0;s<i.length;s++){let a=i[s],c=a.positionalLabel,u=Oe.BOTH;a instanceof fn.FeatureIdAttribute?Sje(e,a,c):a instanceof fn.FeatureIdImplicitRange?qce(e,a,c,r,void 0,n):(wje(e,a,c,s,n),u=Oe.FRAGMENT);let f=a.label;l(f)&&Yce(e,c,f,u)}}function Eje(e,t,n){let i=e.shaderBuilder;i.addStructField(gi.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(gi.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(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(gi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function Sje(e,t,n){let i=e.shaderBuilder;i.addStructField(gi.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(gi.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(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function qce(e,t,n,i,o,r){vje(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(gi.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(gi.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(gi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(gi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function wje(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(gi.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,Oe.FRAGMENT);let f=`v_texCoord
{
initializeMetadata(metadata, metadataClass, attributes);
}
`;var WF=`void metadataStage(out Metadata metadata, out MetadataClass metadataClass, ProcessedAttributes attributes)
{
initializeMetadata(metadata, metadataClass, attributes);
setMetadataVaryings();
}
`;var wi={};wi.name="MetadataPipelineStage";wi.STRUCT_ID_METADATA_VS="MetadataVS";wi.STRUCT_ID_METADATA_FS="MetadataFS";wi.STRUCT_NAME_METADATA="Metadata";wi.STRUCT_ID_METADATACLASS_VS="MetadataClassVS";wi.STRUCT_ID_METADATACLASS_FS="MetadataClassFS";wi.STRUCT_NAME_METADATACLASS="MetadataClass";wi.FUNCTION_ID_INITIALIZE_METADATA_VS="initializeMetadataVS";wi.FUNCTION_ID_INITIALIZE_METADATA_FS="initializeMetadataFS";wi.FUNCTION_SIGNATURE_INITIALIZE_METADATA="void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, ProcessedAttributes attributes)";wi.FUNCTION_ID_SET_METADATA_VARYINGS="setMetadataVaryings";wi.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS="void setMetadataVaryings()";wi.METADATACLASS_FIELDS=[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}];wi.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)&&Oje(c,t,s),l(a)&&Bje(c,a),Pje(i,c),Ije(i),i.addVertexLines([WF]),i.addFragmentLines([GF]),l(s)&&Rje(e,t,s),l(a)&&Lje(e,a)};function Pje(e,t){let n=wi.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 Ije(e){e.addStruct(wi.STRUCT_ID_METADATA_VS,wi.STRUCT_NAME_METADATA,Oe.VERTEX),e.addStruct(wi.STRUCT_ID_METADATA_FS,wi.STRUCT_NAME_METADATA,Oe.FRAGMENT),e.addStruct(wi.STRUCT_ID_METADATACLASS_VS,wi.STRUCT_NAME_METADATACLASS,Oe.VERTEX),e.addStruct(wi.STRUCT_ID_METADATACLASS_FS,wi.STRUCT_NAME_METADATACLASS,Oe.FRAGMENT),e.addFunction(wi.FUNCTION_ID_INITIALIZE_METADATA_VS,wi.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Oe.VERTEX),e.addFunction(wi.FUNCTION_ID_INITIALIZE_METADATA_FS,wi.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Oe.FRAGMENT),e.addFunction(wi.FUNCTION_ID_SET_METADATA_VARYINGS,wi.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,Oe.VERTEX)}function jF(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 Oje(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)}jF(n,r)}function Rje(e,t,n){let{getAttributeByName:i,getAttributeInfo:o}=dn;function r(s,a){let c=i(t,a.attribute),u=o(c);Mje(e,u,s,a)}jF(n,r)}function Mje(e,t,n,i){let o=dn.sanitizeGlslIdentifier(n),r=t.variableName,s=t.glslType,a=e.shaderBuilder;a.addStructField(wi.STRUCT_ID_METADATA_VS,s,o),a.addStructField(wi.STRUCT_ID_METADATA_FS,s,o);let c=`${s}MetadataClass`;a.addStructField(wi.STRUCT_ID_METADATACLASS_VS,c,o),a.addStructField(wi.STRUCT_ID_METADATACLASS_FS,c,o);let u=`attributes.${r}`;i.hasValueTransform&&(u=Xce(u,{renderResources:e,glslType:s,metadataVariable:o,shaderDestination:Oe.BOTH,offset:i.offset,scale:i.scale}));let f=`metadata.${o} = ${u};`;a.addFunctionLines(wi.FUNCTION_ID_INITIALIZE_METADATA_VS,[f]),a.addFunctionLines(wi.FUNCTION_ID_INITIALIZE_METADATA_FS,[f]);let d=wi.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(wi.FUNCTION_ID_INITIALIZE_METADATA_VS,[C]),a.addFunctionLines(wi.FUNCTION_ID_INITIALIZE_METADATA_FS,[C])}}function Bje(e,t){function n(i,o){let r=o.getGlslType();e.add(r)}jF(t,n)}function Lje(e,t){function n(i,o){o.isGpuCompatible()&&Nje(e,i,o)}jF(t,n)}function Nje(e,t,n){let i=n.textureReader,r=`u_propertyTexture_${i.index}`;e.uniformMap.hasOwnProperty(r)||Fje(e,r,i);let s=dn.sanitizeGlslIdentifier(t),a=n.getGlslType(),c=e.shaderBuilder;c.addStructField(wi.STRUCT_ID_METADATA_FS,a,s);let u=`${a}MetadataClass`;c.addStructField(wi.STRUCT_ID_METADATACLASS_FS,u,s);let d=`attributes.texCoord_${i.texCoord}`,p=i.channels,_=`texture2D(${r}, ${d}).${p}`;_=n.unpackInShader(_),n.hasValueTransform&&(_=Xce(_,{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 XF=`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 H9={};H9.name="CPUStylingPipelineStage";H9.process=function(e,t,n){let i=e.model,o=e.shaderBuilder;o.addVertexLines([YF]),o.addFragmentLines([XF]),o.addDefine("USE_CPU_STYLING",void 0,Oe.BOTH),l(i.color)||(o.addUniform("float",Lx.COLOR_BLEND_UNIFORM_NAME,Oe.FRAGMENT),e.uniformMap[Lx.COLOR_BLEND_UNIFORM_NAME]=function(){return Xs.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=Jc.getStyleCommandsNeeded(r.featuresLength,r.batchTexture.translucentFeaturesLength);s===Jc.ALL_TRANSLUCENT&&(e.alphaOptions.pass=Se.TRANSLUCENT),e.styleCommandsNeeded=s};var KF=H9;var u0={};u0.name="DequantizationPipelineStage";u0.FUNCTION_ID_DEQUANTIZATION_STAGE_VS="dequantizationStage";u0.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS="void dequantizationStage(inout ProcessedAttributes attributes)";u0.process=function(e,t,n){let i=e.shaderBuilder;i.addFunction(u0.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,u0.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);$je(i,c),Kje(e,c)}};function Kje(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=Zce(u,0),f=Zce(f,1)),i[s]=function(){return u},i[a]=function(){return f}}}function Zce(e,t){return e instanceof ae?e:new ae(e.x,e.y,e.z,t)}function $je(e,t){let n=t.variableName,i=t.attribute.quantization,o;i.octEncoded?o=Zje(n,i):o=Jje(n),e.addFunctionLines(u0.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function Zje(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 Jje(e){let t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}var $F=u0;var ZF=`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 JF=`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 f0={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};f0.is3DTiles=function(e){switch(e){case f0.TILE_GLTF:case f0.TILE_B3DM:case f0.TILE_I3DM:case f0.TILE_PNTS:case f0.TILE_GEOJSON:return!0;case f0.GLTF:return!1}};var Zs=Object.freeze(f0);var sD=`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 Vd={};Vd.name="SelectedFeatureIdPipelineStage";Vd.STRUCT_ID_SELECTED_FEATURE="SelectedFeature";Vd.STRUCT_NAME_SELECTED_FEATURE="SelectedFeature";Vd.FUNCTION_ID_FEATURE_VARYINGS_VS="updateFeatureStructVS";Vd.FUNCTION_ID_FEATURE_VARYINGS_FS="updateFeatureStructFS";Vd.FUNCTION_SIGNATURE_UPDATE_FEATURE="void updateFeatureStruct(inout SelectedFeature feature)";Vd.process=function(e,t,n){let i=e.shaderBuilder;e.hasPropertyTable=!0;let o=e.model,r=e.runtimeNode.node,s=Qje(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),eqe(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([sD]),i.addFragmentLines([sD])};function Jce(e){return e instanceof fn.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function Qce(e){return e instanceof fn.FeatureIdTexture?Oe.FRAGMENT:Oe.BOTH}function Qje(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:Qce(o),featureIdDefine:Jce(o)}):(o=dn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:Qce(o),featureIdDefine:Jce(o)})}function eqe(e){e.addStructField(Vd.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(Vd.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(Vd.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}var Fx=Vd;var ar={};ar.name="GeometryPipelineStage";ar.STRUCT_ID_PROCESSED_ATTRIBUTES_VS="ProcessedAttributesVS";ar.STRUCT_ID_PROCESSED_ATTRIBUTES_FS="ProcessedAttributesFS";ar.STRUCT_NAME_PROCESSED_ATTRIBUTES="ProcessedAttributes";ar.FUNCTION_ID_INITIALIZE_ATTRIBUTES="initializeAttributes";ar.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES="void initializeAttributes(out ProcessedAttributes attributes)";ar.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS="setDynamicVaryingsVS";ar.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS="setDynamicVaryingsFS";ar.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS="void setDynamicVaryings(inout ProcessedAttributes attributes)";ar.process=function(e,t,n){let i=e.shaderBuilder;i.addStruct(ar.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",Oe.VERTEX),i.addStruct(ar.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",Oe.FRAGMENT),i.addStruct(Fx.STRUCT_ID_SELECTED_FEATURE,Fx.STRUCT_NAME_SELECTED_FEATURE,Oe.BOTH),i.addFunction(ar.FUNCTION_ID_INITIALIZE_ATTRIBUTES,ar.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,Oe.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(ar.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(ar.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(ar.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,ar.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Oe.VERTEX),i.addFunction(ar.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,ar.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Oe.FRAGMENT);let o=e.model;o.type===Zs.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=xn.getAttributeLocationCount(d.type),_=d.semantic===gn.POSITION,m;p>1?(m=e.attributeIndex,e.attributeIndex+=p):_&&!c?m=0:m=e.attributeIndex++,tqe(e,d,m,p,s,a)}uqe(i,t.attributes),t.primitiveType===He.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines([JF]),i.addFragmentLines([ZF])};function tqe(e,t,n,i,o,r){let s=e.shaderBuilder,a=dn.getAttributeInfo(t),c=o&&!r;i>1?oqe(e,t,n,i):iqe(e,t,n,c),sqe(s,a,c),rqe(s,a),l(t.semantic)&&nqe(s,t),aqe(s,a,o),cqe(s,a,c),lqe(s,a)}function nqe(e,t){let n=t.semantic,i=t.setIndex;switch(n){case gn.NORMAL:e.addDefine("HAS_NORMALS");break;case gn.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 fqe={UNLIT:0,PBR:1},a_=Object.freeze(fqe);var G9={};G9.name="LightingPipelineStage";G9.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===a_.PBR?o.addDefine("LIGHTING_PBR",void 0,Oe.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,Oe.FRAGMENT),o.addFragmentLines([e2])};var t2=G9;var n2=`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 dqe=fn.Material,W9=fn.MetallicRoughness,j9=fn.SpecularGlossiness,aD={};aD.name="MaterialPipelineStage";aD.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;hqe(i,o,r,s,a,c),l(i.specularGlossiness)?mqe(i,o,r,s):pqe(i,o,r,s);let u=dn.getAttributeBySemantic(t,gn.NORMAL),f=e.lightingOptions;i.unlit||!u?f.lightingModel=a_.UNLIT:f.lightingModel=a_.PBR;let p=e.model.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=p;let _=e.alphaOptions;i.alphaMode===jp.BLEND?_.pass=Se.TRANSLUCENT:i.alphaMode===jp.MASK&&(_.alphaCutoff=i.alphaCutoff),r.addFragmentLines([n2]),i.doubleSided&&r.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,Oe.FRAGMENT)};function ele(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 d0(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)&&ele(e,t,n,i,o)}function hqe(e,t,n,i,o,r){let s=e.emissiveTexture;l(s)&&d0(n,t,s,"u_emissiveTexture","EMISSIVE",r);let a=e.emissiveFactor;l(a)&&!h.equals(a,dqe.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)&&d0(n,t,c,"u_normalTexture","NORMAL",o);let u=e.occlusionTexture;l(u)&&d0(n,t,u,"u_occlusionTexture","OCCLUSION",i)}function mqe(e,t,n,i){let o=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,Oe.FRAGMENT);let r=o.diffuseTexture;l(r)&&d0(n,t,r,"u_diffuseTexture","DIFFUSE",i);let s=o.diffuseFactor;l(s)&&!ae.equals(s,j9.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)&&d0(n,t,a,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);let c=o.specularFactor;l(c)&&!h.equals(c,j9.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!==j9.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 pqe(e,t,n,i){let o=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,Oe.FRAGMENT);let r=o.baseColorTexture;l(r)&&d0(n,t,r,"u_baseColorTexture","BASE_COLOR",i);let s=o.baseColorFactor;l(s)&&!ae.equals(s,W9.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)&&d0(n,t,a,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);let c=o.metallicFactor;l(c)&&c!==W9.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!==W9.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))}aD._processTexture=d0;aD._processTextureTransform=ele;var i2=aD;var o2=`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 jr={};jr.name="MorphTargetsPipelineStage";jr.FUNCTION_ID_GET_MORPHED_POSITION="getMorphedPosition";jr.FUNCTION_SIGNATURE_GET_MORPHED_POSITION="vec3 getMorphedPosition(in vec3 position)";jr.FUNCTION_ID_GET_MORPHED_NORMAL="getMorphedNormal";jr.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL="vec3 getMorphedNormal(in vec3 normal)";jr.FUNCTION_ID_GET_MORPHED_TANGENT="getMorphedTangent";jr.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT="vec3 getMorphedTangent(in vec3 tangent)";jr.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,Oe.VERTEX),Aqe(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!==gn.POSITION&&p!==gn.NORMAL&&p!==gn.TANGENT||(gqe(e,d,e.attributeIndex,a),e.attributeIndex++)}}Tqe(n);let r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,Oe.VERTEX),n.addVertexLines([o2]);let s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=Dt(s,e.uniformMap)};var _qe={attributeString:void 0,functionId:void 0};function gqe(e,t,n,i){let o=e.shaderBuilder;yqe(e,t,n);let r=xqe(t,_qe);Cqe(o,r,i)}function yqe(e,t,n){let i={index:n,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:xn.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function xqe(e,t){switch(e.semantic){case gn.POSITION:t.attributeString="Position",t.functionId=jr.FUNCTION_ID_GET_MORPHED_POSITION;break;case gn.NORMAL:t.attributeString="Normal",t.functionId=jr.FUNCTION_ID_GET_MORPHED_NORMAL;break;case gn.TANGENT:t.attributeString="Tangent",t.functionId=jr.FUNCTION_ID_GET_MORPHED_TANGENT;break;default:break}return t}function Cqe(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 Aqe(e){e.addFunction(jr.FUNCTION_ID_GET_MORPHED_POSITION,jr.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,Oe.VERTEX);let t="vec3 morphedPosition = position;";e.addFunctionLines(jr.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(jr.FUNCTION_ID_GET_MORPHED_NORMAL,jr.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,Oe.VERTEX);let n="vec3 morphedNormal = normal;";e.addFunctionLines(jr.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(jr.FUNCTION_ID_GET_MORPHED_TANGENT,jr.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,Oe.VERTEX);let i="vec3 morphedTangent = tangent;";e.addFunctionLines(jr.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function Tqe(e){let t="return morphedPosition;";e.addFunctionLines(jr.FUNCTION_ID_GET_MORPHED_POSITION,[t]);let n="return morphedNormal;";e.addFunctionLines(jr.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);let i="return morphedTangent;";e.addFunctionLines(jr.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}var r2=jr;var q9={};q9.name="PickingPipelineStage";q9.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)bqe(e,t,a,i);else if(l(a))Eqe(e,i);else{let c=tle(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 tle(e,t){let n=e.model,i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive},o;if(Zs.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 bqe(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 Sqe=new ae,K9={};K9.name="PointCloudStylingPipelineStage";K9.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=Pqe(a),C=Iqe(r,x);Oqe(i,C);let T=Rqe(C).indexOf("normalMC")>=0,E=dn.getAttributeBySemantic(t,gn.NORMAL);if(T&&!E)throw new de("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,_;Zs.is3DTiles(o.type)&&(p=!0,d=o.content,_=d.tile.refine===Wr.ADD),i.addUniform("vec4","model_pointCloudParameters",Oe.VERTEX),i.addVertexLines([a2]);let m=e.uniformMap;m.model_pointCloudParameters=function(){let x=Sqe,C=1;p&&(C=_?5:d.tileset.maximumScreenSpaceError),x.x=y(f.maximumAttenuation,C),x.x*=n.pixelRatio;let A=wqe(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 nle=new h;function wqe(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,gn.POSITION),r=o.count,s=e.runtimeNode.transform,a=h.subtract(o.max,o.min,nle);a=O.multiplyByPointAsVector(s,a,nle);let c=a.x*a.y*a.z;return I.cbrt(c/r)}var vqe={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},Dqe={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function Pqe(e){let t=ht(Dqe);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 Y9="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function Iqe(e,t){let n=vqe,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${Y9})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${Y9})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${Y9})`,t,i),n.styleTranslucent=l(n.colorStyleFunction)&&i.translucent,n}function Oqe(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 X9(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 Rqe(e){let t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return l(t)&&X9(t,o),l(n)&&X9(n,o),l(i)&&X9(i,o),o}var c2=K9;var l2=`void primitiveOutlineStage() {
v_outlineCoordinates = a_outlineCoordinates;
}
`;var u2=`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 $9={};$9.name="PrimitiveOutlinePipelineStage";$9.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:xn.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=xm.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([l2]),i.addFragmentLines([u2])};var f2=$9;var c_={};c_.name="PrimitiveStatisticsPipelineStage";c_.process=function(e,t,n){let i=e.model,o=i.statistics;ile(o,t),ole(o,e.runtimePrimitive),rle(o,t),sle(o,t.material),ale(o,t.featureIds),cle(o,i)};function ile(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+=Mqe(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 Mqe(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 ole(e,t){let n=t.positionBuffer2D;l(n)&&e.addBuffer(n,!0)}function rle(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 sle(e,t){let n=Bqe(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 Bqe(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 ale(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 cle(e,t){let n=t.structuralMetadata;l(n)&&(Lqe(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 Lqe(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)}}}c_._countGeometry=ile;c_._count2DPositions=ole;c_._countMorphTargetAttributes=rle;c_._countMaterialTextures=sle;c_._countFeatureIdTextures=ale;c_._countBinaryMetadata=cle;var d2=c_;var Nqe=new O,Fqe=new O,Z9={};Z9.name="SceneMode2DPipelineStage";Z9.process=function(e,t,n){let i=dn.getAttributeBySemantic(t,gn.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=O.multiplyTransformation(s,a,Nqe),u=Uqe(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=Gqe(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,Fqe)}};e.uniformMap=Dt(m,e.uniformMap)};var Vqe=new h,kqe=new h;function Uqe(e,t,n){let i=O.multiplyByPoint(t,e.positionMin,Vqe),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 Tm={};Tm.name="SkinningPipelineStage";Tm.FUNCTION_ID_GET_SKINNING_MATRIX="getSkinningMatrix";Tm.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX="mat4 getSkinningMatrix()";Tm.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,Oe.VERTEX),jqe(n,t);let i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,Oe.VERTEX),n.addVertexLines([m2]);let r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=Dt(r,e.uniformMap)};function Wqe(e){let t=-1,n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];(r.semantic===gn.JOINTS||r.semantic===gn.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function jqe(e,t){e.addFunction(Tm.FUNCTION_ID_GET_SKINNING_MATRIX,Tm.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,Oe.VERTEX);let n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(Tm.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o,r=["x","y","z","w"],s=Wqe(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(Tm.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}let a="return skinnedMatrix;";e.addFunctionLines(Tm.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}var p2=Tm;var J9={};J9.name="WireframePipelineStage";J9.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,Oe.FRAGMENT);let o=e.model,r=qqe(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=Nw.getWireframeIndicesCount(a,c)};function qqe(e,t,n){let o=dn.getAttributeBySemantic(e,gn.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=Nw.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 _2=J9;function Mb(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=[]}Mb.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!==l0.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=Yqe(o,i,n);u&&t.push(h2),t.push(QF),C&&t.push(_2),f&&t.push(r2),d&&t.push(p2),E&&t.push(c2),x&&t.push($F),m&&t.push(i2),t.push(Nx),t.push(s_),w.hasPropertyTable&&(t.push(Fx),t.push(VF),t.push(KF)),p&&t.push(qF),t.push(t2),o.allowPicking&&t.push(s2),S&&t.push(f2),t.push(FF),t.push(d2)};function Yqe(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 Vx(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=[],Xqe(this)}Object.defineProperties(Vx.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 Xqe(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 _n.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};Js.prototype.clone=function(){return ht(this,!0)};function Kqe(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 $qe(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function Zqe(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 lD(e){this.shaderBuilder=new Js,this.model=e,this.uniformMap={},this.alphaOptions=new cD,this.renderStateOptions=Ze.getState(Ze.fromCache({depthTest:{enabled:!0,func:jc.LESS_OR_EQUAL}}))}var g2=`void silhouetteStage(inout vec4 color) {
if(model_silhouettePass) {
color = czm_gammaCorrect(model_silhouetteColor);
}
}
`;var y2=`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 uD={};uD.name="ModelSilhouettePipelineStage";uD.silhouettesLength=0;uD.process=function(e,t,n){l(t._silhouetteId)||(t._silhouetteId=++uD.silhouettesLength);let i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,Oe.BOTH),i.addVertexLines([y2]),i.addFragmentLines([g2]),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 x2=uD;var C2=`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 Bb={};Bb.name="ModelSplitterPipelineStage";Bb.SPLIT_DIRECTION_UNIFORM_NAME="model_splitDirection";Bb.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,Oe.FRAGMENT),i.addFragmentLines([C2]);let o={};i.addUniform("float",Bb.SPLIT_DIRECTION_UNIFORM_NAME,Oe.FRAGMENT),o[Bb.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=Dt(o,e.uniformMap)};var A2=Bb;function fD(e,t){this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=ht(e.uniformMap),this.alphaOptions=ht(e.alphaOptions),this.renderStateOptions=ht(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 dD(e){e=y(e,y.EMPTY_OBJECT),this.lightingModel=y(e.lightingModel,a_.UNLIT)}function hD(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=ht(e.uniformMap),this.alphaOptions=ht(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 dD,this.pickId=void 0,this.renderStateOptions=ht(e.renderStateOptions,!0),this.styleCommandsNeeded=void 0}function Ha(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={},Jqe(this)}Object.defineProperties(Ha.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 Jqe(e){let t=e._components,n=t.scene,o=e._model.modelMatrix;fle(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 c0({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=dle(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 Vx({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 fle(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 Qqe=new h;function eYe(e,t){let n=e._computedModelMatrix,i=O.getTranslation(n,Qqe);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: ${nue(e.content.texturesByteLength)}`,i+=`
Geometry Memory: ${nue(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 b$e(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:EW(e.debugPickedTile),u=SW(e.debugPickedTile,e,c);u.pixelOffset=new W(15,-15)}}else{for(n=0;n<r;++n)i=o[n],SW(i,e,EW(i));for(n=0;n<a;++n)i=s[n],(i.hasTilesetContent||i.hasImplicitContent)&&SW(i,e,EW(i))}e._tileDebugLabels.update(t)}function E$e(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 Jp),b$e(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var iue=[];function S$e(e,t){let n=t,i=iue;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&&(w$e(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function oue(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function w$e(e,t){e._cache.unloadTile(e,t,oue),t.destroy()}pa.prototype.trimLoadedTiles=function(){this._cache.trim()};function v$e(e,t){let n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;y0.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 D$e(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 P$e(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 I$e(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,D$e(e),P$e(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;let s=i.traversal.selectTiles(e,t);if(i.requestTiles&&_$e(e),E$e(e,t,i),y0.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 Z2=`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 Y$e=ga.SHOW_INDEX,IW=ga.POSITION_INDEX,yue=ga.COLOR_INDEX,X$e=ga.OUTLINE_COLOR_INDEX,K$e=ga.OUTLINE_WIDTH_INDEX,$$e=ga.PIXEL_SIZE_INDEX,xue=ga.SCALE_BY_DISTANCE_INDEX,Cue=ga.TRANSLUCENCY_BY_DISTANCE_INDEX,Aue=ga.DISTANCE_DISPLAY_CONDITION_INDEX,Z$e=ga.DISABLE_DEPTH_DISTANCE_INDEX,OW=ga.NUMBER_OF_PROPERTIES,gc={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function Nf(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(OW),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,sr.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(Nf.prototype,{length:{get:function(){return RW(this),this._pointPrimitives.length}}});function Tue(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Nf.prototype.add=function(e){let t=new ga(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};Nf.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Nf.prototype.removeAll=function(){Tue(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function RW(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}}Nf.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};Nf.prototype.contains=function(e){return l(e)&&e._pointPrimitiveCollection===this};Nf.prototype.get=function(e){return RW(this),this._pointPrimitives[e]};Nf.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<OW;++i){let o=n[i]===0?We.STATIC_DRAW:We.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function J$e(e,t,n){return new n0(e,[{index:gc.positionHighAndSize,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[IW]},{index:gc.positionLowAndShow,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[IW]},{index:gc.compressedAttribute0,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[yue]},{index:gc.compressedAttribute1,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[Cue]},{index:gc.scaleByDistance,componentsPerAttribute:4,componentDatatype:X.FLOAT,usage:n[xue]},{index:gc.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:X.FLOAT,usage:n[Aue]}],t)}var DW=new yi;function bue(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 XV(e){this._context=e}var gP,Cit=new mt({primitiveType:He.TRIANGLES}),Ait=new Fi({color:new H(0,0,0,0)});function Tit(e,t){return new ka({context:e,colorTextures:[t],destroyAttachments:!1})}function bit(e,t){return _n.fromCache({context:e,vertexShaderSource:BE,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function Eit(e,t){return(!l(gP)||gP.viewport.width!==e||gP.viewport.height!==t)&&(gP=Ze.fromCache({viewport:new it(0,0,e,t)})),gP}XV.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:bit(o,e.fragmentShaderSource),a=Tit(o,t),c=Eit(n,i),u=e.uniformMap,f=Ait;f.framebuffer=a,f.renderState=c,f.execute(o);let d=Cit;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)};XV.prototype.isDestroyed=function(){return!1};XV.prototype.destroy=function(){return fe(this)};var KV=XV;function Sit(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}var sl=Sit;function uh(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(uh.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});uh.prototype.replaceShaderProgram=function(e){return l(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};uh.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 _n({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};uh.prototype.replaceDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(l(r)){jj(this,r);let s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};uh.prototype.getDerivedShaderProgram=function(e,t){let n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(!!l(o))return o.shaderProgram};uh.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 _n({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 jj(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];jj(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}uh.prototype.destroyReleasedShaderPrograms=function(){let e=this._shadersToRelease;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];jj(this,n),--this._numberOfShaders}this._shadersToRelease={}};uh.prototype.releaseShaderProgram=function(e){if(l(e)){let t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};uh.prototype.isDestroyed=function(){return!1};uh.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 Cot(e,t){Hpe(e);let n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(xot(r,i),{framebuffer:n[r].framebuffer,uniformMap:yot(e,r)});e._commands=o}mC.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)};mC.prototype.update=function(e){let t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,got(this,e),Cot(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};mC.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)};mC.prototype.isDestroyed=function(){return!1};mC.prototype.destroy=function(){return zpe(this),Hpe(this),fe(this)};var nk=mC;var Aot={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"},ik=Object.freeze(Aot);function CP(e){}CP.prototype.isReady=function(){return!0};CP.prototype.shouldDiscardImage=function(e){return CP.EMPTY_IMAGE===e};var ok;Object.defineProperties(CP,{EMPTY_IMAGE:{get:function(){return l(ok)||(ok=new Image,ok.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),ok}}});var AP=CP;function ba(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=Ne.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=y(e.mapStyle,ik.AERIAL),this._culture=y(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,l(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new AP),this._proxy=e.proxy,this._credit=new pn(`<a href="http://www.bing.com"><img src="${ba.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new As({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 pn)break;C.credit=new pn(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 de(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 TP(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(TP.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function Dot(e,t,n){let i=t.createViewportQuadCommand(sk,{framebuffer:n,renderState:Ze.fromCache({viewport:new it(0,0,256,256)})});e._drawCommand=i}TP.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:ct.UNSIGNED_BYTE,sampler:Ln.NEAREST});this._colorTexture=n;let i=new ka({context:t,colorTextures:[n],destroyAttachments:!1});Dot(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};TP.prototype.isDestroyed=function(){return!1};TP.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),fe(this)};var ak=TP;var Ype={};function Pot(e,t,n){let i,o,r;if(e instanceof Ji){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 Dl)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}var Iot=new h,Wpe=new h;function Xpe(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 eq(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,Iot),_=h.magnitude(h.multiplyByScalar(u,h.dot(p,u),Wpe)),m=h.magnitude(h.multiplyByScalar(f,h.dot(p,f),Wpe));r=Math.min(Pot(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 bP(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 Kpe=new h;function Oot(e,t,n,i,o,r,s,a){let c=e.camera,u=h.clone(c.position,Kpe),f=c.pitch,d=bP(c.heading,i),p=bP(c.roll,r),_=eq(c,n,u.z,n.z,s),m=Xpe(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 Rot(e,t){e.longitude<t.longitude?e.longitude+=I.TWO_PI:t.longitude+=I.TWO_PI}function Mot(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 Bot=new _e,Lot=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,Bot),m=f.pitch,x=bP(f.heading,i),C=bP(f.roll,r),A=p.cartesianToCartographic(n,Lot);_.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?Rot(_,A):Mot(_,A);let E=eq(f,n,_.height,A.height,s),S=Xpe(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 Fot(e,t,n,i,o,r,s){let a=e.camera,c=h.clone(a.position,Kpe),u=bP(a.heading,i),f=a.frustum.right-a.frustum.left,d=eq(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 jpe=new _e,Vot=new h;function Qj(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function qpe(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}Ype.createTween=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=t.destination,i=e.mode;if(i===te.MORPHING)return Qj();let o=y(t.convert,!0),
{
return ${f};
}
`}return r=`${i} ${e}
{
${r} return ${i}(1.0);
}
`,r};kE.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 gk=kE;function K0(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 Ne){let t=Ne.createIfNeeded(e),n=this;this._readyPromise=t.fetchJson(e).then(function(i){return T_e(n,i),n})}else T_e(this,e),this._readyPromise=Promise.resolve(this)}function T_e(e,t){t=y(ht(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 vd(o[r],i))}e._meta=n,e._ready=!0}function br(e,t){let n=y(e._style,y.EMPTY_OBJECT).defines;if(l(t)){if(typeof t=="boolean"||typeof t=="number")return new vd(String(t));if(typeof t=="string")return new vd(t,n);if(l(t.conditions))return new gk(t,n)}else return;return t}function Er(e){if(l(e)){if(l(e.expression))return e.expression;if(l(e.conditionsExpression))return ht(e.conditionsExpression,!0)}else return;return e}Object.defineProperties(K0.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=br(this,e),this._style.show=Er(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=br(this,e),this._style.color=Er(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=br(this,e),this._style.pointSize=Er(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=br(this,e),this._style.pointOutlineColor=Er(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=br(this,e),this._style.pointOutlineWidth=Er(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 Ck=`#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 Ak=`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 Tk=`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 dh(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 Est=dh.SHOW_INDEX=0,Sst=dh.POSITION_INDEX=1,wst=dh.SCALE_INDEX=2,vst=dh.MAXIMUM_SIZE_INDEX=3,Dst=dh.SLICE_INDEX=4,Pst=dh.BRIGHTNESS_INDEX=5,Ist=dh.COLOR_INDEX=6;dh.NUMBER_OF_PROPERTIES=7;function pC(e,t){let n=e._cloudCollection;l(n)&&(n._updateCloud(e,t),e._dirty=!0)}Object.defineProperties(dh.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,pC(this,Est))}},position:{get:function(){return this._position},set:function(e){let t=this._position;h.equals(t,e)||(h.clone(e,t),pC(this,Sst))}},scale:{get:function(){return this._scale},set:function(e){let t=this._scale;W.equals(t,e)||(W.clone(e,t),pC(this,wst))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){let t=this._maximumSize;h.equals(t,e)||(h.clone(e,t),pC(this,vst))}},color:{get:function(){return this._color},set:function(e){let t=this._color;H.equals(t,e)||(H.clone(e,t),pC(this,Ist))}},slice:{get:function(){return this._slice},set:function(e){this._slice!==e&&(this._slice=e,pC(this,Dst))}},brightness:{get:function(){return this._brightness},set:function(e){this._brightness!==e&&(this._brightness=e,pC(this,Pst))}}});dh.prototype._destroy=function(){this._cloudCollection=void 0};var $f=dh;var Fu,bk=new h,Ost={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},Rst={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},Mst=$f.SHOW_INDEX,Bst=$f.POSITION_INDEX,Lst=$f.SCALE_INDEX,Nst=$f.MAXIMUM_SIZE_INDEX,Fst=$f.SLICE_INDEX,Vst=$f.BRIGHTNESS_INDEX,kst=$f.NUMBER_OF_PROPERTIES,Ust=$f.COLOR_INDEX;function hh(e){e=y(e,y.EMPTY_OBJECT),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(kst),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:b_e(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 b_e(e){return function(){return bk.x=e._textureSliceWidth,bk.y=e._noiseTextureRows,bk.z=1/e._noiseTextureRows,bk}}Object.defineProperties(hh.prototype,{length:{get:function(){return dq(this),this._clouds.length}}});function E_e(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}hh.prototype.add=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.cloudType,wP.CUMULUS),n;return t===wP.CUMULUS&&(n=new $f(e,this),n._index=this._clouds.length,this._clouds.push(n),this._createVertexArray=!0),n};hh.prototype.remove=function(e){return this.contains(e)?(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};hh.prototype.removeAll=function(){E_e(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0};function dq(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}}hh.prototype._updateCloud=function(e,t){e._dirty||
`,n}function mct(){let e="";e+=Sc(".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+=Sc(".cesium-credit-lightbox",{"background-color":"#303336",color:RP,position:"relative","min-height":`${uct}px`,margin:"auto"}),e+=Sc(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:RP}),e+=Sc(".cesium-credit-lightbox > ul > li a:hover",{color:Aq}),e+=Sc(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=Sc(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=Sc(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=Sc(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:RP}),e+=Sc(".cesium-credit-lightbox-close:hover",{color:Aq}),e+=Sc(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=Sc(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=Sc(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=Sc(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:RP}),e+=Sc(".cesium-credit-expand-link:hover",{color:Aq}),e+=Sc(".cesium-credit-text",{color:RP}),e+=Sc(".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 qr(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),mct();let _=pn.clone(qr.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 tge(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 Q_e(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}qr.prototype.addCredit=function(e){if(e._isIon){l(this._defaultCredit)||(this._defaultCredit=pn.clone(nge())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,tge(this,t,e)};qr.prototype.addDefaultCredit=function(e){let t=this._defaultCredits;fct(t,e)||t.push(e)};qr.prototype.removeDefaultCredit=function(e){let t=this._defaultCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};qr.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(MP.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}}});MP.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;MP.prototype.isTranslucent=Mo.prototype.isTranslucent;MP.prototype.getRenderState=Mo.prototype.getRenderState;var ige=MP;function Vk(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 pct=new h,_ct=new Q,gct=new ke,yct=new Ji,xct=new Dl,Cct=new In,Act=new ls,Tct=new H,bct=[1,1e5];Vk.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 Ji?a=yct:s instanceof Dl?a=xct:s instanceof In?a=Cct:a=Act,a=s.clone(a);let c,u=this._frustumSplits;!l(u)||u.length<=1?(u=bct,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(_,pct);let m=_ct;Q.setColumn(m,0,_,m),Q.setColumn(m,1,p,m),Q.setColumn(m,2,d,m);let x=ke.fromRotationMatrix(m,gct);for(t.length=n.length=c,i=0;i<c;++i)a.near=u[i],a.far=u[i+1],t[i]=new ei({geometryInstances:new kt({geometry:new iT({origin:f,orientation:x,frustum:a,_drawNearPlane:i===0}),attributes:{color:nn.fromColor(H.fromAlpha(this._color,.1,Tct))},id:this.id,pickPrimitive:this}),appearance:new Mn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new ei({geometryInstances:new kt({geometry:new SO({origin:f,orientation:x,frustum:a,_drawNearPlane:i===0}),attributes:{color:nn.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new Mn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};Vk.prototype.isDestroyed=function(){return!1};Vk.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 T_=Vk;function oge(){this._cachedShowFrustumsShaders={}}function Ect(e){let t={},n=e.vertexAttributes;for(let i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function Sct(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=Ect(i);return _n.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}var BP=new H;function wct(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?(BP.red=t.debugOverlappingFrustums&1<<0?1:0,BP.green=t.debugOverlappingFrustums&1<<1?1:0,BP.blue=t.debugOverlappingFrustums&1<<2?1:0,BP.alpha=1,BP):H.WHITE}),n}var vct=new mt;oge.prototype.executeDebugShowFrustumsCommand=function(e,t,n){let i=t.shaderProgram.id,o=this._cachedShowFrustumsShaders[i];l(o)||(o=Sct(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);let r=mt.shallowClone(t,vct);r.shaderProgram=o,r.uniformMap=wct(e,t),r.execute(e.context,n)};var kk=oge;function Uk(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}Uk.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 gg({positions:[h.ZERO,h.UNIT_X],width:this.width,vertexFormat:bs.VERTEX_FORMAT,colors:[H.RED,H.RED],arcType:En.NONE}),modelMatrix:O.multiplyByUniformScale(this.modelMatrix,this.length,new O),id:this.id,pickPrimitive:this}),n=new kt({geometry:new gg({positions:[h.ZERO,h.UNIT_Y],width:this.width,vertexFormat:bs.VERTEX_FORMAT,colors:[H.GREEN,H.GREEN],arcType:En.NONE}),modelMatrix:O.multiplyByUniformScale(this.modelMatrix,this.length,new O),id:this.id,pickPrimitive:this}),i=new kt({geometry:new gg({positions:[h.ZERO,h.UNIT_Z],width:this.width,vertexFormat:bs.VERTEX_FORMAT,colors:[H.BLUE,H.BLUE],arcType:En.NONE}),modelMatrix:O.multiplyByUniformScale(this.modelMatrix,this.length,new O),id:this.id,pickPrimitive:this});this._primitive=new ei({geometryInstances:[t,n,i],appearance:new bs,asynchronous:!1})}this._primitive.update(e)}};Uk.prototype.isDestroyed=function(){return!1};Uk.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),fe(this)};var zk=Uk;var Hk=`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 Gk=`attribute vec4 position;
varying vec4 positionEC;
void main()
{
positionEC = czm_modelView * position;
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
}
`;function NP(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 LP=Kt.supportsTypedArrays()?new Float32Array(12):[],rge=new h,sge=new h,Tq=new h,age=new h,Wk=new h;function Dct(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,rge),_=h.normalize(p,sge),m=h.normalize(h.cross(h.UNIT_Z,p,Tq),Tq),x=h.normalize(h.cross(_,m,age),age),C=h.magnitude(p),A=Math.sqrt(C*C-1);o=h.multiplyByScalar(_,1/C,rge);let T=A/C;r=h.multiplyByScalar(m,T,sge),s=h.multiplyByScalar(x,T,Tq)}let a=h.add(o,s,Wk);h.subtract(a,r,a),h.multiplyComponents(n,a,a),h.pack(a,LP,0);let c=h.subtract(o,s,Wk);h.subtract(c,r,c),h.multiplyComponents(n,c,c),h.pack(c,LP,3);let u=h.add(o,s,Wk);h.add(u,r,u),h.multiplyComponents(n,u,u),h.pack(u,LP,6);let f=h.subtract(o,s,Wk);return h.add(f,r,f),h.multiplyComponents(n,f,f),h.pack(f,LP,9),LP}NP.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 mt({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:[Gk]}),a=new je({sources:[Hk]});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=_n.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}let r=Dct(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=Pi.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:We.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};NP.prototype.execute=function(e,t){this._mode===te.SCENE3D&&this._command.execute(e,t)};NP.prototype.isDestroyed=function(){return!1};NP.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};var jk=NP;function FP(){}var Pct=/\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(Pct.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}FP.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=mt.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 Mct=/\s+czm_writeLogDepth\(/,Bct=/\s+czm_vertexLogDepth\(/,Lct=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function Nct(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(Bct.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)Mct.test(u[s])&&(c=!0);r.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(c=!0);let d=!0;for(s=0;s<f;++s)Lct.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}FP.createLogDepthCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=mt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=Nct(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function Fct(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 Vct(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}FP.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=mt.shallowClone(t,i.pickCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=Fct(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=Vct(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function kct(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}FP.createHdrCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=mt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=kct(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};var ey=FP;function qk(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 Uct=new ke,cge=new ke,zct=new Q;function Hct(e,t,n,i){let o=e.direction,r=e.right,s=e.up,a=ke.fromAxisAngle(o,n,cge),c=ke.fromAxisAngle(r,i,Uct),u=ke.multiply(c,a,c),f=ke.fromAxisAngle(s,t,cge);ke.multiply(f,u,u);let d=Q.fromQuaternion(u,zct);Q.multiplyByVector(d,r,r),Q.multiplyByVector(d,s,s),Q.multiplyByVector(d,o,o)}qk.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;Hct(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};qk.prototype.isDestroyed=function(){return!1};qk.prototype.destroy=function(){return this._removeListener(),fe(this)};var Yk=qk;function Gct(e){this.direction=h.clone(e.direction),this.color=H.clone(y(e.color,H.WHITE)),this.intensity=y(e.intensity,1)}var lge=Gct;var VP=`#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 kP=`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 bq={position:0};function Xk(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 mt({owner:y(e._owner,this)}),this._pickCommand=new mt({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 Wct(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(l(t))return t;let n=tu.createGeometry(tu.fromDimensions({dimensions:new h(2,2,2),vertexFormat:Fe.POSITION_ONLY}));return t=Pi.fromGeometry({context:e,geometry:n,attributeLocations:bq,bufferUsage:We.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}var uge=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
`;Xk.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:Ao.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?zn.ALPHA_BLEND:void 0})),l(this._va)||(this._va=Wct(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:[kP]}),p=new je({sources:[this.material.shaderSource,VP]}),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(uge)),this._sp=_n.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:bq}),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:[kP]}),p=new je({sources:[this.material.shaderSource,VP],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(uge)),this._pickSP=_n.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:bq}),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)}};Xk.prototype.isDestroyed=function(){return!1};Xk.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 Kk=Xk;var $k=`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 Zk=`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 yC(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,Zk),this._fragmentShaderSource=y(e.fragmentShaderSource,$k),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(yC.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 yC.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}});yC.VERTEX_FORMAT=Fe.POSITION_AND_ST;yC.prototype.getFragmentShaderSource=Mo.prototype.getFragmentShaderSource;yC.prototype.isTranslucent=Mo.prototype.isTranslucent;yC.prototype.getRenderState=Mo.prototype.getRenderState;var fge=yC;function dge(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}var Jk=[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],Fm=[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<Fm.length;++e)Fm[e]*=1e6;var hge=Fm[1],Eq=Fm[Fm.length-1];for(let e=0;e<Fm.length;++e)Fm[e]=(Fm[e]-Eq)/(hge-Eq);var Ea=0;function jct(e){let t=Jk,n=t.length;if(e<t[0])return Ea=0,Ea;if(e>t[n-1])return Ea=n-2,Ea;if(e>=t[Ea]){if(Ea+1<n&&e<t[Ea+1])return Ea;if(Ea+2<n&&e<t[Ea+2])return++Ea,Ea}else if(Ea-1>=0&&e>=t[Ea-1])return--Ea,Ea;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return Ea=i,Ea}var qct=new h;dge.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=jct(o),s=I.clamp((o-Jk[r])/(Jk[r+1]-Jk[r]),0,1),a=I.lerp(Fm[r],Fm[r+1],s),c=this.density*1e6,u=c/hge*Eq;a=a*(c-u)*1e-6;let f=h.normalize(n.positionWC,qct),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 Qk=dge;function Zl(e){this._scene=e.scene,this.samplingWindow=y(e.samplingWindow,Zl.defaultSettings.samplingWindow),this.quietPeriod=y(e.quietPeriod,Zl.defaultSettings.quietPeriod),this.warmupPeriod=y(e.warmupPeriod,Zl.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=y(e.minimumFrameRateDuringWarmup,Zl.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=y(e.minimumFrameRateAfterWarmup,Zl.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){Yct(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(){Xct(t)}this._visibilityChangeRemoveListener=void 0,l(n)&&(document.addEventListener(n,i,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(n,i,!1)})}Zl.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 oU=`#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 ty=`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 UP=`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 Zct(e,t,n,i,o){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o}function Sq(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function Jct(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 Qct(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}Sq.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===ia.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,he=0;l(R)&&R.length>0&&(he=D?R.clippingPlanesState:0);let oe=n.surfaceShader;if(l(oe)&&oe.numberOfDayTextures===i&&oe.flags===ce&&oe.material===this.material&&oe.clippingShaderState===he)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!==he){let ge=this.baseVertexShaderSource.clone(),De=this.baseFragmentShaderSource.clone();he!==0&&De.sources.unshift(qg(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 et=0;et<i;++et)L?Re+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${et}];
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[${et}],
u_dayTextureUseWebMercatorT[${et}] ? textureCoordinates.xz : textureCoordinates.xy,
u_dayTextureTexCoordsRectangle[${et}],
u_dayTextureTranslationAndScale[${et}],
${u?`u_dayTextureAlpha[${et}]`:"1.0"},
${f?`u_dayTextureNightAlpha[${et}]`:"1.0"},
${f?`u_dayTextureDayAlpha[${et}]`:"1.0"},
${o?`u_dayTextureBrightness[${et}]`:"0.0"},
${r?`u_dayTextureContrast[${et}]`:"0.0"},
${s?`u_dayTextureHue[${et}]`:"0.0"},
${a?`u_dayTextureSaturation[${et}]`:"0.0"},
${c?`u_dayTextureOneOverGamma[${et}]`:"0.0"},
${d?`u_dayTextureSplit[${et}]`:"0.0"},
${b?`u_colorsToAlpha[${et}]`:"vec4(0.0)"},
nightBlend );
`,L&&(Re+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
`);Re+=` return color;
}`,De.sources.push(Re),ge.sources.push(Jct(J)),ge.sources.push(Qct(S));let Pe=_n.fromCache({context:t.context,vertexShaderSource:ge,fragmentShaderSource:De,attributeLocations:V.getAttributeLocations()});oe=le[ce]=new Zct(i,ce,this.material,Pe,he)}return n.surfaceShader=oe,oe.shaderProgram};Sq.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 rU=Sq;var elt={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},Vi=Object.freeze(elt);var tlt={START:0,LOADING:1,DONE:2,FAILED:3},Sa=Object.freeze(tlt);var nlt={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},Jo=Object.freeze(nlt);function Sr(){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=Jo.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(Sr.prototype,{eligibleForUnloading:{get:function(){let e=this.terrainState,n=!(e===Jo.RECEIVING||e===Jo.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 ilt=new _e;function wq(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,ilt);s=n.project(c,r),s=h.fromElements(s.z,s.x,s.y,r)}return s}var olt=new h,rlt=new h,slt=new h;Sr.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=wq(c,t,n,s,p,olt),C=wq(c,t,n,s,_,rlt),A=wq(c,t,n,s,m,slt),T=vo.rayTriangleParametric(e,x,C,A,i);l(T)&&T<f&&T>=0&&(f=T)}return f!==Number.MAX_VALUE?oi.getPoint(e,f,o):void 0};Sr.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=Jo.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()};Sr.prototype.freeVertexArray=function(){Sr._freeVertexArray(this.vertexArray),this.vertexArray=void 0,Sr._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};Sr.initialize=function(e,t,n){let i=e.data;l(i)||(i=e.data=new Sr),e.state===Sa.START&&(alt(e,t,n),e.state=Sa.LOADING)};Sr.processStateMachine=function(e,t,n,i,o,r,s){Sr.initialize(e,n,i);let a=e.data;if(e.state===Sa.LOADING&&clt(e,t,n,i,o,r),s)return;let c=e.renderable;e.renderable=l(a.vertexArray);let u=a.terrainState===Jo.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=Sa.DONE}c&&(e.renderable=!0)};Sr.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 aU=`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 KE(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}KE.createPlaceholder=function(e){let t=new KE(e,0,0,0);return t.addReference(),t.state=Vi.PLACEHOLDER,t};KE.prototype.addReference=function(){++this.referenceCount};KE.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};KE.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 zP=KE;function vq(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}vq.prototype.freeResources=function(){l(this.readyImagery)&&this.readyImagery.releaseReference(),l(this.loadingImagery)&&this.loadingImagery.releaseReference()};vq.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 HP=vq;function go(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,go.DEFAULT_BRIGHTNESS)),this.contrast=y(t.contrast,y(e.defaultContrast,go.DEFAULT_CONTRAST)),this.hue=y(t.hue,y(e.defaultHue,go.DEFAULT_HUE)),this.saturation=y(t.saturation,y(e.defaultSaturation,go.DEFAULT_SATURATION)),this.gamma=y(t.gamma,y(e.defaultGamma,go.DEFAULT_GAMMA)),this.splitDirection=y(t.splitDirection,y(e.defaultSplit,go.DEFAULT_SPLIT)),this.minificationFilter=y(t.minificationFilter,y(e.defaultMinificationFilter,go.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=y(t.magnificationFilter,y(e.defaultMagnificationFilter,go.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 HP(zP.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,go.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(go.prototype,{imagery
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(colorTexture, v_textureCoordinates);
}
`;var CC=`uniform highp sampler2D u_depthTexture;
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);
}
`;function Vm(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new Gi({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new Gi({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new Gi,this._tempCopyDepthFramebuffer=new Gi,this._updateDepthFramebuffer=new Gi({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(Vm.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 Put(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function Yge(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:zn.ALPHA_BLEND}),e._rsUpdate=Ze.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Yi.EQUAL,frontOperation:{fail:ln.KEEP,zFail:ln.KEEP,zPass:ln.KEEP},backFunction:Yi.NEVER,reference:On.CESIUM_3D_TILE_MASK,mask:On.CESIUM_3D_TILE_MASK}})),l(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(CC,{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(Uu,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,l(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(CC,{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(Uu,{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}Vm.prototype.update=function(e,t,n,i,o,r){let s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?ct.HALF_FLOAT:ct.FLOAT:ct.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),Yge(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};Vm.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};Vm.prototype.executeCopyDepth=function(e,t){l(this._copyDepthCommand)&&(this.p
{
gl_FragColor = vec4(1.0);
}
`;t.sources=[n]}function zq(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 o0e(e,t){zq(e,t),ed(e.defines,"GROUND_ATMOSPHERE"),ed(t.defines,"GROUND_ATMOSPHERE"),ed(e.defines,"FOG"),ed(t.defines,"FOG")}function zut(e,t){zq(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Hut(e,t){o0e(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Zge(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 Gut(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 Wut(e){e.cull.face=Ao.BACK,e.cull.enabled=!0}function jut(e){e.cull.face=Ao.FRONT,e.cull.enabled=!0}function qut(e){e.cull.face=Ao.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Yut(e){e.cull.face=Ao.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Xut(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Jge(e){e.cull.face=Ao.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=zn.ALPHA_BLEND}function Qge(e){e.cull.face=Ao.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=zn.ALPHA_BLEND}function Kut(e){e.cull.face=Ao.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function $ut(e){e.cull.face=Ao.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function Zut(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 QE(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function Jut(e,t,n,i,o){return l(o)?!i&&l(n)?n:Dt(t,o(e),!1):t}function gh(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function Qut(){return[new gh({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:kut,getRenderStateFunction:Wut,getUniformMapFunction:void 0}),new gh({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:Uut,getRenderStateFunction:jut,getUniformMapFunction:void 0}),new gh({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:Uq,getRenderStateFunction:qut,getUniformMapFunction:void 0}),new gh({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:Uq,getRenderStateFunction:Yut,getUniformMapFunction:void 0}),new gh({pass:Se.GLOBE,pickOnly:!1,getShaderProgramFunction:Uq,getRenderStateFunction:Xut,getUniformMapFunction:void 0}),new gh({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:zq,getRenderStateFunction:Jge,getUniformMapFunction:QE}),new gh({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:o0e,getRenderStateFunction:Qge,getUniformMapFunction:QE}),new gh({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:zut,getRenderStateFunction:Jge,getUniformMapFunction:QE}),new gh({pass:Se.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Hut,getRenderStateFunction:Qge,getUniformMapFunction:QE}),new gh({pass:Se.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:Zge,getRenderStateFunction:Kut,getUniformMapFunction:QE}),new gh({pass:Se.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:Zge,getRenderStateFunction:$ut,getUniformMapFunction:QE})]}var e0e=new Array(TC),t0e=new Array(TC);bC.prototype.updateDerivedCommands=function(e,t){let n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)t0e[o]=this._derivedCommandPacks[n[o]],e0e[o]=i0e[n[o]];eft(this,e,i,n,e0e,t0e,t)}};function eft(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;
}
`,hft=`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
}
`;km.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:ct.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new Cf({context:e,width:s,height:a,format:Ul.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(lft),this._rsClassified=Ze.fromCache(uft),this._rsDefault=Ze.fromCache(fft)),!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)?hft:dft,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(Uu,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};km.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};km.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))};km.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)};km.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};km.prototype.isDestroyed=function(){return!1};km.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 KP=km;function BU(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(BU.prototype,{total:{get:function(){return this._total}}});function iy(e){let t=new Array(Es.NUMBER_OF_JOB_TYPES);t[Es.TEXTURE]=new BU(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 kU=`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 E_(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 Gi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new Gi({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new Gi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new Gi({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 h0e(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function Wq(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function m0e(e){h0e(e),Wq(e)}function gft(e,t,n,i){h0e(e),e._accumulationTexture=new Zt({context:t,width:n,height:i,pixelFormat:It.RGBA,pixelDatatype:ct.FLOAT});let o=new Float32Array(n*i*4);e._revealageTexture=new Zt({context:t,pixelFormat:It.RGBA,pixelDatatype:ct.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function yft(e,t){Wq(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)&&(Wq(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)&&(m0e(e),e._translucentMultipassSupport=!1,i=!1)}return i}E_.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,gft(this,e,r,s)),(!l(this._translucentFBO.framebuffer)||c||u)&&!yft(this,e))return;this._useHDR=i;let f=this,d,p;l(this._compositeCommand)||(d=new je({sources:[kU]}),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);
`,wft=` 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;
`,vft=` float ai = czm_gl_FragColor.a;
gl_FragColor = vec4(ai);
`;function qq(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 Dft(e,t){return qq(e,t,"translucentMRT",Sft)}function Pft(e,t){return qq(e,t,"translucentMultipass",wft)}function Ift(e,t){return qq(e,t,"alphaMultipass",vft)}E_.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=mt.shallowClone(e,n.translucentCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=Dft(t,e.shaderProgram),n.translucentCommand.renderState=Tft(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=mt.shallowClone(e,n.translucentCommand),n.alphaCommand=mt.shallowClone(e,n.alphaCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=Pft(t,e.shaderProgram),n.translucentCommand.renderState=bft(this,t,e.renderState),n.alphaCommand.shaderProgram=Ift(t,e.shaderProgram),n.alphaCommand.renderState=Eft(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 Oft(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 Rft(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}E_.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){Rft(this,e,t,n,i,o);return}Oft(this,e,t,n,i,o)};E_.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};E_.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}SC.prototype.update=function(e,t){Hft(this,e,t),Gft(this,e,t)};var Wft=new ae,jft=new ae(1,1/255,1/65025,1/16581375);SC.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,Wft);return ae.divideByScalar(o,255,o),ae.dot(o,jft)};SC.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};SC.prototype.isDestroyed=function(){return!1};SC.prototype.destroy=function(){return this._framebuffer.destroy(),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=l(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),fe(this)};var WU=SC;function e1(){this._framebuffer=new Gi({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(e1.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function qft(e){e._framebuffer.destroy()}function Yft(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);let o=new sl(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new it},o.viewport=new it,e._passState=o}e1.prototype.update=function(e,t,n){let i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&Yft(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};e1.prototype.isDestroyed=function(){return!1};e1.prototype.destroy=function(){return qft(this),fe(this)};var jU=e1;function n1(e){let t=new sl(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new it},t.viewport=new it,this._context=e,this._fb=new Gi({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}n1.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 t1=new H;n1.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);t1.red=H.byteToFloat(o[m]),t1.green=H.byteToFloat(o[m+1]),t1.blue=H.byteToFloat(o[m+2]),t1.alpha=H.byteToFloat(o[m+3]);let x=i.getObjectByPickColor(t1);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}};n1.prototype.isDestroyed=function(){return!1};n1.prototype.destroy=function(){return this._fb.destroy(),fe(this)};var qU=n1;function S_(){this._numSamples=1,this._colorFramebuffer=new Gi({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new Gi({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 Xft(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(S_.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});S_.prototype.update=function(e,t,n,i){let o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?ct.HALF_FLOAT:ct.FLOAT:ct.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};S_.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})};wC.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})};wC.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}`};wC.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})};wC.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 w_=wC;function Um(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 YU,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 ls: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 Kft(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,Kq(this),this._clearCommand=new Fi({depth:1,color:new H}),this._clearPassState=new sl(t),this._size=y(e.size,2048),this.size=this._size}Um.MAXIMUM_DISTANCE=2e4;function Kft(e){this.camera=new YU,this.passState=new sl(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function Xq(e,t){return Ze.fromCache({cull:{enabled:!0,face:Ao.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 Kq(e){let t=!e._usesDepthTexture;e._primitiveRenderState=Xq(t,e._primitiveBias),e._terrainRenderState=Xq(t,e._terrainBias),e._pointRenderState=Xq(t,e._pointBias)}Um.prototype.debugCreateRenderStates=function(){Kq(this)};Object.defineProperties(Um.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){tdt(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 odt(e,t){let n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=ndt;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;l(a)||(a=idt(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 zm=new Array(8);zm[0]=new ae(-1,-1,-1,1);zm[1]=new ae(1,-1,-1,1);zm[2]=new ae(1,1,-1,1);zm[3]=new ae(-1,1,-1,1);zm[4]=new ae(-1,-1,1,1);zm[5]=new ae(1,-1,1,1);zm[6]=new ae(1,1,1,1);zm[7]=new ae(-1,1,1,1);var ry=new O,Zq=new Array(8);for(let e=0;e<8;++e)Zq[e]=new ae;function rdt(e,t){let n=new kt({geometry:new Nh({minimum:new h(-.5,-.5,-.5),maximum:new h(.5,.5,.5)}),attributes:{color:nn.fromColor(t)}}),i=new kt({geometry:new Sg({radius:.5}),attributes:{color:nn.fromColor(t)}});return new ei({geometryInstances:[n,i],appearance:new Mn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var sdt=[H.RED,H.GREEN,H.BLUE,H.MAGENTA],adt=new h;function cdt(e,t){odt(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 T_({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 T_({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 T_({camera:e._passes[i].camera,color:sdt[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,adt),a=O.fromTranslationQuaternionRotationScale(i,o,s,ry);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=rdt(a,H.YELLOW)}e._debugLightFrustum.update(t)}else(!l(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new T_({camera:e._shadowMapCamera,color:H.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function YU(){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}YU.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 ldt=new O(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);YU.prototype.getViewProjection=function(){let e=this.viewMatrix,t=this.frustum.projectionMatrix;return O.multiply(t,e,this.viewProjectionMatrix),O.multiply(ldt,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var udt=new Array(5),fdt=new Ji,ddt=new Array(4),v0e=new h,D0e=new h;function hdt(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=ddt,_=udt;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 iS=`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 Ddt=!1;function ay(e){this._drawClassificationFBO=new Gi({createDepthAttachments:!1}),this._accumulationFBO=new Gi({createDepthAttachments:!1}),this._packFBO=new Gi,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(ay.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function O0e(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function R0e(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function Pdt(e,t,n,i){O0e(e),e._translucentDepthStencilTexture=new Zt({context:t,width:n,height:i,pixelFormat:It.DEPTH_STENCIL,pixelDatatype:ct.UNSIGNED_INT_24_8,sampler:Ln.NEAREST})}function Idt(e,t,n,i){R0e(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 Odt(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)&&(Pdt(e,t,o,r),Idt(e,t,o,r));let s,a;if(l(e._packDepthCommand)||(s=new je({sources:[XU]}),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:[iS]}),a={colorTexture:function(){return e._textureToComposite}},Ddt&&(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}),_=mt.shallowClone(f);_.shaderProgram=p,f.derivedCommands.pick=_}l(e._copyCommand)||(s=new je({sources:[iS]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),l(e._accumulateCommand)||(s=new je({sources:[iS]}),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:Yi.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 yht(e){let t=e._sampleMode,n,i;t===td.LINEAR?(n=en.LINEAR,i=To.LINEAR):(n=en.NEAREST,i=To.NEAREST);let o=e._sampler;(!l(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new Ln({wrapS:Gn.CLAMP_TO_EDGE,wrapT:Gn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function xht(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function Cht(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function Aht(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]=Cht(e,d);else if(typeof d=="string"){let _=new Ne({url:d});f.push(_.fetchImage().then(xht(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 X0e(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 Tht(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 bht(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:ct.UNSIGNED_BYTE,source:{arrayBufferView:f,width:1,height:1},sampler:Ln.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:ct.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:Ln.NEAREST})}vC.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&X0e(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=Tht(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,bht(this,e),_ht(this),Aht(this,e),ght(this,e),yh
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 n4=`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 i4=`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 o4=`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 r4=`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 s4=`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 a4=`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 c4=`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 l4=`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 u4=`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 f4=`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 d4=`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 DC=`#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 h4=`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 m4=`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 p4=`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 _4=`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 g4=`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 y4=`#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 PC(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(PC.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}}});PC.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};PC.prototype.get=function(e){return this._stages[e]};function Eht(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}PC.prototype.update=function(e,t){this._selectedDirty=Eht(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)}};PC.prototype.isDestroyed=function(){return!1};PC.prototype.destroy=function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return fe(this)};var Jl=PC;var is={};function x4(e){let o=`#define USE_STEP_SIZE
${DC}`,r=new Qo({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:td.LINEAR}),s=new Qo({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:td.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 Jl({name:e,stages:[r,s],uniforms:a})}is.createBlurStage=function(){return x4("czm_blur")};is.createDepthOfFieldStage=function(){let e=x4("czm_depth_of_field_blur"),t=new Qo({name:"czm_depth_of_field_composite",fragmentShader:c4,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 Jl({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};is.isDepthOfFieldSupported=function(e){return e.context.depthTexture};is.createEdgeDetectionStage=function(){let e=hi();return new Qo({name:`czm_edge_detection_${e}`,fragmentShader:u4,uniforms:{length:.25,color:H.clone(H.BLACK)}})};is.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function Sht(e){if(!l(e))return is.createEdgeDetectionStage();let t=new Jl({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 Qo({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new Jl({name:"czm_edge_detection_composite",stages:[t,s]})}is.createSilhouetteStage=function(e){let t=Sht(e),n=new Qo({name:"czm_silhouette_color_edges",fragmentShader:g4,uniforms:{silhouetteTexture:t.name}});return new Jl({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};is.isSilhouetteSupported=function(e){return e.context.depthTexture};is.createBloomStage=function(){let e=new Qo({name:"czm_bloom_contrast_bias",fragmentShader:a4,uniforms:{contrast:128,brightness:-.3}}),t=x4("czm_bloom_blur"),n=new Jl({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new Qo({name:"czm_bloom_generate_composite",fragmentShader:r4,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 Jl({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};is.createAmbientOcclusionStage=function(){let e=new Qo({name:"czm_ambient_occlusion_generate",fragmentShader:n4,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=x4("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;let n=new Jl({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new Qo({name:"czm_ambient_occlusion_composite",fragmentShader:i4,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 Jl({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};is.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var wht=`#define FXAA_QUALITY_PRESET 39
${y4}
${d4}`;is.createFXAAStage=function(){return new Qo({name:"czm_FXAA",fragmentShader:wht,sampleMode:td.LINEAR})};is.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=t4,new Qo({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};is.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=f4,new Qo({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};is.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=_4,new Qo({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};is.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=m4,new Qo({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:H.WHITE,autoExposure:void 0}})};is.createAutoExposureStage=function(){return new nk};is.createBlackAndWhiteStage=function(){return new Qo({name:"czm_black_and_white",fragmentShader:o4,uniforms:{gradations:5}})};is.createBrightnessStage=function(){return new Qo({name:"czm_brightness",fragmentShader:s4,uniforms:{brightness:.5}})};is.createNightVisionStage=function(){return new Qo({name:"czm_night_vision",fragmentShader:p4})};is.createDepthViewStage=function(){return new Qo({name:"czm_depth_view",fragmentShader:l4})};is.createLensFlareStage=function(){return new Qo({name:"czm_lens_flare",fragmentShader:h4,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 yh=is;function v_(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function r1(e){for(;l(e.length);)e=e.get(e.length-1);return e.name}function tY(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[r1(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[r1(d)]=!0)}}}return i.name}function o1(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=o1(e,t,n,p,o):a=tY(e,t,n,p,o),s&&(o=a)}let u,f;if(s)for(u=1;u<c;++u)f=r1(i.get(u)),l(n[f])||(n[f]={}),n[f][r]=!0;else for(u=1;u<c;++u){f=r1(i.get(u));let d=n[f];for(let p=0;p<u;++p)d[r1(i.get(p))]=!0}return a}function vht(e,t){let n={};if(l(e.ambientOcclusion)){let i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa,a=o1(e,t,n,i,void 0);a=o1(e,t,n,o,a),a=tY(e,t,n,r,a),a=o1(e,t,n,e,a),tY(e,t,n,s,a)}else o1(e,t,n,e,void 0);return n}function Dht(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 Gi({pixelFormat:a,pixelDatatype:c}),clear:void 0},p.push(d),d)}function Pht(e,t){let n=vht(e._collection,t);for(let i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=Dht(e,i,n[i]))}function nY(e){let t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function Iht(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})}}v_.prototype.updateDependencies=function(){this._updateDependencies=!0};v_.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)&&(nY(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&Pht(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 M4=`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 D_(){this._sceneFramebuffer=new nS;let e=.125,t=new Array(6);t[0]=new Qo({fragmentShader:Uu,textureScale:e,forcePowerOfTwo:!0,sampleMode:td.LINEAR});let n=t[1]=new Qo({fragmentShader:M4,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 Qo({fragmentShader:DC,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 Qo({fragmentShader:DC,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 Qo({fragmentShader:Uu,sampleMode:td.LINEAR}),this._uCenter=new W,this._uRadius=void 0,t[5]=new Qo({fragmentShader:R4,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new Jl({stages:t});let o=new aS(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}D_.prototype.get=function(e){return this._stages.get(e)};D_.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 t_t=new ae,Bye=new W,n_t=new W,Lye=new O;function i_t(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,Lye),u=O.multiplyByPoint(r,o,t_t),f=Ut.pointToGLWindowCoordinates(s,c,o,Bye);u.x+=I.SOLAR_RADIUS;let d=Ut.pointToGLWindowCoordinates(a,c,u,u),p=W.magnitude(W.subtract(d,f,d))*30*2,_=n_t;_.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,Lye),f=Ut.pointToGLWindowCoordinates(s,c,o,Bye),_.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)}D_.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};D_.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),i_t(this,t,n),o};D_.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)};D_.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(Uu,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};D_.prototype.isDestroyed=function(){return!1};D_.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),fe(this)};var B4=D_;var N4=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function bo(e){e=y(e,y.EMPTY_OBJECT);let t=e.canvas,n=e.creditContainer,i=e.creditViewport,o=ht(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 QV(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 LU,this._frameState=new tU(s,new Fk(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 V4=`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 k4=`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 lS(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 mt({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(lS.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});lS.prototype.setDynamicAtmosphereColor=function(e,t){let n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};var vY=new O;lS.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,vY),o=O.multiplyTransformation(i,ui.Y_UP_TO_Z_UP,vY),r=O.multiply(this._scaleMatrix,o,vY);O.clone(r,this._modelMatrix);let s=e.context,a=W_t(this),c=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||c||!l(t)||!t.show,f=this._command;if(!l(f.vertexArray)){let p=ra.createGeometry(new ra({radii:new h(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Fe.POSITION_ONLY}));f.vertexArray=Pi.fromGeometry({context:s,geometry:p,attributeLocations:di.createAttributeLocations(p),bufferUsage:We.STATIC_DRAW}),f.renderState=Ze.fromCache({cull:{enabled:!0,face:Ao.FRONT},blending:zn.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:[ty,f1,k4]}),m=new je({defines:p,sources:[ty,f1,V4]});this._spSkyAtmosphere=_n.fromCache({context:s,vertexShaderSource:_,fragmentShaderSource:m}),f.shaderProgram=this._spSkyAtmosphere}return f};function W_t(e){return!(I.equalsEpsilon(e.hueShift,0,I.EPSILON7)&&I.equalsEpsilon(e.saturationShift,0,I.EPSILON7)&&I.equalsEpsilon(e.brightnessShift,0,I.EPSILON7))}lS.prototype.isDestroyed=function(){return!1};lS.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 U4=lS;var z4=`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 H4=`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 G4(e){this.sources=e.sources,this._sources=void 0,this.show=y(e.show,!0),this._command=new mt({modelMatrix:O.clone(O.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}G4.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"?ek(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 Wc({context:i,source:r}))}let o=this._command;if(!l(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};let r=tu.createGeometry(tu.fromDimensions({dimensions:new h(2,2,2),vertexFormat:Fe.POSITION_ONLY})),s=this._attributeLocations=di.createAttributeLocations(r);o.vertexArray=Pi.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:We.STATIC_DRAW}),o.renderState=Ze.fromCache({blending:zn.ALPHA_BLEND})}if(!l(o.shaderProgram)||this._useHdr!==t){let r=new je({defines:[t?"HDR":""],sources:[z4]});o.shaderProgram=_n.fromCache({context:i,vertexShaderSource:H4,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(!!l(this._cubeMap))return o};G4.prototype.isDestroyed=function(){return!1};G4.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 W4=G4;function DY(e){e=y(e,1),this._radius=y(e,1)}Object.defineProperties(DY.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}});DY.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 Gye=DY;function d1(){}d1.prototype.evaluate=function(e,t){Ae.throwInstantiationError()};d1.prototype.evaluateColor=function(e,t){Ae.throwInstantiationError()};d1.prototype.getShaderFunction=function(e,t,n,i){Ae.throwInstantiationError()};d1.prototype.getVariables=function(){Ae.throwInstantiationError()};var Wye=d1;var j4=`uniform sampler2D u_texture;
varying vec2 v_textureCoordinates;
void main()
{
vec4 color = texture2D(u_texture, v_textureCoordinates);
gl_FragColor = czm_gammaCorrect(color);
}
`;var q4=`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 Y4=`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 m1(){this.show=!0,this._drawCommand=new mt({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(m1.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});var j_t=new W,q_t=new W,Y_t=new ae,h1=new ae;m1.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?ct.HALF_FLOAT:ct.FLOAT:ct.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 Sd({fragmentShaderSource:q4,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 Pi({context:o,attributes:R,indexBuffer:M}),a.shaderProgram=_n.fromCache({context:o,vertexShaderSource:Y4,fragmentShaderSource:j4,attributeLocations:S}),a.renderState=Ze.fromCache({blending:zn.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,h1),_=h.magnitude(h.subtract(p,e.camera.position,h1)),m=o.uniformState.projection,x=Y_t;x.x=0,x.y=0,x.z=-_,x.w=1;let C=O.multiplyByVector(m,x,h1),A=Oo.clipToGLWindowCoordinates(t.viewport,C,j_t);x.x=I.SOLAR_RADIUS;let T=O.multiplyByVector(m,x,h1),E=Oo.clipToGLWindowCoordinates(t.viewport,T,q_t);return this._size=W.magnitude(W.subtract(E,A,h1)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};m1.prototype.isDestroyed=function(){return!1};m1.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 X4=m1;function uS(){}uS.prototype.boundingVolume=void 0;uS.prototype.boundingSphere=void 0;uS.prototype.distanceToCamera=function(e){Ae.throwInstantiationError()};uS.prototype.intersectPlane=function(e){Ae.throwInstantiationError()};uS.prototype.createDebugVolume=function(e){Ae.throwInstantiationError()};var jye=uS;function p1(e){e=y(e,y.EMPTY_OBJECT),this._tilingScheme=l(e.tilingScheme)?e.tilingScheme:new wo({ellipsoid:e.ellipsoid}),this._color=y(e.co
${e}`}function $_t(e){return function(t){return Dt(t,{czm_pickColor:function(){return e._pickId.color}})}}function Z_t(){return"czm_pickColor"}NC.prototype.makeStyleDirty=function(){this._styleDirty=!0};NC.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};var J_t=new ee;function OY(e){let t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function LC(e,t){return e._intervals.indexOf(t.start)}function Q_t(e,t){let n=e._intervals,i=e._clock,o=OY(e);if(o===0)return;let r=e._getAverageLoadTime(),s=ee.addSeconds(i.currentTime,r*o,J_t),a=n.indexOf(s),c=LC(e,t);return a===c&&(o>=0?++a:--a),n.get(a)}function egt(e){let t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function tgt(e,t,n){let i=OY(e),o=LC(e,t),r=LC(e,n);return i>=0?o>=r:o<=r}function ngt(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 igt(e,t,n){let i=LC(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:co(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},o[i]=r,Ne.fetchArrayBuffer({url:c}).then(function(u){return r.pointCloud=new xb({arrayBuffer:u,cull:!0,fragmentShaderLoaded:K_t,uniformMapLoaded:$_t(e),pickIdLoaded:Z_t}),r.pointCloud.readyPromise}).catch(ngt(e,c))}return r}function ogt(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 rgt(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(Kye(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){let a=(co()-t.timestamp)/1e3;ogt(e,a)}}t.touchedFrameNumber=i.frameNumber}var sgt=new O;function agt(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 cgt(e){let t=e.shading;return l(t)&&l(t.maximumAttenuation)?t.maximumAttenuation:10}var lgt=new Md;function Kye(e,t,n,i){let o=y(e.shading,lgt),r=t.pointCloud,s=y(t.transform,O.IDENTITY);r.modelMatrix=O.multiplyTransformation(e.modelMatrix,s,sgt),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=agt(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=cgt(e),r.update(i),t.touchedFrameNumber=i.frameNumber}function IY(e,t,n,i){let o=igt(e,t,i);rgt(e,o,n,i)}function ugt(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function $ye(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 fgt(e,t){let n=LC(e,t),i=e._frames[n];if(l(i)&&i.ready)return i}function Xye(e,t,n,i,o){return l(n)?n.ready?!0:(IY(e,t,i,o),n.ready):!1}function dgt(e,t,n,i,o){let r,s,a,c=e._intervals,u=e._frames,f=LC(e,n),d=LC(e,t);if(f>=d){for(r=f;r>=d;--r)if(s=c.get(r),a=u[r],Xye(e,s,a,i,o))return s}else for(r=f;r<=d;++r)if(s=c.get(r),a=u[r],Xye(e,s,a,i,o))return s;return t}function hgt(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 fS={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};NC.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 Z4(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}Z4.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:zn.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,$4]});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)}};Z4.prototype.isDestroyed=function(){return!1};Z4.prototype.destroy=function(){return l(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),fe(this)};var Zye=Z4;var g1;typeof ko<"u"&&(g1=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 he=G[K].match(j)||[];m.a.D(J.match(j),function(oe){m.a.Na(he,oe,ce)}),G[K]=he.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,he=G.length;ce<he;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,he=G.length;ce<he;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 he=0,oe=G.length;he<oe;he++)ce.push(K.call(J,G[he],he));return ce},jb:function(G,K,J){var ce=[];if(G)for(var he=0,oe=G.length;he<oe;he++)K.call(J,G[he],he)&&ce.push(G[he]);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={},he;for(he in G)B.call(G,he)&&(ce[he]=K.call(J,G[he],he,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,he=[];J<ce;J++){var oe=G[J].cloneNode(!0);he.push(K?m.oa(oe):oe)}return he},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],he=ce.parentNode,oe=0,le=K.length;oe<le;oe++)he.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 he;if(!G){var oe=m.getBindingHandler(J);if(oe&&oe.preprocess&&!(ce=oe.preprocess(ce,J,V)))return;(oe=k[J])&&(he=ce,0<=m.a.A(b,he)?he=!1:(oe=he.match(v),he=oe===null?!1:oe[1]?"Object("+oe[1]+")"+oe[2]:he),oe=he),oe&&j.push("'"+(typeof k[J]=="string"?k[J]:J)+"':function(_z){"+he+"=_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,he))&&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 et=m.getBindingHandler(Pe);et&&(et.after&&(De.push(Pe),m.a.D(et.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:et})),ge[Pe]=!0}}),le}function Y(oe,le,ge){var De=m.a.g.Ub(oe,he,{}),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 et=m.ga.instance,Yt=et.getBindingAccessors||k,tn=m.$(function(){return(Pe=le?le(ge,oe):Yt.call(et,oe,ge))&&(ge[$]&&ge[$](),ge[K]&&ge[K]()),Pe},null,{l:oe});Pe&&tn.ja()||(tn=null)}var jt=ge,Et;if(Pe){var Bt=function(){return m.a.Ga(tn?tn():Pe,P)},Ai=tn?function(yt){return function(){return P(tn()[yt])}}:function(yt){return Pe[yt]};Bt.get=function(yt){return Pe[yt]&&P(Ai(yt))},Bt.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,Ai(pe),Bt,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,Ai(pe),Bt,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 Ai=jt?tn():tn,yt=m.a.f(Ai);return le?(m.a.extend(et,le),G in le&&(et[G]=le[G])):(et.$parents=[],et.$root=yt,et.ko=m),et[$]=Et,Yt?yt=et.$data:(et.$rawData=Ai,et.$data=yt),ge&&(et[ge]=yt),De&&De(et,le,yt),le&&le[$]&&!m.S.o().Vb(le[$])&&le[$](),Bt&&(et[K]=Bt),et.$data}var et=this,Yt=oe===ce,tn=Yt?e:oe,jt=typeof tn=="function"&&!m.O(tn),Et,Bt=Re&&Re.dataDependency;Re&&Re.exportDependencies?Pe():(Et=m.xb(Pe),Et.v(),Et.ja()?Et.equalityComparer=null:et[$]=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,et){Pe.$parentContext=et,Pe.$parent=et.$data,Pe.$parents=(et.$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 he=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,he,{});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,he);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,he,{});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,he))&&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 RY="__knockoutObservables",MY="__knockoutSubscribable";function Jye(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=Qye(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===RY||o===MY)&&!(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&&_gt(n,a)}}),e}function Qye(e,t){var n=e[RY];return!n&&t&&(n={},Object.defineProperty(e,RY,{value:n})),n}function pgt(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),Jye.call(i,e,[t]),e}function _gt(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=ggt(e,t,i))})}function ggt(e,t,n){var i=ygt(e,n);return i.subscribe(t)}function ygt(e,t){var n=t[MY];if(!n){n=new e.subscribable,Object.defineProperty(t,MY,{value:n});var i={};xgt(t,n,i),Cgt(e,t,n,i)}return n}function xgt(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 Cgt(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 exe(e,t){if(!e)return null;var n=Qye(e,!1);return n&&n[t]||null}function Agt(e,t){var n=exe(e,t);n&&n.valueHasMutated()}function Tgt(e){e.track=Jye,e.getObservable=exe,e.valueHasMutated=Agt,e.defineProperty=pgt}var J4={attachToKo:Tgt};var txe="http://www.w3.org/2000/svg",nxe="cesium-svgPath-svg",bgt={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){let i=document.createElementNS(txe,"svg:svg");i.setAttribute("class",nxe);let o=document.createElementNS(txe,"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",`${nxe} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},Q4=bgt;J4.attachToKo(dS);Q4.register(dS);var be=dS;var qWi=new Uint8Array([0]),ul=[171,75,84,88,32,50,48,187,13,10,26,10],BY,LY,NY,ez,ixe,FY,oxe,rxe;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(BY||(BY={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(LY||(LY={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(NY||(NY={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(ez||(ez={})),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"}(ixe||(ixe={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(FY||(FY={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(oxe||(oxe={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(rxe||(rxe={}));var VY=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=BY.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 GC="http://www.w3.org/2000/svg",PCe="http://www.w3.org/1999/xlink",fz,w1=H.fromCssColorString("rgba(247,250,255,0.384)"),dz=H.fromCssColorString("rgba(143,191,255,0.216)"),iX=H.fromCssColorString("rgba(153,197,255,0.098)"),hz=H.fromCssColorString("rgba(255,255,255,0.086)"),A0t=H.fromCssColorString("rgba(255,255,255,0.267)"),T0t=H.fromCssColorString("rgba(255,255,255,0)"),vCe=H.fromCssColorString("rgba(66,67,68,0.3)"),DCe=H.fromCssColorString("rgba(0,0,0,0.5)");function fy(e){return H.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}var v1={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 cg),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(OCe.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});var gz=OCe;function yz(e,t){e=ci(e);let n=new gz(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 Y0({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new ea({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 Y0({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new ea({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 Y0({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new ea({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 tS({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new ea({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 tS({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 ea({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 tS({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 ea({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 Z0({assetId:3954})}})),e.push(new ea({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 Z0({assetId:3845})}})),e.push(new ea({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 Z0({assetId:3812})}})),e.push(new ea({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 gC({url:Pn("Assets/Textures/NaturalEarthII")})}})),e}var Cz=P0t;function I0t(){let e=[];return e.push(new ea({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 cg}})),e.push(new ea({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 pO({requestWaterMask:!0,requestVertexNormals:!0})}})),e}var Az=I0t;function O0t(e){return function(t){let n=e._scene.pick(t.position);l(n)&&n.primitive instanceof Bf&&(e.tileset=n.primitive),e.pickActive=!1}}function BCe(e,t){t?e._eventHandler.setInputAction(function(n){let i=e._scene.pick(n.endPosition);l(i)&&i.primitive instanceof Bf&&(e.tileset=i.primitive)},qn.MOUSE_MOVE):(e._eventHandler.removeInputAction(qn.MOUSE_MOVE),e.picking=e.picking)}var R0t={maximumFractionDigits:3};function D1(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,R0t):Math.round(t).toLocaleString()}function P1(e,t){if(!l(e))return"";let n=t?e._statisticsPerPass[Nr.PICK]:e._statisticsPerPass[Nr.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>${D1(n.geometryByteLength)}</li><li><strong>Texture Memory (MB): </strong>${D1(n.texturesByteLength)}</li><li><strong>Batch Table Memory (MB): </strong>${D1(n.batchTableByteLength)}</li>`,i+="</ul>"),i}function LCe(){let e=Xo.statistics;return`
<ul class="cesium-cesiumInspector-statistics">
<li><strong>Geometry Memory (MB): </strong>${D1(e.geometryByteLength)}</li>
<li><strong>Texture Memory (MB): </strong>${D1(e.texturesByteLength)}</li>
</ul>
`}var M0t=[{text:"Highlight",value:du.HIGHLIGHT},{text:"Replace",value:du.REPLACE},{text:"Mix",value:du.MIX}],MCe=new H(1,1,0,.4),B0t=new H,Tz=new H;function va(e,t){let n=this,i=e.canvas;this._eventHandler=new uf(i),this._scene=e,this._performanceContainer=t,this._canvas=i,this._performanceDisplay=new oy({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=du.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 Gr?(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()}},qn.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction(qn.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};va.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=P1(e,!1),this._pickStatisticsText=P1(e,!0),this._resourceCacheStatisticsText=LCe())};va.prototype.isDestroyed=function(){return!1};va.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();let e=this;return this._definedProperties.forEach(function(t){be.getObservable(e,t).dispose()}),fe(this)};va.getStatistics=P1;var bz=va;function Ez(e,t){e=ci(e);let n=document.createElement("div"),i=document.createElement("div");i.setAttribute("data-bind","visible: performance");let o=new bz(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=uy.createSection,c=uy.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(cX("togglePickTileset","Pick Tileset","pickActive")),u.appendChild(cX("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(Th("geometricErrorScale",0,2,.01,"Geometric Error Scale")),E.appendChild(Th("maximumAttenuation",0,32,1,"Maximum Attenuation")),E.appendChild(Th("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(Th("eyeDomeLightingStrength",0,2,.1,"EDL Strength")),S.appendChild(Th("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(Th("maximumScreenSpaceError",0,128,1,"Maximum Screen Space Error")),d.appendChild(w);let D=document.createElement("div");D.setAttribute("data-bind","visible: dynamicScreenSpaceError"),D.appendChild(Th("dynamicScreenSpaceErrorDensitySliderValue",0,1,.005,"Screen Space Error Density","dynamicScreenSpaceErrorDensity")),D.appendChild(Th("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)};WC.prototype.isDestroyed=function(){return!1};WC.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)};WC.prototype.resize=function(){let e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,FCe(this),VCe(this),this._scene.requestRender())};WC.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();let e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};var Pz=WC;function Iz(e,t){l(t)||(t=document.body),t=ci(t);let n=this,i=be.observable(Kr.fullscreen),o=be.observable(Kr.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&&Kr.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(){Kr.fullscreen?Kr.exitFullscreen():Kr.requestFullscreen(n._fullscreenElement)},be.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=y(ci(e),r.body),this._callback=function(){i(Kr.fullscreen)},r.addEventListener(Kr.changeEventName,this._callback)}Object.defineProperties(Iz.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){this._fullscreenElement=e}},command:{get:function(){return this._command}}});Iz.prototype.isDestroyed=function(){return!1};Iz.prototype.destroy=function(){document.removeEventListener(Kr.changeEventName,this._callback),fe(this)};var Oz=Iz;var k0t="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",U0t="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 rAe=Oyt;var Ryt="1.96";return hAe(Myt);})();