chunk-H3QCF24A.js 201 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653
  1. import {
  2. a,
  3. p,
  4. s as s4,
  5. s2 as s5
  6. } from "./chunk-YJKEIUMW.js";
  7. import {
  8. e as e2,
  9. e2 as e3
  10. } from "./chunk-JH3PLIM6.js";
  11. import {
  12. e
  13. } from "./chunk-FCDUTNBY.js";
  14. import {
  15. M as M4
  16. } from "./chunk-LL6JU3GU.js";
  17. import {
  18. C as C3,
  19. N as N2,
  20. P as P2,
  21. U as U2,
  22. Z as Z2,
  23. w as w2
  24. } from "./chunk-ZIWBDWEW.js";
  25. import {
  26. ge
  27. } from "./chunk-Q4LKAPDF.js";
  28. import {
  29. M as M3,
  30. w
  31. } from "./chunk-TODU7HVH.js";
  32. import {
  33. E as E3,
  34. I as I2,
  35. S
  36. } from "./chunk-23ONSYIH.js";
  37. import {
  38. l as l3,
  39. n as n3,
  40. r as r5
  41. } from "./chunk-3T4BXU2T.js";
  42. import {
  43. l as l2
  44. } from "./chunk-EE6TL7XD.js";
  45. import {
  46. D as D4,
  47. c as c3,
  48. f as f2,
  49. r as r4
  50. } from "./chunk-GDB2KX4Y.js";
  51. import {
  52. u
  53. } from "./chunk-546QCRS4.js";
  54. import {
  55. x
  56. } from "./chunk-773XI6MQ.js";
  57. import {
  58. $,
  59. A,
  60. B as B2,
  61. C as C2,
  62. D as D3,
  63. E as E2,
  64. F as F2,
  65. G as G2,
  66. K,
  67. L as L2,
  68. Z,
  69. _ as _2,
  70. at,
  71. o as o2
  72. } from "./chunk-WFSV2B2I.js";
  73. import {
  74. t as t4
  75. } from "./chunk-J525NRN3.js";
  76. import {
  77. B,
  78. C,
  79. D as D2,
  80. E,
  81. F,
  82. G,
  83. I,
  84. L,
  85. M,
  86. N,
  87. O,
  88. P,
  89. R,
  90. U,
  91. V,
  92. Y,
  93. _,
  94. o
  95. } from "./chunk-MI7HWWFL.js";
  96. import {
  97. e as e4
  98. } from "./chunk-ZHRMTKME.js";
  99. import {
  100. n,
  101. t as t5
  102. } from "./chunk-MFFE4I2S.js";
  103. import {
  104. o as o3
  105. } from "./chunk-LGW7TID4.js";
  106. import {
  107. f,
  108. n as n2
  109. } from "./chunk-G5AI6ZNE.js";
  110. import {
  111. D,
  112. H
  113. } from "./chunk-FYNVVMWY.js";
  114. import {
  115. t as t3
  116. } from "./chunk-HBMVUVZX.js";
  117. import {
  118. M as M2,
  119. b,
  120. h,
  121. i,
  122. r as r3
  123. } from "./chunk-CRGVDJI6.js";
  124. import {
  125. r as r2
  126. } from "./chunk-6P6NA7JB.js";
  127. import {
  128. l
  129. } from "./chunk-YIS6BAC3.js";
  130. import {
  131. c as c2
  132. } from "./chunk-XNLG7T2T.js";
  133. import {
  134. s as s2,
  135. s3
  136. } from "./chunk-EMJ4ZSM2.js";
  137. import {
  138. c,
  139. r,
  140. s,
  141. t,
  142. t2
  143. } from "./chunk-GZT4BVFP.js";
  144. // node_modules/@arcgis/core/views/2d/engine/webgl/DefaultVertexAttributeLayouts.js
  145. var r6 = { geometry: [new t4("a_pos", 2, C.BYTE, 0, 2)] };
  146. var t6 = { geometry: [new t4("a_pos", 2, C.BYTE, 0, 4), new t4("a_tex", 2, C.BYTE, 2, 4)] };
  147. var m = { geometry: [new t4("a_pos", 2, C.UNSIGNED_SHORT, 0, 4)] };
  148. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrush.js
  149. var a2 = class {
  150. constructor() {
  151. this.name = this.constructor.name || "UnnamedBrush";
  152. }
  153. prepareState(a5, r9, t9) {
  154. }
  155. draw(a5, r9, t9) {
  156. }
  157. drawMany(a5, r9, t9) {
  158. for (const s10 of r9)
  159. this.draw(a5, s10, t9);
  160. }
  161. };
  162. // node_modules/@arcgis/core/views/2d/engine/flow/BrushFlow.js
  163. var i2 = class extends a2 {
  164. constructor() {
  165. super(...arguments), this._visualState = { time: 0, dvsMat3: e4(), displayViewMat3: e4() };
  166. }
  167. dispose() {
  168. }
  169. prepareState(t9) {
  170. const { context: e8 } = t9;
  171. e8.setColorMask(true, true, true, true), e8.setStencilFunction(I.EQUAL, 0, 255);
  172. }
  173. draw(s10, a5) {
  174. const { requestRender: r9 } = s10, { displayData: i4 } = a5;
  175. if (t(i4))
  176. return;
  177. if (i4.state.name === "loaded" && i4.attach(s10), i4.state.name !== "attached")
  178. return;
  179. const o7 = i4.state.resources;
  180. o7.ready || !r(r9) ? (this._visualState.time = s10.time / 1e3, this._visualState.dvsMat3 = a5.transforms.dvs, this._visualState.displayViewMat3 = s10.state.displayViewMat3, i4.flowStyle.render(s10, this._visualState, o7), i4.flowStyle.animated && r(r9) && r9()) : r9();
  181. }
  182. };
  183. // node_modules/@arcgis/core/views/webgl/rasterUtils.js
  184. function _3(e8, u7, f5 = "nearest", m11 = false) {
  185. const c10 = !(m11 && u7.pixelType === "u8"), _5 = c10 ? G.FLOAT : G.UNSIGNED_BYTE, p6 = u7.pixels == null || u7.pixels.length === 0 ? null : c10 ? u7.getAsRGBAFloat() : u7.getAsRGBA(), E5 = e8.capabilities.textureFloat?.textureFloatLinear, T3 = { width: u7.width, height: u7.height, target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: e8.type === o3.WEBGL2 && c10 ? U.RGBA32F : P.RGBA, samplingMode: !E5 || f5 !== "bilinear" && f5 !== "cubic" ? L.NEAREST : L.LINEAR, dataType: _5, wrapMode: D2.CLAMP_TO_EDGE, flipped: false };
  186. return new u(e8, T3, p6);
  187. }
  188. function E4(e8, u7) {
  189. const { spacing: f5, offsets: m11, coefficients: c10, size: [_5, p6] } = u7, E5 = f5[0] > 1, T3 = { width: E5 ? 4 * _5 : _5, height: p6, target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: e8.type === o3.WEBGL2 ? U.RGBA32F : P.RGBA, dataType: G.FLOAT, samplingMode: L.NEAREST, wrapMode: D2.CLAMP_TO_EDGE, flipped: false }, g3 = new Float32Array(E5 ? _5 * p6 * 16 : 2 * m11.length);
  190. if (E5)
  191. for (let t9 = 0, n8 = 0; t9 < c10.length; t9++)
  192. g3[n8++] = c10[t9], t9 % 3 == 2 && (g3[n8++] = 1);
  193. else
  194. for (let t9 = 0; t9 < p6; t9++)
  195. for (let e9 = 0; e9 < _5; e9++) {
  196. const n8 = 4 * (t9 * _5 + e9), a5 = 2 * (e9 * p6 + t9);
  197. g3[n8] = m11[a5], g3[n8 + 1] = m11[a5 + 1], g3[n8 + 3] = m11[a5] === -1 ? 0 : 1;
  198. }
  199. return new u(e8, T3, g3);
  200. }
  201. function T(e8, t9) {
  202. const i4 = { width: t9.length / 4, height: 1, target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, wrapMode: D2.CLAMP_TO_EDGE, flipped: false };
  203. return new u(e8, i4, t9);
  204. }
  205. function g(t9, n8, a5, r9 = 1, i4 = true) {
  206. return { u_flipY: i4, u_applyTransform: !!t9, u_opacity: r9, u_transformSpacing: t9 ? t9.spacing : f, u_transformGridSize: t9 ? t9.size : f, u_targetImageSize: n8, u_srcImageSize: a5 };
  207. }
  208. function A2(e8, t9) {
  209. return { u_colormapOffset: t9 || 0, u_colormapMaxIndex: e8 ? e8.length / 4 - 1 : 0 };
  210. }
  211. function h2(e8, t9) {
  212. return { u_scale: e8, u_offset: t9 };
  213. }
  214. function d(e8) {
  215. return { u_bandCount: e8.bandCount, u_minOutput: e8.outMin, u_maxOutput: e8.outMax, u_minCutOff: e8.minCutOff, u_maxCutOff: e8.maxCutOff, u_factor: e8.factor, u_useGamma: e8.useGamma, u_gamma: e8.gamma, u_gammaCorrection: e8.gammaCorrection };
  216. }
  217. function O2(e8) {
  218. return { u_hillshadeType: e8.hillshadeType, u_sinZcosAs: e8.sinZcosAs, u_sinZsinAs: e8.sinZsinAs, u_cosZs: e8.cosZs, u_weights: e8.weights, u_factor: e8.factor, u_minValue: e8.minValue, u_maxValue: e8.maxValue };
  219. }
  220. function F3(e8, t9) {
  221. const n8 = e8.gl, a5 = t9.glName, r9 = n8.getProgramParameter(a5, n8.ACTIVE_UNIFORMS), i4 = new Map();
  222. let o7;
  223. for (let s10 = 0; s10 < r9; s10++)
  224. o7 = n8.getActiveUniform(a5, s10), o7 && i4.set(o7.name, { location: n8.getUniformLocation(a5, o7.name), info: o7 });
  225. return i4;
  226. }
  227. function R2(e8, t9, n8) {
  228. Object.keys(n8).forEach((a5) => {
  229. const r9 = t9.get(a5) || t9.get(a5 + "[0]");
  230. r9 && G3(e8, a5, n8[a5], r9);
  231. });
  232. }
  233. function U3(e8, t9, n8, a5) {
  234. n8.length === a5.length && (a5.some((e9) => e9 == null) || n8.some((e9) => e9 == null) || n8.forEach((n9, r9) => {
  235. t9.setUniform1i(n9, r9), e8.bindTexture(a5[r9], r9);
  236. }));
  237. }
  238. function G3(e8, t9, n8, a5) {
  239. if (a5 === null || n8 == null)
  240. return false;
  241. const { info: r9 } = a5;
  242. switch (r9.type) {
  243. case o.FLOAT:
  244. r9.size > 1 ? e8.setUniform1fv(t9, n8) : e8.setUniform1f(t9, n8);
  245. break;
  246. case o.FLOAT_VEC2:
  247. e8.setUniform2fv(t9, n8);
  248. break;
  249. case o.FLOAT_VEC3:
  250. e8.setUniform3fv(t9, n8);
  251. break;
  252. case o.FLOAT_VEC4:
  253. e8.setUniform4fv(t9, n8);
  254. break;
  255. case o.FLOAT_MAT3:
  256. e8.setUniformMatrix3fv(t9, n8);
  257. break;
  258. case o.FLOAT_MAT4:
  259. e8.setUniformMatrix4fv(t9, n8);
  260. break;
  261. case o.INT:
  262. r9.size > 1 ? e8.setUniform1iv(t9, n8) : e8.setUniform1i(t9, n8);
  263. break;
  264. case o.BOOL:
  265. e8.setUniform1i(t9, n8 ? 1 : 0);
  266. break;
  267. case o.INT_VEC2:
  268. case o.BOOL_VEC2:
  269. e8.setUniform2iv(t9, n8);
  270. break;
  271. case o.INT_VEC3:
  272. case o.BOOL_VEC3:
  273. e8.setUniform3iv(t9, n8);
  274. break;
  275. case o.INT_VEC4:
  276. case o.BOOL_VEC4:
  277. e8.setUniform4iv(t9, n8);
  278. break;
  279. default:
  280. return false;
  281. }
  282. return true;
  283. }
  284. // node_modules/@arcgis/core/views/2d/engine/imagery/RasterBitmap.js
  285. var x2 = { bandCount: 3, outMin: 0, outMax: 1, minCutOff: [0, 0, 0], maxCutOff: [255, 255, 255], factor: [1 / 255, 1 / 255, 1 / 255], useGamma: false, gamma: [1, 1, 1], gammaCorrection: [1, 1, 1], colormap: null, colormapOffset: null, stretchType: "none", type: "stretch" };
  286. var p2 = class extends a {
  287. constructor(t9 = null, e8 = null, r9 = null) {
  288. super(), this._textureInvalidated = true, this._colormapTextureInvalidated = true, this._supportsBilinearTexture = true, this.stencilRef = 0, this.coordScale = [1, 1], this._symbolizerParameters = null, this.height = null, this.isRendereredSource = false, this.pixelRatio = 1, this.resolution = 0, this.rotation = 0, this._source = null, this.rawPixelData = null, this._suspended = false, this._bandIds = null, this._interpolation = null, this._transformGrid = null, this.width = null, this.x = 0, this.y = 0, this.source = t9, this.transformGrid = e8, this.interpolation = r9;
  289. }
  290. destroy() {
  291. this.getTextures()?.textures.forEach((t9) => t9.dispose()), this._rasterTexture = null, this._transformGridTexture = null, this._colormapTexture = null;
  292. }
  293. get symbolizerParameters() {
  294. return this._symbolizerParameters || x2;
  295. }
  296. set symbolizerParameters(t9) {
  297. this._symbolizerParameters !== t9 && (this._symbolizerParameters = t9, this._colormapTextureInvalidated = true);
  298. }
  299. get source() {
  300. return this._source;
  301. }
  302. set source(t9) {
  303. this._source !== t9 && (this._source = t9, this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTexture = null, this._rasterTextureBandIds = null), this.invalidateTexture());
  304. }
  305. get suspended() {
  306. return this._suspended;
  307. }
  308. set suspended(t9) {
  309. this._suspended && !t9 && this.stage && (this.ready(), this.requestRender()), this._suspended = t9;
  310. }
  311. get bandIds() {
  312. return this._bandIds;
  313. }
  314. set bandIds(t9) {
  315. this._bandIds = t9, this._isBandIdschanged(t9) && this.invalidateTexture();
  316. }
  317. get interpolation() {
  318. return this._interpolation || "nearest";
  319. }
  320. set interpolation(t9) {
  321. this._interpolation = t9, this._rasterTexture && this._rasterTexture.setSamplingMode(this._getTextureSamplingMethod(t9) === "bilinear" ? L.LINEAR : L.NEAREST);
  322. }
  323. get transformGrid() {
  324. return this._transformGrid;
  325. }
  326. set transformGrid(t9) {
  327. this._transformGrid = t9, this._transformGridTexture && (this._transformGridTexture.dispose(), this._transformGridTexture = null);
  328. }
  329. invalidateTexture() {
  330. this._textureInvalidated || (this._textureInvalidated = true, this.requestRender());
  331. }
  332. _createTransforms() {
  333. return { dvs: e4() };
  334. }
  335. setTransform(t9) {
  336. const o7 = r3(this.transforms.dvs), [n8, h5] = t9.toScreenNoRotation([0, 0], [this.x, this.y]), l8 = this.resolution / this.pixelRatio / t9.resolution, d5 = l8 * this.width, _5 = l8 * this.height, m11 = Math.PI * this.rotation / 180;
  337. M2(o7, o7, t5(n8, h5)), M2(o7, o7, t5(d5 / 2, _5 / 2)), h(o7, o7, -m11), M2(o7, o7, t5(-d5 / 2, -_5 / 2)), b(o7, o7, t5(d5, _5)), i(this.transforms.dvs, t9.displayViewMat3, o7);
  338. }
  339. getTextures() {
  340. if (!this._rasterTexture)
  341. return null;
  342. const t9 = [], e8 = [];
  343. return this._transformGridTexture && (e8.push(this._transformGridTexture), t9.push("u_transformGrid")), this._rasterTexture && (e8.push(this._rasterTexture), t9.push("u_image")), this._colormapTexture && (e8.push(this._colormapTexture), t9.push("u_colormap")), { names: t9, textures: e8 };
  344. }
  345. onAttach() {
  346. this.invalidateTexture();
  347. }
  348. onDetach() {
  349. this.invalidateTexture();
  350. }
  351. updateTexture({ context: t9 }) {
  352. if (!this.stage)
  353. return this._rasterTexture?.dispose(), this._transformGridTexture?.dispose(), this._colormapTexture?.dispose(), this._rasterTexture = null, this._rasterTextureBandIds = null, this._transformGridTexture = null, void (this._colormapTexture = null);
  354. const e8 = this._isValidSource(this.source);
  355. e8 && this._colormapTextureInvalidated && (this._colormapTextureInvalidated = false, this._updateColormapTexture(t9)), this._textureInvalidated && (this._textureInvalidated = false, this._createOrDestroyRasterTexture(t9), this._rasterTexture && (e8 ? this.transformGrid && !this._transformGridTexture && (this._transformGridTexture = E4(t9, this.transformGrid)) : this._rasterTexture.setData(null)), this.suspended || (this.ready(), this.requestRender()));
  356. }
  357. _createOrDestroyRasterTexture(e8) {
  358. const r9 = r(this.source) ? l2(this.source, this.bandIds) : null;
  359. if (!this._isValidSource(r9))
  360. return void (this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTextureBandIds = null, this._rasterTexture = null));
  361. const s10 = !this._isBandIdschanged(this.bandIds);
  362. if (this._rasterTexture) {
  363. if (s10)
  364. return;
  365. this._rasterTexture.dispose(), this._rasterTextureBandIds = null, this._rasterTexture = null;
  366. }
  367. this._supportsBilinearTexture = e8.capabilities.textureFloat?.textureFloatLinear;
  368. const i4 = this._getTextureSamplingMethod(this.interpolation), a5 = this.isRendereredSource || !e8.capabilities.textureFloat?.textureFloat;
  369. this._rasterTexture = _3(e8, r9, i4, a5), this._rasterTextureBandIds = this.bandIds ? [...this.bandIds] : null;
  370. }
  371. _isBandIdschanged(t9) {
  372. const e8 = this._rasterTextureBandIds;
  373. return !(e8 == null && t9 == null || e8 && t9 && e8.join("") === t9.join(""));
  374. }
  375. _isValidSource(e8) {
  376. return r(e8) && e8.pixels?.length > 0;
  377. }
  378. _getTextureSamplingMethod(e8) {
  379. const { type: r9, colormap: s10 } = this.symbolizerParameters, i4 = r9 === "lut" || r9 === "stretch" && r(s10);
  380. return !this._supportsBilinearTexture || i4 || e8 !== "bilinear" && e8 !== "cubic" ? "nearest" : "bilinear";
  381. }
  382. _updateColormapTexture(t9) {
  383. const e8 = this._colormap, r9 = this.symbolizerParameters.colormap;
  384. return r9 ? e8 ? r9.length !== e8.length || r9.some((t10, r10) => t10 !== e8[r10]) ? (this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null), this._colormapTexture = T(t9, r9), void (this._colormap = r9)) : void 0 : (this._colormapTexture = T(t9, r9), void (this._colormap = r9)) : (this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null), void (this._colormap = null));
  385. }
  386. };
  387. function T2(e8) {
  388. return r(e8.source);
  389. }
  390. // node_modules/@arcgis/core/views/2d/engine/webgl/VertexStream.js
  391. var n4 = class {
  392. constructor(s10, n8) {
  393. this.rctx = s10, this._vertexBuffer = c3.createVertex(s10, F.STATIC_DRAW, new Uint16Array(n8)), this._vao = new f2(s10, new Map([["a_position", 0]]), { geometry: [new t4("a_position", 2, C.SHORT, 0, 4)] }, { geometry: this._vertexBuffer }), this._count = n8.length / 2;
  394. }
  395. bind() {
  396. this.rctx.bindVAO(this._vao);
  397. }
  398. unbind() {
  399. this.rctx.bindVAO(null);
  400. }
  401. dispose() {
  402. this._vao.dispose(false), this._vertexBuffer.dispose();
  403. }
  404. draw() {
  405. this.rctx.bindVAO(this._vao), this.rctx.drawArrays(E.TRIANGLE_STRIP, 0, this._count);
  406. }
  407. };
  408. // node_modules/@arcgis/core/views/2d/engine/imagery/BrushRasterBitmap.js
  409. var m2 = class extends a2 {
  410. constructor() {
  411. super(...arguments), this._desc = { lut: { vsPath: "raster/lut", fsPath: "raster/lut", attributes: new Map([["a_position", 0], ["a_texcoord", 1]]) }, stretch: { vsPath: "raster/stretch", fsPath: "raster/stretch", attributes: new Map([["a_position", 0], ["a_texcoord", 1]]) }, hillshade: { vsPath: "raster/hillshade", fsPath: "raster/hillshade", attributes: new Map([["a_position", 0], ["a_texcoord", 1]]) } }, this._rendererUniformInfos = new Map();
  412. }
  413. dispose() {
  414. this._quad && this._quad.dispose();
  415. }
  416. prepareState({ context: e8 }, t9) {
  417. e8.setBlendingEnabled(true), e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setColorMask(true, true, true, true), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true), e8.setStencilFunction(I.EQUAL, t9.stencilRef, 255);
  418. }
  419. draw(e8, r9) {
  420. if (!T2(r9) || r9.suspended)
  421. return;
  422. const { timeline: s10, context: a5, painter: i4, requestRender: o7 } = e8;
  423. s10.begin(this.name);
  424. const n8 = !a5.capabilities.textureFloat?.textureFloatLinear;
  425. r9.updateTexture(e8);
  426. const h5 = this._getShaderVariations(r9, n8), l8 = i4.materialManager.getProgram(this._desc[r9.symbolizerParameters.type], h5);
  427. this._drawWithProgram(a5, l8, r9, o7), s10.end(this.name);
  428. }
  429. _drawWithProgram(t9, s10, a5, i4, d5 = 1, m11 = [0, 0], f5 = false) {
  430. if (this._quad || (this._quad = new n4(t9, [0, 0, 1, 0, 0, 1, 1, 1])), r(i4) && !s10.isCompiled)
  431. return void i4();
  432. const { symbolizerParameters: _5, transformGrid: g3, width: b4, height: P3, opacity: S2 } = a5, w5 = _5.type;
  433. t9.useProgram(s10);
  434. const x6 = this._getShaderVariations(a5), y2 = this._getUniformInfos(w5, t9, s10, x6), { names: M6, textures: U4 } = a5.getTextures();
  435. U3(t9, s10, M6, U4);
  436. const j = h2(d5, m11), I3 = g(g3, [b4, P3], [a5.source.width, a5.source.height], S2, f5);
  437. if (R2(s10, y2, { u_coordScale: a5.coordScale, u_dvsMat3: a5.transforms.dvs, ...j, ...I3 }), _5.colormap) {
  438. const { colormap: e8, colormapOffset: t10 } = _5, r9 = A2(e8, t10);
  439. R2(s10, y2, r9);
  440. }
  441. if (_5.type === "stretch") {
  442. const e8 = d(_5);
  443. R2(s10, y2, e8);
  444. } else if (_5.type === "hillshade") {
  445. const e8 = O2(_5);
  446. R2(s10, y2, e8);
  447. }
  448. this._quad.draw();
  449. }
  450. _getUniformInfos(e8, t9, r9, s10) {
  451. const a5 = s10.length > 0 ? e8 + "-" + s10.join("-") : e8;
  452. if (this._rendererUniformInfos.has(a5))
  453. return this._rendererUniformInfos.get(a5);
  454. const i4 = F3(t9, r9);
  455. return this._rendererUniformInfos.set(a5, i4), i4;
  456. }
  457. _getShaderVariations(e8, t9 = false) {
  458. const r9 = [], { interpolation: s10 } = e8, { type: a5, colormap: i4 } = e8.symbolizerParameters;
  459. return s10 === "cubic" ? r9.push("bicubic") : s10 === "bilinear" && a5 === "stretch" && i4 != null ? (r9.push("bilinear"), r9.push("nnedge")) : t9 && s10 === "bilinear" && r9.push("bilinear"), e8.isRendereredSource ? r9.push("noop") : i4 && r9.push("applyColormap"), e8.transformGrid && (r9.push("applyProjection"), e8.transformGrid.spacing[0] === 1 && r9.push("lookupProjection")), r9;
  460. }
  461. };
  462. // node_modules/@arcgis/core/views/2d/engine/imagery/BrushVectorField.js
  463. var l4 = new Float32Array([0.27058823529411763, 0.4588235294117647, 0.7098039215686275, 1, 0.396078431372549, 0.5372549019607843, 0.7215686274509804, 1, 0.5176470588235295, 0.6196078431372549, 0.7294117647058823, 1, 0.6352941176470588, 0.7058823529411765, 0.7411764705882353, 1, 0.7529411764705882, 0.8, 0.7450980392156863, 1, 0.8705882352941177, 0.8901960784313725, 0.7490196078431373, 1, 1, 1, 0.7490196078431373, 1, 1, 0.8627450980392157, 0.6313725490196078, 1, 0.9803921568627451, 0.7254901960784313, 0.5176470588235295, 1, 0.9607843137254902, 0.596078431372549, 0.4117647058823529, 1, 0.9294117647058824, 0.4588235294117647, 0.3176470588235294, 1, 0.9098039215686274, 0.08235294117647059, 0.08235294117647059, 1]);
  464. var c4 = { beaufort_ft: l4, beaufort_m: l4, beaufort_km: l4, beaufort_mi: l4, beaufort_kn: new Float32Array([0.1568627450980392, 0.5725490196078431, 0.7803921568627451, 1, 0.34901960784313724, 0.6352941176470588, 0.7294117647058823, 1, 0.5058823529411764, 0.7019607843137254, 0.6705882352941176, 1, 0.6274509803921569, 0.7607843137254902, 0.6078431372549019, 1, 0.7490196078431373, 0.8313725490196079, 0.5411764705882353, 1, 0.8549019607843137, 0.9019607843137255, 0.4666666666666667, 1, 0.9803921568627451, 0.9803921568627451, 0.39215686274509803, 1, 0.9882352941176471, 0.8352941176470589, 0.3254901960784314, 1, 0.9882352941176471, 0.7019607843137254, 0.4, 1, 0.9803921568627451, 0.5529411764705883, 0.20392156862745098, 1, 0.9686274509803922, 0.43137254901960786, 0.16470588235294117, 1, 0.9411764705882353, 0.2784313725490196, 0.11372549019607843, 1]), classified_arrow: new Float32Array([0.2196078431372549, 0.6588235294117647, 0, 1, 0.5450980392156862, 1.2117647058823529, 0, 1, 1, 1, 0, 1, 1, 0.5019607843137255, 0, 1, 1, 0, 0, 1]), ocean_current_m: new Float32Array([0.3058823529411765, 0.10196078431372549, 0.6, 1, 0.7019607843137254, 0.10588235294117647, 0.10196078431372549, 1, 0.792156862745098, 0.5019607843137255, 0.10196078431372549, 1, 0.6941176470588235, 0.6941176470588235, 0.6941176470588235, 1]), ocean_current_kn: new Float32Array([0, 0, 0, 1, 0, 0.1450980392156863, 0.39215686274509803, 1, 0.3058823529411765, 0.10196078431372549, 0.6, 1, 0.592156862745098, 0, 0.39215686274509803, 1, 0.7019607843137254, 0.10588235294117647, 0.10196078431372549, 1, 0.6941176470588235, 0.3058823529411765, 0.10196078431372549, 1, 0.792156862745098, 0.5019607843137255, 0.10196078431372549, 1, 0.6941176470588235, 0.7019607843137254, 0.20392156862745098, 1, 0.6941176470588235, 0.6941176470588235, 0.6941176470588235, 1]), single_arrow: new Float32Array([0, 92 / 255, 230 / 255, 1]), wind_speed: new Float32Array([0, 0, 0, 1]) };
  465. var m3 = class extends a2 {
  466. constructor() {
  467. super(...arguments), this._desc = { magdir: { vsPath: "raster/magdir", fsPath: "raster/magdir", attributes: new Map([["a_pos", 0], ["a_offset", 1], ["a_vv", 2]]) }, scalar: { vsPath: "raster/scalar", fsPath: "raster/scalar", attributes: new Map([["a_pos", 0], ["a_offset", 1], ["a_vv", 2]]) } };
  468. }
  469. dispose() {
  470. }
  471. prepareState({ context: e8 }, t9) {
  472. e8.setBlendingEnabled(true), e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setColorMask(true, true, true, true), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true), e8.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), e8.setStencilFunction(I.EQUAL, t9.stencilRef, 255);
  473. }
  474. draw(t9, a5) {
  475. if (t(a5.source) || a5.source.validPixelCount === 0)
  476. return;
  477. const { timeline: r9 } = t9;
  478. if (r9.begin(this.name), a5.updateVectorFieldVAO(t9), t9.renderPass === "scalar") {
  479. const e8 = a5.vaoData.scalar;
  480. e8 && this._drawScalars(t9, a5, e8.vao, e8.elementCount);
  481. } else {
  482. const e8 = a5.vaoData.magdir;
  483. e8 && this._drawTriangles(t9, a5, e8.vao, e8.elementCount);
  484. }
  485. r9.end(this.name);
  486. }
  487. _drawTriangles(e8, a5, r9, s10) {
  488. const { context: o7, painter: l8, requestRender: m11 } = e8, { symbolizerParameters: d5 } = a5, f5 = d5.dataRange ? ["dataRange"] : [];
  489. d5.rotationType === "geographic" && f5.push("rotationGeographic");
  490. const u7 = l8.materialManager.getProgram(this._desc.magdir, f5);
  491. if (r(m11) && !u7.isCompiled)
  492. return void m11();
  493. o7.useProgram(u7);
  494. const { coordScale: _5, opacity: g3, transforms: p6 } = a5;
  495. u7.setUniform2fv("u_coordScale", _5), u7.setUniform1f("u_opacity", g3), u7.setUniformMatrix3fv("u_dvsMat3", p6.dvs);
  496. const { style: y2, dataRange: v, rotation: b4, symbolPercentRange: S2 } = d5;
  497. u7.setUniform4fv("u_colors", c4[y2] || c4.single_arrow), u7.setUniform2fv("u_dataRange", v), u7.setUniform1f("u_rotation", b4), u7.setUniform2fv("u_symbolPercentRange", S2);
  498. const h5 = this._getSymbolSize(e8, a5);
  499. u7.setUniform2fv("u_symbolSize", h5), o7.bindVAO(r9), o7.drawElements(E.TRIANGLES, s10, C.UNSIGNED_INT, 0);
  500. }
  501. _drawScalars(e8, a5, r9, s10) {
  502. const { context: o7, painter: l8, requestRender: c10 } = e8, { symbolizerParameters: m11 } = a5, d5 = [];
  503. m11.style === "wind_speed" ? d5.push("innerCircle") : m11.dataRange && d5.push("dataRange"), m11.rotationType === "geographic" && d5.push("rotationGeographic");
  504. const f5 = l8.materialManager.getProgram(this._desc.scalar, d5);
  505. if (r(c10) && !f5.isCompiled)
  506. return void c10();
  507. o7.useProgram(f5);
  508. const { coordScale: u7, opacity: _5, transforms: g3 } = a5;
  509. f5.setUniform2fv("u_coordScale", u7), f5.setUniform1f("u_opacity", _5), f5.setUniformMatrix3fv("u_dvsMat3", g3.dvs);
  510. const { dataRange: p6, symbolPercentRange: y2 } = m11;
  511. f5.setUniform2fv("u_dataRange", p6), f5.setUniform2fv("u_symbolPercentRange", y2);
  512. const v = this._getSymbolSize(e8, a5);
  513. f5.setUniform2fv("u_symbolSize", v), o7.bindVAO(r9), o7.drawElements(E.TRIANGLES, s10, C.UNSIGNED_INT, 0);
  514. }
  515. _getSymbolSize(e8, t9) {
  516. const a5 = t9.key ? 2 ** (e8.displayLevel - t9.key.level) : t9.resolution / e8.state.resolution, { symbolTileSize: r9 } = t9.symbolizerParameters;
  517. return [r9 / (Math.round((t9.width - t9.offset[0]) / r9) * r9) / a5, r9 / (Math.round((t9.height - t9.offset[1]) / r9) * r9) / a5];
  518. }
  519. };
  520. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/BrushBitmap.js
  521. var o4 = { nearest: { defines: [], samplingMode: L.NEAREST, mips: false }, bilinear: { defines: [], samplingMode: L.LINEAR, mips: false }, bicubic: { defines: ["bicubic"], samplingMode: L.LINEAR, mips: false }, trilinear: { defines: [], samplingMode: L.LINEAR_MIPMAP_LINEAR, mips: true } };
  522. var d2 = (e8, t9, i4) => {
  523. if (i4.samplingMode === "dynamic") {
  524. const { state: i5 } = e8, s10 = t9.resolution / t9.pixelRatio / i5.resolution, n8 = Math.round(e8.pixelRatio) !== e8.pixelRatio, r9 = s10 > 1.05 || s10 < 0.95;
  525. return i5.rotation || r9 || n8 || t9.isSourceScaled || t9.rotation ? o4.bilinear : o4.nearest;
  526. }
  527. return o4[i4.samplingMode];
  528. };
  529. var m4 = class extends a2 {
  530. constructor() {
  531. super(...arguments), this._desc = { vsPath: "raster/bitmap", fsPath: "raster/bitmap", attributes: new Map([["a_pos", 0]]) };
  532. }
  533. dispose() {
  534. this._quad && this._quad.dispose();
  535. }
  536. prepareState({ context: e8 }, t9) {
  537. e8.setBlendingEnabled(true), t9.blendFunction === "additive" ? e8.setBlendFunctionSeparate(R.ONE, R.ONE, R.ONE, R.ONE) : e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setColorMask(true, true, true, true), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true), e8.setStencilFunction(I.EQUAL, t9.stencilRef, 255);
  538. }
  539. draw(s10, n8) {
  540. const { context: r9, renderingOptions: a5, painter: o7, requestRender: m11 } = s10;
  541. if (!n8.source)
  542. return;
  543. const c10 = d2(s10, n8, a5), l8 = o7.materialManager.getProgram(this._desc, c10.defines);
  544. if (r(m11) && !l8.isCompiled)
  545. return void m11();
  546. s10.timeline.begin(this.name), this._quad || (this._quad = new n4(r9, [0, 0, 1, 0, 0, 1, 1, 1]));
  547. const { coordScale: p6, computedOpacity: u7, transforms: f5 } = n8;
  548. n8.setSamplingProfile(c10), n8.bind(s10.context, A), r9.useProgram(l8), l8.setUniformMatrix3fv("u_dvsMat3", f5.dvs), l8.setUniform1i("u_texture", A), l8.setUniform2fv("u_coordScale", p6), l8.setUniform1f("u_opacity", u7), this._quad.draw(), s10.timeline.end(this.name);
  549. }
  550. };
  551. // node_modules/@arcgis/core/chunks/vec4f32.js
  552. function n5() {
  553. return new Float32Array(4);
  554. }
  555. function t7(n8) {
  556. const t9 = new Float32Array(4);
  557. return t9[0] = n8[0], t9[1] = n8[1], t9[2] = n8[2], t9[3] = n8[3], t9;
  558. }
  559. function r7(n8, t9, r9, e8) {
  560. const a5 = new Float32Array(4);
  561. return a5[0] = n8, a5[1] = t9, a5[2] = r9, a5[3] = e8, a5;
  562. }
  563. function e5(n8, t9) {
  564. return new Float32Array(n8, t9, 4);
  565. }
  566. function a3() {
  567. return n5();
  568. }
  569. function o5() {
  570. return r7(1, 1, 1, 1);
  571. }
  572. function u2() {
  573. return r7(1, 0, 0, 0);
  574. }
  575. function s6() {
  576. return r7(0, 1, 0, 0);
  577. }
  578. function c5() {
  579. return r7(0, 0, 1, 0);
  580. }
  581. function i3() {
  582. return r7(0, 0, 0, 1);
  583. }
  584. var f3 = a3();
  585. var l5 = o5();
  586. var _4 = u2();
  587. var y = s6();
  588. var w3 = c5();
  589. var N3 = i3();
  590. var O3 = Object.freeze(Object.defineProperty({ __proto__: null, create: n5, clone: t7, fromValues: r7, createView: e5, zeros: a3, ones: o5, unitX: u2, unitY: s6, unitZ: c5, unitW: i3, ZEROS: f3, ONES: l5, UNIT_X: _4, UNIT_Y: y, UNIT_Z: w3, UNIT_W: N3 }, Symbol.toStringTag, { value: "Module" }));
  591. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/sources/shaderRepository.js
  592. var e6 = { background: { "background.frag": "uniform lowp vec4 u_color;\nvoid main() {\ngl_FragColor = u_color;\n}", "background.vert": "attribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform mediump vec2 u_coord_range;\nuniform mediump float u_depth;\nvoid main() {\nvec3 v_pos = u_dvsMat3 * vec3(u_coord_range * a_pos, 1.0);\ngl_Position = vec4(v_pos.xy, 0.0, 1.0);\n}" }, bitBlit: { "bitBlit.frag": "uniform lowp sampler2D u_tex;\nuniform lowp float u_opacity;\nvarying mediump vec2 v_uv;\nvoid main() {\nlowp vec4 color = texture2D(u_tex, v_uv);\ngl_FragColor = color * u_opacity;\n}", "bitBlit.vert": "attribute vec2 a_pos;\nattribute vec2 a_tex;\nvarying mediump vec2 v_uv;\nvoid main(void) {\ngl_Position = vec4(a_pos, 0.0, 1.0);\nv_uv = a_tex;\n}" }, blend: { "blend.frag": "precision mediump float;\nuniform sampler2D u_layerTexture;\nuniform lowp float u_opacity;\nuniform lowp float u_inFadeOpacity;\n#ifndef NORMAL\nuniform sampler2D u_backbufferTexture;\n#endif\nvarying mediump vec2 v_uv;\nfloat rgb2v(in vec3 c) {\nreturn max(c.x, max(c.y, c.z));\n}\nvec3 rgb2hsv(in vec3 c) {\nvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\nvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\nfloat d = q.x - min(q.w, q.y);\nfloat e = 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);\n}\nvec3 hsv2rgb(in vec3 c) {\nvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvec3 tint(in vec3 Cb, in vec3 Cs) {\nfloat vIn = rgb2v(Cb);\nvec3 hsvTint = rgb2hsv(Cs);\nvec3 hsvOut = vec3(hsvTint.x, hsvTint.y, vIn * hsvTint.z);\nreturn hsv2rgb(hsvOut);\n}\nfloat overlay(in float Cb, in float Cs) {\nreturn (1.0 - step(0.5, Cs)) * (1.0 - 2.0 * (1.0 - Cs ) * (1.0 - Cb)) + step(0.5, Cs) * (2.0 * Cs * Cb);\n}\nfloat colorDodge(in float Cb, in float Cs) {\nreturn (Cb == 0.0) ? 0.0 : (Cs == 1.0) ? 1.0 : min(1.0, Cb / (1.0 - Cs));\n}\nfloat colorBurn(in float Cb, in float Cs) {\nreturn (Cb == 1.0) ? 1.0 : (Cs == 0.0) ? 0.0 : 1.0 - min(1.0, (1.0 - Cb) / Cs);\n}\nfloat hardLight(in float Cb, in float Cs) {\nreturn (1.0 - step(0.5, Cs)) * (2.0 * Cs * Cb) + step(0.5, Cs) * (1.0 - 2.0 * (1.0 - Cs) * (1.0 - Cb));\n}\nfloat reflectBlend(in float Cb, in float Cs) {\nreturn (Cs == 1.0) ? Cs : min(Cb * Cb / (1.0 - Cs), 1.0);\n}\nfloat softLight(in float Cb, in float Cs) {\nif (Cs <= 0.5) {\nreturn Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb);\n}\nif (Cb <= 0.25) {\nreturn Cb + (2.0 * Cs - 1.0) * Cb * ((16.0 * Cb - 12.0) * Cb + 3.0);\n}\nreturn Cb + (2.0 * Cs - 1.0) * (sqrt(Cb) - Cb);\n}\nfloat vividLight(in float Cb, in float Cs) {\nreturn (1.0 - step(0.5, Cs)) * colorBurn(Cb, 2.0 * Cs) + step(0.5, Cs) * colorDodge(Cb, (2.0 * (Cs - 0.5)));\n}\nfloat minv3(in vec3 c) {\nreturn min(min(c.r, c.g), c.b);\n}\nfloat maxv3(in vec3 c) {\nreturn max(max(c.r, c.g), c.b);\n}\nfloat lumv3(in vec3 c) {\nreturn dot(c, vec3(0.3, 0.59, 0.11));\n}\nfloat satv3(vec3 c) {\nreturn maxv3(c) - minv3(c);\n}\nvec3 clipColor(vec3 color) {\nfloat lum = lumv3(color);\nfloat mincol = minv3(color);\nfloat maxcol = maxv3(color);\nif (mincol < 0.0) {\ncolor = lum + ((color - lum) * lum) / (lum - mincol);\n}\nif (maxcol > 1.0) {\ncolor = lum + ((color - lum) * (1.0 - lum)) / (maxcol - lum);\n}\nreturn color;\n}\nvec3 setLum(vec3 cbase, vec3 clum) {\nfloat lbase = lumv3(cbase);\nfloat llum = lumv3(clum);\nfloat ldiff = llum - lbase;\nvec3 color = cbase + vec3(ldiff);\nreturn clipColor(color);\n}\nvec3 setLumSat(vec3 cbase, vec3 csat, vec3 clum)\n{\nfloat minbase = minv3(cbase);\nfloat sbase = satv3(cbase);\nfloat ssat = satv3(csat);\nvec3 color;\nif (sbase > 0.0) {\ncolor = (cbase - minbase) * ssat / sbase;\n} else {\ncolor = vec3(0.0);\n}\nreturn setLum(color, clum);\n}\nvoid main() {\nvec4 src = texture2D(u_layerTexture, v_uv);\n#ifdef NORMAL\ngl_FragColor = src * u_opacity;\n#else\nvec4 dst = texture2D(u_backbufferTexture, v_uv);\nvec3 Cs = src.a == 0.0 ? src.rgb : vec3(src.rgb / src.a);\nvec3 Cb = dst.a == 0.0 ? dst.rgb : vec3(dst.rgb / dst.a);\nfloat as = u_opacity * src.a;\nfloat ab = dst.a;\n#ifdef DESTINATION_OVER\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb, as + ab - as * ab);\n#endif\n#ifdef SOURCE_IN\nvec4 color = vec4(as * Cs * ab, as * ab);\nvec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab);\ngl_FragColor = color + fadeColor;\n#endif\n#ifdef DESTINATION_IN\nvec4 color = vec4(ab * Cb * as, ab * as);\nvec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab);\ngl_FragColor = color + fadeColor;\n#endif\n#ifdef SOURCE_OUT\ngl_FragColor = vec4(as * Cs * (1.0 - ab), as * (1.0 - ab));\n#endif\n#ifdef DESTINATION_OUT\ngl_FragColor = vec4(ab * Cb * (1.0 - as), ab * (1.0 - as));\n#endif\n#ifdef SOURCE_ATOP\ngl_FragColor = vec4(as * Cs * ab + ab * Cb * (1.0 - as), ab);\n#endif\n#ifdef DESTINATION_ATOP\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * as, as);\n#endif\n#ifdef XOR\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * (1.0 - as),\nas * (1.0 - ab) + ab * (1.0 - as));\n#endif\n#ifdef MULTIPLY\ngl_FragColor = vec4(as * Cs * ab * Cb + (1.0 - ab) * as * Cs + (1.0 - as) * ab * Cb,\nas + ab * (1.0 - as));\n#endif\n#ifdef SCREEN\ngl_FragColor = vec4((Cs + Cb - Cs * Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef OVERLAY\nvec3 f = vec3(overlay(Cb.r, Cs.r), overlay(Cb.g, Cs.g), overlay(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef DARKEN\ngl_FragColor = vec4(min(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef LIGHTER\ngl_FragColor = vec4(as * Cs + ab * Cb, as + ab);\n#endif\n#ifdef LIGHTEN\ngl_FragColor = vec4(max(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR_DODGE\nvec3 f = vec3(colorDodge(Cb.r, Cs.r), colorDodge(Cb.g, Cs.g), colorDodge(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR_BURN\nvec3 f = vec3(colorBurn(Cb.r, Cs.r), colorBurn(Cb.g, Cs.g), colorBurn(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef HARD_LIGHT\nvec3 f = vec3(hardLight(Cb.r, Cs.r), hardLight(Cb.g, Cs.g), hardLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef SOFT_LIGHT\nvec3 f = vec3(softLight(Cb.r, Cs.r), softLight(Cb.g, Cs.g), softLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef DIFFERENCE\ngl_FragColor = vec4(abs(Cb - Cs) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef EXCLUSION\nvec3 f = Cs + Cb - 2.0 * Cs * Cb;\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef INVERT\ngl_FragColor = vec4((1.0 - Cb) * as * ab + Cb * ab * (1.0 - as), ab);\n#endif\n#ifdef VIVID_LIGHT\nvec3 f = vec3(vividLight(Cb.r, Cs.r),\nvividLight(Cb.g, Cs.g),\nvividLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef HUE\nvec3 f = setLumSat(Cs,Cb,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef SATURATION\nvec3 f = setLumSat(Cb,Cs,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR\nvec3 f = setLum(Cs,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef LUMINOSITY\nvec3 f = setLum(Cb,Cs);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef PLUS\ngl_FragColor = clamp(vec4(src.r + Cb.r, src.g + Cb.g, src.b + Cb.b, as + ab), 0.0, 1.0);\n#endif\n#ifdef MINUS\ngl_FragColor = vec4(clamp(vec3(Cb.r - src.r, Cb.g - src.g, Cb.b - src.b), 0.0, 1.0), ab * as);\n#endif\n#ifdef AVERAGE\nvec3 f = (Cb + Cs) / 2.0;\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef REFLECT\nvec3 f = vec3(reflectBlend(Cb.r, Cs.r),\nreflectBlend(Cb.g, Cs.g),\nreflectBlend(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#endif\n}", "blend.vert": "attribute vec2 a_position;\nvarying mediump vec2 v_uv;\nvoid main(void) {\ngl_Position = vec4(a_position , 0.0, 1.0);\nv_uv = (a_position + 1.0) / 2.0;\n}" }, dot: { dot: { "dot.frag": "precision mediump float;\nvarying vec4 v_color;\nvarying float v_dotRatio;\nvarying float v_invEdgeRatio;\nuniform highp float u_tileZoomFactor;\nvoid main()\n{\nfloat dist = length(gl_PointCoord - vec2(.5, .5)) * 2.;\nfloat alpha = smoothstep(0., 1., v_invEdgeRatio * (dist - v_dotRatio) + 1.);\ngl_FragColor = v_color * alpha;\n}", "dot.vert": "precision highp float;\nattribute vec2 a_pos;\nuniform sampler2D u_texture;\nuniform highp mat3 u_dvsMat3;\nuniform highp float u_tileZoomFactor;\nuniform highp float u_dotSize;\nuniform highp float u_pixelRatio;\nvarying vec2 v_pos;\nvarying vec4 v_color;\nvarying float v_dotRatio;\nvarying float v_invEdgeRatio;\nconst float EPSILON = 0.000001;\nvoid main()\n{\nmat3 tileToTileTexture = mat3( 1., 0., 0.,\n0., -1., 0.,\n0., 1., 1. );\nvec3 texCoords = tileToTileTexture * vec3(a_pos.xy / 512., 1.);\nv_color = texture2D(u_texture, texCoords.xy);\nfloat smoothEdgeWidth = max(u_dotSize / 2., 1.) ;\nfloat z = 0.;\nz += 2.0 * step(v_color.a, EPSILON);\ngl_PointSize = (smoothEdgeWidth + u_dotSize);\ngl_Position = vec4((u_dvsMat3 * vec3(a_pos + .5, 1.)).xy, z, 1.);\nv_dotRatio = u_dotSize / gl_PointSize;\nv_invEdgeRatio = -1. / ( smoothEdgeWidth / gl_PointSize );\ngl_PointSize *= (u_pixelRatio * u_tileZoomFactor);\n}" } }, filtering: { "bicubic.glsl": "vec4 computeWeights(float v) {\nfloat b = 1.0 / 6.0;\nfloat v2 = v * v;\nfloat v3 = v2 * v;\nfloat w0 = b * (-v3 + 3.0 * v2 - 3.0 * v + 1.0);\nfloat w1 = b * (3.0 * v3 - 6.0 * v2 + 4.0);\nfloat w2 = b * (-3.0 * v3 + 3.0 * v2 + 3.0 * v + 1.0);\nfloat w3 = b * v3;\nreturn vec4(w0, w1, w2, w3);\n}\nvec4 bicubicOffsetsAndWeights(float v) {\nvec4 w = computeWeights(v);\nfloat g0 = w.x + w.y;\nfloat g1 = w.z + w.w;\nfloat h0 = 1.0 - (w.y / g0) + v;\nfloat h1 = 1.0 + (w.w / g1) - v;\nreturn vec4(h0, h1, g0, g1);\n}\nvec4 sampleBicubicBSpline(sampler2D sampler, vec2 coords, vec2 texSize) {\nvec2 eX = vec2(1.0 / texSize.x, 0.0);\nvec2 eY = vec2(0.0, 1.0 / texSize.y);\nvec2 texel = coords * texSize - 0.5;\nvec3 hgX = bicubicOffsetsAndWeights(fract(texel).x).xyz;\nvec3 hgY = bicubicOffsetsAndWeights(fract(texel).y).xyz;\nvec2 coords10 = coords + hgX.x * eX;\nvec2 coords00 = coords - hgX.y * eX;\nvec2 coords11 = coords10 + hgY.x * eY;\nvec2 coords01 = coords00 + hgY.x * eY;\ncoords10 = coords10 - hgY.y * eY;\ncoords00 = coords00 - hgY.y * eY;\nvec4 color00 = texture2D(sampler, coords00);\nvec4 color10 = texture2D(sampler, coords10);\nvec4 color01 = texture2D(sampler, coords01);\nvec4 color11 = texture2D(sampler, coords11);\ncolor00 = mix(color00, color01, hgY.z);\ncolor10 = mix(color10, color11, hgY.z);\ncolor00 = mix(color00, color10, hgX.z);\nreturn color00;\n}", "bilinear.glsl": "vec4 sampleBilinear(sampler2D sampler, vec2 coords, vec2 texSize) {\nvec2 texelStart = floor(coords * texSize);\nvec2 coord0 = texelStart / texSize;\nvec2 coord1 = (texelStart + vec2(1.0, 0.0)) / texSize;\nvec2 coord2 = (texelStart + vec2(0.0, 1.0)) / texSize;\nvec2 coord3 = (texelStart + vec2(1.0, 1.0)) / texSize;\nvec4 color0 = texture2D(sampler, coord0);\nvec4 color1 = texture2D(sampler, coord1);\nvec4 color2 = texture2D(sampler, coord2);\nvec4 color3 = texture2D(sampler, coord3);\nvec2 blend = fract(coords * texSize);\nvec4 color01 = mix(color0, color1, blend.x);\nvec4 color23 = mix(color2, color3, blend.x);\nvec4 color = mix(color01, color23, blend.y);\n#ifdef NNEDGE\nfloat alpha = floor(color0.a * color1.a * color2.a * color3.a + 0.5);\ncolor = color * alpha + (1.0 - alpha) * texture2D(sampler, coords);\n#endif\nreturn color;\n}", "epx.glsl": "vec4 sampleEPX(sampler2D sampler, float size, vec2 coords, vec2 texSize) {\nvec2 invSize = 1.0 / texSize;\nvec2 texel = coords * texSize;\nvec2 texel_i = floor(texel);\nvec2 texel_frac = fract(texel);\nvec4 colorP = texture2D(sampler, texel_i * invSize);\nvec4 colorP1 = vec4(colorP);\nvec4 colorP2 = vec4(colorP);\nvec4 colorP3 = vec4(colorP);\nvec4 colorP4 = vec4(colorP);\nvec4 colorA = texture2D(sampler, (texel_i - vec2(0.0, 1.0)) * invSize);\nvec4 colorB = texture2D(sampler, (texel_i + vec2(1.0, 0.0)) * invSize);\nvec4 colorC = texture2D(sampler, (texel_i - vec2(1.0, 0.0)) * invSize);\nvec4 colorD = texture2D(sampler, (texel_i + vec2(0.0, 1.0)) * invSize);\nif (colorC == colorA && colorC != colorD && colorA != colorB) {\ncolorP1 = colorA;\n}\nif (colorA == colorB && colorA != colorC && colorB != colorD) {\ncolorP2 = colorB;\n}\nif (colorD == colorC && colorD != colorB && colorC != colorA) {\ncolorP3 = colorC;\n}\nif (colorB == colorD && colorB != colorA && colorD != colorC) {\ncolorP4 = colorD;\n}\nvec4 colorP12 = mix(colorP1, colorP2, texel_frac.x);\nvec4 colorP34 = mix(colorP1, colorP2, texel_frac.x);\nreturn mix(colorP12, colorP34, texel_frac.y);\n}" }, fx: { integrate: { "integrate.frag": "precision mediump float;\nuniform lowp sampler2D u_sourceTexture;\nuniform lowp sampler2D u_maskTexture;\nuniform mediump float u_zoomLevel;\nuniform highp float u_timeDelta;\nuniform highp float u_animationTime;\nvarying highp vec2 v_texcoord;\n#include <materials/utils.glsl>\nvoid main()\n{\n#ifdef DELTA\nvec4 texel = texture2D(u_sourceTexture, v_texcoord);\nvec4 data0 = texture2D(u_maskTexture, v_texcoord);\nfloat flags = data0.r * 255.0;\nfloat groupMinZoom = data0.g * 255.0;\nfloat isVisible = getFilterBit(flags, 0);\nfloat wouldClip = step(groupMinZoom, u_zoomLevel);\nfloat direction = wouldClip * 1.0 + (1.0 - wouldClip) * -1.0;\nfloat dt = u_timeDelta / max(u_animationTime, 0.0001);\nvec4 nextState = vec4(texel + direction * dt);\ngl_FragColor = vec4(nextState);\n#elif defined(UPDATE)\nvec4 texel = texture2D(u_sourceTexture, v_texcoord);\ngl_FragColor = texel;\n#endif\n}", "integrate.vert": "precision mediump float;\nattribute vec2 a_pos;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n}" } }, heatmap: { heatmapResolve: { "heatmapResolve.frag": "precision highp float;\n#ifdef HEATMAP_PRECISION_HALF_FLOAT\n#define COMPRESSION_FACTOR 4.0\n#else\n#define COMPRESSION_FACTOR 1.0\n#endif\nuniform sampler2D u_texture;\nuniform sampler2D u_gradient;\nuniform vec2 u_densityMinAndInvRange;\nuniform float u_densityNormalization;\nvarying vec2 v_uv;\nvoid main() {\nvec4 data = texture2D(u_texture, v_uv);\nfloat density = data.r * COMPRESSION_FACTOR;\ndensity *= u_densityNormalization;\ndensity = (density - u_densityMinAndInvRange.x) * u_densityMinAndInvRange.y;\nvec4 color = texture2D(u_gradient, vec2(density, 0.5));\ngl_FragColor = vec4(color.rgb * color.a, color.a);\n}", "heatmapResolve.vert": "precision highp float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nvarying vec2 v_uv;\nconst float UV_TO_TILE_SPACE = 512.;\nvoid main() {\nv_uv = a_pos;\ngl_Position = vec4((u_dvsMat3 * vec3(a_pos * UV_TO_TILE_SPACE, 1.)).xy, 1., 1.);\n}" } }, highlight: { "blur.frag": "varying mediump vec2 v_texcoord;\nuniform mediump vec4 u_direction;\nuniform mediump mat4 u_channelSelector;\nuniform mediump float u_sigma;\nuniform sampler2D u_texture;\nmediump float gauss1(mediump vec2 dir) {\nreturn exp(-dot(dir, dir) / (2.0 * u_sigma * u_sigma));\n}\nmediump vec4 selectChannel(mediump vec4 sample) {\nreturn u_channelSelector * sample;\n}\nvoid accumGauss1(mediump float i, inout mediump float tot, inout mediump float weight) {\nmediump float w = gauss1(i * u_direction.xy);\ntot += selectChannel(texture2D(u_texture, v_texcoord + i * u_direction.zw))[3] * w;\nweight += w;\n}\nvoid main(void) {\nmediump float tot = 0.0;\nmediump float weight = 0.0;\naccumGauss1(-5.0, tot, weight);\naccumGauss1(-4.0, tot, weight);\naccumGauss1(-3.0, tot, weight);\naccumGauss1(-2.0, tot, weight);\naccumGauss1(-1.0, tot, weight);\naccumGauss1(0.0, tot, weight);\naccumGauss1(1.0, tot, weight);\naccumGauss1(2.0, tot, weight);\naccumGauss1(3.0, tot, weight);\naccumGauss1(4.0, tot, weight);\naccumGauss1(5.0, tot, weight);\ngl_FragColor = vec4(0.0, 0.0, 0.0, tot / weight);\n}", "highlight.frag": "varying mediump vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform mediump float u_sigma;\nuniform sampler2D u_shade;\nuniform mediump vec2 u_minMaxDistance;\nmediump float estimateDistance() {\nmediump float y = texture2D(u_texture, v_texcoord)[3];\nconst mediump float y0 = 0.5;\nmediump float m0 = 1.0 / (sqrt(2.0 * 3.1415) * u_sigma);\nmediump float d = (y - y0) / m0;\nreturn d;\n}\nmediump vec4 shade(mediump float d) {\nmediump float mappedDistance = (d - u_minMaxDistance.x) / (u_minMaxDistance.y - u_minMaxDistance.x);\nmappedDistance = clamp(mappedDistance, 0.0, 1.0);\nreturn texture2D(u_shade, vec2(mappedDistance, 0.5));\n}\nvoid main(void) {\nmediump float d = estimateDistance();\ngl_FragColor = shade(d);\n}", "textured.vert": "attribute mediump vec2 a_position;\nattribute mediump vec2 a_texcoord;\nvarying mediump vec2 v_texcoord;\nvoid main(void) {\ngl_Position = vec4(a_position, 0.0, 1.0);\nv_texcoord = a_texcoord;\n}" }, magnifier: { "magnifier.frag": "uniform lowp vec4 u_background;\nuniform mediump sampler2D u_readbackTexture;\nuniform mediump sampler2D u_maskTexture;\nuniform mediump sampler2D u_overlayTexture;\nuniform bool u_maskEnabled;\nuniform bool u_overlayEnabled;\nvarying mediump vec2 v_texCoord;\nconst lowp float barrelFactor = 1.1;\nlowp vec2 barrel(lowp vec2 uv) {\nlowp vec2 uvn = uv * 2.0 - 1.0;\nif (uvn.x == 0.0 && uvn.y == 0.0) {\nreturn vec2(0.5, 0.5);\n}\nlowp float theta = atan(uvn.y, uvn.x);\nlowp float r = pow(length(uvn), barrelFactor);\nreturn r * vec2(cos(theta), sin(theta)) * 0.5 + 0.5;\n}\nvoid main(void)\n{\nlowp vec4 color = texture2D(u_readbackTexture, barrel(v_texCoord));\ncolor = (color + (1.0 - color.a) * u_background);\nlowp float mask = u_maskEnabled ? texture2D(u_maskTexture, v_texCoord).a : 1.0;\ncolor *= mask;\nlowp vec4 overlayColor = u_overlayEnabled ? texture2D(u_overlayTexture, v_texCoord) : vec4(0);\ngl_FragColor = overlayColor + (1.0 - overlayColor.a) * color;\n}", "magnifier.vert": "precision mediump float;\nattribute mediump vec2 a_pos;\nuniform mediump vec4 u_drawPos;\nvarying mediump vec2 v_texCoord;\nvoid main(void)\n{\nv_texCoord = a_pos;\ngl_Position = vec4(u_drawPos.xy + vec2(a_pos - 0.5) * u_drawPos.zw, 0.0, 1.0);\n}" }, materials: { "attributeData.glsl": "uniform highp sampler2D u_attributeData0;\nuniform highp sampler2D u_attributeData1;\nuniform highp sampler2D u_attributeData2;\nuniform highp sampler2D u_attributeData3;\nuniform highp sampler2D u_attributeData4;\nuniform highp sampler2D u_attributeData5;\nuniform highp int u_attributeTextureSize;\nhighp vec2 getAttributeDataCoords(in highp vec3 id) {\nhighp vec3 texel = unpackDisplayIdTexel(id);\nhighp float size = float(u_attributeTextureSize);\nhighp float u32 = float(int(texel.r) + int(texel.g) * 256 + int(texel.b) * 256 * 256);\nhighp float col = mod(u32, size);\nhighp float row = (u32 - col) / size;\nhighp float u = col / size;\nhighp float v = row / size;\nreturn vec2(u, v);\n}\nhighp vec2 getAttributeDataTextureCoords(in highp vec3 id) {\nreturn (getAttributeDataCoords(id) * 2.0) - 1.0 + (.5 / vec2(u_attributeTextureSize));\n}\nhighp vec4 getAttributeData0(in highp vec3 id) {\nvec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData0, coords);\n}\nhighp vec4 getAttributeData1(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData1, coords);\n}\nhighp vec4 getAttributeData2(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData2, coords);\n}\nhighp vec4 getAttributeData3(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData3, coords);\n}\nhighp vec4 getAttributeData4(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData4, coords);\n}\nhighp vec4 getAttributeData5(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData5, coords);\n}\nfloat u88VVToFloat(in vec2 v) {\nbool isMagic = v.x == 255.0 && v.y == 255.0;\nif (isMagic) {\nreturn NAN_MAGIC_NUMBER;\n}\nreturn (v.x + v.y * float(0x100)) - 32768.0;\n}", "barycentric.glsl": "float inTriangle(vec3 bary) {\nvec3 absBary = abs(bary);\nreturn step((absBary.x + absBary.y + absBary.z), 1.05);\n}\nvec3 xyToBarycentric(in vec2 pos, in vec2 v0, in vec2 v1, in vec2 v2) {\nmat3 xyToBarycentricMat3 = mat3(\nv1.x * v2.y - v2.x * v1.y, v2.x * v0.y - v0.x * v2.y, v0.x * v1.y - v1.x * v0.y,\nv1.y - v2.y, v2.y - v0.y, v0.y - v1.y,\nv2.x - v1.x, v0.x - v2.x, v1.x - v0.x\n);\nfloat A2 = v0.x * (v1.y - v2.y) + v1.x * (v2.y - v0.y) + v2.x * (v0.y - v1.y);\nreturn (1. / A2) * xyToBarycentricMat3 * vec3(1., pos);\n}", "constants.glsl": "const float C_DEG_TO_RAD = 3.14159265359 / 180.0;\nconst float C_256_TO_RAD = 3.14159265359 / 128.0;\nconst float C_RAD_TO_DEG = 180.0 / 3.141592654;\nconst float SIGNED_BYTE_TO_UNSIGNED = 128.0;\nconst float POSITION_PRECISION = 1.0 / 8.0;\nconst float FILL_POSITION_PRECISION = 1.0 / 1.0;\nconst float SOFT_EDGE_RATIO = 1.0;\nconst float THIN_LINE_WIDTH_FACTOR = 1.1;\nconst float THIN_LINE_HALF_WIDTH = 1.0;\nconst float EXTRUDE_SCALE_PLACEMENT_PADDING = 1.0 / 4.0;\nconst float OFFSET_PRECISION = 1.0 / 8.0;\nconst float OUTLINE_SCALE = 1.0 / 5.0;\nconst float SDF_FONT_SIZE = 24.0;\nconst float MAX_SDF_DISTANCE = 8.0;\nconst float PLACEMENT_PADDING = 8.0;\nconst float EPSILON = 0.00001;\nconst float EPSILON_HITTEST = 0.05;\nconst int MAX_FILTER_COUNT = 2;\nconst int ATTR_VV_SIZE = 0;\nconst int ATTR_VV_COLOR = 1;\nconst int ATTR_VV_OPACITY = 2;\nconst int ATTR_VV_ROTATION = 3;\nconst highp float NAN_MAGIC_NUMBER = 1e-30;\nconst int BITSET_GENERIC_LOCK_COLOR = 1;\nconst int BITSET_GENERIC_CONSIDER_ALPHA_ONLY = 4;\nconst int BITSET_MARKER_ALIGNMENT_MAP = 0;\nconst int BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE = 2;\nconst int BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY = 3;\nconst int BITSET_TYPE_FILL_OUTLINE = 0;\nconst int BITSET_FILL_RANDOM_PATTERN_OFFSET = 2;\nconst int BITSET_LINE_SCALE_DASH = 2;", fill: { "common.glsl": "#include <materials/symbologyTypeUtils.glsl>\n#ifdef PATTERN\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_sampleAlphaOnly;\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nuniform lowp vec4 u_isActive[ 2 ];\nuniform highp float u_dotValue;\nuniform highp float u_tileDotsOverArea;\nuniform highp float u_dotTextureDotCount;\nuniform mediump float u_tileZoomFactor;\n#endif\nvarying highp vec3 v_id;\nvarying lowp vec4 v_color;\nvarying lowp float v_opacity;\nvarying mediump vec4 v_aux1;\n#ifdef PATTERN\nvarying mediump vec2 v_tileTextureCoord;\n#endif\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nvarying lowp float v_isOutline;\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nvarying highp vec2 v_dotTextureCoords;\nvarying highp vec4 v_dotThresholds[ 2 ];\n#endif", "fill.frag": "precision highp float;\n#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/fill/common.glsl>\n#ifdef PATTERN\nuniform lowp sampler2D u_texture;\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nuniform mediump mat4 u_dotColors[ 2 ];\nuniform sampler2D u_dotTextures[ 2 ];\nuniform vec4 u_dotBackgroundColor;\n#endif\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.frag>\nlowp vec4 drawLine() {\nfloat v_lineWidth = v_aux1.x;\nvec2 v_normal = v_aux1.yz;\nLineData inputs = LineData(\nv_color,\nv_normal,\nv_lineWidth,\nv_opacity,\nv_id\n);\nreturn shadeLine(inputs);\n}\n#endif\nlowp vec4 drawFill() {\nlowp vec4 out_color = vec4(0.);\n#ifdef HITTEST\nout_color = v_color;\n#elif defined(PATTERN)\nmediump vec4 v_tlbr = v_aux1;\nmediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0);\nmediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord);\nlowp vec4 color = texture2D(u_texture, samplePos);\n#ifdef VV_COLOR\nif (v_sampleAlphaOnly > 0.5) {\ncolor.rgb = vec3(color.a);\n}\n#endif\nout_color = v_opacity * v_color * color;\n#elif SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY && !defined(HIGHLIGHT)\nvec4 textureThresholds0 = texture2D(u_dotTextures[0], v_dotTextureCoords);\nvec4 textureThresholds1 = texture2D(u_dotTextures[1], v_dotTextureCoords);\nvec4 difference0 = v_dotThresholds[0] - textureThresholds0;\nvec4 difference1 = v_dotThresholds[1] - textureThresholds1;\n#ifdef DD_DOT_BLENDING\nvec4 isPositive0 = step(0.0, difference0);\nvec4 isPositive1 = step(0.0, difference1);\nfloat weightSum = dot(isPositive0, difference0) + dot(isPositive1, difference1);\nfloat lessThanEqZero = step(weightSum, 0.0);\nfloat greaterThanZero = 1.0 - lessThanEqZero ;\nfloat divisor = (weightSum + lessThanEqZero);\nvec4 weights0 = difference0 * isPositive0 / divisor;\nvec4 weights1 = difference1 * isPositive1 / divisor;\nvec4 dotColor = u_dotColors[0] * weights0 + u_dotColors[1] * weights1;\nvec4 preEffectColor = greaterThanZero * dotColor + lessThanEqZero * u_dotBackgroundColor;\n#else\nfloat diffMax = max(max4(difference0), max4(difference1));\nfloat lessThanZero = step(diffMax, 0.0);\nfloat greaterOrEqZero = 1.0 - lessThanZero;\nvec4 isMax0 = step(diffMax, difference0);\nvec4 isMax1 = step(diffMax, difference1);\nvec4 dotColor = u_dotColors[0] * isMax0 + u_dotColors[1] * isMax1;\nvec4 preEffectColor = greaterOrEqZero * dotColor + lessThanZero * u_dotBackgroundColor;\n#endif\nout_color = preEffectColor;\n#else\nout_color = v_opacity * v_color;\n#endif\n#ifdef HIGHLIGHT\nout_color.a = 1.0;\n#endif\nreturn out_color;\n}\nvoid main() {\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nif (v_isOutline > 0.5) {\ngl_FragColor = drawLine();\n} else {\ngl_FragColor = drawFill();\n}\n#else\ngl_FragColor = drawFill();\n#endif\n}", "fill.vert": "#include <materials/symbologyTypeUtils.glsl>\n#define PACKED_LINE\nprecision highp float;\nattribute float a_bitset;\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nattribute float a_inverseArea;\nvec4 a_color = vec4(0.0, 0.0, 0.0, 1.0);\nvec2 a_zoomRange = vec2(0.0, 10000.0);\n#else\nattribute vec4 a_color;\nattribute vec4 a_aux2;\nattribute vec4 a_aux3;\n#ifndef SYMBOLOGY_TYPE_IS_SIMPLE_LIKE\nattribute vec4 a_aux1;\nattribute vec2 a_zoomRange;\n#else\nvec2 a_zoomRange = vec2(0.0, 10000.0);\n#endif\n#endif\nuniform vec2 u_tileOffset;\n#include <util/encoding.glsl>\n#include <materials/vcommon.glsl>\n#include <materials/fill/common.glsl>\n#include <materials/fill/hittest.glsl>\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nvec4 dotThreshold(vec4 featureAttrOverFeatureArea, float dotValue, float tileDotsOverArea) {\nreturn featureAttrOverFeatureArea * (1.0 / dotValue) * (1.0 / tileDotsOverArea);\n}\n#endif\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.vert>\nvoid drawLine(out lowp vec4 out_color, out highp vec3 out_pos) {\nLineData outputs = buildLine(\nout_pos,\na_id,\na_pos,\na_color,\n(a_aux3.xy - 128.) / 16.,\n(a_aux3.zw - 128.) / 16.,\n0.,\na_aux2.z / 16.,\na_bitset,\nvec4(0.),\nvec2(0.),\na_aux2.w / 16.\n);\nv_id = outputs.id;\nv_opacity = outputs.opacity;\nv_aux1 = vec4(outputs.lineHalfWidth, outputs.normal, 0.);\nout_color = outputs.color;\n}\n#endif\nvoid drawFill(out lowp vec4 out_color, out highp vec3 out_pos) {\nfloat a_bitSet = a_bitset;\nout_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR);\nv_opacity = getOpacity();\nv_id = norm(a_id);\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nmat3 tileToTileNormalized = mat3( 2. / 512., 0., 0.,\n0., -2. / 512., 0.,\n-1., 1., 1. );\nout_pos = tileToTileNormalized * vec3((a_pos * FILL_POSITION_PRECISION), 1.);\n#else\nout_pos = u_dvsMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.);\n#endif\n#ifdef PATTERN\nvec4 a_tlbr = a_aux1;\nfloat a_width = a_aux2.x;\nfloat a_height = a_aux2.y;\nvec2 a_offset = a_aux2.zw;\nvec2 a_scale = a_aux3.xy;\nfloat a_angle = a_aux3.z;\nvec2 scale = (1.0 / SIGNED_BYTE_TO_UNSIGNED) * a_scale;\nfloat width = u_zoomFactor * a_width * scale.x;\nfloat height = u_zoomFactor * a_height * scale.y;\nfloat angle = C_256_TO_RAD * a_angle;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nfloat dx = 0.0;\nfloat dy = 0.0;\nif (getBit(a_bitset, BITSET_FILL_RANDOM_PATTERN_OFFSET) > 0.5) {\nfloat id = rgba2float(vec4(a_id, 0.0));\ndx = rand(vec2(id, 0.0));\ndy = rand(vec2(0.0, id));\n}\nmat3 patternMatrix = mat3(cosA / width, sinA / height, 0,\n-sinA / width, cosA / height, 0,\ndx, dy, 1);\nvec2 tileOffset = vec2(u_tileOffset.x * cosA - u_tileOffset.y * sinA, u_tileOffset.x * sinA + u_tileOffset.y * cosA);\ntileOffset = mod(tileOffset, vec2(a_aux2.x, a_aux2.y));\nvec2 symbolOffset = (a_offset - tileOffset) / vec2(width, height);\nv_tileTextureCoord = (patternMatrix * vec3(a_pos * FILL_POSITION_PRECISION, 1.0)).xy - symbolOffset;\nv_aux1 = a_tlbr / u_mosaicSize.xyxy;\nv_sampleAlphaOnly = getBit(a_bitset, BITSET_GENERIC_CONSIDER_ALPHA_ONLY);\n#elif SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nvec4 ddAttributeData0 = getAttributeData2(a_id) * u_isActive[0] * a_inverseArea;\nvec4 ddAttributeData1 = getAttributeData3(a_id) * u_isActive[1] * a_inverseArea;\nfloat size = u_tileZoomFactor * 512.0 * 1.0 / u_pixelRatio;\nv_dotThresholds[0] = dotThreshold(ddAttributeData0, u_dotValue, u_tileDotsOverArea);\nv_dotThresholds[1] = dotThreshold(ddAttributeData1, u_dotValue, u_tileDotsOverArea);\nv_dotTextureCoords = (a_pos * FILL_POSITION_PRECISION + 0.5) / size;\n#endif\n}\n#ifdef HITTEST\nvoid draw(out lowp vec4 out_color, out highp vec3 out_pos) {\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nif (getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE) > 0.5) {\nout_pos = vec3(0., 0., 2.);\nreturn;\n}\n#endif\nhittestFill(out_color, out_pos);\ngl_PointSize = 1.0;\n}\n#elif defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE)\nvoid draw(out lowp vec4 out_color, out highp vec3 out_pos) {\nv_isOutline = getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE);\nif (v_isOutline > 0.5) {\ndrawLine(out_color, out_pos);\n} else {\ndrawFill(out_color, out_pos);\n}\n}\n#else\n#define draw drawFill\n#endif\nvoid main()\n{\nINIT;\nhighp vec3 pos = vec3(0.);\nhighp vec4 color = vec4(0.);\ndraw(color, pos);\nv_color = color;\ngl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}", "hittest.glsl": "#ifdef HITTEST\n#include <materials/hittest/common.glsl>\nattribute vec2 a_pos1;\nattribute vec2 a_pos2;\nvoid hittestFill(\nout lowp vec4 out_color,\nout highp vec3 out_pos\n) {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.);\nvec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * FILL_POSITION_PRECISION, 1.);\nvec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * FILL_POSITION_PRECISION, 1.);\nfloat hittestDist = u_hittestDist;\nfloat dist = distPointTriangle(u_hittestPos, pos.xy, pos1.xy, pos2.xy);\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nif (dist < 0. || dist >= hittestDist) {\nout_pos.z += 2.0;\n}\nout_color = vec4(1. / 255., 0, 0, dist == 0. ? (1. / 255.) : 0.);\n}\n#endif" }, hittest: { "common.glsl": "#ifdef HITTEST\nuniform float u_hittestDist;\nuniform highp vec2 u_hittestPos;\nfloat projectScalar(vec2 a, vec2 b) {\nreturn dot(a, normalize(b));\n}\nfloat distPointSegment(vec2 p0, vec2 p1, vec2 p2) {\nvec2 L = p2 - p1;\nvec2 A = p0 - p1;\nfloat projAL = projectScalar(A, L);\nfloat t = clamp(projAL / length(L), 0., 1.);\nreturn distance(p0, p1 + t * (p2 - p1));\n}\nvoid hittestMarker(out lowp vec4 out_color, out highp vec3 out_pos, in highp vec3 pos, float size) {\nfloat dist = distance(pos, vec3(u_hittestPos, 1.));\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nif ((dist - size) > u_hittestDist) {\nout_pos.z += 2.0;\n}\nout_color = vec4(1. / 255., 0, 0, (dist - size) < 0. ? (1. / 255.) : 0.);\n}\nfloat intersectPointTriangleBary(vec2 p, vec2 a, vec2 b, vec2 c) {\nreturn inTriangle(xyToBarycentric(p, a, b, c));\n}\nfloat distPointTriangle(vec2 p, vec2 a, vec2 b, vec2 c) {\nvec2 ba = b - a;\nvec2 ca = c - a;\nfloat crossProduct = ba.x * ca.y - ca.x * ba.y;\nbool isParallel = crossProduct < EPSILON_HITTEST && crossProduct > -EPSILON_HITTEST;\nif (isParallel) {\nreturn -1.;\n}\nif (intersectPointTriangleBary(p.xy, a, b, c) == 1.) {\nreturn 0.;\n}\nfloat distAB = distPointSegment(p, a, b);\nfloat distBC = distPointSegment(p, b, c);\nfloat distCA = distPointSegment(p, c, a);\nreturn min(min(distAB, distBC), distCA);\n}\n#endif" }, icon: { "common.glsl": "#include <util/encoding.glsl>\nuniform lowp vec2 u_mosaicSize;\nvarying lowp vec4 v_color;\nvarying highp vec3 v_id;\nvarying highp vec4 v_sizeTex;\nvarying mediump vec3 v_pos;\nvarying lowp float v_opacity;\nuniform lowp sampler2D u_texture;\n#ifdef SDF\nvarying lowp vec4 v_outlineColor;\nvarying mediump float v_outlineWidth;\nvarying mediump float v_distRatio;\nvarying mediump float v_overridingOutlineColor;\nvarying mediump float v_isThin;\n#endif\n#ifdef SDF\nvec4 getColor(vec2 v_size, vec2 v_tex) {\nlowp vec4 fillPixelColor = v_color;\nfloat d = 0.5 - rgba2float(texture2D(u_texture, v_tex));\nfloat size = max(v_size.x, v_size.y);\nfloat dist = d * size * SOFT_EDGE_RATIO * v_distRatio;\nfillPixelColor *= clamp(0.5 - dist, 0.0, 1.0);\nfloat outlineWidth = v_outlineWidth;\n#ifdef HIGHLIGHT\noutlineWidth = max(outlineWidth, 4.0 * v_isThin);\n#endif\nif (outlineWidth > 0.25) {\nlowp vec4 outlinePixelColor = v_overridingOutlineColor * v_color + (1.0 - v_overridingOutlineColor) * v_outlineColor;\nfloat clampedOutlineSize = min(outlineWidth, size);\noutlinePixelColor *= clamp(0.5 - abs(dist) + clampedOutlineSize * 0.5, 0.0, 1.0);\nreturn v_opacity * ((1.0 - outlinePixelColor.a) * fillPixelColor + outlinePixelColor);\n}\nreturn v_opacity * fillPixelColor;\n}\n#else\nvec4 getColor(vec2 _v_size, vec2 v_tex) {\nlowp vec4 texColor = texture2D(u_texture, v_tex);\nreturn v_opacity * texColor * v_color;\n}\n#endif", heatmapAccumulate: { "common.glsl": "varying lowp vec4 v_hittestResult;\nvarying mediump vec2 v_offsetFromCenter;\nvarying highp float v_fieldValue;", "heatmapAccumulate.frag": "precision mediump float;\n#include <materials/icon/heatmapAccumulate/common.glsl>\n#ifdef HEATMAP_PRECISION_HALF_FLOAT\n#define COMPRESSION_FACTOR 0.25\n#else\n#define COMPRESSION_FACTOR 1.0\n#endif\nuniform lowp sampler2D u_texture;\nvoid main() {\n#ifdef HITTEST\ngl_FragColor = v_hittestResult;\n#else\nfloat radius = length(v_offsetFromCenter);\nfloat shapeWeight = step(radius, 1.0);\nfloat oneMinusRadiusSquared = 1.0 - radius * radius;\nfloat kernelWeight = oneMinusRadiusSquared * oneMinusRadiusSquared;\ngl_FragColor = vec4(shapeWeight * kernelWeight * v_fieldValue * COMPRESSION_FACTOR);\n#endif\n}", "heatmapAccumulate.vert": "precision highp float;\nattribute vec2 a_vertexOffset;\nvec4 a_color = vec4(0.0);\nvec2 a_zoomRange = vec2(0.0, 10000.0);\nuniform float u_radius;\nuniform float u_isFieldActive;\nconst float TILE_TO_CLIP_SPACE = 2.0 / 512.0;\n#include <materials/vcommon.glsl>\n#include <materials/hittest/common.glsl>\n#include <materials/icon/heatmapAccumulate/common.glsl>\nvoid main() {\nfloat filterFlags = getFilterFlags();\n#ifdef HITTEST\nhighp vec4 out_hittestResult = vec4(0.);\nhighp vec3 out_pos = vec3(0.);\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.0);\nhittestMarker(out_hittestResult, out_pos, pos, u_radius);\nv_hittestResult = out_hittestResult;\ngl_PointSize = 1.;\ngl_Position = vec4(clip(a_color, out_pos, filterFlags, a_zoomRange), 1.0);\n#else\nv_offsetFromCenter = sign(a_vertexOffset);\nv_fieldValue = getAttributeData2(a_id).x * u_isFieldActive + 1.0 - u_isFieldActive;\nvec3 centerPos = vec3(a_pos * POSITION_PRECISION * TILE_TO_CLIP_SPACE - 1.0, 1.0);\nvec3 vertexPos = centerPos + vec3(v_offsetFromCenter, 0.0) * u_radius * TILE_TO_CLIP_SPACE;\ngl_Position = vec4(clip(a_color, vertexPos, filterFlags, a_zoomRange), 1.0);\n#endif\n}" }, "hittest.glsl": "#ifdef HITTEST\n#include <materials/hittest/common.glsl>\nattribute vec2 a_vertexOffset1;\nattribute vec2 a_vertexOffset2;\nattribute vec2 a_texCoords1;\nattribute vec2 a_texCoords2;\nvec2 getTextureCoords(in vec3 bary, in vec2 texCoords0, in vec2 texCoords1, in vec2 texCoords2) {\nreturn texCoords0 * bary.x + texCoords1 * bary.y + texCoords2 * bary.z;\n}\nvoid hittestIcon(\ninout lowp vec4 out_color,\nout highp vec3 out_pos,\nin vec3 pos,\nin vec3 offset,\nin vec2 size,\nin float scaleFactor,\nin float isMapAligned\n) {\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nvec3 posBase = u_viewMat3 * u_tileMat3 * pos;\nvec3 offset1 = scaleFactor * vec3(a_vertexOffset1 / 16.0, 0.);\nvec3 offset2 = scaleFactor * vec3(a_vertexOffset2 / 16.0, 0.);\nvec2 pos0 = (posBase + getMatrixNoDisplay(isMapAligned) * offset).xy;\nvec2 pos1 = (posBase + getMatrixNoDisplay(isMapAligned) * offset1).xy;\nvec2 pos2 = (posBase + getMatrixNoDisplay(isMapAligned) * offset2).xy;\nvec3 bary0 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, -u_hittestDist), pos0, pos1, pos2);\nvec3 bary1 = xyToBarycentric(u_hittestPos + vec2(0., -u_hittestDist), pos0, pos1, pos2);\nvec3 bary2 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, -u_hittestDist), pos0, pos1, pos2);\nvec3 bary3 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, 0.), pos0, pos1, pos2);\nvec3 bary4 = xyToBarycentric(u_hittestPos, pos0, pos1, pos2);\nvec3 bary5 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, 0.), pos0, pos1, pos2);\nvec3 bary6 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, u_hittestDist), pos0, pos1, pos2);\nvec3 bary7 = xyToBarycentric(u_hittestPos + vec2(0., u_hittestDist), pos0, pos1, pos2);\nvec3 bary8 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, u_hittestDist), pos0, pos1, pos2);\nvec2 tex0 = a_texCoords / u_mosaicSize;\nvec2 tex1 = a_texCoords1 / u_mosaicSize;\nvec2 tex2 = a_texCoords2 / u_mosaicSize;\nfloat alphaSum = 0.;\nalphaSum += inTriangle(bary0) * getColor(size, getTextureCoords(bary0, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary1) * getColor(size, getTextureCoords(bary1, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary2) * getColor(size, getTextureCoords(bary2, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary3) * getColor(size, getTextureCoords(bary3, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary4) * getColor(size, getTextureCoords(bary4, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary5) * getColor(size, getTextureCoords(bary5, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary6) * getColor(size, getTextureCoords(bary6, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary7) * getColor(size, getTextureCoords(bary7, tex0, tex1, tex2)).a;\nout_pos.z += step(alphaSum, .05) * 2.0;\nout_color = vec4(1. / 255., 0., 0., alphaSum / 255.);\n}\n#endif", "icon.frag": "precision mediump float;\n#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/icon/common.glsl>\nvoid main()\n{\n#ifdef HITTEST\nvec4 color = v_color;\n#else\nvec4 color = getColor(v_sizeTex.xy, v_sizeTex.zw);\n#endif\n#ifdef HIGHLIGHT\ncolor.a = step(1.0 / 255.0, color.a);\n#endif\ngl_FragColor = color;\n}", "icon.vert": "precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_outlineColor;\nattribute vec4 a_sizeAndOutlineWidth;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nattribute vec2 a_bitSetAndDistRatio;\nattribute vec2 a_zoomRange;\n#include <materials/vcommon.glsl>\n#include <materials/icon/common.glsl>\n#include <materials/icon/hittest.glsl>\nfloat getMarkerScaleFactor(inout vec2 size, in float referenceSize) {\n#ifdef VV_SIZE\nfloat f = getSize(size.y) / size.y;\nfloat sizeFactor = size.y / referenceSize;\nreturn getSize(referenceSize) / referenceSize;\n#else\nreturn 1.;\n#endif\n}\nvoid main()\n{\nINIT;\nfloat a_bitSet = a_bitSetAndDistRatio.x;\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nvec2 size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0;\nvec3 offset = vec3(a_vertexOffset / 16.0, 0.);\nfloat outlineSize = a_sizeAndOutlineWidth.z * a_sizeAndOutlineWidth.z / 128.0;\nfloat isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP);\nfloat referenceSize = a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0;\nfloat scaleSymbolProportionally = getBit(a_bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY);\nfloat scaleFactor = getMarkerScaleFactor(size, referenceSize);\nsize.xy *= scaleFactor;\noffset.xy *= scaleFactor;\noutlineSize *= scaleSymbolProportionally * (scaleFactor - 1.0) + 1.0;\nvec2 v_tex = a_texCoords / u_mosaicSize;\nfloat filterFlags = getFilterFlags();\nv_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_pos = u_dvsMat3 * pos + getMatrix(isMapAligned) * getRotation() * offset;\nv_sizeTex = vec4(size.xy, v_tex.xy);\n#ifdef SDF\nv_isThin = getBit(a_bitSet, BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE);\n#ifdef VV_COLOR\nv_overridingOutlineColor = v_isThin;\n#else\nv_overridingOutlineColor = 0.0;\n#endif\nv_outlineWidth = min(outlineSize, max(max(size.x, size.y) - 0.99, 0.0));\nv_outlineColor = a_outlineColor;\nv_distRatio = a_bitSetAndDistRatio.y / 126.0;\n#endif\n#ifdef HITTEST\nhighp vec4 out_color = vec4(0.);\nhighp vec3 out_pos = vec3(0.);\nhittestIcon(out_color, out_pos, pos, offset, size, scaleFactor, isMapAligned);\nv_color = out_color;\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, out_pos, filterFlags, a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, filterFlags, a_zoomRange), 1.0);\n#endif\n}" }, label: { "common.glsl": "uniform mediump float u_zoomLevel;\nuniform mediump float u_mapRotation;\nuniform mediump float u_mapAligned;\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_antialiasingWidth;\nvarying mediump float v_edgeDistanceOffset;\nvarying mediump vec2 v_tex;\nvarying mediump vec4 v_color;\nvarying lowp vec4 v_animation;", "label.frag": "#include <materials/text/text.frag>", "label.vert": "precision highp float;\n#include <materials/vcommon.glsl>\n#include <materials/text/common.glsl>\nattribute vec4 a_color;\nattribute vec4 a_haloColor;\nattribute vec4 a_texAndSize;\nattribute vec4 a_refSymbolAndPlacementOffset;\nattribute vec4 a_glyphData;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nuniform float u_isHalo;\nuniform float u_mapRotation;\nuniform float u_mapAligned;\nfloat getZ(in float minZoom, in float maxZoom, in float angle) {\nfloat glyphAngle = angle * 360.0 / 254.0;\nfloat mapAngle = u_mapRotation * 360.0 / 254.0;\nfloat diffAngle = min(360.0 - abs(mapAngle - glyphAngle), abs(mapAngle - glyphAngle));\nfloat z = 0.0;\nz += u_mapAligned * (2.0 * (1.0 - step(minZoom, u_currentZoom)));\nz += u_mapAligned * 2.0 * step(90.0, diffAngle);\nz += 2.0 * (1.0 - step(u_currentZoom, maxZoom));\nreturn z;\n}\nvoid main()\n{\nINIT;\nfloat groupMinZoom = getMinZoom();\nfloat glyphMinZoom = a_glyphData.x;\nfloat glyphMaxZoom = a_glyphData.y;\nfloat glyphAngle = a_glyphData.z;\nfloat a_minZoom = max(groupMinZoom, glyphMinZoom);\nfloat a_placementPadding = a_refSymbolAndPlacementOffset.x * EXTRUDE_SCALE_PLACEMENT_PADDING;\nvec2 a_placementDir = unpack_u8_nf32(a_refSymbolAndPlacementOffset.zw);\nfloat a_refSymbolSize = a_refSymbolAndPlacementOffset.y;\nfloat fontSize = a_texAndSize.z;\nfloat haloSize = a_texAndSize.w * OUTLINE_SCALE;\nvec2 vertexOffset = a_vertexOffset * OFFSET_PRECISION;\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nfloat z = getZ(a_minZoom, glyphMaxZoom, glyphAngle);\nfloat fontScale = fontSize / SDF_FONT_SIZE;\nfloat halfSize = getSize(a_refSymbolSize) / 2.0;\nfloat animation = pow(getAnimationState(), vec4(2.0)).r;\nv_color = animation * ((1.0 - u_isHalo) * a_color + (u_isHalo * a_haloColor));\nv_opacity = 1.0;\nv_tex = a_texCoords / u_mosaicSize;\nv_edgeDistanceOffset = u_isHalo * haloSize / fontScale / MAX_SDF_DISTANCE;\nv_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio;\nvec2 placementOffset = a_placementDir * (halfSize + a_placementPadding);\nvec3 glyphOffset = u_displayMat3 * vec3(vertexOffset + placementOffset, 0.0);\nvec3 v_pos = vec3((u_dvsMat3 * pos + glyphOffset).xy, z);\ngl_Position = vec4(v_pos, 1.0);\n#ifdef DEBUG\nv_color = vec4(a_color.rgb, z == 0.0 ? 1.0 : 0.645);\n#endif\n}" }, line: { "common.glsl": "varying lowp vec4 v_color;\nvarying highp vec3 v_id;\nvarying mediump vec2 v_normal;\nvarying mediump float v_lineHalfWidth;\nvarying lowp float v_opacity;\n#ifdef PATTERN\nvarying mediump vec4 v_tlbr;\nvarying mediump vec2 v_patternSize;\n#endif\n#if defined(PATTERN) || defined(SDF)\nvarying highp float v_accumulatedDistance;\n#endif\n#ifdef SDF\nvarying mediump float v_lineWidthRatio;\n#endif", "hittest.glsl": "#include <materials/hittest/common.glsl>\n#ifdef HITTEST\nattribute vec2 a_pos1;\nattribute vec2 a_pos2;\nvoid hittestLine(out lowp vec4 out_color, out highp vec3 out_pos, float halfWidth) {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.);\nvec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * POSITION_PRECISION, 1.);\nvec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * POSITION_PRECISION, 1.);\nvec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nfloat dist = min(distPointSegment(u_hittestPos, pos.xy, pos1.xy),\ndistPointSegment(u_hittestPos, pos.xy, pos2.xy)) - halfWidth;\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nif (dist >= u_hittestDist) {\nout_pos.z += 2.0;\n}\nout_color = vec4(1. / 255., 0, 0, dist <= 0. ? (1. / 255.) : 0.);\n}\n#endif", "line.frag": "precision lowp float;\n#include <util/encoding.glsl>\n#include <materials/constants.glsl>\n#include <materials/symbologyTypeUtils.glsl>\n#include <materials/line/common.glsl>\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.frag>\n#ifdef HITTEST\nvoid main() {\ngl_FragColor = v_color;\n}\n#else\nvoid main() {\nLineData inputs = LineData(\nv_color,\nv_normal,\nv_lineHalfWidth,\nv_opacity,\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nv_tlbr,\nv_patternSize,\n#endif\n#ifdef SDF\nv_lineWidthRatio,\n#endif\n#if defined(PATTERN) || defined(SDF)\nv_accumulatedDistance,\n#endif\n#endif\nv_id\n);\ngl_FragColor = shadeLine(inputs);\n}\n#endif", "line.vert": "precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_offsetAndNormal;\nattribute vec2 a_accumulatedDistanceAndHalfWidth;\nattribute vec4 a_tlbr;\nattribute vec4 a_segmentDirection;\nattribute vec2 a_aux;\nattribute vec2 a_zoomRange;\n#include <materials/vcommon.glsl>\n#include <materials/symbologyTypeUtils.glsl>\n#include <materials/line/common.glsl>\n#include <materials/line/hittest.glsl>\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.vert>\n#ifdef HITTEST\nvoid draw() {\nfloat aa = 0.5 * u_antialiasing;\nfloat a_halfWidth = a_accumulatedDistanceAndHalfWidth.y / 16.;\nfloat a_cimHalfWidth = a_aux.x / 16. ;\nvec2 a_offset = a_offsetAndNormal.xy / 16.;\nfloat baseWidth = getBaseLineHalfWidth(a_halfWidth, a_cimHalfWidth);\nfloat halfWidth = getLineHalfWidth(baseWidth, aa);\nhighp vec3 pos = vec3(0.);\nv_color = vec4(0.);\nhittestLine(v_color, pos, halfWidth);\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}\n#else\nvoid draw()\n{\nhighp vec3 pos = vec3(0.);\nLineData outputs = buildLine(\npos,\na_id,\na_pos,\na_color,\na_offsetAndNormal.xy / 16.,\na_offsetAndNormal.zw / 16.,\na_accumulatedDistanceAndHalfWidth.x,\na_accumulatedDistanceAndHalfWidth.y / 16.,\na_segmentDirection.w,\na_tlbr,\na_segmentDirection.xy / 16.,\na_aux.x / 16.\n);\nv_id = outputs.id;\nv_color = outputs.color;\nv_normal = outputs.normal;\nv_lineHalfWidth = outputs.lineHalfWidth;\nv_opacity = outputs.opacity;\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nv_tlbr = outputs.tlbr;\nv_patternSize = outputs.patternSize;\n#endif\n#ifdef SDF\nv_lineWidthRatio = outputs.lineWidthRatio;\n#endif\n#if defined(PATTERN) || defined(SDF)\nv_accumulatedDistance = outputs.accumulatedDistance;\n#endif\n#endif\ngl_Position = vec4(clip(outputs.color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}\n#endif\nvoid main() {\nINIT;\ndraw();\n}" }, pie: { "pie.frag": "precision mediump float;\n#include <util/atan2.glsl>\n#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/icon/common.glsl>\nvarying float v_size;\nvarying vec2 v_offset;\nvarying vec2 v_filteredSectorToColorId[NUMBER_OF_FIELDS];\nvarying float v_numOfEntries;\nvarying float v_maxSectorAngle;\nuniform lowp vec4 u_colors[NUMBER_OF_FIELDS];\nuniform lowp vec4 u_defaultColor;\nuniform lowp vec4 u_othersColor;\nuniform lowp vec4 u_outlineColor;\nuniform float u_donutRatio;\nuniform float u_sectorThreshold;\nstruct FilteredChartInfo {\nfloat endSectorAngle;\nint colorId;\n};\nlowp vec4 getSectorColor(in int index, in vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]) {\n#if __VERSION__ == 300\nmediump int colorIndex = int(filteredSectorToColorId[index].y);\nreturn u_colors[colorIndex];\n#else\nmediump int colorIndex;\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nif (i == index) {\ncolorIndex = int(filteredSectorToColorId[i].y);\n}\n}\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nif (i == colorIndex) {\nreturn u_colors[i];\n}\n}\nreturn u_colors[NUMBER_OF_FIELDS - 1];\n#endif\n}\nconst int OTHER_SECTOR_ID = 255;\n#ifdef HITTEST\nvec4 getColor() {\nreturn v_color;\n}\n#else\nvec4 getColor() {\nfloat angle = 90.0 - C_RAD_TO_DEG * atan2(v_offset.y, v_offset.x);\nif (angle < 0.0) {\nangle += 360.0;\n} else if (angle > 360.0) {\nangle = mod(angle, 360.0);\n}\nint numOfEntries = int(v_numOfEntries);\nfloat maxSectorAngle = v_maxSectorAngle;\nlowp vec4 fillColor = (maxSectorAngle > 0.0 || u_sectorThreshold > 0.0) ? u_othersColor : u_defaultColor;\nlowp vec4 prevColor = vec4(0.0);\nlowp vec4 nextColor = vec4(0.0);\nfloat startSectorAngle = 0.0;\nfloat endSectorAngle = 0.0;\nif (angle < maxSectorAngle) {\nfor (int index = 0; index < NUMBER_OF_FIELDS; ++index) {\nstartSectorAngle = endSectorAngle;\nendSectorAngle = v_filteredSectorToColorId[index].x;\nif (endSectorAngle > angle) {\nfillColor = getSectorColor(index, v_filteredSectorToColorId);\nprevColor = u_sectorThreshold != 0.0 && index == 0 && abs(360.0 - maxSectorAngle) < EPSILON ? u_othersColor :\ngetSectorColor(index > 0 ? index - 1 : numOfEntries - 1, v_filteredSectorToColorId);\nnextColor = u_sectorThreshold != 0.0 && abs(endSectorAngle - maxSectorAngle) < EPSILON ? u_othersColor :\ngetSectorColor(index < numOfEntries - 1 ? index + 1 : 0, v_filteredSectorToColorId);\nbreak;\n}\nif (index == numOfEntries - 1) {\nbreak;\n}\n}\n} else {\nprevColor = getSectorColor(numOfEntries - 1, v_filteredSectorToColorId);\nnextColor = getSectorColor(0, v_filteredSectorToColorId);\nstartSectorAngle = maxSectorAngle;\nendSectorAngle = 360.0;\n}\nlowp vec4 outlineColor = u_outlineColor;\nfloat offset = length(v_offset);\nfloat distanceSize = offset * v_size;\nif (startSectorAngle != 0.0 || endSectorAngle != 360.0) {\nfloat distanceToStartSector = (angle - startSectorAngle);\nfloat distanceToEndSector = (endSectorAngle - angle);\nfloat sectorThreshold = 0.6;\nfloat beginSectorAlpha = smoothstep(0.0, sectorThreshold, distanceToStartSector * offset);\nfloat endSectorAlpha = smoothstep(0.0, sectorThreshold, distanceToEndSector * offset);\nif (endSectorAlpha > 0.0) {\nfillColor = mix(nextColor, fillColor, endSectorAlpha);\n} else if (beginSectorAlpha > 0.0) {\nfillColor = mix(prevColor, fillColor, beginSectorAlpha);\n}\n}\nfloat donutSize = u_donutRatio * (v_size - v_outlineWidth);\nfloat endOfDonut = donutSize - v_outlineWidth;\nfloat aaThreshold = 0.75;\nfloat innerCircleAlpha = endOfDonut - aaThreshold > 0.0 ? smoothstep(endOfDonut - aaThreshold, endOfDonut + aaThreshold, distanceSize) : 1.0;\nfloat outerCircleAlpha = 1.0 - smoothstep(v_size - aaThreshold, v_size + aaThreshold , distanceSize);\nfloat circleAlpha = innerCircleAlpha * outerCircleAlpha;\nfloat startOfOutline = v_size - v_outlineWidth;\nif (startOfOutline > 0.0 && v_outlineWidth > 0.25) {\nfloat outlineFactor = smoothstep(startOfOutline - aaThreshold, startOfOutline + aaThreshold, distanceSize);\nfloat innerLineFactor = donutSize - aaThreshold > 0.0 ? 1.0 - smoothstep(donutSize - aaThreshold, donutSize + aaThreshold , distanceSize) : 0.0;\nfillColor = mix(fillColor, outlineColor, innerLineFactor + outlineFactor);\n}\nreturn v_opacity * circleAlpha * fillColor;\n}\n#endif\nvoid main()\n{\nvec4 color = getColor();\n#ifdef HIGHLIGHT\ncolor.a = step(1.0 / 255.0, color.a);\n#endif\ngl_FragColor = color;\n}", "pie.vert": "precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_outlineColor;\nattribute vec4 a_sizeAndOutlineWidth;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nattribute vec2 a_bitSetAndDistRatio;\nattribute vec2 a_zoomRange;\nuniform float u_outlineWidth;\nuniform mediump float u_sectorThreshold;\nvarying float v_size;\nvarying vec2 v_offset;\nvarying vec2 v_filteredSectorToColorId[NUMBER_OF_FIELDS];\nvarying float v_numOfEntries;\nvarying float v_maxSectorAngle;\nstruct FilteredChartInfo {\nfloat endSectorAngle;\nint colorId;\n};\nint filter(in float sectorAngle,\nin int currentIndex,\ninout FilteredChartInfo filteredInfo,\ninout vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]) {\nif (sectorAngle > u_sectorThreshold * 360.0) {\nfilteredInfo.endSectorAngle += sectorAngle;\n#if __VERSION__ == 300\nfilteredSectorToColorId[filteredInfo.colorId] = vec2(filteredInfo.endSectorAngle, currentIndex);\n#else\nfor (int i = 0; i < NUMBER_OF_FIELDS; i++) {\nif (i == filteredInfo.colorId) {\nfilteredSectorToColorId[i] = vec2(filteredInfo.endSectorAngle, currentIndex);\n}\n}\n#endif\n++filteredInfo.colorId;\n}\nreturn 0;\n}\nint filterValues(inout vec2 filteredSectorToColorId[NUMBER_OF_FIELDS],\ninout FilteredChartInfo filteredInfo,\nin float sectorAngles[NUMBER_OF_FIELDS]) {\nfor (int index = 0; index < NUMBER_OF_FIELDS; ++index) {\nfloat sectorValue = sectorAngles[index];\nfilter(sectorValue, index, filteredInfo, filteredSectorToColorId);\n}\nreturn filteredInfo.colorId;\n}\n#include <materials/vcommon.glsl>\n#include <materials/icon/common.glsl>\n#include <materials/hittest/common.glsl>\nvec2 getMarkerSize(inout vec2 offset, inout vec2 baseSize, inout float outlineSize, in float referenceSize, in float bitSet) {\nvec2 outSize = baseSize;\n#ifdef VV_SIZE\nfloat r = 0.5 * getSize(referenceSize) / referenceSize;\noutSize.xy *= r;\noffset.xy *= r;\nfloat scaleSymbolProportionally = getBit(bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY);\noutlineSize *= scaleSymbolProportionally * (r - 1.0) + 1.0;\n#endif\nreturn outSize;\n}\nvec3 getOffset(in vec2 in_offset, float a_bitSet) {\nfloat isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP);\nvec3 offset = vec3(in_offset, 0.0);\nreturn getMatrix(isMapAligned) * offset;\n}\nfloat filterNaNValues(in float value) {\nreturn value != NAN_MAGIC_NUMBER ? value : 0.0;\n}\nvoid main()\n{\nINIT;\nvec2 a_size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0;\nvec2 a_offset = a_vertexOffset / 16.0;\nfloat outlineSize = u_outlineWidth;\nfloat a_bitSet = a_bitSetAndDistRatio.x;\nvec2 size = getMarkerSize(a_offset, a_size, outlineSize, a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0, a_bitSet);\nfloat filterFlags = getFilterFlags();\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_pos = u_dvsMat3 * pos + getOffset(a_offset, a_bitSet);\nv_offset = sign(a_texCoords - 0.5);\nv_size = max(size.x, size.y);\nv_outlineWidth = outlineSize;\nfloat attributeData[10];\nvec4 attributeData0 = getAttributeData3(a_id);\nattributeData[0] = filterNaNValues(attributeData0.x);\nattributeData[1] = filterNaNValues(attributeData0.y);\nattributeData[2] = filterNaNValues(attributeData0.z);\nattributeData[3] = filterNaNValues(attributeData0.w);\n#if (NUMBER_OF_FIELDS > 4)\nvec4 attributeData1 = getAttributeData4(a_id);\nattributeData[4] = filterNaNValues(attributeData1.x);\nattributeData[5] = filterNaNValues(attributeData1.y);\nattributeData[6] = filterNaNValues(attributeData1.z);\nattributeData[7] = filterNaNValues(attributeData1.w);\n#endif\n#if (NUMBER_OF_FIELDS > 8)\nvec4 attributeData2 = getAttributeData5(a_id);\nattributeData[8] = filterNaNValues(attributeData2.x);\nattributeData[9] = filterNaNValues(attributeData2.y);\n#endif\nfloat sum = 0.0;\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nsum += attributeData[i];\n}\nfloat sectorAngles[NUMBER_OF_FIELDS];\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nsectorAngles[i] = 360.0 * attributeData[i] / sum;\n}\nvec2 filteredSectorToColorId[NUMBER_OF_FIELDS];\nFilteredChartInfo filteredInfo = FilteredChartInfo(0.0, 0);\nint numOfEntries = filterValues(filteredSectorToColorId, filteredInfo, sectorAngles);\nv_numOfEntries = float(numOfEntries);\nv_maxSectorAngle = filteredInfo.endSectorAngle;\n#if __VERSION__ == 300\nv_filteredSectorToColorId = filteredSectorToColorId;\n#else\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nif (i == numOfEntries) {\nbreak;\n}\nv_filteredSectorToColorId[i] = filteredSectorToColorId[i];\n}\n#endif\n#ifdef HITTEST\nhighp vec3 out_pos = vec3(0.0);\nv_color = vec4(0.0);\nhittestMarker(v_color, out_pos, u_viewMat3 * u_tileMat3 * pos, v_size);\ngl_PointSize = 1.0;\ngl_Position = vec4(clip(v_color, out_pos, filterFlags, a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, filterFlags, a_zoomRange), 1.0);\n#endif\n}" }, shared: { line: { "common.glsl": "#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && defined(PATTERN)\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_sampleAlphaOnly;\n#endif\nstruct LineData {\nlowp vec4 color;\nmediump vec2 normal;\nmediump float lineHalfWidth;\nlowp float opacity;\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nmediump vec4 tlbr;\nmediump vec2 patternSize;\n#endif\n#ifdef SDF\nmediump float lineWidthRatio;\n#endif\n#if defined(PATTERN) || defined(SDF)\nhighp float accumulatedDistance;\n#endif\n#endif\nhighp vec3 id;\n};", "line.frag": "uniform lowp float u_blur;\n#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && !defined(HIGHLIGHT)\n#if defined(PATTERN) || defined(SDF)\nuniform sampler2D u_texture;\nuniform highp float u_pixelRatio;\n#endif\n#endif\n#if defined(SDF) && !defined(HIGHLIGHT) && !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE)\nlowp vec4 getLineColor(LineData line) {\nmediump float adjustedPatternWidth = line.patternSize.x * 2.0 * line.lineWidthRatio;\nmediump float relativeTexX = fract(line.accumulatedDistance / adjustedPatternWidth);\nmediump float relativeTexY = 0.5 + 0.25 * line.normal.y;\nmediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexX, relativeTexY));\nmediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5;\nfloat dist = d * line.lineHalfWidth;\nreturn line.opacity * clamp(0.5 - dist, 0.0, 1.0) * line.color;\n}\n#elif defined(PATTERN) && !defined(HIGHLIGHT) && !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE)\nlowp vec4 getLineColor(LineData line) {\nmediump float lineHalfWidth = line.lineHalfWidth;\nmediump float adjustedPatternWidth = line.patternSize.x * 2.0 * lineHalfWidth / line.patternSize.y;\nmediump float relativeTexX = fract(line.accumulatedDistance / adjustedPatternWidth);\nmediump float relativeTexY = 0.5 + 0.5 * line.normal.y;\nmediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexY, relativeTexX));\nlowp vec4 color = texture2D(u_texture, texCoord);\n#ifdef VV_COLOR\nif (v_sampleAlphaOnly > 0.5) {\ncolor.rgb = vec3(color.a);\n}\n#endif\nreturn line.opacity * line.color * color;\n}\n#else\nlowp vec4 getLineColor(LineData line) {\nreturn line.opacity * line.color;\n}\n#endif\nvec4 shadeLine(LineData line)\n{\nmediump float thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(line.lineHalfWidth, THIN_LINE_HALF_WIDTH), 1.0);\nmediump float fragDist = length(line.normal) * line.lineHalfWidth;\nlowp float alpha = clamp(thinLineFactor * (line.lineHalfWidth - fragDist) / (u_blur + thinLineFactor - 1.0), 0.0, 1.0);\nlowp vec4 out_color = getLineColor(line) * alpha;\n#ifdef HIGHLIGHT\nout_color.a = step(1.0 / 255.0, out_color.a);\n#endif\n#ifdef ID\nif (out_color.a < 1.0 / 255.0) {\ndiscard;\n}\nout_color = vec4(line.id, 0.0);\n#endif\nreturn out_color;\n}", "line.vert": "float getBaseLineHalfWidth(in float lineHalfWidth, in float referenceHalfWidth) {\n#ifdef VV_SIZE\nfloat refLineWidth = 2.0 * referenceHalfWidth;\nreturn 0.5 * (lineHalfWidth / max(referenceHalfWidth, EPSILON)) * getSize(refLineWidth);\n#else\nreturn lineHalfWidth;\n#endif\n}\nfloat getLineHalfWidth(in float baseWidth, in float aa) {\nfloat halfWidth = max(baseWidth + aa, 0.45) + 0.1 * aa;\n#ifdef HIGHLIGHT\nhalfWidth = max(halfWidth, 2.0);\n#endif\nreturn halfWidth;\n}\nvec2 getDist(in vec2 offset, in float halfWidth) {\nfloat thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(halfWidth, THIN_LINE_HALF_WIDTH), 1.0);\nreturn thinLineFactor * halfWidth * offset;\n}\nLineData buildLine(\nout vec3 out_pos,\nin vec3 in_id,\nin vec2 in_pos,\nin vec4 in_color,\nin vec2 in_offset,\nin vec2 in_normal,\nin float in_accumulatedDist,\nin float in_lineHalfWidth,\nin float in_bitSet,\nin vec4 in_tlbr,\nin vec2 in_segmentDirection,\nin float in_referenceHalfWidth\n)\n{\nfloat aa = 0.5 * u_antialiasing;\nfloat baseWidth = getBaseLineHalfWidth(in_lineHalfWidth, in_referenceHalfWidth);\nfloat halfWidth = getLineHalfWidth(baseWidth, aa);\nfloat z = 2.0 * step(baseWidth, 0.0);\nvec2 dist = getDist(in_offset, halfWidth);\nvec3 offset = u_displayViewMat3 * vec3(dist, 0.0);\nvec3 pos = u_dvsMat3 * vec3(in_pos * POSITION_PRECISION, 1.0) + offset;\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nvec4 color = in_color;\nfloat opacity = 1.0;\n#else\nvec4 color = getColor(in_color, in_bitSet, BITSET_GENERIC_LOCK_COLOR);\nfloat opacity = getOpacity();\n#ifdef SDF\nconst float SDF_PATTERN_HALF_WIDTH = 15.5;\nfloat scaleDash = getBit(in_bitSet, BITSET_LINE_SCALE_DASH);\nfloat lineWidthRatio = (scaleDash * max(halfWidth - 0.55 * u_antialiasing, 0.25) + (1.0 - scaleDash)) / SDF_PATTERN_HALF_WIDTH;\n#endif\n#endif\n#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && defined(PATTERN)\nv_sampleAlphaOnly = getBit(in_bitSet, BITSET_GENERIC_CONSIDER_ALPHA_ONLY);\n#endif\nout_pos = vec3(pos.xy, z);\nreturn LineData(\ncolor,\nin_normal,\nhalfWidth,\nopacity,\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nin_tlbr / u_mosaicSize.xyxy,\nvec2(in_tlbr.z - in_tlbr.x, in_tlbr.w - in_tlbr.y),\n#endif\n#ifdef SDF\nlineWidthRatio,\n#endif\n#if defined(PATTERN) || defined(SDF)\nin_accumulatedDist * u_zoomFactor + dot(in_segmentDirection, dist),\n#endif\n#endif\nnorm(in_id)\n);\n}" } }, "symbologyTypeUtils.glsl": "#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL || SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL_SIMPLE\n#define SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_SIMPLE || SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL_SIMPLE\n#define SYMBOLOGY_TYPE_IS_SIMPLE_LIKE\n#endif", text: { "common.glsl": "uniform highp vec2 u_mosaicSize;\nvarying highp vec3 v_id;\nvarying mediump vec3 v_pos;\nvarying lowp float v_opacity;\nvarying lowp vec4 v_color;\nvarying highp vec2 v_tex;\nvarying mediump float v_antialiasingWidth;\nvarying mediump float v_edgeDistanceOffset;\nvarying lowp float v_transparency;", "hittest.glsl": "#include <materials/hittest/common.glsl>", "text.frag": "precision mediump float;\n#include <materials/text/common.glsl>\nuniform lowp sampler2D u_texture;\n#ifdef HITTEST\nvec4 getColor() {\nreturn v_color;\n}\n#else\nvec4 getColor()\n{\nfloat SDF_CUTOFF = (2.0 / 8.0);\nfloat SDF_BASE_EDGE_DIST = 1.0 - SDF_CUTOFF;\nlowp float dist = texture2D(u_texture, v_tex).a;\nmediump float edge = SDF_BASE_EDGE_DIST - v_edgeDistanceOffset;\n#ifdef HIGHLIGHT\nedge /= 2.0;\n#endif\nlowp float aa = v_antialiasingWidth;\nlowp float alpha = smoothstep(edge - aa, edge + aa, dist);\nreturn alpha * v_color * v_opacity;\n}\n#endif\nvoid main()\n{\ngl_FragColor = getColor();\n}", "text.vert": "precision highp float;\n#include <materials/utils.glsl>\n#include <materials/vcommon.glsl>\n#include <materials/text/common.glsl>\n#include <materials/text/hittest.glsl>\nattribute vec4 a_color;\nattribute vec4 a_haloColor;\nattribute vec4 a_texFontSize;\nattribute vec4 a_aux;\nattribute vec2 a_zoomRange;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nuniform float u_isHalo;\nfloat getTextSize(inout vec2 offset, inout float baseSize, in float referenceSize) {\n#ifdef VV_SIZE\nfloat r = getSize(referenceSize) / referenceSize;\nbaseSize *= r;\noffset.xy *= r;\nreturn baseSize;\n#endif\nreturn baseSize;\n}\nvoid main()\n{\nINIT;\nfloat a_referenceSize = a_aux.z * a_aux.z / 256.0;\nfloat a_bitSet = a_aux.w;\nfloat a_fontSize = a_texFontSize.z;\nvec2 a_offset = a_vertexOffset * OFFSET_PRECISION;\nvec3 in_pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nfloat fontSize = getTextSize(a_offset, a_fontSize, a_referenceSize);\nfloat fontScale = fontSize / SDF_FONT_SIZE;\nvec3 offset = getRotation() * vec3(a_offset, 0.0);\nmat3 extrudeMatrix = getBit(a_bitSet, 0) == 1.0 ? u_displayViewMat3 : u_displayMat3;\nv_color = u_isHalo * a_haloColor + (1.0 - u_isHalo) * getColor(a_color, a_bitSet, 1);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_tex = a_texCoords / u_mosaicSize;\nv_pos = u_dvsMat3 * in_pos + extrudeMatrix * offset;\nv_edgeDistanceOffset = u_isHalo * OUTLINE_SCALE * a_texFontSize.w / fontScale / MAX_SDF_DISTANCE;\nv_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio;\n#ifdef HITTEST\nhighp vec3 out_pos = vec3(0.);\nv_color = vec4(0.);\nhittestMarker(v_color, out_pos, u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.0)\n+ u_tileMat3 * offset, fontSize / 2.);\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, out_pos, getFilterFlags(), a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, getFilterFlags(), a_zoomRange), 1.0);\n#endif\n}" }, "utils.glsl": "float rshift(in float u32, in int amount) {\nreturn floor(u32 / pow(2.0, float(amount)));\n}\nfloat getBit(in float bitset, in int bitIndex) {\nfloat offset = pow(2.0, float(bitIndex));\nreturn mod(floor(bitset / offset), 2.0);\n}\nfloat getFilterBit(in float bitset, in int bitIndex) {\nreturn getBit(bitset, bitIndex + 1);\n}\nfloat getHighlightBit(in float bitset) {\nreturn getBit(bitset, 0);\n}\nhighp vec3 unpackDisplayIdTexel(in highp vec3 bitset) {\nfloat isAggregate = getBit(bitset.b, 7);\nreturn (1.0 - isAggregate) * bitset + isAggregate * (vec3(bitset.rgb) - vec3(0.0, 0.0, float(0x80)));\n}\nvec4 unpack(in float u32) {\nfloat r = mod(rshift(u32, 0), 255.0);\nfloat g = mod(rshift(u32, 8), 255.0);\nfloat b = mod(rshift(u32, 16), 255.0);\nfloat a = mod(rshift(u32, 24), 255.0);\nreturn vec4(r, g, b, a);\n}\nvec3 norm(in vec3 v) {\nreturn v /= 255.0;\n}\nvec4 norm(in vec4 v) {\nreturn v /= 255.0;\n}\nfloat max4(vec4 target) {\nreturn max(max(max(target.x, target.y), target.z), target.w);\n}\nvec2 unpack_u8_nf32(vec2 bytes) {\nreturn (bytes - 127.0) / 127.0;\n}\nhighp float rand(in vec2 co) {\nhighp float a = 12.9898;\nhighp float b = 78.233;\nhighp float c = 43758.5453;\nhighp float dt = dot(co, vec2(a,b));\nhighp float sn = mod(dt, 3.14);\nreturn fract(sin(sn) * c);\n}", "vcommon.glsl": "#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/attributeData.glsl>\n#include <materials/vv.glsl>\n#include <materials/barycentric.glsl>\nattribute vec2 a_pos;\nattribute highp vec3 a_id;\nuniform highp mat3 u_dvsMat3;\nuniform highp mat3 u_displayMat3;\nuniform highp mat3 u_displayViewMat3;\nuniform highp mat3 u_tileMat3;\nuniform highp mat3 u_viewMat3;\nuniform highp float u_pixelRatio;\nuniform mediump float u_zoomFactor;\nuniform mediump float u_antialiasing;\nuniform mediump float u_currentZoom;\nvec4 VV_ADATA = vec4(0.0);\nvoid loadVisualVariableData(inout vec4 target) {\n#ifdef SUPPORTS_TEXTURE_FLOAT\ntarget.rgba = getAttributeData2(a_id);\n#else\nvec4 data0 = getAttributeData2(a_id);\nvec4 data1 = getAttributeData3(a_id);\ntarget.r = u88VVToFloat(data0.rg * 255.0);\ntarget.g = u88VVToFloat(data0.ba * 255.0);\ntarget.b = u88VVToFloat(data1.rg * 255.0);\ntarget.a = u88VVToFloat(data1.ba * 255.0);\n#endif\n}\n#ifdef VV\n#define INIT loadVisualVariableData(VV_ADATA)\n#else\n#define INIT\n#endif\nvec4 getColor(in vec4 a_color, in float a_bitSet, int index) {\n#ifdef VV_COLOR\nfloat isColorLocked = getBit(a_bitSet, index);\nreturn getVVColor(VV_ADATA[ATTR_VV_COLOR], a_color, isColorLocked);\n#else\nreturn a_color;\n#endif\n}\nfloat getOpacity() {\n#ifdef VV_OPACITY\nreturn getVVOpacity(VV_ADATA[ATTR_VV_OPACITY]);\n#else\nreturn 1.0;\n#endif\n}\nfloat getSize(in float in_size) {\n#ifdef VV_SIZE\nreturn getVVSize(in_size, VV_ADATA[ATTR_VV_SIZE]);\n#else\nreturn in_size;\n#endif\n}\nmat3 getRotation() {\n#ifdef VV_ROTATION\nreturn getVVRotationMat3(mod(VV_ADATA[ATTR_VV_ROTATION], 360.0));\n#else\nreturn mat3(1.0);\n#endif\n}\nfloat getFilterFlags() {\n#ifdef IGNORES_SAMPLER_PRECISION\nreturn ceil(getAttributeData0(a_id).x * 255.0);\n#else\nreturn getAttributeData0(a_id).x * 255.0;\n#endif\n}\nvec4 getAnimationState() {\nreturn getAttributeData1(a_id);\n}\nfloat getMinZoom() {\nvec4 data0 = getAttributeData0(a_id) * 255.0;\nreturn data0.g;\n}\nmat3 getMatrixNoDisplay(float isMapAligned) {\nreturn isMapAligned * u_viewMat3 * u_tileMat3 + (1.0 - isMapAligned) * u_tileMat3;\n}\nmat3 getMatrix(float isMapAligned) {\nreturn isMapAligned * u_displayViewMat3 + (1.0 - isMapAligned) * u_displayMat3;\n}\nvec3 clip(inout vec4 color, inout vec3 pos, in float filterFlags, in vec2 minMaxZoom) {\npos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 0));\n#ifdef INSIDE\npos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 1));\n#elif defined(OUTSIDE)\npos.z += 2.0 * getFilterBit(filterFlags, 1);\n#elif defined(HIGHLIGHT)\n#if !defined(HIGHLIGHT_ALL)\npos.z += 2.0 * (1.0 - getHighlightBit(filterFlags));\n#endif\n#endif\npos.z += 2.0 * (step(minMaxZoom.y, u_currentZoom) + (1.0 - step(minMaxZoom.x, u_currentZoom)));\nreturn pos;\n}", "vv.glsl": "#if defined(VV_SIZE_MIN_MAX_VALUE) || defined(VV_SIZE_SCALE_STOPS) || defined(VV_SIZE_FIELD_STOPS) || defined(VV_SIZE_UNIT_VALUE)\n#define VV_SIZE\n#endif\n#if defined(VV_COLOR) || defined(VV_SIZE) || defined(VV_OPACITY) || defined(VV_ROTATION)\n#define VV\n#endif\n#ifdef VV_COLOR\nuniform highp float u_vvColorValues[8];\nuniform vec4 u_vvColors[8];\n#endif\n#ifdef VV_SIZE_MIN_MAX_VALUE\nuniform highp vec4 u_vvSizeMinMaxValue;\n#endif\n#ifdef VV_SIZE_SCALE_STOPS\nuniform highp float u_vvSizeScaleStopsValue;\n#endif\n#ifdef VV_SIZE_FIELD_STOPS\nuniform highp float u_vvSizeFieldStopsValues[6];\nuniform float u_vvSizeFieldStopsSizes[6];\n#endif\n#ifdef VV_SIZE_UNIT_VALUE\nuniform highp float u_vvSizeUnitValueWorldToPixelsRatio;\n#endif\n#ifdef VV_OPACITY\nuniform highp float u_vvOpacityValues[8];\nuniform float u_vvOpacities[8];\n#endif\n#ifdef VV_ROTATION\nuniform lowp float u_vvRotationType;\n#endif\nbool isNan(float val) {\nreturn (val == NAN_MAGIC_NUMBER);\n}\n#ifdef VV_SIZE_MIN_MAX_VALUE\nfloat getVVMinMaxSize(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nfloat interpolationRatio = (sizeValue - u_vvSizeMinMaxValue.x) / (u_vvSizeMinMaxValue.y - u_vvSizeMinMaxValue.x);\ninterpolationRatio = clamp(interpolationRatio, 0.0, 1.0);\nreturn u_vvSizeMinMaxValue.z + interpolationRatio * (u_vvSizeMinMaxValue.w - u_vvSizeMinMaxValue.z);\n}\n#endif\n#ifdef VV_SIZE_FIELD_STOPS\nconst int VV_SIZE_N = 6;\nfloat getVVStopsSize(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nif (sizeValue <= u_vvSizeFieldStopsValues[0]) {\nreturn u_vvSizeFieldStopsSizes[0];\n}\nfor (int i = 1; i < VV_SIZE_N; ++i) {\nif (u_vvSizeFieldStopsValues[i] >= sizeValue) {\nfloat f = (sizeValue - u_vvSizeFieldStopsValues[i-1]) / (u_vvSizeFieldStopsValues[i] - u_vvSizeFieldStopsValues[i-1]);\nreturn mix(u_vvSizeFieldStopsSizes[i-1], u_vvSizeFieldStopsSizes[i], f);\n}\n}\nreturn u_vvSizeFieldStopsSizes[VV_SIZE_N - 1];\n}\n#endif\n#ifdef VV_SIZE_UNIT_VALUE\nfloat getVVUnitValue(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nreturn u_vvSizeUnitValueWorldToPixelsRatio * sizeValue;\n}\n#endif\n#ifdef VV_OPACITY\nconst int VV_OPACITY_N = 8;\nfloat getVVOpacity(float opacityValue) {\nif (isNan(opacityValue)) {\nreturn 1.0;\n}\nif (opacityValue <= u_vvOpacityValues[0]) {\nreturn u_vvOpacities[0];\n}\nfor (int i = 1; i < VV_OPACITY_N; ++i) {\nif (u_vvOpacityValues[i] >= opacityValue) {\nfloat f = (opacityValue - u_vvOpacityValues[i-1]) / (u_vvOpacityValues[i] - u_vvOpacityValues[i-1]);\nreturn mix(u_vvOpacities[i-1], u_vvOpacities[i], f);\n}\n}\nreturn u_vvOpacities[VV_OPACITY_N - 1];\n}\n#endif\n#ifdef VV_ROTATION\nmat4 getVVRotation(float rotationValue) {\nif (isNan(rotationValue)) {\nreturn mat4(1, 0, 0, 0,\n0, 1, 0, 0,\n0, 0, 1, 0,\n0, 0, 0, 1);\n}\nfloat rotation = rotationValue;\nif (u_vvRotationType == 1.0) {\nrotation = 90.0 - rotation;\n}\nfloat angle = C_DEG_TO_RAD * rotation;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nreturn mat4(cosA, sinA, 0, 0,\n-sinA, cosA, 0, 0,\n0, 0, 1, 0,\n0, 0, 0, 1);\n}\nmat3 getVVRotationMat3(float rotationValue) {\nif (isNan(rotationValue)) {\nreturn mat3(1, 0, 0,\n0, 1, 0,\n0, 0, 1);\n}\nfloat rotation = rotationValue;\nif (u_vvRotationType == 1.0) {\nrotation = 90.0 - rotation;\n}\nfloat angle = C_DEG_TO_RAD * -rotation;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nreturn mat3(cosA, -sinA, 0,\nsinA, cosA, 0,\n0, 0, 1);\n}\n#endif\n#ifdef VV_COLOR\nconst int VV_COLOR_N = 8;\nvec4 getVVColor(float colorValue, vec4 fallback, float isColorLocked) {\nif (isNan(colorValue) || isColorLocked == 1.0) {\nreturn fallback;\n}\nif (colorValue <= u_vvColorValues[0]) {\nreturn u_vvColors[0];\n}\nfor (int i = 1; i < VV_COLOR_N; ++i) {\nif (u_vvColorValues[i] >= colorValue) {\nfloat f = (colorValue - u_vvColorValues[i-1]) / (u_vvColorValues[i] - u_vvColorValues[i-1]);\nreturn mix(u_vvColors[i-1], u_vvColors[i], f);\n}\n}\nreturn u_vvColors[VV_COLOR_N - 1];\n}\n#endif\nfloat getVVSize(in float size, in float vvSize) {\n#ifdef VV_SIZE_MIN_MAX_VALUE\nreturn getVVMinMaxSize(vvSize, size);\n#elif defined(VV_SIZE_SCALE_STOPS)\nreturn u_vvSizeScaleStopsValue;\n#elif defined(VV_SIZE_FIELD_STOPS)\nfloat outSize = getVVStopsSize(vvSize, size);\nreturn isNan(outSize) ? size : outSize;\n#elif defined(VV_SIZE_UNIT_VALUE)\nreturn getVVUnitValue(vvSize, size);\n#else\nreturn size;\n#endif\n}" }, overlay: { overlay: { "overlay.frag": "precision lowp float;\nuniform lowp sampler2D u_texture;\nuniform lowp float u_opacity;\nvarying mediump vec2 v_uv;\nvoid main() {\nvec4 color = texture2D(u_texture, v_uv);\ngl_FragColor = color * u_opacity;\n}", "overlay.vert": "precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_uv;\nuniform highp mat3 u_dvsMat3;\nvarying mediump vec2 v_uv;\nvoid main(void) {\nv_uv = a_uv;\nmediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0);\ngl_Position = vec4(pos.xy, 0.0, 1.0);\n}" } }, "post-processing": { blit: { "blit.frag": "precision mediump float;\nuniform sampler2D u_texture;\nvarying vec2 v_uv;\nvoid main() {\ngl_FragColor = texture2D(u_texture, v_uv);\n}" }, bloom: { composite: { "composite.frag": "precision mediump float;\nvarying vec2 v_uv;\nuniform sampler2D u_blurTexture1;\nuniform sampler2D u_blurTexture2;\nuniform sampler2D u_blurTexture3;\nuniform sampler2D u_blurTexture4;\nuniform sampler2D u_blurTexture5;\nuniform float u_bloomStrength;\nuniform float u_bloomRadius;\nuniform float u_bloomFactors[NUMMIPS];\nuniform vec3 u_bloomTintColors[NUMMIPS];\nfloat lerpBloomFactor(const in float factor) {\nfloat mirrorFactor = 1.2 - factor;\nreturn mix(factor, mirrorFactor, u_bloomRadius);\n}\nvoid main() {\ngl_FragColor = u_bloomStrength * (\nlerpBloomFactor(u_bloomFactors[0]) * vec4(u_bloomTintColors[0], 1.0) * texture2D(u_blurTexture1, v_uv) +\nlerpBloomFactor(u_bloomFactors[1]) * vec4(u_bloomTintColors[1], 1.0) * texture2D(u_blurTexture2, v_uv) +\nlerpBloomFactor(u_bloomFactors[2]) * vec4(u_bloomTintColors[2], 1.0) * texture2D(u_blurTexture3, v_uv) +\nlerpBloomFactor(u_bloomFactors[3]) * vec4(u_bloomTintColors[3], 1.0) * texture2D(u_blurTexture4, v_uv) +\nlerpBloomFactor(u_bloomFactors[4]) * vec4(u_bloomTintColors[4], 1.0) * texture2D(u_blurTexture5, v_uv)\n);\n}" }, gaussianBlur: { "gaussianBlur.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nuniform vec2 u_direction;\nvarying vec2 v_uv;\n#define KERNEL_RADIUS RADIUS\n#define SIGMA RADIUS\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / u_texSize;\nfloat fSigma = float(SIGMA);\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i ++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = u_direction * invSize * x;\nvec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset);\nvec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset);\npixelColorSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = pixelColorSum /weightSum;\n}" }, luminosityHighPass: { "luminosityHighPass.frag": "precision mediump float;\nuniform sampler2D u_texture;\nuniform vec3 u_defaultColor;\nuniform float u_defaultOpacity;\nuniform float u_luminosityThreshold;\nuniform float u_smoothWidth;\nvarying vec2 v_uv;\nvoid main() {\nvec4 texel = texture2D(u_texture, v_uv);\nvec3 luma = vec3(0.299, 0.587, 0.114);\nfloat v = dot(texel.xyz, luma);\nvec4 outputColor = vec4(u_defaultColor.rgb, u_defaultOpacity);\nfloat alpha = smoothstep(u_luminosityThreshold, u_luminosityThreshold + u_smoothWidth, v);\ngl_FragColor = mix(outputColor, texel, alpha);\n}" } }, blur: { gaussianBlur: { "gaussianBlur.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nuniform vec2 u_direction;\nuniform float u_sigma;\nvarying vec2 v_uv;\n#define KERNEL_RADIUS RADIUS\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / u_texSize;\nfloat fSigma = u_sigma;\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i ++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = u_direction * invSize * x;\nvec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset);\nvec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset);\npixelColorSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = pixelColorSum /weightSum;\n}" }, "radial-blur": { "radial-blur.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nconst float sampleDist = 1.0;\nconst float sampleStrength = 2.2;\nvoid main(void) {\nfloat samples[10];\nsamples[0] = -0.08;\nsamples[1] = -0.05;\nsamples[2] = -0.03;\nsamples[3] = -0.02;\nsamples[4] = -0.01;\nsamples[5] = 0.01;\nsamples[6] = 0.02;\nsamples[7] = 0.03;\nsamples[8] = 0.05;\nsamples[9] = 0.08;\nvec2 dir = 0.5 - v_uv;\nfloat dist = sqrt(dir.x * dir.x + dir.y * dir.y);\ndir = dir / dist;\nvec4 color = texture2D(u_colorTexture,v_uv);\nvec4 sum = color;\nfor (int i = 0; i < 10; i++) {\nsum += texture2D(u_colorTexture, v_uv + dir * samples[i] * sampleDist);\n}\nsum *= 1.0 / 11.0;\nfloat t = dist * sampleStrength;\nt = clamp(t, 0.0, 1.0);\ngl_FragColor = mix(color, sum, t);\n}" } }, dra: { "dra.frag": "precision mediump float;\nuniform sampler2D u_minColor;\nuniform sampler2D u_maxColor;\nuniform sampler2D u_texture;\nvarying vec2 v_uv;\nvoid main() {\nvec4 minColor = texture2D(u_minColor, vec2(0.5));\nvec4 maxColor = texture2D(u_maxColor, vec2(0.5));\nvec4 color = texture2D(u_texture, v_uv);\nvec3 minColorUnpremultiply = minColor.rgb / minColor.a;\nvec3 maxColorUnpremultiply = maxColor.rgb / maxColor.a;\nvec3 colorUnpremultiply = color.rgb / color.a;\nvec3 range = maxColorUnpremultiply - minColorUnpremultiply;\ngl_FragColor = vec4(color.a * (colorUnpremultiply - minColorUnpremultiply) / range, color.a);\n}", "min-max": { "min-max.frag": "#extension GL_EXT_draw_buffers : require\nprecision mediump float;\n#define CELL_SIZE 2\nuniform sampler2D u_minTexture;\nuniform sampler2D u_maxTexture;\nuniform vec2 u_srcResolution;\nuniform vec2 u_dstResolution;\nvarying vec2 v_uv;\nvoid main() {\nvec2 srcPixel = floor(gl_FragCoord.xy) * float(CELL_SIZE);\nvec2 onePixel = vec2(1.0) / u_srcResolution;\nvec2 uv = (srcPixel + 0.5) / u_srcResolution;\nvec4 minColor = vec4(1.0);\nvec4 maxColor = vec4(0.0);\nfor (int y = 0; y < CELL_SIZE; ++y) {\nfor (int x = 0; x < CELL_SIZE; ++x) {\nvec2 offset = uv + vec2(x, y) * onePixel;\nminColor = min(minColor, texture2D(u_minTexture, offset));\nmaxColor = max(maxColor, texture2D(u_maxTexture, offset));\n}\n}\ngl_FragData[0] = minColor;\ngl_FragData[1] = maxColor;\n}" } }, "drop-shadow": { composite: { "composite.frag": "precision mediump float;\nuniform sampler2D u_layerFBOTexture;\nuniform sampler2D u_blurTexture;\nuniform vec4 u_shadowColor;\nuniform vec2 u_shadowOffset;\nuniform highp mat3 u_displayViewMat3;\nvarying vec2 v_uv;\nvoid main() {\nvec3 offset = u_displayViewMat3 * vec3(u_shadowOffset, 0.0);\nvec4 layerColor = texture2D(u_layerFBOTexture, v_uv);\nvec4 blurColor = texture2D(u_blurTexture, v_uv - offset.xy / 2.0);\ngl_FragColor = ((1.0 - layerColor.a) * blurColor.a * u_shadowColor + layerColor);\n}" } }, "edge-detect": { "frei-chen": { "frei-chen.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nvarying vec2 v_uv;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[9];\nconst mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );\nconst mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );\nconst mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );\nconst mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );\nconst mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );\nconst mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );\nconst mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );\nconst mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );\nconst mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );\nvoid main() {\nG[0] = g0,\nG[1] = g1,\nG[2] = g2,\nG[3] = g3,\nG[4] = g4,\nG[5] = g5,\nG[6] = g6,\nG[7] = g7,\nG[8] = g8;\nmat3 I;\nfloat cnv[9];\nvec3 sample;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D(u_colorTexture, v_uv + texel * vec2(i - 1.0,j - 1.0)).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 9; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\nfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);\nfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);\ngl_FragColor = vec4(vec3(sqrt(M / S)), texture2D(u_colorTexture, v_uv).a);\n}" }, sobel: { "sobel.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nuniform vec2 u_texSize;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[2];\nconst mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );\nconst mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );\nvoid main() {\nmat3 I;\nfloat cnv[2];\nvec3 sample;\nG[0] = g0;\nG[1] = g1;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 2; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\ngl_FragColor = vec4(vec3(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1])), texture2D(u_colorTexture, v_uv).a);\n}" } }, "edge-enhance": { "edge-enhance.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nuniform vec2 u_texSize;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[2];\nconst mat3 g0 = mat3( 1.0, 0.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, -1.0 );\nconst mat3 g1 = mat3( 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0 );\nvoid main() {\nmat3 I;\nfloat cnv[2];\nvec3 sample;\nG[0] = g0;\nG[1] = g1;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 2; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\nvec4 color = texture2D(u_colorTexture, v_uv);\ngl_FragColor = vec4(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1]) * color);\n}" }, filterEffect: { "filterEffect.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform mat4 u_coefficients;\nvarying vec2 v_uv;\nvoid main() {\nvec4 color = texture2D(u_colorTexture, v_uv);\nvec4 rgbw = u_coefficients * vec4(color.a > 0.0 ? color.rgb / color.a : vec3(0.0), 1.0);\nfloat a = color.a;\ngl_FragColor = vec4(a * rgbw.rgb, a);\n}" }, pp: { "pp.vert": "precision mediump float;\nattribute vec2 a_position;\nvarying vec2 v_uv;\nvoid main() {\ngl_Position = vec4(a_position, 0.0, 1.0);\nv_uv = (a_position + 1.0) / 2.0;\n}" } }, raster: { bitmap: { "bitmap.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform highp vec2 u_coordScale;\nuniform lowp float u_opacity;\n#include <filtering/bicubic.glsl>\nvoid main() {\n#ifdef BICUBIC\nvec4 color = sampleBicubicBSpline(u_texture, v_texcoord, u_coordScale);\n#else\nvec4 color = texture2D(u_texture, v_texcoord);\n#endif\nfloat alpha = u_opacity * color.a;\ngl_FragColor = vec4(alpha * color.rgb, alpha);\n}", "bitmap.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" }, common: { "common.glsl": "uniform sampler2D u_image;\nuniform int u_bandCount;\nuniform bool u_flipY;\nuniform float u_opacity;\nuniform int u_resampling;\nuniform vec2 u_srcImageSize;\n#ifdef APPLY_PROJECTION\n#include <raster/common/projection.glsl>\n#endif\n#ifdef BICUBIC\n#include <filtering/bicubic.glsl>\n#endif\n#ifdef BILINEAR\n#include <filtering/bilinear.glsl>\n#endif\nvec2 getPixelLocation(vec2 coords) {\nvec2 targetLocation = u_flipY ? vec2(coords.s, 1.0 - coords.t) : coords;\n#ifdef APPLY_PROJECTION\ntargetLocation = projectPixelLocation(targetLocation);\n#endif\nreturn targetLocation;\n}\nbool isOutside(vec2 coords){\nif (coords.t>1.00001 ||coords.t<-0.00001 || coords.s>1.00001 ||coords.s<-0.00001) {\nreturn true;\n} else {\nreturn false;\n}\n}\nvec4 getPixel(vec2 pixelLocation) {\n#ifdef BICUBIC\nvec4 color = sampleBicubicBSpline(u_image, pixelLocation, u_srcImageSize);\n#elif defined(BILINEAR)\nvec4 color = sampleBilinear(u_image, pixelLocation, u_srcImageSize);\n#else\nvec4 color = texture2D(u_image, pixelLocation);\n#endif\nreturn color;\n}", "contrastBrightness.glsl": "uniform float u_contrastOffset;\nuniform float u_brightnessOffset;\nvec4 adjustContrastBrightness(vec4 currentPixel, bool isFloat) {\nvec4 pixelValue = isFloat ? currentPixel * 255.0 : currentPixel;\nfloat maxI = 255.0;\nfloat mid = 128.0;\nfloat c = u_contrastOffset;\nfloat b = u_brightnessOffset;\nvec4 v;\nif (c > 0.0 && c < 100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) / (2.0 * (100.0 - c)) + mid;\n} else if (c <= 0.0 && c > -100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) * (100.0 + c) / 20000.0 + mid;\n} else if (c == 100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + (maxI + 1.0) * (100.0 - c) + 2.0 * maxI * b);\nv = (sign(v) + 1.0) / 2.0;\n} else if (c == -100.0) {\nv = vec4(mid, mid, mid, currentPixel.a);\n}\nreturn vec4(v.r / 255.0, v.g / 255.0, v.b / 255.0, currentPixel.a);\n}", "projection.glsl": "uniform sampler2D u_transformGrid;\nuniform vec2 u_transformSpacing;\nuniform vec2 u_transformGridSize;\nuniform vec2 u_targetImageSize;\nvec2 projectPixelLocation(vec2 coords) {\n#ifdef LOOKUP_PROJECTION\nvec4 pv = texture2D(u_transformGrid, coords);\nreturn vec2(pv.r, pv.g);\n#endif\nvec2 index_image = floor(coords * u_targetImageSize);\nvec2 oneTransformPixel = vec2(0.25 / u_transformGridSize.s, 1.0 / u_transformGridSize.t);\nvec2 index_transform = floor(index_image / u_transformSpacing) / u_transformGridSize;\nvec2 pos = fract((index_image + vec2(0.5, 0.5)) / u_transformSpacing);\nvec2 srcLocation;\nvec2 transform_location = index_transform + oneTransformPixel * 0.5;\nif (pos.s <= pos.t) {\nvec4 ll_abc = texture2D(u_transformGrid, vec2(transform_location.s, transform_location.t));\nvec4 ll_def = texture2D(u_transformGrid, vec2(transform_location.s + oneTransformPixel.s, transform_location.t));\nsrcLocation.s = dot(ll_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t = dot(ll_def.rgb, vec3(pos, 1.0));\n} else {\nvec4 ur_abc = texture2D(u_transformGrid, vec2(transform_location.s + 2.0 * oneTransformPixel.s, transform_location.t));\nvec4 ur_def = texture2D(u_transformGrid, vec2(transform_location.s + 3.0 * oneTransformPixel.s, transform_location.t));\nsrcLocation.s = dot(ur_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t = dot(ur_def.rgb, vec3(pos, 1.0));\n}\nreturn srcLocation;\n}" }, flow: { "getFadeOpacity.glsl": "uniform float u_decayRate;\nuniform float u_fadeToZero;\nfloat getFadeOpacity(float x) {\nfloat cutOff = mix(0.0, exp(-u_decayRate), u_fadeToZero);\nreturn (exp(-u_decayRate * x) - cutOff) / (1.0 - cutOff);\n}", "getFragmentColor.glsl": "vec4 getFragmentColor(vec4 color, float dist, float size, float featheringSize) {\nfloat featheringStart = clamp(0.5 - featheringSize / size, 0.0, 0.5);\nif (dist > featheringStart) {\ncolor *= 1.0 - (dist - featheringStart) / (0.5 - featheringStart);\n}\nreturn color;\n}", imagery: { "imagery.frag": "precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform float u_Min;\nuniform float u_Max;\nuniform float u_featheringSize;\n#include <raster/flow/vv.glsl>\nfloat getIntensity(float v) {\nreturn u_Min + v * (u_Max - u_Min);\n}\nvoid main(void) {\nvec4 sampled = texture2D(u_texture, v_texcoord);\nfloat intensity = getIntensity(sampled.r);\ngl_FragColor = getColor(intensity);\ngl_FragColor.a *= getOpacity(sampled.r);\ngl_FragColor.a *= sampled.a;\ngl_FragColor.rgb *= gl_FragColor.a;\n}", "imagery.vert": "attribute vec2 a_position;\nattribute vec2 a_texcoord;\nuniform mat3 u_dvsMat3;\nvarying vec2 v_texcoord;\nvoid main(void) {\nvec2 xy = (u_dvsMat3 * vec3(a_position, 1.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_texcoord = a_texcoord;\n}" }, particles: { "particles.frag": "precision highp float;\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying float v_size;\nuniform float u_featheringSize;\n#include <raster/flow/getFragmentColor.glsl>\nvoid main(void) {\ngl_FragColor = getFragmentColor(v_color, length(v_texcoord - 0.5), v_size, u_featheringSize);\n}", "particles.vert": "attribute vec4 a_xyts0;\nattribute vec4 a_xyts1;\nattribute vec4 a_typeIdDurationSeed;\nattribute vec4 a_extrudeInfo;\nuniform mat3 u_dvsMat3;\nuniform mat3 u_displayViewMat3;\nuniform float u_time;\nuniform float u_trailLength;\nuniform float u_flowSpeed;\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying float v_size;\nuniform float u_featheringSize;\nuniform float u_introFade;\n#include <raster/flow/vv.glsl>\n#include <raster/flow/getFadeOpacity.glsl>\nvoid main(void) {\nvec2 position0 = a_xyts0.xy;\nfloat t0 = a_xyts0.z;\nfloat speed0 = a_xyts0.w;\nvec2 position1 = a_xyts1.xy;\nfloat t1 = a_xyts1.z;\nfloat speed1 = a_xyts1.w;\nfloat type = a_typeIdDurationSeed.x;\nfloat id = a_typeIdDurationSeed.y;\nfloat duration = a_typeIdDurationSeed.z;\nfloat seed = a_typeIdDurationSeed.w;\nvec2 e0 = a_extrudeInfo.xy;\nvec2 e1 = a_extrudeInfo.zw;\nfloat animationPeriod = duration + u_trailLength;\nfloat scaledTime = u_time * u_flowSpeed;\nfloat randomizedTime = scaledTime + seed * animationPeriod;\nfloat t = mod(randomizedTime, animationPeriod);\nfloat fUnclamped = (t - t0) / (t1 - t0);\nfloat f = clamp(fUnclamped, 0.0, 1.0);\nfloat clampedTime = mix(t0, t1, f);\nfloat speed = mix(speed0, speed1, f);\nvec2 extrude;\nvec2 position;\nfloat fadeOpacity;\nfloat introOpacity;\nif (type == 2.0) {\nif (fUnclamped < 0.0 || (fUnclamped > 1.0 && t1 != duration)) {\ngl_Position = vec4(0.0, 0.0, -2.0, 1.0);\nreturn;\n}\nvec2 ortho = mix(e0, e1, f);\nvec2 parallel;\nparallel = normalize(position1 - position0) * 0.5;\nif (id == 1.0) {\nextrude = ortho;\nv_texcoord = vec2(0.5, 0.0);\n} else if (id == 2.0) {\nextrude = -ortho;\nv_texcoord = vec2(0.5, 1.0);\n} else if (id == 3.0) {\nextrude = ortho + parallel;\nv_texcoord = vec2(1.0, 0.0);\n} else if (id == 4.0) {\nextrude = -ortho + parallel;\nv_texcoord = vec2(1.0, 1.0);\n}\nfadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength);\nintroOpacity = 1.0 - exp(-clampedTime);\nv_size = getSize(speed);\nv_color = getColor(speed);\nv_color.a *= getOpacity(speed);\nposition = mix(position0, position1, f);\n} else {\nif (fUnclamped < 0.0) {\ngl_Position = vec4(0.0, 0.0, -2.0, 1.0);\nreturn;\n}\nif (id == 1.0) {\nextrude = e0;\nv_texcoord = vec2(0.5, 0.0);\nfadeOpacity = getFadeOpacity((t - t0) / u_trailLength);\nintroOpacity = 1.0 - exp(-t0);\nv_size = getSize(speed0);\nv_color = getColor(speed0);\nv_color.a *= getOpacity(speed0);\nposition = position0;\n} else if (id == 2.0) {\nextrude = -e0;\nv_texcoord = vec2(0.5, 1.0);\nfadeOpacity = getFadeOpacity((t - t0) / u_trailLength);\nintroOpacity = 1.0 - exp(-t0);\nv_size = getSize(speed0);\nv_color = getColor(speed0);\nv_color.a *= getOpacity(speed0);\nposition = position0;\n} else if (id == 3.0) {\nextrude = mix(e0, e1, f);\nv_texcoord = vec2(0.5, 0.0);\nfadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength);\nintroOpacity = 1.0 - exp(-clampedTime);\nv_size = getSize(speed);\nv_color = getColor(speed);\nv_color.a *= getOpacity(speed);\nposition = mix(position0, position1, f);\n} else if (id == 4.0) {\nextrude = -mix(e0, e1, f);\nv_texcoord = vec2(0.5, 1.0);\nfadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength);\nintroOpacity = 1.0 - exp(-clampedTime);\nv_size = getSize(speed);\nv_color = getColor(speed);\nv_color.a *= getOpacity(speed);\nposition = mix(position0, position1, f);\n}\n}\nvec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(extrude * v_size, 0.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_color.a *= fadeOpacity;\nv_color.a *= mix(1.0, introOpacity, u_introFade);\nv_color.rgb *= v_color.a;\n}" }, streamlines: { "streamlines.frag": "precision highp float;\nvarying float v_side;\nvarying float v_time;\nvarying float v_totalTime;\nvarying float v_timeSeed;\nvarying vec4 v_color;\nvarying float v_size;\nuniform float u_time;\nuniform float u_trailLength;\nuniform float u_flowSpeed;\nuniform float u_featheringSize;\nuniform float u_introFade;\n#include <raster/flow/getFragmentColor.glsl>\n#include <raster/flow/getFadeOpacity.glsl>\nvoid main(void) {\nfloat t = mod(v_timeSeed * (v_totalTime + u_trailLength) + u_time * u_flowSpeed, v_totalTime + u_trailLength) - v_time;\nvec4 color = v_color * step(0.0, t) * getFadeOpacity(t / u_trailLength);\ncolor *= mix(1.0, 1.0 - exp(-v_time), u_introFade);\ngl_FragColor = getFragmentColor(color, length((v_side + 1.0) / 2.0 - 0.5), v_size, u_featheringSize);\n}", "streamlines.vert": "attribute vec3 a_positionAndSide;\nattribute vec3 a_timeInfo;\nattribute vec2 a_extrude;\nattribute float a_speed;\nuniform mat3 u_dvsMat3;\nuniform mat3 u_displayViewMat3;\nvarying float v_time;\nvarying float v_totalTime;\nvarying float v_timeSeed;\nvarying vec4 v_color;\nvarying float v_side;\nvarying float v_size;\nuniform float u_featheringSize;\n#include <raster/flow/vv.glsl>\nvoid main(void) {\nvec4 lineColor = getColor(a_speed);\nfloat lineOpacity = getOpacity(a_speed);\nfloat lineSize = getSize(a_speed);\nvec2 position = a_positionAndSide.xy;\nv_side = a_positionAndSide.z;\nvec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(a_extrude * lineSize, 0.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_time = a_timeInfo.x;\nv_totalTime = a_timeInfo.y;\nv_timeSeed = a_timeInfo.z;\nv_color = lineColor;\nv_color.a *= lineOpacity;\nv_color.rgb *= v_color.a;\nv_size = lineSize;\n}" }, "vv.glsl": "#define MAX_STOPS 8\n#ifdef VV_COLOR\nuniform float u_color_stops[MAX_STOPS];\nuniform vec4 u_color_values[MAX_STOPS];\nuniform int u_color_count;\n#else\nuniform vec4 u_color;\n#endif\n#ifdef VV_OPACITY\nuniform float u_opacity_stops[MAX_STOPS];\nuniform float u_opacity_values[MAX_STOPS];\nuniform int u_opacity_count;\n#else\nuniform float u_opacity;\n#endif\n#ifdef VV_SIZE\nuniform float u_size_stops[MAX_STOPS];\nuniform float u_size_values[MAX_STOPS];\nuniform int u_size_count;\n#else\nuniform float u_size;\n#endif\nuniform float u_featheringOffset;\nvec4 getColor(float x) {\n#ifdef VV_COLOR\nvec4 color = u_color_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_color_count) {\nbreak;\n}\nfloat x1 = u_color_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_color_stops[i];\nvec4 y2 = u_color_values[i];\nif (x < x2) {\nvec4 y1 = u_color_values[i - 1];\ncolor = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\ncolor = y2;\n}\n}\n}\n#else\nvec4 color = u_color;\n#endif\nreturn color;\n}\nfloat getOpacity(float x) {\n#ifdef VV_OPACITY\nfloat opacity = u_opacity_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_opacity_count) {\nbreak;\n}\nfloat x1 = u_opacity_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_opacity_stops[i];\nfloat y2 = u_opacity_values[i];\nif (x < x2) {\nfloat y1 = u_opacity_values[i - 1];\nopacity = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nopacity = y2;\n}\n}\n}\n#else\nfloat opacity = u_opacity;\n#endif\nreturn opacity;\n}\nfloat getSize(float x) {\n#ifdef VV_SIZE\nfloat size = u_size_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_size_count) {\nbreak;\n}\nfloat x1 = u_size_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_size_stops[i];\nfloat y2 = u_size_values[i];\nif (x < x2) {\nfloat y1 = u_size_values[i - 1];\nsize = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nsize = y2;\n}\n}\n}\n#else\nfloat size = u_size;\n#endif\nreturn size + 2.0 * u_featheringSize * u_featheringOffset;\n}" }, hillshade: { "hillshade.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\n#include <raster/common/common.glsl>\nuniform int u_hillshadeType;\nuniform float u_sinZcosAs[6];\nuniform float u_sinZsinAs[6];\nuniform float u_cosZs[6];\nuniform float u_weights[6];\nuniform vec2 u_factor;\nuniform float u_minValue;\nuniform float u_maxValue;\n#include <raster/lut/colorize.glsl>\nfloat getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){\nif (a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0) {\nreturn 0.0;\n}\nelse {\nreturn e;\n}\n}\nvec3 rgb2hsv(vec3 c) {\nvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\nvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\nfloat d = q.x - min(q.w, q.y);\nfloat e = 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);\n}\nvec3 hsv2rgb(vec3 c) {\nvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvec4 overlay(float val, float minValue, float maxValue, float hillshade) {\nval = clamp((val - minValue) / (maxValue - minValue), 0.0, 1.0);\nvec4 rgb = colorize(vec4(val, val, val, 1.0), 255.0);\nvec3 hsv = rgb2hsv(rgb.xyz);\nhsv.z = hillshade;\nreturn vec4(hsv2rgb(hsv), 1.0) * rgb.a;\n}\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\nif (currentPixel.a == 0.0) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec2 axy = vec2(-1.0, -1.0);\nvec2 bxy = vec2(0.0, -1.0);\nvec2 cxy = vec2(1.0, -1.0);\nvec2 dxy = vec2(-1.0, 0.0);\nvec2 fxy = vec2(1.0, 0.0);\nvec2 gxy = vec2(-1.0, 1.0);\nvec2 hxy = vec2(0.0, 1.0);\nvec2 ixy = vec2(1.0, 1.0);\nvec2 onePixel = 1.0 / u_srcImageSize;\nif (pixelLocation.s < onePixel.s) {\naxy[0] = 1.0;\ndxy[0] = 1.0;\ngxy[0] = 1.0;\n}\nif (pixelLocation.t < onePixel.t) {\naxy[1] = 1.0;\nbxy[1] = 1.0;\ncxy[1] = 1.0;\n}\nif (pixelLocation.s > 1.0 - onePixel.s) {\ncxy[0] = -1.0;\nfxy[0] = -1.0;\nixy[0] = -1.0;\n}\nif (pixelLocation.t > 1.0 - onePixel.t) {\ngxy[1] = -1.0;\nhxy[1] = -1.0;\nixy[1] = -1.0;\n}\nvec4 va = texture2D(u_image, pixelLocation + onePixel * axy);\nvec4 vb = texture2D(u_image, pixelLocation + onePixel * bxy);\nvec4 vc = texture2D(u_image, pixelLocation + onePixel * cxy);\nvec4 vd = texture2D(u_image, pixelLocation + onePixel * dxy);\nvec4 ve = texture2D(u_image, pixelLocation);\nvec4 vf = texture2D(u_image, pixelLocation + onePixel * fxy);\nvec4 vg = texture2D(u_image, pixelLocation + onePixel * gxy);\nvec4 vh = texture2D(u_image, pixelLocation + onePixel * hxy);\nvec4 vi = texture2D(u_image, pixelLocation + onePixel * ixy);\nfloat dzx = (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r * u_factor.s;\nfloat dzy = (vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r * u_factor.t;\nfloat dzd = sqrt(1.0 + dzx * dzx + dzy * dzy);\nfloat hillshade = 0.0;\nif (u_hillshadeType == 0){\nfloat cosDelta = u_sinZsinAs[0] * dzy - u_sinZcosAs[0] * dzx;\nfloat z = (u_cosZs[0] + cosDelta) / dzd;\nif (z < 0.0) z = 0.0;\nhillshade = z;\n} else {\nfor (int k = 0; k < 6; k++) {\nfloat cosDelta = u_sinZsinAs[k] * dzy - u_sinZcosAs[k] * dzx;\nfloat z = (u_cosZs[k] + cosDelta) / dzd;\nif (z < 0.0) z = 0.0;\nhillshade = hillshade + z * u_weights[k];\nif (k == 5) break;\n}\n}\nfloat alpha = getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a);\n#ifdef APPLY_COLORMAP\ngl_FragColor = overlay(ve.r, u_minValue, u_maxValue, hillshade) * alpha * u_opacity;\n#else\ngl_FragColor = vec4(hillshade, hillshade, hillshade, 1.0) * alpha * u_opacity;\n#endif\n}", "hillshade.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" }, lut: { "colorize.glsl": "uniform sampler2D u_colormap;\nuniform float u_colormapOffset;\nuniform float u_colormapMaxIndex;\nvec4 colorize(vec4 currentPixel, float scaleFactor) {\nfloat clrIndex = clamp(currentPixel.r * scaleFactor - u_colormapOffset, 0.0, u_colormapMaxIndex);\nvec2 clrPosition = vec2((clrIndex + 0.5) / (u_colormapMaxIndex + 1.0), 0.0);\nvec4 color = texture2D(u_colormap, clrPosition);\nvec4 result = vec4(color.rgb, color.a * currentPixel.a);\nreturn result;\n}", "lut.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\n#include <raster/common/common.glsl>\n#include <raster/lut/colorize.glsl>\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\nvec4 result = colorize(currentPixel, 1.0);\ngl_FragColor = vec4(result.xyz, 1.0) * result.a * u_opacity;\n}", "lut.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform highp float u_scale;\nuniform highp vec2 u_offset;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos * u_scale + u_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" }, magdir: { "magdir.frag": "precision mediump float;\nvarying vec4 v_color;\nuniform lowp float u_opacity;\nvoid main() {\ngl_FragColor = v_color * u_opacity;\n}", "magdir.vert": "precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_vv;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform vec2 u_symbolSize;\nuniform vec2 u_symbolPercentRange;\nuniform vec2 u_dataRange;\nuniform float u_rotation;\nuniform vec4 u_colors[12];\nvarying vec4 v_color;\nvoid main()\n{\nfloat angle = a_offset.y + u_rotation;\n#ifndef ROTATION_GEOGRAPHIC\nangle = 3.14159265359 * 2.0 - angle - 3.14159265359 / 2.0;\n#endif\nvec2 offset = vec2(cos(angle), sin(angle)) * a_offset.x;\n#ifdef DATA_RANGE\nfloat valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0);\nfloat sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x);\nfloat sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y);\n#else\nfloat sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0;\n#endif\nvec2 pos = a_pos + offset * sizePercentage * u_symbolSize;\nv_color = u_colors[int(a_vv.x)];\ngl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0);\n}" }, reproject: { "reproject.frag": "precision mediump float;\nvarying vec2 v_texcoord;\n#include <raster/common/common.glsl>\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\ngl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity;\n}", "reproject.vert": "precision mediump float;\nattribute vec2 a_position;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_position;\ngl_Position = vec4(2.0 * (a_position - 0.5), 0.0, 1.0);\n}" }, scalar: { "scalar.frag": "precision mediump float;\nuniform lowp float u_opacity;\nvarying vec2 v_pos;\nconst vec4 outlineColor = vec4(0.2, 0.2, 0.2, 1.0);\nconst float outlineSize = 0.02;\nconst float innerRadius = 0.25;\nconst float outerRadius = 0.42;\nconst float innerSquareLength = 0.15;\nvoid main() {\nmediump float dist = length(v_pos);\nmediump float fillalpha1 = smoothstep(outerRadius, outerRadius + outlineSize, dist);\nfillalpha1 *= (1.0-smoothstep(outerRadius + outlineSize, outerRadius + 0.1 + outlineSize, dist));\n#ifdef INNER_CIRCLE\nmediump float fillalpha2 = smoothstep(innerRadius, innerRadius + outlineSize, dist);\nfillalpha2 *= (1.0-smoothstep(innerRadius + outlineSize, innerRadius + 0.1 + outlineSize, dist));\n#else\nmediump float fillalpha2 = (abs(v_pos.x) < innerSquareLength ? 1.0 : 0.0) * (abs(v_pos.y) < innerSquareLength ? 1.0 : 0.0);\n#endif\ngl_FragColor = (fillalpha2 + fillalpha1) * outlineColor * u_opacity;\n}", "scalar.vert": "precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_vv;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform vec2 u_symbolSize;\nuniform vec2 u_symbolPercentRange;\nuniform vec2 u_dataRange;\nvarying vec2 v_pos;\nvoid main()\n{\n#ifdef DATA_RANGE\nfloat valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0);\nfloat sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x);\nfloat sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y);\n#else\nfloat sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0;\n#endif\nvec2 size = u_symbolSize * sizePercentage;\nvec2 pos = a_pos + a_offset * size;\nv_pos = a_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0);\n}" }, stretch: { "stretch.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\n#include <raster/common/common.glsl>\nuniform float u_minCutOff[3];\nuniform float u_maxCutOff[3];\nuniform float u_minOutput;\nuniform float u_maxOutput;\nuniform float u_factor[3];\nuniform bool u_useGamma;\nuniform float u_gamma[3];\nuniform float u_gammaCorrection[3];\n#include <raster/lut/colorize.glsl>\nfloat stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool useGamma, float gamma, float gammaCorrection) {\nif (val >= maxCutOff) {\nreturn maxOutput;\n} else if (val <= minCutOff) {\nreturn minOutput;\n}\nfloat stretchedVal;\nif (useGamma) {\nfloat tempf = 1.0;\nfloat outRange = maxOutput - minOutput;\nfloat relativeVal = (val - minCutOff) / (maxCutOff - minCutOff);\nif (gamma > 1.0) {\ntempf -= pow(1.0 / outRange, relativeVal * gammaCorrection);\n}\nstretchedVal = (tempf * outRange * pow(relativeVal, 1.0 / gamma) + minOutput) / 255.0;\n} else {\nstretchedVal = minOutput + (val - minCutOff) * factor;\n}\nreturn stretchedVal;\n}\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\n#ifdef NOOP\ngl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity;\nreturn;\n#endif\nif (u_bandCount == 1) {\nfloat grayVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]);\n#ifdef APPLY_COLORMAP\nvec4 result = colorize(vec4(grayVal, grayVal, grayVal, 1.0), u_useGamma ? 255.0 : 1.0);\ngl_FragColor = vec4(result.xyz, 1.0) * result.a * currentPixel.a * u_opacity;\n#else\ngl_FragColor = vec4(grayVal, grayVal, grayVal, 1.0) * currentPixel.a * u_opacity;\n#endif\n} else {\nfloat redVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]);\nfloat greenVal = stretchOneValue(currentPixel.g, u_minCutOff[1], u_maxCutOff[1], u_minOutput, u_maxOutput, u_factor[1], u_useGamma, u_gamma[1], u_gammaCorrection[1]);\nfloat blueVal = stretchOneValue(currentPixel.b, u_minCutOff[2], u_maxCutOff[2], u_minOutput, u_maxOutput, u_factor[2], u_useGamma, u_gamma[2], u_gammaCorrection[2]);\ngl_FragColor = vec4(redVal, greenVal, blueVal, 1.0) * currentPixel.a * u_opacity;\n}\n}", "stretch.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform highp float u_scale;\nuniform highp vec2 u_offset;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos * u_scale + u_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" } }, stencil: { "stencil.frag": "void main() {\ngl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n}", "stencil.vert": "attribute vec2 a_pos;\nuniform mat3 u_worldExtent;\nvoid main() {\ngl_Position = vec4(u_worldExtent * vec3(a_pos, 1.0), 1.0);\n}" }, tileInfo: { "tileInfo.frag": "uniform mediump sampler2D u_texture;\nvarying mediump vec2 v_tex;\nvoid main(void) {\nlowp vec4 color = texture2D(u_texture, v_tex);\ngl_FragColor = 0.75 * color;\n}", "tileInfo.vert": "attribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform mediump float u_depth;\nuniform mediump vec2 u_coord_ratio;\nuniform mediump vec2 u_delta;\nuniform mediump vec2 u_dimensions;\nvarying mediump vec2 v_tex;\nvoid main() {\nmediump vec2 offset = u_coord_ratio * vec2(u_delta + a_pos * u_dimensions);\nvec3 v_pos = u_dvsMat3 * vec3(offset, 1.0);\ngl_Position = vec4(v_pos.xy, 0.0, 1.0);\nv_tex = a_pos;\n}" }, util: { "atan2.glsl": "float atan2(in float y, in float x) {\nfloat t0, t1, t2, t3, t4;\nt3 = abs(x);\nt1 = abs(y);\nt0 = max(t3, t1);\nt1 = min(t3, t1);\nt3 = 1.0 / t0;\nt3 = t1 * t3;\nt4 = t3 * t3;\nt0 = - 0.013480470;\nt0 = t0 * t4 + 0.057477314;\nt0 = t0 * t4 - 0.121239071;\nt0 = t0 * t4 + 0.195635925;\nt0 = t0 * t4 - 0.332994597;\nt0 = t0 * t4 + 0.999995630;\nt3 = t0 * t3;\nt3 = (abs(y) > abs(x)) ? 1.570796327 - t3 : t3;\nt3 = x < 0.0 ? 3.141592654 - t3 : t3;\nt3 = y < 0.0 ? -t3 : t3;\nreturn t3;\n}", "encoding.glsl": "const vec4 rgba2float_factors = vec4(\n255.0 / (256.0),\n255.0 / (256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n);\nfloat rgba2float(vec4 rgba) {\nreturn dot(rgba, rgba2float_factors);\n}" } };
  593. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/sources/resolver.js
  594. function o6(e8) {
  595. let o7 = e6;
  596. return e8.split("/").forEach((r9) => {
  597. o7 && (o7 = o7[r9]);
  598. }), o7;
  599. }
  600. var t8 = new e2(o6);
  601. function n6(r9) {
  602. return t8.resolveIncludes(r9);
  603. }
  604. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/BackgroundPrograms.js
  605. var e7 = { shaders: { vertexShader: n6("background/background.vert"), fragmentShader: n6("background/background.frag") }, attributes: new Map([["a_pos", 0]]) };
  606. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/BrushClip.js
  607. var c6 = () => ge("clip", { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }] });
  608. var f4 = class extends a2 {
  609. constructor() {
  610. super(...arguments), this._color = r7(0, 1, 0, 1);
  611. }
  612. dispose() {
  613. this._program && this._program.dispose();
  614. }
  615. prepareState({ context: r9 }) {
  616. r9.setStencilTestEnabled(true), r9.setBlendingEnabled(false), r9.setFaceCullingEnabled(false), r9.setColorMask(false, false, false, false), r9.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), r9.setStencilWriteMask(255), r9.setStencilFunction(I.ALWAYS, 0, 255);
  617. }
  618. draw(e8, s10) {
  619. const { context: o7, state: a5, requestRender: m11 } = e8, f5 = c6(), d5 = s10.getVAO(o7, a5, f5.attributes, f5.bufferLayouts);
  620. t(d5.indexBuffer) || (this._program || (this._program = e3(o7, e7)), !r(m11) || this._program.isCompiled ? (o7.useProgram(this._program), this._program.setUniform2fv("u_coord_range", [1, 1]), this._program.setUniform4fv("u_color", this._color), this._program.setUniformMatrix3fv("u_dvsMat3", a5.displayMat3), o7.bindVAO(d5), o7.drawElements(E.TRIANGLES, d5.indexBuffer.size, C.UNSIGNED_INT, 0), o7.bindVAO()) : m11());
  621. }
  622. };
  623. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/BrushOverlay.js
  624. var u3 = () => ge("overlay", { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.FLOAT }], tex: [{ location: 1, name: "a_uv", count: 2, type: C.UNSIGNED_SHORT }] });
  625. var m5 = class extends a2 {
  626. constructor() {
  627. super(...arguments), this._desc = { vsPath: "overlay/overlay", fsPath: "overlay/overlay", attributes: new Map([["a_pos", 0], ["a_uv", 1]]) };
  628. }
  629. dispose() {
  630. }
  631. prepareState({ context: e8 }) {
  632. e8.setBlendingEnabled(true), e8.setColorMask(true, true, true, true), e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true), e8.setStencilFunction(I.GREATER, 255, 255);
  633. }
  634. draw(r9, s10) {
  635. const { context: o7, painter: n8, requestRender: a5 } = r9;
  636. if (!s10.isReady)
  637. return;
  638. const { computedOpacity: m11, dvsMat3: c10, isWrapAround: d5, texture: l8 } = s10;
  639. r9.timeline.begin(this.name);
  640. const p6 = n8.materialManager.getProgram(this._desc);
  641. if (r(a5) && !p6.isCompiled)
  642. return void a5();
  643. const f5 = u3(), _5 = s10.getVAO(o7, f5.bufferLayouts, f5.attributes);
  644. if (!_5)
  645. return;
  646. o7.bindVAO(_5), o7.useProgram(p6), o7.bindTexture(l8, A), p6.setUniformMatrix3fv("u_dvsMat3", c10), p6.setUniform1i("u_texture", A), p6.setUniform1f("u_opacity", m11);
  647. const y2 = d5 ? 10 : 4;
  648. o7.drawArrays(E.TRIANGLE_STRIP, 0, y2), o7.bindVAO(), r9.timeline.end(this.name);
  649. }
  650. };
  651. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrush.js
  652. var p3 = class extends a2 {
  653. constructor() {
  654. super(...arguments), this._computeDesc = new Map();
  655. }
  656. prepareState({ context: t9 }, e8, i4) {
  657. i4 && i4.includes("hittest") ? t9.setBlendFunctionSeparate(R.ONE, R.ONE, R.ONE, R.ONE) : t9.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), t9.setBlendingEnabled(true), t9.setColorMask(true, true, true, true), t9.setStencilWriteMask(0), t9.setStencilTestEnabled(true), t9.setStencilFunction(I.EQUAL, e8.stencilRef, 255);
  658. }
  659. draw(e8, i4, s10) {
  660. const o7 = this.getGeometryType();
  661. i4.commit(e8);
  662. const a5 = i4.getGeometry(o7);
  663. t(a5) || (e8.timeline.begin(this.name), e8.attributeView.bindTextures(e8.context), a5.forEachCommand((t9) => {
  664. const o8 = U2.load(t9.materialKey).symbologyType;
  665. this.supportsSymbology(o8) && this.drawGeometry(e8, i4, t9, s10);
  666. }));
  667. }
  668. _setSharedUniforms(t9, u7, v) {
  669. const { displayLevel: f5, pixelRatio: l8, state: p6, passOptions: c10 } = u7;
  670. r(c10) && c10.type === "hittest" && (t9.setUniform2fv("u_hittestPos", c10.position), t9.setUniform1f("u_hittestDist", c10.distance)), t9.setUniform1f("u_pixelRatio", l8), t9.setUniformMatrix3fv("u_tileMat3", v.transforms.tileMat3), t9.setUniformMatrix3fv("u_viewMat3", p6.viewMat3), t9.setUniformMatrix3fv("u_dvsMat3", v.transforms.dvs), t9.setUniformMatrix3fv("u_displayViewMat3", p6.displayViewMat3), t9.setUniform1f("u_currentZoom", Math.round(f5 * at)), t9.setUniform1i("u_attributeTextureSize", u7.attributeView.size), t9.setUniform1i("u_attributeData0", B2), t9.setUniform1i("u_attributeData1", C2), t9.setUniform1i("u_attributeData2", D3), t9.setUniform1i("u_attributeData3", E2), t9.setUniform1i("u_attributeData4", F2), t9.setUniform1i("u_attributeData5", G2);
  671. }
  672. _setSizeVVUniforms(t9, e8, i4, s10) {
  673. if (t9.vvSizeMinMaxValue && e8.setUniform4fv("u_vvSizeMinMaxValue", i4.vvSizeMinMaxValue), t9.vvSizeScaleStops && e8.setUniform1f("u_vvSizeScaleStopsValue", i4.vvSizeScaleStopsValue), t9.vvSizeFieldStops) {
  674. const t10 = i4.getSizeVVFieldStops(s10.key.level);
  675. e8.setUniform1fv("u_vvSizeFieldStopsValues", t10.values), e8.setUniform1fv("u_vvSizeFieldStopsSizes", t10.sizes);
  676. }
  677. t9.vvSizeUnitValue && e8.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio", i4.vvSizeUnitValueToPixelsRatio);
  678. }
  679. _setColorAndOpacityVVUniforms(t9, e8, i4) {
  680. t9.vvColor && (e8.setUniform1fv("u_vvColorValues", i4.vvColorValues), e8.setUniform4fv("u_vvColors", i4.vvColors)), t9.vvOpacity && (e8.setUniform1fv("u_vvOpacityValues", i4.vvOpacityValues), e8.setUniform1fv("u_vvOpacities", i4.vvOpacities));
  681. }
  682. _setRotationVVUniforms(t9, e8, i4) {
  683. t9.vvRotation && e8.setUniform1f("u_vvRotationType", i4.vvMaterialParameters.vvRotationType === "geographic" ? 0 : 1);
  684. }
  685. _getTriangleDesc(t9, e8, i4 = ["a_pos"]) {
  686. const s10 = e8.bufferLayouts.geometry, o7 = i4.map((t10) => s10.findIndex((e9) => e9.name === t10)), a5 = `${t9}-${o7.join("-")}`;
  687. let r9 = this._computeDesc.get(a5);
  688. if (!r9) {
  689. const t10 = e8.strides, i5 = e8.strides.geometry, n8 = new Map(e8.attributes), m11 = s10.map((t11) => ({ ...t11 })), u7 = Math.max(...e8.attributes.values()), v = { geometry: m11 };
  690. let f5 = 0;
  691. for (const e9 of o7) {
  692. const t11 = s10[e9];
  693. v.geometry.push({ count: t11.count, name: t11.name + "1", divisor: t11.divisor, normalized: t11.normalized, offset: i5 + t11.offset, stride: i5, type: t11.type }), v.geometry.push({ count: t11.count, name: t11.name + "2", divisor: t11.divisor, normalized: t11.normalized, offset: 2 * i5 + t11.offset, stride: i5, type: t11.type }), n8.set(t11.name + "1", u7 + ++f5), n8.set(t11.name + "2", u7 + ++f5);
  694. }
  695. r9 = { bufferLayouts: v, attributes: n8, strides: t10 }, this._computeDesc.set(a5, r9);
  696. }
  697. return r9;
  698. }
  699. };
  700. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js
  701. function u4(e8) {
  702. const t9 = { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 3, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_bitset", count: 1, type: C.UNSIGNED_BYTE }, { location: 3, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 4, name: "a_aux1", count: 4, type: C.UNSIGNED_SHORT }, { location: 5, name: "a_aux2", count: 4, type: C.SHORT }, { location: 6, name: "a_aux3", count: 4, type: C.UNSIGNED_BYTE }, { location: 7, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }] };
  703. switch (e8.symbologyType) {
  704. case S.SIMPLE:
  705. case S.OUTLINE_FILL_SIMPLE:
  706. t9.geometry.splice(7, 1), t9.geometry.splice(4, 1);
  707. }
  708. return { shader: "materials/fill", vertexLayout: t9 };
  709. }
  710. var c7 = class extends p3 {
  711. dispose() {
  712. }
  713. getGeometryType() {
  714. return E3.FILL;
  715. }
  716. supportsSymbology(e8) {
  717. return e8 !== S.DOT_DENSITY;
  718. }
  719. drawGeometry(o7, r9, i4, l8) {
  720. const { context: c10, painter: y2, rendererInfo: p6, requiredLevel: _5, passOptions: f5, requestRender: d5 } = o7, E5 = w2.load(i4.materialKey), S2 = p(E5.data), g3 = r(f5) && f5.type === "hittest", N4 = y2.materialManager, { shader: T3, vertexLayout: I3, hittestAttributes: U4 } = c(S2.programSpec, u4(E5));
  721. let x6 = E.TRIANGLES, L3 = ge(E5.data, I3);
  722. g3 && (L3 = this._getTriangleDesc(i4.materialKey, L3, U4), x6 = E.POINTS);
  723. const { attributes: h5, bufferLayouts: G4 } = L3, O5 = N4.getMaterialProgram(o7, E5, T3, h5, l8);
  724. if (r(d5) && !g3 && !O5.isCompiled)
  725. return void d5();
  726. if (c10.useProgram(O5), this._setSharedUniforms(O5, o7, r9), O5.setUniform2f("u_tileOffset", 512 * r9.key.col, 512 * r9.key.row), E5.textureBinding) {
  727. y2.textureManager.bindTextures(c10, O5, E5);
  728. const e8 = 1 / 2 ** (_5 - r9.key.level);
  729. O5.setUniform1f("u_zoomFactor", e8);
  730. }
  731. const b4 = 1 / o7.pixelRatio;
  732. O5.setUniform1f("u_blur", b4), O5.setUniform1f("u_antialiasing", b4), this._setSizeVVUniforms(E5, O5, p6, r9), this._setColorAndOpacityVVUniforms(E5, O5, p6);
  733. const D5 = i4.target.getVAO(c10, G4, h5, g3);
  734. let R3 = i4.indexCount, j = i4.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  735. g3 && (R3 /= 3, j /= 3), c10.bindVAO(D5), this._drawFills(o7, r9, O5, x6, R3, j);
  736. }
  737. _drawFills(e8, t9, o7, r9, a5, i4) {
  738. e8.context.drawElements(r9, a5, C.UNSIGNED_INT, i4);
  739. }
  740. };
  741. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushDotDensity.js
  742. var O4 = class extends c7 {
  743. constructor() {
  744. super(...arguments), this._dotTextureSize = 0, this._dotTextures = null, this._dotSamplers = new Int32Array([K, L2]), this._dotVAO = null, this._dotDesc = { vsPath: "dot/dot", fsPath: "dot/dot", attributes: new Map([["a_pos", 0]]) };
  745. }
  746. dispose() {
  747. super.dispose(), this._disposeTextures(), this._dotFBO = s(this._dotFBO), this._dotVAO = s(this._dotVAO);
  748. }
  749. getGeometryType() {
  750. return E3.FILL;
  751. }
  752. supportsSymbology(e8) {
  753. return e8 === S.DOT_DENSITY;
  754. }
  755. _drawFills(e8, o7, r9, s10, i4, n8) {
  756. const { passOptions: d5 } = e8;
  757. if (r(d5) && d5.type === "hittest")
  758. super._drawFills(e8, o7, r9, s10, i4, n8);
  759. else {
  760. const t9 = this._drawDotLocations(e8, o7, r9, i4, n8);
  761. this._drawDotDensity(e8, o7, t9);
  762. }
  763. }
  764. _drawDotDensity(e8, o7, r9) {
  765. const { context: s10, painter: i4, rendererInfo: n8, requestRender: d5 } = e8, a5 = i4.materialManager.getProgram(this._dotDesc);
  766. if (r(d5) && !a5.isCompiled)
  767. return void d5();
  768. const { rendererSchema: l8 } = n8;
  769. s5(l8, "dot-density");
  770. const u7 = this._createDotDensityMesh(s10, this._dotDesc.attributes, { geometry: [{ name: "a_pos", count: 2, type: C.SHORT, divisor: 0, normalized: false, offset: 0, stride: 4 }] });
  771. s10.setStencilTestEnabled(true), s10.useProgram(a5), a5.setUniform1f("u_tileZoomFactor", 1), a5.setUniform1i("u_texture", this._dotSamplers[0]), a5.setUniform1f("u_dotSize", Math.max(l8.dotSize, 1)), a5.setUniform1f("u_pixelRatio", window.devicePixelRatio), this._setSharedUniforms(a5, e8, o7), s10.bindTexture(r9, this._dotSamplers[0]), s10.bindVAO(u7), s10.drawArrays(E.POINTS, 0, 262144);
  772. }
  773. _drawDotLocations(e8, t9, o7, r9, s10) {
  774. const { context: i4, rendererInfo: d5, requiredLevel: a5 } = e8, l8 = i4.getViewport(), { rendererSchema: u7 } = d5;
  775. s5(u7, "dot-density");
  776. const { dotScale: c10, colors: f5, activeDots: T3, backgroundColor: p6, dotValue: x6 } = u7;
  777. i4.setViewport(0, 0, 512, 512);
  778. const w5 = i4.getBoundFramebufferObject(), D5 = this._createFBO(i4);
  779. i4.bindFramebuffer(D5), i4.setClearColor(0, 0, 0, 0), i4.clear(i4.gl.COLOR_BUFFER_BIT | i4.gl.STENCIL_BUFFER_BIT), i4.setStencilTestEnabled(false);
  780. const g3 = 1 / 2 ** (a5 - t9.key.level), y2 = o2, S2 = y2 * window.devicePixelRatio * y2 * window.devicePixelRatio, E5 = 1 / g3 * (1 / g3), b4 = c10 ? e8.state.scale / c10 : 1;
  781. return o7.setUniform1f("u_tileZoomFactor", g3), o7.setUniform1f("u_tileDotsOverArea", S2 / (o2 * window.devicePixelRatio * o2 * window.devicePixelRatio)), o7.setUniformMatrix4fv("u_dotColors", f5), o7.setUniform4fv("u_isActive", T3), o7.setUniform4fv("u_dotBackgroundColor", p6), o7.setUniform1f("u_dotValue", Math.max(1, x6 * b4 * E5)), this._bindDotDensityTextures(i4, o7, d5, y2), i4.drawElements(E.TRIANGLES, r9, C.UNSIGNED_INT, s10), i4.setViewport(l8.x, l8.y, l8.width, l8.height), i4.bindFramebuffer(w5), D5.colorTexture;
  782. }
  783. _createFBO(e8) {
  784. if (t(this._dotFBO)) {
  785. const t9 = 512, o7 = 512, r9 = { target: M.TEXTURE_2D, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, wrapMode: D2.CLAMP_TO_EDGE, width: t9, height: o7 }, s10 = { colorTarget: Y.TEXTURE, depthStencilTarget: V.DEPTH_STENCIL_RENDER_BUFFER }, i4 = new r4(e8, { width: t9, height: o7, internalFormat: B.DEPTH_STENCIL });
  786. this._dotFBO = new D4(e8, s10, r9, i4);
  787. }
  788. return this._dotFBO;
  789. }
  790. _disposeTextures() {
  791. if (this._dotTextures) {
  792. for (let e8 = 0; e8 < this._dotTextures.length; e8++)
  793. this._dotTextures[e8].dispose();
  794. this._dotTextures = null;
  795. }
  796. }
  797. _bindDotDensityTextures(e8, t9, o7, r9) {
  798. const { rendererSchema: s10 } = o7;
  799. s5(s10, "dot-density");
  800. const i4 = this._createDotDensityTextures(e8, r9, s10.seed);
  801. t9.setUniform1iv("u_dotTextures", this._dotSamplers);
  802. for (let n8 = 0; n8 < i4.length; n8++)
  803. e8.bindTexture(i4[n8], this._dotSamplers[n8]);
  804. }
  805. _createDotDensityMesh(e8, t9, r9) {
  806. if (t(this._dotVAO)) {
  807. const o7 = 2, s10 = new Int16Array(262144 * o7);
  808. for (let e9 = 0; e9 < 512; e9++)
  809. for (let t10 = 0; t10 < 512; t10++)
  810. s10[o7 * (t10 + 512 * e9)] = t10, s10[o7 * (t10 + 512 * e9) + 1] = e9;
  811. const i4 = c3.createVertex(e8, F.STATIC_DRAW, s10);
  812. this._dotVAO = new f2(e8, t9, r9, { geometry: i4 }, null);
  813. }
  814. return this._dotVAO;
  815. }
  816. _createDotDensityTextures(e8, t9, o7) {
  817. if (this._dotTextureSize === t9 && this._seed === o7 || (this._disposeTextures(), this._dotTextureSize = t9, this._seed = o7), this._dotTextures === null) {
  818. const s10 = new t2(o7);
  819. this._dotTextures = [this._allocDotDensityTexture(e8, t9, s10), this._allocDotDensityTexture(e8, t9, s10)];
  820. }
  821. return this._dotTextures;
  822. }
  823. _allocDotDensityTexture(e8, t9, o7) {
  824. const r9 = new Float32Array(t9 * t9 * 4);
  825. for (let s10 = 0; s10 < r9.length; s10++)
  826. r9[s10] = o7.getFloat();
  827. return new u(e8, { wrapMode: D2.REPEAT, pixelFormat: P.RGBA, dataType: G.FLOAT, samplingMode: L.NEAREST, width: t9, height: t9 }, r9);
  828. }
  829. };
  830. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js
  831. var u5 = { shader: "materials/icon", vertexLayout: { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_vertexOffset", count: 2, type: C.SHORT }, { location: 2, name: "a_texCoords", count: 2, type: C.UNSIGNED_SHORT }, { location: 3, name: "a_bitSetAndDistRatio", count: 2, type: C.UNSIGNED_SHORT }, { location: 4, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 5, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 6, name: "a_outlineColor", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 7, name: "a_sizeAndOutlineWidth", count: 4, type: C.UNSIGNED_BYTE }, { location: 8, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }] }, hittestAttributes: ["a_vertexOffset", "a_texCoords"] };
  832. var d3 = class extends p3 {
  833. dispose() {
  834. }
  835. getGeometryType() {
  836. return E3.MARKER;
  837. }
  838. supportsSymbology(t9) {
  839. return t9 !== S.HEATMAP && t9 !== S.PIE_CHART;
  840. }
  841. drawGeometry(o7, a5, i4, m11) {
  842. const { context: d5, painter: c10, rendererInfo: p6, state: y2, passOptions: _5, requestRender: f5 } = o7, E5 = N2.load(i4.materialKey), S2 = p(E5.data), N4 = r(_5) && _5.type === "hittest", { shader: T3, vertexLayout: g3, hittestAttributes: x6 } = c(S2.programSpec, u5);
  843. let h5 = E.TRIANGLES, R3 = ge(E5.data, g3);
  844. N4 && (R3 = this._getTriangleDesc(i4.materialKey, R3, x6), h5 = E.POINTS);
  845. const { attributes: U4, bufferLayouts: A4 } = R3, O5 = c10.materialManager.getMaterialProgram(o7, E5, T3, U4, m11);
  846. if (r(f5) && !N4 && !O5.isCompiled)
  847. return void f5();
  848. d5.useProgram(O5), E5.textureBinding && c10.textureManager.bindTextures(d5, O5, E5, true), this._setSharedUniforms(O5, o7, a5);
  849. const G4 = E5.vvRotation ? y2.displayViewMat3 : y2.displayMat3;
  850. O5.setUniformMatrix3fv("u_displayMat3", G4), this._setSizeVVUniforms(E5, O5, p6, a5), this._setColorAndOpacityVVUniforms(E5, O5, p6), this._setRotationVVUniforms(E5, O5, p6);
  851. const I3 = i4.target.getVAO(d5, A4, U4, N4);
  852. let M6 = i4.indexCount, b4 = i4.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  853. N4 && (M6 /= 3, b4 /= 3), d5.bindVAO(I3), this._drawMarkers(o7, a5, O5, h5, M6, b4, N4), d5.bindVAO(null);
  854. }
  855. _drawMarkers(t9, e8, o7, a5, r9, i4, n8) {
  856. t9.context.drawElements(a5, r9, C.UNSIGNED_INT, i4);
  857. }
  858. };
  859. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js
  860. var x3 = s2.getLogger("esri.views.2d.engine.webgl.brushes.WGLBrushHeatmap");
  861. var F4 = { vsPath: "heatmap/heatmapResolve", fsPath: "heatmap/heatmapResolve", attributes: new Map([["a_position", 0]]) };
  862. var b2 = class extends d3 {
  863. supportsSymbology(e8) {
  864. return e8 === S.HEATMAP;
  865. }
  866. dispose() {
  867. super.dispose(), this._accumulateOutputTexture = s(this._accumulateOutputTexture), this._accumulateFramebuffer = s(this._accumulateFramebuffer), this._resolveGradientTexture = s(this._resolveGradientTexture), this._tileQuad = s(this._tileQuad);
  868. }
  869. drawGeometry(e8, t9, r9, a5) {
  870. const { defines: i4 } = this._loadQualityProfile(e8.context);
  871. super.drawGeometry(e8, t9, r9, a5 ? [...a5, ...i4] : i4);
  872. }
  873. _drawMarkers(e8, t9, r9, a5, i4, s10, o7) {
  874. const { context: u7 } = e8, l8 = u7.getBoundFramebufferObject(), m11 = u7.getViewport();
  875. this._prepareAccumulatePass(e8, t9, r9, o7), u7.drawElements(a5, i4, C.UNSIGNED_INT, s10), o7 || this._drawResolvePass(e8, t9, l8, m11);
  876. }
  877. _prepareAccumulatePass(e8, t9, r9, a5) {
  878. const { context: i4, rendererInfo: s10, state: u7, displayLevel: n8 } = e8, { rendererSchema: d5 } = s10;
  879. s5(d5, "heatmap");
  880. const { referenceScale: h5, radius: c10, isFieldActive: f5 } = d5;
  881. this._loadResources(i4), this._updateResources(d5);
  882. const _5 = c10 * (h5 !== 0 ? h5 / u7.scale : 1) * 2 ** (t9.key.level - n8);
  883. r9.setUniform1f("u_radius", _5), a5 || (i4.bindFramebuffer(this._accumulateFramebuffer), r9.setUniform1f("u_isFieldActive", f5), i4.setViewport(0, 0, this._accumulateFramebuffer.width, this._accumulateFramebuffer.height), i4.setBlendingEnabled(true), i4.setBlendFunction(R.ONE, R.ONE), i4.setClearColor(0, 0, 0, 0), i4.clear(_.COLOR_BUFFER_BIT));
  884. }
  885. _drawResolvePass(e8, t9, r9, a5) {
  886. const { context: i4, painter: s10, rendererInfo: u7 } = e8, { rendererSchema: n8 } = u7;
  887. s5(n8, "heatmap");
  888. const { radius: m11, minDensity: d5, densityRange: h5 } = n8, { defines: c10 } = this._loadQualityProfile(i4), f5 = s10.materialManager.getProgram(F4, c10);
  889. i4.useProgram(f5), this._setSharedUniforms(f5, e8, t9), i4.bindFramebuffer(r9), i4.setViewport(0, 0, a5.width, a5.height), i4.setBlendFunction(R.ONE, R.ONE_MINUS_SRC_ALPHA), i4.bindTexture(this._accumulateOutputTexture, 8), i4.bindTexture(this._resolveGradientTexture, 9), f5.setUniform1i("u_texture", 8), f5.setUniform1i("u_gradient", 9), f5.setUniform2f("u_densityMinAndInvRange", d5, 1 / h5), f5.setUniform1f("u_densityNormalization", 3 / (m11 * m11 * Math.PI)), this._tileQuad.draw();
  890. }
  891. _loadResources(e8) {
  892. const t9 = e8.type === o3.WEBGL2, { dataType: r9, samplingMode: a5, shadingRate: s10 } = this._loadQualityProfile(e8);
  893. this._accumulateOutputTexture ?? (this._accumulateOutputTexture = new u(e8, { target: M.TEXTURE_2D, pixelFormat: t9 ? P.RED : P.RGBA, internalFormat: t9 ? r9 === G.FLOAT ? U.R32F : U.R16F : P.RGBA, dataType: r9, samplingMode: a5, wrapMode: D2.CLAMP_TO_EDGE, width: Math.round(512 * s10), height: Math.round(512 * s10) })), this._accumulateFramebuffer ?? (this._accumulateFramebuffer = new D4(e8, {}, this._accumulateOutputTexture)), this._resolveGradientTexture ?? (this._resolveGradientTexture = new u(e8, { target: M.TEXTURE_2D, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.LINEAR, wrapMode: D2.CLAMP_TO_EDGE })), this._tileQuad ?? (this._tileQuad = new n4(e8, [0, 0, 1, 0, 0, 1, 1, 1]));
  894. }
  895. _updateResources(e8) {
  896. const { gradientHash: t9, gradient: r9 } = e8;
  897. this._prevGradientHash !== t9 && (this._resolveGradientTexture.resize(r9.length / 4, 1), this._resolveGradientTexture.setData(r9), this._prevGradientHash = t9);
  898. }
  899. _loadQualityProfile(e8) {
  900. if (t(this._qualityProfile)) {
  901. const { textureFloat: t9, colorBufferFloat: r9 } = e8.capabilities, { textureFloat: a5, textureFloatLinear: i4, textureHalfFloat: s10, textureHalfFloatLinear: o7, HALF_FLOAT: u7 } = t9, { textureFloat: n8, textureHalfFloat: l8, floatBlend: m11 } = r9;
  902. let d5, h5;
  903. const f5 = a5 && n8 && m11, _5 = s10 && l8;
  904. f5 && i4 ? (d5 = G.FLOAT, h5 = L.LINEAR) : _5 && o7 ? (d5 = u7, h5 = L.LINEAR) : f5 ? (d5 = G.FLOAT, h5 = L.NEAREST) : _5 ? (d5 = u7, h5 = L.NEAREST) : x3.error("Missing webgl extensions for heatmap!"), h5 === L.NEAREST && x3.warnOnce("Missing linear filtering webgl extension(s). Heatmap quality may be reduced."), this._qualityProfile = { dataType: d5, samplingMode: h5, shadingRate: 0.5, defines: d5 === u7 ? ["heatmapPrecisionHalfFloat"] : [] };
  905. }
  906. return this._qualityProfile;
  907. }
  908. };
  909. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/TileInfoPrograms.js
  910. var r8 = { shaders: { vertexShader: n6("tileInfo/tileInfo.vert"), fragmentShader: n6("tileInfo/tileInfo.frag") }, attributes: new Map([["a_pos", 0]]) };
  911. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushInfo.js
  912. var A3 = 300;
  913. var b3 = 32;
  914. var x4 = class extends a2 {
  915. constructor() {
  916. super(...arguments), this._color = r7(1, 0, 0, 1);
  917. }
  918. dispose() {
  919. this._outlineProgram && (this._outlineProgram.dispose(), this._outlineProgram = null), this._tileInfoProgram && (this._tileInfoProgram.dispose(), this._tileInfoProgram = null), this._outlineVertexArrayObject && (this._outlineVertexArrayObject.dispose(), this._outlineVertexArrayObject = null), this._tileInfoVertexArrayObject && (this._tileInfoVertexArrayObject.dispose(), this._tileInfoVertexArrayObject = null), this._canvas = null;
  920. }
  921. prepareState({ context: t9 }) {
  922. t9.setBlendingEnabled(true), t9.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), t9.setColorMask(true, true, true, true), t9.setStencilWriteMask(0), t9.setStencilTestEnabled(false);
  923. }
  924. draw(e8, r9) {
  925. const { context: i4, requestRender: o7 } = e8;
  926. if (!r9.isReady)
  927. return;
  928. if (this._loadWGLResources(i4), r(o7) && (!this._outlineProgram.isCompiled || !this._tileInfoProgram.isCompiled))
  929. return void o7();
  930. i4.bindVAO(this._outlineVertexArrayObject), i4.useProgram(this._outlineProgram), this._outlineProgram.setUniformMatrix3fv("u_dvsMat3", r9.transforms.dvs), this._outlineProgram.setUniform2f("u_coord_range", r9.rangeX, r9.rangeY), this._outlineProgram.setUniform1f("u_depth", 0), this._outlineProgram.setUniform4fv("u_color", this._color), i4.drawArrays(E.LINE_STRIP, 0, 4);
  931. const s10 = this._getTexture(i4, r9);
  932. s10 ? (i4.bindVAO(this._tileInfoVertexArrayObject), i4.useProgram(this._tileInfoProgram), i4.bindTexture(s10, 0), this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3", r9.transforms.dvs), this._tileInfoProgram.setUniform1f("u_depth", 0), this._tileInfoProgram.setUniform2f("u_coord_ratio", r9.rangeX / r9.width, r9.rangeY / r9.height), this._tileInfoProgram.setUniform2f("u_delta", 8, 8), this._tileInfoProgram.setUniform2f("u_dimensions", s10.descriptor.width, s10.descriptor.height), i4.drawArrays(E.TRIANGLE_STRIP, 0, 4), i4.bindVAO()) : i4.bindVAO();
  933. }
  934. _loadWGLResources(t9) {
  935. if (this._outlineProgram && this._tileInfoProgram)
  936. return;
  937. const e8 = e3(t9, e7), i4 = e3(t9, r8), a5 = new Int8Array([0, 0, 1, 0, 1, 1, 0, 1]), l8 = c3.createVertex(t9, F.STATIC_DRAW, a5), m11 = new f2(t9, e7.attributes, r6, { geometry: l8 }), _5 = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), f5 = c3.createVertex(t9, F.STATIC_DRAW, _5), h5 = new f2(t9, r8.attributes, r6, { geometry: f5 });
  938. this._outlineProgram = e8, this._tileInfoProgram = i4, this._outlineVertexArrayObject = m11, this._tileInfoVertexArrayObject = h5;
  939. }
  940. _getTexture(t9, e8) {
  941. if (e8.texture && e8.triangleCountReportedInDebug === e8.triangleCount)
  942. return e8.texture;
  943. e8.triangleCountReportedInDebug = e8.triangleCount, this._canvas || (this._canvas = document.createElement("canvas"), this._canvas.setAttribute("id", "canvas2d"), this._canvas.setAttribute("width", `${A3}`), this._canvas.setAttribute("height", `${b3}`), this._canvas.setAttribute("style", "display:none"));
  944. const r9 = e8.triangleCount;
  945. let i4 = e8.key.id;
  946. e8.triangleCount > 0 && (i4 += `, ${r9}`);
  947. const o7 = this._canvas, s10 = o7.getContext("2d");
  948. return s10.font = "24px sans-serif", s10.textAlign = "left", s10.textBaseline = "top", s10.clearRect(0, 0, A3, b3), r9 > 1e5 ? (s10.fillStyle = "red", s10.fillRect(0, 0, A3, b3), s10.fillStyle = "black") : (s10.clearRect(0, 0, A3, b3), s10.fillStyle = "blue"), s10.fillText(i4, 0, 0), e8.texture = new u(t9, { target: M.TEXTURE_2D, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, wrapMode: D2.CLAMP_TO_EDGE }, o7), e8.texture;
  949. }
  950. };
  951. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushPieChart.js
  952. var s7 = class extends d3 {
  953. supportsSymbology(r9) {
  954. return r9 === S.PIE_CHART;
  955. }
  956. _drawMarkers(o7, r9, s10, n8, l8, f5, u7) {
  957. const { context: i4 } = o7, { rendererInfo: m11 } = o7, { rendererSchema: a5 } = m11;
  958. s5(a5, "pie-chart"), s10.setUniform4fv("u_colors", a5.colors), s10.setUniform4fv("u_defaultColor", a5.defaultColor), s10.setUniform4fv("u_othersColor", a5.othersColor), s10.setUniform4fv("u_outlineColor", a5.outlineColor), s10.setUniform1f("u_donutRatio", a5.holePercentage), s10.setUniform1f("u_sectorThreshold", a5.sectorThreshold), s10.setUniform1f("u_outlineWidth", a5.outlineWidth), i4.drawElements(n8, l8, C.UNSIGNED_INT, f5);
  959. }
  960. };
  961. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushStencil.js
  962. var h3 = class extends a2 {
  963. constructor() {
  964. super(...arguments), this._color = r7(1, 0, 0, 1), this._initialized = false;
  965. }
  966. dispose() {
  967. this._solidProgram && (this._solidProgram.dispose(), this._solidProgram = null), this._solidVertexArrayObject && (this._solidVertexArrayObject.dispose(), this._solidVertexArrayObject = null);
  968. }
  969. prepareState({ context: r9 }, t9) {
  970. r9.setDepthWriteEnabled(false), r9.setDepthTestEnabled(false), r9.setStencilTestEnabled(true), r9.setBlendingEnabled(false), r9.setColorMask(false, false, false, false), r9.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), r9.setStencilWriteMask(255), r9.setStencilFunctionSeparate(N.FRONT_AND_BACK, I.GREATER, t9.stencilRef, 255);
  971. }
  972. draw(t9, e8) {
  973. const { context: i4, requestRender: s10 } = t9;
  974. this._initialized || this._initialize(i4), !r(s10) || this._solidProgram.isCompiled ? (i4.bindVAO(this._solidVertexArrayObject), i4.useProgram(this._solidProgram), this._solidProgram.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), this._solidProgram.setUniform2fv("u_coord_range", [e8.rangeX, e8.rangeY]), this._solidProgram.setUniform1f("u_depth", 0), this._solidProgram.setUniform4fv("u_color", this._color), i4.drawArrays(E.TRIANGLE_STRIP, 0, 4), i4.bindVAO()) : s10();
  975. }
  976. _initialize(r9) {
  977. if (this._initialized)
  978. return true;
  979. const t9 = e3(r9, e7);
  980. if (!t9)
  981. return false;
  982. const i4 = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), a5 = c3.createVertex(r9, F.STATIC_DRAW, i4), l8 = new f2(r9, e7.attributes, r6, { geometry: a5 });
  983. return this._solidProgram = t9, this._solidVertexArrayObject = l8, this._initialized = true, true;
  984. }
  985. };
  986. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js
  987. var d4 = class extends a2 {
  988. constructor() {
  989. super(...arguments), this._color = r7(1, 0, 0, 1), this._patternMatrix = e4(), this._programOptions = { id: false, pattern: false };
  990. }
  991. dispose() {
  992. this._vao && (this._vao.dispose(), this._vao = null);
  993. }
  994. drawMany(e8, o7) {
  995. const { context: c10, painter: m11, styleLayerUID: p6, requestRender: _5 } = e8;
  996. this._loadWGLResources(e8);
  997. const d5 = e8.displayLevel, h5 = e8.styleLayer, g3 = h5.backgroundMaterial, v = m11.vectorTilesMaterialManager, b4 = h5.getPaintValue("background-color", d5), y2 = h5.getPaintValue("background-opacity", d5), M6 = h5.getPaintValue("background-pattern", d5), x6 = M6 !== void 0, j = b4[3] * y2, U4 = 1 | window.devicePixelRatio, L3 = e8.spriteMosaic;
  998. let w5, A4;
  999. const P3 = U4 > _2 ? 2 : 1, I3 = e8.drawPhase === I2.HITTEST, R3 = this._programOptions;
  1000. R3.id = I3, R3.pattern = x6;
  1001. const k = v.getMaterialProgram(c10, g3, R3);
  1002. if (!r(_5) || I3 || k.isCompiled) {
  1003. if (c10.bindVAO(this._vao), c10.useProgram(k), x6) {
  1004. const t9 = L3.getMosaicItemPosition(M6, true);
  1005. if (r(t9)) {
  1006. const { tl: e9, br: o8, page: s10 } = t9;
  1007. w5 = o8[0] - e9[0], A4 = o8[1] - e9[1];
  1008. const a5 = L3.getPageSize(s10);
  1009. r(a5) && (L3.bind(c10, L.LINEAR, s10, Z), k.setUniform4f("u_tlbr", e9[0], e9[1], o8[0], o8[1]), k.setUniform2fv("u_mosaicSize", a5), k.setUniform1i("u_texture", Z));
  1010. }
  1011. k.setUniform1f("u_opacity", y2);
  1012. } else
  1013. this._color[0] = j * b4[0], this._color[1] = j * b4[1], this._color[2] = j * b4[2], this._color[3] = j, k.setUniform4fv("u_color", this._color);
  1014. if (k.setUniform1f("u_depth", h5.z || 0), I3) {
  1015. const t9 = M3(p6 + 1);
  1016. k.setUniform4fv("u_id", t9);
  1017. }
  1018. for (const r9 of o7) {
  1019. if (k.setUniform1f("u_coord_range", r9.rangeX), k.setUniformMatrix3fv("u_dvsMat3", r9.transforms.dvs), x6) {
  1020. const e9 = Math.max(2 ** (Math.round(d5) - r9.key.level), 1), o8 = P3 * r9.width * e9, i4 = o8 / c2(w5), s10 = o8 / c2(A4);
  1021. this._patternMatrix[0] = i4, this._patternMatrix[4] = s10, k.setUniformMatrix3fv("u_pattern_matrix", this._patternMatrix);
  1022. }
  1023. c10.setStencilFunction(I.EQUAL, r9.stencilRef, 255), c10.drawArrays(E.TRIANGLE_STRIP, 0, 4);
  1024. }
  1025. } else
  1026. _5();
  1027. }
  1028. _loadWGLResources(t9) {
  1029. if (this._vao)
  1030. return;
  1031. const { context: r9, styleLayer: e8 } = t9, o7 = e8.backgroundMaterial, i4 = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), s10 = c3.createVertex(r9, F.STATIC_DRAW, i4), a5 = new f2(r9, o7.getAttributeLocations(), o7.getLayoutInfo(), { geometry: s10 });
  1032. this._vao = a5;
  1033. }
  1034. };
  1035. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js
  1036. var c8 = class extends a2 {
  1037. constructor() {
  1038. super(...arguments), this._programOptions = { id: false };
  1039. }
  1040. dispose() {
  1041. }
  1042. drawMany(a5, c10) {
  1043. const { context: m11, displayLevel: f5, requiredLevel: u7, state: d5, drawPhase: p6, painter: y2, spriteMosaic: g3, styleLayerUID: v, requestRender: E5 } = a5;
  1044. if (!c10.some((e8) => e8.layerData.get(v)?.circleIndexCount ?? false))
  1045. return;
  1046. const M6 = a5.styleLayer, T3 = M6.circleMaterial, x6 = y2.vectorTilesMaterialManager, I3 = 1.2, U4 = M6.getPaintValue("circle-translate", f5), _5 = M6.getPaintValue("circle-translate-anchor", f5), h5 = p6 === I2.HITTEST, L3 = this._programOptions;
  1047. L3.id = h5;
  1048. const R3 = x6.getMaterialProgram(m11, T3, L3);
  1049. if (!h5 && r(E5) && !R3.isCompiled)
  1050. return void E5();
  1051. m11.useProgram(R3), R3.setUniformMatrix3fv("u_displayMat3", _5 === r5.VIEWPORT ? d5.displayMat3 : d5.displayViewMat3), R3.setUniform2fv("u_circleTranslation", U4), R3.setUniform1f("u_depth", M6.z), R3.setUniform1f("u_antialiasingWidth", I3);
  1052. let S2 = -1;
  1053. if (h5) {
  1054. const e8 = M3(v + 1);
  1055. R3.setUniform4fv("u_id", e8);
  1056. }
  1057. for (const e8 of c10) {
  1058. if (!e8.layerData.has(v))
  1059. continue;
  1060. e8.key.level !== S2 && (S2 = e8.key.level, T3.setDataUniforms(R3, f5, M6, S2, g3));
  1061. const r9 = e8.layerData.get(v);
  1062. if (!r9.circleIndexCount)
  1063. continue;
  1064. r9.prepareForRendering(m11);
  1065. const i4 = r9.circleVertexArrayObject;
  1066. t(i4) || (m11.bindVAO(i4), R3.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), u7 !== e8.key.level ? m11.setStencilFunction(I.EQUAL, e8.stencilRef, 255) : m11.setStencilFunction(I.GREATER, 255, 255), m11.drawElements(E.TRIANGLES, r9.circleIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * r9.circleIndexStart), e8.triangleCount += r9.circleIndexCount / 3);
  1067. }
  1068. }
  1069. };
  1070. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js
  1071. var c9 = 1 / 65536;
  1072. var m6 = class extends a2 {
  1073. constructor() {
  1074. super(...arguments), this._fillProgramOptions = { id: false, pattern: false }, this._outlineProgramOptions = { id: false };
  1075. }
  1076. dispose() {
  1077. }
  1078. drawMany(t9, e8) {
  1079. const { displayLevel: i4, drawPhase: r9, renderPass: n8, spriteMosaic: s10, styleLayerUID: l8 } = t9;
  1080. let f5 = false;
  1081. for (const a5 of e8)
  1082. if (a5.layerData.has(l8)) {
  1083. const t10 = a5.layerData.get(l8);
  1084. if (t10.fillIndexCount > 0 || t10.outlineIndexCount > 0) {
  1085. f5 = true;
  1086. break;
  1087. }
  1088. }
  1089. if (!f5)
  1090. return;
  1091. const u7 = t9.styleLayer, d5 = u7.getPaintProperty("fill-pattern"), c10 = d5 !== void 0, m11 = c10 && d5.isDataDriven;
  1092. let p6;
  1093. if (c10 && !m11) {
  1094. const t10 = d5.getValue(i4);
  1095. p6 = s10.getMosaicItemPosition(t10, true);
  1096. }
  1097. const y2 = !c10 && u7.getPaintValue("fill-antialias", i4);
  1098. let g3 = true, _5 = 1;
  1099. if (!c10) {
  1100. const t10 = u7.getPaintProperty("fill-color"), e9 = u7.getPaintProperty("fill-opacity");
  1101. if (!t10?.isDataDriven && !e9?.isDataDriven) {
  1102. const t11 = u7.getPaintValue("fill-color", i4);
  1103. _5 = u7.getPaintValue("fill-opacity", i4) * t11[3], _5 >= 1 && (g3 = false);
  1104. }
  1105. }
  1106. if (g3 && n8 === "opaque")
  1107. return;
  1108. let E5;
  1109. r9 === I2.HITTEST && (E5 = M3(l8 + 1));
  1110. const v = u7.getPaintValue("fill-translate", i4), M6 = u7.getPaintValue("fill-translate-anchor", i4);
  1111. (g3 || n8 !== "translucent") && this._drawFill(t9, l8, u7, e8, v, M6, c10, p6, m11, E5);
  1112. const P3 = !u7.hasDataDrivenOutlineColor && u7.outlineUsesFillColor && _5 < 1;
  1113. y2 && n8 !== "opaque" && !P3 && this._drawOutline(t9, l8, u7, e8, v, M6, E5);
  1114. }
  1115. _drawFill(o7, s10, m11, p6, y2, g3, _5, E5, v, M6) {
  1116. if (_5 && !v && t(E5))
  1117. return;
  1118. const { context: P3, displayLevel: I3, state: T3, drawPhase: U4, painter: x6, pixelRatio: h5, spriteMosaic: D5, requestRender: S2 } = o7, R3 = m11.fillMaterial, N4 = x6.vectorTilesMaterialManager, w5 = h5 > _2 ? 2 : 1, L3 = U4 === I2.HITTEST, A4 = this._fillProgramOptions;
  1119. A4.id = L3, A4.pattern = _5;
  1120. const C4 = N4.getMaterialProgram(P3, R3, A4);
  1121. if (r(S2) && !L3 && !C4.isCompiled)
  1122. return void S2();
  1123. if (P3.useProgram(C4), r(E5)) {
  1124. const { page: t9 } = E5, i4 = D5.getPageSize(t9);
  1125. r(i4) && (D5.bind(P3, L.LINEAR, t9, Z), C4.setUniform2fv("u_mosaicSize", i4), C4.setUniform1i("u_texture", Z));
  1126. }
  1127. C4.setUniformMatrix3fv("u_displayMat3", g3 === r5.VIEWPORT ? T3.displayMat3 : T3.displayViewMat3), C4.setUniform2fv("u_fillTranslation", y2), C4.setUniform1f("u_depth", m11.z + c9), L3 && C4.setUniform4fv("u_id", M6);
  1128. let V2 = -1;
  1129. for (const i4 of p6) {
  1130. if (!i4.layerData.has(s10))
  1131. continue;
  1132. i4.key.level !== V2 && (V2 = i4.key.level, R3.setDataUniforms(C4, I3, m11, V2, D5));
  1133. const n8 = i4.layerData.get(s10);
  1134. if (!n8.fillIndexCount)
  1135. continue;
  1136. n8.prepareForRendering(P3);
  1137. const a5 = n8.fillVertexArrayObject;
  1138. if (!t(a5)) {
  1139. if (P3.bindVAO(a5), C4.setUniformMatrix3fv("u_dvsMat3", i4.transforms.dvs), P3.setStencilFunction(I.EQUAL, i4.stencilRef, 255), _5) {
  1140. const t9 = Math.max(2 ** (Math.round(I3) - i4.key.level), 1), e8 = i4.rangeX / (w5 * i4.width * t9);
  1141. C4.setUniform1f("u_patternFactor", e8);
  1142. }
  1143. if (v) {
  1144. const t9 = n8.patternMap;
  1145. if (!t9)
  1146. continue;
  1147. for (const [i5, n9] of t9) {
  1148. const t10 = D5.getPageSize(i5);
  1149. r(t10) && (D5.bind(P3, L.LINEAR, i5, Z), C4.setUniform2fv("u_mosaicSize", t10), C4.setUniform1i("u_texture", Z), P3.drawElements(E.TRIANGLES, n9[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * n9[0]));
  1150. }
  1151. } else
  1152. P3.drawElements(E.TRIANGLES, n8.fillIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * n8.fillIndexStart);
  1153. i4.triangleCount += n8.fillIndexCount / 3;
  1154. }
  1155. }
  1156. }
  1157. _drawOutline(r9, n8, o7, s10, l8, m11, p6) {
  1158. const { context: y2, displayLevel: g3, state: _5, drawPhase: E5, painter: v, pixelRatio: M6, spriteMosaic: P3, requestRender: I3 } = r9, T3 = o7.outlineMaterial, U4 = v.vectorTilesMaterialManager, x6 = 0.75 / M6, h5 = E5 === I2.HITTEST, D5 = this._outlineProgramOptions;
  1159. D5.id = h5;
  1160. const S2 = U4.getMaterialProgram(y2, T3, D5);
  1161. if (r(I3) && !h5 && !S2.isCompiled)
  1162. return void I3();
  1163. y2.useProgram(S2), S2.setUniformMatrix3fv("u_displayMat3", m11 === r5.VIEWPORT ? _5.displayMat3 : _5.displayViewMat3), S2.setUniform2fv("u_fillTranslation", l8), S2.setUniform1f("u_depth", o7.z + c9), S2.setUniform1f("u_outline_width", x6), h5 && S2.setUniform4fv("u_id", p6);
  1164. let R3 = -1;
  1165. for (const e8 of s10) {
  1166. if (!e8.layerData.has(n8))
  1167. continue;
  1168. e8.key.level !== R3 && (R3 = e8.key.level, T3.setDataUniforms(S2, g3, o7, R3, P3));
  1169. const i4 = e8.layerData.get(n8);
  1170. if (i4.prepareForRendering(y2), !i4.outlineIndexCount)
  1171. continue;
  1172. const r10 = i4.outlineVertexArrayObject;
  1173. t(r10) || (y2.bindVAO(r10), S2.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), y2.setStencilFunction(I.EQUAL, e8.stencilRef, 255), y2.drawElements(E.TRIANGLES, i4.outlineIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * i4.outlineIndexStart), e8.triangleCount += i4.outlineIndexCount / 3);
  1174. }
  1175. }
  1176. };
  1177. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js
  1178. var u6 = class extends a2 {
  1179. constructor() {
  1180. super(...arguments), this._programOptions = { id: false, pattern: false, sdf: false };
  1181. }
  1182. dispose() {
  1183. }
  1184. drawMany(o7, u7) {
  1185. const { context: c10, displayLevel: d5, state: p6, drawPhase: g3, painter: y2, pixelRatio: E5, spriteMosaic: M6, styleLayerUID: _5, requestRender: v } = o7;
  1186. if (!u7.some((e8) => e8.layerData.get(_5)?.lineIndexCount ?? false))
  1187. return;
  1188. const U4 = o7.styleLayer, I3 = U4.lineMaterial, P3 = y2.vectorTilesMaterialManager, x6 = U4.getPaintValue("line-translate", d5), T3 = U4.getPaintValue("line-translate-anchor", d5), S2 = U4.getPaintProperty("line-pattern"), D5 = S2 !== void 0, L3 = D5 && S2.isDataDriven;
  1189. let N4, R3;
  1190. if (D5 && !L3) {
  1191. const e8 = S2.getValue(d5);
  1192. N4 = M6.getMosaicItemPosition(e8);
  1193. }
  1194. let V2 = false;
  1195. if (!D5) {
  1196. const e8 = U4.getPaintProperty("line-dasharray");
  1197. if (R3 = e8 !== void 0, V2 = R3 && e8.isDataDriven, R3 && !V2) {
  1198. const t9 = e8.getValue(d5), i4 = U4.getDashKey(t9, U4.getLayoutValue("line-cap", d5));
  1199. N4 = M6.getMosaicItemPosition(i4);
  1200. }
  1201. }
  1202. const h5 = 1 / E5, A4 = g3 === I2.HITTEST, j = this._programOptions;
  1203. j.id = A4, j.pattern = D5, j.sdf = R3;
  1204. const w5 = P3.getMaterialProgram(c10, I3, j);
  1205. if (r(v) && !A4 && !w5.isCompiled)
  1206. return void v();
  1207. if (c10.useProgram(w5), w5.setUniformMatrix3fv("u_displayViewMat3", p6.displayViewMat3), w5.setUniformMatrix3fv("u_displayMat3", T3 === r5.VIEWPORT ? p6.displayMat3 : p6.displayViewMat3), w5.setUniform2fv("u_lineTranslation", x6), w5.setUniform1f("u_depth", U4.z), w5.setUniform1f("u_antialiasing", h5), A4) {
  1208. const e8 = M3(_5 + 1);
  1209. w5.setUniform4fv("u_id", e8);
  1210. }
  1211. if (N4 && r(N4)) {
  1212. const { page: t9 } = N4, i4 = M6.getPageSize(t9);
  1213. r(i4) && (M6.bind(c10, L.LINEAR, t9, Z), w5.setUniform2fv("u_mosaicSize", i4), w5.setUniform1i("u_texture", Z));
  1214. }
  1215. let b4 = -1;
  1216. for (const i4 of u7) {
  1217. if (!i4.layerData.has(_5))
  1218. continue;
  1219. i4.key.level !== b4 && (b4 = i4.key.level, I3.setDataUniforms(w5, d5, U4, b4, M6));
  1220. const r9 = 2 ** (d5 - b4) / E5;
  1221. w5.setUniform1f("u_zoomFactor", r9);
  1222. const a5 = i4.layerData.get(_5);
  1223. if (!a5.lineIndexCount)
  1224. continue;
  1225. a5.prepareForRendering(c10);
  1226. const o8 = a5.lineVertexArrayObject;
  1227. if (!t(o8)) {
  1228. if (c10.bindVAO(o8), w5.setUniformMatrix3fv("u_dvsMat3", i4.transforms.dvs), c10.setStencilFunction(I.EQUAL, i4.stencilRef, 255), L3 || V2) {
  1229. const t9 = a5.patternMap;
  1230. if (!t9)
  1231. continue;
  1232. for (const [i5, r10] of t9) {
  1233. const t10 = M6.getPageSize(i5);
  1234. r(t10) && (M6.bind(c10, L.LINEAR, i5, Z), w5.setUniform2fv("u_mosaicSize", t10), w5.setUniform1i("u_texture", Z), c10.drawElements(E.TRIANGLES, r10[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * r10[0]));
  1235. }
  1236. } else
  1237. c10.drawElements(E.TRIANGLES, a5.lineIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * a5.lineIndexStart);
  1238. i4.triangleCount += a5.lineIndexCount / 3;
  1239. }
  1240. }
  1241. }
  1242. };
  1243. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js
  1244. var h4 = 1 / 65536;
  1245. var M5 = class extends a2 {
  1246. constructor() {
  1247. super(...arguments), this._iconProgramOptions = { id: false, sdf: false }, this._sdfProgramOptions = { id: false }, this._spritesTextureSize = n();
  1248. }
  1249. dispose() {
  1250. }
  1251. drawMany(e8, t9) {
  1252. const { drawPhase: i4, styleLayerUID: a5 } = e8, r9 = e8.styleLayer;
  1253. let s10;
  1254. i4 === I2.HITTEST && (s10 = M3(a5 + 1)), this._drawIcons(e8, r9, t9, s10), this._drawText(e8, r9, t9, s10);
  1255. }
  1256. _drawIcons(i4, a5, f5, p6) {
  1257. const { context: c10, displayLevel: d5, drawPhase: g3, painter: y2, spriteMosaic: _5, state: h5, styleLayerUID: M6, requestRender: P3 } = i4, T3 = a5.iconMaterial, U4 = y2.vectorTilesMaterialManager;
  1258. let E5, x6 = false;
  1259. for (const e8 of f5)
  1260. if (e8.layerData.has(M6) && (E5 = e8.layerData.get(M6), E5.iconPerPageElementsMap.size > 0)) {
  1261. x6 = true;
  1262. break;
  1263. }
  1264. if (!x6)
  1265. return;
  1266. const v = a5.getPaintValue("icon-translate", d5), I3 = a5.getPaintValue("icon-translate-anchor", d5);
  1267. let S2 = a5.getLayoutValue("icon-rotation-alignment", d5);
  1268. S2 === l3.AUTO && (S2 = a5.getLayoutValue("symbol-placement", d5) === n3.POINT ? l3.VIEWPORT : l3.MAP);
  1269. const D5 = S2 === l3.MAP, V2 = a5.getLayoutValue("icon-keep-upright", d5) && D5, R3 = E5.isIconSDF, w5 = g3 === I2.HITTEST, A4 = this._iconProgramOptions;
  1270. A4.id = w5, A4.sdf = R3;
  1271. const L3 = U4.getMaterialProgram(c10, T3, A4);
  1272. if (r(P3) && !w5 && !L3.isCompiled)
  1273. return void P3();
  1274. c10.useProgram(L3), L3.setUniformMatrix3fv("u_displayViewMat3", S2 === l3.MAP ? h5.displayViewMat3 : h5.displayMat3), L3.setUniformMatrix3fv("u_displayMat3", I3 === r5.VIEWPORT ? h5.displayMat3 : h5.displayViewMat3), L3.setUniform2fv("u_iconTranslation", v), L3.setUniform1f("u_depth", a5.z), L3.setUniform1f("u_mapRotation", M4(h5.rotation)), L3.setUniform1f("u_keepUpright", V2 ? 1 : 0), L3.setUniform1f("u_level", 10 * d5), L3.setUniform1i("u_texture", Z), L3.setUniform1f("u_fadeDuration", e / 1e3), w5 && L3.setUniform4fv("u_id", p6);
  1275. let O5 = -1;
  1276. for (const e8 of f5) {
  1277. if (!e8.layerData.has(M6))
  1278. continue;
  1279. if (e8.key.level !== O5 && (O5 = e8.key.level, T3.setDataUniforms(L3, d5, a5, O5, _5)), E5 = e8.layerData.get(M6), E5.iconPerPageElementsMap.size === 0)
  1280. continue;
  1281. E5.prepareForRendering(c10), E5.updateOpacityInfo();
  1282. const r9 = E5.iconVertexArrayObject;
  1283. if (!t(r9)) {
  1284. c10.bindVAO(r9), L3.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), L3.setUniform1f("u_time", (performance.now() - E5.lastOpacityUpdate) / 1e3);
  1285. for (const [t9, a6] of E5.iconPerPageElementsMap)
  1286. this._renderIconRange(i4, L3, a6, t9, e8);
  1287. }
  1288. }
  1289. }
  1290. _renderIconRange(e8, t9, i4, a5, r9) {
  1291. const { context: s10, spriteMosaic: n8 } = e8;
  1292. this._spritesTextureSize[0] = n8.getWidth(a5) / 4, this._spritesTextureSize[1] = n8.getHeight(a5) / 4, t9.setUniform2fv("u_mosaicSize", this._spritesTextureSize), n8.bind(s10, L.LINEAR, a5, Z), s10.setStencilTestEnabled(true), s10.setStencilFunction(I.GREATER, 255, 255), s10.setStencilWriteMask(0), s10.drawElements(E.TRIANGLES, i4[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * i4[0]), r9.triangleCount += i4[1] / 3;
  1293. }
  1294. _drawText(i4, l8, p6, c10) {
  1295. const { context: d5, displayLevel: y2, drawPhase: _5, glyphMosaic: M6, painter: P3, pixelRatio: T3, spriteMosaic: U4, state: E5, styleLayerUID: x6, requestRender: v } = i4, I3 = l8.textMaterial, S2 = P3.vectorTilesMaterialManager;
  1296. let D5, V2 = false;
  1297. for (const e8 of p6)
  1298. if (e8.layerData.has(x6) && (D5 = e8.layerData.get(x6), D5.glyphPerPageElementsMap.size > 0)) {
  1299. V2 = true;
  1300. break;
  1301. }
  1302. if (!V2)
  1303. return;
  1304. const R3 = l8.getPaintProperty("text-opacity");
  1305. if (R3 && !R3.isDataDriven && R3.getValue(y2) === 0)
  1306. return;
  1307. const w5 = l8.getPaintProperty("text-color"), A4 = !w5 || w5.isDataDriven || w5.getValue(y2)[3] > 0, L3 = l8.getPaintProperty("text-halo-width"), O5 = l8.getPaintProperty("text-halo-color"), N4 = (!L3 || L3.isDataDriven || L3.getValue(y2) > 0) && (!O5 || O5.isDataDriven || O5.getValue(y2)[3] > 0);
  1308. if (!A4 && !N4)
  1309. return;
  1310. const b4 = 24 / 8;
  1311. let z = l8.getLayoutValue("text-rotation-alignment", y2);
  1312. z === l3.AUTO && (z = l8.getLayoutValue("symbol-placement", y2) === n3.POINT ? l3.VIEWPORT : l3.MAP);
  1313. const k = z === l3.MAP, j = l8.getLayoutValue("text-keep-upright", y2) && k, G4 = _5 === I2.HITTEST, W2 = 0.8 * b4 / T3;
  1314. this._glyphTextureSize || (this._glyphTextureSize = t5(M6.width / 4, M6.height / 4));
  1315. const C4 = l8.getPaintValue("text-translate", y2), F5 = l8.getPaintValue("text-translate-anchor", y2), B3 = this._sdfProgramOptions;
  1316. B3.id = G4;
  1317. const H2 = S2.getMaterialProgram(d5, I3, B3);
  1318. if (r(v) && !G4 && !H2.isCompiled)
  1319. return void v();
  1320. d5.useProgram(H2), H2.setUniformMatrix3fv("u_displayViewMat3", z === l3.MAP ? E5.displayViewMat3 : E5.displayMat3), H2.setUniformMatrix3fv("u_displayMat3", F5 === r5.VIEWPORT ? E5.displayMat3 : E5.displayViewMat3), H2.setUniform2fv("u_textTranslation", C4), H2.setUniform1f("u_depth", l8.z + h4), H2.setUniform2fv("u_mosaicSize", this._glyphTextureSize), H2.setUniform1f("u_mapRotation", M4(E5.rotation)), H2.setUniform1f("u_keepUpright", j ? 1 : 0), H2.setUniform1f("u_level", 10 * y2), H2.setUniform1i("u_texture", $), H2.setUniform1f("u_antialiasingWidth", W2), H2.setUniform1f("u_fadeDuration", e / 1e3), G4 && H2.setUniform4fv("u_id", c10);
  1321. let Y2 = -1;
  1322. for (const e8 of p6) {
  1323. if (!e8.layerData.has(x6))
  1324. continue;
  1325. if (e8.key.level !== Y2 && (Y2 = e8.key.level, I3.setDataUniforms(H2, y2, l8, Y2, U4)), D5 = e8.layerData.get(x6), D5.glyphPerPageElementsMap.size === 0)
  1326. continue;
  1327. D5.prepareForRendering(d5), D5.updateOpacityInfo();
  1328. const i5 = D5.textVertexArrayObject;
  1329. if (t(i5))
  1330. continue;
  1331. d5.bindVAO(i5), H2.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), d5.setStencilTestEnabled(true), d5.setStencilFunction(I.GREATER, 255, 255), d5.setStencilWriteMask(0);
  1332. const a5 = (performance.now() - D5.lastOpacityUpdate) / 1e3;
  1333. H2.setUniform1f("u_time", a5), D5.glyphPerPageElementsMap.forEach((t9, i6) => {
  1334. this._renderGlyphRange(d5, t9, i6, M6, H2, N4, A4, e8);
  1335. });
  1336. }
  1337. }
  1338. _renderGlyphRange(e8, t9, i4, a5, r9, s10, n8, o7) {
  1339. a5.bind(e8, L.LINEAR, i4, $), s10 && (r9.setUniform1f("u_halo", 1), e8.drawElements(E.TRIANGLES, t9[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * t9[0]), o7.triangleCount += t9[1] / 3), n8 && (r9.setUniform1f("u_halo", 0), e8.drawElements(E.TRIANGLES, t9[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * t9[0]), o7.triangleCount += t9[1] / 3);
  1340. }
  1341. };
  1342. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js
  1343. var m7 = (e8) => ge(e8.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 3, name: "a_haloColor", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 4, name: "a_texAndSize", count: 4, type: C.UNSIGNED_BYTE }, { location: 5, name: "a_refSymbolAndPlacementOffset", count: 4, type: C.UNSIGNED_BYTE }, { location: 6, name: "a_glyphData", count: 4, type: C.UNSIGNED_BYTE }, { location: 7, name: "a_vertexOffset", count: 2, type: C.SHORT }, { location: 8, name: "a_texCoords", count: 2, type: C.UNSIGNED_SHORT }] });
  1344. var l6 = class extends p3 {
  1345. dispose() {
  1346. }
  1347. getGeometryType() {
  1348. return E3.LABEL;
  1349. }
  1350. supportsSymbology(e8) {
  1351. return true;
  1352. }
  1353. drawGeometry(t9, o7, a5, l8) {
  1354. const { context: u7, painter: p6, state: c10, rendererInfo: d5, passOptions: f5, requestRender: y2 } = t9, _5 = Z2.load(a5.materialKey), E5 = r(f5) && f5.type === "hittest", N4 = _5.mapAligned ? 1 : 0;
  1355. if (!N4 && Math.abs(o7.key.level - Math.round(100 * t9.displayLevel) / 100) >= 1)
  1356. return;
  1357. const { bufferLayouts: S2, attributes: U4 } = m7(_5), T3 = p6.materialManager.getMaterialProgram(t9, _5, "materials/label", U4, l8);
  1358. if (r(y2) && !E5 && !T3.isCompiled)
  1359. return void y2();
  1360. t9.context.setStencilFunction(I.EQUAL, 0, 255), u7.useProgram(T3), this._setSharedUniforms(T3, t9, o7), p6.textureManager.bindTextures(u7, T3, _5);
  1361. const g3 = N4 === 1 ? c10.displayViewMat3 : c10.displayMat3;
  1362. this._setSizeVVUniforms(_5, T3, d5, o7), T3.setUniform1f("u_mapRotation", Math.floor(c10.rotation / 360 * 254)), T3.setUniform1f("u_mapAligned", N4), T3.setUniformMatrix3fv("u_displayMat3", g3), T3.setUniform1f("u_opacity", 1), T3.setUniform2fv("u_screenSize", t9.state.size), T3.setUniform1f("u_isHalo", 1);
  1363. const G4 = a5.target.getVAO(u7, S2, U4), I3 = a5.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  1364. u7.bindVAO(G4), u7.drawElements(E.TRIANGLES, a5.indexCount, C.UNSIGNED_INT, I3), T3.setUniform1f("u_isHalo", 0), u7.drawElements(E.TRIANGLES, a5.indexCount, C.UNSIGNED_INT, I3), u7.setStencilTestEnabled(true), u7.setBlendingEnabled(true);
  1365. }
  1366. };
  1367. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js
  1368. var s8 = (e8) => ge(e8.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 3, name: "a_offsetAndNormal", count: 4, type: C.BYTE }, { location: 4, name: "a_accumulatedDistanceAndHalfWidth", count: 2, type: C.UNSIGNED_SHORT }, { location: 5, name: "a_tlbr", count: 4, type: C.UNSIGNED_SHORT }, { location: 6, name: "a_segmentDirection", count: 4, type: C.BYTE }, { location: 7, name: "a_aux", count: 2, type: C.UNSIGNED_SHORT }, { location: 8, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }] });
  1369. var m8 = class extends p3 {
  1370. dispose() {
  1371. }
  1372. getGeometryType() {
  1373. return E3.LINE;
  1374. }
  1375. supportsSymbology(e8) {
  1376. return true;
  1377. }
  1378. drawGeometry(t9, o7, a5, m11) {
  1379. const { context: l8, painter: c10, rendererInfo: u7, displayLevel: p6, passOptions: y2, requestRender: d5 } = t9, _5 = C3.load(a5.materialKey), f5 = r(y2) && y2.type === "hittest";
  1380. let E5 = s8(_5), N4 = E.TRIANGLES;
  1381. f5 && (E5 = this._getTriangleDesc(a5.materialKey, E5), N4 = E.POINTS);
  1382. const { attributes: g3, bufferLayouts: S2 } = E5, T3 = c10.materialManager.getMaterialProgram(t9, _5, "materials/line", g3, m11);
  1383. if (r(d5) && !f5 && !T3.isCompiled)
  1384. return void d5();
  1385. const U4 = 1 / t9.pixelRatio, G4 = 0;
  1386. l8.useProgram(T3), this._setSharedUniforms(T3, t9, o7), _5.textureBinding && c10.textureManager.bindTextures(l8, T3, _5);
  1387. const I3 = 2 ** (p6 - o7.key.level);
  1388. T3.setUniform1f("u_zoomFactor", I3), T3.setUniform1f("u_blur", G4 + U4), T3.setUniform1f("u_antialiasing", U4), this._setSizeVVUniforms(_5, T3, u7, o7), this._setColorAndOpacityVVUniforms(_5, T3, u7), l8.setFaceCullingEnabled(false);
  1389. const b4 = a5.target.getVAO(l8, S2, g3, f5);
  1390. let x6 = a5.indexCount, D5 = a5.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  1391. f5 && (x6 /= 3, D5 /= 3), l8.bindVAO(b4), l8.drawElements(N4, x6, C.UNSIGNED_INT, D5);
  1392. }
  1393. };
  1394. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js
  1395. var s9 = (t9) => ge(t9.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 3, name: "a_haloColor", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 4, name: "a_texFontSize", count: 4, type: C.UNSIGNED_BYTE }, { location: 5, name: "a_aux", count: 4, type: C.BYTE }, { location: 6, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }, { location: 7, name: "a_vertexOffset", count: 2, type: C.SHORT }, { location: 8, name: "a_texCoords", count: 2, type: C.UNSIGNED_SHORT }] });
  1396. var m9 = class extends p3 {
  1397. dispose() {
  1398. }
  1399. getGeometryType() {
  1400. return E3.TEXT;
  1401. }
  1402. supportsSymbology(t9) {
  1403. return true;
  1404. }
  1405. drawGeometry(e8, o7, a5, m11) {
  1406. const { context: l8, painter: p6, rendererInfo: u7, state: y2, passOptions: d5, requestRender: _5 } = e8, c10 = P2.load(a5.materialKey), f5 = r(d5) && d5.type === "hittest", { bufferLayouts: E5, attributes: N4 } = s9(c10), S2 = p6.materialManager.getMaterialProgram(e8, c10, "materials/text", N4, m11);
  1407. if (r(_5) && !f5 && !S2.isCompiled)
  1408. return void _5();
  1409. l8.useProgram(S2);
  1410. let T3 = E.TRIANGLES;
  1411. f5 && (T3 = E.POINTS), this._setSharedUniforms(S2, e8, o7), p6.textureManager.bindTextures(l8, S2, c10), S2.setUniformMatrix3fv("u_displayMat3", y2.displayMat3), S2.setUniformMatrix3fv("u_displayViewMat3", y2.displayViewMat3), this._setSizeVVUniforms(c10, S2, u7, o7), this._setColorAndOpacityVVUniforms(c10, S2, u7), this._setRotationVVUniforms(c10, S2, u7), S2.setUniform1f("u_isHalo", 1);
  1412. const U4 = a5.target.getVAO(l8, E5, N4), x6 = a5.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  1413. l8.bindVAO(U4), l8.drawElements(E.TRIANGLES, a5.indexCount, C.UNSIGNED_INT, x6), S2.setUniform1f("u_isHalo", 0), l8.drawElements(T3, a5.indexCount, C.UNSIGNED_INT, x6);
  1414. }
  1415. };
  1416. // node_modules/@arcgis/core/views/2d/engine/brushes.js
  1417. var W = { marker: d3, line: m8, fill: c7, text: m9, label: l6, clip: f4, stencil: h3, bitmap: m4, overlay: m5, raster: m2, rasterVF: m3, flow: i2, tileInfo: x4, vtlBackground: d4, vtlFill: m6, vtlLine: u6, vtlCircle: c8, vtlSymbol: M5, dotDensity: O4, heatmap: b2, pieChart: s7 };
  1418. // node_modules/@arcgis/core/views/2d/engine/webgl/Mesh2D.js
  1419. var x5 = s2.getLogger("esri.views.2d.engine.webgl.Mesh2D");
  1420. var g2 = (t9) => {
  1421. switch (t9.BYTES_PER_ELEMENT) {
  1422. case 1:
  1423. return C.UNSIGNED_BYTE;
  1424. case 2:
  1425. return C.UNSIGNED_SHORT;
  1426. case 4:
  1427. return C.UNSIGNED_INT;
  1428. default:
  1429. throw new s3("Cannot get DataType of array");
  1430. }
  1431. };
  1432. var p4 = (e8, t9, r9, o7) => {
  1433. let s10 = 0;
  1434. for (let n8 = 1; n8 < r9; n8++) {
  1435. const r10 = e8[2 * (t9 + n8 - 1)], o8 = e8[2 * (t9 + n8 - 1) + 1];
  1436. s10 += (e8[2 * (t9 + n8)] - r10) * (e8[2 * (t9 + n8) + 1] + o8);
  1437. }
  1438. return o7 ? s10 > 0 : s10 < 0;
  1439. };
  1440. var l7 = ({ coords: e8, lengths: t9 }, r9) => {
  1441. const s10 = [];
  1442. for (let n8 = 0, i4 = 0; n8 < t9.length; i4 += t9[n8], n8 += 1) {
  1443. const c10 = i4, a5 = [];
  1444. for (; n8 < t9.length - 1 && p4(e8, i4 + t9[n8], t9[n8 + 1], r9); n8 += 1, i4 += t9[n8])
  1445. a5.push(i4 + t9[n8] - c10);
  1446. const f5 = e8.slice(2 * c10, 2 * (i4 + t9[n8])), h5 = x(f5, a5, 2);
  1447. for (const e9 of h5)
  1448. s10.push(e9 + c10);
  1449. }
  1450. return s10;
  1451. };
  1452. var w4 = class {
  1453. constructor(e8, t9, r9, o7 = false) {
  1454. this._cache = {}, this.vertices = e8, this.indices = t9, this.primitiveType = r9, this.isMapSpace = o7;
  1455. }
  1456. static fromRect({ x: e8, y: t9, width: r9, height: o7 }) {
  1457. const s10 = e8, n8 = t9, i4 = s10 + r9, c10 = n8 + o7;
  1458. return w4.fromScreenExtent({ xmin: s10, ymin: n8, xmax: i4, ymax: c10 });
  1459. }
  1460. static fromPath(e8) {
  1461. const t9 = H(new t3(), e8.path, false, false), r9 = t9.coords, o7 = new Uint32Array(l7(t9, true)), s10 = new Uint32Array(r9.length / 2);
  1462. for (let n8 = 0; n8 < s10.length; n8++)
  1463. s10[n8] = w(Math.floor(r9[2 * n8]), Math.floor(r9[2 * n8 + 1]));
  1464. return new w4({ geometry: s10 }, o7, E.TRIANGLES);
  1465. }
  1466. static fromGeometry(t9, r9) {
  1467. const o7 = r9.geometry.type;
  1468. switch (o7) {
  1469. case "polygon":
  1470. return w4.fromPolygon(t9, r9.geometry);
  1471. case "extent":
  1472. return w4.fromMapExtent(t9, r9.geometry);
  1473. default:
  1474. return x5.error(new s3("mapview-bad-type", `Unable to create a mesh from type ${o7}`, r9)), w4.fromRect({ x: 0, y: 0, width: 1, height: 1 });
  1475. }
  1476. }
  1477. static fromPolygon(e8, t9) {
  1478. const r9 = D(new t3(), t9, false, false), o7 = r9.coords, i4 = new Uint32Array(l7(r9, false)), h5 = new Uint32Array(o7.length / 2), u7 = n2(), y2 = n2();
  1479. for (let n8 = 0; n8 < h5.length; n8++)
  1480. r2(u7, o7[2 * n8], o7[2 * n8 + 1]), e8.toScreen(y2, u7), h5[n8] = w(Math.floor(y2[0]), Math.floor(y2[1]));
  1481. return new w4({ geometry: h5 }, i4, E.TRIANGLES, true);
  1482. }
  1483. static fromScreenExtent({ xmin: e8, xmax: t9, ymin: r9, ymax: o7 }) {
  1484. const s10 = { geometry: new Uint32Array([w(e8, r9), w(t9, r9), w(e8, o7), w(e8, o7), w(t9, r9), w(t9, o7)]) }, n8 = new Uint32Array([0, 1, 2, 3, 4, 5]);
  1485. return new w4(s10, n8, E.TRIANGLES);
  1486. }
  1487. static fromMapExtent(e8, t9) {
  1488. const [r9, o7] = e8.toScreen([0, 0], [t9.xmin, t9.ymin]), [s10, n8] = e8.toScreen([0, 0], [t9.xmax, t9.ymax]), i4 = { geometry: new Uint32Array([w(r9, o7), w(s10, o7), w(r9, n8), w(r9, n8), w(s10, o7), w(s10, n8)]) }, c10 = new Uint32Array([0, 1, 2, 3, 4, 5]);
  1489. return new w4(i4, c10, E.TRIANGLES);
  1490. }
  1491. destroy() {
  1492. r(this._cache.indexBuffer) && this._cache.indexBuffer.dispose();
  1493. for (const e8 in this._cache.vertexBuffers)
  1494. r(this._cache.vertexBuffers[e8]) && this._cache.vertexBuffers[e8].dispose();
  1495. }
  1496. get elementType() {
  1497. return g2(this.indices);
  1498. }
  1499. getIndexBuffer(e8, t9 = F.STATIC_DRAW) {
  1500. return this._cache.indexBuffer || (this._cache.indexBuffer = c3.createIndex(e8, t9, this.indices)), this._cache.indexBuffer;
  1501. }
  1502. getVertexBuffers(e8, t9 = F.STATIC_DRAW) {
  1503. return this._cache.vertexBuffers || (this._cache.vertexBuffers = Object.keys(this.vertices).reduce((r9, o7) => ({ ...r9, [o7]: c3.createVertex(e8, t9, this.vertices[o7]) }), {})), this._cache.vertexBuffers;
  1504. }
  1505. };
  1506. // node_modules/@arcgis/core/views/2d/engine/webgl/ClippingInfo.js
  1507. var n7 = s2.getLogger("esri.views.2d.engine.webgl.ClippingInfo");
  1508. var m10 = (t9) => parseFloat(t9) / 100;
  1509. var p5 = class extends a {
  1510. constructor(t9, e8) {
  1511. super(), this._clip = e8, this._cache = {}, this.stage = t9, this._handle = l(() => e8.version, () => this._invalidate()), this.ready();
  1512. }
  1513. static fromClipArea(t9, e8) {
  1514. return new p5(t9, e8);
  1515. }
  1516. _destroyGL() {
  1517. r(this._cache.mesh) && (this._cache.mesh.destroy(), this._cache.mesh = null), r(this._cache.vao) && (this._cache.vao.dispose(), this._cache.vao = null);
  1518. }
  1519. destroy() {
  1520. this._destroyGL(), this._handle.remove();
  1521. }
  1522. getVAO(t9, e8, r9, i4) {
  1523. const [o7, h5] = e8.size;
  1524. if (this._clip.type !== "geometry" && this._lastWidth === o7 && this._lastHeight === h5 || (this._lastWidth = o7, this._lastHeight = h5, this._destroyGL()), t(this._cache.vao)) {
  1525. const s10 = this._createMesh(e8, this._clip), o8 = s10.getIndexBuffer(t9), h6 = s10.getVertexBuffers(t9);
  1526. this._cache.mesh = s10, this._cache.vao = new f2(t9, r9, i4, h6, o8);
  1527. }
  1528. return this._cache.vao;
  1529. }
  1530. _createTransforms() {
  1531. return { dvs: e4() };
  1532. }
  1533. _invalidate() {
  1534. this._destroyGL(), this.requestRender();
  1535. }
  1536. _createScreenRect(t9, e8) {
  1537. const [r9, s10] = t9.size, i4 = typeof e8.left == "string" ? m10(e8.left) * r9 : e8.left, o7 = typeof e8.right == "string" ? m10(e8.right) * r9 : e8.right, h5 = typeof e8.top == "string" ? m10(e8.top) * s10 : e8.top, a5 = typeof e8.bottom == "string" ? m10(e8.bottom) * s10 : e8.bottom, c10 = i4, n8 = h5;
  1538. return { x: c10, y: n8, width: Math.max(r9 - o7 - c10, 0), height: Math.max(s10 - a5 - n8, 0) };
  1539. }
  1540. _createMesh(e8, r9) {
  1541. switch (r9.type) {
  1542. case "rect":
  1543. return w4.fromRect(this._createScreenRect(e8, r9));
  1544. case "path":
  1545. return w4.fromPath(r9);
  1546. case "geometry":
  1547. return w4.fromGeometry(e8, r9);
  1548. default:
  1549. return n7.error(new s3("mapview-bad-type", "Unable to create ClippingInfo mesh from clip of type: ${clip.type}")), w4.fromRect({ x: 0, y: 0, width: 1, height: 1 });
  1550. }
  1551. }
  1552. };
  1553. // node_modules/@arcgis/core/views/2d/engine/webgl/WGLContainer.js
  1554. var a4 = class extends s4 {
  1555. constructor() {
  1556. super(...arguments), this.name = this.constructor.name;
  1557. }
  1558. set clips(e8) {
  1559. this._clips = e8, this.children.forEach((r9) => r9.clips = e8), this._updateClippingInfo();
  1560. }
  1561. _createTransforms() {
  1562. return { dvs: e4() };
  1563. }
  1564. doRender(e8) {
  1565. const r9 = this.createRenderParams(e8), { painter: s10, globalOpacity: t9, profiler: i4, drawPhase: n8 } = r9, a5 = n8 === I2.LABEL || n8 === I2.HIGHLIGHT ? 1 : t9 * this.computedOpacity;
  1566. i4.recordContainerStart(this.name), s10.beforeRenderLayer(r9, this._clippingInfos ? 255 : 0, a5), this.updateTransforms(e8.state), this.renderChildren(r9), s10.compositeLayer(r9, a5), i4.recordContainerEnd();
  1567. }
  1568. renderChildren(r9) {
  1569. t(this._renderPasses) && (this._renderPasses = this.prepareRenderPasses(r9.painter));
  1570. for (const e8 of this.children)
  1571. e8.beforeRender(r9);
  1572. for (const e8 of this._renderPasses)
  1573. try {
  1574. e8.render(r9);
  1575. } catch (s10) {
  1576. }
  1577. for (const e8 of this.children)
  1578. e8.afterRender(r9);
  1579. }
  1580. createRenderParams(e8) {
  1581. return e8.requireFBO = this.requiresDedicatedFBO, e8;
  1582. }
  1583. prepareRenderPasses(e8) {
  1584. return [e8.registerRenderPass({ name: "clip", brushes: [W.clip], target: () => this._clippingInfos, drawPhase: I2.MAP | I2.LABEL | I2.LABEL_ALPHA | I2.DEBUG | I2.HIGHLIGHT })];
  1585. }
  1586. updateTransforms(e8) {
  1587. for (const r9 of this.children)
  1588. r9.setTransform(e8);
  1589. }
  1590. onAttach() {
  1591. super.onAttach(), this._updateClippingInfo();
  1592. }
  1593. onDetach() {
  1594. super.onDetach(), this._updateClippingInfo();
  1595. }
  1596. _updateClippingInfo() {
  1597. if (r(this._clippingInfos) && (this._clippingInfos.forEach((e9) => e9.destroy()), this._clippingInfos = null), !this.stage)
  1598. return;
  1599. const e8 = this._clips;
  1600. r(e8) && e8.length && (this._clippingInfos = e8.items.map((e9) => p5.fromClipArea(this.stage, e9))), this.requestRender();
  1601. }
  1602. };
  1603. export {
  1604. i2 as i,
  1605. p2 as p,
  1606. n4 as n,
  1607. m3 as m,
  1608. n6 as n2,
  1609. t6 as t,
  1610. m as m2,
  1611. x4 as x,
  1612. h3 as h,
  1613. W,
  1614. a4 as a
  1615. };
  1616. //# sourceMappingURL=chunk-H3QCF24A.js.map