import { O } from "./chunk-RUM3DXFX.js"; import { f, n } from "./chunk-K7B6OWCU.js"; import { r as r2 } from "./chunk-E3G7BRZB.js"; import { s2 as s, s3 as s2 } from "./chunk-E5O6P5I2.js"; import { r, t } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/interfaces.js var t2 = class { }; function n2(t4, ...n4) { let o4 = ""; for (let r4 = 0; r4 < n4.length; r4++) o4 += t4[r4] + n4[r4]; return o4 += t4[t4.length - 1], o4; } !function(t4) { function n4(t5) { return Math.round(t5).toString(); } function o4(t5) { return t5.toPrecision(8); } t4.int = n4, t4.float = o4; }(n2 || (n2 = {})); // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js function o(o4, t4 = true) { o4.attributes.add(O.POSITION, "vec2"), t4 && o4.varyings.add("uv", "vec2"), o4.vertex.code.add(n2` void main(void) { gl_Position = vec4(position, 0.0, 1.0); ${t4 ? n2`uv = position * 0.5 + vec2(0.5);` : ""} } `); } // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js var s3 = s.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder"); var i = class { constructor() { this._includedModules = /* @__PURE__ */ new Map(); } include(e3, r4) { if (this._includedModules.has(e3)) { const t4 = this._includedModules.get(e3); if (t4 !== r4) { s3.error("Trying to include shader module multiple times with different sets of options."); const r5 = /* @__PURE__ */ new Set(); for (const n4 of Object.keys(t4)) t4[n4] !== e3[n4] && r5.add(n4); for (const n4 of Object.keys(e3)) t4[n4] !== e3[n4] && r5.add(n4); r5.forEach((r6) => console.error(` ${r6}: current ${t4[r6]} new ${e3[r6]}`)); } } else this._includedModules.set(e3, r4), e3(this.builder, r4); } }; var o2 = class extends i { constructor() { super(...arguments), this.vertex = new u(), this.fragment = new u(), this.attributes = new m(), this.varyings = new h(), this.extensions = new d(), this.constants = new l(); } get fragmentUniforms() { return this.fragment.uniforms.entries; } get builder() { return this; } generate(e3) { const r4 = this.extensions.generateSource(e3), t4 = this.attributes.generateSource(e3), n4 = this.varyings.generateSource(), s4 = "vertex" === e3 ? this.vertex : this.fragment, i4 = s4.uniforms.generateSource(), o4 = s4.code.generateSource(), a6 = "vertex" === e3 ? f2 : _, c2 = this.constants.generateSource().concat(s4.constants.generateSource()); return ` ${r4.join("\n")} ${a6} ${c2.join("\n")} ${i4.join("\n")} ${t4.join("\n")} ${n4.join("\n")} ${o4.join("\n")}`; } generateBind(e3, r4) { const n4 = /* @__PURE__ */ new Map(); this.vertex.uniforms.entries.forEach((r5) => { const s5 = r5.bind[e3]; r(s5) && n4.set(r5.name, s5); }), this.fragment.uniforms.entries.forEach((r5) => { const s5 = r5.bind[e3]; r(s5) && n4.set(r5.name, s5); }); const s4 = Array.from(n4.values()), i4 = s4.length; return (e4, t4, n5) => { for (let o4 = 0; o4 < i4; ++o4) s4[o4](r4, e4, t4, n5); }; } }; var a = class { constructor() { this._entries = /* @__PURE__ */ new Map(); } add(e3) { if (!Array.isArray(e3)) return this._add(e3); for (const r4 of e3) this._add(r4); } get(e3) { return this._entries.get(e3); } _add(r4) { if (t(r4)) s3.error(`Trying to add null Uniform from ${new Error().stack}.`); else { if (this._entries.has(r4.name) && !this._entries.get(r4.name).equals(r4)) throw new s2(`Duplicate uniform name ${r4.name} for different uniform type`); this._entries.set(r4.name, r4); } } generateSource() { return Array.from(this._entries.values()).map((e3) => r(e3.arraySize) ? `uniform ${e3.type} ${e3.name}[${e3.arraySize}];` : `uniform ${e3.type} ${e3.name};`); } get entries() { return Array.from(this._entries.values()); } }; var c = class { constructor() { this._entries = new Array(); } add(e3) { this._entries.push(e3); } generateSource() { return this._entries; } }; var u = class extends i { constructor() { super(...arguments), this.uniforms = new a(), this.code = new c(), this.constants = new l(); } get builder() { return this; } }; var m = class { constructor() { this._entries = new Array(); } add(e3, r4) { this._entries.push([e3, r4]); } generateSource(e3) { return "fragment" === e3 ? [] : this._entries.map((e4) => `attribute ${e4[1]} ${e4[0]};`); } }; var h = class { constructor() { this._entries = new Array(); } add(e3, r4) { this._entries.push([e3, r4]); } generateSource() { return this._entries.map((e3) => `varying ${e3[1]} ${e3[0]};`); } }; var d = class { constructor() { this._entries = /* @__PURE__ */ new Set(); } add(e3) { this._entries.add(e3); } generateSource(e3) { const r4 = "vertex" === e3 ? d.ALLOWLIST_VERTEX : d.ALLOWLIST_FRAGMENT; return Array.from(this._entries).filter((e4) => r4.includes(e4)).map((e4) => `#extension ${e4} : enable`); } }; d.ALLOWLIST_FRAGMENT = ["GL_EXT_shader_texture_lod", "GL_OES_standard_derivatives"], d.ALLOWLIST_VERTEX = []; var l = class { constructor() { this._entries = /* @__PURE__ */ new Set(); } add(e3, r4, t4) { let n4 = "ERROR_CONSTRUCTOR_STRING"; switch (r4) { case "float": n4 = l._numberToFloatStr(t4); break; case "int": n4 = l._numberToIntStr(t4); break; case "bool": n4 = t4.toString(); break; case "vec2": n4 = `vec2(${l._numberToFloatStr(t4[0])}, ${l._numberToFloatStr(t4[1])})`; break; case "vec3": n4 = `vec3(${l._numberToFloatStr(t4[0])}, ${l._numberToFloatStr(t4[1])}, ${l._numberToFloatStr(t4[2])})`; break; case "vec4": n4 = `vec4(${l._numberToFloatStr(t4[0])}, ${l._numberToFloatStr(t4[1])}, ${l._numberToFloatStr(t4[2])}, ${l._numberToFloatStr(t4[3])})`; break; case "ivec2": n4 = `ivec2(${l._numberToIntStr(t4[0])}, ${l._numberToIntStr(t4[1])})`; break; case "ivec3": n4 = `ivec3(${l._numberToIntStr(t4[0])}, ${l._numberToIntStr(t4[1])}, ${l._numberToIntStr(t4[2])})`; break; case "ivec4": n4 = `ivec4(${l._numberToIntStr(t4[0])}, ${l._numberToIntStr(t4[1])}, ${l._numberToIntStr(t4[2])}, ${l._numberToIntStr(t4[3])})`; break; case "mat2": case "mat3": case "mat4": n4 = `${r4}(${Array.prototype.map.call(t4, (e4) => l._numberToFloatStr(e4)).join(", ")})`; } return this._entries.add(`const ${r4} ${e3} = ${n4};`), this; } static _numberToIntStr(e3) { return e3.toFixed(0); } static _numberToFloatStr(e3) { return Number.isInteger(e3) ? e3.toFixed(1) : e3.toString(); } generateSource() { return Array.from(this._entries); } }; var _ = "#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp sampler2D;\n#else\n precision mediump float;\n precision mediump sampler2D;\n#endif"; var f2 = "precision highp float;\nprecision highp sampler2D;"; // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderTechnique/BindType.js var a2; !function(a6) { a6[a6.Pass = 0] = "Pass", a6[a6.Draw = 1] = "Draw"; }(a2 || (a2 = {})); // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Uniform.js var i2 = class { constructor(i4, s4, t4, a6, n4 = null) { this.name = i4, this.type = s4, this.arraySize = n4, this.bind = { [a2.Pass]: null, [a2.Draw]: null }, r(t4) && r(a6) && (this.bind[t4] = a6); } equals(e3) { return this.type === e3.type && this.name === e3.name && this.arraySize === e3.arraySize; } }; // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js var e = class extends i2 { constructor(r4, e3) { super(r4, "vec2", a2.Pass, (s4, o4, t4) => s4.setUniform2fv(r4, e3(o4, t4))); } }; // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/util/WebGL2Utils.js var t3 = "Size"; var n3 = "InvSize"; function r3(r4, i4, o4 = false, u3 = 0) { if (r4.hasWebGL2Context) { const t4 = n2`vec2(textureSize(${i4}, ${n2.int(u3)}))`; return o4 ? "(1.0 / " + t4 + ")" : t4; } return o4 ? i4 + n3 : i4 + t3; } function i3(t4, r4, i4, o4 = null, u3 = 0) { if (t4.hasWebGL2Context) return n2`texelFetch(${r4}, ivec2(${i4}), ${n2.int(u3)})`; let $ = n2`texture2D(${r4}, ${i4} * `; return $ += o4 ? n2`(${o4}))` : n2`${r4 + n3})`, $; } // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/TextureSizeUniformType.js var e2; !function(e3) { e3[e3.None = 0] = "None", e3[e3.Size = 1] = "Size", e3[e3.InvSize = 2] = "InvSize"; }(e2 || (e2 = {})); // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js var f3 = class extends i2 { constructor(r4, s4) { super(r4, "sampler2D", a2.Pass, (e3, o4, t4) => e3.bindTexture(r4, s4(o4, t4))); } }; function u2(o4, c2, p = e2.None) { const u3 = [new f3(o4, c2)]; if (p & e2.Size) { const i4 = o4 + t3; u3.push(new e(i4, (o5, t4) => { const i5 = c2(o5, t4); return r(i5) ? r2(a3, i5.descriptor.width, i5.descriptor.height) : f; })); } if (p & e2.InvSize) { const t4 = o4 + n3; u3.push(new e(t4, (o5, t5) => { const i4 = c2(o5, t5); return r(i4) ? r2(a3, 1 / i4.descriptor.width, 1 / i4.descriptor.height) : f; })); } return u3; } var a3 = n(); // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js var o3 = class extends i2 { constructor(r4, o4) { super(r4, "float", a2.Pass, (s4, e3, t4) => s4.setUniform1f(r4, o4(e3, t4))); } }; // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js function a4(a6) { a6.code.add(n2`const float MAX_RGBA_FLOAT = 255.0 / 256.0 + 255.0 / 256.0 / 256.0 + 255.0 / 256.0 / 256.0 / 256.0 + 255.0 / 256.0 / 256.0 / 256.0 / 256.0; const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0); vec4 float2rgba(const float value) { float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT); vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0); const float toU8AsFloat = 1.0 / 255.0; return fixedPointU8 * toU8AsFloat; } const vec4 RGBA_2_FLOAT_FACTORS = vec4( 255.0 / (256.0), 255.0 / (256.0 * 256.0), 255.0 / (256.0 * 256.0 * 256.0), 255.0 / (256.0 * 256.0 * 256.0 * 256.0) ); float rgba2float(vec4 rgba) { return dot(rgba, RGBA_2_FLOAT_FACTORS); }`); } // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/output/ReadLinearDepth.glsl.js function a5(a6) { a6.include(a4), a6.code.add(n2`float linearDepthFromFloat(float depth, vec2 nearFar) { return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]); } float linearDepthFromTexture(sampler2D depthTex, vec2 uv, vec2 nearFar) { return linearDepthFromFloat(rgba2float(texture2D(depthTex, uv)), nearFar); }`); } export { t2 as t, n2 as n, o, a2 as a, i2 as i, o2, t3 as t2, n3 as n2, r3 as r, i3 as i2, e, e2, f3 as f, u2 as u, a4 as a2, o3, a5 as a3 }; //# sourceMappingURL=chunk-FQZKJNXZ.js.map