4013 lines
2.6 MiB
JavaScript
4013 lines
2.6 MiB
JavaScript
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Index-BHs-gF4l.js","assets/refresh-cw-CCL0Gd2i.js","assets/clock-CHYQgZWG.js","assets/chevron-right-Dvw0FPw3.js","assets/index-C6sfL5Wv.js","assets/circle-alert-DFiBooaQ.js","assets/video-Di1TW95I.js","assets/Auth-BZtkFe2c.js","assets/mail-C8_RqWpe.js","assets/eye-off-CHF4QKq3.js","assets/eye-IKrhkOAd.js","assets/index-DXB3_sFe.js","assets/smartphone-Ca6TX_3a.js","assets/MissionDetail-Bkj3Z1-2.js","assets/useMissionExamples-k-4yLF0Z.js","assets/useIdentityVerification-Cb6XYb0B.js","assets/circle-check-60AjePHB.js","assets/SecureCamera-0VtB9UCG.js","assets/shield-DIM7u0gp.js","assets/check-CCL32zXH.js","assets/award-7DMfX1ZX.js","assets/triangle-alert-I_PJ38kC.js","assets/gift-C8Ri1JSk.js","assets/ticket-DTjwndeG.js","assets/external-link-DZgJPdR9.js","assets/arrow-left-DyClWdEf.js","assets/image-CUEcTqim.js","assets/timer-DiqX45Mc.js","assets/Profile-Bs_7SKke.js","assets/dropdown-menu-CFWQzY9-.js","assets/circle-CNf9xg3I.js","assets/badge-D3Mn__J4.js","assets/progress-BVXi0hgU.js","assets/trending-up-CVyK6WFK.js","assets/leaf-BV-5O-4e.js","assets/zap-DA9vuiyP.js","assets/select-Dcsz1esX.js","assets/chevron-down-DA--jGG2.js","assets/building-2-BpMHggJ8.js","assets/credit-card-C9X53A_j.js","assets/palette-BI1sulb6.js","assets/save-CMkrLPh2.js","assets/Wallet-DhBioTUc.js","assets/differenceInDays-BjWVl97D.js","assets/sv-KqUX0hpM.js","assets/star-DINAYY6y.js","assets/qr-code-J7tfaoiH.js","assets/heart-Bn8C2h_q.js","assets/graduation-cap-TNnu1wlO.js","assets/scroll-area-DdYSSeiY.js","assets/info-DLVcQf5T.js","assets/file-text-I90VDyBK.js","assets/download-JAaLZNwh.js","assets/send-DWELcW4W.js","assets/calendar-3jVgdv6R.js","assets/Notifications-BvwbWrtB.js","assets/VerifyIdentity-CVO73JZ2.js","assets/OrdererRegistration-BiflvXWp.js","assets/radio-group-BcmHTP2Q.js","assets/landmark-pzfm3gLZ.js","assets/CreateMission-DTYpAitx.js","assets/upload-B_ploHV0.js","assets/repeat-CjEas7lo.js","assets/megaphone-B7uGchyN.js","assets/CreateCampaign-ssmSrgNm.js","assets/waves-CcHX4WbX.js","assets/trash-2-DRcoDJkq.js","assets/radio-DbSuriKm.js","assets/settings-CI2ouCEL.js","assets/search-DezKAVqp.js","assets/OrdererDashboard-CFnxw39_.js","assets/tabs-7ErWJ04g.js","assets/useQuery-CHKCqCt4.js","assets/ROICalculator-ha2oOP1j.js","assets/layers-CksRxMxR.js","assets/activity-BnabgJXD.js","assets/server-D4qLsdvj.js","assets/key-C9i37qxc.js","assets/RealChangeMission-BP6arpm_.js","assets/blocks-CpGLjLKj.js","assets/OrdererMissionDetail-rIgIT4BY.js","assets/OperationsPopout-BydwqHpi.js","assets/AnalyticsPopout-rWRAHbbT.js","assets/AdsPopout-ovL1xFgb.js","assets/Principles-CmpgkpiO.js","assets/network-DPfpWoXe.js","assets/Policy-mB-84Q1T.js","assets/Integritetspolicy-UTJ2l2uy.js","assets/Villkor-DWXP9YER.js","assets/PhotoMarketplace-DHi_u6nN.js","assets/taj-mahal-BrmjbJxw.js","assets/PhotoDetail-CWLPRqgG.js","assets/PhotoContest-ByCNK-WJ.js","assets/IdentityDisclaimer-D9ew3vwe.js","assets/RedeemVoucher-BpkWcNI_.js","assets/ResetPassword-UPJcC126.js"])))=>i.map(i=>d[i]);
|
||
|
|
var I$=Object.defineProperty;var gO=n=>{throw TypeError(n)};var M$=(n,t,s)=>t in n?I$(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var Tk=(n,t,s)=>M$(n,typeof t!="symbol"?t+"":t,s),Ek=(n,t,s)=>t.has(n)||gO("Cannot "+s);var Lt=(n,t,s)=>(Ek(n,t,"read from private field"),s?s.call(n):t.get(n)),Gr=(n,t,s)=>t.has(n)?gO("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),cr=(n,t,s,h)=>(Ek(n,t,"write to private field"),h?h.call(n,s):t.set(n,s),s),Es=(n,t,s)=>(Ek(n,t,"access private method"),s);var Aw=(n,t,s,h)=>({set _(g){cr(n,t,g,s)},get _(){return Lt(n,t,h)}});function P$(n,t){for(var s=0;s<t.length;s++){const h=t[s];if(typeof h!="string"&&!Array.isArray(h)){for(const g in h)if(g!=="default"&&!(g in n)){const v=Object.getOwnPropertyDescriptor(h,g);v&&Object.defineProperty(n,g,v.get?v:{enumerable:!0,get:()=>h[g]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const g of document.querySelectorAll('link[rel="modulepreload"]'))h(g);new MutationObserver(g=>{for(const v of g)if(v.type==="childList")for(const E of v.addedNodes)E.tagName==="LINK"&&E.rel==="modulepreload"&&h(E)}).observe(document,{childList:!0,subtree:!0});function s(g){const v={};return g.integrity&&(v.integrity=g.integrity),g.referrerPolicy&&(v.referrerPolicy=g.referrerPolicy),g.crossOrigin==="use-credentials"?v.credentials="include":g.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function h(g){if(g.ep)return;g.ep=!0;const v=s(g);fetch(g.href,v)}})();const D$="modulepreload",R$=function(n){return"/"+n},_O={},Ri=function(t,s,h){let g=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const E=document.querySelector("meta[property=csp-nonce]"),c=(E==null?void 0:E.nonce)||(E==null?void 0:E.getAttribute("nonce"));g=Promise.allSettled(s.map(T=>{if(T=R$(T),T in _O)return;_O[T]=!0;const L=T.endsWith(".css"),B=L?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${B}`))return;const U=document.createElement("link");if(U.rel=L?"stylesheet":D$,L||(U.as="script"),U.crossOrigin="",U.href=T,c&&U.setAttribute("nonce",c),document.head.appendChild(U),L)return new Promise((H,X)=>{U.addEventListener("load",H),U.addEventListener("error",()=>X(new Error(`Unable to preload CSS for ${T}`)))})}))}function v(E){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=E,window.dispatchEvent(c),!c.defaultPrevented)throw E}return g.then(E=>{for(const c of E||[])c.status==="rejected"&&v(c.reason);return t().catch(v)})};var L$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wI(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var GB={exports:{}},CT={},$B={exports:{}},jr={};/**
|
||
|
|
* @license React
|
||
|
|
* react.production.min.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*/var Vx=Symbol.for("react.element"),O$=Symbol.for("react.portal"),F$=Symbol.for("react.fragment"),z$=Symbol.for("react.strict_mode"),B$=Symbol.for("react.profiler"),N$=Symbol.for("react.provider"),V$=Symbol.for("react.context"),j$=Symbol.for("react.forward_ref"),U$=Symbol.for("react.suspense"),G$=Symbol.for("react.memo"),$$=Symbol.for("react.lazy"),yO=Symbol.iterator;function H$(n){return n===null||typeof n!="object"?null:(n=yO&&n[yO]||n["@@iterator"],typeof n=="function"?n:null)}var HB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WB=Object.assign,qB={};function V_(n,t,s){this.props=n,this.context=t,this.refs=qB,this.updater=s||HB}V_.prototype.isReactComponent={};V_.prototype.setState=function(n,t){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,t,"setState")};V_.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function ZB(){}ZB.prototype=V_.prototype;function SI(n,t,s){this.props=n,this.context=t,this.refs=qB,this.updater=s||HB}var TI=SI.prototype=new ZB;TI.constructor=SI;WB(TI,V_.prototype);TI.isPureReactComponent=!0;var vO=Array.isArray,XB=Object.prototype.hasOwnProperty,EI={current:null},KB={key:!0,ref:!0,__self:!0,__source:!0};function YB(n,t,s){var h,g={},v=null,E=null;if(t!=null)for(h in t.ref!==void 0&&(E=t.ref),t.key!==void 0&&(v=""+t.key),t)XB.call(t,h)&&!KB.hasOwnProperty(h)&&(g[h]=t[h]);var c=arguments.length-2;if(c===1)g.children=s;else if(1<c){for(var T=Array(c),L=0;L<c;L++)T[L]=arguments[L+2];g.children=T}if(n&&n.defaultProps)for(h in c=n.defaultProps,c)g[h]===void 0&&(g[h]=c[h]);return{$$typeof:Vx,type:n,key:v,ref:E,props:g,_owner:EI.current}}function W$(n,t){return{$$typeof:Vx,type:n.type,key:t,ref:n.ref,props:n.props,_owner:n._owner}}function kI(n){return typeof n=="object"&&n!==null&&n.$$typeof===Vx}function q$(n){var t={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(s){return t[s]})}var xO=/\/+/g;function kk(n,t){return typeof n=="object"&&n!==null&&n.key!=null?q$(""+n.key):t.toString(36)}function cS(n,t,s,h,g){var v=typeof n;(v==="undefined"||v==="boolean")&&(n=null);var E=!1;if(n===null)E=!0;else switch(v){case"string":case"number":E=!0;break;case"object":switch(n.$$typeof){case Vx:case O$:E=!0}}if(E)return E=n,g=g(E),n=h===""?"."+kk(E,0):h,vO(g)?(s="",n!=null&&(s=n.replace(xO,"$&/")+"/"),cS(g,t,s,"",function(L){return L})):g!=null&&(kI(g)&&(g=W$(g,s+(!g.key||E&&E.key===g.key?"":(""+g.key).replace(xO,"$&/")+"/")+n)),t.push(g)),1;if(E=0,h=h===""?".":h+":",vO(n))for(var c=0;c<n.length;c++){v=n[c];var T=h+kk(v,c);E+=cS(v,t,s,T,g)}else if(T=H$(n),typeof T=="function")for(n=T.call(n),c=0;!(v=n.next()).done;)v=v.value,T=h+kk(v,c++),E+=cS(v,t,s,T,g);else if(v==="object")throw t=String(n),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return E}function Cw(n,t,s){if(n==null)return n;var h=[],g=0;return cS(n,h,"","",function(v){return t.call(s,v,g++)}),h}function Z$(n){if(n._status===-1){var t=n._result;t=t(),t.then(function(s){(n._status===0||n._status===-1)&&(n._status=1,n._result=s)},function(s){(n._status===0||n._status===-1)&&(n._status=2,n._result=s)}),n._status===-1&&(n._status=0,n._result=t)}if(n._status===1)return n._result.default;throw n._result}var fa={current:null},uS={transition:null},X$={ReactCurrentDispatcher:fa,ReactCurrentBatchConfig:uS,ReactCurrentOwner:EI};function QB(){throw Error("act(...) is not supported in production builds of React.")}jr.Children={map:Cw,forEach:function(n,t,s){Cw(n,function(){t.apply(this,arguments)},s)},count:function(n){var t=0;return Cw(n,function(){t++}),t},toArray:function(n){return Cw(n,function(t){return t})||[]},only:function(n){if(!kI(n))throw Error("React.Children.only expected to receive a sin
|
||
|
|
* @license React
|
||
|
|
* react-jsx-runtime.production.min.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*/var K$=Y,Y$=Symbol.for("react.element"),Q$=Symbol.for("react.fragment"),J$=Object.prototype.hasOwnProperty,eH=K$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tH={key:!0,ref:!0,__self:!0,__source:!0};function JB(n,t,s){var h,g={},v=null,E=null;s!==void 0&&(v=""+s),t.key!==void 0&&(v=""+t.key),t.ref!==void 0&&(E=t.ref);for(h in t)J$.call(t,h)&&!tH.hasOwnProperty(h)&&(g[h]=t[h]);if(n&&n.defaultProps)for(h in t=n.defaultProps,t)g[h]===void 0&&(g[h]=t[h]);return{$$typeof:Y$,type:n,key:v,ref:E,props:g,_owner:eH.current}}CT.Fragment=Q$;CT.jsx=JB;CT.jsxs=JB;GB.exports=CT;var ue=GB.exports,e5={exports:{}},ml={},t5={exports:{}},n5={};/**
|
||
|
|
* @license React
|
||
|
|
* scheduler.production.min.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*/(function(n){function t(vt,pt){var Pt=vt.length;vt.push(pt);e:for(;0<Pt;){var An=Pt-1>>>1,bn=vt[An];if(0<g(bn,pt))vt[An]=pt,vt[Pt]=bn,Pt=An;else break e}}function s(vt){return vt.length===0?null:vt[0]}function h(vt){if(vt.length===0)return null;var pt=vt[0],Pt=vt.pop();if(Pt!==pt){vt[0]=Pt;e:for(var An=0,bn=vt.length,Vn=bn>>>1;An<Vn;){var Mn=2*(An+1)-1,Tn=vt[Mn],Wr=Mn+1,Kn=vt[Wr];if(0>g(Tn,Pt))Wr<bn&&0>g(Kn,Tn)?(vt[An]=Kn,vt[Wr]=Pt,An=Wr):(vt[An]=Tn,vt[Mn]=Pt,An=Mn);else if(Wr<bn&&0>g(Kn,Pt))vt[An]=Kn,vt[Wr]=Pt,An=Wr;else break e}}return pt}function g(vt,pt){var Pt=vt.sortIndex-pt.sortIndex;return Pt!==0?Pt:vt.id-pt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var v=performance;n.unstable_now=function(){return v.now()}}else{var E=Date,c=E.now();n.unstable_now=function(){return E.now()-c}}var T=[],L=[],B=1,U=null,H=3,X=!1,ae=!1,ne=!1,me=typeof setTimeout=="function"?setTimeout:null,oe=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function he(vt){for(var pt=s(L);pt!==null;){if(pt.callback===null)h(L);else if(pt.startTime<=vt)h(L),pt.sortIndex=pt.expirationTime,t(T,pt);else break;pt=s(L)}}function _e(vt){if(ne=!1,he(vt),!ae)if(s(T)!==null)ae=!0,Zt(De);else{var pt=s(L);pt!==null&&zt(_e,pt.startTime-vt)}}function De(vt,pt){ae=!1,ne&&(ne=!1,oe(Xe),Xe=-1),X=!0;var Pt=H;try{for(he(pt),U=s(T);U!==null&&(!(U.expirationTime>pt)||vt&&!Bt());){var An=U.callback;if(typeof An=="function"){U.callback=null,H=U.priorityLevel;var bn=An(U.expirationTime<=pt);pt=n.unstable_now(),typeof bn=="function"?U.callback=bn:U===s(T)&&h(T),he(pt)}else h(T);U=s(T)}if(U!==null)var Vn=!0;else{var Mn=s(L);Mn!==null&&zt(_e,Mn.startTime-pt),Vn=!1}return Vn}finally{U=null,H=Pt,X=!1}}var He=!1,nt=null,Xe=-1,ft=5,At=-1;function Bt(){return!(n.unstable_now()-At<ft)}function Dt(){if(nt!==null){var vt=n.unstable_now();At=vt;var pt=!0;try{pt=nt(!0,vt)}finally{pt?It():(He=!1,nt=null)}}else He=!1}var It;if(typeof re=="function")It=function(){re(Dt)};else if(typeof MessageChannel<"u"){var kt=new MessageChannel,wt=kt.port2;kt.port1.onmessage=Dt,It=function(){wt.postMessage(null)}}else It=function(){me(Dt,0)};function Zt(vt){nt=vt,He||(He=!0,It())}function zt(vt,pt){Xe=me(function(){vt(n.unstable_now())},pt)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(vt){vt.callback=null},n.unstable_continueExecution=function(){ae||X||(ae=!0,Zt(De))},n.unstable_forceFrameRate=function(vt){0>vt||125<vt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ft=0<vt?Math.floor(1e3/vt):5},n.unstable_getCurrentPriorityLevel=function(){return H},n.unstable_getFirstCallbackNode=function(){return s(T)},n.unstable_next=function(vt){switch(H){case 1:case 2:case 3:var pt=3;break;default:pt=H}var Pt=H;H=pt;try{return vt()}finally{H=Pt}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(vt,pt){switch(vt){case 1:case 2:case 3:case 4:case 5:break;default:vt=3}var Pt=H;H=vt;try{return pt()}finally{H=Pt}},n.unstable_scheduleCallback=function(vt,pt,Pt){var An=n.unstable_now();switch(typeof Pt=="object"&&Pt!==null?(Pt=Pt.delay,Pt=typeof Pt=="number"&&0<Pt?An+Pt:An):Pt=An,vt){case 1:var bn=-1;break;case 2:bn=250;break;case 5:bn=1073741823;break;case 4:bn=1e4;break;default:bn=5e3}return bn=Pt+bn,vt={id:B++,callback:pt,priorityLevel:vt,startTime:Pt,expirationTime:bn,sortIndex:-1},Pt>An?(vt.sortIndex=Pt,t(L,vt),s(T)===null&&vt===s(L)&&(ne?(oe(Xe),Xe=-1):ne=!0,zt(_e,Pt-An))):(vt.sortIndex=bn,t(T,vt),ae||X||(ae=!0,Zt(De))),vt},n.unstable_shouldYield=Bt,n.unstable_wrapCallback=function(vt){var pt=H;return function(){var Pt=H;H=pt;try{return vt.apply(this,arguments)}finally{H=Pt}}}})
|
||
|
|
* @license React
|
||
|
|
* react-dom.production.min.js
|
||
|
|
*
|
||
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*/var rH=Y,hl=nH;function Qt(n){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+n,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+n+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r5=new Set,rx={};function Qp(n,t){w_(n,t),w_(n+"Capture",t)}function w_(n,t){for(rx[n]=t,n=0;n<t.length;n++)r5.add(t[n])}var fd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),IA=Object.prototype.hasOwnProperty,iH=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,bO={},wO={};function oH(n){return IA.call(wO,n)?!0:IA.call(bO,n)?!1:iH.test(n)?wO[n]=!0:(bO[n]=!0,!1)}function sH(n,t,s,h){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return h?!1:s!==null?!s.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function aH(n,t,s,h){if(t===null||typeof t>"u"||sH(n,t,s,h))return!0;if(h)return!1;if(s!==null)switch(s.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pa(n,t,s,h,g,v,E){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=h,this.attributeNamespace=g,this.mustUseProperty=s,this.propertyName=n,this.type=t,this.sanitizeURL=v,this.removeEmptyString=E}var Is={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Is[n]=new pa(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var t=n[0];Is[t]=new pa(t,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Is[n]=new pa(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Is[n]=new pa(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Is[n]=new pa(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Is[n]=new pa(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Is[n]=new pa(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Is[n]=new pa(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Is[n]=new pa(n,5,!1,n.toLowerCase(),null,!1,!1)});var AI=/[\-:]([a-z])/g;function CI(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin
|
||
|
|
`+Ak+n}var Ck=!1;function Ik(n,t){if(!n||Ck)return"";Ck=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(L){var h=L}Reflect.construct(n,[],t)}else{try{t.call()}catch(L){h=L}n.call(t.prototype)}else{try{throw Error()}catch(L){h=L}n()}}catch(L){if(L&&h&&typeof L.stack=="string"){for(var g=L.stack.split(`
|
||
|
|
`),v=h.stack.split(`
|
||
|
|
`),E=g.length-1,c=v.length-1;1<=E&&0<=c&&g[E]!==v[c];)c--;for(;1<=E&&0<=c;E--,c--)if(g[E]!==v[c]){if(E!==1||c!==1)do if(E--,c--,0>c||g[E]!==v[c]){var T=`
|
||
|
|
`+g[E].replace(" at new "," at ");return n.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",n.displayName)),T}while(1<=E&&0<=c);break}}}finally{Ck=!1,Error.prepareStackTrace=s}return(n=n?n.displayName||n.name:"")?L0(n):""}function lH(n){switch(n.tag){case 5:return L0(n.type);case 16:return L0("Lazy");case 13:return L0("Suspense");case 19:return L0("SuspenseList");case 0:case 2:case 15:return n=Ik(n.type,!1),n;case 11:return n=Ik(n.type.render,!1),n;case 1:return n=Ik(n.type,!0),n;default:return""}}function RA(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ug:return"Fragment";case jg:return"Portal";case MA:return"Profiler";case MI:return"StrictMode";case PA:return"Suspense";case DA:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case o5:return(n.displayName||"Context")+".Consumer";case i5:return(n._context.displayName||"Context")+".Provider";case PI:var t=n.render;return n=n.displayName,n||(n=t.displayName||t.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case DI:return t=n.displayName||null,t!==null?t:RA(n.type)||"Memo";case wh:t=n._payload,n=n._init;try{return RA(n(t))}catch{}}return null}function cH(n){var t=n.type;switch(n.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=t.render,n=n.displayName||n.name||"",t.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return RA(t);case 8:return t===MI?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qh(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function a5(n){var t=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uH(n){var t=a5(n)?"checked":"value",s=Object.getOwnPropertyDescriptor(n.constructor.prototype,t),h=""+n[t];if(!n.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var g=s.get,v=s.set;return Object.defineProperty(n,t,{configurable:!0,get:function(){return g.call(this)},set:function(E){h=""+E,v.call(this,E)}}),Object.defineProperty(n,t,{enumerable:s.enumerable}),{getValue:function(){return h},setValue:function(E){h=""+E},stopTracking:function(){n._valueTracker=null,delete n[t]}}}}function Mw(n){n._valueTracker||(n._valueTracker=uH(n))}function l5(n){if(!n)return!1;var t=n._valueTracker;if(!t)return!0;var s=t.getValue(),h="";return n&&(h=a5(n)?n.checked?"true":"false":n.value),n=h,n!==s?(t.setValue(n),!0):!1}function RS(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function LA(n,t){var s=t.checked;return go({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??n._wrapperState.initialChecked})}function TO(n,t){var s=t.defaultValue==null?"":t.defaultValue,h=t.checked!=null?t.checked:t.defaultChecked;s=qh(t.value!=null?t.value:s),n._wrapperState={initialChecked:h,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function c5(n,t){t=t.checked,t!=null&&II(n,"checked",t,!1)}function OA(n,t){c5(n,t);var s=qh(t.value),h=t.type;if(s!=null)h==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+s):n.value!==""+s&&(n.value=""+s);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}t.hasOwnProperty("value")?FA(n,t.type,s):t.hasOwnProperty("defaultValue")&&FA(n,t.type,qh(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(n.defaultChecked=!!t.defaultChecked)}function EO(n,t,s){if(t.hasOwnProperty("val
|
||
|
|
`).replace(x9,"")}function Bw(n,t,s){if(t=ZO(t),ZO(n)!==t&&s)throw Error(Qt(425))}function jS(){}var KA=null,YA=null;function QA(n,t){return n==="textarea"||n==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var JA=typeof setTimeout=="function"?setTimeout:void 0,b9=typeof clearTimeout=="function"?clearTimeout:void 0,XO=typeof Promise=="function"?Promise:void 0,w9=typeof queueMicrotask=="function"?queueMicrotask:typeof XO<"u"?function(n){return XO.resolve(null).then(n).catch(S9)}:JA;function S9(n){setTimeout(function(){throw n})}function Uk(n,t){var s=t,h=0;do{var g=s.nextSibling;if(n.removeChild(s),g&&g.nodeType===8)if(s=g.data,s==="/$"){if(h===0){n.removeChild(g),lx(t);return}h--}else s!=="$"&&s!=="$?"&&s!=="$!"||h++;s=g}while(s);lx(t)}function Vh(n){for(;n!=null;n=n.nextSibling){var t=n.nodeType;if(t===1||t===3)break;if(t===8){if(t=n.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return n}function KO(n){n=n.previousSibling;for(var t=0;n;){if(n.nodeType===8){var s=n.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return n;t--}else s==="/$"&&t++}n=n.previousSibling}return null}var U_=Math.random().toString(36).slice(2),hu="__reactFiber$"+U_,fx="__reactProps$"+U_,pd="__reactContainer$"+U_,eC="__reactEvents$"+U_,T9="__reactListeners$"+U_,E9="__reactHandles$"+U_;function Ip(n){var t=n[hu];if(t)return t;for(var s=n.parentNode;s;){if(t=s[pd]||s[hu]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(n=KO(n);n!==null;){if(s=n[hu])return s;n=KO(n)}return t}n=s,s=n.parentNode}return null}function Gx(n){return n=n[hu]||n[pd],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Wg(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(Qt(33))}function LT(n){return n[fx]||null}var tC=[],qg=-1;function nf(n){return{current:n}}function Qi(n){0>qg||(n.current=tC[qg],tC[qg]=null,qg--)}function zi(n,t){qg++,tC[qg]=n.current,n.current=t}var Zh={},Ws=nf(Zh),La=nf(!1),Hp=Zh;function S_(n,t){var s=n.type.contextTypes;if(!s)return Zh;var h=n.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===t)return h.__reactInternalMemoizedMaskedChildContext;var g={},v;for(v in s)g[v]=t[v];return h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=t,n.__reactInternalMemoizedMaskedChildContext=g),g}function Oa(n){return n=n.childContextTypes,n!=null}function US(){Qi(La),Qi(Ws)}function YO(n,t,s){if(Ws.current!==Zh)throw Error(Qt(168));zi(Ws,t),zi(La,s)}function Y5(n,t,s){var h=n.stateNode;if(t=t.childContextTypes,typeof h.getChildContext!="function")return s;h=h.getChildContext();for(var g in h)if(!(g in t))throw Error(Qt(108,cH(n)||"Unknown",g));return go({},s,h)}function GS(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Zh,Hp=Ws.current,zi(Ws,n),zi(La,La.current),!0}function QO(n,t,s){var h=n.stateNode;if(!h)throw Error(Qt(169));s?(n=Y5(n,t,Hp),h.__reactInternalMemoizedMergedChildContext=n,Qi(La),Qi(Ws),zi(Ws,n)):Qi(La),zi(La,s)}var sd=null,OT=!1,Gk=!1;function Q5(n){sd===null?sd=[n]:sd.push(n)}function k9(n){OT=!0,Q5(n)}function rf(){if(!Gk&&sd!==null){Gk=!0;var n=0,t=xi;try{var s=sd;for(xi=1;n<s.length;n++){var h=s[n];do h=h(!0);while(h!==null)}sd=null,OT=!1}catch(g){throw sd!==null&&(sd=sd.slice(n+1)),S5(LI,rf),g}finally{xi=t,Gk=!1}}return null}var Zg=[],Xg=0,$S=null,HS=0,Nl=[],Vl=0,Wp=null,ld=1,cd="";function Tp(n,t){Zg[Xg++]=HS,Zg[Xg++]=$S,$S=n,HS=t}function J5(n,t,s){Nl[Vl++]=ld,Nl[Vl++]=cd,Nl[Vl++]=Wp,Wp=n;var h=ld;n=cd;var g=32-vc(h)-1;h&=~(1<<g),s+=1;var v=32-vc(t)+g;if(30<v){var E=g-g%5;v=(h&(1<<E)-1).toString(32),h>>=E,g-=E,ld=1<<32-vc(t)+g|s<<g|h,cd=v+n}else ld=1<<v|s<<g|h,cd=n}function GI(n){n.return!==null&&(Tp(n,1),J5(n,1,0))}function $I(n){for(;n===$S;)$S=Zg[--Xg],Zg[Xg]=null,HS=Zg[--Xg],Zg[Xg]=null;for(;n===Wp;)Wp=Nl[--Vl],Nl[Vl]=null,cd=Nl[--Vl],Nl[Vl]=null,ld=Nl[--Vl],Nl[Vl]=null}var cl=null,ll=null,so=!1,yc=null;function eN(n,t){var s=jl(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=n,t=n.de
|
||
|
|
Error generating stack: `+v.message+`
|
||
|
|
`+v.stack}return{value:n,source:t,stack:g,digest:null}}function Zk(n,t,s){return{value:n,source:null,stack:s??null,digest:t??null}}function aC(n,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var O9=typeof WeakMap=="function"?WeakMap:Map;function AN(n,t,s){s=ud(-1,s),s.tag=3,s.payload={element:null};var h=t.value;return s.callback=function(){JS||(JS=!0,_C=h),aC(n,t)},s}function CN(n,t,s){s=ud(-1,s),s.tag=3;var h=n.type.getDerivedStateFromError;if(typeof h=="function"){var g=t.value;s.payload=function(){return h(g)},s.callback=function(){aC(n,t)}}var v=n.stateNode;return v!==null&&typeof v.componentDidCatch=="function"&&(s.callback=function(){aC(n,t),typeof h!="function"&&(Uh===null?Uh=new Set([this]):Uh.add(this));var E=t.stack;this.componentDidCatch(t.value,{componentStack:E!==null?E:""})}),s}function lF(n,t,s){var h=n.pingCache;if(h===null){h=n.pingCache=new O9;var g=new Set;h.set(t,g)}else g=h.get(t),g===void 0&&(g=new Set,h.set(t,g));g.has(s)||(g.add(s),n=X9.bind(null,n,t,s),t.then(n,n))}function cF(n){do{var t;if((t=n.tag===13)&&(t=n.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return n;n=n.return}while(n!==null);return null}function uF(n,t,s,h,g){return n.mode&1?(n.flags|=65536,n.lanes=g,n):(n===t?n.flags|=65536:(n.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=ud(-1,1),t.tag=2,jh(s,t,1))),s.lanes|=1),n)}var F9=bd.ReactCurrentOwner,Ra=!1;function ua(n,t,s,h){t.child=n===null?rN(t,null,s,h):E_(t,n.child,s,h)}function dF(n,t,s,h,g){s=s.render;var v=t.ref;return l_(t,g),h=tM(n,t,s,h,v,g),s=nM(),n!==null&&!Ra?(t.updateQueue=n.updateQueue,t.flags&=-2053,n.lanes&=~g,gd(n,t,g)):(so&&s&&GI(t),t.flags|=1,ua(n,t,h,g),t.child)}function hF(n,t,s,h,g){if(n===null){var v=s.type;return typeof v=="function"&&!hM(v)&&v.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=v,IN(n,t,v,h,g)):(n=xS(s.type,null,h,t,t.mode,g),n.ref=t.ref,n.return=t,t.child=n)}if(v=n.child,!(n.lanes&g)){var E=v.memoizedProps;if(s=s.compare,s=s!==null?s:ux,s(E,h)&&n.ref===t.ref)return gd(n,t,g)}return t.flags|=1,n=$h(v,h),n.ref=t.ref,n.return=t,t.child=n}function IN(n,t,s,h,g){if(n!==null){var v=n.memoizedProps;if(ux(v,h)&&n.ref===t.ref)if(Ra=!1,t.pendingProps=h=v,(n.lanes&g)!==0)n.flags&131072&&(Ra=!0);else return t.lanes=n.lanes,gd(n,t,g)}return lC(n,t,s,h,g)}function MN(n,t,s){var h=t.pendingProps,g=h.children,v=n!==null?n.memoizedState:null;if(h.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},zi(Qg,il),il|=s;else{if(!(s&1073741824))return n=v!==null?v.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:n,cachePool:null,transitions:null},t.updateQueue=null,zi(Qg,il),il|=n,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=v!==null?v.baseLanes:s,zi(Qg,il),il|=h}else v!==null?(h=v.baseLanes|s,t.memoizedState=null):h=s,zi(Qg,il),il|=h;return ua(n,t,g,s),t.child}function PN(n,t){var s=t.ref;(n===null&&s!==null||n!==null&&n.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function lC(n,t,s,h,g){var v=Oa(s)?Hp:Ws.current;return v=S_(t,v),l_(t,g),s=tM(n,t,s,h,v,g),h=nM(),n!==null&&!Ra?(t.updateQueue=n.updateQueue,t.flags&=-2053,n.lanes&=~g,gd(n,t,g)):(so&&h&&GI(t),t.flags|=1,ua(n,t,s,g),t.child)}function fF(n,t,s,h,g){if(Oa(s)){var v=!0;GS(t)}else v=!1;if(l_(t,g),t.stateNode===null)_S(n,t),kN(t,s,h),sC(t,s,h,g),h=!0;else if(n===null){var E=t.stateNode,c=t.memoizedProps;E.props=c;var T=E.context,L=s.contextType;typeof L=="object"&&L!==null?L=Gl(L):(L=Oa(s)?Hp:Ws.current,L=S_(t,L));var B=s.getDerivedStateFromProps,U=typeof B=="function"||typeof E.getSnapshotBeforeUpdate=="function";U||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(c!==h||T!==L)&&aF(t,E,h,L),Sh=!1;var H=t.memoizedState;E.state=H,ZS(t,h,E,g),T=t.memoizedState,c!==h||H!==T||La.current||Sh?(typeof B=="function"&&(oC(t,s,B,h),T=t.memoizedState),(c=Sh||sF(t,s,c,h,H,T,L))?(U||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const dW=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C4=(...n)=>n.filter((t,s,h)=>!!t&&t.trim()!==""&&h.indexOf(t)===s).join(" ").trim();/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/var hW={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const fW=Y.forwardRef(({color:n="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:h,className:g="",children:v,iconNode:E,...c},T)=>Y.createElement("svg",{ref:T,...hW,width:t,height:t,stroke:n,strokeWidth:h?Number(s)*24/Number(t):s,className:C4("lucide",g),...c},[...E.map(([L,B])=>Y.createElement(L,B)),...Array.isArray(v)?v:[v]]));/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const Hr=(n,t)=>{const s=Y.forwardRef(({className:h,...g},v)=>Y.createElement(fW,{ref:v,iconNode:t,className:C4(`lucide-${dW(n)}`,h),...g}));return s.displayName=`${n}`,s};/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const pW=Hr("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const FF=Hr("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const I4=Hr("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const zF=Hr("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const mW=Hr("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const gW=Hr("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const _W=Hr("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const Pg=Hr("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const BF=Hr("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const yW=Hr("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const EC=Hr("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const M4=Hr("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const vW=Hr("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const xW=Hr("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const bW=Hr("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const NF=Hr("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const wW=Hr("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const SW=Hr("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const rT=Hr("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const TW=Hr("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const EW=Hr("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const P4=Hr("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const kW=Hr("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const iT=Hr("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const kC=Hr("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const AC=Hr("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const AW=Hr("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const CW=Hr("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const D4=Hr("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const IW=Hr("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const VF=Hr("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const MW=Hr("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const PW=Hr("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const DW=Hr("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/**
|
||
|
|
* @license lucide-react v0.462.0 - ISC
|
||
|
|
*
|
||
|
|
* This source code is licensed under the ISC license.
|
||
|
|
* See the LICENSE file in the root directory of this source tree.
|
||
|
|
*/const jp=Hr("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),SM="-",RW=n=>{const t=OW(n),{conflictingClassGroups:s,conflictingClassGroupModifiers:h}=n;return{getClassGroupId:E=>{const c=E.split(SM);return c[0]===""&&c.length!==1&&c.shift(),R4(c,t)||LW(E)},getConflictingClassGroupIds:(E,c)=>{const T=s[E]||[];return c&&h[E]?[...T,...h[E]]:T}}},R4=(n,t)=>{var E;if(n.length===0)return t.classGroupId;const s=n[0],h=t.nextPart.get(s),g=h?R4(n.slice(1),h):void 0;if(g)return g;if(t.validators.length===0)return;const v=n.join(SM);return(E=t.validators.find(({validator:c})=>c(v)))==null?void 0:E.classGroupId},jF=/^\[(.+)\]$/,LW=n=>{if(jF.test(n)){const t=jF.exec(n)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},OW=n=>{const{theme:t,prefix:s}=n,h={nextPart:new Map,validators:[]};return zW(Object.entries(n.classGroups),s).forEach(([v,E])=>{CC(E,h,v,t)}),h},CC=(n,t,s,h)=>{n.forEach(g=>{if(typeof g=="string"){const v=g===""?t:UF(t,g);v.classGroupId=s;return}if(typeof g=="function"){if(FW(g)){CC(g(h),t,s,h);return}t.validators.push({validator:g,classGroupId:s});return}Object.entries(g).forEach(([v,E])=>{CC(E,UF(t,v),s,h)})})},UF=(n,t)=>{let s=n;return t.split(SM).forEach(h=>{s.nextPart.has(h)||s.nextPart.set(h,{nextPart:new Map,validators:[]}),s=s.nextPart.get(h)}),s},FW=n=>n.isThemeGetter,zW=(n,t)=>t?n.map(([s,h])=>{const g=h.map(v=>typeof v=="string"?t+v:typeof v=="object"?Object.fromEntries(Object.entries(v).map(([E,c])=>[t+E,c])):v);return[s,g]}):n,BW=n=>{if(n<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,h=new Map;const g=(v,E)=>{s.set(v,E),t++,t>n&&(t=0,h=s,s=new Map)};return{get(v){let E=s.get(v);if(E!==void 0)return E;if((E=h.get(v))!==void 0)return g(v,E),E},set(v,E){s.has(v)?s.set(v,E):g(v,E)}}},L4="!",NW=n=>{const{separator:t,experimentalParseClassName:s}=n,h=t.length===1,g=t[0],v=t.length,E=c=>{const T=[];let L=0,B=0,U;for(let me=0;me<c.length;me++){let oe=c[me];if(L===0){if(oe===g&&(h||c.slice(me,me+v)===t)){T.push(c.slice(B,me)),B=me+v;continue}if(oe==="/"){U=me;continue}}oe==="["?L++:oe==="]"&&L--}const H=T.length===0?c:c.substring(B),X=H.startsWith(L4),ae=X?H.substring(1):H,ne=U&&U>B?U-B:void 0;return{modifiers:T,hasImportantModifier:X,baseClassName:ae,maybePostfixModifierPosition:ne}};return s?c=>s({className:c,parseClassName:E}):E},VW=n=>{if(n.length<=1)return n;const t=[];let s=[];return n.forEach(h=>{h[0]==="["?(t.push(...s.sort(),h),s=[]):s.push(h)}),t.push(...s.sort()),t},jW=n=>({cache:BW(n.cacheSize),parseClassName:NW(n),...RW(n)}),UW=/\s+/,GW=(n,t)=>{const{parseClassName:s,getClassGroupId:h,getConflictingClassGroupIds:g}=t,v=[],E=n.trim().split(UW);let c="";for(let T=E.length-1;T>=0;T-=1){const L=E[T],{modifiers:B,hasImportantModifier:U,baseClassName:H,maybePostfixModifierPosition:X}=s(L);let ae=!!X,ne=h(ae?H.substring(0,X):H);if(!ne){if(!ae){c=L+(c.length>0?" "+c:c);continue}if(ne=h(H),!ne){c=L+(c.length>0?" "+c:c);continue}ae=!1}const me=VW(B).join(":"),oe=U?me+L4:me,re=oe+ne;if(v.includes(re))continue;v.push(re);const he=g(ne,ae);for(let _e=0;_e<he.length;++_e){const De=he[_e];v.push(oe+De)}c=L+(c.length>0?" "+c:c)}return c};function $W(){let n=0,t,s,h="";for(;n<arguments.length;)(t=arguments[n++])&&(s=O4(t))&&(h&&(h+=" "),h+=s);return h}const O4=n=>{if(typeof n=="string")return n;let t,s="";for(let h=0;h<n.length;h++)n[h]&&(t=O4(n[h]))&&(s&&(s+=" "),s+=t);return s};function HW(n,...t){let s,h,g,v=E;function E(T){const L=t.reduce((B,U)=>U(B),n());return s=jW(L),h=s.cache.get,g=s.cache.set,v=c,c(T)}function c(T){const L=h(T);if(L)return L;const B=GW(T,s);return g(T,B),B}return function(){return v($W.apply(null,arguments))}}const Xi=n=>{const t=s=>s[n]||[];return t.isThemeGetter=!0,t},F4=/^\[(?:([a-z-]+):)?(.+)\]$/i,WW=/^\d+\/\d+$/,qW=new Set(["px","full","screen"]),ZW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,KW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,YW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(
|
||
|
|
`);function Zw(n){return n.label!==void 0}var Oq=3,Fq="32px",zq="16px",$F=4e3,Bq=356,Nq=14,Vq=20,jq=200;function hc(...n){return n.filter(Boolean).join(" ")}function Uq(n){let[t,s]=n.split("-"),h=[];return t&&h.push(t),s&&h.push(s),h}var Gq=n=>{var t,s,h,g,v,E,c,T,L,B,U;let{invert:H,toast:X,unstyled:ae,interacting:ne,setHeights:me,visibleToasts:oe,heights:re,index:he,toasts:_e,expanded:De,removeToast:He,defaultRichColors:nt,closeButton:Xe,style:ft,cancelButtonStyle:At,actionButtonStyle:Bt,className:Dt="",descriptionClassName:It="",duration:kt,position:wt,gap:Zt,loadingIcon:zt,expandByDefault:vt,classNames:pt,icons:Pt,closeButtonAriaLabel:An="Close toast",pauseWhenPageIsHidden:bn}=n,[Vn,Mn]=dn.useState(null),[Tn,Wr]=dn.useState(null),[Kn,Ho]=dn.useState(!1),[Ni,wo]=dn.useState(!1),[$n,Ar]=dn.useState(!1),[pi,zo]=dn.useState(!1),[Tr,ns]=dn.useState(!1),[ma,So]=dn.useState(0),[Ci,Or]=dn.useState(0),Vi=dn.useRef(X.duration||kt||$F),To=dn.useRef(null),ys=dn.useRef(null),za=he===0,Ec=he+1<=oe,oi=X.type,rs=X.dismissible!==!1,vs=X.className||"",Ct=X.descriptionClassName||"",sn=dn.useMemo(()=>re.findIndex(zn=>zn.toastId===X.id)||0,[re,X.id]),pn=dn.useMemo(()=>{var zn;return(zn=X.closeButton)!=null?zn:Xe},[X.closeButton,Xe]),jn=dn.useMemo(()=>X.duration||kt||$F,[X.duration,kt]),Fn=dn.useRef(0),hr=dn.useRef(0),qr=dn.useRef(0),ti=dn.useRef(null),[qs,Ba]=wt.split("-"),is=dn.useMemo(()=>re.reduce((zn,vr,et)=>et>=sn?zn:zn+vr.height,0),[re,sn]),Ms=Aq(),mi=X.invert||H,ga=oi==="loading";hr.current=dn.useMemo(()=>sn*Zt+is,[sn,is]),dn.useEffect(()=>{Vi.current=jn},[jn]),dn.useEffect(()=>{Ho(!0)},[]),dn.useEffect(()=>{let zn=ys.current;if(zn){let vr=zn.getBoundingClientRect().height;return Or(vr),me(et=>[{toastId:X.id,height:vr,position:X.position},...et]),()=>me(et=>et.filter(ji=>ji.toastId!==X.id))}},[me,X.id]),dn.useLayoutEffect(()=>{if(!Kn)return;let zn=ys.current,vr=zn.style.height;zn.style.height="auto";let et=zn.getBoundingClientRect().height;zn.style.height=vr,Or(et),me(ji=>ji.find(Eo=>Eo.toastId===X.id)?ji.map(Eo=>Eo.toastId===X.id?{...Eo,height:et}:Eo):[{toastId:X.id,height:et,position:X.position},...ji])},[Kn,X.title,X.description,me,X.id]);let Wo=dn.useCallback(()=>{wo(!0),So(hr.current),me(zn=>zn.filter(vr=>vr.toastId!==X.id)),setTimeout(()=>{He(X)},jq)},[X,He,me,hr]);dn.useEffect(()=>{if(X.promise&&oi==="loading"||X.duration===1/0||X.type==="loading")return;let zn;return De||ne||bn&&Ms?(()=>{if(qr.current<Fn.current){let vr=new Date().getTime()-Fn.current;Vi.current=Vi.current-vr}qr.current=new Date().getTime()})():Vi.current!==1/0&&(Fn.current=new Date().getTime(),zn=setTimeout(()=>{var vr;(vr=X.onAutoClose)==null||vr.call(X,X),Wo()},Vi.current)),()=>clearTimeout(zn)},[De,ne,X,oi,bn,Ms,Wo]),dn.useEffect(()=>{X.delete&&Wo()},[Wo,X.delete]);function _a(){var zn,vr,et;return Pt!=null&&Pt.loading?dn.createElement("div",{className:hc(pt==null?void 0:pt.loader,(zn=X==null?void 0:X.classNames)==null?void 0:zn.loader,"sonner-loader"),"data-visible":oi==="loading"},Pt.loading):zt?dn.createElement("div",{className:hc(pt==null?void 0:pt.loader,(vr=X==null?void 0:X.classNames)==null?void 0:vr.loader,"sonner-loader"),"data-visible":oi==="loading"},zt):dn.createElement(bq,{className:hc(pt==null?void 0:pt.loader,(et=X==null?void 0:X.classNames)==null?void 0:et.loader),visible:oi==="loading"})}return dn.createElement("li",{tabIndex:0,ref:ys,className:hc(Dt,vs,pt==null?void 0:pt.toast,(t=X==null?void 0:X.classNames)==null?void 0:t.toast,pt==null?void 0:pt.default,pt==null?void 0:pt[oi],(s=X==null?void 0:X.classNames)==null?void 0:s[oi]),"data-sonner-toast":"","data-rich-colors":(h=X.richColors)!=null?h:nt,"data-styled":!(X.jsx||X.unstyled||ae),"data-mounted":Kn,"data-promise":!!X.promise,"data-swiped":Tr,"data-removed":Ni,"data-visible":Ec,"data-y-position":qs,"data-x-position":Ba,"data-index":he,"data-front":za,"data-swiping":$n,"data-dismissible":rs,"data-type":oi,"data-invert":mi,"data-swipe-out":pi,"data-swipe-direction":Tn,"data-expanded":!!(De||vt&&Kn),style:{"--index":he,"--toasts-before":he,"--z-index":_e.length-he,"--offset":`${Ni?ma
|
||
|
|
* @remix-run/router v1.23.3
|
||
|
|
*
|
||
|
|
* Copyright (c) Remix Software Inc.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE.md file in the root directory of this source tree.
|
||
|
|
*
|
||
|
|
* @license MIT
|
||
|
|
*/function Ex(){return Ex=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var h in s)({}).hasOwnProperty.call(s,h)&&(n[h]=s[h])}return n},Ex.apply(null,arguments)}var Oh;(function(n){n.Pop="POP",n.Push="PUSH",n.Replace="REPLACE"})(Oh||(Oh={}));const uz="popstate";function lK(n){n===void 0&&(n={});function t(h,g){let{pathname:v,search:E,hash:c}=h.location;return NC("",{pathname:v,search:E,hash:c},g.state&&g.state.usr||null,g.state&&g.state.key||"default")}function s(h,g){return typeof g=="string"?g:uT(g)}return uK(t,s,null,n)}function Fo(n,t){if(n===!1||n===null||typeof n>"u")throw new Error(t)}function FM(n,t){if(!n){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function cK(){return Math.random().toString(36).substr(2,8)}function dz(n,t){return{usr:n.state,key:n.key,idx:t}}function NC(n,t,s,h){return s===void 0&&(s=null),Ex({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof t=="string"?X_(t):t,{state:s,key:t&&t.key||h||cK()})}function uT(n){let{pathname:t="/",search:s="",hash:h=""}=n;return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),h&&h!=="#"&&(t+=h.charAt(0)==="#"?h:"#"+h),t}function X_(n){let t={};if(n){let s=n.indexOf("#");s>=0&&(t.hash=n.substr(s),n=n.substr(0,s));let h=n.indexOf("?");h>=0&&(t.search=n.substr(h),n=n.substr(0,h)),n&&(t.pathname=n)}return t}function uK(n,t,s,h){h===void 0&&(h={});let{window:g=document.defaultView,v5Compat:v=!1}=h,E=g.history,c=Oh.Pop,T=null,L=B();L==null&&(L=0,E.replaceState(Ex({},E.state,{idx:L}),""));function B(){return(E.state||{idx:null}).idx}function U(){c=Oh.Pop;let me=B(),oe=me==null?null:me-L;L=me,T&&T({action:c,location:ne.location,delta:oe})}function H(me,oe){c=Oh.Push;let re=NC(ne.location,me,oe);L=B()+1;let he=dz(re,L),_e=ne.createHref(re);try{E.pushState(he,"",_e)}catch(De){if(De instanceof DOMException&&De.name==="DataCloneError")throw De;g.location.assign(_e)}v&&T&&T({action:c,location:ne.location,delta:1})}function X(me,oe){c=Oh.Replace;let re=NC(ne.location,me,oe);L=B();let he=dz(re,L),_e=ne.createHref(re);E.replaceState(he,"",_e),v&&T&&T({action:c,location:ne.location,delta:0})}function ae(me){let oe=g.location.origin!=="null"?g.location.origin:g.location.href,re=typeof me=="string"?me:uT(me);return re=re.replace(/ $/,"%20"),Fo(oe,"No window.location.(origin|href) available to create URL for href: "+re),new URL(re,oe)}let ne={get action(){return c},get location(){return n(g,E)},listen(me){if(T)throw new Error("A history only accepts one active listener");return g.addEventListener(uz,U),T=me,()=>{g.removeEventListener(uz,U),T=null}},createHref(me){return t(g,me)},createURL:ae,encodeLocation(me){let oe=ae(me);return{pathname:oe.pathname,search:oe.search,hash:oe.hash}},push:H,replace:X,go(me){return E.go(me)}};return ne}var hz;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(hz||(hz={}));function dK(n,t,s){return s===void 0&&(s="/"),hK(n,t,s)}function hK(n,t,s,h){let g=typeof t=="string"?X_(t):t,v=zM(g.pathname||"/",s);if(v==null)return null;let E=CV(n);fK(E);let c=null,T=EK(v);for(let L=0;c==null&&L<E.length;++L)c=wK(E[L],T);return c}function CV(n,t,s,h){t===void 0&&(t=[]),s===void 0&&(s=[]),h===void 0&&(h="");let g=(v,E,c)=>{let T={relativePath:c===void 0?v.path||"":c,caseSensitive:v.caseSensitive===!0,childrenIndex:E,route:v};T.relativePath.startsWith("/")&&(Fo(T.relativePath.startsWith(h),'Absolute route path "'+T.relativePath+'" nested under path '+('"'+h+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),T.relativePath=T.relativePath.slice(h.length));let L=Hh([h,T.relativePath]),B=s.concat(T);v.children&&v.children.length>0&&(Fo(v.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+L+'".')),CV(v.children,t,B,L)),!(v.path==null&&!v.index)&&t.push({path:L,score:xK(L,v.index),routesMeta:B})};return n.forEach((v,E)=>{var c;if(v.path===""||!((c=v.path)!=null&&c.includes("?")))g(v,E);else for(let T of IV(v.path))g(v,E,T
|
||
|
|
* React Router v6.30.4
|
||
|
|
*
|
||
|
|
* Copyright (c) Remix Software Inc.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE.md file in the root directory of this source tree.
|
||
|
|
*
|
||
|
|
* @license MIT
|
||
|
|
*/function kx(){return kx=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var h in s)({}).hasOwnProperty.call(s,h)&&(n[h]=s[h])}return n},kx.apply(null,arguments)}const VM=Y.createContext(null),OK=Y.createContext(null),of=Y.createContext(null),r2=Y.createContext(null),Sd=Y.createContext({outlet:null,matches:[],isDataRoute:!1}),DV=Y.createContext(null);function FK(n,t){let{relative:s}=t===void 0?{}:t;K_()||Fo(!1);let{basename:h,navigator:g}=Y.useContext(of),{hash:v,pathname:E,search:c}=LV(n,{relative:s}),T=E;return h!=="/"&&(T=E==="/"?h:Hh([h,E])),g.createHref({pathname:T,search:c,hash:v})}function K_(){return Y.useContext(r2)!=null}function em(){return K_()||Fo(!1),Y.useContext(r2).location}function RV(n){Y.useContext(of).static||Y.useLayoutEffect(n)}function Y_(){let{isDataRoute:n}=Y.useContext(Sd);return n?XK():zK()}function zK(){K_()||Fo(!1);let n=Y.useContext(VM),{basename:t,future:s,navigator:h}=Y.useContext(of),{matches:g}=Y.useContext(Sd),{pathname:v}=em(),E=JSON.stringify(BM(g,s.v7_relativeSplatPath)),c=Y.useRef(!1);return RV(()=>{c.current=!0}),Y.useCallback(function(L,B){if(B===void 0&&(B={}),!c.current)return;if(typeof L=="number"){h.go(L);return}let U=NM(L,JSON.parse(E),v,B.relative==="path");n==null&&t!=="/"&&(U.pathname=U.pathname==="/"?t:Hh([t,U.pathname])),(B.replace?h.replace:h.push)(U,B.state,B)},[t,h,E,v,n])}function Kle(){let{matches:n}=Y.useContext(Sd),t=n[n.length-1];return t?t.params:{}}function LV(n,t){let{relative:s}=t===void 0?{}:t,{future:h}=Y.useContext(of),{matches:g}=Y.useContext(Sd),{pathname:v}=em(),E=JSON.stringify(BM(g,h.v7_relativeSplatPath));return Y.useMemo(()=>NM(n,JSON.parse(E),v,s==="path"),[n,E,v,s])}function BK(n,t){return NK(n,t)}function NK(n,t,s,h){K_()||Fo(!1);let{navigator:g}=Y.useContext(of),{matches:v}=Y.useContext(Sd),E=v[v.length-1],c=E?E.params:{};E&&E.pathname;let T=E?E.pathnameBase:"/";E&&E.route;let L=em(),B;if(t){var U;let me=typeof t=="string"?X_(t):t;T==="/"||(U=me.pathname)!=null&&U.startsWith(T)||Fo(!1),B=me}else B=L;let H=B.pathname||"/",X=H;if(T!=="/"){let me=T.replace(/^\//,"").split("/");X="/"+H.replace(/^\//,"").split("/").slice(me.length).join("/")}let ae=dK(n,{pathname:X}),ne=$K(ae&&ae.map(me=>Object.assign({},me,{params:Object.assign({},c,me.params),pathname:Hh([T,g.encodeLocation?g.encodeLocation(me.pathname).pathname:me.pathname]),pathnameBase:me.pathnameBase==="/"?T:Hh([T,g.encodeLocation?g.encodeLocation(me.pathnameBase).pathname:me.pathnameBase])})),v,s,h);return t&&ne?Y.createElement(r2.Provider,{value:{location:kx({pathname:"/",search:"",hash:"",state:null,key:"default"},B),navigationType:Oh.Pop}},ne):ne}function VK(){let n=ZK(),t=RK(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),s=n instanceof Error?n.stack:null,g={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return Y.createElement(Y.Fragment,null,Y.createElement("h2",null,"Unexpected Application Error!"),Y.createElement("h3",{style:{fontStyle:"italic"}},t),s?Y.createElement("pre",{style:g},s):null,null)}const jK=Y.createElement(VK,null);class UK extends Y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){console.error("React Router caught the following error during render",t,s)}render(){return this.state.error!==void 0?Y.createElement(Sd.Provider,{value:this.props.routeContext},Y.createElement(DV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function GK(n){let{routeContext:t,match:s,children:h}=n,g=Y.useContext(VM);return g&&g.static&&g.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(g.staticContext._deepestRenderedBoundaryId=s
|
||
|
|
* React Router DOM v6.30.4
|
||
|
|
*
|
||
|
|
* Copyright (c) Remix Software Inc.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE.md file in the root directory of this source tree.
|
||
|
|
*
|
||
|
|
* @license MIT
|
||
|
|
*/function jC(){return jC=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var h in s)({}).hasOwnProperty.call(s,h)&&(n[h]=s[h])}return n},jC.apply(null,arguments)}function eY(n,t){if(n==null)return{};var s={};for(var h in n)if({}.hasOwnProperty.call(n,h)){if(t.indexOf(h)!==-1)continue;s[h]=n[h]}return s}function tY(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function nY(n,t){return n.button===0&&(!t||t==="_self")&&!tY(n)}function UC(n){return n===void 0&&(n=""),new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((t,s)=>{let h=n[s];return t.concat(Array.isArray(h)?h.map(g=>[s,g]):[[s,h]])},[]))}function rY(n,t){let s=UC(n);return t&&t.forEach((h,g)=>{s.has(g)||t.getAll(g).forEach(v=>{s.append(g,v)})}),s}const iY=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],oY="6";try{window.__reactRouterVersion=oY}catch{}const sY="startTransition",gz=IT[sY];function aY(n){let{basename:t,children:s,future:h,window:g}=n,v=Y.useRef();v.current==null&&(v.current=lK({window:g,v5Compat:!0}));let E=v.current,[c,T]=Y.useState({action:E.action,location:E.location}),{v7_startTransition:L}=h||{},B=Y.useCallback(U=>{L&&gz?gz(()=>T(U)):T(U)},[T,L]);return Y.useLayoutEffect(()=>E.listen(B),[E,B]),Y.useEffect(()=>YK(h),[h]),Y.createElement(QK,{basename:t,children:s,location:c.location,navigationType:c.action,navigator:E,future:h})}const lY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cY=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qle=Y.forwardRef(function(t,s){let{onClick:h,relative:g,reloadDocument:v,replace:E,state:c,target:T,to:L,preventScrollReset:B,viewTransition:U}=t,H=eY(t,iY),{basename:X}=Y.useContext(of),ae,ne=!1;if(typeof L=="string"&&cY.test(L)&&(ae=L,lY))try{let he=new URL(window.location.href),_e=L.startsWith("//")?new URL(he.protocol+L):new URL(L),De=zM(_e.pathname,X);_e.origin===he.origin&&De!=null?L=De+_e.search+_e.hash:ne=!0}catch{}let me=FK(L,{relative:g}),oe=uY(L,{replace:E,state:c,target:T,preventScrollReset:B,relative:g,viewTransition:U});function re(he){h&&h(he),he.defaultPrevented||oe(he)}return Y.createElement("a",jC({},H,{href:ae||me,onClick:ne||v?h:re,ref:s,target:T}))});var _z;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(_z||(_z={}));var yz;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(yz||(yz={}));function uY(n,t){let{target:s,replace:h,state:g,preventScrollReset:v,relative:E,viewTransition:c}=t===void 0?{}:t,T=Y_(),L=em(),B=LV(n,{relative:E});return Y.useCallback(U=>{if(nY(U,s)){U.preventDefault();let H=h!==void 0?h:uT(L)===uT(B);T(n,{replace:H,state:g,preventScrollReset:v,relative:E,viewTransition:c})}},[L,T,B,h,g,s,n,v,E,c])}function dY(n){let t=Y.useRef(UC(n)),s=Y.useRef(!1),h=em(),g=Y.useMemo(()=>rY(h.search,s.current?null:t.current),[h.search]),v=Y_(),E=Y.useCallback((c,T)=>{const L=UC(typeof c=="function"?c(g):c);s.current=!0,v("?"+L,T)},[v,g]);return[g,E]}class hY{constructor(t){Tk(this,"config");Tk(this,"listeners",new Set);this.config={token_key:"qz_auth_token",refresh_token_key:"qz_refresh_token",auto_refresh:!0,...t}}async request(t,s={}){const h=`${this.config.api_base_url}${t}`,g=this.getToken(),v={"Content-Type":"application/json",...s.headers||{}};g&&(v.Authorization=`Bearer ${g}`);const E=await fetch(h,{...s,headers:v});if(!E.ok){const c=await E.json().catch(()=>({}));throw new fY(c.message||`HTTP ${E.status}`,E.status,c.code)}return E.json()}getToken(){return localStorage.getItem(this.config.token_key)}setToken(t){localStorage.setItem(this.config.token_key,t)}getRefreshToken(){return localStorage.getItem(this.config.refresh_token_key)}setRefreshToken(t){localStorage.setItem(this.config.refresh_token_key,t)}clearTokens(){localStorage.removeItem(this.config.token_key),
|
||
|
|
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
|
||
|
|
and paste the contents of this message in the report.
|
||
|
|
Thank you!
|
||
|
|
Filter Expression:
|
||
|
|
${JSON.stringify(d,null,2)}
|
||
|
|
`)}let m=null,y=null;if(l!=="background"&&l!=="sky"&&l!=="slot"){y=Le[`filter_${l}`];const C=Ql(p,y,e,i);if(C.result==="error")throw new Error(C.value.map(I=>`${I.key}: ${I.message}`).join(", "));m=(I,M,R)=>C.value.evaluate(I,M,{},R)}let b=null,S=null;if(p!==d){const C=Ql(d,y,e,i);if(C.result==="error")throw new Error(C.value.map(I=>`${I.key}: ${I.message}`).join(", "));b=(I,M,R,O,N)=>C.value.evaluate(I,M,{},R,void 0,void 0,O,N),S=!wn(C.value.expression)}return{filter:m,dynamicFilter:b||void 0,needGeometry:jb(p),needFeature:!!S}}function $r(o){if(!Array.isArray(o))return o;const e=function(i){if(M2.has(i[0])){for(let l=1;l<i.length;l++)if(Wd(i[l]))return!0}return i}(o);return e===!0?e:e.map(i=>$r(i))}function Vb(o){let e=!1;const i=[];if(o[0]==="case"){for(let l=1;l<o.length-1;l+=2)e=e||Wd(o[l]),i.push(o[l+1]);i.push(o.at(-1))}else if(o[0]==="match"){e=e||Wd(o[1]);for(let l=2;l<o.length-1;l+=2)i.push(o[l+1]);i.push(o.at(-1))}else if(o[0]==="step"){e=e||Wd(o[1]);for(let l=1;l<o.length-1;l+=2)i.push(o[l+1])}e&&(o.length=0,o.push("any",...i));for(let l=1;l<o.length;l++)Vb(o[l])}function Wd(o){if(!Array.isArray(o))return!1;if((e=o[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<o.length;i++)if(Wd(o[i]))return!0;return!1}const M2=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function P2(o,e){return o<e?-1:o>e?1:0}function jb(o){if(!Array.isArray(o))return!1;if(o[0]==="within"||o[0]==="distance")return!0;for(let e=1;e<o.length;e++)if(jb(o[e]))return!0;return!1}function $m(o){if(!o)return!0;const e=o[0];return o.length<=1?e!=="any":e==="=="?iv(o[1],o[2],"=="):e==="!="?Hm(iv(o[1],o[2],"==")):e==="<"||e===">"||e==="<="||e===">="?iv(o[1],o[2],e):e==="any"?(i=o.slice(1),["any"].concat(i.map($m))):e==="all"?["all"].concat(o.slice(1).map($m)):e==="none"?["all"].concat(o.slice(1).map($m).map(Hm)):e==="in"?Ub(o[1],o.slice(2)):e==="!in"?Hm(Ub(o[1],o.slice(2))):e==="has"?Gb(o[1]):e!=="!has"||Hm(Gb(o[1]));var i}function iv(o,e,i){switch(o){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,o,e]}}function Ub(o,e){if(e.length===0)return!1;switch(o){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",o,["literal",e.sort(P2)]]:["filter-in-small",o,["literal",e]]}}function Gb(o){switch(o){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",o]}}function Hm(o){return["!",o]}const Hf="";function ov(o,e){return e?`${o}${Hf}${e}`:o}function $b(o){const e=o.indexOf(Hf);return e>=0?o.slice(e+1):""}let Hb;const Wb=()=>Hb||(Hb=new fr({"icon-size":new xt(Le.layout_symbol["icon-size"]),"icon-image":new xt(Le.layout_symbol["icon-image"]),"icon-rotate":new xt(Le.layout_symbol["icon-rotate"]),"icon-offset":new xt(Le.layout_symbol["icon-offset"]),"text-size":new xt(Le.layout_symbol["text-size"]),"text-rotate":new xt(Le.layout_symbol["text-rotate"]),"text-offset":new xt(Le.layout_symbol["text-offset"])}));let qb;const Zb=()=>qb||(qb=new fr({"icon-opacity":new xt(Le.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new xt(Le.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new xt(Le.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new xt(Le.paint_symbol["text-emissive-strength"]),"icon-color":new xt(Le.paint_symbol["icon-color"]),"icon-halo-color":new xt(Le.paint_symbol["icon-halo-color"]),"icon-halo-width":new xt(Le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new xt(Le.paint_symbol["icon-halo-blur"]),"icon-translate":new xt(Le.paint_symbol["icon-translate"]),"text-opacity":new xt(Le.paint_symbol["text-opacity"]),"text-occlusion-opacity":new xt(Le.paint_symbol["text-occlusion-opacity"]),"text-color":new xt(Le.paint_symbol["text-color"],{runtimeType:as,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new xt(Le.paint_symbol["text-halo-color"]),"text-halo-width":new xt(Le.paint_symbol["text-halo-width"]),"text-halo-blur":new xt(Le.paint_sym
|
||
|
|
Use an identity property function instead: ${$}.`)]}const j=[];if(u.layerType==="symbol")k!=="text-field"||!f||f.glyphs||f.imports||j.push(new ge(a,w,'use of "text-field" requires a style "glyphs" property')),k==="text-font"&&c.dB(c.c3(w))&&c.fT(w.type)==="identity"&&j.push(new ge(a,w,'"text-font" does not support identity functions'));else if(u.layerType==="model"&&r==="paint"&&_&&_.layout&&Object.hasOwn(_.layout,"model-id")&&c.fC(z)&&(c.fB(z)||c.fD(z))){const $=c.b$(c.c3(w),z).value,W="expression"in $&&$.expression||"_styleExpression"in $&&$._styleExpression&&$._styleExpression.expression;W&&!c.dC(W,["measure-light"])&&(k==="model-emissive-strength"&&c.dy(W)&&c.dP(W)||j.push(new ge(a,w,`${k} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return j.concat(Cr({key:u.key,value:w,valueSpec:z,style:f,styleSpec:x,expressionContext:"property",propertyType:r,propertyKey:k}))}function Cn(u){return Gi(u,"paint")}function ci(u){return Gi(u,"layout")}function Na(u){let r=[];const a=u.value,f=u.key,_=u.style,x=u.styleSpec;if(!c.dN(a))return[new ge(f,a,"object expected")];a.type||a.ref||r.push(new ge(f,a,'either "type" or "ref" is required'));let w=c.fT(a.type);const k=c.fT(a.ref);if(a.id){const A=c.fT(a.id);for(let P=0;P<u.arrayIndex;P++){const D=_.layers[P];c.fT(D.id)===A&&r.push(new ge(f,a.id,`duplicate layer id "${A}", previously used at line ${D.id.__line__}`))}}if("ref"in a){let A;["type","source","source-layer","filter","layout"].forEach(P=>{P in a&&r.push(new ge(f,a[P],`"${P}" is prohibited for ref layers`))}),_.layers.forEach(P=>{c.fT(P.id)===k&&(A=P)}),A?A.ref?r.push(new ge(f,a.ref,"ref cannot reference another ref layer")):w=c.fT(A.type):typeof k=="string"&&r.push(new ge(f,a.ref,`ref layer "${k}" not found`))}else if(w!=="background"&&w!=="sky"&&w!=="slot")if(a.source)if(c.dQ(a.source)){const A=_.sources&&Object.hasOwn(_.sources,a.source)?_.sources[a.source]:void 0,P=A&&c.fT(A.type);A?P==="vector"&&w==="raster"?r.push(new ge(f,a.source,`layer "${a.id}" requires a raster source`)):P==="raster"&&w!=="raster"?r.push(new ge(f,a.source,`layer "${a.id}" requires a vector source`)):P!=="vector"||a["source-layer"]?P==="raster-dem"&&w!=="hillshade"?r.push(new ge(f,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):P!=="raster-array"||["raster","raster-particle"].includes(w)?w==="line"&&a.paint&&a.paint["line-gradient"]&&P==="geojson"&&!A.lineMetrics?r.push(new ge(f,a,`layer "${a.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):w==="line"&&a.paint&&a.paint["line-trim-offset"]&&P==="geojson"&&!A.lineMetrics?r.push(new ge(f,a,`layer "${a.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):w==="raster-particle"&&P!=="raster-array"&&r.push(new ge(f,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new ge(f,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new ge(f,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new ge(f,a.source,`source "${a.source}" not found`))}else r.push(new ge(`${f}.source`,a.source,'"source" must be a string'));else r.push(new ge(f,a,'missing required property "source"'));return r=r.concat(ui({key:f,value:a,valueSpec:x.layer,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Cr({key:`${f}.type`,value:a.type,valueSpec:x.layer.type,style:u.style,styleSpec:u.styleSpec,object:a,objectKey:"type"}),filter:A=>xr(Object.assign({layerType:w},A)),layout:A=>ui({layer:a,key:A.key,value:A.value,valueSpec:{},style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":P=>ci(Object.assign({layerType:w},P))}}),paint:A=>ui({layer:a,key:A.key,value:A.value,valueSpec:{},style:A.style,styleSpec:A.styleSpec,objectElementValidators:{"*":P=>Cn(Object.assign({layerType:w,layer:a},P))}}),appearances(A){const P=st({key:A.key,value:A.value,valueSpec:A.valueSpec,style:A.style,styleSpec:A.styleSpec,arrayElementValidator:F=>function(j){const{key:$,layer:W,layerTy
|
||
|
|
uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}
|
||
|
|
#endif
|
||
|
|
uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,St=`
|
||
|
|
#define EPSILON 0.0000001
|
||
|
|
#define PI 3.141592653589793
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
|
||
|
|
#endif`,_y=`
|
||
|
|
#ifdef DUAL_SOURCE_BLENDING
|
||
|
|
layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
|
||
|
|
#elif defined(FLOAT_RENDER_TARGET)
|
||
|
|
layout(location=0) out highp vec4 glFragColor;
|
||
|
|
#else
|
||
|
|
layout(location=0) out vec4 glFragColor;
|
||
|
|
#endif
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
layout(location=1) out vec4 out_Target1;
|
||
|
|
#endif
|
||
|
|
highp float unpack_depth(highp vec4 rgba_depth)
|
||
|
|
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
|
||
|
|
#endif
|
||
|
|
const float DITHER_THRESHOLDS[16]=float[16](
|
||
|
|
1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0
|
||
|
|
);vec4 applyCutout(vec4 color,float height) {
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
|
||
|
|
#else
|
||
|
|
return color;
|
||
|
|
#endif
|
||
|
|
}float cutoutGroundRoofOpacity(vec4 groundRoof) {
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
float fadeStartX=u_indicator_cutout_params.w;float holeRadius=u_indicator_cutout_params.y;float holeMinOpacity=mix(u_indicator_cutout_params.x,1.0,smoothstep(u_indicator_cutout_params.z,u_indicator_cutout_centers.z,groundRoof.y));float distX=abs(u_indicator_cutout_centers.x-groundRoof.x);float roofOpacity=mix(holeMinOpacity,1.0,smoothstep(fadeStartX,holeRadius,u_indicator_cutout_centers.y-groundRoof.w));float groundOpacity=min(smoothstep(fadeStartX,holeRadius,distX)+holeMinOpacity,1.0);return max(roofOpacity,groundOpacity);
|
||
|
|
#else
|
||
|
|
return 1.0;
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#ifdef DEBUG_WIREFRAME
|
||
|
|
#define HANDLE_WIREFRAME_DEBUG \\
|
||
|
|
glFragColor=vec4(0.7,0.0,0.0,0.7); \\
|
||
|
|
gl_FragDepth=gl_FragCoord.z-0.0001;
|
||
|
|
#else
|
||
|
|
#define HANDLE_WIREFRAME_DEBUG
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}`,yy=`
|
||
|
|
#define EXTENT 8192.0
|
||
|
|
#define RAD_TO_DEG 180.0/PI
|
||
|
|
#define DEG_TO_RAD PI/180.0
|
||
|
|
#define GLOBE_RADIUS EXTENT/PI/2.0
|
||
|
|
float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
|
||
|
|
#ifndef PROJECTED_POS_ON_VIEWPORT
|
||
|
|
float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
|
||
|
|
#else
|
||
|
|
return vec3(0.0);
|
||
|
|
#endif
|
||
|
|
}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
|
||
|
|
#endif
|
||
|
|
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}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 vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)
|
||
|
|
{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}
|
||
|
|
#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer
|
||
|
|
#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib
|
||
|
|
#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib
|
||
|
|
#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib
|
||
|
|
#define DECLARE_MATERIAL_TABLE_INFO
|
||
|
|
#endif`,wf="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Sl=`
|
||
|
|
#define ELEVATION_SCALE 7.0
|
||
|
|
#define ELEVATION_OFFSET 450.0
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
|
||
|
|
mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
|
||
|
|
#else
|
||
|
|
vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
|
||
|
|
#endif
|
||
|
|
#ifdef TERRAIN
|
||
|
|
uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
|
||
|
|
#ifdef TERRAIN_DEM_FLOAT_FORMAT
|
||
|
|
vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
|
||
|
|
#else
|
||
|
|
float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
|
||
|
|
#endif
|
||
|
|
}float prevElevation(vec2 apos) {
|
||
|
|
#ifdef TERRAIN_DEM_FLOAT_FORMAT
|
||
|
|
vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
|
||
|
|
#else
|
||
|
|
float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#ifdef TERRAIN_VERTEX_MORPHING
|
||
|
|
float elevation(vec2 apos) {
|
||
|
|
#ifdef ZERO_EXAGGERATION
|
||
|
|
return 0.0;
|
||
|
|
#endif
|
||
|
|
float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
|
||
|
|
#else
|
||
|
|
float elevation(vec2 apos) {
|
||
|
|
#ifdef ZERO_EXAGGERATION
|
||
|
|
return 0.0;
|
||
|
|
#endif
|
||
|
|
return currentElevation(apos);}
|
||
|
|
#endif
|
||
|
|
vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
|
||
|
|
#else
|
||
|
|
float elevation(vec2 pos) { return 0.0; }
|
||
|
|
#endif
|
||
|
|
#ifdef DEPTH_OCCLUSION
|
||
|
|
uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;
|
||
|
|
#ifdef DEPTH_D24
|
||
|
|
float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}
|
||
|
|
#else
|
||
|
|
highp float unpack_depth_rgba(vec4 rgba_depth)
|
||
|
|
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
|
||
|
|
#endif
|
||
|
|
bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
|
||
|
|
#ifdef CLIP_ZERO_TO_ONE
|
||
|
|
coord.z=-1.0+2.0*coord.z;
|
||
|
|
#endif
|
||
|
|
#ifdef DEPTH_D24
|
||
|
|
float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
|
||
|
|
#else
|
||
|
|
float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
|
||
|
|
#endif
|
||
|
|
return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
|
||
|
|
#ifdef DEPTH_D24
|
||
|
|
highp vec4 depth=vec4(
|
||
|
|
texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r
|
||
|
|
);depth=unpack_depth4(depth);
|
||
|
|
#else
|
||
|
|
highp vec4 depth=vec4(
|
||
|
|
unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))
|
||
|
|
);
|
||
|
|
#endif
|
||
|
|
return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;
|
||
|
|
#ifdef CLIP_ZERO_TO_ONE
|
||
|
|
coord.z=-1.0+2.0*coord.z;
|
||
|
|
#endif
|
||
|
|
int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {
|
||
|
|
#ifdef DEPTH_D24
|
||
|
|
highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
|
||
|
|
#else
|
||
|
|
highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
|
||
|
|
#endif
|
||
|
|
res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;
|
||
|
|
#ifdef CLIP_ZERO_TO_ONE
|
||
|
|
coord.z=-1.0+2.0*coord.z;
|
||
|
|
#endif
|
||
|
|
highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}
|
||
|
|
#else
|
||
|
|
bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
|
||
|
|
#endif`,ym=`#ifdef FOG
|
||
|
|
uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
|
||
|
|
#endif`,Lc=`#ifdef FOG
|
||
|
|
uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
uv.y=1.0-uv.y;
|
||
|
|
#endif
|
||
|
|
highp vec3 ray_dir=mix(
|
||
|
|
mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
|
||
|
|
#endif`,Pd=`
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
|
||
|
|
#endif`,Ru=`#ifdef RASTER_ARRAY
|
||
|
|
uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
|
||
|
|
);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)
|
||
|
|
);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
|
||
|
|
#endif`,Sf=`#ifdef RENDER_SHADOWS
|
||
|
|
uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
|
||
|
|
#endif`,pb=`#ifdef RENDER_SHADOWS
|
||
|
|
precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {
|
||
|
|
#ifdef CLIP_ZERO_TO_ONE
|
||
|
|
highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
|
||
|
|
#else
|
||
|
|
highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
|
||
|
|
#endif
|
||
|
|
return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;
|
||
|
|
#ifdef SHADOWS_SINGLE_CASCADE
|
||
|
|
vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);
|
||
|
|
#else
|
||
|
|
light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);
|
||
|
|
#endif
|
||
|
|
}highp float calculate_shadow_bias(float NDotL) {
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
return 0.5*u_shadow_bias.x;
|
||
|
|
#else
|
||
|
|
return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
|
||
|
|
#endif
|
||
|
|
}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)
|
||
|
|
{highp vec2 biasUV=vec2(
|
||
|
|
pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
|
||
|
|
#endif`;const vy=/#include\s+"([^"]+)"/g,xy=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,by=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,y2=new Set(["ifdef","ifndef","elif","if","defined"]),vm=new Set;Oc(St,vm),Oc(yy,vm),Oc(_y,vm);const Tf={"_prelude_fog.vertex.glsl":ym,"_prelude_terrain.vertex.glsl":Sl,"_prelude_shadow.vertex.glsl":Sf,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer
|
||
|
|
#define MATERIAL_TABLE_DEBUG 0
|
||
|
|
uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
vec4 colorDebug;
|
||
|
|
#endif
|
||
|
|
};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) {
|
||
|
|
if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u;
|
||
|
|
}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else {
|
||
|
|
iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green;
|
||
|
|
#endif
|
||
|
|
uint offset=0u;
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}
|
||
|
|
#endif
|
||
|
|
offset++;
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}
|
||
|
|
#endif
|
||
|
|
offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}
|
||
|
|
#endif
|
||
|
|
uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
if(keepFinding)
|
||
|
|
{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}}
|
||
|
|
#endif
|
||
|
|
offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;
|
||
|
|
#if MATERIAL_TABLE_DEBUG
|
||
|
|
if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}
|
||
|
|
#endif
|
||
|
|
info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)
|
||
|
|
{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);}
|
||
|
|
#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)
|
||
|
|
#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)
|
||
|
|
#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)
|
||
|
|
#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));
|
||
|
|
#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;
|
||
|
|
#endif`,"_prelude_fog.fragment.glsl":Lc,"_prelude_shadow.fragment.glsl":pb,"_prelude_lighting.glsl":Pd,"_prelude_raster_array.glsl":Ru},xm={},wy="precision highp float;",mb="precision mediump float;",Ef=`
|
||
|
|
#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
|
||
|
|
#extension GL_EXT_blend_func_extended : require
|
||
|
|
#endif`,gb={preludeTerrain:wn("",Sl),preludeFog:wn(Lc,ym),preludeShadow:wn(pb,Sf),preludeRasterArray:wn(Ru,""),preludeLighting:wn(Pd,Pd),preludePrecisionQualifiers:wn(mb,wy),prelude:wn(_y,yy),preludeExtensions:wn(Ef,"")},_b=[Ef,mb,St,gb.prelude.fragmentSource].join(`
|
||
|
|
`),Sy=[wy,St,gb.prelude.vertexSource].join(`
|
||
|
|
`);var bm={background:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
in vec4 v_color;
|
||
|
|
#endif
|
||
|
|
void main() {vec4 out_color;
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
vec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
uv.y=1.0-uv.y;
|
||
|
|
#endif
|
||
|
|
float factorTex=min(texture(u_cutout_factor_image,uv).r,1.0);float cutoutFactor=(1.0-u_feature_cutout_params.x)*factorTex;out_color=u_color*(1.0-cutoutFactor);
|
||
|
|
#else
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=v_color;
|
||
|
|
#else
|
||
|
|
out_color=u_color;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color*u_opacity;
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
in ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
uniform mediump vec4 u_color;out vec4 v_color;
|
||
|
|
#endif
|
||
|
|
void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
|
||
|
|
#ifndef FEATURE_CUTOUT
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
}`),backgroundPattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color*u_opacity;
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
}`),circle:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
in vec3 v_data;in 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
|
||
|
|
uniform float u_emissive_strength;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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ?
|
||
|
|
smoothstep(0.0,-antialiased_blur,1.0-extrude_length) :
|
||
|
|
smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
|
||
|
|
antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
|
||
|
|
);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_apply_premultiplied(out_color,v_fog_pos);
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color*(v_visibility*opacity_t);
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#define NUM_VISIBILITY_RINGS 2
|
||
|
|
#define INV_SQRT2 0.70710678
|
||
|
|
#define ELEVATION_BIAS 0.0001
|
||
|
|
#define NUM_SAMPLES_PER_RING 16
|
||
|
|
uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in float a_circle_z_offset;
|
||
|
|
#endif
|
||
|
|
out vec3 v_data;out 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
|
||
|
|
vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
|
||
|
|
#if defined(TERRAIN)
|
||
|
|
return elevation(pos)+ELEVATION_BIAS;
|
||
|
|
#else
|
||
|
|
return 0.0;
|
||
|
|
#endif
|
||
|
|
}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
|
||
|
|
#ifdef PITCH_WITH_MAP
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
|
||
|
|
#else
|
||
|
|
return u_matrix*( world_center+vec4(sample_offset,0,0) );
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
return projected_center+vec4(sample_offset,0,0);
|
||
|
|
#endif
|
||
|
|
}float get_sample_step() {
|
||
|
|
#ifdef PITCH_WITH_MAP
|
||
|
|
return 2.0*PI/float(NUM_SAMPLES_PER_RING);
|
||
|
|
#else
|
||
|
|
return PI/float(NUM_SAMPLES_PER_RING);
|
||
|
|
#endif
|
||
|
|
}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 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
surface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
|
||
|
|
#else
|
||
|
|
surface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
|
||
|
|
#endif
|
||
|
|
vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
|
||
|
|
#ifdef PITCH_WITH_MAP
|
||
|
|
#ifdef SCALE_WITH_MAP
|
||
|
|
view_scale=1.0;
|
||
|
|
#else
|
||
|
|
view_scale=projected_center.w/u_camera_to_center_distance;
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
#ifdef SCALE_WITH_MAP
|
||
|
|
view_scale=u_camera_to_center_distance;
|
||
|
|
#else
|
||
|
|
view_scale=projected_center.w;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
|
||
|
|
#ifdef PITCH_WITH_MAP
|
||
|
|
float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
|
||
|
|
#else
|
||
|
|
occlusion_world_center=world_center;occlusion_projected_center=projected_center;
|
||
|
|
#endif
|
||
|
|
for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
|
||
|
|
#else
|
||
|
|
visibility=1.0;
|
||
|
|
#endif
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
visibility=1.0;
|
||
|
|
#endif
|
||
|
|
v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(world_center.xyz);
|
||
|
|
#endif
|
||
|
|
}`),clippingMask:wn("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
uniform highp float u_intensity;in 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);glFragColor=vec4(val,1.0,1.0,1.0);
|
||
|
|
#ifdef FOG
|
||
|
|
if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#include "_prelude_fog.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
|
||
|
|
#endif
|
||
|
|
out 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() {
|
||
|
|
#pragma mapbox: initialize highp float weight
|
||
|
|
#pragma mapbox: initialize mediump float radius
|
||
|
|
vec2 unscaled_extrude=vec2(mod(vec2(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;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
vec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
|
|
#else
|
||
|
|
pos=vec3(tilePos+extrude,elevation(tilePos));
|
||
|
|
#endif
|
||
|
|
gl_Position=u_matrix*vec4(pos,1);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
}`),heatmapTexture:wn(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(0.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,"in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),collisionBox:wn("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
in ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
|
||
|
|
#endif
|
||
|
|
out float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
#ifndef PROJECTED_POS_ON_VIEWPORT
|
||
|
|
vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
vec4 projectedPoint=u_matrix*vec4(proj_pos,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,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}`),collisionCircle:wn("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
|
||
|
|
mix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));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=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:wn("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
in ivec2 a_pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in ivec4 a_pos_3;
|
||
|
|
#endif
|
||
|
|
out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
gl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);
|
||
|
|
#else
|
||
|
|
gl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);
|
||
|
|
#endif
|
||
|
|
}`),fill:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
in highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
vec4 out_color=color;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
out_color*=(opacity*u_opacity_multiplier);
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color;
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
in ivec2 a_pos;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in float a_road_z_offset;out highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define highp float z_offset
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize highp float z_offset
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
|
||
|
|
#endif
|
||
|
|
float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
v_z_offset=z_offset;
|
||
|
|
#endif
|
||
|
|
}`),fillOutline:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#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);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color*(alpha*opacity*u_opacity_multiplier);
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
in ivec2 a_pos;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in float a_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;
|
||
|
|
#pragma mapbox: define highp vec4 outline_color
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define highp float z_offset
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 outline_color
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize highp float z_offset
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
z_offset+=a_road_z_offset;
|
||
|
|
#endif
|
||
|
|
float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
|
||
|
|
#else
|
||
|
|
v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));
|
||
|
|
#endif
|
||
|
|
}`),fillOutlinePattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
uniform vec2 u_texsize;uniform sampler2D u_image;
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
uniform float u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
uniform highp sampler3D u_lutTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
in highp vec2 v_pos;in highp vec2 v_pos_world;
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define lowp uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
out_color=applyLUT(u_lutTexture,out_color);
|
||
|
|
#endif
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color*(alpha*opacity*u_opacity_multiplier);
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in float a_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
out highp vec2 v_pos;out highp vec2 v_pos_world;
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define lowp uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define lowp float pixel_ratio
|
||
|
|
#pragma mapbox: define highp float z_offset
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: initialize lowp float pixel_ratio
|
||
|
|
#pragma mapbox: initialize highp float z_offset
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
z_offset+=a_road_z_offset;
|
||
|
|
#endif
|
||
|
|
float hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
|
||
|
|
#else
|
||
|
|
v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
}`),fillPattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
uniform vec2 u_texsize;uniform sampler2D u_image;
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
uniform float u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
uniform highp sampler3D u_lutTexture;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define lowp uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
out_color=applyLUT(u_lutTexture,out_color);
|
||
|
|
#endif
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
|
|
#else
|
||
|
|
out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color*(opacity*u_opacity_multiplier);
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in float a_road_z_offset;out highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
out highp vec2 v_pos;
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define lowp uvec4 pattern
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define lowp float pixel_ratio
|
||
|
|
#pragma mapbox: define highp float z_offset
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#pragma mapbox: initialize lowp float pixel_ratio
|
||
|
|
#pragma mapbox: initialize highp float z_offset
|
||
|
|
#ifdef FILL_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
|
||
|
|
#endif
|
||
|
|
float hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
}`),lineBlendComposite:wn(`uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;
|
||
|
|
#define ADDITIVE 1
|
||
|
|
void main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(0.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,"in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),lineBlendReduce:wn("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
in vec4 v_color;in vec4 v_flat;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
|
||
|
|
#endif
|
||
|
|
uniform lowp float u_opacity;
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
in float v_front_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
in vec4 v_ground_roof;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
uniform lowp vec2 u_ao;in vec2 v_ao;
|
||
|
|
#endif
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
|
||
|
|
in vec4 v_roof_color;
|
||
|
|
#endif
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
|
|
in highp vec3 v_normal;
|
||
|
|
#endif
|
||
|
|
uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
|
||
|
|
#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
|
||
|
|
in float v_flood_radius;in float v_has_floodlight;
|
||
|
|
#endif
|
||
|
|
in float v_height;
|
||
|
|
#pragma mapbox: define highp float emissive_strength
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp float emissive_strength
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
|
|
vec3 normal=normalize(v_normal);
|
||
|
|
#endif
|
||
|
|
float z;vec4 color=v_color;
|
||
|
|
#ifdef ZERO_ROOF_RADIUS
|
||
|
|
z=float(normal.z > 0.00001);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
normal=mix(normal,vec3(0.0,0.0,1.0),z);
|
||
|
|
#else
|
||
|
|
color=mix(v_color,v_roof_color,z);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
float h=max(0.0,v_height);float ao_shade=1.0;
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
|
||
|
|
#ifdef ZERO_ROOF_RADIUS
|
||
|
|
concave*=(1.0-z);
|
||
|
|
#endif
|
||
|
|
float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
|
||
|
|
#else
|
||
|
|
color.rgb*=ao_shade;
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
color.rgb*=ao_shade;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
float flood_radiance=0.0;
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
|
||
|
|
#else
|
||
|
|
float shadowed_lighting_factor;
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
|
||
|
|
#else
|
||
|
|
shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
|
||
|
|
#endif
|
||
|
|
color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
color.rgb=apply_lighting(color.rgb,normal);
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}
|
||
|
|
#else
|
||
|
|
color=applyCutout(color,h);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
if (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
|
|
#endif
|
||
|
|
glFragColor=color;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_material_table.vertex.glsl"
|
||
|
|
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;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;
|
||
|
|
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
|
|
in uvec2 a_centroid_pos;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_WALL_MODE
|
||
|
|
in ivec4 a_join_normal_inside;
|
||
|
|
#endif
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
|
||
|
|
#endif
|
||
|
|
#ifdef TERRAIN
|
||
|
|
uniform int u_height_type;uniform int u_base_type;
|
||
|
|
#endif
|
||
|
|
uniform highp float u_vertical_scale;
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
out vec4 v_color;out vec4 v_flat;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
|
||
|
|
#endif
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
|
||
|
|
out vec4 v_roof_color;
|
||
|
|
#endif
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
|
|
out highp vec3 v_normal;
|
||
|
|
#endif
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
uniform lowp vec2 u_ao;out vec2 v_ao;
|
||
|
|
#endif
|
||
|
|
#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
|
||
|
|
out float v_flood_radius;out float v_has_floodlight;
|
||
|
|
#endif
|
||
|
|
out float v_height;
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out vec4 v_ground_roof;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
|
||
|
|
#pragma mapbox: define highp float base
|
||
|
|
#pragma mapbox: define highp float height
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
#pragma mapbox: define highp float flood_light_wall_radius
|
||
|
|
#pragma mapbox: define highp float line_width
|
||
|
|
#pragma mapbox: define highp float emissive_strength
|
||
|
|
void main() {DECLARE_MATERIAL_TABLE_INFO
|
||
|
|
#pragma mapbox: initialize highp float base
|
||
|
|
#pragma mapbox: initialize highp float height
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
#pragma mapbox: initialize highp float flood_light_wall_radius
|
||
|
|
#pragma mapbox: initialize highp float line_width
|
||
|
|
#pragma mapbox: initialize highp float emissive_strength
|
||
|
|
base*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
|
||
|
|
v_normal=normal;
|
||
|
|
#endif
|
||
|
|
base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);
|
||
|
|
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
|
|
centroid_pos=vec2(a_centroid_pos);
|
||
|
|
#endif
|
||
|
|
float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;
|
||
|
|
#else
|
||
|
|
h=t > 0.0 ? height : base;
|
||
|
|
#endif
|
||
|
|
pos=vec3(pos_nx.xy,h);
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
|
|
#endif
|
||
|
|
float cutoff=1.0;vec3 scaled_pos=pos;
|
||
|
|
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
|
|
vec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}
|
||
|
|
#endif
|
||
|
|
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
|
|
vec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
#ifdef CLIP_ZERO_TO_ONE
|
||
|
|
cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
|
||
|
|
#else
|
||
|
|
cutoff=cutoff_opacity(u_cutoff_params,ground.z);
|
||
|
|
#endif
|
||
|
|
if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
|
||
|
|
#endif
|
||
|
|
float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
v_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_WALL_MODE
|
||
|
|
vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;
|
||
|
|
#endif
|
||
|
|
gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos0=pos;vec3 shd_pos1=pos;
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);
|
||
|
|
#endif
|
||
|
|
float NdotL=0.0;float colorvalue=0.0;
|
||
|
|
#ifndef LIGHTING_3D_MODE
|
||
|
|
colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
|
||
|
|
(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
|
||
|
|
#endif
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
|
||
|
|
#endif
|
||
|
|
v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
top_height+=u_height_lift;
|
||
|
|
#endif
|
||
|
|
gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
float is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
|
||
|
|
#endif
|
||
|
|
v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);
|
||
|
|
#else
|
||
|
|
v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
|
||
|
|
#endif
|
||
|
|
#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
|
||
|
|
float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
vec4 pos_ground=u_matrix*vec4(pos.xy,ele,1.0);vec4 pos_roof=u_matrix*vec4(pos.xy,ele+height,1.0);v_ground_roof=vec4(pos_ground.xy/pos_ground.w,pos_roof.xy/pos_roof.w);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
}`),fillExtrusionDepth:wn("void main() {}",`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#include "_prelude_material_table.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
uniform int u_height_type;uniform int u_base_type;
|
||
|
|
#endif
|
||
|
|
in ivec4 a_pos_normal_ed;
|
||
|
|
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
|
|
in uvec2 a_centroid_pos;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_WALL_MODE
|
||
|
|
in ivec4 a_join_normal_inside;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define highp float base
|
||
|
|
#pragma mapbox: define highp float height
|
||
|
|
#pragma mapbox: define highp float line_width
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
void main() {DECLARE_MATERIAL_TABLE_INFO
|
||
|
|
#pragma mapbox: initialize highp float base
|
||
|
|
#pragma mapbox: initialize highp float height
|
||
|
|
#pragma mapbox: initialize highp float line_width
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
base*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
|
||
|
|
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
|
|
centroid_pos=vec2(a_centroid_pos);
|
||
|
|
#endif
|
||
|
|
vec3 pos;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
|
||
|
|
#else
|
||
|
|
pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_WALL_MODE
|
||
|
|
vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;
|
||
|
|
#endif
|
||
|
|
float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}`),fillExtrusionPattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform vec2 u_texsize;uniform sampler2D u_image;
|
||
|
|
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
|
|
uniform float u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
uniform lowp vec2 u_ao;in vec3 v_ao;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
in vec3 v_normal;
|
||
|
|
#endif
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
uniform highp sampler3D u_lutTexture;
|
||
|
|
#endif
|
||
|
|
in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
|
||
|
|
#pragma mapbox: define highp float base
|
||
|
|
#pragma mapbox: define highp float height
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern
|
||
|
|
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define highp float pixel_ratio
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp float base
|
||
|
|
#pragma mapbox: initialize highp float height
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: initialize highp float pixel_ratio
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
out_color=applyLUT(u_lutTexture,out_color);
|
||
|
|
#endif
|
||
|
|
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
|
|
vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
|
||
|
|
#else
|
||
|
|
out_color=out_color*v_lighting;
|
||
|
|
#endif
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out_color=applyCutout(out_color,height);
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_material_table.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in ivec4 a_pos_normal_ed;
|
||
|
|
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
|
|
in uvec2 a_centroid_pos;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_WALL_MODE
|
||
|
|
in ivec4 a_join_normal_inside;
|
||
|
|
#endif
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
|
||
|
|
#endif
|
||
|
|
#ifdef TERRAIN
|
||
|
|
uniform int u_height_type;uniform int u_base_type;
|
||
|
|
#endif
|
||
|
|
out highp vec2 v_pos;out vec4 v_lighting;
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
uniform lowp vec2 u_ao;out vec3 v_ao;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out vec3 v_normal;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define highp float base
|
||
|
|
#pragma mapbox: define highp float height
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern
|
||
|
|
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define highp float pixel_ratio
|
||
|
|
#pragma mapbox: define highp float line_width
|
||
|
|
void main() {DECLARE_MATERIAL_TABLE_INFO
|
||
|
|
#pragma mapbox: initialize highp float base
|
||
|
|
#pragma mapbox: initialize highp float height
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: initialize highp float pixel_ratio
|
||
|
|
#pragma mapbox: initialize highp float line_width
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
|
||
|
|
#if defined(HAS_CENTROID) || defined(TERRAIN)
|
||
|
|
centroid_pos=vec2(a_centroid_pos);
|
||
|
|
#endif
|
||
|
|
float ele=0.0;float h=z;vec3 p;float c_ele;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
|
||
|
|
#else
|
||
|
|
p=vec3(pos_nx.xy,z);
|
||
|
|
#endif
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_WALL_MODE
|
||
|
|
vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;
|
||
|
|
#endif
|
||
|
|
float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
|
||
|
|
? pos_nx.xy
|
||
|
|
: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
NdotL=calculate_NdotL(normal);
|
||
|
|
#else
|
||
|
|
NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
|
||
|
|
#endif
|
||
|
|
if (normal.y !=0.0) {float r=0.84;
|
||
|
|
#ifndef LIGHTING_3D_MODE
|
||
|
|
r=mix(0.7,0.98,1.0-u_lightintensity);
|
||
|
|
#endif
|
||
|
|
NdotL*=(
|
||
|
|
(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
|
||
|
|
#ifdef FAUX_AO
|
||
|
|
float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
|
||
|
|
#endif
|
||
|
|
v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
top_height+=u_height_lift;
|
||
|
|
#endif
|
||
|
|
gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
v_normal=normal;
|
||
|
|
#else
|
||
|
|
v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(p);
|
||
|
|
#endif
|
||
|
|
}`),groundShadow:wn(`#include "_prelude_shadow.fragment.glsl"
|
||
|
|
precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
|
||
|
|
#ifdef FOG
|
||
|
|
in float v_fog_opacity;
|
||
|
|
#endif
|
||
|
|
void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
shadow=mix(shadow,vec3(1.0),v_fog_opacity);
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
shadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y);
|
||
|
|
#endif
|
||
|
|
glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
|
||
|
|
#ifdef FOG
|
||
|
|
out float v_fog_opacity;
|
||
|
|
#endif
|
||
|
|
void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);
|
||
|
|
#endif
|
||
|
|
}`),fillExtrusionGroundEffect:wn(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
|
||
|
|
#ifdef SDF_SUBPASS
|
||
|
|
in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
|
||
|
|
#ifdef FOG
|
||
|
|
in highp float v_fog;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#ifdef CLEAR_SUBPASS
|
||
|
|
vec4 color=vec4(1.0);
|
||
|
|
#ifdef CLEAR_FROM_TEXTURE
|
||
|
|
color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
|
||
|
|
#endif
|
||
|
|
glFragColor=color;
|
||
|
|
#else
|
||
|
|
#ifdef SDF_SUBPASS
|
||
|
|
highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
|
||
|
|
#ifdef FOG
|
||
|
|
fog=v_fog;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
fog*=v_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
|
||
|
|
#else
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
|
||
|
|
#else
|
||
|
|
vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
color=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
glFragColor=color;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;
|
||
|
|
#endif
|
||
|
|
}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
in highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;
|
||
|
|
#ifdef SDF_SUBPASS
|
||
|
|
out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
|
||
|
|
#ifdef FOG
|
||
|
|
out highp float v_fog;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
|
||
|
|
#pragma mapbox: define highp float flood_light_ground_radius
|
||
|
|
const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
|
||
|
|
#pragma mapbox: initialize highp float flood_light_ground_radius
|
||
|
|
vec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
|
||
|
|
#ifdef SDF_SUBPASS
|
||
|
|
v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
float hidden_by_landmark=0.0;
|
||
|
|
#ifdef HAS_CENTROID
|
||
|
|
hidden_by_landmark=float(a_hidden_by_landmark);
|
||
|
|
#endif
|
||
|
|
float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
|
||
|
|
#endif
|
||
|
|
}`),hillshadePrepare:wn(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
|
||
|
|
)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
|
||
|
|
deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 a_texture_pos;out 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=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),hillshade:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));
|
||
|
|
#endif
|
||
|
|
}`),line:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;uniform bool u_emissive_in_shadows;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;in vec2 v_tile_pos;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef VARIABLE_LINE_WIDTH
|
||
|
|
in float stub_side;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_DASH
|
||
|
|
uniform sampler2D u_dash_image;in vec2 v_tex;
|
||
|
|
#endif
|
||
|
|
#ifdef DEBUG_ELEVATION_ID
|
||
|
|
in vec3 v_elevation_id_col;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_GRADIENT
|
||
|
|
uniform sampler2D u_gradient_image;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
in highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
#pragma mapbox: define lowp float floorwidth
|
||
|
|
#pragma mapbox: define mediump uvec4 dash
|
||
|
|
#pragma mapbox: define lowp float blur
|
||
|
|
#pragma mapbox: define lowp float opacity
|
||
|
|
#pragma mapbox: define mediump float side_z_offset
|
||
|
|
#pragma mapbox: define lowp float border_width
|
||
|
|
#pragma mapbox: define lowp vec4 border_color
|
||
|
|
#pragma mapbox: define lowp float emissive_strength
|
||
|
|
float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
#pragma mapbox: initialize lowp float floorwidth
|
||
|
|
#pragma mapbox: initialize mediump uvec4 dash
|
||
|
|
#pragma mapbox: initialize lowp float blur
|
||
|
|
#pragma mapbox: initialize lowp float opacity
|
||
|
|
#pragma mapbox: initialize mediump float side_z_offset
|
||
|
|
#pragma mapbox: initialize lowp float border_width
|
||
|
|
#pragma mapbox: initialize lowp vec4 border_color
|
||
|
|
#pragma mapbox: initialize lowp float emissive_strength
|
||
|
|
float dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;
|
||
|
|
#ifdef RENDER_LINE_BORDER
|
||
|
|
#ifndef VARIABLE_LINE_WIDTH
|
||
|
|
ANTIALIASING*=8.0;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef VARIABLE_LINE_WIDTH
|
||
|
|
blur=mix(blur,0.0,stub_side);
|
||
|
|
#endif
|
||
|
|
float diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);float pxStep;float delta;
|
||
|
|
#ifdef RENDER_LINE_BORDER
|
||
|
|
#ifndef VARIABLE_LINE_WIDTH
|
||
|
|
pxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_DASH
|
||
|
|
float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=ANTIALIASING/(float(dash.z)+float(dash.w)/65535.0);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
|
||
|
|
#endif
|
||
|
|
highp vec4 out_color;
|
||
|
|
#ifdef RENDER_LINE_GRADIENT
|
||
|
|
out_color=texture(u_gradient_image,v_uv.xy);
|
||
|
|
#else
|
||
|
|
out_color=color;
|
||
|
|
#endif
|
||
|
|
float trim_alpha=1.0;
|
||
|
|
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
|
|
highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;
|
||
|
|
#ifdef RENDER_LINE_GRADIENT
|
||
|
|
gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);
|
||
|
|
#endif
|
||
|
|
highp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
|
||
|
|
#endif
|
||
|
|
if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
|
||
|
|
#ifdef RENDER_LINE_BORDER
|
||
|
|
#ifndef VARIABLE_LINE_WIDTH
|
||
|
|
float edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {if (border_color.a==0.0) {
|
||
|
|
#ifndef RENDER_LINE_GRADIENT
|
||
|
|
float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}
|
||
|
|
#else
|
||
|
|
out_color.rgb*=(0.6+0.4*alpha2);
|
||
|
|
#endif
|
||
|
|
} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}out_color*=v_width2_dilute.w;}
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
|
|
#else
|
||
|
|
out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
out_color*=(alpha*diluted_opacity*u_opacity_multiplier);
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out_color=applyCutout(out_color,v_z_offset);
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
#ifdef LINE_BLEND_ADDITIVE
|
||
|
|
{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}
|
||
|
|
#else
|
||
|
|
#ifdef LINE_BLEND_MULTIPLY
|
||
|
|
glFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);
|
||
|
|
#else
|
||
|
|
glFragColor=out_color;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef DUAL_SOURCE_BLENDING
|
||
|
|
glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
|
||
|
|
#else
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
#ifdef DEBUG_ELEVATION_ID
|
||
|
|
glFragColor=vec4(v_elevation_id_col,1.0);
|
||
|
|
#endif
|
||
|
|
if (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#define EXTRUDE_SCALE 0.015873016
|
||
|
|
in ivec2 a_pos_normal;in uvec4 a_data;
|
||
|
|
#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)
|
||
|
|
in vec4 a_z_offset_width;
|
||
|
|
#endif
|
||
|
|
#ifdef DEBUG_ELEVATION_ID
|
||
|
|
in vec3 a_elevation_id_col;
|
||
|
|
#endif
|
||
|
|
#ifdef DEBUG_ELEVATION_ID
|
||
|
|
out vec3 v_elevation_id_col;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATION_GROUND_SCALE
|
||
|
|
in float a_elevation_ground_scale;
|
||
|
|
#endif
|
||
|
|
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
|
||
|
|
in highp vec3 a_packed;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_DASH
|
||
|
|
in float a_linesofar;
|
||
|
|
#endif
|
||
|
|
uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_floor_width_scale;
|
||
|
|
#ifdef RENDER_LINE_CURVE
|
||
|
|
uniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED
|
||
|
|
uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
|
||
|
|
#ifdef ELEVATION_REFERENCE_SEA
|
||
|
|
return 0.0;
|
||
|
|
#else
|
||
|
|
return elevation(apos);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
out vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;out vec2 v_tile_pos;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
out highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef VARIABLE_LINE_WIDTH
|
||
|
|
out float stub_side;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_DASH
|
||
|
|
uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_GRADIENT
|
||
|
|
uniform float u_image_height;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define highp vec4 color
|
||
|
|
#pragma mapbox: define lowp float floorwidth
|
||
|
|
#pragma mapbox: define mediump uvec4 dash
|
||
|
|
#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 mediump float side_z_offset
|
||
|
|
#pragma mapbox: define lowp float border_width
|
||
|
|
#pragma mapbox: define lowp vec4 border_color
|
||
|
|
#pragma mapbox: define lowp float emissive_strength
|
||
|
|
#ifdef RENDER_LINE_CURVE
|
||
|
|
vec3 getCurvePoint(int index) {int row=index/3;int col=index-row*3;float x=u_curve_points_x[row][col];float y=u_curve_points_y[row][col];float z=u_curve_points_z[row][col];return vec3(x,y,z);}vec3 catmullRom(vec3 p0,vec3 p1,vec3 p2,vec3 p3,float t) {float t2=t*t;float t3=t2*t;return 0.5*(
|
||
|
|
2.0*p1+(-p0+p2)*t+(2.0*p0-5.0*p1+4.0*p2-p3)*t2+(-p0+3.0*p1-3.0*p2+p3)*t3
|
||
|
|
);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(
|
||
|
|
(-p0+p2)+(2.0*p0-5.0*p1+4.0*p2-p3)*2.0*t+(-p0+3.0*p1-3.0*p2+p3)*3.0*t2
|
||
|
|
);}struct CurveResult {vec3 point;vec2 tangent;};CurveResult calculateCurve(float line_progress) {float curve_progress=line_progress*(u_curve_point_count-1.0);float curve_progress_local=fract(curve_progress);float curve_segment=floor(curve_progress);int seg=int(curve_segment);vec3 p1=getCurvePoint(seg);vec3 p2=getCurvePoint(seg+1);float is_first_seg=step(curve_segment,0.5);vec3 p0_extrapolated=p1-(p2-p1);vec3 p0_fetched=getCurvePoint(max(seg-1,0));vec3 p0=mix(p0_fetched,p0_extrapolated,is_first_seg);int last_seg=int(u_curve_point_count)-2;float is_last_seg=step(float(last_seg)-0.5,curve_segment);vec3 p3_extrapolated=p2+(p2-p1);vec3 p3_fetched=getCurvePoint(min(seg+2,int(u_curve_point_count)-1));vec3 p3=mix(p3_fetched,p3_extrapolated,is_last_seg);vec3 point=catmullRom(p0,p1,p2,p3,curve_progress_local);vec2 tangent=catmullRomTangent(p0.xy,p1.xy,p2.xy,p3.xy,curve_progress_local)*(u_curve_point_count-1.0);CurveResult result;result.point=point;result.tangent=tangent;return result;}
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 color
|
||
|
|
#pragma mapbox: initialize lowp float floorwidth
|
||
|
|
#pragma mapbox: initialize mediump uvec4 dash
|
||
|
|
#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 mediump float side_z_offset
|
||
|
|
#pragma mapbox: initialize lowp float border_width
|
||
|
|
#pragma mapbox: initialize lowp vec4 border_color
|
||
|
|
#pragma mapbox: initialize lowp float emissive_strength
|
||
|
|
#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH
|
||
|
|
emissive_strength=a_z_offset_width.w;
|
||
|
|
#endif
|
||
|
|
float a_z_offset=u_z_offset;
|
||
|
|
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
|
|
a_z_offset+=a_z_offset_width.x;
|
||
|
|
#endif
|
||
|
|
#ifdef DEBUG_ELEVATION_ID
|
||
|
|
v_elevation_id_col=a_elevation_id_col;
|
||
|
|
#endif
|
||
|
|
highp float line_progress=0.0;
|
||
|
|
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
|
||
|
|
line_progress=a_packed[2];
|
||
|
|
#endif
|
||
|
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;
|
||
|
|
#ifdef RENDER_LINE_BORDER
|
||
|
|
#ifndef VARIABLE_LINE_WIDTH
|
||
|
|
ANTIALIASING*=8.0;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;
|
||
|
|
#ifdef RENDER_LINE_CURVE
|
||
|
|
CurveResult curve=calculateCurve(line_progress);pos=curve.point.xy*8192.0;a_extrude=length(a_extrude)*normalize(curve.tangent);a_extrude=left ? vec2(-a_extrude.y,a_extrude.x) : vec2(a_extrude.y,-a_extrude.x);a_z_offset+=curve.point.z;
|
||
|
|
#endif
|
||
|
|
gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;
|
||
|
|
#ifdef VARIABLE_LINE_WIDTH
|
||
|
|
float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=u_width_scale*(left ? left_width : right_width);if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;symmetric_outset=zero_right_width ? u_width_scale*left_width : halfwidth;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;
|
||
|
|
#else
|
||
|
|
halfwidth=(u_width_scale*width)/2.0;
|
||
|
|
#endif
|
||
|
|
float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
v_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);
|
||
|
|
#else
|
||
|
|
#ifdef ELEVATED
|
||
|
|
vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
|
||
|
|
#ifdef ELEVATION_GROUND_SCALE
|
||
|
|
scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
|
||
|
|
#endif
|
||
|
|
#ifdef CROSS_SLOPE_VERTICAL
|
||
|
|
float top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
|
||
|
|
#else
|
||
|
|
#ifdef CROSS_SLOPE_HORIZONTAL
|
||
|
|
float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;
|
||
|
|
#else
|
||
|
|
float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
v_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
|
||
|
|
#else
|
||
|
|
v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifndef ELEVATED
|
||
|
|
#ifndef VARIABLE_LINE_WIDTH
|
||
|
|
#ifndef RENDER_TO_TEXTURE
|
||
|
|
float base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else
|
||
|
|
{
|
||
|
|
#ifdef RENDER_LINE_BORDER
|
||
|
|
float border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);
|
||
|
|
#endif
|
||
|
|
}}
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
v_tile_pos=(v_tile_pos+extrude)/EXTENT;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
gl_Position=gl_Position+projected_extrude;
|
||
|
|
#else
|
||
|
|
gl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifndef RENDER_TO_TEXTURE
|
||
|
|
float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
|
||
|
|
#else
|
||
|
|
v_gamma_scale=1.0;
|
||
|
|
#endif
|
||
|
|
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
|
||
|
|
highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];
|
||
|
|
#ifdef RENDER_LINE_GRADIENT
|
||
|
|
highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);
|
||
|
|
#else
|
||
|
|
v_uv=vec3(a_uv_x,0.0,line_progress);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_DASH
|
||
|
|
vec4 dashf=vec4(dash);float totalLength=dashf.z+dashf.w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dashf.y+dashf.x+0.5)/u_texsize.y);
|
||
|
|
#endif
|
||
|
|
v_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);
|
||
|
|
#ifdef VARIABLE_LINE_WIDTH
|
||
|
|
v_width2_dilute.x=symmetric_outset;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
v_z_offset=a_z_offset;
|
||
|
|
#endif
|
||
|
|
}`),linePattern:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
uniform highp sampler3D u_lutTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef LINE_PATTERN_TRANSITION
|
||
|
|
uniform float u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
|
||
|
|
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
|
|
in highp vec3 v_uv;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef LINE_JOIN_NONE
|
||
|
|
in vec2 v_pattern_data;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
in highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern
|
||
|
|
#ifdef LINE_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define mediump float pixel_ratio
|
||
|
|
#pragma mapbox: define mediump float blur
|
||
|
|
#pragma mapbox: define mediump float opacity
|
||
|
|
#pragma mapbox: define lowp float emissive_strength
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef LINE_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: initialize mediump float pixel_ratio
|
||
|
|
#pragma mapbox: initialize mediump float blur
|
||
|
|
#pragma mapbox: initialize mediump float opacity
|
||
|
|
#pragma mapbox: initialize lowp float emissive_strength
|
||
|
|
vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
color=applyLUT(u_lutTexture,color);
|
||
|
|
#endif
|
||
|
|
#ifdef LINE_PATTERN_TRANSITION
|
||
|
|
vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
|
|
highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}
|
||
|
|
#endif
|
||
|
|
#ifdef LINE_JOIN_NONE
|
||
|
|
highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
color=apply_lighting_with_emission_ground(color,emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
|
|
#else
|
||
|
|
color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
color*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
color=applyCutout(color,v_z_offset);
|
||
|
|
#endif
|
||
|
|
glFragColor=color;
|
||
|
|
#ifdef DUAL_SOURCE_BLENDING
|
||
|
|
glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
|
||
|
|
#else
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#define scale 0.015873016
|
||
|
|
in ivec2 a_pos_normal;in uvec4 a_data;
|
||
|
|
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
|
|
in vec4 a_z_offset_width;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATION_GROUND_SCALE
|
||
|
|
in float a_elevation_ground_scale;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
|
|
in highp vec3 a_packed;
|
||
|
|
#endif
|
||
|
|
in highp float a_linesofar;
|
||
|
|
#ifdef LINE_JOIN_NONE
|
||
|
|
in highp vec3 a_pattern_data;out vec2 v_pattern_data;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;
|
||
|
|
#ifdef ELEVATED
|
||
|
|
uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
|
||
|
|
#ifdef ELEVATION_REFERENCE_SEA
|
||
|
|
return 0.0;
|
||
|
|
#else
|
||
|
|
return elevation(apos);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
|
||
|
|
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
|
|
out highp vec3 v_uv;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
out highp float v_road_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define mediump float blur
|
||
|
|
#pragma mapbox: define mediump float opacity
|
||
|
|
#pragma mapbox: define mediump float offset
|
||
|
|
#pragma mapbox: define mediump float gapwidth
|
||
|
|
#pragma mapbox: define mediump float width
|
||
|
|
#pragma mapbox: define mediump float floorwidth
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern
|
||
|
|
#ifdef LINE_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: define mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define mediump float pixel_ratio
|
||
|
|
#pragma mapbox: define lowp float emissive_strength
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize mediump float blur
|
||
|
|
#pragma mapbox: initialize mediump float opacity
|
||
|
|
#pragma mapbox: initialize mediump float offset
|
||
|
|
#pragma mapbox: initialize mediump float gapwidth
|
||
|
|
#pragma mapbox: initialize mediump float width
|
||
|
|
#pragma mapbox: initialize mediump float floorwidth
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern
|
||
|
|
#ifdef LINE_PATTERN_TRANSITION
|
||
|
|
#pragma mapbox: initialize mediump uvec4 pattern_b
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: initialize mediump float pixel_ratio
|
||
|
|
#pragma mapbox: initialize lowp float emissive_strength
|
||
|
|
float a_z_offset;
|
||
|
|
#if defined(ELEVATED) || defined(ELEVATED_ROADS)
|
||
|
|
a_z_offset=a_z_offset_width.x;
|
||
|
|
#endif
|
||
|
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
|
||
|
|
#else
|
||
|
|
#ifdef ELEVATED
|
||
|
|
vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
|
||
|
|
#ifdef ELEVATION_GROUND_SCALE
|
||
|
|
scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
|
||
|
|
#endif
|
||
|
|
#ifdef CROSS_SLOPE_VERTICAL
|
||
|
|
float top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
|
||
|
|
#else
|
||
|
|
#ifdef CROSS_SLOPE_HORIZONTAL
|
||
|
|
float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;
|
||
|
|
#else
|
||
|
|
float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
|
||
|
|
#else
|
||
|
|
gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifndef RENDER_TO_TEXTURE
|
||
|
|
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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
|
||
|
|
#else
|
||
|
|
v_gamma_scale=1.0;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_LINE_TRIM_OFFSET
|
||
|
|
highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
|
||
|
|
#endif
|
||
|
|
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
|
||
|
|
#ifdef LINE_JOIN_NONE
|
||
|
|
v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(pos);
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
v_z_offset=a_z_offset;
|
||
|
|
#endif
|
||
|
|
}`),raster:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_raster_array.glsl"
|
||
|
|
uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in float v_split_fade;
|
||
|
|
#endif
|
||
|
|
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;uniform float u_emissive_strength;
|
||
|
|
#ifndef RASTER_ARRAY
|
||
|
|
uniform highp sampler2D u_image0;uniform sampler2D u_image1;
|
||
|
|
#endif
|
||
|
|
#ifdef RASTER_COLOR
|
||
|
|
uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
|
||
|
|
#endif
|
||
|
|
void main() {vec4 color0,color1,color;vec2 value;
|
||
|
|
#ifdef RASTER_COLOR
|
||
|
|
#ifdef RASTER_ARRAY
|
||
|
|
#ifdef RASTER_ARRAY_LINEAR
|
||
|
|
value=mix(
|
||
|
|
raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
|
||
|
|
);
|
||
|
|
#else
|
||
|
|
value=mix(
|
||
|
|
raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
|
||
|
|
);
|
||
|
|
#endif
|
||
|
|
if (value.y > 0.0) value.x/=value.y;
|
||
|
|
#else
|
||
|
|
color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
|
||
|
|
#endif
|
||
|
|
color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
|
||
|
|
#else
|
||
|
|
color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
|
||
|
|
#endif
|
||
|
|
color.a*=u_opacity;
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
|
||
|
|
#endif
|
||
|
|
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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
|
||
|
|
#endif
|
||
|
|
glFragColor=vec4(out_color*color.a,color.a);
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
#ifdef USE_MRT1
|
||
|
|
out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
|
||
|
|
#ifdef ELEVATED
|
||
|
|
uniform lowp float u_zbias_factor;
|
||
|
|
#endif
|
||
|
|
#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
in vec3 a_globe_pos;in vec2 a_uv;
|
||
|
|
#else
|
||
|
|
in ivec2 a_pos;in uvec2 a_texture_pos;
|
||
|
|
#endif
|
||
|
|
out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
out float v_split_fade;
|
||
|
|
#endif
|
||
|
|
void main() {vec2 uv;
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
vec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;
|
||
|
|
#ifdef ELEVATION_REFERENCE_GROUND
|
||
|
|
ele+=elevation(uv*EXTENT);
|
||
|
|
#endif
|
||
|
|
globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
vec4 world_pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
vec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);
|
||
|
|
float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation;
|
||
|
|
#ifdef ELEVATION_REFERENCE_GROUND
|
||
|
|
ele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;
|
||
|
|
#endif
|
||
|
|
vec4 merc_world_pos=vec4(0.0);
|
||
|
|
v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
float ele=0.0;vec2 decodedPos=vec2(a_pos);
|
||
|
|
#ifdef ELEVATION_REFERENCE_GROUND
|
||
|
|
vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;
|
||
|
|
#else
|
||
|
|
uv=vec2(a_texture_pos)/8192.0;
|
||
|
|
#endif
|
||
|
|
world_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(decodedPos);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
float w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;
|
||
|
|
#endif
|
||
|
|
v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
|
||
|
|
#ifdef ELEVATED
|
||
|
|
float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
v_depth=gl_Position.z;
|
||
|
|
#endif
|
||
|
|
}`),symbol:wn(`#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
#define SDF_PX 8.0
|
||
|
|
#define SDF 1.0
|
||
|
|
#define ICON 0.0
|
||
|
|
uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;
|
||
|
|
#ifdef ICON_TRANSITION
|
||
|
|
uniform float u_icon_transition;
|
||
|
|
#endif
|
||
|
|
#ifdef COLOR_ADJUSTMENT
|
||
|
|
uniform mat4 u_color_adj_mat;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
in highp float v_z_offset;
|
||
|
|
#else
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
in highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
in vec2 v_tex_a;
|
||
|
|
#ifdef ICON_TRANSITION
|
||
|
|
in vec2 v_tex_b;
|
||
|
|
#endif
|
||
|
|
in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
|
||
|
|
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
|
|
in float is_sdf;in vec2 v_tex_a_icon;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
uniform highp sampler3D u_lutTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
|
|
in lowp float v_opacity;
|
||
|
|
#ifdef RENDER_SDF
|
||
|
|
in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
in lowp float v_emissive_strength;
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
#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
|
||
|
|
#pragma mapbox: define lowp float emissive_strength
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
|
|
lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;
|
||
|
|
#ifdef RENDER_SDF
|
||
|
|
fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;
|
||
|
|
#endif
|
||
|
|
lowp float emissive_strength=0.0;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
emissive_strength=v_emissive_strength;
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
#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
|
||
|
|
#pragma mapbox: initialize lowp float emissive_strength
|
||
|
|
#endif
|
||
|
|
vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
|
||
|
|
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
|
|
if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
return;}
|
||
|
|
#endif
|
||
|
|
vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SDF
|
||
|
|
float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;
|
||
|
|
#else
|
||
|
|
#ifdef ICON_TRANSITION
|
||
|
|
vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);
|
||
|
|
#else
|
||
|
|
out_color=texture(u_texture,v_tex_a);
|
||
|
|
#endif
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
out_color=applyLUT(u_lutTexture,out_color);
|
||
|
|
#endif
|
||
|
|
#ifdef COLOR_ADJUSTMENT
|
||
|
|
out_color=u_color_adj_mat*out_color;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
out_color*=opacity*fade_opacity*u_opacity_multiplier;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
|
||
|
|
#ifdef TERRAIN
|
||
|
|
out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
|
||
|
|
#else
|
||
|
|
out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out_color=applyCutout(out_color,v_z_offset);
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
glFragColor=out_color;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
#define USING_APPEARANCE 1.0
|
||
|
|
in ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;
|
||
|
|
#ifdef Z_OFFSET
|
||
|
|
in float a_auto_z_offset;
|
||
|
|
#endif
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
in ivec4 a_globe_anchor;in vec3 a_globe_normal;
|
||
|
|
#endif
|
||
|
|
#ifdef ICON_TRANSITION
|
||
|
|
in uvec2 a_texb;
|
||
|
|
#endif
|
||
|
|
#ifdef OCCLUSION_QUERIES
|
||
|
|
in float a_occlusion_query_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out highp float v_z_offset;
|
||
|
|
#else
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
out highp float v_z_offset;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
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_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
|
||
|
|
#endif
|
||
|
|
out vec2 v_tex_a;
|
||
|
|
#ifdef ICON_TRANSITION
|
||
|
|
out vec2 v_tex_b;
|
||
|
|
#endif
|
||
|
|
out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
|
||
|
|
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
|
|
out float is_sdf;out vec2 v_tex_a_icon;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
|
|
#ifndef MAX_UBO_SIZE_VEC4
|
||
|
|
#define MAX_UBO_SIZE_VEC4 1024u
|
||
|
|
#endif
|
||
|
|
#define SPP_HEADER_SIZE_VEC4 3u
|
||
|
|
#define DWORDS_PER_VEC4 4u
|
||
|
|
struct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;float zoomFactor;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_fill_color_zoom_factor;uniform highp float u_spp_halo_color_zoom_factor;uniform highp float u_spp_opacity_zoom_factor;uniform highp float u_spp_halo_width_zoom_factor;uniform highp float u_spp_halo_blur_zoom_factor;uniform highp float u_spp_emissive_strength_zoom_factor;uniform highp float u_spp_occlusion_opacity_zoom_factor;uniform highp float u_spp_z_offset_zoom_factor;uniform highp float u_spp_translate_zoom_factor;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;
|
||
|
|
#ifdef RENDER_SDF
|
||
|
|
out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out lowp float v_emissive_strength;
|
||
|
|
#endif
|
||
|
|
PropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint offsetDwords,float zoomFactor) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;type.zoomFactor=zoomFactor;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask =u_spp_header.header[0][0];uint zoomDependentMask =u_spp_header.header[0][1];header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color =getPropertyType(0u,dataDrivenMask,zoomDependentMask,u_spp_header.header[0][3],u_spp_fill_color_zoom_factor);header.halo_np_color =getPropertyType(1u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][0],u_spp_halo_color_zoom_factor);header.opacity =getPropertyType(2u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][1],u_spp_opacity_zoom_factor);header.halo_width =getPropertyType(3u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][2],u_spp_halo_width_zoom_factor);header.halo_blur =getPropertyType(4u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][3],u_spp_halo_blur_zoom_factor);header.emissive_strength=getPropertyType(5u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][0],u_spp_emissive_strength_zoom_factor);header.occlusion_opacity=getPropertyType(6u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][1],u_spp_occlusion_opacity_zoom_factor);header.z_offset =getPropertyType(7u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][2],u_spp_z_offset_zoom_factor);header.translate =getPropertyType(8u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][3],u_spp_translate_zoom_factor);return header;}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :
|
||
|
|
(index==1u) ? v.y :
|
||
|
|
(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :
|
||
|
|
(index==1u) ? v.y :
|
||
|
|
(index==2u) ? v.z : v.w;}vec4 readVec4(uint baseOffsetVec4,uint propertyOffsetDwords) {return u_spp_properties.properties[baseOffsetVec4+propertyOffsetDwords/DWORDS_PER_VEC4];}float readFloat(vec4 slot,uint propertyOffsetDwords) {return slot[propertyOffsetDwords % DWORDS_PER_VEC4];}uint readUint(uvec4 slot,uint offset) {return slot[offset % DWORDS_PER_VEC4];}vec2 readVec2(vec4 slot,uint propertyOffsetDwords) {float x=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);float y=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4+1u);return vec2(x,y);}uint getDataDrivenBlockOffsetVec4(uint dataDrivenBlockSizeVec4) {uint featureIndex=uint(a_feature_index);uvec4 slot=u_spp_index.block_indices[featureIndex/DWORDS_PER_VEC4];uint blockIndex=uvec4At(slot,featureIndex % DWORDS_PER_VEC4);return blockIndex*dataDrivenBlockSizeVec4;}vec4 readColorProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 color=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {color=unpack_mix_color(color,propertyType.zoomFactor);} else {vec2 packedColor=readVec2(color,propertyType.offsetDwords);color=decode_color(packedColor);}return color;}vec2 readVec2Property(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {return mix(slot.xy,slot.zw,propertyType.zoomFactor);}return readVec2(slot,propertyType.offsetDwords);}float readFloatProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);float value;if (propertyType.isZoomDependent) {vec2 packedValues=readVec2(slot,propertyType.offsetDwords);value=unpack_mix_vec2(packedValues,propertyType.zoomFactor);} else {value=readFloat(slot,propertyType.offsetDwords);}return value;}SymbolPaintProperties readSymbolPaintProperties() {SymbolPropertyHeader header=readSymbolPropertiesHeader();uint sizeVec4=header.dataDrivenBlockSizeVec4;SymbolPaintProperties props;props.fill_np_color =header.fill_np_color.isDataDriven ? readColorProperty(header.fill_np_color,sizeVec4) : u_spp_fill_np_color;props.halo_np_color =header.halo_np_color.isDataDriven ? readColorProperty(header.halo_np_color,sizeVec4) : u_spp_halo_np_color;props.opacity =header.opacity.isDataDriven ? readFloatProperty(header.opacity,sizeVec4) : u_spp_opacity;props.halo_width =header.halo_width.isDataDriven ? readFloatProperty(header.halo_width,sizeVec4) : u_spp_halo_width;props.halo_blur =header.halo_blur.isDataDriven ? readFloatProperty(header.halo_blur,sizeVec4) : u_spp_halo_blur;props.emissive_strength =header.emissive_strength.isDataDriven ? readFloatProperty(header.emissive_strength,sizeVec4) : u_spp_emissive_strength;props.occlusion_opacity =header.occlusion_opacity.isDataDriven ? readFloatProperty(header.occlusion_opacity,sizeVec4) : u_spp_occlusion_opacity;props.z_offset =header.z_offset.isDataDriven ? readFloatProperty(header.z_offset,sizeVec4) : u_spp_z_offset;props.translate =header.translate.isDataDriven ? readVec2Property(header.translate,sizeVec4) : vec2(0.0);return props;}
|
||
|
|
#else
|
||
|
|
#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
|
||
|
|
#pragma mapbox: define lowp float emissive_strength
|
||
|
|
#pragma mapbox: define lowp float occlusion_opacity
|
||
|
|
#pragma mapbox: define highp float z_offset
|
||
|
|
#endif
|
||
|
|
vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {
|
||
|
|
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
|
|
SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;
|
||
|
|
#ifdef RENDER_SDF
|
||
|
|
v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
v_emissive_strength=paint_properties.emissive_strength;
|
||
|
|
#endif
|
||
|
|
lowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;
|
||
|
|
#else
|
||
|
|
#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
|
||
|
|
#pragma mapbox: initialize lowp float emissive_strength
|
||
|
|
#pragma mapbox: initialize lowp float occlusion_opacity
|
||
|
|
#pragma mapbox: initialize highp float z_offset
|
||
|
|
#endif
|
||
|
|
vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,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 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);
|
||
|
|
#ifdef Z_OFFSET
|
||
|
|
e+=a_auto_z_offset;
|
||
|
|
#endif
|
||
|
|
vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
|
||
|
|
#else
|
||
|
|
world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
|
||
|
|
#endif
|
||
|
|
vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;
|
||
|
|
#else
|
||
|
|
offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
|
||
|
|
#endif
|
||
|
|
vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
#ifdef PROJECTED_POS_ON_VIEWPORT
|
||
|
|
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
|
||
|
|
#else
|
||
|
|
vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
|
||
|
|
#endif
|
||
|
|
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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
|
||
|
|
#ifdef TERRAIN
|
||
|
|
#ifdef PITCH_WITH_MAP_TERRAIN
|
||
|
|
vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef Z_OFFSET
|
||
|
|
z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
|
||
|
|
#else
|
||
|
|
z+=u_pitch_with_map ? z_offset : 0.0;
|
||
|
|
#endif
|
||
|
|
float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));
|
||
|
|
#ifdef DEPTH_OCCLUSION
|
||
|
|
float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
|
||
|
|
#endif
|
||
|
|
#ifdef OCCLUSION_QUERIES
|
||
|
|
float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
|
||
|
|
#endif
|
||
|
|
#ifdef Z_TEST_OCCLUSION
|
||
|
|
out_fade_opacity*=occlusion_opacity;
|
||
|
|
#endif
|
||
|
|
float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
|
||
|
|
#else
|
||
|
|
#ifdef ELEVATED_ROADS
|
||
|
|
vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
|
||
|
|
#else
|
||
|
|
pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);
|
||
|
|
#ifdef USE_PAINT_PROPERTIES_UBO
|
||
|
|
{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(
|
||
|
|
u_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y
|
||
|
|
);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}
|
||
|
|
#endif
|
||
|
|
float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;
|
||
|
|
#ifdef RENDER_TEXT_AND_SYMBOL
|
||
|
|
is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
|
||
|
|
#endif
|
||
|
|
#ifdef ICON_TRANSITION
|
||
|
|
v_tex_b=vec2(a_texb)/u_texsize;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
v_z_offset=e;
|
||
|
|
#else
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
v_z_offset=e;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
}`),terrainRaster:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform sampler2D u_image0;
|
||
|
|
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
|
|
uniform sampler2D u_image1;uniform float u_emissive_texture_available;
|
||
|
|
#endif
|
||
|
|
in vec2 v_pos0;
|
||
|
|
#ifdef FOG
|
||
|
|
in float v_fog_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
|
||
|
|
#endif
|
||
|
|
uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
const vec3 normal=vec3(0.0,0.0,1.0);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float cutoffOpacity=1.0;
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
|
|
float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
|
||
|
|
#else
|
||
|
|
float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
|
||
|
|
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
|
|
float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
color=image_color;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
#ifdef ZERO_EXAGGERATION
|
||
|
|
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
|
||
|
|
#else
|
||
|
|
color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
glFragColor=color;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;
|
||
|
|
#ifdef FOG
|
||
|
|
out float v_fog_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
|
||
|
|
#endif
|
||
|
|
void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
|
||
|
|
#ifdef FOG
|
||
|
|
#ifdef ZERO_EXAGGERATION
|
||
|
|
v_fog_pos=fog_position(decodedPos);
|
||
|
|
#else
|
||
|
|
v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
|
||
|
|
#endif
|
||
|
|
}`),terrainDepth:wn("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
|
||
|
|
cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
|
||
|
|
#ifdef FOG
|
||
|
|
sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
|
||
|
|
#endif
|
||
|
|
sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
}`,wf),skyboxGradient:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
|
||
|
|
#ifdef FOG
|
||
|
|
color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
|
||
|
|
#endif
|
||
|
|
color*=u_opacity;glFragColor=color;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
}`,wf),skyboxCapture:wn(`
|
||
|
|
in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
|
||
|
|
#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)
|
||
|
|
#define BETA_M vec3(21e-6,21e-6,21e-6)
|
||
|
|
#define MIE_G 0.76
|
||
|
|
#define DENSITY_HEIGHT_SCALE_R 8000.0
|
||
|
|
#define DENSITY_HEIGHT_SCALE_M 1200.0
|
||
|
|
#define PLANET_RADIUS 6360e3
|
||
|
|
#define ATMOSPHERE_RADIUS 6420e3
|
||
|
|
#define SAMPLE_STEPS 10
|
||
|
|
#define DENSITY_STEPS 4
|
||
|
|
float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform sampler2D u_image0;
|
||
|
|
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
|
|
uniform sampler2D u_image1;uniform float u_emissive_texture_available;
|
||
|
|
#endif
|
||
|
|
uniform float u_far_z_cutoff;in vec2 v_pos0;
|
||
|
|
#ifndef FOG
|
||
|
|
uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
|
||
|
|
#endif
|
||
|
|
void main() {vec4 color;
|
||
|
|
#ifdef CUSTOM_ANTIALIASING
|
||
|
|
highp vec2 uv=gl_FragCoord.xy/u_viewport;
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
uv.y=1.0-uv.y;
|
||
|
|
#endif
|
||
|
|
highp vec3 ray_dir=mix(
|
||
|
|
mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
|
|
float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);
|
||
|
|
#else
|
||
|
|
raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
color=vec4(raster.rgb*antialias,raster.a*antialias);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
color=texture(u_image0,v_pos0);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
|
||
|
|
float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;
|
||
|
|
#else
|
||
|
|
color=apply_lighting_ground(color);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
|
||
|
|
#endif
|
||
|
|
color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_terrain.vertex.glsl"
|
||
|
|
uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
in vec3 a_globe_pos;in vec2 a_uv;
|
||
|
|
#else
|
||
|
|
in ivec2 a_pos;
|
||
|
|
#endif
|
||
|
|
out vec2 v_pos0;void main() {
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
|
||
|
|
#else
|
||
|
|
float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
|
||
|
|
#endif
|
||
|
|
v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
vec3 up_vector=globe_derived_up_vector;
|
||
|
|
#else
|
||
|
|
vec3 up_vector=elevationVector(tile_pos);
|
||
|
|
#endif
|
||
|
|
float height=elevation(tile_pos);globe_pos+=up_vector*height;
|
||
|
|
#ifndef GLOBE_POLES
|
||
|
|
globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
|
||
|
|
#endif
|
||
|
|
#ifdef GLOBE_POLES
|
||
|
|
vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
|
||
|
|
#else
|
||
|
|
vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
|
||
|
|
#endif
|
||
|
|
gl_Position=u_proj_matrix*interpolated_pos;
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
|
||
|
|
#endif
|
||
|
|
}`),globeAtmosphere:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
|
||
|
|
#ifdef ALPHA_PASS
|
||
|
|
glFragColor=vec4(0,0,0,0);return;
|
||
|
|
#else
|
||
|
|
#ifdef NATIVE
|
||
|
|
glFragColor=vec4(1,1,1,1);
|
||
|
|
#else
|
||
|
|
glFragColor=vec4(0,0,0,1);
|
||
|
|
#endif
|
||
|
|
return;
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
|
||
|
|
0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
|
||
|
|
PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
|
||
|
|
#else
|
||
|
|
horizon_angle=horizon_angle_mercator;
|
||
|
|
#endif
|
||
|
|
horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;
|
||
|
|
#ifdef ALPHA_PASS
|
||
|
|
float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
|
||
|
|
#else
|
||
|
|
vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);
|
||
|
|
#endif
|
||
|
|
}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
|
||
|
|
mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
|
||
|
|
mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),stars:wn(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
|
||
|
|
{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
|
||
|
|
in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),occlusion:wn("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
|
||
|
|
in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;
|
||
|
|
#ifdef TERRAIN
|
||
|
|
float e=elevation(world_pos.xy);world_pos.z+=e;
|
||
|
|
#endif
|
||
|
|
vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Oc(u,r){const a=u.split(`
|
||
|
|
`);for(let f of a){if(f=f.trimStart(),f[0]!=="#"||!f.includes("if")||f.startsWith("#endif"))continue;const _=f.match(by);if(_)for(const x of _)y2.has(x)||r.add(x)}}function Fc(u){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(u)}function wn(u,r){const a=new Set,f=[],_=[];u=u.replace(vy,(w,k)=>(_.push(k),"")),r=r.replace(vy,(w,k)=>(f.push(k),""));let x=new Set(vm);Oc(u,x),Oc(r,x);for(const w of[...f,..._])xm[w]||(xm[w]=new Set,Oc(Tf[w],xm[w])),x=new Set([...x,...xm[w]]);return{fragmentSource:u=u.replace(xy,(w,k,A,P,D)=>(a.add(D),k==="define"?`
|
||
|
|
#ifndef HAS_UNIFORM_u_${D}
|
||
|
|
${Fc(P)?"flat ":""}in ${A} ${P} ${D};
|
||
|
|
#else
|
||
|
|
uniform ${A} ${P} u_${D};
|
||
|
|
#endif
|
||
|
|
`:k==="initialize"?`
|
||
|
|
#ifdef HAS_UNIFORM_u_${D}
|
||
|
|
${A} ${P} ${D} = u_${D};
|
||
|
|
#endif
|
||
|
|
`:k==="define-attribute"?`
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
|
|
in ${A} ${P} ${D};
|
||
|
|
#endif
|
||
|
|
`:k==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(xy,(w,k,A,P,D)=>{const z=`MATERIAL_ATTRIBUTE_OFFSET_${D}`,F=P==="float"?"vec2":P,j=`GET_ATTRIBUTE_${F}(a_${D}, materialInfo, ${z})`,$=D.includes("color")?"color":F;return k==="define-attribute-vertex-shader-only"?`
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
|
|
in ${A} ${P} a_${D};
|
||
|
|
#endif
|
||
|
|
`:a.has(D)?k==="define"?`
|
||
|
|
#ifndef HAS_UNIFORM_u_${D}
|
||
|
|
uniform lowp float u_${D}_t;
|
||
|
|
#if !defined(${z})
|
||
|
|
in ${A} ${F} a_${D};
|
||
|
|
#endif
|
||
|
|
${Fc(P)?"flat ":""}out ${A} ${P} ${D};
|
||
|
|
#else
|
||
|
|
uniform ${A} ${P} u_${D};
|
||
|
|
#endif
|
||
|
|
`:k==="initialize"?$==="vec4"||$==="uvec4"?`
|
||
|
|
#ifndef HAS_UNIFORM_u_${D}
|
||
|
|
${D} = a_${D};
|
||
|
|
#else
|
||
|
|
${A} ${P} ${D} = u_${D};
|
||
|
|
#endif
|
||
|
|
`:`
|
||
|
|
#if !defined(HAS_UNIFORM_u_${D})
|
||
|
|
#ifdef ${z}
|
||
|
|
${D} = unpack_mix_${$}(${j}, u_${D}_t);
|
||
|
|
#else
|
||
|
|
${D} = unpack_mix_${$}(a_${D}, u_${D}_t);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
${A} ${P} ${D} = u_${D};
|
||
|
|
#endif
|
||
|
|
`:k==="define-attribute"?`
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
|
|
in ${A} ${P} a_${D};
|
||
|
|
out ${A} ${P} ${D};
|
||
|
|
#endif
|
||
|
|
`:k==="initialize-attribute"?`
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
|
|
${D} = a_${D};
|
||
|
|
#endif
|
||
|
|
`:void 0:k==="define"?`
|
||
|
|
#ifndef HAS_UNIFORM_u_${D}
|
||
|
|
uniform lowp float u_${D}_t;
|
||
|
|
#if !defined(${z})
|
||
|
|
in ${A} ${F} a_${D};
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
uniform ${A} ${P} u_${D};
|
||
|
|
#endif
|
||
|
|
`:k==="define-instanced"?$==="mat4"?`
|
||
|
|
#ifdef INSTANCED_ARRAYS
|
||
|
|
in vec4 a_${D}0;
|
||
|
|
in vec4 a_${D}1;
|
||
|
|
in vec4 a_${D}2;
|
||
|
|
in vec4 a_${D}3;
|
||
|
|
#else
|
||
|
|
uniform ${A} ${P} u_${D};
|
||
|
|
#endif
|
||
|
|
`:`
|
||
|
|
#ifdef INSTANCED_ARRAYS
|
||
|
|
in ${A} ${F} a_${D};
|
||
|
|
#else
|
||
|
|
uniform ${A} ${P} u_${D};
|
||
|
|
#endif
|
||
|
|
`:k==="initialize-attribute-custom"?`
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_${D}
|
||
|
|
${A} ${P} ${D} = a_${D};
|
||
|
|
#endif
|
||
|
|
`:$==="vec4"||$==="uvec4"?`
|
||
|
|
#ifndef HAS_UNIFORM_u_${D}
|
||
|
|
#ifdef ${z}
|
||
|
|
${A} ${P} ${D} = ${j};
|
||
|
|
#else
|
||
|
|
${A} ${P} ${D} = a_${D};
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
${A} ${P} ${D} = u_${D};
|
||
|
|
#endif
|
||
|
|
`:`
|
||
|
|
#ifndef HAS_UNIFORM_u_${D}
|
||
|
|
#ifdef ${z}
|
||
|
|
${A} ${P} ${D} = unpack_mix_${$}(${j}, u_${D}_t);
|
||
|
|
#else
|
||
|
|
${A} ${P} ${D} = unpack_mix_${$}(a_${D}, u_${D}_t);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
${A} ${P} ${D} = u_${D};
|
||
|
|
#endif
|
||
|
|
`}),usedDefines:x,vertexIncludes:f,fragmentIncludes:_}}Tf["_prelude_raster_particle.glsl"]||(Tf["_prelude_raster_particle.glsl"]=bf);var Dd={building:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
in float v_front_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
in vec4 v_ground_roof;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
|
||
|
|
#endif
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
in highp float v_flood_radius;in float v_has_flood_light;
|
||
|
|
#endif
|
||
|
|
uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
highp float hash12(in highp vec2 p) {highp vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
|
||
|
|
#if 0
|
||
|
|
if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;
|
||
|
|
#else
|
||
|
|
if (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;
|
||
|
|
#endif
|
||
|
|
return out_color;}
|
||
|
|
#endif
|
||
|
|
vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
if (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
|
||
|
|
#endif
|
||
|
|
vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
|
||
|
|
#else
|
||
|
|
shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
shadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));
|
||
|
|
#endif
|
||
|
|
color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);
|
||
|
|
#endif
|
||
|
|
color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
|
||
|
|
#ifdef FOG
|
||
|
|
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
|
||
|
|
#endif
|
||
|
|
color*=u_opacity;
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}
|
||
|
|
#else
|
||
|
|
color=applyCutout(color,v_pos.z);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
if (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
|
|
#endif
|
||
|
|
glFragColor=color;
|
||
|
|
#ifdef DEBUG_SHOW_NORMALS
|
||
|
|
color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
|
||
|
|
#endif
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
in vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
in int a_flood_light_wall_radius_1i16;
|
||
|
|
#endif
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
in uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;
|
||
|
|
#endif
|
||
|
|
uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out vec4 v_ground_roof;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
|
||
|
|
#endif
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
out highp float v_flood_radius;out float v_has_flood_light;
|
||
|
|
#endif
|
||
|
|
const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
|
||
|
|
#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
|
||
|
|
#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive
|
||
|
|
#ifdef FLOOD_LIGHT
|
||
|
|
v_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);
|
||
|
|
#endif
|
||
|
|
vec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(a_normal_3)/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3);
|
||
|
|
#ifdef BUILDING_FAUX_FACADE
|
||
|
|
vec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(vec2(a_faux_facade_vertical_range)/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;}
|
||
|
|
#endif
|
||
|
|
v_pos=a_pos_3f;
|
||
|
|
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
|
|
float halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;
|
||
|
|
#endif
|
||
|
|
#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
|
||
|
|
vec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shadow_pos=v_pos;
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(v_pos);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_FRONT_CUTOFF
|
||
|
|
v_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}
|
||
|
|
#endif
|
||
|
|
gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
vec4 ic_ground=u_matrix*vec4(v_pos.xy,0.0,1.0);vec4 ic_roof=u_matrix*vec4(v_pos.xy,v_pos.z,1.0);v_ground_roof=vec4(ic_ground.xy/ic_ground.w,ic_roof.xy/ic_roof.w);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
}`),buildingBloom:wn(`in vec4 v_color_emissive;
|
||
|
|
#pragma mapbox: define-attribute highp vec4 bloom_attenuation
|
||
|
|
#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
|
||
|
|
float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
|
||
|
|
float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
opacity*=v_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
|
||
|
|
#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
|
||
|
|
#pragma mapbox: define-attribute highp vec4 bloom_attenuation
|
||
|
|
out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
|
||
|
|
#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
|
||
|
|
#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_part_color_emissive
|
||
|
|
vec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
|
||
|
|
#else
|
||
|
|
v_color_emissive=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
gl_Position=u_matrix*vec4(a_pos_3f,1.0);
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
|
||
|
|
#endif
|
||
|
|
}`),buildingDepth:wn("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
|
||
|
|
#endif
|
||
|
|
glFragColor=vec4(out_color*color.a,color.a);
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
|
||
|
|
#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
|
||
|
|
in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
|
||
|
|
#ifdef PROJECTION_GLOBE_VIEW
|
||
|
|
vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
uv=vec2(a_texture_pos)/8192.0;gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:wn("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl"
|
||
|
|
in int a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
|
||
|
|
mod(float(a_index),u_particle_texture_side_len),float(a_index)/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:wn("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:wn(`#include "_prelude_raster_particle.glsl"
|
||
|
|
uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(
|
||
|
|
linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
|
||
|
|
);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),snowParticle:wn("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",`
|
||
|
|
in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture;
|
||
|
|
uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius;
|
||
|
|
uniform float u_horizontalOscillationRate;
|
||
|
|
uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
|
||
|
|
localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:wn("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",`
|
||
|
|
in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture;
|
||
|
|
uniform float u_velocity;
|
||
|
|
uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize;
|
||
|
|
pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+
|
||
|
|
localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:wn("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),elevatedStructuresDepth:wn("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructures:wn(`#include "_prelude_fog.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
in vec3 v_normal;in float v_height;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
|
||
|
|
#endif
|
||
|
|
vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
|
||
|
|
{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;uniform float u_opacity_multiplier;
|
||
|
|
#pragma mapbox: define highp vec4 structure_color
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 structure_color
|
||
|
|
vec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
cutout_factors=get_cutout_factors(gl_FragCoord);
|
||
|
|
#endif
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
float light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light);
|
||
|
|
#else
|
||
|
|
color=apply_lighting(color,transformed_normal);
|
||
|
|
#endif
|
||
|
|
color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
color=fog_apply(color,v_fog_pos);
|
||
|
|
#endif
|
||
|
|
vec4 out_color=vec4(color,1.0);
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
out_color=applyCutout(out_color,v_height);
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
|
||
|
|
#endif
|
||
|
|
out_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
in ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define highp vec4 structure_color
|
||
|
|
void main() {
|
||
|
|
#pragma mapbox: initialize highp vec4 structure_color
|
||
|
|
v_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1);
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec3 shd_pos0=pos;vec3 shd_pos1=pos;
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(vec2(a_pos));
|
||
|
|
#endif
|
||
|
|
}`),elevatedStructuresDepthReconstruct:wn(`#ifdef DEPTH_RECONSTRUCTION
|
||
|
|
in float v_height;
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#ifdef DEPTH_RECONSTRUCTION
|
||
|
|
if (v_height >=0.0)
|
||
|
|
discard;
|
||
|
|
#else
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
|
||
|
|
#ifdef DEPTH_RECONSTRUCTION
|
||
|
|
out float v_height;
|
||
|
|
#endif
|
||
|
|
void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
|
||
|
|
#ifdef DEPTH_RECONSTRUCTION
|
||
|
|
if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
|
||
|
|
#endif
|
||
|
|
gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`)};wn(bf,"");const Tl=c.b_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),yb=c.b_([{type:"Float32",name:"a_pos_2f",components:2}]);class Ty{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(r,a){const f=r.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const w=new c.aO,k=new c.aT;w.emplaceBack(-1,-1),w.emplaceBack(1,-1),w.emplaceBack(1,1),w.emplaceBack(-1,1),k.emplaceBack(0,1,2),k.emplaceBack(0,2,3),this.vignetteVx=r.context.createVertexBuffer(w,yb.members),this.vignetteIdx=r.context.createIndexBuffer(k)}const _=c.aJ.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,f);const w={u_vignetteShape:(x={vignetteShape:[a.start,a.range,Math.pow(10,a.fadePower)],vignetteColor:[a.color.r,a.color.g,a.color.b,a.color.a*a.strength]}).vignetteShape,u_vignetteColor:x.vignetteColor};f.draw(r,r.context.gl.TRIANGLES,Vt.disabled,rn.disabled,tn.alphaBlended,Ut.disabled,w,"vignette",this.vignetteVx,this.vignetteIdx,_)}var x}}class vb{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(r,a){const f=r.getFreeCameraOptions().position,_=f.toAltitude(),x=f.toLngLat(),w=c.c4(x.lng),k=c.c4(x.lat),A=r.pixelsPerMeter/a,P=w*c.c9,D=c.c9*Math.log(Math.tan(Math.PI/4+k/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const z=-this._offsetYPrev+D,F=-this._elevationPrev+_;this._accumulatedOffsetX+=(-this._offsetXPrev+P)*A,this._accumulatedOffsetY+=z*A,this._accumulatedElevation+=F*A,this._offsetXPrev=P,this._offsetYPrev=D,this._elevationPrev=_}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Lu(u,r){return[-(u[0]-Math.floor(u[0]/r)*r),-(u[1]-Math.floor(u[1]/r)*r),-(u[2]-Math.floor(u[2]/r)*r)]}function kf(u){const r=c.eq(1323123451230),a=[];for(let f=0;f<u;++f){const _=2*r()-1,x=2*r()-1,w=2*r()-1;a.push(c.cx(_,x,w))}return a}function Wa(u,r,a,f,_){const x=c.bG((_-a)/(f-a),0,1);return c.dY(u,r,x)}class wm{constructor(r){this._movement=new vb,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Ty,this._ppmScaleFactor=r}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(r,a){const f=r.transform;this._movement.update(f,this._ppmScaleFactor);const _=f.starsProjMatrix,x=c.dp([]);c.f2(x,x,c.c4(90)-f._pitch),c.f5(x,x,-f.angle);const w=c.ct(new Float32Array(16),x),k=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),A=c.fR([],k),P=c.er([],A,w),D=Date.now()/1e3;return this._accumulatedTimeFromStart+=(D-this._prevTime)*a,this._prevTime=D,{projectionMatrix:_,modelviewMatrix:P}}}const Sm=c.b_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]),Af=(u,r)=>({u_matrix:u,u_depth_bias:r}),xb=(u,r)=>({u_matrix:u,u_ground_shadow_factor:r,u_opacity_multiplier:1}),Cf=(u,r,a,f,_)=>({u_matrix:u,u_camera_pos:[r[0],r[1],r[2]],u_depth_bias:a,u_height_scale:f,u_reset_depth:_}),bb={building:u=>({u_matrix:new c.bb(u),u_normal_matrix:new c.bb(u),u_opacity:new c.b4(u),u_faux_facade_ao_intensity:new c.b4(u),u_camera_pos:new c.b7(u),u_tile_to_meter:new c.b4(u),u_facade_emissive_chance:new c.b4(u),u_flood_light_color:new c.b7(u),u_flood_light_intensity:new c.b4(u),u_front_cutoff_params:new c.b7(u)}),buildingBloom:u=>({u_matrix:new c.bb(u)}),buildingDepth:u=>({u_matrix:new c.bb(u)}),elevatedStructuresDepth:u=>({u_matrix:new c.bb(u),u_depth_bias:new c.b4(u)}),elevatedStructures:u=>({u_matrix:new c.bb(u),u_ground_shadow
|
||
|
|
#include "_prelude_shadow.fragment.glsl"
|
||
|
|
#include "_prelude_lighting.glsl"
|
||
|
|
uniform float u_opacity;
|
||
|
|
#ifdef DITHERED_DISCARD
|
||
|
|
uniform float u_dithered_discard_threshold;
|
||
|
|
#endif
|
||
|
|
uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
|
||
|
|
#endif
|
||
|
|
#ifdef OCCLUSION_TEXTURE_TRANSFORM
|
||
|
|
uniform vec4 u_occlusionTextureTransform;
|
||
|
|
#endif
|
||
|
|
#pragma mapbox: define-attribute highp vec3 normal_3f
|
||
|
|
#pragma mapbox: define-attribute highp vec3 color_3f
|
||
|
|
#pragma mapbox: define-attribute highp vec4 color_4f
|
||
|
|
#pragma mapbox: define-attribute highp vec2 uv_2f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec3 normal_3f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec3 color_3f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec4 color_4f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec2 uv_2f
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_TEXTURE_u_baseColorTexture
|
||
|
|
uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
|
||
|
|
uniform sampler2D u_metallicRoughnessTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_TEXTURE_u_occlusionTexture
|
||
|
|
uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_TEXTURE_u_normalTexture
|
||
|
|
uniform sampler2D u_normalTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_TEXTURE_u_emissionTexture
|
||
|
|
uniform sampler2D u_emissionTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
uniform highp sampler3D u_lutTexture;
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT_VERTEX
|
||
|
|
in highp float v_cutout_factor;
|
||
|
|
#endif
|
||
|
|
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
|
|
in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
|
||
|
|
#ifdef DEPTH_D24
|
||
|
|
highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
|
||
|
|
#else
|
||
|
|
highp float unpack_depth_rgba(highp vec4 rgba_depth)
|
||
|
|
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
|
||
|
|
#endif
|
||
|
|
bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
coord.y=1.0-coord.y;
|
||
|
|
#endif
|
||
|
|
#ifdef DEPTH_D24
|
||
|
|
highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
|
||
|
|
#else
|
||
|
|
highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
|
||
|
|
#endif
|
||
|
|
return v_depth > depth+0.0005;}
|
||
|
|
#endif
|
||
|
|
#define saturate(_x) clamp(_x,0.,1.)
|
||
|
|
vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
|
||
|
|
{
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
|
||
|
|
#else
|
||
|
|
lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
|
||
|
|
#endif
|
||
|
|
return apply_lighting(albedo,transformed_normal,lighting_factor);
|
||
|
|
#else
|
||
|
|
vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;
|
||
|
|
#endif
|
||
|
|
}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_color_3f
|
||
|
|
albedo*=vec4(color_3f,1.0);
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
#else
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_color_4f
|
||
|
|
albedo*=color_4f;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
|
||
|
|
vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
|
||
|
|
#ifdef UNPREMULT_TEXTURE_IN_SHADER
|
||
|
|
texColor=vec4(unpremultiplyColor(texColor),1.0);
|
||
|
|
#endif
|
||
|
|
if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
|
||
|
|
#endif
|
||
|
|
vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
color=applyLUT(u_lutTexture,color);
|
||
|
|
#endif
|
||
|
|
return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
|
||
|
|
#ifdef HAS_TEXTURE_u_normalTexture
|
||
|
|
highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
T=-T;B=-B;
|
||
|
|
#endif
|
||
|
|
highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
|
||
|
|
#else
|
||
|
|
return mat3(1.0);
|
||
|
|
#endif
|
||
|
|
}highp vec3 getNormal(){highp vec3 n;
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_normal_3f
|
||
|
|
n=normalize(normal_3f);
|
||
|
|
#else
|
||
|
|
highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
n=normalize(cross(fdx,fdy));
|
||
|
|
#else
|
||
|
|
n=normalize(cross(fdx,fdy))*-1.0;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
|
|
vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
|
||
|
|
#endif
|
||
|
|
return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
|
||
|
|
#endif
|
||
|
|
#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
|
|
vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
|
||
|
|
#endif
|
||
|
|
const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
|
||
|
|
{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
|
||
|
|
{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
|
||
|
|
{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
|
||
|
|
{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
|
||
|
|
{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
|
||
|
|
{
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
return mat.diffuseColor;
|
||
|
|
#else
|
||
|
|
return mat.diffuseColor/PI;
|
||
|
|
#endif
|
||
|
|
}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
|
||
|
|
{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
|
||
|
|
{vec3 env_light=vec3(0.65,0.65,0.65);
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
|
||
|
|
#endif
|
||
|
|
vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
|
||
|
|
{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
|
||
|
|
#else
|
||
|
|
lighting_factor=NdotL;
|
||
|
|
#endif
|
||
|
|
vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
|
||
|
|
#if !defined(LIGHTING_3D_MODE)
|
||
|
|
const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
|
||
|
|
#endif
|
||
|
|
color*=intensityFactor;return color;}void main() {
|
||
|
|
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
|
|
if (isOccluded()) {discard;}
|
||
|
|
#endif
|
||
|
|
vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
|
||
|
|
#ifdef LIGHTING_3D_MODE
|
||
|
|
lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
|
||
|
|
#endif
|
||
|
|
vec4 finalColor;
|
||
|
|
#ifdef DIFFUSE_SHADED
|
||
|
|
vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
|
||
|
|
#ifdef HAS_TEXTURE_u_occlusionTexture
|
||
|
|
float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
|
||
|
|
#endif
|
||
|
|
finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
|
||
|
|
#else
|
||
|
|
Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
|
||
|
|
#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
|
|
#ifdef OCCLUSION_TEXTURE_TRANSFORM
|
||
|
|
vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
|
||
|
|
#else
|
||
|
|
vec2 uv=uv_2f;
|
||
|
|
#endif
|
||
|
|
ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
|
||
|
|
#endif
|
||
|
|
vec4 emissive=u_emissiveFactor;
|
||
|
|
#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
|
||
|
|
emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
|
||
|
|
#endif
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
|
||
|
|
#endif
|
||
|
|
color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;
|
||
|
|
#ifdef APPLY_LUT_ON_GPU
|
||
|
|
color_mix=applyLUT(u_lutTexture,color_mix);
|
||
|
|
#endif
|
||
|
|
color=mix(color,color_mix,min(1.0,resEmission));
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_color_4f
|
||
|
|
float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
|
||
|
|
#endif
|
||
|
|
#ifdef DITHERED_DISCARD
|
||
|
|
if (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
finalColor*=v_cutoff_opacity;
|
||
|
|
#endif
|
||
|
|
#ifdef INDICATOR_CUTOUT
|
||
|
|
finalColor=applyCutout(finalColor,v_position_height.w);
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT_VERTEX
|
||
|
|
apply_feature_cutout_dither(gl_FragCoord,v_cutout_factor);
|
||
|
|
#else
|
||
|
|
#ifdef FEATURE_CUTOUT
|
||
|
|
finalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
glFragColor=finalColor;
|
||
|
|
#ifdef OVERDRAW_INSPECTOR
|
||
|
|
glFragColor=vec4(1.0);
|
||
|
|
#endif
|
||
|
|
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
|
||
|
|
#include "_prelude_shadow.vertex.glsl"
|
||
|
|
in vec3 a_pos_3f;
|
||
|
|
#pragma mapbox: define-attribute highp vec3 normal_3f
|
||
|
|
#pragma mapbox: define-attribute highp vec2 uv_2f
|
||
|
|
#pragma mapbox: define-attribute highp vec3 color_3f
|
||
|
|
#pragma mapbox: define-attribute highp vec4 color_4f
|
||
|
|
#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr
|
||
|
|
#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
|
||
|
|
uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
|
||
|
|
#ifdef INSTANCED_ARRAYS
|
||
|
|
in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
|
||
|
|
#else
|
||
|
|
uniform highp mat4 u_normal_matrix;
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
|
||
|
|
#endif
|
||
|
|
out vec4 v_position_height;out lowp vec4 v_color_mix;
|
||
|
|
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
|
|
out highp float v_depth;
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT_VERTEX
|
||
|
|
out highp float v_cutout_factor;
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
|
||
|
|
#endif
|
||
|
|
vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
|
||
|
|
#pragma mapbox: initialize-attribute highp vec3 normal_3f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec2 uv_2f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec3 color_3f
|
||
|
|
#pragma mapbox: initialize-attribute highp vec4 color_4f
|
||
|
|
#pragma mapbox: initialize-attribute-custom highp uvec4 pbr
|
||
|
|
#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
|
||
|
|
highp mat4 normal_matrix;
|
||
|
|
#ifdef INSTANCED_ARRAYS
|
||
|
|
normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
|
||
|
|
#else
|
||
|
|
normal_matrix=u_normal_matrix;
|
||
|
|
#endif
|
||
|
|
#ifdef FEATURE_CUTOUT_VERTEX
|
||
|
|
v_cutout_factor=1.0;
|
||
|
|
#endif
|
||
|
|
vec3 local_pos;mat3 rs;
|
||
|
|
#ifdef MODEL_POSITION_ON_GPU
|
||
|
|
vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
|
||
|
|
#ifdef FEATURE_CUTOUT_VERTEX
|
||
|
|
highp vec4 ground_pos=vec4(pos_a.xy,0.0,1.0);highp vec4 cutout_clip_pos=mix(u_matrix*ground_pos,AWAY,hidden);highp vec3 cutout_ndc=cutout_clip_pos.xyz/cutout_clip_pos.w;vec2 uv=cutout_ndc.xy*0.5+0.5;highp float fragDepthNDC=cutout_ndc.z*0.5+0.5;
|
||
|
|
#ifdef FLIP_Y
|
||
|
|
fragDepthNDC=cutout_ndc.z;
|
||
|
|
#endif
|
||
|
|
highp float cutoutFactor=get_cutout_factors_vert(uv).x;highp float cutoutDepthNDC=sample_cutout_depth(u_cutout_depth_image,uv);highp float groundThreshold=0.001;highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);v_cutout_factor=mix(1.0-cutoutFactor,1.0,groundLimit);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
|
||
|
|
#endif
|
||
|
|
v_position_height.w=a_pos_3f.z;
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
vec4 albedo_c=decode_color(vec2(pbr.xy));vec2 e_r_m=unpack_float(float(pbr.z));vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(float(pbr.w))/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
|
||
|
|
#endif
|
||
|
|
#ifdef FOG
|
||
|
|
v_fog_pos=fog_position(local_pos);
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_CUTOFF
|
||
|
|
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
|
||
|
|
#endif
|
||
|
|
#ifdef TERRAIN_FRAGMENT_OCCLUSION
|
||
|
|
v_depth=gl_Position.z/gl_Position.w;
|
||
|
|
#ifdef CLIP_ZERO_TO_ONE
|
||
|
|
v_depth=-1.0+2.0*v_depth;
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_normal_3f
|
||
|
|
#ifdef MODEL_POSITION_ON_GPU
|
||
|
|
float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
|
||
|
|
#else
|
||
|
|
normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_pbr
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_color_4f
|
||
|
|
v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#ifdef RENDER_SHADOWS
|
||
|
|
vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
|
||
|
|
#ifdef NORMAL_OFFSET
|
||
|
|
#ifdef HAS_ATTRIBUTE_a_normal_3f
|
||
|
|
#ifdef MODEL_POSITION_ON_GPU
|
||
|
|
vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
|
||
|
|
#else
|
||
|
|
vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;
|
||
|
|
#endif
|
||
|
|
}`),modelDepth:wn("void main() {}",`in vec3 a_pos_3f;uniform mat4 u_matrix;
|
||
|
|
#ifdef MODEL_POSITION_ON_GPU
|
||
|
|
#ifdef INSTANCED_ARRAYS
|
||
|
|
in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
|
||
|
|
#else
|
||
|
|
uniform highp mat4 u_instance;
|
||
|
|
#endif
|
||
|
|
uniform highp mat4 u_node_matrix;
|
||
|
|
#endif
|
||
|
|
void main() {
|
||
|
|
#ifdef MODEL_POSITION_ON_GPU
|
||
|
|
highp mat4 instance;
|
||
|
|
#ifdef INSTANCED_ARRAYS
|
||
|
|
instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
|
||
|
|
#else
|
||
|
|
instance=u_instance;
|
||
|
|
#endif
|
||
|
|
vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);
|
||
|
|
#else
|
||
|
|
gl_Position=u_matrix*vec4(a_pos_3f,1);
|
||
|
|
#endif
|
||
|
|
}`)},programUniforms:{model:u=>({u_matrix:new c.bb(u),u_lighting_matrix:new c.bb(u),u_normal_matrix:new c.bb(u),u_node_matrix:new c.bb(u),u_lightpos:new c.b7(u),u_lightintensity:new c.b4(u),u_lightcolor:new c.b7(u),u_camera_pos:new c.b7(u),u_opacity:new c.b4(u),u_baseColorFactor:new c.b8(u),u_emissiveFactor:new c.b8(u),u_metallicFactor:new c.b4(u),u_roughnessFactor:new c.b4(u),u_baseTextureIsAlpha:new c.b5(u),u_alphaMask:new c.b5(u),u_alphaCutoff:new c.b4(u),u_baseColorTexture:new c.b5(u),u_metallicRoughnessTexture:new c.b5(u),u_normalTexture:new c.b5(u),u_occlusionTexture:new c.b5(u),u_emissionTexture:new c.b5(u),u_lutTexture:new c.b5(u),u_color_mix:new c.b8(u),u_aoIntensity:new c.b4(u),u_emissive_strength:new c.b4(u),u_occlusionTextureTransform:new c.b8(u),u_dithered_discard_threshold:new c.b4(u)}),modelDepth:u=>({u_matrix:new c.bb(u),u_instance:new c.bb(u),u_node_matrix:new c.bb(u)})}};async function Cb(){return Promise.resolve()}class Vy{constructor(r,a,f){this.screenBounds=r,this.cameraPoint=f.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=a,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,f)}static createFromScreenPoints(r,a){let f,_;if(r instanceof c.au||typeof r[0]=="number"){const x=c.au.convert(r);f=[x],_=a.isPointAboveHorizon(x)}else{const x=c.au.convert(r[0]),w=c.au.convert(r[1]),k=x.add(w)._div(2);f=[x,w],_=c.eP(x,w).every(A=>a.isPointAboveHorizon(A))&&a.isPointAboveHorizon(k)}return new Vy(f,_,a)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return c.eP(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const a=this.screenBounds[0],f=this.screenBounds.length===1?this.screenBounds[0].add(new c.au(1,1)):this.screenBounds[1],_=c.eP(a,f,0,!1);return this.cameraPoint.y>f.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x<f.x?_.splice(3,0,this.cameraPoint):this.cameraPoint.x>=f.x?_[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(_[3]=this.cameraPoint)),c.bu(_,r)}bufferedCameraGeometryGlobe(r){const a=this.screenBounds[0],f=this.screenBounds.length===1?this.screenBounds[0].add(new c.au(1,1)):this.screenBounds[1],_=c.eP(a,f,r),x=this.cameraPoint.clone(),w=+(x.x>a.x)+ +(x.x>f.x);switch(3*(+(x.y>a.y)+ +(x.y>f.y))+w){case 0:_[0]=x,_[4]=x.clone();break;case 1:_.splice(1,0,x);break;case 2:_[1]=x;break;case 3:_.splice(4,0,x);break;case 5:_.splice(2,0,x);break;case 6:_[3]=x;break;case 7:_.splice(3,0,x);break;case 8:_[2]=x}return _}containsTile(r,a,f,_=0){const x=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/a._pixelsPerMercatorPixel+1,w=f?this._bufferedCameraMercator(x,a):this._bufferedScreenMercator(x,a);let k=r.tileID.wrap+(w.unwrapped?_:0);const A=w.polygon.map(J=>c.d8(r.tileTransform,J,k));if(!c.eM(A,0,0,c.r,c.r))return;k=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?_:0);const P=this.screenGeometryMercator.polygon.map(J=>c.d9(r.tileTransform,J,k)),D=P.map(J=>new c.au(J[0],J[1])),z=a.getFreeCameraOptions().position||new c.ag(0,0,0),F=c.d9(r.tileTransform,z,k),j=P.map(J=>{const Q=c.fx(J,J,F);return c.ex(Q,Q),new c.aB(F,Q)}),$=c.eG(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:D,tilespaceRays:j,bufferedTilespaceGeometry:A,bufferedTilespaceBounds:(W=c.cI(A),W.min.x=c.bG(W.min.x,0,c.r),W.min.y=c.bG(W.min.y,0,c.r),W.max.x=c.bG(W.max.x,0,c.r),W.max.y=c.bG(W.max.y,0,c.r),W),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:$};var W}_bufferedScreenMercator(r,a){const f=Rm(r);if(this._screenRaycastCache[f])return this._screenRaycastCache[f];{let _;return _=a.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),a):{polygon:this.bufferedScreenGeometry(r).map(x=>a.pointCoordinate3D(x)),unwrapped:!0},this._screenRaycastCache[f]=_,_}}_bufferedCameraMercator(r,a){const f=Rm(r);if(this._cameraRaycastCache[f])return this._cameraRaycastCache[f];{let _;return _=a.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),a):
|
||
|
|
This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const z=this.getScaledDemTileSize();this.sourceCache.update(a,z,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,D(),this._initializing=!0),D(),a.updateElevation(!0,f),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){if(this._attenuationRange&&r.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(r.zoom);const a=this._previousCameraAltitude,f=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=f;const _=a!=null?f-a:Number.MAX_VALUE;if(Math.abs(_)<2)return this._exaggeration;const x=r.zoom,w=this._style.terrain;if(!this._previousUpdateTimestamp)return w.getExaggeration(x);let k=x-this._previousZoom;const A=this._previousUpdateTimestamp;let P=x;this._evaluationZoom!=null&&(P=this._evaluationZoom,Math.abs(x-P)>.5&&(k=.5*(x-P+k)),k*_<0&&(P+=k)),this._evaluationZoom=P;const D=w.getExaggeration(P),z=D===w.getExaggeration(Math.max(0,P-.1));if(z&&Math.abs(D-this._exaggeration)<.01)return D;let F=Math.min(.1,.00375*(this._updateTimestamp-A));return(z||D<.1||Math.abs(k)<1e-4)&&(F=Math.min(.2,4*F)),c.dY(this._exaggeration,D,F)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.dataType==="source"&&r.coord?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(r=>r.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const a=this.proxySourceCache,f=this.painter.transform;this._initializing&&(this._initializing=f._centerAltitude===0&&this.getAtPointOrZero(c.ag.fromLngLat(f.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const _=this.proxyCoords=a.getIds().map(A=>{const P=a.getTileByID(A).tileID;return P.projMatrix=f.calculateProjMatrix(P.toUnwrapped()),P});(function(A,P){const D=P.transform.pointCoordinate(P.transform.getCameraPoint()),z=new c.au(D.x,D.y);A.sort((F,j)=>{if(j.overscaledZ-F.overscaledZ)return j.overscaledZ-F.overscaledZ;const $=new c.au(F.canonical.x+(1<<F.canonical.z)*F.wrap,F.canonical.y),W=new c.au(j.canonical.x+(1<<j.canonical.z)*j.wrap,j.canonical.y),J=z.mult(1<<F.canonical.z);return J.x-=.5,J.y-=.5,J.distSqr($)-J.distSqr(W)})})(_,this.painter);const x=this.proxyToSource||{};this.proxyToSource={},_.forEach(A=>{this.proxyToSource[A.key]={}}),this.terrainTileForTile={};const w=this._style._mergedSourceCaches;for(const A in w){const P=w[A];if(!P.used||(P!==this.sourceCache&&this.resetTileLookupCache(P.id),this._
|
||
|
|
${(_?_.defines():[]).concat(w.map(J=>`#define ${J}`)).join(`
|
||
|
|
`)}`,D=[P,_b];for(const J of f.fragmentIncludes)D.push(Tf[J]);D.push(f.fragmentSource);const z=D.join(`
|
||
|
|
`),F=[P,Sy];for(const J of f.vertexIncludes)F.push(Tf[J]);this.forceManualRenderingForInstanceIDShaders=r.forceManualRenderingForInstanceIDShaders&&f.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&F.push("uniform int u_instanceID;"),F.push(f.vertexSource);let j=F.join(`
|
||
|
|
`);this.forceManualRenderingForInstanceIDShaders&&(j=j.replaceAll("gl_InstanceID","u_instanceID"));const $=A.createShader(A.FRAGMENT_SHADER);if(A.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);A.shaderSource($,z),A.compileShader($),A.attachShader(this.program,$);const W=A.createShader(A.VERTEX_SHADER);if(A.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);A.shaderSource(W,j),A.compileShader(W),A.attachShader(this.program,W),A.linkProgram(this.program),this._fragmentShader=$,this._vertexShader=W,r.extParallelShaderCompile?r._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;const r=this._context,a=r.gl;r._pendingPrograms.delete(this);const f=c.co.now(),_=a.getProgramParameter(this.program,a.LINK_STATUS),x=c.co.now()-f,w=r._compileStats;if(w.totalStallMs+=x,x>w.maxStallMs&&(w.maxStallMs=x),x>1){w.framesMissed+=Math.floor(60*x/1e3);const P=this.fixedDefines.join(",");w.stalls.push({name:`${this.name}${P?"/":""}${P}`,ms:x,timestamp:f})}if(this._fragmentShader&&(_||c.f_(`Fragment shader '${this.name}': ${a.getShaderInfoLog(this._fragmentShader)}`),a.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(_||c.f_(`Vertex shader '${this.name}': ${a.getShaderInfoLog(this._vertexShader)}`),a.deleteShader(this._vertexShader),this._vertexShader=null),!_)return c.f_(`Failed to link program '${this.name}': ${a.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(r),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(r):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(P=>({u_instanceID:new c.b5(P)}))(r));const k=this.fixedDefines,A=this.name;(k.includes("TERRAIN")||k.includes("ELEVATED")||A.includes("symbol")||A.includes("circle"))&&(this.terrainUniforms=(P=>({u_dem:new c.b5(P),u_dem_prev:new c.b5(P),u_dem_tl:new c.b6(P),u_dem_scale:new c.b4(P),u_dem_tl_prev:new c.b6(P),u_dem_scale_prev:new c.b4(P),u_dem_size:new c.b4(P),u_dem_lerp:new c.b4(P),u_exaggeration:new c.b4(P),u_depth:new c.b5(P),u_depth_size_inv:new c.b6(P),u_depth_range_unpack:new c.b6(P),u_occluder_half_size:new c.b4(P),u_occlusion_depth_offset:new c.b4(P),u_meter_to_dem:new c.b4(P),u_label_plane_matrix_inv:new c.bb(P)}))(r)),k.includes("GLOBE")&&(this.globeUniforms=(P=>({u_tile_tl_up:new c.b7(P),u_tile_tr_up:new c.b7(P),u_tile_br_up:new c.b7(P),u_tile_bl_up:new c.b7(P),u_tile_up_scale:new c.b4(P)}))(r)),k.includes("FOG")&&(this.fogUniforms=(P=>({u_fog_matrix:new c.bb(P),u_fog_range:new c.b6(P),u_fog_color:new c.b8(P),u_fog_horizon_blend:new c.b4(P),u_fog_vertical_limit:new c.b6(P),u_fog_temporal_offset:new c.b4(P),u_frustum_tl:new c.b7(P),u_frustum_tr:new c.b7(P),u_frustum_br:new c.b7(P),u_frustum_bl:new c.b7(P),u_globe_pos:new c.b7(P),u_globe_radius:new c.b4(P),u_globe_transition:new c.b4(P),u_is_globe:new c.b5(P),u_viewport:new c.b6(P)}))(r)),k.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(P=>({u_cutoff_params:new c.b8(P)}))(r)),k.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(P=>({u_lighting_ambient_color:new c.b7(P),u_lighting_directional_dir:new c.b7(P),u_lighting_directional_color:new c.b7(P),u_ground_radiance:new c.b7(P)}))(r)),k.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(P=>({u_light_matrix_0:new c.bb(P),u_light_matrix_1:new c.bb(P),u_fade_range:new c.b6(P),u_shadow_normal_offset:new c.b7(P),u_shadow_intensity:new c.b4(P),u_shadow_texel_size:new c.b4(P),u_shadow_map_resolution:new c.b4(P),u_shadow_direction:new c.b7(P),u_shadow_bias:new c.b7(P),u_shadowmap_0:new c.b5(P),u_shadowmap_1:new c.b5(P)}))(r))}maybeFinalize(){if(!this._pending)return;const r=this._context.extParallelShaderCompile;r&&!this._context.gl.getProgramParameter(this.program,r.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(r,a){this._ensureReady();let f=this.attributes[a];return f===void 0&&(f=this.attributes[a]=r
|
||
|
|
translate(${r.x}px,${r.y}px)
|
||
|
|
${Fv[this._anchor]}
|
||
|
|
${this._calculateXYTransform()} ${this._calculateZTransform()}
|
||
|
|
translate(${a.x}px,${a.y}px)
|
||
|
|
`}_calculateXYTransform(){const r=this._pos,a=this._map,f=this.getPitchAlignment();if(!a||!r||f!=="map")return"";if(!a._showingGlobe()){const A=a.getPitch();return A?`rotateX(${A}deg)`:""}const _=c.eX(c.dl(a.transform,this._lngLat)),x=r.sub(c.dd(a.transform)),w=Math.abs(x.x)+Math.abs(x.y);if(w===0)return"";const k=_/w;return`rotateX(${-x.y*k}deg) rotateY(${x.x*k}deg)`}_calculateZTransform(){const r=this._pos,a=this._map;if(!a||!r)return"";let f=0;const _=this.getRotationAlignment();if(_==="map")if(a._showingGlobe()){const x=a.project(new c.ab(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),w=a.project(new c.ab(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(x);f=c.eX(Math.atan2(w.y,w.x))-90}else f=-a.getBearing();else if(_==="horizon"){const x=c.fq(4,6,a.getZoom()),w=c.dd(a.transform);w.y+=x*a.transform.height;const k=r.sub(w),A=c.eX(Math.atan2(k.y,k.x));f=(A>90?A-270:A+90)*(1-x)}return f+=this._rotation,f?`rotateZ(${f}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const a=this._map;a&&(a.transform.renderWorldCopies&&(this._lngLat=ug(this._lngLat,this._pos,a.transform)),this._pos=a.project(this._lngLat,this._altitude),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),a._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(a._showingGlobe()||a.getTerrain()||a.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=c.au.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const a=this._map;if(!a)return;const f=this._pointerdownPos,_=this._positionDelta;if(f&&_){if(!this._isDragging){const x=this._clickTolerance||a._clickTolerance;if(r.point.dist(f)<x)return;this._isDragging=!0}this._pos=r.point.sub(_),this._lngLat=a.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.x("dragstart"))),this.fire(new c.x("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new c.x("dragend")),this._state="inactive"}_addDragHandler(r){const a=this._map,f=this._pos;a&&f&&this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(f),this._pointerdownPos=r.point,this._state="pending",a.on("mousemove",this._onMove),a.on("touchmove",this._onMove),a.once("mouseup",this._onUp),a.once("touchend",this._onUp))}setDraggable(r){this._draggable=!!r;const a=this._map;return a&&(r?(a.on("mousedown",this._addDragHandler),a.on("touchstart",this._addDragHandler)):(a.off("mousedown",this._addDragHandler),a.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||Dl.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||Dl.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r||Dl.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(r){return this._occludedOpacity=r||Dl.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Zu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracy
|
||
|
|
must be that same as the previous version of the image
|
||
|
|
(${f.data.width}, ${f.data.height})`)));const A=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);let P=!1;f.usvg?(f.data=new c.ay({width:x,height:w},new Uint8Array(k)),f.usvg=!1,f.icon=void 0,P=!0):f.data.replace(k,A),this.style.updateImage(a,f,P)}hasImage(u){return u?!!this.style&&!!this.style.getImage(c.a1.from(u)):(this.fire(new c.v(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(c.a1.from(u))}loadImage(u,r){c.cQ(this._requestManager.transformRequest(u,c.aH.Image),(a,f)=>{r(a,f)})}listImages(){return this.style.listImages().map(u=>u.name)}addModel(u,r){this._lazyInitEmptyStyle(),this.style.addModel(u,r)}hasModel(u){return u?this.style.hasModel(u):(this.fire(new c.v(new Error("Missing required model id"))),!1)}removeModel(u){this.style.removeModel(u)}listModels(){return this.style.listModels()}addLayer(u,r){return this._isValidId(u.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(u,r),this._update(!0)):this}getSlot(u){const r=this.getLayer(u);return r&&r.slot||null}setSlot(u,r){return this.style.setSlot(u,r),this.style.mergeLayers(),this._update(!0)}addImport(u,r){return this.style.addImport(u,r).catch(a=>this.fire(new c.v(new Error("Failed to add import",a)))),this}updateImport(u,r){return typeof r!="string"&&r.id!==u?(this.removeImport(u),this.addImport(r)):(this.style.updateImport(u,r),this._update(!0))}removeImport(u){return this.style.removeImport(u),this}moveImport(u,r){return this.style.moveImport(u,r),this._update(!0)}moveLayer(u,r){return this._isValidId(u)?(this.style.moveLayer(u,r),this._update(!0)):this}removeLayer(u){return this._isValidId(u)?(this.style.removeLayer(u),this._update(!0)):this}getLayer(u){if(!this._isValidId(u))return null;const r=this.style.getOwnLayer(u);return r?r.type==="custom"?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(u,r,a){return this._isValidId(u)?(this.style.setLayerZoomRange(u,r,a),this._update(!0)):this}setFilter(u,r,a={}){return this._isValidId(u)?(this.style.setFilter(u,r,a),this._update(!0)):this}getFilter(u){return this._isValidId(u)?this.style.getFilter(u):null}setPaintProperty(u,r,a,f={}){return this._isValidId(u)?(this.style.setPaintProperty(u,r,a,f),this._update(!0)):this}getPaintProperty(u,r){return this._isValidId(u)?this.style.getPaintProperty(u,r):null}setLayoutProperty(u,r,a,f={}){return this._isValidId(u)?(this.style.setLayoutProperty(u,r,a,f),this._update(!0)):this}getLayoutProperty(u,r){return this._isValidId(u)?this.style.getLayoutProperty(u,r):null}getLayerProperty(u,r){return this._isValidId(u)?this.style.getLayerProperty(u,r):null}setLayerProperty(u,r,a,f={}){return this._isValidId(u)?(r==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(u,r,a,f),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(u){return this.style.setGlyphsUrl(u),this._update(!0)}getSchema(u){return this.style.getSchema(u)}setSchema(u,r){return this.style.setSchema(u,r),this._update(!0)}getConfig(u){return this.style.getConfig(u)}setConfig(u,r){return this.style.setConfig(u,r),this._update(!0)}getConfigProperty(u,r){return this.style.getConfigProperty(u,r)}setConfigProperty(u,r,a){return this.style.setConfigProperty(u,r,a),this._update(!0)}getFeaturesetDescriptors(u){return this.style.getFeaturesetDescriptors(u)}setLights(u){if(this._lazyInitEmptyStyle(),u&&u.length===1&&u[0].type==="flat"){const r=u[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(u),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const u=this.style.getLights()||[];return u.length===0&&u.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),u}setLight(u,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:u}])}getLight(){return console.log("The
|
||
|
|
<circle cx="12" cy="12" r="10" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<circle cx="12" cy="12" r="4" fill="rgba(255,100,100,0.3)"/>
|
||
|
|
<path d="m4.93 4.93 4.24 4.24" stroke-width="2.5"/>
|
||
|
|
<path d="m14.83 14.83 4.24 4.24" stroke-width="2.5"/>
|
||
|
|
<path d="m14.83 9.17 4.24-4.24" stroke-width="2.5"/>
|
||
|
|
<path d="m4.93 19.07 4.24-4.24" stroke-width="2.5"/>
|
||
|
|
</svg>`,gradient:"hsl(4 85% 55%)",gradientDark:"hsl(4 85% 42%)"}:t.includes("räddningsstation")||t.includes("rescue station")||t.includes("livräddning")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M8 2h8l4 10H4L8 2Z" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M12 12v10"/>
|
||
|
|
<path d="M4 22h16"/>
|
||
|
|
<path d="M12 2v2"/>
|
||
|
|
<circle cx="12" cy="7" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(350 75% 52%)",gradientDark:"hsl(350 75% 40%)"}:t.includes("nödtelefon")||t.includes("emergency phone")||t.includes("sos")||t.includes("larmtelefon")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="5" y="2" width="14" height="20" rx="2" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M12 18h.01"/>
|
||
|
|
<path d="M9 6h6"/>
|
||
|
|
<path d="M9 10h6"/>
|
||
|
|
<path d="M8 14l2 2 4-4" stroke-width="2.5"/>
|
||
|
|
</svg>`,gradient:"hsl(0 85% 50%)",gradientDark:"hsl(0 85% 38%)"}:t.includes("brygga")||t.includes("pier")||t.includes("kaj")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M2 17c6.667-6 13.333 0 20-6" stroke-width="2.5" opacity="0.6"/>
|
||
|
|
<path d="M2 21c6.667-6 13.333 0 20-6" stroke-width="2"/>
|
||
|
|
<rect x="8" y="4" width="8" height="10" rx="1" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M10 4v10"/>
|
||
|
|
<path d="M14 4v10"/>
|
||
|
|
</svg>`,gradient:"hsl(200 75% 48%)",gradientDark:"hsl(200 75% 38%)"}:t.includes("strand")||t.includes("beach")||t.includes("bad")||t.includes("vatten")||t.includes("sjö")||t.includes("lake")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1" stroke-width="2.5"/>
|
||
|
|
<path d="M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>
|
||
|
|
<path d="M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>
|
||
|
|
</svg>`,gradient:"hsl(195 85% 48%)",gradientDark:"hsl(195 85% 38%)"}:t.includes("stege")||t.includes("ladder")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M8 3v18"/>
|
||
|
|
<path d="M16 3v18"/>
|
||
|
|
<path d="M8 6h8"/>
|
||
|
|
<path d="M8 10h8"/>
|
||
|
|
<path d="M8 14h8"/>
|
||
|
|
<path d="M8 18h8"/>
|
||
|
|
</svg>`,gradient:"hsl(35 75% 52%)",gradientDark:"hsl(35 75% 40%)"}:t.includes("utegym")||t.includes("outdoor gym")||t.includes("gym")||t.includes("träning")||t.includes("fitness")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M6.5 6.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M2 22v-5l4-1v-5l4 2 4-2v5l4 1v5"/>
|
||
|
|
<path d="M6 11V6.5"/>
|
||
|
|
<path d="M18 11V6.5"/>
|
||
|
|
<rect x="15.5" y="2" width="5" height="4" rx="1" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
</svg>`,gradient:"hsl(145 70% 42%)",gradientDark:"hsl(145 70% 32%)"}:t.includes("fotboll")||t.includes("football")||t.includes("soccer")||t.includes("fotbollsplan")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="12" cy="12" r="10" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="M12 2a10 10 0 0 0-7.07 2.93"/>
|
||
|
|
<path d="M12 2a10 10 0 0 1 7.07 2.93"/>
|
||
|
|
<path d="M2 12a10 10 0 0 0 2.93 7.07"/>
|
||
|
|
<path d="M22 12a10 10 0 0 1-2.93 7.07"/>
|
||
|
|
<path d="M12 22a10 10 0 0 1-7.07-2.93"/>
|
||
|
|
<path d="M12 22a10 10 0 0 0 7.07-2.93"/>
|
||
|
|
<polygon points="12,7 15,10 14,14 10,14 9,10" fill="rgba(0,0,0,0.3)" stroke="white"/>
|
||
|
|
</svg>`,gradient:"hsl(120 60% 38%)",gradientDark:"hsl(120 60% 28%)"}:t.includes("tennis")||t.includes("padel")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="10" cy="10" r="7" fill="rgba(200,255,0,0.25)"/>
|
||
|
|
<path d="M10 3a7 7 0 0 0 0 14"/>
|
||
|
|
<path d="M3 10a7 7 0 0 0 14 0"/>
|
||
|
|
<path d="m18 18 3 3"/>
|
||
|
|
<path d="m15 15 2 2"/>
|
||
|
|
</svg>`,gradient:"hsl(75 85% 45%)",gradientDark:"hsl(75 85% 35%)"}:t.includes("basket")||t.includes("basketball")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="12" cy="12" r="10" fill="rgba(255,120,0,0.25)"/>
|
||
|
|
<path d="M12 2v20"/>
|
||
|
|
<path d="M2 12h20"/>
|
||
|
|
<path d="M4.93 4.93c4.08 4.08 10.06 4.08 14.14 0"/>
|
||
|
|
<path d="M4.93 19.07c4.08-4.08 10.06-4.08 14.14 0"/>
|
||
|
|
</svg>`,gradient:"hsl(25 90% 52%)",gradientDark:"hsl(25 90% 40%)"}:t.includes("golf")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M12 18V2l7 4-7 4"/>
|
||
|
|
<path d="M8 22c2.2 0 4-1.8 4-4"/>
|
||
|
|
<circle cx="6" cy="20" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(140 50% 40%)",gradientDark:"hsl(140 50% 30%)"}:t.includes("lekplats")||t.includes("playground")||t.includes("lek")||t.includes("gungor")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M4 22V6l8-4 8 4v16"/>
|
||
|
|
<path d="M4 12h16"/>
|
||
|
|
<path d="M8 12v6"/>
|
||
|
|
<path d="M16 12v6"/>
|
||
|
|
<circle cx="8" cy="20" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
<circle cx="16" cy="20" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(45 90% 52%)",gradientDark:"hsl(45 90% 42%)"}:t.includes("löpar")||t.includes("running")||t.includes("track")||t.includes("bana")||t.includes("sprint")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="17" cy="5" r="3" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="m4 17 4-4 3 3 5-7 4 4"/>
|
||
|
|
<path d="M22 21H2"/>
|
||
|
|
</svg>`,gradient:"hsl(10 80% 55%)",gradientDark:"hsl(10 80% 42%)"}:t.includes("skate")||t.includes("skridskor")||t.includes("skridsko")||t.includes("rink")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M5 20a1 1 0 1 0 2 0 1 1 0 1 0-2 0"/>
|
||
|
|
<path d="M17 20a1 1 0 1 0 2 0 1 1 0 1 0-2 0"/>
|
||
|
|
<path d="M6 20h12"/>
|
||
|
|
<path d="m6 16 2-10h8l2 10"/>
|
||
|
|
<path d="M10 6v4"/>
|
||
|
|
<path d="M14 6v4"/>
|
||
|
|
</svg>`,gradient:"hsl(210 80% 55%)",gradientDark:"hsl(210 80% 42%)"}:t.includes("staty")||t.includes("statue")||t.includes("monument")||t.includes("skulptur")||t.includes("sculpture")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="12" cy="5" r="3" fill="rgba(255,255,255,0.25)"/>
|
||
|
|
<path d="M12 8v6"/>
|
||
|
|
<path d="M8 10l4 4 4-4"/>
|
||
|
|
<path d="M9 14l-2 8"/>
|
||
|
|
<path d="M15 14l2 8"/>
|
||
|
|
<path d="M6 22h12"/>
|
||
|
|
</svg>`,gradient:"hsl(280 50% 55%)",gradientDark:"hsl(280 50% 42%)"}:t.includes("mural")||t.includes("väggmålning")||t.includes("graffiti")||t.includes("gatukonst")||t.includes("street art")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="3" y="3" width="18" height="18" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="M9 3v18"/>
|
||
|
|
<path d="M15 3v18"/>
|
||
|
|
<path d="M3 9h18"/>
|
||
|
|
<path d="M3 15h18"/>
|
||
|
|
<circle cx="12" cy="12" r="2" fill="rgba(255,100,255,0.4)"/>
|
||
|
|
</svg>`,gradient:"hsl(330 70% 55%)",gradientDark:"hsl(330 70% 42%)"}:t.includes("museum")||t.includes("galleri")||t.includes("gallery")||t.includes("utställning")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M3 22h18"/>
|
||
|
|
<path d="M6 22V8l6-4 6 4v14"/>
|
||
|
|
<path d="M12 4v4"/>
|
||
|
|
<path d="M9 10h6"/>
|
||
|
|
<rect x="9" y="14" width="6" height="4" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
</svg>`,gradient:"hsl(35 60% 50%)",gradientDark:"hsl(35 60% 38%)"}:t.includes("kyrka")||t.includes("church")||t.includes("katedral")||t.includes("cathedral")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M12 2v4"/>
|
||
|
|
<path d="M9 4h6"/>
|
||
|
|
<path d="M4 22V10l8-4 8 4v12"/>
|
||
|
|
<path d="M10 22v-6h4v6"/>
|
||
|
|
<circle cx="12" cy="12" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(260 45% 50%)",gradientDark:"hsl(260 45% 38%)"}:t.includes("fontän")||t.includes("fountain")||t.includes("springbrunn")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M12 3v3"/>
|
||
|
|
<path d="M8 6c0-2 4-2 4-2s4 0 4 2"/>
|
||
|
|
<path d="M6 14c0 4 6 6 6 6s6-2 6-6"/>
|
||
|
|
<path d="M12 6c-2 2-2 4-2 6"/>
|
||
|
|
<path d="M12 6c2 2 2 4 2 6"/>
|
||
|
|
<ellipse cx="12" cy="20" rx="8" ry="2" fill="rgba(100,200,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(200 85% 52%)",gradientDark:"hsl(200 85% 40%)"}:t.includes("skylt")||t.includes("sign")||t.includes("tavla")||t.includes("information")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="3" y="4" width="18" height="10" rx="2" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M12 14v8"/>
|
||
|
|
<path d="M8 22h8"/>
|
||
|
|
<path d="M7 8h10"/>
|
||
|
|
<path d="M7 11h6"/>
|
||
|
|
</svg>`,gradient:"hsl(220 75% 52%)",gradientDark:"hsl(220 75% 40%)"}:t.includes("byggnad")||t.includes("building")||t.includes("fasad")||t.includes("facade")||t.includes("hus")||t.includes("house")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="4" y="2" width="16" height="20" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="M9 22v-4h6v4"/>
|
||
|
|
<rect x="7" y="5" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
|
|
<rect x="14" y="5" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
|
|
<rect x="7" y="11" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
|
|
<rect x="14" y="11" width="3" height="3" fill="rgba(255,220,100,0.4)"/>
|
||
|
|
</svg>`,gradient:"hsl(220 40% 50%)",gradientDark:"hsl(220 40% 38%)"}:t.includes("butik")||t.includes("store")||t.includes("shop")||t.includes("affär")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M3 9h18v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9Z" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9"/>
|
||
|
|
<path d="M12 3v6"/>
|
||
|
|
<rect x="8" y="13" width="8" height="6" rx="1" fill="rgba(100,200,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(280 55% 52%)",gradientDark:"hsl(280 55% 40%)"}:t.includes("restaurang")||t.includes("restaurant")||t.includes("mat")||t.includes("food")||t.includes("cafe")||t.includes("kafé")||t.includes("meny")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"/>
|
||
|
|
<path d="M7 2v20"/>
|
||
|
|
<path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"/>
|
||
|
|
<circle cx="7" cy="17" r="2" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
</svg>`,gradient:"hsl(25 85% 52%)",gradientDark:"hsl(25 85% 40%)"}:t.includes("parkering")||t.includes("parking")||t.includes("garage")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="4" y="4" width="16" height="16" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="M9 17V7h4a3 3 0 0 1 0 6H9"/>
|
||
|
|
</svg>`,gradient:"hsl(210 75% 52%)",gradientDark:"hsl(210 75% 40%)"}:t.includes("bil")||t.includes("car")||t.includes("fordon")||t.includes("vehicle")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.5 2.8C1.4 11.3 1 12.1 1 13v3c0 .6.4 1 1 1h2" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<circle cx="7" cy="17" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
<path d="M9 17h6"/>
|
||
|
|
<circle cx="17" cy="17" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
</svg>`,gradient:"hsl(215 70% 52%)",gradientDark:"hsl(215 70% 40%)"}:t.includes("träd")||t.includes("tree")||t.includes("park")||t.includes("natur")||t.includes("nature")||t.includes("skog")||t.includes("forest")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="m17 14-5-8-5 8h3v6h4v-6h3Z" fill="rgba(100,200,100,0.3)"/>
|
||
|
|
<path d="M12 22v-4"/>
|
||
|
|
<path d="m17 8-5-6-5 6"/>
|
||
|
|
</svg>`,gradient:"hsl(140 65% 40%)",gradientDark:"hsl(140 65% 30%)"}:t.includes("blomma")||t.includes("flower")||t.includes("trädgård")||t.includes("garden")||t.includes("rabatt")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M12 7.5a4.5 4.5 0 1 1 4.5 4.5M12 7.5A4.5 4.5 0 1 0 7.5 12M12 7.5V9m-4.5 3a4.5 4.5 0 1 0 4.5 4.5M7.5 12H9m7.5 0a4.5 4.5 0 1 1-4.5 4.5m4.5-4.5H15m-3 4.5V15"/>
|
||
|
|
<circle cx="12" cy="12" r="3" fill="rgba(255,200,100,0.4)"/>
|
||
|
|
<path d="M12 22v-6"/>
|
||
|
|
</svg>`,gradient:"hsl(340 70% 55%)",gradientDark:"hsl(340 70% 42%)"}:t.includes("fågel")||t.includes("bird")||t.includes("djur")||t.includes("animal")||t.includes("wildlife")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M16 7h.01"/>
|
||
|
|
<path d="M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20"/>
|
||
|
|
<path d="m20 7 2 .5-2 .5"/>
|
||
|
|
<path d="M10 18v3"/>
|
||
|
|
<path d="M14 17.75V21"/>
|
||
|
|
<path d="M7 18a6 6 0 0 0 3.84-10.61"/>
|
||
|
|
</svg>`,gradient:"hsl(30 70% 50%)",gradientDark:"hsl(30 70% 38%)"}:t.includes("event")||t.includes("händelse")||t.includes("festival")||t.includes("konsert")||t.includes("marknad")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="3" y="4" width="18" height="18" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="M16 2v4"/>
|
||
|
|
<path d="M8 2v4"/>
|
||
|
|
<path d="M3 10h18"/>
|
||
|
|
<path d="m9 16 2 2 4-4"/>
|
||
|
|
</svg>`,gradient:"hsl(320 75% 52%)",gradientDark:"hsl(320 75% 40%)"}:t.includes("utrymningsväg")||t.includes("emergency exit")||t.includes("nödutgång")||t.includes("utrymning")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="3" y="3" width="18" height="18" rx="2" fill="rgba(0,200,0,0.25)"/>
|
||
|
|
<path d="M9 3v18"/>
|
||
|
|
<path d="m16 8-4 4 4 4"/>
|
||
|
|
<path d="M12 12h6"/>
|
||
|
|
<circle cx="6" cy="8" r="1.5" fill="rgba(255,255,255,0.4)"/>
|
||
|
|
<path d="M5 10v6l2 2"/>
|
||
|
|
<path d="M7 10v4"/>
|
||
|
|
</svg>`,gradient:"hsl(145 80% 38%)",gradientDark:"hsl(145 80% 28%)"}:t.includes("räcke")||t.includes("railing")||t.includes("ledstång")||t.includes("handledare")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M4 6h16"/>
|
||
|
|
<path d="M4 6v12"/>
|
||
|
|
<path d="M10 6v12"/>
|
||
|
|
<path d="M16 6v12"/>
|
||
|
|
<path d="M22 6v12"/>
|
||
|
|
<path d="M4 18h18"/>
|
||
|
|
</svg>`,gradient:"hsl(220 30% 50%)",gradientDark:"hsl(220 30% 38%)"}:t.includes("bro")||t.includes("bridge")||t.includes("viadukt")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M4 10c0-4 4-6 8-6s8 2 8 6" stroke-width="2.5"/>
|
||
|
|
<path d="M4 10v8"/>
|
||
|
|
<path d="M20 10v8"/>
|
||
|
|
<path d="M2 18h20"/>
|
||
|
|
<path d="M8 10v8"/>
|
||
|
|
<path d="M12 10v8"/>
|
||
|
|
<path d="M16 10v8"/>
|
||
|
|
</svg>`,gradient:"hsl(35 50% 45%)",gradientDark:"hsl(35 50% 35%)"}:t.includes("kaj")||t.includes("quay")||t.includes("hamn")||t.includes("harbor")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="2" y="8" width="20" height="6" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M2 14h20"/>
|
||
|
|
<path d="M6 8V4"/>
|
||
|
|
<path d="M18 8V4"/>
|
||
|
|
<circle cx="6" cy="3" r="1" fill="rgba(255,255,255,0.4)"/>
|
||
|
|
<circle cx="18" cy="3" r="1" fill="rgba(255,255,255,0.4)"/>
|
||
|
|
<path d="M2 18c2-2 4-2 6 0s4 2 6 0 4-2 6 0"/>
|
||
|
|
</svg>`,gradient:"hsl(210 60% 45%)",gradientDark:"hsl(210 60% 35%)"}:t.includes("cykelställ")||t.includes("bicycle rack")||t.includes("bike rack")||t.includes("cykelparkering")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="5.5" cy="17.5" r="3.5" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<circle cx="18.5" cy="17.5" r="3.5" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<circle cx="15" cy="5" r="1"/>
|
||
|
|
<path d="M12 17.5V14l-3-3 4-3 2 3h3"/>
|
||
|
|
<path d="m5.5 17.5 5-7"/>
|
||
|
|
<path d="m18.5 17.5-3-8"/>
|
||
|
|
</svg>`,gradient:"hsl(180 60% 42%)",gradientDark:"hsl(180 60% 32%)"}:t.includes("elskåp")||t.includes("teknikskåp")||t.includes("electrical cabinet")||t.includes("kopplingsskåp")||t.includes("transformator")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="4" y="2" width="16" height="20" rx="2" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<path d="M4 10h16"/>
|
||
|
|
<path d="M12 10v12"/>
|
||
|
|
<circle cx="8" cy="6" r="1.5" fill="rgba(255,200,0,0.5)"/>
|
||
|
|
<circle cx="16" cy="6" r="1.5" fill="rgba(100,255,100,0.5)"/>
|
||
|
|
<path d="M9 14l2 3-2 3"/>
|
||
|
|
<path d="M15 14l-2 3 2 3"/>
|
||
|
|
</svg>`,gradient:"hsl(45 80% 45%)",gradientDark:"hsl(45 80% 35%)"}:t.includes("handikappramp")||t.includes("ramp")||t.includes("handicap")||t.includes("tillgänglighet")||t.includes("accessibility")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<circle cx="12" cy="5" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
<path d="M12 7v5"/>
|
||
|
|
<circle cx="9" cy="19" r="2" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<circle cx="17" cy="19" r="2" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M9 17h5l3 2"/>
|
||
|
|
<path d="M9 12h6"/>
|
||
|
|
<path d="M2 20l6-8"/>
|
||
|
|
<path d="M22 20H20"/>
|
||
|
|
</svg>`,gradient:"hsl(210 80% 50%)",gradientDark:"hsl(210 80% 38%)"}:t.includes("brandpost")||t.includes("fire hydrant")||t.includes("hydrant")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="7" y="8" width="10" height="14" rx="2" fill="rgba(255,50,50,0.3)"/>
|
||
|
|
<path d="M9 8V6a3 3 0 0 1 6 0v2"/>
|
||
|
|
<path d="M5 13h2"/>
|
||
|
|
<path d="M17 13h2"/>
|
||
|
|
<circle cx="12" cy="14" r="2" fill="rgba(255,255,255,0.3)"/>
|
||
|
|
<path d="M10 22h4"/>
|
||
|
|
</svg>`,gradient:"hsl(0 80% 50%)",gradientDark:"hsl(0 80% 38%)"}:t.includes("bänk")||t.includes("bench")||t.includes("sittplats")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<rect x="3" y="10" width="18" height="3" rx="1" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
<path d="M5 13v6"/>
|
||
|
|
<path d="M19 13v6"/>
|
||
|
|
<path d="M3 10V8c0-1 1-2 3-2h12c2 0 3 1 3 2v2"/>
|
||
|
|
<path d="M3 19h18"/>
|
||
|
|
</svg>`,gradient:"hsl(25 50% 45%)",gradientDark:"hsl(25 50% 35%)"}:t.includes("papperskorg")||t.includes("soptunna")||t.includes("trash")||t.includes("bin")||t.includes("avfall")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M3 6h18"/>
|
||
|
|
<path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
|
||
|
|
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/>
|
||
|
|
<path d="M10 11v6"/>
|
||
|
|
<path d="M14 11v6"/>
|
||
|
|
</svg>`,gradient:"hsl(100 40% 40%)",gradientDark:"hsl(100 40% 30%)"}:t.includes("belysning")||t.includes("lyktstolpe")||t.includes("street light")||t.includes("lampa")||t.includes("lantern")?{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M12 2v4"/>
|
||
|
|
<path d="M12 22v-6"/>
|
||
|
|
<path d="M8 6h8l-1 8H9L8 6Z" fill="rgba(255,220,100,0.4)"/>
|
||
|
|
<path d="M9 14h6"/>
|
||
|
|
<path d="M5 4l2 2"/>
|
||
|
|
<path d="M19 4l-2 2"/>
|
||
|
|
</svg>`,gradient:"hsl(45 90% 50%)",gradientDark:"hsl(45 90% 38%)"}:{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));">
|
||
|
|
<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z" fill="rgba(255,255,255,0.15)"/>
|
||
|
|
<circle cx="12" cy="13" r="3" fill="rgba(255,255,255,0.2)"/>
|
||
|
|
</svg>`,gradient:"hsl(168 55% 45%)",gradientDark:"hsl(168 55% 35%)"}}function dre(n={}){const{enabled:t=!0,autoNavigate:s=!0}=n,[h,g]=Y.useState(!1),[v,E]=Y.useState(!1),[c,T]=Y.useState("idle"),[L,B]=Y.useState(null),[U,H]=Y.useState(null),X=Y.useRef(null),ae=Y.useRef(null),ne=Y.useCallback(()=>{X.current&&(X.current.pause(),X.current=null,E(!1))},[]),me=Y.useCallback(async(De,He,nt)=>{if(!(!t||De==="idle")){ne(),g(!0),T(De);try{const Xe=await fetch("undefined/functions/v1/voice-guide",{method:"POST",headers:{"Content-Type":"application/json",apikey:void 0,Authorization:"Bearer undefined"},body:JSON.stringify({state:De,missionTitle:He.missionTitle,distanceMeters:He.distanceMeters,targetDescription:He.targetDescription,instructions:He.instructions,criticalElements:He.criticalElements,sponsorReward:He.sponsorReward,sponsorBrand:He.sponsorBrand,camera:He.camera,position:He.position,voiceId:nt})});if(!Xe.ok){if(Xe.status===429){Jo.error("Röstguide tillfälligt otillgänglig, försök igen om en stund");return}if(Xe.status===402){Jo.error("AI-krediter slut");return}throw new Error(`Voice guide request failed: ${Xe.status}`)}const ft=decodeURIComponent(Xe.headers.get("X-Generated-Text")||"");H(ft);const At=await Xe.blob(),Bt=URL.createObjectURL(At),Dt=new Audio(Bt);X.current=Dt,Dt.onplay=()=>E(!0),Dt.onended=()=>{E(!1),B(De),URL.revokeObjectURL(Bt),X.current=null},Dt.onerror=()=>{E(!1),URL.revokeObjectURL(Bt),X.current=null},await Dt.play()}catch(Xe){console.error("Voice guide error:",Xe),Jo.error("Kunde inte spela röstguide")}finally{g(!1)}}},[t,ne]),oe=Y.useCallback((De,He)=>{if(!s||!t)return;const nt=ae.current;ae.current=De;let Xe="navigation";De<=10?Xe="photo":De<=50&&(Xe="positioning");const ft=Xe!==c,At=nt!==null&&c==="navigation"&&Math.abs(De-nt)>100;(ft||At)&&(Xe!==L||At)&&me(Xe,{...He,distanceMeters:De})},[s,t,c,L,me]),re=Y.useCallback(De=>{me("completion",De)},[me]),he=Y.useCallback(De=>{De.sponsorReward&&De.sponsorBrand&&me("sponsor",De)},[me]),_e=Y.useCallback((De,He)=>{me(De,He)},[me]);return Y.useEffect(()=>()=>{ne()},[ne]),{speak:me,stop:ne,updateNavigation:oe,speakCompletion:re,speakSponsorReward:he,triggerState:_e,isLoading:h,isPlaying:v,currentState:c,lastSpokenText:U,enabled:t}}const hre={idle:"Starta röstguide",navigation:"Navigerar...",positioning:"Positionering...",photo:"Fotoinstruktion...",completion:"Slutför...",sponsor:"Belöning..."};function fre({isLoading:n,isPlaying:t,currentState:s,onPlay:h,onStop:g,className:v,showLabel:E=!1}){const c=()=>{t?g():h()};return ue.jsxs(ol,{variant:t?"default":"outline",size:E?"sm":"icon",onClick:c,disabled:n,className:fi("transition-all gap-2",t&&"bg-primary animate-pulse",v),children:[n?ue.jsx(rT,{className:"h-4 w-4 animate-spin"}):t?ue.jsx(PW,{className:"h-4 w-4"}):ue.jsx(MW,{className:"h-4 w-4"}),E&&ue.jsx("span",{className:"text-xs",children:n?"Laddar...":t?hre[s]:"Röstguide"})]})}function pre(){const{t:n}=nm(),[t,s]=Y.useState({heading:null,accuracy:null,error:null,supported:!1,permissionGranted:!1}),h=Y.useCallback(async()=>{if(typeof DeviceOrientationEvent.requestPermission=="function")try{return await DeviceOrientationEvent.requestPermission()==="granted"?(s(v=>({...v,permissionGranted:!0,error:null})),!0):(s(v=>({...v,error:n("compass.permissionDenied"),permissionGranted:!1})),!1)}catch{return s(v=>({...v,error:n("compass.couldNotRequest")})),!1}return s(g=>({...g,permissionGranted:!0})),!0},[n]);return Y.useEffect(()=>{const g="DeviceOrientationEvent"in window;if(s(c=>({...c,supported:g})),!g){s(c=>({...c,error:n("compass.notSupported")}));return}const v=c=>{let T=null;"webkitCompassHeading"in c&&typeof c.webkitCompassHeading=="number"?T=c.webkitCompassHeading:(c.alpha!==null&&c.absolute||c.alpha!==null)&&(T=360-c.alpha),T!==null&&(T=(T%360+360)%360,s(L=>({...L,heading:T,accuracy:c.webkitCompassAccuracy??null,error:null,permissionGranted:!0})))};return(async()=>{typeof DeviceOrientationEvent.requestPermission=="function"?s(c=>({...c,permissionGranted:!1})):(window.addEventListener("deviceorientation",v,!0),s(c=>({...c,permissionGranted:!0})))})
|
||
|
|
<div class="relative cursor-pointer transform transition-all duration-200 hover:scale-110 hover:-translate-y-0.5">
|
||
|
|
<div class="w-14 h-14 rounded-2xl flex items-center justify-center shadow-[0_6px_24px_rgba(0,0,0,0.5)] border-[3px] border-white overflow-hidden" style="background: white;">
|
||
|
|
<img
|
||
|
|
src="${Ct.sponsor.logoUrl}"
|
||
|
|
alt="${Ct.sponsor.brandName}"
|
||
|
|
class="w-full h-full object-contain p-1.5"
|
||
|
|
onerror="this.style.display='none'; this.parentElement.style.background='linear-gradient(145deg, ${qr}, ${qr}dd)'; this.parentElement.innerHTML='<span style=\\'font-size:20px;font-weight:bold;color:white;\\'>${Ct.sponsor.brandName.charAt(0)}</span>';"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
<div class="absolute -bottom-2.5 left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[8px] border-r-[8px] border-t-[11px] border-l-transparent border-r-transparent border-t-white" style="filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));"></div>
|
||
|
|
<div class="absolute -top-1.5 -right-1.5 text-white text-[10px] font-bold rounded-lg px-2 h-[22px] flex items-center justify-center shadow-[0_2px_8px_rgba(0,0,0,0.35)] whitespace-nowrap" style="background: linear-gradient(145deg, ${qr}, ${qr}cc); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
|
|
${Ct.reward_credits} krediter
|
||
|
|
</div>
|
||
|
|
<div class="absolute -bottom-6 left-1/2 transform -translate-x-1/2 text-[9px] font-semibold text-white bg-black/60 px-2 py-0.5 rounded-full whitespace-nowrap backdrop-blur-sm">
|
||
|
|
${Ct.sponsor.brandName}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
`}else{const qr=ure(Ct.title);sn.innerHTML=`
|
||
|
|
<div class="relative cursor-pointer transform transition-all duration-200 hover:scale-110 hover:-translate-y-0.5">
|
||
|
|
<div class="w-12 h-12 rounded-xl flex items-center justify-center shadow-[0_4px_20px_rgba(0,0,0,0.4)] border-[2.5px] border-white/90" style="background: linear-gradient(145deg, ${qr.gradient} 0%, ${qr.gradientDark} 100%);">
|
||
|
|
${qr.svg}
|
||
|
|
</div>
|
||
|
|
<div class="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[7px] border-r-[7px] border-t-[10px] border-l-transparent border-r-transparent" style="border-top-color: ${qr.gradientDark}; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));"></div>
|
||
|
|
<div class="absolute -top-1.5 -right-1.5 text-white text-[10px] font-bold rounded-lg px-2 h-[22px] flex items-center justify-center shadow-[0_2px_8px_rgba(0,0,0,0.35)] whitespace-nowrap" style="background: linear-gradient(145deg, hsl(18 55% 55%) 0%, hsl(18 55% 45%) 100%); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
|
|
${Ct.reward_credits} krediter
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
`}if(sn.addEventListener("click",()=>{var qr;ft.current&&(kt(Ct),(qr=_e.current)==null||qr.flyTo({center:[Ct.longitude,Ct.latitude],zoom:15,pitch:60}))}),!_e.current||!ft.current)return;const jn=new rd.Marker(sn).setLngLat([Ct.longitude,Ct.latitude]).addTo(_e.current);De.current.push(jn)}),n.length>1&&!It&&!g&&!Ni.current&&!wo.current&&_e.current&&ft.current)try{wo.current=!0;const Ct=new rd.LngLatBounds;n.forEach(sn=>Ct.extend([sn.longitude,sn.latitude])),t&&Ct.extend([t.longitude,t.latitude]),_e.current.fitBounds(Ct,{padding:80,maxZoom:14,pitch:P0})}catch{}}},[n,zt]),Y.useEffect(()=>{if(!_e.current||!zt||!ft.current||!t)return;nt.current&&(nt.current.remove(),nt.current=null);const Ct=document.createElement("div");Ct.className="user-location-marker",Ct.innerHTML=`
|
||
|
|
<div class="relative flex items-center justify-center">
|
||
|
|
<!-- Outer pulsing glow ring (like Google Maps accuracy circle) -->
|
||
|
|
<div class="absolute w-24 h-24 rounded-full animate-ping" style="background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, rgba(59, 130, 246, 0) 70%); animation-duration: 2s;"></div>
|
||
|
|
|
||
|
|
<!-- Medium spotlight ring -->
|
||
|
|
<div class="absolute w-16 h-16 rounded-full" style="background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0) 70%); animation: user-pulse 3s ease-in-out infinite;"></div>
|
||
|
|
|
||
|
|
<!-- Inner glow -->
|
||
|
|
<div class="absolute w-10 h-10 rounded-full" style="background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, rgba(59, 130, 246, 0.1) 50%, transparent 70%);"></div>
|
||
|
|
|
||
|
|
<!-- User dot with sharp border -->
|
||
|
|
<div class="relative w-5 h-5 rounded-full shadow-[0_0_12px_rgba(59,130,246,0.8),0_2px_6px_rgba(0,0,0,0.4)]" style="background: linear-gradient(145deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%); border: 3px solid white;">
|
||
|
|
<!-- Inner bright spot for 3D effect -->
|
||
|
|
<div class="absolute top-0.5 left-0.5 w-1.5 h-1.5 rounded-full bg-white/60"></div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Direction indicator arrow (optional - shows heading) -->
|
||
|
|
<div class="absolute -top-3 w-0 h-0 border-l-[5px] border-r-[5px] border-b-[8px] border-l-transparent border-r-transparent border-b-blue-500" style="filter: drop-shadow(0 -1px 2px rgba(0,0,0,0.3)); opacity: 0.9;"></div>
|
||
|
|
</div>
|
||
|
|
`,nt.current=new rd.Marker({element:Ct,anchor:"center"}).setLngLat([t.longitude,t.latitude]).addTo(_e.current)},[t,zt]),Y.useEffect(()=>{if(!(!_e.current||!zt||!ft.current)){try{He.current.forEach(Ct=>Ct.remove())}catch{}He.current=[],re.forEach(Ct=>{const sn=document.createElement("div");sn.className="beauty-mission-marker";const pn=Ct.type==="sponsored",jn=pn&&Ct.sponsorEmoji?`<span style="font-size: 16px;">${Ct.sponsorEmoji}</span>`:`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||
|
|
<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>
|
||
|
|
</svg>`,Fn=Ct.themeColor;if(sn.innerHTML=`
|
||
|
|
<div class="relative cursor-pointer transform transition-all duration-200 hover:scale-110 hover:-translate-y-0.5">
|
||
|
|
<div class="w-12 h-12 rounded-xl flex items-center justify-center shadow-[0_4px_20px_rgba(0,0,0,0.4)] border-[2.5px] border-white/90" style="background: linear-gradient(145deg, ${Fn}, ${Fn}dd);">
|
||
|
|
${jn}
|
||
|
|
</div>
|
||
|
|
<div class="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[7px] border-r-[7px] border-t-[10px] border-l-transparent border-r-transparent" style="border-top-color: ${Fn}; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));"></div>
|
||
|
|
<div class="absolute -top-1.5 -right-1.5 text-white text-[10px] font-bold rounded-lg px-2 h-[22px] flex items-center justify-center shadow-[0_2px_8px_rgba(0,0,0,0.35)] whitespace-nowrap" style="background: linear-gradient(145deg, ${Fn}, ${Fn}cc); border: 1.5px solid rgba(255,255,255,0.3);">
|
||
|
|
${Ct.reward} krediter
|
||
|
|
</div>
|
||
|
|
${pn&&Ct.sponsor?`
|
||
|
|
<div class="absolute -bottom-6 left-1/2 transform -translate-x-1/2 text-[9px] font-semibold text-white px-2 py-0.5 rounded-md whitespace-nowrap shadow-[0_2px_8px_rgba(0,0,0,0.3)]" style="background: ${Fn}; border: 1px solid rgba(255,255,255,0.2);">
|
||
|
|
${Ct.sponsor}
|
||
|
|
</div>
|
||
|
|
`:""}
|
||
|
|
</div>
|
||
|
|
`,sn.addEventListener("click",()=>{var qr;ft.current&&(Zt(Ct),kt(null),(qr=_e.current)==null||qr.flyTo({center:[Ct.longitude,Ct.latitude],zoom:15,pitch:60}))}),!_e.current||!ft.current)return;const hr=new rd.Marker(sn).setLngLat([Ct.longitude,Ct.latitude]).addTo(_e.current);He.current.push(hr)})}},[re,zt]);const vs=()=>{var Ct,sn,pn;try{De.current.forEach(jn=>jn.remove()),De.current=[],He.current.forEach(jn=>jn.remove()),He.current=[],(Ct=nt.current)==null||Ct.remove(),nt.current=null,(sn=Xe.current)==null||sn.disconnect(),Xe.current=null,(pn=_e.current)==null||pn.remove(),_e.current=null}catch{}Pt(null),vt(!1),kt(null),Zt(null),bn(jn=>jn+1)};return ue.jsxs("div",{ref:X,className:"relative w-full h-full",children:[ue.jsx("div",{ref:he,className:"absolute inset-0"}),Tn&&ue.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 flex items-center justify-center",children:ue.jsxs("div",{className:"relative",children:[ue.jsx("div",{className:"absolute inset-0 w-32 h-32 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/20 animate-ping"}),ue.jsx("div",{className:"absolute w-24 h-24 -translate-x-1/2 -translate-y-1/2 rounded-full border-4 border-primary/50",style:{animation:"pulse 1.5s ease-in-out infinite"}}),ue.jsx("div",{className:"absolute w-12 h-12 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 backdrop-blur-sm flex items-center justify-center",children:ue.jsx(VF,{className:"w-6 h-6 text-primary animate-bounce"})})]})}),!zt&&!pt&&ue.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/40 backdrop-blur-sm",children:ue.jsx("div",{className:"text-sm text-muted-foreground",children:ae("map.loadingMap")})}),pt&&ue.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/40 backdrop-blur-sm p-6",children:ue.jsxs("div",{className:"text-center text-muted-foreground max-w-sm bg-card/90 border border-border rounded-lg p-4 shadow-lg",children:[ue.jsx(iT,{className:"w-10 h-10 mx-auto mb-2 opacity-60"}),ue.jsx("p",{className:"text-sm leading-relaxed",children:pt}),ue.jsx(ol,{onClick:vs,className:"mt-3",variant:"outline",children:ae("map.reloadMap")})]})}),ue.jsxs("div",{className:"absolute left-3 z-20 flex items-center gap-2",style:{top:"calc(env(safe-area-inset-top, 0px) + 12px)"},children:[ue.jsx("div",{className:"bg-background/80 backdrop-blur-sm rounded-lg p-1.5 shadow-md border border-border/50",children:ue.jsx(AU,{})}),ue.jsxs("button",{onClick:()=>{const Ct=_e.current;!Ct||!zt||(Ar?(rB(Ct),pi(!1)):(nB(Ct)?(Tr(!1),Ct.easeTo({pitch:P0,bearing:D0,duration:800})):Tr(!0),pi(!0)))},disabled:!zt,className:"bg-background/80 backdrop-blur-sm rounded-lg px-3 py-1.5 shadow-md border border-border/50 text-xs font-medium text-foreground hover:bg-accent transition-colors disabled:opacity-50",children:[Or?"3D":"2D",zo&&ue.jsx("span",{className:"ml-1 text-muted-foreground",children:"(auto)"})]}),v&&t&&ue.jsxs("button",{onClick:()=>{var jn;const Ct=v.geometry.coordinates,sn=Ct.length>1?Ct[1]:Ct[0],pn=xA(t.latitude,t.longitude,sn[1],sn[0]);(jn=_e.current)==null||jn.flyTo({center:[t.longitude,t.latitude],zoom:17,pitch:52,bearing:pn,duration:700})},className:"bg-primary text-primary-foreground rounded-lg px-3 py-1.5 shadow-md text-xs font-medium hover:bg-primary/90 transition-colors flex items-center gap-1.5",children:[ue.jsx(xW,{className:"w-4 h-4"}),ae("map.centerOnMe")]})]}),L&&ue.jsxs("div",{className:"absolute bottom-32 left-4 right-4 z-40 space-y-3 animate-fade-in",children:[ue.jsxs("div",{className:"flex justify-center gap-2",children:[ue.jsx("button",{onClick:()=>Mn("walking"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${Vn==="walking"?"bg-primary text-primary-foreground scale-110":"bg-card/95 text-muted-foreground hover:bg-card border border-border"}`,children:ue.jsx(NF,{className:"w-6 h-6"})}),ue.jsx("button",{onClick:()=>Mn("cycling"),className:`w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg transition-all duration-200 ${Vn==="cycling"?"bg-primary text-p
|
||
|
|
.mission-marker,
|
||
|
|
.beauty-mission-marker,
|
||
|
|
.user-location-marker {
|
||
|
|
cursor: pointer;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* User location pulse animation */
|
||
|
|
@keyframes user-pulse {
|
||
|
|
0%, 100% {
|
||
|
|
transform: scale(1);
|
||
|
|
opacity: 0.6;
|
||
|
|
}
|
||
|
|
50% {
|
||
|
|
transform: scale(1.15);
|
||
|
|
opacity: 0.3;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/* User location outer glow animation */
|
||
|
|
@keyframes user-glow {
|
||
|
|
0%, 100% {
|
||
|
|
opacity: 0.4;
|
||
|
|
transform: scale(0.95);
|
||
|
|
}
|
||
|
|
50% {
|
||
|
|
opacity: 0.2;
|
||
|
|
transform: scale(1.1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.user-location-marker > div > div:first-child {
|
||
|
|
animation: user-glow 2.5s ease-in-out infinite !important;
|
||
|
|
}
|
||
|
|
|
||
|
|
.mapboxgl-ctrl-group {
|
||
|
|
background: hsl(var(--card)) !important;
|
||
|
|
border: 1px solid hsl(var(--border)) !important;
|
||
|
|
}
|
||
|
|
.mapboxgl-ctrl-group button {
|
||
|
|
background-color: transparent !important;
|
||
|
|
}
|
||
|
|
.mapboxgl-ctrl-group button:hover {
|
||
|
|
background-color: hsl(var(--muted)) !important;
|
||
|
|
}
|
||
|
|
.mapboxgl-ctrl-group button span {
|
||
|
|
filter: invert(1);
|
||
|
|
}
|
||
|
|
.mapboxgl-ctrl-logo {
|
||
|
|
display: none !important;
|
||
|
|
}
|
||
|
|
.mapboxgl-ctrl-attrib {
|
||
|
|
display: none !important;
|
||
|
|
}
|
||
|
|
.mapboxgl-ctrl-scale {
|
||
|
|
display: none !important;
|
||
|
|
}
|
||
|
|
`})]})});PU.displayName="MissionMap";const nS="https://api.quixzoom.com/api/qz",yh="qz_token",$p={signUp:async(n,t,s)=>{try{const g=await(await fetch(`${nS}/auth/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:t,name:s,role:"zoomer"})})).json();return g.token&&localStorage.setItem(yh,g.token),g}catch{return{error:"Network error",code:"NETWORK_ERROR"}}},signIn:async(n,t)=>{try{const h=await(await fetch(`${nS}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:t})})).json();return h.token&&localStorage.setItem(yh,h.token),h}catch{return{error:"Network error",code:"NETWORK_ERROR"}}},signOut:async()=>{const n=localStorage.getItem(yh);if(n){try{await fetch(`${nS}/auth/logout`,{method:"POST",headers:{Authorization:`Bearer ${n}`}})}catch{}localStorage.removeItem(yh)}},getToken:()=>localStorage.getItem(yh),getUser:async()=>{const n=localStorage.getItem(yh);if(!n)return null;try{const t=await fetch(`${nS}/auth/me`,{headers:{Authorization:`Bearer ${n}`}});return t.ok?(await t.json()).user??null:(localStorage.removeItem(yh),null)}catch{return null}},isAuthenticated:()=>{const n=localStorage.getItem(yh);if(!n)return!1;try{return(JSON.parse(atob(n.split(".")[1])).exp??0)>Math.floor(Date.now()/1e3)}catch{return!1}}},bA="https://api.quixzoom.com/api/qz",Tre=3e4;function Ere(){const{user:n}=tm(),[t,s]=Y.useState([]),[h,g]=Y.useState(0),[v,E]=Y.useState(!0),c=Y.useRef(null),T=Y.useCallback(async()=>{if(!n){E(!1);return}const U=$p.getToken();if(!U){E(!1);return}try{const H=await fetch(`${bA}/notifications?limit=50`,{headers:{Authorization:`Bearer ${U}`}});if(H.ok){const X=await H.json();s(Array.isArray(X.notifications)?X.notifications:[]),g(X.unread??0)}else H.status===404?(s([]),g(0)):console.error("[useNotifications] fetch error:",H.status)}catch(H){console.error("[useNotifications] network error:",H)}finally{E(!1)}},[n]);return Y.useEffect(()=>(T(),c.current=setInterval(T,Tre),()=>{c.current&&clearInterval(c.current)}),[T]),{notifications:t,unreadCount:h,isLoading:v,markAsRead:async U=>{const H=$p.getToken();if(H)try{(await fetch(`${bA}/notifications/${encodeURIComponent(U)}`,{method:"PATCH",headers:{Authorization:`Bearer ${H}`}})).ok&&(s(ae=>ae.map(ne=>ne.id===U?{...ne,read:!0}:ne)),g(ae=>Math.max(0,ae-1)))}catch(X){console.error("[useNotifications] markAsRead error:",X)}},markAllAsRead:async()=>{if(!n)return;const U=$p.getToken();if(U)try{(await fetch(`${bA}/notifications/read-all`,{method:"PATCH",headers:{Authorization:`Bearer ${U}`}})).ok&&(s(X=>X.map(ae=>({...ae,read:!0}))),g(0))}catch(H){console.error("[useNotifications] markAllAsRead error:",H)}}}}const kre=()=>{const{user:n}=tm(),[t,s]=Y.useState(null),[h,g]=Y.useState(!0),[v,E]=Y.useState(null),c=Y.useRef(!1),T=Y.useCallback(async()=>{var ae,ne,me;if(!n){s(null),g(!1);return}try{g(!0),E(null);const oe=await IU(`/orderer-profiles?user_id=${n.id}`);s(oe)}catch(oe){((oe==null?void 0:oe.status)||((ne=(ae=oe==null?void 0:oe.message)==null?void 0:ae.match(/API error: (\d+)/))==null?void 0:ne[1]))==="404"||(me=oe==null?void 0:oe.message)!=null&&me.includes("404")?s(null):(console.error("Error fetching orderer profile:",oe),E("Kunde inte hämta beställarprofil"))}finally{g(!1)}},[n]);Y.useEffect(()=>{c.current||(c.current=!0,T())},[T]);const L=async ae=>{if(!n)return{error:"Inte inloggad"};try{const ne=await mI("/orderer-profiles",{user_id:n.id,...ae});return s(ne),{data:ne,error:null}}catch(ne){return console.error("Error creating orderer profile:",ne),ne.code==="23505"?{error:"En beställarprofil finns redan för detta konto eller organisationsnummer"}:{error:"Kunde inte skapa beställarprofil"}}},B=async ae=>{if(!n||!t)return{error:"Ingen beställarprofil att uppdatera"};try{const ne=await ore(`/orderer-profiles/${t.id}`,ae);return s(ne),{data:ne,error:null}}catch(ne){return console.error("Error updating orderer profile:",ne),{error:"Kunde inte uppdatera beställarprofil"}}},U=(t==null?void 0:t.status)==="active",H=(t==null?void 0:t.status)==="pending",X=U&&(
|
||
|
|
.`.concat(Ure,` {
|
||
|
|
overflow: hidden `).concat(h,`;
|
||
|
|
padding-right: `).concat(c,"px ").concat(h,`;
|
||
|
|
}
|
||
|
|
body[`).concat(h_,`] {
|
||
|
|
overflow: hidden `).concat(h,`;
|
||
|
|
overscroll-behavior: contain;
|
||
|
|
`).concat([t&&"position: relative ".concat(h,";"),s==="margin"&&`
|
||
|
|
padding-left: `.concat(g,`px;
|
||
|
|
padding-top: `).concat(v,`px;
|
||
|
|
padding-right: `).concat(E,`px;
|
||
|
|
margin-left:0;
|
||
|
|
margin-top:0;
|
||
|
|
margin-right: `).concat(c,"px ").concat(h,`;
|
||
|
|
`),s==="padding"&&"padding-right: ".concat(c,"px ").concat(h,";")].filter(Boolean).join(""),`
|
||
|
|
}
|
||
|
|
|
||
|
|
.`).concat(IS,` {
|
||
|
|
right: `).concat(c,"px ").concat(h,`;
|
||
|
|
}
|
||
|
|
|
||
|
|
.`).concat(MS,` {
|
||
|
|
margin-right: `).concat(c,"px ").concat(h,`;
|
||
|
|
}
|
||
|
|
|
||
|
|
.`).concat(IS," .").concat(IS,` {
|
||
|
|
right: 0 `).concat(h,`;
|
||
|
|
}
|
||
|
|
|
||
|
|
.`).concat(MS," .").concat(MS,` {
|
||
|
|
margin-right: 0 `).concat(h,`;
|
||
|
|
}
|
||
|
|
|
||
|
|
body[`).concat(h_,`] {
|
||
|
|
`).concat(Gre,": ").concat(c,`px;
|
||
|
|
}
|
||
|
|
`)},hB=function(){var n=parseInt(document.body.getAttribute(h_)||"0",10);return isFinite(n)?n:0},lie=function(){Y.useEffect(function(){return document.body.setAttribute(h_,(hB()+1).toString()),function(){var n=hB()-1;n<=0?document.body.removeAttribute(h_):document.body.setAttribute(h_,n.toString())}},[])},cie=function(n){var t=n.noRelative,s=n.noImportant,h=n.gapMode,g=h===void 0?"margin":h;lie();var v=Y.useMemo(function(){return oie(g)},[g]);return Y.createElement(sie,{styles:aie(v,!t,g,s?"":"!important")})},_I=!1;if(typeof window<"u")try{var iS=Object.defineProperty({},"passive",{get:function(){return _I=!0,!0}});window.addEventListener("test",iS,iS),window.removeEventListener("test",iS,iS)}catch{_I=!1}var Dg=_I?{passive:!1}:!1,uie=function(n){return n.tagName==="TEXTAREA"},VU=function(n,t){if(!(n instanceof Element))return!1;var s=window.getComputedStyle(n);return s[t]!=="hidden"&&!(s.overflowY===s.overflowX&&!uie(n)&&s[t]==="visible")},die=function(n){return VU(n,"overflowY")},hie=function(n){return VU(n,"overflowX")},fB=function(n,t){var s=t.ownerDocument,h=t;do{typeof ShadowRoot<"u"&&h instanceof ShadowRoot&&(h=h.host);var g=jU(n,h);if(g){var v=UU(n,h),E=v[1],c=v[2];if(E>c)return!0}h=h.parentNode}while(h&&h!==s.body);return!1},fie=function(n){var t=n.scrollTop,s=n.scrollHeight,h=n.clientHeight;return[t,s,h]},pie=function(n){var t=n.scrollLeft,s=n.scrollWidth,h=n.clientWidth;return[t,s,h]},jU=function(n,t){return n==="v"?die(t):hie(t)},UU=function(n,t){return n==="v"?fie(t):pie(t)},mie=function(n,t){return n==="h"&&t==="rtl"?-1:1},gie=function(n,t,s,h,g){var v=mie(n,window.getComputedStyle(t).direction),E=v*h,c=s.target,T=t.contains(c),L=!1,B=E>0,U=0,H=0;do{if(!c)break;var X=UU(n,c),ae=X[0],ne=X[1],me=X[2],oe=ne-me-v*ae;(ae||oe)&&jU(n,c)&&(U+=oe,H+=ae);var re=c.parentNode;c=re&&re.nodeType===Node.DOCUMENT_FRAGMENT_NODE?re.host:re}while(!T&&c!==document.body||T&&(t.contains(c)||t===c));return(B&&Math.abs(U)<1||!B&&Math.abs(H)<1)&&(L=!0),L},oS=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},pB=function(n){return[n.deltaX,n.deltaY]},mB=function(n){return n&&"current"in n?n.current:n},_ie=function(n,t){return n[0]===t[0]&&n[1]===t[1]},yie=function(n){return`
|
||
|
|
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
||
|
|
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
||
|
|
`)},vie=0,Rg=[];function xie(n){var t=Y.useRef([]),s=Y.useRef([0,0]),h=Y.useRef(),g=Y.useState(vie++)[0],v=Y.useState(NU)[0],E=Y.useRef(n);Y.useEffect(function(){E.current=n},[n]),Y.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(g));var ne=jre([n.lockRef.current],(n.shards||[]).map(mB),!0).filter(Boolean);return ne.forEach(function(me){return me.classList.add("allow-interactivity-".concat(g))}),function(){document.body.classList.remove("block-interactivity-".concat(g)),ne.forEach(function(me){return me.classList.remove("allow-interactivity-".concat(g))})}}},[n.inert,n.lockRef.current,n.shards]);var c=Y.useCallback(function(ne,me){if("touches"in ne&&ne.touches.length===2||ne.type==="wheel"&&ne.ctrlKey)return!E.current.allowPinchZoom;var oe=oS(ne),re=s.current,he="deltaX"in ne?ne.deltaX:re[0]-oe[0],_e="deltaY"in ne?ne.deltaY:re[1]-oe[1],De,He=ne.target,nt=Math.abs(he)>Math.abs(_e)?"h":"v";if("touches"in ne&&nt==="h"&&He.type==="range")return!1;var Xe=window.getSelection(),ft=Xe&&Xe.anchorNode,At=ft?ft===He||ft.contains(He):!1;if(At)return!1;var Bt=fB(nt,He);if(!Bt)return!0;if(Bt?De=nt:(De=nt==="v"?"h":"v",Bt=fB(nt,He)),!Bt)return!1;if(!h.current&&"changedTouches"in ne&&(he||_e)&&(h.current=De),!De)return!0;var Dt=h.current||De;return gie(Dt,me,ne,Dt==="h"?he:_e)},[]),T=Y.useCallback(function(ne){var me=ne;if(!(!Rg.length||Rg[Rg.length-1]!==v)){var oe="deltaY"in me?pB(me):oS(me),re=t.current.filter(function(De){return De.name===me.type&&(De.target===me.target||me.target===De.shadowParent)&&_ie(De.delta,oe)})[0];if(re&&re.should){me.cancelable&&me.preventDefault();return}if(!re){var he=(E.current.shards||[]).map(mB).filter(Boolean).filter(function(De){return De.contains(me.target)}),_e=he.length>0?c(me,he[0]):!E.current.noIsolation;_e&&me.cancelable&&me.preventDefault()}}},[]),L=Y.useCallback(function(ne,me,oe,re){var he={name:ne,delta:me,target:oe,should:re,shadowParent:bie(oe)};t.current.push(he),setTimeout(function(){t.current=t.current.filter(function(_e){return _e!==he})},1)},[]),B=Y.useCallback(function(ne){s.current=oS(ne),h.current=void 0},[]),U=Y.useCallback(function(ne){L(ne.type,pB(ne),ne.target,c(ne,n.lockRef.current))},[]),H=Y.useCallback(function(ne){L(ne.type,oS(ne),ne.target,c(ne,n.lockRef.current))},[]);Y.useEffect(function(){return Rg.push(v),n.setCallbacks({onScrollCapture:U,onWheelCapture:U,onTouchMoveCapture:H}),document.addEventListener("wheel",T,Dg),document.addEventListener("touchmove",T,Dg),document.addEventListener("touchstart",B,Dg),function(){Rg=Rg.filter(function(ne){return ne!==v}),document.removeEventListener("wheel",T,Dg),document.removeEventListener("touchmove",T,Dg),document.removeEventListener("touchstart",B,Dg)}},[]);var X=n.removeScrollBar,ae=n.inert;return Y.createElement(Y.Fragment,null,ae?Y.createElement(v,{styles:yie(g)}):null,X?Y.createElement(cie,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function bie(n){for(var t=null;n!==null;)n instanceof ShadowRoot&&(t=n.host,n=n.host),n=n.parentNode;return t}const wie=Kre(BU,xie);var GU=Y.forwardRef(function(n,t){return Y.createElement(u2,fu({},n,{ref:t,sideCar:wie}))});GU.classNames=u2.classNames;var Sie=function(n){if(typeof document>"u")return null;var t=Array.isArray(n)?n[0]:n;return t.ownerDocument.body},Lg=new WeakMap,sS=new WeakMap,aS={},AA=0,$U=function(n){return n&&(n.host||$U(n.parentNode))},Tie=function(n,t){return t.map(function(s){if(n.contains(s))return s;var h=$U(s);return h&&n.contains(h)?h:(console.error("aria-hidden",s,"in not contained inside",n,". Doing nothing"),null)}).filter(function(s){return!!s})},Eie=function(n,t,s,h){var g=Tie(t,Array.isArray(n)?n:[n]);aS[s]||(aS[s]=new WeakMap);var v=aS[s],E=[],c=new Set,T=new Set(g),L=function(U){!U||c.has(U)||(c.add(U),L(U.parentNode))};g.forEach(L);var B=function(U){!U||T.has(U)||Array.prototype.forEach.call(U.children,function(H){if(c.has(H))B(H);else try{var X=H.getAttribute(h),ae=X!==null&&X!=="false",ne=(Lg.get(H)||0)+1,me=(v.get(H)||0)+1;Lg.set(H,ne),v.set(H,me),E.push(H),ne===1&&ae&&sS.set(H,!0),me===1&&H.setAttribute(s,"t
|
||
|
|
//# sourceMappingURL=index-CZD3_4lD.js.map
|