1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-08 00:32:26 -04:00

10985 lines
4.9 MiB
JavaScript
Raw Normal View History

2025-06-09 10:14:12 +01:00
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.129
*
* 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 u1e=Object.create;var nN=Object.defineProperty;var m1e=Object.getOwnPropertyDescriptor;var f1e=Object.getOwnPropertyNames;var h1e=Object.getPrototypeOf,p1e=Object.prototype.hasOwnProperty;var iN=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ad=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),b1e=(e,t)=>{for(var n in t)nN(e,n,{get:t[n],enumerable:!0})},Tq=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f1e(t))!p1e.call(e,o)&&o!==n&&nN(e,o,{get:()=>t[o],enumerable:!(i=m1e(t,o))||i.enumerable});return e};var _=(e,t,n)=>(n=e!=null?u1e(h1e(e)):{},Tq(t||!e||!e.__esModule?nN(n,"default",{value:e,enumerable:!0}):n,e)),y1e=e=>Tq(nN({},"__esModule",{value:!0}),e);var T=ad(()=>{globalThis.CESIUM_WORKERS=atob("dmFyIENlc2l1bVdvcmtlcnM9KCgpPT57dmFyIFhTPU9iamVjdC5jcmVhdGU7dmFyIEJsPU9iamVjdC5kZWZpbmVQcm9wZXJ0eTt2YXIgWVM9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcjt2YXIgJFM9T2JqZWN0LmdldE93blByb3BlcnR5TmFtZXM7dmFyIFpTPU9iamVjdC5nZXRQcm90b3R5cGVPZixRUz1PYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O3ZhciBwcj0odD0+dHlwZW9mIHJlcXVpcmU8InUiP3JlcXVpcmU6dHlwZW9mIFByb3h5PCJ1Ij9uZXcgUHJveHkodCx7Z2V0OihlLG4pPT4odHlwZW9mIHJlcXVpcmU8InUiP3JlcXVpcmU6ZSlbbl19KTp0KShmdW5jdGlvbih0KXtpZih0eXBlb2YgcmVxdWlyZTwidSIpcmV0dXJuIHJlcXVpcmUuYXBwbHkodGhpcyxhcmd1bWVudHMpO3Rocm93IEVycm9yKCdEeW5hbWljIHJlcXVpcmUgb2YgIicrdCsnIiBpcyBub3Qgc3VwcG9ydGVkJyl9KSxwMT10PT5lPT57dmFyIG49dFtlXTtpZihuKXJldHVybiBuKCk7dGhyb3cgbmV3IEVycm9yKCJNb2R1bGUgbm90IGZvdW5kIGluIGJ1bmRsZTogIitlKX07dmFyICQ9KHQsZSk9PigpPT4odCYmKGU9dCh0PTApKSxlKTt2YXIgWG49KHQsZSk9PigpPT4oZXx8dCgoZT17ZXhwb3J0czp7fX0pLmV4cG9ydHMsZSksZS5leHBvcnRzKSxwZT0odCxlKT0+e2Zvcih2YXIgbiBpbiBlKUJsKHQsbix7Z2V0OmVbbl0sZW51bWVyYWJsZTohMH0pfSxkMT0odCxlLG4sbyk9PntpZihlJiZ0eXBlb2YgZT09Im9iamVjdCJ8fHR5cGVvZiBlPT0iZnVuY3Rpb24iKWZvcihsZXQgciBvZiAkUyhlKSkhUVMuY2FsbCh0LHIpJiZyIT09biYmQmwodCxyLHtnZXQ6KCk9PmVbcl0sZW51bWVyYWJsZTohKG89WVMoZSxyKSl8fG8uZW51bWVyYWJsZX0pO3JldHVybiB0fTt2YXIgZHI9KHQsZSxuKT0+KG49dCE9bnVsbD9YUyhaUyh0KSk6e30sZDEoZXx8IXR8fCF0Ll9fZXNNb2R1bGU/QmwobiwiZGVmYXVsdCIse3ZhbHVlOnQsZW51bWVyYWJsZTohMH0pOm4sdCkpLEpTPXQ9PmQxKEJsKHt9LCJfX2VzTW9kdWxlIix7dmFsdWU6ITB9KSx0KTtmdW5jdGlvbiB0Qyh0KXtyZXR1cm4gdCE9bnVsbH12YXIgaCxhdD0kKCgpPT57aD10Q30pO2Z1bmN0aW9uIGtzKHQpe3RoaXMubmFtZT0iRGV2ZWxvcGVyRXJyb3IiLHRoaXMubWVzc2FnZT10O2xldCBlO3RyeXt0aHJvdyBuZXcgRXJyb3J9Y2F0Y2gobil7ZT1uLnN0YWNrfXRoaXMuc3RhY2s9ZX12YXIgTCxqdD0kKCgpPT57YXQoKTtoKE9iamVjdC5jcmVhdGUpJiYoa3MucHJvdG90eXBlPU9iamVjdC5jcmVhdGUoRXJyb3IucHJvdG90eXBlKSxrcy5wcm90b3R5cGUuY29uc3RydWN0b3I9a3MpO2tzLnByb3RvdHlwZS50b1N0cmluZz1mdW5jdGlvbigpe2xldCB0PWAke3RoaXMubmFtZX06ICR7dGhpcy5tZXNzYWdlfWA7cmV0dXJuIGgodGhpcy5zdGFjaykmJih0Kz1gCiR7dGhpcy5zdGFjay50b1N0cmluZygpfWApLHR9O2tzLnRocm93SW5zdGFudGlhdGlvbkVycm9yPWZ1bmN0aW9uKCl7dGhyb3cgbmV3IGtzKCJUaGlzIGZ1bmN0aW9uIGRlZmluZXMgYW4gaW50ZXJmYWNlIGFuZCBzaG91bGQgbm90IGJlIGNhbGxlZCBkaXJlY3RseS4iKX07TD1rc30pO2Z1bmN0aW9uIGVDKHQpe3JldHVybmAke3R9IGlzIHJlcXVpcmVkLCBhY3R1YWwgdmFsdWUgd2FzIHVuZGVmaW5lZGB9ZnVuY3Rpb24gemModCxlLG4pe3JldHVybmBFeHBlY3RlZCAke259IHRvIGJlIHR5cGVvZiAke2V9LCBhY3R1YWwgdHlwZW9mIHdhcyAke3R9YH12YXIgWW4seSxXdD0kKCgpPT57YXQoKTtqdCgpO1luPXt9O1luLnR5cGVPZj17fTtZbi5kZWZpbmVkPWZ1bmN0aW9uKHQsZSl7aWYoIWgoZSkpdGhyb3cgbmV3IEwoZUModCkpfTtZbi50eXBlT2YuZnVuYz1mdW5jdGlvbih0LGUpe2lmKHR5cGVvZiBlIT0iZnVuY3Rpb24iKXRocm93IG5ldyBMKHpjKHR5cGVvZiBlLCJmdW5jdGlvbiIsdCkpfTtZbi50eXBlT2Yuc3RyaW5nPWZ1bmN0aW9uKHQsZSl7aWYodHlwZW9mIGUhPSJzdHJpbmciKXRocm93IG5ldyBMKHpjKHR5cGVvZiBlLCJzdHJpbmciLHQpKX07WW4udHlwZU9mLm51bWJlcj1mdW5jdGlvbih0LGUpe2lmKHR5cGVvZiBlIT0ibnVtYmVyIil0aHJvdyBuZXcgTCh6Yyh0eXBlb2YgZSwibnVtYmVyIix0KSl9O1luLnR5cGVPZi5udW1iZXIubGVzc1RoYW49ZnVuY3Rpb24odCxlLG4pe2lmKFluLnR5cGVPZi5udW1iZXIodCxlKSxlPj1uKXRocm93IG5ldyBMKGBFeHBlY3RlZCAke3R9IHRvIGJlIGxlc3MgdGhhbiAke259LCBhY3R1YWwgdmFsdWUgd2FzICR7ZX1gKX07WW4udHlwZU9mLm51bWJlci5sZXNzVGhhbk9yRXF1YWxzPWZ1bmN0aW9uKHQsZSxuKXtpZihZbi50eXBlT2YubnVtYmVyKHQsZSksZT5uKXRocm93IG5ldyBMKGBFeHBlY3RlZC
* 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 ZN=="object"&&ZN.exports?ZN.exports=t():typeof define=="function"&&define.amd?define(t):e.IPv6=t(e)})(Kq,function(e){"use strict";var t=e&&e.IPv6;function n(o){var r=o.toLowerCase(),s=r.split(":"),a=s.length,l=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&&(l=7);var d;for(d=0;d<a&&s[d]!=="";d++);if(d<l)for(s.splice(d,1,"0000");s.length<l;)s.splice(d,0,"0000");for(var u,f=0;f<l;f++){u=s[f].split("");for(var p=0;p<3&&(u[0]==="0"&&u.length>1);p++)u.splice(0,1);s[f]=u.join("")}var y=-1,h=0,g=0,x=-1,S=!1;for(f=0;f<l;f++)S?s[f]==="0"?g+=1:(S=!1,g>h&&(y=x,h=g)):s[f]==="0"&&(S=!0,x=f,g=1);g>h&&(y=x,h=g),h>1&&s.splice(y,h,""),a=s.length;var V="";for(s[0]===""&&(V=":"),f=0;f<a&&(V+=s[f],f!==a-1);f++)V+=":";return s[a-1]===""&&(V+=":"),V}function i(){return e.IPv6===this&&(e.IPv6=t),this}return{best:n,noConflict:i}})});var jq=ad((Qq,RN)=>{var uGt=_(T());/*!
* 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 RN=="object"&&RN.exports?RN.exports=t():typeof define=="function"&&define.amd?define(t):e.SecondLevelDomains=t(e)})(Qq,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 GN=="object"&&GN.exports?GN.exports=t(zq(),Jq(),jq()):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(qq,function(e,t,n,i){"use strict";var o=i&&i.URI;function r(G,X){var W=arguments.length>=1,A=arguments.length>=2;if(!(this instanceof r))return W?A?new r(G,X):new r(G):new r;if(G===void 0){if(W)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?G=location.href+"":G=""}if(G===null&&W)throw new TypeError("null is not a valid argument for URI");return this.href(G),X!==void 0?this.absoluteTo(X):this}function s(G){return/^[0-9]+$/.test(G)}r.version="1.19.11";var a=r.prototype,l=Object.prototype.hasOwnProperty;function d(G){return G.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function u(G){return G===void 0?"Undefined":String(Object.prototype.toString.call(G)).slice(8,-1)}function f(G){return u(G)==="Array"}function p(G,X){var W={},A,k;if(u(X)==="RegExp")W=null;else if(f(X))for(A=0,k=X.length;A<k;A++)W[X[A]]=!0;else W[X]=!0;for(A=0,k=G.length;A<k;A++){var B=W&&W[G[A]]!==void 0||!W&&X.test(G[A]);B&&(G.splice(A,1),k--,A--)}return G}function y(G,X){var W,A;if(f(X)){for(W=0,A=X.length;W<A;W++)if(!y(G,X[W]))return!1;return!0}var k=u(X);for(W=0,A=G.length;W<A;W++)if(k==="RegExp"){if(typeof G[W]=="string"&&G[W].match(X))return!0}else if(G[W]===X)return!0;return!1}function h(G,X){if(!f(G)||!f(X)||G.length!==X.length)return!1;G.sort(),X.sort();for(var W=0,A=G.length;W<A;W++)if(G[W]!==X[W])return!1;return!0}function g(G){var X=/^\/+|\/+$/g;return G.replace(X,"")}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",
* protobuf.js v7.4.0 (c) 2016, daniel wirtz
* compiled thu, 22 aug 2024 20:30:39 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,l=2,d=!0;l<arguments.length;)s[a++]=arguments[l++];return new Promise(function(f,p){s[a]=function(h){if(d)if(d=!1,h)p(h);else{for(var g=new Array(arguments.length-1),x=0;x<g.length;)g[x++]=arguments[x];f.apply(null,g)}};try{o.apply(r||null,s)}catch(y){d&&(d=!1,p(y))}})}},{}],2:[function(e,t,n){"use strict";var i=n;i.length=function(d){var u=d.length;if(!u)return 0;for(var f=0;--u%4>1&&d.charAt(u)==="=";)++f;return Math.ceil(d.length*3)/4-f};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(d,u,f){for(var p=null,y=[],h=0,g=0,x;u<f;){var S=d[u++];switch(g){case 0:y[h++]=o[S>>2],x=(S&3)<<4,g=1;break;case 1:y[h++]=o[x|S>>4],x=(S&15)<<2,g=2;break;case 2:y[h++]=o[x|S>>6],y[h++]=o[S&63],g=0;break}h>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,y)),h=0)}return g&&(y[h++]=o[x],y[h++]=61,g===1&&(y[h++]=61)),p?(h&&p.push(String.fromCharCode.apply(String,y.slice(0,h))),p.join("")):String.fromCharCode.apply(String,y.slice(0,h))};var a="invalid encoding";i.decode=function(d,u,f){for(var p=f,y=0,h,g=0;g<d.length;){var x=d.charCodeAt(g++);if(x===61&&y>1)break;if((x=r[x])===undefined)throw Error(a);switch(y){case 0:h=x,y=1;break;case 1:u[f++]=h<<2|(x&48)>>4,h=x,y=2;break;case 2:u[f++]=(h&15)<<4|(x&60)>>2,h=x,y=3;break;case 3:u[f++]=(h&3)<<6|x,y=0;break}}if(y===1)throw Error(a);return f-p},i.test=function(d){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(d)}},{}],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],l=0;l<a.length;)a[l].fn===s?a.splice(l,1):++l;return this},i.prototype.emit=function(r){var s=this._listeners[r];if(s){for(var a=[],l=1;l<arguments.length;)a.push(arguments[l++]);for(l=0;l<s.length;)s[l].fn.apply(s[l++].ctx,a)}return this}},{}],4:[function(e,t,n){"use strict";t.exports=i(i);function i(l){return typeof Float32Array<"u"?function(){var d=new Float32Array([-0]),u=new Uint8Array(d.buffer),f=u[3]===128;function p(x,S,V){d[0]=x,S[V]=u[0],S[V+1]=u[1],S[V+2]=u[2],S[V+3]=u[3]}function y(x,S,V){d[0]=x,S[V]=u[3],S[V+1]=u[2],S[V+2]=u[1],S[V+3]=u[0]}l.writeFloatLE=f?p:y,l.writeFloatBE=f?y:p;function h(x,S){return u[0]=x[S],u[1]=x[S+1],u[2]=x[S+2],u[3]=x[S+3],d[0]}function g(x,S){return u[3]=x[S],u[2]=x[S+1],u[1]=x[S+2],u[0]=x[S+3],d[0]}l.readFloatLE=f?h:g,l.readFloatBE=f?g:h}():function(){function d(f,p,y,h){var g=p<0?1:0;if(g&&(p=-p),p===0)f(1/p>0?0:2147483648,y,h);else if(isNaN(p))f(2143289344,y,h);else if(p>34028234663852886e22)f((g<<31|2139095040)>>>0,y,h);else if(p<11754943508222875e-54)f((g<<31|Math.round(p/1401298464324817e-60))>>>0,y,h);else{var x=Math.floor(Math.log(p)/Math.LN2),S=Math.round(p*Math.pow(2,-x)*8388608)&8388607;f((g<<31|x+127<<23|S)>>>0,y,h)}}l.writeFloatLE=d.bind(null,o),l.writeFloatBE=d.bind(null,r);function u(f,p,y){var h=f(p,y),g=(h>>31)*2+1,x=h>>>23&255,S=h&8388607;return x===255?S?NaN:g*(1/0):x===0?g*1401298464324817e-60*S:g*Math.pow(2,x-150)*(S+8388608)}l.readFloatLE=u.bind(null,s),l.readFloatBE=u.bind(null,a)}(),typeof Float64Array<"u"?function(){var d=new Float64Array([-0]),u=new Uint8Array(d.buffer),f=u[7]===128;function p(x,S,V){d[0]=x,S[V]=u[0],S[V+1]=u[1],S[V+2]=u[2],S[V+3]=u[3],S[V+4]=u[4],S[V+5]=u[5],S[V+6]=u[6],S[V+7]=u[7]}function y(x,S,V){d[0]=x,S[V]=u[7],S[V+1]=u[6],S[V+2]=u[5],S[V+3]=u[4],S[V+4]=u[3],S[V+5]=u[2],S[V+6]=u[1],S
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.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(n=>(this.enabled=!0,n)).catch(n=>{throw this.enabled=!1,n})}disable(){lq()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):cq()?this.noSleepTimer&&(console.warn(`
NoSleep now disabled for older iOS devices.
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}};n1e.exports=dq});var YVt={};b1e(YVt,{AlphaMode:()=>Th,AlphaPipelineStage:()=>XW,AnchorPointDirect:()=>PI,AnchorPointIndirect:()=>vI,Animation:()=>bM,AnimationViewModel:()=>yM,Appearance:()=>no,ApproximateTerrainHeights:()=>ui,ArcGISTiledElevationTerrainProvider:()=>n7,ArcGisBaseMapType:()=>Mf,ArcGisMapServerImageryProvider:()=>l0,ArcGisMapService:()=>Jd,ArcType:()=>Kt,ArticulationStageType:()=>yc,AssociativeArray:()=>Zt,Atmosphere:()=>C_,AtmospherePipelineStage:()=>dW,AttributeCompression:()=>Fn,AttributeType:()=>rn,AutoExposure:()=>RA,AutomaticUniforms:()=>_p,Axis:()=>Po,AxisAlignedBoundingBox:()=>J0,B3dmLoader:()=>KI,B3dmParser:()=>YI,BaseLayerPicker:()=>xM,BaseLayerPickerViewModel:()=>gM,BatchTable:()=>Ix,BatchTableHierarchy:()=>t_,BatchTexture:()=>Qc,BatchTexturePipelineStage:()=>IW,Billboard:()=>co,BillboardCollection:()=>Gd,BillboardGraphics:()=>cc,BillboardLoadState:()=>is,BillboardTexture:()=>xb,BillboardVisualizer:()=>yE,BingMapsGeocoderService:()=>o7,BingMapsImageryProvider:()=>tF,BingMapsStyle:()=>JV,BlendEquation:()=>Pa,BlendFunction:()=>Co,BlendOption:()=>Lo,BlendingState:()=>un,BoundingRectangle:()=>je,BoundingSphere:()=>ue,BoundingSphereState:()=>ut,BoundingVolumeSemantics:()=>g_,BoxEmitter:()=>J7,BoxGeometry:()=>Wa,BoxGeometryUpdater:()=>EX,BoxGraphics:()=>Nx,BoxOutlineGeometry:()=>Fm,BrdfLutGenerator:()=>IF,Buffer:()=>_t,BufferLoader:()=>s_,BufferUsage:()=>Ne,CPUStylingPipelineStage:()=>vW,CallbackPositionProperty:()=>XX,CallbackProperty:()=>Om,Camera:()=>oo,CameraEventAggregator:()=>PA,CameraEventType:()=>Ni,CameraFlightPath:()=>wF,Cartesian2:()=>D,Cartesian3:()=>m,Cartesian4:()=>ce,Cartographic:()=>pe,CartographicGeocoderService:()=>s7,CatmullRomSpline:()=>a7,Cesium3DContentGroup:()=>e_,Cesium3DTile:()=>Ku,Cesium3DTileBatchTable:()=>zp,Cesium3DTileColorBlendMode:()=>Wl,Cesium3DTileContent:()=>Q7,Cesium3DTileContentFactory:()=>M_,Cesium3DTileContentState:()=>Ho,Cesium3DTileContentType:()=>Zs,Cesium3DTileFeature:()=>Us,Cesium3DTileFeatureTable:()=>of,Cesium3DTileOptimizationHint:()=>Du,Cesium3DTileOptimizations:()=>gP,Cesium3DTilePass:()=>Fo,Cesium3DTilePassState:()=>hm,Cesium3DTilePointFeature:()=>_b,Cesium3DTileRefine:()=>Bo,Cesium3DTileStyle:()=>RS,Cesium3DTileStyleEngine:()=>VP,Cesium3DTilesInspector:()=>LM,Cesium3DTilesInspectorViewModel:()=>VM,Cesium3DTilesVoxelProvider:()=>j7,Cesium3DTileset:()=>bs,Cesium3DTilesetBaseTraversal:()=>XP,Cesium3DTilesetCache:()=>TP,Cesium3DTilesetGraphics:()=>Hx,Cesium3DTilesetHeatmap:()=>SP,Cesium3DTilesetMetadata:()=>K_,Cesium3DTilesetMostDetailedTraversal:()=>RP,Cesium3DTilesetSkipTraversal:()=>wP,Cesium3DTilesetStatistics:()=>pf,Cesium3DTilesetTraversal:()=>zs,Cesium3DTilesetVisualizer:()=>PP,CesiumInspector:()=>GM,CesiumInspectorViewModel:()=>RM,CesiumTerrainProvider:()=>_S,CesiumWidget:()=>G9,Check:()=>C,CheckerboardMaterialProperty:()=>X1,CircleEmitter:()=>O9,CircleGeometry:()=>f7,CircleOutlineGeometry:()=>h7,ClassificationModelDrawCommand:()=>Rw,ClassificationPipelineStage:()=>WW,ClassificationPrimitive:()=>bC,ClassificationType:()=>Un,ClearCommand:()=>ti,ClippingPlane:()=>x_,ClippingPlaneCollection:()=>hs,ClippingPolygon:()=>HC,ClippingPolygonCollection:()=>qm,Clock:()=>_f,ClockRange:()=>zr,ClockStep:()=>fo,ClockViewModel:()=>fM,CloudCollection:()=>i6,CloudType:()=>GS,Color:()=>Y,ColorBlendMode:()=>bc,ColorGeometryInstanceAttribute:()=>Yt,ColorMaterialProperty:()=>Ut,Command:()=>z6,ComponentDatatype:()=>q,Composite3DTileContent:()=>NX,CompositeEntityCollection:()=>AK,CompositeMaterialProperty:()=>W1,CompositePositionProperty:()=>ya,CompositeProperty:()=>Sc,CompressedTextureBuffer:()=>yZ,ComputeCommand:()=>vc,ComputeEngine:()=>bZ,ConditionsExpression:()=>M9,ConeEmitter:()=>r6,ConstantPositionProperty:()=>Oc,ConstantProperty:()=>Qn,ConstantSpline:()=>qI,ContentMetadata:()=>lP,Context:()=>lE,ContextLimits:()=>mt,CoplanarPolygonGeometry:()=>g2,CoplanarPolygonGeometryLibrary:()=>Eb,CoplanarPolygonOutlineGeometry:()=>zu,CornerType:()=>Fi,Correlati
${this.stack.toString()}`),e};tx.throwInstantiationError=function(){throw new tx("This function defines an interface and should not be called directly.")};var L=tx;var Ts={};Ts.typeOf={};function x1e(e){return`${e} is required, actual value was undefined`}function NS(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Ts.defined=function(e,t){if(!c(t))throw new L(x1e(e))};Ts.typeOf.func=function(e,t){if(typeof t!="function")throw new L(NS(typeof t,"function",e))};Ts.typeOf.string=function(e,t){if(typeof t!="string")throw new L(NS(typeof t,"string",e))};Ts.typeOf.number=function(e,t){if(typeof t!="number")throw new L(NS(typeof t,"number",e))};Ts.typeOf.number.lessThan=function(e,t,n){if(Ts.typeOf.number(e,t),t>=n)throw new L(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Ts.typeOf.number.lessThanOrEquals=function(e,t,n){if(Ts.typeOf.number(e,t),t>n)throw new L(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Ts.typeOf.number.greaterThan=function(e,t,n){if(Ts.typeOf.number(e,t),t<=n)throw new L(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Ts.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Ts.typeOf.number(e,t),t<n)throw new L(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};Ts.typeOf.object=function(e,t){if(typeof t!="object")throw new L(NS(typeof t,"object",e))};Ts.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new L(NS(typeof t,"boolean",e))};Ts.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new L(NS(typeof t,"bigint",e))};Ts.typeOf.number.equals=function(e,t,n,i){if(Ts.typeOf.number(e,n),Ts.typeOf.number(t,i),n!==i)throw new L(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};var C=Ts;var dLt=_(T(),1),JB=_(oN(),1);var ct={};ct.EPSILON1=.1;ct.EPSILON2=.01;ct.EPSILON3=.001;ct.EPSILON4=1e-4;ct.EPSILON5=1e-5;ct.EPSILON6=1e-6;ct.EPSILON7=1e-7;ct.EPSILON8=1e-8;ct.EPSILON9=1e-9;ct.EPSILON10=1e-10;ct.EPSILON11=1e-11;ct.EPSILON12=1e-12;ct.EPSILON13=1e-13;ct.EPSILON14=1e-14;ct.EPSILON15=1e-15;ct.EPSILON16=1e-16;ct.EPSILON17=1e-17;ct.EPSILON18=1e-18;ct.EPSILON19=1e-19;ct.EPSILON20=1e-20;ct.EPSILON21=1e-21;ct.GRAVITATIONALPARAMETER=3986004418e5;ct.SOLAR_RADIUS=6955e5;ct.LUNAR_RADIUS=1737400;ct.SIXTY_FOUR_KILOBYTES=64*1024;ct.FOUR_GIGABYTES=4*1024*1024*1024;ct.sign=Math.sign??function(t){return t=+t,t===0||t!==t?t:t>0?1:-1};ct.signNotZero=function(e){return e<0?-1:1};ct.toSNorm=function(e,t){return t=t??255,Math.round((ct.clamp(e,-1,1)*.5+.5)*t)};ct.fromSNorm=function(e,t){return t=t??255,ct.clamp(e,0,t)/t*2-1};ct.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:ct.clamp((e-t)/n,0,1)};ct.sinh=Math.sinh??function(t){return(Math.exp(t)-Math.exp(-t))/2};ct.cosh=Math.cosh??function(t){return(Math.exp(t)+Math.exp(-t))/2};ct.lerp=function(e,t,n){return(1-n)*e+n*t};ct.PI=Math.PI;ct.ONE_OVER_PI=1/Math.PI;ct.PI_OVER_TWO=Math.PI/2;ct.PI_OVER_THREE=Math.PI/3;ct.PI_OVER_FOUR=Math.PI/4;ct.PI_OVER_SIX=Math.PI/6;ct.THREE_PI_OVER_TWO=3*Math.PI/2;ct.TWO_PI=2*Math.PI;ct.ONE_OVER_TWO_PI=1/(2*Math.PI);ct.RADIANS_PER_DEGREE=Math.PI/180;ct.DEGREES_PER_RADIAN=180/Math.PI;ct.RADIANS_PER_ARCSECOND=ct.RADIANS_PER_DEGREE/3600;ct.toRadians=function(e){if(!c(e))throw new L("degrees is required.");return e*ct.RADIANS_PER_DEGREE};ct.toDegrees=function(e){if(!c(e))throw new L("radians is required.");return e*ct.DEGREES_PER_RADIAN};ct.convertLongitudeRange=function(e){if(!c(e))throw new L("angle is required.");let t=ct.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};ct.clampToLatitudeRange=function(e){if(!c(e))throw new L("angle is required.");return ct.clamp(e,-1*ct.PI_OVER_TWO,ct.PI_OVER_TWO)};ct.negativePiToPi=function(e){if(!c(e))throw new L("angle is required.");return e>=-ct.PI&&e<=ct.PI?e:ct.zeroToTwoPi(e+ct.PI)-ct.PI};ct.zeroToTwoPi=function(e){if(!c(e))throw new L("angle is required.");if(e>=0&&e<=ct.TWO_PI)return e;let t=ct.mod(e,ct.TWO_PI);return Math.abs(t)<ct.EPSILON14&&Math.abs(e)>ct.EPSILON14?ct.TWO_PI:t};ct.mod=function(e,t){if(!c(e))throw new L("m is required.");if(!c(t))t
(${this[1]}, ${this[4]}, ${this[7]})
(${this[2]}, ${this[5]}, ${this[8]})`};var te=it;var PLt=_(T(),1);function QL(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(QL.prototype=Object.create(Error.prototype),QL.prototype.constructor=QL);QL.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=`
${this.stack.toString()}`),e};var le=QL;function nt(e,t,n,i,o,r,s,a,l,d,u,f,p,y,h,g){this[0]=e??0,this[1]=o??0,this[2]=l??0,this[3]=p??0,this[4]=t??0,this[5]=r??0,this[6]=d??0,this[7]=y??0,this[8]=n??0,this[9]=s??0,this[10]=u??0,this[11]=h??0,this[12]=i??0,this[13]=a??0,this[14]=f??0,this[15]=g??0}nt.packedLength=16;nt.pack=function(e,t,n){return C.typeOf.object("value",e),C.defined("array",t),n=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};nt.unpack=function(e,t,n){return C.defined("array",e),t=t??0,c(n)||(n=new nt),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};nt.packArray=function(e,t){C.defined("array",e);let n=e.length,i=n*16;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new L("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)nt.pack(e[o],t,o*16);return t};nt.unpackArray=function(e,t){if(C.defined("array",e),C.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!==0)throw new L("array length must be a multiple of 16.");let n=e.length;c(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){let o=i/16;t[o]=nt.unpack(e,i,t[o])}return t};nt.clone=function(e,t){if(c(e))return c(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 nt(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])};nt.fromArray=nt.unpack;nt.fromColumnMajorArray=function(e,t){return C.defined("values",e),nt.clone(e,t)};nt.fromRowMajorArray=function(e,t){return C.defined("values",e),c(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 nt(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])};nt.fromRotationTranslation=function(e,t,n){return C.typeOf.object("rotation",e),t=t??m.ZERO,c(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 nt(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)};nt.fromTranslationQuaternionRotationScale=function(e,t,n,i){C.typeOf.object("translation",e),C.typeOf.object("rotation",t),C.typeOf.object("scale",n),c(i)||(i=new nt);let o=n.x,r=n.y,s=n.z,a=t.x*t.x,l=t.x*t.y,d=t.x*t.z,u=t.x*t.w,f=t.y*t.y,p=t.y*t.z,y=t.y*t.w,h=t.z*t.z,g=t.z*t.w,x=t.w*t.w,S=a-f-h+x,V=2*(l-g),Z=2*(d+y),R=2*(l+g),E=-a+f-h+x,I=2*(p-u),v=2*(d-y),P=2*(p+u),F=-a-f+h+x;return i[0]=S*o,i[1]=R*o,i[2]=v*o,i[3]=0,i[4]=V*r,i[5]=E*r,i[6]=P*r,i[7]=0,i[8]=Z*s,i[9]=I*s,i[10]=F*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};nt.fromTranslationRotationScale=function(e,t){return C.typeOf.object("translationRotationScale",e),nt.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};nt.fromTranslation=function(e,t){return C.typeOf.object("translation",e),nt.fromRotationTranslation(te.IDENTITY,e,t)};nt.fromScale=function(e,t){return C.typeOf.object("scale",e),c(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 nt(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};nt.fromUniformScale=function(e,t){return C.typeOf.number("scale",e),c(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 nt(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};nt.fromRotation=function(e,t){return C.typeOf.object("rotation",e),c(t)||(t=new nt),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,
(${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 M=nt;var zLt=_(T(),1),U1e={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,
`);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 tZ=eLe;function r$(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=tZ(this.responseHeaders))}r$.prototype.toString=function(){let e="Request has failed.";return c(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};var ih=r$;var vEt=_(T(),1),XN=_(cd(),1);var TEt=_(T(),1);function nZ(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(nZ.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});nZ.prototype.addEventListener=function(e,t){C.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);let n=this;return function(){n.removeEventListener(e,t)}};nZ.prototype.removeEventListener=function(e,t){C.typeOf.func("listener",e);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 tLe(e,t){return t-e}nZ.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];c(r)&&t[e].apply(n[e],arguments)}let o=this._toRemove;if(i=o.length,i>0){for(o.sort(tLe),e=0;e<i;e++){let r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};var ye=nZ;var LEt=_(T(),1);function cx(e){C.typeOf.object("options",e),C.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(cx.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){C.typeOf.number.greaterThanOrEquals("maximumLength",e,0);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 y3(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}cx.prototype.reserve=function(e){e=e??this._length,this._array.length=e};cx.prototype.heapify=function(e){e=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?(y3(i,o,e),e=o):r=!1}};cx.prototype.resort=function(){let e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};cx.prototype.insert=function(e){C.defined("element",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)y3(t,o,s),o=s;else break}let r;return c(i)&&this._length>i&&(r=t[i],this._length=i),r};cx.prototype.pop=function(e){if(e=e??0,this._length===0)return;C.typeOf.number.lessThan("index",e,this._length);let t=this._array,n=t[e];return y3(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};var iZ=cx;function nLe(e,t){return e.priority-t.priority}var eo={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0},zS=20,nc=new iZ({comparator:nLe});nc.maximumLength=zS;nc.reserve(zS);var oh=[],Cp={},iLe=typeof document<"u"?new XN.default(document.location.href):new XN.default,IN=new ye;function Qo(){}Qo.maximumRequests=50;Qo.maximumRequestsPerServer=18;Qo.requestsByServer={};Qo.throttleRequests=!0;Qo.debugShowStatistics=!1;Qo.requestCompletedEvent=IN;Object.defineProperties(Qo,{statistics:{get:function(){return eo}},priorityHeapLength:{get:function(){return zS},set:function(e){if(e<zS)for(;nc.length>e;){let t=nc.pop();lx(t)}zS=e,nc.maximumLength=e,nc.reserve(e)}}});function s$(e){c(e.priorityFunction)&&(e.priority=e.priorityFunction())}Qo.serverHasOpenSlots=function(e,t){t=t??1;let n=Qo.requestsByServer
in vec2 textureCoordinates;
out vec2 v_textureCoordinates;
void main()
{
gl_Position = position;
v_textureCoordinates = textureCoordinates;
}
`;var $It=_(T(),1);var Tr={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 uZ(e){e=e??z.EMPTY_OBJECT,this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=e.primitiveType??ve.TRIANGLES,this._vertexArray=e.vertexArray,this._count=e.count,this._offset=e.offset??0,this._instanceCount=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._pickMetadataAllowed=e.pickMetadataAllowed===!0,this._pickedMetadataInfo=void 0,this._flags=0,this.cull=e.cull??!0,this.occlude=e.occlude??!0,this.executeInClosestFrustum=e.executeInClosestFrustum??!1,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.castShadows=e.castShadows??!1,this.receiveShadows=e.receiveShadows??!1,this.pickOnly=e.pickOnly??!1,this.depthForTranslucentClassification=e.depthForTranslucentClassification??!1,this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function rc(e,t){return(e._flags&t)===t}function k0(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(uZ.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 rc(this,Tr.CULL)},set:function(e){rc(this,Tr.CULL)!==e&&(k0(this,Tr.CULL,e),this.dirty=!0)}},occlude:{get:function(){return rc(this,Tr.OCCLUDE)},set:function(e){rc(this,Tr.OCCLUDE)!==e&&(k0(this,Tr.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)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return rc(this,Tr.CAST_SHADOWS)},set:function(e){rc(this,Tr.CAST_SHADOWS)!==e&&(k0(this,Tr.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return rc(this,Tr.RECEIVE_SHADOWS)},set:function(e){rc(this,Tr.RECEIVE_SHADOWS)!==e&&(k0(this,Tr.RECEIVE_SHADOWS,e),this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return rc(this,Tr.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){rc(this,Tr.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(k0(this,Tr.EXECUTE_IN_CLOSEST_FRUSTUM,e),this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return rc(this,Tr.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){rc(this,Tr.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(k0(
(${this[1]}, ${this[3]})`};var Ii=jt;function gZe(e,t,n,i){switch(t.type){case e.FLOAT:return new q$(e,t,n,i);case e.FLOAT_VEC2:return new $$(e,t,n,i);case e.FLOAT_VEC3:return new eee(e,t,n,i);case e.FLOAT_VEC4:return new tee(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new A3(e,t,n,i);case e.INT:case e.BOOL:return new nee(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new iee(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new oee(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new ree(e,t,n,i);case e.FLOAT_MAT2:return new see(e,t,n,i);case e.FLOAT_MAT3:return new aee(e,t,n,i);case e.FLOAT_MAT4:return new cee(e,t,n,i);default:throw new le(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function q$(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}q$.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function $$(e,t,n,i){this.name=n,this.value=void 0,this._value=new D,this._gl=e,this._location=i}$$.prototype.set=function(){let e=this.value;D.equals(e,this._value)||(D.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))};function eee(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}eee.prototype.set=function(){let e=this.value;if(c(e.red))Y.equals(e,this._value)||(this._value=Y.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else if(c(e.x))m.equals(e,this._value)||(this._value=m.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z));else throw new L(`Invalid vec3 value for uniform "${this.name}".`)};function tee(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}tee.prototype.set=function(){let e=this.value;if(c(e.red))Y.equals(e,this._value)||(this._value=Y.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else if(c(e.x))ce.equals(e,this._value)||(this._value=ce.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w));else throw new L(`Invalid vec4 value for uniform "${this.name}".`)};function A3(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}A3.prototype.set=function(){let e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);let t=this.value;e.bindTexture(t._target,t._texture)};A3.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function nee(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}nee.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function iee(e,t,n,i){this.name=n,this.value=void 0,this._value=new D,this._gl=e,this._location=i}iee.prototype.set=function(){let e=this.value;D.equals(e,this._value)||(D.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))};function oee(e,t,n,i){this.name=n,this.value=void 0,this._value=new m,this._gl=e,this._location=i}oee.prototype.set=function(){let e=this.value;m.equals(e,this._value)||(m.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function ree(e,t,n,i){this.name=n,this.value=void 0,this._value=new ce,this._gl=e,this._location=i}ree.prototype.set=function(){let e=this.value;ce.equals(e,this._value)||(ce.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};var xZe=new Float32Array(4);function see(e,t,n,i){this.name=n,this.value=void 0,this._value=new Ii,this._gl=e,this._location=i}see.prototype.set=function(){if(!Ii.equalsArray(this.value,this._value,0)){Ii.clone(this.value,this._value);let e=Ii.toArray(this.value,xZe);this._gl.uniformMatrix2fv(this._location,!1,e)}};var _Ze=new Float32Array(9);function aee(e,t,n,i){this.name=n,this.value=void 0,this._value=new te,this._gl=e,this._location=i}aee.prototype.set=function(){if(!te.equalsArray(this.value,this._value,0)){te.clone(this.value,this._value);let e=te.toArray(this.value,_Ze);this._gl.uniformMatrix3fv(this._location,!1,e)}};var TZe=new Float32Ar
${n}`),d=`Vertex shader failed to compile. Compile log: ${l}`):(l=e.getShaderInfoLog(r),console.error(`${ch}Fragment shader compile log: ${l}`),console.error(`${ch} Fragment shader source:
${i}`),d=`Fragment shader failed to compile. Compile log: ${l}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new le(d);function f(p,y){if(!c(u))return;let h=u.getTranslatedShaderSource(p);if(h===""){console.error(`${ch}${y} shader translation failed.`);return}console.error(`${ch}Translated ${y} shaderSource:
${h}`)}}function ZZe(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 RZe(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),l="[0]",d=a.name.indexOf(l,a.name.length-l.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(d.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){let u=e.getUniformLocation(t,d);if(u!==null){let f=fZ(e,a,d,u);n[d]=f,i.push(f),f._setSampler&&o.push(f)}}else{let u,f,p,y,h=d.indexOf("[");if(h>=0){if(u=n[d.slice(0,h)],!c(u))continue;f=u._locations,f.length<=1&&(p=u.value,y=e.getUniformLocation(t,d),y!==null&&(f.push(y),p.push(e.getUniform(t,y))))}else{f=[];for(let g=0;g<a.size;++g)y=e.getUniformLocation(t,`${d}[${g}]`),y!==null&&f.push(y);u=hZ(e,a,d,f),n[d]=u,i.push(u),u._setSampler&&o.push(u)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function GZe(e,t){let n=[],i=[];for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=o,a=e._duplicateUniformNames[s];c(a)&&(r.name=a,s=a);let l=_p[s];c(l)?n.push({uniform:r,automaticUniform:l}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function EZe(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 YN(e){c(e._program)||Tee(e)}function Tee(e){let t=e._program,n=e._gl,i=LZe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=RZe(n,i),s=GZe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=ZZe(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=EZe(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,l,d,u){let f=e._vertexShaderText,p=e._fragmentShaderText,y=/ ! = /g;e._vertexShaderText=a.replace(y," != "),e._fragmentShaderText=l.replace(y," != ");try{Tee(e),d(e._program)}catch(h){e._vertexShaderText=f,e._fragmentShaderText=p;let x=/(?:Compile|Link) error: ([^]*)/.exec(h.message);u(x?x[1]:h.message)}})}Zp.prototype._bind=function(){YN(this),this._gl.useProgram(this._program)};Zp.prototype._setUniforms=function(e,t,n){let i,o;if(c(e)){let a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){let l=a[o];if(!c(e[l.name]))throw new L(`Unknown uniform: ${l.name}`);l.value=e[l.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,l=this._program;if(a.validateProgram(l),!a.getProgramParameter(l,a.VALIDATE_STATUS))throw new L(`Program validation failed. Program info log: ${a.getProgramInfoLog(l)}`)}};Zp.prototype.isDestroyed=function(){return!1};Zp.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Zp.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),he(this)};var tn=Zp;function HN(e){this._context=e}var pZ,XZe=new et({primitiveType:ve.TRIANGLES}),IZe=new ti({color:new Y(0,0,0,0)});function WZe(e,t){return new Fr({context:e,colorTextures:[t],destroyAttachments:!1})}function wZe(e,t){return tn.fromCache({context:e,vertexShaderSource:fx,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function PZe(e,t){return(!c(pZ)||pZ.viewport.width!==e||pZ.viewport.height!==t)&&(pZ=Oe.fromCache({viewport:new je(0,0,e,t)})),pZ}HN.prototype.execute=function(e){if(C.defined("computeCommand",e),c(e.preExecute)&&e.preExecute(e),!c(e.fragmentShaderSource)&&!c(e.shaderProgram))throw new L("computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.");C.defined("computeCommand.outputTexture",e.outputTexture);let t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=c(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=c(e.shaderProgram)?e.shaderProgram:wZe(o,e.fragmentShaderSource),a=WZe(o,t),l=PZe(n,i),d=e.uniformMap,u=IZe;u.framebuffer=a,u.r
importScripts("${k3(CESIUM_WORKERS)}");
CesiumWorkers["${i}"]();
`;return r=k3(a),new Worker(r,o)}if(r=e,n||(r=on(`${la._workerModulePrefix+i}.js`)),!Ot.supportsEsmWebWorkers())throw new le("This browser is not supported. Please update your browser to continue.");return o.type="module",new Worker(r,o)}async function HZe(e,t){let n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Ot.supportsWebAssembly()){if(!c(t.fallbackModulePath))throw new le(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=on(t.fallbackModulePath),n}n.wasmBinaryFile=on(t.wasmBinaryFile);let i=await Ge.fetchArrayBuffer({url:n.wasmBinaryFile});return n.wasmBinary=i,n}function la(e,t){this._workerPath=e,this._maximumActiveTasks=t??Number.POSITIVE_INFINITY,this._activeTasks=0,this._nextID=0,this._webAssemblyPromise=void 0}var zZe=(e,t,n,i)=>{let o=({data:r})=>{if(r.id===t){if(c(r.error)){let s=r.error;s.name==="RuntimeError"?(s=new le(r.error.message),s.stack=r.error.stack):s.name==="DeveloperError"?(s=new L(r.error.message),s.stack=r.error.stack):s.name==="Error"&&(s=new Error(r.error.message),s.stack=r.error.stack),U3.raiseEvent(s),i(s)}else U3.raiseEvent(),n(r.result);e.removeEventListener("message",o)}};return o},KZe=[];async function JZe(e,t,n){let i=await Promise.resolve(Vee());c(n)?i||(n.length=0):n=KZe;let o=e._nextID++,r=new Promise((s,a)=>{e._worker.addEventListener("message",zZe(e._worker,o,s,a))});return e._worker.postMessage({id:o,baseUrl:on.getCesiumBaseUrl().url,parameters:t,canTransferArrayBuffer:i},n),r}async function QZe(e,t,n){++e._activeTasks;try{let i=await JZe(e,t,n);return--e._activeTasks,i}catch(i){throw--e._activeTasks,i}}la.prototype.scheduleTask=function(e,t){if(c(this._worker)||(this._worker=O3(this._workerPath)),!(this._activeTasks>=this._maximumActiveTasks))return QZe(this,e,t)};la.prototype.initWebAssemblyModule=async function(e){if(c(this._webAssemblyPromise))return this._webAssemblyPromise;let t=async()=>{let n=this._worker=O3(this._workerPath),i=await HZe(this,e),o=await Promise.resolve(Vee()),r,s=i.wasmBinary;c(s)&&o&&(r=[s]);let a=new Promise((l,d)=>{n.onmessage=function({data:u}){c(u)?l(u.result):d(new le("Could not configure wasm module"))}});return n.postMessage({canTransferArrayBuffer:o,parameters:{webAssemblyConfig:i}},r),a};return this._webAssemblyPromise=t(),this._webAssemblyPromise};la.prototype.isDestroyed=function(){return!1};la.prototype.destroy=function(){return c(this._worker)&&this._worker.terminate(),he(this)};la.taskCompletedEvent=U3;la._defaultWorkerModulePrefix="Workers/";la._workerModulePrefix=la._defaultWorkerModulePrefix;la._canTransferArrayBuffer=void 0;var gi=la;function Rp(){}Rp._transcodeTaskProcessor=new gi("transcodeKTX2",Number.POSITIVE_INFINITY);Rp._readyPromise=void 0;function jZe(){let e=Rp._transcodeTaskProcessor.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(t){if(t)return Rp._transcodeTaskProcessor;throw new le("KTX2 transcoder could not be initialized.")});Rp._readyPromise=e}Rp.transcode=function(e,t){return C.defined("supportedTargetFormats",t),c(Rp._readyPromise)||jZe(),Rp._readyPromise.then(function(n){let i=e;e instanceof ArrayBuffer&&(i=new Uint8Array(e));let o={supportedTargetFormats:t,ktx2Buffer:i};return n.scheduleTask(o,[i.buffer])}).then(function(n){let i=n.length,o=Object.keys(n[0]);for(let r=0;r<i;r++){let s=n[r];for(let a=0;a<o.length;a++){let l=s[o[a]];s[o[a]]=new yZ(l.internalFormat,l.datatype,l.width,l.height,l.levelBuffer)}}if(o.length===1){for(let r=0;r<i;++r)n[r]=n[r][o[0]];i===1&&(n=n[0])}return n}).catch(function(n){throw n})};var gZ=Rp;var Lee;Zee.setKTX2SupportedFormats=function(e,t,n,i,o,r){Lee={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function Zee(e){C.defined("resourceOrUrlOrBuffer",e);let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=Ge.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return gZ.transcode(n,Lee)})}var Ll=Zee;var WAt=_(T(),1);var L2t=_(T(),1);var e2t=_(T(),1);var kPt=_(T(),1);function qZe(e,t){this.start=e??0,this.stop=t??0}var Ia=qZ
`;var MAt=_(T(),1),XZ=`const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
`;var kAt=_(T(),1),IZ=`const float czm_epsilon1 = 0.1;
`;var OAt=_(T(),1),WZ=`const float czm_epsilon2 = 0.01;
`;var BAt=_(T(),1),wZ=`const float czm_epsilon3 = 0.001;
`;var HAt=_(T(),1),PZ=`const float czm_epsilon4 = 0.0001;
`;var KAt=_(T(),1),vZ=`const float czm_epsilon5 = 0.00001;
`;var QAt=_(T(),1),FZ=`const float czm_epsilon6 = 0.000001;
`;var qAt=_(T(),1),AZ=`const float czm_epsilon7 = 0.0000001;
`;var e9t=_(T(),1),MZ=`const float czm_infinity = 5906376272000.0;
`;var n9t=_(T(),1),NZ=`const float czm_oneOverPi = 0.3183098861837907;
`;var o9t=_(T(),1),kZ=`const float czm_oneOverTwoPi = 0.15915494309189535;
`;var s9t=_(T(),1),UZ=`const float czm_passCesium3DTile = 4.0;
`;var c9t=_(T(),1),OZ=`const float czm_passCesium3DTileClassification = 5.0;
`;var d9t=_(T(),1),DZ=`const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
`;var m9t=_(T(),1),BZ=`const float czm_passClassification = 7.0;
`;var h9t=_(T(),1),YZ=`const float czm_passCompute = 1.0;
`;var b9t=_(T(),1),HZ=`const float czm_passEnvironment = 0.0;
`;var g9t=_(T(),1),zZ=`const float czm_passGlobe = 2.0;
`;var _9t=_(T(),1),KZ=`const float czm_passOpaque = 7.0;
`;var S9t=_(T(),1),JZ=`const float czm_passOverlay = 10.0;
`;var V9t=_(T(),1),QZ=`const float czm_passTerrainClassification = 3.0;
`;var Z9t=_(T(),1),jZ=`const float czm_passTranslucent = 8.0;
`;var G9t=_(T(),1),qZ=`const float czm_passVoxels = 9.0;
`;var X9t=_(T(),1),$Z=`const float czm_pi = 3.141592653589793;
`;var W9t=_(T(),1),eR=`const float czm_piOverFour = 0.7853981633974483;
`;var P9t=_(T(),1),tR=`const float czm_piOverSix = 0.5235987755982988;
`;var F9t=_(T(),1),nR=`const float czm_piOverThree = 1.0471975511965976;
`;var M9t=_(T(),1),iR=`const float czm_piOverTwo = 1.5707963267948966;
`;var k9t=_(T(),1),oR=`const float czm_radiansPerDegree = 0.017453292519943295;
`;var O9t=_(T(),1),rR=`const float czm_sceneMode2D = 2.0;
`;var B9t=_(T(),1),sR=`const float czm_sceneMode3D = 3.0;
`;var H9t=_(T(),1),aR=`const float czm_sceneModeColumbusView = 1.0;
`;var K9t=_(T(),1),cR=`const float czm_sceneModeMorphing = 0.0;
`;var Q9t=_(T(),1),lR=`const float czm_solarRadius = 695500000.0;
`;var q9t=_(T(),1),dR=`const float czm_threePiOver2 = 4.71238898038469;
`;var eMt=_(T(),1),uR=`const float czm_twoPi = 6.283185307179586;
`;var nMt=_(T(),1),mR=`const float czm_webMercatorMaxLatitude = 1.4844222297453324;
`;var oMt=_(T(),1),fR=`struct czm_depthRangeStruct
{
float near;
float far;
};
`;var sMt=_(T(),1),hR=`struct czm_material
{
vec3 diffuse;
float specular;
float shininess;
vec3 normal;
vec3 emission;
float alpha;
};
`;var cMt=_(T(),1),pR=`struct czm_materialInput
{
float s;
vec2 st;
vec3 str;
vec3 normalEC;
mat3 tangentToEyeMatrix;
vec3 positionToEyeEC;
float height;
float slope;
float aspect;
float waterMask;
};
`;var dMt=_(T(),1),bR=`struct czm_modelMaterial {
vec4 baseColor;
vec3 diffuse;
float alpha;
vec3 specular;
float roughness;
vec3 normalEC;
float occlusion;
vec3 emissive;
#ifdef USE_SPECULAR
float specularWeight;
#endif
#ifdef USE_ANISOTROPY
vec3 anisotropicT;
vec3 anisotropicB;
float anisotropyStrength;
#endif
#ifdef USE_CLEARCOAT
float clearcoatFactor;
float clearcoatRoughness;
vec3 clearcoatNormal;
#endif
};
`;var mMt=_(T(),1),yR=`struct czm_modelVertexOutput {
vec3 positionMC;
float pointSize;
};
`;var hMt=_(T(),1),gR=`struct czm_ray
{
vec3 origin;
vec3 direction;
};
`;var bMt=_(T(),1),xR=`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 gMt=_(T(),1),_R=`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 _Mt=_(T(),1),TR=`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 SMt=_(T(),1),SR=`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 VMt=_(T(),1),CR=`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 ZMt=_(T(),1),VR=`vec3 czm_applyHSBShift(vec3 rgb, vec3 hsbShift, bool ignoreBlackPixels) {
vec3 hsb = czm_RGBToHSB(rgb);
hsb.x += hsbShift.x;
hsb.y = clamp(hsb.y + hsbShift.y, 0.0, 1.0);
if (ignoreBlackPixels) {
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + hsbShift.z : 0.0;
} else {
hsb.z = hsb.z + hsbShift.z;
}
hsb.z = clamp(hsb.z, 0.0, 1.0);
return czm_HSBToRGB(hsb);
}
`;var GMt=_(T(),1),LR=`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 XMt=_(T(),1),ZR=`float czm_approximateTanh(float x) {
float x2 = x * x;
return max(-1.0, min(1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2)));
}
`;var WMt=_(T(),1),RR=`bool czm_backFacing()
{
return gl_FrontFacing == false;
}
`;var PMt=_(T(),1),GR=`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 FMt=_(T(),1),ER=`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 MMt=_(T(),1),XR=`uniform vec4 shadowMap_cascadeDistances;
float czm_cascadeDistance(vec4 weights)
{
return dot(shadowMap_cascadeDistances, weights);
}
`;var kMt=_(T(),1),IR=`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 OMt=_(T(),1),WR=`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 BMt=_(T(),1),wR=`float getSignedDistance(vec2 uv, highp sampler2D clippingDistance) {
float signedDistance = texture(clippingDistance, uv).r;
return (signedDistance - 0.5) * 2.0;
}
void czm_clipPolygons(highp sampler2D clippingDistance, int extentsLength, vec2 clippingPosition, int regionIndex) {
vec2 rectUv = clippingPosition;
if (regionIndex < 0 || rectUv.x <= 0.0 || rectUv.y <= 0.0 || rectUv.x >= 1.0 || rectUv.y >= 1.0) {
#ifdef CLIPPING_INVERSE
discard;
#endif
return;
}
vec2 clippingDistanceTextureDimensions = vec2(textureSize(clippingDistance, 0));
vec2 sampleOffset = max(1.0 / clippingDistanceTextureDimensions, vec2(0.005));
float dimension = float(extentsLength);
if (extentsLength > 2) {
dimension = ceil(log2(float(extentsLength)));
}
vec2 textureOffset = vec2(mod(float(regionIndex), dimension), floor(float(regionIndex) / dimension)) / dimension;
vec2 uv = textureOffset + rectUv / dimension;
float signedDistance = getSignedDistance(uv, clippingDistance);
#ifdef CLIPPING_INVERSE
if (signedDistance > 0.0) {
discard;
}
#else
if (signedDistance < 0.0) {
discard;
}
#endif
}
`;var HMt=_(T(),1),PR=`vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
{
vec3 p = mix(position2D.xyz, position3D.xyz, time);
return vec4(p, 1.0);
}
`;var KMt=_(T(),1),vR=`vec4 czm_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 = czm_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) * czm_atmosphereLightIntensity;
return vec4(color, opacity);
}
vec4 czm_computeAtmosphereColor(
czm_ray primaryRay,
vec3 lightDirection,
vec3 rayleighColor,
vec3 mieColor,
float opacity
) {
vec3 direction = normalize(primaryRay.direction);
float cosAngle = dot(direction, lightDirection);
float cosAngleSq = cosAngle * cosAngle;
float G = czm_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) * czm_atmosphereLightIntensity;
return vec4(color, opacity);
}
`;var QMt=_(T(),1),FR=`void czm_computeGroundAtmosphereScattering(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);
czm_computeScattering(
primaryRay,
length(cameraToPositionWC),
lightDirection,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
}
`;var qMt=_(T(),1),AR=`vec4 czm_computePosition();
`;var eNt=_(T(),1),MR=`void czm_computeScattering(
czm_ray primaryRay,
float primaryRayLength,
vec3 lightDirection,
float atmosphereInnerRadius,
out vec3 rayleighColor,
out vec3 mieColor,
out float opacity
) {
const float ATMOSPHERE_THICKNESS = 111e3;
const int PRIMARY_STEPS_MAX = 16;
const int LIGHT_STEPS_MAX = 4;
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;
}
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
float start_0 = primaryRayAtmosphereIntersect.start;
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
float x_o_a = start_0 - ATMOSPHERE_THICKNESS;
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0);
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0);
float rayPositionLength = primaryRayAtmosphereIntersect.start;
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
vec3 rayleighAccumulation = vec3(0.0);
vec3 mieAccumulation = vec3(0.0);
vec2 opticalDepth = vec2(0.0);
vec2 heightScale = vec2(czm_atmosphereRayleighScaleHeight, czm_atmosphereMieScaleHeight);
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
if (i >= PRIMARY_STEPS) {
break;
}
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_MAX; ++j) {
if (j >= LIGHT_STEPS) {
break;
}
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
lightPositionLength += lightStepLength;
}
vec3 attenuation = exp(-((czm_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (czm_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
rayleighAccumulation += sampleDensity.x * attenuation;
mieAccumulation += sampleDensity.y * attenuation;
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
}
rayleighColor = czm_atmosphereRayleighCoefficient * rayleighAccumulation;
mieColor = czm_atmosphereMieCoefficient * mieAccumulation;
opacity = length(exp(-((czm_atmosphereMieCoefficient * opticalDepth.y) + (czm_atmosphereRayleighCoefficient * opticalDepth.x))));
}
`;var nNt=_(T(),1),NR=`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 oNt=_(T(),1),kR=`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 sNt=_(T(),1),UR=`#if (__VERSION__ == 300 || defined(GL_EXT_frag_depth)) && !defined(LOG_DEPTH)
out float v_WindowZ;
#endif
vec4 czm_depthClamp(vec4 coords)
{
#ifndef LOG_DEPTH
#if __VERSION__ == 300 || defined(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 cNt=_(T(),1),OR=`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 dNt=_(T(),1),DR=`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 mNt=_(T(),1),BR=`vec2 czm_ellipsoidTextureCoordinates(vec3 normal)
{
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
}
`;var hNt=_(T(),1),YR=`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 bNt=_(T(),1),HR=`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 gNt=_(T(),1),zR=`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 _Nt=_(T(),1),KR=`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 SNt=_(T(),1),JR=`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 VNt=_(T(),1),QR=`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 ZNt=_(T(),1),jR=`vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
{
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
}
`;var GNt=_(T(),1),qR=`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 XNt=_(T(),1),$R=`vec3 czm_getDynamicAtmosphereLightDirection(vec3 positionWC, float lightEnum) {
const float NONE = 0.0;
const float SCENE_LIGHT = 1.0;
const float SUNLIGHT = 2.0;
vec3 lightDirection =
positionWC * float(lightEnum == NONE) +
czm_lightDirectionWC * float(lightEnum == SCENE_LIGHT) +
czm_sunDirectionWC * float(lightEnum == SUNLIGHT);
return normalize(lightDirection);
}
`;var WNt=_(T(),1),eG=`float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
{
return max(dot(lightDirectionEC, normalEC), 0.0);
}
`;var PNt=_(T(),1),tG=`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 FNt=_(T(),1),nG=`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 = (texture(normalMap, uv0)) +
(texture(normalMap, uv1)) +
(texture(normalMap, uv2)) +
(texture(normalMap, uv3));
return ((noise / 4.0) - 0.5) * 2.0;
}
`;var MNt=_(T(),1),iG=`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 kNt=_(T(),1),oG=`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 ONt=_(T(),1),rG=`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 BNt=_(T(),1),sG=`vec3 czm_inverseGamma(vec3 color) {
return pow(color, vec3(1.0 / czm_gamma));
}
`;var HNt=_(T(),1),aG=`bool czm_isEmpty(czm_raySegment interval)
{
return (interval.stop < 0.0);
}
`;var KNt=_(T(),1),cG=`bool czm_isFull(czm_raySegment interval)
{
return (interval.start == 0.0 && interval.stop == czm_infinity);
}
`;var QNt=_(T(),1),lG=`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 qNt=_(T(),1),dG=`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 e5t=_(T(),1),uG=`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 n5t=_(T(),1),mG=`float czm_luminance(vec3 rgb)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
return dot(rgb, W);
}
`;var o5t=_(T(),1),fG=`float czm_maximumComponent(vec2 v)
{
return max(v.x, v.y);
}
float czm_maximumComponent(vec3 v)
{
return max(max(v.x, v.y), v.z);
}
float czm_maximumComponent(vec4 v)
{
return max(max(max(v.x, v.y), v.z), v.w);
}
`;var s5t=_(T(),1),hG=`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 c5t=_(T(),1),pG=`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 d5t=_(T(),1),bG=`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 m5t=_(T(),1),yG=`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 h5t=_(T(),1),gG=`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 b5t=_(T(),1),xG=`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 g5t=_(T(),1),_G=`vec3 lambertianDiffuse(vec3 diffuseColor)
{
return diffuseColor / czm_pi;
}
vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
{
float versine = 1.0 - VdotH;
float versineSquared = versine * versine;
return f0 + (f90 - f0) * versineSquared * versineSquared * versine;
}
#ifdef USE_ANISOTROPY
float smithVisibilityGGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 lightDirection, vec3 viewDirection)
{
vec3 roughnessScale = vec3(tangentialRoughness, bitangentRoughness, 1.0);
float GGXV = lightDirection.z * length(roughnessScale * viewDirection);
float GGXL = viewDirection.z * length(roughnessScale * lightDirection);
float v = 0.5 / (GGXV + GGXL);
return clamp(v, 0.0, 1.0);
}
float GGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 halfwayDirection)
{
float roughnessSquared = bitangentRoughness * tangentialRoughness;
vec3 f = halfwayDirection * vec3(bitangentRoughness, tangentialRoughness, roughnessSquared);
float w2 = roughnessSquared / dot(f, f);
return roughnessSquared * w2 * w2 / czm_pi;
}
#endif
float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
{
float alphaRoughnessSq = alphaRoughness * alphaRoughness;
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGX = GGXV + GGXL;
if (GGX > 0.0)
{
return 0.5 / GGX;
}
return 0.0;
}
float GGX(float alphaRoughness, float NdotH)
{
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
float f = (NdotH * alphaRoughnessSquared - NdotH) * NdotH + 1.0;
return alphaRoughnessSquared / (czm_pi * f * f);
}
float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float alphaRoughness)
{
float NdotL = clamp(dot(normal, lightDirection), 0.0, 1.0);
float NdotV = clamp(dot(normal, viewDirection), 0.0, 1.0);
float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
float NdotH = clamp(dot(normal, halfwayDirection), 0.0, 1.0);
float D = GGX(alphaRoughness, NdotH);
return G * D;
}
vec3 czm_pbrLighting(vec3 viewDirectionEC, vec3 normalEC, vec3 lightDirectionEC, czm_modelMaterial material)
{
vec3 halfwayDirectionEC = normalize(viewDirectionEC + lightDirectionEC);
float VdotH = clamp(dot(viewDirectionEC, halfwayDirectionEC), 0.0, 1.0);
float NdotL = clamp(dot(normalEC, lightDirectionEC), 0.001, 1.0);
vec3 f0 = material.specular;
float reflectance = czm_maximumComponent(f0);
vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
vec3 F = fresnelSchlick2(f0, f90, VdotH);
#if defined(USE_SPECULAR)
F *= material.specularWeight;
#endif
float alphaRoughness = material.roughness * material.roughness;
#ifdef USE_ANISOTROPY
mat3 tbn = mat3(material.anisotropicT, material.anisotropicB, normalEC);
vec3 lightDirection = lightDirectionEC * tbn;
vec3 viewDirection = viewDirectionEC * tbn;
vec3 halfwayDirection = halfwayDirectionEC * tbn;
float anisotropyStrength = material.anisotropyStrength;
float tangentialRoughness = mix(alphaRoughness, 1.0, anisotropyStrength * anisotropyStrength);
float bitangentRoughness = clamp(alphaRoughness, 0.001, 1.0);
float G = smithVisibilityGGX_anisotropic(bitangentRoughness, tangentialRoughness, lightDirection, viewDirection);
float D = GGX_anisotropic(bitangentRoughness, tangentialRoughness, halfwayDirection);
vec3 specularContribution = F * G * D;
#else
float specularStrength = computeDirectSpecularStrength(normalEC, lightDirectionEC, viewDirectionEC, halfwayDirectionEC, alphaRoughness);
vec3 specularContribution = F * specularStrength;
#endif
vec3 diffuseColor = material.diffuse;
vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);
return (diffuseContribution + specularContribution) * NdotL;
}
`;var _5t=_(T(),1),TG=`vec3 czm_pbrNeutralTonemapping(vec3 color) {
const float startCompression = 0.8 - 0.04;
const float desaturation = 0.15;
float x = min(color.r, min(color.g, color.b));
float offset = czm_branchFreeTernary(x < 0.08, x - 6.25 * x * x, 0.04);
color -= offset;
float peak = max(color.r, max(color.g, color.b));
if (peak < startCompression) return color;
const float d = 1.0 - startCompression;
float newPeak = 1.0 - d * d / (peak + d - startCompression);
color *= newPeak / peak;
float g = 1.0 - 1.0 / (desaturation * (peak - newPeak) + 1.0);
return mix(color, newPeak * vec3(1.0, 1.0, 1.0), g);
}
`;var S5t=_(T(),1),SG=`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 V5t=_(T(),1),CG=`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 Z5t=_(T(),1),VG=`vec3 czm_pointAlongRay(czm_ray ray, float time)
{
return ray.origin + (time * ray.direction);
}
`;var G5t=_(T(),1),LG=`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 X5t=_(T(),1),ZG=`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 W5t=_(T(),1),RG=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
{
return czm_reverseLogDepth(texture(depthTexture, texCoords).r);
}
`;var P5t=_(T(),1),GG=`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 F5t=_(T(),1),EG=`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 = exp2(log2Depth) - 1.0;
return far * (1.0 - near / (depthFromNear + near)) / (far - near);
#endif
return logZ;
}
`;var M5t=_(T(),1),XG=`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 k5t=_(T(),1),IG=`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 O5t=_(T(),1),WG=`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 B5t=_(T(),1),wG=`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 H5t=_(T(),1),PG=`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 K5t=_(T(),1),vG=`float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)
{
return czm_unpackDepth(czm_textureCube(shadowMap, d));
}
float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)
{
#ifdef USE_SHADOW_DEPTH_TEXTURE
return texture(shadowMap, uv).r;
#else
return czm_unpackDepth(texture(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 Q5t=_(T(),1),FG=`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 q5t=_(T(),1),AG=`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 ekt=_(T(),1),MG=`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;
vec3 L =
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);
return max(L, vec3(0.0));
}
`;var nkt=_(T(),1),NG=`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 okt=_(T(),1),kG=`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 skt=_(T(),1),UG=`vec4 czm_textureCube(samplerCube sampler, vec3 p) {
#if __VERSION__ == 300
return texture(sampler, p);
#else
return textureCube(sampler, p);
#endif
}
vec4 czm_textureCube(samplerCube sampler, vec3 p, float lod) {
#if __VERSION__ == 300
return textureLod(sampler, p, lod);
#elif defined(GL_EXT_shader_texture_lod)
return textureCubeLodEXT(sampler, p, lod);
#endif
}
`;var ckt=_(T(),1),OG=`vec4 czm_transformPlane(vec4 plane, mat4 transform) {
vec4 transformedPlane = transform * plane;
float normalMagnitude = length(transformedPlane.xyz);
return transformedPlane / normalMagnitude;
}
`;var dkt=_(T(),1),DG=`vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
{
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
if (length(highDifference) == 0.0) {
highDifference = vec3(0);
}
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
return vec4(highDifference + lowDifference, 1.0);
}
`;var mkt=_(T(),1),BG=`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 hkt=_(T(),1),YG=`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 bkt=_(T(),1),HG=`vec2 getLookupUv(vec2 dimensions, int i) {
int pixY = i / int(dimensions.x);
int pixX = i - (pixY * int(dimensions.x));
float pixelWidth = 1.0 / dimensions.x;
float pixelHeight = 1.0 / dimensions.y;
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
return vec2(u, v);
}
vec4 czm_unpackClippingExtents(highp sampler2D extentsTexture, int index) {
vec2 textureDimensions = vec2(textureSize(extentsTexture, 0));
return texture(extentsTexture, getLookupUv(textureDimensions, index));
}
`;var gkt=_(T(),1),zG=`float czm_unpackDepth(vec4 packedDepth)
{
return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
}
`;var _kt=_(T(),1),KG=`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 Skt=_(T(),1),JG=`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 Vkt=_(T(),1),QG=`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 Zkt=_(T(),1),jG=`#ifdef LOG_DEPTH
out float v_depthFromNearPlusOne;
#ifdef SHADOW_MAP
out 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 Gkt=_(T(),1),qG=`vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)
{
float x = 2.0 * screenCoordinate.x - 1.0;
float y = 2.0 * screenCoordinate.y - 1.0;
float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
vec4 q = vec4(x, y, z, 1.0);
q /= screenCoordinate.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(vec4 fragmentCoordinate)
{
vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;
return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));
}
vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)
{
#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;
float depthFromNear = exp2(log2Depth) - 1.0;
float depthFromCamera = depthFromNear + near;
vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
eyeCoordinate.w = 1.0 / depthFromCamera;
return eyeCoordinate;
#else
vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
#endif
return eyeCoordinate;
}
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
{
vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;
return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);
}
`;var Xkt=_(T(),1),$G=`#if !defined(LOG_DEPTH)
in float v_WindowZ;
#endif
void czm_writeDepthClamp()
{
#if (!defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
gl_FragDepth = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
#endif
}
`;var Wkt=_(T(),1),eE=`#ifdef LOG_DEPTH
in float v_depthFromNearPlusOne;
#ifdef POLYGON_OFFSET
uniform vec2 u_polygonOffset;
#endif
#endif
void czm_writeLogDepth(float depth)
{
#if (defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {
discard;
}
#ifdef POLYGON_OFFSET
float factor = u_polygonOffset[0];
float units = u_polygonOffset[1];
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
if (factor != 0.0) {
float x = dFdx(depth);
float y = dFdy(depth);
float m = sqrt(x * x + y * y);
depth += m * factor;
}
#endif
#endif
gl_FragDepth = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;
#ifdef POLYGON_OFFSET
gl_FragDepth += czm_epsilon7 * units;
#endif
#endif
}
void czm_writeLogDepth() {
#ifdef LOG_DEPTH
czm_writeLogDepth(v_depthFromNearPlusOne);
#endif
}
`;var Pkt=_(T(),1),tE=`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 Fkt=_(T(),1),nE=`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 Sx={czm_degreesPerRadian:EZ,czm_depthRange:XZ,czm_epsilon1:IZ,czm_epsilon2:WZ,czm_epsilon3:wZ,czm_epsilon4:PZ,czm_epsilon5:vZ,czm_epsilon6:FZ,czm_epsilon7:AZ,czm_infinity:MZ,czm_oneOverPi:NZ,czm_oneOverTwoPi:kZ,czm_passCesium3DTile:UZ,czm_passCesium3DTileClassification:OZ,czm_passCesium3DTileClassificationIgnoreShow:DZ,czm_passClassification:BZ,czm_passCompute:YZ,czm_passEnvironment:HZ,czm_passGlobe:zZ,czm_passOpaque:KZ,czm_passOverlay:JZ,czm_passTerrainClassification:QZ,czm_passTranslucent:jZ,czm_passVoxels:qZ,czm_pi:$Z,czm_piOverFour:eR,czm_piOverSix:tR,czm_piOverThree:nR,czm_piOverTwo:iR,czm_radiansPerDegree:oR,czm_sceneMode2D:rR,czm_sceneMode3D:sR,czm_sceneModeColumbusView:aR,czm_sceneModeMorphing:cR,czm_solarRadius:lR,czm_threePiOver2:dR,czm_twoPi:uR,czm_webMercatorMaxLatitude:mR,czm_depthRangeStruct:fR,czm_material:hR,czm_materialInput:pR,czm_modelMaterial:bR,czm_modelVertexOutput:yR,czm_ray:gR,czm_raySegment:xR,czm_shadowParameters:_R,czm_acesTonemapping:TR,czm_alphaWeight:SR,czm_antialias:CR,czm_applyHSBShift:VR,czm_approximateSphericalCoordinates:LR,czm_approximateTanh:ZR,czm_backFacing:RR,czm_branchFreeTernary:GR,czm_cascadeColor:ER,czm_cascadeDistance:XR,czm_cascadeMatrix:IR,czm_cascadeWeights:WR,czm_clipPolygons:wR,czm_columbusViewMorph:PR,czm_computeAtmosphereColor:vR,czm_computeGroundAtmosphereScattering:FR,czm_computePosition:AR,czm_computeScattering:MR,czm_cosineAndSine:NR,czm_decompressTextureCoordinates:kR,czm_depthClamp:UR,czm_eastNorthUpToEyeCoordinates:OR,czm_ellipsoidContainsPoint:DR,czm_ellipsoidTextureCoordinates:BR,czm_equalsEpsilon:YR,czm_eyeOffset:HR,czm_eyeToWindowCoordinates:zR,czm_fastApproximateAtan:KR,czm_fog:JR,czm_gammaCorrect:QR,czm_geodeticSurfaceNormal:jR,czm_getDefaultMaterial:qR,czm_getDynamicAtmosphereLightDirection:$R,czm_getLambertDiffuse:eG,czm_getSpecular:tG,czm_getWaterNoise:nG,czm_HSBToRGB:iG,czm_HSLToRGB:oG,czm_hue:rG,czm_inverseGamma:sG,czm_isEmpty:aG,czm_isFull:cG,czm_latitudeToWebMercatorFraction:lG,czm_linearToSrgb:dG,czm_lineDistance:uG,czm_luminance:mG,czm_maximumComponent:fG,czm_metersPerPixel:hG,czm_modelToWindowCoordinates:pG,czm_multiplyWithColorBalance:bG,czm_nearFarScalar:yG,czm_octDecode:gG,czm_packDepth:xG,czm_pbrLighting:_G,czm_pbrNeutralTonemapping:TG,czm_phong:SG,czm_planeDistance:CG,czm_pointAlongRay:VG,czm_rayEllipsoidIntersectionInterval:LG,czm_raySphereIntersectionInterval:ZG,czm_readDepth:RG,czm_readNonPerspective:GG,czm_reverseLogDepth:EG,czm_RGBToHSB:XG,czm_RGBToHSL:IG,czm_RGBToXYZ:WG,czm_round:wG,czm_saturation:PG,czm_shadowDepthCompare:vG,czm_shadowVisibility:FG,czm_signNotZero:AG,czm_sphericalHarmonics:MG,czm_srgbToLinear:NG,czm_tangentToEyeSpaceMatrix:kG,czm_textureCube:UG,czm_transformPlane:OG,czm_translateRelativeToEye:DG,czm_translucentPhong:BG,czm_transpose:YG,czm_unpackClippingExtents:HG,czm_unpackDepth:zG,czm_unpackFloat:KG,czm_unpackUint:JG,czm_valueTransform:QG,czm_vertexLogDepth:jG,czm_windowToEyeCoordinates:qG,czm_writeDepthClamp:$G,czm_writeLogDepth:eE,czm_writeNonPerspective:tE,czm_XYZToRGB:nE};var hDt=_(T(),1);function EGe(e,t){let n=e;return n=n.replaceAll("version 300 es",""),n=n.replaceAll(/(texture\()/g,"texture2D("),t?(n=n.replaceAll(/\n\s*(in)\s+(vec\d|mat\d|float)/g,`
varying $2`),/out_FragData_(\d+)/.test(n)&&(n=`#extension GL_EXT_draw_buffers : enable
${n}`,n=n.replaceAll(/layout\s+\(location\s*=\s*\d+\)\s*out\s+vec4\s+out_FragData_\d+;/g,""),n=n.replaceAll(/out_FragData_(\d+)/g,"gl_FragData[$1]")),n=n.replaceAll(/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,""),n=n.replaceAll(/out_FragColor/g,"gl_FragColor"),n=n.replaceAll(/out_FragColor\[(\d+)\]/g,"gl_FragColor[$1]"),/gl_FragDepth/.test(n)&&(n=`#extension GL_EXT_frag_depth : enable
${n}`,n=n.replaceAll(/gl_FragDepth/g,"gl_FragDepthEXT")),n=`#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#endif
${n}`,n=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
${n}`):(n=n.replaceAll(/(in)\s+(vec\d|mat\d|float)/g,"attribute $2"),n=n.replaceAll(/(out)\s+(vec\d|mat\d|float)\s+([\w]+);/g,"varying $2 $3;")),n=`#version 100
${n}`,n}var iE=EGe;function bte(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 yte(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return c(i)||(t=bte(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function gte(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);c(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&Ms._czmBuiltinsAndUniforms.hasOwnProperty(i)){let o=yte(i,Ms._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),gte(o,t)}}))}function XGe(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]);if(i.length!==0){let o=`A circular dependency was found in the following built-in functions/structs/constants:
`;for(let r=0;r<i.length;++r)o=`${o+i[r].name}
`;throw new L(o)}}function IGe(e){let t=[],n=yte("main",e,t);gte(n,t),XGe(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
`;return i.replace(n.glslSource,"")}function xte(e,t,n){let i,o,r="",s=e.sources;if(c(s))for(i=0,o=s.length;i<o;++i)r+=`
#line 0
${s[i]}`;r=bte(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(g,x){if(c(a)&&a!==x)throw new L(`inconsistent versions found: ${a} and ${x}`);return a=x,`
`});let l=[];r=r.replace(/#extension.*\n/gm,function(g){return l.push(g),`
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");let d=e.pickColorQualifier;c(d)&&(r=Ms.createPickFragmentShaderSource(r,d));let u="",f=l.length;for(i=0;i<f;i++)u+=l[i];t&&(u+=`#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(c(p))for(i=0,o=p.length;i<o;++i){let g=p[i];g.length!==0&&(u+=`#define ${g}
`)}n.textureFloatLinear&&(u+=`#define OES_texture_float_linear
`),n.floatingPointTexture&&(u+=`#define OES_texture_float
`);let y="";e.includeBuiltIns&&(y=IGe(r)),u+=`
#line 0
`;let h=y+r;return n.webgl2&&t&&!/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g.test(h)&&!/czm_out_FragColor/g.test(h)&&/out_FragColor/g.test(h)&&(u+=`layout(location = 0) out vec4 out_FragColor;
`),u+=y,u+=r,n.webgl2?u=`#version 300 es
${u}`:u=iE(u,t),u}function Ms(e){e=e??z.EMPTY_OBJECT;let t=e.pickColorQualifier;if(c(t)&&t!=="uniform"&&t!=="in")throw new L("options.pickColorQualifier must be 'uniform' or 'in'.");this.defines=c(e.defines)?e.defines.slice(0):[],this.sources=c(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=e.includeBuiltIns??!0}Ms.prototype.clone=function(){return new Ms({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};Ms.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};Ms.prototype.getCacheKey=function(){let t=this.defines.slice().sort().join(","),n=this.pickColorQualifier,i=this.includeBuiltIns,o=this.sources.join(`
`);return`${t}:${n}:${i}:${o}`};Ms.prototype.createCombinedVertexShader=function(e){return xte(this,!1,e)};Ms.prototype.createCombinedFragmentShader=function(e){return xte(this,!0,e)};Ms._czmBuiltinsAndUniforms={};for(let e in Sx)Sx.hasOwnProperty(e)&&(Ms._czmBuiltinsAndUniforms[e]=Sx[e]);for(let e in _p)if(_p.hasOwnProperty(e)){let t=_p[e];typeof t.getDeclaration=="function"&&(Ms._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}Ms.createPickVertexShaderSource=function(e){return`${Ms.replaceMain(e,"czm_old_main")}
in vec4 pickColor;
out vec4 czm_pickColor;
void main()
{
czm_old_main();
czm_pickColor = pickColor;
}`};Ms.createPickFragmentShaderSource=function(e,t){let n=Ms.replaceMain(e,"czm_old_main"),i=`${t} vec4 czm_pickColor;
void main()
{
czm_old_main();
if (out_FragColor.a == 0.0) {
discard;
}
out_FragColor = czm_pickColor;
}`;return`${n}
${i}`};function WGe(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 _te(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 Tte(e,t){let n=t.length;for(let i=0;i<n;++i){let o=t[i];if(_te(e,o))return o}}var wGe=["v_normalEC","v_normal"];Ms.findNormalVarying=function(e){return _te(e,"#ifdef HAS_NORMALS")?WGe(e,"HAS_NORMALS")?"v_normalEC":void 0:Tte(e,wGe)};var PGe=["v_positionEC"];Ms.findPositionVarying=function(e){return Tte(e,PGe)};var Be=Ms;function wm(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(wm.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});wm.prototype.replaceShaderProgram=function(e){return c(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function vGe(e){let t=Object.keys(e).sort();return JSON.stringify(e,t)}wm.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource,i=e.attributeLocations;typeof t=="string"&&(t=new Be({sources:[t]})),typeof n=="string"&&(n=new Be({sources:[n]}));let o=t.getCacheKey(),r=n.getCacheKey(),s=c(i)?vGe(i):"",a=`${o}:${r}:${s}`,l;if(c(this._shaders[a]))l=this._shaders[a],delete this._shadersToRelease[a];else{let d=this._context,u=t.createCombinedVertexShader(d),f=n.createCombinedFragmentShader(d),p=new tn({gl:d._gl,logShaderCompilation:d.logShaderCompilation,debugShaders:d.debugShaders,vertexShaderSource:t,vertexShaderText:u,fragmentShaderSource:n,fragmentShaderText:f,attributeLocations:i});l={cache:this,shaderProgram:p,keyword:a,derivedKeywords:[],count:0},p._cachedShader=l,this._shaders[a]=l,++this._numberOfShaders}return++l.count,l.shaderProgram};wm.prototype.replaceDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(c(r)){CY(this,r);let s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};wm.prototype.getDerivedShaderProgram=function(e,t){let n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(c(o))return o.shaderProgram};wm.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 Be({sources:[r]})),typeof s=="string"&&(s=new Be({sources:[s]}));let l=this._context,d=r.createCombinedVertexShader(l),u=s.createCombinedFragmentShader(l),f=new tn({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:r,vertexShaderText:d,fragmentShaderSource:s,fragmentShaderText:u,attributeLocations:a}),p={cache:this,shaderProgram:f,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),f._cachedShader=p,this._shaders[o]=p,f};function CY(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];CY(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}wm.prototype.destroyReleasedShaderPrograms=function(){let e=this._shadersToRelease;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];CY(this,n),--this._numberOfShaders}this._shadersToRelease={}};wm.prototype.releaseShaderProgram=function(e){if(c(e)){let t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};wm.prototype.isDestroyed=function(){return!1};wm.prototype.destroy=function(){let e=this._shaders;for(let t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return he(this)};var oE=wm;var YDt=_(T(),1);function Pm(e){e=e??z.EMPTY_OBJECT,C.defined("options.context",e.context);let{context:t,source:n,pixelFormat:i=ke.RGBA,pixelDatatype:o=Ue.UNSIGNED_BYTE,flipY:r=!0,skipColorSpaceConversion:s=!1,sampler:a=new en}=e,{width:l,height:d}=e;c(n)&&(c(l)||(l=n.videoWidth??n.naturalWidth??n.width),c(d)||(d=n.videoHeight??n.naturalHeight??n.height));let u=e.preMultiplyAlpha||i===ke.RGB||i===ke.LUMINANCE,f=ke.toInternalFormat(i,o,t),p=ke.isCompressedFormat(f);if(!c(l)||!c(d))throw new L("options requires a source field to create an initialized texture or
`),r=new Be({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
`),a=new Be({defines:this._fragmentShaderParts.defineLines,sources:[s]});return tn.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};Mc.prototype.clone=function(){return He(this,!0)};function IXe(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 WXe(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function wXe(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}}var Lx=Mc;var aHt=_(T(),1);var YYt=_(T(),1);function pE({x:e,y:t,width:n,height:i}){this.rectangle=new je(e,t,n,i),this.childNode1=void 0,this.childNode2=void 0,this.index=void 0}function wY({width:e,height:t,borderPadding:n}){this._width=e,this._height=t,this._borderPadding=n,this._root=new pE({x:n,y:n,width:e-2*n,height:t-2*n})}wY.prototype.pack=function(e,{width:t,height:n}){C.typeOf.number.greaterThanOrEquals("index",e,0),C.typeOf.number.greaterThanOrEquals("image.width",t,1),C.typeOf.number.greaterThanOrEquals("image.height",n,1);let i=this._findNode(this._root,{width:t,height:n});if(c(i))return i.index=e,i};wY.prototype._findNode=function(e,{width:t,height:n}){if(c(e)){if(!c(e.childNode1)&&!c(e.childNode2)){if(c(e.index))return;let{rectangle:i}=e,o=i.width,r=i.height,s=o-t,a=r-n;return s<0||a<0?void 0:s===0&&a===0?e:s>a?(e.childNode1=new pE({x:i.x,y:i.y,width:t,height:r}),e.childNode2=new pE({x:i.x+t,y:i.y,width:s,height:r}),this._findNode(e.childNode1,{width:t,height:n})):(e.childNode1=new pE({x:i.x,y:i.y,width:o,height:n}),e.childNode2=new pE({x:i.x,y:i.y+n,width:o,height:a}),this._findNode(e.childNode1,{width:t,height:n}))}return this._findNode(e.childNode1,{width:t,height:n})||this._findNode(e.childNode2,{width:t,height:n})}};var cC=wY;var one=16;function Gl(e){e=e??z.EMPTY_OBJECT;let t=e.borderWidthInPixels??1,n=e.initialSize??new D(one,one);C.typeOf.number.greaterThanOrEquals("options.borderWidthInPixels",t,0),C.typeOf.number.greaterThan("options.initialSize.x",n.x,0),C.typeOf.number.greaterThan("options.initialSize.y",n.y,0),this._pixelFormat=e.pixelFormat??ke.RGBA,this._sampler=e.sampler,this._borderWidthInPixels=t,this._initialSize=n,this._texturePacker=void 0,this._rectangles=[],this._subRegions=new Map,this._guid=Hn(),this._imagesToAddQueue=[],this._indexById=new Map,this._indexPromiseById=new Map,this._nextIndex=0}Object.defineProperties(Gl.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},rectangles:{get:function(){return this._rectangles}},texture:{get:function(){return this._texture}},pixelFormat:{get:function(){return this._pixelFormat}},sampler:{get:function(){return this._sampler}},numberOfImages:{get:function(){return this._nextIndex}},guid:{get:function(){return this._guid}},sizeInBytes:{get:function(){return c(this._texture)?this._texture.sizeInBytes:0}}});Gl.prototype.computeTextureCoordinates=function(e,t){C.typeOf.number.greaterThanOrEquals("index",e,0);let n=this._texture,i=this._rectangles[e];if(c(t)||(t=new je),!c(i))return t.x=0,t.y=0,t.width=0,t.height=0,t;let o=n.width,r=n.height,s=i.width,a=i.height,l=i.x,d=i.y,u=this._subRegions.get(e);if(c(u)){let f=this._rectangles[u];l+=f.x,d+=f.y}return t.x=l/o,t.y=d/r,t.width=s/o,t.height=a/r,t};Gl.prototype._copyFromTexture=function(e,t,n,i){let o=this._pixelFormat,r=this._sampler,s=new Pt({context:e,height:n,width:t,pixelFormat:o,sampler:r}),a=e._gl,l=s._textureTarget,d=this._texture,u=new Fr({context:e,colorTextures:[d],destroyAttachments:!1});a.activeTexture(a.TEXTURE0),a.bindTexture(l,s._texture),u._bind();let f=this.rectangles,p=
in vec3 v_normalEC;
in vec3 v_tangentEC;
in vec3 v_bitangentEC;
in 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
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var LKt=_(T(),1),TE=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in vec3 tangent;
in vec3 bitangent;
in vec2 st;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
out vec3 v_tangentEC;
out vec3 v_bitangentEC;
out 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 RKt=_(T(),1),SE=`in vec3 v_positionEC;
in 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
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var EKt=_(T(),1),CE=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in float batchId;
out vec3 v_positionEC;
out 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 IKt=_(T(),1),VE=`in vec3 v_positionEC;
in vec3 v_normalEC;
in 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
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var wKt=_(T(),1),LE=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in vec2 st;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
out 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 eJt=_(T(),1);var DKt=_(T(),1);var FKt=_(T(),1);var pIe={ADD:oe.FUNC_ADD,SUBTRACT:oe.FUNC_SUBTRACT,REVERSE_SUBTRACT:oe.FUNC_REVERSE_SUBTRACT,MIN:oe.MIN,MAX:oe.MAX},Pa=Object.freeze(pIe);var NKt=_(T(),1);var bIe={ZERO:oe.ZERO,ONE:oe.ONE,SOURCE_COLOR:oe.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:oe.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:oe.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:oe.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:oe.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:oe.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:oe.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:oe.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:oe.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:oe.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:oe.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:oe.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:oe.SRC_ALPHA_SATURATE},Co=Object.freeze(bIe);var yIe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Pa.ADD,equationAlpha:Pa.ADD,functionSourceRgb:Co.SOURCE_ALPHA,functionSourceAlpha:Co.ONE,functionDestinationRgb:Co.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Co.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Pa.ADD,equationAlpha:Pa.ADD,functionSourceRgb:Co.ONE,functionSourceAlpha:Co.ONE,functionDestinationRgb:Co.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Co.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:Pa.ADD,equationAlpha:Pa.ADD,functionSourceRgb:Co.SOURCE_ALPHA,functionSourceAlpha:Co.ONE,functionDestinationRgb:Co.ONE,functionDestinationAlpha:Co.ONE})},un=Object.freeze(yIe);var HKt=_(T(),1);var gIe={FRONT:oe.FRONT,BACK:oe.BACK,FRONT_AND_BACK:oe.FRONT_AND_BACK},_i=Object.freeze(gIe);function mC(e){e=e??z.EMPTY_OBJECT,this.material=e.material,this.translucent=e.translucent??!0,this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=e.closed??!1}Object.defineProperties(mC.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}}});mC.prototype.getFragmentShaderSource=function(){let e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),c(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
`)};mC.prototype.isTranslucent=function(){return c(this.material)&&this.material.isTranslucent()||!c(this.material)&&this.translucent};mC.prototype.getRenderState=function(){let e=this.isTranslucent(),t=He(this.renderState,!1);return e?(t.depthMask=!1,t.blending=un.ALPHA_BLEND):t.depthMask=!0,t};mC.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=un.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:_i.BACK}),c(n)&&(i=St(n,i,!0)),i};var no=mC;var VQt=_(T(),1);var nJt=_(T(),1),ZE=`uniform sampler2D image;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 rampColor = texture(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 oJt=_(T(),1),RE=`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 = texture(image, centerPixel).channel;
float imageWidth = float(imageDimensions.x);
vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));
float rightBump = texture(image, rightPixel).channel;
float imageHeight = float(imageDimensions.y);
vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));
float topBump = texture(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 sJt=_(T(),1),GE=`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 cJt=_(T(),1),EE=`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 dJt=_(T(),1),XE=`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 texture(heights, uv).x;
#else
return czm_unpackFloat(texture(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 = texture(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 mJt=_(T(),1),IE=`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);
#if (__VERSION__ == 300 || defined(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 hJt=_(T(),1),WE=`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 = texture(image, vec2(scaledHeight, 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var bJt=_(T(),1),wE=`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 gJt=_(T(),1),PE=`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;
#if (__VERSION__ == 300 || defined(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 _Jt=_(T(),1),vE=`uniform sampler2D image;
uniform float strength;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 textureValue = texture(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 SJt=_(T(),1),FE=`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;
#if (__VERSION__ == 300 || defined(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 VJt=_(T(),1),AE=`uniform vec4 color;
uniform vec4 gapColor;
uniform float dashLength;
uniform float dashPattern;
in 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 ZJt=_(T(),1),ME=`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 GJt=_(T(),1),NE=`uniform vec4 color;
uniform vec4 outlineColor;
uniform float outlineWidth;
in 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 XJt=_(T(),1),kE=`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 WJt=_(T(),1),UE=`uniform sampler2D image;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 rampColor = texture(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 PJt=_(T(),1),OE=`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 FJt=_(T(),1),DE=`uniform vec4 waterColor;
uniform vec4 landColor;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 outColor = mix(landColor, waterColor, materialInput.waterMask);
outColor = czm_gammaCorrect(outColor);
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var MJt=_(T(),1),BE=`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 = texture(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 Je(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=e.minificationFilter??Jt.LINEAR,this._magnificationFilter=e.magnificationFilter??di.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,xIe(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),c(Je._uniformList[this.type])||(Je._uniformList[this.type]=Object.keys(this._uniforms))}Je._uniformList={};Je.fromType=function(e,t){if(!c(Je._materialCache.getMaterial(e)))throw new L(`material with type '${e}' does not exist.`);let n=new Je({fabric:{type:e}});if(c(t))for(let i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};Je.prototype.isTranslucent=function(){if(c(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};Je.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n,i=this._loadedImages,o=i.length;for(t=0;t<o;++t){let l=i[t];n=l.id;let d=l.image,u;Array.isArray(d)&&(u=d.slice(1,d.length).map(function(g){return g.bufferView}),d=d[0]);let f=new en({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter}),p;c(d.internalFormat)?p=new Pt({context:e,pixelFormat:d.internalFormat,width:d.width,height:d.height,source:{arrayBufferView:d.bufferView,mipLevels:u},sampler:f}):p=new Pt({context:e,source:d,sampler:f});let y=this._textures[n];c(y)&&y!==this._defaultTexture&&y.destroy(),this._textures[n]=p;let h=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(h)){let g=this.uniforms[h];g.x=p._width,g.y=p._height}}i.length=0;let r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){let l=r[t];n=l.id;let d=l.images,u=new Uo({context:e,source:{positiveX:d[0],negativeX:d[1],positiveY:d[2],negativeY:d[3],positiveZ:d[4],negativeZ:d[5]},sampler:new en({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=u}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 l in a)a.hasOwnProperty(l)&&a[l].update(e)};Je.prototype.isDestroyed=function(){return!1};Je.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 he(this)};function xIe(e,t){e=e??z.EMPTY_OBJECT,t._strict=e.strict??!1,t._count=e.count??0,t._template=He(e.fabric??z.EMPTY_OBJECT),t._template.uniforms=He(t._template.uniforms??z.EMPTY_OBJECT),t._template.materials=He(t._template.materials??z.EMPTY_OBJECT),t.type=c(t._template.type)?t._template.type:Hn(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n,i=Je._materialCache.getMaterial(t.type);if(c(i)){let r=He(i.fabric,!0);t._template=St(t._template,r,!0),n=i.translucent}CIe(t),c(i)||Je._materialCache.addMaterial(t.type,t),LIe(t),EIe(t),IIe(t);let o=t._translucentFunctions.length===0?!0:void 0;if(n=n??o,n=e.translucent??n,c(n))if(typeof n=="function"){let r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function FY(e,t,n,i){if(c(e)){for(let o in e)if(e.hasOwnProperty(o)){let r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function mne(e,t){let n=`fabric: property name '${e}' is not valid. It should be `;for(let i=0;i<t.length;i++){let o=`'${t[i]}'`;n+=i===t.length-1?`or ${o}.`:`${o}, `}throw new L(n)}function _Ie(e,t){let n=`fabric: uniforms and materials cannot share the same property '${e}'`;throw new L(n)}var TIe=["type","materials","uniforms","components","source"],SIe=["diffuse","specular","shininess","normal","emission","alpha"];function CIe(e){let t=e._template,n=t.uniforms,i=t.materials,o=t.comp
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
{
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
`,c(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&&VIe(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 fne={mat2:Ii,mat3:te,mat4:M},ZIe=/\.ktx2$/i;function RIe(e){let t;return function(n,i){let o=n.uniforms,r=o[e],s=t!==r,a=!c(r)||r===Je.DefaultImageId;t=r;let l=n._textures[e],d,u;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&c(l)&&(l!==i.defaultTexture&&l.destroy(),l=void 0),!c(l)||l===i.defaultTexture){let p=new en({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});l=new Pt({context:i,source:r,sampler:p}),n._textures[e]=l;return}l.copyFrom({source:r})}else c(l)||(n._textures[e]=i.defaultTexture);return}if(r instanceof Pt&&r!==l){n._texturePaths[e]=void 0;let p=n._textures[e];c(p)&&p!==n._defaultTexture&&p.destroy(),n._textures[e]=r,d=`${e}Dimensions`,o.hasOwnProperty(d)&&(u=o[d],u.x=r._width,u.y=r._height);return}if(s&&c(l)&&a&&(l!==n._defaultTexture&&l.destroy(),l=void 0),c(l)||(n._texturePaths[e]=void 0,l=n._textures[e]=n._defaultTexture,d=`${e}Dimensions`,o.hasOwnProperty(d)&&(u=o[d],u.x=l._width,u.y=l._height)),a)return;let f=r instanceof Ge;if(!c(n._texturePaths[e])||f&&r.url!==n._texturePaths[e].url||!f&&r!==n._texturePaths[e]){if(typeof r=="string"||f){let p=f?r:Ge.createIfNeeded(r),y;ZIe.test(p.url)?y=Ll(p.url):y=p.fetchImage(),Promise.resolve(y).then(function(h){n._loadedImages.push({id:e,image:h})}).catch(function(){c(l)&&l!==n._defaultTexture&&l.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 GIe(e){return function(t,n){let i=t.uniforms[e];if(i instanceof Uo){let r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(c(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===Je.DefaultCubeMapId)return;let o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){let r=[Ge.createIfNeeded(i.positiveX).fetchImage(),Ge.createIfNeeded(i.negativeX).fetchImage(),Ge.createIfNeeded(i.positiveY).fetchImage(),Ge.createIfNeeded(i.negativeY).fetchImage(),Ge.createIfNeeded(i.positiveZ).fetchImage(),Ge.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function EIe(e){let t=e._template.uniforms;for(let n in t)t.hasOwnProperty(n)&&hne(e,n)}function hne(e,t){let n=e._strict,i=e._template.uniforms,o=i[t],r=XIe(o);if(!c(r))throw new L(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=YE(e,t,o,!1),s===0&&n)throw new L(`strict: shader source does not use channels '${t}'.`)}else{if(r==="sampler2D"){let d=`${t}Dimensions`;WIe(e,d)>0&&(i[d]={type:"ivec3",x:1,y:1},hne(e,d))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){let d=`uniform ${r} ${t};`;e.shaderSource=d+e.shaderSource}let l=`${t}_${e._count++}`;if(s=YE(e,t,l),s===1&&n)throw new L(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,r==="sampler2D")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(RIe(t));else if(r==="samplerCube")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(GIe(t));else if(r.indexOf("mat")!==-1){let d=new fne[r];e._uniforms[l]=function(){return fne[r].fromColumnMajorArray(e.uniforms[t],d)}}else e._uniforms[l]=function(){return e.uniforms[t]}}}function XIe(e){let t=e.type;if(!c(t)){let n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof Ge||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===Je.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 IIe(e){let t=e._strict,n=e._template.materials;for(let i in n)if(n.hasOwnProperty(i)){let o=new Je({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=St(e._un
in vec3 v_normalEC;
in 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;
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
}
`;var UQt=_(T(),1),zE=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in vec4 color;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
out 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 DQt=_(T(),1),Xx=`in vec4 v_color;
void main()
{
out_FragColor = czm_gammaCorrect(v_color);
}
`;var YQt=_(T(),1),KE=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec4 color;
in float batchId;
out vec4 v_color;
void main()
{
vec4 p = czm_computePosition();
v_color = color;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;function Wp(e){e=e??z.EMPTY_OBJECT;let t=e.translucent??!0,n=e.closed??!1,i=e.flat??!1,o=i?KE:zE,r=i?Xx:HE,s=i?Wp.FLAT_VERTEX_FORMAT:Wp.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??o,this._fragmentShaderSource=e.fragmentShaderSource??r,this._renderState=no.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=e.faceForward??!n}Object.defineProperties(Wp.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}}});Wp.VERTEX_FORMAT=We.POSITION_AND_NORMAL;Wp.FLAT_VERTEX_FORMAT=We.POSITION_ONLY;Wp.prototype.getFragmentShaderSource=no.prototype.getFragmentShaderSource;Wp.prototype.isTranslucent=no.prototype.isTranslucent;Wp.prototype.getRenderState=no.prototype.getRenderState;var an=Wp;var cjt=_(T(),1);function fC(e){this._definitionChanged=new ye,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(fC.prototype,{isConstant:{get:function(){return J.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color")});fC.prototype.getType=function(e){return"Color"};var wIe=new ee;fC.prototype.getValue=function(e,t){return c(e)||(e=ee.now(wIe)),c(t)||(t={}),t.color=J.getValueOrClonedDefault(this._color,e,Y.WHITE,t.color),t};fC.prototype.equals=function(e){return this===e||e instanceof fC&&J.equals(this._color,e._color)};var Ut=fC;var aqt=_(T(),1);var N6t=_(T(),1);var Wjt=_(T(),1);var gjt=_(T(),1);function K0(e){e=e??z.EMPTY_OBJECT,this._ellipsoid=e.ellipsoid??re.default,this._rectangle=e.rectangle??de.MAX_VALUE,this._projection=new Xi(this._ellipsoid),this._numberOfLevelZeroTilesX=e.numberOfLevelZeroTilesX??2,this._numberOfLevelZeroTilesY=e.numberOfLevelZeroTilesY??1}Object.defineProperties(K0.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});K0.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};K0.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};K0.prototype.rectangleToNativeRectangle=function(e,t){C.defined("rectangle",e);let n=w.toDegrees(e.west),i=w.toDegrees(e.south),o=w.toDegrees(e.east),r=w.toDegrees(e.north);return c(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new de(n,i,o,r)};K0.prototype.tileXYToNativeRectangle=function(e,t,n,i){let o=this.tileXYToRectangle(e,t,n,i);return o.west=w.toDegrees(o.west),o.south=w.toDegrees(o.south),o.east=w.toDegrees(o.east),o.north=w.toDegrees(o.north),o};K0.prototype.tileXYToRectangle=function(e,t,n,i){let o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,l=e*a+o.west,d=(e+1)*a+o.west,u=o.height/s,f=o.north-t*u,p=o.north-(t+1)*u;return c(i)||(i=new de(l,p,d,f)),i.west=l,i.south=p,i.east=d,i.north=f,i};K0.prototype.positionToTileXY=function(e,t,n){let i=this._rectangle;if(!de.contains(i,e))return;let o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=i.width/o,a=i.height/r,l=e.longitude;i.east<i.west&&(l+=w.TWO_PI);let d=(l-i.west)/s|0;d>=o&&(d=o-1);let u=(i.north-e.latitude)/a|0;return u>=r&&(u=r-1),c(n)?(n.x=d,n.y=u,n):new D(d,u)};var Ki=K0;var pne=new m,bne=new m,yne=new pe,AY=new m,PIe=new m,gne=new ue,vIe=new Ki,JE=[new pe,new pe,new pe,new pe],QE=new D,Vr={};Vr.initialize=function(){let e=Vr._initPromise;return c(e)||(e=Ge.fetchJson(on("Assets/approximateTerrainHeights.json")).then(function(t){Vr._terrainHeights=t}),Vr._initPromise=e),e};Vr.getMinimumMaximumHeights=function(e,t){if(C.defined("rectangle",e),!c(Vr._terrainHeights))throw new L("You must call ApproximateTerrainHeights.initialize an
in vec3 position3DLow;
in float batchId;
#ifdef EXTRUDED_GEOMETRY
in vec3 extrudeDirection;
uniform float u_globeMinimumAltitude;
#endif // EXTRUDED_GEOMETRY
#ifdef PER_INSTANCE_COLOR
out vec4 v_color;
#endif // PER_INSTANCE_COLOR
#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
out vec4 v_sphericalExtents;
#else // SPHERICAL
out vec2 v_inversePlaneExtents;
out vec4 v_westPlane;
out vec4 v_southPlane;
#endif // SPHERICAL
out vec3 v_uvMinAndSphericalLongitudeRotation;
out vec3 v_uMaxAndInverseDistance;
out 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 R4t=_(T(),1),Q0=`#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
void main(void)
{
#ifdef VECTOR_TILE
out_FragColor = czm_gammaCorrect(u_highlightColor);
#else
out_FragColor = vec4(1.0);
#endif
czm_writeDepthClamp();
}
`;var E4t=_(T(),1),Xne={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};Xne.NUMBER_OF_CLASSIFICATION_TYPES=3;var Un=Object.freeze(Xne);var W4t=_(T(),1);var ZWe={NEVER:oe.NEVER,LESS:oe.LESS,EQUAL:oe.EQUAL,LESS_OR_EQUAL:oe.LEQUAL,GREATER:oe.GREATER,NOT_EQUAL:oe.NOTEQUAL,GREATER_OR_EQUAL:oe.GEQUAL,ALWAYS:oe.ALWAYS},lc=Object.freeze(ZWe);var f7t=_(T(),1);var F4t=_(T(),1);function RWe(e,t){if(!c(e))throw new L("array is required.");if(!c(t)||t<1)throw new L("numberOfArrays must be greater than 0.");let n=[],i=e.length,o=0;for(;o<i;){let r=Math.ceil((i-o)/t--);n.push(e.slice(o,o+r)),o+=r}return n}var qE=RWe;var j4t=_(T(),1);function wp(e,t,n){if(!c(e))throw new L("context is required");if(!c(t))throw new L("attributes is required");if(!c(n))throw new L("numberOfInstances is required");if(this._attributes=t,this._numberOfInstances=n,t.length===0)return;let i=GWe(t),o=e.floatingPointTexture,r=i===Ue.FLOAT&&!o,s=EWe(t,r),a=XWe(s,t,r),l=Math.floor(mt.maximumTextureSize/a),d=Math.min(n,l),u=a*d,f=Math.ceil(n/d),p=1/u,y=p*.5,h=1/f,g=h*.5;this._textureDimensions=new D(u,f),this._textureStep=new ce(p,y,h,g),this._pixelDatatype=r?Ue.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;let x=4*u*f;this._batchValues=i===Ue.FLOAT&&!r?new Float32Array(x):new Uint8Array(x),this._batchValuesDirty=!1}Object.defineProperties(wp.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function GWe(e){let t=!1,n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==q.UNSIGNED_BYTE){t=!0;break}return t?Ue.FLOAT:Ue.UNSIGNED_BYTE}function Wne(e,t){let n=e[t].componentsPerAttribute;return n===2?D:n===3?m:n===4?ce:Number}function EWe(e,t){let n=new Array(e.length),i=0,o=e.length;for(let r=0;r<o;++r){let a=e[r].componentDatatype;n[r]=i,a!==q.UNSIGNED_BYTE&&t?i+=4:++i}return n}function XWe(e,t,n){let i=e.length,o=e[i-1];return t[i-1].componentDatatype!==q.UNSIGNED_BYTE&&n?o+4:o+1}var $E=new ce;function IWe(e,t,n){let i=ce.unpack(e,t,$E),o=ce.unpackFloat(i);i=ce.unpack(e,t+4,$E);let r=ce.unpackFloat(i);i=ce.unpack(e,t+8,$E);let s=ce.unpackFloat(i);i=ce.unpack(e,t+12,$E);let a=ce.unpackFloat(i);return ce.fromElements(o,r,s,a,n)}function WWe(e,t,n){let i=ce.packFloat(e.x,$E);ce.pack(i,t,n),i=ce.packFloat(e.y,i),ce.pack(i,t,n+4),i=ce.packFloat(e.z,i),ce.pack(i,t,n+8),i=ce.packFloat(e.w,i),ce.pack(i,t,n+12)}var Ine=new ce;wp.prototype.getBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new L("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new L("attributeIndex is out of range");let i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o,a;this._packFloats&&i[t].componentDatatype!==Ue.UNSIGNED_BYTE?a=IWe(this._batchValues,s,Ine):a=ce.unpack(this._batchValues,s,Ine);let l=Wne(i,t);return c(l.fromCartesian4)?l.fromCartesian4(a,n):c(l.clone)?l.clone(a,n):a.x};var wWe=[void 0,void 0,new D,new m,new ce],PWe=new ce;wp.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new L("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new L("attributeIndex is out of range");if(!c(n))throw new L("value is required.");let i=this._attributes,o=wWe[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=Wne(this._attributes,t);if(c(s.equals)?s.equals(r,n):r===n)return;let l=PWe;l.x=c(n.x)?n.x:n,l.y=c(n.y)?n.y:0,l.z=c(n.z)?n.z:0,l.w=c(n.w)?n.w:0;let d=this._offsets[t],f=4*this._stride*e+4*d;this._packFloats&&i[t].componentDatatype!==Ue.UNSIGNED_BYTE?WWe(l,this._batchValues,f):ce.pack(l,this._batchValues,f),this._batchValuesDirty=!0};function vWe(e,t){let n=e._textureDimensions;e._texture=new Pt({context:t,pixelFormat:ke.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:en.NEAREST,flipY:!1})}function FWe(e){let t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}wp.prototype.update=function(e){c(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!
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 MWe(e){return e===1?"float":`vec${e}`}function NWe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function kWe(e,t){let i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=MWe(o),a=NWe(o),l=e._offsets[t],d=`${s} ${r}(float batchId)
{
vec2 st = computeSt(batchId);
st.x += batchTextureStep.x * float(${l});
`;return e._packFloats&&i.componentDatatype!==Ue.UNSIGNED_BYTE?d+=`vec4 textureValue;
textureValue.x = czm_unpackFloat(texture(batchTexture, st));
textureValue.y = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x, 0.0)));
textureValue.z = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0)));
textureValue.w = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0)));
`:d+=` vec4 textureValue = texture(batchTexture, st);
`,d+=` ${s} value = textureValue${a};
`,e._pixelDatatype===Ue.UNSIGNED_BYTE&&i.componentDatatype===q.UNSIGNED_BYTE&&!i.normalize?d+=`value *= 255.0;
`:e._pixelDatatype===Ue.FLOAT&&i.componentDatatype===q.UNSIGNED_BYTE&&i.normalize&&(d+=`value /= 255.0;
`),d+=` return value;
}
`,d}wp.prototype.getVertexShaderCallback=function(){let e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
`;t+=`${AWe(this)}
`;let n=e.length;for(let i=0;i<n;++i)t+=kWe(this,i);return function(i){let o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
${t}
${s}`}};wp.prototype.isDestroyed=function(){return!1};wp.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),he(this)};var Ix=wp;var T8t=_(T(),1);var r8t=_(T(),1);function El(e){this._ellipsoid=e??re.WGS84,this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(El.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});El.mercatorAngleToGeodeticLatitude=function(e){return w.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};El.geodeticLatitudeToMercatorAngle=function(e){e>El.MaximumLatitude?e=El.MaximumLatitude:e<-El.MaximumLatitude&&(e=-El.MaximumLatitude);let t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};El.MaximumLatitude=El.mercatorAngleToGeodeticLatitude(Math.PI);El.prototype.project=function(e,t){let n=this._semimajorAxis,i=e.longitude*n,o=El.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return c(t)?(t.x=i,t.y=o,t.z=r,t):new m(i,o,r)};El.prototype.unproject=function(e,t){if(!c(e))throw new L("cartesian is required");let n=this._oneOverSemimajorAxis,i=e.x*n,o=El.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return c(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new pe(i,o,r)};var Wi=El;function UWe(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(!M.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)c(e[r].geometry)&&An.transformToWorldCoordinates(e[r]);else M.multiplyTransformation(t,e[0].modelMatrix,t)}function NY(e,t){let n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new Ee({componentDatatype:q.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});let r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function OWe(e){let t=e.length;for(let n=0;n<t;++n){let i=e[n];c(i.geometry)?NY(i.geometry,n):c(i.westHemisphereGeometry)&&c(i.eastHemisphereGeometry)&&(NY(i.westHemisphereGeometry,n),NY(i.eastHemisphereGeometry,n))}}function DWe(e){let t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix,l,d,u,f=t.length;for(l=0;l<f;++l)if(c(t[l].geometry)){u=t[l].geometry.primitiveType;break}for(l=1;l<f;++l)if(c(t[l].geometry)&&t[l].geometry.primitiveType!==u)throw new L("All instance geometries must have the same primitiveType.");if(UWe(t,a,o),!o)for(l=0;l<f;++l)c(t[l].geometry)&&An.splitLongitude(t[l]);if(OWe(t),r)for(l=0;l<f;++l){let y=t[l];c(y.geometry)?(An.reorderForPostVertexCache(y.geometry),An.reorderForPreVertexCache(y.geometry)):c(y.westHemisphereGeometry)&&c(y.eastHemisphereGeometry)&&(An.reorderForPostVertexCache(y.westHemisphereGeometry),An.reorderForPreVertexCache(y.westHemisphereGeometry),An.reorderForPostVertexCache(y.eastHemisphereGeometry),An.reorderForPreVertexCache(y.eastHemisphereGeometry))}let p=An.combineInstances(t);for(f=p.length,l=0;l<f;++l){d=p[l];let y=d.attributes;if(o)for(let h in y)y.hasOwnProperty(h)&&y[h].componentDatatype===q.DOUBLE&&An.encodeAttribute(d,h,`${h}3DHigh`,`${h}3DLow`);else for(let h in y)if(y.hasOwnProperty(h)&&y[h].componentDatatype===q.DOUBLE){let g=`${h}3D`,x=`${h}2D`;An.projectTo2D(d,h,g,x,n),c(d.boundingSphere)&&h==="position"&&(d.boundingSphereCV=ue.fromVertices(d.attributes.position2D.values)),An.encodeAttribute(d,g,`${g}High`,`${g}Low`),An.encodeAttribute(d,x,`${x}High`,`${x}Low`)}s&&An.compressVertices(d)}if(!i){let y=[];for(f=p.length,l=0;l<f;++l)d=p[l],y=y.concat(An.fitToUnsignedShortIndices(d));p=y}return p}function kY(e,t,n,i){let o,r,s,a=i.length-1;if(a>=0){let d=i[a];o=d.offset+d.count,s=d.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;let l=e.length;for(let d=0;d<l;++d){let f=e[d][t];if(!c(f))continue;let p=f.indices.length;o+p>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:p}),o+=p}}function BWe(e,t){let n=[];return kY(e,"geometry",t,n),kY(e,"westHemisphereGeometry",t,n),kY(e,"eastHemisphereGeometry",t,n),n}var Pp={};Pp.combineGeometry=function(e){let t,n,i=e.instances,o=i.length,r,s,a=!1;o>0&&(t=DWe(e),t.length>0&&(n=An.createAttributeLocations(t[0]),e.createPickOf
`),c(e.rtcCenter)?(t=t.replace(/in\s+vec(?:3|4)\s+position3DHigh;/g,""),t=t.replace(/in\s+vec(?:3|4)\s+position3DLow;/g,""),o+=`uniform mat4 u_modifiedModelView;
`,r+=`in vec4 position;
`,s+=`${l}
{
return u_modifiedModelView * position;
}
`,t=t.replace(/czm_modelViewRelativeToEye\s+\*\s+/g,""),t=t.replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?s+=`${l}
{
return czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
}
`:(r+=`in vec3 ${a}2DHigh;
in vec3 ${a}2DLow;
`,s+=`${l}
{
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(`
`)};Rr._appendShowToShader=function(e,t){return c(e._batchTableAttributeIndices.show)?`${Be.replaceMain(t,"czm_non_show_main")}
void main()
{
czm_non_show_main();
gl_Position *= czm_batchTable_show(batchId);
}`:t};Rr._updateColorAttribute=function(e,t,n){if(!c(e._batchTableAttributeIndices.color)&&!c(e._batchTableAttributeIndices.depthFailColor)||t.search(/in\s+vec4\s+color;/g)===-1)return t;if(n&&!c(e._batchTableAttributeIndices.depthFailColor))throw new L("A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute.");let i=t;return i=i.replace(/in\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 vne(e){return`${Be.replaceMain(e,"czm_non_pick_main")}
out vec4 v_pickColor;
void main()
{
czm_non_pick_main();
v_pickColor = czm_batchTable_pickColor(batchId);
}`}function Fne(e){return`in vec4 v_pickColor;
${e}`}Rr._updatePickColorAttribute=function(e){let t=e.replace(/in\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t};Rr._appendOffsetToShader=function(e,t){if(!c(e._batchTableAttributeIndices.offset))return t;let n=`in float batchId;
`;n+="in float applyOffset;";let i=t.replace(/in\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};Rr._appendDistanceDisplayConditionToShader=function(e,t,n){if(!c(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let i=Be.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 Ane(e,t){if(!e.compressVertices)return t;let n=t.search(/in\s+vec3\s+normal;/g)!==-1,i=t.search(/in\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;let o=t.search(/in\s+vec3\s+tangent;/g)!==-1,r=t.search(/in\s+vec3\s+bitangent;/g)!==-1,s=i&&n?2:1;s+=o||r?1:0;let a=s>1?`vec${s}`:"float",l="compressedAttributes",d=`in ${a} ${l};`,u="",f="";if(i){u+=`vec2 st;
`;let h=s>1?`${l}.x`:l;f+=` st = czm_decompressTextureCoordinates(${h});
`}n&&o&&r?(u+=`vec3 normal;
vec3 tangent;
vec3 bitangent;
`,f+=` czm_octDecode(${l}.${i?"yz":"xy"}, normal, tangent, bitangent);
`):(n&&(u+=`vec3 normal;
`,f+=` normal = czm_octDecode(${l}${s>1?`.${i?"y":"x"}`:""});
`),o&&(u+=`vec3 tangent;
`,f+=` tangent = czm_octDecode(${l}.${i&&n?"z":"y"});
`),r&&(u+=`vec3 bitangent;
`,f+=` bitangent = czm_octDecode(${l}.${i&&n?"z":"y"});
`));let p=t;p=p.replace(/in\s+vec3\s+normal;/g,""),p=p.replace(/in\s+vec2\s+st;/g,""),p=p.replace(/in\s+vec3\s+tangent;/g,""),p=p.replace(/in\s+vec3\s+bitangent;/g,""),p=Be.replaceMain(p,"czm_non_compressed_main");let y=`void main()
{
${f} czm_non_compressed_main();
}`;return[d,u,p,y].join(`
`)}function rwe(e){let t=Be.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
czm_non_depth_clamp_main();
gl_Position = czm_depthClamp(gl_Position);}
`,t}function swe(e){let t=Be.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
czm_non_depth_clamp_main();
#if defined(LOG_DEPTH)
czm_writeLogDepth();
#else
czm_writeDepthClamp();
#endif
}
`,t}function Mne(e,t){let n=e.vertexAttributes;for(let i in n)if(n.hasOwnProperty(i)&&!c(t[i]))throw new L(`Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`)}function awe(e,t){return function(){return e[t]}}var UY=Math.max(Ot.hardwareConcurrency-1,1),f5,cwe=new gi("combineGeometry");function lwe(e,t){let n,i,o,r,s=e._instanceIds;if(e._state===Zr.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let a=e._numberOfInstances=n.length,l=[],d=[];for(o=0;o<a;++o){if(i=n[o].geometry,s.push(n[o].id),c(i._workerName)&&c(i._workerPath)||!c(i._workerName)&&!c(i._workerPath))throw new L("Must define either _workerName or _workerPath for asynchronous geometry.");d.push({moduleName:i._workerName,modulePath:i._workerPath,geometry:i})}if(!c(f5))for(f5=new Array(UY),o=0;o<UY;o++)f5[o]=new gi("createGeometry");let u;for(d=qE(d,UY),o=0;o<d.length;o++){let f=0,p=d[o],y=p.length;for(r=0;r<y;++r)u=p[r],i=u.geometry,c(i.constructor.pack)&&(u.offset=f,f+=i.constructor.packedLength??i.packedLength);let h;if(f>0){let g=new Float64Array(f);for(h=[g.buffer],r=0;r<y;++r)u=p[r],i=u.geometry,c(i.constructor.pack)&&(i.constructor.pack(i,g,u.offset),u.geometry=g)}l.push(f5[o].scheduleTask({subTasks:d[o]},h))}e._state=Zr.CREATING,Promise.all(l).then(function(f){e._createGeometryResults=f,e._state=Zr.CREATED}).catch(function(f){tX(e,t,Zr.FAILED,f)})}else if(e._state===Zr.CREATED){let a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let l=t.scene3DOnly,d=t.mapProjection,u=cwe.scheduleTask(Wx.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:d.ellipsoid,projection:d,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},a),a);e._createGeometryResults=void 0,e._state=Zr.COMBINING,Promise.resolve(u).then(function(f){let p=Wx.unpackCombineGeometryResults(f);e._geometries=p.geometries,e._attributeLocations=p.attributeLocations,e.modelMatrix=M.clone(p.modelMatrix,e.modelMatrix),e._pickOffsets=p.pickOffsets,e._offsetInstanceExtend=p.offsetInstanceExtend,e._instanceBoundingSpheres=p.boundingSpheres,e._instanceBoundingSpheresCV=p.boundingSpheresCV,c(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Zr.COMBINED):tX(e,t,Zr.FAILED,void 0)}).catch(function(f){tX(e,t,Zr.FAILED,f)})}}function dwe(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,l=0;for(a=0;a<i;a++){s=n[a];let p=s.geometry,y;c(p.attributes)&&c(p.primitiveType)?y=nwe(p):y=p.constructor.createGeometry(p),o[l++]=iwe(s,y),r.push(s.id)}o.length=l;let d=t.scene3DOnly,u=t.mapProjection,f=Wx.combineGeometry({instances:o,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:d,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=f.geometries,e._attributeLocations=f.attributeLocations,e.modelMatrix=M.clone(f.modelMatrix,e.modelMatrix),e._pickOffsets=f.pickOffsets,e._offsetInstanceExtend=f.offsetInstanceExtend,e._instanceBoundingSpheres=f.boundingSpheres,e._instanceBoundingSpheresCV=f.boundingSpheresCV,c(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Zr.COMBINED):tX(e,t,Zr.FAILED,void 0)}function uwe(e,t){let n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!c(n)){e._recomputeBoundingSpheres=!1;return}let i,o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length,a=e._tempBoundingSpheres;if(!c(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new ue;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let g=a[i],x=e._batchTable.getBatchedAttribute(i,n,n
#ifdef SPHERICAL
in vec4 v_sphericalExtents;
#else // SPHERICAL
in vec2 v_inversePlaneExtents;
in vec4 v_westPlane;
in vec4 v_southPlane;
#endif // SPHERICAL
in vec3 v_uvMinAndSphericalLongitudeRotation;
in vec3 v_uMaxAndInverseDistance;
in vec3 v_vMaxAndInverseDistance;
#endif // TEXTURE_COORDINATES
#ifdef PER_INSTANCE_COLOR
in 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(texture(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
float downOrLeftLogDepth = czm_unpackDepth(texture(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(texture(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) {
out_FragColor.a = 1.0;
czm_writeDepthClamp();
}
#else // CULL_FRAGMENTS
out_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
out_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;
out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
#endif // FLAT
out_FragColor.rgb *= out_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
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else // FLAT
out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
#endif // FLAT
out_FragColor.rgb *= out_FragColor.a;
#endif // PER_INSTANCE_COLOR
czm_writeDepthClamp();
#endif // PICK
}
`;function Zu(e,t,n){C.typeOf.bool("extentsCulling",e),C.typeOf.bool("planarExtents",t),C.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};let i=new DY;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;let o=new DY;if(o.requiresTextureCoordinates=e,n instanceof an)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}Zu.prototype.createFragmentShader=function(e){C.typeOf.bool("columbusView2D",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 an&&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 an||(o=t.material.shaderSource),new Be({defines:i,sources:[o,hC]})};Zu.prototype.createPickFragmentShader=function(e){C.typeOf.bool("columbusView2D",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 Be({defines:n,sources:[hC],pickColorQualifier:"in"})};Zu.prototype.createVertexShader=function(e,t,n,i){return C.defined("defines",e),C.typeOf.string("vertexShaderSource",t),C.typeOf.bool("columbusView2D",n),C.defined("mapProjection",i),nie(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Zu.prototype.createPickVertexShader=function(e,t,n,i){return C.defined("defines",e),C.typeOf.string("vertexShaderSource",t),C.typeOf.bool("columbusView2D",n),C.defined("mapProjection",i),nie(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};var Jne=new m,Qne=new pe,jne={high:0,low:0};function nie(e,t,n,i,o,r,s,a){let l=i.slice();if(a.eastMostYhighDefine===""){let d=Qne;d.longitude=w.PI,d.latitude=0,d.height=0;let u=s.project(d,Jne),f=Bn.encode(u.x,jne);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${f.high.toFixed(`${f.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${f.low.toFixed(`${f.low}`.length+1)}`;let p=Qne;p.longitude=-w.PI,p.latitude=0,p.height=0;let y=s.project(p,Jne);f=Bn.encode(y.x,jne),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${f.high.toFixed(`${f.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${f.low.toFixed(`${f.low}`.length+1)}`}return n&&(l.push(a.eastMostYhighDefine),l.push(a.eastMostYlowDefine),l.push(a.westMostYhighDefine),l.push(a.westMostYlowDefine)),c(r)&&r instanceof an&&l.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(l.push("TEXTURE_COORDINATES"),t||n||l.push("SPHERICAL"),n&&l.push("COLUMBUS_VIEW_2D")),new Be({defines:l,sources:[o]})}function DY(){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(DY.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(
`,r=` extrudeDirection = czm_octDecode(${n}, 65535.0);
`,s=t;s=s.replace(/in\s+vec3\s+extrudeDirection;/g,""),s=Be.replaceMain(s,"czm_non_compressed_main");let a=`void main()
{
${r} czm_non_compressed_main();
}`;return[i,o,s,a].join(`
`)}}function Ywe(e,t){let n=t.context,i=e._primitive,o=jE;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=In._appendDistanceDisplayConditionToShader(i,o),o=In._modifyShaderPosition(e,o,t.scene3DOnly),o=In._updateColorAttribute(i,o);let r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=Bwe(i,o));let a=e._extruded?"EXTRUDED_GEOMETRY":"",l=new Be({defines:[a],sources:[o]}),d=new Be({sources:[Q0]}),u=e._primitive._attributeLocations,f=new pd(s,r,e.appearance);if(e._spStencil=tn.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:l,fragmentShaderSource:d,attributeLocations:u}),e._primitive.allowPicking){let h=Be.createPickVertexShaderSource(o);h=In._appendShowToShader(i,h),h=In._updatePickColorAttribute(h);let g=f.createPickFragmentShader(!1),x=f.createPickVertexShader([a],h,!1,t.mapProjection);if(e._spPick=tn.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:x,fragmentShaderSource:g,attributeLocations:u}),s){let S=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!c(S)){let V=f.createPickFragmentShader(!0),Z=f.createPickVertexShader([a],h,!0,t.mapProjection);S=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:Z,fragmentShaderSource:V,attributeLocations:u})}e._spPick2D=S}}else e._spPick=tn.fromCache({context:n,vertexShaderSource:l,fragmentShaderSource:d,attributeLocations:u});o=In._appendShowToShader(i,o),l=new Be({defines:[a],sources:[o]}),e._sp=tn.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:l,fragmentShaderSource:d,attributeLocations:u});let p=f.createFragmentShader(!1),y=f.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=tn.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:y,fragmentShaderSource:p,attributeLocations:u}),s){let h=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!c(h)){let g=f.createFragmentShader(!0),x=f.createVertexShader([a],o,!0,t.mapProjection);h=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:x,fragmentShaderSource:g,attributeLocations:u})}e._spColor2D=h}}function Hwe(e,t){let n=e._primitive,i=n._va.length*2;t.length=i;let o,r,s,a=0,l=n._batchTable.getUniformMapCallback()(e._uniformMap),d=e._needs2DShader;for(o=0;o<i;o+=2){let y=n._va[a++];r=t[o],c(r)||(r=t[o]=new et({owner:e,primitiveType:n._primitiveType})),r.vertexArray=y,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=l,r.pass=Xe.TERRAIN_CLASSIFICATION,s=et.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=Xe.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],c(r)||(r=t[o+1]=new et({owner:e,primitiveType:n._primitiveType})),r.vertexArray=y,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Xe.TERRAIN_CLASSIFICATION;let g=e.appearance.material;if(c(g)&&(l=St(l,g._uniforms)),r.uniformMap=l,s=et.shallowClone(r,r.derivedCommands.tileset),s.pass=Xe.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,d){let x=et.shallowClone(r,r.derivedCommands.appearance2D);x.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=x,x=et.shallowClone(s,s.derivedCommands.appearance2D),x.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=x}}let u=e._commandsIgnoreShow,f=e._spStencil,p=0;i=u.length=i/2;for(let y=0;y<i;++y){let h=u[y]=et.shallowClone(t[p],u[y]);h.shaderProgram=f,h.pass=Xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,p+=2}}function zwe(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 l,d,u,f=0,p=i._batchTable.getUniformMapCallback()(e._uniformMap),y=e._needs2DShader;for(l=0;l<o;l+=2){let h=i._va[f++];if(n&&(a=r[s++],h=i._va[a.index]),d=t[l],c(d)||(d=t[l]=new et({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),d.vertexArray=h,d.renderState=e._rsStencilDepthPass,d.shaderProgram=e._sp,d.uniformMap=p,d.pass=Xe.TERRAIN_CLASSIFICATION,n&&(d.offset=a.offset,d.count=a.count),u=et.shallowClone(d,d.derivedCommands.tileset),u.renderState=e._rsStencilDepthPass3DTiles,u.pass=Xe.CE
in vec4 v_endPlaneNormalEcAndBatchId;
in vec4 v_rightPlaneEC;
in vec4 v_endEcAndStartEcX;
in vec4 v_texcoordNormalizationAndStartEcYZ;
#ifdef PER_INSTANCE_COLOR
in vec4 v_color;
#endif
void main(void)
{
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(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
out_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
out_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
out_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);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#endif // PER_INSTANCE_COLOR
out_FragColor.rgb *= out_FragColor.a;
czm_writeDepthClamp();
}
`;var h$t=_(T(),1),sX=`in vec3 v_forwardDirectionEC;
in vec3 v_texcoordNormalizationAndHalfWidth;
in float v_batchId;
#ifdef PER_INSTANCE_COLOR
in vec4 v_color;
#else
in vec2 v_alignedPlaneDistances;
in 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
out_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);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#endif // PER_INSTANCE_COLOR
}
`;var b$t=_(T(),1),aX=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec4 startHiAndForwardOffsetX;
in vec4 startLoAndForwardOffsetY;
in vec4 startNormalAndForwardOffsetZ;
in vec4 endNormalAndTextureCoordinateNormalizationX;
in vec4 rightNormalAndTextureCoordinateNormalizationY;
in vec4 startHiLo2D;
in vec4 offsetAndRight2D;
in vec4 startEndNormals2D;
in vec2 texcoordNormalization2D;
in float batchId;
out vec3 v_forwardDirectionEC;
out vec3 v_texcoordNormalizationAndHalfWidth;
out float v_batchId;
#ifdef WIDTH_VARYING
out float v_width;
#endif
#ifdef ANGLE_VARYING
out float v_polylineAngle;
#endif
#ifdef PER_INSTANCE_COLOR
out vec4 v_color;
#else
out vec2 v_alignedPlaneDistances;
out 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 g$t=_(T(),1),cX=`in vec3 position3DHigh;
in vec3 position3DLow;
#ifndef COLUMBUS_VIEW_2D
in vec4 startHiAndForwardOffsetX;
in vec4 startLoAndForwardOffsetY;
in vec4 startNormalAndForwardOffsetZ;
in vec4 endNormalAndTextureCoordinateNormalizationX;
in vec4 rightNormalAndTextureCoordinateNormalizationY;
#else
in vec4 startHiLo2D;
in vec4 offsetAndRight2D;
in vec4 startEndNormals2D;
in vec2 texcoordNormalization2D;
#endif
in float batchId;
out vec4 v_startPlaneNormalEcAndHalfWidth;
out vec4 v_endPlaneNormalEcAndBatchId;
out vec4 v_rightPlaneEC;
out vec4 v_endEcAndStartEcX;
out vec4 v_texcoordNormalizationAndStartEcYZ;
#ifdef WIDTH_VARYING
out float v_width;
#endif
#ifdef ANGLE_VARYING
out float v_polylineAngle;
#endif
#ifdef PER_INSTANCE_COLOR
out 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 I$t=_(T(),1);var _$t=_(T(),1),lX=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 prevPosition3DHigh;
in vec3 prevPosition3DLow;
in vec3 nextPosition3DHigh;
in vec3 nextPosition3DLow;
in vec2 expandAndWidth;
in vec4 color;
in float batchId;
out 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 S$t=_(T(),1),bd=`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 rH=`${bd}
${lX}`,r2e=Xx;Ot.isInternetExplorer()||(rH=`#define CLIP_POLYLINE
${rH}`);function Fx(e){e=e??z.EMPTY_OBJECT;let t=e.translucent??!0,n=!1,i=Fx.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??rH,this._fragmentShaderSource=e.fragmentShaderSource??r2e,this._renderState=no.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Fx.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}}});Fx.VERTEX_FORMAT=We.POSITION_ONLY;Fx.prototype.getFragmentShaderSource=no.prototype.getFragmentShaderSource;Fx.prototype.isTranslucent=no.prototype.isTranslucent;Fx.prototype.getRenderState=no.prototype.getRenderState;var es=Fx;var H$t=_(T(),1);var w$t=_(T(),1),dX=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 prevPosition3DHigh;
in vec3 prevPosition3DLow;
in vec3 nextPosition3DHigh;
in vec3 nextPosition3DLow;
in vec2 expandAndWidth;
in vec2 st;
in float batchId;
out float v_width;
out vec2 v_st;
out 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 v$t=_(T(),1),Ax=`#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
in 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);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#ifdef VECTOR_TILE
out_FragColor *= u_highlightColor;
#endif
czm_writeLogDepth();
}
`;var sH=`${bd}
${dX}`,s2e=Ax;Ot.isInternetExplorer()||(sH=`#define CLIP_POLYLINE
${sH}`);function Mx(e){e=e??z.EMPTY_OBJECT;let t=e.translucent??!0,n=!1,i=Mx.VERTEX_FORMAT;this.material=c(e.material)?e.material:zi.fromType(zi.ColorType),this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??sH,this._fragmentShaderSource=e.fragmentShaderSource??s2e,this._renderState=no.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Mx.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/in\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}}});Mx.VERTEX_FORMAT=We.POSITION_AND_ST;Mx.prototype.getFragmentShaderSource=no.prototype.getFragmentShaderSource;Mx.prototype.isTranslucent=no.prototype.isTranslucent;Mx.prototype.getRenderState=no.prototype.getRenderState;var ua=Mx;function Np(e){e=e??z.EMPTY_OBJECT,this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;c(t)||(t=new ua),this.appearance=t,this.show=e.show??!0,this.classificationType=e.classificationType??Un.BOTH,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this._debugShowShadowVolume=e.debugShowShadowVolume??!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:e.interleave??!1,releaseGeometryInstances:e.releaseGeometryInstances??!0,allowPicking:e.allowPicking??!0,asynchronous:e.asynchronous??!0,compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=Bie(!1),this._renderState3DTiles=Bie(!0),this._renderStateMorph=Oe.fromCache({cull:{enabled:!0,face:_i.FRONT},depthTest:{enabled:!0},blending:un.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(Np.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}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});Np.initializeTerrainHeights=function(){return ui.initialize()};function a2e(e,t,n){let i=t.context,o=e._primitive,r=o._attributeLocations,s=o._batchTable.getVertexShaderCallback()(cX);s=In._appendShowToShader(o,s),s=In._appendDistanceDisplayConditionToShader(o,s),s=In._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(aX);a=In._appendShowToShader(o,a),a=In._appendDistanceDisplayConditionToShader(o,a),a=In._modifyShaderPosition(e,a,t.scene3DOnly);let l=o._batchTable.getVertexShaderCallback()(rX),d=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`],u="",f="";c(n.material)?(f=c(n.material)?n.material.shaderSource:"",f.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&d.push("ANGLE_VARYING"),f.search(/in\s+float\s+v_width;/g)!==-1&&d.push("WIDTH_VARYING")):u="PER_INSTANCE_COLOR",d.push(u);let p=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",u]:[u],y=new Be({defines:d,sources:[s]}),h=new Be({defines:p,sources:[f,l]});e._sp=tn.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:y,fragmentShaderSource:h,attributeLocations:r});let g=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!c(g)){let S=new Be({defines:d.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});g=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:S,fragmentShaderSource:h,attributeLocations:r})}e._sp2D=g;let x=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!c(x)){let S=new Be({defines:d.concat([`MAX_TERRAIN_HEIGHT ${ui._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});l=o._batchTable.getVertexShaderCallback()(sX);let V=new Be({defines:p,sources:[f,l]});x=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:S,fragmentShaderSource:V,attributeLocations:r})}e._spMorph=x}function Bie(e){return Oe.fromCache({cull:{enabled:!0},blending:un.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:On.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:On.EQUAL,backOperation:{fa
`+Tl),Ie&&T5([G,X,W],$f=>{Tl=WX(Tl,$f," ")}),R&&qe?R.createHTML(Tl):Tl},t.setConfig=function(){let dn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xl(dn),Ke=!0},t.clearConfig=function(){bi=null,Ke=!1},t.isValidAttribute=function(dn,Re,It){bi||xl({});let gn=Li(dn),xr=Li(Re);return uu(gn,xr,It)},t.addHook=function(dn,Re){typeof Re=="function"&&IX(b[dn],Re)},t.removeHook=function(dn){return ioe(b[dn])},t.removeHooks=function(dn){b[dn]=[]},t.removeAllHooks=function(){b=doe()},t}var boe=poe();var hve=0,yH={};function hh(e,t){C.typeOf.string("html",e);let n,i=e;c(yH[i])?n=yH[i]:(n=hve++,yH[i]=n),t=t??!1,this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(hh.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen},set:function(e){this._showOnScreen=e}},element:{get:function(){if(!c(this._element)){let e=boe.sanitize(this._html),t=document.createElement("div");t.className="cesium-credit-wrapper",t._creditId=this._id,t.style.display="inline",t.innerHTML=e;let n=t.querySelectorAll("a");for(let i=0;i<n.length;i++)n[i].setAttribute("target","_blank");this._element=t}return this._element}}});hh.equals=function(e,t){return e===t||c(e)&&c(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};hh.prototype.equals=function(e){return hh.equals(this,e)};hh.prototype.isIon=function(){return this.html.indexOf("ion-credit.png")!==-1};hh.getIonCredit=function(e){let t=c(e.collapsible)&&!e.collapsible;return new hh(e.html,t)};hh.clone=function(e){if(c(e))return new hh(e.html,e.showOnScreen)};var Ct=hh;var xsn=_(T(),1);function pve(e,t){if(!c(e)||!c(t))throw new L("identifier and message are required.");ht(e,t)}var Cs=pve;var Nsn=_(T(),1);var Xsn=_(T(),1);function qx(e){this._url=e,this._cubeMapBuffers=void 0,this._texture=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._errorEvent=new ye}Object.defineProperties(qx.prototype,{url:{get:function(){return this._url}},errorEvent:{get:function(){return this._errorEvent}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}}});qx.isSupported=function(e){return(e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat)&&e.supportsTextureLod};function gH(e){e._cubeMapBuffers=void 0}qx.prototype.update=function(e){let{context:t}=e;if(!qx.isSupported(t))return;if(c(this._texture)){gH(this);return}if(!c(this._texture)&&!this._loading){let u=t.textureCache.getTexture(this._url);c(u)&&(gH(this),this._texture=u,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0)}let n=this._cubeMapBuffers;if(!c(n)&&!this._loading){let u=this;Ll(this._url).then(function(f){u._cubeMapBuffers=f,u._loading=!1}).catch(function(f){u.isDestroyed()||u._errorEvent.raiseEvent(f)}),this._loading=!0}if(!c(this._cubeMapBuffers))return;let{pixelDatatype:i}=n[0].positiveX;c(i)||(i=t.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT);let o=ke.RGBA,r=n.length;this._maximumMipmapLevel=r-1;let s=n[0].positiveX.width,a=Math.log2(s)+1;if(r!==a){let u={};Object.values(Uo.FaceName).forEach(f=>{u[f]=void 0});for(let f=r;f<a;f++)n.push(u)}let l=new en({minificationFilter:Jt.LINEAR_MIPMAP_LINEAR}),d=new Uo({context:t,source:n[0],flipY:!1,pixelDatatype:i,pixelFormat:o,sampler:l});d.loadMipmaps(n.slice(1)),this._texture=d,this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture),this._ready=!0};qx.prototype.isDestroyed=function(){return!1};qx.prototype.destroy=function(){return gH(this),this._texture=this._texture&&this._texture.destroy(),he(this)};var Bm=qx;function FX(e){e=e??z.EMPTY_OBJECT;let t=c(e.imageBasedLightingFactor)?D.clone(e.imageBasedLightingFactor):new D(1,1);C.typeOf.object("options.imageBasedLightingFactor",t),C.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),C.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1)
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));
}
`}_o.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;let i=this;return function(o){let r=Zoe(o,n,!1),s;return mt.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand;
`),s+=`uniform sampler2D tile_batchTexture;
out vec4 tile_featureColor;
out vec2 tile_featureSt;
void main()
{
vec2 st = computeSt(${t});
vec4 featureProperties = texture(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=`out vec2 tile_featureSt;
void main()
{
tile_color(vec4(1.0));
tile_featureSt = computeSt(${t});
}`,`${r}
${Hve(i)}${s}`}};function Voe(e,t){return e=Be.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend;
void tile_color(vec4 tile_featureColor)
{
tile_main();
tile_featureColor = czm_gammaCorrect(tile_featureColor);
out_FragColor.a *= tile_featureColor.a;
float highlight = ceil(tile_colorBlend);
out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
}
`:`${e}void tile_color(vec4 tile_featureColor)
{
tile_main();
}
`}function zve(e,t){let n=`texture(${t}`,i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let d=o;d<e.length;++d){let u=e.charAt(d);if(u==="(")++s;else if(u===")"&&(--s,s===0)){r=d+1;break}}let l=`tile_diffuse_final(${e.slice(o,r)}, tile_diffuse)`;e=e.slice(0,o)+l+e.slice(r),i=o+l.length,o=e.indexOf(n,i)}return e}function Zoe(e,t,n){if(!c(t))return Voe(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`),o=e.match(i);if(!c(o))return Voe(e,n);let r=o[0],s=o[2];e=Be.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);
}
`,l=` tile_featureColor = czm_gammaCorrect(tile_featureColor);
out_FragColor.a *= tile_featureColor.a;
float highlight = ceil(tile_colorBlend);
out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
`,d;if(s==="vec3"||s==="vec4"){let u=s==="vec3"?`vec4(${t}, 1.0)`:t,f=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,f),d=` vec4 source = ${u};
tile_diffuse = tile_diffuse_final(source, tile_featureColor);
tile_main();
`}else s==="sampler2D"&&(e=zve(e,t),d=` 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)
{
${d}`,n&&(e+=l),e+=`}
`,e}_o.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=Zoe(i,t,!0),mt.maximumVertexTextureImageUnits>0?(i+=`uniform sampler2D tile_pickTexture;
in vec2 tile_featureSt;
in vec4 tile_featureColor;
void main()
{
tile_color(tile_featureColor);
`,n&&(i+=` out_FragColor.rgb *= out_FragColor.a;
`),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand;
`),i+=`uniform sampler2D tile_pickTexture;
uniform sampler2D tile_batchTexture;
in vec2 tile_featureSt;
void main()
{
vec4 featureProperties = texture(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+=` out_FragColor.rgb *= out_FragColor.a;
`),i+=`}
`),i}};function Kve(e){let t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===Wl.HIGHLIGHT)return 0;if(n===Wl.REPLACE)return 1;if(n===Wl.MIX)return w.clamp(i,w.EPSILON4,1);throw new L(`Invalid color blend mode "${n}".`)}_o.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;let e=this;return function(t){return St(t,{tile_batchTexture:function(){return e._batchTexture.batchTexture??e._batchTexture.defaultTexture},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return Kve(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};_o.prototype.getPickId=function(){return"texture(tile_pickTexture, tile_featureSt)"};var ny={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};_o.prototype.addDerivedCommands=function(e,t){let n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s.isSkippingLevelOfDetail&&s.hasMixedContent&&e.context.stencilBuffer,l=Jve(this);for(let d=t;d<i;++d){let u=n[d];if(u.pass===Xe.COMPUTE)continue;let f=u.derivedCommands.tileset;(!c(f)||u.dirty)&&(f={},u.derivedCommands.tileset=f,f.originalCommand=Qve(u),u.dirty=!1);let p=f.originalCommand;l!==ny.ALL_OPAQUE&&u.pass!==Xe.TRANSLUCENT&&(c(f.translucent)||(f.translucent=jve(p))),l!==ny.ALL_TRANSLUCENT&&u.pass!==Xe.TRANSLUCENT&&(c(f.opaque)||(f.opaque=qve(p)),a&&(r||(c(f.zback)||(f.zback=eFe(e.context,p)),s._backfaceCommands.push(f.zback)),(!c(f.stencil)||o._selectionDepth!==nFe(f.stencil))&&(u.renderState.depthMask?f.stencil=tFe(p,o._selectionDepth):f.stencil=f.opaque)));let y=a?f.stencil:f.opaque,h=f.translucent;u.pass!==Xe.TRANSLUCENT?(l===ny.ALL_OPAQUE&&(n[d]=y),l===ny.ALL_TRANSLUCENT&&(n[d]=h),l===ny.OPAQUE_AND_TRANSLUCENT&&(n[d]=y,n.push(h))):n[d]=p}};function Jve(e){let t=e._batchTexture.translucentFeaturesLength;return t===0?ny.ALL_OPAQUE:t===e.featuresLength?ny.ALL_TRANSLUCENT:ny.OPAQUE_AND_TRANSLUCENT}function Qve(e){let t=et.shallowClone(e),n=t.pass===Xe.TRANSLUCENT;return t.uniformMap=c(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function jve(e){let t=et.shallowClone(e);return t.pass=Xe.TRANSLUCENT,t.renderState=iFe(e.renderState),t}function qve(e){let t=et.shallowClone(e);return t.renderState=oFe(e.renderState),t}function $ve(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!c(n)){let i=t.fragmentShaderSource.clone();i.defines=c(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function eFe(e,t){let n=et.shallowClone(t),i=He(n.renderState,!0);i.cull.enabled=!0,i.cull.face=_i.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=kt.setCesium3DTileBit(),i.stencilMask=kt.CESIUM_3D_TILE_MASK,n.renderState=Oe.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=He(t.uniformMap);let o=new D(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=$ve(e,t.shaderProgram),n}function tFe(e,t){let n=et.shallowClone(e),i=He(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=kt.SKIP_LOD_MASK,i.stencilTest.reference=kt.CESIUM_3D_TILE_MASK|t<<kt.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=On.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=ft.REPLACE,i.stencilTest.backFunction=On.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=ft.REPLACE,i.stencilMask=kt.CESIUM_3D_TILE_MASK|kt.SKIP_LOD_MASK,n.renderState=Oe.fromCache(i),n}function nFe(e){return(e.renderState.stencilTest.reference&kt.SKIP_LOD_MASK)>>>kt.SKIP_LOD_BIT_SHIFT}function iFe(e){let t=He(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=un.ALPHA_BLEND,t.stencilTest=kt.setCesium3DTileBit(),t.stencilMask=kt.CESIUM_3D_TILE_MASK,Oe.fromCache(t)}function oFe(e){let t=He(e,!0);return t.stencilT
in float a_batchId;
uniform mat4 u_modifiedModelViewProjection;
void main()
{
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
}
`;var zcn=_(T(),1);function Xu(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Xu.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 c(this._color)||(this._color=new Y),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(c(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)}}});Xu.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Xu.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Xu.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Xu.getPropertyInherited=function(e,t,n){let i=e.batchTable;if(c(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(c(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(c(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(c(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),c(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}let l=c(e.group)?e.group.metadata:void 0;if(c(l)){if(l.hasPropertyBySemantic(n))return l.getPropertyBySemantic(n);if(l.hasProperty(n))return l.getProperty(n)}let d=e.tileset.metadata;if(c(d)){if(d.hasPropertyBySemantic(n))return d.getPropertyBySemantic(n);if(d.hasProperty(n))return d.getProperty(n)}};Xu.prototype.getPropertyInherited=function(e){return Xu.getPropertyInherited(this._content,this._batchId,e)};Xu.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Xu.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Xu.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Xu.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var Us=Xu;var uln=_(T(),1);var Qcn=_(T(),1),CH=class{add(t,n,i){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],n&&this[o][i?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(i){i.call(n&&n.context?n.context:n,n)})}},VH=class{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}},wl=class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,n,i){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=n,i?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,n){return e.literals[t]=n,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=r}else t+=r}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){let n=[],i=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===t){i=!0,this.index++,t===e.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===e.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let s=n.length;s<o;s++)n.push(null)}}else if(n.length!==o&&o!==0)this.throwError("Expected comma");else{let s=this.gobbleExpression();(!s||s.type===e.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}},sFe=new CH;Object.assign(wl,{hooks:sFe,plugins:new VH(wl),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});wl.max_unop_len=wl.getMaxKeyLen(wl.unary_ops);wl.max_binop_len=wl.getMaxKeyLen(wl.binary_ops);var iy=e=>new wl(e).parse(),aFe=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(wl).filter(e=>!aFe.includes(e)&&iy[e]===void 0).forEach(e=>{iy[e]=wl[e]});iy.Jsep=wl;var cFe="ConditionalExpression",lFe={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;let i=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:cFe,test:i,consequent:o,alternate:r},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=i}}else this.throwError("Expected :")}})}};iy.plugins.register(lFe);var qcn=_(T(),1),dFe={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},gt=Object.freeze(dFe);function zm(e,t){C.typeOf.string("expression",e),this._expression=e,e=CFe(e,t),e=LFe(VFe(e)),iy.addBinaryOp("=~",0),iy.addBinaryOp("!~",0);let n;try{n=iy(e)}catch(i){throw new le(i)}this._runtimeAst=Zi(this,n)}Object.defineProperties(zm.prototype,{expression:{get:function(){return this._expression}}});var Pn={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new D],cartesian3Array:[new m],cartesian4Array:[new ce],re
{
return ${o};
}
`,o};zm.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};zm.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var uFe=["!","-","+"],Roe=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],OX=/\${(.*?)}/g,mFe=/\\/g,fFe="@#%",hFe=/@#%/g,R5=new Y,G5={abs:Os(Math.abs),sqrt:Os(Math.sqrt),cos:Os(Math.cos),sin:Os(Math.sin),tan:Os(Math.tan),acos:Os(Math.acos),asin:Os(Math.asin),atan:Os(Math.atan),radians:Os(w.toRadians),degrees:Os(w.toDegrees),sign:Os(w.sign),floor:Os(Math.floor),ceil:Os(Math.ceil),round:Os(Math.round),exp:Os(Math.exp),exp2:Os(bFe),log:Os(Math.log),log2:Os(yFe),fract:Os(pFe),length:gFe,normalize:xFe},E5={atan2:L5(Math.atan2,!1),pow:L5(Math.pow,!1),min:L5(Math.min,!0),max:L5(Math.max,!0),distance:_Fe,dot:TFe,cross:SFe},RH={clamp:Goe(w.clamp,!0),mix:Goe(w.lerp,!0)};function pFe(e){return e-Math.floor(e)}function bFe(e){return Math.pow(2,e)}function yFe(e){return w.log2(e)}function Os(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof D)return D.fromElements(e(n.x),e(n.y),Pn.getCartesian2());if(n instanceof m)return m.fromElements(e(n.x),e(n.y),e(n.z),Pn.getCartesian3());if(n instanceof ce)return ce.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Pn.getCartesian4());throw new le(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function L5(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof D)return D.fromElements(e(i.x,o),e(i.y,o),Pn.getCartesian2());if(i instanceof m)return m.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Pn.getCartesian3());if(i instanceof ce)return ce.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Pn.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof D&&o instanceof D)return D.fromElements(e(i.x,o.x),e(i.y,o.y),Pn.getCartesian2());if(i instanceof m&&o instanceof m)return m.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Pn.getCartesian3());if(i instanceof ce&&o instanceof ce)return ce.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),Pn.getCartesian4());throw new le(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function Goe(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 D&&o instanceof D)return D.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),Pn.getCartesian2());if(i instanceof m&&o instanceof m)return m.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Pn.getCartesian3());if(i instanceof ce&&o instanceof ce)return ce.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),Pn.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof D&&o instanceof D&&r instanceof D)return D.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),Pn.getCartesian2());if(i instanceof m&&o instanceof m&&r instanceof m)return m.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),Pn.getCartesian3());if(i instanceof ce&&o instanceof ce&&r instanceof ce)return ce.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),Pn.getCartesian4());throw new le(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function gFe(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof D)return D.magnitude(t);if(t instanceof m)return m.magnitude(t);if(t instanceof ce)return ce.magnitude(t);throw new le(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function xFe(e,t){if(typeof t=="number")return 1;if(t instanceof D)return D.normalize(t,Pn.getCartesian2());if(t instanceof m)return m.normalize(t,Pn.getCartesian3());if(t instanceof ce)return ce.normalize(t,Pn.getCartesian4());throw new le(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function _Fe(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof D
{
czm_non_pick_main();
out_FragColor = ${o};
}
`,e._spPick=tn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}let a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(LC),l=n.getFragmentShaderCallback(!1,void 0,!0)(Q0);o=n.getPickId();let d=new Be({sources:[a]}),u=new Be({defines:["VECTOR_TILE"],sources:[l]});e._sp=tn.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:u,attributeLocations:i}),d=new Be({sources:[LC]}),u=new Be({defines:["VECTOR_TILE"],sources:[Q0]}),e._spStencil=tn.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:u,attributeLocations:i}),l=Be.replaceMain(l,"czm_non_pick_main"),l=`${l}
void main()
{
czm_non_pick_main();
out_FragColor = ${o};
}
`;let f=new Be({sources:[a]}),p=new Be({defines:["VECTOR_TILE"],sources:[l]});e._spPick=tn.fromCache({context:t,vertexShaderSource:f,fragmentShaderSource:p,attributeLocations:i})}function woe(e){let t=e?On.EQUAL:On.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:ft.KEEP,zFail:ft.DECREMENT_WRAP,zPass:ft.KEEP},backFunction:t,backOperation:{fail:ft.KEEP,zFail:ft.INCREMENT_WRAP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:lc.LESS_OR_EQUAL},depthMask:!1}}var BFe={stencilTest:{enabled:!0,frontFunction:On.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:On.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:un.PRE_MULTIPLIED_ALPHA_BLEND},YFe={stencilTest:{enabled:!0,frontFunction:On.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:On.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function HFe(e){c(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Oe.fromCache(woe(!1)),e._rsStencilDepthPass3DTiles=Oe.fromCache(woe(!0)),e._rsColorPass=Oe.fromCache(BFe),e._rsPickPass=Oe.fromCache(YFe))}var i_=new M,Poe=new m;function zFe(e,t){if(c(e._uniformMap))return;let n={u_modifiedModelViewProjection:function(){let i=t.uniformState.view,o=t.uniformState.projection;return M.clone(i,i_),M.multiplyByPoint(i_,e._center,Poe),M.setTranslation(i_,Poe,i_),M.multiply(o,i_,i_),i_},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function GH(e,t,n,i,o,r,s){let a=e.constructor.BYTES_PER_ELEMENT,l=r.length;for(let d=0;d<l;++d){let u=r[d],f=s[u],p=i[f],y=o[f],h=new e.constructor(e.buffer,a*p,y);t.set(h,n),i[f]=n,n+=y}return n}function KFe(e,t){let n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length),a=t.pop(),l=[a],d=GH(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=d;t.length>0;){let u=t.pop();if(Y.equals(u.color,a.color))d=GH(n,s,d,i,o,u.batchIds,r),a.batchIds=a.batchIds.concat(u.batchIds),a.count=d-a.offset;else{let f=d;d=GH(n,s,d,i,o,u.batchIds,r),u.offset=f,u.count=d-f,l.push(u),a=u}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=l}function EH(e,t,n,i,o,r,s){let a=e.bytesPerIndex,l=r.length;for(let d=0;d<l;++d){let u=r[d],f=s[u],p=i[f],y=o[f];t.copyFromBuffer(e,p*a,n*a,y*a),i[f]=n,n+=y}return n}function JFe(e,t){let n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp,r=t.pop(),s=[r],a=e._va.indexBuffer,l=e._vaSwap.indexBuffer,d=EH(a,l,0,n,i,r.batchIds,o);for(r.offset=0,r.count=d;t.length>0;){let f=t.pop();if(Y.equals(f.color,r.color))d=EH(a,l,d,n,i,f.batchIds,o),r.batchIds=r.batchIds.concat(f.batchIds),r.count=d-r.offset;else{let p=d;d=EH(a,l,d,n,i,f.batchIds,o),f.offset=p,f.count=d-p,s.push(f),r=f}}let u=e._va;e._va=e._vaSwap,e._vaSwap=u,e._batchedIndices=s}function QFe(e,t){return t.color.toRgba()-e.color.toRgba()}function jFe(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 l=n[s].color.toRgba();if(c(r[l])){o=!0;break}else r[l]=!0}if(!o)return e._batchDirty=!1,!1;if(o&&!e.forceRebatch&&e._framesSinceLastRebatch<120){++e._framesSinceLastRebatch;return}return n.sort(QFe),t.webgl2?JFe(e,n):KFe(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function qFe(e,t){let n=jFe(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(c(i)&&!n&&i.length===s)return;i.length=s;let a=e._va,l=e._sp,d=e._modelMatrix??M.IDENTITY,u=e._uniformMap,f=e._boundingVolume;for(let p=0;p<r;++p){let y=o[p].offset,h=o[p].count,g=i[p*2];c(g)||(g=i[p*2]=new et({owner:e})),g.vertexArray=a,g.modelMatrix=d,g.offset=y,g.count=h,g.renderState=e._rsStencilDepthPass,g.sh
${t.message}`);let n=new le(e);return c(t)&&(n.stack=`Original stack:
${t.stack}
Handler stack:
${n.stack}`),n};ly.prototype.isDestroyed=function(){return!1};ly.prototype.destroy=function(){return this.unload(),he(this)};var Ji=ly;var amn=_(T(),1),n9e={UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,READY:4,FAILED:5},xt=Object.freeze(n9e);function $p(e){e=e??z.EMPTY_OBJECT;let t=e.typedArray,n=e.resource,i=e.cacheKey;if(c(t)===c(n))throw new L("One of options.typedArray and options.resource must be defined.");this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=xt.UNLOADED,this._promise=void 0}c(Object.create)&&($p.prototype=Object.create(Ji.prototype),$p.prototype.constructor=$p);Object.defineProperties($p.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});$p.prototype.load=async function(){return c(this._promise)?this._promise:c(this._typedArray)?(this._promise=Promise.resolve(this),this._promise):(this._promise=i9e(this),this._promise)};async function i9e(e){let t=e._resource;e._state=xt.LOADING;try{let n=await $p._fetchArrayBuffer(t);return e.isDestroyed()?void 0:(e._typedArray=new Uint8Array(n),e._state=xt.READY,e)}catch(n){if(e.isDestroyed())return;e._state=xt.FAILED;let i=`Failed to load external buffer: ${t.url}`;throw e.getError(i,n)}}$p._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};$p.prototype.unload=function(){this._typedArray=void 0};var s_=$p;var kmn=_(T(),1);var Rmn=_(T());var ymn=_(T()),pmn=function(){var e="b9H79TebbbeJq9Geueu9Geub9Gbb9Gvuuuuueu9Gduueu9Gluuuueu9Gvuuuuub9Gouuuuuub9Gluuuub9GiuuueuiKLdilevlevlooroowwvwbDDbelve9Weiiviebeoweuec:G:Qdkr;RiOo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWVbe8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9c9V919U9KbdE9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949wWV79P9V9UbiY9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWVbl8E9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWV9c9V919U9Kbv8A9TW79O9V9Wt9FW9U9J9V9KW69U9KW949wWV79P9V9UboE9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JWbra9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JW9c9V919U9KbwL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9p9JtbDK9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9r919HtbqL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVT949WbkE9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OWbPa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OW9ttV9P9Wbsa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9WbzK9TW79O9V9Wt9F79W9Ht9P9H29t9VVt9sW9T9H9WbHl79IV9RbODwebcekdQXq;A9pLdbk;QqeKu8Jjjjjbcjo9Rgv8Kjjjjbcbhodnalcefae0mbabcbRbN:kjjbc:GeV86bbavcjdfcbcjdzNjjjb8AdnaiTmbavcjdfadalz:tjjjb8Akabaefhrabcefhwavalfcbcbcjdal9RalcFe0EzNjjjb8Aavavcjdfalz:tjjjbhDcj;abal9Uc;WFbGgecjdaecjd6Ehqcbhkindndnaiak9nmbaDcjlfcbcjdzNjjjb8Aaqaiak9Rakaqfai6Egxcsfgecl4cifcd4hmadakal2fhPdndndnaec9WGgsTmbcbhzaPhHawhOxekdnaxmbalheinaraw9Ram6miawcbamzNjjjbamfhwaecufgembxvkkcbhAaPhOinaDaAfRbbhCaDcjlfheaOhoaxhXinaeaoRbbgQaC9RgCcetaCcKtcK91cr4786bbaoalfhoaecefheaQhCaXcufgXmbkaraw9Ram6mdaOcefhOawcbamzNjjjbamfhwaAcefgAal9hmbxlkkindnaxTmbaDazfRbbhCaDcjlfheaHhoaxhXinaeaoRbbgQaC9RgCcetaCcKtcK91cr4786bbaoalfhoaecefheaQhCaXcufgXmbkkaraO9Ram6mearaOcbamzNjjjbgLamfgw9RcK6mecbhKaDcjlfhOinaDcjlfaKfhYcwhAczhQceheindndnaegXce9hmbcuhoaYRbbmecbhodninaogecsSmeaecefhoaOaefcefRbbTmbkkcucbaecs6EhoxekaXcethocuaXtc;:bGcFb7hCcbheinaoaCaOaefRbb9nfhoaecefgecz9hmbkkaoaQaoaQ6geEhQaXaAaeEhAaXcetheaXcl6mbkdndndndnaAcufPdiebkaLaKco4fgeaeRbbcdciaAclSEaKci4coGtV86bbaAcw9hmeawaY8Pbb83bbawcwfaYcwf8Pbb83bbawczfhwxdkaLaKco4fgeaeRbbceaKci4coGtV86bbkdncwaA9Tg8Ambinawcb86bbawcefhwxbkkcuaAtcu7hYcbhEaOh3ina3hea8AhCcbhoinaeRbbgQaYcFeGgXaQaX6EaoaAtVhoaecefheaCcufgCmbkawao86bba3a8Afh3awcefhwaEa8AfgEcz6mbkcbheindnaOaefRbbgoaX6mbawao86bbawcefhwkaecefgecz9hmbkkdnaKczfgKas9pmbaOczfhOaraw9RcL0mekkaKas6meawTmeaHcefhHawhOazcefgzalSmixbkkcbhoxikcbhoaraw9Ralcaalca0E6mddnalc8F0mbawcbcaal9RgezNjjjbaefhwkawaDcjdfalz:tjjjbalfab9RhoxdkaDaPaxcufal2falz:tjjjb8Aaxakfhkawmbkcbhokavcjof8Kjjjjbaok9heeuaecaaeca0Eabcj;abae9Uc;WFbGgdcjdadcjd6Egdfcufad9Uae2adcl4cifcd4adV2fcefkmbcbabBdN:kjjbk:zse5u8Jjjjjbc;ae9Rgl8Kjjjjbcbhvdnaici9UgocHfae0mbabcbyd:e:kjjbgrc;GeV86bbalc;abfcFecjezNjjjb8AalcUfgw9cu83ibalc8WfgD9cu83ibalcyfgq9cu83ibalcafgk9cu83ibalcKfgx9cu83ibalczfgm9cu83ibal9cu83iwal9cu83i
${n.message}`);let o=new le(i);return c(n)&&(o.stack=`Original stack:
${n.stack}
Handler stack:
${o.stack}`),o};fc.getNodeTransform=function(e){return c(e.matrix)?e.matrix:M.fromTranslationQuaternionRotationScale(c(e.translation)?e.translation:m.ZERO,c(e.rotation)?e.rotation:Fe.IDENTITY,c(e.scale)?e.scale:m.ONE)};fc.getAttributeBySemantic=function(e,t,n){let i=e.attributes,o=i.length;for(let r=0;r<o;++r){let s=i[r],a=c(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};fc.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}};fc.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}};fc.hasQuantizedAttributes=function(e){if(!c(e))return!1;for(let t=0;t<e.length;t++){let n=e[t];if(c(n.quantization))return!0}return!1};fc.getAttributeInfo=function(e){let t=e.semantic,n=e.setIndex,i,o=!1;c(t)?(i=pt.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());let r=/^color_\d+$/.test(i),s=e.type,a=rn.getGlslType(s);r&&(a="vec4");let l=c(e.quantization),d;return l&&(d=r?"vec4":rn.getGlslType(e.quantization.type)),{attribute:e,isQuantized:l,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:d}};var WMe=new m,wMe=new m;fc.getPositionMinMax=function(e,t,n){let i=fc.getAttributeBySemantic(e,"POSITION"),o=i.max,r=i.min;return c(n)&&c(t)&&(r=m.add(r,t,wMe),o=m.add(o,n,WMe)),{min:r,max:o}};fc.getAxisCorrectionMatrix=function(e,t,n){return n=M.clone(M.IDENTITY,n),e===Po.Y?n=M.clone(Po.Y_UP_TO_Z_UP,n):e===Po.X&&(n=M.clone(Po.X_UP_TO_Z_UP,n)),t===Po.Z&&(n=M.multiplyTransformation(n,Po.Z_UP_TO_X_UP,n)),n};var PMe=new te;fc.getCullFace=function(e,t){if(!ve.isTriangles(t))return _i.BACK;let n=M.getMatrix3(e,PMe);return te.determinant(n)<0?_i.FRONT:_i.BACK};fc.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};fc.supportedExtensions={AGI_articulations:!0,CESIUM_primitive_outline:!0,CESIUM_RTC:!0,EXT_feature_metadata:!0,EXT_implicit_cylinder_region:!0,EXT_implicit_ellipsoid_region:!0,EXT_instance_features:!0,EXT_mesh_features:!0,EXT_mesh_gpu_instancing:!0,EXT_meshopt_compression:!0,EXT_primitive_voxels:!0,EXT_structural_metadata:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_draco_mesh_compression:!0,KHR_implicit_shapes:!0,KHR_materials_common:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_materials_specular:!0,KHR_materials_anisotropy:!0,KHR_materials_clearcoat:!0,KHR_materials_unlit:!0,KHR_mesh_quantization:!0,KHR_techniques_webgl:!0,KHR_texture_basisu:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0};fc.checkSupportedExtensions=function(e){let t=e.length;for(let n=0;n<t;n++){let i=e[n];if(!fc.supportedExtensions[i])throw new le(`Unsupported glTF Extension: ${i}`)}};var qt=fc;function fy(e){e=e??z.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;C.typeOf.func("options.resourceCache",t),C.typeOf.object("options.gltfResource",n),C.typeOf.object("options.baseResource",i),this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=o,this._gltfJson=r,this._cacheKey=s,this._gltf=void 0,this._bufferLoaders=[],this._state=xt.UNLOADED,this._promise=void 0}c(Object.create)&&(fy.prototype=Object.create(Ji.prototype),fy.prototype.constructor=fy);Object.defineProperties(fy.prototype,{cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});fy.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=xt.LOADING,c(this._gltfJson)?(this._promise=bre(this,this._gltfJson),this._promise):c(this._typedArray)?(this._promise=yre(this,this._typedArray),this._promise):(this._promise=vMe(this),this._promise))};async function vMe(e){let t;try{let n=await e._fetchGltf();if(e.isDestroyed())return;t=new Uint8Array(n)}catch(n){if(e.isDestroyed())return;DH(e,n)}return yre(e,t)}function DH(e,t){e.unload(),e._state=xt.FAILED;let n=`Failed to load glTF: ${e._gltfResource.url}`;throw e.getError(n,t)}async function FMe(e,t){if(c(t.asset)&&t.asset.version==="2.0"&&!ur(t,"KHR_techniques_webgl
uniform int u_polygonsLength;
uniform int u_extentsLength;
uniform highp sampler2D u_polygonTexture;
uniform highp sampler2D u_extentsTexture;
int getPolygonIndex(float dimension, vec2 coord) {
vec2 uv = coord.xy * dimension;
return int(floor(uv.y) * dimension + floor(uv.x));
}
vec2 getLookupUv(ivec2 dimensions, int i) {
int pixY = i / dimensions.x;
int pixX = i - (pixY * dimensions.x);
float pixelWidth = 1.0 / float(dimensions.x);
float pixelHeight = 1.0 / float(dimensions.y);
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
return vec2(u, v);
}
vec4 getExtents(int i) {
return texture(u_extentsTexture, getLookupUv(textureSize(u_extentsTexture, 0), i));
}
ivec2 getPositionsLengthAndExtentsIndex(int i) {
vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);
vec4 value = texture(u_polygonTexture, uv);
return ivec2(int(value.x), int(value.y));
}
vec2 getPolygonPosition(int i) {
vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);
return texture(u_polygonTexture, uv).xy;
}
vec2 getCoordinates(vec2 textureCoordinates, vec4 extents) {
float latitude = mix(extents.x, extents.x + 1.0 / extents.z, textureCoordinates.y);
float longitude = mix(extents.y, extents.y + 1.0 / extents.w, textureCoordinates.x);
return vec2(latitude, longitude);
}
void main() {
int lastPolygonIndex = 0;
out_FragColor = vec4(1.0);
float dimension = float(u_extentsLength);
if (u_extentsLength > 2) {
dimension = ceil(log2(float(u_extentsLength)));
}
int regionIndex = getPolygonIndex(dimension, v_textureCoordinates);
for (int polygonIndex = 0; polygonIndex < u_polygonsLength; polygonIndex++) {
ivec2 positionsLengthAndExtents = getPositionsLengthAndExtentsIndex(lastPolygonIndex);
int positionsLength = positionsLengthAndExtents.x;
int polygonExtentsIndex = positionsLengthAndExtents.y;
lastPolygonIndex += 1;
if (polygonExtentsIndex == regionIndex) {
float clipAmount = czm_infinity;
vec4 extents = getExtents(polygonExtentsIndex);
vec2 textureOffset = vec2(mod(float(polygonExtentsIndex), dimension), floor(float(polygonExtentsIndex) / dimension)) / dimension;
vec2 p = getCoordinates((v_textureCoordinates - textureOffset) * dimension, extents);
float s = 1.0;
for (int i = 0, j = positionsLength - 1; i < positionsLength; j = i, i++) {
vec2 a = getPolygonPosition(lastPolygonIndex + i);
vec2 b = getPolygonPosition(lastPolygonIndex + j);
vec2 ab = b - a;
vec2 pa = p - a;
float t = dot(pa, ab) / dot(ab, ab);
t = clamp(t, 0.0, 1.0);
vec2 pq = pa - t * ab;
float d = length(pq);
bvec3 cond = bvec3(p.y >= a.y,
p.y < b.y,
ab.x * pa.y > ab.y * pa.x);
if (all(cond) || all(not(cond))) s = -s;
if (abs(d) < abs(clipAmount)) {
clipAmount = d;
}
}
vec4 result = (s * vec4(clipAmount * length(extents.zw))) / 2.0 + 0.5;
out_FragColor = min(out_FragColor, result);
}
lastPolygonIndex += positionsLength;
}
}
`;function ts(e){e=e??z.EMPTY_OBJECT,this._polygons=[],this._totalPositions=0,this.enabled=e.enabled??!0,this.inverse=e.inverse??!1,this.polygonAdded=new ye,this.polygonRemoved=new ye,this._owner=void 0,this._float32View=void 0,this._extentsFloat32View=void 0,this._extentsCount=0,this._polygonsTexture=void 0,this._extentsTexture=void 0,this._signedDistanceTexture=void 0,this._signedDistanceComputeCommand=void 0;let t=e.polygons;if(c(t)){let n=t.length;for(let i=0;i<n;++i)this._polygons.push(t[i])}}Object.defineProperties(ts.prototype,{length:{get:function(){return this._polygons.length}},totalPositions:{get:function(){return this._totalPositions}},extentsTexture:{get:function(){return this._extentsTexture}},extentsCount:{get:function(){return this._extentsCount}},pixelsNeededForExtents:{get:function(){return this.length}},pixelsNeededForPolygonPositions:{get:function(){return this.totalPositions+this.length}},clippingTexture:{get:function(){return this._signedDistanceTexture}},owner:{get:function(){return this._owner}},clippingPolygonsState:{get:function(){return this.inverse?-this.extentsCount:this.extentsCount}}});ts.prototype.add=function(e){C.typeOf.object("polygon",e);let t=this._polygons.length;return this._polygons.push(e),this.polygonAdded.raiseEvent(e,t),e};ts.prototype.get=function(e){return C.typeOf.number("index",e),this._polygons[e]};ts.prototype.contains=function(e){return C.typeOf.object("polygon",e),this._polygons.some(t=>HC.equals(t,e))};ts.prototype.remove=function(e){C.typeOf.object("polygon",e);let t=this._polygons,n=t.findIndex(i=>HC.equals(i,e));return n===-1?!1:(t.splice(n,1),this.polygonRemoved.raiseEvent(e,n),!0)};var gke=new de;function xke(e){let t=[],n=[],i=e.length;for(let r=0;r<i;++r){let a=e[r].computeSphericalExtents(),l=Math.max(a.height*2.5,.001),d=Math.max(a.width*2.5,.001),u=de.clone(a);u.south-=l,u.west-=d,u.north+=l,u.east+=d,u.south=Math.max(u.south,-Math.PI),u.west=Math.max(u.west,-Math.PI),u.north=Math.min(u.north,Math.PI),u.east=Math.min(u.east,Math.PI);let f=[r];for(let p=0;p<t.length;++p){let y=t[p];if(c(y)&&c(de.simpleIntersection(y,u))&&!de.equals(y,u)){let h=n[p];f.push(...h),h.reduce((g,x)=>de.union(e[x].computeSphericalExtents(gke),g,g),a),t[p]=void 0,n[p]=void 0,l=Math.max(a.height*2.5,.001),d=Math.max(a.width*2.5,.001),u=de.clone(a,u),u.south-=l,u.west-=d,u.north+=l,u.east+=d,u.south=Math.max(u.south,-Math.PI),u.west=Math.max(u.west,-Math.PI),u.north=Math.min(u.north,Math.PI),u.east=Math.min(u.east,Math.PI),p=-1}}t.push(u),n.push(f)}let o=new Map;return n.filter(c).forEach((r,s)=>r.forEach(a=>o.set(a,s))),{extentsList:t.filter(c),extentsIndexByPolygon:o}}ts.prototype.removeAll=function(){let e=this._polygons,t=e.length;for(let n=0;n<t;++n){let i=e[n];this.polygonRemoved.raiseEvent(i,n)}this._polygons=[]};function _ke(e){let t=e._float32View,n=e._extentsFloat32View,i=e._polygons,{extentsList:o,extentsIndexByPolygon:r}=xke(i),s=0;for(let[l,d]of i.entries()){let u=d.length;t[s++]=u,t[s++]=r.get(l);for(let f=0;f<u;++f){let p=d.positions[f],y=Math.hypot(p.x,p.y),h=w.fastApproximateAtan2(y,p.z),g=w.fastApproximateAtan2(p.x,p.y);t[s++]=h,t[s++]=g}}let a=0;for(let l of o){let d=1/(l.east-l.west),u=1/(l.north-l.south);n[a++]=l.south,n[a++]=l.west,n[a++]=u,n[a++]=d}e._extentsCount=o.length}var iz=new D;ts.prototype.update=function(e){let t=e.context;if(!ts.isSupported(e))throw new le("ClippingPolygonCollections are only supported for WebGL 2.");let n=this._polygons.reduce((s,a)=>s+a.length,0);if(n===this.totalPositions||(this._totalPositions=n,this.length===0))return;c(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0,this._signedDistanceComputeCommand=void 0);let i=this._polygonsTexture,o=this._extentsTexture,r=this._signedDistanceTexture;if(c(i)){let s=i.width*i.height;(s<this.pixelsNeededForPolygonPositions||this.pixelsNeededForPolygonPositions<.25*s)&&(i.destroy(),i=void 0,this._polygonsTexture=void 0)}if(!c(i)){let s=ts.getTextureResolution(i,this.pixelsNeededForPolygonPositions,iz);i=new Pt({context:t,width:s.x,height:s.y,pixelFormat:ke.RG
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_MAX = 16;
const int LIGHT_STEPS_MAX = 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;
}
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
float start_0 = primaryRayAtmosphereIntersect.start;
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
float x_o_a = start_0 - ATMOSPHERE_THICKNESS;
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0);
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0);
float rayPositionLength = primaryRayAtmosphereIntersect.start;
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
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_MAX; ++i) {
if (i >= PRIMARY_STEPS) {
break;
}
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_MAX; ++j) {
if (j >= LIGHT_STEPS) {
break;
}
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 += rayStepLengthIncrease);
}
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 kTn=_(T(),1),_I=`uniform samplerCube u_radianceMap;
in vec2 v_textureCoordinates;
const float twoSqrtPi = 2.0 * sqrt(czm_pi);
float computeShBasis(int index, vec3 s) {
if (index == 0) {
return 1.0 / twoSqrtPi;
}
if (index == 1) {
return -sqrt(3.0) * s.y / twoSqrtPi;
}
if (index == 2) {
return sqrt(3.0) * s.z / twoSqrtPi;
}
if (index == 3) {
return -sqrt(3.0) * s.x / twoSqrtPi;
}
if (index == 4) {
return sqrt(15.0) * s.y * s.x / twoSqrtPi;
}
if (index == 5) {
return -sqrt(15.0) * s.y * s.z / twoSqrtPi;
}
if (index == 6) {
return sqrt(5.0) * (3.0 * s.z * s.z - 1.0) / 2.0 / twoSqrtPi;
}
if (index == 7) {
return -sqrt(15.0) * s.x * s.z / twoSqrtPi;
}
if (index == 8) {
return sqrt(15.0) * (s.x * s.x - s.y * s.y) / 2.0 / twoSqrtPi;
}
return 0.0;
}
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));
}
const int samples = 256;
const float solidAngle = 1.0 / float(samples);
void main() {
vec2 uv = v_textureCoordinates.xy * 3.0;
int coefficientIndex = int(floor(uv.y) * 3.0 + floor(uv.x));
for (int i = 0; i < samples; ++i) {
vec2 xi = hammersley2D(i, samples);
float phi = czm_twoPi * xi.x;
float cosTheta = 1.0 - 2.0 * sqrt(1.0 - xi.y * xi.y);
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
vec3 direction = normalize(vec3(sinTheta * cos(phi), cosTheta, sinTheta * sin(phi)));
float Ylm = computeShBasis(coefficientIndex, direction);
vec3 lookupDirection = -direction.xyz;
lookupDirection.z = -lookupDirection.z;
vec4 color = czm_textureCube(u_radianceMap, lookupDirection, 0.0);
out_FragColor += Ylm * color * solidAngle * sinTheta;
}
}
`;var OTn=_(T(),1),TI=`precision highp float;
in vec2 v_textureCoordinates;
uniform vec3 u_faceDirection;
uniform vec3 u_positionWC;
uniform mat4 u_enuToFixedFrame;
uniform vec4 u_brightnessSaturationGammaIntensity;
uniform vec4 u_groundColor;
vec4 getCubeMapDirection(vec2 uv, vec3 faceDir) {
vec2 scaledUV = uv * 2.0 - 1.0;
if (faceDir.x != 0.0) {
return vec4(faceDir.x, scaledUV.x * faceDir.x, -scaledUV.y, 0.0);
} else if (faceDir.y != 0.0) {
return vec4(scaledUV.x, -scaledUV.y * faceDir.y, faceDir.y, 0.0);
} else {
return vec4(scaledUV.x * faceDir.z, -faceDir.z, -scaledUV.y, 0.0);
}
}
void main() {
float height = length(u_positionWC);
float atmosphereInnerRadius = u_radiiAndDynamicAtmosphereColor.y;
float ellipsoidHeight = max(height - atmosphereInnerRadius, 0.0);
vec3 positionWC = u_positionWC / height * (ellipsoidHeight + atmosphereInnerRadius);
float atmosphereOuterRadius = u_radiiAndDynamicAtmosphereColor.x;
float atmosphereHeight = atmosphereOuterRadius - atmosphereInnerRadius;
vec3 direction = (u_enuToFixedFrame * getCubeMapDirection(v_textureCoordinates, u_faceDirection)).xyz;
vec3 normalizedDirection = normalize(direction);
czm_ray ray = czm_ray(positionWC, normalizedDirection);
czm_raySegment intersection = czm_raySphereIntersectionInterval(ray, vec3(0.0), atmosphereInnerRadius);
if (!czm_isEmpty(intersection)) {
intersection = czm_rayEllipsoidIntersectionInterval(ray, vec3(0.0), czm_ellipsoidInverseRadii);
}
bool onEllipsoid = intersection.start >= 0.0;
float rayLength = czm_branchFreeTernary(onEllipsoid, intersection.start, atmosphereOuterRadius);
vec3 skyPositionWC = positionWC + normalizedDirection * rayLength;
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirectionWC = normalize(czm_getDynamicAtmosphereLightDirection(skyPositionWC, lightEnum));
vec3 mieColor;
vec3 rayleighColor;
float opacity;
czm_computeScattering(
ray,
rayLength,
lightDirectionWC,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
vec4 atmopshereColor = czm_computeAtmosphereColor(ray, lightDirectionWC, rayleighColor, mieColor, opacity);
#ifdef ATMOSPHERE_COLOR_CORRECT
const bool ignoreBlackPixels = true;
atmopshereColor.rgb = czm_applyHSBShift(atmopshereColor.rgb, czm_atmosphereHsbShift, ignoreBlackPixels);
#endif
vec3 lookupDirection = -normalizedDirection;
lookupDirection.x = -lookupDirection.x;
lookupDirection = -normalize(czm_temeToPseudoFixed * lookupDirection);
lookupDirection.x = -lookupDirection.x;
float skyAlpha = clamp((1.0 - ellipsoidHeight / atmosphereHeight) * atmopshereColor.a, 0.0, 1.0);
skyAlpha = czm_branchFreeTernary(length(atmopshereColor.rgb) <= czm_epsilon7, 0.0, skyAlpha);
float intensity = u_brightnessSaturationGammaIntensity.w;
vec4 sceneSkyBoxColor = czm_textureCube(czm_environmentMap, lookupDirection);
vec3 skyBackgroundColor = mix(czm_backgroundColor.rgb, sceneSkyBoxColor.rgb, sceneSkyBoxColor.a);
vec4 combinedSkyColor = vec4(mix(skyBackgroundColor, atmopshereColor.rgb * intensity, skyAlpha), 1.0);
vec3 up = normalize(positionWC);
float occlusion = max(dot(lightDirectionWC, up), 0.05);
vec4 groundColor = vec4(u_groundColor.rgb * u_groundColor.a * (vec3(intensity * occlusion) + atmopshereColor.rgb), 1.0);
vec4 blendedGroundColor = mix(groundColor, atmopshereColor, clamp(ellipsoidHeight / atmosphereHeight, 0.0, 1.0));
vec4 color = czm_branchFreeTernary(onEllipsoid, blendedGroundColor, combinedSkyColor);
float brightness = u_brightnessSaturationGammaIntensity.x;
float saturation = u_brightnessSaturationGammaIntensity.y;
float gamma = u_brightnessSaturationGammaIntensity.z;
#ifdef ENVIRONMENT_COLOR_CORRECT
color.rgb = mix(vec3(0.0), color.rgb, brightness);
color.rgb = czm_saturation(color.rgb, saturation);
#endif
color.rgb = pow(color.rgb, vec3(gamma));
color.rgb = czm_gammaCorrect(color.rgb);
out_FragColor = color;
}
`;var BTn=_(T(),1),SI=`precision highp float;
in vec3 v_textureCoordinates;
uniform float u_roughness;
uniform samplerCube u_radianceTexture;
uniform vec3 u_faceDirection;
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 alphaRoughness, vec3 N)
{
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
float phi = czm_twoPi * xi.x;
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 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;
}
const int samples = 128;
void main() {
vec3 normal = u_faceDirection;
vec3 V = normalize(v_textureCoordinates);
float roughness = u_roughness;
vec4 color = vec4(0.0);
float weight = 0.0;
for (int i = 0; i < samples; ++i) {
vec2 xi = hammersley2D(i, samples);
vec3 H = importanceSampleGGX(xi, roughness, V);
vec3 L = 2.0 * dot(V, H) * H - V;
float NdotL = max(dot(V, L), 0.0);
if (NdotL > 0.0) {
color += vec4(czm_textureCube(u_radianceTexture, L).rgb, 1.0) * NdotL;
weight += NdotL;
}
}
out_FragColor = color / weight;
}
`;var HTn=_(T(),1),CI=`in vec3 position;
out vec3 v_textureCoordinates;
uniform vec3 u_faceDirection;
vec3 getCubeMapDirection(vec2 uv, vec3 faceDir) {
vec2 scaledUV = uv;
if (faceDir.x != 0.0) {
return vec3(faceDir.x, scaledUV.y, scaledUV.x * faceDir.x);
} else if (faceDir.y != 0.0) {
return vec3(scaledUV.x, -faceDir.y, -scaledUV.y * faceDir.y);
} else {
return vec3(scaledUV.x * faceDir.z, scaledUV.y, -faceDir.z);
}
}
void main()
{
v_textureCoordinates = getCubeMapDirection(position.xy, u_faceDirection);
v_textureCoordinates.y = -v_textureCoordinates.y;
v_textureCoordinates.z = -v_textureCoordinates.z;
gl_Position = vec4(position, 1.0);
}
`;function $n(e){this._position=void 0,this._radianceMapDirty=!1,this._radianceCommandsDirty=!1,this._convolutionsCommandsDirty=!1,this._irradianceCommandDirty=!1,this._irradianceTextureDirty=!1,this._sphericalHarmonicCoefficientsDirty=!1,this._shouldRegenerateShaders=!1,this._shouldReset=!1,e=e??z.EMPTY_OBJECT;let t=Math.min(e.mipmapLevels??7,Math.log2(mt.maximumCubeMapSize));this._mipmapLevels=t,this._radianceMapComputeCommands=new Array(6),this._convolutionComputeCommands=new Array((t-1)*6),this._irradianceComputeCommand=void 0,this._radianceMapFS=void 0,this._irradianceMapFS=void 0,this._convolveSP=void 0,this._va=void 0,this._radianceMapTextures=new Array(6),this._specularMapTextures=new Array((t-1)*6),this._radianceCubeMap=void 0,this._irradianceMapTexture=void 0,this._sphericalHarmonicCoefficients=$n.DEFAULT_SPHERICAL_HARMONIC_COEFFICIENTS.slice(),this._lastTime=new ee;let n=Math.pow(2,t-1);this._textureDimensions=new D(n,n),this._radiiAndDynamicAtmosphereColor=new m,this._sceneEnvironmentMap=void 0,this._backgroundColor=void 0,this._owner=void 0,this.enabled=e.enabled??!0,this.shouldUpdate=!0,this.maximumSecondsDifference=e.maximumSecondsDifference??60*60,this.maximumPositionEpsilon=e.maximumPositionEpsilon??1e3,this.atmosphereScatteringIntensity=e.atmosphereScatteringIntensity??2,this.gamma=e.gamma??1,this.brightness=e.brightness??1,this.saturation=e.saturation??1,this.groundColor=e.groundColor??$n.AVERAGE_EARTH_GROUND_COLOR,this.groundAlbedo=e.groundAlbedo??.31}Object.defineProperties($n.prototype,{owner:{get:function(){return this._owner}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},position:{get:function(){return this._position},set:function(e){m.equalsEpsilon(e,this._position,0,this.maximumPositionEpsilon)||(this._position=m.clone(e,this._position),this._shouldReset=!0)}},radianceCubeMap:{get:function(){return this._radianceCubeMap}},maximumMipmapLevel:{get:function(){return this._mipmapLevels}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}}});$n._maximumComputeCommandCount=8;$n._activeComputeCommandCount=0;$n._nextFrameCommandQueue=[];$n._queueCommand=(e,t)=>{if($n._activeComputeCommandCount>=$n._maximumComputeCommandCount){$n._nextFrameCommandQueue.push(e);return}t.commandList.push(e),$n._activeComputeCommandCount++};$n._updateCommandQueue=e=>{if($n._maximumComputeCommandCount=Math.log2(mt.maximumCubeMapSize),$n._nextFrameCommandQueue.length>0&&$n._activeComputeCommandCount<$n._maximumComputeCommandCount){let t=$n._nextFrameCommandQueue.shift();for(;c(t)&&$n._activeComputeCommandCount<$n._maximumComputeCommandCount;){if(t.owner.isDestroyed()||t.canceled){t=$n._nextFrameCommandQueue.shift();continue}e.commandList.push(t),$n._activeComputeCommandCount++,t=$n._nextFrameCommandQueue.shift()}c(t)&&$n._nextFrameCommandQueue.push(t)}};$n.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),c(e))){if(c(e._owner))throw new L("DynamicEnvironmentMapManager should only be assigned to one object");e._owner=t,t[n]=e}};$n.prototype.reset=function(){let e=this._radianceMapComputeCommands.length;for(let t=0;t<e;++t)c(this._radianceMapComputeCommands[t])&&(this._radianceMapComputeCommands[t].canceled=!0),this._radianceMapComputeCommands[t]=void 0;e=this._convolutionComputeCommands.length;for(let t=0;t<e;++t)c(this._convolutionComputeCommands[t])&&(this._convolutionComputeCommands[t].canceled=!0),this._convolutionComputeCommands[t]=void 0;c(this._irradianceComputeCommand)&&(this._irradianceComputeCommand.canceled=!0,this._irradianceComputeCommand=void 0),this._radianceMapDirty=!0,this._radianceCommandsDirty=!0,this._convolutionsCommandsDirty=!1,this._irradianceCommandDirty=!1};var Cke=new m,Vke=new m;function Lke(e,t){let n=e._position,i=t.atmosphere,o=t.mapProjection.ellipsoid,r=o.scaleToGeodeticSurface(n,Vke),s=1.025,a=Cke,l=c(r)?m.magnitude(r):o.maximumRadius;return a.x=l*s,a.y=l,a.z=i.dynamicLighting,!m.equalsEpsilon(e._radiiAndDynamicAtmosphereColor,a)||t.environmentMap!==e._sceneEnvironmentMap||t.backgroundColor!==e._backgroundC
uniform sampler2D u_pointCloud_depthGBuffer;
uniform vec2 u_distanceAndEdlStrength;
in 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(texture(u_pointCloud_depthGBuffer, texCoord0));
float depthOrLogDepth1 = czm_unpackDepth(texture(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(texture(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 = texture(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;
out_FragColor = vec4(color);
gl_FragDepth = depthOrLogDepth;
}
`;function QC(){this._framebuffer=new hi({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(QC.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 zOe(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}var fz=new D;function KOe(e,t){let n=new Be({defines:["LOG_DEPTH_WRITE"],sources:[DI]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return fz.x=e._radius,fz.y=e._strength,fz}},o=Oe.fromCache({blending:un.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:kt.setCesium3DTileBit(),stencilMask:kt.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:Xe.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ti({framebuffer:e.framebuffer,color:new Y(0,0,0,0),depth:1,renderState:Oe.fromCache(),pass:Xe.CESIUM_3D_TILE,owner:e})}function JOe(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),KOe(e,t)}function Hse(e){return e.drawBuffers&&e.fragmentDepth}QC.isSupported=Hse;function QOe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!c(n)){let i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources.splice(0,0,`layout (location = 0) out vec4 out_FragData_0;
layout (location = 1) out vec4 out_FragData_1;`),o.sources=o.sources.map(function(r){return r=Be.replaceMain(r,"czm_point_cloud_post_process_main"),r=r.replaceAll(/out_FragColor/g,"out_FragData_0"),r}),o.sources.push(`void main()
{
czm_point_cloud_post_process_main();
#ifdef LOG_DEPTH
czm_writeLogDepth();
out_FragData_1 = czm_packDepth(gl_FragDepth);
#else
out_FragData_1 = czm_packDepth(gl_FragCoord.z);
#endif
}`),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}QC.prototype.update=function(e,t,n,i){if(!Hse(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,JOe(this,e.context);let o,r=e.commandList,s=r.length;for(o=t;o<s;++o){let d=r[o];if(d.primitiveType!==ve.POINTS||d.pass===Xe.TRANSLUCENT)continue;let u,f,p=d.derivedCommands.pointCloudProcessor;c(p)&&(u=p.command,f=p.originalShaderProgram),(!c(u)||d.dirty||f!==d.shaderProgram||u.framebuffer!==this.framebuffer)&&(u=et.shallowClone(d,u),u.framebuffer=this.framebuffer,u.shaderProgram=QOe(e.context,d.shaderProgram),u.castShadows=!1,u.receiveShadows=!1,c(p)||(p={command:u,originalShaderProgram:d.shaderProgram},d.derivedCommands.pointCloudProcessor=p),p.originalShaderProgram=d.shaderProgram),r[o]=u}let a=this._clearCommand,l=this._drawCommand;l.boundingVolume=i,r.push(l),r.push(a)};QC.prototype.isDestroyed=function(){return!1};QC.prototype.destroy=function(){return zOe(this),he(this)};var lb=QC;function zse(e){let t=e??{};this.attenuation=t.attenuation??!1,this.geometricErrorScale=t.geometricErrorScale??1,this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=t.eyeDomeLighting??!0,this.eyeDomeLightingStrength=t.eyeDomeLightingStrength??1,this.eyeDomeLightingRadius=t.eyeDomeLightingRadius??1,this.backFaceCulling=t.backFaceCulling??!1,this.normalShading=t.normalShading??!0}zse.isSupported=function(e){return lb.isSupported(e.context)};var Vh=zse;var HLn=_(T(),1);var Ma={},jOe=new ce(0,0,0,1),xc=new ce,qOe=new je,hz=new D,pz=new D;Ma.worldToWindowCoordinates=function(e,t,n){return Ma.worldWithEyeOffsetToWindowCoordinates(e,t,m.ZERO,n)};var Kse=new ce,Jse=new m;function BI(e,t,n,i){let o=n.viewMatrix,r=M.multiplyByVector(o,ce.fromElements(e.x,e.y,e.z,1,Kse),Kse),s=m.multiplyComponents(t,m.normalize(r,Jse),Jse);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,M.multiplyByVector(n.frustum.projectionMatrix,r,i)}var $Oe=new pe(Math.PI,w.PI_OVER_TWO),eDe=new m,tDe=new m;Ma.worldWithEyeOffsetToWindowCoordinates=function(e,t,n,i){if(!c(e))throw new L("scene is required.");if(!c(t))throw new L("position is required.");let o=e.frameState,r=Ma.computeActualEllipsoidPosition(o,t,jOe);if(!c(r))return;let s=e.canvas,a=qOe;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;let l=e.camera,d=!1;if(o.mode===se.SCENE2D){let u=e.mapProjection,f=$Oe,p=u.project(f,eDe),y=m.clone(l.position,tDe),h=l.frustum.clone(),g=M.computeViewportTransformation(a,0,1,new M),x=l.frustum.projectionMatrix,S=l.positionWC.y,V=m.fromElements(w.sign(S)*p.x-S,0,-l.positionWC.x),Z=wt.pointToGLWindowCoordinates(x,g,V);if(S===0||Z.x<=0||Z.x>=s.clientWidth)d=!0;else{if(Z.x>s.clientWidth*.5){a.width=Z.x,l.frustum.right=p.x-S,xc=BI(r,n,l,xc),Ma.clipToGLWindowCoordinates(a,xc,hz),a.x+=Z.x,l.position.x=-l.position.x;let R=l.frustum.right;l.frustum.right=-l.frustum.left,l.frustum.left=-R,xc=BI(r,n,l,xc),Ma.clipToGLWindowCoordinates(a,xc,pz)}else{a.x+=Z.x,a.width-=Z.x,l.frustum.left=-p.x-S,xc=BI(r,n,l,xc),Ma.clipToGLWindowCoordinates(a,xc,hz),a.x=a.x-a.width,l.position.x=-l.position.x;let R=l.frustum.left;l.frustum.left=-l.frustum.right,l.frustum.right=-R,xc=BI(r,n,l,xc),Ma.clipToGLWindowCoordinates(a,xc,pz)}m.clone(y,l.position),l.frustum=h.clone(),i=D.clone(hz,i),(i.x<0||i.x>s.clientWidth)&&(i.x=pz.x)}}if(o.mode!==se.SCENE2D||d){if(xc=BI(r,n,l,xc),xc.z<0&&!(l.frustum instanceof sn)&&!(l.frustum instanceof Oo))return;i=Ma.clipToGLWindowCoordinates(a,xc,i)}return i.y=s.clientHeight-i.y,i};Ma.worldToDrawingBufferCoordinates=function(e,t,n){if(n=Ma.worldToWindowCoordinates(e,t,n),!!c(n))return Ma.transformWindowToDrawingBuffer(e,n,n)};var db=new m,nDe=new pe;Ma.computeActualEllipsoidPosition=function(e,t,n){let i=e.mode;if(i===se.SCENE3D)return m.clone(t,n);let o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,nDe);if(!c(r))return;if(o.project(r,db),i===se.COLUMBUS_VIEW)return m.fromElements(db.z,db.x,db.y,n);if(i===se.SCENE2D)ret
vec2 p = abs(pos);
vec2 inverseRadii = 1.0 / radii;
vec2 evoluteScale = (radii.x * radii.x - radii.y * radii.y) * vec2(1.0, -1.0) * inverseRadii;
vec2 tTrigs = vec2(0.70710678118);
vec2 v = radii * tTrigs;
vec2 evolute = evoluteScale * tTrigs * tTrigs * tTrigs;
vec2 q = normalize(p - evolute) * length(v - evolute);
tTrigs = (q + evolute) * inverseRadii;
tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));
v = radii * tTrigs;
return v * sign(pos);
}
vec3 computeEllipsoidPositionWC(vec3 positionMC) {
vec3 positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
vec2 positionEllipse = vec2(length(positionWC.xy), positionWC.z);
vec2 nearestPoint = nearestPointOnEllipseFast(positionEllipse, czm_ellipsoidRadii.xz);
return vec3(nearestPoint.x * normalize(positionWC.xy), nearestPoint.y);
}
void applyFog(inout vec4 color, vec4 groundAtmosphereColor, vec3 lightDirection, float distanceToCamera) {
vec3 fogColor = groundAtmosphereColor.rgb;
const float NONE = 0.0;
if (czm_atmosphereDynamicLighting != NONE) {
float darken = clamp(dot(normalize(czm_viewerPositionWC), lightDirection), czm_fogMinimumBrightness, 1.0);
fogColor *= darken;
}
#ifndef HDR
fogColor.rgb = czm_pbrNeutralTonemapping(fogColor.rgb);
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
#endif
vec3 withFog = czm_fog(distanceToCamera, color.rgb, fogColor, czm_fogVisualDensityScalar);
color = vec4(withFog, color.a);
}
void atmosphereStage(inout vec4 color, in ProcessedAttributes attributes) {
vec3 rayleighColor;
vec3 mieColor;
float opacity;
vec3 positionWC;
vec3 lightDirection;
if (false) {
positionWC = computeEllipsoidPositionWC(attributes.positionMC);
lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);
czm_computeGroundAtmosphereScattering(
positionWC,
lightDirection,
rayleighColor,
mieColor,
opacity
);
} else {
positionWC = attributes.positionWC;
lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);
rayleighColor = v_atmosphereRayleighColor;
mieColor = v_atmosphereMieColor;
opacity = v_atmosphereOpacity;
}
const bool ignoreBlackPixels = true;
rayleighColor = czm_applyHSBShift(rayleighColor, czm_atmosphereHsbShift, ignoreBlackPixels);
mieColor = czm_applyHSBShift(mieColor, czm_atmosphereHsbShift, ignoreBlackPixels);
vec4 groundAtmosphereColor = czm_computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
if (u_isInFog) {
float distanceToCamera = length(attributes.positionEC);
applyFog(color, groundAtmosphereColor, lightDirection, distanceToCamera);
} else {
}
}
`;var eXn=_(T(),1),lW=`void atmosphereStage(ProcessedAttributes attributes) {
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_positionWC, czm_atmosphereDynamicLighting);
czm_computeGroundAtmosphereScattering(
v_positionWC,
lightDirection,
v_atmosphereRayleighColor,
v_atmosphereMieColor,
v_atmosphereOpacity
);
}
`;var hae={name:"AtmospherePipelineStage"};hae.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_ATMOSPHERE",void 0,xe.BOTH),i.addDefine("COMPUTE_POSITION_WC_ATMOSPHERE",void 0,xe.BOTH),i.addVarying("vec3","v_atmosphereRayleighColor"),i.addVarying("vec3","v_atmosphereMieColor"),i.addVarying("float","v_atmosphereOpacity"),i.addVertexLines([lW]),i.addFragmentLines([cW]),i.addUniform("bool","u_isInFog",xe.FRAGMENT),e.uniformMap.u_isInFog=function(){let o=m.distance(n.camera.positionWC,t.boundingSphere.center);return w.fog(o,n.fog.density)>w.EPSILON3}};var dW=hae;var yXn=_(T(),1);var lXn=_(T(),1),uW=`#ifdef DIFFUSE_IBL
vec3 sampleDiffuseEnvironment(vec3 cubeDir)
{
#ifdef CUSTOM_SPHERICAL_HARMONICS
return czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients);
#else
return czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);
#endif
}
#endif
#ifdef SPECULAR_IBL
vec3 sampleSpecularEnvironment(vec3 cubeDir, float roughness)
{
#ifdef CUSTOM_SPECULAR_IBL
float lod = roughness * model_specularEnvironmentMapsMaximumLOD;
return czm_textureCube(model_specularEnvironmentMaps, cubeDir, lod).rgb;
#else
float lod = roughness * czm_specularEnvironmentMapsMaximumLOD;
return czm_textureCube(czm_specularEnvironmentMaps, cubeDir, lod).rgb;
#endif
}
vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, vec3 f0, float roughness)
{
vec3 f90 = max(vec3(1.0 - roughness), f0);
vec3 F = fresnelSchlick2(f0, f90, NdotV);
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
vec3 specularSample = sampleSpecularEnvironment(cubeDir, roughness);
return specularSample * (F * brdfLut.x + brdfLut.y);
}
#endif
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
vec3 textureIBL(vec3 viewDirectionEC, vec3 normalEC, czm_modelMaterial material) {
vec3 f0 = material.specular;
float roughness = material.roughness;
float specularWeight = 1.0;
#ifdef USE_SPECULAR
specularWeight = material.specularWeight;
#endif
float NdotV = clamp(dot(normalEC, viewDirectionEC), 0.0, 1.0);
vec3 f90 = max(vec3(1.0 - roughness), f0);
vec3 singleScatterFresnel = fresnelSchlick2(f0, f90, NdotV);
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
vec3 FssEss = specularWeight * (singleScatterFresnel * brdfLut.x + brdfLut.y);
#ifdef DIFFUSE_IBL
vec3 normalMC = normalize(model_iblReferenceFrameMatrix * normalEC);
vec3 irradiance = sampleDiffuseEnvironment(normalMC);
vec3 averageFresnel = f0 + (1.0 - f0) / 21.0;
float Ems = specularWeight * (1.0 - brdfLut.x - brdfLut.y);
vec3 FmsEms = FssEss * averageFresnel * Ems / (1.0 - averageFresnel * Ems);
vec3 dielectricScattering = (1.0 - FssEss - FmsEms) * material.diffuse;
vec3 diffuseContribution = irradiance * (FmsEms + dielectricScattering) * model_iblFactor.x;
#else
vec3 diffuseContribution = vec3(0.0);
#endif
#ifdef USE_ANISOTROPY
vec3 anisotropyDirection = material.anisotropicB;
vec3 anisotropicTangent = cross(anisotropyDirection, viewDirectionEC);
vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);
float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - roughness);
float bendFactorPow4 = bendFactor * bendFactor * bendFactor * bendFactor;
vec3 bentNormal = normalize(mix(anisotropicNormal, normalEC, bendFactorPow4));
vec3 reflectEC = reflect(-viewDirectionEC, bentNormal);
#else
vec3 reflectEC = reflect(-viewDirectionEC, normalEC);
#endif
#ifdef SPECULAR_IBL
vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflectEC);
vec3 radiance = sampleSpecularEnvironment(reflectMC, roughness);
vec3 specularContribution = radiance * FssEss * model_iblFactor.y;
#else
vec3 specularContribution = vec3(0.0);
#endif
return diffuseContribution + specularContribution;
}
#endif
`;var pae={name:"ImageBasedLightingPipelineStage"},JDe=new D;pae.process=function(e,t,n){let i=t.imageBasedLighting,o=t.environmentMapManager,r=e.shaderBuilder,s;c(i.specularEnvironmentMaps)||(s=o.radianceCubeMap);let a=i.sphericalHarmonicCoefficients??o.sphericalHarmonicCoefficients;r.addDefine("USE_IBL_LIGHTING",void 0,xe.FRAGMENT),r.addUniform("vec2","model_iblFactor",xe.FRAGMENT),Bm.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&r.addUniform("mat3","model_iblReferenceFrameMatrix",xe.FRAGMENT),c(s)&&r.addDefine("COMPUTE_POSITION_WC_ATMOSPHERE",void 0,xe.BOTH),c(a)&&c(a[0])?(r.addDefine("DIFFUSE_IBL",void 0,xe.FRAGMENT),r.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,xe.FRAGMENT),r.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",xe.FRAGMENT)):i.useDefaultSphericalHarmonics&&r.addDefine("DIFFUSE_IBL",void 0,xe.FRAGMENT),c(i.specularEnvironmentCubeMap)&&i.specularEnvironmentCubeMap.ready||c(s)?(r.addDefine("SPECULAR_IBL",void 0,xe.FRAGMENT),r.addDefine("CUSTOM_SPECULAR_IBL",void 0,xe.FRAGMENT),r.addUniform("samplerCube","model_specularEnvironmentMaps",xe.FRAGMENT),r.addUniform("float","model_specularEnvironmentMapsMaximumLOD",xe.FRAGMENT)):t.useDefaultSpecularMaps&&r.addDefine("SPECULAR_IBL",void 0,xe.FRAGMENT)),r.addFragmentLines(uW);let l={model_iblFactor:function(){return D.multiplyByScalar(i.imageBasedLightingFactor,o?.intensity||1,JDe)},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_sphericalHarmonicCoefficients:function(){return a},model_specularEnvironmentMaps:function(){return i.specularEnvironmentCubeMap.texture},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentCubeMap.maximumMipmapLevel}};c(s)&&(l.model_specularEnvironmentMaps=function(){return s},l.model_specularEnvironmentMapsMaximumLOD=function(){return o.maximumMipmapLevel}),e.uniformMap=St(l,e.uniformMap)};var mW=pae;var wXn=_(T(),1);var ZXn=_(T(),1);var QDe=w.EPSILON16;function Cz(e){e=e??z.EMPTY_OBJECT;let t=e.stage,n=e.runtimeArticulation;C.typeOf.object("options.stage",t),C.typeOf.object("options.runtimeArticulation",n),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(Cz.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){C.typeOf.number("value",e),e=w.clamp(e,this.minimumValue,this.maximumValue),w.equalsEpsilon(this._currentValue,e,QDe)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});var jDe=new m,Sz=new te;Cz.prototype.applyStageToMatrix=function(e){C.typeOf.object("result",e);let t=this.type,n=this.currentValue,i=jDe,o;switch(t){case yc.XROTATE:o=te.fromRotationX(w.toRadians(n),Sz),e=M.multiplyByMatrix3(e,o,e);break;case yc.YROTATE:o=te.fromRotationY(w.toRadians(n),Sz),e=M.multiplyByMatrix3(e,o,e);break;case yc.ZROTATE:o=te.fromRotationZ(w.toRadians(n),Sz),e=M.multiplyByMatrix3(e,o,e);break;case yc.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=M.multiplyByTranslation(e,i,e);break;case yc.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=M.multiplyByTranslation(e,i,e);break;case yc.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=M.multiplyByTranslation(e,i,e);break;case yc.XSCALE:i.x=n,i.y=1,i.z=1,e=M.multiplyByScale(e,i,e);break;case yc.YSCALE:i.x=1,i.y=n,i.z=1,e=M.multiplyByScale(e,i,e);break;case yc.ZSCALE:i.x=1,i.y=1,i.z=n,e=M.multiplyByScale(e,i,e);break;case yc.UNIFORMSCALE:e=M.multiplyByUniformScale(e,n,e);break;default:break}return e};var fW=Cz;function sk(e){e=e??z.EMPTY_OBJECT;let t=e.articulation,n=e.sceneGraph;C.typeOf.object("options.articulation",t),C.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages
{
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 s1={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};s1.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,xe.FRAGMENT),i.addFragmentLines(pW);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=Xe.TRANSLUCENT),i.addUniform("vec4",s1.COLOR_UNIFORM_NAME,xe.FRAGMENT),o[s1.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",s1.COLOR_BLEND_UNIFORM_NAME,xe.FRAGMENT),o[s1.COLOR_BLEND_UNIFORM_NAME]=function(){return bc.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=St(o,e.uniformMap)};var Ey=s1;var qXn=_(T(),1);var BXn=_(T(),1),bW=`#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 = texture(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 = texture(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(texture(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 bae={name:"ModelClippingPlanesPipelineStage"},tBe=new D;bae.process=function(e,t,n){let i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,xe.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,xe.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,xe.FRAGMENT),hs.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,xe.FRAGMENT);let s=hs.getTextureResolution(i,o,tBe);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,xe.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,xe.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",xe.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",xe.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",xe.FRAGMENT),r.addFragmentLines(bW);let a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){let l=Y.clone(i.edgeColor);return l.alpha=i.edgeWidth,l},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=St(a,e.uniformMap)};var yW=bae;var cIn=_(T(),1);var eIn=_(T(),1),gW=`void modelClippingPolygonsStage(ProcessedAttributes attributes)
{
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(v_positionWC);
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
vec2 minDistance = vec2(czm_infinity);
v_regionIndex = -1;
v_clippingPosition = vec2(czm_infinity);
for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {
vec4 extents = czm_unpackClippingExtents(model_clippingExtents, regionIndex);
vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;
vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));
vec2 distance = abs(rectUv - clamped) * extents.wz;
if (minDistance.x > distance.x || minDistance.y > distance.y) {
minDistance = distance;
v_clippingPosition = rectUv;
}
float threshold = 0.01;
if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {
v_regionIndex = regionIndex;
}
}
}
`;var nIn=_(T(),1),xW=`void modelClippingPolygonsStage()
{
vec2 clippingPosition = v_clippingPosition;
int regionIndex = v_regionIndex;
czm_clipPolygons(model_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);
}
`;var yae={name:"ModelClippingPolygonsPipelineStage"};yae.process=function(e,t,n){let i=t.clippingPolygons,o=e.shaderBuilder;o.addDefine("ENABLE_CLIPPING_POLYGONS",void 0,xe.BOTH),i.inverse&&o.addDefine("CLIPPING_INVERSE",void 0,xe.FRAGMENT),o.addDefine("CLIPPING_POLYGON_REGIONS_LENGTH",i.extentsCount,xe.BOTH),o.addUniform("sampler2D","model_clippingDistance",xe.FRAGMENT),o.addUniform("sampler2D","model_clippingExtents",xe.VERTEX),o.addVarying("vec2","v_clippingPosition"),o.addVarying("int","v_regionIndex","flat"),o.addVertexLines(gW),o.addFragmentLines(xW);let r={model_clippingDistance:function(){return i.clippingTexture},model_clippingExtents:function(){return i.extentsTexture}};e.uniformMap=St(r,e.uniformMap)};var _W=yae;var mIn=_(T(),1);function gae(e,t){C.typeOf.object("model",e),C.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(gae.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){c(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 TW=gae;var aWn=_(T(),1);var kIn=_(T(),1);var hIn=_(T(),1),SW=`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 bIn=_(T(),1),CW=`void instancingStage(inout ProcessedAttributes attributes)
{
vec3 positionMC = attributes.positionMC;
mat4 instancingTransform = getInstancingTransform();
attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;
#ifdef HAS_NORMALS
vec3 normalMC = attributes.normalMC;
attributes.normalMC = (instancingTransform * vec4(normalMC, 0.0)).xyz;
#endif
#ifdef USE_2D_INSTANCING
mat4 instancingTransform2D = getInstancingTransform2D();
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
#endif
}
`;var gIn=_(T(),1),VW=`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 ak=new M,nBe=new M,iBe=new M,_ae={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:Lae,_transformsToTypedArray:Lz};_ae.process=function(e,t,n){let i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(SW);let s=e.model,a=s.sceneGraph,l=e.runtimeNode,d=n.mode!==se.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,u=s._enablePick&&!n.context.webgl2,f=[];gBe(e,n,i,f,d,u),TBe(e,n,i,f);let p={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,xe.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",xe.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",xe.VERTEX),p.u_instance_modifiedModelView=function(){let y=M.multiplyTransformation(s.modelMatrix,a.components.transform,ak);return d?M.multiplyTransformation(n.context.uniformState.view3D,y,ak):(n.mode!==se.SCENE3D&&(y=wt.basisTo2D(n.mapProjection,y,ak)),M.multiplyTransformation(n.context.uniformState.view,y,ak))},p.u_instance_nodeTransform=function(){return M.multiplyTransformation(a.axisCorrectionMatrix,l.computedTransform,nBe)},r.addVertexLines(VW)):r.addVertexLines(CW),d){r.addDefine("USE_2D_INSTANCING",void 0,xe.VERTEX),r.addUniform("mat4","u_modelView2D",xe.VERTEX);let y=n.context,h=M.fromTranslation(l.instancingReferencePoint2D,new M);p.u_modelView2D=function(){return M.multiplyTransformation(y.uniformState.view,h,iBe)}}e.uniformMap=St(p,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,f)};var LW=new M,oBe=new m;function rBe(e,t,n,i,o){let r=M.multiplyTransformation(t,e,LW);return r=M.multiplyTransformation(r,n,LW),o=wt.basisTo2D(i.mapProjection,r,o),o}function sBe(e,t,n,i,o){let r=M.fromTranslation(e,LW),s=M.multiplyTransformation(t,r,LW);s=M.multiplyTransformation(s,n,LW);let a=M.getTranslation(s,oBe);return o=Oi.computeActualEllipsoidPosition(i,a,o),o}function Tae(e,t,n){let i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=M.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=M.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=M.clone(o.computedModelMatrix,t),t=M.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=M.clone(M.IDENTITY,n))}var Sae=new M,Cae=new M,aBe=new M,cBe=new m;function lBe(e,t,n,i){let o=Sae,r=Cae;Tae(t,o,r);let a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let d=0;d<l;d++){let u=e[d],f=rBe(u,o,r,n,aBe),p=M.getTranslation(f,cBe),y=m.subtract(p,a,p);i[d]=M.setTranslation(f,y,i[d])}return i}function dBe(e,t,n,i){let o=Sae,r=Cae;Tae(t,o,r);let a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let d=0;d<l;d++){let u=e[d],f=sBe(u,o,r,n,u);i[d]=m.subtract(f,a,i[d])}return i}var uBe=new m,mBe=new m;function Vae(e,t){let n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=M.multiplyByPoint(i,n.instancingTranslationMin,uBe),r=Oi.computeActualEllipsoidPosition(t,o,o),s=M.multiplyByPoint(i,n.instancingTranslationMax,mBe),a=Oi.computeActualEllipsoidPosition(t,s,s);n.instancingReferencePoint2D=m.lerp(r,a,.5,new m)}function Lz(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 fBe(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 hBe=new m,pBe=new Fe,bBe=new m;function Lae(e,t,n){let i=new Array(t),o=qt.getAttributeBySemantic(e,ns.TRANSLATION),r=qt.getAttributeBySemantic(e,ns.ROTATION),s=qt.getAttributeBySemantic(e,ns.SCALE),a=new m(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),l=new m(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),d=c(o),u=c(r),f=c(s),p=d?o.typedArray:new Float32Array(t*3),y=u?r.typedArray:new Float32Array(t*4);u&&r.normalized&&(y=Fn.dequantize(y,r.componentDatatype,r.type,t));let h;f?h=s.typedArray:(h=new Float32Array(t*3),h.fill(1));for(let x=0;x<t;x++){let S=new m(p[x*3],p[x*3+1],p[x*3+2],hBe);m.maximumByComponent(a,S,a),m.minimumBy
{
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;
#if defined(HAS_SELECTED_FEATURE_ID_ATTRIBUTE) && !defined(HAS_CLASSIFICATION)
filterByPassType(positionMC, feature.color);
#endif
}
`;var RWn=_(T(),1),PW=`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;
}
#if defined(HAS_SELECTED_FEATURE_ID_TEXTURE) && !defined(HAS_CLASSIFICATION)
filterByPassType(featureColor);
#endif
featureColor = czm_gammaCorrect(featureColor);
#ifdef HAS_CLASSIFICATION
material.diffuse = featureColor.rgb * featureColor.a;
#else
float highlight = ceil(model_colorBlend);
material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);
#endif
material.alpha *= featureColor.a;
}
`;var wae={name:"CPUStylingPipelineStage"};wae.process=function(e,t,n){let i=e.model,o=e.shaderBuilder;o.addVertexLines(wW),o.addFragmentLines(PW),o.addDefine("USE_CPU_STYLING",void 0,xe.BOTH),c(i.color)||(o.addUniform("float",Ey.COLOR_BLEND_UNIFORM_NAME,xe.FRAGMENT),e.uniformMap[Ey.COLOR_BLEND_UNIFORM_NAME]=function(){return bc.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",xe.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===Xe.TRANSLUCENT}};var vW=wae;var MWn=_(T(),1),Pae={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};Pae.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};var bb=Object.freeze(Pae);var Pwn=_(T(),1);var kWn=_(T(),1),FW=`void customShaderStage(
inout czm_modelVertexOutput vsOutput,
inout ProcessedAttributes attributes,
FeatureIds featureIds,
Metadata metadata,
MetadataClass metadataClass,
MetadataStatistics metadataStatistics
) {
VertexInput vsInput;
initializeInputStruct(vsInput, attributes);
vsInput.featureIds = featureIds;
vsInput.metadata = metadata;
vsInput.metadataClass = metadataClass;
vsInput.metadataStatistics = metadataStatistics;
vertexMain(vsInput, vsOutput);
attributes.positionMC = vsOutput.positionMC;
}
`;var OWn=_(T(),1),AW=`void customShaderStage(
inout czm_modelMaterial material,
ProcessedAttributes attributes,
FeatureIds featureIds,
Metadata metadata,
MetadataClass metadataClass,
MetadataStatistics metadataStatistics
) {
FragmentInput fsInput;
initializeInputStruct(fsInput, attributes);
fsInput.featureIds = featureIds;
fsInput.metadata = metadata;
fsInput.metadataClass = metadataClass;
fsInput.metadataStatistics = metadataStatistics;
fragmentMain(fsInput, material);
}
`;var rwn=_(T(),1);var BWn=_(T(),1),MW=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
}
`;var HWn=_(T(),1),NW=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
{
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
setFeatureIdVaryings();
}
`;var Di={name:"FeatureIdPipelineStage",STRUCT_ID_FEATURE_IDS_VS:"FeatureIdsVS",STRUCT_ID_FEATURE_IDS_FS:"FeatureIdsFS",STRUCT_NAME_FEATURE_IDS:"FeatureIds",FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS:"initializeFeatureIdsVS",FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS:"initializeFeatureIdsFS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS:"initializeFeatureIdAliasesVS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS:"initializeFeatureIdAliasesFS",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS:"void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES:"void initializeFeatureIdAliases(inout FeatureIds featureIds)",FUNCTION_ID_SET_FEATURE_ID_VARYINGS:"setFeatureIdVaryings",FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS:"void setFeatureIdVaryings()"};Di.process=function(e,t,n){let i=e.shaderBuilder;LBe(i);let o=e.runtimeNode.node.instances;c(o)&&ZBe(e,o,n),RBe(e,t,n),i.addVertexLines(NW),i.addFragmentLines(MW)};function LBe(e){e.addStruct(Di.STRUCT_ID_FEATURE_IDS_VS,Di.STRUCT_NAME_FEATURE_IDS,xe.VERTEX),e.addStruct(Di.STRUCT_ID_FEATURE_IDS_FS,Di.STRUCT_NAME_FEATURE_IDS,xe.FRAGMENT),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,xe.VERTEX),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,xe.FRAGMENT),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,xe.VERTEX),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,xe.FRAGMENT),e.addFunction(Di.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,Di.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,xe.VERTEX)}function ZBe(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 Cn.FeatureIdAttribute?GBe(e,s,a):vae(e,s,a,o,1,n);let l=s.label;c(l)&&Fae(e,a,l,xe.BOTH)}}function RBe(e,t,n){let i=t.featureIds,r=qt.getAttributeBySemantic(t,pt.POSITION).count;for(let s=0;s<i.length;s++){let a=i[s],l=a.positionalLabel,d=xe.BOTH;a instanceof Cn.FeatureIdAttribute?EBe(e,a,l):a instanceof Cn.FeatureIdImplicitRange?vae(e,a,l,r,void 0,n):(XBe(e,a,l,s,n),d=xe.FRAGMENT);let u=a.label;c(u)&&Fae(e,l,u,d)}}function GBe(e,t,n){let i=e.shaderBuilder;i.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n);let o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,l=`featureIds.${n} = int(czm_round(${s}));`,d=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[l]),i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[d]),i.addVarying("float",a),i.addFunctionLines(Di.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function EBe(e,t,n){let i=e.shaderBuilder;i.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Di.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(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function vae(e,t,n,i,o,r){IBe(e,t,i,o,r);let s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);let l=`v_implicit_${n}`;s.addVarying("float",l),s.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(Di.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${l} = ${a};`]),s.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${l}));`])}function XBe(e,t,n,i,o){let r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return a.texture??o.context.defaultTexture};let l=a.channels,d=e.shaderBuilder;d.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n),d.addUniform("sampler2D",r,xe.FRAGMENT);let f=`v_texCoord_${a.texCoord}`,p=f,y=a.transform;if(c(y)&&
out Metadata metadata,
out MetadataClass metadataClass,
out MetadataStatistics metadataStatistics,
ProcessedAttributes attributes
)
{
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
}
`;var lwn=_(T(),1),UW=`void metadataStage(
out Metadata metadata,
out MetadataClass metadataClass,
out MetadataStatistics metadataStatistics,
ProcessedAttributes attributes
)
{
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
setMetadataVaryings();
}
`;var Gi={name:"MetadataPipelineStage",STRUCT_ID_METADATA_VS:"MetadataVS",STRUCT_ID_METADATA_FS:"MetadataFS",STRUCT_NAME_METADATA:"Metadata",STRUCT_ID_METADATA_CLASS_VS:"MetadataClassVS",STRUCT_ID_METADATA_CLASS_FS:"MetadataClassFS",STRUCT_NAME_METADATA_CLASS:"MetadataClass",STRUCT_ID_METADATA_STATISTICS_VS:"MetadataStatisticsVS",STRUCT_ID_METADATA_STATISTICS_FS:"MetadataStatisticsFS",STRUCT_NAME_METADATA_STATISTICS:"MetadataStatistics",FUNCTION_ID_INITIALIZE_METADATA_VS:"initializeMetadataVS",FUNCTION_ID_INITIALIZE_METADATA_FS:"initializeMetadataFS",FUNCTION_SIGNATURE_INITIALIZE_METADATA:"void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",FUNCTION_ID_SET_METADATA_VARYINGS:"setMetadataVaryings",FUNCTION_SIGNATURE_SET_METADATA_VARYINGS:"void setMetadataVaryings()",METADATA_CLASS_FIELDS:[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}],METADATA_STATISTICS_FIELDS:[{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"},{specName:"mean",shaderName:"mean",type:"float"},{specName:"median",shaderName:"median"},{specName:"standardDeviation",shaderName:"standardDeviation",type:"float"},{specName:"variance",shaderName:"variance",type:"float"},{specName:"sum",shaderName:"sum"}]};Gi.process=function(e,t,n){let{shaderBuilder:i,model:o}=e,{structuralMetadata:r={},content:s}=o,a=s?.tileset.metadataExtension?.statistics,l=wBe(r.propertyAttributes,t,a),d=vBe(r.propertyTextures,a),u=l.concat(d);ABe(i,u),kBe(i),i.addVertexLines(UW),i.addFragmentLines(kW);for(let f=0;f<l.length;f++){let p=l[f];UBe(e,p)}for(let f=0;f<d.length;f++){let p=d[f];DBe(e,p)}};function wBe(e,t,n){return c(e)?e.flatMap(i=>PBe(i,t,n)):[]}function PBe(e,t,n){let{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=qt,s=e.class.id,a=n?.classes[s],l=Object.entries(e.properties),d=new Array(l.length);for(let u=0;u<l.length;u++){let[f,p]=l[u],y=i(t,p.attribute),{glslType:h,variableName:g}=o(y);d[u]={metadataVariable:r(f),property:p,type:p.classProperty.type,glslType:h,variableName:g,propertyStatistics:a?.properties[f],shaderDestination:xe.BOTH}}return d}function vBe(e,t){return c(e)?e.flatMap(n=>FBe(n,t)):[]}function FBe(e,t){let{sanitizeGlslIdentifier:n}=qt,i=e.class.id,o=t?.classes[i],r=Object.entries(e.properties).filter(([a,l])=>l.isGpuCompatible()),s=new Array(r.length);for(let a=0;a<r.length;a++){let[l,d]=r[a];s[a]={metadataVariable:n(l),property:d,type:d.classProperty.type,glslType:d.getGlslType(),propertyStatistics:o?.properties[l],shaderDestination:xe.FRAGMENT}}return s}function ABe(e,t){let n=new Set,i=new Set;for(let a=0;a<t.length;a++){let{type:l,glslType:d,propertyStatistics:u}=t[a];n.add(d),c(u)&&l!==lt.ENUM&&i.add(d)}let o=Gi.METADATA_CLASS_FIELDS;for(let a of n){let l=`${a}MetadataClass`;s(l,a,o)}let r=Gi.METADATA_STATISTICS_FIELDS;for(let a of i){let l=`${a}MetadataStatistics`;s(l,a,r)}function s(a,l,d){e.addStruct(a,a,xe.BOTH);for(let u=0;u<d.length;u++){let{shaderName:f}=d[u],p=d[u].type==="float"?NBe(l):l;e.addStructField(a,p,f)}}}var MBe={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function NBe(e){let t=MBe[e];return c(t)?t:e}function kBe(e){e.addStruct(Gi.STRUCT_ID_METADATA_VS,Gi.STRUCT_NAME_METADATA,xe.VERTEX),e.addStruct(Gi.STRUCT_ID_METADATA_FS,Gi.STRUCT_NAME_METADATA,xe.FRAGMENT),e.addStruct(Gi.STRUCT_ID_METADATA_CLASS_VS,Gi.STRUCT_NAME_METADATA_CLASS,xe.VERTEX),e.addStruct(Gi.STRUCT_ID_METADATA_CLASS_FS,Gi.STRUCT_NAME_METADATA_CLASS,xe.FRAGMENT),e.addStruct(Gi.STRUCT_ID_METADATA_STATISTICS_VS,Gi.STRUCT_NAME_METADATA_STATISTICS,xe.VERTEX),e.addStruct(Gi.STRUCT_ID_METADATA_STATISTICS_FS,Gi.STRUCT_NAME_METADATA_STATISTICS,xe.FRAGMENT),e.addFunction(Gi.FUNCTION_ID_INITIALIZE_METADATA_VS,Gi.FUNCTION_SIGNATURE_INITIALIZE_METADATA,xe.VERTEX),e.addFunction(Gi.FUNCTION_ID_INITIALIZE_METADATA_FS,Gi.FUNCTION_SIGNATURE_INITIALIZE_METADATA,xe.FRAGMENT),e.addFunction(Gi.FUNCTION_ID_SET_METADATA_VARY
{
attributes.positionMC = v_positionMC;
attributes.positionEC = v_positionEC;
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE)
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 Ywn=_(T(),1),HW=`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) || defined(COMPUTE_POSITION_WC_ATMOSPHERE) || defined(ENABLE_CLIPPING_POLYGONS)
v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
#endif
#ifdef HAS_NORMALS
v_normalEC = normalize(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 ePn=_(T(),1);var zwn=_(T(),1),c1=`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 = texture(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 zW={name:"SelectedFeatureIdPipelineStage",STRUCT_ID_SELECTED_FEATURE:"SelectedFeature",STRUCT_NAME_SELECTED_FEATURE:"SelectedFeature"};zW.process=function(e,t,n){let i=e.shaderBuilder;e.hasPropertyTable=!0;let o=e.model,r=e.runtimeNode.node,s=c3e(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),l3e(i);let l=s.featureIds.nullFeatureId,d=e.uniformMap;c(l)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),d.model_nullFeatureId=function(){return l}),s.shaderDestination===xe.BOTH&&i.addVertexLines(c1),i.addFragmentLines(c1)};function Yae(e){return e instanceof Cn.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function Hae(e){return e instanceof Cn.FeatureIdTexture?xe.FRAGMENT:xe.BOTH}function c3e(e,t,n){let i,o;return c(t.instances)&&(o=qt.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),c(o))?(i=o.label??o.positionalLabel,{featureIds:o,variableName:i,shaderDestination:Hae(o),featureIdDefine:Yae(o)}):(o=qt.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=o.label??o.positionalLabel,{featureIds:o,variableName:i,shaderDestination:Hae(o),featureIdDefine:Yae(o)})}function l3e(e){e.addStructField(zW.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(zW.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(zW.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}var Wy=zW;var Bs={name:"GeometryPipelineStage",STRUCT_ID_PROCESSED_ATTRIBUTES_VS:"ProcessedAttributesVS",STRUCT_ID_PROCESSED_ATTRIBUTES_FS:"ProcessedAttributesFS",STRUCT_NAME_PROCESSED_ATTRIBUTES:"ProcessedAttributes",FUNCTION_ID_INITIALIZE_ATTRIBUTES:"initializeAttributes",FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES:"void initializeAttributes(out ProcessedAttributes attributes)",FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS:"setDynamicVaryingsVS",FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS:"setDynamicVaryingsFS",FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS:"void setDynamicVaryings(inout ProcessedAttributes attributes)"};Bs.process=function(e,t,n){let{shaderBuilder:i,model:o}=e;i.addStruct(Bs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",xe.VERTEX),i.addStruct(Bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",xe.FRAGMENT),i.addStruct(Wy.STRUCT_ID_SELECTED_FEATURE,Wy.STRUCT_NAME_SELECTED_FEATURE,xe.BOTH),i.addFunction(Bs.FUNCTION_ID_INITIALIZE_ATTRIBUTES,Bs.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,xe.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(Bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(Bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(Bs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,Bs.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,xe.VERTEX),i.addFunction(Bs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,Bs.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,xe.FRAGMENT),o.type===mr.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,xe.FRAGMENT);let r=n.mode!==se.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,s=c(e.runtimeNode.node.instances),a=r&&!s,l=t.attributes.length;for(let d=0;d<l;d++){let u=t.attributes[d],f=rn.getAttributeLocationCount(u.type);if(!c(u.buffer)&&!c(u.constant))throw new L("Attributes must be provided as a Buffer or constant value");let p=u.semantic===pt.POSITION,y;f>1?(y=e.attributeIndex,e.attributeIndex+=f):p&&!a?y=0:y=e.attributeIndex++,d3e(e,u,y,f,r,s)}x3e(i,t.attributes),t.primitiveType===ve.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(HW),i.addFragmentLines(YW)};function d3e(e,t,n,i,o,r){let s=e.shaderBuilder,a=qt.getAttributeInfo(t),l=o&&!r;i>1?f3e(e,t,n,i):m3e(e,t,n,l),p3e(s,a,l),h3e(s,a),c(t.semantic)&&u3e(s,t),b3e(s,a,o),y3e(s,a,l),g3e(s,a)}function u3e(e,t){let{semantic:n,setIndex:i}=t;switch(n){case pt.NORMAL:e.addDefine("HAS_NORMALS");break;case pt.TANGENT:e.addDefine("HAS_TANGENTS");break;case pt.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case pt.TEXCOORD:case pt.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function m3e(e,t,n,i){let{quantization:o,semanti
vec3 computeIBL(vec3 position, vec3 normal, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)
{
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
vec3 viewDirection = -normalize(position);
vec3 iblColor = textureIBL(viewDirection, normal, material);
return iblColor;
#endif
return vec3(0.0);
}
#endif
#ifdef USE_CLEARCOAT
vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)
{
vec3 viewDirection = -normalize(position);
vec3 halfwayDirection = normalize(viewDirection + lightDirection);
vec3 normal = material.clearcoatNormal;
float NdotL = clamp(dot(normal, lightDirection), 0.001, 1.0);
vec3 f0 = vec3(0.04);
vec3 f90 = vec3(1.0);
float NdotV = clamp(dot(normal, viewDirection), 0.0, 1.0);
vec3 F = fresnelSchlick2(f0, f90, NdotV);
float roughness = material.clearcoatRoughness;
float alphaRoughness = roughness * roughness;
float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, alphaRoughness);
vec3 directReflection = F * directStrength * NdotL;
vec3 color = lightColorHdr * directReflection;
#ifdef SPECULAR_IBL
vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflect(-viewDirection, normal));
vec3 iblColor = computeSpecularIBL(reflectMC, NdotV, f0, roughness);
color += iblColor * material.occlusion;
#endif
float clearcoatFactor = material.clearcoatFactor;
vec3 clearcoatColor = color * clearcoatFactor;
return baseLayerColor * (1.0 - clearcoatFactor * F) + clearcoatColor;
}
#endif
#if defined(LIGHTING_PBR) && defined(HAS_NORMALS)
vec3 computePbrLighting(in czm_modelMaterial material, in vec3 position)
{
#ifdef USE_CUSTOM_LIGHT_COLOR
vec3 lightColorHdr = model_lightColorHdr;
#else
vec3 lightColorHdr = czm_lightColorHdr;
#endif
vec3 viewDirection = -normalize(position);
vec3 normal = material.normalEC;
vec3 lightDirection = normalize(czm_lightDirectionEC);
vec3 directLighting = czm_pbrLighting(viewDirection, normal, lightDirection, material);
vec3 directColor = lightColorHdr * directLighting;
vec3 color = directColor + material.emissive;
#ifdef USE_IBL_LIGHTING
color += computeIBL(position, normal, lightDirection, lightColorHdr, material);
#endif
#ifdef USE_CLEARCOAT
color = addClearcoatReflection(color, position, lightDirection, lightColorHdr, material);
#endif
return color;
}
#endif
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
{
#ifdef LIGHTING_PBR
#ifdef HAS_NORMALS
vec3 color = computePbrLighting(material, attributes.positionEC);
#else
vec3 color = material.diffuse * material.occlusion + material.emissive;
#endif
#ifndef HDR
color = czm_pbrNeutralTonemapping(color);
#endif
#else // unlit
vec3 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 xPn=_(T(),1),_3e={UNLIT:0,PBR:1},Lh=Object.freeze(_3e);var zae={name:"LightingPipelineStage"};zae.process=function(e,t){let{model:n,lightingOptions:i,shaderBuilder:o}=e;if(c(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,xe.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",xe.FRAGMENT);let s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}let{lightingModel:r}=i;r===Lh.PBR?o.addDefine("LIGHTING_PBR",void 0,xe.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,xe.FRAGMENT),o.addFragmentLines(JW)};var QW=zae;var UPn=_(T(),1);var RPn=_(T(),1),jW=`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_NORMAL_TEXTURE
vec2 getNormalTexCoords()
{
vec2 texCoord = TEXCOORD_NORMAL;
#ifdef HAS_NORMAL_TEXTURE_TRANSFORM
texCoord = vec2(u_normalTextureTransform * vec3(texCoord, 1.0));
#endif
return texCoord;
}
#endif
#if defined(HAS_NORMAL_TEXTURE) || defined(HAS_CLEARCOAT_NORMAL_TEXTURE)
vec3 computeTangent(in vec3 position, in vec2 normalTexCoords)
{
vec2 tex_dx = dFdx(normalTexCoords);
vec2 tex_dy = dFdy(normalTexCoords);
float determinant = tex_dx.x * tex_dy.y - tex_dy.x * tex_dx.y;
vec3 tangent = tex_dy.t * dFdx(position) - tex_dx.t * dFdy(position);
return tangent / determinant;
}
#endif
#ifdef USE_ANISOTROPY
struct NormalInfo {
vec3 tangent;
vec3 bitangent;
vec3 normal;
vec3 geometryNormal;
};
NormalInfo getNormalInfo(ProcessedAttributes attributes)
{
vec3 geometryNormal = attributes.normalEC;
#ifdef HAS_NORMAL_TEXTURE
vec2 normalTexCoords = getNormalTexCoords();
#endif
#ifdef HAS_BITANGENTS
vec3 tangent = attributes.tangentEC;
vec3 bitangent = attributes.bitangentEC;
#else // Assume HAS_NORMAL_TEXTURE
vec3 tangent = computeTangent(attributes.positionEC, normalTexCoords);
tangent = normalize(tangent - geometryNormal * dot(geometryNormal, tangent));
vec3 bitangent = normalize(cross(geometryNormal, tangent));
#endif
#ifdef HAS_NORMAL_TEXTURE
mat3 tbn = mat3(tangent, bitangent, geometryNormal);
vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
normalSample = 2.0 * normalSample - 1.0;
#ifdef HAS_NORMAL_TEXTURE_SCALE
normalSample.xy *= u_normalTextureScale;
#endif
vec3 normal = normalize(tbn * normalSample);
#else
vec3 normal = geometryNormal;
#endif
#ifdef HAS_DOUBLE_SIDED_MATERIAL
if (czm_backFacing()) {
tangent *= -1.0;
bitangent *= -1.0;
normal *= -1.0;
geometryNormal *= -1.0;
}
#endif
NormalInfo normalInfo;
normalInfo.tangent = tangent;
normalInfo.bitangent = bitangent;
normalInfo.normal = normal;
normalInfo.geometryNormal = geometryNormal;
return normalInfo;
}
#endif
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
vec3 getNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
{
vec2 normalTexCoords = getNormalTexCoords();
#ifdef HAS_BITANGENTS
vec3 t = attributes.tangentEC;
vec3 b = attributes.bitangentEC;
#else
vec3 t = computeTangent(attributes.positionEC, normalTexCoords);
t = normalize(t - geometryNormal * dot(geometryNormal, t));
vec3 b = normalize(cross(geometryNormal, t));
#endif
mat3 tbn = mat3(t, b, geometryNormal);
vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
normalSample = 2.0 * normalSample - 1.0;
#ifdef HAS_NORMAL_TEXTURE_SCALE
normalSample.xy *= u_normalTextureScale;
#endif
return normalize(tbn * normalSample);
}
#endif
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
vec3 getClearcoatNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
{
vec2 normalTexCoords = TEXCOORD_CLEARCOAT_NORMAL;
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_TRANSFORM
normalTexCoords = vec2(u_clearcoatNormalTextureTransform * vec3(normalTexCoords, 1.0));
#endif
#ifdef HAS_BITANGENTS
vec3 t = attributes.tangentEC;
vec3 b = attributes.bitangentEC;
#else
vec3 t = computeTangent(attributes.positionEC, normalTexCoords);
t = normalize(t - geometryNormal * dot(geometryNormal, t));
vec3 b = normalize(cross(geometryNormal, t));
#endif
mat3 tbn = mat3(t, b, geometryNormal);
vec3 normalSample = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;
normalSample = 2.0 * normalSample - 1.0;
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_SCALE
normalSample.xy *= u_clearcoatNormalTextureScale;
#endif
return normalize(tbn * normalSample);
}
#endif
#ifdef HAS_NORMALS
vec3 computeNormal(ProcessedAttributes attributes)
{
vec3 normal = attributes.normalEC;
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
normal = getNormalFromTexture(attributes, normal);
#endif
#ifdef HAS_DOUBLE_SIDED_MATERIAL
if (czm_backFacing()) {
normal = -normal;
}
#endif
return normal;
}
#endif
#ifdef HAS_BASE_COLOR_TEXTURE
vec4 getBaseColorFromTexture()
{
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
#endif
vec4 baseColorWithAlpha = czm_srgbToLinear(texture(u_baseColorTexture, baseColorTexCoords));
#ifdef HAS_BASE_COLOR_FACTOR
baseColorWithAlpha *= u_baseColorFactor;
#endif
return baseColorWithAlpha;
}
#endif
#ifdef HAS_EMISSIVE_TEXTURE
vec3 getEmissiveFromTexture()
{
vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;
#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM
emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);
#endif
vec3 emissive = czm_srgbToLinear(texture(u_emissiveTexture, emissiveTexCoords).rgb);
#ifdef HAS_EMISSIVE_FACTOR
emissive *= u_emissiveFactor;
#endif
return emissive;
}
#endif
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
void setSpecularGlossiness(inout czm_modelMaterial material)
{
#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(texture(u_specularGlossinessTexture, specularGlossinessTexCoords));
vec3 specular = specularGlossiness.rgb;
float glossiness = specularGlossiness.a;
#ifdef HAS_LEGACY_SPECULAR_FACTOR
specular *= u_legacySpecularFactor;
#endif
#ifdef HAS_GLOSSINESS_FACTOR
glossiness *= u_glossinessFactor;
#endif
#else
#ifdef HAS_LEGACY_SPECULAR_FACTOR
vec3 specular = clamp(u_legacySpecularFactor, 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(texture(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
material.diffuse = diffuse.rgb * (1.0 - czm_maximumComponent(specular));
material.alpha = diffuse.a;
material.specular = specular;
material.roughness = 1.0 - glossiness;
}
#elif defined(LIGHTING_PBR)
float setMetallicRoughness(inout czm_modelMaterial material)
{
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE
vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM
metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);
#endif
vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
float roughness = clamp(metallicRoughness.g, 0.0, 1.0);
#ifdef HAS_METALLIC_FACTOR
metalness = clamp(metalness * u_metallicFactor, 0.0, 1.0);
#endif
#ifdef HAS_ROUGHNESS_FACTOR
roughness = clamp(roughness * u_roughnessFactor, 0.0, 1.0);
#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.0, 1.0);
#else
float roughness = 1.0;
#endif
#endif
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.baseColor.rgb, metalness);
material.specular = f0;
material.diffuse = mix(material.baseColor.rgb, vec3(0.0), metalness);
material.roughness = roughness;
return metalness;
}
#ifdef USE_SPECULAR
void setSpecular(inout czm_modelMaterial material, in float metalness)
{
#ifdef HAS_SPECULAR_TEXTURE
vec2 specularTexCoords = TEXCOORD_SPECULAR;
#ifdef HAS_SPECULAR_TEXTURE_TRANSFORM
specularTexCoords = computeTextureTransform(specularTexCoords, u_specularTextureTransform);
#endif
float specularWeight = texture(u_specularTexture, specularTexCoords).a;
#ifdef HAS_SPECULAR_FACTOR
specularWeight *= u_specularFactor;
#endif
#else
#ifdef HAS_SPECULAR_FACTOR
float specularWeight = u_specularFactor;
#else
float specularWeight = 1.0;
#endif
#endif
#ifdef HAS_SPECULAR_COLOR_TEXTURE
vec2 specularColorTexCoords = TEXCOORD_SPECULAR_COLOR;
#ifdef HAS_SPECULAR_COLOR_TEXTURE_TRANSFORM
specularColorTexCoords = computeTextureTransform(specularColorTexCoords, u_specularColorTextureTransform);
#endif
vec3 specularColorSample = texture(u_specularColorTexture, specularColorTexCoords).rgb;
vec3 specularColorFactor = czm_srgbToLinear(specularColorSample);
#ifdef HAS_SPECULAR_COLOR_FACTOR
specularColorFactor *= u_specularColorFactor;
#endif
#else
#ifdef HAS_SPECULAR_COLOR_FACTOR
vec3 specularColorFactor = u_specularColorFactor;
#else
vec3 specularColorFactor = vec3(1.0);
#endif
#endif
material.specularWeight = specularWeight;
vec3 f0 = material.specular;
vec3 dielectricSpecularF0 = min(f0 * specularColorFactor, vec3(1.0));
material.specular = mix(dielectricSpecularF0, material.baseColor.rgb, metalness);
}
#endif
#ifdef USE_ANISOTROPY
void setAnisotropy(inout czm_modelMaterial material, in NormalInfo normalInfo)
{
mat2 rotation = mat2(u_anisotropy.xy, -u_anisotropy.y, u_anisotropy.x);
float anisotropyStrength = u_anisotropy.z;
vec2 direction = vec2(1.0, 0.0);
#ifdef HAS_ANISOTROPY_TEXTURE
vec2 anisotropyTexCoords = TEXCOORD_ANISOTROPY;
#ifdef HAS_ANISOTROPY_TEXTURE_TRANSFORM
anisotropyTexCoords = computeTextureTransform(anisotropyTexCoords, u_anisotropyTextureTransform);
#endif
vec3 anisotropySample = texture(u_anisotropyTexture, anisotropyTexCoords).rgb;
direction = anisotropySample.rg * 2.0 - vec2(1.0);
anisotropyStrength *= anisotropySample.b;
#endif
direction = rotation * direction;
mat3 tbn = mat3(normalInfo.tangent, normalInfo.bitangent, normalInfo.normal);
vec3 anisotropicT = tbn * normalize(vec3(direction, 0.0));
vec3 anisotropicB = cross(normalInfo.geometryNormal, anisotropicT);
material.anisotropicT = anisotropicT;
material.anisotropicB = anisotropicB;
material.anisotropyStrength = anisotropyStrength;
}
#endif
#ifdef USE_CLEARCOAT
void setClearcoat(inout czm_modelMaterial material, in ProcessedAttributes attributes)
{
#ifdef HAS_CLEARCOAT_TEXTURE
vec2 clearcoatTexCoords = TEXCOORD_CLEARCOAT;
#ifdef HAS_CLEARCOAT_TEXTURE_TRANSFORM
clearcoatTexCoords = computeTextureTransform(clearcoatTexCoords, u_clearcoatTextureTransform);
#endif
float clearcoatFactor = texture(u_clearcoatTexture, clearcoatTexCoords).r;
#ifdef HAS_CLEARCOAT_FACTOR
clearcoatFactor *= u_clearcoatFactor;
#endif
#else
#ifdef HAS_CLEARCOAT_FACTOR
float clearcoatFactor = u_clearcoatFactor;
#else
float clearcoatFactor = 0.0;
#endif
#endif
#ifdef HAS_CLEARCOAT_ROUGHNESS_TEXTURE
vec2 clearcoatRoughnessTexCoords = TEXCOORD_CLEARCOAT_ROUGHNESS;
#ifdef HAS_CLEARCOAT_ROUGHNESS_TEXTURE_TRANSFORM
clearcoatRoughnessTexCoords = computeTextureTransform(clearcoatRoughnessTexCoords, u_clearcoatRoughnessTextureTransform);
#endif
float clearcoatRoughness = texture(u_clearcoatRoughnessTexture, clearcoatRoughnessTexCoords).g;
#ifdef HAS_CLEARCOAT_ROUGHNESS_FACTOR
clearcoatRoughness *= u_clearcoatRoughnessFactor;
#endif
#else
#ifdef HAS_CLEARCOAT_ROUGHNESS_FACTOR
float clearcoatRoughness = u_clearcoatRoughnessFactor;
#else
float clearcoatRoughness = 0.0;
#endif
#endif
material.clearcoatFactor = clearcoatFactor;
material.clearcoatRoughness = clearcoatRoughness;
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
material.clearcoatNormal = getClearcoatNormalFromTexture(attributes, attributes.normalEC);
#else
material.clearcoatNormal = attributes.normalEC;
#endif
}
#endif
#endif
void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
{
#ifdef USE_ANISOTROPY
NormalInfo normalInfo = getNormalInfo(attributes);
material.normalEC = normalInfo.normal;
#elif defined(HAS_NORMALS)
material.normalEC = computeNormal(attributes);
#endif
vec4 baseColorWithAlpha = vec4(1.0);
#ifdef HAS_BASE_COLOR_TEXTURE
baseColorWithAlpha = getBaseColorFromTexture();
#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
#ifdef USE_CPU_STYLING
baseColorWithAlpha.rgb = blend(baseColorWithAlpha.rgb, feature.color.rgb, model_colorBlend);
#endif
material.baseColor = baseColorWithAlpha;
material.diffuse = baseColorWithAlpha.rgb;
material.alpha = baseColorWithAlpha.a;
#ifdef HAS_OCCLUSION_TEXTURE
vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM
occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);
#endif
material.occlusion = texture(u_occlusionTexture, occlusionTexCoords).r;
#endif
#ifdef HAS_EMISSIVE_TEXTURE
material.emissive = getEmissiveFromTexture();
#elif defined(HAS_EMISSIVE_FACTOR)
material.emissive = u_emissiveFactor;
#endif
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
setSpecularGlossiness(material);
#elif defined(LIGHTING_PBR)
float metalness = setMetallicRoughness(material);
#ifdef USE_SPECULAR
setSpecular(material, metalness);
#endif
#ifdef USE_ANISOTROPY
setAnisotropy(material, normalInfo);
#endif
#ifdef USE_CLEARCOAT
setClearcoat(material, attributes);
#endif
#endif
}
`;var{Material:T3e,MetallicRoughness:Ez,SpecularGlossiness:Xz,Specular:Kae,Clearcoat:Jae}=Cn,Qae={name:"MaterialPipelineStage",_processTexture:Nl,_processTextureTransform:jae};Qae.process=function(e,t,n){let i=t.material,{model:o,uniformMap:r,shaderBuilder:s}=e,a=c(o.classificationType),l=a,{defaultTexture:d,defaultNormalTexture:u,defaultEmissiveTexture:f}=n.context;C3e(i,r,s,d,u,f,l),c(i.specularGlossiness)?V3e(i.specularGlossiness,r,s,d,l):(c(i.specular)&&qt.supportedExtensions.KHR_materials_specular&&L3e(i.specular,r,s,d,l),c(i.anisotropy)&&qt.supportedExtensions.KHR_materials_anisotropy&&R3e(i.anisotropy,r,s,d,l),c(i.clearcoat)&&qt.supportedExtensions.KHR_materials_clearcoat&&G3e(i.clearcoat,r,s,d,l),E3e(i.metallicRoughness,r,s,d,l));let p=qt.getAttributeBySemantic(t,pt.NORMAL),y=e.lightingOptions;i.unlit||!p||a?y.lightingModel=Lh.UNLIT:y.lightingModel=Lh.PBR;let h=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=h;let g=e.alphaOptions;i.alphaMode===Th.BLEND?g.pass=Xe.TRANSLUCENT:i.alphaMode===Th.MASK&&(g.alphaCutoff=i.alphaCutoff),s.addFragmentLines(jW),i.doubleSided&&s.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,xe.BOTH)};function jae(e,t,n,i,o){let r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,xe.FRAGMENT);let s=`${i}Transform`;e.addUniform("mat3",s,xe.FRAGMENT),t[s]=function(){return n.transform}}function S3e(e,t,n,i,o){let r=`HAS_${o}_TEXTURE_SCALE`;e.addDefine(r,void 0,xe.FRAGMENT);let s=`${i}Scale`;e.addUniform("float",s,xe.FRAGMENT),t[s]=function(){return n.scale}}function Nl(e,t,n,i,o,r){e.addUniform("sampler2D",i,xe.FRAGMENT),t[i]=function(){return n.texture??r};let s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,xe.FRAGMENT);let l=`v_texCoord_${n.texCoord}`,d=`TEXCOORD_${o}`;e.addDefine(d,l,xe.FRAGMENT);let u=n.transform;c(u)&&!te.equals(u,te.IDENTITY)&&jae(e,t,n,i,o);let{scale:f}=n;c(f)&&f!==1&&S3e(e,t,n,i,o)}function C3e(e,t,n,i,o,r,s){let{emissiveFactor:a,emissiveTexture:l,normalTexture:d,occlusionTexture:u}=e;c(a)&&!m.equals(a,T3e.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",xe.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,xe.FRAGMENT),c(l)&&!s&&Nl(n,t,l,"u_emissiveTexture","EMISSIVE",r)),c(d)&&!s&&Nl(n,t,d,"u_normalTexture","NORMAL",o),c(u)&&!s&&Nl(n,t,u,"u_occlusionTexture","OCCLUSION",i)}function V3e(e,t,n,i,o){let{diffuseTexture:r,diffuseFactor:s,specularGlossinessTexture:a,specularFactor:l,glossinessFactor:d}=e;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,xe.FRAGMENT),c(r)&&!o&&Nl(n,t,r,"u_diffuseTexture","DIFFUSE",i),c(s)&&!ce.equals(s,Xz.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",xe.FRAGMENT),t.u_diffuseFactor=function(){return e.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,xe.FRAGMENT)),c(a)&&!o&&Nl(n,t,a,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i),c(l)&&!m.equals(l,Xz.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_legacySpecularFactor",xe.FRAGMENT),t.u_legacySpecularFactor=function(){return e.specularFactor},n.addDefine("HAS_LEGACY_SPECULAR_FACTOR",void 0,xe.FRAGMENT)),c(d)&&d!==Xz.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",xe.FRAGMENT),t.u_glossinessFactor=function(){return e.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,xe.FRAGMENT))}function L3e(e,t,n,i,o){let{specularTexture:r,specularFactor:s,specularColorTexture:a,specularColorFactor:l}=e;n.addDefine("USE_SPECULAR",void 0,xe.FRAGMENT),c(r)&&!o&&Nl(n,t,r,"u_specularTexture","SPECULAR",i),c(s)&&s!==Kae.DEFAULT_SPECULAR_FACTOR&&(n.addUniform("float","u_specularFactor",xe.FRAGMENT),t.u_specularFactor=function(){return e.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,xe.FRAGMENT)),c(a)&&!o&&Nl(n,t,a,"u_specularColorTexture","SPECULAR_COLOR",i),c(l)&&!m.equals(l,Kae.DEFAULT_SPECULAR_COLOR_FACTOR)&&(n.addUniform("vec3","u_specularColorFactor",xe.FRAGMENT),t.u_specularColorFactor=function(){return e.specularColorFactor},n.addDefine("HAS_SPECULAR_COLOR_FACTOR",void 0,xe.FRAGMENT))}var Z3e=new m;function R3e(e,t,n,i,o){let{anisotropyStrength:r,anisotro
{
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 Na={name:"MorphTargetsPipelineStage",FUNCTION_ID_GET_MORPHED_POSITION:"getMorphedPosition",FUNCTION_SIGNATURE_GET_MORPHED_POSITION:"vec3 getMorphedPosition(in vec3 position)",FUNCTION_ID_GET_MORPHED_NORMAL:"getMorphedNormal",FUNCTION_SIGNATURE_GET_MORPHED_NORMAL:"vec3 getMorphedNormal(in vec3 normal)",FUNCTION_ID_GET_MORPHED_TANGENT:"getMorphedTangent",FUNCTION_SIGNATURE_GET_MORPHED_TANGENT:"vec3 getMorphedTangent(in vec3 tangent)"};Na.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,xe.VERTEX),v3e(n);let i=t.morphTargets.length;for(let a=0;a<i;a++){let l=t.morphTargets[a].attributes,d=l.length;for(let u=0;u<d;u++){let f=l[u],p=f.semantic;p!==pt.POSITION&&p!==pt.NORMAL&&p!==pt.TANGENT||(I3e(e,f,e.attributeIndex,a),e.attributeIndex++)}}F3e(n);let r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,xe.VERTEX),n.addVertexLines($W);let s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=St(s,e.uniformMap)};var X3e={attributeString:void 0,functionId:void 0};function I3e(e,t,n,i){let o=e.shaderBuilder;W3e(e,t,n);let r=w3e(t,X3e);P3e(o,r,i)}function W3e(e,t,n){let i={index:n,value:c(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:rn.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function w3e(e,t){switch(e.semantic){case pt.POSITION:t.attributeString="Position",t.functionId=Na.FUNCTION_ID_GET_MORPHED_POSITION;break;case pt.NORMAL:t.attributeString="Normal",t.functionId=Na.FUNCTION_ID_GET_MORPHED_NORMAL;break;case pt.TANGENT:t.attributeString="Tangent",t.functionId=Na.FUNCTION_ID_GET_MORPHED_TANGENT;break;default:break}return t}function P3e(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 v3e(e){e.addFunction(Na.FUNCTION_ID_GET_MORPHED_POSITION,Na.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,xe.VERTEX),e.addFunctionLines(Na.FUNCTION_ID_GET_MORPHED_POSITION,["vec3 morphedPosition = position;"]),e.addFunction(Na.FUNCTION_ID_GET_MORPHED_NORMAL,Na.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,xe.VERTEX),e.addFunctionLines(Na.FUNCTION_ID_GET_MORPHED_NORMAL,["vec3 morphedNormal = normal;"]),e.addFunction(Na.FUNCTION_ID_GET_MORPHED_TANGENT,Na.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,xe.VERTEX),e.addFunctionLines(Na.FUNCTION_ID_GET_MORPHED_TANGENT,["vec3 morphedTangent = tangent;"])}function F3e(e){e.addFunctionLines(Na.FUNCTION_ID_GET_MORPHED_POSITION,["return morphedPosition;"]),e.addFunctionLines(Na.FUNCTION_ID_GET_MORPHED_NORMAL,["return morphedNormal;"]),e.addFunctionLines(Na.FUNCTION_ID_GET_MORPHED_TANGENT,["return morphedTangent;"])}var ew=Na;var d2n=_(T(),1);var qae={name:"PickingPipelineStage"};qae.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)A3e(e,t,a,i);else if(c(a))M3e(e,i);else{let l=$ae(e),d=i.createPickId(l);s._pipelineResources.push(d),s._pickIds.push(d),r.addUniform("vec4","czm_pickColor",xe.FRAGMENT);let u=e.uniformMap;u.czm_pickColor=function(){return d.color},e.pickId="czm_pickColor"}};function $ae(e,t){let n=e.model;if(c(n.pickObject))return n.pickObject;let i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive},o;if(mr.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,c(t)&&(o.instanceId=t),o}function A3e(e,t,n){let i=e.model,o,r,s=i.featureIdLabel,a=i.instanceFeatureIdLabel;c(i.featureTableId)?o=i.featureTableId:c(n)?(r=qt.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=qt.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);let l=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",xe.FRAGMENT);let u=l.batchTexture;e.uniformMap.model_pickTexture=function(){return u.pickTexture??u.defaultTexture},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? text
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
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
float pointCloudBackFaceCullingStage() {
#if defined(HAS_NORMALS) && !defined(HAS_DOUBLE_SIDED_MATERIAL)
return step(-v_normalEC.z, 0.0);
#else
return 1.0;
#endif
}
#endif
`;var k3e=new ce,tce={name:"PointCloudStylingPipelineStage"};tce.process=function(e,t,n){let i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=c(s)?s.propertyAttributes:void 0,l=c(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,d=!c(a)&&l;if(c(r)&&!d){let g=B3e(a),x=Y3e(r,g);H3e(i,x);let V=z3e(x).indexOf("normalMC")>=0,Z=qt.getAttributeBySemantic(t,pt.NORMAL);if(V&&!Z)throw new le("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,xe.VERTEX),x.styleTranslucent&&(e.alphaOptions.pass=Xe.TRANSLUCENT)}let u=o.pointCloudShading;u.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,xe.VERTEX),u.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,xe.VERTEX);let f,p,y;mr.is3DTiles(o.type)&&(p=!0,f=o.content,y=f.tile.refine===Bo.ADD),i.addUniform("vec4","model_pointCloudParameters",xe.VERTEX),i.addVertexLines(nw);let h=e.uniformMap;h.model_pointCloudParameters=function(){let g=k3e,x=1;p&&(x=y?5:f.tileset.memoryAdjustedScreenSpaceError),g.x=u.maximumAttenuation??x,g.x*=n.pixelRatio;let S=U3e(e,t,u,f);g.y=S*u.geometricErrorScale;let V=n.context,Z=n.camera.frustum,R;return n.mode===se.SCENE2D||Z instanceof sn?R=Number.POSITIVE_INFINITY:R=V.drawingBufferHeight/n.camera.frustum.sseDenominator,g.z=R,p&&(g.w=f.tileset.timeSinceLoad),g}};var ece=new m;function U3e(e,t,n,i){if(c(i)){let u=i.tile.geometricError;if(u>0)return u}if(c(n.baseResolution))return n.baseResolution;let o=qt.getAttributeBySemantic(t,pt.POSITION),r=o.count,s=e.runtimeNode.transform,a=m.subtract(o.max,o.min,ece);a=M.multiplyByPointAsVector(s,a,ece);let l=a.x*a.y*a.z;return w.cbrt(l/r)}var O3e={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},D3e={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function B3e(e){let t=He(D3e);if(!c(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 Iz="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function Y3e(e,t){let n=O3e,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${Iz})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${Iz})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${Iz})`,t,i),n.styleTranslucent=c(n.colorStyleFunction)&&i.translucent,n}function H3e(e,t){let n=t.colorStyleFunction;c(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,xe.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));let i=t.showStyleFunction;c(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,xe.BOTH),e.addVertexLines(i),e.addVarying("float","v_pointCloudShow"));let o=t.pointSizeStyleFunction;c(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,xe.VERTEX),e.addVertexLines(o))}function Wz(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 z3e(e){let t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return c(t)&&Wz(t,o),c(n)&&Wz(n,o),c(i)&&Wz(i,o),o}var iw=tce;var D2n=_(T(),1);var P2n=_(T(),1),ow=`void primitiveOutlineStage() {
v_outlineCoordinates = a_outlineCoordinates;
}
`;var F2n=_(T(),1),rw=`void primitiveOutlineStage(inout czm_modelMaterial material) {
if (!model_showOutline) {
return;
}
float outlineX =
texture(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;
float outlineY =
texture(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;
float outlineZ =
texture(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 nce={name:"PrimitiveOutlinePipelineStage"};nce.process=function(e,t,n){let i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,xe.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");let r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:rn.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",xe.FRAGMENT);let a=L_.createTexture(n.context);o.model_outlineTexture=function(){return a};let l=e.model;i.addUniform("vec4","model_outlineColor",xe.FRAGMENT),o.model_outlineColor=function(){return l.outlineColor},i.addUniform("bool","model_showOutline",xe.FRAGMENT),o.model_showOutline=function(){return l.showOutline},i.addVertexLines(ow),i.addFragmentLines(rw)};var sw=nce;var J2n=_(T(),1);var ice={name:"PrimitiveStatisticsPipelineStage",_countGeometry:oce,_count2DPositions:rce,_countMorphTargetAttributes:sce,_countMaterialTextures:ace,_countFeatureIdTextures:cce,_countBinaryMetadata:lce};ice.process=function(e,t,n){let i=e.model,o=i.statistics;oce(o,t),rce(o,e.runtimePrimitive),sce(o,t),ace(o,t.material),cce(o,t.featureIds),lce(o,i)};function oce(e,t){let n=c(t.indices)?t.indices.count:qt.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===ve.POINTS?e.pointsLength+=n:ve.isTriangles(i)&&(e.trianglesLength+=K3e(i,n));let o=t.attributes,r=o.length;for(let l=0;l<r;l++){let d=o[l];if(c(d.buffer)){let u=c(d.typedArray);e.addBuffer(d.buffer,u)}}let s=t.outlineCoordinates;c(s)&&c(s.buffer)&&e.addBuffer(s.buffer,!1);let a=t.indices;if(c(a)&&c(a.buffer)){let l=c(a.typedArray);e.addBuffer(a.buffer,l)}}function K3e(e,t){switch(e){case ve.TRIANGLES:return t/3;case ve.TRIANGLE_STRIP:case ve.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function rce(e,t){let n=t.positionBuffer2D;c(n)&&e.addBuffer(n,!0)}function sce(e,t){let n=t.morphTargets;if(!c(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 l=0;l<a;l++){let d=s[l];c(d.buffer)&&e.addBuffer(d.buffer,i)}}}function ace(e,t){let n=J3e(t),i=n.length;for(let o=0;o<i;o++){let r=n[o];c(r)&&c(r.texture)&&e.addTexture(r.texture)}}function J3e(e){let t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return c(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function cce(e,t){let n=t.length;for(let i=0;i<n;i++){let o=t[i];if(o instanceof Cn.FeatureIdTexture){let r=o.textureReader;c(r.texture)&&e.addTexture(r.texture)}}}function lce(e,t){let n=t.structuralMetadata;c(n)&&(Q3e(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);let i=t.featureTables;if(!c(i))return;let o=i.length;for(let r=0;r<o;r++){let s=i[r];e.addBatchTexture(s.batchTexture)}}function Q3e(e,t){let n=t.propertyTextures;if(!c(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 d=s[a].textureReader;c(d.texture)&&e.addTexture(d.texture)}}}var aw=ice;var dvn=_(T(),1);var j3e=new M,q3e=new M,dce={name:"SceneMode2DPipelineStage"};dce.process=function(e,t,n){let i=qt.getAttributeBySemantic(t,pt.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,l=M.multiplyTransformation(s,a,j3e),d=tYe(e,l,n),u=e.runtimePrimitive;u.boundingSphere2D=d;let f=e.runtimeNode.node.instances;if(c(f))return;if(c(i.typedArray)){let g=oYe(i,l,d,n);u.positionBuffer2D=g,r._modelResources.push(g),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,xe.VERTEX),o.addUniform("mat4","u_modelView2D",xe.VERTEX);let p=M.fromTranslation(d.center,new M),y=n.context,h={u_modelView2D:function(){return M.multiplyTransformation(y.uniformState.view,p,q3e)}};e.uniformMap=St(h,e.uniformMap)};var $3e=new m,eYe=new m;function tYe(e,t,n){let i=M.multiplyByPoint(t,e.positionMin,$3e),o=Oi.computeActualEllipsoidPositi
{
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 E_={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};E_.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,xe.VERTEX),sYe(n,t);let i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,xe.VERTEX),n.addVertexLines(lw);let r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=St(r,e.uniformMap)};function rYe(e){let t=-1,n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];(r.semantic===pt.JOINTS||r.semantic===pt.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function sYe(e,t){e.addFunction(E_.FUNCTION_ID_GET_SKINNING_MATRIX,E_.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,xe.VERTEX),e.addFunctionLines(E_.FUNCTION_ID_GET_SKINNING_MATRIX,["mat4 skinnedMatrix = mat4(0);"]);let i,o,r=["x","y","z","w"],s=rYe(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){let l=r[o],d=`skinnedMatrix += a_weights_${i}.${l} * u_jointMatrices[int(a_joints_${i}.${l})];`;e.addFunctionLines(E_.FUNCTION_ID_GET_SKINNING_MATRIX,[d])}e.addFunctionLines(E_.FUNCTION_ID_GET_SKINNING_MATRIX,["return skinnedMatrix;"])}var dw=E_;var Lvn=_(T(),1);var _vn=_(T(),1),uw=`void verticalExaggerationStage(
inout ProcessedAttributes attributes
) {
vec4 vertexPositionENU = czm_modelToEnu * vec4(attributes.positionMC, 1.0);
vec2 vertexAzimuth = normalize(vertexPositionENU.xy);
float azimuthalCurvature = dot(vertexAzimuth * vertexAzimuth, czm_eyeEllipsoidCurvature);
float eyeToCenter = 1.0 / azimuthalCurvature + czm_eyeHeight;
vec3 vertexPositionEC = (czm_modelView * vec4(attributes.positionMC, 1.0)).xyz;
vec3 centerToVertex = eyeToCenter * czm_eyeEllipsoidNormalEC + vertexPositionEC;
vec3 vertexNormal = normalize(centerToVertex);
float verticalDistance = dot(vertexPositionEC, czm_eyeEllipsoidNormalEC);
float horizontalDistance = length(vertexPositionEC - verticalDistance * czm_eyeEllipsoidNormalEC);
float sinTheta = horizontalDistance / (eyeToCenter + verticalDistance);
bool isSmallAngle = clamp(sinTheta, 0.0, 0.05) == sinTheta;
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC, vertexNormal);
float smallAngleVersine = 0.5 * sinTheta * sinTheta;
float versine = isSmallAngle ? smallAngleVersine : exactVersine;
float dHeight = dot(vertexPositionEC, vertexNormal) - eyeToCenter * versine;
float vertexHeight = czm_eyeHeight + dHeight;
vec3 vertexNormalMC = (czm_inverseModelView * vec4(vertexNormal, 0.0)).xyz;
vertexNormalMC = normalize(vertexNormalMC);
float stretch = u_verticalExaggerationAndRelativeHeight.x;
float shift = u_verticalExaggerationAndRelativeHeight.y;
float exaggeration = (vertexHeight - shift) * (stretch - 1.0);
attributes.positionMC += exaggeration * vertexNormalMC;
}
`;var mce={name:"VerticalExaggerationPipelineStage"},aYe=new D;mce.process=function(e,t,n){let{shaderBuilder:i,uniformMap:o}=e;i.addVertexLines(uw),i.addDefine("HAS_VERTICAL_EXAGGERATION",void 0,xe.VERTEX),i.addUniform("vec2","u_verticalExaggerationAndRelativeHeight",xe.VERTEX),o.u_verticalExaggerationAndRelativeHeight=function(){return D.fromElements(n.verticalExaggeration,n.verticalExaggerationRelativeHeight,aYe)}};var mw=mce;var Uvn=_(T(),1);var Xvn=_(T(),1);var wz={};function cYe(e){let t=Me.createTypedArray(e,e*2),n=e,i=0;for(let o=0;o<n;o+=3)t[i++]=o,t[i++]=o+1,t[i++]=o+1,t[i++]=o+2,t[i++]=o+2,t[i++]=o;return t}function lYe(e,t){let n=t.length,i=Me.createTypedArray(e,n*2),o=0;for(let r=0;r<n;r+=3){let s=t[r],a=t[r+1],l=t[r+2];i[o++]=s,i[o++]=a,i[o++]=a,i[o++]=l,i[o++]=l,i[o++]=s}return i}function dYe(e){let t=e-2,n=2+t*4,i=Me.createTypedArray(e,n),o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=r;return i}function uYe(e,t){let i=t.length-2,o=2+i*4,r=Me.createTypedArray(e,o),s=0;r[s++]=t[0],r[s++]=t[1];for(let a=0;a<i;a++){let l=t[a],d=t[a+1],u=t[a+2];r[s++]=d,r[s++]=u,r[s++]=u,r[s++]=l}return r}function mYe(e){let t=e-2,n=2+t*4,i=Me.createTypedArray(e,n),o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=0;return i}function fYe(e,t){let i=t.length-2,o=2+i*4,r=Me.createTypedArray(e,o),s=0,a=t[0];r[s++]=a,r[s++]=t[1];for(let l=0;l<i;l++){let d=t[l+1],u=t[l+2];r[s++]=d,r[s++]=u,r[s++]=u,r[s++]=a}return r}wz.createWireframeIndices=function(e,t,n){let i=c(n);if(e===ve.TRIANGLES)return i?lYe(t,n):cYe(t);if(e===ve.TRIANGLE_STRIP)return i?uYe(t,n):dYe(t);if(e===ve.TRIANGLE_FAN)return i?fYe(t,n):mYe(t)};wz.getWireframeIndicesCount=function(e,t){return e===ve.TRIANGLES?t*2:e===ve.TRIANGLE_STRIP||e===ve.TRIANGLE_FAN?2+(t-2)*4:t};var l1=wz;var fce={name:"WireframePipelineStage"};fce.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,xe.FRAGMENT);let o=e.model,r=hYe(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r,o.statistics.addBuffer(r,!1);let a=e.primitiveType,l=e.count;e.primitiveType=ve.LINES,e.count=l1.getWireframeIndicesCount(a,l)};function hYe(e,t,n){let o=qt.getAttributeBySemantic(e,pt.POSITION).count,r=n.context.webgl2,s;if(c(t)){let u=t.buffer,f=t.count;c(u)&&r?(s=u.sizeInBytes===f?new Uint8Array(f):Me.createTypedArray(o,f),u.getBufferData(s)):s=t.typedArray}let a=e.primitiveType,l=l1.createWireframeIndices(a,o,s),d=Me.fromSizeInBytes(l.BYTES_PER_ELEMENT);return _t.createIndexBuffer({context:n.context,typedArray:l,usage:Ne.STATIC_DRAW,indexDatatype:d})}var fw=fce;function hce(e){e=e??z.EMPTY_OBJECT;let t=e.primitive,n=e.node,i=e.model;C.typeOf.object("options.primitive",t),C.typeOf.object("options.node",n),C.typeOf.object("options.model",i),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.batchLengths=void 0,this.batchOffsets=void 0,this.updateStages=[]}hce.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,d=e.mode!==se.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,u=e.verticalExaggeration!==1&&o.hasVerticalExaggeration,f=c(n.morphTargets)&&n.morphTargets.length>0,p=c(i.skin),y=c(r),g=!(y&&c(r.fragmentShaderText))||r.mode!==bb.REPLACE_MATERIAL,x=qt.hasQuantizedAttributes(n.attributes),S=o.debugWireframe&&ve.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),V=o.pointCloudShading,Z=c(V)&&V.attenuation,R=c(V)&&V.backFaceCulling,E=n.primitiveType===ve.POINTS&&(c(s)||Z||R),I=o._enableShowOutline&&c(n.outlineCoordinates),v=pYe(o,i,n),P=c(o.classificationType);d&&t.push(cw),t.push(KW),S&&t.push(fw),P&&t.push(WW),f&&t.push(ew),p&&t.push(dw),E&&t.push(iw),x&&t.push(BW),g&&t.push(qW),t.push(Xy),t.push(Fu),t.push(Ld),v.hasPropertyTable&&(t.push(Wy),t.push(IW),t.push(vW)),u&&t.push(mw),y&&t.push(OW),t.push(QW),o.allowPicking&&t.push(tw),I&&t.push(sw),t.push(XW),t.push(aw)};f
if(model_silhouettePass) {
color = czm_gammaCorrect(model_silhouetteColor);
}
}
`;var FFn=_(T(),1),xw=`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 ck={name:"ModelSilhouettePipelineStage"};ck.silhouettesLength=0;ck.process=function(e,t,n){c(t._silhouetteId)||(t._silhouetteId=++ck.silhouettesLength);let i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,xe.BOTH),i.addVertexLines(xw),i.addFragmentLines(gw),i.addUniform("vec4","model_silhouetteColor",xe.FRAGMENT),i.addUniform("float","model_silhouetteSize",xe.VERTEX),i.addUniform("bool","model_silhouettePass",xe.BOTH);let o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=St(o,e.uniformMap),e.hasSilhouette=!0};var _w=ck;var QFn=_(T(),1);var YFn=_(T(),1),Tw=`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 lk={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};lk.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,xe.FRAGMENT),i.addFragmentLines(Tw);let o={};i.addUniform("float",lk.SPLIT_DIRECTION_UNIFORM_NAME,xe.FRAGMENT),o[lk.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=St(o,e.uniformMap)};var Sw=lk;var eAn=_(T(),1);function xYe(e,t){C.typeOf.object("modelRenderResources",e),C.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=He(e.uniformMap),this.alphaOptions=He(e.alphaOptions),this.renderStateOptions=He(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0}var Cw=xYe;var fAn=_(T(),1);var oAn=_(T(),1);function _Ye(e){e=e??z.EMPTY_OBJECT,this.lightingModel=e.lightingModel??Lh.UNLIT}var Vw=_Ye;function TYe(e,t){C.typeOf.object("nodeRenderResources",e),C.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=He(e.uniformMap),this.alphaOptions=He(e.alphaOptions),this.renderStateOptions=He(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;let n=t.primitive;this.count=c(n.indices)?n.indices.count:qt.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;let i=qt.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=m.clone(i.min,new m),this.positionMax=m.clone(i.max,new m),this.boundingSphere=ue.fromCornerPoints(this.positionMin,this.positionMax,new ue),this.lightingOptions=new Vw,this.pickId=void 0}var Lw=TYe;var y9n=_(T(),1);var GAn=_(T(),1);function Fz(e){e=e??z.EMPTY_OBJECT;let t=e.command,n=e.primitiveRenderResources;C.typeOf.object("options.command",t),C.typeOf.object("options.primitiveRenderResources",n);let i=n.model;this._command=t,this._model=i,this._runtimePrimitive=n.runtimePrimitive,this._modelMatrix=t.modelMatrix,this._boundingVolume=t.boundingVolume,this._cullFace=t.renderState.cull.face;let o=i.classificationType;this._classificationType=o,this._classifiesTerrain=o!==Un.CESIUM_3D_TILE,this._classifies3DTiles=o!==Un.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],LYe(this)}function SYe(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:ft.KEEP,zFail:ft.DECREMENT_WRAP,zPass:ft.KEEP},backFunction:e,backOperation:{fail:ft.KEEP,zFail:ft.INCREMENT_WRAP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:lc.LESS_OR_EQUAL},depthMask:!1}}var CYe={stencilTest:{enabled:!0,frontFunction:On.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:On.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:un.PRE_MULTIPLIED_ALPHA_BLEND},VYe={stencilTest:{enabled:!0,frontFunction:On.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:On.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},dept
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;
MetadataStatistics metadataStatistics;
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
#ifdef HAS_VERTICAL_EXAGGERATION
verticalExaggerationStage(attributes);
#endif
#ifdef HAS_CUSTOM_VERTEX_SHADER
czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);
customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass, metadataStatistics);
#endif
vec4 positionClip = geometryStage(attributes, modelView, normal);
#ifdef HAS_ATMOSPHERE
atmosphereStage(attributes);
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
modelClippingPolygonsStage(attributes);
#endif
#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_BACK_FACE_CULLING
show *= pointCloudBackFaceCullingStage();
#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 = positionClip;
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
v_pointCloudShow = show;
#endif
}
`;var e9n=_(T(),1),Xw=`precision highp float;
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_POINT_CLOUD_SHOW_STYLE
if (v_pointCloudShow == 0.0)
{
discard;
}
#endif
#ifdef HAS_MODEL_SPLITTER
modelSplitterStage();
#endif
czm_modelMaterial material = defaultModelMaterial();
ProcessedAttributes attributes;
geometryStage(attributes);
FeatureIds featureIds;
featureIdStage(featureIds, attributes);
Metadata metadata;
MetadataClass metadataClass;
MetadataStatistics metadataStatistics;
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
#ifndef METADATA_PICKING_ENABLED
#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, metadataStatistics);
#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);
#else
vec4 metadataValues = vec4(0.0, 0.0, 0.0, 0.0);
metadataPickingStage(metadata, metadataClass, metadataValues);
vec4 color = metadataValues;
#endif
#ifdef HAS_CLIPPING_PLANES
modelClippingPlanesStage(color);
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
modelClippingPolygonsStage();
#endif
#ifndef METADATA_PICKING_ENABLED
#if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)
silhouetteStage(color);
#endif
#ifdef HAS_ATMOSPHERE
atmosphereStage(color, attributes);
#endif
#endif
out_FragColor = color;
}
`;function _ce(){}_ce.buildModelDrawCommand=function(e,t){let n=e.shaderBuilder,i=OYe(e,n,t),o=DYe(e,i,t),r=e.model;return c(r.classificationType)?new Rw({primitiveRenderResources:e,command:o}):new Gw({primitiveRenderResources:e,command:o})};function OYe(e,t,n){t.addVertexLines(Ew),t.addFragmentLines(Xw);let i=e.model,o=t.buildShaderProgram(n.context);return i._pipelineResources.push(o),o}function DYe(e,t,n){let i=BYe(e),o=new ni({context:n.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);let s=e.alphaOptions.pass,a=r.sceneGraph,l=n.mode===se.SCENE3D,d,u;if(!l&&!n.scene3DOnly&&r._projectTo2D)d=M.multiplyTransformation(a._computedModelMatrix,e.runtimeNode.computedTransform,new M),u=e.runtimePrimitive.boundingSphere2D;else{let S=l?a._computedModelMatrix:a._computedModelMatrix2D;d=M.multiplyTransformation(S,e.runtimeNode.computedTransform,new M),u=ue.transform(e.boundingSphere,d)}let f=He(Oe.fromCache(e.renderStateOptions),!0);f.cull.face=qt.getCullFace(d,e.primitiveType),f=Oe.fromCache(f);let p=c(r.classificationType),y=p?!1:Sn.castShadows(r.shadows),h=p?!1:Sn.receiveShadows(r.shadows),g=p?void 0:e.pickId;return new et({boundingVolume:u,modelMatrix:d,uniformMap:e.uniformMap,renderState:f,vertexArray:o,shaderProgram:t,cull:r.cull,pass:s,count:e.count,owner:r,pickId:g,pickMetadataAllowed:!0,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:y,receiveShadows:h})}function BYe(e){let t=e.wireframeIndexBuffer;if(c(t))return t;let n=e.indices;if(c(n)){if(!c(n.buffer))throw new L("Indices must be provided as a Buffer");return n.buffer}}var Iw=_ce;function Zd(e){e=e??z.EMPTY_OBJECT;let t=e.modelComponents;C.typeOf.object("options.model",e.model),C.typeOf.object("options.modelComponents",t),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=M.clone(M.IDENTITY),this._computedModelMatrix2D=M.clone(M.IDENTITY),this._axisCorrectionMatrix=qt.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new M),this._runtimeArticulations={},YYe(this)}Object.defineProperties(Zd.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 YYe(e){let t=e._components,n=t.scene,o=e._model.modelMatrix;Tce(e,o);let r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let V=0;V<s;V++){let Z=r[V],R=new hW({articulation:Z,sceneGraph:e}),E=R.name;a[E]=R}let l=t.nodes,d=l.length;e._runtimeNodes=new Array(d);let f=n.nodes.length,p=M.IDENTITY;for(let V=0;V<f;V++){let Z=n.nodes[V],R=Sce(e,Z,p);e._rootNodes.push(R)}let y=t.skins,h=e._runtimeSkins,g=y.length;for(let V=0;V<g;V++){let Z=y[V];h.push(new pw({skin:Z,sceneGraph:e}))}let x=e._skinnedNodes,S=x.length;for(let V=0;V<S;V++){let Z=x[V],R=e._runtimeNodes[Z],I=l[Z].skin.index;R._runtimeSkin=h[I],R.updateJointMatrices()}e.applyArticulations()}function Tce(e,t){let n=e._components,i=e._model;e._computedModelMatrix=M.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=M.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=M.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}var HYe=new m;function zYe(e,t){let n=e._computedModelMatrix,i=M.getTranslation(n,HYe);if(!m.equals(i,m.ZERO))e._computedModelMatrix2D=wt.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{let o=e.boundingSphere.center,r=wt.ellipsoidTo2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedModelMatrix2D=M.multiply(r,n,e._computedModelMatrix2D)}e._boundingSphere2D=ue.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}function
#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
in vec2 v_textureCoordinates;
in vec4 v_pickColor;
in vec4 v_color;
in float v_splitDirection;
#ifdef SDF
in vec4 v_outlineColor;
in float v_outlineWidth;
#endif
#ifdef FRAGMENT_DEPTH_CHECK
in vec4 v_textureCoordinateBounds;
in vec4 v_originTextureCoordinateAndTranslate;
in vec4 v_compressed;
in 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(texture(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 texture(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()
{
if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
vec4 color = texture(u_atlas, v_textureCoordinates);
#ifdef SDF
float outlineWidth = v_outlineWidth;
vec4 outlineColor = v_outlineColor;
float distance = getDistance(v_textureCoordinates);
#if (__VERSION__ == 300 || defined(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
out_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 u5n=_(T(),1),kw=`#ifdef INSTANCED
in vec2 direction;
#endif
in vec4 positionHighAndScale;
in vec4 positionLowAndRotation;
in vec4 compressedAttribute0;
in vec4 compressedAttribute1;
in vec4 compressedAttribute2;
in vec4 eyeOffset;
in vec4 scaleByDistance;
in vec4 pixelOffsetScaleByDistance;
in vec4 compressedAttribute3;
in vec2 sdf;
in float splitDirection;
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
in vec4 textureCoordinateBoundsOrLabelTranslate;
#endif
#ifdef VECTOR_TILE
in float a_batchId;
#endif
out vec2 v_textureCoordinates;
#ifdef FRAGMENT_DEPTH_CHECK
out vec4 v_textureCoordinateBounds;
out vec4 v_originTextureCoordinateAndTranslate;
out vec4 v_compressed;
out mat2 v_rotationMatrix;
#endif
out vec4 v_pickColor;
out vec4 v_color;
out float v_splitDirection;
#ifdef SDF
out vec4 v_outlineColor;
out 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_modelView3D * 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(texture(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;
v_splitDirection = splitDirection;
}
`;var D5n=_(T(),1);var g5n=_(T(),1);var f5n=_(T(),1),Cze=Object.freeze({NONE:0,LOADING:2,LOADED:3,ERROR:4,FAILED:5}),is=Cze;function gb(e){C.defined("billboardCollection",e),this._billboardCollection=e,this._id=void 0,this._loadState=is.NONE,this._loadError=void 0,this._index=-1,this._width=void 0,this._height=void 0,this._hasSubregion=!1,this.dirty=!1}Object.defineProperties(gb.prototype,{loadError:{get:function(){return this._loadError}},loadState:{get:function(){return this._loadState}},ready:{get:function(){return this._loadState===is.LOADED}},hasImage:{get:function(){return this._loadState!==is.NONE}},id:{get:function(){return this._id}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});gb.prototype.unload=async function(){this._loadState!==is.NONE&&(this._id=void 0,this._loadError=void 0,this._loadState=is.NONE,this._index=-1,this._width=void 0,this._height=void 0,this.dirty=!0)};gb.prototype.loadImage=async function(e,t){if(this._id===e)return;let n=this._billboardCollection,i=n.billboardTextureCache,o=i.get(e);if(c(o)&&t.loadState===is.LOADING||t.loadState===is.LOADED){gb.clone(o,this);return}c(o)||(o=new gb(n),i.set(e,o)),o._id=this._id=e,o._loadState=this._loadState=is.LOADING,o._loadError=this._loadError=void 0;let r,s=this._billboardCollection.textureAtlas;try{r=await s.addImage(e,t)}catch(l){if(o._loadState=is.ERROR,o._loadError=l,this._id!==e)return;this._loadState=is.ERROR,this._loadError=l;return}if(!c(r)||r===-1){if(o._loadState=is.FAILED,o._index=-1,this._id!==e)return;this._loadState=is.FAILED,this._index=-1;return}o._index=r,o._loadState=is.LOADED;let a=s.rectangles[r];o._width=a.width,o._height=a.height,this._id===e&&(this._index=r,this._loadState=is.LOADED,this._width=a.width,this._height=a.height,this.dirty=!0)};gb.prototype.addImageSubRegion=async function(e,t){this._id=e,this._loadState=is.LOADING,this._loadError=void 0,this._hasSubregion=!0;let n,i=this._billboardCollection.textureAtlas;try{n=await i.addImageSubRegion(e,t)}catch(o){this._loadState=is.ERROR,this._loadError=o;return}if(!c(n)||n===-1){this._loadState=is.FAILED,this._index=-1,this._width=void 0,this._height=void 0;return}this._width=t.width,this._height=t.height,this._index=n,this._loadState=is.LOADED,this.dirty=!0};gb.prototype.computeTextureCoordinates=function(e){return this._billboardCollection.textureAtlas.computeTextureCoordinates(this._index,e)};gb.clone=function(e,t){if(t._id=e._id,t._loadState=e._loadState,t._loadError=void 0,t._index=e._index,t._width=e._width,t._height=e._height,t._hasSubregion=e._hasSubregion,e.ready){t.dirty=!0;return}return(async()=>{let i=e._id;await e._billboardCollection.textureAtlas._indexPromiseById.get(i),t._id===i&&(e._hasSubregion&&await Promise.resolve(),t._id=i,t._loadState=e._loadState,t._loadError=e._loadError,t._index=e._index,t._width=e._width,t._height=e._height,t.dirty=!0)})(),t};var xb=gb;function pi(e,t){if(e=e??z.EMPTY_OBJECT,c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new L("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new L("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Nt.clone(n)}if(c(i)){if(i.far<=i.near)throw new L("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Nt.clone(i)}if(c(o)){if(o.far<=o.near)throw new L("scaleByDistance.far must be greater than scaleByDistance.near.");o=Nt.clone(o)}if(c(r)){if(r.far<=r.near)throw new L("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=vt.clone(r)}this._show=e.show??!0,this._position=m.clone(e.position??m.ZERO),this._actualPosition=m.clone(this._position),this._pixelOffset=D.clone(e.pixelOffset??D.ZERO),this._translate=new D(0,0),this._eyeOffset=m.clone(e.eyeOffset??m.ZERO),this._heightReference=e.heightReference??ze.NONE,this._verticalOrigin=e.verticalOrigin??Mn.CENTER,this._horizontalOrigin=e.horizontal
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = texture(billboard_texture, v_textureCoordinates);
}
`,{uniformMap:{billboard_texture:function(){return e.textureAtlas.texture}}});return i.pass=Xe.OVERLAY,i}var aKe=[];Nu.prototype.update=function(e){if(Jz(this),!this.show)return;let t=e.context;this._instanced=t.instancedArrays,lo=this._instanced?zze:Hze,Oz=this._instanced?Jze:Kze;let n=this._billboards,i=n.length,o=!0;for(let P=0;P<i;++P){let F=n[P];c(F.loadError)&&(console.error(`Error loading image for billboard: ${F.loadError}`),F.image=void 0),F.textureDirty&&this._updateBillboard(F,W_),F.show&&(o=o&&F.ready)}let r=this._textureAtlas;if(e.afterRender.push(()=>{if(!this.isDestroyed())return r.update(e.context)}),!c(r.texture))return;oKe(this,e),n=this._billboards,i=n.length;let s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,l=this._propertiesChanged,d=r.guid,u=this._createVertexArray||this._textureAtlasGUID!==d;this._textureAtlasGUID=d;let f,p=e.passes,y=p.pick;if(u||!y&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let P=0;P<Kz;++P)l[P]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),i>0){this._vaf=jze(t,i,this._buffersUsage,this._instanced,this._batchTable,this._sdf),f=this._vaf.writers;for(let P=0;P<i;++P){let F=this._billboards[P];F._dirty=!1,F.textureDirty=!1,iKe(this,e,f,F)}this._vaf.commit(Oz(t))}this._billboardsToUpdateIndex=0}else if(a>0){let P=aKe;P.length=0,(l[Ow]||l[Oze]||l[Uze])&&P.push(Qce),(l[W_]||l[kce]||l[Nze]||l[kze]||l[Mze])&&(P.push(nle),this._instanced&&P.push(zz)),(l[W_]||l[Dze]||l[Bce])&&(P.push(ile),P.push(Hz)),(l[W_]||l[Oce])&&P.push(Hz),(l[W_]||l[Uce])&&P.push(zz),l[Dce]&&P.push(ole),l[Yce]&&P.push(rle),(l[Hce]||l[Bze]||l[W_]||l[Ow])&&P.push(sle),(l[W_]||l[Ow])&&P.push(ale),l[zce]&&P.push(cle),l[Kce]&&P.push(lle);let F=P.length;if(f=this._vaf.writers,a/i>.1){for(let N=0;N<a;++N){let b=s[N];b._dirty=!1,b.textureDirty=!1;for(let G=0;G<F;++G)P[G](this,e,f,b)}this._vaf.commit(Oz(t))}else{for(let N=0;N<a;++N){let b=s[N];b._dirty=!1,b.textureDirty=!1;for(let G=0;G<F;++G)P[G](this,e,f,b);this._instanced?this._vaf.subCommit(b._index,1):this._vaf.subCommit(b._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>i*1.5&&(s.length=i),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,ue.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let h,g=M.IDENTITY;e.mode===se.SCENE3D?(g=this.modelMatrix,h=ue.clone(this._baseVolumeWC,this._boundingVolume)):h=ue.clone(this._baseVolume2D,this._boundingVolume),rKe(this,e,h);let x=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,x){this._blendOption===Lo.OPAQUE||this._blendOption===Lo.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Oe.fromCache({depthTest:{enabled:!0,func:oe.LESS},depthMask:!0}):this._rsOpaque=void 0;let P=this._blendOption===Lo.TRANSLUCENT;this._blendOption===Lo.TRANSLUCENT||this._blendOption===Lo.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Oe.fromCache({depthTest:{enabled:!0,func:P?oe.LEQUAL:oe.LESS},depthMask:P,blending:un.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let S,V,Z,R,E,I=mt.maximumVertexTextureImageUnits>0;if(x||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){S=kw,V=Nw,E=[],c(this._batchTable)&&(E.push("VECTOR_TILE"),S=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(S),V=this._batchTable.getFragmentShaderCallback(!1,void 0)(V)),Z=new Be({defines:E,sources:[S]}),this._instanced&&Z.defines.push("INSTANCED"),this._shaderRotation&&Z.defines.push("ROTATION"),t
`),n="";for(let i=0;i<t.length;i++){let o=t[i],r=ble.test(o.charAt(0)),s=yKe(o,ble),a=0,l="";for(let d=0;d<s.length;++d){let u=s[d],f=u.Type===ps.BRACKETS?xKe(u.Word):gKe(u.Word);r?u.Type===ps.RTL?(l=f+l,a=0):u.Type===ps.LTR?(l=Hw(l,a,u.Word),a+=u.Word.length):(u.Type===ps.WEAK||u.Type===ps.BRACKETS)&&(u.Type===ps.WEAK&&s[d-1].Type===ps.BRACKETS?l=f+l:s[d-1].Type===ps.RTL?(l=f+l,a=0):s.length>d+1?s[d+1].Type===ps.RTL?(l=f+l,a=0):(l=Hw(l,a,u.Word),a+=u.Word.length):l=Hw(l,0,f)):u.Type===ps.RTL?l=Hw(l,a,f):u.Type===ps.LTR?(l+=u.Word,a=l.length):(u.Type===ps.WEAK||u.Type===ps.BRACKETS)&&(d>0&&s[d-1].Type===ps.RTL?s.length>d+1?s[d+1].Type===ps.RTL?l=Hw(l,a,f):(l+=u.Word,a=l.length):l+=u.Word:(l+=u.Word,a=l.length))}n+=l,i<t.length-1&&(n+=`
`)}return n}var Fy=cf;var Sle=_(gle(),1);function VKe(){this.dimensions=void 0,this.billboardTexture=void 0,this.billboard=void 0}var LKe=1.2,xle="ID_WHITE_PIXEL",jz=new D(4,4),ZKe=new je(1,1,1,1);function RKe(e,t){let n=t._backgroundBillboardTexture;if(!n.hasImage){let o=document.createElement("canvas");o.width=jz.x,o.height=jz.y;let r=o.getContext("2d");r.fillStyle="#fff",r.fillRect(0,0,o.width,o.height),n.loadImage(xle,o),n.addImageSubRegion(xle,ZKe)}let i=e.add({collection:t});return i.setImageTexture(n),i}var Tb={};function GKe(e,t,n,i,o,r){return Tb.font=t,Tb.fillColor=n,Tb.strokeColor=i,Tb.strokeWidth=o,Tb.padding=Ys.PADDING,Tb.fill=r===Yo.FILL||r===Yo.FILL_AND_OUTLINE,Tb.stroke=r===Yo.OUTLINE||r===Yo.FILL_AND_OUTLINE,Tb.backgroundColor=Y.BLACK,v_(e,Tb)}function qz(e,t){let n=t.billboard;c(n)&&(n.show=!1,c(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}var EKe=new Sle.default,XKe=/\s/;function IKe(e,t){let n=t._renderedText,i=EKe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;if(t._relativeSize=t._fontSize/Ys.FONT_SIZE,o<s)for(let y=o;y<s;++y)qz(e,r[y]);r.length=o;let a=t.show&&t._showBackground&&n.split(`
`).join("").length>0,l=t._backgroundBillboard,d=e._backgroundBillboardCollection;a?(c(l)||(l=RKe(d,e),t._backgroundBillboard=l),l.color=t._backgroundColor,l.show=t._show,l.position=t._position,l.eyeOffset=t._eyeOffset,l.pixelOffset=t._pixelOffset,l.horizontalOrigin=xi.LEFT,l.verticalOrigin=t._verticalOrigin,l.heightReference=t._heightReference,l.scale=t.totalScale,l.pickPrimitive=t,l.id=t._id,l.translucencyByDistance=t._translucencyByDistance,l.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,l.scaleByDistance=t._scaleByDistance,l.distanceDisplayCondition=t._distanceDisplayCondition,l.disableDepthTestDistance=t._disableDepthTestDistance,l.clusterShow=t.clusterShow):c(l)&&(d.remove(l),t._backgroundBillboard=l=void 0);let u=e._glyphBillboardCollection,f=u.billboardTextureCache,p=e._textDimensionsCache;for(let y=0;y<o;++y){let h=i[y],g=t._verticalOrigin,x=JSON.stringify([h,t._fontFamily,t._fontStyle,t._fontWeight,+g]),S=p[x],V=f.get(x);if(!c(V)||!c(S)){V=new xb(u),f.set(x,V);let I=`${t._fontStyle} ${t._fontWeight} ${Ys.FONT_SIZE}px ${t._fontFamily}`,v=GKe(h,I,Y.WHITE,Y.WHITE,0,Yo.FILL);if(S=v.dimensions,p[x]=S,v.width>0&&v.height>0&&!XKe.test(h)){let P=(0,Tle.default)(v,{cutoff:Ys.CUTOFF,radius:Ys.RADIUS}),F=v.getContext("2d"),N=v.width,b=v.height,G=F.getImageData(0,0,N,b);for(let X=0;X<N;X++)for(let W=0;W<b;W++){let A=W*N+X,k=P[A]*255,B=A*4;G.data[B+0]=k,G.data[B+1]=k,G.data[B+2]=k,G.data[B+3]=k}F.putImageData(G,0,0),V.loadImage(x,v)}}let Z=r[y];if(c(Z)||(Z=new VKe,Z.dimensions=S,Z.billboardTexture=V,r[y]=Z),Z.billboardTexture.id!==x&&(Z.billboardTexture=V,Z.dimensions=S),!V.hasImage){qz(e,Z);continue}let R=Z.billboard,E=e._spareBillboards;c(R)||(E.length>0?R=E.pop():(R=u.add({collection:e}),R._labelDimensions=new D,R._labelTranslate=new D),Z.billboard=R),R.setImageTexture(V),R.show=t._show,R.position=t._position,R.eyeOffset=t._eyeOffset,R.pixelOffset=t._pixelOffset,R.horizontalOrigin=xi.LEFT,R.verticalOrigin=t._verticalOrigin,R.heightReference=t._heightReference,R.scale=t.totalScale,R.pickPrimitive=t,R.id=t._id,R.translucencyByDistance=t._translucencyByDistance,R.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,R.scaleByDistance=t._scaleByDistance,R.distanceDisplayCondition=t._distanceDisplayCondition,R.disableDepthTestDistance=t._disableDepthTestDistance,R._batchIndex=t._batchIndex,R.outlineColor=t.outlineColor,t.style===Yo.FILL_AND_OUTLINE?(R.color=t._fillColor,R.outlineWidth=t.outlineWidth):t.style===Yo.FILL?(R.color=t._fillColor,R.outlineWidth=0):t.style===Yo.OUTLINE&&(R.color=Y.TRANSPARENT,R.outlineWidth=t.outlineWidth)}t._repositionAllGlyphs=!0}function _le(e,t,n){return t===xi.CENTER?-e/2:t===xi.RIGHT?-(e+n.x):n.x}var fr=new D,WKe=new D;function wKe(e){let t=e._glyphs,n=e._renderedText,i=0,o=0,r=[],s=Number.NEGATIVE_INFINITY,a=0,l=1,d=t.length,u=e._backgroundBillboard,f=D.clone(c(u)?e._backgroundPadding:D.ZERO,WKe);f.x/=e._relativeSize,f.y/=e._relativeSize;for(let F=0;F<d;++F){if(n.charAt(F)===`
`){r.push(i),++l,i=0;continue}let b=t[F].dimensions;c(b)&&(a=Math.max(a,b.height-b.descent),s=Math.max(s,b.descent),i+=b.width-b.minx,F<d-1&&(i+=t[F+1].dimensions.minx),o=Math.max(o,i))}r.push(i);let p=a+s,y=e.totalScale,h=e._horizontalOrigin,g=e._verticalOrigin,x=0,S=r[x],V=_le(S,h,f),Z=(c(e._lineHeight)?e._lineHeight:LKe*e._fontSize)/e._relativeSize,R=Z*(l-1),E=o,I=p+R;c(u)&&(E+=f.x*2,I+=f.y*2,u._labelHorizontalOrigin=h),fr.x=V*y,fr.y=0;let v=!0,P=0;for(let F=0;F<d;++F){if(n.charAt(F)===`
`){++x,P+=Z,S=r[x],V=_le(S,h,f),fr.x=V*y,v=!0;continue}let N=t[F],b=N.dimensions;if(c(b)&&(g===Mn.TOP?(fr.y=b.height-a-f.y,fr.y+=Ys.PADDING):g===Mn.CENTER?fr.y=(R+b.height-a)/2:g===Mn.BASELINE?(fr.y=R,fr.y-=Ys.PADDING):(fr.y=R+s+f.y,fr.y-=Ys.PADDING),fr.y=(fr.y-b.descent-P)*y,v&&(fr.x-=Ys.PADDING*y,v=!1),c(N.billboard)&&(N.billboard._setTranslate(fr),N.billboard._labelDimensions.x=E,N.billboard._labelDimensions.y=I,N.billboard._labelHorizontalOrigin=h),F<d-1)){let G=t[F+1];fr.x+=(b.width-b.minx+G.dimensions.minx)*y}}if(c(u)&&n.split(`
`).join("").length>0&&(h===xi.CENTER?V=-o/2-f.x:h===xi.RIGHT?V=-(o+f.x*2):V=0,fr.x=V*y,g===Mn.TOP?fr.y=p-a-s:g===Mn.CENTER?fr.y=(p-a)/2-s:g===Mn.BASELINE?fr.y=-f.y-s:fr.y=0,fr.y=fr.y*y,u.width=E,u.height=I,u._setTranslate(fr),u._labelTranslate=D.clone(fr,u._labelTranslate)),Lu(e.heightReference))for(let F=0;F<d;++F){let b=t[F].billboard;c(b)&&(b._labelTranslate=D.clone(fr,b._labelTranslate))}}function Cle(e,t){let n=t._glyphs;for(let i=0,o=n.length;i<o;++i)qz(e,n[i]);c(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,c(t._removeCallbackFunc)&&t._removeCallbackFunc(),he(t)}function Rh(e){e=e??z.EMPTY_OBJECT,this._scene=e.scene,this._batchTable=e.batchTable;let t=new Gd({scene:this._scene,textureAtlas:new Zx({initialSize:jz})});this._backgroundBillboardCollection=t,this._backgroundBillboardTexture=new xb(t),this._glyphBillboardCollection=new Gd({scene:this._scene,batchTable:this._batchTable}),this._glyphBillboardCollection._sdf=!0,this._spareBillboards=[],this._textDimensionsCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=Y.clone(Y.WHITE),this.show=e.show??!0,this.modelMatrix=M.clone(e.modelMatrix??M.IDENTITY),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.blendOption=e.blendOption??Lo.OPAQUE_AND_TRANSLUCENT}Object.defineProperties(Rh.prototype,{length:{get:function(){return this._labels.length}},sizeInBytes:{get:function(){return this._glyphBillboardCollection.sizeInBytes+this._backgroundBillboardCollection.sizeInBytes}},ready:{get:function(){let e=this._backgroundBillboardCollection.get(0);return c(e)&&!e.ready?!1:this._glyphBillboardCollection.ready}}});Rh.prototype.add=function(e){let t=new Fy(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Rh.prototype.remove=function(e){if(c(e)&&e._labelCollection===this){let t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),Cle(this,e),!0}return!1};Rh.prototype.removeAll=function(){let e=this._labels;for(let t=0,n=e.length;t<n;++t)Cle(this,e[t]);e.length=0};Rh.prototype.contains=function(e){return c(e)&&e._labelCollection===this};Rh.prototype.get=function(e){if(!c(e))throw new L("index is required.");return this._labels[e]};Rh.prototype.update=function(e){if(!this.show)return;let t=this._glyphBillboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;let i=this._labelsToUpdate.length;for(let r=0;r<i;++r){let s=this._labelsToUpdate[r];if(s.isDestroyed())continue;let a=s._glyphs.length;s._rebindAllGlyphs&&(IKe(this,s),s._rebindAllGlyphs=!1),s._repositionAllGlyphs&&(wKe(s),s._repositionAllGlyphs=!1);let l=s._glyphs.length-a;this._totalGlyphCount+=l}let o=n.length>0?Lo.TRANSLUCENT:this.blendOption;t.blendOption=o,n.blendOption=o,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};Rh.prototype.isDestroyed=function(){return!1};Rh.prototype.destroy=function(){return this.removeAll(),this._glyphBillboardCollection=this._glyphBillboardCollection.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),he(this)};var Gh=Rh;var QOn=_(T(),1);var MUn=_(T(),1),zw=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 position2DHigh;
in vec3 position2DLow;
in vec3 prevPosition3DHigh;
in vec3 prevPosition3DLow;
in vec3 prevPosition2DHigh;
in vec3 prevPosition2DLow;
in vec3 nextPosition3DHigh;
in vec3 nextPosition3DLow;
in vec3 nextPosition2DHigh;
in vec3 nextPosition2DLow;
in vec4 texCoordExpandAndBatchIndex;
out vec2 v_st;
out float v_width;
out vec4 v_pickColor;
out 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;
}
`;var dOn=_(T(),1);var jUn=_(T(),1);var tl={};tl.numberOfPoints=function(e,t,n){let i=m.distance(e,t);return Math.ceil(i/n)};tl.numberOfPointsRhumbLine=function(e,t,n){let i=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(i/(n*n))))};var PKe=new pe;tl.extractHeights=function(e,t){let n=e.length,i=new Array(n);for(let o=0;o<n;o++){let r=e[o];i[o]=t.cartesianToCartographic(r,PKe).height}return i};var vKe=new M,FKe=new m,Vle=new m,AKe=new cn(m.UNIT_X,0),Lle=new m,MKe=new cn(m.UNIT_X,0),NKe=new m,kKe=new m,eK=[];function Rle(e,t,n){let i=eK;i.length=e;let o;if(t===n){for(o=0;o<e;o++)i[o]=t;return i}let s=(n-t)/e;for(o=0;o<e;o++){let a=t+o*s;i[o]=a}return i}var gk=new pe,yk=new pe,Ay=new m,tK=new m,UKe=new m,$z=new Fp,Kw=new va;function OKe(e,t,n,i,o,r,s,a){let l=i.scaleToGeodeticSurface(e,tK),d=i.scaleToGeodeticSurface(t,UKe),u=tl.numberOfPoints(e,t,n),f=i.cartesianToCartographic(l,gk),p=i.cartesianToCartographic(d,yk),y=Rle(u,o,r);$z.setEndPoints(f,p);let h=$z.surfaceDistance/u,g=a;f.height=o;let x=i.cartographicToCartesian(f,Ay);m.pack(x,s,g),g+=3;for(let S=1;S<u;S++){let V=$z.interpolateUsingSurfaceDistance(S*h,yk);V.height=y[S],x=i.cartographicToCartesian(V,Ay),m.pack(x,s,g),g+=3}return g}function DKe(e,t,n,i,o,r,s,a){let l=i.cartesianToCartographic(e,gk),d=i.cartesianToCartographic(t,yk),u=tl.numberOfPointsRhumbLine(l,d,n);l.height=0,d.height=0;let f=Rle(u,o,r);Kw.ellipsoid.equals(i)||(Kw=new va(void 0,void 0,i)),Kw.setEndPoints(l,d);let p=Kw.surfaceDistance/u,y=a;l.height=o;let h=i.cartographicToCartesian(l,Ay);m.pack(h,s,y),y+=3;for(let g=1;g<u;g++){let x=Kw.interpolateUsingSurfaceDistance(g*p,yk);x.height=f[g],h=i.cartographicToCartesian(x,Ay),m.pack(h,s,y),y+=3}return y}tl.wrapLongitude=function(e,t){let n=[],i=[];if(c(e)&&e.length>0){t=t??M.IDENTITY;let o=M.inverseTransformation(t,vKe),r=M.multiplyByPoint(o,m.ZERO,FKe),s=m.normalize(M.multiplyByPointAsVector(o,m.UNIT_Y,Vle),Vle),a=cn.fromPointNormal(r,s,AKe),l=m.normalize(M.multiplyByPointAsVector(o,m.UNIT_X,Lle),Lle),d=cn.fromPointNormal(r,l,MKe),u=1;n.push(m.clone(e[0]));let f=n[0],p=e.length;for(let y=1;y<p;++y){let h=e[y];if(cn.getPointDistance(d,f)<0||cn.getPointDistance(d,h)<0){let g=qn.lineSegmentPlane(f,h,a,NKe);if(c(g)){let x=m.multiplyByScalar(s,5e-9,kKe);cn.getPointDistance(a,f)<0&&m.negate(x,x),n.push(m.add(g,x,new m)),i.push(u+1),m.negate(x,x),n.push(m.add(g,x,new m)),u=1}}n.push(m.clone(e[y])),u++,f=h}i.push(u)}return{positions:n,lengths:i}};tl.generateArc=function(e){c(e)||(e={});let t=e.positions;if(!c(t))throw new L("options.positions is required.");let n=t.length,i=e.ellipsoid??re.default,o=e.height??0,r=Array.isArray(o);if(n<1)return[];if(n===1){let g=i.scaleToGeodeticSurface(t[0],tK);if(o=r?o[0]:o,o!==0){let x=i.geodeticSurfaceNormal(g,Ay);m.multiplyByScalar(x,o,x),m.add(g,x,g)}return[g.x,g.y,g.z]}let s=e.minDistance;if(!c(s)){let g=e.granularity??w.RADIANS_PER_DEGREE;s=w.chordLength(g,i.maximumRadius)}let a=0,l;for(l=0;l<n-1;l++)a+=tl.numberOfPoints(t[l],t[l+1],s);let d=(a+1)*3,u=new Array(d),f=0;for(l=0;l<n-1;l++){let g=t[l],x=t[l+1],S=r?o[l]:o,V=r?o[l+1]:o;f=OKe(g,x,s,i,S,V,u,f)}eK.length=0;let p=t[n-1],y=i.cartesianToCartographic(p,gk);y.height=r?o[n-1]:o;let h=i.cartographicToCartesian(y,Ay);return m.pack(h,u,d-3),u};var Zle=new pe,BKe=new pe;tl.generateRhumbArc=function(e){c(e)||(e={});let t=e.positions;if(!c(t))throw new L("options.positions is required.");let n=t.length,i=e.ellipsoid??re.default,o=e.height??0,r=Array.isArray(o);if(n<1)return[];if(n===1){let S=i.scaleToGeodeticSurface(t[0],tK);if(o=r?o[0]:o,o!==0){let V=i.geodeticSurfaceNormal(S,Ay);m.multiplyByScalar(V,o,V),m.add(S,V,S)}return[S.x,S.y,S.z]}let s=e.granularity??w.RADIANS_PER_DEGREE,a=0,l,d=i.cartesianToCartographic(t[0],Zle),u;for(l=0;l<n-1;l++)u=i.cartesianToCartographic(t[l+1],BKe),a+=tl.numberOfPointsRhumbLine(d,u,s),d=pe.clone(u,Zle);let f=(a+1)*3,p=new Array(f),y=0;for(l=0;l<n-1;l++){let S=t[l],V=t[l+1],Z=r?o[l]:o,R=r?o[l+1]:o;y=DKe(S,V,s,i,Z,R,p,y)}eK.length=0;let h=t[n-1],g=i.cartesianToCartographic(h,gk)
`,this.material.shaderSource,Ax]}),r=t.getVertexShaderCallback()(zw),s=new Be({defines:i,sources:[bd,r]});this.shaderProgram=tn.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:Ul})};function Dle(e){return m.dot(m.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(cn.ORIGIN_ZX_PLANE)===zt.INTERSECTING}Eh.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===se.SCENE3D||!Dle(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 Ls=new m,Uu=new m,Ou=new m,_k=new m,sJe=new ce,aJe=new D;Eh.prototype.write=function(e,t,n,i,o,r,s,a){let l=this.mode,d=a.ellipsoid.maximumRadius*w.PI,u=this.polylines,f=u.length;for(let p=0;p<f;++p){let y=u[p],h=y.width,g=y.show&&h>0,x=y._index,S=this.getSegments(y,a),V=S.positions,Z=S.lengths,R=V.length,E=y.getPickId(s).color,I=0,v=0,P;for(let B=0;B<R;++B){B===0?y._loop?P=V[R-2]:(P=_k,m.subtract(V[0],V[1],P),m.add(V[0],P,P)):P=V[B-1],m.clone(P,Uu),m.clone(V[B],Ls),B===R-1?y._loop?P=V[1]:(P=_k,m.subtract(V[R-1],V[R-2],P),m.add(V[R-1],P,P)):P=V[B+1],m.clone(P,Ou);let O=Z[I];B===v+O&&(v+=O,++I);let H=B-v===0,U=B===v+Z[I]-1;l===se.SCENE2D&&(Uu.z=0,Ls.z=0,Ou.z=0),(l===se.SCENE2D||l===se.MORPHING)&&(H||U)&&d-Math.abs(Ls.x)<1&&((Ls.x<0&&Uu.x>0||Ls.x>0&&Uu.x<0)&&m.clone(Ls,Uu),(Ls.x<0&&Ou.x>0||Ls.x>0&&Ou.x<0)&&m.clone(Ls,Ou));let K=H?2:0,Q=U?2:4;for(let ie=K;ie<Q;++ie){Bn.writeElements(Ls,e,n),Bn.writeElements(Uu,e,n+6),Bn.writeElements(Ou,e,n+12);let j=ie-2<0?-1:1;t[o]=B/(R-1),t[o+1]=2*(ie%2)-1,t[o+2]=j,t[o+3]=x,n+=6*3,o+=4}}let F=sJe;F.x=Y.floatToByte(E.red),F.y=Y.floatToByte(E.green),F.z=Y.floatToByte(E.blue),F.w=Y.floatToByte(E.alpha);let N=aJe;N.x=h,N.y=g?1:0;let b=l===se.SCENE2D?y._boundingVolume2D:y._boundingVolumeWC,G=Bn.fromCartesian(b.center,Mle),X=G.high,W=ce.fromElements(G.low.x,G.low.y,G.low.z,b.radius,Nle),A=kle;A.x=0,A.y=Number.MAX_VALUE;let k=y.distanceDisplayCondition;c(k)&&(A.x=k.near,A.y=k.far),r.setBatchedAttribute(x,0,N),r.setBatchedAttribute(x,1,F),r.attributes.length>2&&(r.setBatchedAttribute(x,2,X),r.setBatchedAttribute(x,3,W),r.setBatchedAttribute(x,4,A))}};var cJe=new m,lJe=new m,dJe=new m,Ple=new m;Eh.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,l=s._segments.lengths,d=a.length,u=0,f=0;for(let p=0;p<d;++p){let y;p===0?s._loop?y=a[d-2]:(y=Ple,m.subtract(a[0],a[1],y),m.add(a[0],y,y)):y=a[p-1],y=M.multiplyByPoint(n,y,lJe);let h=M.multiplyByPoint(n,a[p],cJe),g;p===d-1?s._loop?g=a[1]:(g=Ple,m.subtract(a[d-1],a[d-2],g),m.add(a[d-1],g,g)):g=a[p+1],g=M.multiplyByPoint(n,g,dJe);let x=l[u];p===f+x&&(f+=x,++u);let S=p-f===0,V=p===f+l[u]-1,Z=S?2:0,R=V?2:4;for(let E=Z;E<R;++E)Bn.writeElements(h,e,t),Bn.writeElements(y,e,t+6),Bn.writeElements(g,e,t+12),t+=6*3}}};var uJe=new Array(1);Eh.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new nK(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],l=0;a.length>0&&(l=a[a.length-1]+1);let d=this.polylines,u=d.length;for(let f=0;f<u;++f){let p=d[f];p._locatorBuckets=[];let y;if(this.mode===se.SCENE3D){y=uJe;let g=p._actualPositions.length;if(g>0)y[0]=g;else continue}else y=p._segments.lengths;let h=y.length;if(h>0){let g=0;for(let x=0;x<h;++x){let S=y[x]-1;for(let V=0;V<S;++V)l+4>w.SIXTY_FOUR_KILOBYTES&&(p._locatorBuckets.push({locator:r,count:g}),g=0,t.push(4),a=[],e.push(a),l=0,r.count=s,s=0,i=0,r=new nK(0,0,this),n[++o]=[r]),a.push(l,l+2,l+1),a.push(l+1,l+2,l+3),g+=6,s+=6,i+=6,l+=4}p._locatorBuckets.push({locator:r,count:g}),l+4>w.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),l=0,r.count=s,i=0,s=0,r=new nK(0,0,this),n[++o]=[r])}p._clean()}return r.count=s,i};Eh.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 p1={positions:void 0,lengths:void 0},vle=new Array(1),mJe=new m,fJe=new pe;Eh.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===se.SCENE3D)return vle[0]=n.
in vec4 previousPosition;
in vec4 nextPosition;
in vec2 expandAndWidth;
in 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 uf(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=e.ellipsoid??re.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=Y.clone(Y.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(uf.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function IJe(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+de.packedLength+re.packedLength+m.packedLength,a=new Float64Array(s),l=0;return a[l++]=n,a[l++]=i,de.pack(t,a,l),l+=de.packedLength,re.pack(o,a,l),l+=re.packedLength,m.pack(r,a,l),a}var WJe=new gi("createVectorTilePolylines",5),b1={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function wJe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(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=IJe(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},d=WJe.scheduleTask(l,a);if(c(d))return d.then(function(u){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(u.decodedPositions),e._decodedPositionOffsets=new Uint32Array(u.decodedPositionOffsets)),e._currentPositions=new Float32Array(u.currentPositions),e._previousPositions=new Float32Array(u.previousPositions),e._nextPositions=new Float32Array(u.nextPositions),e._expandAndWidth=new Float32Array(u.expandAndWidth),e._vertexBatchIds=new Uint16Array(u.batchIds);let f=u.indexDatatype;e._indices=f===Me.UNSIGNED_SHORT?new Uint16Array(u.indices):new Uint32Array(u.indices),PJe(e,t),e._ready=!0}).catch(u=>{e.isDestroyed()||(e._error=u)})}function PJe(e,t){if(!c(e._va)){let n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices,l=i.byteLength+n.byteLength+o.byteLength;l+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=l;let d=_t.createVertexBuffer({context:t,typedArray:i,usage:Ne.STATIC_DRAW}),u=_t.createVertexBuffer({context:t,typedArray:n,usage:Ne.STATIC_DRAW}),f=_t.createVertexBuffer({context:t,typedArray:o,usage:Ne.STATIC_DRAW}),p=_t.createVertexBuffer({context:t,typedArray:r,usage:Ne.STATIC_DRAW}),y=_t.createVertexBuffer({context:t,typedArray:s,usage:Ne.STATIC_DRAW}),h=_t.createIndexBuffer({context:t,typedArray:a,usage:Ne.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?Me.UNSIGNED_SHORT:Me.UNSIGNED_INT}),g=[{index:b1.previousPosition,vertexBuffer:d,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:b1.currentPosition,vertexBuffer:u,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:b1.nextPosition,vertexBuffer:f,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:b1.expandAndWidth,vertexBuffer:p,componentDatatype:q.FLOAT,componentsPerAttribute:2},{index:b1.a_batchId,vertexBuffer:y,componentDatatype:q.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new ni({context:t,attributes:g,indexBuffer:h}),e._positions=void 0,e._widths=void 0,e._coun
void main()
{
out_FragColor = u_highlightColor;
}
`;function MJe(e,t){if(c(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(tP),o=n.getFragmentShaderCallback(!1,void 0,!1)(AJe),r=new Be({defines:["VECTOR_TILE",Ot.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[bd,i]}),s=new Be({defines:["VECTOR_TILE"],sources:[o]});e._sp=tn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:b1})}function NJe(e,t){if(!c(e._command)){let n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new et({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:Xe.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}uf.getPolylinePositions=function(e,t){let n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!c(n)||!c(i))return;let r,s,a=n.length,l=0,d=0;for(r=0;r<a;++r)n[r]===t&&(l+=o[r+1]-o[r]);if(l===0)return;let u=new Float64Array(l*3);for(r=0;r<a;++r)if(n[r]===t){let f=o[r],p=o[r+1]-f;for(s=0;s<p;++s){let y=(f+s)*3;u[d++]=i[y],u[d++]=i[y+1],u[d++]=i[y+2]}}return u};uf.prototype.getPositions=function(e){return uf.getPolylinePositions(this,e)};uf.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 Us(e,r)}};uf.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function kJe(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=Y.WHITE}}var UJe=new Y,OJe=Y.WHITE,DJe=!0;uf.prototype.applyStyle=function(e,t){if(!c(e)){kJe(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=c(e.color)?e.color.evaluateColor(s,UJe):OJe,s.show=c(e.show)?e.show.evaluate(s):DJe}};uf.prototype.update=function(e){let t=e.context;if(!this._ready){if(c(this._promise)||(this._promise=wJe(this,t)),c(this._error)){let i=this._error;throw this._error=void 0,i}return}vJe(this,t),MJe(this,t),FJe(this);let n=e.passes;(n.render||n.pick)&&NJe(this,e)};uf.prototype.isDestroyed=function(){return!1};uf.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),he(this)};var A_=uf;var UBn=_(T(),1);var oBn=_(T(),1),iP=`in vec3 startEllipsoidNormal;
in vec3 endEllipsoidNormal;
in vec4 startPositionAndHeight;
in vec4 endPositionAndHeight;
in vec4 startFaceNormalAndVertexCorner;
in vec4 endFaceNormalAndHalfWidth;
in float a_batchId;
uniform mat4 u_modifiedModelView;
uniform vec2 u_minimumMaximumVectorHeights;
out vec4 v_startPlaneEC;
out vec4 v_endPlaneEC;
out vec4 v_rightPlaneEC;
out float v_halfWidth;
out 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 sBn=_(T(),1),oP=`in vec4 v_startPlaneEC;
in vec4 v_endPlaneEC;
in vec4 v_rightPlaneEC;
in float v_halfWidth;
in vec3 v_volumeUpEC;
uniform vec4 u_highlightColor;
void main()
{
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
if (logDepthOrDepth == 0.0) {
#ifdef DEBUG_SHOW_VOLUME
out_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
out_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
out_FragColor = u_highlightColor;
czm_writeDepthClamp();
}
`;function Vb(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=e.ellipsoid??re.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 D(ui._defaultMinTerrainHeight,ui._defaultMaxTerrainHeight),this._boundingVolume=Xn.fromRectangle(e.rectangle,ui._defaultMinTerrainHeight,ui._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=Y.clone(Y.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(Vb.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function BJe(e,t,n){let i=ui.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;let a=e._boundingVolume,l=e._rectangle;Xn.fromRectangle(l,o,r,n,a)}function YJe(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+de.packedLength+re.packedLength+m.packedLength,a=new Float64Array(s),l=0;return a[l++]=n,a[l++]=i,de.pack(t,a,l),l+=de.packedLength,re.pack(o,a,l),l+=re.packedLength,m.pack(r,a,l),a}var HJe=new gi("createVectorTileClampedPolylines"),Ny={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function zJe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(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=YJe(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},d=HJe.scheduleTask(l,a);if(c(d))return d.then(function(u){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(u.decodedPositions),e._decodedPositionOffsets=new Uint32Array(u.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(u.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(u.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(u.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(u.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(u.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(u.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(u.vertexBatchIds);let f=u.indexDatatype;e._indices=f===Me.UNSIGNED_SHORT?new Uint16Array(u.indices):new Uint32Array(u.indices),KJe(e,t),e._ready=!0}).catch(u=>{e.isDestroyed()||(e._error=u)})}function KJe(e,t){if(!c(e._va)){let n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,l=e._vertexBatchIds,d=e._indices,u=n.byteLength+i.byteLength;u+=o.byteLength+r.byteLength,u+=s.byteLength+a.byteLength,u+=l.byteLength+d.byteLength,e._trianglesLength=d.length/3,e._geometryByteLength=u;let f=_t.createVertexBuffer({context:t,typedArray:n,usage:Ne.STATIC_D
The tileset will be rendered with a larger screen space error (see memoryAdjustedScreenSpaceError).
Consider using larger values for cacheBytes and maximumCacheOverflowBytes.`),e._memoryAdjustedScreenSpaceError*=1.02;let t=e._processingQueue;for(let n=0;n<t.length;++n)t[n].updatePriority();t.sort(Nde)}function T4e(e){e._memoryAdjustedScreenSpaceError=Math.max(e.memoryAdjustedScreenSpaceError/1.02,e.maximumScreenSpaceError)}var Ek=new m,S4e={maximumFractionDigits:3};function Mde(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,S4e):Math.round(t).toLocaleString()}function wK(e){let{halfAxes:t,radius:n,center:i}=e.boundingVolume.boundingVolume,o=m.clone(i,Ek);if(c(t))o.x+=.75*(t[0]+t[3]+t[6]),o.y+=.75*(t[1]+t[4]+t[7]),o.z+=.75*(t[2]+t[5]+t[8]);else if(c(n)){let r=m.normalize(i,Ek);r=m.multiplyByScalar(r,.75*n,Ek),o=m.add(r,i,Ek)}return o}function PK(e,t,n){let i="",o=0;if(t.debugShowGeometricError&&(i+=`
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: ${Mde(e.content.texturesByteLength)}`,i+=`
Geometry Memory: ${Mde(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 C4e(e,t){let n=e._selectedTiles,i=n.length,o=e._emptyTiles,r=o.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(c(e.debugPickedTile)){let s=c(e.debugPickPosition)?e.debugPickPosition:wK(e.debugPickedTile),a=PK(e.debugPickedTile,e,s);a.pixelOffset=new D(15,-15)}}else{for(let s=0;s<i;++s){let a=n[s];PK(a,e,wK(a))}for(let s=0;s<r;++s){let a=o[s];(a.hasTilesetContent||a.hasImplicitContent)&&PK(a,e,wK(a))}}e._tileDebugLabels.update(t)}function V4e(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;let{commandList:i,context:o}=t,r=i.length,s=e._selectedTiles,a=e.isSkippingLevelOfDetail&&e._hasMixedContent&&o.stencilBuffer&&s.length>0;e._backfaceCommands.length=0,a&&(c(e._stencilClearCommand)||(e._stencilClearCommand=new ti({stencil:0,pass:Xe.CESIUM_3D_TILE,renderState:Oe.fromCache({stencilMask:kt.SKIP_LOD_MASK})})),i.push(e._stencilClearCommand));let{statistics:l,tileVisible:d}=e,u=n.isRender,f=i.length;for(let h=0;h<s.length;++h){let g=s[h];u&&d.raiseEvent(g),g4e(e,g,t),g.update(e,t,n),l.incrementSelectionCounts(g.content),++l.selected}let p=e._emptyTiles;for(let h=0;h<p.length;++h)p[h].update(e,t,n);let y=i.length-f;if(e._backfaceCommands.trim(),a){let h=e._backfaceCommands.values,g=h.length;i.length+=g;for(let x=y-1;x>=0;--x)i[f+g+x]=i[f+x];for(let x=0;x<g;++x)i[f+x]=h[x]}y=i.length-r,l.numberOfCommands=y,u&&(e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&y>0&&e._pointCloudEyeDomeLighting.update(t,r,e.pointCloudShading,e.boundingSphere),e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(c(e._tileDebugLabels)||(e._tileDebugLabels=new Gh),C4e(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var Ude=[];function L4e(e,t){let n=t,i=Ude;for(i.push(t);i.length>0;){t=i.pop();let o=t.children;for(let r=0;r<o.length;++r)i.push(o[r]);t!==n&&(Z4e(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function Ode(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function Z4e(e,t){e._cache.unloadTile(e,t,Ode),t.destroy()}rr.prototype.trimLoadedTiles=function(){this._cache.trim()};function R4e(e,t){let n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;pf.clone(n,i);let l=o!==s||r!==a;l&&t.afterRender.push(function(){return e.loadProgress.raiseEvent(o,r),!0}),e._tilesLoaded=n.numberOfPendingRequests===0&&n.numberOfTilesProcessing===0&&n.numberOfAttemptedRequests===0,l&&e._tilesLoaded&&(t.afterRender.push(function(){return e.allTilesLoaded.raiseEvent(),!0}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){return e.initialTilesLoaded.raiseEvent(),!0})))}function G4e(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 E4e(e,t){t.frameNumber===e._updatedModelMatrixFrame&&c(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!M.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=M.clone(e.modelMatrix,e._previousModelMatrix)))}function X4e(e,t,n,i){if(t.mode===se.MORPHING||!c(e._root))return!1;let o=e._statistics;o.clear(),++e._updatedVisibilityFrame,G4e(e),E4e(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;let r=e.getTraversal(i).selectTiles(e,t);if(i.requestTiles&&f4e(e),V4e(e,t,i),pf.clone(o,n),i.isRen
in vec4 v_outlineColor;
in float v_innerPercent;
in float v_pixelDistance;
in vec4 v_pickColor;
in float v_splitDirection;
void main()
{
if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
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
out_FragColor = czm_gammaCorrect(color);
czm_writeLogDepth();
}
`;var rqn=_(T(),1),BP=`uniform float u_maxTotalPointSize;
in vec4 positionHighAndSize;
in vec4 positionLowAndOutline;
in vec4 compressedAttribute0;
in vec4 compressedAttribute1;
in vec4 scaleByDistance;
in vec4 distanceDisplayConditionAndDisableDepthAndSplitDirection;
out vec4 v_color;
out vec4 v_outlineColor;
out float v_innerPercent;
out float v_pixelDistance;
out vec4 v_pickColor;
out float v_splitDirection;
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;
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
if (totalSize > 0.0) {
totalSize += 3.0;
}
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 = distanceDisplayConditionAndDisableDepthAndSplitDirection.x;
float farSq = distanceDisplayConditionAndDisableDepthAndSplitDirection.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 = distanceDisplayConditionAndDisableDepthAndSplitDirection.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;
v_splitDirection = distanceDisplayConditionAndDisableDepthAndSplitDirection.w;
}
`;var K8e=Gs.SHOW_INDEX,$K=Gs.POSITION_INDEX,Nue=Gs.COLOR_INDEX,J8e=Gs.OUTLINE_COLOR_INDEX,Q8e=Gs.OUTLINE_WIDTH_INDEX,j8e=Gs.PIXEL_SIZE_INDEX,kue=Gs.SCALE_BY_DISTANCE_INDEX,Uue=Gs.TRANSLUCENCY_BY_DISTANCE_INDEX,Oue=Gs.DISTANCE_DISPLAY_CONDITION_INDEX,q8e=Gs.DISABLE_DEPTH_DISTANCE_INDEX,$8e=Gs.SPLIT_DIRECTION_INDEX,eJ=Gs.NUMBER_OF_PROPERTIES,Cc={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepthAndSplitDirection:5};function ju(e){e=e??z.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(eJ),this._maxPixelSize=1,this._baseVolume=new ue,this._baseVolumeWC=new ue,this._baseVolume2D=new ue,this._boundingVolume=new ue,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=e.show??!0,this.modelMatrix=M.clone(e.modelMatrix??M.IDENTITY),this._modelMatrix=M.clone(M.IDENTITY),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.blendOption=e.blendOption??Lo.OPAQUE_AND_TRANSLUCENT,this._blendOption=void 0,this._mode=se.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW];let t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(ju.prototype,{length:{get:function(){return tJ(this),this._pointPrimitives.length}}});function Due(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}ju.prototype.add=function(e){let t=new Gs(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};ju.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};ju.prototype.removeAll=function(){Due(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function tJ(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}}ju.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};ju.prototype.contains=function(e){return c(e)&&e._pointPrimitiveCollection===this};ju.prototype.get=function(e){if(!c(e))throw new L("index is required.");return tJ(this),this._pointPrimitives[e]};ju.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<eJ;++i){let o=n[i]===0?Ne.STATIC_DRAW:Ne.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function e7e(e,t,n){return new Ip(e,[{index:Cc.positionHighAndSize,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[$K]},{index:Cc.positionLowAndShow,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[$K]},{index:Cc.compressedAttribute0,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Nue]},{index:Cc.compressedAttribute1,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Uue]},{index:Cc.scaleByDistance,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[kue]},{index:Cc.distanceDisplayConditionAndDisableDepthAndSplitDirection,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Oue]}],t)}var jK=new Bn;function Bue(e,t,n,i){let o=i._index,r=i._getAc
layout (location = 0) out vec4 out_FragData_0;
layout (location = 1) out vec4 out_FragData_1;
#else
layout (location = 0) out vec4 out_FragColor;
#endif
uniform vec4 u_bgColor;
uniform sampler2D u_depthTexture;
in vec2 v_textureCoordinates;
void main()
{
if (texture(u_depthTexture, v_textureCoordinates).r < 1.0)
{
#ifdef MRT
out_FragData_0 = u_bgColor;
out_FragData_1 = vec4(u_bgColor.a);
#else
out_FragColor = u_bgColor;
#endif
return;
}
discard;
}
`;var qZi=_(T(),1),Ev=`in vec2 v_textureCoordinates;
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 alphaRoughness, vec3 N)
{
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
float phi = 2.0 * M_PI * xi.x;
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 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 smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
{
float alphaRoughnessSq = alphaRoughness * alphaRoughness;
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGX = GGXV + GGXL;
if (GGX > 0.0)
{
return 0.5 / GGX;
}
return 0.0;
}
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;
float alphaRoughness = roughness * roughness;
for (int i = 0; i < NumSamples; i++)
{
vec2 xi = hammersley2D(i, NumSamples);
vec3 H = importanceSampleGGX(xi, alphaRoughness, 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 = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
float G_Vis = 4.0 * G * VdotH * NdotL / NdotH;
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()
{
out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
}
`;var eRi=_(T(),1),Xv=`uniform sampler2D u_noiseTexture;
uniform vec3 u_noiseTextureDimensions;
uniform float u_noiseDetail;
in vec2 v_offset;
in vec3 v_maximumSize;
in vec4 v_color;
in float v_slice;
in 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));
}
vec2 voxelToUV(vec3 voxelIndex) {
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);
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 = texture(u_noiseTexture, uv0);
vec4 sample1 = texture(u_noiseTexture, uv1);
return mix(sample0, sample1, x);
}
vec4 sampleNoiseTexture(vec3 position) {
float textureSliceWidth = u_noiseTextureDimensions.x;
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
out_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)) {
out_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;
}
out_FragColor = cloud;
#endif
#endif
}
`;var nRi=_(T(),1),Iv=`#ifdef INSTANCED
in vec2 direction;
#endif
in vec4 positionHighAndScaleX;
in vec4 positionLowAndScaleY;
in vec4 packedAttribute0;
in vec4 packedAttribute1;
in vec4 color;
out vec2 v_offset;
out vec3 v_maximumSize;
out vec4 v_color;
out float v_slice;
out 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 oRi=_(T(),1),Wv=`uniform vec3 u_noiseTextureDimensions;
uniform float u_noiseDetail;
uniform vec3 u_noiseOffset;
in vec2 v_position;
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) {
float textureSliceWidth = u_noiseTextureDimensions.x;
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 textureSliceWidth = u_noiseTextureDimensions.x;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
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);
out_FragColor = vec4(worley0, worley1, worley2, 1.0);
}
`;var sRi=_(T(),1),wv=`uniform vec3 u_noiseTextureDimensions;
in vec2 position;
out 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;
}
`;var cRi=_(T(),1),Pv=`uniform sampler2D u_opaqueDepthTexture;
uniform sampler2D u_translucentDepthTexture;
in vec2 v_textureCoordinates;
void main()
{
float opaqueDepth = texture(u_opaqueDepthTexture, v_textureCoordinates).r;
float translucentDepth = texture(u_translucentDepthTexture, v_textureCoordinates).r;
translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
out_FragColor = czm_packDepth(translucentDepth);
}
`;var dRi=_(T(),1),vv=`uniform sampler2D u_opaque;
uniform sampler2D u_accumulation;
uniform sampler2D u_revealage;
in vec2 v_textureCoordinates;
void main()
{
vec4 opaque = texture(u_opaque, v_textureCoordinates);
vec4 accum = texture(u_accumulation, v_textureCoordinates);
float r = texture(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
out_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;
if (opaque != czm_backgroundColor)
{
out_FragColor.a = 1.0;
}
}
`;var mRi=_(T(),1),Fv=`in 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))
{
out_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
else
{
discard;
}
czm_writeLogDepth();
}
`;var hRi=_(T(),1),Av=`in vec4 position;
out vec4 positionEC;
void main()
{
positionEC = czm_modelView * position;
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
}
`;var bRi=_(T(),1),UV=`uniform vec3 u_radii;
uniform vec3 u_oneOverEllipsoidRadiiSquared;
in 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_ellipsoidTextureCoordinates(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);
out_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);
out_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);
#if (defined(WRITE_DEPTH) && (__VERSION__ == 300 || defined(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_FragDepth = (z * (f - n) + f + n) * 0.5;
#endif
#endif
}
`;var gRi=_(T(),1),OV=`in vec3 position;
uniform vec3 u_radii;
out 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 _Ri=_(T(),1);/**
* @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 Mv=`#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) texture(t, p)
#define FxaaTexOff(t, p, o, r) texture(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);
}
`;var SRi=_(T(),1),Nv=`uniform vec4 u_initialColor;
#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
#if defined(HAS_WATER_MASK) && (defined(SHOW_REFLECTIVE_OCEAN) || defined(APPLY_MATERIAL))
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
#ifdef ENABLE_CLIPPING_POLYGONS
uniform highp sampler2D u_clippingDistance;
in vec2 v_clippingPosition;
flat in int v_regionIndex;
#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;
uniform float u_vertexShadowDarkness;
#endif
in vec3 v_positionMC;
in vec3 v_positionEC;
in vec3 v_textureCoordinates;
in vec3 v_normalMC;
in vec3 v_normalEC;
#ifdef APPLY_MATERIAL
in float v_height;
in float v_slope;
in float v_aspect;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
in float v_distance;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
in vec3 v_atmosphereRayleighColor;
in vec3 v_atmosphereMieColor;
in 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 = texture(textureToSample, textureCoordinates);
vec3 color = value.rgb;
float alpha = value.a;
#ifdef APPLY_COLOR_TO_ALPHA
vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);
colorDiff.r = czm_maximumComponent(colorDiff);
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));
}
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;
if (czm_orthographicIn3D == 1.0)
{
direction = vec3(0.0, 0.0, -1.0);
}
else
{
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
#if defined(HAS_WATER_MASK) && (defined(SHOW_REFLECTIVE_OCEAN) || defined(APPLY_MATERIAL))
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 = texture(u_waterMask, waterMaskTextureCoordinates).r;
#ifdef SHOW_REFLECTIVE_OCEAN
if (mask > 0.0)
{
mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
vec2 ellipsoidTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC);
vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidTextureCoordinates(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
#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;
#ifdef HAS_WATER_MASK
materialInput.waterMask = mask;
#endif
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 + u_vertexShadowDarkness, 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 ENABLE_CLIPPING_POLYGONS
vec2 clippingPosition = v_clippingPosition;
int regionIndex = v_regionIndex;
clipPolygons(u_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);
#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
#ifdef COLOR_CORRECT
const bool ignoreBlackPixels = true;
rayleighColor = czm_applyHSBShift(rayleighColor, u_hsbShift, ignoreBlackPixels);
mieColor = czm_applyHSBShift(mieColor, u_hsbShift, ignoreBlackPixels);
#endif
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_pbrNeutralTonemapping(fogColor.rgb);
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
#endif
finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, czm_fogVisualDensityScalar), 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
out_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 VRi=_(T(),1),kv=`#ifdef QUANTIZATION_BITS12
in vec4 compressed0;
in float compressed1;
#else
in vec4 position3DAndHeight;
in vec4 textureCoordAndEncodedNormals;
#endif
#ifdef GEODETIC_SURFACE_NORMALS
in vec3 geodeticSurfaceNormal;
#endif
#ifdef EXAGGERATION
uniform vec2 u_verticalExaggerationAndRelativeHeight;
#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;
out vec3 v_positionMC;
out vec3 v_positionEC;
out vec3 v_textureCoordinates;
out vec3 v_normalMC;
out vec3 v_normalEC;
#ifdef APPLY_MATERIAL
out float v_slope;
out float v_aspect;
out float v_height;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
out float v_distance;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE)
out vec3 v_atmosphereRayleighColor;
out vec3 v_atmosphereMieColor;
out float v_atmosphereOpacity;
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
uniform highp sampler2D u_clippingExtents;
out vec2 v_clippingPosition;
flat out int v_regionIndex;
#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) || defined(APPLY_MATERIAL)
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_verticalExaggerationAndRelativeHeight.x;
float relativeHeight = u_verticalExaggerationAndRelativeHeight.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
#ifdef ENABLE_CLIPPING_POLYGONS
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(position3DWC);
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
vec2 minDistance = vec2(czm_infinity);
v_clippingPosition = vec2(czm_infinity);
v_regionIndex = -1;
for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {
vec4 extents = unpackClippingExtents(u_clippingExtents, regionIndex);
vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;
vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));
vec2 distance = abs(rectUv - clamped) * extents.wz;
float threshold = 0.01;
if (minDistance.x > distance.x || minDistance.y > distance.y) {
minDistance = distance;
v_clippingPosition = rectUv;
if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {
v_regionIndex = regionIndex;
}
}
}
#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 ZRi=_(T(),1),DV=`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
);
}
`;var GRi=_(T(),1),Uv=`uniform sampler2D u_texture;
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = texture(u_texture, v_textureCoordinates);
}
`;var XRi=_(T(),1),Ov=`in vec4 position;
in float webMercatorT;
uniform vec2 u_textureDimensions;
out vec2 v_textureCoordinates;
void main()
{
v_textureCoordinates = vec2(position.x, webMercatorT);
gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));
}
`;var WRi=_(T(),1),BV=`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);
}
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 PRi=_(T(),1),Dv=`in vec3 v_outerPositionWC;
uniform vec3 u_hsbShift;
#ifndef PER_FRAGMENT_ATMOSPHERE
in vec3 v_mieColor;
in vec3 v_rayleighColor;
in float v_opacity;
in float v_translucent;
#endif
void main (void)
{
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_outerPositionWC, lightEnum);
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_pbrNeutralTonemapping(color.rgb);
color.rgb = czm_inverseGamma(color.rgb);
#endif
#ifdef COLOR_CORRECT
const bool ignoreBlackPixels = true;
color.rgb = czm_applyHSBShift(color.rgb, u_hsbShift, ignoreBlackPixels);
#endif
if (translucent == 0.0) {
color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);
}
out_FragColor = color;
}
`;var FRi=_(T(),1),Bv=`in vec4 position;
out vec3 v_outerPositionWC;
#ifndef PER_FRAGMENT_ATMOSPHERE
out vec3 v_mieColor;
out vec3 v_rayleighColor;
out float v_opacity;
out float v_translucent;
#endif
void main(void)
{
vec4 positionWC = czm_model * position;
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC.xyz, lightEnum);
#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;
}
`;var MRi=_(T(),1),Yv=`uniform samplerCube u_cubeMap;
in vec3 v_texCoord;
void main()
{
vec4 color = czm_textureCube(u_cubeMap, normalize(v_texCoord));
out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
}
`;var kRi=_(T(),1),Hv=`in vec3 position;
out 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;
}
`;var ORi=_(T(),1),zv=`uniform sampler2D u_texture;
in vec2 v_textureCoordinates;
void main()
{
vec4 color = texture(u_texture, v_textureCoordinates);
out_FragColor = czm_gammaCorrect(color);
}
`;var BRi=_(T(),1),Kv=`uniform float u_radiusTS;
in 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;
out_FragColor = clamp(color, vec4(0.0), vec4(1.0));
}
`;var HRi=_(T(),1),Jv=`in vec2 direction;
uniform float u_size;
out 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;
}
`;var KRi=_(T(),1),Qv=`in vec2 v_textureCoordinates;
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);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
}
`;var Ceo=_(T(),1);var jRi=_(T(),1);function vrt(e){let t,n=e.name,i=e.message;c(n)&&c(i)?t=`${n}: ${i}`:t=e.toString();let o=e.stack;return c(o)&&(t+=`
${o}`),t}var qh=vrt;var fGi=_(T(),1);var aGi=_(T(),1);var tGi=_(T(),1);async function Frt(e,t,n,i){return c(i)||(i=!1),C.typeOf.object("terrainProvider",e),C.typeOf.number("level",t),C.typeOf.bool("rejectOnTileFail",i),C.defined("positions",n),Nrt(e,t,n,i)}function Art(e,t,n){let i=e[0],o=i.terrainProvider.requestTileGeometry(i.x,i.y,i.level);if(!o)return!1;let r;return n?r=o.then(uye(i)):r=o.then(uye(i)).catch(krt(i)),e.shift(),t.push(r),!0}function Mrt(e){return new Promise(function(t){setTimeout(t,e)})}function Dj(e,t,n){return e.length?Art(e,t,n)?Dj(e,t,n):Mrt(100).then(()=>Dj(e,t,n)):Promise.resolve()}function Nrt(e,t,n,i){let o=e.tilingScheme,r,s=[],a={};for(r=0;r<n.length;++r){let d=o.positionToTileXY(n[r],t);if(!c(d))continue;let u=d.toString();if(!a.hasOwnProperty(u)){let f={x:d.x,y:d.y,level:t,tilingScheme:o,terrainProvider:e,positions:[]};a[u]=f,s.push(f)}a[u].positions.push(n[r])}let l=[];return Dj(s,l,i).then(function(){return Promise.all(l).then(function(){return n})})}function dye(e,t,n){let i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function uye(e){let t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let o=!1;for(let r=0;r<t.length;++r){let s=t[r];if(!dye(s,i,n)){o=!0;break}}return o?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then(function(){for(let r=0;r<t.length;++r){let s=t[r];dye(s,i,n)}}):Promise.resolve()}}function krt(e){let t=e.positions;return function(){for(let n=0;n<t.length;++n){let i=t[n];i.height=void 0}}}var jv=Frt;var Bj=new D;async function mye(e,t,n){if(c(n)||(n=!1),!c(e))throw new L("terrainProvider is required.");if(!c(t))throw new L("positions is required.");let i=[],o=[],r=e.availability;if(!c(r))throw new L("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");let s=[];for(let l=0;l<t.length;++l){let d=t[l],u=r.computeMaximumLevelAtPosition(d);if(o[l]=u,u===0){e.tilingScheme.positionToTileXY(d,1,Bj);let p=e.loadTileDataAvailability(Bj.x,Bj.y,1);c(p)&&s.push(p)}let f=i[u];c(f)||(i[u]=f=[]),f.push(d)}await Promise.all(s),await Promise.all(i.map(function(l,d){if(c(l))return jv(e,d,l,n)}));let a=[];for(let l=0;l<t.length;++l){let d=t[l];r.computeMaximumLevelAtPosition(d)!==o[l]&&a.push(d)}return a.length>0&&await mye(e,a,n),t}var IT=mye;async function Yj(e,t){let n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid,r,s=t.camera.getRectangleCameraCoordinates(e);if(t.mode===se.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),!c(n))return r;let a=n.availability;if(!c(a)||t.mode===se.SCENE2D)return r;let l=[de.center(e),de.southeast(e),de.southwest(e),de.northeast(e),de.northwest(e)],d=await Yj._sampleTerrainMostDetailed(n,l),u=!1,f=d.reduce(function(y,h){return c(h.height)?(u=!0,Math.max(h.height,y)):y},-Number.MAX_VALUE),p=r;return u&&(p.height+=f),p}Yj._sampleTerrainMostDetailed=IT;var WT=Yj;var CAi=_(T(),1);var XEi=_(T(),1);var TEi=_(T(),1);var pGi=_(T(),1),Urt={NONE:0,LERC:1},cm=Object.freeze(Urt);var YGi=_(T(),1);var GGi=_(T(),1);var yGi=_(T(),1),Ort={NONE:0,BITS12:1},qs=Object.freeze(Ort);var wT=new m,Drt=new m,lm=new D,XO=new M,Brt=new M,Yrt=Math.pow(2,12);function Zc(e,t,n,i,o,r,s,a,l,d){let u=qs.NONE,f,p;if(c(t)&&c(n)&&c(i)&&c(o)){let y=t.minimum,h=t.maximum,g=m.subtract(h,y,Drt),x=i-n;Math.max(m.maximumComponent(g),x)<Yrt-1?u=qs.BITS12:u=qs.NONE,f=M.inverseTransformation(o,new M);let V=m.negate(y,wT);M.multiply(M.fromTranslation(V,XO),f,f);let Z=wT;Z.x=1/g.x,Z.y=1/g.y,Z.z=1/g.z,M.multiply(M.fromScale(Z,XO),f,f),p=M.clone(o),M.setTranslation(p,m.ZERO,p),o=M.clone(o,new M);let R=M.fromTranslation(y,XO),E=M.fromScale(g,Brt),I=M.multiply(R,E,XO);M.multiply(o,I,o),M.multiply(p,I,p)}this.quantization=u,this.minimumHeight=n,this.maximumHeight=i,this.center=m.clone(e),this.toScaledENU=f,this.fromScaledENU=o,this.matrix=p,this.hasVertexNormals=r,this.hasWebMercatorT=s??!1,this.hasGeodeticSurfaceNormals=a??!1,this.exaggeration=l??1,this.exaggerationRelativeHeight=d??0,this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNo
`,l+=n?ist(i):ost(i),l}function ist(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 ost(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 rst(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 = texture(packedClippingPlanes, vec2(u, v));
return czm_transformPlane(plane, transform);
}
`}function sst(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 = texture(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(texture(packedClippingPlanes, vec2(u + ${o}, v)));
return czm_transformPlane(plane, transform);
}
`}var c0=nst;function ast(e,t,n,i,o,r){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o,this.clippingPolygonShaderState=r}function zj(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function cst(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 se.SCENE3D:o=t;break;case se.SCENE2D:case se.COLUMBUS_VIEW:o=n;break;case se.MORPHING:o=i;break}return o}function lst(e){return e.webgl2?`void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
czm_clipPolygons(clippingDistance, regionsLength, clippingPosition, regionIndex);
}`:`void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
}`}function dst(e){return e.webgl2?`vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
return czm_unpackClippingExtents(extentsTexture, index);
}`:`vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
return vec4();
}`}function ust(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}zj.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,l=e.applyGamma,d=e.applyAlpha,u=e.applyDayNightAlpha,f=e.applySplit,p=e.hasWaterMask,y=e.showReflectiveOcean,h=e.showOceanWaves,g=e.enableLighting,x=e.dynamicAtmosphereLighting,S=e.dynamicAtmosphereLightingFromSun,V=e.showGroundAtmosphere,Z=e.perFragmentGroundAtmosphere,R=e.hasVertexNormals,E=e.useWebMercatorProjection,I=e.enableFog,v=e.enableClippingPlanes,P=e.clippingPlanes,F=e.enableClippingPolygons,N=e.clippingPolygons,b=e.clippedByBoundaries,G=e.hasImageryLayerCutout,X=e.colorCorrect,W=e.highlightFillTile,A=e.colorToAlpha,k=e.hasGeodeticSurfaceNormals,B=e.hasExaggeration,O=e.showUndergroundColor,H=e.translucent,U=0,K="",ie=n.renderedMesh.encoding;ie.quantization===qs.BITS12&&(U=1,K="QUANTIZATION_BITS12");let $=0,ne="";b&&($=1,ne="TILE_LIMIT_RECTANGLE");let be=0,Ce="";G&&(be=1,Ce="APPLY_IMAGERY_CUTOUT");let me=t.mode,_e=me|o<<2|r<<3|s<<4|a<<5|l<<6|d<<7|p<<8|y<<9|h<<10|g<<11|x<<12|S<<13|V<<14|Z<<15|R<<16|E<<17|I<<18|U<<19|f<<20|v<<21|F<<22|$<<23|be<<24|X<<25|W<<26|A<<27|k<<28|B<<29|O<<30|H<<31|u<<32,Ve=0;c(P)&&P.length>0&&(Ve=v?P.clippingPlanesState:0);let Ie=0;c(N)&&N.length>0&&(Ie=F?N.clippingPolygonsState:0);let Ze=n.surfaceShader;if(c(Ze)&&Ze.numberOfDayTextures===i&&Ze.flags===_e&&Ze.material===this.material&&Ze.clippingShaderState===Ve&&Ze.clippingPolygonShaderState===Ie)return Ze.shaderProgram;let De=this._shadersByTexturesFlags[i];if(c(De)||(De=this._shadersByTexturesFlags[i]=[]),Ze=De[_e],!c(Ze)||Ze.material!==this.material||Ze.clippingShaderState!==Ve||Ze.clippingPolygonShaderState!==Ie){let Ke=this.baseVertexShaderSource.clone(),rt=this.baseFragmentShaderSource.clone();Ve!==0&&rt.sources.unshift(c0(P,t.context)),Ie!==0&&(rt.sources.unshift(lst(t.context)),Ke.sources.unshift(dst(t.context))),Ke.defines.push(K),rt.defines.push(`TEXTURE_UNITS ${i}`,ne,Ce),o&&rt.defines.push("APPLY_BRIGHTNESS"),r&&rt.defines.push("APPLY_CONTRAST"),s&&rt.defines.push("APPLY_HUE"),a&&rt.defines.push("APPLY_SATURATION"),l&&rt.defines.push("APPLY_GAMMA"),d&&rt.defines.push("APPLY_ALPHA"),u&&rt.defines.push("APPLY_DAY_NIGHT_ALPHA"),p&&rt.defines.push("HAS_WATER_MASK"),y&&(rt.defines.push("SHOW_REFLECTIVE_OCEAN"),Ke.defines.push("SHOW_REFLECTIVE_OCEAN")),h&&rt.defines.push("SHOW_OCEAN_WAVES"),A&&rt.defines.push("APPLY_COLOR_TO_ALPHA"),O&&(Ke.defines.push("UNDERGROUND_COLOR"),rt.defines.push("UNDERGROUND_COLOR")),H&&(Ke.defines.push("TRANSLUCENT"),rt.defines.push("TRANSLUCENT")),g&&(R?(Ke.defines.push("ENABLE_VERTEX_LIGHTING"),rt.defines.push("ENABLE_VERTEX_LIGHTING")):(Ke.defines.push("ENABLE_DAYNIGHT_SHADING"),rt.defines.push("ENABLE_DAYNIGHT_SHADING"))),x&&(Ke.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),rt.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),S&&(Ke.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),rt.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),V&&(Ke.defines.push("GROUND_ATMOSPHERE"),rt.defines.push("GROUND_ATMOSPHERE"),Z&&(Ke.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),rt.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),Ke.defines.push("INCLUDE_WEB_MERCATOR_Y"),rt.defines.push("INCLUDE_WEB_MERCATOR_Y"),I&&(Ke.defines.push("FOG"),rt.defines.push("FOG")),f&&rt.defines.push("APPLY_SPLIT"),v&&rt.defines.push("ENABLE_CLIPPING_PLANES"),F&&(rt.defines.push("ENABLE_CLIPPING_POLYGONS"),Ke.defines.push("ENABLE_CLIPPING_POLYGONS"),N.inverse&&rt.defines.push("CLIPPING_INVERSE"),rt.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${N.extentsCount}`),Ke.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${N.extentsCount}`)),X&&rt.defines.push("COLOR_CORRECT"),W&&rt.defines.push("HIGHLIGHT_FILL_TILE"),k&&Ke.defines.push("GEODETIC_SURFACE_NORMALS"),B&&Ke.defines.push("EXAGGERATION");let Xt=`
{
vec4 color = initialColor;
`;G&&(Xt+=` vec4 cutoutAndColorResult;
bool texelUnclipped;
`);for(let qe=0;qe<i;++qe)G?Xt+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${qe}];
texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
cutoutAndColorResult = sampleAndBlend(
`:Xt+=` color = sampleAndBlend(
`,Xt+=` color,
u_dayTextures[${qe}],
u_dayTextureUseWebMercatorT[${qe}] ? textureCoordinates.xz : textureCoordinates.xy,
u_dayTextureTexCoordsRectangle[${qe}],
u_dayTextureTranslationAndScale[${qe}],
${d?`u_dayTextureAlpha[${qe}]`:"1.0"},
${u?`u_dayTextureNightAlpha[${qe}]`:"1.0"},
${u?`u_dayTextureDayAlpha[${qe}]`:"1.0"},
${o?`u_dayTextureBrightness[${qe}]`:"0.0"},
${r?`u_dayTextureContrast[${qe}]`:"0.0"},
${s?`u_dayTextureHue[${qe}]`:"0.0"},
${a?`u_dayTextureSaturation[${qe}]`:"0.0"},
${l?`u_dayTextureOneOverGamma[${qe}]`:"0.0"},
${f?`u_dayTextureSplit[${qe}]`:"0.0"},
${A?`u_colorsToAlpha[${qe}]`:"vec4(0.0)"},
nightBlend );
`,G&&(Xt+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
`);Xt+=` return color;
}`,rt.sources.push(Xt),Ke.sources.push(cst(me)),Ke.sources.push(ust(E));let Ht=tn.fromCache({context:t.context,vertexShaderSource:Ke,fragmentShaderSource:rt,attributeLocations:ie.getAttributeLocations()});Ze=De[_e]=new ast(i,_e,this.material,Ht,Ve,Ie)}return n.surfaceShader=Ze,Ze.shaderProgram};zj.prototype.destroy=function(){let e,t,n=this._shadersByTexturesFlags;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];if(!c(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],c(t)&&t.shaderProgram.destroy())}return he(this)};var qv=zj;var Kvi=_(T(),1);var YEi=_(T(),1),mst={NONE:-1,PARTIAL:0,FULL:1},yr=Object.freeze(mst);var XXi=_(T(),1);var JEi=_(T(),1);function vO(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=r??0,this.retry=!1,this.error=s}vO.reportError=function(e,t,n,i,o,r,s,a){let l=e;return c(e)?(l.provider=t,l.message=i,l.x=o,l.y=r,l.level=s,l.retry=!1,l.error=a,++l.timesRetried):l=new vO(t,i,o,r,s,0,a),c(n)&&n.numberOfListeners>0?n.raiseEvent(l):c(t)&&console.log(`An error occurred in "${t.constructor.name}": ${qh(i)}`),l};vO.reportSuccess=function(e){c(e)&&(e.timesRetried=-1)};var Ro=vO;var jEi=_(T(),1),fst={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},ci=Object.freeze(fst);var $Ei=_(T(),1),hst={START:0,LOADING:1,DONE:2,FAILED:3},$s=Object.freeze(hst);var tXi=_(T(),1),pst={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},uo=Object.freeze(pst);function sr(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new ce(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new m,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=uo.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new ue,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(sr.prototype,{eligibleForUnloading:{get:function(){let e=this.terrainState,n=!(e===uo.RECEIVING||e===uo.TRANSFORMING),i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){let s=i[o];n=!c(s.loadingImagery)||s.loadingImagery.state!==ci.TRANSITIONING}return n}},renderedMesh:{get:function(){if(c(this.vertexArray))return this.mesh;if(c(this.fill))return this.fill.mesh}}});var bst=new pe;function Kj(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(c(t)&&t!==se.SCENE3D){let l=n.ellipsoid.cartesianToCartographic(s,bst);s=n.project(l,r),s=m.fromElements(s.z,s.x,s.y,r)}return s}var yst=new m,gst=new m,xst=new m;sr.prototype.pick=function(e,t,n,i,o){let r=this.renderedMesh;if(!c(r))return;let s=r.vertices,a=r.indices,l=r.encoding,d=a.length,u=Number.MAX_VALUE;for(let f=0;f<d;f+=3){let p=a[f],y=a[f+1],h=a[f+2],g=Kj(l,t,n,s,p,yst),x=Kj(l,t,n,s,y,gst),S=Kj(l,t,n,s,h,xst),V=qn.rayTriangleParametric(e,g,x,S,i);c(V)&&V<u&&V>=0&&(u=V)}return u!==Number.MAX_VALUE?bn.getPoint(e,u,o):void 0};sr.prototype.freeResources=function(){c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=uo.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;c(i)||(i=e.data=new sr),e.state===$s.START&&(_st(e,t,n),e.state=$s.LOADING)};sr.processStateMachine=function(e,t,n,i,o,r,s){sr.initialize(e,n,i);let a=e.data;if(e.state===$s.LOADING&&Tst(e,t,n,i,o,r),s)return;let l=e.renderable;e.renderable=c(a.vertexArray);let d=a.terrainState===uo.READY;e.upsampledFromParent=c(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();let u=a.processImagery(e,n,t);if(d&&u){let f=e._loadedCallbacks,p={};for(let y in f
.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);
}
.cesium-credit-lightbox {
background-color: #303336;
color: ${FF};
position: relative;
min-height: ${Rut}px;
margin: auto;
}
.cesium-credit-lightbox > ul > li a,
.cesium-credit-lightbox > ul > li a:visited,
.cesium-credit-wrapper a,
.cesium-credit-wrapper a:visited {
color: ${FF};
}
.cesium-credit-lightbox > ul > li a:hover {
color: ${gD};
}
.cesium-credit-lightbox.cesium-credit-lightbox-expanded {
border: 1px solid #444;
border-radius: 5px;
max-width: 370px;
}
.cesium-credit-lightbox.cesium-credit-lightbox-mobile {
height: 100%;
width: 100%;
}
.cesium-credit-lightbox-title {
padding: 20px 20px 0 20px;
}
.cesium-credit-lightbox-close {
font-size: 18pt;
cursor: pointer;
position: absolute;
top: 0;
right: 6px;
color: ${FF};
}
.cesium-credit-lightbox-close:hover {
color: ${gD};
}
.cesium-credit-lightbox > ul {
margin: 0;
padding: 12px 20px 12px 40px;
font-size: 13px;
}
.cesium-credit-lightbox > ul > li {
padding-bottom: 6px;
}
.cesium-credit-lightbox > ul > li * {
padding: 0;
margin: 0;
}
.cesium-credit-expand-link {
padding-left: 5px;
cursor: pointer;
text-decoration: underline;
color: ${FF};
}
.cesium-credit-expand-link:hover {
color: ${gD};
}
.cesium-credit-text {
color: ${FF};
}
.cesium-credit-delimiter {
padding: 0 5px;
}
.cesium-credit-textContainer *,
.cesium-credit-logoContainer * {
display: inline;
}
.cesium-credit-textContainer a:hover {
color: ${gD}
}
.cesium-credit-textContainer .cesium-credit-wrapper:first-of-type {
padding-left: 5px;
}
`;function n(r){if(r.shadowRoot)return r.shadowRoot;if(r.getRootNode){let s=r.getRootNode();if(s instanceof ShadowRoot)return s}}let i=n(e)??document.head,o=document.createElement("style");o.innerHTML=t,i.appendChild(o)}function gr(e,t,n){C.defined("container",e);let i=this;n=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(h){r.contains(h.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 l=document.createElement("a");l.onclick=this.hideLightbox.bind(this),l.innerHTML="&times;",l.className="cesium-credit-lightbox-close",r.appendChild(l);let d=document.createElement("ul");r.appendChild(d);let u=document.createElement("div");u.className="cesium-credit-logoContainer",u.style.display="inline",e.appendChild(u);let f=document.createElement("div");f.className="cesium-credit-textContainer",f.style.display="inline",e.appendChild(f);let p=document.createElement("a");p.className="cesium-credit-expand-link",p.onclick=this.showLightbox.bind(this),p.textContent="Data attribution",e.appendChild(p),Iut(e);let y=Ct.clone(gr.cesiumCredit);this._delimiter=t??"\u2022",this._screenContainer=f,this._cesiumCreditContainer=u,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=d,this._lightbox=o,this._hideLightbox=s,this._expandLink=p,this._expanded=!1,this._staticCredits=[],this._cesiumCredit=y,this._previousCesiumCredit=void 0,this._currentCesiumCredit=y,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new Zt,lightboxCredits:new Zt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function pxe(e,t,n,i){i=i??1;let o=t.get(n.id);if(c(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 fxe(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}gr.prototype.addCreditToNextFrame=function(e){if(C.defined("credit",e),e.isIon()){c(this._defaultCredit)||(this._defaultCredit=Ct.clone(bxe())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,pxe(this,t,e)};gr.prototype.addStaticCredit=function(e){C.defined("credit",e);let t=this._staticCredits;Gut(t,e)||t.push(e)};gr.prototype.removeStaticCredit=function(e){C.defined("credit",e);let t=this._staticCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};gr.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};gr.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};gr.prototype.update=function(){this._expanded&&Xut(this)};gr.prototype.beginFrame=function(){let e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;let t=e.screenCredits,n=e.lightboxCredits;t.removeAll(),n.removeAll();let i=this._staticCredits;for(let o=0;o<i.length;++o){let r=i[o],s=r.showOnScreen?t:n;r.isIon()&&Ct.equals(gr.cesiumCredit,this._cesiumCredit)||pxe(this,s,r,Number.MAX_VALUE)}Ct.equals(gr.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Ct.clone(gr.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};gr.prototype.endFrame=function(){let e=this._currentFrameCredits.screenCredits.values;uxe(this._screenContainer,e,this._delimiter,void 0);let t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",uxe(this._creditList,t,void 0,"li"),Eut(this)};gr.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),he(th
{
out_FragColor = vec4(1.0);
}
`;i=new Be({sources:[a]})}else if(!o&&s){let a=`void main()
{
out_FragColor = vec4(1.0);
czm_writeLogDepth();
}
`;i=new Be({defines:["LOG_DEPTH"],sources:[a]})}return e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}function amt(e,t){let n=e._depthOnlyRenderStateCache,i=n[t.id];if(c(i))return i;let o=Oe.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1};let r=Oe.fromCache(o);return n[t.id]=r,r}uL.createDepthOnlyDerivedCommand=function(e,t,n,i){c(i)||(i={});let o=i.depthOnlyCommand?.shaderProgram,r=i.depthOnlyCommand?.renderState;return i.depthOnlyCommand=et.shallowClone(t,i.depthOnlyCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=smt(n,t.shaderProgram),i.depthOnlyCommand.renderState=amt(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};var cmt=/\s+czm_writeLogDepth\(/,lmt=/\s+czm_vertexLogDepth\(/;function dmt(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(c(i))return i;let o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=c(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a=!1,l=r.sources;for(let u=0;u<l.length;++u)if(lmt.test(l[u])){a=!0;break}if(!a){for(let f=0;f<l.length;++f)l[f]=Be.replaceMain(l[f],"czm_log_depth_main");l.push(`
void main()
{
czm_log_depth_main();
czm_vertexLogDepth();
}
`)}l=s.sources,a=!1;for(let u=0;u<l.length;++u)cmt.test(l[u])&&(a=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(a=!0);let d="";if(!a){for(let u=0;u<l.length;u++)l[u]=Be.replaceMain(l[u],"czm_log_depth_main");d=`
void main()
{
czm_log_depth_main();
czm_writeLogDepth();
}
`}return l.push(d),e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}uL.createLogDepthCommand=function(e,t,n){c(n)||(n={});let i=n.command?.shaderProgram;return n.command=et.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=dmt(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function umt(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(c(i))return i;let o=t._attributeLocations,{sources:r,defines:s}=t.fragmentShaderSource,l=r.some(y=>y.includes("out_FragData"))?"out_FragData_0":"out_FragColor",d=`void main ()
{
czm_non_pick_main();
if (${l}.a == 0.0) {
discard;
}
${l} = ${n};
} `,u=r.length,f=new Array(u+1);for(let y=0;y<u;++y)f[y]=Be.replaceMain(r[y],"czm_non_pick_main");f[u]=d;let p=new Be({sources:f,defines:s});return e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:p,attributeLocations:o})}function Vxe(e,t){let n=e.picking.pickRenderStateCache,i=n[t.id];if(c(i))return i;let o=Oe.getState(t);o.blending.enabled=!1,o.depthMask=!0;let r=Oe.fromCache(o);return n[t.id]=r,r}uL.createPickDerivedCommand=function(e,t,n,i){c(i)||(i={});let o=i.pickCommand?.shaderProgram,r=i.pickCommand?.renderState;return i.pickCommand=et.shallowClone(t,i.pickCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=umt(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=Vxe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function dL(e,t,n){let i=e.length;for(let o=0;o<i;o++)e[o].trimStart().split(/\s+/)[0]===t&&(e[o]=`${t} ${n}`)}function Lxe(e){return e.isArray?e.arrayLength:lt.getComponentCount(e.type)}function mmt(e){let t=Lxe(e);return e.normalized?t===1?"float":`vec${t}`:t===1?"int":`ivec${t}`}function Zxe(e,t,n){return`((${e} - float(${t})) / float(${n}))`}function Rxe(e,t){let n=At.getMaximum(t);return`(${e}) / float(${n})`}function fmt(e,t){let n="float(value)";if(t.hasValueTransform){let i=t.offset,o=t.scale;n=Zxe(n,i,o)}return e.normalized||(n=Rxe(n,e.componentType)),n}function hmt(e,t,n){let o=`float(${`value.${n}`})`;if(t.hasValueTransform){let r=t.offset[n],s=t.scale[n];o=Zxe(o,r,s)}return e.normalized||(o=Rxe(o,e.componentType)),o}function pmt(e,t,n){let i=n.schemaId,o=n.className,r=n.propertyName,s=`pickMetadata-${i}-${o}-${r}`,a=e.shaderCache.getDerivedShaderProgram(t,s);if(c(a))return a;let l=n.metadataProperty,d=n.classProperty,u=mmt(d),f=["0.0","0.0","0.0","0.0"],p=Lxe(d);if(p===1)f[0]=fmt(d,l);else{let x=["x","y","z","w"];for(let S=0;S<p;S++)f[S]=hmt(d,l,x[S])}let y=t.fragmentShaderSource.defines.slice();y.push(Ld.METADATA_PICKING_ENABLED),dL(y,Ld.METADATA_PICKING_VALUE_TYPE,u),dL(y,Ld.METADATA_PICKING_VALUE_STRING,`metadata.${r}`),dL(y,Ld.METADATA_PICKING_VALUE_COMPONENT_X,f[0]),dL(y,Ld.METADATA_PICKING_VALUE_COMPONENT_Y,f[1]),dL(y,Ld.METADATA_PICKING_VALUE_COMPONENT_Z,f[2]),dL(y,Ld.METADATA_PICKING_VALUE_COMPONENT_W,f[3]);let h=new Be({sources:t.fragmentShaderSource.sources,defines:y});return e.shaderCache.createDerivedShaderProgram(t,s,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:h,attributeLocations:t._attributeLocations})}uL.createPickMetadataDerivedCommand=function(e,t,n,i){return c(i)||(i={}),i.pickMetadataCommand=et.shallowClone(t,i.pickMetadataCommand),i.pickMetadataCommand.shaderProgram=pmt(n,t.shaderProgram,t.pickedMetadataInfo),i.pickMetadataCommand.renderState=Vxe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id,i};function bmt(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(c(n))return n;let i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();return o.defines=c(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}uL.createHdrCommand=function(e,t,n){c(n)||(n={});let i=n.command?.shaderProgram;return n.command=et.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=bmt(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};var rp=uL;var rki=_(T(),1);function CD(e){if(!c(e))throw new L("scene is required.");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(!c(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=w.toRadians(o),t._beta=w.toRadians(i.beta),t._gamma=w.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=functi
{
out_FragColor = vec4(1.0);
}
`;t.sources=[n]}function N4(e,t){let n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=Be.replaceMain(n[r],"czm_globe_translucency_main");n.push(`
uniform sampler2D u_classificationTexture;
void main()
{
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
#ifdef MANUAL_DEPTH_TEST
float logDepthOrDepth = czm_unpackDepth(texture(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 = texture(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;
}
out_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + out_FragColor * (1.0 - classificationColor.a);
}
`)}function Nxe(e,t){N4(e,t),pm(e.defines,"GROUND_ATMOSPHERE"),pm(t.defines,"GROUND_ATMOSPHERE"),pm(e.defines,"FOG"),pm(t.defines,"FOG")}function Xmt(e,t){N4(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Imt(e,t){Nxe(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Wxe(e,t){let n=`uniform sampler2D u_classificationTexture;
void main()
{
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
vec4 pickColor = texture(u_classificationTexture, st);
if (pickColor == vec4(0.0))
{
discard;
}
out_FragColor = pickColor;
}
`;t.sources=[n]}function Wmt(e,t,n,i,o,r){if(!c(o))return t;if(!i&&c(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!c(s)){let a=t._attributeLocations,l=t.vertexShaderSource.clone(),d=t.fragmentShaderSource.clone();l.defines=c(l.defines)?l.defines.slice(0):[],d.defines=c(d.defines)?d.defines.slice(0):[],o(l,d),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:l,fragmentShaderSource:d,attributeLocations:a})}return s}function wmt(e){e.cull.face=_i.BACK,e.cull.enabled=!0}function Pmt(e){e.cull.face=_i.FRONT,e.cull.enabled=!0}function vmt(e){e.cull.face=_i.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Fmt(e){e.cull.face=_i.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Amt(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function wxe(e){e.cull.face=_i.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=un.ALPHA_BLEND}function Pxe(e){e.cull.face=_i.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=un.ALPHA_BLEND}function Mmt(e){e.cull.face=_i.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function Nmt(e){e.cull.face=_i.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function kmt(e,t,n,i,o){if(!c(i))return e;if(!n&&c(t))return t;let r=o[e.id];if(!c(r)){let s=Oe.getState(e);i(s),r=Oe.fromCache(s),o[e.id]=r}return r}function mL(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function Umt(e,t,n,i,o){return c(o)?!i&&c(n)?n:St(t,o(e),!1):t}function Of(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function Omt(){return[new Of({pass:Xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Gmt,getRenderStateFunction:wmt,getUniformMapFunction:void 0}),new Of({pass:Xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Emt,getRenderStateFunction:Pmt,getUniformMapFunction:void 0}),new Of({pass:Xe.GLOBE,pickOnly:!1,getShaderProgramFunction:M4,getRenderStateFunction:vmt,getUniformMapFunction:void 0}),new Of({pass:Xe.GLOBE,pickOnly:!1,getShaderProgramFunction:M4,getRenderStateFunction:Fmt,getUniformMapFunction:void 0}),new Of({pass:Xe.GLOBE,pickOnly:!1,getShaderProgramFunction:M4,getRenderStateFunction:Amt,getUniformMapFunction:void 0}),new Of({pass:Xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:N4,getRenderStateFunction:wxe,getUniformMapFunction:mL}),new Of({pass:Xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Nxe,getRenderStateFunction:Pxe,getUniformMapFunction:mL}),new Of({pass:Xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Xmt,getRenderStateFunction:wxe,getUniformMapFunction:mL}),new Of({pass:Xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Imt,getRenderStateFunction:Pxe,getUniformMapFunction:mL}),new Of({pass:Xe.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:Wxe,getRenderStateFunction:Mmt,getUniformMapFunction:mL}),new Of({pass:Xe.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:Wxe,getRenderStateFunction:Nmt,getUniformMapFunction:mL})]}var vxe=new Array(kT),Fxe=new Array(kT);UT.prototype.updateDerivedCommands=function(e,t){let n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)Fxe[o]=this._derivedCommandPacks[n[o]],vxe[o]=Mxe[n[o]];Dmt(this,e,i,n,vxe,Fxe,t)}};function Dmt(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency,l=e._derivedCommandsDirty;if(t.dirty||!c(a)||l){t.dirty=!1,c(a)||(a={},t.derivedCommands.globeTranslucency=a);let d=s.frameNumber,u=a.uniformMapDirtyFrame??0,f=a.shaderProgramDirtyFrame??0,p=a.renderStateDirtyFrame??0,y=a.uniformMap!==t.uniformMap,h=a.shaderProgramId!==t.shaderProgram.id,g=a.renderStateId!==t.renderState.id;y&&(a.uniformMapDirtyFrame=d),h&&(a.shaderProgramDirtyFrame=d),g&&(a.renderStateDirtyFrame=d),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let x=0;x<n;++x){let S=r[x],V=i[x],Z=o[x],R=a[Z],E,I,v;c(R)?(E=R.uniformMap,I=R.shaderProgram,v=
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = texture(colorTexture, v_textureCoordinates);
}
`;function sp(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new hi({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new hi({depthStencil:!0,createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new ti({color:new Y(0,0,0,0),owner:this}),this._clearCommand=new ti({color:new Y(0,0,0,0),depth:1,stencil:0});let e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(sp.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});sp.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};var Hmt={depthMask:!1,stencilTest:{enabled:!0,frontFunction:On.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:On.NEVER,reference:0,mask:kt.CLASSIFICATION_MASK},blending:un.ALPHA_BLEND},zmt={depthMask:!1,stencilTest:{enabled:!0,frontFunction:On.NOT_EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:On.NEVER,reference:0,mask:kt.CLASSIFICATION_MASK},blending:un.ALPHA_BLEND},Kmt={depthMask:!0,depthTest:{enabled:!0},stencilTest:kt.setCesium3DTileBit(),stencilMask:kt.CESIUM_3D_TILE_MASK,blending:un.ALPHA_BLEND},Jmt=`uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform sampler2D classifiedTexture;
in vec2 v_textureCoordinates;
void main()
{
vec4 color = texture(colorTexture, v_textureCoordinates);
if (color.a == 0.0)
{
discard;
}
bool isClassified = all(equal(texture(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
out_FragColor = color * highlightColor;
gl_FragDepth = texture(depthTexture, v_textureCoordinates).r;
}
`,Qmt=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
void main()
{
vec4 color = texture(colorTexture, v_textureCoordinates);
if (color.a == 0.0)
{
discard;
}
#ifdef UNCLASSIFIED
out_FragColor = color * czm_invertClassificationColor;
#else
out_FragColor = color;
#endif
}
`;sp.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,l=!c(i)||i.width!==s||i.height!==a;if((l||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._previousFramebuffer)||(this._depthStencilTexture=new Pt({context:e,width:s,height:a,pixelFormat:ke.DEPTH_STENCIL,pixelDatatype:Ue.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new md({context:e,width:s,height:a,format:ac.DEPTH24_STENCIL8,numSamples:t})))),!c(this._fbo.framebuffer)||l||o||r){this._fbo.destroy(),this._fboClassified.destroy();let d,u;c(this._previousFramebuffer)?(d=n.getDepthStencilTexture(),u=n.getDepthStencilRenderbuffer()):(d=this._depthStencilTexture,u=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(d),c(u)&&this._fbo.setDepthStencilRenderbuffer(u),this._fbo.update(e,s,a,t),c(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(d),this._fboClassified.update(e,s,a))}if(c(this._rsUnclassified)||(this._rsUnclassified=Oe.fromCache(Hmt),this._rsClassified=Oe.fromCache(zmt),this._rsDefault=Oe.fromCache(Kmt)),!c(this._unclassifiedCommand)||o||r){c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());let d=c(this._previousFramebuffer)?Qmt:Jmt,u=new Be({defines:["UNCLASSIFIED"],sources:[d]}),f=new Be({sources:[d]});this._unclassifiedCommand=e.createViewportQuadCommand(u,{renderState:c(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(f,{renderState:c(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),c(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),c(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(td,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};sp.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};sp.prototype.clear=function(e,t){c(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};sp.prototype.executeClassified=function(e,t){if(!c(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)};sp.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};sp.prototype.isDestroyed=function(){return!1};sp.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),he(this)};var fL=sp;var tUi=_(T(),1);function VD(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(VD.prototype,{total:{get:function(){return this._total}}});function Ig(e){if(c(e)&&e.length!==fa.NUMBER_OF_JOB_TYPES)throw n
in vec2 v_textureCoordinates;
void main()
{
vec4 globeDepthPacked = texture(czm_globeDepthTexture, v_textureCoordinates);
float globeDepth = czm_unpackDepth(globeDepthPacked);
float depth = texture(colorTexture, v_textureCoordinates).r;
out_FragColor = czm_branchFreeTernary(globeDepth <= 0.0 || globeDepth >= 1.0 || depth < globeDepth && depth > 0.0 && depth < 1.0,
czm_packDepth(depth), globeDepthPacked);
}
`,{renderState:Oe.fromCache(),uniformMap:{colorTexture:function(){return e._textureToCopy}},owner:e})),e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}OT.prototype.update=function(e,t){jmt(this,e,t),qmt(this,e,t)};var $mt=new ce,eft=new ce(1,1/255,1/65025,1/16581375);OT.prototype.getDepth=function(e,t,n){if(!c(this.framebuffer))return;let i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=ce.unpack(i,0,$mt);return ce.divideByScalar(o,255,o),ce.dot(o,eft)};OT.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};OT.prototype.isDestroyed=function(){return!1};OT.prototype.destroy=function(){return this._framebuffer.destroy(),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=c(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),he(this)};var QF=OT;var MBi=_(T(),1);var WUi=_(T(),1);function tft(e,t){this.near=e??0,this.far=t??0;let n=Xe.NUMBER_OF_PASSES,i=new Array(n),o=new Array(n);for(let r=0;r<n;++r)i[r]=[],o[r]=0;this.commands=i,this.indices=o}var jF=tft;var QUi=_(T(),1);var PUi=_(T(),1),Wg=`uniform highp sampler2D u_depthTexture;
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = czm_packDepth(texture(u_depthTexture, v_textureCoordinates).r);
}
`;function ap(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new hi,this._tempCopyDepthFramebuffer=new hi,this._updateDepthFramebuffer=new hi({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 je,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(ap.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 Uxe(e,t,n,i,o){let r=e._viewport;r.width=n,r.height=i;let s=!je.equals(r,o.viewport),a=s!==e._useScissorTest;e._useScissorTest=s,je.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=je.clone(o.viewport,e._scissorRectangle),a=!0),(!c(e._rs)||!je.equals(r,e._rs.viewport)||a)&&(e._rs=Oe.fromCache({viewport:r,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Oe.fromCache({viewport:r,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:un.ALPHA_BLEND}),e._rsUpdate=Oe.fromCache({viewport:r,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:On.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:On.NEVER,reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK}})),c(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(Wg,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,c(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(td,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,c(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(Wg,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,c(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(td,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,c(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ti({color:new Y(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}ap.prototype.update=function(e,t,n,i,o,r){let{width:s,height:a}=n,l=o?e.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT:Ue.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,l),this._copyDepthFramebuffer.update(e,s,a),Uxe(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._clearGlobeDepth=r};ap.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};ap.prototype.executeCopyDepth=function(e,t){c(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};ap.prototype.executeUpdateDepth=function(e,t,n){let i=c(n)?n:t.framebuffer.depthStencilTexture;if(!this._clearGlobeDep
float ai = czm_out_FragColor.a;
float wzi = czm_alphaWeight(ai);
out_FragData_0 = vec4(Ci * wzi, ai);
out_FragData_1 = vec4(ai * wzi);
`,hft=` vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;
float ai = czm_out_FragColor.a;
float wzi = czm_alphaWeight(ai);
out_FragColor = vec4(Ci, ai) * wzi;
`,pft=` float ai = czm_out_FragColor.a;
out_FragColor = vec4(ai);
`;function O4(e,t,n,i){let{shaderCache:o}=e,r=o.getDerivedShaderProgram(t,n);if(c(r))return r;let s=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map(function(u){return Be.replaceMain(u,"czm_translucent_main").replace(/out_FragColor/g,"czm_out_FragColor").replace(/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,"").replace(/\bdiscard\b/g,"czm_discard = true").replace(/czm_phong/g,"czm_translucentPhong")}),a.sources.splice(0,0,`vec4 czm_out_FragColor;
bool czm_discard = false;
`);let l=[...i.matchAll(/out_FragData_(\d+)/g)],d="";for(let u=0;u<l.length;u++){let f=l[u];d=`layout (location = ${f[1]}) out vec4 ${f[0]};
${d}`}return a.sources.push(d),a.sources.push(`void main()
{
czm_translucent_main();
if (czm_discard)
{
discard;
}
${i}}
`),o.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:s})}function bft(e,t){return O4(e,t,"translucentMRT",fft)}function yft(e,t){return O4(e,t,"translucentMultipass",hft)}function gft(e,t){return O4(e,t,"alphaMultipass",pft)}b0.prototype.createDerivedCommands=function(e,t,n){if(c(n)||(n={}),this._translucentMRTSupport){let a,l;return c(n.translucentCommand)&&(a=n.translucentCommand.shaderProgram,l=n.translucentCommand.renderState),n.translucentCommand=et.shallowClone(e,n.translucentCommand),!c(a)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=bft(t,e.shaderProgram),n.translucentCommand.renderState=dft(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=a,n.translucentCommand.renderState=l),n}let i,o,r,s;return c(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=et.shallowClone(e,n.translucentCommand),n.alphaCommand=et.shallowClone(e,n.alphaCommand),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=yft(t,e.shaderProgram),n.translucentCommand.renderState=uft(this,t,e.renderState),n.alphaCommand.shaderProgram=gft(t,e.shaderProgram),n.alphaCommand.renderState=mft(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),n};function xft(e,t,n,i,o,r){let{context:s,frameState:a}=t,{useLogDepth:l,shadowState:d}=a,u=t._hdr,f=i.framebuffer,p=d.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(s,i);let y=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;for(let h=0;h<o.length;++h){let g=o[h];g=l?g.derivedCommands.logDepth.command:g,g=u?g.derivedCommands.hdr.command:g;let x=p&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand;n(x,t,i,y)}if(c(r)){let h=r.unclassifiedCommand,g=p&&h.receiveShadows?h.derivedCommands.oit.shadows.translucentCommand:h.derivedCommands.oit.translucentCommand;n(g,t,i,y)}i.framebuffer=e._alphaFBO.framebuffer;for(let h=0;h<o.length;++h){let g=o[h];g=l?g.derivedCommands.logDepth.command:g,g=u?g.derivedCommands.hdr.command:g;let x=p&&g.receiveShadows?g.derivedCommands.oit.shadows.alphaCommand:g.derivedCommands.oit.alphaCommand;n(x,t,i,y)}if(c(r)){let h=r.unclassifiedCommand,g=p&&h.receiveShadows?h.derivedCommands.oit.shadows.alphaCommand:h.derivedCommands.oit.alphaCommand;n(g,t,i,y)}i.framebuffer=f}function _ft(e,t,n,i,o,r){let{context:s,frameState:a}=t,{useLogDepth:l,shadowState:d}=a,u=t._hdr,f=i.framebuffer,p=d.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);let y=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;for(let h=0;h<o.length;++h){let g=o[h];g=l?g.derivedCommands.logDepth.command:g,g=u?g.derivedCommands.hdr.command:g;let x=p&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand;n(x,t,i,y)}if(c(r)){let h=r.unclassifiedCommand,g=p&&h.receiveShadows?h.derivedCommands.oit.shadows.translucentCommand:h.derivedCommands.oit.translucentCommand;n(g,t,i,y)}i.framebuffer=f}b0.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){_ft(this,e,t,n,i,o);return}xft(this,e,t,n,i,o)};b0.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};b0.prototype.clear=function(e,t,n){let i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,Y.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.frame
void main()
{
czm_shadow_cast_main();
v_positionEC = (czm_inverseProjection * gl_Position).xyz;
}`)}return new Be({defines:i,sources:o})};YT.createShadowCastFragmentShader=function(e,t,n,i){let o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=Be.findPositionVarying(e),a=c(s);a||(s="v_positionEC");let l=r.length;for(let u=0;u<l;++u)r[u]=Be.replaceMain(r[u],"czm_shadow_cast_main");let d="";return t&&(a||(d+=`in vec3 v_positionEC;
`),d+=`uniform vec4 shadowMap_lightPositionEC;
`),i?d+=`void main()
{
`:d+=`void main()
{
czm_shadow_cast_main();
if (out_FragColor.a == 0.0)
{
discard;
}
`,t?d+=` float distance = length(${s});
if (distance >= shadowMap_lightPositionEC.w)
{
discard;
}
distance /= shadowMap_lightPositionEC.w; // radius
out_FragColor = czm_packDepth(distance);
`:n?d+=` out_FragColor = vec4(1.0);
`:d+=` out_FragColor = czm_packDepth(gl_FragCoord.z);
`,d+=`}
`,r.push(d),new Be({defines:o,sources:r})};YT.getShadowReceiveShaderKeyword=function(e,t,n,i){let o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,l=e._numberOfCascades>1,d=e.debugCascadeColors,u=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${l}${d}${u}${t}${n}${i}`};YT.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 Be({defines:i,sources:o})};YT.createShadowReceiveFragmentShader=function(e,t,n,i,o){let r=Be.findNormalVarying(e),s=!i&&c(r)||i&&o,a=Be.findPositionVarying(e),l=c(a),d=t._usesDepthTexture,u=t._polygonOffsetSupported,f=t._isPointLight,p=t._isSpotLight,y=t._numberOfCascades>1,h=t.debugCascadeColors,g=t.softShadows,x=f?t._pointBias:i?t._terrainBias:t._primitiveBias,S=e.defines.slice(0),V=e.sources.slice(0),Z=V.length;for(let I=0;I<Z;++I)V[I]=Be.replaceMain(V[I],"czm_shadow_receive_main");f?S.push("USE_CUBE_MAP_SHADOW"):d&&S.push("USE_SHADOW_DEPTH_TEXTURE"),g&&!f&&S.push("USE_SOFT_SHADOWS"),y&&n&&i&&(s?S.push("ENABLE_VERTEX_LIGHTING"):S.push("ENABLE_DAYNIGHT_SHADING")),n&&x.normalShading&&s&&(S.push("USE_NORMAL_SHADING"),x.normalShadingSmooth>0&&S.push("USE_NORMAL_SHADING_SMOOTH"));let R="";f?R+=`uniform samplerCube shadowMap_textureCube;
`:R+=`uniform sampler2D shadowMap_texture;
`;let E;return l?E=` return vec4(${a}, 1.0);
`:E=`#ifndef LOG_DEPTH
return czm_windowToEyeCoordinates(gl_FragCoord);
#else
return vec4(v_logPositionEC, 1.0);
#endif
`,R+=`uniform mat4 shadowMap_matrix;
uniform vec3 shadowMap_lightDirectionEC;
uniform vec4 shadowMap_lightPositionEC;
uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness;
uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth;
#ifdef LOG_DEPTH
in vec3 v_logPositionEC;
#endif
vec4 getPositionEC()
{
${E}}
vec3 getNormalEC()
{
${s?` return normalize(${r});
`:` return vec3(1.0);
`}}
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL)
{
${x.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x;
float normalOffsetScale = 1.0 - nDotL;
vec3 offset = normalOffset * normalOffsetScale * normalEC;
positionEC.xyz += offset;
`:""}}
`,R+=`void main()
{
czm_shadow_receive_main();
vec4 positionEC = getPositionEC();
vec3 normalEC = getNormalEC();
float depth = -positionEC.z;
`,R+=` czm_shadowParameters shadowParameters;
shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
`,i?R+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0);
`:u||(R+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015);
`),f?R+=` 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?R+=` 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);
`:y?R+=` 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);
${h?` // Draw cascade colors for debugging
out_FragColor *= czm_cascadeColor(weights);
`:""}`:R+=` 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);
`,R+=` out_FragColor.rgb *= visibility;
}
`,V.push(R),new Be({defines:S,sources:V})};var cp=YT;function lp(e){e=e??z.EMPTY_OBJECT;let t=e.context;if(!c(t))throw new L("context is required.");if(!c(e.lightCamera))throw new L("lightCamera is required.");if(c(e.numberOfCascades)&&e.numberOfCascades!==1&&e.numberOfCascades!==4)throw new L("Only one or four cascades are supported.");this._enabled=e.enabled??!0,this._softShadows=e.softShadows??!1,this._normalOffset=e.normalOffset??!0,this.dirty=!0,this.fromLightSource=e.fromLightSource??!0,this.darkness=e.darkness??.3,this._darkness=this.darkness,this.fadingEnabled=e.fadingEnabled??!0,this.maximumDistance=e.maximumDistance??5e3,this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(Ot.isInternetExplorer()||Ot.isEdge()||(Ot.isChrome()||Ot.isFirefox())&&Ot.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 M,this._shadowMapTexture=void 0,this._lightDirectionEC=new m,this._lightPositionEC=new ce,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new ZD,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new ue,this._isPointLight=e.isPointLight??!1,this._pointLightRadius=e.pointLightRadius??100,this._cascadesEnabled=this._isPointLight?!1:e.cascadesEnabled??!0,this._numberOfCascades=this._cascadesEnabled?e.numberOfCascades??4:0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new D,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new Oo:c(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new ce,new ce],this._cascadeMatrices=[new M,new M,new M,new M],this._cascadeDistances=new ce;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 Vft(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,B4(this),this._clearCommand=new ti({depth:1,color:new Y}),this._clearPassState=new sc(t),this._size=e.size??2048,this.size=this._size}lp.MAXIMUM_DISTANCE=2e4;function Vft(e){this.camera=new ZD,this.passState=new sc(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function D4(e,t){return Oe.fromCache({cull:{enabled:!0,face:_i.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 B4(e){let t=!e._usesDepthTexture;e._primitiveRenderState=D4(t,e._primitiveBias),e._terrainRenderState=D4(t,e._terrainBias),e._pointRenderState=D4(t,e._pointBias)}lp.prototype.debugCreateRenderStates=function(){B4(this)};Object.defineProperties(lp.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
in 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(czm_textureCube(shadowMap_textureCube, dir));
out_FragColor = vec4(vec3(shadow), 1.0);
}
`:n=`uniform sampler2D shadowMap_texture;
in vec2 v_textureCoordinates;
void main()
{
${e._usesDepthTexture?` float shadow = texture(shadowMap_texture, v_textureCoordinates).r;
`:` float shadow = czm_unpackDepth(texture(shadowMap_texture, v_textureCoordinates));
`} out_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=Xe.OVERLAY,i}function wft(e,t){let n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=Ift;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;c(a)||(a=Wft(e,n),e._debugShadowViewCommand=a),(!c(a.renderState)||!je.equals(a.renderState.viewport,s))&&(a.renderState=Oe.fromCache({viewport:je.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}var dp=new Array(8);dp[0]=new ce(-1,-1,-1,1);dp[1]=new ce(1,-1,-1,1);dp[2]=new ce(1,1,-1,1);dp[3]=new ce(-1,1,-1,1);dp[4]=new ce(-1,-1,1,1);dp[5]=new ce(1,-1,1,1);dp[6]=new ce(1,1,1,1);dp[7]=new ce(-1,1,1,1);var wg=new M,H4=new Array(8);for(let e=0;e<8;++e)H4[e]=new ce;function Pft(e,t){let n=new Rt({geometry:new Fm({minimum:new m(-.5,-.5,-.5),maximum:new m(.5,.5,.5)}),attributes:{color:Yt.fromColor(t)}}),i=new Rt({geometry:new Ib({radius:.5}),attributes:{color:Yt.fromColor(t)}});return new In({geometryInstances:[n,i],appearance:new an({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var vft=[Y.RED,Y.GREEN,Y.BLUE,Y.MAGENTA],Fft=new m;function Aft(e,t){wft(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 op({camera:e._sceneCamera,color:Y.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new op({camera:e._shadowMapCamera,color:Y.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 op({camera:e._passes[i].camera,color:vft[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!c(e._debugLightFrustum)||e._needsUpdate){let i=e._shadowMapCamera.positionWC,o=Fe.IDENTITY,r=e._pointLightRadius*2,s=m.fromElements(r,r,r,Fft),a=M.fromTranslationQuaternionRotationScale(i,o,s,wg);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=Pft(a,Y.YELLOW)}e._debugLightFrustum.update(t)}else(!c(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new op({camera:e._shadowMapCamera,color:Y.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function ZD(){this.viewMatrix=new M,this.inverseViewMatrix=new M,this.frustum=void 0,this.positionCartographic=new pe,this.positionWC=new m,this.directionWC=m.clone(m.UNIT_Z),this.upWC=m.clone(m.UNIT_Y),this.rightWC=m.clone(m.UNIT_X),this.viewProjectionMatrix=new M}ZD.prototype.clone=function(e){M.clone(e.viewMatrix,this.viewMatrix),M.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),pe.clone(e.positionCartographic,this.positionCartographic),m.clone(e.positionWC,this.positionWC),m.clone(e.directionWC,this.directionWC),m.clone(e.upWC,this.upWC),m.clone(e.rightWC,this.rightWC)};var Mft=new M(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);ZD.prototype.getViewProjection=function(){let e=this.viewMatrix,t=this.frustum.projectionMatrix;return M.multiply(t,e,this.viewProjectionMatrix),M.multiply(Mft,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var Nft=new Array(5),kft=new Ci,Uft=new Array(4),Kxe=new m,Jxe=new m;function Oft(e,t){let n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades,a,l=r-o,d=r/o,u=.9,f=!1;t.shadowState.closestObjectSize<200&&(f=!0,u=.9);let p=Uft,y=Nft;for(y[0]=o,y[s]=r,a=0;a<s;++a){let N=(a+1)/s,b=o*Math.pow(d,N),G=o+l*N,X=w.lerp(G,b,u);y[a+1]=X,p[a]=X-y[a]}if(f){for(a=0;a<s;++a)p[a]=Math.min(p[a],e._maximumCascadeDistances[a]);let N=y[0];for(a=0;a<s-1;++a)N+=p[a],y[a+1]=N}ce.unpack(y,0,e._cascadeSplits[0]),ce.unpack(y,
#ifdef DEBUG_SHOW_DEPTH
uniform sampler2D u_packedTranslucentDepth;
#endif
in vec2 v_textureCoordinates;
void main()
{
#ifdef DEBUG_SHOW_DEPTH
if (v_textureCoordinates.x < 0.5)
{
out_FragColor.rgb = vec3(czm_unpackDepth(texture(u_packedTranslucentDepth, v_textureCoordinates)));
out_FragColor.a = 1.0;
}
#else
vec4 color = texture(colorTexture, v_textureCoordinates);
#ifdef PICK
if (color == vec4(0.0))
{
discard;
}
#else
color.rgb /= color.a;
#endif
out_FragColor = color;
#endif
}
`;var iht=!1;function Pg(e){this._drawClassificationFBO=new hi({createDepthAttachments:!1}),this._accumulationFBO=new hi({createDepthAttachments:!1}),this._packFBO=new hi,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 ti({color:new Y(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new ti({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new je,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(Pg.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function qxe(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function $xe(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function oht(e,t,n,i){qxe(e),e._translucentDepthStencilTexture=new Pt({context:t,width:n,height:i,pixelFormat:ke.DEPTH_STENCIL,pixelDatatype:Ue.UNSIGNED_INT_24_8,sampler:en.NEAREST})}function rht(e,t,n,i){$xe(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 sht(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)&&(oht(e,t,o,r),rht(e,t,o,r));let s,a;if(c(e._packDepthCommand)||(s=new Be({sources:[Pv]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!c(e._compositeCommand)){s=new Be({sources:[HT]}),a={colorTexture:function(){return e._textureToComposite}},iht&&(s.defines=["DEBUG_SHOW_DEPTH"],a.u_packedTranslucentDepth=function(){return e._packFBO.getColorTexture()}),e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});let u=e._compositeCommand,f=u.shaderProgram,p=t.shaderCache.createDerivedShaderProgram(f,"pick",{vertexShaderSource:f.vertexShaderSource,fragmentShaderSource:new Be({sources:s.sources,defines:["PICK"]}),attributeLocations:f._attributeLocations}),y=et.shallowClone(u);y.shaderProgram=p,u.derivedCommands.pick=y}c(e._copyCommand)||(s=new Be({sources:[HT]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),c(e._accumulateCommand)||(s=new Be({sources:[HT]}),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 l=!je.equals(e._viewport,n.viewport),d=l!==e._useScissorTest;e._useScissorTest=l,je.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=je.clone(n.viewport,e._scissorRectangle),d=!0),(!c(e._rsDepth)||!je.equals(e._viewport,e._rsDepth.viewport)||d)&&(e._rsDepth=Oe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!c(e._rsAccumulate)||!je.equals(e._viewport,e._rsAccumulate.viewport)||d)&&(e._rsAccumulate=Oe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:On.EQUAL,reference:kt.CESIUM_3D_TILE_MASK}})),c(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!c(e._rsComp)||!je.equals(e._viewport,e._rsComp.viewport)||d)&&(e._rs
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
color /= texture(autoExposure, vec2(0.5)).r;
#else
color *= vec3(exposure);
#endif
color = czm_acesTonemapping(color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var b3i=_(T(),1),dA=`precision highp float;
uniform sampler2D randomTexture;
uniform sampler2D depthTexture;
uniform float intensity;
uniform float bias;
uniform float lengthCap;
uniform int stepCount;
uniform int directionCount;
vec4 pixelToEye(vec2 screenCoordinate)
{
vec2 uv = screenCoordinate / czm_viewport.zw;
float depth = czm_readDepth(depthTexture, uv);
vec2 xy = 2.0 * uv - vec2(1.0);
vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);
posEC = posEC / posEC.w;
if (depth >= 1.0) {
posEC.z = czm_currentFrustum.y;
}
return posEC;
}
vec3 getNormalXEdge(vec3 positionEC)
{
vec2 centerCoord = gl_FragCoord.xy;
vec3 positionLeft = pixelToEye(centerCoord + vec2(-1.0, 0.0)).xyz;
vec3 positionRight = pixelToEye(centerCoord + vec2(1.0, 0.0)).xyz;
vec3 positionUp = pixelToEye(centerCoord + vec2(0.0, 1.0)).xyz;
vec3 positionDown = pixelToEye(centerCoord + vec2(0.0, -1.0)).xyz;
vec3 dx0 = positionEC - positionLeft;
vec3 dx1 = positionRight - positionEC;
vec3 dy0 = positionEC - positionDown;
vec3 dy1 = positionUp - positionEC;
vec3 dx = length(dx0) < length(dx1) ? dx0 : dx1;
vec3 dy = length(dy0) < length(dy1) ? dy0 : dy1;
return normalize(cross(dx, dy));
}
const float sqrtTwoPi = sqrt(czm_twoPi);
float gaussian(float x, float standardDeviation) {
float argument = x / standardDeviation;
return exp(-0.5 * argument * argument) / (sqrtTwoPi * standardDeviation);
}
void main(void)
{
vec4 positionEC = pixelToEye(gl_FragCoord.xy);
float maxValidDepth = czm_currentFrustum.y - lengthCap;
if (-positionEC.z > maxValidDepth)
{
out_FragColor = vec4(1.0);
return;
}
vec3 normalEC = getNormalXEdge(positionEC.xyz);
float gaussianVariance = lengthCap * sqrt(-positionEC.z);
float stepLength = 3.0 * gaussianVariance / (float(stepCount) + 1.0);
float metersPerPixel = czm_metersPerPixel(positionEC, 1.0);
float pixelsPerStep = max(stepLength / metersPerPixel, 1.0);
stepLength = pixelsPerStep * metersPerPixel;
float angleStepScale = 1.0 / float(directionCount);
float angleStep = angleStepScale * czm_twoPi;
float cosStep = cos(angleStep);
float sinStep = sin(angleStep);
mat2 rotateStep = mat2(cosStep, sinStep, -sinStep, cosStep);
const float randomTextureSize = 255.0;
vec2 randomTexCoord = fract(gl_FragCoord.xy / randomTextureSize);
float randomVal = texture(randomTexture, randomTexCoord).x;
vec2 sampleDirection = vec2(cos(angleStep * randomVal), sin(angleStep * randomVal));
float ao = 0.0;
#if __VERSION__ == 300
for (int i = 0; i < directionCount; i++)
{
#else
for (int i = 0; i < 16; i++)
{
if (i >= directionCount) {
break;
}
#endif
sampleDirection = rotateStep * sampleDirection;
float localAO = 0.0;
vec2 radialStep = pixelsPerStep * sampleDirection;
#if __VERSION__ == 300
for (int j = 0; j < stepCount; j++)
{
#else
for (int j = 0; j < 64; j++)
{
if (j >= stepCount) {
break;
}
#endif
vec2 samplePixel = floor(gl_FragCoord.xy + float(j + 1) * radialStep) + vec2(0.5);
if (clamp(samplePixel, vec2(0.0), czm_viewport.zw) != samplePixel) {
break;
}
vec4 samplePositionEC = pixelToEye(samplePixel);
vec3 stepVector = samplePositionEC.xyz - positionEC.xyz;
float dotVal = clamp(dot(normalEC, normalize(stepVector)), 0.0, 1.0);
dotVal = czm_branchFreeTernary(dotVal > bias, dotVal, 0.0);
dotVal = czm_branchFreeTernary(-samplePositionEC.z <= maxValidDepth, dotVal, 0.0);
float sampleDistance = length(stepVector);
float weight = gaussian(sampleDistance, gaussianVariance);
localAO += weight * dotVal;
}
ao += localAO;
}
ao *= angleStepScale * stepLength;
ao = 1.0 - clamp(ao, 0.0, 1.0);
ao = pow(ao, intensity);
out_FragColor = vec4(vec3(ao), 1.0);
}
`;var g3i=_(T(),1),uA=`uniform sampler2D colorTexture;
uniform sampler2D ambientOcclusionTexture;
uniform bool ambientOcclusionOnly;
in vec2 v_textureCoordinates;
void main(void)
{
vec4 color = texture(colorTexture, v_textureCoordinates);
vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates);
out_FragColor = ambientOcclusionOnly ? ao : ao * color;
}
`;var _3i=_(T(),1),mA=`uniform sampler2D colorTexture;
uniform float gradations;
in vec2 v_textureCoordinates;
void main(void)
{
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
#ifdef CZM_SELECTED_FEATURE
if (czm_selected()) {
out_FragColor = vec4(rgb, 1.0);
return;
}
#endif
float luminance = czm_luminance(rgb);
float darkness = luminance * gradations;
darkness = (darkness - fract(darkness)) / gradations;
out_FragColor = vec4(vec3(darkness), 1.0);
}
`;var S3i=_(T(),1),fA=`uniform sampler2D colorTexture;
uniform sampler2D bloomTexture;
uniform bool glowOnly;
in vec2 v_textureCoordinates;
void main(void)
{
vec4 color = texture(colorTexture, v_textureCoordinates);
#ifdef CZM_SELECTED_FEATURE
if (czm_selected()) {
out_FragColor = color;
return;
}
#endif
vec4 bloom = texture(bloomTexture, v_textureCoordinates);
out_FragColor = glowOnly ? bloom : bloom + color;
}
`;var V3i=_(T(),1),hA=`uniform sampler2D colorTexture;
uniform float brightness;
in vec2 v_textureCoordinates;
void main(void)
{
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
vec3 target = vec3(0.0);
out_FragColor = vec4(mix(target, rgb, brightness), 1.0);
}
`;var Z3i=_(T(),1),pA=`uniform sampler2D colorTexture;
uniform float contrast;
uniform float brightness;
in vec2 v_textureCoordinates;
void main(void)
{
vec3 sceneColor = texture(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);
out_FragColor = vec4(sceneColor, 1.0);
}
`;var G3i=_(T(),1),bA=`uniform sampler2D colorTexture;
uniform sampler2D blurTexture;
uniform sampler2D depthTexture;
uniform float focalDistance;
in 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);
out_FragColor = mix(texture(colorTexture, v_textureCoordinates), texture(blurTexture, v_textureCoordinates), d);
}
`;var X3i=_(T(),1),yA=`uniform sampler2D depthTexture;
in vec2 v_textureCoordinates;
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
out_FragColor = vec4(vec3(depth), 1.0);
}
`;var W3i=_(T(),1),gA=`uniform sampler2D depthTexture;
uniform float length;
uniform vec4 color;
in 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)
{
out_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 -= texture(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;
horizEdge += texture(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;
vertEdge -= texture(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;
vertEdge += texture(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;
}
float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);
out_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);
}
`;var P3i=_(T(),1),xA=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture(autoExposure, vec2(0.5)).r;
color /= exposure;
#else
color *= vec3(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);
out_FragColor = vec4(c, fragmentColor.a);
}
`;var F3i=_(T(),1),_A=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
color /= texture(autoExposure, vec2(0.5)).r;
#else
color *= vec3(exposure);
#endif
color = czm_pbrNeutralTonemapping(color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var M3i=_(T(),1),TA=`in 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 = texture(colorTexture, v_textureCoordinates).a;
out_FragColor = vec4(color.rgb, alpha);
}
`;var k3i=_(T(),1),vg=`#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
in 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 = texture(colorTexture, st) * g.x;
for (int i = 1; i < SAMPLES; ++i)
{
g.xy *= g.yz;
vec2 offset = float(i) * dir * step;
result += texture(colorTexture, st - offset) * g.x;
result += texture(colorTexture, st + offset) * g.x;
}
out_FragColor = result;
}
`;var O3i=_(T(),1),SA=`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;
in 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) * texture(tex, texcoord + direction * distortion.r).r;
color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture(tex, texcoord + direction * distortion.g).g;
color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture(tex, texcoord + direction * distortion.b).b;
}
else
{
color.r = texture(tex, texcoord + direction * distortion.r).r;
color.g = texture(tex, texcoord + direction * distortion.g).g;
color.b = texture(tex, texcoord + direction * distortion.b).b;
}
return vec4(clamp(color, 0.0, 1.0), 0.0);
}
void main(void)
{
vec4 originalColor = texture(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)))
{
out_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 * texture(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 *= texture(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;
}
result += texture(colorTexture, v_textureCoordinates);
out_FragColor = result;
}
`;var B3i=_(T(),1),CA=`uniform sampler2D colorTexture;
uniform vec3 white;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture(autoExposure, vec2(0.5)).r;
color /= exposure;
#else
color *= vec3(exposure);
#endif
color = (color * (1.0 + color / white)) / (1.0 + color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var H3i=_(T(),1),VA=`uniform sampler2D colorTexture;
in 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 = texture(colorTexture, v_textureCoordinates).rgb;
vec3 green = vec3(0.0, 1.0, 0.0);
out_FragColor = vec4((noiseValue + rgb) * green, 1.0);
}
`;var K3i=_(T(),1),LA=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture(autoExposure, vec2(0.5)).r;
color /= exposure;
#else
color *= vec3(exposure);
#endif
color = color / (1.0 + color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var Q3i=_(T(),1),ZA=`uniform sampler2D colorTexture;
uniform sampler2D silhouetteTexture;
in vec2 v_textureCoordinates;
void main(void)
{
vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);
vec4 color = texture(colorTexture, v_textureCoordinates);
out_FragColor = mix(color, silhouetteColor, silhouetteColor.a);
}
`;var rYi=_(T(),1);function KT(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new hi,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new D,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}Object.defineProperties(KT.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){let e=this._framebuffers;if(c(e))return e[e.length-1].getColorTexture(0)}}});function u_e(e){let t=e._framebuffers;if(!c(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function Nht(e,t){u_e(e);let n=e._width,i=e._height,o=t.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let l=0;l<r;++l)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[l]=new hi,s[l].update(t,n,i,1,o);let a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}function m_e(e){let t=e._commands;if(!c(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function kht(e,t){let n;if(t===0)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{let i=e._framebuffers[t-1].getColorTexture(0);n={colorTexture:function(){return i},colorTextureDimensions:function(){return i.dimensions}}}return n.minMaxLuminance=function(){return e._minMaxLuminance},n.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},n}function Uht(e,t){let n=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
float sampleTexture(vec2 offset) {
`;return e===0?n+=` vec4 color = texture(colorTexture, v_textureCoordinates + offset);
return czm_luminance(color.rgb);
`:n+=` return texture(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 = texture(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+=` out_FragColor = vec4(color);
}
`,n}function Oht(e,t){m_e(e);let n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(Uht(r,i),{framebuffer:n[r].framebuffer,uniformMap:kht(e,r)});e._commands=o}KT.prototype.clear=function(e){let t=this._framebuffers;if(!c(t))return;let n=this._clearCommand;c(n)||(n=this._clearCommand=new ti({color:new Y(0,0,0,0),framebuffer:void 0}));let i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};KT.prototype.update=function(e){let t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,Nht(this,e),Oht(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};KT.prototype.execute=function(e,t){this._colorTexture=t;let n=this._commands;if(!c(n))return;let i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};KT.prototype.isDestroyed=function(){return!1};KT.prototype.destroy=function(){return u_e(this),m_e(this),he(this)};var RA=KT;var XYi=_(T(),1);var aYi=_(T(),1),Dht={NEAREST:0,LINEAR:1},qd=Dht;function JT(e){e=e??z.EMPTY_OBJECT;let{name:t=Hn(),fragmentShader:n,uniforms:i,textureScale:o=1,forcePowerOfTwo:r=!1,sampleMode:s=qd.NEAREST,pixelFormat:a=ke.RGBA,pixelDatatype:l=Ue.UNSIGNED_BYTE,clearColor:d=Y.BLACK,scissorRectangle:u}=e;if(C.typeOf.string("options.fragmentShader",n),C.typeOf.number.greaterThan("options.textureScale",o,0),C.typeOf.number.lessThanOrEquals("options.textureScale",o,1),!ke.isColorFormat(a))throw new L("options.pixelFormat must be a color format.");this._fragmentShader=n,this._uniforms=i,this._textureScale=o,this._forcePowerOfTwo=r,this._sampleMode=s,this._pixelFormat=a,this._pixelDatatype=l,this._clearColor=d,this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;let f=new sc;f.scissorTest={enabled:!0,rectangle:c(u)?je.clone(u):new je},this._passState=f,this._ready=!1,this._name=t,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=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,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(JT.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(c(this._textureCache)){let e=this._textureCache.getFramebuffer(this._name);if(c(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});var Bht=/uniform\s+sampler2D\s+depthTexture/g;JT.prototype._isSupported=function(e){return!Bht.test(this._fragmentShader)||e.depthTexture};function Yht(e,t,n){let i=t[n];return(typeof i=="string"||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(o){let r=t[n];t[n]=o;let s=e._actua
uniform sampler2D czm_idTexture;
uniform sampler2D czm_selectedIdTexture;
uniform float czm_selectedIdTextureStep;
in vec2 v_textureCoordinates;
bool czm_selected(vec2 offset)
{
bool selected = false;
vec4 id = texture(czm_idTexture, v_textureCoordinates + offset);
for (int i = 0; i < ${t}; ++i)
{
vec4 selectedId = texture(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));
}
${e}`}function Qht(e,t){if(c(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(c(e._selectedIdTexture)){let o=e._selectedIdTexture.width;n=Jht(n,o)}let i=new Be({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function jht(e){let t=e._sampleMode,n,i;t===qd.LINEAR?(n=Jt.LINEAR,i=di.LINEAR):(n=Jt.NEAREST,i=di.NEAREST);let o=e._sampler;(!c(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new en({wrapS:xn.CLAMP_TO_EDGE,wrapT:xn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function qht(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function $ht(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function ept(e,t){let n=e._texturesToRelease;for(let a=0;a<n.length;++a){let l=n[a];l=l&&l.destroy()}n.length=0;let i=e._texturesToCreate;for(let a=0;a<i.length;++a){let{name:l,source:d}=i[a];e._actualUniforms[l]=new Pt({context:t,source:d})}i.length=0;let o=e._dirtyUniforms;if(o.length===0&&!c(e._texturePromise)){e._ready=!0;return}if(o.length===0||c(e._texturePromise))return;let r=e._uniforms,s=[];for(let a=0;a<o.length;++a){let l=o[a],d=r[l],u=e._textureCache.getStageByName(d);if(c(u))e._actualUniforms[l]=$ht(e,d);else if(typeof d=="string"){let f=new Ge({url:d});s.push(f.fetchImage().then(qht(e,l)))}else e._texturesToCreate.push({name:l,source:d})}o.length=0,s.length>0?(e._ready=!1,e._texturePromise=Promise.all(s).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function f_e(e){c(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(!c(t))return;let n=e._uniforms,i=e._actualUniforms;for(let o in i){if(!i.hasOwnProperty(o))continue;let r=i[o];r instanceof Pt&&(c(t.getStageByName(n[o]))||r.destroy(),e._dirtyUniforms.push(o))}}function tpt(e){let t=c(e._selected)?e._selected.length:0,n=c(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength;if(c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;for(let o=0;o<e._combinedSelected.length;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}function npt(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;let n=e._combinedSelected;if(!c(n))return;let i=0;for(let s=0;s<n.length;++s){let a=n[s];c(a.pickIds)?i+=a.pickIds.length:c(a.pickId)&&++i}if(n.length===0||i===0){let s=new Uint8Array([255,255,255,255]);e._selectedIdTexture=new Pt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:s,width:1,height:1},sampler:en.NEAREST});return}let o=0,r=new Uint8Array(i*4);for(let s=0;s<n.length;++s){let a=n[s];if(c(a.pickIds)){let l=a.pickIds,d=l.length;for(let u=0;u<d;++u){let f=l[u].color;r[o]=Y.floatToByte(f.red),r[o+1]=Y.floatToByte(f.green),r[o+2]=Y.floatToByte(f.blue),r[o+3]=Y.floatToByte(f.alpha),o+=4}}else if(c(a.pickId)){let l=a.pickId.color;r[o]=Y.floatToByte(l.red),r[o+1]=Y.floatToByte(l.green),r[o+2]=Y.floatToByte(l.blue),r[o+3]=Y.floatToByte(l.alpha),o+=4}}e._selectedIdTexture=new Pt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:r,width:i,height:1},sampler:en.NEAREST})}JT.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&f_e(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=tpt(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelecte
${vg}`,r=new mo({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:qd.LINEAR}),s=new mo({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:qd.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(l){let d=r.uniforms,u=s.uniforms;d.delta=u.delta=l}},sigma:{get:function(){return r.uniforms.sigma},set:function(l){let d=r.uniforms,u=s.uniforms;d.sigma=u.sigma=l}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(l){let d=r.uniforms,u=s.uniforms;d.stepSize=u.stepSize=l}}}),new nd({name:e,stages:[r,s],uniforms:a})}Ir.createBlurStage=function(){return j4("czm_blur")};Ir.createDepthOfFieldStage=function(){let e=j4("czm_depth_of_field_blur"),t=new mo({name:"czm_depth_of_field_composite",fragmentShader:bA,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 nd({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};Ir.isDepthOfFieldSupported=function(e){return e.context.depthTexture};Ir.createEdgeDetectionStage=function(){let e=Hn();return new mo({name:`czm_edge_detection_${e}`,fragmentShader:gA,uniforms:{length:.25,color:Y.clone(Y.BLACK)}})};Ir.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function opt(e){if(!c(e))return Ir.createEdgeDetectionStage();let t=new nd({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} = texture(edgeTexture${a}, v_textureCoordinates);
if (edge${a}.a > 0.0)
{
color = edge${a};
break;
}
`,n[`edgeTexture${a}`]=e[a].name;let r=`${i}in vec2 v_textureCoordinates;
void main() {
vec4 color = vec4(0.0);
for (int i = 0; i < ${e.length}; i++)
{
${o} }
out_FragColor = color;
}
`,s=new mo({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new nd({name:"czm_edge_detection_composite",stages:[t,s]})}Ir.createSilhouetteStage=function(e){let t=opt(e),n=new mo({name:"czm_silhouette_color_edges",fragmentShader:ZA,uniforms:{silhouetteTexture:t.name}});return new nd({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};Ir.isSilhouetteSupported=function(e){return e.context.depthTexture};Ir.createBloomStage=function(){let e=new mo({name:"czm_bloom_contrast_bias",fragmentShader:pA,uniforms:{contrast:128,brightness:-.3}}),t=j4("czm_bloom_blur"),n=new nd({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new mo({name:"czm_bloom_generate_composite",fragmentShader:fA,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 nd({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};Ir.createAmbientOcclusionStage=function(){let e=new mo({name:"czm_ambient_occlusion_generate",fragmentShader:dA,uniforms:{intensity:3,bias:.1,lengthCap:.26,directionCount:8,stepCount:32,randomTexture:void 0}}),t=new mo({name:"czm_ambient_occlusion_composite",fragmentShader:uA,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:e.name}}),n={};return Object.defineProperties(n,{intensity:{get:function(){return e.uniforms.intensity},set:function(i){e.uniforms.intensity=i}},bias:{get:function(){return e.uniforms.bias},set:function(i){e.uniforms.bias=i}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(i){e.uniforms.lengthCap=i}},directionCount:{get:function(){return e.uniforms.directionCount},set:function(i){e.uniforms.directionCount=i}},stepCount:{get:function(){return e.uniforms.stepCount},set:function(i){e.uniforms.stepCount=i}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(i){e.uniforms.randomTexture=i}},ambientOcclusionOnly:{get:function(){return t.uniforms.ambientOcclusionOnly},set:function(i){t.uniforms.ambientOcclusionOnly=i}}}),new nd({name:"czm_ambient_occlusion",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};Ir.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var rpt=`#define FXAA_QUALITY_PRESET 39
${Mv}
${TA}`;Ir.createFXAAStage=function(){return new mo({name:"czm_FXAA",fragmentShader:rpt,sampleMode:qd.LINEAR})};Ir.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=lA,new mo({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Ir.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=xA,new mo({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Ir.createPbrNeutralTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=_A,new mo({name:"czm_pbr_neutral",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Ir.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=LA,new mo({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Ir.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=CA,new mo({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:Y.WHITE,autoExposure:void 0,exposure:1}})};Ir.createAutoExposureStage=function(){return new RA};Ir.createBlackAndWhiteStage=function(){return new mo({name:"czm_black_and_white",fragmentShader:mA,uniforms:{gradations:5}})};Ir.createBrightnessStage=function(){return new mo({name:"czm_brightness",fragmentShader:hA,uniforms:{brightness:.5}})};Ir.createNightVisionStage=function(){return new mo({name:"czm_night_vision",fragmentShader:VA})};Ir.createDepthViewStage=function(){return new mo({name:"czm_depth_view",fragmentShader:yA})};Ir.createLensFlareStage=function(){return new mo({name:"czm_lens_flare",fragmentShader:SA,uniforms:{dirtTexture:on("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:on("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:re.WGS84.maximumRadius}})};var $d=Ir;var SHi=_(T(),1);function x0(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function EA(e){for(;c(e.length);)e=e.get(e.length-1);return e.name}function q4(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;let r=n[i.name]={};if(c(o)){let a=e.getStageByName(o);r[EA(a)]=!0}let s=i.uniforms;if(c(s)){let a=Object.getOwnPropertyNames(s),l=a.length;for(let d=0;d<l;++d){let u=s[a[d]];if(typeof u=="string"){let f=e.getStageByName(u);c(f)&&(r[EA(f)]=!0)}}}return i.name}function GA(e,t,n,i,o){if(c(i.enabled)&&!i.enabled||c(i._isSupported)&&!i._isSupported(t))return o;let r=o,s=!c(i.inputPreviousStageTexture)||i.inputPreviousStageTexture,a=o,l=i.length;for(let f=0;f<l;++f){let p=i.get(f);c(p.length)?a=GA(e,t,n,p,o):a=q4(e,t,n,p,o),s&&(o=a)}let d,u;if(s)for(d=1;d<l;++d)u=EA(i.get(d)),c(n[u])||(n[u]={}),n[u][r]=!0;else for(d=1;d<l;++d){u=EA(i.get(d));let f=n[u];for(let p=0;p<d;++p)f[EA(i.get(p))]=!0}return a}function spt(e,t){let n={};if(c(e.ambientOcclusion)){let i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa,a=GA(e,t,n,i,void 0);a=GA(e,t,n,o,a),a=q4(e,t,n,r,a),a=GA(e,t,n,e,a),q4(e,t,n,s,a)}else GA(e,t,n,e,void 0);return n}function apt(e,t,n){let o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,l=o._pixelDatatype,d=o._clearColor,u,f,p=e._framebuffers,y=p.length;for(u=0;u<y;++u){if(f=p[u],r!==f.textureScale||s!==f.forcePowerOfTwo||a!==f.pixelFormat||l!==f.pixelDatatype||!Y.equals(d,f.clearColor))continue;let h=f.stages,g=h.length,x=!1;for(let S=0;S<g;++S)if(n[h[S]]){x=!0;break}if(!x)break}return c(f)&&u<y?(f.stages.push(t),f):(f={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:l,clearColor:d,stages:[t],buffer:new hi({pixelFormat:a,pixelDatatype:l}),clear:void 0},p.push(f),f)}function cpt(e,t){let n=spt(e._collection,t);for(let i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=apt(e,i,n[i]))}function $4(e){let t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function lpt(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],l=a.textureScale,d=Math.ceil(n*l),u=Math.ceil(i*l),f=Math.min(d,u);a.forcePowerOfTwo&&(w.isPowerOfTwo(f)||(f=w.nextPowerOfTwo(f)),d=f,u=f),a.buffer.update(t,d,u),a.clear=new ti({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}x0.prototype.updateDependencies=function(){this._updateDependencies=!0};x0.prototype.update=function(e){let t=this._collection,n=this._updateDependencies,i=c(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=c(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=c(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=c(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!c(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&($4(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&cpt(this,e);let l=e.drawingBufferWidth,d=e.drawingB
uniform sampler2D colorTexture2;
uniform vec2 center;
uniform float radius;
in vec2 v_textureCoordinates;
void main()
{
vec4 color0 = texture(colorTexture, v_textureCoordinates);
vec4 color1 = texture(colorTexture2, v_textureCoordinates);
float x = length(gl_FragCoord.xy - center) / radius;
float t = smoothstep(0.5, 0.8, x);
out_FragColor = mix(color0 + color1, color1, t);
}
`;var SKi=_(T(),1),NA=`uniform sampler2D colorTexture;
uniform float avgLuminance;
uniform float threshold;
uniform float offset;
in 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 = texture(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;
out_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);
}
`;function S0(){this._sceneFramebuffer=new BT;let e=.125,t=new Array(6);t[0]=new mo({fragmentShader:td,textureScale:e,forcePowerOfTwo:!0,sampleMode:qd.LINEAR});let n=t[1]=new mo({fragmentShader:NA,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new D,t[2]=new mo({fragmentShader:vg,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 mo({fragmentShader:vg,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 mo({fragmentShader:td,sampleMode:qd.LINEAR}),this._uCenter=new D,this._uRadius=void 0,t[5]=new mo({fragmentShader:MA,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new nd({stages:t});let o=new jT(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}S0.prototype.get=function(e){return this._stages.get(e)};S0.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 B0t=new ce,STe=new D,Y0t=new D,CTe=new M;function H0t(e,t,n){let i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection,l=M.computeViewportTransformation(n,0,1,CTe),d=M.multiplyByPoint(r,o,B0t),u=wt.pointToGLWindowCoordinates(s,l,o,STe);d.x+=w.SOLAR_RADIUS;let f=wt.pointToGLWindowCoordinates(a,l,d,d),p=D.magnitude(D.subtract(f,u,f))*30*2,y=Y0t;y.x=p,y.y=p,e._uCenter=D.clone(u,e._uCenter),e._uRadius=Math.max(y.x,y.y)*.15;let h=t.drawingBufferWidth,g=t.drawingBufferHeight,x=e._stages,S=x.get(0),V=S.outputTexture.width,Z=S.outputTexture.height,R=new je;R.width=V,R.height=Z,l=M.computeViewportTransformation(R,0,1,CTe),u=wt.pointToGLWindowCoordinates(s,l,o,STe),y.x*=V/h,y.y*=Z/g;let E=S.scissorRectangle;E.x=Math.max(u.x-y.x*.5,0),E.y=Math.max(u.y-y.y*.5,0),E.width=Math.min(y.x,h),E.height=Math.min(y.y,g);for(let I=1;I<4;++I)je.clone(E,x.get(I).scissorRectangle)}S0.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};S0.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),H0t(this,t,n),o};S0.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)};S0.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(td,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};S0.prototype.isDestroyed=function(){return!1};S0.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),he(this)};var kA=S0;var KKi=_(T(),1);function VTe(){this._cachedShowFrustumsShaders={}}function z0t(e){let t={},n=e.vertexAttributes;for(let i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function K0t(e,t){let n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(u){u=Be.replaceMain(u,"czm_Debug_main");let f=/out_FragData_(\d+)/g,p;for(;(p=f.exec(u))!==null;)r.indexOf(p[1])===-1&&r.push(p[1]);return u});let s=r.length,a="";a+=`uniform vec3 debugShowCommandsColor;
`,a+=`uniform vec3 debugShowFrustumsColor;
`,a+=`void main()
{
czm_Debug_main();
`;let l;if(s>0)for(l=0;l<s;++l)a+=` out_FragData_${r[l]}.rgb *= debugShowCommandsColor;
`,a+=` out_FragData_${r[l]}.rgb *= debugShowFrustumsColor;
`;else a+=` out_FragColor.rgb *= debugShowCommandsColor;
`,a+=` out_FragColor.rgb *= debugShowFrustumsColor;
`;a+="}",o.sources.push(a);let d=z0t(i);return tn.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:d})}var UA=new Y;function J0t(e,t){let n;return c(t.uniformMap)?n=t.uniformMap:n={},c(n.debugShowCommandsColor)||c(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(c(t._debugColor)||(t._debugColor=Y.fromRandom()),t._debugColor):Y.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(UA.red=t.debugOverlappingFrustums&1?1:0,UA.green=t.debugOverlappingFrustums&2?1:0,UA.blue=t.debugOverlappingFrustums&4?1:0,UA.alpha=1,UA):Y.WHITE}),n}var Q0t=new et;VTe.prototype.executeDebugShowFrustumsCommand=function(e,t,n){let i=t.shaderProgram.id,o=this._cachedShowFrustumsShaders[i];c(o)||(o=K0t(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);let r=et.shallowClone(t,Q0t);r.shaderProgram=o,r.uniformMap=J0t(e,t),r.execute(e.context,n)};var OA=VTe;var tJi=_(T(),1);function iS(e,t,n){this._primitive=e,this._tileIndex=t,this._sampleIndex=n,this._metadata={},this._orientedBoundingBox=new Xn}iS.fromKeyframeNode=function(e,t,n,i){C.typeOf.object("primitive",e),C.typeOf.number("tileIndex",t),C.typeOf.number("sampleIndex",n),C.typeOf.object("keyframeNode",i);let o=new iS(e,t,n),{spatialNode:r,content:s}=i;return o._metadata=j0t(e,s,n),o._orientedBoundingBox=$0t(e,r,n,o._orientedBoundingBox),o};function j0t(e,t,n){if(!c(t)||!c(t.metadata))return;let{names:i,types:o}=e.provider,{metadata:r}=t,s={};for(let a=0;a<i.length;a++){let l=i[a],d=lt.getComponentCount(o[a]),u=r[a].slice(n*d,(n+1)*d);s[l]=u}return s}var LTe=new m,q0t=new m;function $0t(e,t,n,i){let o=t.dimensions,r=o.x*o.y,s=Math.floor(n/r),a=n-s*r,l=Math.floor(a/o.x),d=a-l*o.x,u=m.fromElements(d,l,s,LTe),f=m.divideComponents(m.subtract(u,e._paddingBefore,LTe),e.dimensions,q0t);return e._shape.computeOrientedBoundingBoxForSample(t,e.dimensions,f,i)}Object.defineProperties(iS.prototype,{metadata:{get:function(){return this._metadata}},primitive:{get:function(){return this._primitive}},sampleIndex:{get:function(){return this._sampleIndex}},tileIndex:{get:function(){return this._tileIndex}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox.clone()}}});iS.prototype.hasProperty=function(e){return c(this._metadata[e])};iS.prototype.getNames=function(){return Object.keys(this._metadata)};iS.prototype.getProperty=function(e){return this._metadata[e]};var DA=iS;var V8i=_(T(),1);var CQi=_(T(),1);var rQi=_(T(),1);var iJi=_(T(),1),BA=`struct Ray {
vec3 pos;
vec3 dir;
vec3 rawDir;
};
#if defined(JITTER)
float hash(vec2 p)
{
vec3 p3 = fract(vec3(p.xyx) * 50.0);
p3 += dot(p3, p3.yzx + 19.19);
return fract((p3.x + p3.y) * p3.z);
}
#endif
float minComponent(in vec3 v) {
return min(min(v.x, v.y), v.z);
}
float maxComponent(in vec3 v) {
return max(max(v.x, v.y), v.z);
}
struct PointJacobianT {
vec3 point;
mat3 jacobianT;
};
`;var rJi=_(T(),1),YA=`#define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops
#if defined(PICKING_VOXEL)
#define ALPHA_ACCUM_MAX 0.1
#else
#define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0
#endif
uniform mat3 u_transformDirectionViewToLocal;
uniform vec3 u_cameraPositionUv;
uniform float u_stepSize;
#if defined(PICKING)
uniform vec4 u_pickColor;
#endif
vec3 getSampleSize(in int level) {
vec3 sampleCount = exp2(float(level)) * vec3(u_dimensions);
vec3 sampleSizeUv = 1.0 / sampleCount;
return scaleShapeUvToShapeSpace(sampleSizeUv);
}
#define MINIMUM_STEP_SCALAR (0.02)
#define SHIFT_FRACTION (0.001)
RayShapeIntersection getVoxelIntersection(in vec3 tileUv, in vec3 sampleSizeAlongRay) {
vec3 voxelCoord = tileUv * vec3(u_dimensions);
vec3 directions = sign(sampleSizeAlongRay);
vec3 positiveDirections = max(directions, 0.0);
vec3 entryCoord = mix(ceil(voxelCoord), floor(voxelCoord), positiveDirections);
vec3 exitCoord = entryCoord + directions;
vec3 distanceFromEntry = -abs((entryCoord - voxelCoord) * sampleSizeAlongRay);
float lastEntry = maxComponent(distanceFromEntry);
bvec3 isLastEntry = equal(distanceFromEntry, vec3(lastEntry));
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
vec4 entry = vec4(entryNormal, lastEntry);
vec3 distanceToExit = abs((exitCoord - voxelCoord) * sampleSizeAlongRay);
float firstExit = minComponent(distanceToExit);
bvec3 isFirstExit = equal(distanceToExit, vec3(firstExit));
vec3 exitNormal = vec3(isFirstExit) * directions;
vec4 exit = vec4(exitNormal, firstExit);
return RayShapeIntersection(entry, exit);
}
vec4 getStepSize(in SampleData sampleData, in Ray viewRay, in RayShapeIntersection shapeIntersection, in mat3 jacobianT, in float currentT) {
vec3 gradient = 2.0 * viewRay.rawDir * jacobianT;
vec3 sampleSizeAlongRay = getSampleSize(sampleData.tileCoords.w) / gradient;
RayShapeIntersection voxelIntersection = getVoxelIntersection(sampleData.tileUv, sampleSizeAlongRay);
vec3 voxelNormal = normalize(jacobianT * voxelIntersection.entry.xyz);
vec4 voxelEntry = vec4(voxelNormal, currentT + voxelIntersection.entry.w);
vec4 entry = intersectionMax(shapeIntersection.entry, voxelEntry);
float fixedStep = minComponent(abs(sampleSizeAlongRay)) * u_stepSize;
float shift = fixedStep * SHIFT_FRACTION;
float dt = voxelIntersection.exit.w + shift;
if ((currentT + dt) > shapeIntersection.exit.w) {
dt = shapeIntersection.exit.w - currentT + shift;
}
float stepSize = clamp(dt, fixedStep * MINIMUM_STEP_SCALAR, fixedStep + shift);
return vec4(entry.xyz, stepSize);
}
vec2 packIntToVec2(int value) {
float shifted = float(value) / 255.0;
float lowBits = fract(shifted);
float highBits = floor(shifted) / 255.0;
return vec2(highBits, lowBits);
}
vec2 packFloatToVec2(float value) {
float lowBits = fract(value);
float highBits = floor(value) / 255.0;
return vec2(highBits, lowBits);
}
int getSampleIndex(in SampleData sampleData) {
vec3 maxCoordinate = vec3(u_inputDimensions) - vec3(0.5);
vec3 inputCoordinate = clamp(sampleData.inputCoordinate, vec3(0.0), maxCoordinate);
ivec3 sampleIndex = ivec3(floor(inputCoordinate));
return sampleIndex.x + u_inputDimensions.x * (sampleIndex.y + u_inputDimensions.y * sampleIndex.z);
}
void main()
{
vec4 fragCoord = gl_FragCoord;
vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw;
vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz);
vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection);
vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection);
vec3 viewPosUv = u_cameraPositionUv;
#if defined(SHAPE_ELLIPSOID)
vec3 rawDir = viewDirUv * u_ellipsoidRadiiUv;
Ray viewRayUv = Ray(viewPosUv, viewDirUv, rawDir);
#else
Ray viewRayUv = Ray(viewPosUv, viewDirUv, viewDirUv);
#endif
Intersections ix;
RayShapeIntersection shapeIntersection = intersectScene(screenCoord, viewRayUv, ix);
if (shapeIntersection.entry.w == NO_HIT) {
discard;
}
float currentT = shapeIntersection.entry.w;
float endT = shapeIntersection.exit.w;
vec3 positionUv = viewPosUv + currentT * viewDirUv;
PointJacobianT pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);
TraversalData traversalData;
SampleData sampleDatas[SAMPLE_COUNT];
traverseOctreeFromBeginning(pointJacobian.point, traversalData, sampleDatas);
vec4 step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);
#if defined(JITTER)
float noise = hash(screenCoord);
currentT += noise * step.w;
positionUv += noise * step.w * viewDirUv;
#endif
FragmentInput fragmentInput;
#if defined(STATISTICS)
setStatistics(fragmentInput.metadata.statistics);
#endif
vec4 colorAccum = vec4(0.0);
for (int stepCount = 0; stepCount < STEP_COUNT_MAX; ++stepCount) {
Properties properties = accumulatePropertiesFromMegatexture(sampleDatas);
copyPropertiesToMetadata(properties, fragmentInput.metadata);
fragmentInput.voxel.positionUv = positionUv;
fragmentInput.voxel.positionShapeUv = pointJacobian.point;
fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv;
fragmentInput.voxel.viewDirUv = viewDirUv;
fragmentInput.voxel.viewDirWorld = viewDirWorld;
fragmentInput.voxel.surfaceNormal = step.xyz;
fragmentInput.voxel.travelDistance = step.w;
fragmentInput.voxel.stepCount = stepCount;
fragmentInput.voxel.tileIndex = sampleDatas[0].megatextureIndex;
fragmentInput.voxel.sampleIndex = getSampleIndex(sampleDatas[0]);
czm_modelMaterial materialOutput;
fragmentMain(fragmentInput, materialOutput);
vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha);
color.rgb = max(color.rgb, vec3(0.0));
color.a = clamp(color.a, 0.0, 1.0);
colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a);
if (colorAccum.a > ALPHA_ACCUM_MAX) {
colorAccum.a = ALPHA_ACCUM_MAX;
break;
}
if (step.w == 0.0) {
step.w == 0.00001;
}
currentT += step.w;
positionUv = viewPosUv + currentT * viewDirUv;
if (currentT > endT) {
#if (INTERSECTION_COUNT == 1)
break;
#else
shapeIntersection = nextIntersection(ix);
if (shapeIntersection.entry.w == NO_HIT) {
break;
} else {
currentT = shapeIntersection.entry.w;
endT = shapeIntersection.exit.w;
positionUv = viewPosUv + currentT * viewDirUv;
}
#endif
}
pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);
traverseOctreeFromExisting(pointJacobian.point, traversalData, sampleDatas);
step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);
}
colorAccum.a /= ALPHA_ACCUM_MAX;
#if defined(PICKING)
if (colorAccum.a == 0.0) {
discard;
}
out_FragColor = u_pickColor;
#elif defined(PICKING_VOXEL)
if (colorAccum.a == 0.0) {
discard;
}
vec2 megatextureId = packIntToVec2(sampleDatas[0].megatextureIndex);
vec2 sampleIndex = packIntToVec2(getSampleIndex(sampleDatas[0]));
out_FragColor = vec4(megatextureId, sampleIndex);
#else
out_FragColor = colorAccum;
#endif
}
`;var aJi=_(T(),1),HA=`in vec2 position;
uniform vec4 u_ndcSpaceAxisAlignedBoundingBox;
void main() {
vec2 aabbMin = u_ndcSpaceAxisAlignedBoundingBox.xy;
vec2 aabbMax = u_ndcSpaceAxisAlignedBoundingBox.zw;
vec2 translation = 0.5 * (aabbMax + aabbMin);
vec2 scale = 0.5 * (aabbMax - aabbMin);
gl_Position = vec4(position * scale + translation, 0.0, 1.0);
}
`;var lJi=_(T(),1),zA=`#define NO_HIT (-czm_infinity)
#define INF_HIT (czm_infinity * 0.5)
struct RayShapeIntersection {
vec4 entry;
vec4 exit;
};
vec4 intersectionMin(in vec4 intersect0, in vec4 intersect1)
{
if (intersect0.w == NO_HIT) {
return intersect1;
} else if (intersect1.w == NO_HIT) {
return intersect0;
}
return (intersect0.w <= intersect1.w) ? intersect0 : intersect1;
}
vec4 intersectionMax(in vec4 intersect0, in vec4 intersect1)
{
return (intersect0.w >= intersect1.w) ? intersect0 : intersect1;
}
RayShapeIntersection intersectIntersections(in Ray ray, in RayShapeIntersection intersect0, in RayShapeIntersection intersect1)
{
bool missed = (intersect0.entry.w == NO_HIT) ||
(intersect1.entry.w == NO_HIT) ||
(intersect0.exit.w < intersect1.entry.w) ||
(intersect0.entry.w > intersect1.exit.w);
if (missed) {
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
return RayShapeIntersection(miss, miss);
}
vec4 entry = intersectionMax(intersect0.entry, intersect1.entry);
vec4 exit = intersectionMin(intersect0.exit, intersect1.exit);
return RayShapeIntersection(entry, exit);
}
struct Intersections {
vec4 intersections[INTERSECTION_COUNT * 2];
#if (INTERSECTION_COUNT > 1)
int index;
int surroundCount;
bool surroundIsPositive;
#endif
};
RayShapeIntersection getFirstIntersection(in Intersections ix)
{
return RayShapeIntersection(ix.intersections[0], ix.intersections[1]);
}
vec4 encodeIntersectionType(vec4 intersection, int index, bool entry)
{
float scale = float(index > 0) * 2.0 + float(!entry) + 1.0;
return vec4(intersection.xyz * scale, intersection.w);
}
#define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = vec4(0.0, float(!positive) * 2.0 + float(!enter) + 1.0, 0.0, (t))
#define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec4(0.0, float((index) > 0) * 2.0 + 1.0, 0.0, (entryExit).x); (ix).intersections[(index) * 2 + 1] = vec4(0.0, float((index) > 0) * 2.0 + 2.0, 0.0, (entryExit).y)
#define setSurfaceIntersection(/*inout Intersections*/ ix, /*int*/ index, /*vec4*/ intersection, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = encodeIntersectionType((intersection), int(!positive), (enter))
#define setShapeIntersection(/*inout Intersections*/ ix, /*int*/ index, /*RayShapeIntersection*/ intersection) (ix).intersections[(index) * 2 + 0] = encodeIntersectionType((intersection).entry, (index), true); (ix).intersections[(index) * 2 + 1] = encodeIntersectionType((intersection).exit, (index), false)
#if (INTERSECTION_COUNT > 1)
void initializeIntersections(inout Intersections ix) {
const int sortPasses = INTERSECTION_COUNT * 2 - 1;
for (int n = sortPasses; n > 0; --n) {
for (int i = 0; i < sortPasses; ++i) {
if (i >= n) { break; }
vec4 intersect0 = ix.intersections[i + 0];
vec4 intersect1 = ix.intersections[i + 1];
bool inOrder = intersect0.w <= intersect1.w;
ix.intersections[i + 0] = inOrder ? intersect0 : intersect1;
ix.intersections[i + 1] = inOrder ? intersect1 : intersect0;
}
}
ix.index = 0;
ix.surroundCount = 0;
ix.surroundIsPositive = false;
}
#endif
#if (INTERSECTION_COUNT > 1)
RayShapeIntersection nextIntersection(inout Intersections ix) {
vec4 surfaceIntersection = vec4(0.0, 0.0, 0.0, NO_HIT);
RayShapeIntersection shapeIntersection = RayShapeIntersection(surfaceIntersection, surfaceIntersection);
const int passCount = INTERSECTION_COUNT * 2;
if (ix.index == passCount) {
return shapeIntersection;
}
for (int i = 0; i < passCount; ++i) {
if (i < ix.index) {
continue;
}
ix.index = i + 1;
surfaceIntersection = ix.intersections[i];
int intersectionType = int(length(surfaceIntersection.xyz) - 0.5);
bool currShapeIsPositive = intersectionType < 2;
bool enter = intMod(intersectionType, 2) == 0;
ix.surroundCount += enter ? +1 : -1;
ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive;
if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) {
shapeIntersection.entry = surfaceIntersection;
}
bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0;
bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive;
if (exitPositive || enterNegativeFromPositive) {
shapeIntersection.exit = surfaceIntersection;
if (exitPositive) {
ix.index = passCount;
}
break;
}
}
return shapeIntersection;
}
#endif
`;var uJi=_(T(),1),KA=`uniform mat4 u_transformPositionViewToUv;
void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));
if (logDepthOrDepth != 0.0) {
vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);
eyeCoordinateDepth /= eyeCoordinateDepth.w;
vec3 depthPositionUv = vec3(u_transformPositionViewToUv * eyeCoordinateDepth);
float t = dot(depthPositionUv - ray.pos, ray.dir);
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(t, +INF_HIT));
} else {
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT));
}
}
`;var fJi=_(T(),1),JA=`uniform sampler2D u_clippingPlanesTexture;
uniform mat4 u_clippingPlanesMatrix;
vec4 intersectPlane(in Ray ray, in vec4 plane) {
vec3 n = plane.xyz;
float w = plane.w;
float a = dot(ray.pos, n);
float b = dot(ray.dir, n);
float t = -(w + a) / b;
return vec4(n, t);
}
void intersectClippingPlanes(in Ray ray, inout Intersections ix) {
vec4 backSide = vec4(-ray.dir, -INF_HIT);
vec4 farSide = vec4(ray.dir, +INF_HIT);
RayShapeIntersection clippingVolume;
#if (CLIPPING_PLANES_COUNT == 1)
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix);
vec4 intersection = intersectPlane(ray, planeUv);
bool reflects = dot(ray.dir, intersection.xyz) < 0.0;
clippingVolume.entry = reflects ? backSide : intersection;
clippingVolume.exit = reflects ? intersection : farSide;
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);
#elif defined(CLIPPING_PLANES_UNION)
vec4 firstTransmission = vec4(ray.dir, +INF_HIT);
vec4 lastReflection = vec4(-ray.dir, -INF_HIT);
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
vec4 intersection = intersectPlane(ray, planeUv);
if (dot(ray.dir, planeUv.xyz) > 0.0) {
firstTransmission = intersection.w <= firstTransmission.w ? intersection : firstTransmission;
} else {
lastReflection = intersection.w >= lastReflection.w ? intersection : lastReflection;
}
}
clippingVolume.entry = backSide;
clippingVolume.exit = lastReflection;
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, clippingVolume);
clippingVolume.entry = firstTransmission;
clippingVolume.exit = farSide;
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, clippingVolume);
#else // intersection
vec4 lastTransmission = vec4(ray.dir, -INF_HIT);
vec4 firstReflection = vec4(-ray.dir, +INF_HIT);
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
vec4 intersection = intersectPlane(ray, planeUv);
if (dot(ray.dir, planeUv.xyz) > 0.0) {
lastTransmission = intersection.w > lastTransmission.w ? intersection : lastTransmission;
} else {
firstReflection = intersection.w < firstReflection.w ? intersection: firstReflection;
}
}
if (lastTransmission.w < firstReflection.w) {
clippingVolume.entry = lastTransmission;
clippingVolume.exit = firstReflection;
} else {
clippingVolume.entry = vec4(-ray.dir, NO_HIT);
clippingVolume.exit = vec4(ray.dir, NO_HIT);
}
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);
#endif
}
`;var pJi=_(T(),1),xL=`vec4 intersectLongitude(in Ray ray, in float angle, in bool positiveNormal) {
float normalSign = positiveNormal ? 1.0 : -1.0;
vec2 planeNormal = vec2(-sin(angle), cos(angle)) * normalSign;
vec2 position = ray.pos.xy;
vec2 direction = ray.dir.xy;
float approachRate = dot(direction, planeNormal);
float distance = -dot(position, planeNormal);
float t = (approachRate == 0.0)
? NO_HIT
: distance / approachRate;
return vec4(planeNormal, 0.0, t);
}
RayShapeIntersection intersectHalfSpace(in Ray ray, in float angle, in bool positiveNormal)
{
vec4 intersection = intersectLongitude(ray, angle, positiveNormal);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
bool hitFront = (intersection.w > 0.0) == (dot(ray.pos.xy, intersection.xy) > 0.0);
if (!hitFront) {
return RayShapeIntersection(intersection, farSide);
} else {
return RayShapeIntersection(-1.0 * farSide, intersection);
}
}
void intersectFlippedWedge(in Ray ray, in vec2 minMaxAngle, out RayShapeIntersection intersections[2])
{
intersections[0] = intersectHalfSpace(ray, minMaxAngle.x, false);
intersections[1] = intersectHalfSpace(ray, minMaxAngle.y, true);
}
bool hitPositiveHalfPlane(in Ray ray, in vec4 intersection, in bool positiveNormal) {
float normalSign = positiveNormal ? 1.0 : -1.0;
vec2 planeDirection = vec2(intersection.y, -intersection.x) * normalSign;
vec2 hit = ray.pos.xy + intersection.w * ray.dir.xy;
return dot(hit, planeDirection) > 0.0;
}
void intersectHalfPlane(in Ray ray, in float angle, out RayShapeIntersection intersections[2]) {
vec4 intersection = intersectLongitude(ray, angle, true);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
if (hitPositiveHalfPlane(ray, intersection, true)) {
intersections[0].entry = -1.0 * farSide;
intersections[0].exit = vec4(-1.0 * intersection.xy, 0.0, intersection.w);
intersections[1].entry = intersection;
intersections[1].exit = farSide;
} else {
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
intersections[0].entry = -1.0 * farSide;
intersections[0].exit = farSide;
intersections[1].entry = miss;
intersections[1].exit = miss;
}
}
RayShapeIntersection intersectRegularWedge(in Ray ray, in vec2 minMaxAngle)
{
vec4 intersect1 = intersectLongitude(ray, minMaxAngle.x, false);
vec4 intersect2 = intersectLongitude(ray, minMaxAngle.y, true);
bool inOrder = intersect1.w <= intersect2.w;
vec4 first = inOrder ? intersect1 : intersect2;
vec4 last = inOrder ? intersect2 : intersect1;
bool firstIsAhead = first.w >= 0.0;
bool startedInsideFirst = dot(ray.pos.xy, first.xy) < 0.0;
bool exitFromInside = firstIsAhead == startedInsideFirst;
bool lastIsAhead = last.w > 0.0;
bool startedOutsideLast = dot(ray.pos.xy, last.xy) >= 0.0;
bool enterFromOutside = lastIsAhead == startedOutsideLast;
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
if (exitFromInside && enterFromOutside) {
return RayShapeIntersection(first, last);
} else if (!exitFromInside && enterFromOutside) {
return RayShapeIntersection(-1.0 * farSide, first);
} else if (exitFromInside && !enterFromOutside) {
return RayShapeIntersection(last, farSide);
} else {
return RayShapeIntersection(miss, miss);
}
}
`;var yJi=_(T(),1),QA=`uniform vec3 u_renderMinBounds;
uniform vec3 u_renderMaxBounds;
RayShapeIntersection intersectBox(in Ray ray, in vec3 minBound, in vec3 maxBound)
{
vec3 t0 = (minBound - ray.pos) / ray.dir;
vec3 t1 = (maxBound - ray.pos) / ray.dir;
vec3 entries = min(t0, t1);
vec3 exits = max(t0, t1);
vec3 directions = sign(ray.dir);
float lastEntry = maxComponent(entries);
bvec3 isLastEntry = equal(entries, vec3(lastEntry));
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
vec4 entry = vec4(entryNormal, lastEntry);
float firstExit = minComponent(exits);
bvec3 isFirstExit = equal(exits, vec3(firstExit));
vec3 exitNormal = vec3(isLastEntry) * directions;
vec4 exit = vec4(exitNormal, firstExit);
if (entry.w > exit.w) {
entry.w = NO_HIT;
exit.w = NO_HIT;
}
return RayShapeIntersection(entry, exit);
}
void intersectShape(in Ray ray, inout Intersections ix)
{
RayShapeIntersection intersection = intersectBox(ray, u_renderMinBounds, u_renderMaxBounds);
setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection);
}
`;var xJi=_(T(),1),jA=`uniform vec2 u_cylinderRenderRadiusMinMax;
uniform vec2 u_cylinderRenderHeightMinMax;
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)
uniform vec2 u_cylinderRenderAngleMinMax;
#endif
RayShapeIntersection intersectHeightBounds(in Ray ray, in vec2 minMaxHeight, in bool convex)
{
float zPosition = ray.pos.z;
float zDirection = ray.dir.z;
float tmin = (minMaxHeight.x - zPosition) / zDirection;
float tmax = (minMaxHeight.y - zPosition) / zDirection;
float signFlip = convex ? 1.0 : -1.0;
vec4 intersectMin = vec4(0.0, 0.0, -1.0 * signFlip, tmin);
vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax);
bool topEntry = zDirection < 0.0;
vec4 entry = topEntry ? intersectMax : intersectMin;
vec4 exit = topEntry ? intersectMin : intersectMax;
return RayShapeIntersection(entry, exit);
}
RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool convex)
{
vec2 position = ray.pos.xy;
vec2 direction = ray.dir.xy;
float a = dot(direction, direction);
float b = dot(position, direction);
float c = dot(position, position) - radius * radius;
float determinant = b * b - a * c;
if (determinant < 0.0) {
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
return RayShapeIntersection(miss, miss);
}
determinant = sqrt(determinant);
float t1 = (-b - determinant) / a;
float t2 = (-b + determinant) / a;
float signFlip = convex ? 1.0 : -1.0;
vec4 intersect1 = vec4(normalize(position + t1 * direction) * signFlip, 0.0, t1);
vec4 intersect2 = vec4(normalize(position + t2 * direction) * signFlip, 0.0, t2);
return RayShapeIntersection(intersect1, intersect2);
}
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in float radius, in vec2 minMaxHeight)
{
RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true);
RayShapeIntersection heightBoundsIntersection = intersectHeightBounds(ray, minMaxHeight, true);
return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection);
}
void intersectShape(Ray ray, inout Intersections ix)
{
ray.pos = ray.pos * 2.0 - 1.0;
ray.dir *= 2.0;
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);
if (outerIntersect.entry.w == NO_HIT) {
return;
}
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
RayShapeIntersection innerIntersect = intersectCylinder(ray, 1.0, false);
setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true);
setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true);
setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false);
setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false);
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN)
RayShapeIntersection innerIntersect = intersectCylinder(ray, u_cylinderRenderRadiusMinMax.x, false);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect);
#endif
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF)
RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF)
RayShapeIntersection wedgeIntersects[2];
intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax, wedgeIntersects);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
RayShapeIntersection wedgeIntersects[2];
intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x, wedgeIntersects);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);
#endif
}
`;var TJi=_(T(),1),qA=`#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)
uniform vec2 u_ellipsoidRenderLongitudeMinMax;
#endif
uniform float u_eccentricitySquared;
uniform vec2 u_ellipsoidRenderLatitudeSinMinMax;
uniform vec2 u_clipMinMaxHeight;
RayShapeIntersection intersectZPlane(in Ray ray, in float z) {
float t = -ray.pos.z / ray.dir.z;
bool startsOutside = sign(ray.pos.z) == sign(z);
bool entry = (t >= 0.0) != startsOutside;
vec4 intersect = vec4(0.0, 0.0, z, t);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
if (entry) {
return RayShapeIntersection(intersect, farSide);
} else {
return RayShapeIntersection(-1.0 * farSide, intersect);
}
}
RayShapeIntersection intersectHeight(in Ray ray, in float relativeHeight, in bool convex)
{
vec3 radiiCorrection = u_ellipsoidRadiiUv / (u_ellipsoidRadiiUv + relativeHeight);
vec3 position = ray.pos * radiiCorrection;
vec3 direction = ray.dir * radiiCorrection;
float a = dot(direction, direction);
float b = dot(direction, position);
float c = dot(position, position) - 1.0;
float determinant = b * b - a * c;
if (determinant < 0.0) {
vec4 miss = vec4(normalize(direction), NO_HIT);
return RayShapeIntersection(miss, miss);
}
determinant = sqrt(determinant);
float signB = b < 0.0 ? -1.0 : 1.0;
float t1 = (-b - signB * determinant) / a;
float t2 = c / (a * t1);
float tmin = min(t1, t2);
float tmax = max(t1, t2);
float directionScale = convex ? 1.0 : -1.0;
vec3 d1 = directionScale * normalize(position + tmin * direction);
vec3 d2 = directionScale * normalize(position + tmax * direction);
return RayShapeIntersection(vec4(d1, tmin), vec4(d2, tmax));
}
vec2 intersectDoubleEndedCone(in Ray ray, in float cosSqrHalfAngle)
{
vec3 o = ray.pos;
vec3 d = ray.dir;
float sinSqrHalfAngle = 1.0 - cosSqrHalfAngle;
float aSin = d.z * d.z * sinSqrHalfAngle;
float aCos = -dot(d.xy, d.xy) * cosSqrHalfAngle;
float a = aSin + aCos;
float bSin = d.z * o.z * sinSqrHalfAngle;
float bCos = -dot(o.xy, d.xy) * cosSqrHalfAngle;
float b = bSin + bCos;
float cSin = o.z * o.z * sinSqrHalfAngle;
float cCos = -dot(o.xy, o.xy) * cosSqrHalfAngle;
float c = cSin + cCos;
float determinant = 2.0 * bSin * bCos + bCos * bCos - aSin * cCos - aCos * cSin - aCos * cCos;
if (determinant < 0.0) {
return vec2(NO_HIT);
} else if (a == 0.0) {
return (b == 0.0)
? vec2(NO_HIT)
: vec2(-0.5 * c / b, NO_HIT);
}
determinant = sqrt(determinant);
float signB = b < 0.0 ? -1.0 : 1.0;
float t1 = (-b - signB * determinant) / a;
float t2 = c / (a * t1);
float tmin = min(t1, t2);
float tmax = max(t1, t2);
return vec2(tmin, tmax);
}
vec3 getConeNormal(in vec3 p, in bool convex) {
vec2 radial = -abs(p.z) * normalize(p.xy);
float zSign = (p.z < 0.0) ? -1.0 : 1.0;
float z = length(p.xy) * zSign;
float flip = (convex) ? -1.0 : 1.0;
return normalize(vec3(radial, z) * flip);
}
float getLatitudeConeShift(in float sinLatitude) {
float x2 = u_eccentricitySquared * sinLatitude * sinLatitude;
float primeVerticalRadius = inversesqrt(1.0 - x2);
return primeVerticalRadius * u_eccentricitySquared * sinLatitude;
}
void intersectFlippedCone(in Ray ray, in float cosHalfAngle, out RayShapeIntersection intersections[2]) {
ray.pos = ray.pos * u_ellipsoidRadiiUv;
ray.dir = ray.dir * u_ellipsoidRadiiUv;
ray.pos.z += getLatitudeConeShift(cosHalfAngle);
float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
intersections[0].entry = -1.0 * farSide;
intersections[0].exit = farSide;
intersections[1].entry = miss;
intersections[1].exit = miss;
if (intersect.x == NO_HIT) {
return;
}
float tmin = intersect.x;
float tmax = intersect.y;
vec3 p0 = ray.pos + tmin * ray.dir;
vec3 p1 = ray.pos + tmax * ray.dir;
vec4 intersect0 = vec4(getConeNormal(p0, true), tmin);
vec4 intersect1 = vec4(getConeNormal(p1, true), tmax);
bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
if (p0InShadowCone && p1InShadowCone) {
} else if (p0InShadowCone) {
intersections[0].exit = intersect1;
} else if (p1InShadowCone) {
intersections[0].entry = intersect0;
} else {
intersections[0].exit = intersect0;
intersections[1].entry = intersect1;
intersections[1].exit = farSide;
}
}
RayShapeIntersection intersectRegularCone(in Ray ray, in float cosHalfAngle, in bool convex) {
ray.pos = ray.pos * u_ellipsoidRadiiUv;
ray.dir = ray.dir * u_ellipsoidRadiiUv;
ray.pos.z += getLatitudeConeShift(cosHalfAngle);
float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
if (intersect.x == NO_HIT) {
return RayShapeIntersection(miss, miss);
}
float tmin = intersect.x;
float tmax = intersect.y;
vec3 p0 = ray.pos + tmin * ray.dir;
vec3 p1 = ray.pos + tmax * ray.dir;
vec4 intersect0 = vec4(getConeNormal(p0, convex), tmin);
vec4 intersect1 = vec4(getConeNormal(p1, convex), tmax);
bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
if (p0InShadowCone && p1InShadowCone) {
return RayShapeIntersection(miss, miss);
} else if (p0InShadowCone) {
return RayShapeIntersection(intersect1, farSide);
} else if (p1InShadowCone) {
return RayShapeIntersection(-1.0 * farSide, intersect0);
} else {
return RayShapeIntersection(intersect0, intersect1);
}
}
void intersectShape(in Ray ray, inout Intersections ix) {
ray.pos = ray.pos * 2.0 - 1.0;
ray.dir *= 2.0;
RayShapeIntersection outerIntersect = intersectHeight(ray, u_clipMinMaxHeight.y, true);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);
if (outerIntersect.entry.w == NO_HIT) {
return;
}
RayShapeIntersection innerIntersect = intersectHeight(ray, u_clipMinMaxHeight.x, false);
if (innerIntersect.entry.w == NO_HIT) {
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
} else {
innerIntersect.entry.w = max(innerIntersect.entry.w, outerIntersect.entry.w);
innerIntersect.exit.w = min(innerIntersect.exit.w, outerIntersect.exit.w);
setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true);
setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true);
setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false);
setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false);
}
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)
RayShapeIntersection bottomConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, false);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)
RayShapeIntersection bottomConeIntersection = intersectZPlane(ray, -1.0);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)
RayShapeIntersection bottomConeIntersections[2];
intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, bottomConeIntersections);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersections[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersections[1]);
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
RayShapeIntersection topConeIntersections[2];
intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, topConeIntersections);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersections[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersections[1]);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)
RayShapeIntersection topConeIntersection = intersectZPlane(ray, 1.0);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
RayShapeIntersection topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, false);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
RayShapeIntersection wedgeIntersects[2];
intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x, wedgeIntersects);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)
RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)
RayShapeIntersection wedgeIntersects[2];
intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax, wedgeIntersects);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
#endif
}
`;var CJi=_(T(),1),oS=`RayShapeIntersection intersectScene(in vec2 screenCoord, in Ray ray, out Intersections ix) {
intersectShape(ray, ix);
RayShapeIntersection intersection = getFirstIntersection(ix);
if (intersection.entry.w == NO_HIT) {
return intersection;
}
#if defined(CLIPPING_PLANES)
intersectClippingPlanes(ray, ix);
#endif
#if defined(DEPTH_TEST)
intersectDepth(screenCoord, ray, ix);
#endif
#if (INTERSECTION_COUNT > 1)
initializeIntersections(ix);
for (int i = 0; i < INTERSECTION_COUNT; ++i) {
intersection = nextIntersection(ix);
if (intersection.exit.w > 0.0) {
intersection.entry.w = max(intersection.entry.w, 0.0);
break;
}
}
#else
intersection.entry.w = max(intersection.entry.w, 0.0);
#endif
return intersection;
}
`;var LJi=_(T(),1),$A=`#if defined(BOX_HAS_SHAPE_BOUNDS)
uniform vec3 u_boxUvToShapeUvScale;
uniform vec3 u_boxUvToShapeUvTranslate;
#endif
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
return PointJacobianT(positionUv, mat3(0.5));
}
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
#if defined(BOX_HAS_SHAPE_BOUNDS)
return positionShape * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate;
#else
return positionShape;
#endif
}
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
return pointJacobian;
}
vec3 convertShapeUvToUvSpace(in vec3 shapeUv) {
#if defined(BOX_HAS_SHAPE_BOUNDS)
return (shapeUv - u_boxUvToShapeUvTranslate) / u_boxUvToShapeUvScale;
#else
return shapeUv;
#endif
}
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
#if defined(BOX_HAS_SHAPE_BOUNDS)
return shapeUv / u_boxUvToShapeUvScale;
#else
return shapeUv;
#endif
}
`;var RJi=_(T(),1),e9=`#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
uniform vec2 u_cylinderUvToShapeUvRadius;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
uniform vec2 u_cylinderUvToShapeUvHeight;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
uniform vec2 u_cylinderUvToShapeUvAngle;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
uniform vec2 u_cylinderShapeUvAngleMinMax;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
uniform float u_cylinderShapeUvAngleRangeZeroMid;
#endif
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
vec3 position = positionUv * 2.0 - 1.0;
float radius = length(position.xy);
vec3 radial = normalize(vec3(position.xy, 0.0));
float height = positionUv.z;
vec3 z = vec3(0.0, 0.0, 1.0);
float angle = atan(position.y, position.x);
vec3 east = normalize(vec3(-position.y, position.x, 0.0));
vec3 point = vec3(radius, angle, height);
mat3 jacobianT = mat3(radial, z, east / length(position.xy));
return PointJacobianT(point, jacobianT);
}
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
float radius = positionShape.x;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y;
#endif
float angle = (positionShape.y + czm_pi) / czm_twoPi;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid);
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY)
angle = angle > u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.x : angle;
#elif defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
angle = angle < u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.y : angle;
#endif
angle = angle * u_cylinderUvToShapeUvAngle.x + u_cylinderUvToShapeUvAngle.y;
#endif
float height = positionShape.z;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y;
#endif
return vec3(radius, angle, height);
}
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
return pointJacobian;
}
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
float radius = shapeUv.x;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
radius /= u_cylinderUvToShapeUvRadius.x;
#endif
float angle = shapeUv.y * czm_twoPi;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
angle /= u_cylinderUvToShapeUvAngle.x;
#endif
float height = shapeUv.z;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
height /= u_cylinderUvToShapeUvHeight.x;
#endif
return vec3(radius, angle, height);
}
`;var EJi=_(T(),1),t9=`uniform vec3 u_ellipsoidRadiiUv;
uniform vec2 u_evoluteScale;
uniform vec3 u_ellipsoidInverseRadiiSquaredUv;
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) || defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
uniform vec3 u_ellipsoidShapeUvLongitudeMinMaxMid;
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
uniform vec2 u_ellipsoidUvToShapeUvLongitude;
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
uniform vec2 u_ellipsoidUvToShapeUvLatitude;
#endif
uniform float u_ellipsoidInverseHeightDifferenceUv;
vec3 nearestPointAndRadiusOnEllipse(vec2 pos, vec2 radii) {
vec2 p = abs(pos);
vec2 inverseRadii = 1.0 / radii;
vec2 tTrigs = vec2(0.7071067811865476);
vec2 v = radii * tTrigs;
vec2 evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;
const int iterations = 3;
for (int i = 0; i < iterations; ++i) {
vec2 q = normalize(p - evolute) * length(v - evolute);
tTrigs = (q + evolute) * inverseRadii;
tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));
v = radii * tTrigs;
evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;
}
return vec3(v * sign(pos), length(v - evolute));
}
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
vec3 position = positionUv * 2.0 - 1.0;
position = position * u_ellipsoidRadiiUv;
float longitude = atan(position.y, position.x);
vec3 east = normalize(vec3(-position.y, position.x, 0.0));
float distanceFromZAxis = length(position.xy);
vec2 posEllipse = vec2(distanceFromZAxis, position.z);
vec3 surfacePointAndRadius = nearestPointAndRadiusOnEllipse(posEllipse, u_ellipsoidRadiiUv.xz);
vec2 surfacePoint = surfacePointAndRadius.xy;
vec2 normal2d = normalize(surfacePoint * u_ellipsoidInverseRadiiSquaredUv.xz);
float latitude = atan(normal2d.y, normal2d.x);
vec3 north = vec3(-normal2d.y * normalize(position.xy), abs(normal2d.x));
float heightSign = length(posEllipse) < length(surfacePoint) ? -1.0 : 1.0;
float height = heightSign * length(posEllipse - surfacePoint);
vec3 up = normalize(cross(east, north));
vec3 point = vec3(longitude, latitude, height);
mat3 jacobianT = mat3(east / distanceFromZAxis, north / (surfacePointAndRadius.z + height), up);
return PointJacobianT(point, jacobianT);
}
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
float longitude = (positionShape.x + czm_pi) / czm_twoPi;
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z);
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY)
longitude = longitude > u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.x : longitude;
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY)
longitude = longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.y : longitude;
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
longitude = longitude * u_ellipsoidUvToShapeUvLongitude.x + u_ellipsoidUvToShapeUvLongitude.y;
#endif
float latitude = (positionShape.y + czm_piOverTwo) / czm_pi;
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y;
#endif
float height = 1.0 + positionShape.z * u_ellipsoidInverseHeightDifferenceUv;
return vec3(longitude, latitude, height);
}
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
return pointJacobian;
}
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
float longitude = shapeUv.x * czm_twoPi;
#if defined (ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
longitude /= u_ellipsoidUvToShapeUvLongitude.x;
#endif
float latitude = shapeUv.y * czm_pi;
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
latitude /= u_ellipsoidUvToShapeUvLatitude.x;
#endif
float height = shapeUv.z / u_ellipsoidInverseHeightDifferenceUv;
return vec3(longitude, latitude, height);
}
`;var IJi=_(T(),1),n9=`#define OCTREE_FLAG_INTERNAL 0
#define OCTREE_FLAG_LEAF 1
#define OCTREE_FLAG_PACKED_LEAF_FROM_PARENT 2
#define OCTREE_MAX_LEVELS 32 // Harcoded value because GLSL doesn't like variable length loops
uniform sampler2D u_octreeInternalNodeTexture;
uniform vec2 u_octreeInternalNodeTexelSizeUv;
uniform int u_octreeInternalNodeTilesPerRow;
#if (SAMPLE_COUNT > 1)
uniform sampler2D u_octreeLeafNodeTexture;
uniform vec2 u_octreeLeafNodeTexelSizeUv;
uniform int u_octreeLeafNodeTilesPerRow;
#endif
uniform ivec3 u_dimensions;
uniform ivec3 u_inputDimensions;
#if defined(PADDING)
uniform ivec3 u_paddingBefore;
#endif
struct OctreeNodeData {
int data;
int flag;
};
struct TraversalData {
ivec4 octreeCoords;
int parentOctreeIndex;
};
struct SampleData {
int megatextureIndex;
ivec4 tileCoords;
vec3 tileUv;
vec3 inputCoordinate;
#if (SAMPLE_COUNT > 1)
float weight;
#endif
};
int intMod(in int a, in int b) {
return a - (b * (a / b));
}
int normU8_toInt(in float value) {
return int(value * 255.0);
}
int normU8x2_toInt(in vec2 value) {
return int(value.x * 255.0) + 256 * int(value.y * 255.0);
}
float normU8x2_toFloat(in vec2 value) {
return float(normU8x2_toInt(value)) / 65535.0;
}
OctreeNodeData getOctreeNodeData(in vec2 octreeUv) {
vec4 texData = texture(u_octreeInternalNodeTexture, octreeUv);
OctreeNodeData data;
data.data = normU8x2_toInt(texData.xy);
data.flag = normU8x2_toInt(texData.zw);
return data;
}
OctreeNodeData getOctreeChildData(in int parentOctreeIndex, in ivec3 childCoord) {
int childIndex = childCoord.z * 4 + childCoord.y * 2 + childCoord.x;
int octreeCoordX = intMod(parentOctreeIndex, u_octreeInternalNodeTilesPerRow) * 9 + 1 + childIndex;
int octreeCoordY = parentOctreeIndex / u_octreeInternalNodeTilesPerRow;
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
return getOctreeNodeData(octreeUv);
}
int getOctreeParentIndex(in int octreeIndex) {
int octreeCoordX = intMod(octreeIndex, u_octreeInternalNodeTilesPerRow) * 9;
int octreeCoordY = octreeIndex / u_octreeInternalNodeTilesPerRow;
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
vec4 parentData = texture(u_octreeInternalNodeTexture, octreeUv);
int parentOctreeIndex = normU8x2_toInt(parentData.xy);
return parentOctreeIndex;
}
vec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
float dimAtLevel = exp2(float(octreeCoords.w));
return shapePosition * dimAtLevel - vec3(octreeCoords.xyz);
}
vec3 getClampedTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
return clamp(tileUv, vec3(0.0), vec3(1.0));
}
void addSampleCoordinates(in vec3 shapePosition, inout SampleData sampleData) {
vec3 tileUv = getClampedTileUv(shapePosition, sampleData.tileCoords);
vec3 inputCoordinate = tileUv * vec3(u_dimensions);
#if defined(PADDING)
inputCoordinate += vec3(u_paddingBefore);
#endif
#if defined(Y_UP_METADATA_ORDER)
#if defined(SHAPE_BOX)
float inputY = inputCoordinate.y;
inputCoordinate.y = float(u_inputDimensions.y) - inputCoordinate.z;
inputCoordinate.z = inputY;
#elif defined(SHAPE_CYLINDER)
float angle = inputCoordinate.y;
float height = inputCoordinate.z;
#if (!defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE))
if (sampleData.tileCoords.w == 0) {
float angleCount = float(u_inputDimensions.z);
angle = mod(angle + angleCount / 2.0, angleCount);
}
#endif
inputCoordinate.y = height;
inputCoordinate.z = angle;
#endif
#endif
sampleData.tileUv = tileUv;
sampleData.inputCoordinate = inputCoordinate;
}
void getOctreeLeafSampleData(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleData) {
sampleData.megatextureIndex = data.data;
sampleData.tileCoords = (data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT)
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
: octreeCoords;
}
#if (SAMPLE_COUNT > 1)
void getOctreeLeafSampleDatas(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleDatas[SAMPLE_COUNT]) {
int leafIndex = data.data;
int leafNodeTexelCount = 2;
float leafCoordXStart = float(intMod(leafIndex, u_octreeLeafNodeTilesPerRow) * leafNodeTexelCount) + 0.5;
float leafCoordY = float(leafIndex / u_octreeLeafNodeTilesPerRow) + 0.5;
vec2 leafUv0 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 0.0, leafCoordY);
vec4 leafData0 = texture(u_octreeLeafNodeTexture, leafUv0);
float lerp = normU8x2_toFloat(leafData0.xy);
sampleDatas[0].weight = 1.0 - lerp;
sampleDatas[1].weight = lerp;
sampleDatas[0].tileCoords = (normU8_toInt(leafData0.z) == 1)
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
: octreeCoords;
sampleDatas[1].tileCoords = (normU8_toInt(leafData0.w) == 1)
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
: octreeCoords;
vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY);
vec4 leafData1 = texture(u_octreeLeafNodeTexture, leafUv1);
sampleDatas[0].megatextureIndex = normU8x2_toInt(leafData1.xy);
sampleDatas[1].megatextureIndex = normU8x2_toInt(leafData1.zw);
}
#endif
OctreeNodeData traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData) {
float sizeAtLevel = exp2(-1.0 * float(traversalData.octreeCoords.w));
vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel;
vec3 end = start + vec3(sizeAtLevel);
OctreeNodeData childData;
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
vec3 center = 0.5 * (start + end);
vec3 childCoord = step(center, shapePosition);
ivec4 octreeCoords = traversalData.octreeCoords;
traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1);
childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord));
if (childData.flag != OCTREE_FLAG_INTERNAL) {
break;
}
start = mix(start, center, childCoord);
end = mix(center, end, childCoord);
traversalData.parentOctreeIndex = childData.data;
}
return childData;
}
void traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
traversalData.octreeCoords = ivec4(0);
traversalData.parentOctreeIndex = 0;
OctreeNodeData nodeData = getOctreeNodeData(vec2(0.0));
if (nodeData.flag != OCTREE_FLAG_LEAF) {
nodeData = traverseOctreeDownwards(shapePosition, traversalData);
}
#if (SAMPLE_COUNT == 1)
getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[0]);
#else
getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);
addSampleCoordinates(shapePosition, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[1]);
#endif
}
bool inRange(in vec3 v, in vec3 minVal, in vec3 maxVal) {
return clamp(v, minVal, maxVal) == v;
}
bool insideTile(in vec3 shapePosition, in ivec4 octreeCoords) {
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
bool inside = inRange(tileUv, vec3(0.0), vec3(1.0));
return inside || octreeCoords.w == 0;
}
void traverseOctreeFromExisting(in vec3 shapePosition, inout TraversalData traversalData, inout SampleData sampleDatas[SAMPLE_COUNT]) {
if (insideTile(shapePosition, traversalData.octreeCoords)) {
for (int i = 0; i < SAMPLE_COUNT; i++) {
addSampleCoordinates(shapePosition, sampleDatas[i]);
}
return;
}
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
traversalData.octreeCoords.xyz /= 2;
traversalData.octreeCoords.w -= 1;
if (insideTile(shapePosition, traversalData.octreeCoords)) {
break;
}
traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex);
}
OctreeNodeData nodeData = traverseOctreeDownwards(shapePosition, traversalData);
#if (SAMPLE_COUNT == 1)
getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[0]);
#else
getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);
addSampleCoordinates(shapePosition, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[1]);
#endif
}
`;var wJi=_(T(),1),i9=`uniform ivec2 u_megatextureSliceDimensions;
uniform ivec2 u_megatextureTileDimensions;
uniform vec2 u_megatextureVoxelSizeUv;
uniform vec2 u_megatextureSliceSizeUv;
uniform vec2 u_megatextureTileSizeUv;
int intMin(int a, int b) {
return a <= b ? a : b;
}
int intMax(int a, int b) {
return a >= b ? a : b;
}
int intClamp(int v, int minVal, int maxVal) {
return intMin(intMax(v, minVal), maxVal);
}
vec2 index1DTo2DTexcoord(int index, ivec2 dimensions, vec2 uvScale)
{
int indexX = intMod(index, dimensions.x);
int indexY = index / dimensions.x;
return vec2(indexX, indexY) * uvScale;
}
Properties getPropertiesFromMegatexture(in SampleData sampleData) {
int tileIndex = sampleData.megatextureIndex;
vec3 voxelCoord = sampleData.inputCoordinate;
#if defined(NEAREST_SAMPLING)
voxelCoord = floor(voxelCoord) + vec3(0.5);
#endif
vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv);
float slice = voxelCoord.z - 0.5;
int sliceIndex = int(floor(slice));
int sliceIndex0 = intClamp(sliceIndex, 0, u_inputDimensions.z - 1);
vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(u_inputDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv;
vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset;
#if defined(NEAREST_SAMPLING)
return getPropertiesFromMegatextureAtUv(uv0);
#else
float sliceLerp = fract(slice);
int sliceIndex1 = intMin(sliceIndex + 1, u_inputDimensions.z - 1);
vec2 sliceUvOffset1 = index1DTo2DTexcoord(sliceIndex1, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
vec2 uv1 = tileUvOffset + sliceUvOffset1 + voxelUvOffset;
Properties properties0 = getPropertiesFromMegatextureAtUv(uv0);
Properties properties1 = getPropertiesFromMegatextureAtUv(uv1);
return mixProperties(properties0, properties1, sliceLerp);
#endif
}
Properties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) {
#if (SAMPLE_COUNT == 1)
return getPropertiesFromMegatexture(sampleDatas[0]);
#else
Properties properties = clearProperties();
for (int i = 0; i < SAMPLE_COUNT; ++i) {
float weight = sampleDatas[i].weight;
if (weight > 0.0) {
Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]);
tempProperties = scaleProperties(tempProperties, weight);
properties = sumProperties(properties, tempProperties);
}
}
return properties;
#endif
}
`;var vJi=_(T(),1),eyt={Z_UP:0,Y_UP:1},gm=Object.freeze(eyt);function tyt(e){let t=new Lx;this.shaderBuilder=t;let n=e._customShader,i=St(e._uniformMap,n.uniformMap);e._uniformMap=i;let o=n.uniforms;for(let p in o)if(o.hasOwnProperty(p)){let y=o[p];t.addUniform(y.type,p,xe.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",xe.FRAGMENT),this.uniformMap=i;let r=e._clippingPlanes,s=c(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([HA]),e.provider.metadataOrder===gm.Y_UP&&t.addDefine("Y_UP_METADATA_ORDER",void 0,xe.FRAGMENT);let a=e._provider.shape;a==="BOX"?t.addDefine("SHAPE_BOX",void 0,xe.FRAGMENT):a==="CYLINDER"?t.addDefine("SHAPE_CYLINDER",void 0,xe.FRAGMENT):a==="ELLIPSOID"&&t.addDefine("SHAPE_ELLIPSOID",void 0,xe.FRAGMENT),t.addFragmentLines([n.fragmentShaderText,"#line 0",n9,BA,zA,i9]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,xe.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,xe.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,xe.FRAGMENT),t.addFragmentLines([JA])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,xe.FRAGMENT),t.addFragmentLines([KA])),a==="BOX"?t.addFragmentLines([$A,QA,oS]):a==="CYLINDER"?t.addFragmentLines([e9,xL,jA,oS]):a==="ELLIPSOID"&&t.addFragmentLines([t9,xL,qA,oS]),t.addFragmentLines([YA]);let l=e._shape,d=l.shaderDefines;for(let p in d)if(d.hasOwnProperty(p)){let y=d[p];c(y)&&(y=y===!0?void 0:y,t.addDefine(p,y,xe.FRAGMENT))}let u=l.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",u,xe.FRAGMENT),s===1?u+=1:r.unionClippingRegions?u+=2:u+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",u,xe.FRAGMENT),u+=1),t.addDefine("INTERSECTION_COUNT",u,xe.FRAGMENT),(!m.equals(e.paddingBefore,m.ZERO)||!m.equals(e.paddingAfter,m.ZERO))&&t.addDefine("PADDING",void 0,xe.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,xe.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,xe.FRAGMENT);let f=e._traversal;t.addDefine("SAMPLE_COUNT",`${f._sampleCount}`,xe.FRAGMENT)}var o9=tyt;var dQi=_(T(),1);function nyt(e,t){let{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,l=o.length,d=c(s)&&c(a);n.addDefine("METADATA_COUNT",l,xe.FRAGMENT),d&&n.addDefine("STATISTICS",void 0,xe.FRAGMENT);for(let P=0;P<l;P++){let F=i[P],N=o[P],b=`PropertyStatistics_${F}`,G=`PropertyStatistics_${F}`;n.addStruct(b,G,xe.FRAGMENT);let X=YD(N);n.addStructField(b,X,"min"),n.addStructField(b,X,"max")}let u="Statistics",f="Statistics",p="statistics";n.addStruct(u,f,xe.FRAGMENT);for(let P=0;P<l;P++){let F=i[P],N=`PropertyStatistics_${F}`,b=F;n.addStructField(u,N,b)}let y="Metadata",h="Metadata",g="metadata";n.addStruct(y,h,xe.FRAGMENT),n.addStructField(y,f,p);for(let P=0;P<l;P++){let F=i[P],N=o[P],b=YD(N);n.addStructField(y,b,F)}for(let P=0;P<l;P++){let F=i[P],N=o[P],b=oyt(N),G=`VoxelProperty_${F}`,X=`VoxelProperty_${F}`;n.addStruct(G,X,xe.FRAGMENT),n.addStructField(G,b,"partialDerivativeLocal"),n.addStructField(G,b,"partialDerivativeWorld"),n.addStructField(G,b,"partialDerivativeView"),n.addStructField(G,b,"partialDerivativeValid")}let x="Voxel",S="Voxel",V="voxel";n.addStruct(x,S,xe.FRAGMENT);for(let P=0;P<l;P++){let F=i[P],N=`VoxelProperty_${F}`;n.addStructField(x,N,F)}n.addStructField(x,"vec3","positionEC"),n.addStructField(x,"vec3","positionUv"),n.addStructField(x,"vec3","positionShapeUv"),n.addStructField(x,"vec3","positionUvLocal"),n.addStructField(x,"vec3","viewDirUv"),n.addStructField(x,"vec3","viewDirWorld"),n.addStructField(x,"vec3","surfaceNormal"),n.addStructField(x,"float","travelDistance"),n.addStructField(x,"int","stepCount"),n.addStructField(x,"int","tileIndex"),n.addStructField(x,"int","sampleIndex");let Z="FragmentInput";n.addStruct(Z,"FragmentInput",xe.FRAGMENT),n.addStructField(Z,h,g),n.addStructField(Z,S,V);let E="Properties",I="Properties",v="properties";n.addStruct(E,I,xe.FRAGMENT);for(let P=0;P<l;P++){let F=i[P],N=o[P],b=YD(N);n.addStructField(E,b,F)}{let P="clearProperties";n.addFunction(P,`${I} clear
{
material.diffuse = vec3(1.0);
material.alpha = 1.0;
}`});function QTe(){this.ready=!0,this.shape=La.BOX,this.dimensions=new m(1,1,1),this.names=["data"],this.types=[lt.SCALAR],this.componentTypes=[At.FLOAT32],this.maximumTileCount=1}QTe.prototype.requestData=function(e){if((c(e)?e.tileLevel??0:0)>=1)return;let n=new cS({metadata:[new Float32Array(1)]});return Promise.resolve(n)};fp.DefaultProvider=new QTe;var Ng=fp;var R8i=_(T(),1);function Hgt(e,t,n,i){if(!c(e)||c(t)&&e.id!==t)return;let r=(e.classes||{})[n];if(!c(r))return;let a=(r.properties||{})[i];if(c(a))return a}var p9=Hgt;var E8i=_(T(),1);function zgt(e,t,n,i,o){this.schemaId=e,this.className=t,this.propertyName=n,this.classProperty=i,this.metadataProperty=o}var b9=zgt;var W8i=_(T(),1);function Kgt(e,t,n){if(!c(e))return;let i=e.propertyTextures;for(let o of i)if(o.class.id===t){let a=o.properties[n];if(c(a))return a}}var y9=Kgt;var qD=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function li(e){e=e??z.EMPTY_OBJECT;let t=e.canvas,n=e.creditContainer,i=e.creditViewport,o=He(e.contextOptions);if(!c(t))throw new L("options and options.canvas are required.");let r=c(n),s=new lE(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)),c(i)||(i=t.parentNode),this._id=Hn(),this._jobScheduler=new KF,this._frameState=new HF(s,new AF(n,"\u2022",i),this._jobScheduler),this._frameState.scene3DOnly=e.scene3DOnly??!1,this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new bZ(s),this._ellipsoid=e.ellipsoid??re.default,this._globe=void 0,this._globeTranslucencyState=new zF,this._primitives=new al,this._groundPrimitives=new al,this._globeHeight=void 0,this._globeHeightDirty=!0,this._cameraUnderground=!1,this._removeUpdateHeightCallback=void 0,this._logDepthBuffer=li.defaultLogDepthBuffer&&s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new tS,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=e.orderIndependentTranslucency??!0,this._executeOITFunction=void 0,this._depthPlane=new DF(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new ti({color:new Y,stencil:0,owner:this}),this._depthClearCommand=new ti({depth:1,owner:this}),this._stencilClearCommand=new ti({stencil:0}),this._classificationStencilClearCommand=new ti({stencil:0,renderState:Oe.fromCache({stencilMask:kt.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new wA(this),this._preUpdate=new ye,this._postUpdate=new ye,this._renderError=new ye,this._preRender=new ye,this._postRender=new ye,this._minimumDisableDepthTestDistance=0,this._debugInspector=new OA,this._msaaSamples=e.msaaSamples??4,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new ye,this.morphComplete=new ye,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=Y.clone(Y.BLACK),this._mode=se.SCENE3D,this._mapProjection=c(e.mapProjection)?e.mapProjection:new Xi(this._ellipsoid),this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.atmosphere=new C_,this.fog=new YF,this.fog.enabled=re.WGS84.equals(this._ellipsoid),re.WGS84.equals(this._ellipsoid)||(oo.DEFAULT_VIEW_RECTANGLE=de.fromDegrees(-45,-45,45,45)),this._shadowMapCamera=new oo(this),this.shadowMap=new g0({context:s,lightCamera:this._shadowMapCamera,enabled:e.shadows??!1}),this.invertClassification=!1,this.invert
vec4 clippingPlanesEdgeColor = vec4(1.0);
clippingPlanesEdgeColor.rgb = ${n}.rgb;
float clippingPlanesEdgeWidth = ${n}.a;
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth)
{
out_FragColor = clippingPlanesEdgeColor;
}
`}var V9=zxt;var Mqi=_(T(),1);var Kxt={modifyFragmentShader:function(t){return t=Be.replaceMain(t,"czm_splitter_main"),t+=`uniform float czm_splitDirection;
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}}},LL=Kxt;var pS={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function L9(e){C.typeOf.object("options",e),C.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=Y.clone(Y.DARKGRAY),this._highlightColor=Y.clone(Y.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=pS.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=e.opaquePass??Xe.OPAQUE,this._cull=e.cull??!0,this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=M.clone(M.IDENTITY),this._modelMatrix=M.clone(M.IDENTITY),this.time=0,this.shadows=Sn.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,this.splitDirection=e.splitDirection??Ar.NONE,this._splittingEnabled=!1,this._error=void 0,Jxt(this,e)}Object.defineProperties(L9.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},color:{get:function(){return Y.clone(this._highlightColor)},set:function(e){this._highlightColor=Y.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(c(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=ue.clone(e,this._boundingSphere)}}});function Jxt(e,t){let n=I_.parse(t.arrayBuffer,t.byteOffset);if(e._parsedContent=n,e._rtcCenter=n.rtcCenter,e._hasNormals=n.hasNormals,e._hasColors=n.hasColors,e._hasBatchIds=n.hasBatchIds,e._isTranslucent=n.isTranslucent,!n.hasBatchIds&&c(n.batchTableBinary)&&(n.styleableProperties=zp.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),c(n.draco)){let a=n.draco;e._decodingState=pS.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}let i=n.positions;c(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);let o=n.normals;c(o)&&(e._isOctEncoded16P=o.octEncoded);let r=n.colors;c(r)&&(c(r.constantColor)&&(e._constantColor=Y.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);let s=n.batchIds;c(n.batchIds)&&(s.name="BATCH_ID",s.semantic="BATCH_ID",s.setIndex=void 0),n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary),e._pointsLength=n.pointsLength}var Qxt=new m,jxt=new m,qxt=new m,aSe,$D;function $xt(e){if(!c($D)){aSe=new lSe.default(0),$D=new Array(e);for(let t=0;t<e;++t)$D[t]=aSe.random()}return $D}function e_t(e){let n=e.length/3,i=Math.min(n,20),o=$xt(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=m.fromElements(r,r,r,Qxt),l=m.fromElements(s,s,s,jxt);for(let u=0;u<i;++u){let f=Math.floor(o[u]*n),p=m.unpack(e,f*3,qxt);m.minimumByComponent(a,p,a),m.maximumByComponent(l,p,l)}let d=ue.fromCornerPoints(a,l);return d.radius+=w.EPSILON2,d}function cSe(e,t){let n=q.fromTypedArray(e);return n===q.INT||n===q.UNSIGNED_INT||n===q.DOUBLE?(ht("Cast pnts property to
`));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 J8(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 c_t={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 l_t(e,t,n){let i,o,r,s=t.context,a=c(n),l=e._isQuantized,d=e._isQuantizedDraco,u=e._isOctEncoded16P,f=e._isOctEncodedDraco,p=e._isRGB565,y=e._isTranslucent,h=e._hasColors,g=e._hasNormals,x=e._hasBatchIds,S=e._backFaceCulling,V=e._normalShading,Z=e._drawCommand.vertexArray,R=e.clippingPlanes,E=e._attenuation,I,v,P,F=y,N=He(c_t),b={},G=e._styleableShaderAttributes;for(o in G)G.hasOwnProperty(o)&&(r=G[o],N[o]=`czm_3dtiles_property_${r.location}`,b[r.location]=r);if(a){let me={translucent:!1},_e="(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)";I=n.getColorShaderFunction(`getColorFromStyle${_e}`,N,me),v=n.getShowShaderFunction(`getShowFromStyle${_e}`,N,me),P=n.getPointSizeShaderFunction(`getPointSizeFromStyle${_e}`,N,me),c(I)&&me.translucent&&(F=!0)}e._styleTranslucent=F;let X=c(I),W=c(v),A=c(P),k=e.isClipped,B=[],O=[];X&&(z8(I,B),K8(I,O)),W&&(z8(v,B),K8(v,O)),A&&(z8(P,B),K8(P,O));let H=O.indexOf("COLOR")>=0,U=O.indexOf("NORMAL")>=0;if(U&&!g)throw new le("Style references the NORMAL semantic but the point cloud does not have normals");for(o in G)if(G.hasOwnProperty(o)){r=G[o];let me=B.indexOf(r.location)>=0,_e=J8(Z,r.location);_e.enabled=me}let K=h&&(!X||H);if(h){let me=J8(Z,eB);me.enabled=K}let Q=g&&(V||S||U);if(g){let me=J8(Z,Q8);me.enabled=Q}let ie={a_position:dSe};K&&(ie.a_color=eB),Q&&(ie.a_normal=Q8),x&&(ie.a_batchId=uSe);let j="",$=B.length;for(i=0;i<$;++i){let me=B[i];r=b[me];let _e=r.componentCount,Ve=`czm_3dtiles_property_${me}`,Ie;_e===1?Ie="float":Ie=`vec${_e}`,j+=`in ${Ie} ${Ve};
`,ie[Ve]=r.location}a_t(e,t);let ne=`in vec3 a_position;
out vec4 v_color;
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
uniform vec4 u_constantColor;
uniform vec4 u_highlightColor;
`;ne+=`float u_pointSize;
float tiles3d_tileset_time;
`,E&&(ne+=`float u_geometricError;
float u_depthMultiplier;
`),ne+=j,K&&(y?ne+=`in vec4 a_color;
`:p?ne+=`in 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;
`:ne+=`in vec3 a_color;
`),Q&&(u||f?ne+=`in vec2 a_normal;
`:ne+=`in vec3 a_normal;
`),x&&(ne+=`in float a_batchId;
`),(l||d||f)&&(ne+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange;
`),X&&(ne+=I),W&&(ne+=v),A&&(ne+=P),ne+=`void main()
{
u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x;
tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y;
`,E&&(ne+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z;
u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w;
`),K?y?ne+=` vec4 color = a_color;
`:p?ne+=` 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);
`:ne+=` vec4 color = vec4(a_color, 1.0);
`:ne+=` vec4 color = u_constantColor;
`,l||d?ne+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz;
`:ne+=` vec3 position = a_position;
`,ne+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0));
`,Q?(u?ne+=` vec3 normal = czm_octDecode(a_normal);
`:f?ne+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy;
`:ne+=` vec3 normal = a_normal;
`,ne+=` vec3 normalEC = czm_normal * normal;
`):ne+=` vec3 normal = vec3(1.0);
`,X&&(ne+=` color = getColorFromStyle(position, position_absolute, color, normal);
`),W&&(ne+=` float show = float(getShowFromStyle(position, position_absolute, color, normal));
`),A?ne+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio;
`:E?ne+=` vec4 positionEC = czm_modelView * vec4(position, 1.0);
float depth = -positionEC.z;
gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize);
`:ne+=` gl_PointSize = u_pointSize;
`,ne+=` color = color * u_highlightColor;
`,Q&&V&&(ne+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC);
diffuseStrength = max(diffuseStrength, 0.4);
color.xyz *= diffuseStrength * czm_lightColor;
`),ne+=` v_color = color;
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
`,Q&&S&&(ne+=` float visible = step(-normalEC.z, 0.0);
gl_Position *= visible;
gl_PointSize *= visible;
`),W&&(ne+=` gl_Position.w *= float(show);
gl_PointSize *= float(show);
`),ne+=`}
`;let be=`in vec4 v_color;
`;k&&(be+=`uniform highp sampler2D u_clippingPlanes;
uniform mat4 u_clippingPlanesMatrix;
uniform vec4 u_clippingPlanesEdgeStyle;
`,be+=`
`,be+=c0(R,s),be+=`
`),be+=`void main()
{
out_FragColor = czm_gammaCorrect(v_color);
`,k&&(be+=V9("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),be+=`}
`,e.splitDirection!==Ar.NONE&&(be=LL.modifyFragmentShader(be)),c(e._vertexShaderLoaded)&&(ne=e._vertexShaderLoaded(ne)),c(e._fragmentShaderLoaded)&&(be=e._fragmentShaderLoaded(be));let Ce=e._drawCommand;c(Ce.shaderProgram)&&Ce.shaderProgram.destroy(),Ce.shaderProgram=tn.fromCache({context:s,vertexShaderSource:ne,fragmentShaderSource:be,attributeLocations:ie});try{Ce.shaderProgram._bind()}catch{throw new le("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function d_t(e,t){if(e._decodingState===pS.READY)return!1;if(e._decodingState===pS.NEEDS_DECODE){let n=e._parsedContent,i=n.draco,o=eb.decodePointCloud(i,t);c(o)&&(e._decodingState=pS.DECODING,o.then(function(r){e._decodingState=pS.READY;let s=c(r.POSITION)?r.POSITION.array:void 0,a=c(r.RGB)?r.RGB.array:void 0,l=c(r.RGBA)?r.RGBA.array:void 0,d=c(r.NORMAL)?r.NORMAL.array:void 0,u=c(r.BATCH_ID)?r.BATCH_ID.array:void 0,f=c(s)&&c(r.POSITION.data.quantization),p=c(d)&&c(r.NORMAL.data.quantization);if(f){let x=r.POSITION.data.quantization,S=x.range;e._quantizedVolumeScale=m.fromElements(S,S,S),e._quantizedVolumeOffset=m.unpack(x.minValues),e._quantizedRange=(1<<x.quantizationBits)-1,e._isQuantizedDraco=!0}p&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let y=n.styleableProperties,h=i.batchTableProperties;for(let x in h)if(h.hasOwnProperty(x)){let S=r[x];c(y)||(y={}),y[x]={typedArray:S.array,componentCount:S.data.componentsPerAttribute}}c(s)&&(n.positions={typedArray:s});let g=l??a;c(g)&&(n.colors={typedArray:g}),c(d)&&(n.normals={typedArray:d}),c(u)&&(n.batchIds={typedArray:u}),n.styleableProperties=y}).catch(function(r){e._decodingState=pS.FAILED,e._error=r}))}return!0}var u_t=new ce,m_t=new m;L9.prototype.update=function(e){let t=e.context;if(c(this._error)){let d=this._error;throw this._error=void 0,d}if(d_t(this,t))return;let i=!1,o=!M.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),c(this._drawCommand)||(s_t(this,e),o=!0,i=!0,this._ready=!0,this._parsedContent=void 0),o){M.clone(this.modelMatrix,this._modelMatrix);let d=this._drawCommand.modelMatrix;if(M.clone(this._modelMatrix,d),c(this._rtcCenter)&&M.multiplyByTranslation(d,this._rtcCenter,d),c(this._quantizedVolumeOffset)&&M.multiplyByTranslation(d,this._quantizedVolumeOffset,d),e.mode!==se.SCENE3D){let f=e.mapProjection,p=M.getColumn(d,3,u_t);ce.equals(p,ce.UNIT_W)||wt.basisTo2D(f,d,d)}let u=this._drawCommand.boundingVolume;if(ue.clone(this._boundingSphere,u),this._cull){let f=u.center;M.multiplyByPoint(d,f,f);let p=M.getScale(d,m_t);u.radius*=m.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!==Ar.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&l_t(this,e,this._style),this._drawCommand.castShadows=Sn.castShadows(this.shadows),this._drawCommand.receiveShadows=Sn.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?Xe.TRANSLUCENT:this._opaquePass;let a=e.commandList,l=e.passes;(l.render||l.pick)&&a.push(this._drawCommand)};L9.prototype.isDestroyed=function(){return!1};L9.prototype.destroy=function(){let e=this._drawCommand;return c(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),he(this)};var Z9=L9;function yS(e){e=e??z.EMPTY_OBJECT,C.typeOf.object("options.clock",e.clock),C.typeOf.object("options.intervals",e.intervals),this.show=e.show??!0,this.modelMatrix=M.clone(e.modelMatrix??M.IDENTI
${e}`}function h_t(e){return function(t){return St(t,{czm_pickColor:function(){return e._pickId.color}})}}function p_t(){return"czm_pickColor"}yS.prototype.makeStyleDirty=function(){this._styleDirty=!0};yS.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};var b_t=new ee;function q8(e){let t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function bS(e,t){return e._intervals.indexOf(t.start)}function y_t(e,t){let n=e._intervals,i=e._clock,o=q8(e);if(o===0)return;let r=e._getAverageLoadTime(),s=ee.addSeconds(i.currentTime,r*o,b_t),a=n.indexOf(s),l=bS(e,t);return a===l&&(o>=0?++a:--a),n.get(a)}function g_t(e){let t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function x_t(e,t,n){let i=q8(e),o=bS(e,t),r=bS(e,n);return i>=0?o>=r:o<=r}function fSe(e,t){return function(n){let i=c(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 __t(e,t,n){let i=bS(e,t),o=e._frames,r=o[i];if(!c(r)){let s=t.data.transform,a=c(s)?M.fromArray(s):void 0,l=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:Ti(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber,uri:l},o[i]=r,Ge.fetchArrayBuffer({url:l}).then(function(d){r.pointCloud=new Z9({arrayBuffer:d,cull:!0,fragmentShaderLoaded:f_t,uniformMapLoaded:h_t(e),pickIdLoaded:p_t})}).catch(fSe(e,l))}return r}function T_t(e,t){e._runningSum+=t,e._runningSum-=e._runningSamples[e._runningIndex],e._runningSamples[e._runningIndex]=t,e._runningLength=Math.min(e._runningLength+1,e._runningSamples.length),e._runningIndex=(e._runningIndex+1)%e._runningSamples.length,e._runningAverage=e._runningSum/e._runningLength}function S_t(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);let o=t.pointCloud;if(c(o)&&!t.ready){let r=i.commandList,s=r.length;if(hSe(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){let a=(Ti()-t.timestamp)/1e3;T_t(e,a)}}t.touchedFrameNumber=i.frameNumber}var C_t=new M;function V_t(e,t){let n=e.shading;return c(n)&&c(n.baseResolution)?n.baseResolution:c(t.boundingSphere)?w.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function L_t(e){let t=e.shading;return c(t)&&c(t.maximumAttenuation)?t.maximumAttenuation:10}var Z_t=new Vh;function hSe(e,t,n,i){let o=e.shading??Z_t,r=t.pointCloud,s=t.transform??M.IDENTITY;r.modelMatrix=M.multiplyTransformation(e.modelMatrix,s,C_t),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=V_t(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=L_t(e);try{r.update(i)}catch(a){fSe(e,t.uri)(a)}t.touchedFrameNumber=i.frameNumber}function j8(e,t,n,i){let o=__t(e,t,i);S_t(e,o,n,i)}function R_t(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function pSe(e,t){let n=e._frames,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(c(r)&&(!c(t)||t(r))){let s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),c(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function G_t(e,t){let n=bS(e,t),i=e._frames[n];if(c(i)&&i.ready)return i}function mSe(e,t,n,i,o){return c(n)?n.ready?!0:(j8(e,t,i,o),n.ready):!1}function E_t(e,t,n,i,o){let r,s,a,l=e._intervals,d=e._frames,u=bS(e,n),f=bS(e,t);if(u>=f){for(r=u;r>=f;--r)if(s=l.get(r),a=d[r],mSe(e,s,a,i,o))return s}else for(r=u;r<=f;++r)if(s=l.get(r),a=d[r],mSe(e,s,a,i,o))return s;return t}function X_t(e,t,n){let i=e._frames,o=i.length;for(let r=0;r<o;++r){let s=i[r];c(s)&&c(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}var ZL={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};yS.prototype.update=function(e){if(e.mode===se.MORPHING||!this.show)return;c(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),c(this._loadTi
${t}
${h}`);let g=document.createElement("div");g.className="cesium-widget-errorPanel-message-details collapsed";let x=document.createElement("span");x.className="cesium-widget-errorPanel-more-details",x.appendChild(document.createTextNode("See more...")),g.appendChild(x),g.onclick=function(S){g.removeChild(x),g.appendChild(document.createTextNode(h)),g.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",g.onclick=void 0},a.appendChild(g)}y.innerHTML=`<p>${t}</p>`}let f=document.createElement("div");f.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(f);let p=document.createElement("button");p.setAttribute("type","button"),p.className="cesium-button",p.appendChild(document.createTextNode("OK")),p.onclick=function(){c(l)&&c(window.removeEventListener)&&window.removeEventListener("resize",l,!1),i.removeChild(o)},f.appendChild(p),i.appendChild(o)};Go.prototype.isDestroyed=function(){return!1};Go.prototype.destroy=function(){let e=this.dataSources,t=e.length;for(let n=0;n<t;n++)this._dataSourceRemoved(e,e.get(n));this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),c(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),this._eventHelper.removeAll(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),he(this)};Go.prototype.resize=function(){let e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,_Se(this),TSe(this),this._scene.requestRender())};Go.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();let e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};Go.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(Go.prototype._onEntityCollectionChanged,this)};Go.prototype._dataSourceRemoved=function(e,t){let n=t.entities;n.collectionChanged.removeEventListener(Go.prototype._onEntityCollectionChanged,this),c(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0)};Go.prototype._updateCanAnimate=function(e){this._clock.canAnimate=e};var W_t=new ue;Go.prototype._onTick=function(e){let t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&this._canAnimateUpdateCallback(n);let i=this._entityView;if(c(i)){let o=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(o,!1,i.boundingSphere??W_t)===ut.DONE&&i.update(t)}};Go.prototype._onEntityCollectionChanged=function(e,t,n){let i=n.length;for(let o=0;o<i;o++){let r=n[o];this.trackedEntity===r&&(this.trackedEntity=void 0)}};Go.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};Go.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&gSe(this.clock,e)};Go.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);let n=t.entities.id,i=this._eventHelper.add(t.changedEvent,Go.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};Go.prototype._onDataSourceRemoved=function(e,t){let n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){let o=e.length;this._automaticallyTrackDataSourceClocks&&o>0?this.clockTrackedDataSource=e.get(o-1):this.clockTrackedDataSource=void 0}};Go.prototype.zoomTo=function(e,t){return SSe(this,e,{offset:t},!1)};Go.prototype.flyTo=function(e,t){return SSe(this,e,t,!0)};function SSe(e,t,n,i){if(!c(t))throw new L("zoomTarget is required.");$8(e);let o=new Promise(r=>{e._completeZoom=function(s){r(s)}});return e._zoomPromise=o,e._zoomIsFlight=i,e._zoomOptions=n,Promise.resolve(t).then(function(r){if(e._zoomPromise
${t.message}`),e.previousError=Ro.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,i),e.previousError.retry)return u7(e,n);throw new le(i)}async function lTt(e,t,n){await wSe(e,t,n);let i=e.overallAvailability.length;if(i>0){let o=e.availability=new Hf(e.tilingScheme,e.overallMaxZoom);for(let r=0;r<i;++r){let s=e.overallAvailability[r];for(let a=0;a<s.length;++a){let l=s[a];o.addAvailableTileRange(r,l[0],l[1],l[2],l[3])}}}if(e.attribution.length>0){let o=new Ct(e.attribution);e.tileCredits.push(o)}return!0}async function u7(e,t){try{let n=await e.layerJsonResource.fetchJson();return lTt(e,n,t)}catch(n){return c(n)&&n.statusCode===404?(await wSe(e,{tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]},t),!0):cTt(e,n,t)}}function zf(e){e=e??z.EMPTY_OBJECT,this._heightmapWidth=void 0,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._hasMetadata=!1,this._scheme=void 0,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=e.requestVertexNormals??!1,this._requestWaterMask=e.requestWaterMask??!1,this._requestMetadata=e.requestMetadata??!0,this._errorEvent=new ye;let t=e.credit;typeof t=="string"&&(t=new Ct(t)),this._credit=t,this._availability=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._layers=void 0,this._tileCredits=void 0}var l7={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function ISe(e){return!c(e)||e.length===0?{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:`application/vnd.quantized-mesh;extensions=${e.join("-")},application/octet-stream;q=0.9,*/*;q=0.01`}}function dTt(e,t,n,i,o){let r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new Da({buffer:r,childTileMask:new Uint8Array(t,r.byteLength,1)[0],waterMask:new Uint8Array(t,r.byteLength+1,t.byteLength-r.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function uTt(e,t,n,i,o,r){let s=r.littleEndianExtensionSize,a=0,l=3,d=l+1,u=Float64Array.BYTES_PER_ELEMENT*l,f=Float64Array.BYTES_PER_ELEMENT*d,y=Uint16Array.BYTES_PER_ELEMENT*3,h=3,g=Uint16Array.BYTES_PER_ELEMENT,x=g*h,S=new DataView(t),V=new m(S.getFloat64(a,!0),S.getFloat64(a+8,!0),S.getFloat64(a+16,!0));a+=u;let Z=S.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;let R=S.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;let E=new ue(new m(S.getFloat64(a,!0),S.getFloat64(a+8,!0),S.getFloat64(a+16,!0)),S.getFloat64(a+u,!0));a+=f;let I=new m(S.getFloat64(a,!0),S.getFloat64(a+8,!0),S.getFloat64(a+16,!0));a+=u;let v=S.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let P=new Uint16Array(t,a,v*3);a+=v*y,v>64*1024&&(g=Uint32Array.BYTES_PER_ELEMENT,x=g*h);let F=P.subarray(0,v),N=P.subarray(v,2*v),b=P.subarray(v*2,3*v);Fn.zigZagDeltaDecode(F,N,b),a%g!==0&&(a+=g-a%g);let G=S.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let X=Me.createTypedArrayFromArrayBuffer(v,t,a,G*h);a+=G*x;let W=0,A=X.length;for(let me=0;me<A;++me){let _e=X[me];X[me]=W-_e,_e===0&&++W}let k=S.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let B=Me.createTypedArrayFromArrayBuffer(v,t,a,k);a+=k*g;let O=S.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let H=Me.createTypedArrayFromArrayBuffer(v,t,a,O);a+=O*g;let U=S.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let K=Me.createTypedArrayFromArrayBuffer(v,t,a,U);a+=U*g;let Q=S.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let ie=Me.createTypedArrayFromArrayBuffer(v,t,a,Q);a+=Q*g;let j,$;for(;a<S.byteLength;){let me=S.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;let _e=S.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,me===l7.OCT_VERTEX_NORMALS&&e._requestVertexNormals)j=new Uint8Array(t,a,v*2);else if(me===l7.WATER_MASK&&e._requestWaterMask)$=new Uint8Array(t,a,_e);else if(me===l7.METADATA&&e._requestMetadata){let Ve=S.getUint32(a,!0);if(Ve>0){let Ze=er(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,Ve).available;if(c(Ze))for(let De=0;De<Ze.length;++De){let Ke=n+De+1,rt=Ze[De],Xt=e._tilingScheme.getNumberOfYTilesAtLev
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 su(e){this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=w.EPSILON12,this.providers={},this.key=void 0,this._resource=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={}}Object.defineProperties(su.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}}});su.fromUrl=async function(e){C.defined("resourceOrUrl",e);let t=e;typeof t!="string"&&!(t instanceof Ge)&&(C.typeOf.string("resourceOrUrl.url",e.url),t=e.url);let n=Ge.createIfNeeded(t);n.appendForwardSlash();let i=new su;i._resource=n;try{await ZTt(i),await i.getQuadTreePacket("",i._quadPacketVersion)}catch(o){let r=`An error occurred while accessing ${USe(i,"",1).url}: ${o}`;throw new le(r)}return i};su.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){let r=1<<o,s=0;Wc(t,r)?Wc(e,r)&&(s|=1):(s|=2,Wc(e,r)||(s|=1)),i+=s}return i};su.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];Wc(s,2)?Wc(s,1)||(t|=r):(n|=r,Wc(s,1)&&(t|=r))}return{x:t,y:n,level:i}};su.prototype.isValid=function(e){let t=this.getTileInformationFromQuadKey(e);if(c(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),c(t)){!t.hasSubtree()&&!t.hasChild(parseInt(o))&&(n=!1);break}else if(t===null){n=!1;break}return n};var kSe=new gi("decodeGoogleEarthEnterprisePacket");su.prototype.getQuadTreePacket=function(e,t,n){t=t??1,e=e??"";let o=USe(this,e,t,n).fetchArrayBuffer();if(!c(o))return;let r=this._tileInfo,s=this.key;return o.then(function(a){return kSe.scheduleTask({buffer:a,quadKey:e,type:"Metadata",key:s},[a]).then(function(d){let u,f=-1;if(e!==""){f=e.length+1;let h=d[e];u=r[e],u._bits|=h._bits,delete d[e]}let p=Object.keys(d);p.sort(function(h,g){return h.length-g.length});let y=p.length;for(let h=0;h<y;++h){let g=p[h];if(d[g]!==null){let S=w9.clone(d[g]),V=g.length;if(V===f)S.setParent(u);else if(V>1){let Z=r[g.substring(0,g.length-1)];S.setParent(Z)}r[g]=S}else r[g]=null}})})};su.prototype.populateSubtree=function(e,t,n,i){let o=su.tileXYToQuadKey(e,t,n);return C7(this,o,i)};function C7(e,t,n){let i=e._tileInfo,o=t,r=i[o];if(c(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,l=a[o];if(c(l))return l.then(function(){return s=new Jo({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),C7(e,t,s)});if(!c(r)||!r.hasSubtree())return Promise.reject(new le(`Couldn't load metadata for tile ${t}`));if(l=e.getQuadTreePacket(o,r.cnodeVersion,n),!!c(l))return a[o]=l,l.then(function(){return s=new Jo({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),C7(e,t,s)}).finally(function(){delete a[o]})}su.prototype.getTileInformation=function(e,t,n){let i=su.tileXYToQuadKey(e,t,n);return this._tileInfo[i]};su.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]};function USe(e,t,n,i){return e._resource.getDerivedResource({url:`flatfile?q2-0${t}-q.${n.toString()}`,request:i})}var T7,S7;function ZTt(e){let t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!c(S7)){let n=on("ThirdParty/google-earth-dbroot-parser.js"),i=window.cesiumGoogleEarthDbRootParser;S7=sx(n).then(function(){T7=window.cesiumGoogleEarthDbRootParser(CTt),c(i)?window.cesiumGoogleEarthDbRootParser=i:delete window.cesiumGoogleEarthDbRootParser})}return S7.then(function(){return t.fetchArrayBuffer()}).then(function(n){let i=T7.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.byteLeng
{
return ${u};
}
`}return r=`${i} ${e}
{
${r} return ${i}(1.0);
}
`,r};ML.prototype.getVariables=function(){let e=[],t=this._runtimeConditions;if(!c(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 M9=ML;function Jg(e){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,dSt(this,e)}function dSt(e,t){t=He(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(c(t.meta)){let i=t.defines,o=t.meta??z.EMPTY_OBJECT;for(let r in o)o.hasOwnProperty(r)&&(n[r]=new Iu(o[r],i))}e._meta=n,e._ready=!0}function cr(e,t){let n=(e._style??z.EMPTY_OBJECT).defines;if(c(t)){if(typeof t=="boolean"||typeof t=="number")return new Iu(String(t));if(typeof t=="string")return new Iu(t,n);if(c(t.conditions))return new M9(t,n)}else return;return t}function lr(e){if(c(e)){if(c(e.expression))return e.expression;if(c(e.conditionsExpression))return He(e.conditionsExpression,!0)}else return;return e}Object.defineProperties(Jg.prototype,{style:{get:function(){return this._style}},show:{get:function(){return this._show},set:function(e){this._show=cr(this,e),this._style.show=lr(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=cr(this,e),this._style.color=lr(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=cr(this,e),this._style.pointSize=lr(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=cr(this,e),this._style.pointOutlineColor=lr(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=cr(this,e),this._style.pointOutlineWidth=lr(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=cr(this,e),this._style.labelColor=lr(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=cr(this,e),this._style.labelOutlineColor=lr(this._labelOutlineColor)}},labelOutlineWidth:{get:fu
`;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;default:throw new L("options.glslDatatype must be float, vec2, vec3, or vec4.")}let s=`in vec3 position3DHigh;
in vec3 position3DLow;
in float batchId;
${n?"":`in ${i} ${t};
`}out ${i} ${o};
void main()
{
vec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);
${n?`${o} = czm_batchTable_${t}(batchId);
`:`${o} = ${t};
`}gl_Position = czm_modelViewProjectionRelativeToEye * p;
}`,a=`in ${i} ${o};
${r}
void main()
{
out_FragColor = getColor();
}`;this.material=void 0,this.translucent=e.translucent??!1,this._vertexShaderSource=e.vertexShaderSource??s,this._fragmentShaderSource=e.fragmentShaderSource??a,this._renderState=no.getDefaultRenderState(!1,!1,e.renderState),this._closed=e.closed??!1,this._attributeName=t,this._glslDatatype=i}Object.defineProperties(B9.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}}});B9.prototype.getFragmentShaderSource=no.prototype.getFragmentShaderSource;B9.prototype.isTranslucent=no.prototype.isTranslucent;B9.prototype.getRenderState=no.prototype.getRenderState;var d6=B9;var ydo=_(T(),1);function pB(e){e=e??z.EMPTY_OBJECT,this.length=e.length??1e7,this._length=void 0,this.width=e.width??2,this._width=void 0,this.show=e.show??!0,this.modelMatrix=M.clone(e.modelMatrix??M.IDENTITY),this._modelMatrix=new M,this.id=e.id,this._id=void 0,this._primitive=void 0}pB.prototype.update=function(e){if(this.show){if(!c(this._primitive)||!M.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=M.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,c(this._primitive)&&this._primitive.destroy(),this.modelMatrix[12]===0&&this.modelMatrix[13]===0&&this.modelMatrix[14]===0&&(this.modelMatrix[14]=.01);let t=new Rt({geometry:new e0({positions:[m.ZERO,m.UNIT_X],width:this.width,vertexFormat:es.VERTEX_FORMAT,colors:[Y.RED,Y.RED],arcType:Kt.NONE}),modelMatrix:M.multiplyByUniformScale(this.modelMatrix,this.length,new M),id:this.id,pickPrimitive:this}),n=new Rt({geometry:new e0({positions:[m.ZERO,m.UNIT_Y],width:this.width,vertexFormat:es.VERTEX_FORMAT,colors:[Y.GREEN,Y.GREEN],arcType:Kt.NONE}),modelMatrix:M.multiplyByUniformScale(this.modelMatrix,this.length,new M),id:this.id,pickPrimitive:this}),i=new Rt({geometry:new e0({positions:[m.ZERO,m.UNIT_Z],width:this.width,vertexFormat:es.VERTEX_FORMAT,colors:[Y.BLUE,Y.BLUE],arcType:Kt.NONE}),modelMatrix:M.multiplyByUniformScale(this.modelMatrix,this.length,new M),id:this.id,pickPrimitive:this});this._primitive=new In({geometryInstances:[t,n,i],appearance:new es,asynchronous:!1})}this._primitive.update(e)}};pB.prototype.isDestroyed=function(){return!1};pB.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),he(this)};var Y9=pB;var Cdo=_(T(),1);function uCt(e){if(C.typeOf.object("options",e),C.typeOf.object("options.direction",e.direction),m.equals(e.direction,m.ZERO))throw new L("options.direction cannot be zero-length");this.direction=m.clone(e.direction),this.color=Y.clone(e.color??Y.WHITE),this.intensity=e.intensity??1}var u6=uCt;var Fdo=_(T(),1);var Ldo=_(T(),1),H9=`in vec3 v_positionMC;
in vec3 v_positionEC;
in 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
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var Rdo=_(T(),1),z9=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec2 st;
in float batchId;
out vec3 v_positionMC;
out vec3 v_positionEC;
out 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 XS(e){e=e??z.EMPTY_OBJECT;let t=e.translucent??!0,n=e.aboveGround??!1;this.material=c(e.material)?e.material:zi.fromType(zi.ColorType),this.translucent=e.translucent??!0,this._vertexShaderSource=e.vertexShaderSource??z9,this._fragmentShaderSource=e.fragmentShaderSource??H9,this._renderState=no.getDefaultRenderState(t,!n,e.renderState),this._closed=!1,this._flat=e.flat??!1,this._faceForward=e.faceForward??n,this._aboveGround=n}Object.defineProperties(XS.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 XS.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}});XS.VERTEX_FORMAT=We.POSITION_AND_ST;XS.prototype.getFragmentShaderSource=no.prototype.getFragmentShaderSource;XS.prototype.isTranslucent=no.prototype.isTranslucent;XS.prototype.getRenderState=no.prototype.getRenderState;var m6=XS;var Bdo=_(T(),1);function od(e){if(!c(e)||!c(e.scene))throw new L("options.scene is required.");this._scene=e.scene,this.samplingWindow=e.samplingWindow??od.defaultSettings.samplingWindow,this.quietPeriod=e.quietPeriod??od.defaultSettings.quietPeriod,this.warmupPeriod=e.warmupPeriod??od.defaultSettings.warmupPeriod,this.minimumFrameRateDuringWarmup=e.minimumFrameRateDuringWarmup??od.defaultSettings.minimumFrameRateDuringWarmup,this.minimumFrameRateAfterWarmup=e.minimumFrameRateAfterWarmup??od.defaultSettings.minimumFrameRateAfterWarmup,this._lowFrameRate=new ye,this._nominalFrameRate=new ye,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){mCt(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(){fCt(t)}this._visibilityChangeRemoveListener=void 0,c(n)&&(document.addEventListener(n,i,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(n,i,!1)})}od.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8};od.fromScene=function(e){if(!c(e))throw new L("scene is required.");return(!c(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new od({scene:e})),e._frameRateMonitor};Object.defineProperties(od.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}});od.prototype.pause=function(){++this._pauseCount,this._pauseCount===1&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)};od.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)};od.prototype.isDestroyed=function(){return!1};od.prototype.destroy=function(){return this._preUpdateRemoveListener(),c(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),he(this)};function mCt(e,t){if(e._pauseCount>0)return;let n=Ti();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=n+e.quietPeriod/Kn.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/Kn.SECONDS_PER_MILLISECOND;else if(n>=e._quietPeriodEndTime){e._frameTimes.push(n);let i=n-e.samplingWindow/Kn.SECONDS_PER_MILLISECOND
in vec2 v_textureCoordinates;
void main()
{
float z_window = czm_unpackDepth(texture(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);
out_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);
}
`;var fpo=_(T(),1);function l1t(e){e=e??z.EMPTY_OBJECT;let t=c(e.typedArray),n=c(e.url);if(t===n)throw new L("exactly one of options.typedArray, options.url must be defined");if(t&&(!c(e.width)||!c(e.height)))throw new L("options.width and options.height are required when options.typedArray is defined");this.typedArray=e.typedArray,this.width=e.width,this.height=e.height,this.pixelFormat=e.pixelFormat??ke.RGBA,this.pixelDatatype=e.pixelDatatype??Ue.UNSIGNED_BYTE;let i=e.url;typeof i=="string"&&(i=Ge.createIfNeeded(i)),this.resource=i;let r=e.repeat??!0?xn.REPEAT:xn.CLAMP_TO_EDGE;this.sampler=new en({wrapS:r,wrapT:r,minificationFilter:e.minificationFilter,magnificationFilter:e.magnificationFilter,maximumAnisotropy:e.maximumAnisotropy})}var U6=l1t;var ppo=_(T(),1),d1t={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",MAT2:"mat2",MAT3:"mat3",MAT4:"mat4"},O6=Object.freeze(d1t);var ypo=_(T(),1),u1t={SIGX:"SIGX",SIGY:"SIGY",SIGZ:"SIGZ",VARX:"VARX",VARY:"VARY",VARZ:"VARZ",SIGR:"VARZ"},D6=Object.freeze(u1t);var _po=_(T(),1);function m1t(e){async function t({data:i}){let o=[],r={id:i.id,result:void 0,error:void 0};self.CESIUM_BASE_URL=i.baseUrl;try{let s=await e(i.parameters,o);r.result=s}catch(s){s instanceof Error?r.error={name:s.name,message:s.message,stack:s.stack}:r.error=s}i.canTransferArrayBuffer||(o.length=0);try{postMessage(r,o)}catch(s){r.result=void 0,r.error=`postMessage failed with error: ${qh(s)}
with responseMessage: ${JSON.stringify(r)}`,postMessage(r)}}function n(i){postMessage({id:i.data?.id,error:`postMessage failed with error: ${JSON.stringify(i)}`})}return self.onmessage=t,self.onmessageerror=n,self}var B6=m1t;globalThis.CESIUM_VERSION="1.129";var lMo=_(T(),1);var v2o=_(T(),1);var I2o=_(T(),1);var S2o=_(T(),1),lM;typeof ko<"u"&&(lM=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 l(b,G){return b===null||typeof b in g?b===G:!1}function d(b,G){var X;return function(){X||(X=h.a.setTimeout(function(){X=e,b()},G))}}function u(b,G){var X;return function(){clearTimeout(X),X=h.a.setTimeout(b,G)}}function f(b,G){G&&G!=="change"?G==="beforeChange"?this.pc(b):this.gb(b,G):this.qc(b)}function p(b,G){G!==null&&G.s&&G.s()}function y(b,G){var X=this.qd,W=X[R];W.ra||(this.Qb&&this.mb[G]?(X.uc(G,b,this.mb[G]),this.mb[G]=null,--this.Qb):W.I[G]||X.uc(G,b,W.J?{da:b}:X.$c(b)),b.Ja&&b.gd())}var h=typeof s<"u"?s:{};h.b=function(b,G){for(var X=b.split("."),W=h,A=0;A<X.length-1;A++)W=W[X[A]];W[X[X.length-1]]=G},h.L=function(b,G,X){b[G]=X},h.version="3.5.1",h.b("version",h.version),h.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},h.a=function(){function b(j,$){for(var ne in j)A.call(j,ne)&&$(ne,j[ne])}function G(j,$){if($)for(var ne in $)A.call($,ne)&&(j[ne]=$[ne]);return j}function X(j,$){return j.__proto__=$,j}function W(j,$,ne,be){var Ce=j[$].match(Q)||[];h.a.D(ne.match(Q),function(me){h.a.Na(Ce,me,be)}),j[$]=Ce.join(" ")}var A=Object.prototype.hasOwnProperty,k={__proto__:[]}instanceof Array,B=typeof Symbol=="function",O={},H={};O[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],O.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),b(O,function(j,$){if($.length)for(var ne=0,be=$.length;ne<be;ne++)H[$[ne]]=j});var U={propertychange:!0},K=n&&function(){for(var j=3,$=n.createElement("div"),ne=$.getElementsByTagName("i");$.innerHTML="<!--[if gt IE "+ ++j+"]><i></i><![endif]-->",ne[0];);return 4<j?j:e}(),Q=/\S+/g,ie;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(j,$,ne){for(var be=0,Ce=j.length;be<Ce;be++)$.call(ne,j[be],be,j)},A:typeof Array.prototype.indexOf=="function"?function(j,$){return Array.prototype.indexOf.call(j,$)}:function(j,$){for(var ne=0,be=j.length;ne<be;ne++)if(j[ne]===$)return ne;return-1},Lb:function(j,$,ne){for(var be=0,Ce=j.length;be<Ce;be++)if($.call(ne,j[be],be,j))return j[be];return e},Pa:function(j,$){var ne=h.a.A(j,$);0<ne?j.splice(ne,1):ne===0&&j.shift()},wc:function(j){var $=[];return j&&h.a.D(j,function(ne){0>h.a.A($,ne)&&$.push(ne)}),$},Mb:function(j,$,ne){var be=[];if(j)for(var Ce=0,me=j.length;Ce<me;Ce++)be.push($.call(ne,j[Ce],Ce));return be},jb:function(j,$,ne){var be=[];if(j)for(var Ce=0,me=j.length;Ce<me;Ce++)$.call(ne,j[Ce],Ce)&&be.push(j[Ce]);return be},Nb:function(j,$){if($ instanceof Array)j.push.apply(j,$);else for(var ne=0,be=$.length;ne<be;ne++)j.push($[ne]);return j},Na:function(j,$,ne){var be=h.a.A(h.a.bc(j),$);0>be?ne&&j.push($):ne||j.splice(be,1)},Ba:k,extend:G,setPrototypeOf:X,Ab:k?X:G,P:b,Ga:function(j,$,ne){if(!j)return j;var be={},Ce;for(Ce in j)A.call(j,Ce)&&(be[Ce]=$.call(ne,j[Ce],Ce,j));return be},Tb:function(j){for(;j.firstChild;)h.removeNode(j.firstChild)},Yb:function(j){j=h.a.la(j);for(var $=(j[0]&&j[0].ownerDocument||n).createElement("div"),ne=0,be=j.length;ne<be;ne++)$.appendChild(h.oa(j[ne]));return $},Ca:function(j,$){for(var ne=0,be=j.length,Ce=[];ne<be;ne++){var me=j[ne].cloneNode(!0);Ce.push($?h.oa(me):me)}return Ce},va:function(j,$){if(h.a.Tb(j),$)for(var ne=0,be=$.length;ne<be;ne++)j.appendChild($[ne])},Xc:function(j,$){var ne=j.nodeType?[j]:j;if(0<ne.length){for(var be=ne[0],Ce=be.parentNode,me=0,_e=$.length;me<_e;me++)Ce.insertBefore($[me],be);for(me=0,_e=ne.length;me<_e;me++)h.removeNode(ne[me])}},Ua:function(j,$){if(j.length){for($=$.nodeType===8&&$.parentNode||$;j.length&&j[0].parentNode!==$;)j.splice(0,1);for(;1<j.length&&j[j.length-1].parentNode!==$;)j.length--;if(1<j.length){var ne=j[0],be=j[j.length-1];for(j.length=0;ne!==be;)j.push(ne),ne=ne.nextSibling;j.push(be)}}return j},Zc:function(j,$){7>K?j.setAttribute("selected",$):j.selected=$},Db:function(j){return j===null||j===e?"":j.trim?j.trim():j.toString().
,`;var H=[],U=O.match(W),K,Q=[],ie=0;if(1<U.length){for(var j=0,$;$=U[j];++j){var ne=$.charCodeAt(0);if(ne===44){if(0>=ie){H.push(K&&Q.length?{key:K,value:Q.join("")}:{unknown:K||Q.join("")}),K=ie=0,Q=[];continue}}else if(ne===58){if(!ie&&!K&&Q.length===1){K=Q.pop();continue}}else{if(ne===47&&1<$.length&&($.charCodeAt(1)===47||$.charCodeAt(1)===42))continue;ne===47&&j&&1<$.length?(ne=U[j-1].match(A))&&!k[ne[0]]&&(O=O.substr(O.indexOf($)+1),U=O.match(W),j=-1,$="/"):ne===40||ne===123||ne===91?++ie:ne===41||ne===125||ne===93?--ie:K||Q.length||ne!==34&&ne!==39||($=$.slice(1,-1))}Q.push($)}if(0<ie)throw Error("Unbalanced parentheses, braces, or brackets")}return H}var G=["true","false","null","undefined"],X=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,W=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),A=/[\])"'A-Za-z0-9_$]+$/,k={in:1,return:1,typeof:1},B={};return{Ra:[],wa:B,ac:b,vb:function(O,H){function U(ne,be){var Ce;if(!j){var me=h.getBindingHandler(ne);if(me&&me.preprocess&&!(be=me.preprocess(be,ne,U)))return;(me=B[ne])&&(Ce=be,0<=h.a.A(G,Ce)?Ce=!1:(me=Ce.match(X),Ce=me===null?!1:me[1]?"Object("+me[1]+")"+me[2]:Ce),me=Ce),me&&Q.push("'"+(typeof B[ne]=="string"?B[ne]:ne)+"':function(_z){"+Ce+"=_z}")}ie&&(be="function(){return "+be+" }"),K.push("'"+ne+"':"+be)}H=H||{};var K=[],Q=[],ie=H.valueAccessors,j=H.bindingParams,$=typeof O=="string"?b(O):O;return h.a.D($,function(ne){U(ne.key||ne.unknown,ne.value)}),Q.length&&U("_ko_property_writers","{"+Q.join(",")+" }"),K.join(",")},Id:function(O,H){for(var U=0;U<O.length;U++)if(O[U].key==H)return!0;return!1},eb:function(O,H,U,K,Q){O&&h.O(O)?!h.Za(O)||Q&&O.v()===K||O(K):(O=H.get("_ko_property_writers"))&&O[U]&&O[U](K)}}}(),h.b("expressionRewriting",h.m),h.b("expressionRewriting.bindingRewriteValidators",h.m.Ra),h.b("expressionRewriting.parseObjectLiteral",h.m.ac),h.b("expressionRewriting.preProcessBindings",h.m.vb),h.b("expressionRewriting._twoWayBindings",h.m.wa),h.b("jsonExpressionRewriting",h.m),h.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",h.m.vb),function(){function b(U){return U.nodeType==8&&k.test(A?U.text:U.nodeValue)}function G(U){return U.nodeType==8&&B.test(A?U.text:U.nodeValue)}function X(U,K){for(var Q=U,ie=1,j=[];Q=Q.nextSibling;){if(G(Q)&&(h.a.g.set(Q,H,!0),ie--,ie===0))return j;j.push(Q),b(Q)&&ie++}if(!K)throw Error("Cannot find closing comment tag to match: "+U.nodeValue);return null}function W(U,K){var Q=X(U,K);return Q?0<Q.length?Q[Q.length-1].nextSibling:U.nextSibling:null}var A=n&&n.createComment("test").text==="<!--test-->",k=A?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,B=A?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,O={ul:!0,ol:!0},H="__ko_matchedEndComment__";h.h={ea:{},childNodes:function(U){return b(U)?X(U):U.childNodes},Ea:function(U){if(b(U)){U=h.h.childNodes(U);for(var K=0,Q=U.length;K<Q;K++)h.removeNode(U[K])}else h.a.Tb(U)},va:function(U,K){if(b(U)){h.h.Ea(U);for(var Q=U.nextSibling,ie=0,j=K.length;ie<j;ie++)Q.parentNode.insertBefore(K[ie],Q)}else h.a.va(U,K)},Vc:function(U,K){var Q;b(U)?(Q=U.nextSibling,U=U.parentNode):Q=U.firstChild,Q?K!==Q&&U.insertBefore(K,Q):U.appendChild(K)},Wb:function(U,K,Q){Q?(Q=Q.nextSibling,b(U)&&(U=U.parentNode),Q?K!==Q&&U.insertBefore(K,Q):U.appendChild(K)):h.h.Vc(U,K)},firstChild:function(U){if(b(U))return!U.nextSibling||G(U.nextSibling)?null:U.nextSibling;if(U.firstChild&&G(U.firstChild))throw Error("Found invalid end comment, as the first child of "+U);return U.firstChild},nextSibling:function(U){if(b(U)&&(U=W(U)),U.nextSibling&&G(U.nextSibling)){var K=U.nextSibling;if(G(K)&&!h.a.g.get(K,H))throw Error("Found end comment without a matching opening comment, as child of "+U);return null}return U.nextSibling},Cd:b,Vd:function(U){return(U=(A?U.text:U.nodeValue).match(k))?U[1]:null},Sc:function(U){if(O[h.a.R(U)]){var K=U.firstChild;if(K)do if(K.nodeType===1){var Q;Q=K.firstChild;var ie=null;if(Q)do if(ie)ie.push(Q);else if(b(Q)){var j=W(Q,!0);j?Q=j:ie=[Q]}else G(Q)&&(ie=[Q]);while(Q=Q.nextSibling);if(Q=ie)for(ie=K.nextSibling,j=0;j<Q.length;j++)ie?U.insertBefore(Q[j],ie):U.appendChild(Q[j])}while(K=K.nextSibling)}}}}(),h.b("virtualElements",h.h),h.b("virtualElements.allowedBindings",h.h.ea),h.b("virtualElements.emptyNode",h.h.Ea),h.b("virtualElements.insertAfter",h.h.Wb),h.b("virtualElements.prepend",h.h.Vc),h.b("virtualElements.setDomNodeChildren",h.h.va),function(){h.ga=function(){this.nd={}},h.a.extend(h.ga.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind")!=null||h.j.getComponentNameForNode(b);case 8:return h.h.Cd(b);default:return!1}},getBindings:function(b,G){var X=this.getBindingsString(b,G),X=X?this.parseBindingsString(X,G,b):null;return h.j.tc(X,b,G,!1)},getBindingAccessors:function(b,G){var X=this.getBindingsString(b,G),X=X?this
Bindings value: `+b+`
Message: `+U.message,U}}}),h.ga.instance=new h.ga}(),h.b("bindingProvider",h.ga),function(){function b(me){var _e=(me=h.a.g.get(me,Ce))&&me.N;_e&&(me.N=null,_e.Tc())}function G(me,_e,Ve){this.node=me,this.yc=_e,this.kb=[],this.H=!1,_e.N||h.a.K.za(me,b),Ve&&Ve.N&&(Ve.N.kb.push(me),this.Kb=Ve)}function X(me){return function(){return me}}function W(me){return me()}function A(me){return h.a.Ga(h.u.G(me),function(_e,Ve){return function(){return me()[Ve]}})}function k(me,_e,Ve){return typeof me=="function"?A(me.bind(null,_e,Ve)):h.a.Ga(me,X)}function B(me,_e){return A(this.getBindings.bind(this,me,_e))}function O(me,_e){var Ve=h.h.firstChild(_e);if(Ve){var Ie,Ze=h.ga.instance,De=Ze.preprocessNode;if(De){for(;Ie=Ve;)Ve=h.h.nextSibling(Ie),De.call(Ze,Ie);Ve=h.h.firstChild(_e)}for(;Ie=Ve;)Ve=h.h.nextSibling(Ie),H(me,Ie)}h.i.ma(_e,h.i.H)}function H(me,_e){var Ve=me,Ie=_e.nodeType===1;Ie&&h.h.Sc(_e),(Ie||h.ga.instance.nodeHasBindings(_e))&&(Ve=K(_e,null,me).bindingContextForDescendants),Ve&&!ne[h.a.R(_e)]&&O(Ve,_e)}function U(me){var _e=[],Ve={},Ie=[];return h.a.P(me,function Ze(De){if(!Ve[De]){var Ke=h.getBindingHandler(De);Ke&&(Ke.after&&(Ie.push(De),h.a.D(Ke.after,function(rt){if(me[rt]){if(h.a.A(Ie,rt)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Ie.join(", "));Ze(rt)}}),Ie.length--),_e.push({key:De,Mc:Ke})),Ve[De]=!0}}),_e}function K(me,_e,Ve){var Ie=h.a.g.Ub(me,Ce,{}),Ze=Ie.hd;if(!_e){if(Ze)throw Error("You cannot apply bindings multiple times to the same element.");Ie.hd=!0}Ze||(Ie.context=Ve),Ie.Zb||(Ie.Zb={});var De;if(_e&&typeof _e!="function")De=_e;else{var Ke=h.ga.instance,rt=Ke.getBindingAccessors||B,Xt=h.$(function(){return(De=_e?_e(Ve,me):rt.call(Ke,me,Ve))&&(Ve[ie]&&Ve[ie](),Ve[$]&&Ve[$]()),De},null,{l:me});De&&Xt.ja()||(Xt=null)}var Ht=Ve,qe;if(De){var mn=function(){return h.a.Ga(Xt?Xt():De,W)},Dt=Xt?function(Lt){return function(){return W(Xt()[Lt])}}:function(Lt){return De[Lt]};mn.get=function(Lt){return De[Lt]&&W(Dt(Lt))},mn.has=function(Lt){return Lt in De},h.i.H in De&&h.i.subscribe(me,h.i.H,function(){var Lt=(0,De[h.i.H])();if(Lt){var Vi=h.h.childNodes(me);Vi.length&&Lt(Vi,h.Ec(Vi[0]))}}),h.i.pa in De&&(Ht=h.i.Cb(me,Ve),h.i.subscribe(me,h.i.pa,function(){var Lt=(0,De[h.i.pa])();Lt&&h.h.firstChild(me)&&Lt(me)})),Ie=U(De),h.a.D(Ie,function(Lt){var Vi=Lt.Mc.init,ln=Lt.Mc.update,ge=Lt.key;if(me.nodeType===8&&!h.h.ea[ge])throw Error("The binding '"+ge+"' cannot be used with virtual elements");try{typeof Vi=="function"&&h.u.G(function(){var Le=Vi(me,Dt(ge),mn,Ht.$data,Ht);if(Le&&Le.controlsDescendantBindings){if(qe!==e)throw Error("Multiple bindings ("+qe+" and "+ge+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");qe=ge}}),typeof ln=="function"&&h.$(function(){ln(me,Dt(ge),mn,Ht.$data,Ht)},null,{l:me})}catch(Le){throw Le.message='Unable to process binding "'+ge+": "+De[ge]+`"
Message: `+Le.message,Le}})}return Ie=qe===e,{shouldBindDescendants:Ie,bindingContextForDescendants:Ie&&Ht}}function Q(me,_e){return me&&me instanceof h.fa?me:new h.fa(me,e,e,_e)}var ie=h.a.Da("_subscribable"),j=h.a.Da("_ancestorBindingInfo"),$=h.a.Da("_dataDependency");h.c={};var ne={script:!0,textarea:!0,template:!0};h.getBindingHandler=function(me){return h.c[me]};var be={};h.fa=function(me,_e,Ve,Ie,Ze){function De(){var Dt=Ht?Xt():Xt,Lt=h.a.f(Dt);return _e?(h.a.extend(Ke,_e),j in _e&&(Ke[j]=_e[j])):(Ke.$parents=[],Ke.$root=Lt,Ke.ko=h),Ke[ie]=qe,rt?Lt=Ke.$data:(Ke.$rawData=Dt,Ke.$data=Lt),Ve&&(Ke[Ve]=Lt),Ie&&Ie(Ke,_e,Lt),_e&&_e[ie]&&!h.S.o().Vb(_e[ie])&&_e[ie](),mn&&(Ke[$]=mn),Ke.$data}var Ke=this,rt=me===be,Xt=rt?e:me,Ht=typeof Xt=="function"&&!h.O(Xt),qe,mn=Ze&&Ze.dataDependency;Ze&&Ze.exportDependencies?De():(qe=h.xb(De),qe.v(),qe.ja()?qe.equalityComparer=null:Ke[ie]=e)},h.fa.prototype.createChildContext=function(me,_e,Ve,Ie){if(!Ie&&_e&&typeof _e=="object"&&(Ie=_e,_e=Ie.as,Ve=Ie.extend),_e&&Ie&&Ie.noChildContext){var Ze=typeof me=="function"&&!h.O(me);return new h.fa(be,this,null,function(De){Ve&&Ve(De),De[_e]=Ze?me():me},Ie)}return new h.fa(me,this,_e,function(De,Ke){De.$parentContext=Ke,De.$parent=Ke.$data,De.$parents=(Ke.$parents||[]).slice(0),De.$parents.unshift(De.$parent),Ve&&Ve(De)},Ie)},h.fa.prototype.extend=function(me,_e){return new h.fa(be,this,null,function(Ve){h.a.extend(Ve,typeof me=="function"?me(Ve):me)},_e)};var Ce=h.a.g.Z();G.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},G.prototype.sd=function(me){h.a.Pa(this.kb,me),!this.kb.length&&this.H&&this.Cc()},G.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,h.a.K.yb(this.node,b),h.i.ma(this.node,h.i.pa),this.Tc())},h.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(me,_e,Ve,Ie,Ze){var De=h.a.g.Ub(me,Ce,{});return De.Fa||(De.Fa=new h.T),Ze&&Ze.notifyImmediately&&De.Zb[_e]&&h.u.G(Ve,Ie,[me]),De.Fa.subscribe(Ve,Ie,_e)},ma:function(me,_e){var Ve=h.a.g.get(me,Ce);if(Ve&&(Ve.Zb[_e]=!0,Ve.Fa&&Ve.Fa.notifySubscribers(me,_e),_e==h.i.H)){if(Ve.N)Ve.N.Cc();else if(Ve.N===e&&Ve.Fa&&Ve.Fa.Wa(h.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(me,_e){var Ve=h.a.g.Ub(me,Ce,{});return Ve.N||(Ve.N=new G(me,Ve,_e[j])),_e[j]==Ve?_e:_e.extend(function(Ie){Ie[j]=Ve})}},h.Td=function(me){return(me=h.a.g.get(me,Ce))&&me.context},h.ib=function(me,_e,Ve){return me.nodeType===1&&h.h.Sc(me),K(me,_e,Q(Ve))},h.ld=function(me,_e,Ve){return Ve=Q(Ve),h.ib(me,k(_e,Ve,me),Ve)},h.Oa=function(me,_e){_e.nodeType!==1&&_e.nodeType!==8||O(Q(me),_e)},h.vc=function(me,_e,Ve){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(_e=n.body,!_e)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!_e||_e.nodeType!==1&&_e.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");H(Q(me,Ve),_e)},h.Dc=function(me){return!me||me.nodeType!==1&&me.nodeType!==8?e:h.Td(me)},h.Ec=function(me){return(me=h.Dc(me))?me.$data:e},h.b("bindingHandlers",h.c),h.b("bindingEvent",h.i),h.b("bindingEvent.subscribe",h.i.subscribe),h.b("bindingEvent.startPossiblyAsyncContentBinding",h.i.Cb),h.b("applyBindings",h.vc),h.b("applyBindingsToDescendants",h.Oa),h.b("applyBindingAccessorsToNode",h.ib),h.b("applyBindingsToNode",h.ld),h.b("contextFor",h.Dc),h.b("dataFor",h.Ec)}(),function(b){function G(B,O){var H=Object.prototype.hasOwnProperty.call(A,B)?A[B]:b,U;H?H.subscribe(O):(H=A[B]=new h.T,H.subscribe(O),X(B,function(K,Q){var ie=!(!Q||!Q.synchronous);k[B]={definition:K,Gd:ie},delete A[B],U||ie?H.notifySubscribers(K):h.na.zb(function(){H.notifySubscribers(K)})}),U=!0)}function X(B,O){W("getConfig",[B],function(H){H?W("loadComponent",[B,H],function(U){O(U,H)}):O(null,null)})}function W(B,O,H,U){U||(U=h.j.loaders.slice(0));var K=U.shift();if(K){var Q=K[B];if(Q){var ie=!1;if(Q.apply(K,O.concat(function(j){ie?H(null):j!==null?H(j):W(B,O,H,U)}))!==b&&(ie=!0,!K.suppressLoaderExceptions))throw Er
* @license
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
* Copyright (c) Steve Sanderson
* MIT license
*/var Y6="__knockoutObservables",H6="__knockoutSubscribable";function LCe(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=ZCe(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===Y6||o===H6)&&!(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&&p1t(n,a)}}),e}function ZCe(e,t){var n=e[Y6];return!n&&t&&(n={},Object.defineProperty(e,Y6,{value:n})),n}function h1t(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),LCe.call(i,e,[t]),e}function p1t(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=b1t(e,t,i))})}function b1t(e,t,n){var i=y1t(e,n);return i.subscribe(t)}function y1t(e,t){var n=t[H6];if(!n){n=new e.subscribable,Object.defineProperty(t,H6,{value:n});var i={};g1t(t,n,i),x1t(e,t,n,i)}return n}function g1t(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 x1t(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 RCe(e,t){if(!e)return null;var n=ZCe(e,!1);return n&&n[t]||null}function _1t(e,t){var n=RCe(e,t);n&&n.valueHasMutated()}function T1t(e){e.track=LCe,e.getObservable=RCe,e.valueHasMutated=_1t,e.defineProperty=h1t}var dM={attachToKo:T1t};var Z2o=_(T(),1),GCe="http://www.w3.org/2000/svg",ECe="cesium-svgPath-svg",S1t={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){let i=document.createElementNS(GCe,"svg:svg");i.setAttribute("class",ECe);let o=document.createElementNS(GCe,"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",`${ECe} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},uM=S1t;dM.attachToKo(vS);uM.register(vS);var Se=vS;function mM(e){c(e)||(e=new _f),this._clock=e,this._eventHelper=new hr,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=Se.observable(ee.now()),this.systemTime.equalityComparer=ee.equals,this.startTime=Se.observable(e.startTime),this.startTime.equalityComparer=ee.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=Se.observable(e.stopTime),this.stopTime.equalityComparer=ee.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=Se.observable(e.currentTime),this.currentTime.equalityComparer=ee.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=Se.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=Se.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=Se.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=Se.observable(e.canAnimate),this.canAnimate.subscribe(f
${h}`:c(y)?y:h}),this.buttonImageUrl=void 0,Se.defineProperty(this,"buttonImageUrl",function(){let f=this.selectedImagery;if(c(f))return f.iconUrl}),this.selectedImagery=void 0;let l=Se.observable();this._currentImageryLayers=[],Se.defineProperty(this,"selectedImagery",{get:function(){return l()},set:function(f){if(l()===f){this.dropDownVisible=!1;return}let p,y=this._currentImageryLayers,h=y.length,g=this._globe.imageryLayers,x=!1;for(p=0;p<h;p++){let S=g.length;for(let V=0;V<S;V++){let Z=g.get(V);if(Z===y[p]){g.remove(Z),x=!0;break}}}if(c(f)){let S=f.creationCommand();if(Array.isArray(S)){let V=S.length;for(this._currentImageryLayers=[],p=V-1;p>=0;p--){let Z=Ya.fromProviderAsync(S[p]);g.add(Z,0),this._currentImageryLayers.push(Z)}}else{this._currentImageryLayers=[];let V=Ya.fromProviderAsync(S);if(V.name=f.name,x)g.add(V,0);else{let Z=g.get(0);c(Z)&&g.remove(Z),g.add(V,0)}this._currentImageryLayers.push(V)}}l(f),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;let d=Se.observable();Se.defineProperty(this,"selectedTerrain",{get:function(){return d()},set:function(f){if(d()===f){this.dropDownVisible=!1;return}let p;if(c(f)&&(p=f.creationCommand()),c(p)&&!c(p.then))this._globe.depthTestAgainstTerrain=!(p instanceof ep),this._globe.terrainProvider=p;else if(c(p)){let y=!1,h=this._globe.terrainProviderChanged.addEventListener(()=>{y=!0,h()}),x=new sM(p).readyEvent.addEventListener(S=>{y||(this._globe.depthTestAgainstTerrain=!(S instanceof ep),this._globe.terrainProvider=S,x())})}d(f),this.dropDownVisible=!1}});let u=this;this._toggleDropDown=Rn(function(){u.dropDownVisible=!u.dropDownVisible}),this.selectedImagery=e.selectedImageryProviderViewModel??n[0],this.selectedTerrain=e.selectedTerrainProviderViewModel}Object.defineProperties(vCe.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});var gM=vCe;function GB(e,t){if(!c(e))throw new L("container is required.");e=Wn(e);let n=new gM(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 l=document.createElement("div");l.className="cesium-baseLayerPicker-category",a.appendChild(l);let d=document.createElement("div");d.className="cesium-baseLayerPicker-categoryTitle",d.setAttribute("data-bind","text: name"),l.appendChild(d);let u=document.createElement("div");u.className="cesium-baseLayerPicker-choices",u.setAttribute("data-bind","foreach: providers"),l.appendChild(u);let f=document.createElement("div");f.className="cesium-baseLayerPicker-item",f.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),u.appendChild(f);let p=document.createElement("img");p.className="cesium-baseLayerPicker-itemIcon",p.setAttribute("data-bind","attr: { src: iconUrl }"),p.setAttribute("draggable","false"),f.appendChild(p);let y=document.createElement("div");y.className="cesium-baseLayerPicker-itemLabel",y.setAttribute("data-bind","text: name"),f.appendChild(y);let h=document.createElement("div");h.className="cesium-baseLayerPicker-sec
https://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9`,category:"Other",creationFunction:function(){return l0.fromBasemapType(Mf.SATELLITE,{enablePickFeatures:!1})}})),e.push(new ls({name:"ArcGIS World Hillshade",iconUrl:on("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png"),tooltip:`ArcGIS World Hillshade map portrays elevation as an artistic hillshade. This map is designed to be used as a backdrop for topographical, soil, hydro, landcover or other outdoor recreational maps. The map was compiled from a variety of sources from several data providers. The basemap has global coverage down to a scale of ~1:72k. In select areas of the United States and Europe, coverage is available down to ~1:9k. For more information on this map, including the terms of use, visit us online at
https://www.arcgis.com/home/item.html?id=1b243539f4514b6ba35e7d995890db1d`,category:"Other",creationFunction:function(){return l0.fromBasemapType(Mf.HILLSHADE,{enablePickFeatures:!1})}})),e.push(new ls({name:"Esri World Ocean",iconUrl:on("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png"),tooltip:`ArcGIS World Ocean map is designed to be used as a base map by marine GIS professionals and as a reference map by anyone interested in ocean data. The base map features marine bathymetry. Land features include inland waters and roads overlaid on land cover and shaded relief imagery. The map was compiled from a variety of best available sources from several data providers, including General Bathymetric Chart of the Oceans GEBCO_08 Grid, National Oceanic and Atmospheric Administration (NOAA), and National Geographic, Garmin, HERE, Geonames.org, and Esri, and various other contributors. The base map currently provides coverage for the world down to a scale of ~1:577k, and coverage down to 1:72k in US coastal areas, and various other areas. Coverage down to ~ 1:9k is available limited areas based on regional hydrographic survey data. The base map was designed and developed by Esri. For more information on this map, including our terms of use, visit us online at
https://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500`,category:"Other",creationFunction:function(){return l0.fromBasemapType(Mf.OCEANS,{enablePickFeatures:!1})}})),e.push(new ls({name:"Open\xADStreet\xADMap",iconUrl:on("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 I0({url:"https://tile.openstreetmap.org/"})}})),e.push(new ls({name:"Stadia x Stamen Watercolor",iconUrl:on("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and reminiscent of hand drawn maps, the watercolor maps from Stamen Design apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
https://docs.stadiamaps.com/map-styles/stamen-watercolor/`,category:"Other",creationFunction:function(){return new I0({url:"https://tiles.stadiamaps.com/tiles/stamen_watercolor/",fileExtension:"jpg",credit:`&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a>
&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
&copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ls({name:"Stadia x Stamen Toner",iconUrl:on("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and the most popular of the excellent styles from Stamen Design, these high-contrast B+W (black and white) maps are the perfect backdrop for your colorful and eye-catching overlays.
https://docs.stadiamaps.com/map-styles/stamen-toner/`,category:"Other",creationFunction:function(){return new I0({url:"https://tiles.stadiamaps.com/tiles/stamen_toner/",retinaTiles:t,credit:`&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a>
&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
&copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ls({name:"Stadia Alidade Smooth",iconUrl:on("Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png"),tooltip:`Stadia's custom Alidade Smooth style is designed for maps that use a lot of markers or overlays. It features a muted color scheme and fewer points of interest to allow your added data to shine.
https://docs.stadiamaps.com/map-styles/alidade-smooth/`,category:"Other",creationFunction:function(){return new I0({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth/",retinaTiles:t,credit:`&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
&copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ls({name:"Stadia Alidade Smooth Dark",iconUrl:on("Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png"),tooltip:`Stadia Alidade Smooth Dark, like its lighter cousin, is also designed to stay out of the way. It just flips the dark mode switch on the color scheme. With the lights out, your data can now literally shine.
https://docs.stadiamaps.com/map-styles/alidade-smooth-dark/`,category:"Other",creationFunction:function(){return new I0({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/",retinaTiles:t,credit:`&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
&copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ls({name:"Sentinel-2",iconUrl:on("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 d0.fromAssetId(3954)}})),e.push(new ls({name:"Blue Marble",iconUrl:on("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return d0.fromAssetId(3845)}})),e.push(new ls({name:"Earth at night",iconUrl:on("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 d0.fromAssetId(3812)}})),e.push(new ls({name:"Natural Earth\xA0II",iconUrl:on("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return Rg.fromUrl(on("Assets/Textures/NaturalEarthII"))}})),e}var _M=P1t;var Ivo=_(T(),1);function v1t(){let e=[];return e.push(new ls({name:"WGS84 Ellipsoid",iconUrl:on("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new ep({ellipsoid:re.WGS84})}})),e.push(new ls({name:"Cesium World Terrain",iconUrl:on("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 TS({requestWaterMask:!0,requestVertexNormals:!0})}})),e}var TM=v1t;var Uvo=_(T(),1);var vvo=_(T(),1);function F1t(e){return function(t){let n=e._scene.pick(t.position);c(n)&&n.primitive instanceof bs&&(e.tileset=n.primitive),e.pickActive=!1}}function MCe(e,t){t?e._eventHandler.setInputAction(function(n){let i=e._scene.pick(n.endPosition);c(i)&&i.primitive instanceof bs&&(e.tileset=i.primitive)},Vn.MOUSE_MOVE):(e._eventHandler.removeInputAction(Vn.MOUSE_MOVE),e.picking=e.picking)}var A1t={maximumFractionDigits:3};function SM(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,A1t):Math.round(t).toLocaleString()}function CM(e,t){if(!c(e))return"";let n=t?e._statisticsPerPass[Fo.PICK]:e._statisticsPerPass[Fo.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>${SM(n.geometryByteLength)}</li><li><strong>Texture Memory (MB): </strong>${SM(n.texturesByteLength)}</li><li><strong>Batch Table Memory (MB): </strong>${SM(n.batchTableByteLength)}</li>`,i+="</ul>"),i}function NCe(){let e=Ri.statistics;return`
<ul class="cesium-cesiumInspector-statistics">
<li><strong>Geometry Memory (MB): </strong>${SM(e.geometryByteLength)}</li>
<li><strong>Texture Memory (MB): </strong>${SM(e.texturesByteLength)}</li>
</ul>
`}var M1t=[{text:"Highlight",value:Wl.HIGHLIGHT},{text:"Replace",value:Wl.REPLACE},{text:"Mix",value:Wl.MIX}],ACe=new Y(1,1,0,.4),N1t=new Y,EB=new Y;function Ra(e,t){C.typeOf.object("scene",e),C.typeOf.object("performanceContainer",t);let n=this,i=e.canvas;this._eventHandler=new tu(i),this._scene=e,this._performanceContainer=t,this._canvas=i,this._performanceDisplay=new p0({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.hasEnabledWireframe=!1,this._tileset=void 0,this._feature=void 0,this._tile=void 0,Se.track(this,["performance","inspectorVisible","_statisticsText","_pickStatisticsText","_resourceCacheStatisticsText","_editorError","showPickStatistics","showStatistics","showResourceCacheStatistics","tilesetVisible","displayVisible","updateVisible","loggingVisible","styleVisible","optimizationVisible","tileDebugLabelsVisible","styleString","_feature","_tile","_tileset","hasEnabledWireframe"]),this._properties=Se.observable({}),this.properties=[],Se.defineProperty(this,"properties",function(){let U=[],K=n._properties();for(let Q in K)K.hasOwnProperty(Q)&&U.push(Q);return U});let o=Se.observable();Se.defineProperty(this,"dynamicScreenSpaceError",{get:function(){return o()},set:function(U){o(U),c(n._tileset)&&(n._tileset.dynamicScreenSpaceError=U)}}),this.dynamicScreenSpaceError=!1;let r=Se.observable();Se.defineProperty(this,"colorBlendMode",{get:function(){return r()},set:function(U){r(U),c(n._tileset)&&(n._tileset.colorBlendMode=U,n._scene.requestRender())}}),this.colorBlendMode=Wl.HIGHLIGHT;let s=Se.observable(),a=Se.observable();Se.defineProperty(this,"picking",{get:function(){return a()},set:function(U){a(U),U?n._eventHandler.setInputAction(function(K){let Q=e.pick(K.endPosition);if(Q instanceof Us?(n.feature=Q,n.tile=Q.content.tile):c(Q)&&c(Q.content)?(n.feature=void 0,n.tile=Q.content.tile):(n.feature=void 0,n.tile=void 0),!!c(n._tileset)){if(s&&c(Q)&&c(Q.content)){let ie;e.pickPositionSupported&&(ie=e.pickPosition(K.endPosition),c(ie)&&(n._tileset.debugPickPosition=ie)),n._tileset.debugPickedTile=Q.content.tile}else n._tileset.debugPickedTile=void 0;n._scene.requestRender()}},Vn.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction(Vn.MOUSE_MOVE))}}),this.picking=!0;let l=Se.observable();Se.defineProperty(this,"colorize",{get:function(){return l()},set:function(U){l(U),c(n._tileset)&&(n._tileset.debugColorizeTiles=U,n._scene.requestRender())}}),this.colorize=!1;let d=Se.observable();Se.defineProperty(this,"wireframe",{get:function(){return d()},set:function(U){d(U),c(n._tileset)&&(n._tileset.debugWireframe=U,n._scene.requestRender())}}),this.wireframe=!1;let u=Se.observable();Se.defineProperty(this,"showBoundingVolumes",{get:function(){return u()},set:function(U){u(U),c(n._tileset)&&(n._tileset.debugShowBoundingVolume=U,n._scene.requestRender())}}),this.showBoundingVolumes=!1;let f=Se.observable();Se.defineProperty(this,"showContentBoundingVolumes",{get:function(){return f()},set:function(U){f(U),c(n._tileset)&&(n._tileset.debugShowContentBoundingVolume=U,n._scene.requestRender())}}),this.showContentBoundingVolumes=!1;let p=Se.observable();Se.defineProperty(this,"showRequestVolumes",{get:function(){return p()},set:function(U){p(U),c(n._tileset)&&(n._tileset.debugShowViewerRequestVolume=U,n._scene.requestRender())}}),this.showRequestVolumes=!1;let y=Se.observable();Se.defineProperty(this,"freezeFrame",{get:function(){return y()},set:function(U){y(U),c(n._tileset)&&(n._tileset.debugFreezeFrame=U,n._scene.debugShowFrustumPlanes=U,n._scene.requestRender())}}),this.freezeFrame=!1,Se.defineProperty(this,"showOnlyPickedTileDebugLabel",{get:function(){return s()},set:function(U){s(U),c(n._tileset)&
`),l=a.length,d;if(t.shiftKey)for(d=0;d<l;++d)a[d][0]===" "&&(a[d][1]===" "?(a[d]=a[d].substr(2),r-=2):(a[d]=a[d].substr(1),r-=1));else for(d=0;d<l;++d)a[d]=` ${a[d]}`,r+=2;let u=a.join(`
`);n.value=n.value.slice(0,i)+u+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};Ra.prototype._update=function(){let e=this._tileset;if(this.performance&&this._performanceDisplay.update(),c(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=CM(e,!1),this._pickStatisticsText=CM(e,!0),this._resourceCacheStatisticsText=NCe())};Ra.prototype.isDestroyed=function(){return!1};Ra.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();let e=this;return this._definedProperties.forEach(function(t){Se.getObservable(e,t).dispose()}),he(this)};Ra.getStatistics=CM;var VM=Ra;function XB(e,t){C.defined("container",e),C.typeOf.object("scene",t),e=Wn(e);let n=document.createElement("div"),i=document.createElement("div");i.setAttribute("data-bind","visible: performance");let o=new VM(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");s.className="cesium-cesiumInspector-dropDown",n.appendChild(s);let a=sd.createSection,l=sd.createCheckbox,d=sd.createRangeInput,u=sd.createButton,f=a(s,"Tileset","tilesetVisible","toggleTileset"),p=a(s,"Display","displayVisible","toggleDisplay"),y=a(s,"Update","updateVisible","toggleUpdate"),h=a(s,"Logging","loggingVisible","toggleLogging"),g=a(s,"Tile Debug Labels","tileDebugLabelsVisible","toggleTileDebugLabels"),x=a(s,"Style","styleVisible","toggleStyle"),S=a(s,"Optimization","optimizationVisible","toggleOptimization"),V=document.createElement("div");V.className="field-group";let Z=document.createElement("label");Z.className="field-label",Z.appendChild(document.createTextNode("Properties: "));let R=document.createElement("div");R.setAttribute("data-bind","text: properties"),V.appendChild(Z),V.appendChild(R),f.appendChild(V),f.appendChild(u("Pick Tileset","togglePickTileset","pickActive")),f.appendChild(u("Trim Tiles Cache","trimTilesCache")),f.appendChild(l("Enable Picking","picking")),p.appendChild(l("Colorize","colorize"));let E=p.appendChild(l("Wireframe","wireframe","_tileset === undefined || hasEnabledWireframe")),I=document.createElement("p");I.setAttribute("data-bind","visible: _tileset !== undefined && !hasEnabledWireframe"),I.setAttribute("class","cesium-3DTilesInspector-disabledElementsInfo"),I.innerText="Set enableDebugWireframe to true in the tileset constructor to enable this option.",E.appendChild(I),p.appendChild(l("Bounding Volumes","showBoundingVolumes")),p.appendChild(l("Content Volumes","showContentBoundingVolumes")),p.appendChild(l("Request Volumes","showRequestVolumes")),p.appendChild(l("Point Cloud Shading","pointCloudShading"));let v=document.createElement("div");v.setAttribute("data-bind","visible: pointCloudShading"),v.appendChild(d("Geometric Error Scale","geometricErrorScale",0,2,.01)),v.appendChild(d("Maximum Attenuation","maximumAttenuation",0,32,1)),v.appendChild(d("Base Resolution","baseResolution",0,1,.01)),v.appendChild(l("Eye Dome Lighting (EDL)","eyeDomeLighting")),p.appendChild(v);let P=document.createElement("div");P.setAttribute("data-bind","visible: eyeDomeLighting"),P.appendChild(d("EDL Strength","eyeDomeLightingStrength",0,2,.1)),P.appendChild(d("EDL Radius","eyeDomeLightingRadius",0,4,.1)),v.appendChild(P),y.appendChild(l("Freeze Frame","freezeFrame")),y.appendChild(l("Dynamic Screen Space Error","dynamicScreenSpaceError"));let F=document.createElement("div");F.
<h3>Building explorer</h3>
<select
data-bind="options: topLayers, optionsText: 'name', optionsAfterRender: setOptionDisable, value: currentLayer"
></select>
<div id="bsl-wrapper">
<h3>Select Level</h3>
<select data-bind="options: levels, value: currentLevel"></select>
<h3>Disciplines & Categories</h3>
<ul class="layersList" data-bind="foreach: sublayers">
<ul class="layersList" data-bind="foreach: sublayers.sort(function (l, r) { return l.name.localeCompare(r.name) })">
<li>
<div class="li-wrapper">
<span
class="expandItem"
data-bind="click: $root.expandClickHandler"
>+</span
>
<input
type="checkbox"
data-bind="checked: visibility, valueUpdate: 'input', attr: { id: name}"
/>
<label data-bind="attr: { for: name}">
<span data-bind="text: name"></span>
</label>
</div>
<ul class="nested" data-bind="attr: { id: name + '-expander'}">
<li data-bind="foreach: sublayers.sort(function (l, r) { return l.name.localeCompare(r.name) })">
<div class="li-wrapper">
<input
type="checkbox"
data-bind="checked: visibility, valueUpdate: 'input', attr: { id: name}"
/>
<label data-bind="attr: { for: name}">
<span data-bind="text: name"></span>
</label>
</div>
</li>
</ul>
</li>
</ul>
</ul>
</div>`,n.appendChild(i);let o=new vM(t);Se.track(o),Se.applyBindings(o,n),c(o.defaultLayer)&&(o.currentLayer=o.defaultLayer)}var nq=oVt;var zFo=_(T(),1);var UFo=_(T(),1);var rVt="M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4853444 22.104033 11.423165 24.0625 13.84375 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 8.975298 28.305952 7.03125 25.875 7.03125 L 13.84375 7.03125 z",sVt="M 27.34375 1.65625 L 5.28125 27.9375 L 8.09375 30.3125 L 30.15625 4.03125 L 27.34375 1.65625 z M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4724893 20.232036 9.5676108 20.7379 9.75 21.21875 L 21.65625 7.03125 L 13.84375 7.03125 z M 28.21875 7.71875 L 14.53125 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 9.8371439 29.456025 8.4902779 28.21875 7.71875 z";function iq(){this._cameraClicked=new ye,this._closeClicked=new ye,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",Se.track(this,["showInfo","titleText","description","maxHeight","enableCamera","isCameraTracking"]),this._loadingIndicatorHtml='<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>',this.cameraIconPath=void 0,Se.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?sVt:rVt}}),Se.defineProperty(this,"_bodyless",{get:function(){return!c(this.description)||this.description.length===0}})}iq.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(iq.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});var FM=iq;function AB(e){C.defined("container",e),e=Wn(e);let t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);let n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);let i=document.createElement("button");i.type="button",i.className="cesium-button cesium-infoBox-camera",i.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),t.appendChild(i);let o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="&times;",t.appendChild(o);let r=document.createElement("iframe");r.className="cesium-infoBox-iframe",r.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),r.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),r.setAttribute("allowfullscreen",!0),t.appendChild(r);let s=new FM;Se.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;let a=this;r.addEventListener("load",function(){let l=r.contentDocument,d=l.createElement("link");d.href=on("Widgets/InfoBox/InfoBoxDescription.css"),d.rel="stylesheet",d.type="text/css";let u=l.createElement("div");u.className="cesium-infoBox-description",l.head.appendChild(d),l.body.appendChild(u),a._descriptionSubscription=Za(s,"description",function(f){r.style.height="5px",u.innerHTML=f;let p=null,y=u.firstElementChild;if(y!==null&&u.childNodes.length===1){let g=window.getComputedStyle(y);if(g!==null){let x=g["background-color"],S=Y.fromCssColorString(x);c(S)&&S.alpha!==0&&(p=g["background-color"])}}t.style["background-color"]=p;let h=u.getBoundingClientRect().height;r.style.height=`${h}px`})}),r.setAttribute("src","about:blank")}Object.definePropert
`),n;for(n=0;n<t.length&&!t[n].match(/\S/);n++);if(n===t.length)return"";let i="",o=/^\s*/,s=t[n].match(o)[0].length;for(let a=n;a<t.length;a++){let l=t[a];l.match(o)[0].length>=s&&(l=l.slice(s)),i+=`${l}
`}return i}function Vm(e){C.typeOf.object("scene",e),this._scene=e,this._voxelPrimitive=void 0,this._customShaderCompilationRemoveCallback=void 0,this._definedProperties=[],this._getPrimitiveFunctions=[],this._modelMatrixReady=!1;let t=this;function n(o){let{name:r,initialValue:s}=o;t._definedProperties.push(r);let a=o.setPrimitiveFunction;a===!0&&(a=function(u){t._voxelPrimitive[r]=u});let l=o.getPrimitiveFunction;l===!0&&(l=function(){t[r]=t._voxelPrimitive[r]}),c(l)&&t._getPrimitiveFunctions.push(l);let d=Se.observable();return Se.defineProperty(t,r,{get:function(){return d()},set:function(u){typeof s=="number"&&typeof u=="string"&&(u=Number(u),isNaN(u)&&(u=s)),typeof s=="boolean"&&typeof u=="number"&&(u=u===1),d(u),c(a)&&c(t._voxelPrimitive)&&(a(u),e.requestRender())}}),t[r]=s,d}function i(o,r){return function(s){let a=t._voxelPrimitive[o].clone();a[r]=s,t._voxelPrimitive[o]=a}}n({name:"inspectorVisible",initialValue:!0}),n({name:"displayVisible",initialValue:!1}),n({name:"transformVisible",initialValue:!1}),n({name:"boundsVisible",initialValue:!1}),n({name:"clippingVisible",initialValue:!1}),n({name:"shaderVisible",initialValue:!1}),n({name:"shaderString",initialValue:"",getPrimitiveFunction:function(){let o=t._voxelPrimitive.customShader.fragmentShaderText;t.shaderString=$Ce(o)}}),n({name:"shaderCompilationMessage",initialValue:""}),n({name:"shaderCompilationSuccess",initialValue:!0}),n({name:"depthTest",initialValue:!1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"show",initialValue:!0,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"disableUpdate",initialValue:!1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"debugDraw",initialValue:!1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"jitter",initialValue:!0,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"nearestSampling",initialValue:!0,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"screenSpaceError",initialValue:4,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"stepSize",initialValue:1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"shapeIsBox",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsBox=o===La.BOX}}),n({name:"shapeIsEllipsoid",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsEllipsoid=o===La.ELLIPSOID}}),n({name:"shapeIsCylinder",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsCylinder=o===La.CYLINDER}}),n({name:"clippingBoxMaxXMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMaxXMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingBoxMaxXMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMaxXMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingBoxMaxX",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingBoxMaxX=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingBoxMinXMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMinXMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingBoxMinXMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMinXMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingBoxMinX",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingBoxMinX=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingBoxMaxYMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMaxYMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingBoxMaxYMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMaxYMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingBoxMaxY",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingBoxMaxY=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingBoxMinYMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMinYMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingBoxMinYMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMinYMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingBoxMinY",initialValue:0,set
`),l=a.length,d;if(t.shiftKey)for(d=0;d<l;++d)a[d][0]===" "&&(a[d][1]===" "?(a[d]=a[d].substr(2),r-=2):(a[d]=a[d].substr(1),r-=1));else for(d=0;d<l;++d)a[d]=` ${a[d]}`,r+=2;let u=a.join(`
`);n.value=n.value.slice(0,i)+u+n.value.slice(o),n.selectionStart=i!==o?i:r,n.selectionEnd=r}else t.ctrlKey&&(t.keyCode===10||t.keyCode===13)&&this.compileShader();return!0};Vm.prototype.isDestroyed=function(){return!1};Vm.prototype.destroy=function(){let e=this;return this._definedProperties.forEach(function(t){Se.getObservable(e,t).dispose()}),he(this)};var qM=Vm;function HB(e,t){C.defined("container",e),C.typeOf.object("scene",t),e=Wn(e);let n=document.createElement("div"),i=new qM(t);this._viewModel=i,this._container=e,this._element=n;let o=document.createElement("div");o.textContent="Voxel Inspector",o.className="cesium-cesiumInspector-button",o.setAttribute("data-bind","click: toggleInspector"),n.appendChild(o),n.className="cesium-cesiumInspector cesium-VoxelInspector",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'),e.appendChild(n);let r=document.createElement("div");r.className="cesium-cesiumInspector-dropDown",n.appendChild(r);let{createSection:s,createCheckbox:a,createRangeInput:l,createButton:d}=sd,u=s(r,"Display","displayVisible","toggleDisplay"),f=s(r,"Transform","transformVisible","toggleTransform"),p=s(r,"Clipping","clippingVisible","toggleClipping"),y=s(r,"Shader","shaderVisible","toggleShader");u.appendChild(a("Depth Test","depthTest")),u.appendChild(a("Show","show")),u.appendChild(a("Disable Update","disableUpdate")),u.appendChild(a("Debug Draw","debugDraw")),u.appendChild(a("Jitter","jitter")),u.appendChild(a("Nearest Sampling","nearestSampling")),u.appendChild(l("Screen Space Error","screenSpaceError",0,128)),u.appendChild(l("Step Size","stepSize",0,2));let h=10,g=10,x=w.PI;f.appendChild(l("Translation X","translationX",-h,+h)),f.appendChild(l("Translation Y","translationY",-h,+h)),f.appendChild(l("Translation Z","translationZ",-h,+h)),f.appendChild(l("Scale X","scaleX",0,+g)),f.appendChild(l("Scale Y","scaleY",0,+g)),f.appendChild(l("Scale Z","scaleZ",0,+g)),f.appendChild(l("Heading","angleX",-x,+x)),f.appendChild(l("Pitch","angleY",-x,+x)),f.appendChild(l("Roll","angleZ",-x,+x)),aq("Max X","Min X","Max Y","Min Y","Max Z","Min Z","clippingBoxMaxX","clippingBoxMinX","clippingBoxMaxY","clippingBoxMinY","clippingBoxMaxZ","clippingBoxMinZ","shapeIsBox",p),aq("Max Longitude","Min Longitude","Max Latitude","Min Latitude","Max Height","Min Height","clippingEllipsoidMaxLongitude","clippingEllipsoidMinLongitude","clippingEllipsoidMaxLatitude","clippingEllipsoidMinLatitude","clippingEllipsoidMaxHeight","clippingEllipsoidMinHeight","shapeIsEllipsoid",p),aq("Max Radius","Min Radius","Max Angle","Min Angle","Max Height","Min Height","clippingCylinderMaxRadius","clippingCylinderMinRadius","clippingCylinderMaxAngle","clippingCylinderMinAngle","clippingCylinderMaxHeight","clippingCylinderMinHeight","shapeIsCylinder",p);let S=document.createElement("div");y.appendChild(S);let V=document.createElement("textarea");V.setAttribute("data-bind","textInput: shaderString, event: { keydown: shaderEditorKeyPress }"),S.className="cesium-cesiumInspector-styleEditor",S.appendChild(V);let Z=d("Compile (Ctrl+Enter)","compileShader");S.appendChild(Z);let R=document.createElement("label");R.style.display="block",R.setAttribute("data-bind","text: shaderCompilationMessage, style: {color: shaderCompilationSuccess ? 'green' : 'red'}"),S.appendChild(R),Se.applyBindings(i,n)}Object.defineProperties(HB.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});HB.prototype.isDestroyed=function(){return!1};HB.prototype.destroy=function(){return Se.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),he(this)};function aq(e,t,n,i,o,r,s,a,l,d,u,f,p,y){let h=sd.createRangeInputWithDynamicMinMax,g=y.appendChild(document.createElement("div"));g.setAttribute("data-bind",`if: ${p}`),g.appendChild(h(e,s)),g.appendChild(h(t,a)),g.appendChild(h(n,l)),g.appendChild(h(i,d)),g.appendChild(h(o,u)),g.appendChild(h(r,f))}var $M=HB;var S9o=_(T(),1);var y9o=_(T(),1);var
//# sourceMappingURL=Cesium.js.map