3882 lines
4.5 MiB
JavaScript
3882 lines
4.5 MiB
JavaScript
|
/**
|
|||
|
* plotly.js v3.1.0
|
|||
|
* Copyright 2012-2025, Plotly, Inc.
|
|||
|
* All rights reserved.
|
|||
|
* Licensed under the MIT license
|
|||
|
*/
|
|||
|
(
|
|||
|
function(root, factory) {
|
|||
|
if (typeof module === "object" && module.exports) {
|
|||
|
module.exports = factory();
|
|||
|
} else {
|
|||
|
root.moduleName = factory();
|
|||
|
}
|
|||
|
} (typeof self !== "undefined" ? self : this, () => {
|
|||
|
"use strict";var Plotly=(()=>{var Uet=Object.create;var ES=Object.defineProperty,Vet=Object.defineProperties,Get=Object.getOwnPropertyDescriptor,Het=Object.getOwnPropertyDescriptors,jet=Object.getOwnPropertyNames,aee=Object.getOwnPropertySymbols,Wet=Object.getPrototypeOf,see=Object.prototype.hasOwnProperty,Xet=Object.prototype.propertyIsEnumerable;var oee=(e,t,r)=>t in e?ES(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lee=(e,t)=>{for(var r in t||(t={}))see.call(t,r)&&oee(e,r,t[r]);if(aee)for(var r of aee(t))Xet.call(t,r)&&oee(e,r,t[r]);return e},uee=(e,t)=>Vet(e,Het(t));var ru=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cee=(e,t)=>{for(var r in t)ES(e,r,{get:t[r],enumerable:!0})},fee=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jet(t))!see.call(e,i)&&i!==r&&ES(e,i,{get:()=>t[i],enumerable:!(n=Get(t,i))||n.enumerable});return e};var Zet=(e,t,r)=>(r=e!=null?Uet(Wet(e)):{},fee(t||!e||!e.__esModule?ES(r,"default",{value:e,enumerable:!0}):r,e)),B1=e=>fee(ES({},"__esModule",{value:!0}),e);var o6=ye(hee=>{"use strict";hee.version="3.1.0"});var vee=ye((dee,s6)=>{(function(t,r,n){r[t]=r[t]||n(),typeof s6!="undefined"&&s6.exports&&(s6.exports=r[t])})("Promise",typeof window!="undefined"?window:dee,function(){"use strict";var t,r,n,i=Object.prototype.toString,a=typeof setImmediate!="undefined"?function(C){return setImmediate(C)}:setTimeout;try{Object.defineProperty({},"x",{}),t=function(C,E,A,L){return Object.defineProperty(C,E,{value:A,writable:!0,configurable:L!==!1})}}catch(p){t=function(E,A,L){return E[A]=L,E}}n=function(){var C,E,A;function L(_,k){this.fn=_,this.self=k,this.next=void 0}return{add:function(k,M){A=new L(k,M),E?E.next=A:C=A,E=A,A=void 0},drain:function(){var k=C;for(C=E=r=void 0;k;)k.fn.call(k.self),k=k.next}}}();function o(p,C){n.add(p,C),r||(r=a(n.drain))}function s(p){var C,E=typeof p;return p!=null&&(E=="object"||E=="function")&&(C=p.then),typeof C=="function"?C:!1}function l(){for(var p=0;p<this.chain.length;p++)u(this,this.state===1?this.chain[p].success:this.chain[p].failure,this.chain[p]);this.chain.length=0}function u(p,C,E){var A,L;try{C===!1?E.reject(p.msg):(C===!0?A=p.msg:A=C.call(void 0,p.msg),A===E.promise?E.reject(TypeError("Promise-chain cycle")):(L=s(A))?L.call(A,E.resolve,E.reject):E.resolve(A))}catch(_){E.reject(_)}}function c(p){var C,E=this;if(!E.triggered){E.triggered=!0,E.def&&(E=E.def);try{(C=s(p))?o(function(){var A=new d(E);try{C.call(p,function(){c.apply(A,arguments)},function(){f.apply(A,arguments)})}catch(L){f.call(A,L)}}):(E.msg=p,E.state=1,E.chain.length>0&&o(l,E))}catch(A){f.call(new d(E),A)}}}function f(p){var C=this;C.triggered||(C.triggered=!0,C.def&&(C=C.def),C.msg=p,C.state=2,C.chain.length>0&&o(l,C))}function h(p,C,E,A){for(var L=0;L<C.length;L++)(function(k){p.resolve(C[k]).then(function(g){E(k,g)},A)})(L)}function d(p){this.def=p,this.triggered=!1}function v(p){this.promise=p,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function x(p){if(typeof p!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var C=new v(this);this.then=function(A,L){var _={success:typeof A=="function"?A:!0,failure:typeof L=="function"?L:!1};return _.promise=new this.constructor(function(M,g){if(typeof M!="function"||typeof g!="function")throw TypeError("Not a function");_.resolve=M,_.reject=g}),C.chain.push(_),C.state!==0&&o(l,C),_.promise},this.catch=function(A){return this.then(void 0,A)};try{p.call(void 0,function(A){c.call(C,A)},function(A){f.call(C,A)})}catch(E){f.call(C,E)}}var b=t({},"constructor",x,!1);return x.prototype=b,t(b,"__NPO__",0,!1),t(x,"resolve",function(C){var E=this;return C&&typeof C=="object"&&C.__NPO__===1?C:new E(function(L,_){if(typeof L!="function"||typeof _!="function")throw TypeError("Not a function");L(C)})}),t(x,"reject",function(C){return new this(function(A,L){if(typeof A!="function"||typeof L!="function")throw TypeError("Not a function");L(C)})}),t(x,"all",function(C){var E=this;return i.call(C)!="[
|
|||
|
]`),Ne=X.charCodeAt(0);function He(gr,yr,Gr){arguments.length<3&&(Gr=yr,yr=null);var qr=Sn(gr,se,yr==null?Ye:Ct(yr),Gr);return qr.row=function(_i){return arguments.length?qr.response((yr=_i)==null?Ye:Ct(_i)):yr},qr}function Ye(gr){return He.parse(gr.responseText)}function Ct(gr){return function(yr){return He.parse(yr.responseText,gr)}}He.parse=function(gr,yr){var Gr;return He.parseRows(gr,function(qr,_i){if(Gr)return Gr(qr,_i-1);var bi=function(Xr){for(var ni={},gi=qr.length,Pi=0;Pi<gi;++Pi)ni[qr[Pi]]=Xr[Pi];return ni};Gr=yr?function(Xr,ni){return yr(bi(Xr),ni)}:bi})},He.parseRows=function(gr,yr){var Gr={},qr={},_i=[],bi=gr.length,Xr=0,ni=0,gi,Pi;function Ai(){if(Xr>=bi)return qr;if(Pi)return Pi=!1,Gr;var Rn=Xr;if(gr.charCodeAt(Rn)===34){for(var Cn=Rn;Cn++<bi;)if(gr.charCodeAt(Cn)===34){if(gr.charCodeAt(Cn+1)!==34)break;++Cn}Xr=Cn+2;var Nn=gr.charCodeAt(Cn+1);return Nn===13?(Pi=!0,gr.charCodeAt(Cn+2)===10&&++Xr):Nn===10&&(Pi=!0),gr.slice(Rn+1,Cn).replace(/""/g,'"')}for(;Xr<bi;){var Nn=gr.charCodeAt(Xr++),ia=1;if(Nn===10)Pi=!0;else if(Nn===13)Pi=!0,gr.charCodeAt(Xr)===10&&(++Xr,++ia);else if(Nn!==Ne)continue;return gr.slice(Rn,Xr-ia)}return gr.slice(Rn)}for(;(gi=Ai())!==qr;){for(var ti=[];gi!==Gr&&gi!==qr;)ti.push(gi),gi=Ai();yr&&(ti=yr(ti,ni++))==null||_i.push(ti)}return _i},He.format=function(gr){if(Array.isArray(gr[0]))return He.formatRows(gr);var yr=new V,Gr=[];return gr.forEach(function(qr){for(var _i in qr)yr.has(_i)||Gr.push(yr.add(_i))}),[Gr.map(jt).join(X)].concat(gr.map(function(qr){return Gr.map(function(_i){return jt(qr[_i])}).join(X)})).join(`
|
|||
|
`)},He.formatRows=function(gr){return gr.map(nt).join(`
|
|||
|
`)};function nt(gr){return gr.map(jt).join(X)}function jt(gr){return Te.test(gr)?'"'+gr.replace(/\"/g,'""')+'"':gr}return He},e.csv=e.dsv(",","text/csv"),e.tsv=e.dsv(" ","text/tab-separated-values");var _n,ya,Jn,Ma,_o=this[H(this,"requestAnimationFrame")]||function(X){setTimeout(X,17)};e.timer=function(){No.apply(this,arguments)};function No(X,se,Te){var Ne=arguments.length;Ne<2&&(se=0),Ne<3&&(Te=Date.now());var He=Te+se,Ye={c:X,t:He,n:null};return ya?ya.n=Ye:_n=Ye,ya=Ye,Jn||(Ma=clearTimeout(Ma),Jn=1,_o(po)),Ye}function po(){var X=Lo(),se=Co()-X;se>24?(isFinite(se)&&(clearTimeout(Ma),Ma=setTimeout(po,se)),Jn=0):(Jn=1,_o(po))}e.timer.flush=function(){Lo(),Co()};function Lo(){for(var X=Date.now(),se=_n;se;)X>=se.t&&se.c(X-se.t)&&(se.c=null),se=se.n;return X}function Co(){for(var X,se=_n,Te=1/0;se;)se.c?(se.t<Te&&(Te=se.t),se=(X=se).n):se=X?X.n=se.n:_n=se.n;return ya=X,Te}e.round=function(X,se){return se?Math.round(X*(se=Math.pow(10,se)))/se:Math.round(X)},e.geom={};function Fs(X){return X[0]}function zs(X){return X[1]}e.geom.hull=function(X){var se=Fs,Te=zs;if(arguments.length)return Ne(X);function Ne(He){if(He.length<3)return[];var Ye=pi(se),Ct=pi(Te),nt,jt=He.length,gr=[],yr=[];for(nt=0;nt<jt;nt++)gr.push([+Ye.call(this,He[nt],nt),+Ct.call(this,He[nt],nt),nt]);for(gr.sort(cl),nt=0;nt<jt;nt++)yr.push([gr[nt][0],-gr[nt][1]]);var Gr=ul(gr),qr=ul(yr),_i=qr[0]===Gr[0],bi=qr[qr.length-1]===Gr[Gr.length-1],Xr=[];for(nt=Gr.length-1;nt>=0;--nt)Xr.push(He[gr[Gr[nt]][2]]);for(nt=+_i;nt<qr.length-bi;++nt)Xr.push(He[gr[qr[nt]][2]]);return Xr}return Ne.x=function(He){return arguments.length?(se=He,Ne):se},Ne.y=function(He){return arguments.length?(Te=He,Ne):Te},Ne};function ul(X){for(var se=X.length,Te=[0,1],Ne=2,He=2;He<se;He++){for(;Ne>1&&ir(X[Te[Ne-2]],X[Te[Ne-1]],X[He])<=0;)--Ne;Te[Ne++]=He}return Te.slice(0,Ne)}function cl(X,se){return X[0]-se[0]||X[1]-se[1]}e.geom.polygon=function(X){return ie(X,Fl),X};var Fl=e.geom.polygon.prototype=[];Fl.area=function(){for(var X=-1,se=this.length,Te,Ne=this[se-1],He=0;++X<se;)Te=Ne,Ne=this[X],He+=Te[1]*Ne[0]-Te[0]*Ne[1];return He*.5},Fl.centroid=function(X){var se=-1,Te=this.length,Ne=0,He=0,Ye,Ct=this[Te-1],nt;for(arguments.length||(X=-1/(6*this.area()));++se<Te;)Ye=Ct,Ct=this[se],nt=Ye[0]*Ct[1]-Ct[0]*Ye[1],Ne+=(Ye[0]+Ct[0])*nt,He+=(Ye[1]+Ct[1])*nt;return[Ne*X,He*X]},Fl.clip=function(X){for(var se,Te=Ss(X),Ne=-1,He=this.length-Ss(this),Ye,Ct,nt=this[He-1],jt,gr,yr;++Ne<He;){for(se=X.slice(),X.length=0,jt=this[Ne],gr=se[(Ct=se.length-Te)-1],Ye=-1;++Ye<Ct;)yr=se[Ye],cs(yr,nt,jt)?(cs(gr,nt,jt)||X.push(nl(gr,yr,nt,jt)),X.push(yr)):cs(gr,nt,jt)&&X.push(nl(gr,yr,nt,jt)),gr=yr;Te&&X.push(X[0]),nt=jt}return X};function cs(X,se,Te){return(Te[0]-se[0])*(X[1]-se[1])<(Te[1]-se[1])*(X[0]-se[0])}function nl(X,se,Te,Ne){var He=X[0],Ye=Te[0],Ct=se[0]-He,nt=Ne[0]-Ye,jt=X[1],gr=Te[1],yr=se[1]-jt,Gr=Ne[1]-gr,qr=(nt*(jt-gr)-Gr*(He-Ye))/(Gr*Ct-nt*yr);return[He+qr*Ct,jt+qr*yr]}function Ss(X){var se=X[0],Te=X[X.length-1];return!(se[0]-Te[0]||se[1]-Te[1])}var fl,Js,Os,Io=[],us,Zl,Su=[];function nc(){qs(this),this.edge=this.site=this.circle=null}function ws(X){var se=Io.pop()||new nc;return se.site=X,se}function Fn(X){Oo(X),Os.remove(X),Io.push(X),qs(X)}function _a(X){var se=X.circle,Te=se.x,Ne=se.cy,He={x:Te,y:Ne},Ye=X.P,Ct=X.N,nt=[X];Fn(X);for(var jt=Ye;jt.circle&&p(Te-jt.circle.x)<Je&&p(Ne-jt.circle.cy)<Je;)Ye=jt.P,nt.unshift(jt),Fn(jt),jt=Ye;nt.unshift(jt),Oo(jt);for(var gr=Ct;gr.circle&&p(Te-gr.circle.x)<Je&&p(Ne-gr.circle.cy)<Je;)Ct=gr.N,nt.push(gr),Fn(gr),gr=Ct;nt.push(gr),Oo(gr);var yr=nt.length,Gr;for(Gr=1;Gr<yr;++Gr)gr=nt[Gr],jt=nt[Gr-1],ml(gr.edge,jt.site,gr.site,He);jt=nt[0],gr=nt[yr-1],gr.edge=rf(jt.site,gr.site,null,He),aa(jt),aa(gr)}function Vu(X){for(var se=X.x,Te=X.y,Ne,He,Ye,Ct,nt=Os._;nt;)if(Ye=zl(nt,Te)-se,Ye>Je)nt=nt.L;else if(Ct=se-xo(nt,Te),Ct>Je){if(!nt.R){Ne=nt;break}nt=nt.R}else{Ye>-Je?(Ne=nt.P,He=nt):Ct>-Je?(Ne=nt,He=nt.N):Ne=He=nt;break}var jt=ws(X);if(Os.insert(Ne,jt),!(!Ne&&!He)){if(Ne===He){Oo(Ne),He=ws(Ne.site),Os.insert(jt,He),jt.edge=He.edge=rf(Ne.site,jt.site),aa(Ne),aa(He);return
|
|||
|
`+a.year;else return oit(e,r)+`
|
|||
|
`+lie(a.dayMonthYear,e,n,i);return lie(t,e,n,i)};var uie=3*bp;hh.incrementMonth=function(e,t,r){r=yy(r)&&r;var n=Z1(e,bp);if(e=Math.round(e-n),r)try{var i=Math.round(e/bp)+US,a=my.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return t%12?a.add(o,t,"m"):a.add(o,t/12,"y"),(o.toJD()-US)*bp+n}catch(l){NO.error("invalid ms "+e+" in calendar "+r)}var s=new Date(e+uie);return s.setUTCMonth(s.getUTCMonth()+t)+n-uie};hh.findExactDates=function(e,t){for(var r=0,n=0,i=0,a=0,o,s,l=yy(t)&&my.getComponentMethod("calendars","getCal")(t),u=0;u<e.length;u++){if(s=e[u],!cie(s)){a++;continue}if(!(s%bp))if(l)try{o=l.fromJD(s/bp+US),o.day()===1?o.month()===1?r++:n++:i++}catch(f){}else o=new Date(s),o.getUTCDate()===1?o.getUTCMonth()===0?r++:n++:i++}n+=r,i+=n;var c=e.length-a;return{exactYears:r/c,exactMonths:n/c,exactDays:i/c}}});var VS=ye((Err,die)=>{"use strict";die.exports=function(t){return t}});var P6=ye(_y=>{"use strict";var sit=Eo(),lit=H1(),uit=VS(),cit=hs().BADNUM,UO=1e-9;_y.findBin=function(e,t,r){if(sit(t.start))return r?Math.ceil((e-t.start)/t.size-UO)-1:Math.floor((e-t.start)/t.size+UO);var n=0,i=t.length,a=0,o=i>1?(t[i-1]-t[0])/(i-1):1,s,l;for(o>=0?l=r?fit:hit:l=r?vit:dit,e+=o*UO*(r?-1:1)*(o>=0?1:-1);n<i&&a++<100;)s=Math.floor((n+i)/2),l(t[s],e)?n=s+1:i=s;return a>90&&lit.log("Long binary search..."),n-1};function fit(e,t){return e<t}function hit(e,t){return e<=t}function dit(e,t){return e>t}function vit(e,t){return e>=t}_y.sorterAsc=function(e,t){return e-t};_y.sorterDes=function(e,t){return t-e};_y.distinctVals=function(e){var t=e.slice();t.sort(_y.sorterAsc);var r;for(r=t.length-1;r>-1&&t[r]===cit;r--);for(var n=t[r]-t[0]||1,i=n/(r||1)/1e4,a=[],o,s=0;s<=r;s++){var l=t[s],u=l-o;o===void 0?(a.push(l),o=l):u>i&&(n=Math.min(n,u),a.push(l),o=l)}return{vals:a,minDiff:n}};_y.roundUp=function(e,t,r){for(var n=0,i=t.length-1,a,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;n<i&&o++<100;)a=u((n+i)/2),t[a]<=e?n=a+s:i=a-l;return t[n]};_y.sort=function(e,t){for(var r=0,n=0,i=1;i<e.length;i++){var a=t(e[i],e[i-1]);if(a<0?r=1:a>0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()};_y.findIndexOfMin=function(e,t){t=t||uit;for(var r=1/0,n,i=0;i<e.length;i++){var a=t(e[i]);a<r&&(r=a,n=i)}return n}});var Y1=ye((krr,vie)=>{"use strict";vie.exports=function(t){return Object.keys(t).sort()}});var pie=ye(dh=>{"use strict";var GS=Eo(),pit=vv().isArrayOrTypedArray;dh.aggNums=function(e,t,r,n){var i,a;if((!n||n>r.length)&&(n=r.length),GS(t)||(t=!1),pit(r[0])){for(a=new Array(n),i=0;i<n;i++)a[i]=dh.aggNums(e,t,r[i]);r=a}for(i=0;i<n;i++)GS(t)?GS(r[i])&&(t=e(+t,+r[i])):t=r[i];return t};dh.len=function(e){return dh.aggNums(function(t){return t+1},0,e)};dh.mean=function(e,t){return t||(t=dh.len(e)),dh.aggNums(function(r,n){return r+n},0,e)/t};dh.geometricMean=function(e,t){return t||(t=dh.len(e)),Math.pow(dh.aggNums(function(r,n){return r*n},1,e),1/t)};dh.midRange=function(e){if(!(e===void 0||e.length===0))return(dh.aggNums(Math.max,null,e)+dh.aggNums(Math.min,null,e))/2};dh.variance=function(e,t,r){return t||(t=dh.len(e)),GS(r)||(r=dh.mean(e,t)),dh.aggNums(function(n,i){return n+Math.pow(i-r,2)},0,e)/t};dh.stdev=function(e,t,r){return Math.sqrt(dh.variance(e,t,r))};dh.median=function(e){var t=e.slice().sort();return dh.interp(t,.5)};dh.interp=function(e,t){if(!GS(t))throw"n should be a finite number";if(t=t*e.length-.5,t<0)return e[0];if(t>e.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}});var xie=ye((Prr,_ie)=>{"use strict";var gie=r3(),VO=gie.mod,git=gie.modHalf,HS=Math.PI,K1=2*HS;function mit(e){return e/180*HS}function yit(e){return e/HS*180}function GO(e){return Math.abs(e[1]-e[0])>K1-1e-14}function mie(e,t){return git(t-e,K1)}function _it(e,t){return Math.abs(mie(e,t))}function yie(e,t){if(GO(t))return!0;var r,n;t[0]<t[1]?(r=t[0],n=t[1]):(r=t[1],n=t[0]),r=VO(r,K1),n=VO(n,K1),r>n&&(n+=K1);var i=VO(e,K1),a=i+K1;return i>=r&&i<=n||a>=r&&a<=n}function xit(e,t,r,n){if(!yie(t,n))return!1;var i,a;return r[0]<r[1]?(i=r[0],a=r[1]):(i=r[1],a=r[0]),e>=i&&e<=a}function HO(e,t,r,n,i,a,o){i=i||0,a=a||0;var s=
|
|||
|
`);if(l!==-1&&(s=o.substr(l+1),o=o.substr(0,l)),n&&(s!==void 0&&(o==="00:00:00"||o==="00:00")?(o=s,s=""):o.length===8&&(o=o.replace(/:00$/,""))),s)if(r)i==="d"?o+=", "+s:o=s+(o?", "+o:"");else if(!e._inCalcTicks||e._prevDateHead!==s)e._prevDateHead=s,o+="<br>"+s;else{var u=lM(e),c=e._trueSide||e.side;(!u&&c==="top"||u&&c==="bottom")&&(o+="<br> ")}t.text=o}function Cst(e,t,r,n,i){var a=e.dtick,o=t.x,s=e.tickformat,l=typeof a=="string"&&a.charAt(0);if(i==="never"&&(i=""),n&&l!=="L"&&(a="L3",l="L"),s||l==="L")t.text=sM(Math.pow(10,o),e,i,n);else if(kh(a)||l==="D"&&(e.minorloglabels==="complete"||Jo.mod(o+.01,1)<.1)){var u;e.minorloglabels==="complete"&&!(Jo.mod(o+.01,1)<.1)&&(u=!0,t.fontSize*=.75);var c=Math.pow(10,o).toExponential(0),f=c.split("e"),h=+f[1],d=Math.abs(h),v=e.exponentformat;v==="power"||ML(v)&&hB(h)?(t.text=f[0],d>0&&(t.text+="x10"),t.text==="1x10"&&(t.text="10"),h!==0&&h!==1&&(t.text+="<sup>"+(h>0?"":Cb)+d+"</sup>"),t.fontSize*=1.25):(v==="e"||v==="E")&&d>2?t.text=f[0]+v+(h>0?"+":Cb)+d:(t.text=sM(Math.pow(10,o),e,"","fakehover"),a==="D1"&&e._id.charAt(0)==="y"&&(t.dy-=t.fontSize/6))}else if(l==="D")t.text=e.minorloglabels==="none"?"":String(Math.round(Math.pow(10,Jo.mod(o,1)))),t.fontSize*=.75;else throw"unrecognized dtick "+String(a);if(e.dtick==="D1"){var x=String(t.text).charAt(0);(x==="0"||x==="1")&&(e._id.charAt(0)==="y"?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(o<0?.5:.25)))}}function kst(e,t){var r=e._categories[Math.round(t.x)];r===void 0&&(r=""),t.text=String(r)}function Lst(e,t,r){var n=Math.round(t.x),i=e._categories[n]||[],a=i[1]===void 0?"":String(i[1]),o=i[0]===void 0?"":String(i[0]);r?t.text=o+" - "+a:(t.text=a,t.text2=o)}function Pst(e,t,r,n,i){i==="never"?i="":e.showexponent==="all"&&Math.abs(t.x/e.dtick)<1e-6&&(i="hide"),t.text=sM(t.x,e,i,n)}function Ist(e,t,r,n,i){if(e.thetaunit==="radians"&&!r){var a=t.x/180;if(a===0)t.text="0";else{var o=Rst(a);if(o[1]>=100)t.text=sM(Jo.deg2rad(t.x),e,i,n);else{var s=t.x<0;o[1]===1?o[0]===1?t.text="\u03C0":t.text=o[0]+"\u03C0":t.text=["<sup>",o[0],"</sup>","\u2044","<sub>",o[1],"</sub>","\u03C0"].join(""),s&&(t.text=Cb+t.text)}}}else t.text=sM(t.x,e,i,n)}function Rst(e){function t(s,l){return Math.abs(s-l)<=1e-6}function r(s,l){return t(l,0)?s:r(l,s%l)}function n(s){for(var l=1;!t(Math.round(s*l)/l,s);)l*=10;return l}var i=n(e),a=e*i,o=Math.abs(r(a,i));return[Math.round(a/o),Math.round(i/o)]}var Dst=["f","p","n","\u03BC","m","","k","M","G","T"];function ML(e){return e==="SI"||e==="B"}function hB(e){return e>14||e<-15}function sM(e,t,r,n){var i=e<0,a=t._tickround,o=r||t.exponentformat||"B",s=t._tickexponent,l=Qn.getTickFormat(t),u=t.separatethousands;if(n){var c={exponentformat:o,minexponent:t.minexponent,dtick:t.showexponent==="none"?t.dtick:kh(e)&&Math.abs(e)||1,range:t.showexponent==="none"?t.range.map(t.r2d):[0,e||1]};Cse(c),a=(Number(c._tickround)||0)+4,s=c._tickexponent,t.hoverformat&&(l=t.hoverformat)}if(l)return t._numFormat(l)(e).replace(/-/g,Cb);var f=Math.pow(10,-a)/2;if(o==="none"&&(s=0),e=Math.abs(e),e<f)e="0",i=!1;else{if(e+=f,s&&(e*=Math.pow(10,-s),a+=s),a===0)e=String(Math.floor(e));else if(a<0){e=String(Math.round(e)),e=e.substr(0,e.length+a);for(var h=a;h<0;h++)e+="0"}else{e=String(e);var d=e.indexOf(".")+1;d&&(e=e.substr(0,d+a).replace(/\.?0+$/,""))}e=Jo.numSeparate(e,t._separators,u)}if(s&&o!=="hide"){ML(o)&&hB(s)&&(o="power");var v;s<0?v=Cb+-s:o!=="power"?v="+"+s:v=String(s),o==="e"||o==="E"?e+=o+v:o==="power"?e+="\xD710<sup>"+v+"</sup>":o==="B"&&s===9?e+="B":ML(o)&&(e+=Dst[s/3+5])}return i?Cb+e:e}Qn.getTickFormat=function(e){var t;function r(l){return typeof l!="string"?l:Number(l.replace("M",""))*R3}function n(l,u){var c=["L","D"];if(typeof l==typeof u){if(typeof l=="number")return l-u;var f=c.indexOf(l.charAt(0)),h=c.indexOf(u.charAt(0));return f===h?Number(l.replace(/(L|D)/g,""))-Number(u.replace(/(L|D)/g,"")):f-h}else return typeof l=="number"?1:-1}function i(l,u,c){var f=c||function(v){return v},h=u[0],d=u[1];return(!h&&typeof h!="number"||f(h)<=f(l))&&(!d&&typeof d!="number"||f(d)>=
|
|||
|
`));var ke;L.med!==i0?ke=L.med:L.q1!==i0?L.q3!==i0?ke=(L.q1+L.q3)/2:ke=L.q1:L.q3!==i0?ke=L.q3:ke=0,L.med=ke,L.q1=L.q3=ke,L.lf=L.uf=ke,L.mean=L.sd=ke,L.ln=L.un=ke,L.min=L.max=ke}V=Math.min(V,L.min),G=Math.max(G,L.max),L.pts2=_.filter(T),o.push(L)}}r._extremes[c._id]=WI.findExtremes(c,[V,G],{padded:!0})}else{var me=c.makeCalcdata(r,f),ie=J1t(E,A),Se=E.length,Le=$1t(Se);for(l=0;l<r._length;l++)if(P=me[l],!!kV(P)){var Ae=ph.findBin(b[l],ie);Ae>=0&&Ae<Se&&(g={v:P,i:l},m1e(g,r,l),Le[Ae].push(g))}var De=1/0,Pe=-1/0,ge=r.quartilemethod,Fe=ge==="exclusive",ce=ge==="inclusive";for(l=0;l<Se;l++)if(Le[l].length>0){if(L={},L.pos=L[d]=E[l],_=L.pts=Le[l].sort(y1e),k=L[f]=_.map(_1e),M=k.length,L.min=k[0],L.max=k[M-1],L.mean=ph.mean(k,M),L.sd=ph.stdev(k,M,L.mean)*r.sdmultiple,L.med=ph.interp(k,.5),M%2&&(Fe||ce)){var Ze,ct;Fe?(Ze=k.slice(0,M/2),ct=k.slice(M/2+1)):ce&&(Ze=k.slice(0,M/2+1),ct=k.slice(M/2)),L.q1=ph.interp(Ze,.5),L.q3=ph.interp(ct,.5)}else L.q1=ph.interp(k,.25),L.q3=ph.interp(k,.75);L.lf=x1e(L,k,M),L.uf=b1e(L,k,M),L.lo=w1e(L),L.uo=T1e(L);var pt=A1e(L,M);L.ln=L.med-pt,L.un=L.med+pt,De=Math.min(De,L.ln),Pe=Math.max(Pe,L.un),L.pts2=_.filter(T),o.push(L)}r.notched&&ph.isTypedArray(me)&&(me=Array.from(me)),r._extremes[c._id]=WI.findExtremes(c,r.notched?me.concat([De,Pe]):me,{padded:!0})}return Q1t(o,r),o.length>0?(o[0].t={num:n[s],dPos:A,posLetter:d,valLetter:f,labels:{med:zy(t,"median:"),min:zy(t,"min:"),q1:zy(t,"q1:"),q3:zy(t,"q3:"),max:zy(t,"max:"),mean:r.boxmean==="sd"||r.sizemode==="sd"?zy(t,"mean \xB1 \u03C3:").replace("\u03C3",r.sdmultiple===1?"\u03C3":r.sdmultiple+"\u03C3"):zy(t,"mean:"),lf:zy(t,"lower fence:"),uf:zy(t,"upper fence:")}},n[s]++,o):[{t:{empty:!0}}]};function K1t(e,t,r,n){var i=t in e,a=t+"0"in e,o="d"+t in e;if(i||a&&o){var s=r.makeCalcdata(e,t),l=Y1t(e,r,t,s).vals;return[l,s]}var u;a?u=e[t+"0"]:"name"in e&&(r.type==="category"||kV(e.name)&&["linear","log"].indexOf(r.type)!==-1||ph.isDateTime(e.name)&&r.type==="date")?u=e.name:u=n;for(var c=r.type==="multicategory"?r.r2c_just_indices(u):r.d2c(u,0,e[t+"calendar"]),f=e._length,h=new Array(f),d=0;d<f;d++)h[d]=c;return[h]}function J1t(e,t){for(var r=e.length,n=new Array(r+1),i=0;i<r;i++)n[i]=e[i]-t;return n[r]=e[r-1]+t,n}function $1t(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=[];return t}var CV={text:"tx",hovertext:"htx"};function m1e(e,t,r){for(var n in CV)ph.isArrayOrTypedArray(t[n])&&(Array.isArray(r)?ph.isArrayOrTypedArray(t[n][r[0]])&&(e[CV[n]]=t[n][r[0]][r[1]]):e[CV[n]]=t[n][r])}function Q1t(e,t){if(ph.isArrayOrTypedArray(t.selectedpoints))for(var r=0;r<e.length;r++){for(var n=e[r].pts||[],i={},a=0;a<n.length;a++)i[n[a].i]=a;ph.tagSelected(n,t,i)}}function y1e(e,t){return e.v-t.v}function _1e(e){return e.v}function x1e(e,t,r){return r===0?e.q1:Math.min(e.q1,t[Math.min(ph.findBin(2.5*e.q1-1.5*e.q3,t,!0)+1,r-1)])}function b1e(e,t,r){return r===0?e.q3:Math.max(e.q3,t[Math.max(ph.findBin(2.5*e.q3-1.5*e.q1,t),0)])}function w1e(e){return 4*e.q1-3*e.q3}function T1e(e){return 4*e.q3-3*e.q1}function A1e(e,t){return t===0?0:1.57*(e.q3-e.q1)/Math.sqrt(t)}});var XI=ye((llr,k1e)=>{"use strict";var M1e=ho(),e_t=Dr(),t_t=Bb().getAxisGroup,E1e=["v","h"];function r_t(e,t){for(var r=e.calcdata,n=t.xaxis,i=t.yaxis,a=0;a<E1e.length;a++){for(var o=E1e[a],s=o==="h"?i:n,l=[],u=0;u<r.length;u++){var c=r[u],f=c[0].t,h=c[0].trace;h.visible===!0&&(h.type==="box"||h.type==="candlestick")&&!f.empty&&(h.orientation||"v")===o&&h.xaxis===n._id&&h.yaxis===i._id&&l.push(u)}C1e("box",e,l,s)}}function C1e(e,t,r,n){var i=t.calcdata,a=t._fullLayout,o=n._id,s=o.charAt(0),l,u,c,f=[],h=0;for(l=0;l<r.length;l++)for(c=i[r[l]],u=0;u<c.length;u++)f.push(n.c2l(c[u].pos,!0)),h+=(c[u].pts2||[]).length;if(f.length){var d=e_t.distinctVals(f);(n.type==="category"||n.type==="multicategory")&&(d.minDiff=1);var v=d.minDiff/2;M1e.minDtick(n,d.minDiff,d.vals[0],!0);var x=e==="violin"?"_numViolins":"_numBoxes",b=a[x],p=a[e+"mode"]==="group"&&b>1,C=1-a[e+"gap"],E=1-a[e+"groupgap"];for(l=0;l<r.length;l++){c=i[r[l]];var A=c[0].trace,L=c[0].t,_=A.width,k=A.side,M,g,P,T;if(_)M=g=T=_/2,P=0;else if(M=v,p){var z=t_t(a,
|
|||
|
`)>-1&&(a?s=s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`).slice(2):s=`
|
|||
|
`+s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`))):s=e.stylize("[Circular]","special")),d2(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function n5t(e,t,r){var n=0,i=e.reduce(function(a,o){return n++,o.indexOf(`
|
|||
|
`)>=0&&n++,a+o.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(t===""?"":t+`
|
|||
|
`)+" "+e.join(`,
|
|||
|
`)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}fu.types=ZH();function T5e(e){return Array.isArray(e)}fu.isArray=T5e;function QH(e){return typeof e=="boolean"}fu.isBoolean=QH;function vR(e){return e===null}fu.isNull=vR;function a5t(e){return e==null}fu.isNullOrUndefined=a5t;function A5e(e){return typeof e=="number"}fu.isNumber=A5e;function pR(e){return typeof e=="string"}fu.isString=pR;function o5t(e){return typeof e=="symbol"}fu.isSymbol=o5t;function d2(e){return e===void 0}fu.isUndefined=d2;function Z4(e){return sA(e)&&ej(e)==="[object RegExp]"}fu.isRegExp=Z4;fu.types.isRegExp=Z4;function sA(e){return typeof e=="object"&&e!==null}fu.isObject=sA;function dR(e){return sA(e)&&ej(e)==="[object Date]"}fu.isDate=dR;fu.types.isDate=dR;function Y4(e){return sA(e)&&(ej(e)==="[object Error]"||e instanceof Error)}fu.isError=Y4;fu.types.isNativeError=Y4;function fR(e){return typeof e=="function"}fu.isFunction=fR;function s5t(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}fu.isPrimitive=s5t;fu.isBuffer=YH();function ej(e){return Object.prototype.toString.call(e)}function JH(e){return e<10?"0"+e.toString(10):e.toString(10)}var l5t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function u5t(){var e=new Date,t=[JH(e.getHours()),JH(e.getMinutes()),JH(e.getSeconds())].join(":");return[e.getDate(),l5t[e.getMonth()],t].join(" ")}fu.log=function(){console.log("%s - %s",u5t(),fu.format.apply(fu,arguments))};fu.inherits=Uy();fu._extend=function(e,t){if(!t||!sA(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};function S5e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var h2=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;fu.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(h2&&t[h2]){var r=t[h2];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,h2,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var n,i,a=new Promise(function(l,u){n=l,i=u}),o=[],s=0;s<arguments.length;s++)o.push(arguments[s]);o.push(function(l,u){l?i(l):n(u)});try{t.apply(this,o)}catch(l){i(l)}return a}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),h2&&Object.defineProperty(r,h2,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,b5e(t))};fu.promisify.custom=h2;function c5t(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function f5t(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');function t(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};e.apply(this,r).then(function(s){process.nextTick(o.bind(null,null,s))},function(s){process.nextTick(c5t.bind(null,s,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,b5e(e)),t}fu.callbackify=f5t});var k5e=ye((Ffr,C5e)=>{"use strict";function M5e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function h5t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?M5e(Object(r),!0).forEach(function(n){d5t(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M5e(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function d5t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v5t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E5e(e,t){for(var r=0;r<t.length;r++){va
|
|||
|
`)>-1&&(a?s=s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`).slice(2):s=`
|
|||
|
`+s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`))):s=e.stylize("[Circular]","special")),b2(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function mMt(e,t,r){var n=0,i=e.reduce(function(a,o){return n++,o.indexOf(`
|
|||
|
`)>=0&&n++,a+o.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(t===""?"":t+`
|
|||
|
`)+" "+e.join(`,
|
|||
|
`)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}hu.types=ZH();function CSe(e){return Array.isArray(e)}hu.isArray=CSe;function Rj(e){return typeof e=="boolean"}hu.isBoolean=Rj;function zR(e){return e===null}hu.isNull=zR;function yMt(e){return e==null}hu.isNullOrUndefined=yMt;function kSe(e){return typeof e=="number"}hu.isNumber=kSe;function OR(e){return typeof e=="string"}hu.isString=OR;function _Mt(e){return typeof e=="symbol"}hu.isSymbol=_Mt;function b2(e){return e===void 0}hu.isUndefined=b2;function iE(e){return hA(e)&&Dj(e)==="[object RegExp]"}hu.isRegExp=iE;hu.types.isRegExp=iE;function hA(e){return typeof e=="object"&&e!==null}hu.isObject=hA;function FR(e){return hA(e)&&Dj(e)==="[object Date]"}hu.isDate=FR;hu.types.isDate=FR;function nE(e){return hA(e)&&(Dj(e)==="[object Error]"||e instanceof Error)}hu.isError=nE;hu.types.isNativeError=nE;function RR(e){return typeof e=="function"}hu.isFunction=RR;function xMt(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}hu.isPrimitive=xMt;hu.isBuffer=YH();function Dj(e){return Object.prototype.toString.call(e)}function Pj(e){return e<10?"0"+e.toString(10):e.toString(10)}var bMt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function wMt(){var e=new Date,t=[Pj(e.getHours()),Pj(e.getMinutes()),Pj(e.getSeconds())].join(":");return[e.getDate(),bMt[e.getMonth()],t].join(" ")}hu.log=function(){console.log("%s - %s",wMt(),hu.format.apply(hu,arguments))};hu.inherits=Uy();hu._extend=function(e,t){if(!t||!hA(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};function LSe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var x2=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;hu.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(x2&&t[x2]){var r=t[x2];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,x2,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var n,i,a=new Promise(function(l,u){n=l,i=u}),o=[],s=0;s<arguments.length;s++)o.push(arguments[s]);o.push(function(l,u){l?i(l):n(u)});try{t.apply(this,o)}catch(l){i(l)}return a}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),x2&&Object.defineProperty(r,x2,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,MSe(t))};hu.promisify.custom=x2;function TMt(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function AMt(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');function t(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};e.apply(this,r).then(function(s){process.nextTick(o.bind(null,null,s))},function(s){process.nextTick(TMt.bind(null,s,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,MSe(e)),t}hu.callbackify=AMt});var Oj=ye((Qfr,DSe)=>{"use strict";function B_(e){"@babel/helpers - typeof";return B_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B_(e)}function PSe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,MMt(n.key),n)}}function SMt(e,t,r){return t&&PSe(e.prototype,t),r&&PSe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function MMt(e){var t=EMt(e,"string");return B_(t)==="symbol"?t:String(t)}function EMt(e,t){if(B_(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(B_(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}
|
|||
|
`),c=uE(t).split(`
|
|||
|
`),f=0,h="";if(r==="strictEqual"&&Rp(e)==="object"&&Rp(t)==="object"&&e!==null&&t!==null&&(r="strictEqualObject"),u.length===1&&c.length===1&&u[0]!==c[0]){var d=u[0].length+c[0].length;if(d<=ZMt){if((Rp(e)!=="object"||e===null)&&(Rp(t)!=="object"||t===null)&&(e!==0||t!==0))return"".concat(w2[r],`
|
|||
|
|
|||
|
`)+"".concat(u[0]," !== ").concat(c[0],`
|
|||
|
`)}else if(r!=="strictEqualObject"){var v=process.stderr&&process.stderr.isTTY?process.stderr.columns:80;if(d<v){for(;u[0][f]===c[0][f];)f++;f>2&&(h=`
|
|||
|
`.concat(XMt(" ",f),"^"),f=0)}}}for(var x=u[u.length-1],b=c[c.length-1];x===b&&(f++<2?o=`
|
|||
|
`.concat(x).concat(o):n=x,u.pop(),c.pop(),!(u.length===0||c.length===0));)x=u[u.length-1],b=c[c.length-1];var p=Math.max(u.length,c.length);if(p===0){var C=l.split(`
|
|||
|
`);if(C.length>30)for(C[26]="".concat(Hg,"...").concat(xv);C.length>27;)C.pop();return"".concat(w2.notIdentical,`
|
|||
|
|
|||
|
`).concat(C.join(`
|
|||
|
`),`
|
|||
|
`)}f>3&&(o=`
|
|||
|
`.concat(Hg,"...").concat(xv).concat(o),s=!0),n!==""&&(o=`
|
|||
|
`.concat(n).concat(o),n="");var E=0,A=w2[r]+`
|
|||
|
`.concat(sE,"+ actual").concat(xv," ").concat(lE,"- expected").concat(xv),L=" ".concat(Hg,"...").concat(xv," Lines skipped");for(f=0;f<p;f++){var _=f-a;if(u.length<f+1)_>1&&f>2&&(_>4?(i+=`
|
|||
|
`.concat(Hg,"...").concat(xv),s=!0):_>3&&(i+=`
|
|||
|
`.concat(c[f-2]),E++),i+=`
|
|||
|
`.concat(c[f-1]),E++),a=f,n+=`
|
|||
|
`.concat(lE,"-").concat(xv," ").concat(c[f]),E++;else if(c.length<f+1)_>1&&f>2&&(_>4?(i+=`
|
|||
|
`.concat(Hg,"...").concat(xv),s=!0):_>3&&(i+=`
|
|||
|
`.concat(u[f-2]),E++),i+=`
|
|||
|
`.concat(u[f-1]),E++),a=f,i+=`
|
|||
|
`.concat(sE,"+").concat(xv," ").concat(u[f]),E++;else{var k=c[f],M=u[f],g=M!==k&&(!qSe(M,",")||M.slice(0,-1)!==k);g&&qSe(k,",")&&k.slice(0,-1)===M&&(g=!1,M+=","),g?(_>1&&f>2&&(_>4?(i+=`
|
|||
|
`.concat(Hg,"...").concat(xv),s=!0):_>3&&(i+=`
|
|||
|
`.concat(u[f-2]),E++),i+=`
|
|||
|
`.concat(u[f-1]),E++),a=f,i+=`
|
|||
|
`.concat(sE,"+").concat(xv," ").concat(M),n+=`
|
|||
|
`.concat(lE,"-").concat(xv," ").concat(k),E+=2):(i+=n,n="",(_===1||f===0)&&(i+=`
|
|||
|
`.concat(M),E++))}if(E>20&&f<p-2)return"".concat(A).concat(L,`
|
|||
|
`).concat(i,`
|
|||
|
`).concat(Hg,"...").concat(xv).concat(n,`
|
|||
|
`)+"".concat(Hg,"...").concat(xv)}return"".concat(A).concat(s?L:"",`
|
|||
|
`).concat(i).concat(n).concat(o).concat(h)}var KMt=function(e,t){UMt(n,e);var r=VMt(n);function n(i){var a;if(qMt(this,n),Rp(i)!=="object"||i===null)throw new WMt("options","Object",i);var o=i.message,s=i.operator,l=i.stackStartFn,u=i.actual,c=i.expected,f=Error.stackTraceLimit;if(Error.stackTraceLimit=0,o!=null)a=r.call(this,String(o));else if(process.stderr&&process.stderr.isTTY&&(process.stderr&&process.stderr.getColorDepth&&process.stderr.getColorDepth()!==1?(Hg="\x1B[34m",sE="\x1B[32m",xv="\x1B[39m",lE="\x1B[31m"):(Hg="",sE="",xv="",lE="")),Rp(u)==="object"&&u!==null&&Rp(c)==="object"&&c!==null&&"stack"in u&&u instanceof Error&&"stack"in c&&c instanceof Error&&(u=BSe(u),c=BSe(c)),s==="deepStrictEqual"||s==="strictEqual")a=r.call(this,YMt(u,c,s));else if(s==="notDeepStrictEqual"||s==="notStrictEqual"){var h=w2[s],d=uE(u).split(`
|
|||
|
`);if(s==="notStrictEqual"&&Rp(u)==="object"&&u!==null&&(h=w2.notStrictEqualObject),d.length>30)for(d[26]="".concat(Hg,"...").concat(xv);d.length>27;)d.pop();d.length===1?a=r.call(this,"".concat(h," ").concat(d[0])):a=r.call(this,"".concat(h,`
|
|||
|
|
|||
|
`).concat(d.join(`
|
|||
|
`),`
|
|||
|
`))}else{var v=uE(u),x="",b=w2[s];s==="notDeepEqual"||s==="notEqual"?(v="".concat(w2[s],`
|
|||
|
|
|||
|
`).concat(v),v.length>1024&&(v="".concat(v.slice(0,1021),"..."))):(x="".concat(uE(c)),v.length>512&&(v="".concat(v.slice(0,509),"...")),x.length>512&&(x="".concat(x.slice(0,509),"...")),s==="deepEqual"||s==="equal"?v="".concat(b,`
|
|||
|
|
|||
|
`).concat(v,`
|
|||
|
|
|||
|
should equal
|
|||
|
|
|||
|
`):x=" ".concat(s," ").concat(x)),a=r.call(this,"".concat(v).concat(x))}return Error.stackTraceLimit=f,a.generatedMessage=!o,Object.defineProperty(qj(a),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),a.code="ERR_ASSERTION",a.actual=u,a.expected=c,a.operator=s,Error.captureStackTrace&&Error.captureStackTrace(qj(a),l),a.stack,a.name="AssertionError",USe(a)}return BMt(n,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(a,o){return Nj(this,zSe(zSe({},o),{},{customInspect:!1,depth:0}))}}]),n}(Bj(Error),Nj.custom);GSe.exports=KMt});var Uj=ye((thr,WSe)=>{"use strict";var jSe=Object.prototype.toString;WSe.exports=function(t){var r=jSe.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jSe.call(t.callee)==="[object Function]"),n}});var tMe=ye((rhr,eMe)=>{"use strict";var QSe;Object.keys||(hE=Object.prototype.hasOwnProperty,Vj=Object.prototype.toString,XSe=Uj(),Gj=Object.prototype.propertyIsEnumerable,ZSe=!Gj.call({toString:null},"toString"),YSe=Gj.call(function(){},"prototype"),dE=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],NR=function(e){var t=e.constructor;return t&&t.prototype===e},KSe={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},JSe=function(){if(typeof window=="undefined")return!1;for(var e in window)try{if(!KSe["$"+e]&&hE.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{NR(window[e])}catch(t){return!0}}catch(t){return!0}return!1}(),$Se=function(e){if(typeof window=="undefined"||!JSe)return NR(e);try{return NR(e)}catch(t){return!1}},QSe=function(t){var r=t!==null&&typeof t=="object",n=Vj.call(t)==="[object Function]",i=XSe(t),a=r&&Vj.call(t)==="[object String]",o=[];if(!r&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var s=YSe&&n;if(a&&t.length>0&&!hE.call(t,0))for(var l=0;l<t.length;++l)o.push(String(l));if(i&&t.length>0)for(var u=0;u<t.length;++u)o.push(String(u));else for(var c in t)!(s&&c==="prototype")&&hE.call(t,c)&&o.push(String(c));if(ZSe)for(var f=$Se(t),h=0;h<dE.length;++h)!(f&&dE[h]==="constructor")&&hE.call(t,dE[h])&&o.push(dE[h]);return o});var hE,Vj,XSe,Gj,ZSe,YSe,dE,NR,KSe,JSe,$Se;eMe.exports=QSe});var Hj=ye((ihr,nMe)=>{"use strict";var JMt=Array.prototype.slice,$Mt=Uj(),rMe=Object.keys,UR=rMe?function(t){return rMe(t)}:tMe(),iMe=Object.keys;UR.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return $Mt(n)?iMe(JMt.call(n)):iMe(n)})}else Object.keys=UR;return Object.keys||UR};nMe.exports=UR});var cMe=ye((nhr,uMe)=>{"use strict";var QMt=Hj(),sMe=V8()(),lMe=nA(),aMe=Object,e4t=lMe("Array.prototype.push"),oMe=lMe("Object.prototype.propertyIsEnumerable"),t4t=sMe?Object.getOwnPropertySymbols:null;uMe.exports=function(t,r){if(t==null)throw new TypeError("target must be an object");var n=aMe(t);if(arguments.length===1)return n;for(var i=1;i<arguments.length;++i){var a=aMe(arguments[i]),o=QMt(a),s=sMe&&(Object.getOwnPropertySymbols||t4t);if(s)for(var l=s(a),u=0;u<l.length;++u){var c=l[u];oMe(a,c)&&e4t(o,c)}for(var f=0;f<o.length;++f){var h=o[f];if(oMe(a,h)){var d=a[h];n[h]=d}}}return n}});var hMe=ye((ahr,fMe)=>{"use strict";var jj=cMe(),r4t=function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},n=0;n<t.length;++n)r[t[n]]=t[n];var i=Object.assign({},r),a="";for(var o in i)a+=o;return e!==a},i4t=function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch(t){return e[1]==="y"}return!1};fMe.expo
|
|||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function M4t(e,t){if(e){if(typeof e=="string")return FMe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return FMe(e,t)}}function FMe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function E4t(e,t){var r=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function C4t(e){if(Array.isArray(e))return e}function J0(e){"@babel/helpers - typeof";return J0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J0(e)}var k4t=/a/g.flags!==void 0,YR=function(t){var r=[];return t.forEach(function(n){return r.push(n)}),r},zMe=function(t){var r=[];return t.forEach(function(n,i){return r.push([i,n])}),r},XMe=Object.is?Object.is:SMe(),XR=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},Yj=Number.isNaN?Number.isNaN:RMe();function Jj(e){return e.call.bind(e)}var gE=Jj(Object.prototype.hasOwnProperty),ZR=Jj(Object.prototype.propertyIsEnumerable),OMe=Jj(Object.prototype.toString),op=dA().types,L4t=op.isAnyArrayBuffer,P4t=op.isArrayBufferView,qMe=op.isDate,GR=op.isMap,BMe=op.isRegExp,HR=op.isSet,I4t=op.isNativeError,R4t=op.isBoxedPrimitive,NMe=op.isNumberObject,UMe=op.isStringObject,VMe=op.isBooleanObject,GMe=op.isBigIntObject,D4t=op.isSymbolObject,F4t=op.isFloat32Array,z4t=op.isFloat64Array;function O4t(e){if(e.length===0||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return e.length===10&&e>=Math.pow(2,32)}function jR(e){return Object.keys(e).filter(O4t).concat(XR(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function ZMe(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}var WR=void 0,q4t=!0,B4t=!1,Kj=0,$j=1,YMe=2,KMe=3;function N4t(e,t){return k4t?e.source===t.source&&e.flags===t.flags:RegExp.prototype.toString.call(e)===RegExp.prototype.toString.call(t)}function U4t(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function V4t(e,t){return e.byteLength!==t.byteLength?!1:ZMe(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))===0}function G4t(e,t){return e.byteLength===t.byteLength&&ZMe(new Uint8Array(e),new Uint8Array(t))===0}function H4t(e,t){return NMe(e)?NMe(t)&&XMe(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):UMe(e)?UMe(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):VMe(e)?VMe(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):GMe(e)?GMe(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):D4t(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}function $0(e,t,r,n){if(e===t)return e!==0?!0:r?XMe(e,t):!0;if(r){if(J0(e)!=="object")return typeof e=="number"&&Yj(e)&&Yj(t);if(J0(t)!=="object"||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(e===null||J0(e)!=="object")return t===null||J0(t)!=="object"?e==t:!1;if(t===null||J0(t)!=="object")return!1}var i=OMe(e),a=OMe(t);if(i!==a)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var o=jR(e,WR),s=jR(t,WR);return o.length!==s.length?!1:pE(e,t,r,n,$j,o)}if(i==="[object Object]"&&(!GR(e)&&GR(t)||!HR(e)&&HR(t)))return!1;if(qMe(e)){if(!qMe(t)||Date.prototype.getTime.call(e)!==Date.protot
|
|||
|
`)+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}Mf.throws=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];d4e.apply(void 0,[e,f4e(t)].concat(n))};Mf.rejects=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return h4e(t).then(function(a){return d4e.apply(void 0,[e,a].concat(n))})};Mf.doesNotThrow=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];v4e.apply(void 0,[e,f4e(t)].concat(n))};Mf.doesNotReject=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return h4e(t).then(function(a){return v4e.apply(void 0,[e,a].concat(n))})};Mf.ifError=function e(t){if(t!=null){var r="ifError got unwanted exception: ";jg(t)==="object"&&typeof t.message=="string"?t.message.length===0&&t.constructor?r+=t.constructor.name:r+=t.message:r+=KR(t);var n=new V_({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),i=t.stack;if(typeof i=="string"){var a=i.split(`
|
|||
|
`);a.shift();for(var o=n.stack.split(`
|
|||
|
`),s=0;s<a.length;s++){var l=o.indexOf(a[s]);if(l!==-1){o=o.slice(0,l);break}}n.stack="".concat(o.join(`
|
|||
|
`),`
|
|||
|
`).concat(a.join(`
|
|||
|
`))}throw n}};function p4e(e,t,r,n,i){if(!JR(t))throw new pA("regexp","RegExp",t);var a=i==="match";if(typeof e!="string"||$R(t,e)!==a){if(r instanceof Error)throw r;var o=!r;r=r||(typeof e!="string"?'The "string" argument must be of type string. Received type '+"".concat(jg(e)," (").concat(KR(e),")"):(a?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(KR(t),`. Input:
|
|||
|
|
|||
|
`).concat(KR(e),`
|
|||
|
`));var s=new V_({actual:e,expected:t,message:r,operator:i,stackStartFn:n});throw s.generatedMessage=o,s}}Mf.match=function e(t,r,n){p4e(t,r,n,e,"match")};Mf.doesNotMatch=function e(t,r,n){p4e(t,r,n,e,"doesNotMatch")};function g4e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l4e.apply(void 0,[g4e,t.length].concat(t))}Mf.strict=sEt(g4e,Mf,{equal:Mf.strictEqual,deepEqual:Mf.deepStrictEqual,notEqual:Mf.notStrictEqual,notDeepEqual:Mf.notDeepStrictEqual});Mf.strict.strict=Mf.strict});var _4e=ye((mhr,y4e)=>{var _E=1e3,xE=_E*60,bE=xE*60,wE=bE*24,uEt=wE*365.25;y4e.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return cEt(e);if(r==="number"&&isNaN(e)===!1)return t.long?hEt(e):fEt(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function cEt(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*uEt;case"days":case"day":case"d":return r*wE;case"hours":case"hour":case"hrs":case"hr":case"h":return r*bE;case"minutes":case"minute":case"mins":case"min":case"m":return r*xE;case"seconds":case"second":case"secs":case"sec":case"s":return r*_E;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function fEt(e){return e>=wE?Math.round(e/wE)+"d":e>=bE?Math.round(e/bE)+"h":e>=xE?Math.round(e/xE)+"m":e>=_E?Math.round(e/_E)+"s":e+"ms"}function hEt(e){return tD(e,wE,"day")||tD(e,bE,"hour")||tD(e,xE,"minute")||tD(e,_E,"second")||e+" ms"}function tD(e,t,r){if(!(e<t))return e<t*1.5?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}});var b4e=ye((Lc,x4e)=>{Lc=x4e.exports=tW.debug=tW.default=tW;Lc.coerce=mEt;Lc.disable=pEt;Lc.enable=vEt;Lc.enabled=gEt;Lc.humanize=_4e();Lc.names=[];Lc.skips=[];Lc.formatters={};var eW;function dEt(e){var t=0,r;for(r in e)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Lc.colors[Math.abs(t)%Lc.colors.length]}function tW(e){function t(){if(t.enabled){var r=t,n=+new Date,i=n-(eW||n);r.diff=i,r.prev=eW,r.curr=n,eW=n;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=Lc.coerce(a[0]),typeof a[0]!="string"&&a.unshift("%O");var s=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(u,c){if(u==="%%")return u;s++;var f=Lc.formatters[c];if(typeof f=="function"){var h=a[s];u=f.call(r,h),a.splice(s,1),s--}return u}),Lc.formatArgs.call(r,a);var l=t.log||Lc.log||console.log.bind(console);l.apply(r,a)}}return t.namespace=e,t.enabled=Lc.enabled(e),t.useColors=Lc.useColors(),t.color=dEt(e),typeof Lc.init=="function"&&Lc.init(t),t}function vEt(e){Lc.save(e),Lc.names=[],Lc.skips=[];for(var t=(typeof e=="string"?e:"").split(/[\s,]+/),r=t.length,n=0;n<r;n++)t[n]&&(e=t[n].replace(/\*/g,".*?"),e[0]==="-"?Lc.skips.push(new RegExp("^"+e.substr(1)+"$")):Lc.names.push(new RegExp("^"+e+"$")))}function pEt(){Lc.enable("")}function gEt(e){var t,r;for(t=0,r=Lc.skips.length;t<r;t++)if(Lc.skips[t].test(e))return!1;for(t=0,r=Lc.names.length;t<r;t++)if(Lc.names[t].test(e))return!0;return!1}function mEt(e){return e instanceof Error?e.stack||e.message:e}});var A4e=ye((sp,T4e)=>{sp=T4e.exports=b4e();sp.log=xEt;sp.formatArgs=_Et;sp.save=bEt;sp.load=w4e;sp.useColors=yEt;sp.storage=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"?chrome.storage.local:wEt();sp.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function yEt(){return typeof window!="undefined"&&window.process&&window.process.type==="renderer"?!0:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined
|
|||
|
|
|||
|
`),tCt=$4e("IHDR");Q4e.exports=function(e){if(!(e.length<24)&&K4e(e,0,eCt)&&K4e(e,12,tCt))return{width:J4e(e,16),height:J4e(e,20),type:"png",mime:"image/png",wUnits:"px",hUnits:"px"}}});var iEe=ye((Chr,rEe)=>{"use strict";var rCt=rc().str2arr,iCt=rc().sliceEq,tEe=rc().readUInt32BE,nCt=rCt("8BPS\0");rEe.exports=function(e){if(!(e.length<22)&&iCt(e,0,nCt))return{width:tEe(e,18),height:tEe(e,14),type:"psd",mime:"image/vnd.adobe.photoshop",wUnits:"px",hUnits:"px"}}});var oEe=ye((khr,aEe)=>{"use strict";function aCt(e){return e===32||e===9||e===13||e===10}function yA(e){return typeof e=="number"&&isFinite(e)&&e>0}function oCt(e){var t=0,r=e.length;for(e[0]===239&&e[1]===187&&e[2]===191&&(t=3);t<r&&aCt(e[t]);)t++;return t===r?!1:e[t]===60}var sCt=/<[-_.:a-zA-Z0-9][^>]*>/,lCt=/^<([-_.:a-zA-Z0-9]+:)?svg\s/,uCt=/[^-]\bwidth="([^%]+?)"|[^-]\bwidth='([^%]+?)'/,cCt=/\bheight="([^%]+?)"|\bheight='([^%]+?)'/,fCt=/\bview[bB]ox="(.+?)"|\bview[bB]ox='(.+?)'/,nEe=/in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;function hCt(e){var t=e.match(uCt),r=e.match(cCt),n=e.match(fCt);return{width:t&&(t[1]||t[2]),height:r&&(r[1]||r[2]),viewbox:n&&(n[1]||n[2])}}function Nm(e){return nEe.test(e)?e.match(nEe)[0]:"px"}aEe.exports=function(e){if(oCt(e)){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);var n=(t.match(sCt)||[""])[0];if(lCt.test(n)){var i=hCt(n),a=parseFloat(i.width),o=parseFloat(i.height);if(i.width&&i.height)return!yA(a)||!yA(o)?void 0:{width:a,height:o,type:"svg",mime:"image/svg+xml",wUnits:Nm(i.width),hUnits:Nm(i.height)};var s=(i.viewbox||"").split(" "),l={width:s[2],height:s[3]},u=parseFloat(l.width),c=parseFloat(l.height);if(!(!yA(u)||!yA(c))&&Nm(l.width)===Nm(l.height)){var f=u/c;return i.width?yA(a)?{width:a,height:a/f,type:"svg",mime:"image/svg+xml",wUnits:Nm(i.width),hUnits:Nm(i.width)}:void 0:i.height?yA(o)?{width:o*f,height:o,type:"svg",mime:"image/svg+xml",wUnits:Nm(i.height),hUnits:Nm(i.height)}:void 0:{width:u,height:c,type:"svg",mime:"image/svg+xml",wUnits:Nm(l.width),hUnits:Nm(l.height)}}}}}});var fEe=ye((Lhr,cEe)=>{"use strict";var uEe=rc().str2arr,sEe=rc().sliceEq,dCt=rc().readUInt16LE,vCt=rc().readUInt16BE,pCt=rc().readUInt32LE,gCt=rc().readUInt32BE,mCt=uEe("II*\0"),yCt=uEe("MM\0*");function lD(e,t,r){return r?vCt(e,t):dCt(e,t)}function sW(e,t,r){return r?gCt(e,t):pCt(e,t)}function lEe(e,t,r){var n=lD(e,t+2,r),i=sW(e,t+4,r);return i!==1||n!==3&&n!==4?null:n===3?lD(e,t+8,r):sW(e,t+8,r)}cEe.exports=function(e){if(!(e.length<8)&&!(!sEe(e,0,mCt)&&!sEe(e,0,yCt))){var t=e[0]===77,r=sW(e,4,t)-8;if(!(r<0)){var n=r+8;if(!(e.length-n<2)){var i=lD(e,n+0,t)*12;if(!(i<=0)&&(n+=2,!(e.length-n<i))){var a,o,s,l;for(a=0;a<i;a+=12)l=lD(e,n+a,t),l===256?o=lEe(e,n+a,t):l===257&&(s=lEe(e,n+a,t));if(o&&s)return{width:o,height:s,type:"tiff",mime:"image/tiff",wUnits:"px",hUnits:"px"}}}}}}});var gEe=ye((Phr,pEe)=>{"use strict";var vEe=rc().str2arr,hEe=rc().sliceEq,dEe=rc().readUInt16LE,lW=rc().readUInt32LE,_Ct=oD(),xCt=vEe("RIFF"),bCt=vEe("WEBP");function wCt(e,t){if(!(e[t+3]!==157||e[t+4]!==1||e[t+5]!==42))return{width:dEe(e,t+6)&16383,height:dEe(e,t+8)&16383,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}function TCt(e,t){if(e[t]===47){var r=lW(e,t+1);return{width:(r&16383)+1,height:(r>>14&16383)+1,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}}function ACt(e,t){return{width:(e[t+6]<<16|e[t+5]<<8|e[t+4])+1,height:(e[t+9]<<t|e[t+8]<<8|e[t+7])+1,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}pEe.exports=function(e){if(!(e.length<16)&&!(!hEe(e,0,xCt)&&!hEe(e,8,bCt))){var t=12,r=null,n=0,i=lW(e,4)+8;if(!(i>e.length)){for(;t+8<i;){if(e[t]===0){t++;continue}var a=String.fromCharCode.apply(null,e.slice(t,t+4)),o=lW(e,t+4);a==="VP8 "&&o>=10?r=r||wCt(e,t+8):a==="VP8L"&&o>=9?r=r||TCt(e,t+8):a==="VP8X"&&o>=10?r=r||ACt(e,t+8):a==="EXIF"&&(n=_Ct.get_orientation(e.slice(t+8,t+8+o)),t=1/0),t+=8+o}if(r)return n>0&&(r.orientation=n),r}}}});var yEe=ye((Ihr,mEe)=>{"use strict";mEe.exports={avif:z4e(),bmp:B4e(),gif:H4e(),ico:X4e(),jpeg:Y4e(),png:eEe(),psd:iEe(),svg:oEe(),tiff:fEe(),webp:gEe()}});var _Ee=ye((Rhr,cW)=>{"use strict";var uW=
|
|||
|
parent value =`,j,`
|
|||
|
children sum =`,re].join(" "))}H.value=j});break}else VCe(T,t,{branches:t.count.indexOf("branches")!==-1,leaves:t.count.indexOf("leaves")!==-1});if(!z){t.sort&&T.sort(function(H,N){return N.value-H.value});var O,V,G=t.marker.colors||[],Z=!!G.length;return t._hasColorscale?(Z||(G=l?t.values:t._values),Hkt(e,t,{vals:G,containerStr:"marker",cLetter:"c"}),V=Ukt(t.marker)):O=Vkt(r["_"+t.type+"colormap"]),T.each(function(H){var N=H.data.data;N.color=t._hasColorscale?V(G[N.i]):O(G[N.i],N.id)}),u[0].hierarchy=T,u}};PE._runCrossTraceCalc=function(e,t){var r=t._fullLayout,n=t.calcdata,i=r[e+"colorway"],a=r["_"+e+"colormap"];r["extend"+e+"colors"]&&(i=Gkt(i,e==="icicle"?Zkt:e==="treemap"?Xkt:Wkt));var o=0,s;function l(h){var d=h.data.data,v=d.id;d.color===!1&&(a[v]?d.color=a[v]:h.parent?h.parent.parent?d.color=h.parent.data.data.color:(a[v]=d.color=i[o%i.length],o++):d.color=s)}for(var u=0;u<n.length;u++){var c=n[u],f=c[0];f.trace.type===e&&f.hierarchy&&(s=f.trace.root.color,f.hierarchy.each(l))}};PE.crossTraceCalc=function(e){return PE._runCrossTraceCalc("sunburst",e)};function VCe(e,t,r){var n=0,i=e.children;if(i){for(var a=i.length,o=0;o<a;o++)n+=VCe(i[o],t,r);r.branches&&n++}else r.leaves&&n++;return e.value=e.data.data.value=n,t._values||(t._values=[]),t._values[e.data.data.i]=n,n}});function Zy(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function H_(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}var yD=ru(()=>{});function Vm(){}function HCe(){return this.rgb().formatHex()}function r6t(){return this.rgb().formatHex8()}function i6t(){return JCe(this).formatHsl()}function jCe(){return this.rgb().formatRgb()}function W_(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Ykt.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?WCe(t):r===3?new _d(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?_D(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?_D(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Kkt.exec(e))?new _d(t[1],t[2],t[3],1):(t=Jkt.exec(e))?new _d(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$kt.exec(e))?_D(t[1],t[2],t[3],t[4]):(t=Qkt.exec(e))?_D(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=e6t.exec(e))?YCe(t[1],t[2]/100,t[3]/100,1):(t=t6t.exec(e))?YCe(t[1],t[2]/100,t[3]/100,t[4]):GCe.hasOwnProperty(e)?WCe(GCe[e]):e==="transparent"?new _d(NaN,NaN,NaN,0):null}function WCe(e){return new _d(e>>16&255,e>>8&255,e&255,1)}function _D(e,t,r,n){return n<=0&&(e=t=r=NaN),new _d(e,t,r,n)}function DE(e){return e instanceof Vm||(e=W_(e)),e?(e=e.rgb(),new _d(e.r,e.g,e.b,e.opacity)):new _d}function AA(e,t,r,n){return arguments.length===1?DE(e):new _d(e,t,r,n==null?1:n)}function _d(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function XCe(){return`#${M2(this.r)}${M2(this.g)}${M2(this.b)}`}function n6t(){return`#${M2(this.r)}${M2(this.g)}${M2(this.b)}${M2((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZCe(){let e=bD(this.opacity);return`${e===1?"rgb(":"rgba("}${E2(this.r)}, ${E2(this.g)}, ${E2(this.b)}${e===1?")":`, ${e})`}`}function bD(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function E2(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function M2(e){return e=E2(e),(e<16?"0":"")+e.toString(16)}function YCe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Xg(e,t,r,n)}function JCe(e){if(e instanceof Xg)return new Xg(e.h,e.s,e.l,e.opacity);if(e instanceof Vm||(e=W_(e)),!e)return new Xg;if(e instanceof Xg)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,l=(a+i)/2;return s?(t===a?o=(r-n)/s+(r<n)*6:r===a?o=(n-t)/s+2:o=(t-r)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Xg(o,s,l,e.opacity)}function FE(e,t,r,n){return arguments.length===1?JCe(e):new Xg(e,t,r,n==null?1:n)}function Xg(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function KCe(e){return e=(e||0)%360,e<0?e+360:e}function xD(e){return Math.max(0,Math.min(1,e||0))}function gW(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var j_,C2,TA,RE,Um,Ykt,Kkt,Jkt,$kt,Qkt,e6t,t6t,GCe,wD=ru(()=>{yD();j
|
|||
|
`)}},3952:function(i,a,o){"use strict";i.exports=u;var s=o(3250);function l(c,f){for(var h=new Array(f+1),d=0;d<c.length;++d)h[d]=c[d];for(var d=0;d<=c.length;++d){for(var v=c.length;v<=f;++v){for(var x=new Array(f),b=0;b<f;++b)x[b]=Math.pow(v+1-d,b);h[v]=x}var p=s.apply(void 0,h);if(p)return!0}return!1}function u(c){var f=c.length;if(f===0)return[];if(f===1)return[0];for(var h=c[0].length,d=[c[0]],v=[0],x=1;x<f;++x){if(d.push(c[x]),!l(d,h)){d.pop();continue}if(v.push(x),v.length===h+1)return v}return v}},5995:function(i,a,o){"use strict";i.exports=u;var s=o(7642),l=o(6037);function u(c,f){return s(f).filter(function(h){for(var d=new Array(h.length),v=0;v<h.length;++v)d[v]=f[h[v]];return l(d)*c<1})}},3502:function(i,a,o){i.exports=u;var s=o(5995),l=o(9127);function u(c,f){return l(s(c,f))}},6468:function(i){i.exports=function(o){return atob(o)}},2642:function(i,a,o){"use strict";i.exports=u;var s=o(727);function l(c){for(var f=0,h=0;h<c.length;++h)f+=c[h];return f}function u(c,f){for(var h=f.length,d=new Array(h+1),v=0;v<h;++v){for(var x=new Array(h+1),b=0;b<=h;++b)x[b]=c[b][v];d[v]=x}d[h]=new Array(h+1);for(var v=0;v<=h;++v)d[h][v]=1;for(var p=new Array(h+1),v=0;v<h;++v)p[v]=f[v];p[h]=1;var C=s(d,p),E=l(C[h+1]);E===0&&(E=1);for(var A=new Array(h+1),v=0;v<=h;++v)A[v]=l(C[v])/E;return A}},7507:function(i,a){"use strict";a.byteLength=d,a.toByteArray=x,a.fromByteArray=C;for(var o=[],s=[],l=typeof Uint8Array!="undefined"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,f=u.length;c<f;++c)o[c]=u[c],s[u.charCodeAt(c)]=c;s[45]=62,s[95]=63;function h(E){var A=E.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var L=E.indexOf("=");L===-1&&(L=A);var _=L===A?0:4-L%4;return[L,_]}function d(E){var A=h(E),L=A[0],_=A[1];return(L+_)*3/4-_}function v(E,A,L){return(A+L)*3/4-L}function x(E){var A,L=h(E),_=L[0],k=L[1],M=new l(v(E,_,k)),g=0,P=k>0?_-4:_,T;for(T=0;T<P;T+=4)A=s[E.charCodeAt(T)]<<18|s[E.charCodeAt(T+1)]<<12|s[E.charCodeAt(T+2)]<<6|s[E.charCodeAt(T+3)],M[g++]=A>>16&255,M[g++]=A>>8&255,M[g++]=A&255;return k===2&&(A=s[E.charCodeAt(T)]<<2|s[E.charCodeAt(T+1)]>>4,M[g++]=A&255),k===1&&(A=s[E.charCodeAt(T)]<<10|s[E.charCodeAt(T+1)]<<4|s[E.charCodeAt(T+2)]>>2,M[g++]=A>>8&255,M[g++]=A&255),M}function b(E){return o[E>>18&63]+o[E>>12&63]+o[E>>6&63]+o[E&63]}function p(E,A,L){for(var _,k=[],M=A;M<L;M+=3)_=(E[M]<<16&16711680)+(E[M+1]<<8&65280)+(E[M+2]&255),k.push(b(_));return k.join("")}function C(E){for(var A,L=E.length,_=L%3,k=[],M=16383,g=0,P=L-_;g<P;g+=M)k.push(p(E,g,g+M>P?P:g+M));return _===1?(A=E[L-1],k.push(o[A>>2]+o[A<<4&63]+"==")):_===2&&(A=(E[L-2]<<8)+E[L-1],k.push(o[A>>10]+o[A>>4&63]+o[A<<2&63]+"=")),k.join("")}},3865:function(i,a,o){"use strict";var s=o(869);i.exports=l;function l(u,c){return s(u[0].mul(c[1]).add(c[0].mul(u[1])),u[1].mul(c[1]))}},1318:function(i){"use strict";i.exports=a;function a(o,s){return o[0].mul(s[1]).cmp(s[0].mul(o[1]))}},8697:function(i,a,o){"use strict";var s=o(869);i.exports=l;function l(u,c){return s(u[0].mul(c[1]),u[1].mul(c[0]))}},7842:function(i,a,o){"use strict";var s=o(6330),l=o(1533),u=o(2651),c=o(6768),f=o(869),h=o(8697);i.exports=d;function d(v,x){if(s(v))return x?h(v,d(x)):[v[0].clone(),v[1].clone()];var b=0,p,C;if(l(v))p=v.clone();else if(typeof v=="string")p=c(v);else{if(v===0)return[u(0),u(1)];if(v===Math.floor(v))p=u(v);else{for(;v!==Math.floor(v);)v=v*Math.pow(2,256),b-=256;p=u(v)}}if(s(x))p.mul(x[1]),C=x[0].clone();else if(l(x))C=x.clone();else if(typeof x=="string")C=c(x);else if(!x)C=u(1);else if(x===Math.floor(x))C=u(x);else{for(;x!==Math.floor(x);)x=x*Math.pow(2,256),b+=256;C=u(x)}return b>0?p=p.ushln(b):b<0&&(C=C.ushln(-b)),f(p,C)}},6330:function(i,a,o){"use strict";var s=o(1533);i.exports=l;function l(u){return Array.isArray(u)&&u.length===2&&s(u[0])&&s(u[1])}},5716:function(i,a,o){"use strict";var s=o(6859);i.exports=l;function l(u){return u.cmp(new s(0))}},1369:function(i,a,o){"use strict";var s=o(5716);i.exports=l;function l(u){var c=u.length,f=u.words,h=0;if(c===1)h=f[0];else if(c===2)h=f[0]+f[1]*6710886
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 offset, majorAxis, minorAxis, screenAxis;
|
|||
|
uniform float lineWidth;
|
|||
|
uniform vec2 screenShape;
|
|||
|
|
|||
|
vec3 project(vec3 p) {
|
|||
|
vec4 pp = projection * (view * (model * vec4(p, 1.0)));
|
|||
|
return pp.xyz / max(pp.w, 0.0001);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 major = position.x * majorAxis;
|
|||
|
vec3 minor = position.y * minorAxis;
|
|||
|
|
|||
|
vec3 vPosition = major + minor + offset;
|
|||
|
vec3 pPosition = project(vPosition);
|
|||
|
vec3 offset = project(vPosition + screenAxis * position.z);
|
|||
|
|
|||
|
vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;
|
|||
|
|
|||
|
gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec4 color;
|
|||
|
void main() {
|
|||
|
gl_FragColor = color;
|
|||
|
}`]);a.n=function(x){return l(x,u,c,null,[{name:"position",type:"vec3"}])};var f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 offset, axis, alignDir, alignOpt;
|
|||
|
uniform float scale, angle, pixelScale;
|
|||
|
uniform vec2 resolution;
|
|||
|
|
|||
|
vec3 project(vec3 p) {
|
|||
|
vec4 pp = projection * (view * (model * vec4(p, 1.0)));
|
|||
|
return pp.xyz / max(pp.w, 0.0001);
|
|||
|
}
|
|||
|
|
|||
|
float computeViewAngle(vec3 a, vec3 b) {
|
|||
|
vec3 A = project(a);
|
|||
|
vec3 B = project(b);
|
|||
|
|
|||
|
return atan(
|
|||
|
(B.y - A.y) * resolution.y,
|
|||
|
(B.x - A.x) * resolution.x
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
const float PI = 3.141592;
|
|||
|
const float TWO_PI = 2.0 * PI;
|
|||
|
const float HALF_PI = 0.5 * PI;
|
|||
|
const float ONE_AND_HALF_PI = 1.5 * PI;
|
|||
|
|
|||
|
int option = int(floor(alignOpt.x + 0.001));
|
|||
|
float hv_ratio = alignOpt.y;
|
|||
|
bool enableAlign = (alignOpt.z != 0.0);
|
|||
|
|
|||
|
float mod_angle(float a) {
|
|||
|
return mod(a, PI);
|
|||
|
}
|
|||
|
|
|||
|
float positive_angle(float a) {
|
|||
|
return mod_angle((a < 0.0) ?
|
|||
|
a + TWO_PI :
|
|||
|
a
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
float look_upwards(float a) {
|
|||
|
float b = positive_angle(a);
|
|||
|
return ((b > HALF_PI) && (b <= ONE_AND_HALF_PI)) ?
|
|||
|
b - PI :
|
|||
|
b;
|
|||
|
}
|
|||
|
|
|||
|
float look_horizontal_or_vertical(float a, float ratio) {
|
|||
|
// ratio controls the ratio between being horizontal to (vertical + horizontal)
|
|||
|
// if ratio is set to 0.5 then it is 50%, 50%.
|
|||
|
// when using a higher ratio e.g. 0.75 the result would
|
|||
|
// likely be more horizontal than vertical.
|
|||
|
|
|||
|
float b = positive_angle(a);
|
|||
|
|
|||
|
return
|
|||
|
(b < ( ratio) * HALF_PI) ? 0.0 :
|
|||
|
(b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :
|
|||
|
(b < (2.0 + ratio) * HALF_PI) ? 0.0 :
|
|||
|
(b < (4.0 - ratio) * HALF_PI) ? HALF_PI :
|
|||
|
0.0;
|
|||
|
}
|
|||
|
|
|||
|
float roundTo(float a, float b) {
|
|||
|
return float(b * floor((a + 0.5 * b) / b));
|
|||
|
}
|
|||
|
|
|||
|
float look_round_n_directions(float a, int n) {
|
|||
|
float b = positive_angle(a);
|
|||
|
float div = TWO_PI / float(n);
|
|||
|
float c = roundTo(b, div);
|
|||
|
return look_upwards(c);
|
|||
|
}
|
|||
|
|
|||
|
float applyAlignOption(float rawAngle, float delta) {
|
|||
|
return
|
|||
|
(option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions
|
|||
|
(option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical
|
|||
|
(option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis
|
|||
|
(option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards
|
|||
|
(option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal
|
|||
|
rawAngle; // otherwise return back raw input angle
|
|||
|
}
|
|||
|
|
|||
|
bool isAxisTitle = (axis.x == 0.0) &&
|
|||
|
(axis.y == 0.0) &&
|
|||
|
(axis.z == 0.0);
|
|||
|
|
|||
|
void main() {
|
|||
|
//Compute world offset
|
|||
|
float axisDistance = position.z;
|
|||
|
vec3 dataPosition = axisDistance * axis + offset;
|
|||
|
|
|||
|
float beta = angle; // i.e. user defined attributes for each tick
|
|||
|
|
|||
|
float axisAngle;
|
|||
|
float clipAngle;
|
|||
|
float flip;
|
|||
|
|
|||
|
if (enableAlign) {
|
|||
|
axisAngle = (isAxisTitle) ? HALF_PI :
|
|||
|
computeViewAngle(dataPosition, dataPosition + axis);
|
|||
|
clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);
|
|||
|
|
|||
|
axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;
|
|||
|
clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;
|
|||
|
|
|||
|
flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),
|
|||
|
vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;
|
|||
|
|
|||
|
beta += applyAlignOption(clipAngle, flip * PI);
|
|||
|
}
|
|||
|
|
|||
|
//Compute plane offset
|
|||
|
vec2 planeCoord = position.xy * pixelScale;
|
|||
|
|
|||
|
mat2 planeXform = scale * mat2(
|
|||
|
cos(beta), sin(beta),
|
|||
|
-sin(beta), cos(beta)
|
|||
|
);
|
|||
|
|
|||
|
vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;
|
|||
|
|
|||
|
//Compute clip position
|
|||
|
vec3 clipPosition = project(dataPosition);
|
|||
|
|
|||
|
//Apply text offset in clip coordinates
|
|||
|
clipPosition += vec3(viewOffset, 0.0);
|
|||
|
|
|||
|
//Done
|
|||
|
gl_Position = vec4(clipPosition, 1.0);
|
|||
|
}
|
|||
|
`]),h=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec4 color;
|
|||
|
void main() {
|
|||
|
gl_FragColor = color;
|
|||
|
}`]);a.Q=function(x){return l(x,f,h,null,[{name:"position",type:"vec3"}])};var d=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec3 normal;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 enable;
|
|||
|
uniform vec3 bounds[2];
|
|||
|
|
|||
|
varying vec3 colorChannel;
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 signAxis = sign(bounds[1] - bounds[0]);
|
|||
|
|
|||
|
vec3 realNormal = signAxis * normal;
|
|||
|
|
|||
|
if(dot(realNormal, enable) > 0.0) {
|
|||
|
vec3 minRange = min(bounds[0], bounds[1]);
|
|||
|
vec3 maxRange = max(bounds[0], bounds[1]);
|
|||
|
vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));
|
|||
|
gl_Position = projection * (view * (model * vec4(nPosition, 1.0)));
|
|||
|
} else {
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
}
|
|||
|
|
|||
|
colorChannel = abs(realNormal);
|
|||
|
}
|
|||
|
`]),v=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec4 colors[3];
|
|||
|
|
|||
|
varying vec3 colorChannel;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = colorChannel.x * colors[0] +
|
|||
|
colorChannel.y * colors[1] +
|
|||
|
colorChannel.z * colors[2];
|
|||
|
}`]);a.bg=function(x){return l(x,d,v,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},4935:function(i,a,o){"use strict";i.exports=C;var s=o(2762),l=o(8116),u=o(4359),c=o(1879).Q,f=window||process.global||{},h=f.__TEXT_CACHE||{};f.__TEXT_CACHE={};var d=3;function v(E,A,L,_){this.gl=E,this.shader=A,this.buffer=L,this.vao=_,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}var x=v.prototype,b=[0,0];x.bind=function(E,A,L,_){this.vao.bind(),this.shader.bind();var k=this.shader.uniforms;k.model=E,k.view=A,k.projection=L,k.pixelScale=_,b[0]=this.gl.drawingBufferWidth,b[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=b},x.unbind=function(){this.vao.unbind()},x.update=function(E,A,L,_,k){var M=[];function g(j,re,oe,_e,Me,ke){var me=[oe.style,oe.weight,oe.variant,oe.family].join("_"),ie=h[me];ie||(ie=h[me]={});var Se=ie[re];Se||(Se=ie[re]=p(re,{triangles:!0,font:oe.family,fontStyle:oe.style,fontWeight:oe.weight,fontVariant:oe.variant,textAlign:"center",textBaseline:"middle",lineSpacing:Me,styletags:ke}));for(var Le=(_e||12)/12,Ae=Se.positions,De=Se.cells,Pe=0,ge=De.length;Pe<ge;++Pe)for(var Fe=De[Pe],ce=2;ce>=0;--ce){var Ze=Ae[Fe[ce]];M.push(Le*Ze[0],-Le*Ze[1],j)}}for(var P=[0,0,0],T=[0,0,0],z=[0,0,0],O=[0,0,0],V=1.25,G={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},Z=0;Z<3;++Z){z[Z]=M.length/d|0,g(.5*(E[0][Z]+E[1][Z]),A[Z],L[Z],12,V,G),O[Z]=(M.length/d|0)-z[Z],P[Z]=M.length/d|0;for(var H=0;H<_[Z].length;++H)if(_[Z][H].text){var N={family:_[Z][H].font||k[Z].family,style:k[Z].fontStyle||k[Z].style,weight:k[Z].fontWeight||k[Z].weight,variant:k[Z].fontVariant||k[Z].variant};g(_[Z][H].x,_[Z][H].text,N,_[Z][H].fontSize||12,V,G)}T[Z]=(M.length/d|0)-P[Z]}this.buffer.update(M),this.tickOffset=P,this.tickCount=T,this.labelOffset=z,this.labelCount=O},x.drawTicks=function(E,A,L,_,k,M,g,P){this.tickCount[E]&&(this.shader.uniforms.axis=M,this.shader.uniforms.color=k,this.shader.uniforms.angle=L,this.shader.uniforms.scale=A,this.shader.uniforms.offset=_,this.shader.uniforms.alignDir=g,this.shader.uniforms.alignOpt=P,this.vao.draw(this.gl.TRIANGLES,this.tickCount[E],this.tickOffset[E]))},x.drawLabel=function(E,A,L,_,k,M,g,P){this.labelCount[E]&&(this.shader.uniforms.axis=M,this.shader.uniforms.color=k,this.shader.uniforms.angle=L,this.shader.uniforms.scale=A,this.shader.uniforms.offset=_,this.shader.uniforms.alignDir=g,this.shader.uniforms.alignOpt=P,this.vao.draw(this.gl.TRIANGLES,this.labelCount[E],this.labelOffset[E]))},x.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()};function p(E,A){try{return u(E,A)}catch(L){return console.warn('error vectorizing text:"'+E+'" error:',L),{cells:[],positions:[]}}}function C(E,A,L,_,k,M){var g=s(E),P=l(E,[{buffer:g,size:3}]),T=c(E);T.attributes.position.location=0;var z=new v(E,T,g,P);return z.update(A,L,_,k,M),z}},6444:function(i,a){"use strict";a.create=s,a.equal=l;function o(u,c){var f=u+"",h=f.indexOf("."),d=0;h>=0&&(d=f.length-h-1);var v=Math.pow(10,d),x=Math.round(u*c*v),b=x+"";if(b.indexOf("e")>=0)return b;var p=x/v,C=x%v;x<0?(p=-Math.ceil(p)|0,C=-C|0):(p=Math.floor(p)|0,C=C|0);var E=""+p;if(x<0&&(E="-"+E),d){for(var A=""+C;A.length<d;)A="0"+A;return E+"."+A}else return E}function s(u,c){for(var f=[],h=0;h<3;++h){for(var d=[],v=.5*(u[0][h]+u[1][h]),x=0;x*c[h]<=u[1][h];++x)d.push({x:x*c[h],text:o(c[h],x)});for(var x=-1;x*c[h]>=u[0][h];--x)d.push({x:x*c[h],text:o(c[h],x)});f.push(d)}return f}function l(u,c){for(var f=0;f<3;++f){if(u[f].length!==c[f].length)return!1;for(var h=0;h<u[f].length;++h){var d=u[f][h],v=c[f][h];if(d.x!==v.x||d.text!==v.text||d.font!==v.font||d.fontColor!==v.fontColor||d.fontSize!==v.fontSize||d.dx!==v.dx||d.dy!==v.dy)return!1}}return!0}},5445:function(i,a,o){"use strict";i.exports=L;var s=o(5033),l=o(5202),u=o(6429),c=o(6760),f=o(5665),h=o(5352),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),v=new Float32Array(16);function x(_,k,M){this.lo=_,this.hi=k,this.pixelsPerDataUnit=M}var b=[0,0,0,1],p=[0,0,0,1];function C(_,k,M,g,P){for(var T=0;T<3;++T){for(var z=b,O=p,V=0;V
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the cone vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a cone with its top at origin and height of 1.0,
|
|||
|
// pointing in the direction of the vector attribute.
|
|||
|
//
|
|||
|
// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.
|
|||
|
// These vertices are used to make up the triangles of the cone by the following:
|
|||
|
// segment + 0 top vertex
|
|||
|
// segment + 1 perimeter vertex a+1
|
|||
|
// segment + 2 perimeter vertex a
|
|||
|
// segment + 3 center base vertex
|
|||
|
// segment + 4 perimeter vertex a
|
|||
|
// segment + 5 perimeter vertex a+1
|
|||
|
// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.
|
|||
|
// To go from index to segment, floor(index / 6)
|
|||
|
// To go from segment to angle, 2*pi * (segment/segmentCount)
|
|||
|
// To go from index to segment index, index - (segment*6)
|
|||
|
//
|
|||
|
vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {
|
|||
|
|
|||
|
const float segmentCount = 8.0;
|
|||
|
|
|||
|
float index = rawIndex - floor(rawIndex /
|
|||
|
(segmentCount * 6.0)) *
|
|||
|
(segmentCount * 6.0);
|
|||
|
|
|||
|
float segment = floor(0.001 + index/6.0);
|
|||
|
float segmentIndex = index - (segment*6.0);
|
|||
|
|
|||
|
normal = -normalize(d);
|
|||
|
|
|||
|
if (segmentIndex > 2.99 && segmentIndex < 3.01) {
|
|||
|
return mix(vec3(0.0), -d, coneOffset);
|
|||
|
}
|
|||
|
|
|||
|
float nextAngle = (
|
|||
|
(segmentIndex > 0.99 && segmentIndex < 1.01) ||
|
|||
|
(segmentIndex > 4.99 && segmentIndex < 5.01)
|
|||
|
) ? 1.0 : 0.0;
|
|||
|
float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);
|
|||
|
|
|||
|
vec3 v1 = mix(d, vec3(0.0), coneOffset);
|
|||
|
vec3 v2 = v1 - d;
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d)*0.25;
|
|||
|
vec3 y = v * sin(angle) * length(d)*0.25;
|
|||
|
vec3 v3 = v2 + x + y;
|
|||
|
if (segmentIndex < 3.0) {
|
|||
|
vec3 tx = u * sin(angle);
|
|||
|
vec3 ty = v * -cos(angle);
|
|||
|
vec3 tangent = tx + ty;
|
|||
|
normal = normalize(cross(v3 - v1, tangent));
|
|||
|
}
|
|||
|
|
|||
|
if (segmentIndex == 0.0) {
|
|||
|
return mix(d, vec3(0.0), coneOffset);
|
|||
|
}
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 vector;
|
|||
|
attribute vec4 color, position;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform float vectorScale, coneScale, coneOffset;
|
|||
|
uniform mat4 model, view, projection, inverseModel;
|
|||
|
uniform vec3 eyePosition, lightPosition;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
// Scale the vector magnitude to stay constant with
|
|||
|
// model & view changes.
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);
|
|||
|
vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * conePosition;
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
f_lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
f_eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);
|
|||
|
|
|||
|
// vec4 m_position = model * vec4(conePosition, 1.0);
|
|||
|
vec4 t_position = view * conePosition;
|
|||
|
gl_Position = projection * t_position;
|
|||
|
|
|||
|
f_color = color;
|
|||
|
f_data = conePosition.xyz;
|
|||
|
f_position = position.xyz;
|
|||
|
f_uv = uv;
|
|||
|
}
|
|||
|
`]),u=s([`#extension GL_OES_standard_derivatives : enable
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float cookTorranceSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness,
|
|||
|
float fresnel) {
|
|||
|
|
|||
|
float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
|
|||
|
float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);
|
|||
|
|
|||
|
//Half angle vector
|
|||
|
vec3 H = normalize(lightDirection + viewDirection);
|
|||
|
|
|||
|
//Geometric term
|
|||
|
float NdotH = max(dot(surfaceNormal, H), 0.0);
|
|||
|
float VdotH = max(dot(viewDirection, H), 0.000001);
|
|||
|
float LdotH = max(dot(lightDirection, H), 0.000001);
|
|||
|
float G1 = (2.0 * NdotH * VdotN) / VdotH;
|
|||
|
float G2 = (2.0 * NdotH * LdotN) / LdotH;
|
|||
|
float G = min(1.0, min(G1, G2));
|
|||
|
|
|||
|
//Distribution term
|
|||
|
float D = beckmannDistribution(NdotH, roughness);
|
|||
|
|
|||
|
//Fresnel term
|
|||
|
float F = pow(1.0 - VdotN, fresnel);
|
|||
|
|
|||
|
//Multiply terms and done
|
|||
|
return G * F * D / max(3.14159265 * VdotN, 0.000001);
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
|
|||
|
uniform sampler2D texture;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
vec3 N = normalize(f_normal);
|
|||
|
vec3 L = normalize(f_lightDirection);
|
|||
|
vec3 V = normalize(f_eyeDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
vec4 surfaceColor = f_color * texture2D(texture, f_uv);
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = litColor * opacity;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the cone vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a cone with its top at origin and height of 1.0,
|
|||
|
// pointing in the direction of the vector attribute.
|
|||
|
//
|
|||
|
// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.
|
|||
|
// These vertices are used to make up the triangles of the cone by the following:
|
|||
|
// segment + 0 top vertex
|
|||
|
// segment + 1 perimeter vertex a+1
|
|||
|
// segment + 2 perimeter vertex a
|
|||
|
// segment + 3 center base vertex
|
|||
|
// segment + 4 perimeter vertex a
|
|||
|
// segment + 5 perimeter vertex a+1
|
|||
|
// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.
|
|||
|
// To go from index to segment, floor(index / 6)
|
|||
|
// To go from segment to angle, 2*pi * (segment/segmentCount)
|
|||
|
// To go from index to segment index, index - (segment*6)
|
|||
|
//
|
|||
|
vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {
|
|||
|
|
|||
|
const float segmentCount = 8.0;
|
|||
|
|
|||
|
float index = rawIndex - floor(rawIndex /
|
|||
|
(segmentCount * 6.0)) *
|
|||
|
(segmentCount * 6.0);
|
|||
|
|
|||
|
float segment = floor(0.001 + index/6.0);
|
|||
|
float segmentIndex = index - (segment*6.0);
|
|||
|
|
|||
|
normal = -normalize(d);
|
|||
|
|
|||
|
if (segmentIndex > 2.99 && segmentIndex < 3.01) {
|
|||
|
return mix(vec3(0.0), -d, coneOffset);
|
|||
|
}
|
|||
|
|
|||
|
float nextAngle = (
|
|||
|
(segmentIndex > 0.99 && segmentIndex < 1.01) ||
|
|||
|
(segmentIndex > 4.99 && segmentIndex < 5.01)
|
|||
|
) ? 1.0 : 0.0;
|
|||
|
float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);
|
|||
|
|
|||
|
vec3 v1 = mix(d, vec3(0.0), coneOffset);
|
|||
|
vec3 v2 = v1 - d;
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d)*0.25;
|
|||
|
vec3 y = v * sin(angle) * length(d)*0.25;
|
|||
|
vec3 v3 = v2 + x + y;
|
|||
|
if (segmentIndex < 3.0) {
|
|||
|
vec3 tx = u * sin(angle);
|
|||
|
vec3 ty = v * -cos(angle);
|
|||
|
vec3 tangent = tx + ty;
|
|||
|
normal = normalize(cross(v3 - v1, tangent));
|
|||
|
}
|
|||
|
|
|||
|
if (segmentIndex == 0.0) {
|
|||
|
return mix(d, vec3(0.0), coneOffset);
|
|||
|
}
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec4 vector;
|
|||
|
attribute vec4 position;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float vectorScale, coneScale, coneOffset;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal);
|
|||
|
vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
gl_Position = projection * (view * conePosition);
|
|||
|
f_id = id;
|
|||
|
f_position = position.xyz;
|
|||
|
}
|
|||
|
`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId, f_id.xyz);
|
|||
|
}`]);a.meshShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},a.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},737:function(i){i.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",3407
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, offset;
|
|||
|
attribute vec4 color;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float capSize;
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec3 fragPosition;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec4 worldPosition = model * vec4(position, 1.0);
|
|||
|
worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);
|
|||
|
gl_Position = projection * (view * worldPosition);
|
|||
|
fragColor = color;
|
|||
|
fragPosition = position;
|
|||
|
}`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float opacity;
|
|||
|
varying vec3 fragPosition;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||
|
|||
|
fragColor.a * opacity == 0.
|
|||
|
) discard;
|
|||
|
|
|||
|
gl_FragColor = opacity * fragColor;
|
|||
|
}`]);i.exports=function(f){return l(f,u,c,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},2260:function(i,a,o){"use strict";var s=o(7766);i.exports=k;var l=null,u,c,f,h;function d(M){var g=M.getParameter(M.FRAMEBUFFER_BINDING),P=M.getParameter(M.RENDERBUFFER_BINDING),T=M.getParameter(M.TEXTURE_BINDING_2D);return[g,P,T]}function v(M,g){M.bindFramebuffer(M.FRAMEBUFFER,g[0]),M.bindRenderbuffer(M.RENDERBUFFER,g[1]),M.bindTexture(M.TEXTURE_2D,g[2])}function x(M,g){var P=M.getParameter(g.MAX_COLOR_ATTACHMENTS_WEBGL);l=new Array(P+1);for(var T=0;T<=P;++T){for(var z=new Array(P),O=0;O<T;++O)z[O]=M.COLOR_ATTACHMENT0+O;for(var O=T;O<P;++O)z[O]=M.NONE;l[T]=z}}function b(M){switch(M){case u:throw new Error("gl-fbo: Framebuffer unsupported");case c:throw new Error("gl-fbo: Framebuffer incomplete attachment");case f:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case h:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function p(M,g,P,T,z,O){if(!T)return null;var V=s(M,g,P,z,T);return V.magFilter=M.NEAREST,V.minFilter=M.NEAREST,V.mipSamples=1,V.bind(),M.framebufferTexture2D(M.FRAMEBUFFER,O,M.TEXTURE_2D,V.handle,0),V}function C(M,g,P,T,z){var O=M.createRenderbuffer();return M.bindRenderbuffer(M.RENDERBUFFER,O),M.renderbufferStorage(M.RENDERBUFFER,T,g,P),M.framebufferRenderbuffer(M.FRAMEBUFFER,z,M.RENDERBUFFER,O),O}function E(M){var g=d(M.gl),P=M.gl,T=M.handle=P.createFramebuffer(),z=M._shape[0],O=M._shape[1],V=M.color.length,G=M._ext,Z=M._useStencil,H=M._useDepth,N=M._colorType;P.bindFramebuffer(P.FRAMEBUFFER,T);for(var j=0;j<V;++j)M.color[j]=p(P,z,O,N,P.RGBA,P.COLOR_ATTACHMENT0+j);V===0?(M._color_rb=C(P,z,O,P.RGBA4,P.COLOR_ATTACHMENT0),G&&G.drawBuffersWEBGL(l[0])):V>1&&G.drawBuffersWEBGL(l[V]);var re=P.getExtension("WEBGL_depth_texture");re?Z?M.depth=p(P,z,O,re.UNSIGNED_INT_24_8_WEBGL,P.DEPTH_STENCIL,P.DEPTH_STENCIL_ATTACHMENT):H&&(M.depth=p(P,z,O,P.UNSIGNED_SHORT,P.DEPTH_COMPONENT,P.DEPTH_ATTACHMENT)):H&&Z?M._depth_rb=C(P,z,O,P.DEPTH_STENCIL,P.DEPTH_STENCIL_ATTACHMENT):H?M._depth_rb=C(P,z,O,P.DEPTH_COMPONENT16,P.DEPTH_ATTACHMENT):Z&&(M._depth_rb=C(P,z,O,P.STENCIL_INDEX,P.STENCIL_ATTACHMENT));var oe=P.checkFramebufferStatus(P.FRAMEBUFFER);if(oe!==P.FRAMEBUFFER_COMPLETE){M._destroyed=!0,P.bindFramebuffer(P.FRAMEBUFFER,null),P.deleteFramebuffer(M.handle),M.handle=null,M.depth&&(M.depth.dispose(),M.depth=null),M._depth_rb&&(P.deleteRenderbuffer(M._depth_rb),M._depth_rb=null);for(var j=0;j<M.color.length;++j)M.color[j].dispose(),M.color[j]=null;M._color_rb&&(P.deleteRenderbuffer(M._color_rb),M._color_rb=null),v(P,g),b(oe)}v(P,g)}function A(M,g,P,T,z,O,V,G){this.gl=M,this._shape=[g|0,P|0],this._destroyed=!1,this._ext=G,this.color=new Array(z);for(var Z=0;Z<z;++Z)this.color[Z]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=T,this._useDepth=O,this._useStencil=V;var H=this,N=[g|0,P|0];Object.defineProperties(N,{0:{get:function(){return H._shape[0]},set:function(j){return H.width=j}},1:{get:function(){return H._shape[1]},set:function(j){return H.height=j}}}),this._shapeVector=N,E(this)}var L=A.prototype;function _(M,g,P){if(M._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(!(M._shape[0]===g&&M._shape[1]===P)){var T=M.gl,z=T.getParameter(T.MAX_RENDERBUFFER_SIZE);if(g<0||g>z||P<0||P>z)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");M._shape[0]=g,M._shape[1]=P;for(var O=d(T),V=0;V<M.color.length;++V)M.color[V].shape=M._shape;M._color_rb&&(T.bindRenderbuffer(T.RENDERBUFFER,M._color_rb),T.renderbufferStorage(T.RENDERBUFFER,T.RGBA4,M._shape[0],M._shape[1])),M.depth&&(M.depth.shape=M._shape),M._depth_rb&&(T.bindRenderbuffer(T.RENDERBUFFER,M._depth_rb),M._useDepth&&M._useStencil?T.renderbufferStorage(T.RENDERBUFFER,T.DEPTH_STENCIL,M._shape[0],M._shape[1]):M._useDepth?T.renderbufferStorage(T.RENDERBUFFER,T.DEPTH_COMPONENT16,M._shape[0],M._shape[1]):M._useStencil&&T.renderbufferStorage(T.RENDERBUFFER,T.STENCIL_INDEX,M._shape[0],M._s
|
|||
|
`,b,x),C=s("%s%s",p,h),E=h.split(`
|
|||
|
`),A={},L=0;L<E.length;L++){var _=E[L];if(!(_===""||_==="\0")){var k=parseInt(_.split(":")[2]);if(isNaN(k))throw new Error(s("Could not parse error: %s",_));A[k]=_}}for(var M=c(d).split(`
|
|||
|
`),L=0;L<M.length;L++)if(!(!A[L+3]&&!A[L+2]&&!A[L+1])){var g=M[L];if(p+=g+`
|
|||
|
`,A[L+1]){var P=A[L+1];P=P.substr(P.split(":",3).join(":").length+1).trim(),p+=s(`^^^ %s
|
|||
|
|
|||
|
`,P)}}return{long:p.trim(),short:C.trim()}}},7319:function(i,a,o){var s=o(3236),l=o(9405),u=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, nextPosition;
|
|||
|
attribute float arcLength, lineWidth;
|
|||
|
attribute vec4 color;
|
|||
|
|
|||
|
uniform vec2 screenShape;
|
|||
|
uniform float pixelRatio;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec3 worldPosition;
|
|||
|
varying float pixelArcLength;
|
|||
|
|
|||
|
vec4 project(vec3 p) {
|
|||
|
return projection * (view * (model * vec4(p, 1.0)));
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
vec4 startPoint = project(position);
|
|||
|
vec4 endPoint = project(nextPosition);
|
|||
|
|
|||
|
vec2 A = startPoint.xy / startPoint.w;
|
|||
|
vec2 B = endPoint.xy / endPoint.w;
|
|||
|
|
|||
|
float clipAngle = atan(
|
|||
|
(B.y - A.y) * screenShape.y,
|
|||
|
(B.x - A.x) * screenShape.x
|
|||
|
);
|
|||
|
|
|||
|
vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(
|
|||
|
sin(clipAngle),
|
|||
|
-cos(clipAngle)
|
|||
|
) / screenShape;
|
|||
|
|
|||
|
gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);
|
|||
|
|
|||
|
worldPosition = position;
|
|||
|
pixelArcLength = arcLength;
|
|||
|
fragColor = color;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform sampler2D dashTexture;
|
|||
|
uniform float dashScale;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec3 worldPosition;
|
|||
|
varying float pixelArcLength;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||
|
|||
|
fragColor.a * opacity == 0.
|
|||
|
) discard;
|
|||
|
|
|||
|
float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;
|
|||
|
if(dashWeight < 0.5) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
gl_FragColor = fragColor * opacity;
|
|||
|
}
|
|||
|
`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
#define FLOAT_MAX 1.70141184e38
|
|||
|
#define FLOAT_MIN 1.17549435e-38
|
|||
|
|
|||
|
// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl
|
|||
|
vec4 packFloat(float v) {
|
|||
|
float av = abs(v);
|
|||
|
|
|||
|
//Handle special cases
|
|||
|
if(av < FLOAT_MIN) {
|
|||
|
return vec4(0.0, 0.0, 0.0, 0.0);
|
|||
|
} else if(v > FLOAT_MAX) {
|
|||
|
return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;
|
|||
|
} else if(v < -FLOAT_MAX) {
|
|||
|
return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;
|
|||
|
}
|
|||
|
|
|||
|
vec4 c = vec4(0,0,0,0);
|
|||
|
|
|||
|
//Compute exponent and mantissa
|
|||
|
float e = floor(log2(av));
|
|||
|
float m = av * pow(2.0, -e) - 1.0;
|
|||
|
|
|||
|
//Unpack mantissa
|
|||
|
c[1] = floor(128.0 * m);
|
|||
|
m -= c[1] / 128.0;
|
|||
|
c[2] = floor(32768.0 * m);
|
|||
|
m -= c[2] / 32768.0;
|
|||
|
c[3] = floor(8388608.0 * m);
|
|||
|
|
|||
|
//Unpack exponent
|
|||
|
float ebias = e + 127.0;
|
|||
|
c[0] = floor(ebias / 2.0);
|
|||
|
ebias -= c[0] * 2.0;
|
|||
|
c[1] += floor(ebias) * 128.0;
|
|||
|
|
|||
|
//Unpack sign bit
|
|||
|
c[0] += 128.0 * step(0.0, -v);
|
|||
|
|
|||
|
//Scale back to range
|
|||
|
return c / 255.0;
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform float pickId;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec3 worldPosition;
|
|||
|
varying float pixelArcLength;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz);
|
|||
|
}`]),h=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];a.createShader=function(d){return l(d,u,c,null,h)},a.createPickShader=function(d){return l(d,u,f,null,h)}},5714:function(i,a,o){"use strict";i.exports=M;var s=o(2762),l=o(8116),u=o(7766),c=new Uint8Array(4),f=new Float32Array(c.buffer);function h(g,P,T,z){return c[0]=z,c[1]=T,c[2]=P,c[3]=g,f[0]}var d=o(2478),v=o(9618),x=o(7319),b=x.createShader,p=x.createPickShader,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function E(g,P){for(var T=0,z=0;z<3;++z){var O=g[z]-P[z];T+=O*O}return Math.sqrt(T)}function A(g){for(var P=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],T=0;T<3;++T)P[0][T]=Math.max(g[0][T],P[0][T]),P[1][T]=Math.min(g[1][T],P[1][T]);return P}function L(g,P,T,z){this.arcLength=g,this.position=P,this.index=T,this.dataCoordinate=z}function _(g,P,T,z,O,V){this.gl=g,this.shader=P,this.pickShader=T,this.buffer=z,this.vao=O,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=V,this.dashScale=1,this.opacity=1,this.hasAlpha=!1,this.dirty=!0,this.pixelRatio=1}var k=_.prototype;k.isTransparent=function(){return this.hasAlpha},k.isOpaque=function(){return!this.hasAlpha},k.pickSlots=1,k.setPickBase=function(g){this.pickId=g},k.drawTransparent=k.draw=function(g){if(this.vertexCount){var P=this.gl,T=this.shader,z=this.vao;T.bind(),T.uniforms={model:g.model||C,view:g.view||C,projection:g.projection||C,clipBounds:A(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[P.drawingBufferWidth,P.drawingBufferHeight],pixelRatio:this.pixelRatio},z.bind(),z.draw(P.TRIANGLE_STRIP,this.vertexCount),z.unbind()}},k.drawPick=function(g){if(this.vertexCount){var P=this.gl,T=this.pickShader,z=this.vao;T.bind(),T.uniforms={model:g.model||C,view:g.view||C,projection:g.projection||C,pickId:this.pickId,clipBounds:A(this.clipBounds),screenShape:[P.drawingBufferWidth,P.drawingBufferHeight],pixelRatio:this.pixelRatio},z.bind(),z.draw(P.TRIANGLE_STRIP,this.vertexCount),z.unbind()}},k.update=function(g){var P,T;this.dirty=!0;var z=!!g.connectGaps;"dashScale"in g&&(this.dashScale=g.dashScale),this.hasAlpha=!1,"opacity"in g&&(this.opacity=+g.opacity,this.opacity<1&&(this.hasAlpha=!0));var O=[],V=[],G=[],Z=0,H=0,N=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],j=g.position||g.positions;if(j){var re=g.color||g.colors||[0,0,0,1],oe=g.lineWidth||1,_e=!1;e:for(P=1;P<j.length;++P){var Me=j[P-1],ke=j[P];for(V.push(Z),G.push(Me.slice()),T=0;T<3;++T){if(isNaN(Me[T])||isNaN(ke[T])||!isFinite(Me[T])||!isFinite(ke[T])){if(!z&&O.length>0){for(var me=0;me<24;++me)O.push(O[O.length-12]);H+=2,_e=!0}continue e}N[0][T]=Math.min(N[0][T],Me[T],ke[T]),N[1][T]=Math.max(N[1][T],Me[T],ke[T])}var ie,Se;Array.isArray(re[0])?(ie=re.length>P-1?re[P-1]:re.length>0?re[re.length-1]:[0,0,0,1],Se=re.length>P?re[P]:re.length>0?re[re.length-1]:[0,0,0,1]):ie=Se=re,ie.length===3&&(ie=[ie[0],ie[1],ie[2],1]),Se.length===3&&(Se=[Se[0],Se[1],Se[2],1]),!this.hasAlpha&&ie[3]<1&&(this.hasAlpha=!0);var Le;Array.isArray(oe)?Le=oe.length>P-1?oe[P-1]:oe.length>0?oe[oe.length-1]:[0,0,0,1]:Le=oe;var Ae=Z;if(Z+=E(Me,ke),_e){for(T=0;T<2;++T)O.push(Me[0],Me[1],Me[2],ke[0],ke[1],ke[2],Ae,Le,ie[0],ie[1],ie[2],ie[3]);H+=2,_e=!1}O.push(Me[0],Me[1],Me[2],ke[0],ke[1],ke[2],Ae,Le,ie[0],ie[1],ie[2],ie[3],Me[0],Me[1],Me[2],ke[0],ke[1],ke[2],Ae,-Le,ie[0],ie[1],ie[2],ie[3],ke[0],ke[1],ke[2],Me[0],Me[1],Me[2],Z,-Le,Se[0],Se[1],Se[2],Se[3],ke[0],ke[1],ke[2],Me[0],Me[1],Me[2],Z,Le,Se[0],Se[1],Se[2],Se[3]),H+=4}}if(this.buffer.update(O),V.push(Z),G.push(j[j.length-1].slice()),this.bounds=N,this.vertexCount=H,this.points=G,this.arcLength=V,"dashes"in g){var De=g.dashes,Pe=De.slice();for(Pe.unshift(0),P=1;P<Pe.length;++P)Pe[P]=Pe[P-1]+Pe[P];var ge=v(new Array(256*4),[256,1,4]);for(P=0;P<256;++P){for(T=0;T<4;++T)ge.set(P,0,T,0);d.le(Pe,Pe[Pe.length-1]*P/255)&1?ge.set(P,0,0,0):ge.set(P,0,
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, normal;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform mat4 model
|
|||
|
, view
|
|||
|
, projection
|
|||
|
, inverseModel;
|
|||
|
uniform vec3 eyePosition
|
|||
|
, lightPosition;
|
|||
|
|
|||
|
varying vec3 f_normal
|
|||
|
, f_lightDirection
|
|||
|
, f_eyeDirection
|
|||
|
, f_data;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
vec4 project(vec3 p) {
|
|||
|
return projection * (view * (model * vec4(p, 1.0)));
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = project(position);
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * vec4(position , 1.0);
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
f_lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
f_eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);
|
|||
|
|
|||
|
f_color = color;
|
|||
|
f_data = position;
|
|||
|
f_uv = uv;
|
|||
|
}
|
|||
|
`]),u=s([`#extension GL_OES_standard_derivatives : enable
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float cookTorranceSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness,
|
|||
|
float fresnel) {
|
|||
|
|
|||
|
float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
|
|||
|
float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);
|
|||
|
|
|||
|
//Half angle vector
|
|||
|
vec3 H = normalize(lightDirection + viewDirection);
|
|||
|
|
|||
|
//Geometric term
|
|||
|
float NdotH = max(dot(surfaceNormal, H), 0.0);
|
|||
|
float VdotH = max(dot(viewDirection, H), 0.000001);
|
|||
|
float LdotH = max(dot(lightDirection, H), 0.000001);
|
|||
|
float G1 = (2.0 * NdotH * VdotN) / VdotH;
|
|||
|
float G2 = (2.0 * NdotH * LdotN) / LdotH;
|
|||
|
float G = min(1.0, min(G1, G2));
|
|||
|
|
|||
|
//Distribution term
|
|||
|
float D = beckmannDistribution(NdotH, roughness);
|
|||
|
|
|||
|
//Fresnel term
|
|||
|
float F = pow(1.0 - VdotN, fresnel);
|
|||
|
|
|||
|
//Multiply terms and done
|
|||
|
return G * F * D / max(3.14159265 * VdotN, 0.000001);
|
|||
|
}
|
|||
|
|
|||
|
//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness
|
|||
|
, fresnel
|
|||
|
, kambient
|
|||
|
, kdiffuse
|
|||
|
, kspecular;
|
|||
|
uniform sampler2D texture;
|
|||
|
|
|||
|
varying vec3 f_normal
|
|||
|
, f_lightDirection
|
|||
|
, f_eyeDirection
|
|||
|
, f_data;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (f_color.a == 0.0 ||
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], f_data)
|
|||
|
) discard;
|
|||
|
|
|||
|
vec3 N = normalize(f_normal);
|
|||
|
vec3 L = normalize(f_lightDirection);
|
|||
|
vec3 V = normalize(f_eyeDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
|
|||
|
//float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d
|
|||
|
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
vec4 surfaceColor = vec4(f_color.rgb, 1.0) * texture2D(texture, f_uv);
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = litColor * f_color.a;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec3 f_data;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
f_color = color;
|
|||
|
f_data = position;
|
|||
|
f_uv = uv;
|
|||
|
}`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform sampler2D texture;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec3 f_data;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;
|
|||
|
|
|||
|
gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;
|
|||
|
}`]),h=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 uv;
|
|||
|
attribute float pointSize;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0.0, 0.0 ,0.0 ,0.0);
|
|||
|
} else {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
}
|
|||
|
gl_PointSize = pointSize;
|
|||
|
f_color = color;
|
|||
|
f_uv = uv;
|
|||
|
}`]),d=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform sampler2D texture;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec2 pointR = gl_PointCoord.xy - vec2(0.5, 0.5);
|
|||
|
if(dot(pointR, pointR) > 0.25) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;
|
|||
|
}`]),v=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
f_id = id;
|
|||
|
f_position = position;
|
|||
|
}`]),x=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId, f_id.xyz);
|
|||
|
}`]),b=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute float pointSize;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0.0, 0.0, 0.0, 0.0);
|
|||
|
} else {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
gl_PointSize = pointSize;
|
|||
|
}
|
|||
|
f_id = id;
|
|||
|
f_position = position;
|
|||
|
}`]),p=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
}`]),C=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec3 contourColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = vec4(contourColor, 1.0);
|
|||
|
}
|
|||
|
`]);a.meshShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},a.wireShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},a.pointShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},a.pickShader={vertex:v,fragment:x,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},a.pointPickShader={vertex:b,fragment:x,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},a.contourShader={vertex:p,fragment:C,attributes:[{name:"position",type:"vec3"}]}},7201:function(i,a,o){"use strict";var s=1e-6,l=1e-6,u=o(9405),c=o(2762),f=o(8116),h=o(7766),d=o(8406),v=o(6760),x=o(7608),b=o(9618),p=o(6729),C=o(7765),E=o(1888),A=o(840),L=o(7626),_=A.meshShader,k=A.wireShader,M=A.pointShader,g=A.pickShader,P=A.pointPickShader,T=A.contourShader,z=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function O(me,ie,Se,Le,Ae,De,Pe,ge,Fe,ce,Ze,ct,pt,Wt,st,lt,Gt,Nt,$t,sr,wr,ur,Qe,Et,er,Ut,Ft){this.gl=me,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=ie,this.dirty=!0,this.triShader=Se,this.lineShader=Le,this.pointShader=Ae,this.pickShader=De,this.pointPickShader=Pe,this.contourShader=ge,this.trianglePositions=Fe,this.triangleColors=Ze,this.triangleNormals=pt,this.triangleUVs=ct,this.triangleIds=ce,this.triangleVAO=Wt,this.triangleCount=0,this.lineWidth=1,this.edgePositions=st,this.edgeColors=Gt,this.edgeUVs=Nt,this.edgeIds=lt,this.edgeVAO=$t,this.edgeCount=0,this.pointPositions=sr,this.pointColors=ur,this.pointUVs=Qe,this.pointSizes=Et,this.pointIds=wr,this.pointVAO=er,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=Ut,this.contourVAO=Ft,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this.hasAlpha=!1,this.opacityscale=!1,this._model=z,this._view=z,this._projection=z,this._resolution=[1,1]}var V=O.prototype;V.isOpaque=function(){return!this.hasAlpha},V.isTransparent=function(){return this.hasAlpha},V.pickSlots=1,V.setPickBase=function(me){this.pickId=me};function G(me,ie){if(!ie||!ie.length)return 1;for(var Se=0;Se<ie.length;++Se){if(ie.length<2)return 1;if(ie[Se][0]===me)return ie[Se][1];if(ie[Se][0]>me&&Se>0){var Le=(ie[Se][0]-me)/(ie[Se][0]-ie[Se-1][0]);return ie[Se][1]*(1-Le)+Le*ie[Se-1][1]}}return 1}function Z(me,ie){for(var Se=p({colormap:me,nshades:256,format:"rgba"}),Le=new Uint8Array(256*4),Ae=0;Ae<256;++Ae){for(var De=Se[Ae],Pe=0;Pe<3;++Pe)Le[4*Ae+Pe]=De[Pe];ie?Le[4*Ae+3]=255*G(Ae/255,ie):Le[4*Ae+3]=255*De[3]}return b(Le,[256,256,4],[4,0,1])}function H(me){for(var ie=me.length,Se=new Array(ie),Le=0;Le<ie;++Le)Se[Le]=me[Le][2];return Se}V.highlight=function(me){if(!me||!this.contourEnable){this.contourCount=0;return}for(var ie=C(this.cells,this.intensity,me.intensity),Se=ie.cells,Le=ie.vertexIds,Ae=ie.vertexWeights,De=Se.length,Pe=E.mallocFloat32(2*3*De),ge=0,Fe=0;Fe<De;++Fe)for(var ce=Se[Fe],Ze=0;Ze<2;++Ze){var ct=ce[0];ce.length===2&&(ct=ce[Ze]);for(var pt=Le[ct][0],Wt=Le[ct][1],st=Ae[ct],lt=1-st,Gt=this.positions[pt],Nt=this.positions[Wt],$t=0;$t<3;++$t)Pe[ge++]=st*Gt[$t]+lt*Nt[$t]}this.contourCount=ge/3|0,this.contourPositions.update(Pe.subarray(0,ge)),E.free(Pe)},V.update=function(me){me=me||{};var ie=this.gl;this.dirty=!0,"contourEnable"in me&&(this.contourEnable=me.contourEnable),"contourColor"in me&&(this.contourColor=me.contourColor),"lineWidth"in me&&(this.lineWidth=me.lineWidth),"lightPosition"in me&&(this.lightPosition=me.lightPosition),this.hasAlpha=!1,"opacity"in me&&(this.opacity=me.opacity,this.opacity<1&&(this.hasAlpha=!0)),"opacityscale"in me&&(this.opacityscale=me.opacityscale,this.hasA
|
|||
|
#define GLSLIFY 1
|
|||
|
attribute vec2 position;
|
|||
|
varying vec2 uv;
|
|||
|
void main() {
|
|||
|
uv = position;
|
|||
|
gl_Position = vec4(position, 0, 1);
|
|||
|
}`]),c=s([`precision mediump float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform sampler2D accumBuffer;
|
|||
|
varying vec2 uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));
|
|||
|
gl_FragColor = min(vec4(1,1,1,1), accum);
|
|||
|
}`]);i.exports=function(f){return l(f,u,c,null,[{name:"position",type:"vec2"}])}},4100:function(i,a,o){"use strict";var s=o(4437),l=o(3837),u=o(5445),c=o(4449),f=o(3589),h=o(2260),d=o(7169),v=o(351),x=o(4772),b=o(4040),p=o(799),C=o(9216)({tablet:!0,featureDetect:!0});i.exports={createScene:k,createCamera:s};function E(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function A(g,P){var T=null;try{T=g.getContext("webgl",P),T||(T=g.getContext("experimental-webgl",P))}catch(z){return null}return T}function L(g){var P=Math.round(Math.log(Math.abs(g))/Math.log(10));if(P<0){var T=Math.round(Math.pow(10,-P));return Math.ceil(g*T)/T}else if(P>0){var T=Math.round(Math.pow(10,P));return Math.ceil(g/T)*T}return Math.ceil(g)}function _(g){return typeof g=="boolean"?g:!0}function k(g){g=g||{},g.camera=g.camera||{};var P=g.canvas;if(!P)if(P=document.createElement("canvas"),g.container){var T=g.container;T.appendChild(P)}else document.body.appendChild(P);var z=g.gl;if(z||(g.glOptions&&(C=!!g.glOptions.preserveDrawingBuffer),z=A(P,g.glOptions||{premultipliedAlpha:!0,antialias:!0,preserveDrawingBuffer:C})),!z)throw new Error("webgl not supported");var O=g.bounds||[[-10,-10,-10],[10,10,10]],V=new E,G=h(z,z.drawingBufferWidth,z.drawingBufferHeight,{preferFloat:!C}),Z=p(z),H=g.cameraObject&&g.cameraObject._ortho===!0||g.camera.projection&&g.camera.projection.type==="orthographic"||!1,N={eye:g.camera.eye||[2,0,0],center:g.camera.center||[0,0,0],up:g.camera.up||[0,1,0],zoomMin:g.camera.zoomMax||.1,zoomMax:g.camera.zoomMin||100,mode:g.camera.mode||"turntable",_ortho:H},j=g.axes||{},re=l(z,j);re.enable=!j.disable;var oe=g.spikes||{},_e=c(z,oe),Me=[],ke=[],me=[],ie=[],Se=!0,Pe=!0,Le=new Array(16),Ae=new Array(16),De={view:null,projection:Le,model:Ae,_ortho:!1},Pe=!0,ge=[z.drawingBufferWidth,z.drawingBufferHeight],Fe=g.cameraObject||s(P,N),ce={gl:z,contextLost:!1,pixelRatio:g.pixelRatio||1,canvas:P,selection:V,camera:Fe,axes:re,axesPixels:null,spikes:_e,bounds:O,objects:Me,shape:ge,aspect:g.aspectRatio||[1,1,1],pickRadius:g.pickRadius||10,zNear:g.zNear||.01,zFar:g.zFar||1e3,fovy:g.fovy||Math.PI/4,clearColor:g.clearColor||[0,0,0,0],autoResize:_(g.autoResize),autoBounds:_(g.autoBounds),autoScale:!!g.autoScale,autoCenter:_(g.autoCenter),clipToBounds:_(g.clipToBounds),snapToData:!!g.snapToData,onselect:g.onselect||null,onrender:g.onrender||null,onclick:g.onclick||null,cameraParams:De,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(sr){this.aspect[0]=sr.x,this.aspect[1]=sr.y,this.aspect[2]=sr.z,Pe=!0},setBounds:function(sr,wr){this.bounds[0][sr]=wr.min,this.bounds[1][sr]=wr.max},setClearColor:function(sr){this.clearColor=sr},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},Ze=[z.drawingBufferWidth/ce.pixelRatio|0,z.drawingBufferHeight/ce.pixelRatio|0];function ct(){if(!ce._stopped&&ce.autoResize){var sr=P.parentNode,wr=1,ur=1;sr&&sr!==document.body?(wr=sr.clientWidth,ur=sr.clientHeight):(wr=window.innerWidth,ur=window.innerHeight);var Qe=Math.ceil(wr*ce.pixelRatio)|0,Et=Math.ceil(ur*ce.pixelRatio)|0;if(Qe!==P.width||Et!==P.height){P.width=Qe,P.height=Et;var er=P.style;er.position=er.position||"absolute",er.left="0px",er.top="0px",er.width=wr+"px",er.height=ur+"px",Se=!0}}}ce.autoResize&&ct(),window.addEventListener("resize",ct);function pt(){for(var sr=Me.length,wr=ie.length,ur=0;ur<wr;++ur)me[ur]=0;e:for(var ur=0;ur<sr;++ur){var Qe=Me[ur],Et=Qe.pickSlots;if(!Et){ke[ur]=-1;continue}for(var er=0;er<wr;++er)if(me[er]+Et<255){ke[ur]=er,Qe.setPickBase(me[er]+1),me[er]+=Et;continue e}var Ut=f(z,ge);ke[ur]=wr,ie.push(Ut),me.push(Et),Qe.setPickBase(1),wr+=1}for(;wr>0&&me[wr-1]===0;)me.pop(),ie.pop().dispose()}ce.update=function(sr){ce._stopped||(sr=sr||{},Se=!0,Pe=!0)},ce.add=function(sr){ce._stopped||(sr.axes=re,
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 glyph;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform vec4 highlightId;
|
|||
|
uniform float highlightScale;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
} else {
|
|||
|
float scale = 1.0;
|
|||
|
if(distance(highlightId, id) < 0.0001) {
|
|||
|
scale = highlightScale;
|
|||
|
}
|
|||
|
|
|||
|
vec4 worldPosition = model * vec4(position, 1);
|
|||
|
vec4 viewPosition = view * worldPosition;
|
|||
|
viewPosition = viewPosition / viewPosition.w;
|
|||
|
vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));
|
|||
|
|
|||
|
gl_Position = clipPosition;
|
|||
|
interpColor = color;
|
|||
|
pickId = id;
|
|||
|
dataCoordinate = position;
|
|||
|
}
|
|||
|
}`]),c=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 glyph;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec2 screenSize;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float highlightScale, pixelRatio;
|
|||
|
uniform vec4 highlightId;
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
} else {
|
|||
|
float scale = pixelRatio;
|
|||
|
if(distance(highlightId.bgr, id.bgr) < 0.001) {
|
|||
|
scale *= highlightScale;
|
|||
|
}
|
|||
|
|
|||
|
vec4 worldPosition = model * vec4(position, 1.0);
|
|||
|
vec4 viewPosition = view * worldPosition;
|
|||
|
vec4 clipPosition = projection * viewPosition;
|
|||
|
clipPosition /= clipPosition.w;
|
|||
|
|
|||
|
gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);
|
|||
|
interpColor = color;
|
|||
|
pickId = id;
|
|||
|
dataCoordinate = position;
|
|||
|
}
|
|||
|
}`]),f=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 glyph;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform float highlightScale;
|
|||
|
uniform vec4 highlightId;
|
|||
|
uniform vec3 axes[2];
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec2 screenSize;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float scale, pixelRatio;
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
} else {
|
|||
|
float lscale = pixelRatio * scale;
|
|||
|
if(distance(highlightId, id) < 0.0001) {
|
|||
|
lscale *= highlightScale;
|
|||
|
}
|
|||
|
|
|||
|
vec4 clipCenter = projection * (view * (model * vec4(position, 1)));
|
|||
|
vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;
|
|||
|
vec4 clipPosition = projection * (view * (model * vec4(dataPosition, 1)));
|
|||
|
|
|||
|
gl_Position = clipPosition;
|
|||
|
interpColor = color;
|
|||
|
pickId = id;
|
|||
|
dataCoordinate = dataPosition;
|
|||
|
}
|
|||
|
}
|
|||
|
`]),h=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 fragClipBounds[2];
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||
|
|||
|
interpColor.a * opacity == 0.
|
|||
|
) discard;
|
|||
|
gl_FragColor = interpColor * opacity;
|
|||
|
}
|
|||
|
`]),d=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 fragClipBounds[2];
|
|||
|
uniform float pickGroup;
|
|||
|
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickGroup, pickId.bgr);
|
|||
|
}`]),v=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],x={vertex:u,fragment:h,attributes:v},b={vertex:c,fragment:h,attributes:v},p={vertex:f,fragment:h,attributes:v},C={vertex:u,fragment:d,attributes:v},E={vertex:c,fragment:d,attributes:v},A={vertex:f,fragment:d,attributes:v};function L(_,k){var M=s(_,k),g=M.attributes;return g.position.location=0,g.color.location=1,g.glyph.location=2,g.id.location=3,M}a.createPerspective=function(_){return L(_,x)},a.createOrtho=function(_){return L(_,b)},a.createProject=function(_){return L(_,p)},a.createPickPerspective=function(_){return L(_,C)},a.createPickOrtho=function(_){return L(_,E)},a.createPickProject=function(_){return L(_,A)}},8418:function(i,a,o){"use strict";var s=o(5219),l=o(2762),u=o(8116),c=o(1888),f=o(6760),h=o(1283),d=o(9366),v=o(5964),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],b=ArrayBuffer,p=DataView;function C(Ae){return b.isView(Ae)&&!(Ae instanceof p)}function E(Ae){return Array.isArray(Ae)||C(Ae)}i.exports=Le;function A(Ae,De){var Pe=Ae[0],ge=Ae[1],Fe=Ae[2],ce=Ae[3];return Ae[0]=De[0]*Pe+De[4]*ge+De[8]*Fe+De[12]*ce,Ae[1]=De[1]*Pe+De[5]*ge+De[9]*Fe+De[13]*ce,Ae[2]=De[2]*Pe+De[6]*ge+De[10]*Fe+De[14]*ce,Ae[3]=De[3]*Pe+De[7]*ge+De[11]*Fe+De[15]*ce,Ae}function L(Ae,De,Pe,ge){return A(ge,ge,Pe),A(ge,ge,De),A(ge,ge,Ae)}function _(Ae,De){this.index=Ae,this.dataCoordinate=this.position=De}function k(Ae){return Ae===!0||Ae>1?1:Ae}function M(Ae,De,Pe,ge,Fe,ce,Ze,ct,pt,Wt,st,lt){this.gl=Ae,this.pixelRatio=1,this.shader=De,this.orthoShader=Pe,this.projectShader=ge,this.pointBuffer=Fe,this.colorBuffer=ce,this.glyphBuffer=Ze,this.idBuffer=ct,this.vao=pt,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.hasAlpha=!1,this.lineWidth=0,this.projectScale=[.6666666666666666,.6666666666666666,.6666666666666666],this.projectOpacity=[1,1,1],this.projectHasAlpha=!1,this.pickId=0,this.pickPerspectiveShader=Wt,this.pickOrthoShader=st,this.pickProjectShader=lt,this.points=[],this._selectResult=new _(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.dirty=!0}var g=M.prototype;g.pickSlots=1,g.setPickBase=function(Ae){this.pickId=Ae},g.isTransparent=function(){if(this.hasAlpha)return!0;for(var Ae=0;Ae<3;++Ae)if(this.axesProject[Ae]&&this.projectHasAlpha)return!0;return!1},g.isOpaque=function(){if(!this.hasAlpha)return!0;for(var Ae=0;Ae<3;++Ae)if(this.axesProject[Ae]&&!this.projectHasAlpha)return!0;return!1};var P=[0,0],T=[0,0,0],z=[0,0,0],O=[0,0,0,1],V=[0,0,0,1],G=x.slice(),Z=[0,0,0],H=[[0,0,0],[0,0,0]];function N(Ae){return Ae[0]=Ae[1]=Ae[2]=0,Ae}function j(Ae,De){return Ae[0]=De[0],Ae[1]=De[1],Ae[2]=De[2],Ae[3]=1,Ae}function re(Ae,De,Pe,ge){return Ae[0]=De[0],Ae[1]=De[1],Ae[2]=De[2],Ae[Pe]=ge,Ae}function oe(Ae){for(var De=H,Pe=0;Pe<2;++Pe)for(var ge=0;ge<3;++ge)De[Pe][ge]=Math.max(Math.min(Ae[Pe][ge],1e8),-1e8);return De}function _e(Ae,De,Pe,ge){var Fe=De.axesProject,ce=De.gl,Ze=Ae.uniforms,ct=Pe.model||x,pt=Pe.view||x,Wt=Pe.projection||x,st=De.axesBounds,lt=oe(De.clipBounds),Gt;De.axes&&De.axes.lastCubeProps?Gt=De.axes.lastCubeProps.axis:Gt=[1,1,1],P[0]=2/ce.drawingBufferWidth,P[1]=2/ce.drawingBufferHeight,Ae.bind(),Ze.view=pt,Ze.projection=Wt,Ze.screenSize=P,Ze.highlightId=De.highlightId,Ze.highlightScale=De.highlightScale,Ze.clipBounds=lt,Ze.pickGroup=De.pickId/255,Ze.pixelRatio=ge;for(var Nt=0;Nt<3;++Nt)if(Fe[Nt]){Ze.scale=De.projectScale[Nt],Ze.opacity=De.projectOpacity[Nt];for(var $t=G,sr=0;sr<16;++sr)$t[sr]=0;for(var sr=0;sr<4;++sr)$t[5*sr]=1;$t[5*Nt]=0,Gt[Nt]<0?$t[12+Nt]=st[0][Nt]:$t[12+Nt]=st[1][Nt],f($t,ct,$t),Ze.model=$t;var wr=(Nt+1)%3,ur=(Nt+2)%3,Qe=N(T),Et=N(z);Qe[wr]=1,Et[ur]=1;var er=L(Wt,pt,ct,j(O,Qe)),Ut=L(Wt,pt,ct,j(V,Et));if(Math.abs(er[1])>Math.abs(Ut[1])){var Ft=er;er=Ut,Ut=Ft,Ft=Qe,Qe=Et,Et=Ft;var bt=wr;wr=ur,ur=bt}er[0]<0&&(Qe[wr]=-1),Ut[1]>0&&(Et[ur]=-1);for(var yt=0,Yt=0,sr=0;sr<4;++sr)yt+=Math.pow(ct
|
|||
|
`+l:""),this.stack=new Error().stack}a.prototype=new Error,a.prototype.name="GLError",a.prototype.constructor=a,i.exports=a},8731:function(i,a,o){"use strict";i.exports=d;var s=o(8866);function l(v,x,b,p,C,E){this._gl=v,this._wrapper=x,this._index=b,this._locations=p,this._dimension=C,this._constFunc=E}var u=l.prototype;u.pointer=function(x,b,p,C){var E=this,A=E._gl,L=E._locations[E._index];A.vertexAttribPointer(L,E._dimension,x||A.FLOAT,!!b,p||0,C||0),A.enableVertexAttribArray(L)},u.set=function(v,x,b,p){return this._constFunc(this._locations[this._index],v,x,b,p)},Object.defineProperty(u,"location",{get:function(){return this._locations[this._index]},set:function(v){return v!==this._locations[this._index]&&(this._locations[this._index]=v|0,this._wrapper.program=null),v|0}});var c=[function(v,x,b){return b.length===void 0?v.vertexAttrib1f(x,b):v.vertexAttrib1fv(x,b)},function(v,x,b,p){return b.length===void 0?v.vertexAttrib2f(x,b,p):v.vertexAttrib2fv(x,b)},function(v,x,b,p,C){return b.length===void 0?v.vertexAttrib3f(x,b,p,C):v.vertexAttrib3fv(x,b)},function(v,x,b,p,C,E){return b.length===void 0?v.vertexAttrib4f(x,b,p,C,E):v.vertexAttrib4fv(x,b)}];function f(v,x,b,p,C,E,A){var L=c[C],_=new l(v,x,b,p,C,L);Object.defineProperty(E,A,{set:function(k){return v.disableVertexAttribArray(p[b]),L(v,p[b],k),k},get:function(){return _},enumerable:!0})}function h(v,x,b,p,C,E,A){for(var L=new Array(C),_=new Array(C),k=0;k<C;++k)f(v,x,b[k],p,C,L,k),_[k]=L[k];Object.defineProperty(L,"location",{set:function(P){if(Array.isArray(P))for(var T=0;T<C;++T)_[T].location=P[T];else for(var T=0;T<C;++T)_[T].location=P+T;return P},get:function(){for(var P=new Array(C),T=0;T<C;++T)P[T]=p[b[T]];return P},enumerable:!0}),L.pointer=function(P,T,z,O){P=P||v.FLOAT,T=!!T,z=z||C*C,O=O||0;for(var V=0;V<C;++V){var G=p[b[V]];v.vertexAttribPointer(G,C,P,T,z,O+V*C),v.enableVertexAttribArray(G)}};var M=new Array(C),g=v["vertexAttrib"+C+"fv"];Object.defineProperty(E,A,{set:function(P){for(var T=0;T<C;++T){var z=p[b[T]];if(v.disableVertexAttribArray(z),Array.isArray(P[0]))g.call(v,z,P[T]);else{for(var O=0;O<C;++O)M[O]=P[C*T+O];g.call(v,z,M)}}return P},get:function(){return L},enumerable:!0})}function d(v,x,b,p){for(var C={},E=0,A=b.length;E<A;++E){var L=b[E],_=L.name,k=L.type,M=L.locations;switch(k){case"bool":case"int":case"float":f(v,x,M[0],p,1,C,_);break;default:if(k.indexOf("vec")>=0){var g=k.charCodeAt(k.length-1)-48;if(g<2||g>4)throw new s("","Invalid data type for attribute "+_+": "+k);f(v,x,M[0],p,g,C,_)}else if(k.indexOf("mat")>=0){var g=k.charCodeAt(k.length-1)-48;if(g<2||g>4)throw new s("","Invalid data type for attribute "+_+": "+k);h(v,x,M,p,g,C,_)}else throw new s("","Unknown data type for attribute "+_+": "+k);break}}return C}},3327:function(i,a,o){"use strict";var s=o(216),l=o(8866);i.exports=f;function u(h){return function(){return h}}function c(h,d){for(var v=new Array(h),x=0;x<h;++x)v[x]=d;return v}function f(h,d,v,x){function b(k){return function(M,g,P){return M.getUniform(g.program,P[k])}}function p(k){return function(g){for(var P=C("",k),T=0;T<P.length;++T){var z=P[T],O=z[0],V=z[1];if(x[V]){var G=g;if(typeof O=="string"&&(O.indexOf(".")===0||O.indexOf("[")===0)){var Z=O;if(O.indexOf(".")===0&&(Z=O.slice(1)),Z.indexOf("]")===Z.length-1){var H=Z.indexOf("["),N=Z.slice(0,H),j=Z.slice(H+1,Z.length-1);G=N?g[N][j]:g[j]}else G=g[Z]}var re=v[V].type,oe;switch(re){case"bool":case"int":case"sampler2D":case"samplerCube":h.uniform1i(x[V],G);break;case"float":h.uniform1f(x[V],G);break;default:var _e=re.indexOf("vec");if(0<=_e&&_e<=1&&re.length===4+_e){if(oe=re.charCodeAt(re.length-1)-48,oe<2||oe>4)throw new l("","Invalid data type");switch(re.charAt(0)){case"b":case"i":h["uniform"+oe+"iv"](x[V],G);break;case"v":h["uniform"+oe+"fv"](x[V],G);break;default:throw new l("","Unrecognized data type for vector "+name+": "+re)}}else if(re.indexOf("mat")===0&&re.length===4){if(oe=re.charCodeAt(re.length-1)-48,oe<2||oe>4)throw new l("","Invalid uniform dimension type for matrix "+name+": "+re);h["uniformMatrix"+oe+"fv"](x[V],!1,G);break}else throw new l("","Unkn
|
|||
|
`+M)}throw new s(M,g.short,g.long)}return k}v.getShaderReference=function(A,L){var _=this.gl,k=this.shaders[A===_.FRAGMENT_SHADER|0],M=k[L];if(!M||!_.isShader(M.shader)){var g=x(_,A,L);M=k[L]=new h(f++,L,A,g,[],1,this)}else M.count+=1;return M};function b(A,L,_,k,M){var g=A.createProgram();A.attachShader(g,L),A.attachShader(g,_);for(var P=0;P<k.length;++P)A.bindAttribLocation(g,M[P],k[P]);if(A.linkProgram(g),!A.getProgramParameter(g,A.LINK_STATUS)){var T=A.getProgramInfoLog(g);throw new s(T,"Error linking program: "+T)}return g}v.getProgram=function(A,L,_,k){var M=[A.id,L.id,_.join(":"),k.join(":")].join("@"),g=this.programs[M];return(!g||!this.gl.isProgram(g))&&(this.programs[M]=g=b(this.gl,A.shader,L.shader,_,k),A.programs.push(M),L.programs.push(M)),g};function p(A){var L=c.get(A);return L||(L=new d(A),c.set(A,L)),L}function C(A,L,_){return p(A).getShaderReference(L,_)}function E(A,L,_,k,M){return p(A).getProgram(L,_,k,M)}},1493:function(i,a,o){"use strict";var s=o(3236),l=o(9405),u=s([`precision mediump float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, color;
|
|||
|
attribute float weight;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 coordinates[3];
|
|||
|
uniform vec4 colors[3];
|
|||
|
uniform vec2 screenShape;
|
|||
|
uniform float lineWidth;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 vertexPosition = mix(coordinates[0],
|
|||
|
mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));
|
|||
|
|
|||
|
vec4 clipPos = projection * (view * (model * vec4(vertexPosition, 1.0)));
|
|||
|
vec2 clipOffset = (projection * (view * (model * vec4(color, 0.0)))).xy;
|
|||
|
vec2 delta = weight * clipOffset * screenShape;
|
|||
|
vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;
|
|||
|
|
|||
|
gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);
|
|||
|
fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];
|
|||
|
}
|
|||
|
`]),c=s([`precision mediump float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = fragColor;
|
|||
|
}`]);i.exports=function(f){return l(f,u,c,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},4449:function(i,a,o){"use strict";var s=o(2762),l=o(8116),u=o(1493);i.exports=b;var c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function f(p,C,E,A){this.gl=p,this.buffer=C,this.vao=E,this.shader=A,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}var h=f.prototype,d=[0,0,0],v=[0,0,0],x=[0,0];h.isTransparent=function(){return!1},h.drawTransparent=function(p){},h.draw=function(p){var C=this.gl,E=this.vao,A=this.shader;E.bind(),A.bind();var L=p.model||c,_=p.view||c,k=p.projection||c,M;this.axes&&(M=this.axes.lastCubeProps.axis);for(var g=d,P=v,T=0;T<3;++T)M&&M[T]<0?(g[T]=this.bounds[0][T],P[T]=this.bounds[1][T]):(g[T]=this.bounds[1][T],P[T]=this.bounds[0][T]);x[0]=C.drawingBufferWidth,x[1]=C.drawingBufferHeight,A.uniforms.model=L,A.uniforms.view=_,A.uniforms.projection=k,A.uniforms.coordinates=[this.position,g,P],A.uniforms.colors=this.colors,A.uniforms.screenShape=x;for(var T=0;T<3;++T)A.uniforms.lineWidth=this.lineWidth[T]*this.pixelRatio,this.enabled[T]&&(E.draw(C.TRIANGLES,6,6*T),this.drawSides[T]&&E.draw(C.TRIANGLES,12,18+12*T));E.unbind()},h.update=function(p){p&&("bounds"in p&&(this.bounds=p.bounds),"position"in p&&(this.position=p.position),"lineWidth"in p&&(this.lineWidth=p.lineWidth),"colors"in p&&(this.colors=p.colors),"enabled"in p&&(this.enabled=p.enabled),"drawSides"in p&&(this.drawSides=p.drawSides))},h.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()};function b(p,C){var E=[];function A(g,P,T,z,O,V){var G=[g,P,T,0,0,0,1];G[z+3]=1,G[z]=O,E.push.apply(E,G),G[6]=-1,E.push.apply(E,G),G[z]=V,E.push.apply(E,G),E.push.apply(E,G),G[6]=1,E.push.apply(E,G),G[z]=O,E.push.apply(E,G)}A(0,0,0,0,0,1),A(0,0,0,1,0,1),A(0,0,0,2,0,1),A(1,0,0,1,-1,1),A(1,0,0,2,-1,1),A(0,1,0,0,-1,1),A(0,1,0,2,-1,1),A(0,0,1,0,-1,1),A(0,0,1,1,-1,1);var L=s(p,E),_=l(p,[{type:p.FLOAT,buffer:L,size:3,offset:0,stride:28},{type:p.FLOAT,buffer:L,size:3,offset:12,stride:28},{type:p.FLOAT,buffer:L,size:1,offset:24,stride:28}]),k=u(p);k.attributes.position.location=0,k.attributes.color.location=1,k.attributes.weight.location=2;var M=new f(p,L,_,k);return M.update(C),M}},6740:function(i,a,o){var s=o(3236),l=s([`precision highp float;
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the tube vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.
|
|||
|
//
|
|||
|
// Each tube segment is made up of a ring of vertices.
|
|||
|
// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.
|
|||
|
// The indexes of tube segments run from 0 to 8.
|
|||
|
//
|
|||
|
vec3 getTubePosition(vec3 d, float index, out vec3 normal) {
|
|||
|
float segmentCount = 8.0;
|
|||
|
|
|||
|
float angle = 2.0 * 3.14159 * (index / segmentCount);
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d);
|
|||
|
vec3 y = v * sin(angle) * length(d);
|
|||
|
vec3 v3 = x + y;
|
|||
|
|
|||
|
normal = normalize(v3);
|
|||
|
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec4 vector;
|
|||
|
attribute vec4 color, position;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform float vectorScale, tubeScale;
|
|||
|
uniform mat4 model, view, projection, inverseModel;
|
|||
|
uniform vec3 eyePosition, lightPosition;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
// Scale the vector magnitude to stay constant with
|
|||
|
// model & view changes.
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);
|
|||
|
vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * tubePosition;
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
f_lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
f_eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);
|
|||
|
|
|||
|
// vec4 m_position = model * vec4(tubePosition, 1.0);
|
|||
|
vec4 t_position = view * tubePosition;
|
|||
|
gl_Position = projection * t_position;
|
|||
|
|
|||
|
f_color = color;
|
|||
|
f_data = tubePosition.xyz;
|
|||
|
f_position = position.xyz;
|
|||
|
f_uv = uv;
|
|||
|
}
|
|||
|
`]),u=s([`#extension GL_OES_standard_derivatives : enable
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float cookTorranceSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness,
|
|||
|
float fresnel) {
|
|||
|
|
|||
|
float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
|
|||
|
float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);
|
|||
|
|
|||
|
//Half angle vector
|
|||
|
vec3 H = normalize(lightDirection + viewDirection);
|
|||
|
|
|||
|
//Geometric term
|
|||
|
float NdotH = max(dot(surfaceNormal, H), 0.0);
|
|||
|
float VdotH = max(dot(viewDirection, H), 0.000001);
|
|||
|
float LdotH = max(dot(lightDirection, H), 0.000001);
|
|||
|
float G1 = (2.0 * NdotH * VdotN) / VdotH;
|
|||
|
float G2 = (2.0 * NdotH * LdotN) / LdotH;
|
|||
|
float G = min(1.0, min(G1, G2));
|
|||
|
|
|||
|
//Distribution term
|
|||
|
float D = beckmannDistribution(NdotH, roughness);
|
|||
|
|
|||
|
//Fresnel term
|
|||
|
float F = pow(1.0 - VdotN, fresnel);
|
|||
|
|
|||
|
//Multiply terms and done
|
|||
|
return G * F * D / max(3.14159265 * VdotN, 0.000001);
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
|
|||
|
uniform sampler2D texture;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
vec3 N = normalize(f_normal);
|
|||
|
vec3 L = normalize(f_lightDirection);
|
|||
|
vec3 V = normalize(f_eyeDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
vec4 surfaceColor = f_color * texture2D(texture, f_uv);
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = litColor * opacity;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the tube vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.
|
|||
|
//
|
|||
|
// Each tube segment is made up of a ring of vertices.
|
|||
|
// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.
|
|||
|
// The indexes of tube segments run from 0 to 8.
|
|||
|
//
|
|||
|
vec3 getTubePosition(vec3 d, float index, out vec3 normal) {
|
|||
|
float segmentCount = 8.0;
|
|||
|
|
|||
|
float angle = 2.0 * 3.14159 * (index / segmentCount);
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d);
|
|||
|
vec3 y = v * sin(angle) * length(d);
|
|||
|
vec3 v3 = x + y;
|
|||
|
|
|||
|
normal = normalize(v3);
|
|||
|
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec4 vector;
|
|||
|
attribute vec4 position;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float tubeScale;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);
|
|||
|
vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
|
|||
|
gl_Position = projection * (view * tubePosition);
|
|||
|
f_id = id;
|
|||
|
f_position = position.xyz;
|
|||
|
}
|
|||
|
`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId, f_id.xyz);
|
|||
|
}`]);a.meshShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]},a.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},7815:function(i,a,o){"use strict";var s=o(2931),l=o(9970),u=["xyz","xzy","yxz","yzx","zxy","zyx"],c=function(A,L,_,k){for(var M=A.points,g=A.velocities,P=A.divergences,T=[],z=[],O=[],V=[],G=[],Z=[],H=0,N=0,j=l.create(),re=l.create(),oe=8,_e=0;_e<M.length;_e++){var Me=M[_e],ke=g[_e],me=P[_e];L===0&&(me=_*.05),N=s.length(ke)/k,j=l.create(),s.copy(j,ke),j[3]=me;for(var ie=0;ie<oe;ie++)G[ie]=[Me[0],Me[1],Me[2],ie];if(V.length>0)for(var ie=0;ie<oe;ie++){var Se=(ie+1)%oe;T.push(V[ie],G[ie],G[Se],G[Se],V[Se],V[ie]),O.push(re,j,j,j,re,re),Z.push(H,N,N,N,H,H);var Le=T.length;z.push([Le-6,Le-5,Le-4],[Le-3,Le-2,Le-1])}var Ae=V;V=G,G=Ae;var De=re;re=j,j=De;var Pe=H;H=N,N=Pe}return{positions:T,cells:z,vectors:O,vertexIntensity:Z}},f=function(A,L,_,k){for(var M=0,g=0;g<A.length;g++)for(var P=A[g].velocities,T=0;T<P.length;T++)M=Math.max(M,s.length(P[T]));for(var z=A.map(function(_e){return c(_e,_,k,M)}),O=[],V=[],G=[],Z=[],g=0;g<z.length;g++){var H=z[g],N=O.length;O=O.concat(H.positions),G=G.concat(H.vectors),Z=Z.concat(H.vertexIntensity);for(var T=0;T<H.cells.length;T++){var j=H.cells[T],re=[];V.push(re);for(var oe=0;oe<j.length;oe++)re.push(j[oe]+N)}}return{positions:O,cells:V,vectors:G,vertexIntensity:Z,colormap:L}},h=function(A,L){var _=A.length,k;for(k=0;k<_;k++){var M=A[k];if(M===L)return k;if(M>L)return k-1}return k},d=function(A,L,_){return A<L?L:A>_?_:A},v=function(A,L,_){var k=L.vectors,M=L.meshgrid,g=A[0],P=A[1],T=A[2],z=M[0].length,O=M[1].length,V=M[2].length,G=h(M[0],g),Z=h(M[1],P),H=h(M[2],T),N=G+1,j=Z+1,re=H+1;if(G=d(G,0,z-1),N=d(N,0,z-1),Z=d(Z,0,O-1),j=d(j,0,O-1),H=d(H,0,V-1),re=d(re,0,V-1),G<0||Z<0||H<0||N>z-1||j>O-1||re>V-1)return s.create();var oe=M[0][G],_e=M[0][N],Me=M[1][Z],ke=M[1][j],me=M[2][H],ie=M[2][re],Se=(g-oe)/(_e-oe),Le=(P-Me)/(ke-Me),Ae=(T-me)/(ie-me);isFinite(Se)||(Se=.5),isFinite(Le)||(Le=.5),isFinite(Ae)||(Ae=.5);var De,Pe,ge,Fe,ce,Ze;switch(_.reversedX&&(G=z-1-G,N=z-1-N),_.reversedY&&(Z=O-1-Z,j=O-1-j),_.reversedZ&&(H=V-1-H,re=V-1-re),_.filled){case 5:ce=H,Ze=re,ge=Z*V,Fe=j*V,De=G*V*O,Pe=N*V*O;break;case 4:ce=H,Ze=re,De=G*V,Pe=N*V,ge=Z*V*z,Fe=j*V*z;break;case 3:ge=Z,Fe=j,ce=H*O,Ze=re*O,De=G*O*V,Pe=N*O*V;break;case 2:ge=Z,Fe=j,De=G*O,Pe=N*O,ce=H*O*z,Ze=re*O*z;break;case 1:De=G,Pe=N,ce=H*z,Ze=re*z,ge=Z*z*V,Fe=j*z*V;break;default:De=G,Pe=N,ge=Z*z,Fe=j*z,ce=H*z*O,Ze=re*z*O;break}var ct=k[De+ge+ce],pt=k[De+ge+Ze],Wt=k[De+Fe+ce],st=k[De+Fe+Ze],lt=k[Pe+ge+ce],Gt=k[Pe+ge+Ze],Nt=k[Pe+Fe+ce],$t=k[Pe+Fe+Ze],sr=s.create(),wr=s.create(),ur=s.create(),Qe=s.create();s.lerp(sr,ct,lt,Se),s.lerp(wr,pt,Gt,Se),s.lerp(ur,Wt,Nt,Se),s.lerp(Qe,st,$t,Se);var Et=s.create(),er=s.create();s.lerp(Et,sr,ur,Le),s.lerp(er,wr,Qe,Le);var Ut=s.create();return s.lerp(Ut,Et,er,Ae),Ut},x=function(A,L){var _=L[0],k=L[1],M=L[2];return A[0]=_<0?-_:_,A[1]=k<0?-k:k,A[2]=M<0?-M:M,A},b=function(A){var L=1/0;A.sort(function(g,P){return g-P});for(var _=A.length,k=1;k<_;k++){var M=Math.abs(A[k]-A[k-1]);M<L&&(L=M)}return L},p=function(A){for(var L=[],_=[],k=[],M={},g={},P={},T=A.length,z=0;z<T;z++){var O=A[z],V=O[0],G=O[1],Z=O[2];M[V]||(L.push(V),M[V]=!0),g[G]||(_.push(G),g[G]=!0),P[Z]||(k.push(Z),P[Z]=!0)}var H=b(L),N=b(_),j=b(k),re=Math.min(H,N,j);return isFinite(re)?re:1};i.exports=function(A,L){var _=A.startingPositions,k=A.maxLength||1e3,M=A.tubeSize||1,g=A.absoluteTubeSize,P=A.gridFill||"+x+y+z",T={};P.indexOf("-x")!==-1&&(T.reversedX=!0),P.indexOf("-y")!==-1&&(T.reversedY=!0),P.indexOf("-z")!==-1&&(T.reversedZ=!0),T.filled=u.indexOf(P.replace(/-/g,"").replace(/\+/g,""));var z=A.getVelocity||function(Gt){return v(Gt,A,T)},O=A.getDivergence||function(Gt,Nt){var $t=s.create(),sr=1e-4;s.add($t,Gt,[sr,0,0]);var wr=z($t);s.subtract(wr,wr,Nt),s.scale(wr,wr,1/sr),s.add($t,Gt,[0,sr,0]);var ur=z($t);s.subtract(ur,ur,Nt),s.scale(ur,ur,1/sr),s.add($t,Gt,[0,0,sr]);va
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec4 uv;
|
|||
|
attribute vec3 f;
|
|||
|
attribute vec3 normal;
|
|||
|
|
|||
|
uniform vec3 objectOffset;
|
|||
|
uniform mat4 model, view, projection, inverseModel;
|
|||
|
uniform vec3 lightPosition, eyePosition;
|
|||
|
uniform sampler2D colormap;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec2 planeCoordinate;
|
|||
|
varying vec3 lightDirection, eyeDirection, surfaceNormal;
|
|||
|
varying vec4 vColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 localCoordinate = vec3(uv.zw, f.x);
|
|||
|
worldCoordinate = objectOffset + localCoordinate;
|
|||
|
mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0));
|
|||
|
vec4 worldPosition = (model * objectOffsetTranslation) * vec4(localCoordinate, 1.0);
|
|||
|
vec4 clipPosition = projection * (view * worldPosition);
|
|||
|
gl_Position = clipPosition;
|
|||
|
kill = f.y;
|
|||
|
value = f.z;
|
|||
|
planeCoordinate = uv.xy;
|
|||
|
|
|||
|
vColor = texture2D(colormap, vec2(value, value));
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * worldPosition;
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);
|
|||
|
}
|
|||
|
`]),c=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float beckmannSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness) {
|
|||
|
return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 lowerBound, upperBound;
|
|||
|
uniform float contourTint;
|
|||
|
uniform vec4 contourColor;
|
|||
|
uniform sampler2D colormap;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
|
|||
|
uniform float vertexColor;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec3 lightDirection, eyeDirection, surfaceNormal;
|
|||
|
varying vec4 vColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
kill > 0.0 ||
|
|||
|
vColor.a == 0.0 ||
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)
|
|||
|
) discard;
|
|||
|
|
|||
|
vec3 N = normalize(surfaceNormal);
|
|||
|
vec3 V = normalize(eyeDirection);
|
|||
|
vec3 L = normalize(lightDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = max(beckmannSpecular(L, V, N, roughness), 0.);
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
//decide how to interpolate color \u2014 in vertex or in fragment
|
|||
|
vec4 surfaceColor =
|
|||
|
step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) +
|
|||
|
step(.5, vertexColor) * vColor;
|
|||
|
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;
|
|||
|
}
|
|||
|
`]),f=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec4 uv;
|
|||
|
attribute float f;
|
|||
|
|
|||
|
uniform vec3 objectOffset;
|
|||
|
uniform mat3 permutation;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float height, zOffset;
|
|||
|
uniform sampler2D colormap;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec2 planeCoordinate;
|
|||
|
varying vec3 lightDirection, eyeDirection, surfaceNormal;
|
|||
|
varying vec4 vColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 dataCoordinate = permutation * vec3(uv.xy, height);
|
|||
|
worldCoordinate = objectOffset + dataCoordinate;
|
|||
|
mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0));
|
|||
|
vec4 worldPosition = (model * objectOffsetTranslation) * vec4(dataCoordinate, 1.0);
|
|||
|
|
|||
|
vec4 clipPosition = projection * (view * worldPosition);
|
|||
|
clipPosition.z += zOffset;
|
|||
|
|
|||
|
gl_Position = clipPosition;
|
|||
|
value = f + objectOffset.z;
|
|||
|
kill = -1.0;
|
|||
|
planeCoordinate = uv.zw;
|
|||
|
|
|||
|
vColor = texture2D(colormap, vec2(value, value));
|
|||
|
|
|||
|
//Don't do lighting for contours
|
|||
|
surfaceNormal = vec3(1,0,0);
|
|||
|
eyeDirection = vec3(0,1,0);
|
|||
|
lightDirection = vec3(0,0,1);
|
|||
|
}
|
|||
|
`]),h=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec2 shape;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec2 planeCoordinate;
|
|||
|
varying vec3 surfaceNormal;
|
|||
|
|
|||
|
vec2 splitFloat(float v) {
|
|||
|
float vh = 255.0 * v;
|
|||
|
float upper = floor(vh);
|
|||
|
float lower = fract(vh);
|
|||
|
return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
if ((kill > 0.0) ||
|
|||
|
(outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;
|
|||
|
|
|||
|
vec2 ux = splitFloat(planeCoordinate.x / shape.x);
|
|||
|
vec2 uy = splitFloat(planeCoordinate.y / shape.y);
|
|||
|
gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));
|
|||
|
}
|
|||
|
`]);a.createShader=function(d){var v=s(d,u,c,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v.attributes.normal.location=2,v},a.createPickShader=function(d){var v=s(d,u,h,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v.attributes.normal.location=2,v},a.createContourShader=function(d){var v=s(d,f,c,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v},a.createPickContourShader=function(d){var v=s(d,f,h,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v}},9499:function(i,a,o){"use strict";i.exports=De;var s=o(8828),l=o(2762),u=o(8116),c=o(7766),f=o(1888),h=o(6729),d=o(5298),v=o(9994),x=o(9618),b=o(3711),p=o(6760),C=o(7608),E=o(2478),A=o(6199),L=o(990),_=L.createShader,k=L.createContourShader,M=L.createPickShader,g=L.createPickContourShader,P=4*10,T=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],z=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],O=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];(function(){for(var Pe=0;Pe<3;++Pe){var ge=O[Pe],Fe=(Pe+1)%3,ce=(Pe+2)%3;ge[Fe+0]=1,ge[ce+3]=1,ge[Pe+6]=1}})();function V(Pe,ge,Fe,ce,Ze){this.position=Pe,this.index=ge,this.uv=Fe,this.level=ce,this.dataCoordinate=Ze}var G=256;function Z(Pe,ge,Fe,ce,Ze,ct,pt,Wt,st,lt,Gt,Nt,$t,sr,wr){this.gl=Pe,this.shape=ge,this.bounds=Fe,this.objectOffset=wr,this.intensityBounds=[],this._shader=ce,this._pickShader=Ze,this._coordinateBuffer=ct,this._vao=pt,this._colorMap=Wt,this._contourShader=st,this._contourPickShader=lt,this._contourBuffer=Gt,this._contourVAO=Nt,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new V([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=$t,this._dynamicVAO=sr,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[x(f.mallocFloat(1024),[0,0]),x(f.mallocFloat(1024),[0,0]),x(f.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.pixelRatio=1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}var H=Z.prototype;H.genColormap=function(Pe,ge){var Fe=!1,ce=v([h({colormap:Pe,nshades:G,format:"rgba"}).map(function(Ze,ct){var pt=ge?N(ct/255,ge):Ze[3];return pt<1&&(Fe=!0),[Ze[0],Ze[1],Ze[2],255*pt]})]);return d.divseq(ce,255),this.hasAlphaScale=Fe,ce},H.isTransparent=function(){return this.opacity<1||this.hasAlphaScale},H.isOpaque=function(){return!this.isTransparent()},H.pickSlots=1,H.setPickBase=function(Pe){this.pickId=Pe};function N(Pe,ge){if(!ge||!ge.length)return 1;for(var Fe=0;Fe<ge.length;++Fe){if(ge.length<2)return 1;if(ge[Fe][0]===Pe)return ge[Fe][1];if(ge[Fe][0]>Pe&&Fe>0){var ce=(ge[Fe][0]-Pe)/(ge[Fe][0]-ge[Fe-1][0]);return ge[Fe][1]*(1-ce)+ce*ge[Fe-1][1]}}return 1}var j=[0,0,0],re={showSurface:!1,showContour:!1,projections:[T.slice(),T.slice(),T.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function oe(Pe,ge){var Fe,ce,Ze,ct=ge.axes&&ge.axes.lastCubeProps.axis||j,pt=ge.showSurface,Wt=ge.showContour;for(Fe=0;Fe<3;++Fe)for(pt=pt||ge.surfaceProject[Fe],ce=0;ce<3;++ce)Wt=Wt||ge.contourProject[F
|
|||
|
`),Le=Se.length;for(var Et;Z=Se[O],O<Le;){switch(Et=O,G){case v:O=lt();break;case x:O=st();break;case b:O=Wt();break;case p:O=Gt();break;case C:O=sr();break;case g:O=$t();break;case E:O=wr();break;case d:O=ur();break;case k:O=pt();break;case h:O=ct();break}if(Et!==O)switch(Se[Et]){case`
|
|||
|
`:Me=0,++_e;break;default:++Me;break}}return V+=O,Se=Se.slice(O),j}function Ze(Qe){return N.length&&Fe(N.join("")),G=M,Fe("(eof)"),j}function ct(){return N=N.length?[]:N,H==="/"&&Z==="*"?(ke=V+O-1,G=v,H=Z,O+1):H==="/"&&Z==="/"?(ke=V+O-1,G=x,H=Z,O+1):Z==="#"?(G=b,ke=V+O,O):/\s/.test(Z)?(G=k,ke=V+O,O):(me=/\d/.test(Z),ie=/[^\w_]/.test(Z),ke=V+O,G=me?C:ie?p:d,O)}function pt(){return/[^\s]/g.test(Z)?(Fe(N.join("")),G=h,O):(N.push(Z),H=Z,O+1)}function Wt(){return(Z==="\r"||Z===`
|
|||
|
`)&&H!=="\\"?(Fe(N.join("")),G=h,O):(N.push(Z),H=Z,O+1)}function st(){return Wt()}function lt(){return Z==="/"&&H==="*"?(N.push(Z),Fe(N.join("")),G=h,O+1):(N.push(Z),H=Z,O+1)}function Gt(){if(H==="."&&/\d/.test(Z))return G=E,O;if(H==="/"&&Z==="*")return G=v,O;if(H==="/"&&Z==="/")return G=x,O;if(Z==="."&&N.length){for(;Nt(N););return G=E,O}if(Z===";"||Z===")"||Z==="("){if(N.length)for(;Nt(N););return Fe(Z),G=h,O+1}var Qe=N.length===2&&Z!=="=";if(/[\w_\d\s]/.test(Z)||Qe){for(;Nt(N););return G=h,O}return N.push(Z),H=Z,O+1}function Nt(Qe){var Et=0,er,Ut;do{if(er=l.indexOf(Qe.slice(0,Qe.length+Et).join("")),Ut=l[er],er===-1){if(Et--+Qe.length>0)continue;Ut=Qe.slice(0,1).join("")}return Fe(Ut),ke+=Ut.length,N=N.slice(Ut.length),N.length}while(!0)}function $t(){return/[^a-fA-F0-9]/.test(Z)?(Fe(N.join("")),G=h,O):(N.push(Z),H=Z,O+1)}function sr(){return Z==="."||/[eE]/.test(Z)?(N.push(Z),G=E,H=Z,O+1):Z==="x"&&N.length===1&&N[0]==="0"?(G=g,N.push(Z),H=Z,O+1):/[^\d]/.test(Z)?(Fe(N.join("")),G=h,O):(N.push(Z),H=Z,O+1)}function wr(){return Z==="f"&&(N.push(Z),H=Z,O+=1),/[eE]/.test(Z)||(Z==="-"||Z==="+")&&/[eE]/.test(H)?(N.push(Z),H=Z,O+1):/[^\d]/.test(Z)?(Fe(N.join("")),G=h,O):(N.push(Z),H=Z,O+1)}function ur(){if(/[^\d\w_]/.test(Z)){var Qe=N.join("");return ge[Qe]?G=_:Pe[Qe]?G=L:G=A,Fe(N.join("")),G=h,O}return N.push(Z),H=Z,O+1}}},3508:function(i,a,o){var s=o(6852);s=s.slice().filter(function(l){return!/^(gl\_|texture)/.test(l)}),i.exports=s.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},6852:function(i){i.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_Obje
|
|||
|
`):Z=Z.replace(/\<br\>/g," ");var re="",oe=[];for(ge=0;ge<Z.length;++ge)oe[ge]=re;j.bolds===!0&&(oe=k(d,v,Z,oe)),j.italics===!0&&(oe=k(x,b,Z,oe)),j.superscripts===!0&&(oe=k(p,E,Z,oe)),j.subscripts===!0&&(oe=k(A,_,Z,oe));var _e=[],Me="";for(ge=0;ge<Z.length;++ge)oe[ge]!==null&&(Me+=Z[ge],_e.push(oe[ge]));var ke=Me.split(`
|
|||
|
`),me=ke.length,ie=Math.round(N*H),Se=H,Le=H*2,Ae=0,De=me*ie+Le;V.height<De&&(V.height=De),G.fillStyle="#000",G.fillRect(0,0,V.width,V.height),G.fillStyle="#fff";var Pe,ge,Fe,ce,Ze,ct=0,pt="";function Wt(){if(pt!==""){var Qe=G.measureText(pt).width;G.fillText(pt,Se+Fe,Le+ce),Fe+=Qe}}function st(){return""+Math.round(Ze)+"px "}function lt(Qe,Et){var er=""+G.font;if(j.subscripts===!0){var Ut=Qe.indexOf(L),Ft=Et.indexOf(L),bt=Ut>-1?parseInt(Qe[1+Ut]):0,yt=Ft>-1?parseInt(Et[1+Ft]):0;bt!==yt&&(er=er.replace(st(),"?px "),Ze*=Math.pow(.75,yt-bt),er=er.replace("?px ",st())),ce+=.25*ie*(yt-bt)}if(j.superscripts===!0){var Yt=Qe.indexOf(C),lr=Et.indexOf(C),Tr=Yt>-1?parseInt(Qe[1+Yt]):0,Rr=lr>-1?parseInt(Et[1+lr]):0;Tr!==Rr&&(er=er.replace(st(),"?px "),Ze*=Math.pow(.75,Rr-Tr),er=er.replace("?px ",st())),ce-=.25*ie*(Rr-Tr)}if(j.bolds===!0){var ei=Qe.indexOf(v)>-1,Wr=Et.indexOf(v)>-1;!ei&&Wr&&(Ur?er=er.replace("italic ","italic bold "):er="bold "+er),ei&&!Wr&&(er=er.replace("bold ",""))}if(j.italics===!0){var Ur=Qe.indexOf(b)>-1,dt=Et.indexOf(b)>-1;!Ur&&dt&&(er="italic "+er),Ur&&!dt&&(er=er.replace("italic ",""))}G.font=er}for(Pe=0;Pe<me;++Pe){var Gt=ke[Pe]+`
|
|||
|
`;for(Fe=0,ce=Pe*ie,Ze=H,pt="",ge=0;ge<Gt.length;++ge){var Nt=ge+ct<_e.length?_e[ge+ct]:_e[_e.length-1];re===Nt?pt+=Gt[ge]:(Wt(),pt=Gt[ge],Nt!==void 0&&(lt(re,Nt),re=Nt))}Wt(),ct+=Gt.length;var $t=Math.round(Fe+2*Se)|0;Ae<$t&&(Ae=$t)}var sr=Ae,wr=Le+ie*me,ur=l(G.getImageData(0,0,sr,wr).data,[wr,sr,4]);return ur.pick(-1,-1,0).transpose(1,0)}function P(V,G){var Z=s(V,128);return G?u(Z.cells,Z.positions,.25):{edges:Z.cells,positions:Z.positions}}function T(V,G,Z,H){var N=P(V,H),j=M(N.positions,G,Z),re=N.edges,oe=G.orientation==="ccw";if(c(j,re),G.polygons||G.polygon||G.polyline){for(var _e=h(re,j),Me=new Array(_e.length),ke=0;ke<_e.length;++ke){for(var me=_e[ke],ie=new Array(me.length),Se=0;Se<me.length;++Se){for(var Le=me[Se],Ae=new Array(Le.length),De=0;De<Le.length;++De)Ae[De]=j[Le[De]].slice();oe&&Ae.reverse(),ie[Se]=Ae}Me[ke]=ie}return Me}else return G.triangles||G.triangulate||G.triangle?{cells:f(j,re,{delaunay:!1,exterior:!1,interior:!0}),positions:j}:{edges:re,positions:j}}function z(V,G,Z){try{return T(V,G,Z,!0)}catch(H){}try{return T(V,G,Z,!1)}catch(H){}return G.polygons||G.polyline||G.polygon?[]:G.triangles||G.triangulate||G.triangle?{cells:[],positions:[]}:{edges:[],positions:[]}}function O(V,G,Z,H){var N=64,j=1.25,re={breaklines:!1,bolds:!1,italics:!1,subscripts:!1,superscripts:!1};H&&(H.size&&H.size>0&&(N=H.size),H.lineSpacing&&H.lineSpacing>0&&(j=H.lineSpacing),H.styletags&&H.styletags.breaklines&&(re.breaklines=!!H.styletags.breaklines),H.styletags&&H.styletags.bolds&&(re.bolds=!!H.styletags.bolds),H.styletags&&H.styletags.italics&&(re.italics=!!H.styletags.italics),H.styletags&&H.styletags.subscripts&&(re.subscripts=!!H.styletags.subscripts),H.styletags&&H.styletags.superscripts&&(re.superscripts=!!H.styletags.superscripts)),Z.font=[H.fontStyle,H.fontVariant,H.fontWeight,N+"px",H.font].filter(function(_e){return _e}).join(" "),Z.textAlign="start",Z.textBaseline="alphabetic",Z.direction="ltr";var oe=g(G,Z,V,N,j,re);return z(oe,H,N)}},1538:function(i){(function(){"use strict";if(typeof ses!="undefined"&&ses.ok&&!ses.ok())return;function o(T){T.permitHostObjects___&&T.permitHostObjects___(o)}typeof ses!="undefined"&&(ses.weakMapPermitHostObjects=o);var s=!1;if(typeof WeakMap=="function"){var l=WeakMap;if(!(typeof navigator!="undefined"&&/Firefox/.test(navigator.userAgent))){var u=new l,c=Object.freeze({});if(u.set(c,1),u.get(c)!==1)s=!0;else{i.exports=WeakMap;return}}}var f=Object.prototype.hasOwnProperty,h=Object.getOwnPropertyNames,d=Object.defineProperty,v=Object.isExtensible,x="weakmap:",b=x+"ident:"+Math.random()+"___";if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"&&typeof ArrayBuffer=="function"&&typeof Uint8Array=="function"){var p=new ArrayBuffer(25),C=new Uint8Array(p);crypto.getRandomValues(C),b=x+"rand:"+Array.prototype.map.call(C,function(T){return(T%36).toString(36)}).join("")+"___"}function E(T){return!(T.substr(0,x.length)==x&&T.substr(T.length-3)==="___")}if(d(Object,"getOwnPropertyNames",{value:function(z){return h(z).filter(E)}}),"getPropertyNames"in Object){var A=Object.getPropertyNames;d(Object,"getPropertyNames",{value:function(z){return A(z).filter(E)}})}function L(T){if(T!==Object(T))throw new TypeError("Not an object: "+T);var z=T[b];if(z&&z.key===T)return z;if(v(T)){z={key:T};try{return d(T,b,{value:z,writable:!1,enumerable:!1,configurable:!1}),z}catch(O){return}}}(function(){var T=Object.freeze;d(Object,"freeze",{value:function(G){return L(G),T(G)}});var z=Object.seal;d(Object,"seal",{value:function(G){return L(G),z(G)}});var O=Object.preventExtensions;d(Object,"preventExtensions",{value:function(G){return L(G),O(G)}})})();function _(T){return T.prototype=null,Object.freeze(T)}var k=!1;function M(){!k&&typeof console!="undefined"&&(k=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}var g=0,P=function(){this instanceof P||M();var T=[],z=[],O=g++;function V(N,j){var re,oe=L(N);return oe?O in oe?oe[O]:j:(re=T.indexOf(N),re>=0?z[re]:j)}function G(N){var j=L(N);return j?O in j:T.indexOf(N)>=0}func
|
|||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K9t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var J9t=$_(),$9t=j2(),Q9t=Nze(),eOt=NF(),K2=Fh(),JF=Hze(),tOt=Xm(),rOt=lY(),iOt=W2(),Yze=Xze(),$F=KF(),nOt=e5(),aOt=nv;function nv(e,t){var r=this;if(!(this instanceof nv))return new nv(e,t);typeof e=="function"?(t||(t={}),t.regl=e):(t=e,e=null),t&&t.length&&(t.positions=t),e=t.regl;var n=e._gl,i,a=[],o={},s=[],l=[null],u=[null],c=255,f=100;this.tooManyColors=Yze,i=e.texture({data:new Uint8Array(c*4),width:c,height:1,type:"uint8",format:"rgba",wrapS:"clamp",wrapT:"clamp",mag:"nearest",min:"nearest"}),K2(this,{regl:e,gl:n,groups:s,markerCache:u,markerTextures:l,palette:a,paletteIds:o,paletteTexture:i,maxColors:c,maxSize:f,canvas:n.canvas}),this.update(t);var h={uniforms:{constPointSize:!!t.constPointSize,opacity:e.prop("opacity"),paletteSize:function(b,p){return[r.tooManyColors?0:c,i.height]},pixelRatio:e.context("pixelRatio"),scale:e.prop("scale"),scaleFract:e.prop("scaleFract"),translate:e.prop("translate"),translateFract:e.prop("translateFract"),markerTexture:e.prop("markerTexture"),paletteTexture:i},attributes:{x:function(b,p){return p.xAttr||{buffer:p.positionBuffer,stride:8,offset:0}},y:function(b,p){return p.yAttr||{buffer:p.positionBuffer,stride:8,offset:4}},xFract:function(b,p){return p.xAttr?{constant:[0,0]}:{buffer:p.positionFractBuffer,stride:8,offset:0}},yFract:function(b,p){return p.yAttr?{constant:[0,0]}:{buffer:p.positionFractBuffer,stride:8,offset:4}},size:function(b,p){return p.size.length?{buffer:p.sizeBuffer,stride:2,offset:0}:{constant:[Math.round(p.size*255/r.maxSize)]}},borderSize:function(b,p){return p.borderSize.length?{buffer:p.sizeBuffer,stride:2,offset:1}:{constant:[Math.round(p.borderSize*255/r.maxSize)]}},colorId:function(b,p){return p.color.length?{buffer:p.colorBuffer,stride:r.tooManyColors?8:4,offset:0}:{constant:r.tooManyColors?a.slice(p.color*4,p.color*4+4):[p.color]}},borderColorId:function(b,p){return p.borderColor.length?{buffer:p.colorBuffer,stride:r.tooManyColors?8:4,offset:r.tooManyColors?4:2}:{constant:r.tooManyColors?a.slice(p.borderColor*4,p.borderColor*4+4):[p.borderColor]}},isActive:function(b,p){return p.activation===!0?{constant:[1]}:p.activation?p.activation:{constant:[0]}}},blend:{enable:!0,color:[0,0,0,1],func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},scissor:{enable:!0,box:e.prop("viewport")},viewport:e.prop("viewport"),stencil:{enable:!1},depth:{enable:!1},elements:e.prop("elements"),count:e.prop("count"),offset:e.prop("offset"),primitive:"points"},d=K2({},h);d.frag=JF([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform float opacity;
|
|||
|
uniform sampler2D markerTexture;
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragWidth, fragBorderColorLevel, fragColorLevel;
|
|||
|
|
|||
|
float smoothStep(float x, float y) {
|
|||
|
return 1.0 / (1.0 + exp(50.0*(x - y)));
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float dist = texture2D(markerTexture, gl_PointCoord).r, delta = fragWidth;
|
|||
|
|
|||
|
// max-distance alpha
|
|||
|
if (dist < 0.003) discard;
|
|||
|
|
|||
|
// null-border case
|
|||
|
if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {
|
|||
|
float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);
|
|||
|
gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a * opacity);
|
|||
|
}
|
|||
|
else {
|
|||
|
float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);
|
|||
|
float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);
|
|||
|
|
|||
|
vec4 color = fragBorderColor;
|
|||
|
color.a *= borderColorAmt;
|
|||
|
color = mix(color, fragColor, colorAmt);
|
|||
|
color.a *= opacity;
|
|||
|
|
|||
|
gl_FragColor = color;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
`]),d.vert=JF([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute float x, y, xFract, yFract;
|
|||
|
attribute float size, borderSize;
|
|||
|
attribute vec4 colorId, borderColorId;
|
|||
|
attribute float isActive;
|
|||
|
|
|||
|
// \`invariant\` effectively turns off optimizations for the position.
|
|||
|
// We need this because -fast-math on M1 Macs is re-ordering
|
|||
|
// floating point operations in a way that causes floating point
|
|||
|
// precision limits to put points in the wrong locations.
|
|||
|
invariant gl_Position;
|
|||
|
|
|||
|
uniform bool constPointSize;
|
|||
|
uniform float pixelRatio;
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract, paletteSize;
|
|||
|
uniform sampler2D paletteTexture;
|
|||
|
|
|||
|
const float maxSize = 100.;
|
|||
|
const float borderLevel = .5;
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragPointSize, fragBorderRadius, fragWidth, fragBorderColorLevel, fragColorLevel;
|
|||
|
|
|||
|
float pointSizeScale = (constPointSize) ? 2. : pixelRatio;
|
|||
|
|
|||
|
bool isDirect = (paletteSize.x < 1.);
|
|||
|
|
|||
|
vec4 getColor(vec4 id) {
|
|||
|
return isDirect ? id / 255. : texture2D(paletteTexture,
|
|||
|
vec2(
|
|||
|
(id.x + .5) / paletteSize.x,
|
|||
|
(id.y + .5) / paletteSize.y
|
|||
|
)
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
// ignore inactive points
|
|||
|
if (isActive == 0.) return;
|
|||
|
|
|||
|
vec2 position = vec2(x, y);
|
|||
|
vec2 positionFract = vec2(xFract, yFract);
|
|||
|
|
|||
|
vec4 color = getColor(colorId);
|
|||
|
vec4 borderColor = getColor(borderColorId);
|
|||
|
|
|||
|
float size = size * maxSize / 255.;
|
|||
|
float borderSize = borderSize * maxSize / 255.;
|
|||
|
|
|||
|
gl_PointSize = 2. * size * pointSizeScale;
|
|||
|
fragPointSize = size * pixelRatio;
|
|||
|
|
|||
|
vec2 pos = (position + translate) * scale
|
|||
|
+ (positionFract + translateFract) * scale
|
|||
|
+ (position + translate) * scaleFract
|
|||
|
+ (positionFract + translateFract) * scaleFract;
|
|||
|
|
|||
|
gl_Position = vec4(pos * 2. - 1., 0., 1.);
|
|||
|
|
|||
|
fragColor = color;
|
|||
|
fragBorderColor = borderColor;
|
|||
|
fragWidth = 1. / gl_PointSize;
|
|||
|
|
|||
|
fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);
|
|||
|
fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);
|
|||
|
}
|
|||
|
`]),this.drawMarker=e(d);var v=K2({},h);v.frag=JF([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragBorderRadius, fragWidth;
|
|||
|
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
float smoothStep(float edge0, float edge1, float x) {
|
|||
|
float t;
|
|||
|
t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
|||
|
return t * t * (3.0 - 2.0 * t);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float radius, alpha = 1.0, delta = fragWidth;
|
|||
|
|
|||
|
radius = length(2.0 * gl_PointCoord.xy - 1.0);
|
|||
|
|
|||
|
if (radius > 1.0 + delta) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
|
|||
|
alpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);
|
|||
|
|
|||
|
float borderRadius = fragBorderRadius;
|
|||
|
float ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);
|
|||
|
vec4 color = mix(fragColor, fragBorderColor, ratio);
|
|||
|
color.a *= alpha * opacity;
|
|||
|
gl_FragColor = color;
|
|||
|
}
|
|||
|
`]),v.vert=JF([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute float x, y, xFract, yFract;
|
|||
|
attribute float size, borderSize;
|
|||
|
attribute vec4 colorId, borderColorId;
|
|||
|
attribute float isActive;
|
|||
|
|
|||
|
// \`invariant\` effectively turns off optimizations for the position.
|
|||
|
// We need this because -fast-math on M1 Macs is re-ordering
|
|||
|
// floating point operations in a way that causes floating point
|
|||
|
// precision limits to put points in the wrong locations.
|
|||
|
invariant gl_Position;
|
|||
|
|
|||
|
uniform bool constPointSize;
|
|||
|
uniform float pixelRatio;
|
|||
|
uniform vec2 paletteSize, scale, scaleFract, translate, translateFract;
|
|||
|
uniform sampler2D paletteTexture;
|
|||
|
|
|||
|
const float maxSize = 100.;
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragBorderRadius, fragWidth;
|
|||
|
|
|||
|
float pointSizeScale = (constPointSize) ? 2. : pixelRatio;
|
|||
|
|
|||
|
bool isDirect = (paletteSize.x < 1.);
|
|||
|
|
|||
|
vec4 getColor(vec4 id) {
|
|||
|
return isDirect ? id / 255. : texture2D(paletteTexture,
|
|||
|
vec2(
|
|||
|
(id.x + .5) / paletteSize.x,
|
|||
|
(id.y + .5) / paletteSize.y
|
|||
|
)
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
// ignore inactive points
|
|||
|
if (isActive == 0.) return;
|
|||
|
|
|||
|
vec2 position = vec2(x, y);
|
|||
|
vec2 positionFract = vec2(xFract, yFract);
|
|||
|
|
|||
|
vec4 color = getColor(colorId);
|
|||
|
vec4 borderColor = getColor(borderColorId);
|
|||
|
|
|||
|
float size = size * maxSize / 255.;
|
|||
|
float borderSize = borderSize * maxSize / 255.;
|
|||
|
|
|||
|
gl_PointSize = (size + borderSize) * pointSizeScale;
|
|||
|
|
|||
|
vec2 pos = (position + translate) * scale
|
|||
|
+ (positionFract + translateFract) * scale
|
|||
|
+ (position + translate) * scaleFract
|
|||
|
+ (positionFract + translateFract) * scaleFract;
|
|||
|
|
|||
|
gl_Position = vec4(pos * 2. - 1., 0., 1.);
|
|||
|
|
|||
|
fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);
|
|||
|
fragColor = color;
|
|||
|
fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;
|
|||
|
fragWidth = 1. / gl_PointSize;
|
|||
|
}
|
|||
|
`]),Yze&&(v.frag=v.frag.replace("smoothstep","smoothStep"),d.frag=d.frag.replace("smoothstep","smoothStep")),this.drawCircle=e(v)}nv.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4};nv.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this};nv.prototype.draw=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=this.groups;if(r.length===1&&Array.isArray(r[0])&&(r[0][0]===null||Array.isArray(r[0][0]))&&(r=r[0]),this.regl._refresh(),r.length)for(var a=0;a<r.length;a++)this.drawItem(a,r[a]);else i.forEach(function(o,s){e.drawItem(s)});return this};nv.prototype.drawItem=function(e,t){var r=this.groups,n=r[e];if(typeof t=="number"&&(e=t,n=r[t],t=null),!!(n&&n.count&&n.opacity)){n.activation[0]&&this.drawCircle(this.getMarkerDrawOptions(0,n,t));for(var i=[],a=1;a<n.activation.length;a++)!n.activation[a]||n.activation[a]!==!0&&!n.activation[a].data.length||i.push.apply(i,j9t(this.getMarkerDrawOptions(a,n,t)));i.length&&this.drawMarker(i)}};nv.prototype.getMarkerDrawOptions=function(e,t,r){var n=t.range,i=t.tree,a=t.viewport,o=t.activation,s=t.selectionBuffer,l=t.count,u=this.regl;if(!i)return r?[K2({},t,{markerTexture:this.markerTextures[e],activation:o[e],count:r.length,elements:r,offset:0})]:[K2({},t,{markerTexture:this.markerTextures[e],activation:o[e],offset:0})];var c=[],f=i.range(n,{lod:!0,px:[(n[2]-n[0])/a.width,(n[3]-n[1])/a.height]});if(r){for(var h=o[e],d=h.data,v=new Uint8Array(l),x=0;x<r.length;x++){var b=r[x];v[b]=d?d[b]:1}s.subdata(v)}for(var p=f.length;p--;){var C=H9t(f[p],2),E=C[0],A=C[1];c.push(K2({},t,{markerTexture:this.markerTextures[e],activation:r?s:o[e],offset:E,count:A-E}))}return c};nv.prototype.update=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(r.length){r.length===1&&Array.isArray(r[0])&&(r=r[0]);var i=this.groups,a=this.gl,o=this.regl,s=this.maxSize,l=this.maxColors,u=this.palette;this.groups=i=r.map(function(c,f){var h=i[f];if(c===void 0)return h;c===null?c={positions:null}:typeof c=="function"?c={ondraw:c}:typeof c[0]=="number"&&(c={positions:c}),c=tOt(c,{positions:"positions data points",snap:"snap cluster lod tree",size:"sizes size radius",borderSize:"borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline",color:"colors color fill fill-color fillColor",borderColor:"borderColors borderColor stroke stroke-color strokeColor",marker:"markers marker shape",range:"range dataBox databox",viewport:"viewport viewPort viewBox viewbox",opacity:"opacity alpha transparency",bounds:"bound bounds boundaries limits",tooManyColors:"tooManyColors palette paletteMode optimizePalette enablePalette"}),c.positions===null&&(c.positions=[]),c.tooManyColors!=null&&(e.tooManyColors=c.tooManyColors),h||(i[f]=h={id:f,scale:null,translate:null,scaleFract:null,translateFract:null,activation:[],selectionBuffer:o.buffer({data:new Uint8Array(0),usage:"stream",type:"uint8"}),sizeBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"uint8"}),colorBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"uint8"}),positionBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"float"}),positionFractBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"float"})},c=K2({},nv.defaults,c)),c.positions&&!("marker"in c)&&(c.marker=h.marker,delete h.marker),c.marker&&!("positions"in c)&&(c.positions=h.positions,delete h.positions);var d=0,v=0;if(rOt(h,c,[{snap:!0,size:function(H,N){return H==null&&(H=nv.defaults.size),d+=H&&H.length?1:0,H},borderSize:function(H,N){return H==null&&(H=nv.defaults.borderSize),d+=H&&H.length?1:0,H},opacity:parseFloat,color:function(H,N){return H==null&&(H=nv.defaults.color),H=e.updateColor(H),v++,H},borderColor:function(H,N){return H==null&&(H=nv.defaults.borderColor),H=e.updateColor(H),v++,H},bounds:function(H,N,j){return"rang
|
|||
|
`:return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}),t)}});var EY=ye((hyr,z9e)=>{"use strict";var D9e=$2(),bqt=oz(),wqt=k9e(),Tqt=R9e(),F9e=function(e,t){return e.replace("%v",Tqt(t))};z9e.exports=function(e,t,r){if(!bqt(r))throw new TypeError(F9e(t,e));if(!D9e(e)){if("default"in r)return r.default;if(r.isOptional)return null}var n=wqt(r.errorMessage);throw D9e(n)||(n=t),new TypeError(F9e(n,e))}});var q9e=ye((dyr,O9e)=>{"use strict";var Aqt=EY(),Sqt=$2();O9e.exports=function(e){return Sqt(e)?e:Aqt(e,"Cannot use %v",arguments[1])}});var N9e=ye((vyr,B9e)=>{"use strict";var Mqt=EY(),Eqt=_Y();B9e.exports=function(e){return Eqt(e)?e:Mqt(e,"%v is not a plain function",arguments[1])}});var V9e=ye((pyr,U9e)=>{"use strict";U9e.exports=function(){var e=Array.from,t,r;return typeof e!="function"?!1:(t=["raz","dwa"],r=e(t),!!(r&&r!==t&&r[1]==="dwa"))}});var H9e=ye((gyr,G9e)=>{"use strict";var Cqt=Object.prototype.toString,kqt=RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);G9e.exports=function(e){return typeof e=="function"&&kqt(Cqt.call(e))}});var W9e=ye((myr,j9e)=>{"use strict";j9e.exports=function(){var e=Math.sign;return typeof e!="function"?!1:e(10)===1&&e(-20)===-1}});var Z9e=ye((yyr,X9e)=>{"use strict";X9e.exports=function(e){return e=Number(e),isNaN(e)||e===0?e:e>0?1:-1}});var K9e=ye((_yr,Y9e)=>{"use strict";Y9e.exports=W9e()()?Math.sign:Z9e()});var $9e=ye((xyr,J9e)=>{"use strict";var Lqt=K9e(),Pqt=Math.abs,Iqt=Math.floor;J9e.exports=function(e){return isNaN(e)?0:(e=Number(e),e===0||!isFinite(e)?e:Lqt(e)*Iqt(Pqt(e)))}});var eOe=ye((byr,Q9e)=>{"use strict";var Rqt=$9e(),Dqt=Math.max;Q9e.exports=function(e){return Dqt(0,Rqt(e))}});var nOe=ye((wyr,iOe)=>{"use strict";var Fqt=ux().iterator,zqt=mC(),Oqt=H9e(),qqt=eOe(),tOe=u5(),Bqt=i1(),Nqt=lx(),Uqt=yC(),rOe=Array.isArray,CY=Function.prototype.call,Q2={configurable:!0,enumerable:!0,writable:!0,value:null},kY=Object.defineProperty;iOe.exports=function(e){var t=arguments[1],r=arguments[2],n,i,a,o,s,l,u,c,f,h;if(e=Object(Bqt(e)),Nqt(t)&&tOe(t),!this||this===Array||!Oqt(this)){if(!t){if(zqt(e))return s=e.length,s!==1?Array.apply(null,e):(o=new Array(1),o[0]=e[0],o);if(rOe(e)){for(o=new Array(s=e.length),i=0;i<s;++i)o[i]=e[i];return o}}o=[]}else n=this;if(!rOe(e)){if((f=e[Fqt])!==void 0){for(u=tOe(f).call(e),n&&(o=new n),c=u.next(),i=0;!c.done;)h=t?CY.call(t,r,c.value,i):c.value,n?(Q2.value=h,kY(o,i,Q2)):o[i]=h,c=u.next(),++i;s=i}else if(Uqt(e)){for(s=e.length,n&&(o=new n),i=0,a=0;i<s;++i)h=e[i],i+1<s&&(l=h.charCodeAt(0),l>=55296&&l<=56319&&(h+=e[++i])),h=t?CY.call(t,r,h,a):h,n?(Q2.value=h,kY(o,a,Q2)):o[a]=h,++a;s=a}}if(s===void 0)for(s=qqt(e.length),n&&(o=new n(s)),i=0;i<s;++i)h=t?CY.call(t,r,e[i],i):e[i],n?(Q2.value=h,kY(o,i,Q2)):o[i]=h;return n&&(Q2.value=null,o.length=s),o}});var oOe=ye((Tyr,aOe)=>{"use strict";aOe.exports=V9e()()?Array.from:nOe()});var lOe=ye((Ayr,sOe)=>{"use strict";var Vqt=oOe(),Gqt=sz(),Hqt=i1();sOe.exports=function(e){var t=Object(Hqt(e)),r=arguments[1],n=Object(arguments[2]);if(t!==e&&!r)return t;var i={};return r?Vqt(r,function(a){(n.ensure||a in e)&&(i[a]=e[a])}):Gqt(i,e),i}});var fOe=ye((Syr,cOe)=>{"use strict";var jqt=u5(),Wqt=i1(),Xqt=Function.prototype.bind,uOe=Function.prototype.call,Zqt=Object.keys,Yqt=Object.prototype.propertyIsEnumerable;cOe.exports=function(e,t){return function(r,n){var i,a=arguments[2],o=arguments[3];return r=Object(Wqt(r)),jqt(n),i=Zqt(r),o&&i.sort(typeof o=="function"?Xqt.call(o,r):void 0),typeof e!="function"&&(e=i[e]),uOe.call(e,i,function(s,l){return Yqt.call(r,s)?uOe.call(n,a,r[s],s,r,l):t})}}});var dOe=ye((Myr,hOe)=>{"use strict";hOe.exports=fOe()("forEach")});var pOe=ye((Eyr,vOe)=>{"use strict";var Kqt=u5(),Jqt=dOe(),$qt=Function.prototype.call;vOe.exports=function(e,t){var r={},n=arguments[2];return Kqt(t),Jqt(e,function(i,a,o,s){r[a]=$qt.call(t,n,i,a,o,s)}),r}});var _Oe=ye((Cyr,yOe)=>{"use strict";var Qqt=$2(),eBt=q9e(),gOe=N9e(),tBt=lOe(),rBt=xY(),iBt=pOe(),nBt=Function.prototype.bind,aBt=Object.defineProperty,oBt=
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;
|
|||
|
attribute vec4 color;
|
|||
|
attribute float lineEnd, lineTop;
|
|||
|
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract;
|
|||
|
uniform float thickness, pixelRatio, id, depth;
|
|||
|
uniform vec4 viewport;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec2 tangent;
|
|||
|
|
|||
|
vec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {
|
|||
|
// the order is important
|
|||
|
return position * scale + translate
|
|||
|
+ positionFract * scale + translateFract
|
|||
|
+ position * scaleFract
|
|||
|
+ positionFract * scaleFract;
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float lineStart = 1. - lineEnd;
|
|||
|
float lineOffset = lineTop * 2. - 1.;
|
|||
|
|
|||
|
vec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);
|
|||
|
tangent = normalize(diff * scale * viewport.zw);
|
|||
|
vec2 normal = vec2(-tangent.y, tangent.x);
|
|||
|
|
|||
|
vec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart
|
|||
|
+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd
|
|||
|
|
|||
|
+ thickness * normal * .5 * lineOffset / viewport.zw;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2.0 - 1.0, depth, 1);
|
|||
|
|
|||
|
fragColor = color / 255.;
|
|||
|
}
|
|||
|
`,WBt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
uniform float dashLength, pixelRatio, thickness, opacity, id;
|
|||
|
uniform sampler2D dashTexture;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec2 tangent;
|
|||
|
|
|||
|
void main() {
|
|||
|
float alpha = 1.;
|
|||
|
|
|||
|
float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;
|
|||
|
float dash = texture2D(dashTexture, vec2(t, .5)).r;
|
|||
|
|
|||
|
gl_FragColor = fragColor;
|
|||
|
gl_FragColor.a *= alpha * opacity * dash;
|
|||
|
}
|
|||
|
`,XBt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 position, positionFract;
|
|||
|
|
|||
|
uniform vec4 color;
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract;
|
|||
|
uniform float pixelRatio, id;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
const float MAX_LINES = 256.;
|
|||
|
|
|||
|
void main() {
|
|||
|
float depth = (MAX_LINES - 4. - id) / (MAX_LINES);
|
|||
|
|
|||
|
vec2 position = position * scale + translate
|
|||
|
+ positionFract * scale + translateFract
|
|||
|
+ position * scaleFract
|
|||
|
+ positionFract * scaleFract;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2.0 - 1.0, depth, 1);
|
|||
|
|
|||
|
fragColor = color / 255.;
|
|||
|
fragColor.a *= opacity;
|
|||
|
}
|
|||
|
`,ZBt=`
|
|||
|
precision highp float;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = fragColor;
|
|||
|
}
|
|||
|
`,YBt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 aCoord, bCoord, nextCoord, prevCoord;
|
|||
|
attribute vec4 aColor, bColor;
|
|||
|
attribute float lineEnd, lineTop;
|
|||
|
|
|||
|
uniform vec2 scale, translate;
|
|||
|
uniform float thickness, pixelRatio, id, depth;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform float miterLimit, miterMode;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec4 startCutoff, endCutoff;
|
|||
|
varying vec2 tangent;
|
|||
|
varying vec2 startCoord, endCoord;
|
|||
|
varying float enableStartMiter, enableEndMiter;
|
|||
|
|
|||
|
const float REVERSE_THRESHOLD = -.875;
|
|||
|
const float MIN_DIFF = 1e-6;
|
|||
|
|
|||
|
// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead
|
|||
|
// TODO: precalculate dot products, normalize things beforehead etc.
|
|||
|
// TODO: refactor to rectangular algorithm
|
|||
|
|
|||
|
float distToLine(vec2 p, vec2 a, vec2 b) {
|
|||
|
vec2 diff = b - a;
|
|||
|
vec2 perp = normalize(vec2(-diff.y, diff.x));
|
|||
|
return dot(p - a, perp);
|
|||
|
}
|
|||
|
|
|||
|
bool isNaN( float val ){
|
|||
|
return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true;
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
vec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord;
|
|||
|
|
|||
|
vec2 adjustedScale;
|
|||
|
adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x;
|
|||
|
adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y;
|
|||
|
|
|||
|
vec2 scaleRatio = adjustedScale * viewport.zw;
|
|||
|
vec2 normalWidth = thickness / scaleRatio;
|
|||
|
|
|||
|
float lineStart = 1. - lineEnd;
|
|||
|
float lineBot = 1. - lineTop;
|
|||
|
|
|||
|
fragColor = (lineStart * aColor + lineEnd * bColor) / 255.;
|
|||
|
|
|||
|
if (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return;
|
|||
|
|
|||
|
if (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord);
|
|||
|
if (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord);
|
|||
|
|
|||
|
|
|||
|
vec2 prevDiff = aCoord - prevCoord;
|
|||
|
vec2 currDiff = bCoord - aCoord;
|
|||
|
vec2 nextDiff = nextCoord - bCoord;
|
|||
|
|
|||
|
vec2 prevTangent = normalize(prevDiff * scaleRatio);
|
|||
|
vec2 currTangent = normalize(currDiff * scaleRatio);
|
|||
|
vec2 nextTangent = normalize(nextDiff * scaleRatio);
|
|||
|
|
|||
|
vec2 prevNormal = vec2(-prevTangent.y, prevTangent.x);
|
|||
|
vec2 currNormal = vec2(-currTangent.y, currTangent.x);
|
|||
|
vec2 nextNormal = vec2(-nextTangent.y, nextTangent.x);
|
|||
|
|
|||
|
vec2 startJoinDirection = normalize(prevTangent - currTangent);
|
|||
|
vec2 endJoinDirection = normalize(currTangent - nextTangent);
|
|||
|
|
|||
|
// collapsed/unidirectional segment cases
|
|||
|
// FIXME: there should be more elegant solution
|
|||
|
vec2 prevTanDiff = abs(prevTangent - currTangent);
|
|||
|
vec2 nextTanDiff = abs(nextTangent - currTangent);
|
|||
|
if (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) {
|
|||
|
startJoinDirection = currNormal;
|
|||
|
}
|
|||
|
if (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) {
|
|||
|
endJoinDirection = currNormal;
|
|||
|
}
|
|||
|
if (aCoord == bCoord) {
|
|||
|
endJoinDirection = startJoinDirection;
|
|||
|
currNormal = prevNormal;
|
|||
|
currTangent = prevTangent;
|
|||
|
}
|
|||
|
|
|||
|
tangent = currTangent;
|
|||
|
|
|||
|
//calculate join shifts relative to normals
|
|||
|
float startJoinShift = dot(currNormal, startJoinDirection);
|
|||
|
float endJoinShift = dot(currNormal, endJoinDirection);
|
|||
|
|
|||
|
float startMiterRatio = abs(1. / startJoinShift);
|
|||
|
float endMiterRatio = abs(1. / endJoinShift);
|
|||
|
|
|||
|
vec2 startJoin = startJoinDirection * startMiterRatio;
|
|||
|
vec2 endJoin = endJoinDirection * endMiterRatio;
|
|||
|
|
|||
|
vec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin;
|
|||
|
startTopJoin = sign(startJoinShift) * startJoin * .5;
|
|||
|
startBotJoin = -startTopJoin;
|
|||
|
|
|||
|
endTopJoin = sign(endJoinShift) * endJoin * .5;
|
|||
|
endBotJoin = -endTopJoin;
|
|||
|
|
|||
|
vec2 aTopCoord = aCoord + normalWidth * startTopJoin;
|
|||
|
vec2 bTopCoord = bCoord + normalWidth * endTopJoin;
|
|||
|
vec2 aBotCoord = aCoord + normalWidth * startBotJoin;
|
|||
|
vec2 bBotCoord = bCoord + normalWidth * endBotJoin;
|
|||
|
|
|||
|
//miter anti-clipping
|
|||
|
float baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x)));
|
|||
|
float abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x)));
|
|||
|
|
|||
|
//prevent close to reverse direction switch
|
|||
|
bool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) < length(normalWidth * currNormal);
|
|||
|
bool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) < length(normalWidth * currNormal);
|
|||
|
|
|||
|
if (prevReverse) {
|
|||
|
//make join rectangular
|
|||
|
vec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5;
|
|||
|
float normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.);
|
|||
|
aBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;
|
|||
|
aTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;
|
|||
|
}
|
|||
|
else if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) {
|
|||
|
//handle miter clipping
|
|||
|
bTopCoord -= normalWidth * endTopJoin;
|
|||
|
bTopCoord += normalize(endTopJoin * normalWidth) * baClipping;
|
|||
|
}
|
|||
|
|
|||
|
if (nextReverse) {
|
|||
|
//make join rectangular
|
|||
|
vec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;
|
|||
|
float normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);
|
|||
|
bBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;
|
|||
|
bTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;
|
|||
|
}
|
|||
|
else if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {
|
|||
|
//handle miter clipping
|
|||
|
aBotCoord -= normalWidth * startBotJoin;
|
|||
|
aBotCoord += normalize(startBotJoin * normalWidth) * abClipping;
|
|||
|
}
|
|||
|
|
|||
|
vec2 aTopPosition = (aTopCoord) * adjustedScale + translate;
|
|||
|
vec2 aBotPosition = (aBotCoord) * adjustedScale + translate;
|
|||
|
|
|||
|
vec2 bTopPosition = (bTopCoord) * adjustedScale + translate;
|
|||
|
vec2 bBotPosition = (bBotCoord) * adjustedScale + translate;
|
|||
|
|
|||
|
//position is normalized 0..1 coord on the screen
|
|||
|
vec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;
|
|||
|
|
|||
|
startCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;
|
|||
|
endCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2.0 - 1.0, depth, 1);
|
|||
|
|
|||
|
enableStartMiter = step(dot(currTangent, prevTangent), .5);
|
|||
|
enableEndMiter = step(dot(currTangent, nextTangent), .5);
|
|||
|
|
|||
|
//bevel miter cutoffs
|
|||
|
if (miterMode == 1.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
vec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;
|
|||
|
startCutoff = vec4(aCoord, aCoord);
|
|||
|
startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;
|
|||
|
startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
startCutoff += viewport.xyxy;
|
|||
|
startCutoff += startMiterWidth.xyxy;
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
vec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;
|
|||
|
endCutoff = vec4(bCoord, bCoord);
|
|||
|
endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;
|
|||
|
endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
endCutoff += viewport.xyxy;
|
|||
|
endCutoff += endMiterWidth.xyxy;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//round miter cutoffs
|
|||
|
else if (miterMode == 2.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
vec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;
|
|||
|
startCutoff = vec4(aCoord, aCoord);
|
|||
|
startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;
|
|||
|
startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
startCutoff += viewport.xyxy;
|
|||
|
startCutoff += startMiterWidth.xyxy;
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
vec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;
|
|||
|
endCutoff = vec4(bCoord, bCoord);
|
|||
|
endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;
|
|||
|
endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
endCutoff += viewport.xyxy;
|
|||
|
endCutoff += endMiterWidth.xyxy;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
`,KBt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
uniform float dashLength, pixelRatio, thickness, opacity, id, miterMode;
|
|||
|
uniform sampler2D dashTexture;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec2 tangent;
|
|||
|
varying vec4 startCutoff, endCutoff;
|
|||
|
varying vec2 startCoord, endCoord;
|
|||
|
varying float enableStartMiter, enableEndMiter;
|
|||
|
|
|||
|
float distToLine(vec2 p, vec2 a, vec2 b) {
|
|||
|
vec2 diff = b - a;
|
|||
|
vec2 perp = normalize(vec2(-diff.y, diff.x));
|
|||
|
return dot(p - a, perp);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float alpha = 1., distToStart, distToEnd;
|
|||
|
float cutoff = thickness * .5;
|
|||
|
|
|||
|
//bevel miter
|
|||
|
if (miterMode == 1.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);
|
|||
|
if (distToStart < -1.) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
alpha *= min(max(distToStart + 1., 0.), 1.);
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);
|
|||
|
if (distToEnd < -1.) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
alpha *= min(max(distToEnd + 1., 0.), 1.);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// round miter
|
|||
|
else if (miterMode == 2.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);
|
|||
|
if (distToStart < 0.) {
|
|||
|
float radius = length(gl_FragCoord.xy - startCoord);
|
|||
|
|
|||
|
if(radius > cutoff + .5) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
alpha -= smoothstep(cutoff - .5, cutoff + .5, radius);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);
|
|||
|
if (distToEnd < 0.) {
|
|||
|
float radius = length(gl_FragCoord.xy - endCoord);
|
|||
|
|
|||
|
if(radius > cutoff + .5) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
alpha -= smoothstep(cutoff - .5, cutoff + .5, radius);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;
|
|||
|
float dash = texture2D(dashTexture, vec2(t, .5)).r;
|
|||
|
|
|||
|
gl_FragColor = fragColor;
|
|||
|
gl_FragColor.a *= alpha * opacity * dash;
|
|||
|
}
|
|||
|
`;$Oe.exports=Wc;function Wc(e,t){if(!(this instanceof Wc))return new Wc(e,t);if(typeof e=="function"?(t||(t={}),t.regl=e):t=e,t.length&&(t.positions=t),e=t.regl,!e.hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");this.gl=e._gl,this.regl=e,this.passes=[],this.shaders=Wc.shaders.has(e)?Wc.shaders.get(e):Wc.shaders.set(e,Wc.createShaders(e)).get(e),this.update(t)}Wc.dashMult=2;Wc.maxPatternLength=256;Wc.precisionThreshold=3e6;Wc.maxPoints=1e4;Wc.maxLines=2048;Wc.shaders=new GBt;Wc.createShaders=function(e){let t=e.buffer({usage:"static",type:"float",data:[0,1,0,0,1,1,1,0]}),r={primitive:"triangle strip",instances:e.prop("count"),count:4,offset:0,uniforms:{miterMode:(o,s)=>s.join==="round"?2:1,miterLimit:e.prop("miterLimit"),scale:e.prop("scale"),scaleFract:e.prop("scaleFract"),translateFract:e.prop("translateFract"),translate:e.prop("translate"),thickness:e.prop("thickness"),dashTexture:e.prop("dashTexture"),opacity:e.prop("opacity"),pixelRatio:e.context("pixelRatio"),id:e.prop("id"),dashLength:e.prop("dashLength"),viewport:(o,s)=>[s.viewport.x,s.viewport.y,o.viewportWidth,o.viewportHeight],depth:e.prop("depth")},blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:(o,s)=>!s.overlay},stencil:{enable:!1},scissor:{enable:!0,box:e.prop("viewport")},viewport:e.prop("viewport")},n=e(NY({vert:jBt,frag:WBt,attributes:{lineEnd:{buffer:t,divisor:0,stride:8,offset:0},lineTop:{buffer:t,divisor:0,stride:8,offset:4},aCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:16,divisor:1},aCoordFract:{buffer:e.prop("positionFractBuffer"),stride:8,offset:8,divisor:1},bCoordFract:{buffer:e.prop("positionFractBuffer"),stride:8,offset:16,divisor:1},color:{buffer:e.prop("colorBuffer"),stride:4,offset:0,divisor:1}}},r)),i;try{i=e(NY({cull:{enable:!0,face:"back"},vert:YBt,frag:KBt,attributes:{lineEnd:{buffer:t,divisor:0,stride:8,offset:0},lineTop:{buffer:t,divisor:0,stride:8,offset:4},aColor:{buffer:e.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:e.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},r))}catch(o){i=n}return{fill:e({primitive:"triangle",elements:(o,s)=>s.triangles,offset:0,vert:XBt,frag:ZBt,uniforms:{scale:e.prop("scale"),color:e.prop("fill"),scaleFract:e.prop("scaleFract"),translateFract:e.prop("translateFract"),translate:e.prop("translate"),opacity:e.prop("opacity"),pixelRatio:e.context("pixelRatio"),id:e.prop("id"),viewport:(o,s)=>[s.viewport.x,s.viewport.y,o.viewportWidth,o.viewportHeight]},attributes:{position:{buffer:e.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:e.prop("positionFractBuffer"),stride:8,offset:8}},blend:r.blend,depth:{enable:!1},scissor:r.scissor,stencil:r.stencil,viewport:r.viewport}),rect:n,miter:i}};Wc.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null};Wc.prototype.render=function(...e){e.length&&this.update(...e),this.draw()};Wc.prototype.draw=function(...e){return(e.length?e:this.passes).forEach((t,r)=>{if(t&&Array.isArray(t))return this.draw(...t);typeof t=="number"&&(t=this.passes[t]),t&&t.count>1&&t.opacity&&(this.regl._refresh(),t.fill&&t.triangles&&t.triangles.length>2&&this.shaders.fill(t),t.thickness&&(t.scale[0]*t.viewport.width>Wc.precisionThreshold||t.scale[1]*t.viewport.height>Wc.precisionThreshold?this.shaders.rect(t):t.join==="rect"||!t.join&&(t.thickness<=2||t.count>=Wc.maxPoints)?this.shaders.rect(t):this.shaders.miter(t)))}),this};Wc.prototype.update=function(e){if(!e)return;e.length!=null?typeof e[0]=="number
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 position, positionFract;
|
|||
|
attribute vec4 error;
|
|||
|
attribute vec4 color;
|
|||
|
|
|||
|
attribute vec2 direction, lineOffset, capOffset;
|
|||
|
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform float lineWidth, capSize;
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
fragColor = color / 255.;
|
|||
|
|
|||
|
vec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;
|
|||
|
|
|||
|
vec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;
|
|||
|
|
|||
|
vec2 position = position + dxy;
|
|||
|
|
|||
|
vec2 pos = (position + translate) * scale
|
|||
|
+ (positionFract + translateFract) * scale
|
|||
|
+ (position + translate) * scaleFract
|
|||
|
+ (positionFract + translateFract) * scaleFract;
|
|||
|
|
|||
|
pos += pixelOffset / viewport.zw;
|
|||
|
|
|||
|
gl_Position = vec4(pos * 2. - 1., 0, 1);
|
|||
|
}
|
|||
|
`,frag:`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = fragColor;
|
|||
|
gl_FragColor.a *= opacity;
|
|||
|
}
|
|||
|
`,uniforms:{range:e.prop("range"),lineWidth:e.prop("lineWidth"),capSize:e.prop("capSize"),opacity:e.prop("opacity"),scale:e.prop("scale"),translate:e.prop("translate"),scaleFract:e.prop("scaleFract"),translateFract:e.prop("translateFract"),viewport:(b,p)=>[p.viewport.x,p.viewport.y,b.viewportWidth,b.viewportHeight]},attributes:{color:{buffer:o,offset:(b,p)=>p.offset*4,divisor:1},position:{buffer:i,offset:(b,p)=>p.offset*8,divisor:1},positionFract:{buffer:a,offset:(b,p)=>p.offset*8,divisor:1},error:{buffer:s,offset:(b,p)=>p.offset*16,divisor:1},direction:{buffer:l,stride:24,offset:0},lineOffset:{buffer:l,stride:24,offset:8},capOffset:{buffer:l,stride:24,offset:16}},primitive:"triangles",blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("viewport")},viewport:e.prop("viewport"),stencil:!1,instances:e.prop("count"),count:tqe.length}),QOe(f,{update:v,draw:h,destroy:x,regl:e,gl:r,canvas:r.canvas,groups:c}),f;function f(b){b?v(b):b===null&&x(),h()}function h(b){if(typeof b=="number")return d(b);b&&!Array.isArray(b)&&(b=[b]),e._refresh(),c.forEach((p,C)=>{if(p){if(b&&(b[C]?p.draw=!0:p.draw=!1),!p.draw){p.draw=!0;return}d(C)}})}function d(b){typeof b=="number"&&(b=c[b]),b!=null&&b&&b.count&&b.color&&b.opacity&&b.positions&&b.positions.length>1&&(b.scaleRatio=[b.scale[0]*b.viewport.width,b.scale[1]*b.viewport.height],n(b),b.after&&b.after(b))}function v(b){if(!b)return;b.length!=null?typeof b[0]=="number"&&(b=[{positions:b}]):Array.isArray(b)||(b=[b]);let p=0,C=0;if(f.groups=c=b.map((L,_)=>{let k=c[_];if(L)typeof L=="function"?L={after:L}:typeof L[0]=="number"&&(L={positions:L});else return k;return L=eNt(L,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),k||(c[_]=k={id:_,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},L=QOe({},u,L)),QBt(k,L,[{lineWidth:M=>+M*.5,capSize:M=>+M*.5,opacity:parseFloat,errors:M=>(M=eqe(M),C+=M.length,M),positions:(M,g)=>(M=eqe(M,"float64"),g.count=Math.floor(M.length/2),g.bounds=JBt(M,2),g.offset=p,p+=g.count,M)},{color:(M,g)=>{let P=g.count;if(M||(M="transparent"),!Array.isArray(M)||typeof M[0]=="number"){let z=M;M=Array(P);for(let O=0;O<P;O++)M[O]=z}if(M.length<P)throw Error("Not enough colors");let T=new Uint8Array(P*4);for(let z=0;z<P;z++){let O=$Bt(M[z],"uint8");T.set(O,z*4)}return T},range:(M,g,P)=>{let T=g.bounds;return M||(M=T),g.scale=[1/(M[2]-M[0]),1/(M[3]-M[1])],g.translate=[-M[0],-M[1]],g.scaleFract=VY(g.scale),g.translateFract=VY(g.translate),M},viewport:M=>{let g;return Array.isArray(M)?g={x:M[0],y:M[1],width:M[2]-M[0],height:M[3]-M[1]}:M?(g={x:M.x||M.left||0,y:M.y||M.top||0},M.right?g.width=M.right-g.x:g.width=M.w||M.width||0,M.bottom?g.height=M.bottom-g.y:g.height=M.h||M.height||0):g={x:0,y:0,width:r.drawingBufferWidth,height:r.drawingBufferHeight},g}}]),k}),p||C){let L=c.reduce((g,P,T)=>g+(P?P.count:0),0),_=new Float64Array(L*2),k=new Uint8Array(L*4),M=new Float32Array(L*4);c.forEach((g,P)=>{if(!g)return;let{positions:T,count:z,offset:O,color:V,errors:G}=g;z&&(k.set(V,O*4),M.set(G,O*4),_.set(T,O*2))});var E=tNt(_);i(E);var A=VY(_,E);a(A),o(k),s(M)}}function x(){i.destroy(),a.destroy(),o.destroy(),s.destroy(),l.destroy()}}});var oqe=ye((Vyr,aqe)=>{var nqe=/[\'\"]/;aqe.exports=function(t){return t?(nqe.test(t.charAt(0))&&(t=t.substr(1)),nqe.test(t.charAt(t.length-1))&&(t=t.substr(0,t.length-1)),t):""}});var GY=ye(()=>{});var HY=ye(()=>{});var jY=ye(()=>{});var WY=ye(()=>{});var XY=ye(()=>{});var cqe=ye((Qyr,uqe)=>{"use strict";function sqe(e,t){if(typeof e!="string")return[e];var r=[e];typeof t=="string"||Array.isArray(t)?t={brackets:t}:t||(t={});var n=t.brackets?Array.isArray(t.brackets)?t.brackets:[t.brackets]:["{}","[]","()"],i=t.escape||"___",a=!!t.flat;n.forEach(function(l){var u=new Re
|
|||
|
`).replace(/}/g,`}
|
|||
|
`).replace(/{/g,`{
|
|||
|
`),Yr;if(xt&&(Yr=Oc(Mr),xt[Yr]))return xt[Yr].apply(null,Hr);var xi=Function.apply(null,Ir.concat(Mr));return xt&&(xt[Yr]=xi),xi.apply(null,Hr)}return{global:Mi,link:Vr,block:mi,proc:Qi,scope:Ni,cond:Oi,compile:ji}}var ka="xyzw".split(""),Ra=5121,La=1,Na=2,Yn=0,zn=1,Ka=2,bo=3,Xo=4,Ms=5,os=6,Ts="dither",Ho="blend.enable",yl="blend.color",Xs="blend.equation",Ps="blend.func",va="depth.enable",no="depth.func",_s="depth.range",is="depth.mask",$l="colorMask",ku="cull.enable",Yu="cull.face",Nc="frontFace",gu="lineWidth",Uc="polygonOffset.enable",xu="polygonOffset.offset",Ac="sample.alpha",Ua="sample.enable",oo="sample.coverage",Vc="stencil.enable",hc="stencil.mask",Ku="stencil.func",ue="stencil.opFront",w="stencil.opBack",B="scissor.enable",Q="scissor.box",ee="viewport",le="profile",qe="framebuffer",Xe="vert",ot="frag",Tt="elements",Kt="primitive",Jt="count",xr="offset",Pr="instances",ve="vao",be="Width",Re="Height",Be=qe+be,tt=qe+Re,We=ee+be,it=ee+Re,Dt="drawingBuffer",Ht=Dt+be,rr=Dt+Re,dr=[Ps,Xs,Ku,ue,w,oo,ee,Q,xu],Sr=34962,Or=34963,jr=2884,ii=3042,Li=3024,un=2960,sn=2929,In=3089,Kn=32823,Aa=32926,fa=32928,$a=5126,ko=35664,Qa=35665,mo=35666,Bo=5124,Is=35667,As=35668,wo=35669,To=35670,dl=35671,Nl=35672,Lu=35673,ou=35674,$s=35675,Ql=35676,dc=35678,Tl=35680,Al=4,X=1028,se=1029,Te=2304,Ne=2305,He=32775,Ye=32776,Ct=519,nt=7680,jt=0,gr=1,yr=32774,Gr=513,qr=36160,_i=36064,bi={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Xr={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},ni={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},gi={cw:Te,ccw:Ne};function Pi(Ee){return Array.isArray(Ee)||Wr(Ee)||Ur(Ee)}function Ai(Ee){return Ee.sort(function(xt,zt){return xt===ee?-1:zt===ee?1:xt<zt?-1:1})}function ti(Ee,xt,zt,Ir){this.thisDep=Ee,this.contextDep=xt,this.propDep=zt,this.append=Ir}function Rn(Ee){return Ee&&!(Ee.thisDep||Ee.contextDep||Ee.propDep)}function Cn(Ee){return new ti(!1,!1,!1,Ee)}function Nn(Ee,xt){var zt=Ee.type;if(zt===Yn){var Ir=Ee.data.length;return new ti(!0,Ir>=1,Ir>=2,xt)}else if(zt===Xo){var Hr=Ee.data;return new ti(Hr.thisDep,Hr.contextDep,Hr.propDep,xt)}else{if(zt===Ms)return new ti(!1,!1,!1,xt);if(zt===os){for(var Br=!1,Vr=!1,mi=!1,Ni=0;Ni<Ee.data.length;++Ni){var Oi=Ee.data[Ni];if(Oi.type===zn)mi=!0;else if(Oi.type===Ka)Vr=!0;else if(Oi.type===bo)Br=!0;else if(Oi.type===Yn){Br=!0;var Mi=Oi.data;Mi>=1&&(Vr=!0),Mi>=2&&(mi=!0)}else Oi.type===Xo&&(Br=Br||Oi.data.thisDep,Vr=Vr||Oi.data.contextDep,mi=mi||Oi.data.propDep)}return new ti(Br,Vr,mi,xt)}else return new ti(zt===bo,zt===Ka,zt===zn,xt)}}var ia=new ti(!1,!1,!1,function(){});function Ea(Ee,xt,zt,Ir,Hr,Br,Vr,mi,Ni,Oi,Mi,Hn,Qi,ji,si,Mr){var Yr=Oi.Record,xi={add:32774,subtract:32778,"reverse subtract":32779};zt.ext_blend_minmax&&(xi.min=He,xi.max=Ye);var Ii=zt.angle_instanced_arrays,ci=zt.webgl_draw_buffers,nn=zt.oes_vertex_array_object,Xi={dirty:!0,profile:Mr.profile},qn={},vi=[],li={},mn={};function Ki(Ve){return Ve.replace(".","_")}function Ui(Ve,et,at){var kt=Ki(Ve);vi.push(Ve),qn[kt]=Xi[kt]=!!at,li[kt]=et}function Bi(Ve,et,at){var kt=Ki(Ve);vi.push(Ve),Array.isArray(at)?(Xi[kt]=at.slice(),qn[kt]=at.slice()):Xi[kt]=qn[kt]=at,mn[kt]=et}function vn(Ve){return!!isNaN(Ve)}Ui(Ts,Li),Ui(Ho,ii),Bi(yl,"blendColor",[0,0,0,0]),Bi(Xs,"blendEquationSeparate",[yr,yr]),Bi(Ps,"blendFuncSeparate",[gr,jt,gr,jt]),Ui(va,sn,!0),Bi(no,"depthFunc",Gr),Bi(_s,"depthRange",[0,1]),Bi(is,"depthMask",!0),Bi($l,$l,[!0,!0,!0,!0]),Ui(ku,jr),Bi(Yu,"cullFace",se),Bi(Nc,Nc,Ne),Bi(gu,gu,1),Ui(Uc,Kn),Bi(xu,"polygonOffset",[0,0]),Ui(Ac,Aa),Ui(Ua,fa),Bi(oo,"sampleCoverage",[1,!1]),Ui(Vc,un),Bi(hc,"stencilMask",-1),Bi(Ku,"stencilFunc",[Ct,
|
|||
|
precision highp float;
|
|||
|
attribute float width, charOffset, char;
|
|||
|
attribute vec2 position;
|
|||
|
uniform float fontSize, charStep, em, align, baseline;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform vec4 color;
|
|||
|
uniform vec2 atlasSize, atlasDim, scale, translate, positionOffset;
|
|||
|
varying vec2 charCoord, charId;
|
|||
|
varying float charWidth;
|
|||
|
varying vec4 fontColor;
|
|||
|
void main () {
|
|||
|
vec2 offset = floor(em * (vec2(align + charOffset, baseline)
|
|||
|
+ vec2(positionOffset.x, -positionOffset.y)))
|
|||
|
/ (viewport.zw * scale.xy);
|
|||
|
|
|||
|
vec2 position = (position + translate) * scale;
|
|||
|
position += offset * scale;
|
|||
|
|
|||
|
charCoord = position * viewport.zw + viewport.xy;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2. - 1., 0, 1);
|
|||
|
|
|||
|
gl_PointSize = charStep;
|
|||
|
|
|||
|
charId.x = mod(char, atlasDim.x);
|
|||
|
charId.y = floor(char / atlasDim.x);
|
|||
|
|
|||
|
charWidth = width * em;
|
|||
|
|
|||
|
fontColor = color / 255.;
|
|||
|
}`,frag:`
|
|||
|
precision highp float;
|
|||
|
uniform float fontSize, charStep, opacity;
|
|||
|
uniform vec2 atlasSize;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform sampler2D atlas;
|
|||
|
varying vec4 fontColor;
|
|||
|
varying vec2 charCoord, charId;
|
|||
|
varying float charWidth;
|
|||
|
|
|||
|
float lightness(vec4 color) {
|
|||
|
return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
|
|||
|
}
|
|||
|
|
|||
|
void main () {
|
|||
|
vec2 uv = gl_FragCoord.xy - charCoord + charStep * .5;
|
|||
|
float halfCharStep = floor(charStep * .5 + .5);
|
|||
|
|
|||
|
// invert y and shift by 1px (FF expecially needs that)
|
|||
|
uv.y = charStep - uv.y;
|
|||
|
|
|||
|
// ignore points outside of character bounding box
|
|||
|
float halfCharWidth = ceil(charWidth * .5);
|
|||
|
if (floor(uv.x) > halfCharStep + halfCharWidth ||
|
|||
|
floor(uv.x) < halfCharStep - halfCharWidth) return;
|
|||
|
|
|||
|
uv += charId * charStep;
|
|||
|
uv = uv / atlasSize;
|
|||
|
|
|||
|
vec4 color = fontColor;
|
|||
|
vec4 mask = texture2D(atlas, uv);
|
|||
|
|
|||
|
float maskY = lightness(mask);
|
|||
|
// float colorY = lightness(color);
|
|||
|
color.a *= maskY;
|
|||
|
color.a *= opacity;
|
|||
|
|
|||
|
// color.a += .1;
|
|||
|
|
|||
|
// antialiasing, see yiq color space y-channel formula
|
|||
|
// color.rgb += (1. - color.rgb) * (1. - mask.rgb);
|
|||
|
|
|||
|
gl_FragColor = color;
|
|||
|
}`}),n={};return{regl:t,draw:r,atlas:n}};xc.prototype.update=function(t){var r=this;if(typeof t=="string")t={text:t};else if(!t)return;t=zNt(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0),t.opacity!=null&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map(function(ke){return parseFloat(ke)}):this.opacity=parseFloat(t.opacity)),t.viewport!=null&&(this.viewport=UNt(t.viewport),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),this.viewport==null&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),t.kerning!=null&&(this.kerning=t.kerning),t.offset!=null&&(typeof t.offset=="number"&&(t.offset=[t.offset,0]),this.positionOffset=ZNt(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),!this.font.length&&!t.font&&(t.font=xc.baseFontSize+"px sans-serif");var n=!1,i=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach(function(ke,me){if(typeof ke=="string")try{ke=h5.parse(ke)}catch(Ze){ke=h5.parse(xc.baseFontSize+"px "+ke)}else{var ie=ke.style,Se=ke.weight,Le=ke.stretch,Ae=ke.variant;ke=h5.parse(h5.stringify(ke)),ie&&(ke.style=ie),Se&&(ke.weight=Se),Le&&(ke.stretch=Le),Ae&&(ke.variant=Ae)}var De=h5.stringify({size:xc.baseFontSize,family:ke.family,stretch:bz?ke.stretch:void 0,variant:ke.variant,weight:ke.weight,style:ke.style}),Pe=GNt(ke.size),ge=Math.round(Pe[0]*HNt(Pe[1]));if(ge!==r.fontSize[me]&&(i=!0,r.fontSize[me]=ge),(!r.font[me]||De!=r.font[me].baseString)&&(n=!0,r.font[me]=xc.fonts[De],!r.font[me])){var Fe=ke.family.join(", "),ce=[ke.style];ke.style!=ke.variant&&ce.push(ke.variant),ke.variant!=ke.weight&&ce.push(ke.weight),bz&&ke.weight!=ke.stretch&&ce.push(ke.stretch),r.font[me]={baseString:De,family:Fe,weight:ke.weight,stretch:ke.stretch,style:ke.style,variant:ke.variant,width:{},kerning:{},metrics:XNt(Fe,{origin:"top",fontSize:xc.baseFontSize,fontStyle:ce.join(" ")})},xc.fonts[De]=r.font[me]}}),(n||i)&&this.font.forEach(function(ke,me){var ie=h5.stringify({size:r.fontSize[me],family:ke.family,stretch:bz?ke.stretch:void 0,variant:ke.variant,weight:ke.weight,style:ke.style});if(r.fontAtlas[me]=r.shader.atlas[ie],!r.fontAtlas[me]){var Se=ke.metrics;r.shader.atlas[ie]=r.fontAtlas[me]={fontString:ie,step:Math.ceil(r.fontSize[me]*Se.bottom*.5)*2,em:r.fontSize[me],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:r.regl.texture()}}t.text==null&&(t.text=r.text)}),typeof t.text=="string"&&t.position&&t.position.length>2){for(var a=Array(t.position.length*.5),o=0;o<a.length;o++)a[o]=t.text;t.text=a}var s;if(t.text!=null||n){if(this.textOffsets=[0],Array.isArray(t.text)){this.count=t.text[0].length,this.counts=[this.count];for(var l=1;l<t.text.length;l++)this.textOffsets[l]=this.textOffsets[l-1]+t.text[l-1].length,this.count+=t.text[l].length,this.counts.push(t.text[l].length);this.text=t.text.join("")}else this.text=t.text,this.count=this.text.length,this.counts=[this.count];s=[],this.font.forEach(function(ke,me){xc.atlasContext.font=ke.baseString;for(var ie=r.fontAtlas[me],Se=0;Se<r.text.length;Se++){var Le=r.text.charAt
|
|||
|
`).replace(/}/g,`}
|
|||
|
`).replace(/{/g,`{
|
|||
|
`),Yr;if(xt&&(Yr=Oc(Mr),xt[Yr]))return xt[Yr].apply(null,Hr);var xi=Function.apply(null,Ir.concat(Mr));return xt&&(xt[Yr]=xi),xi.apply(null,Hr)}return{global:Mi,link:Vr,block:mi,proc:Qi,scope:Ni,cond:Oi,compile:ji}}var ka="xyzw".split(""),Ra=5121,La=1,Na=2,Yn=0,zn=1,Ka=2,bo=3,Xo=4,Ms=5,os=6,Ts="dither",Ho="blend.enable",yl="blend.color",Xs="blend.equation",Ps="blend.func",va="depth.enable",no="depth.func",_s="depth.range",is="depth.mask",$l="colorMask",ku="cull.enable",Yu="cull.face",Nc="frontFace",gu="lineWidth",Uc="polygonOffset.enable",xu="polygonOffset.offset",Ac="sample.alpha",Ua="sample.enable",oo="sample.coverage",Vc="stencil.enable",hc="stencil.mask",Ku="stencil.func",ue="stencil.opFront",w="stencil.opBack",B="scissor.enable",Q="scissor.box",ee="viewport",le="profile",qe="framebuffer",Xe="vert",ot="frag",Tt="elements",Kt="primitive",Jt="count",xr="offset",Pr="instances",ve="vao",be="Width",Re="Height",Be=qe+be,tt=qe+Re,We=ee+be,it=ee+Re,Dt="drawingBuffer",Ht=Dt+be,rr=Dt+Re,dr=[Ps,Xs,Ku,ue,w,oo,ee,Q,xu],Sr=34962,Or=34963,jr=2884,ii=3042,Li=3024,un=2960,sn=2929,In=3089,Kn=32823,Aa=32926,fa=32928,$a=5126,ko=35664,Qa=35665,mo=35666,Bo=5124,Is=35667,As=35668,wo=35669,To=35670,dl=35671,Nl=35672,Lu=35673,ou=35674,$s=35675,Ql=35676,dc=35678,Tl=35680,Al=4,X=1028,se=1029,Te=2304,Ne=2305,He=32775,Ye=32776,Ct=519,nt=7680,jt=0,gr=1,yr=32774,Gr=513,qr=36160,_i=36064,bi={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Xr={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},ni={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},gi={cw:Te,ccw:Ne};function Pi(Ee){return Array.isArray(Ee)||Wr(Ee)||Ur(Ee)}function Ai(Ee){return Ee.sort(function(xt,zt){return xt===ee?-1:zt===ee?1:xt<zt?-1:1})}function ti(Ee,xt,zt,Ir){this.thisDep=Ee,this.contextDep=xt,this.propDep=zt,this.append=Ir}function Rn(Ee){return Ee&&!(Ee.thisDep||Ee.contextDep||Ee.propDep)}function Cn(Ee){return new ti(!1,!1,!1,Ee)}function Nn(Ee,xt){var zt=Ee.type;if(zt===Yn){var Ir=Ee.data.length;return new ti(!0,Ir>=1,Ir>=2,xt)}else if(zt===Xo){var Hr=Ee.data;return new ti(Hr.thisDep,Hr.contextDep,Hr.propDep,xt)}else{if(zt===Ms)return new ti(!1,!1,!1,xt);if(zt===os){for(var Br=!1,Vr=!1,mi=!1,Ni=0;Ni<Ee.data.length;++Ni){var Oi=Ee.data[Ni];if(Oi.type===zn)mi=!0;else if(Oi.type===Ka)Vr=!0;else if(Oi.type===bo)Br=!0;else if(Oi.type===Yn){Br=!0;var Mi=Oi.data;Mi>=1&&(Vr=!0),Mi>=2&&(mi=!0)}else Oi.type===Xo&&(Br=Br||Oi.data.thisDep,Vr=Vr||Oi.data.contextDep,mi=mi||Oi.data.propDep)}return new ti(Br,Vr,mi,xt)}else return new ti(zt===bo,zt===Ka,zt===zn,xt)}}var ia=new ti(!1,!1,!1,function(){});function Ea(Ee,xt,zt,Ir,Hr,Br,Vr,mi,Ni,Oi,Mi,Hn,Qi,ji,si,Mr){var Yr=Oi.Record,xi={add:32774,subtract:32778,"reverse subtract":32779};zt.ext_blend_minmax&&(xi.min=He,xi.max=Ye);var Ii=zt.angle_instanced_arrays,ci=zt.webgl_draw_buffers,nn=zt.oes_vertex_array_object,Xi={dirty:!0,profile:Mr.profile},qn={},vi=[],li={},mn={};function Ki(Ve){return Ve.replace(".","_")}function Ui(Ve,et,at){var kt=Ki(Ve);vi.push(Ve),qn[kt]=Xi[kt]=!!at,li[kt]=et}function Bi(Ve,et,at){var kt=Ki(Ve);vi.push(Ve),Array.isArray(at)?(Xi[kt]=at.slice(),qn[kt]=at.slice()):Xi[kt]=qn[kt]=at,mn[kt]=et}function vn(Ve){return!!isNaN(Ve)}Ui(Ts,Li),Ui(Ho,ii),Bi(yl,"blendColor",[0,0,0,0]),Bi(Xs,"blendEquationSeparate",[yr,yr]),Bi(Ps,"blendFuncSeparate",[gr,jt,gr,jt]),Ui(va,sn,!0),Bi(no,"depthFunc",Gr),Bi(_s,"depthRange",[0,1]),Bi(is,"depthMask",!0),Bi($l,$l,[!0,!0,!0,!0]),Ui(ku,jr),Bi(Yu,"cullFace",se),Bi(Nc,Nc,Ne),Bi(gu,gu,1),Ui(Uc,Kn),Bi(xu,"polygonOffset",[0,0]),Ui(Ac,Aa),Ui(Ua,fa),Bi(oo,"sampleCoverage",[1,!1]),Ui(Vc,un),Bi(hc,"stencilMask",-1),Bi(Ku,"stencilFunc",[Ct,
|
|||
|
`),FVt=["precision highp float;","","varying vec4 fragColor;","","void main() {"," gl_FragColor = fragColor;","}"].join(`
|
|||
|
`),IC=LC().maxDimensionCount,iUe=Dr(),$Ne=1e-6,Oz=2048,zVt=new Uint8Array(4),QNe=new Uint8Array(4),eUe={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function OVt(e){e.read({x:0,y:0,width:1,height:1,data:zVt})}function nUe(e,t,r,n,i){var a=e._gl;a.enable(a.SCISSOR_TEST),a.scissor(t,r,n,i),e.clear({color:[0,0,0,0],depth:1})}function qVt(e,t,r,n,i,a){var o=a.key;function s(l){var u=Math.min(n,i-l*n);l===0&&(window.cancelAnimationFrame(r.currentRafs[o]),delete r.currentRafs[o],nUe(e,a.scissorX,a.scissorY,a.scissorWidth,a.viewBoxSize[1])),!r.clearOnly&&(a.count=2*u,a.offset=2*l*n,t(a),l*n+u<i&&(r.currentRafs[o]=window.requestAnimationFrame(function(){s(l+1)})),r.drawCompleted=!1)}r.drawCompleted||(OVt(e),r.drawCompleted=!0),s(0)}function BVt(e){return Math.max($Ne,Math.min(1-$Ne,e))}function NVt(e,t){for(var r=new Array(256),n=0;n<256;n++)r[n]=e(n/255).concat(t);return r}function PK(e,t){return(e>>>8*t)%256/255}function UVt(e,t,r){for(var n=new Array(e*(IC+4)),i=0,a=0;a<e;a++){for(var o=0;o<IC;o++)n[i++]=o<t.length?t[o].paddedUnitValues[a]:.5;n[i++]=PK(a,2),n[i++]=PK(a,1),n[i++]=PK(a,0),n[i++]=BVt(r[a])}return n}function VVt(e,t,r){for(var n=new Array(t*8),i=0,a=0;a<t;a++)for(var o=0;o<2;o++)for(var s=0;s<4;s++){var l=e*4+s,u=r[a*64+l];l===63&&o===0&&(u*=-1),n[i++]=u}return n}function tUe(e){var t="0"+e;return t.substr(t.length-2)}function aUe(e){return e<IC?"p"+tUe(e+1)+"_"+tUe(e+4):"colors"}function GVt(e,t,r){for(var n=0;n<=IC;n+=4)e[aUe(n)](VVt(n/4,t,r))}function HVt(e){for(var t={},r=0;r<=IC;r+=4)t[aUe(r)]=e.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)});return t}function jVt(e,t,r,n,i,a,o,s,l,u,c,f,h,d){for(var v=[[],[]],x=0;x<64;x++)v[0][x]=x===i?1:0,v[1][x]=x===a?1:0;o*=d,s*=d,l*=d,u*=d;var b=e.lines.canvasOverdrag*d,p=e.domain,C=e.canvasWidth*d,E=e.canvasHeight*d,A=e.pad.l*d,L=e.pad.b*d,_=e.layoutHeight*d,k=e.layoutWidth*d,M=e.deselectedLines.color,g=e.deselectedLines.opacity,P=iUe.extendFlat({key:c,resolution:[C,E],viewBoxPos:[o+b,s],viewBoxSize:[l,u],i0:i,i1:a,dim0A:v[0].slice(0,16),dim0B:v[0].slice(16,32),dim0C:v[0].slice(32,48),dim0D:v[0].slice(48,64),dim1A:v[1].slice(0,16),dim1B:v[1].slice(16,32),dim1C:v[1].slice(32,48),dim1D:v[1].slice(48,64),drwLayer:f,contextColor:[M[0]/255,M[1]/255,M[2]/255,g!=="auto"?M[3]*g:Math.max(1/255,Math.pow(1/e.lines.color.length,1/3))],scissorX:(n===t?0:o+b)+(A-b)+k*p.x[0],scissorWidth:(n===r?C-o+b:l+.5)+(n===t?o+b:0),scissorY:s+L+_*p.y[0],scissorHeight:u,viewportX:A-b+k*p.x[0],viewportY:L+_*p.y[0],viewportWidth:C,viewportHeight:E},h);return P}function rUe(e){var t=Oz-1,r=Math.max(0,Math.floor(e[0]*t),0),n=Math.min(t,Math.ceil(e[1]*t),t);return[Math.min(r,n),Math.max(r,n)]}oUe.exports=function(e,t){var r=t.context,n=t.pick,i=t.regl,a=i._gl,o=a.getParameter(a.ALIASED_LINE_WIDTH_RANGE),s=Math.max(o[0],Math.min(o[1],t.viewModel.plotGlPixelRatio)),l={currentRafs:{},drawCompleted:!0,clearOnly:!1},u,c,f,h,d=HVt(i),v,x=i.texture(eUe),b=[];C(t);var p=i({profile:!1,blend:{enable:r,func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:1,dstAlpha:1},equation:{rgb:"add",alpha:"add"},color:[0,0,0,0]},depth:{enable:!r,mask:!0,func:"less",range:[0,1]},cull:{enable:!0,face:"back"},scissor:{enable:!0,box:{x:i.prop("scissorX"),y:i.prop("scissorY"),width:i.prop("scissorWidth"),height:i.prop("scissorHeight")}},viewport:{x:i.prop("viewportX"),y:i.prop("viewportY"),width:i.prop("viewportWidth"),height:i.prop("viewportHeight")},dither:!1,vert:DVt,frag:FVt,primitive:"lines",lineWidth:s,attributes:d,uniforms:{resolution:i.prop("resolution"),viewBoxPos:i.prop("viewBoxPos"),viewBoxSize:i.prop("viewBoxSize"),dim0A:i.prop("dim0A"),dim1A:i.prop("dim1A"),dim0B:i.prop("dim0B"),dim1B:i.prop("dim1B"),dim0C:i.prop("dim0C"),dim1C:i.prop("dim1C"),dim0D:i.prop("dim0D"),dim1D:i.prop("dim1D"),loA:i.prop("loA"),hiA:i.prop("hiA"),loB:i.prop("loB"),hiB:i.prop("hiB"),loC:i.prop("loC"),hiC:i.prop("hiC"),loD:i.prop("loD"),hiD:i.prop("hiD"),palette:x,contextColor:i.prop("contextColor"),maskTexture:i.prop("maskTexture"),drwLayer:i.prop("drwLayer"),maskHeight:i.prop("maskHeight")},
|
|||
|
`),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.newPlot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join(`
|
|||
|
`),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",uVe.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join(`
|
|||
|
`),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join(`
|
|||
|
`),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":`content: ""; cursor: pointer; position: absolute; background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;`,"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":`display:block; width: 21px; height: 21px; background-image: url('data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new"
|
|||
|
`)),c.push({type:"Feature",geometry:{type:"Point",coordinates:h.lonlat},properties:{symbol:s(f),angle:l(f),text:v}})}}return{type:"FeatureCollection",features:c}}function rJ(e,t){return av.isArrayOrTypedArray(e)?t?function(r){return LVe(e[r])?+e[r]:0}:function(r){return e[r]}:e?function(){return e}:Wz}function Wz(){return""}function PVe(e){return e[0]===LHt}function iJ(e,t){var r;if(av.isArrayOrTypedArray(e)&&av.isArrayOrTypedArray(t)){r=["step",["get","point_count"],e[0]];for(var n=1;n<e.length;n++)r.push(t[n-1],e[n])}else r=e;return r}function kVe(e){var t=e.textfont,r=t.family,n=t.style,i=t.weight,a=r.split(" "),o=a[a.length-1]==="Italic";o&&a.pop(),o=o||n==="italic";var s=a.join(" ");i==="bold"&&a.indexOf("Bold")===-1?s+=" Bold":i<=1e3&&(a[0]==="Metropolis"?(s="Metropolis",i>850?s+=" Black":i>750?s+=" Extra Bold":i>650?s+=" Bold":i>550?s+=" Semi Bold":i>450?s+=" Medium":i>350?s+=" Regular":i>250?s+=" Light":i>150?s+=" Extra Light":s+=" Thin"):a.slice(0,2).join(" ")==="Open Sans"?(s="Open Sans",i>750?s+=" Extrabold":i>650?s+=" Bold":i>550?s+=" Semibold":i>350?s+=" Regular":s+=" Light"):a.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(s="Klokantech Noto Sans",a[3]==="CJK"&&(s+=" CJK"),s+=i>500?" Bold":" Regular")),o&&(s+=" Italic"),s==="Open Sans Regular Italic"?s="Open Sans Italic":s==="Open Sans Regular Bold"?s="Open Sans Bold":s==="Open Sans Regular Bold Italic"?s="Open Sans Bold Italic":s==="Klokantech Noto Sans Regular Italic"&&(s="Klokantech Noto Sans Italic"),RHt(s)||(s=r);var l=s.split(", ");return l}});var OVe=ye((x_r,zVe)=>{"use strict";var NHt=Dr(),DVe=RVe(),w5=c1().traceLayerPrefix,rg={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function FVe(e,t,r,n){this.type="scattermapbox",this.subplot=e,this.uid=t,this.clusterEnabled=r,this.isHidden=n,this.sourceIds={fill:"source-"+t+"-fill",line:"source-"+t+"-line",circle:"source-"+t+"-circle",symbol:"source-"+t+"-symbol",cluster:"source-"+t+"-circle",clusterCount:"source-"+t+"-circle"},this.layerIds={fill:w5+t+"-fill",line:w5+t+"-line",circle:w5+t+"-circle",symbol:w5+t+"-symbol",cluster:w5+t+"-cluster",clusterCount:w5+t+"-cluster-count"},this.below=null}var VC=FVe.prototype;VC.addSource=function(e,t,r){var n={type:"geojson",data:t.geojson};r&&r.enabled&&NHt.extendFlat(n,{cluster:!0,clusterMaxZoom:r.maxzoom});var i=this.subplot.map.getSource(this.sourceIds[e]);i?i.setData(t.geojson):this.subplot.map.addSource(this.sourceIds[e],n)};VC.setSourceData=function(e,t){this.subplot.map.getSource(this.sourceIds[e]).setData(t.geojson)};VC.addLayer=function(e,t,r){var n={type:t.type,id:this.layerIds[e],source:this.sourceIds[e],layout:t.layout,paint:t.paint};t.filter&&(n.filter=t.filter);for(var i=this.layerIds[e],a,o=this.subplot.getMapLayers(),s=0;s<o.length;s++)if(o[s].id===i){a=!0;break}a?(this.subplot.setOptions(i,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(i,"setPaintProperty",n.paint)):this.subplot.addLayer(n,r)};VC.update=function(t){var r=t[0].trace,n=this.subplot,i=n.map,a=DVe(n.gd,t),o=n.belowLookup["trace-"+this.uid],s=!!(r.cluster&&r.cluster.enabled),l=!!this.clusterEnabled,u=this;function c(E){E||u.addSource("circle",a.circle,r.cluster);for(var A=rg.cluster,L=0;L<A.length;L++){var _=A[L],k=a[_];u.addLayer(_,k,o)}}function f(E){for(var A=rg.cluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_])}E||i.removeSource(u.sourceIds.circle)}function h(E){for(var A=rg.nonCluster,L=0;L<A.length;L++){var _=A[L],k=a[_];E||u.addSource(_,k),u.addLayer(_,k,o)}}function d(E){for(var A=rg.nonCluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_]),E||i.removeSource(u.sourceIds[_])}}function v(E){l?f(E):d(E)}function x(E){s?c(E):h(E)}function b(){for(var E=s?rg.cluster:rg.nonCluster,A=0;A<E.length;A++){var L=E[A],_=a[L];_&&(n.setOptions(u.layerIds[L],"setLayoutProperty",_.layout),_.layout.visibility==="visible"&&(L!=="cluster"&&u.setSourceData(L,_),n.setOptions(u.layerIds[L],"setPaintProperty",_.paint)))}}var p=this.isHidden,C=r.visible!==!0;C?p||v():p?C||x():l!==s?(v
|
|||
|
precision mediump float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif`,sc=`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|||
|
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}`,Nh=`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,kf="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}",fs=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,nf="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",Vf=`varying vec3 v_data;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Jl=`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,hl="void main() {gl_FragColor=vec4(1.0);}",lc="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}",Fu=`uniform highp float u_intensity;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Cs=`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
const highp float ZERO=1.0/255.0/16.0;
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`,js=`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(0.0);
|
|||
|
#endif
|
|||
|
}`,Go="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}",gs="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}",uc="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}",xl="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}",Gu="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}",Bs="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}",ad="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}",Po=`#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_FragColor=color*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,od=`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);}`,Yo=`varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Pa=`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`,af=`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Hu=`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`,bl=`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Gf=`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`,Ic=`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,mf=`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
|
|||
|
#pragma mapbox: define highp float base
|
|||
|
#pragma mapbox: define highp float height
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float base
|
|||
|
#pragma mapbox: initialize highp float height
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`,ql=`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,_h=`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|||
|
? a_pos
|
|||
|
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`,Qf=`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,yf="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}",Yc=`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|||
|
#define PI 3.141592653589793
|
|||
|
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,eh="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}",th=`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,ju=`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`,Hf=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,cc=`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`,of=`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Bl=`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`,Kc=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Rc=`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`,ms=`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,jf="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}",Uh=`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,rh=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`,sf=`#define SDF_PX 8.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,xh=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`,Mu=`#define SDF_PX 8.0
|
|||
|
#define SDF 1.0
|
|||
|
#define ICON 0.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,ih=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`,Ws=Vs(Cf,sc),Eu=Vs(Nh,kf),Dc=Vs(fs,nf),ks=Vs(Vf,Jl),bc=Vs(hl,lc),du=Vs(Fu,Cs),_u=Vs(js,Go),al=Vs(gs,uc),nh=Vs(xl,Gu),bh=Vs(Bs,ad),zu=Vs(Po,od),Fc=Vs(Yo,Pa),wc=Vs(af,Hu),bd=Vs(bl,Gf),_f=Vs(Ic,mf),Lf=Vs(ql,_h),Ou=Vs(Qf,yf),xf=Vs(Yc,eh),jl=Vs(th,ju),lf=Vs(Hf,cc),Vh=Vs(of,Bl),Pf=Vs(Kc,Rc),Ls=Vs(ms,jf),vu=Vs(Uh,rh),Cu=Vs(sf,xh),Wf=Vs(Mu,ih);function Vs(Y,D){var J=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,q=D.match(/attribute ([\w]+) ([\w]+)/g),K=Y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),de=D.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),ne=de?de.concat(K):K,we={};return Y=Y.replace(J,function(Ue,ft,Zt,hr,qt){return we[qt]=!0,ft==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
varying `+Zt+" "+hr+" "+qt+`;
|
|||
|
#else
|
|||
|
uniform `+Zt+" "+hr+" u_"+qt+`;
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifdef HAS_UNIFORM_u_`+qt+`
|
|||
|
`+Zt+" "+hr+" "+qt+" = u_"+qt+`;
|
|||
|
#endif
|
|||
|
`}),D=D.replace(J,function(Ue,ft,Zt,hr,qt){var Ve=hr==="float"?"vec2":"vec4",et=qt.match(/color/)?"color":Ve;return we[qt]?ft==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
uniform lowp float u_`+qt+`_t;
|
|||
|
attribute `+Zt+" "+Ve+" a_"+qt+`;
|
|||
|
varying `+Zt+" "+hr+" "+qt+`;
|
|||
|
#else
|
|||
|
uniform `+Zt+" "+hr+" u_"+qt+`;
|
|||
|
#endif
|
|||
|
`:et==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
`+qt+" = a_"+qt+`;
|
|||
|
#else
|
|||
|
`+Zt+" "+hr+" "+qt+" = u_"+qt+`;
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
`+qt+" = unpack_mix_"+et+"(a_"+qt+", u_"+qt+`_t);
|
|||
|
#else
|
|||
|
`+Zt+" "+hr+" "+qt+" = u_"+qt+`;
|
|||
|
#endif
|
|||
|
`:ft==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
uniform lowp float u_`+qt+`_t;
|
|||
|
attribute `+Zt+" "+Ve+" a_"+qt+`;
|
|||
|
#else
|
|||
|
uniform `+Zt+" "+hr+" u_"+qt+`;
|
|||
|
#endif
|
|||
|
`:et==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
`+Zt+" "+hr+" "+qt+" = a_"+qt+`;
|
|||
|
#else
|
|||
|
`+Zt+" "+hr+" "+qt+" = u_"+qt+`;
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_`+qt+`
|
|||
|
`+Zt+" "+hr+" "+qt+" = unpack_mix_"+et+"(a_"+qt+", u_"+qt+`_t);
|
|||
|
#else
|
|||
|
`+Zt+" "+hr+" "+qt+" = u_"+qt+`;
|
|||
|
#endif
|
|||
|
`}),{fragmentSource:Y,vertexSource:D,staticAttributes:q,staticUniforms:ne}}var bf=Object.freeze({__proto__:null,prelude:Ws,background:Eu,backgroundPattern:Dc,circle:ks,clippingMask:bc,heatmap:du,heatmapTexture:_u,collisionBox:al,collisionCircle:nh,debug:bh,fill:zu,fillOutline:Fc,fillOutlinePattern:wc,fillPattern:bd,fillExtrusion:_f,fillExtrusionPattern:Lf,hillshadePrepare:Ou,hillshade:xf,line:jl,lineGradient:lf,linePattern:Vh,lineSDF:Pf,raster:Ls,symbolIcon:vu,symbolSDF:Cu,symbolTextAndIcon:Wf}),zc=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};zc.prototype.bind=function(D,J,q,K,de,ne,we,Ue){this.context=D;for(var ft=this.boundPaintVertexBuffers.length!==K.length,Zt=0;!ft&&Zt<K.length;Zt++)this.boundPaintVertexBuffers[Zt]!==K[Zt]&&(ft=!0);var hr=!this.vao||this.boundProgram!==J||this.boundLayoutVertexBuffer!==q||ft||this.boundIndexBuffer!==de||this.boundVertexOffset!==ne||this.boundDynamicVertexBuffer!==we||this.boundDynamicVertexBuffer2!==Ue;!D.extVertexArrayObject||hr?this.freshBind(J,q,K,de,ne,we,Ue):(D.bindVertexArrayOES.set(this.vao),we&&we.bind(),de&&de.dynamicDraw&&de.bind(),Ue&&Ue.bind())},zc.prototype.freshBind=function(D,J,q,K,de,ne,we){var Ue,ft=D.numAttributes,Zt=this.context,hr=Zt.gl;if(Zt.extVertexArrayObject)this.vao&&this.destroy(),this.vao=Zt.extVertexArrayObject.createVertexArrayOES(),Zt.bindVertexArrayOES.set(this.vao),Ue=0,this.boundProgram=D,this.boundLayoutVertexBuffer=J,this.boundPaintVertexBuffers=q,this.boundIndexBuffer=K,this.boundVertexOffset=de,this.boundDynamicVertexBuffer=ne,this.boundDynamicVertexBuffer2=we;else{Ue=Zt.currentNumAttributes||0;for(var qt=ft;qt<Ue;qt++)hr.disableVertexAttribArray(qt)}J.enableAttributes(hr,D);for(var Ve=0,et=q;Ve<et.length;Ve+=1){var at=et[Ve];at.enableAttributes(hr,D)}ne&&ne.enableAttributes(hr,D),we&&we.enableAttributes(hr,D),J.bind(),J.setVertexAttribPointers(hr,D,de);for(var kt=0,Ot=q;kt<Ot.length;kt+=1){var It=Ot[kt];It.bind(),It.setVertexAttribPointers(hr,D,de)}ne&&(ne.bind(),ne.setVertexAttribPointers(hr,D,de)),K&&K.bind(),we&&(we.bind(),we.setVertexAttribPointers(hr,D,de)),Zt.currentNumAttributes=ft},zc.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};function Wu(Y){for(var D=[],J=0;J<Y.length;J++)if(Y[J]!==null){var q=Y[J].split(" ");D.push(q.pop())}return D}var If=function(D,J,q,K,de,ne){var we=D.gl;this.program=we.createProgram();for(var Ue=Wu(q.staticAttributes),ft=K?K.getBinderAttributes():[],Zt=Ue.concat(ft),hr=q.staticUniforms?Wu(q.staticUniforms):[],qt=K?K.getBinderUniforms():[],Ve=hr.concat(qt),et=[],at=0,kt=Ve;at<kt.length;at+=1){var Ot=kt[at];et.indexOf(Ot)<0&&et.push(Ot)}var It=K?K.defines():[];ne&&It.push("#define OVERDRAW_INSPECTOR;");var Bt=It.concat(Ws.fragmentSource,q.fragmentSource).join(`
|
|||
|
`),Rt=It.concat(Ws.vertexSource,q.vertexSource).join(`
|
|||
|
`),mt=we.createShader(we.FRAGMENT_SHADER);if(we.isContextLost()){this.failedToCreate=!0;return}we.shaderSource(mt,Bt),we.compileShader(mt),we.attachShader(this.program,mt);var Pt=we.createShader(we.VERTEX_SHADER);if(we.isContextLost()){this.failedToCreate=!0;return}we.shaderSource(Pt,Rt),we.compileShader(Pt),we.attachShader(this.program,Pt),this.attributes={};var ht={};this.numAttributes=Zt.length;for(var cr=0;cr<this.numAttributes;cr++)Zt[cr]&&(we.bindAttribLocation(this.program,cr,Zt[cr]),this.attributes[Zt[cr]]=cr);we.linkProgram(this.program),we.deleteShader(Pt),we.deleteShader(mt);for(var br=0;br<et.length;br++){var Nr=et[br];if(Nr&&!ht[Nr]){var Ri=we.getUniformLocation(this.program,Nr);Ri&&(ht[Nr]=Ri)}}this.fixedUniforms=de(D,ht),this.binderUniforms=K?K.getUniforms(D,ht):[]};If.prototype.draw=function(D,J,q,K,de,ne,we,Ue,ft,Zt,hr,qt,Ve,et,at,kt){var Ot,It=D.gl;if(!this.failedToCreate){D.program.set(this.program),D.setDepthMode(q),D.setStencilMode(K),D.setColorMode(de),D.setCullFace(ne);for(var Bt in this.fixedUniforms)this.fixedUniforms[Bt].set(we[Bt]);et&&et.setUniforms(D,this.binderUniforms,qt,{zoom:Ve});for(var Rt=(Ot={},Ot[It.LINES]=2,Ot[It.TRIANGLES]=3,Ot[It.LINE_STRIP]=1,Ot)[J],mt=0,Pt=hr.get();mt<Pt.length;mt+=1){var ht=Pt[mt],cr=ht.vaos||(ht.vaos={}),br=cr[Ue]||(cr[Ue]=new zc);br.bind(D,this,ft,et?et.getPaintVertexBuffers():[],Zt,ht.vertexOffset,at,kt),It.drawElements(J,ht.primitiveLength*Rt,It.UNSIGNED_SHORT,ht.primitiveOffset*Rt*2)}}};function Xu(Y,D,J){var q=1/Ss(J,1,D.transform.tileZoom),K=Math.pow(2,J.tileID.overscaledZ),de=J.tileSize*Math.pow(2,D.transform.tileZoom)/K,ne=de*(J.tileID.canonical.x+J.tileID.wrap*K),we=de*J.tileID.canonical.y;return{u_image:0,u_texsize:J.imageAtlasTexture.size,u_scale:[q,Y.fromScale,Y.toScale],u_fade:Y.t,u_pixel_coord_upper:[ne>>16,we>>16],u_pixel_coord_lower:[ne&65535,we&65535]}}function uf(Y,D,J,q){var K=J.imageManager.getPattern(Y.from.toString()),de=J.imageManager.getPattern(Y.to.toString()),ne=J.imageManager.getPixelSize(),we=ne.width,Ue=ne.height,ft=Math.pow(2,q.tileID.overscaledZ),Zt=q.tileSize*Math.pow(2,J.transform.tileZoom)/ft,hr=Zt*(q.tileID.canonical.x+q.tileID.wrap*ft),qt=Zt*q.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:K.tl,u_pattern_br_a:K.br,u_pattern_tl_b:de.tl,u_pattern_br_b:de.br,u_texsize:[we,Ue],u_mix:D.t,u_pattern_size_a:K.displaySize,u_pattern_size_b:de.displaySize,u_scale_a:D.fromScale,u_scale_b:D.toScale,u_tile_units_to_pixels:1/Ss(q,1,J.transform.tileZoom),u_pixel_coord_upper:[hr>>16,qt>>16],u_pixel_coord_lower:[hr&65535,qt&65535]}}var Xf=function(Y,D){return{u_matrix:new i.UniformMatrix4f(Y,D.u_matrix),u_lightpos:new i.Uniform3f(Y,D.u_lightpos),u_lightintensity:new i.Uniform1f(Y,D.u_lightintensity),u_lightcolor:new i.Uniform3f(Y,D.u_lightcolor),u_vertical_gradient:new i.Uniform1f(Y,D.u_vertical_gradient),u_opacity:new i.Uniform1f(Y,D.u_opacity)}},Wl=function(Y,D){return{u_matrix:new i.UniformMatrix4f(Y,D.u_matrix),u_lightpos:new i.Uniform3f(Y,D.u_lightpos),u_lightintensity:new i.Uniform1f(Y,D.u_lightintensity),u_lightcolor:new i.Uniform3f(Y,D.u_lightcolor),u_vertical_gradient:new i.Uniform1f(Y,D.u_vertical_gradient),u_height_factor:new i.Uniform1f(Y,D.u_height_factor),u_image:new i.Uniform1i(Y,D.u_image),u_texsize:new i.Uniform2f(Y,D.u_texsize),u_pixel_coord_upper:new i.Uniform2f(Y,D.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(Y,D.u_pixel_coord_lower),u_scale:new i.Uniform3f(Y,D.u_scale),u_fade:new i.Uniform1f(Y,D.u_fade),u_opacity:new i.Uniform1f(Y,D.u_opacity)}},ah=function(Y,D,J,q){var K=D.style.light,de=K.properties.get("position"),ne=[de.x,de.y,de.z],we=i.create$1();K.properties.get("anchor")==="viewport"&&i.fromRotation(we,-D.transform.angle),i.transformMat3(ne,ne,we);var Ue=K.properties.get("color");return{u_matrix:Y,u_lightpos:ne,u_lightintensity:K.properties.get("intensity"),u_lightcolor:[Ue.r,Ue.g,Ue.b],u_vertical_gradient:+J,u_opacity:q}},Zu=function(Y,D,J,q,K,de,ne){return i.extend(ah(Y,D,J,q),Xu(de,D,ne),{u_height_factor:-Math.pow(2,K.overscaledZ)/ne.tileSize/8})},Oc=function(Y,D){return{u_matrix:new i.UniformMa
|
|||
|
{name:nonlatin}`,"text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":.2},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-ocean",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["all",["==","$type","Point"],["==","class","ocean"]],layout:{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":.2},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-other",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["all",["==","$type","Point"],["!in","class","ocean"]],layout:{"text-font":["Noto Sans Italic"],"text-size":{stops:[[0,10],[6,14]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":.2,visibility:"visible"},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"poi-level-3",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:16,filter:["all",["==","$type","Point"],[">=","rank",25]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"poi-level-2",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:15,filter:["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"poi-level-1",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:14,filter:["all",["==","$type","Point"],["<=","rank",14],["has","name"]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":11,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{id:"poi-railway",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:13,filter:["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9,"icon-optional":!1,"icon-ignore-placement":!1,"icon-allow-overlap":!1,"text-ignore-placement":!1,"text-allow-overlap":!1,"text-optional":!0},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"road_oneway",type:"symbol",source:"openmaptiles","source-layer":"transportation",minzoom:15,filter:["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],layout:{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{stops:[[15,.5],[19,1]]}},paint:{"icon-opacity":.5}},{id:"road_oneway_opposite",type:"symbol",source:"openmaptiles","source-layer":"transportation",minzoom:15,filter:["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],layout:{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{stops:[[15,.5],[19,1]]}},paint:{"icon-opacity":.5}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==","class","path"],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==","$type","LineString"],["in","class","minor","service","track"]],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-blur":.5,"text-color":"#765","text-halo-width":1}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["in","class","primary","secondary","tertiary","trunk"],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-blur":.5,"text-color":"#765","text-halo-width":1}},{id:"highway-shield",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:8,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],layout:{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:7,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],layout:{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-other",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:9,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],layout:{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-
|
|||
|
{name:nonlatin}`,"text-transform":"uppercase","text-max-width":9,visibility:"visible"},paint:{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{id:"place-village",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",minzoom:10,filter:["==","class","village"],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[10,12],[15,16]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{id:"place-town",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["==","class","town"],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[10,14],[15,24]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{id:"place-city",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["!=","capital",2],["==","class","city"]],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[7,14],[11,24]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-city-capital",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","capital",2],["==","class","city"]],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[7,14],[11,24]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,"icon-image":"star_11","text-offset":[.4,0],"icon-size":.8,"text-anchor":"left",visibility:"visible"},paint:{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-other",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],layout:{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-3",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-2",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-1",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-continent",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",maxzoom:1,filter:["==","class","continent"],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase",visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],id:"qebnlkra6"}});var iHe=ye((Y_r,rHe)=>{rHe.exports={version:8,name:"orto",metadata:{},center:[1.537786,41.837539],zoom:12,bearing:0,pitch:0,light:{anchor:"viewport",color:"white",intensity:.4,position:[1.15,45,30]},sources:{ortoEsri:{type:"raster",tiles:["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],tileSize:256,maxzoom:18,attribution:"ESRI © <a href='http://www.esri.com'>ESRI</a>"},ortoInstaMaps:{type:"raster",tiles:["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],tileSize:256,maxzoom:13},ortoICGC:{type:"raster",tiles:["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],tileSize:256,minzoom:13.1,maxzoom:20},openmaptiles:{type:"vector",url:"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},sprite:"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1",glyphs:"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"#F4F9F4"}},{id:"ortoEsri",type:"raster",source:"ortoEsri",maxzoom:16,layout:{visibility:"visible"}},{id:"ortoICGC",type:"raster",source:"ortoICGC",minzoom:13.1,maxzoom:19,layout:{visibility:"visible"}},{id:"ortoInstaMaps",type:"raster",source:"ortoInstaMaps",maxzoom:13,layout:{visibility:"visible"}}]}});var wx=ye((K_r,lHe)=>{"use strict";var Hjt=Y1(),jjt=tHe(),Wjt=iHe(),Xjt='\xA9 <a target="_blank" href="https://www.openst
|
|||
|
`),mapOnErrorMsg:"Map error."}});var HC=ye((J_r,dHe)=>{"use strict";var uHe=Dr(),cHe=Ca().defaultLine,Jjt=kc().attributes,$jt=ec(),Qjt=pf().textposition,eWt=mc().overrideAll,tWt=pl().templatedArray,fHe=wx(),hHe=$jt({noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0});hHe.family.dflt="Open Sans Regular, Arial Unicode MS Regular";var rWt=dHe.exports=eWt({_arrayAttrRegexps:[uHe.counterRegex("map",".layers",!0)],domain:Jjt({name:"map"}),style:{valType:"any",values:fHe.styleValuesMap,dflt:fHe.styleValueDflt},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},bounds:{west:{valType:"number"},east:{valType:"number"},south:{valType:"number"},north:{valType:"number"}},layers:tWt("layer",{visible:{valType:"boolean",dflt:!0},sourcetype:{valType:"enumerated",values:["geojson","vector","raster","image"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},sourceattribution:{valType:"string"},type:{valType:"enumerated",values:["circle","line","fill","symbol","raster"],dflt:"circle"},coordinates:{valType:"any"},below:{valType:"string"},color:{valType:"color",dflt:cHe},opacity:{valType:"number",min:0,max:1,dflt:1},minzoom:{valType:"number",min:0,max:24,dflt:0},maxzoom:{valType:"number",min:0,max:24,dflt:24},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2},dash:{valType:"data_array"}},fill:{outlinecolor:{valType:"color",dflt:cHe}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},placement:{valType:"enumerated",values:["point","line","line-center"],dflt:"point"},textfont:hHe,textposition:uHe.extendFlat({},Qjt,{arrayOk:!1})}})},"plot","from-root");rWt.uirevision={valType:"any",editType:"none"}});var e7=ye(($_r,gHe)=>{"use strict";var iWt=Qo().hovertemplateAttrs,nWt=Qo().texttemplateAttrs,aWt=Eg(),jC=G2(),A5=pf(),vHe=HC(),oWt=Vl(),sWt=Tu(),rw=Ao().extendFlat,lWt=mc().overrideAll,uWt=HC(),pHe=jC.line,S5=jC.marker;gHe.exports=lWt({lon:jC.lon,lat:jC.lat,cluster:{enabled:{valType:"boolean"},maxzoom:rw({},uWt.layers.maxzoom,{}),step:{valType:"number",arrayOk:!0,dflt:-1,min:-1},size:{valType:"number",arrayOk:!0,dflt:20,min:0},color:{valType:"color",arrayOk:!0},opacity:rw({},S5.opacity,{dflt:1})},mode:rw({},A5.mode,{dflt:"markers"}),text:rw({},A5.text,{}),texttemplate:nWt({editType:"plot"},{keys:["lat","lon","text"]}),hovertext:rw({},A5.hovertext,{}),line:{color:pHe.color,width:pHe.width},connectgaps:A5.connectgaps,marker:rw({symbol:{valType:"string",dflt:"circle",arrayOk:!0},angle:{valType:"number",dflt:"auto",arrayOk:!0},allowoverlap:{valType:"boolean",dflt:!1},opacity:S5.opacity,size:S5.size,sizeref:S5.sizeref,sizemin:S5.sizemin,sizemode:S5.sizemode},sWt("marker")),fill:jC.fill,fillcolor:aWt(),textfont:vHe.layers.symbol.textfont,textposition:vHe.layers.symbol.textposition,below:{valType:"string"},selected:{marker:A5.selected.marker},unselected:{marker:A5.unselected.marker},hoverinfo:rw({},oWt.hoverinfo,{flags:["lon","lat","text","name"]}),hovertemplate:iWt()},"calc","nested")});var xJ=ye((Q_r,mHe)=>{"use strict";var cWt=["Metropolis Black Italic","Metropolis Black","Metropolis Bold Italic","Metropolis Bold","Metropolis Extra Bold Italic","Metropolis Extra Bold","Metropolis Extra Light Italic","Metropolis Extra Light","Metropolis Light Italic","Metropolis Light","Metropolis Medium Italic","Metropolis Medium","Metropolis Regular Italic","Metropolis Regular","Metropolis Semi Bold Italic","Metropolis Semi Bold","Metropolis Thin Italic","Metropolis Thin","Open Sans Bold Italic","Open Sans Bold","Open Sans Extrabold Italic","Open Sans Extrabold","Open Sans Italic","Open Sans Light Italic","Open Sans Light","Open Sans Regular","Open Sans Semibold Italic","Open Sans Semibold","Klokantech Noto Sans Bold","Klokantech Noto Sans CJK Bold","Klokantech Noto Sans CJK Regular","Klokantech Noto Sans Italic","Klokantech Noto Sans Regular"];mHe.exports={isSupportedFont:function(e){return cWt.indexOf(e)!==-1}
|
|||
|
`)),c.push({type:"Feature",geometry:{type:"Point",coordinates:h.lonlat},properties:{symbol:s(f),angle:l(f),text:v}})}}return{type:"FeatureCollection",features:c}}function AJ(e,t){return ov.isArrayOrTypedArray(e)?t?function(r){return EHe(e[r])?+e[r]:0}:function(r){return e[r]}:e?function(){return e}:n7}function n7(){return""}function CHe(e){return e[0]===mWt}function SJ(e,t){var r;if(ov.isArrayOrTypedArray(e)&&ov.isArrayOrTypedArray(t)){r=["step",["get","point_count"],e[0]];for(var n=1;n<e.length;n++)r.push(t[n-1],e[n])}else r=e;return r}function MHe(e){var t=e.textfont,r=t.family,n=t.style,i=t.weight,a=r.split(" "),o=a[a.length-1]==="Italic";o&&a.pop(),o=o||n==="italic";var s=a.join(" ");i==="bold"&&a.indexOf("Bold")===-1?s+=" Bold":i<=1e3&&(a[0]==="Metropolis"?(s="Metropolis",i>850?s+=" Black":i>750?s+=" Extra Bold":i>650?s+=" Bold":i>550?s+=" Semi Bold":i>450?s+=" Medium":i>350?s+=" Regular":i>250?s+=" Light":i>150?s+=" Extra Light":s+=" Thin"):a.slice(0,2).join(" ")==="Open Sans"?(s="Open Sans",i>750?s+=" Extrabold":i>650?s+=" Bold":i>550?s+=" Semibold":i>350?s+=" Regular":s+=" Light"):a.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(s="Klokantech Noto Sans",a[3]==="CJK"&&(s+=" CJK"),s+=i>500?" Bold":" Regular")),o&&(s+=" Italic"),s==="Open Sans Regular Italic"?s="Open Sans Italic":s==="Open Sans Regular Bold"?s="Open Sans Bold":s==="Open Sans Regular Bold Italic"?s="Open Sans Bold Italic":s==="Klokantech Noto Sans Regular Italic"&&(s="Klokantech Noto Sans Italic"),xWt(s)||(s=r);var l=s.split(", ");return l}});var DHe=ye((nxr,RHe)=>{"use strict";var EWt=Dr(),PHe=LHe(),M5=wx().traceLayerPrefix,ng={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function IHe(e,t,r,n){this.type="scattermap",this.subplot=e,this.uid=t,this.clusterEnabled=r,this.isHidden=n,this.sourceIds={fill:"source-"+t+"-fill",line:"source-"+t+"-line",circle:"source-"+t+"-circle",symbol:"source-"+t+"-symbol",cluster:"source-"+t+"-circle",clusterCount:"source-"+t+"-circle"},this.layerIds={fill:M5+t+"-fill",line:M5+t+"-line",circle:M5+t+"-circle",symbol:M5+t+"-symbol",cluster:M5+t+"-cluster",clusterCount:M5+t+"-cluster-count"},this.below=null}var XC=IHe.prototype;XC.addSource=function(e,t,r){var n={type:"geojson",data:t.geojson};r&&r.enabled&&EWt.extendFlat(n,{cluster:!0,clusterMaxZoom:r.maxzoom});var i=this.subplot.map.getSource(this.sourceIds[e]);i?i.setData(t.geojson):this.subplot.map.addSource(this.sourceIds[e],n)};XC.setSourceData=function(e,t){this.subplot.map.getSource(this.sourceIds[e]).setData(t.geojson)};XC.addLayer=function(e,t,r){var n={type:t.type,id:this.layerIds[e],source:this.sourceIds[e],layout:t.layout,paint:t.paint};t.filter&&(n.filter=t.filter);for(var i=this.layerIds[e],a,o=this.subplot.getMapLayers(),s=0;s<o.length;s++)if(o[s].id===i){a=!0;break}a?(this.subplot.setOptions(i,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(i,"setPaintProperty",n.paint)):this.subplot.addLayer(n,r)};XC.update=function(t){var r=t[0].trace,n=this.subplot,i=n.map,a=PHe(n.gd,t),o=n.belowLookup["trace-"+this.uid],s=!!(r.cluster&&r.cluster.enabled),l=!!this.clusterEnabled,u=this;function c(E){E||u.addSource("circle",a.circle,r.cluster);for(var A=ng.cluster,L=0;L<A.length;L++){var _=A[L],k=a[_];u.addLayer(_,k,o)}}function f(E){for(var A=ng.cluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_])}E||i.removeSource(u.sourceIds.circle)}function h(E){for(var A=ng.nonCluster,L=0;L<A.length;L++){var _=A[L],k=a[_];E||u.addSource(_,k),u.addLayer(_,k,o)}}function d(E){for(var A=ng.nonCluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_]),E||i.removeSource(u.sourceIds[_])}}function v(E){l?f(E):d(E)}function x(E){s?c(E):h(E)}function b(){for(var E=s?ng.cluster:ng.nonCluster,A=0;A<E.length;A++){var L=E[A],_=a[L];_&&(n.setOptions(u.layerIds[L],"setLayoutProperty",_.layout),_.layout.visibility==="visible"&&(L!=="cluster"&&u.setSourceData(L,_),n.setOptions(u.layerIds[L],"setPaintProperty",_.paint)))}}var p=this.isHidden,C=r.visible!==!0;C?p||v():p?C||x():l!==s?(v(),
|
|||
|
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(Qt[1])} }\`.`)];let fr=[];return R.layerType==="symbol"&&(ze==="text-field"&&te&&!te.glyphs&&fr.push(new ur(F,pe,'use of "text-field" requires a style "glyphs" property')),ze==="text-font"&&jf(vu(pe))&&Ls(pe.type)==="identity"&&fr.push(new ur(F,pe,'"text-font" does not support identity functions'))),fr.concat(W({key:R.key,value:pe,valueSpec:Lt,style:te,styleSpec:fe,expressionContext:"property",propertyType:S,propertyKey:ze}))}function Xf(R){return uf(R,"paint")}function Wl(R){return uf(R,"layout")}function ah(R){let S=[],F=R.value,W=R.key,te=R.style,fe=R.styleSpec;F.type||F.ref||S.push(new ur(W,F,'either "type" or "ref" is required'));let pe=Ls(F.type),ze=Ls(F.ref);if(F.id){let Ke=Ls(F.id);for(let ut=0;ut<R.arrayIndex;ut++){let Lt=te.layers[ut];Ls(Lt.id)===Ke&&S.push(new ur(W,F.id,`duplicate layer id "${F.id}", previously used at line ${Lt.id.__line__}`))}}if("ref"in F){let Ke;["type","source","source-layer","filter","layout"].forEach(ut=>{ut in F&&S.push(new ur(W,F[ut],`"${ut}" is prohibited for ref layers`))}),te.layers.forEach(ut=>{Ls(ut.id)===ze&&(Ke=ut)}),Ke?Ke.ref?S.push(new ur(W,F.ref,"ref cannot reference another ref layer")):pe=Ls(Ke.type):S.push(new ur(W,F.ref,`ref layer "${ze}" not found`))}else if(pe!=="background")if(F.source){let Ke=te.sources&&te.sources[F.source],ut=Ke&&Ls(Ke.type);Ke?ut==="vector"&&pe==="raster"?S.push(new ur(W,F.source,`layer "${F.id}" requires a raster source`)):ut!=="raster-dem"&&pe==="hillshade"?S.push(new ur(W,F.source,`layer "${F.id}" requires a raster-dem source`)):ut==="raster"&&pe!=="raster"?S.push(new ur(W,F.source,`layer "${F.id}" requires a vector source`)):ut!=="vector"||F["source-layer"]?ut==="raster-dem"&&pe!=="hillshade"?S.push(new ur(W,F.source,"raster-dem source can only be used with layer type 'hillshade'.")):pe!=="line"||!F.paint||!F.paint["line-gradient"]||ut==="geojson"&&Ke.lineMetrics||S.push(new ur(W,F,`layer "${F.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):S.push(new ur(W,F,`layer "${F.id}" must specify a "source-layer"`)):S.push(new ur(W,F.source,`source "${F.source}" not found`))}else S.push(new ur(W,F,'missing required property "source"'));return S=S.concat(Cu({key:W,value:F,valueSpec:fe.layer,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,objectElementValidators:{"*":()=>[],type:()=>R.validateSpec({key:`${W}.type`,value:F.type,valueSpec:fe.layer.type,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,object:F,objectKey:"type"}),filter:If,layout:Ke=>Cu({layer:F,key:Ke.key,value:Ke.value,style:Ke.style,styleSpec:Ke.styleSpec,validateSpec:Ke.validateSpec,objectElementValidators:{"*":ut=>Wl(Qe({layerType:pe},ut))}}),paint:Ke=>Cu({layer:F,key:Ke.key,value:Ke.value,style:Ke.style,styleSpec:Ke.styleSpec,validateSpec:Ke.validateSpec,objectElementValidators:{"*":ut=>Xf(Qe({layerType:pe},ut))}})}})),S}function Zu(R){let S=R.value,F=R.key,W=ms(S);return W!=="string"?[new ur(F,S,`string expected, ${W} found`)]:[]}let Oc={promoteId:function({key:R,value:S}){if(ms(S)==="string")return Zu({key:R,value:S});{let F=[];for(let W in S)F.push(...Zu({key:`${R}.${W}`,value:S[W]}));return F}}};function Tc(R){let S=R.value,F=R.key,W=R.styleSpec,te=R.style,fe=R.validateSpec;if(!S.type)return[new ur(F,S,'"type" is required')];let pe=Ls(S.type),ze;switch(pe){case"vector":case"raster":return ze=Cu({key:F,value:S,valueSpec:W[`source_${pe.replace("-","_")}`],style:R.style,styleSpec:W,objectElementValidators:Oc,validateSpec:fe}),ze;case"raster-dem":return ze=function(Ke){var ut;let Lt=(ut=Ke.sourceName)!==null&&ut!==void 0?ut:"",Qt=Ke.value,fr=Ke.styleSpec,mr=fr.source_raster_dem,Lr=Ke.style,zr=[],ui=ms(Qt);if(Qt===void 0)return zr;if(ui!=="object")return zr.push(new ur("source_raster_dem",Qt,`object expected, ${ui} found`)),zr;let yi=Ls(Qt.encoding)==="custom",dn=["redFactor","greenFactor","blueFactor","baseShift"],Fi=Ke.value.encoding?`"${Ke.value.encoding}"`:"Default";for(let ln in Qt)!yi&&dn.includes(ln)?zr.pu
|
|||
|
precision mediump float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
`,`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|||
|
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
|
|||
|
#ifdef TERRAIN3D
|
|||
|
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|||
|
#endif
|
|||
|
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|||
|
#else
|
|||
|
return 1.0;
|
|||
|
#endif
|
|||
|
}float calculate_visibility(vec4 pos) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|||
|
#else
|
|||
|
return 1.0;
|
|||
|
#endif
|
|||
|
}float ele(vec2 pos) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|||
|
#else
|
|||
|
return 0.0;
|
|||
|
#endif
|
|||
|
}float get_elevation(vec2 pos) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
|||
|
#else
|
|||
|
return 0.0;
|
|||
|
#endif
|
|||
|
}`),background:St(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:St(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:St(`varying vec3 v_data;varying float v_visibility;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:St("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:St(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
const highp float ZERO=1.0/255.0/16.0;
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:St(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(0.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:St("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:St("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:St("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:St(`#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_FragColor=color*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:St(`varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:St(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:St(`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:St(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
attribute vec2 a_centroid;
|
|||
|
#endif
|
|||
|
varying vec4 v_color;
|
|||
|
#pragma mapbox: define highp float base
|
|||
|
#pragma mapbox: define highp float height
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float base
|
|||
|
#pragma mapbox: initialize highp float height
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
vec3 normal=a_normal_ed.xyz;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|||
|
#else
|
|||
|
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|||
|
#endif
|
|||
|
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:St(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
attribute vec2 a_centroid;
|
|||
|
#endif
|
|||
|
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|||
|
#else
|
|||
|
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|||
|
#endif
|
|||
|
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|||
|
? a_pos
|
|||
|
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:St(`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:St(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|||
|
#define PI 3.141592653589793
|
|||
|
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:St(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_width2=vec2(outset,inset);}`),lineGradient:St(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_width2=vec2(outset,inset);}`),linePattern:St(`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:St(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:St(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:St(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:St(`#define SDF_PX 8.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:St(`#define SDF_PX 8.0
|
|||
|
#define SDF 1.0
|
|||
|
#define ICON 0.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:St("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:St("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:St("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
varying ${Kt} ${Jt} ${xr};
|
|||
|
#else
|
|||
|
uniform ${Kt} ${Jt} u_${xr};
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifdef HAS_UNIFORM_u_${xr}
|
|||
|
${Kt} ${Jt} ${xr} = u_${xr};
|
|||
|
#endif
|
|||
|
`)),vertexSource:w=w.replace(B,(ot,Tt,Kt,Jt,xr)=>{let Pr=Jt==="float"?"vec2":"vec4",ve=xr.match(/color/)?"color":Pr;return Xe[xr]?Tt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
uniform lowp float u_${xr}_t;
|
|||
|
attribute ${Kt} ${Pr} a_${xr};
|
|||
|
varying ${Kt} ${Jt} ${xr};
|
|||
|
#else
|
|||
|
uniform ${Kt} ${Jt} u_${xr};
|
|||
|
#endif
|
|||
|
`:ve==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
${xr} = a_${xr};
|
|||
|
#else
|
|||
|
${Kt} ${Jt} ${xr} = u_${xr};
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
${xr} = unpack_mix_${ve}(a_${xr}, u_${xr}_t);
|
|||
|
#else
|
|||
|
${Kt} ${Jt} ${xr} = u_${xr};
|
|||
|
#endif
|
|||
|
`:Tt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
uniform lowp float u_${xr}_t;
|
|||
|
attribute ${Kt} ${Pr} a_${xr};
|
|||
|
#else
|
|||
|
uniform ${Kt} ${Jt} u_${xr};
|
|||
|
#endif
|
|||
|
`:ve==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
${Kt} ${Jt} ${xr} = a_${xr};
|
|||
|
#else
|
|||
|
${Kt} ${Jt} ${xr} = u_${xr};
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_${xr}
|
|||
|
${Kt} ${Jt} ${xr} = unpack_mix_${ve}(a_${xr}, u_${xr}_t);
|
|||
|
#else
|
|||
|
${Kt} ${Jt} ${xr} = u_${xr};
|
|||
|
#endif
|
|||
|
`}),staticAttributes:Q,staticUniforms:qe}}class Cr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(w,B,Q,ee,le,qe,Xe,ot,Tt){this.context=w;let Kt=this.boundPaintVertexBuffers.length!==ee.length;for(let Jt=0;!Kt&&Jt<ee.length;Jt++)this.boundPaintVertexBuffers[Jt]!==ee[Jt]&&(Kt=!0);!this.vao||this.boundProgram!==B||this.boundLayoutVertexBuffer!==Q||Kt||this.boundIndexBuffer!==le||this.boundVertexOffset!==qe||this.boundDynamicVertexBuffer!==Xe||this.boundDynamicVertexBuffer2!==ot||this.boundDynamicVertexBuffer3!==Tt?this.freshBind(B,Q,ee,le,qe,Xe,ot,Tt):(w.bindVertexArray.set(this.vao),Xe&&Xe.bind(),le&&le.dynamicDraw&&le.bind(),ot&&ot.bind(),Tt&&Tt.bind())}freshBind(w,B,Q,ee,le,qe,Xe,ot){let Tt=w.numAttributes,Kt=this.context,Jt=Kt.gl;this.vao&&this.destroy(),this.vao=Kt.createVertexArray(),Kt.bindVertexArray.set(this.vao),this.boundProgram=w,this.boundLayoutVertexBuffer=B,this.boundPaintVertexBuffers=Q,this.boundIndexBuffer=ee,this.boundVertexOffset=le,this.boundDynamicVertexBuffer=qe,this.boundDynamicVertexBuffer2=Xe,this.boundDynamicVertexBuffer3=ot,B.enableAttributes(Jt,w);for(let xr of Q)xr.enableAttributes(Jt,w);qe&&qe.enableAttributes(Jt,w),Xe&&Xe.enableAttributes(Jt,w),ot&&ot.enableAttributes(Jt,w),B.bind(),B.setVertexAttribPointers(Jt,w,le);for(let xr of Q)xr.bind(),xr.setVertexAttribPointers(Jt,w,le);qe&&(qe.bind(),qe.setVertexAttribPointers(Jt,w,le)),ee&&ee.bind(),Xe&&(Xe.bind(),Xe.setVertexAttribPointers(Jt,w,le)),ot&&(ot.bind(),ot.setVertexAttribPointers(Jt,w,le)),Kt.currentNumAttributes=Tt}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let Qr=(ue,w,B,Q,ee)=>({u_matrix:ue,u_texture:0,u_ele_delta:w,u_fog_matrix:B,u_fog_color:Q?Q.properties.get("fog-color"):a.aM.white,u_fog_ground_blend:Q?Q.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:Q?Q.calculateFogBlendOpacity(ee):0,u_horizon_color:Q?Q.properties.get("horizon-color"):a.aM.white,u_horizon_fog_blend:Q?Q.properties.get("horizon-fog-blend"):1});function pi(ue){let w=[];for(let B=0;B<ue.length;B++){if(ue[B]===null)continue;let Q=ue[B].split(" ");w.push(Q.pop())}return w}class fn{constructor(w,B,Q,ee,le,qe){let Xe=w.gl;this.program=Xe.createProgram();let ot=pi(B.staticAttributes),Tt=Q?Q.getBinderAttributes():[],Kt=ot.concat(Tt),Jt=jn.prelude.staticUniforms?pi(jn.prelude.staticUniforms):[],xr=B.staticUniforms?pi(B.staticUniforms):[],Pr=Q?Q.getBinderUniforms():[],ve=Jt.concat(xr).concat(Pr),be=[];for(let Ht of ve)be.indexOf(Ht)<0&&be.push(Ht);let Re=Q?Q.defines():[];le&&Re.push("#define OVERDRAW_INSPECTOR;"),qe&&Re.push("#define TERRAIN3D;");let Be=Re.concat(jn.prelude.fragmentSource,B.fragmentSource).join(`
|
|||
|
`),tt=Re.concat(jn.prelude.vertexSource,B.vertexSource).join(`
|
|||
|
`),We=Xe.createShader(Xe.FRAGMENT_SHADER);if(Xe.isContextLost())return void(this.failedToCreate=!0);if(Xe.shaderSource(We,Be),Xe.compileShader(We),!Xe.getShaderParameter(We,Xe.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${Xe.getShaderInfoLog(We)}`);Xe.attachShader(this.program,We);let it=Xe.createShader(Xe.VERTEX_SHADER);if(Xe.isContextLost())return void(this.failedToCreate=!0);if(Xe.shaderSource(it,tt),Xe.compileShader(it),!Xe.getShaderParameter(it,Xe.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${Xe.getShaderInfoLog(it)}`);Xe.attachShader(this.program,it),this.attributes={};let Dt={};this.numAttributes=Kt.length;for(let Ht=0;Ht<this.numAttributes;Ht++)Kt[Ht]&&(Xe.bindAttribLocation(this.program,Ht,Kt[Ht]),this.attributes[Kt[Ht]]=Ht);if(Xe.linkProgram(this.program),!Xe.getProgramParameter(this.program,Xe.LINK_STATUS))throw new Error(`Program failed to link: ${Xe.getProgramInfoLog(this.program)}`);Xe.deleteShader(it),Xe.deleteShader(We);for(let Ht=0;Ht<be.length;Ht++){let rr=be[Ht];if(rr&&!Dt[rr]){let dr=Xe.getUniformLocation(this.program,rr);dr&&(Dt[rr]=dr)}}this.fixedUniforms=ee(w,Dt),this.terrainUniforms=((Ht,rr)=>({u_depth:new a.aH(Ht,rr.u_depth),u_terrain:new a.aH(Ht,rr.u_terrain),u_terrain_dim:new a.aI(Ht,rr.u_terrain_dim),u_terrain_matrix:new a.aJ(Ht,rr.u_terrain_matrix),u_terrain_unpack:new a.aK(Ht,rr.u_terrain_unpack),u_terrain_exaggeration:new a.aI(Ht,rr.u_terrain_exaggeration)}))(w,Dt),this.binderUniforms=Q?Q.getUniforms(w,Dt):[]}draw(w,B,Q,ee,le,qe,Xe,ot,Tt,Kt,Jt,xr,Pr,ve,be,Re,Be,tt){let We=w.gl;if(this.failedToCreate)return;if(w.program.set(this.program),w.setDepthMode(Q),w.setStencilMode(ee),w.setColorMode(le),w.setCullFace(qe),ot){w.activeTexture.set(We.TEXTURE2),We.bindTexture(We.TEXTURE_2D,ot.depthTexture),w.activeTexture.set(We.TEXTURE3),We.bindTexture(We.TEXTURE_2D,ot.texture);for(let Dt in this.terrainUniforms)this.terrainUniforms[Dt].set(ot[Dt])}for(let Dt in this.fixedUniforms)this.fixedUniforms[Dt].set(Xe[Dt]);be&&be.setUniforms(w,this.binderUniforms,Pr,{zoom:ve});let it=0;switch(B){case We.LINES:it=2;break;case We.TRIANGLES:it=3;break;case We.LINE_STRIP:it=1}for(let Dt of xr.get()){let Ht=Dt.vaos||(Dt.vaos={});(Ht[Tt]||(Ht[Tt]=new Cr)).bind(w,this,Kt,be?be.getPaintVertexBuffers():[],Jt,Dt.vertexOffset,Re,Be,tt),We.drawElements(B,Dt.primitiveLength*it,We.UNSIGNED_SHORT,Dt.primitiveOffset*it*2)}}}function Sn(ue,w,B){let Q=1/Pn(B,1,w.transform.tileZoom),ee=Math.pow(2,B.tileID.overscaledZ),le=B.tileSize*Math.pow(2,w.transform.tileZoom)/ee,qe=le*(B.tileID.canonical.x+B.tileID.wrap*ee),Xe=le*B.tileID.canonical.y;return{u_image:0,u_texsize:B.imageAtlasTexture.size,u_scale:[Q,ue.fromScale,ue.toScale],u_fade:ue.t,u_pixel_coord_upper:[qe>>16,Xe>>16],u_pixel_coord_lower:[65535&qe,65535&Xe]}}let En=(ue,w,B,Q)=>{let ee=w.style.light,le=ee.properties.get("position"),qe=[le.x,le.y,le.z],Xe=function(){var Tt=new a.A(9);return a.A!=Float32Array&&(Tt[1]=0,Tt[2]=0,Tt[3]=0,Tt[5]=0,Tt[6]=0,Tt[7]=0),Tt[0]=1,Tt[4]=1,Tt[8]=1,Tt}();ee.properties.get("anchor")==="viewport"&&function(Tt,Kt){var Jt=Math.sin(Kt),xr=Math.cos(Kt);Tt[0]=xr,Tt[1]=Jt,Tt[2]=0,Tt[3]=-Jt,Tt[4]=xr,Tt[5]=0,Tt[6]=0,Tt[7]=0,Tt[8]=1}(Xe,-w.transform.angle),function(Tt,Kt,Jt){var xr=Kt[0],Pr=Kt[1],ve=Kt[2];Tt[0]=xr*Jt[0]+Pr*Jt[3]+ve*Jt[6],Tt[1]=xr*Jt[1]+Pr*Jt[4]+ve*Jt[7],Tt[2]=xr*Jt[2]+Pr*Jt[5]+ve*Jt[8]}(qe,qe,Xe);let ot=ee.properties.get("color");return{u_matrix:ue,u_lightpos:qe,u_lightintensity:ee.properties.get("intensity"),u_lightcolor:[ot.r,ot.g,ot.b],u_vertical_gradient:+B,u_opacity:Q}},ki=(ue,w,B,Q,ee,le,qe)=>a.e(En(ue,w,B,Q),Sn(le,w,qe),{u_height_factor:-Math.pow(2,ee.overscaledZ)/qe.tileSize/8}),_n=ue=>({u_matrix:ue}),ya=(ue,w,B,Q)=>a.e(_n(ue),Sn(B,w,Q)),Jn=(ue,w)=>({u_matrix:ue,u_world:w}),Ma=(ue,w,B,Q,ee)=>a.e(ya(ue,w,B,Q),{u_world:ee}),_o=(ue,w,B,Q)=>{let ee=ue.transform,le,qe;if(Q.paint.get("circle-pitch-alignment")==="map"){let Xe=Pn(B,1,ee.zoom);le=!0,qe=[Xe,Xe]}else le=!1,qe=ee.pixelsToGLUnits;return{u_camera_to_center_distance:ee.cameraToCenterDistance,u_scale_with_map:+(Q.paint.get("circle-pi
|
|||
|
/*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|||
|
/*!
|
|||
|
* Determine if an object is a Buffer
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
/*!
|
|||
|
* pad-left <https://github.com/jonschlinkert/pad-left>
|
|||
|
*
|
|||
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|||
|
* Licensed under the MIT license.
|
|||
|
*/
|
|||
|
/*!
|
|||
|
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
|||
|
*
|
|||
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|||
|
* Licensed under the MIT License.
|
|||
|
*/
|
|||
|
/*! Bundled license information:
|
|||
|
|
|||
|
native-promise-only/lib/npo.src.js:
|
|||
|
(*! Native Promise Only
|
|||
|
v0.8.1 (c) Kyle Simpson
|
|||
|
MIT License: http://getify.mit-license.org
|
|||
|
*)
|
|||
|
|
|||
|
polybooljs/index.js:
|
|||
|
(*
|
|||
|
* @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc
|
|||
|
* @license MIT
|
|||
|
* @preserve Project Home: https://github.com/voidqk/polybooljs
|
|||
|
*)
|
|||
|
|
|||
|
ieee754/index.js:
|
|||
|
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|||
|
|
|||
|
buffer/index.js:
|
|||
|
(*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|||
|
* @license MIT
|
|||
|
*)
|
|||
|
|
|||
|
safe-buffer/index.js:
|
|||
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|||
|
|
|||
|
assert/build/internal/util/comparisons.js:
|
|||
|
(*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|||
|
* @license MIT
|
|||
|
*)
|
|||
|
|
|||
|
object-assign/index.js:
|
|||
|
(*
|
|||
|
object-assign
|
|||
|
(c) Sindre Sorhus
|
|||
|
@license MIT
|
|||
|
*)
|
|||
|
|
|||
|
maplibre-gl/dist/maplibre-gl.js:
|
|||
|
(**
|
|||
|
* MapLibre GL JS
|
|||
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
|
|||
|
*)
|
|||
|
*/
|
|||
|
|
|||
|
window.Plotly = Plotly;
|
|||
|
return Plotly;
|
|||
|
}));
|