123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- import {
- d as d2,
- e as e4,
- f as f2,
- f2 as f3,
- i as i2,
- m as m2,
- n as n2,
- n2 as n3,
- n3 as n4,
- o as o3,
- o2 as o4,
- o3 as o5,
- o4 as o6,
- r as r6,
- r2 as r7,
- t as t4
- } from "./chunk-ORLXOWB6.js";
- import {
- g as g2,
- p
- } from "./chunk-SFI4OJO6.js";
- import {
- c as c2,
- m
- } from "./chunk-UE4KC4K5.js";
- import "./chunk-X6GHUY4U.js";
- import {
- D,
- E as E2
- } from "./chunk-3OFVLRSL.js";
- import {
- _
- } from "./chunk-BXBBOCLV.js";
- import {
- e2 as e3,
- f,
- n,
- o as o2,
- r as r5,
- t as t2,
- t2 as t3
- } from "./chunk-IRQMHCT3.js";
- import "./chunk-W3XAGTM6.js";
- import "./chunk-44FMXGSC.js";
- import "./chunk-XFDO4CMR.js";
- import {
- e as e2
- } from "./chunk-GHN7C53L.js";
- import {
- E,
- L,
- O,
- T,
- c,
- i,
- u,
- x
- } from "./chunk-HIELTLML.js";
- import "./chunk-6FXLJAMI.js";
- import {
- g
- } from "./chunk-O3JQY77G.js";
- import "./chunk-E3G7BRZB.js";
- import "./chunk-P24XEEHY.js";
- import "./chunk-SAJAEMIJ.js";
- import "./chunk-GGGVIS2U.js";
- import {
- r as r4
- } from "./chunk-C7742RNZ.js";
- import "./chunk-4ONPMX2F.js";
- import "./chunk-VGWC3IKZ.js";
- import "./chunk-2H5MD622.js";
- import "./chunk-3RSFVUKZ.js";
- import "./chunk-O6VYMEIX.js";
- import {
- l
- } from "./chunk-X4SA4ELJ.js";
- import "./chunk-2ZSOO377.js";
- import "./chunk-ZLNEXZAN.js";
- import "./chunk-ZYRIJWLX.js";
- import {
- d
- } from "./chunk-RYY6632W.js";
- import "./chunk-DW42UVIT.js";
- import "./chunk-YAEIHDJH.js";
- import {
- r as r3
- } from "./chunk-TJNOJH33.js";
- import "./chunk-OSHI574D.js";
- import "./chunk-VCH45Q2I.js";
- import "./chunk-GSSTTHIT.js";
- import "./chunk-HZRKBTHJ.js";
- import {
- U
- } from "./chunk-DVUG3KID.js";
- import "./chunk-FWSQEIAR.js";
- import "./chunk-VEGAOVMY.js";
- import "./chunk-6T6G6LCQ.js";
- import "./chunk-YEJL5NEF.js";
- import "./chunk-PQFTYGF5.js";
- import "./chunk-2Z2TG5CU.js";
- import "./chunk-6KZ2LTDA.js";
- import "./chunk-U2XHEJM7.js";
- import {
- r as r2
- } from "./chunk-SQOPWYIT.js";
- import "./chunk-V6P2MAQQ.js";
- import "./chunk-E5O6P5I2.js";
- import "./chunk-SPWQ3AWG.js";
- import "./chunk-2TIUKVZN.js";
- import {
- e,
- o,
- r,
- t
- } from "./chunk-YXWMMD76.js";
- import "./chunk-S5KM4IGW.js";
- // node_modules/@arcgis/core/geometry/support/meshUtils/loadGLTFMesh.js
- async function W(e5, t5, r8) {
- const o7 = new n4(X(r8)), s = (await m2(o7, t5, r8, true)).model, i3 = s.lods.shift(), a = /* @__PURE__ */ new Map(), c3 = /* @__PURE__ */ new Map();
- s.textures.forEach((e6, t6) => a.set(t6, te(e6))), s.materials.forEach((e6, t6) => c3.set(t6, re(e6, a)));
- const u2 = ee(i3);
- for (const n5 of u2.parts)
- oe(u2, n5, c3);
- const { position: l2, normal: f4, tangent: m3, color: p2, texCoord0: d3 } = u2.vertexAttributes, x2 = { position: l2.typedBuffer, normal: r(f4) ? f4.typedBuffer : null, tangent: r(m3) ? m3.typedBuffer : null, uv: r(d3) ? d3.typedBuffer : null, color: r(p2) ? p2.typedBuffer : null }, T2 = _(x2, e5, r8);
- return { transform: T2.transform, components: u2.components, spatialReference: e5.spatialReference, vertexAttributes: new p({ position: T2.vertexAttributes.position, normal: T2.vertexAttributes.normal, tangent: T2.vertexAttributes.tangent, color: x2.color, uv: x2.uv }) };
- }
- function X(e5) {
- const r8 = e5 == null ? void 0 : e5.resolveFile;
- return r8 ? { busy: false, request: async (e6, o7, s) => {
- const i3 = r8(e6), a = "image" === o7 ? "image" : "binary" === o7 ? "array-buffer" : "json";
- return (await U(i3, { responseType: a, signal: r(s) ? s.signal : null })).data;
- } } : null;
- }
- function Y(e5, t5) {
- if (t(e5))
- return "-";
- const o7 = e5.typedBuffer;
- return `${r2(t5, o7.buffer, () => t5.size)}/${o7.byteOffset}/${o7.byteLength}`;
- }
- function Z(e5) {
- return r(e5) ? e5.toString() : "-";
- }
- function ee(e5) {
- let t5 = 0;
- const has = { color: false, tangent: false, normal: false, texCoord0: false }, o7 = /* @__PURE__ */ new Map(), n5 = /* @__PURE__ */ new Map(), s = [];
- for (const i3 of e5.parts) {
- const { attributes: { position: e6, normal: a, color: c3, tangent: u2, texCoord0: l2 } } = i3, f4 = `
- ${Y(e6, o7)}/
- ${Y(a, o7)}/
- ${Y(c3, o7)}/
- ${Y(u2, o7)}/
- ${Y(l2, o7)}/
- ${Z(i3.transform)}
- `;
- let m3 = false;
- const p2 = r2(n5, f4, () => (m3 = true, { start: t5, length: e6.count }));
- m3 && (t5 += e6.count), a && (has.normal = true), c3 && (has.color = true), u2 && (has.tangent = true), l2 && (has.texCoord0 = true), s.push({ gltf: i3, writeVertices: m3, region: p2 });
- }
- return { vertexAttributes: { position: r7(T, t5), normal: has.normal ? r7(i, t5) : null, tangent: has.tangent ? r7(c, t5) : null, color: has.color ? r7(x, t5) : null, texCoord0: has.texCoord0 ? r7(u, t5) : null }, parts: s, components: [] };
- }
- function te(e5) {
- return new m({ data: e5.data, wrap: ae(e5.parameters.wrap) });
- }
- function re(t5, r8) {
- const o7 = new l(le(t5.color, t5.opacity)), n5 = t5.emissiveFactor ? new l(fe(t5.emissiveFactor)) : null;
- return new c2({ color: o7, colorTexture: e(o(t5.textureColor, (e5) => r8.get(e5))), normalTexture: e(o(t5.textureNormal, (e5) => r8.get(e5))), emissiveColor: n5, emissiveTexture: e(o(t5.textureEmissive, (e5) => r8.get(e5))), occlusionTexture: e(o(t5.textureOcclusion, (e5) => r8.get(e5))), alphaMode: ie(t5.alphaMode), alphaCutoff: t5.alphaCutoff, doubleSided: t5.doubleSided, metallic: t5.metallicFactor, roughness: t5.roughnessFactor, metallicRoughnessTexture: e(o(t5.textureMetallicRoughness, (e5) => r8.get(e5))), colorTextureTransform: t5.colorTextureTransform, normalTextureTransform: t5.normalTextureTransform, occlusionTextureTransform: t5.occlusionTextureTransform, emissiveTextureTransform: t5.emissiveTextureTransform, metallicRoughnessTextureTransform: t5.metallicRoughnessTextureTransform });
- }
- function oe(e5, t5, r8) {
- t5.writeVertices && ne(e5, t5);
- const o7 = t5.gltf, n5 = se(o7.indices || o7.attributes.position.count, o7.primitiveType), s = t5.region.start;
- if (s)
- for (let i3 = 0; i3 < n5.length; i3++)
- n5[i3] += s;
- e5.components.push(new g2({ faces: n5, material: r8.get(o7.material), trustSourceNormals: true }));
- }
- function ne(e5, t5) {
- const { position: r8, normal: s, tangent: i3, color: a, texCoord0: l2 } = e5.vertexAttributes, f4 = t5.region.start, { attributes: m3, transform: p2 } = t5.gltf, d3 = m3.position.count;
- if (t2(r8.slice(f4, d3), m3.position, p2), r(m3.normal) && r(s)) {
- const e6 = g(e2(), p2), t6 = s.slice(f4, d3);
- r5(t6, m3.normal, e6), d(e6) && o2(t6, t6);
- } else
- r(s) && t3(s, 0, 0, 1, { dstIndex: f4, count: d3 });
- if (r(m3.tangent) && r(i3)) {
- const e6 = g(e2(), p2), t6 = i3.slice(f4, d3);
- r6(t6, m3.tangent, e6), d(e6) && f2(t6, t6);
- } else
- r(i3) && t4(i3, 0, 0, 1, 1, { dstIndex: f4, count: d3 });
- if (r(m3.texCoord0) && r(l2) ? n3(l2.slice(f4, d3), m3.texCoord0) : r(l2) && d2(l2, 0, 0, { dstIndex: f4, count: d3 }), r(m3.color) && r(a)) {
- const e6 = m3.color, t6 = a.slice(f4, d3);
- if (4 === e6.elementCount)
- e6 instanceof c ? o3(t6, e6, 255) : e6 instanceof x ? e4(t6, e6) : e6 instanceof L && n2(t6, e6, 8);
- else {
- t4(t6, 255, 255, 255, 255);
- const r9 = O.fromTypedArray(t6.typedBuffer, t6.typedBufferStride);
- e6 instanceof i ? f(r9, e6, 255) : e6 instanceof O ? e3(r9, e6) : e6 instanceof E && n(r9, e6, 8);
- }
- } else
- r(a) && t4(a.slice(f4, d3), 255, 255, 255, 255);
- }
- function se(e5, t5) {
- switch (t5) {
- case E2.TRIANGLES:
- return o5(e5, o4);
- case E2.TRIANGLE_STRIP:
- return f3(e5);
- case E2.TRIANGLE_FAN:
- return i2(e5);
- }
- }
- function ie(e5) {
- switch (e5) {
- case "OPAQUE":
- return "opaque";
- case "MASK":
- return "mask";
- case "BLEND":
- return "blend";
- }
- }
- function ae(e5) {
- return { horizontal: ce(e5.s), vertical: ce(e5.t) };
- }
- function ce(e5) {
- switch (e5) {
- case D.CLAMP_TO_EDGE:
- return "clamp";
- case D.MIRRORED_REPEAT:
- return "mirror";
- case D.REPEAT:
- return "repeat";
- }
- }
- function ue(e5) {
- return e5 ** (1 / o6) * 255;
- }
- function le(e5, t5) {
- return r4(ue(e5[0]), ue(e5[1]), ue(e5[2]), t5);
- }
- function fe(e5) {
- return r3(ue(e5[0]), ue(e5[1]), ue(e5[2]));
- }
- export {
- W as loadGLTFMesh
- };
- //# sourceMappingURL=loadGLTFMesh-WBYY2AJJ.js.map
|