@graphty/graphty-element 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +9 -0
  2. package/dist/basisTextureLoader-BqIvxvNl.js +312 -0
  3. package/dist/basisTextureLoader-BqIvxvNl.js.map +1 -0
  4. package/dist/custom-elements.json +1 -0
  5. package/dist/dds-BlAaKjyJ.js +357 -0
  6. package/dist/dds-BlAaKjyJ.js.map +1 -0
  7. package/dist/ddsTextureLoader-D7Jh83wc.js +44 -0
  8. package/dist/ddsTextureLoader-D7Jh83wc.js.map +1 -0
  9. package/dist/default.fragment-BNc4beoN.js +452 -0
  10. package/dist/default.fragment-BNc4beoN.js.map +1 -0
  11. package/dist/default.fragment-CSeCDRwv.js +512 -0
  12. package/dist/default.fragment-CSeCDRwv.js.map +1 -0
  13. package/dist/default.vertex-9pBFrn06.js +202 -0
  14. package/dist/default.vertex-9pBFrn06.js.map +1 -0
  15. package/dist/default.vertex-DDjK1DRv.js +185 -0
  16. package/dist/default.vertex-DDjK1DRv.js.map +1 -0
  17. package/dist/defaultUboDeclaration-CG47IDRY.js +9 -0
  18. package/dist/defaultUboDeclaration-CG47IDRY.js.map +1 -0
  19. package/dist/defaultUboDeclaration-Ct5CiQ-w.js +11 -0
  20. package/dist/defaultUboDeclaration-Ct5CiQ-w.js.map +1 -0
  21. package/dist/dumpTools-DA1xMSIZ.js +103 -0
  22. package/dist/dumpTools-DA1xMSIZ.js.map +1 -0
  23. package/dist/envTextureLoader-DdCLpySN.js +238 -0
  24. package/dist/envTextureLoader-DdCLpySN.js.map +1 -0
  25. package/dist/exrTextureLoader-CnJSRQ9w.js +741 -0
  26. package/dist/exrTextureLoader-CnJSRQ9w.js.map +1 -0
  27. package/dist/graphty.js +12 -0
  28. package/dist/graphty.js.map +1 -0
  29. package/dist/graphty.umd.cjs +12657 -0
  30. package/dist/graphty.umd.cjs.map +1 -0
  31. package/dist/greasedLine.fragment-BZnGGe-r.js +30 -0
  32. package/dist/greasedLine.fragment-BZnGGe-r.js.map +1 -0
  33. package/dist/greasedLine.fragment-DixuqXus.js +12 -0
  34. package/dist/greasedLine.fragment-DixuqXus.js.map +1 -0
  35. package/dist/greasedLine.vertex-BhhwFKPy.js +33 -0
  36. package/dist/greasedLine.vertex-BhhwFKPy.js.map +1 -0
  37. package/dist/greasedLine.vertex-DIhgGSOi.js +49 -0
  38. package/dist/greasedLine.vertex-DIhgGSOi.js.map +1 -0
  39. package/dist/harmonicsFunctions-B9jTNKTF.js +197 -0
  40. package/dist/harmonicsFunctions-B9jTNKTF.js.map +1 -0
  41. package/dist/harmonicsFunctions-D9ZL5yLA.js +194 -0
  42. package/dist/harmonicsFunctions-D9ZL5yLA.js.map +1 -0
  43. package/dist/hdrTextureLoader-DreWCvHD.js +112 -0
  44. package/dist/hdrTextureLoader-DreWCvHD.js.map +1 -0
  45. package/dist/helperFunctions-Dh1WD8YN.js +106 -0
  46. package/dist/helperFunctions-Dh1WD8YN.js.map +1 -0
  47. package/dist/helperFunctions-ZBnqb-in.js +79 -0
  48. package/dist/helperFunctions-ZBnqb-in.js.map +1 -0
  49. package/dist/iesTextureLoader-JdfAyRK-.js +94 -0
  50. package/dist/iesTextureLoader-JdfAyRK-.js.map +1 -0
  51. package/dist/index-ChGTkj2q.js +62191 -0
  52. package/dist/index-ChGTkj2q.js.map +1 -0
  53. package/dist/instancesVertex-BrWNnWxF.js +46 -0
  54. package/dist/instancesVertex-BrWNnWxF.js.map +1 -0
  55. package/dist/instancesVertex-evcSIvCA.js +55 -0
  56. package/dist/instancesVertex-evcSIvCA.js.map +1 -0
  57. package/dist/ktxTextureLoader-Dg1h0a-4.js +520 -0
  58. package/dist/ktxTextureLoader-Dg1h0a-4.js.map +1 -0
  59. package/dist/logDepthDeclaration-BHUUDd5l.js +12 -0
  60. package/dist/logDepthDeclaration-BHUUDd5l.js.map +1 -0
  61. package/dist/logDepthDeclaration-Bou5AJOP.js +28 -0
  62. package/dist/logDepthDeclaration-Bou5AJOP.js.map +1 -0
  63. package/dist/logDepthVertex-CCFGLExi.js +496 -0
  64. package/dist/logDepthVertex-CCFGLExi.js.map +1 -0
  65. package/dist/logDepthVertex-r_niddz9.js +496 -0
  66. package/dist/logDepthVertex-r_niddz9.js.map +1 -0
  67. package/dist/mesh.vertexData.functions-Bc9lJlrU.js +75 -0
  68. package/dist/mesh.vertexData.functions-Bc9lJlrU.js.map +1 -0
  69. package/dist/meshUboDeclaration-Dg__Mhmj.js +18 -0
  70. package/dist/meshUboDeclaration-Dg__Mhmj.js.map +1 -0
  71. package/dist/oitFragment-Bn29Ggvj.js +1191 -0
  72. package/dist/oitFragment-Bn29Ggvj.js.map +1 -0
  73. package/dist/oitFragment-D6JBEGk0.js +1328 -0
  74. package/dist/oitFragment-D6JBEGk0.js.map +1 -0
  75. package/dist/pass.fragment-C9O4ZLJL.js +11 -0
  76. package/dist/pass.fragment-C9O4ZLJL.js.map +1 -0
  77. package/dist/pass.fragment-Cf0ob1Y3.js +11 -0
  78. package/dist/pass.fragment-Cf0ob1Y3.js.map +1 -0
  79. package/dist/passCube.fragment-Mg8Qj5T9.js +30 -0
  80. package/dist/passCube.fragment-Mg8Qj5T9.js.map +1 -0
  81. package/dist/passCube.fragment-uM4B7TOI.js +30 -0
  82. package/dist/passCube.fragment-uM4B7TOI.js.map +1 -0
  83. package/dist/pbr.fragment-C8Lm3cwF.js +3176 -0
  84. package/dist/pbr.fragment-C8Lm3cwF.js.map +1 -0
  85. package/dist/pbr.fragment-siOdCYqI.js +3219 -0
  86. package/dist/pbr.fragment-siOdCYqI.js.map +1 -0
  87. package/dist/pbr.vertex-Bw_TrGQv.js +229 -0
  88. package/dist/pbr.vertex-Bw_TrGQv.js.map +1 -0
  89. package/dist/pbr.vertex-CmEPCcBW.js +365 -0
  90. package/dist/pbr.vertex-CmEPCcBW.js.map +1 -0
  91. package/dist/postprocess.vertex-B086G8mM.js +16 -0
  92. package/dist/postprocess.vertex-B086G8mM.js.map +1 -0
  93. package/dist/rgbdDecode.fragment-bNaGtQ-x.js +9 -0
  94. package/dist/rgbdDecode.fragment-bNaGtQ-x.js.map +1 -0
  95. package/dist/rgbdDecode.fragment-koAcppx0.js +9 -0
  96. package/dist/rgbdDecode.fragment-koAcppx0.js.map +1 -0
  97. package/dist/rgbdEncode.fragment-BDHL2P_i.js +9 -0
  98. package/dist/rgbdEncode.fragment-BDHL2P_i.js.map +1 -0
  99. package/dist/rgbdEncode.fragment-Dw0FS9aH.js +9 -0
  100. package/dist/rgbdEncode.fragment-Dw0FS9aH.js.map +1 -0
  101. package/dist/tgaTextureLoader-DIfkfgQh.js +199 -0
  102. package/dist/tgaTextureLoader-DIfkfgQh.js.map +1 -0
  103. package/package.json +124 -0
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ [![Test](https://github.com/graphty-org/graphty-element/actions/workflows/test.yml/badge.svg)](https://github.com/graphty-org/graphty-element/actions/workflows/test.yml)
2
+ <a href="https://graphty-org.github.io/graphty-element" target="_blank"><img
3
+ src="https://raw.githubusercontent.com/storybooks/brand/master/badge/badge-storybook.svg"></a>
4
+ [![Coverage
5
+ Status](https://coveralls.io/repos/github/graphty-org/graphty-element/badge.svg?branch=master)](https://coveralls.io/github/graphty-org/graphty-element?branch=master)
6
+
7
+ Graph analysis tool using [Babylon.js](https://www.babylonjs.com/).
8
+
9
+ Inspired by [three-forcegraph](https://github.com/vasturiano/three-forcegraph).
@@ -0,0 +1,312 @@
1
+ import { e as h, I as R, f as U } from "./index-ChGTkj2q.js";
2
+ function D() {
3
+ const e = {
4
+ cTFETC1: 0,
5
+ cTFETC2: 1,
6
+ cTFBC1: 2,
7
+ cTFBC3: 3,
8
+ cTFBC7: 6,
9
+ cTFPVRTC1_4_RGB: 8,
10
+ cTFPVRTC1_4_RGBA: 9,
11
+ cTFASTC_4x4: 10,
12
+ cTFRGB565: 14
13
+ };
14
+ let n = null;
15
+ onmessage = (t) => {
16
+ if (t.data.action === "init") {
17
+ if (t.data.url)
18
+ try {
19
+ importScripts(t.data.url);
20
+ } catch (o) {
21
+ postMessage({ action: "error", error: o });
22
+ }
23
+ n || (n = BASIS({
24
+ // Override wasm binary
25
+ wasmBinary: t.data.wasmBinary
26
+ })), n !== null && n.then((o) => {
27
+ BASIS = o, o.initializeBasis(), postMessage({ action: "init" });
28
+ });
29
+ } else if (t.data.action === "transcode") {
30
+ const o = t.data.config, a = t.data.imageData, d = new BASIS.BasisFile(a), i = l(d);
31
+ let f = t.data.ignoreSupportedFormats ? null : s(t.data.config, i), p = !1;
32
+ f === null && (p = !0, f = i.hasAlpha ? e.cTFBC3 : e.cTFBC1);
33
+ let g = !0;
34
+ d.startTranscoding() || (g = !1);
35
+ const T = [];
36
+ for (let m = 0; m < i.images.length && g; m++) {
37
+ const F = i.images[m];
38
+ if (o.loadSingleImage === void 0 || o.loadSingleImage === m) {
39
+ let w = F.levels.length;
40
+ o.loadMipmapLevels === !1 && (w = 1);
41
+ for (let u = 0; u < w; u++) {
42
+ const y = F.levels[u], B = r(d, m, u, f, p);
43
+ if (!B) {
44
+ g = !1;
45
+ break;
46
+ }
47
+ y.transcodedPixels = B, T.push(y.transcodedPixels.buffer);
48
+ }
49
+ }
50
+ }
51
+ d.close(), d.delete(), p && (f = -1), g ? postMessage({ action: "transcode", success: g, id: t.data.id, fileInfo: i, format: f }, T) : postMessage({ action: "transcode", success: g, id: t.data.id });
52
+ }
53
+ };
54
+ function s(t, o) {
55
+ let a = null;
56
+ return t.supportedCompressionFormats && (t.supportedCompressionFormats.astc ? a = e.cTFASTC_4x4 : t.supportedCompressionFormats.bc7 ? a = e.cTFBC7 : t.supportedCompressionFormats.s3tc ? a = o.hasAlpha ? e.cTFBC3 : e.cTFBC1 : t.supportedCompressionFormats.pvrtc ? a = o.hasAlpha ? e.cTFPVRTC1_4_RGBA : e.cTFPVRTC1_4_RGB : t.supportedCompressionFormats.etc2 ? a = e.cTFETC2 : t.supportedCompressionFormats.etc1 ? a = e.cTFETC1 : a = e.cTFRGB565), a;
57
+ }
58
+ function l(t) {
59
+ const o = t.getHasAlpha(), a = t.getNumImages(), d = [];
60
+ for (let f = 0; f < a; f++) {
61
+ const p = {
62
+ levels: []
63
+ }, g = t.getNumLevels(f);
64
+ for (let T = 0; T < g; T++) {
65
+ const m = {
66
+ width: t.getImageWidth(f, T),
67
+ height: t.getImageHeight(f, T)
68
+ };
69
+ p.levels.push(m);
70
+ }
71
+ d.push(p);
72
+ }
73
+ return { hasAlpha: o, images: d };
74
+ }
75
+ function r(t, o, a, d, i) {
76
+ const f = t.getImageTranscodedSizeInBytes(o, a, d);
77
+ let p = new Uint8Array(f);
78
+ if (!t.transcodeImage(p, o, a, d, 1, 0))
79
+ return null;
80
+ if (i) {
81
+ const g = t.getImageWidth(o, a) + 3 & -4, T = t.getImageHeight(o, a) + 3 & -4;
82
+ p = c(p, 0, g, T);
83
+ }
84
+ return p;
85
+ }
86
+ function c(t, o, a, d) {
87
+ const i = new Uint16Array(4), f = new Uint16Array(a * d), p = a / 4, g = d / 4;
88
+ for (let T = 0; T < g; T++)
89
+ for (let m = 0; m < p; m++) {
90
+ const F = o + 8 * (T * p + m);
91
+ i[0] = t[F] | t[F + 1] << 8, i[1] = t[F + 2] | t[F + 3] << 8, i[2] = (2 * (i[0] & 31) + 1 * (i[1] & 31)) / 3 | (2 * (i[0] & 2016) + 1 * (i[1] & 2016)) / 3 & 2016 | (2 * (i[0] & 63488) + 1 * (i[1] & 63488)) / 3 & 63488, i[3] = (2 * (i[1] & 31) + 1 * (i[0] & 31)) / 3 | (2 * (i[1] & 2016) + 1 * (i[0] & 2016)) / 3 & 2016 | (2 * (i[1] & 63488) + 1 * (i[0] & 63488)) / 3 & 63488;
92
+ for (let w = 0; w < 4; w++) {
93
+ const u = t[F + 4 + w];
94
+ let y = (T * 4 + w) * a + m * 4;
95
+ f[y++] = i[u & 3], f[y++] = i[u >> 2 & 3], f[y++] = i[u >> 4 & 3], f[y++] = i[u >> 6 & 3];
96
+ }
97
+ }
98
+ return f;
99
+ }
100
+ }
101
+ async function W(e, n, s) {
102
+ return await new Promise((l, r) => {
103
+ const c = (t) => {
104
+ t.data.action === "init" ? (e.removeEventListener("message", c), l(e)) : t.data.action === "error" && r(t.data.error || "error initializing worker");
105
+ };
106
+ e.addEventListener("message", c), e.postMessage({ action: "init", url: s ? h.GetBabylonScriptURL(s) : void 0, wasmBinary: n }, [n]);
107
+ });
108
+ }
109
+ var C;
110
+ (function(e) {
111
+ e[e.cTFETC1 = 0] = "cTFETC1", e[e.cTFETC2 = 1] = "cTFETC2", e[e.cTFBC1 = 2] = "cTFBC1", e[e.cTFBC3 = 3] = "cTFBC3", e[e.cTFBC4 = 4] = "cTFBC4", e[e.cTFBC5 = 5] = "cTFBC5", e[e.cTFBC7 = 6] = "cTFBC7", e[e.cTFPVRTC1_4_RGB = 8] = "cTFPVRTC1_4_RGB", e[e.cTFPVRTC1_4_RGBA = 9] = "cTFPVRTC1_4_RGBA", e[e.cTFASTC_4x4 = 10] = "cTFASTC_4x4", e[e.cTFATC_RGB = 11] = "cTFATC_RGB", e[e.cTFATC_RGBA_INTERPOLATED_ALPHA = 12] = "cTFATC_RGBA_INTERPOLATED_ALPHA", e[e.cTFRGBA32 = 13] = "cTFRGBA32", e[e.cTFRGB565 = 14] = "cTFRGB565", e[e.cTFBGR565 = 15] = "cTFBGR565", e[e.cTFRGBA4444 = 16] = "cTFRGBA4444", e[e.cTFFXT1_RGB = 17] = "cTFFXT1_RGB", e[e.cTFPVRTC2_4_RGB = 18] = "cTFPVRTC2_4_RGB", e[e.cTFPVRTC2_4_RGBA = 19] = "cTFPVRTC2_4_RGBA", e[e.cTFETC2_EAC_R11 = 20] = "cTFETC2_EAC_R11", e[e.cTFETC2_EAC_RG11 = 21] = "cTFETC2_EAC_RG11";
112
+ })(C || (C = {}));
113
+ const b = {
114
+ /**
115
+ * URL to use when loading the basis transcoder
116
+ */
117
+ JSModuleURL: `${h._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.js`,
118
+ /**
119
+ * URL to use when loading the wasm module for the transcoder
120
+ */
121
+ WasmModuleURL: `${h._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.wasm`
122
+ }, V = (e, n) => {
123
+ let s;
124
+ switch (e) {
125
+ case C.cTFETC1:
126
+ s = 36196;
127
+ break;
128
+ case C.cTFBC1:
129
+ s = 33776;
130
+ break;
131
+ case C.cTFBC4:
132
+ s = 33779;
133
+ break;
134
+ case C.cTFASTC_4x4:
135
+ s = 37808;
136
+ break;
137
+ case C.cTFETC2:
138
+ s = 37496;
139
+ break;
140
+ case C.cTFBC7:
141
+ s = 36492;
142
+ break;
143
+ }
144
+ if (s === void 0)
145
+ throw "The chosen Basis transcoder format is not currently supported";
146
+ return s;
147
+ };
148
+ let G = null, L = null, k = 0;
149
+ const H = !1, x = async () => (G || (G = new Promise((e, n) => {
150
+ L ? e(L) : h.LoadFileAsync(h.GetBabylonScriptURL(b.WasmModuleURL)).then((s) => {
151
+ if (typeof URL != "function")
152
+ return n("Basis transcoder requires an environment with a URL constructor");
153
+ const l = URL.createObjectURL(new Blob([`(${D})()`], { type: "application/javascript" }));
154
+ L = new Worker(l), W(L, s, b.JSModuleURL).then(e, n);
155
+ }).catch(n);
156
+ })), await G), _ = async (e, n) => {
157
+ const s = e instanceof ArrayBuffer ? new Uint8Array(e) : e;
158
+ return await new Promise((l, r) => {
159
+ x().then(() => {
160
+ const c = k++, t = (a) => {
161
+ a.data.action === "transcode" && a.data.id === c && (L.removeEventListener("message", t), a.data.success ? l(a.data) : r("Transcode is not supported on this device"));
162
+ };
163
+ L.addEventListener("message", t);
164
+ const o = new Uint8Array(s.byteLength);
165
+ o.set(new Uint8Array(s.buffer, s.byteOffset, s.byteLength)), L.postMessage({ action: "transcode", id: c, imageData: o, config: n, ignoreSupportedFormats: H }, [
166
+ o.buffer
167
+ ]);
168
+ }, (c) => {
169
+ r(c);
170
+ });
171
+ });
172
+ }, E = (e, n) => {
173
+ var l, r;
174
+ let s = (l = n._gl) == null ? void 0 : l.TEXTURE_2D;
175
+ e.isCube && (s = (r = n._gl) == null ? void 0 : r.TEXTURE_CUBE_MAP), n._bindTextureDirectly(s, e, !0);
176
+ }, P = (e, n) => {
177
+ const s = e.getEngine();
178
+ for (let l = 0; l < n.fileInfo.images.length; l++) {
179
+ const r = n.fileInfo.images[l].levels[0];
180
+ if (e._invertVScale = e.invertY, n.format === -1 || n.format === C.cTFRGB565)
181
+ if (e.type = 10, e.format = 4, s._features.basisNeedsPOT && (Math.log2(r.width) % 1 !== 0 || Math.log2(r.height) % 1 !== 0)) {
182
+ const c = new R(
183
+ s,
184
+ 2
185
+ /* InternalTextureSource.Temp */
186
+ );
187
+ e._invertVScale = e.invertY, c.type = 10, c.format = 4, c.width = r.width + 3 & -4, c.height = r.height + 3 & -4, E(c, s), s._uploadDataToTextureDirectly(c, new Uint16Array(r.transcodedPixels.buffer), l, 0, 4, !0), s._rescaleTexture(c, e, s.scenes[0], s._getInternalFormat(4), () => {
188
+ s._releaseTexture(c), E(e, s);
189
+ });
190
+ } else
191
+ e._invertVScale = !e.invertY, e.width = r.width + 3 & -4, e.height = r.height + 3 & -4, e.samplingMode = 2, E(e, s), s._uploadDataToTextureDirectly(e, new Uint16Array(r.transcodedPixels.buffer), l, 0, 4, !0);
192
+ else {
193
+ e.width = r.width, e.height = r.height, e.generateMipMaps = n.fileInfo.images[l].levels.length > 1;
194
+ const c = v.GetInternalFormatFromBasisFormat(n.format, s);
195
+ e.format = c, E(e, s);
196
+ const t = n.fileInfo.images[l].levels;
197
+ for (let o = 0; o < t.length; o++) {
198
+ const a = t[o];
199
+ s._uploadCompressedDataToTextureDirectly(e, c, a.width, a.height, a.transcodedPixels, l, o);
200
+ }
201
+ s._features.basisNeedsPOT && (Math.log2(e.width) % 1 !== 0 || Math.log2(e.height) % 1 !== 0) && (h.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."), e._cachedWrapU = U.CLAMP_ADDRESSMODE, e._cachedWrapV = U.CLAMP_ADDRESSMODE);
202
+ }
203
+ }
204
+ }, v = {
205
+ /**
206
+ * URL to use when loading the basis transcoder
207
+ */
208
+ JSModuleURL: b.JSModuleURL,
209
+ /**
210
+ * URL to use when loading the wasm module for the transcoder
211
+ */
212
+ WasmModuleURL: b.WasmModuleURL,
213
+ /**
214
+ * Get the internal format to be passed to texImage2D corresponding to the .basis format value
215
+ * @param basisFormat format chosen from GetSupportedTranscodeFormat
216
+ * @returns internal format corresponding to the Basis format
217
+ */
218
+ GetInternalFormatFromBasisFormat: V,
219
+ /**
220
+ * Transcodes a loaded image file to compressed pixel data
221
+ * @param data image data to transcode
222
+ * @param config configuration options for the transcoding
223
+ * @returns a promise resulting in the transcoded image
224
+ */
225
+ TranscodeAsync: _,
226
+ /**
227
+ * Loads a texture from the transcode result
228
+ * @param texture texture load to
229
+ * @param transcodeResult the result of transcoding the basis file to load from
230
+ */
231
+ LoadTextureFromTranscodeResult: P
232
+ };
233
+ Object.defineProperty(v, "JSModuleURL", {
234
+ get: function() {
235
+ return b.JSModuleURL;
236
+ },
237
+ set: function(e) {
238
+ b.JSModuleURL = e;
239
+ }
240
+ });
241
+ Object.defineProperty(v, "WasmModuleURL", {
242
+ get: function() {
243
+ return b.WasmModuleURL;
244
+ },
245
+ set: function(e) {
246
+ b.WasmModuleURL = e;
247
+ }
248
+ });
249
+ class M {
250
+ constructor() {
251
+ this.supportCascades = !1;
252
+ }
253
+ /**
254
+ * Uploads the cube texture data to the WebGL texture. It has already been bound.
255
+ * @param data contains the texture data
256
+ * @param texture defines the BabylonJS internal texture
257
+ * @param createPolynomials will be true if polynomials have been requested
258
+ * @param onLoad defines the callback to trigger once the texture is ready
259
+ * @param onError defines the callback to trigger in case of error
260
+ */
261
+ loadCubeData(n, s, l, r, c) {
262
+ if (Array.isArray(n))
263
+ return;
264
+ const t = s.getEngine().getCaps(), o = {
265
+ supportedCompressionFormats: {
266
+ etc1: !!t.etc1,
267
+ s3tc: !!t.s3tc,
268
+ pvrtc: !!t.pvrtc,
269
+ etc2: !!t.etc2,
270
+ astc: !!t.astc,
271
+ bc7: !!t.bptc
272
+ }
273
+ };
274
+ _(n, o).then((a) => {
275
+ const d = a.fileInfo.images[0].levels.length > 1 && s.generateMipMaps;
276
+ P(s, a), s.getEngine()._setCubeMapTextureParams(s, d), s.isReady = !0, s.onLoadedObservable.notifyObservers(s), s.onLoadedObservable.clear(), r && r();
277
+ }).catch((a) => {
278
+ h.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"), s.isReady = !0, c && c(a);
279
+ });
280
+ }
281
+ /**
282
+ * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.
283
+ * @param data contains the texture data
284
+ * @param texture defines the BabylonJS internal texture
285
+ * @param callback defines the method to call once ready to upload
286
+ */
287
+ loadData(n, s, l) {
288
+ const r = s.getEngine().getCaps(), c = {
289
+ supportedCompressionFormats: {
290
+ etc1: !!r.etc1,
291
+ s3tc: !!r.s3tc,
292
+ pvrtc: !!r.pvrtc,
293
+ etc2: !!r.etc2,
294
+ astc: !!r.astc,
295
+ bc7: !!r.bptc
296
+ }
297
+ };
298
+ _(n, c).then((t) => {
299
+ const o = t.fileInfo.images[0].levels[0], a = t.fileInfo.images[0].levels.length > 1 && s.generateMipMaps;
300
+ l(o.width, o.height, a, t.format !== -1, () => {
301
+ P(s, t);
302
+ });
303
+ }).catch((t) => {
304
+ h.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"), h.Warn(`Failed to transcode Basis file: ${t}`), l(0, 0, !1, !1, () => {
305
+ }, !0);
306
+ });
307
+ }
308
+ }
309
+ export {
310
+ M as _BasisTextureLoader
311
+ };
312
+ //# sourceMappingURL=basisTextureLoader-BqIvxvNl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basisTextureLoader-BqIvxvNl.js","sources":["../node_modules/@babylonjs/core/Misc/basisWorker.js","../node_modules/@babylonjs/core/Misc/basis.js","../node_modules/@babylonjs/core/Materials/Textures/Loaders/basisTextureLoader.js"],"sourcesContent":["import { Tools } from \"./tools.js\";\n/**\n * The worker function that gets converted to a blob url to pass into a worker.\n * To be used if a developer wants to create their own worker instance and inject it instead of using the default worker.\n */\nexport function workerFunction() {\n const _BASIS_FORMAT = {\n cTFETC1: 0,\n cTFETC2: 1,\n cTFBC1: 2,\n cTFBC3: 3,\n cTFBC4: 4,\n cTFBC5: 5,\n cTFBC7: 6,\n cTFPVRTC1_4_RGB: 8,\n cTFPVRTC1_4_RGBA: 9,\n cTFASTC_4x4: 10,\n cTFATC_RGB: 11,\n cTFATC_RGBA_INTERPOLATED_ALPHA: 12,\n cTFRGBA32: 13,\n cTFRGB565: 14,\n cTFBGR565: 15,\n cTFRGBA4444: 16,\n cTFFXT1_RGB: 17,\n cTFPVRTC2_4_RGB: 18,\n cTFPVRTC2_4_RGBA: 19,\n cTFETC2_EAC_R11: 20,\n cTFETC2_EAC_RG11: 21,\n };\n let transcoderModulePromise = null;\n onmessage = (event) => {\n if (event.data.action === \"init\") {\n // Load the transcoder if it hasn't been yet\n if (event.data.url) {\n // make sure we loaded the script correctly\n try {\n importScripts(event.data.url);\n }\n catch (e) {\n postMessage({ action: \"error\", error: e });\n }\n }\n if (!transcoderModulePromise) {\n transcoderModulePromise = BASIS({\n // Override wasm binary\n wasmBinary: event.data.wasmBinary,\n });\n }\n if (transcoderModulePromise !== null) {\n // eslint-disable-next-line github/no-then\n transcoderModulePromise.then((m) => {\n BASIS = m;\n m.initializeBasis();\n postMessage({ action: \"init\" });\n });\n }\n }\n else if (event.data.action === \"transcode\") {\n // Transcode the basis image and return the resulting pixels\n const config = event.data.config;\n const imgData = event.data.imageData;\n const loadedFile = new BASIS.BasisFile(imgData);\n const fileInfo = GetFileInfo(loadedFile);\n let format = event.data.ignoreSupportedFormats ? null : GetSupportedTranscodeFormat(event.data.config, fileInfo);\n let needsConversion = false;\n if (format === null) {\n needsConversion = true;\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;\n }\n // Begin transcode\n let success = true;\n if (!loadedFile.startTranscoding()) {\n success = false;\n }\n const buffers = [];\n for (let imageIndex = 0; imageIndex < fileInfo.images.length; imageIndex++) {\n if (!success) {\n break;\n }\n const image = fileInfo.images[imageIndex];\n if (config.loadSingleImage === undefined || config.loadSingleImage === imageIndex) {\n let mipCount = image.levels.length;\n if (config.loadMipmapLevels === false) {\n mipCount = 1;\n }\n for (let levelIndex = 0; levelIndex < mipCount; levelIndex++) {\n const levelInfo = image.levels[levelIndex];\n const pixels = TranscodeLevel(loadedFile, imageIndex, levelIndex, format, needsConversion);\n if (!pixels) {\n success = false;\n break;\n }\n levelInfo.transcodedPixels = pixels;\n buffers.push(levelInfo.transcodedPixels.buffer);\n }\n }\n }\n // Close file\n loadedFile.close();\n loadedFile.delete();\n if (needsConversion) {\n format = -1;\n }\n if (!success) {\n postMessage({ action: \"transcode\", success: success, id: event.data.id });\n }\n else {\n postMessage({ action: \"transcode\", success: success, id: event.data.id, fileInfo: fileInfo, format: format }, buffers);\n }\n }\n };\n /**\n * Detects the supported transcode format for the file\n * @param config transcode config\n * @param fileInfo info about the file\n * @returns the chosed format or null if none are supported\n */\n function GetSupportedTranscodeFormat(config, fileInfo) {\n let format = null;\n if (config.supportedCompressionFormats) {\n if (config.supportedCompressionFormats.astc) {\n format = _BASIS_FORMAT.cTFASTC_4x4;\n }\n else if (config.supportedCompressionFormats.bc7) {\n format = _BASIS_FORMAT.cTFBC7;\n }\n else if (config.supportedCompressionFormats.s3tc) {\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;\n }\n else if (config.supportedCompressionFormats.pvrtc) {\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFPVRTC1_4_RGBA : _BASIS_FORMAT.cTFPVRTC1_4_RGB;\n }\n else if (config.supportedCompressionFormats.etc2) {\n format = _BASIS_FORMAT.cTFETC2;\n }\n else if (config.supportedCompressionFormats.etc1) {\n format = _BASIS_FORMAT.cTFETC1;\n }\n else {\n format = _BASIS_FORMAT.cTFRGB565;\n }\n }\n return format;\n }\n /**\n * Retrieves information about the basis file eg. dimensions\n * @param basisFile the basis file to get the info from\n * @returns information about the basis file\n */\n function GetFileInfo(basisFile) {\n const hasAlpha = basisFile.getHasAlpha();\n const imageCount = basisFile.getNumImages();\n const images = [];\n for (let i = 0; i < imageCount; i++) {\n const imageInfo = {\n levels: [],\n };\n const levelCount = basisFile.getNumLevels(i);\n for (let level = 0; level < levelCount; level++) {\n const levelInfo = {\n width: basisFile.getImageWidth(i, level),\n height: basisFile.getImageHeight(i, level),\n };\n imageInfo.levels.push(levelInfo);\n }\n images.push(imageInfo);\n }\n const info = { hasAlpha, images };\n return info;\n }\n function TranscodeLevel(loadedFile, imageIndex, levelIndex, format, convertToRgb565) {\n const dstSize = loadedFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, format);\n let dst = new Uint8Array(dstSize);\n if (!loadedFile.transcodeImage(dst, imageIndex, levelIndex, format, 1, 0)) {\n return null;\n }\n // If no supported format is found, load as dxt and convert to rgb565\n if (convertToRgb565) {\n const alignedWidth = (loadedFile.getImageWidth(imageIndex, levelIndex) + 3) & ~3;\n const alignedHeight = (loadedFile.getImageHeight(imageIndex, levelIndex) + 3) & ~3;\n dst = ConvertDxtToRgb565(dst, 0, alignedWidth, alignedHeight);\n }\n return dst;\n }\n /**\n * From https://github.com/BinomialLLC/basis_universal/blob/master/webgl/texture/dxt-to-rgb565.js\n * An unoptimized version of dxtToRgb565. Also, the floating\n * point math used to compute the colors actually results in\n * slightly different colors compared to hardware DXT decoders.\n * @param src dxt src pixels\n * @param srcByteOffset offset for the start of src\n * @param width aligned width of the image\n * @param height aligned height of the image\n * @returns the converted pixels\n */\n function ConvertDxtToRgb565(src, srcByteOffset, width, height) {\n const c = new Uint16Array(4);\n const dst = new Uint16Array(width * height);\n const blockWidth = width / 4;\n const blockHeight = height / 4;\n for (let blockY = 0; blockY < blockHeight; blockY++) {\n for (let blockX = 0; blockX < blockWidth; blockX++) {\n const i = srcByteOffset + 8 * (blockY * blockWidth + blockX);\n c[0] = src[i] | (src[i + 1] << 8);\n c[1] = src[i + 2] | (src[i + 3] << 8);\n c[2] =\n ((2 * (c[0] & 0x1f) + 1 * (c[1] & 0x1f)) / 3) |\n (((2 * (c[0] & 0x7e0) + 1 * (c[1] & 0x7e0)) / 3) & 0x7e0) |\n (((2 * (c[0] & 0xf800) + 1 * (c[1] & 0xf800)) / 3) & 0xf800);\n c[3] =\n ((2 * (c[1] & 0x1f) + 1 * (c[0] & 0x1f)) / 3) |\n (((2 * (c[1] & 0x7e0) + 1 * (c[0] & 0x7e0)) / 3) & 0x7e0) |\n (((2 * (c[1] & 0xf800) + 1 * (c[0] & 0xf800)) / 3) & 0xf800);\n for (let row = 0; row < 4; row++) {\n const m = src[i + 4 + row];\n let dstI = (blockY * 4 + row) * width + blockX * 4;\n dst[dstI++] = c[m & 0x3];\n dst[dstI++] = c[(m >> 2) & 0x3];\n dst[dstI++] = c[(m >> 4) & 0x3];\n dst[dstI++] = c[(m >> 6) & 0x3];\n }\n }\n }\n return dst;\n }\n}\n/**\n * Initialize a web worker with the basis transcoder\n * @param worker the worker to initialize\n * @param wasmBinary the wasm binary to load into the worker\n * @param moduleUrl the url to the basis transcoder module\n * @returns a promise that resolves when the worker is initialized\n */\n// eslint-disable-next-line no-restricted-syntax\nexport async function initializeWebWorker(worker, wasmBinary, moduleUrl) {\n return await new Promise((res, reject) => {\n const initHandler = (msg) => {\n if (msg.data.action === \"init\") {\n worker.removeEventListener(\"message\", initHandler);\n res(worker);\n }\n else if (msg.data.action === \"error\") {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(msg.data.error || \"error initializing worker\");\n }\n };\n worker.addEventListener(\"message\", initHandler);\n // we can use transferable objects here because the worker will own the ArrayBuffer\n worker.postMessage({ action: \"init\", url: moduleUrl ? Tools.GetBabylonScriptURL(moduleUrl) : undefined, wasmBinary }, [wasmBinary]);\n });\n}\n//# sourceMappingURL=basisWorker.js.map","import { Tools } from \"./tools.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { InternalTexture } from \"../Materials/Textures/internalTexture.js\";\n\nimport { initializeWebWorker, workerFunction } from \"./basisWorker.js\";\n/**\n * Info about the .basis files\n */\nexport class BasisFileInfo {\n}\n/**\n * Result of transcoding a basis file\n */\nclass TranscodeResult {\n}\n/**\n * Configuration options for the Basis transcoder\n */\nexport class BasisTranscodeConfiguration {\n}\n/**\n * @internal\n * Enum of basis transcoder formats\n */\nvar BASIS_FORMATS;\n(function (BASIS_FORMATS) {\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC1\"] = 0] = \"cTFETC1\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC2\"] = 1] = \"cTFETC2\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC1\"] = 2] = \"cTFBC1\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC3\"] = 3] = \"cTFBC3\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC4\"] = 4] = \"cTFBC4\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC5\"] = 5] = \"cTFBC5\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC7\"] = 6] = \"cTFBC7\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFPVRTC1_4_RGB\"] = 8] = \"cTFPVRTC1_4_RGB\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFPVRTC1_4_RGBA\"] = 9] = \"cTFPVRTC1_4_RGBA\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFASTC_4x4\"] = 10] = \"cTFASTC_4x4\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFATC_RGB\"] = 11] = \"cTFATC_RGB\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFATC_RGBA_INTERPOLATED_ALPHA\"] = 12] = \"cTFATC_RGBA_INTERPOLATED_ALPHA\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFRGBA32\"] = 13] = \"cTFRGBA32\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFRGB565\"] = 14] = \"cTFRGB565\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBGR565\"] = 15] = \"cTFBGR565\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFRGBA4444\"] = 16] = \"cTFRGBA4444\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFFXT1_RGB\"] = 17] = \"cTFFXT1_RGB\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFPVRTC2_4_RGB\"] = 18] = \"cTFPVRTC2_4_RGB\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFPVRTC2_4_RGBA\"] = 19] = \"cTFPVRTC2_4_RGBA\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC2_EAC_R11\"] = 20] = \"cTFETC2_EAC_R11\";\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC2_EAC_RG11\"] = 21] = \"cTFETC2_EAC_RG11\";\n})(BASIS_FORMATS || (BASIS_FORMATS = {}));\n/**\n * Used to load .Basis files\n * See https://github.com/BinomialLLC/basis_universal/tree/master/webgl\n */\nexport const BasisToolsOptions = {\n /**\n * URL to use when loading the basis transcoder\n */\n JSModuleURL: `${Tools._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.js`,\n /**\n * URL to use when loading the wasm module for the transcoder\n */\n WasmModuleURL: `${Tools._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.wasm`,\n};\n/**\n * Get the internal format to be passed to texImage2D corresponding to the .basis format value\n * @param basisFormat format chosen from GetSupportedTranscodeFormat\n * @param engine\n * @returns internal format corresponding to the Basis format\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const GetInternalFormatFromBasisFormat = (basisFormat, engine) => {\n let format;\n switch (basisFormat) {\n case BASIS_FORMATS.cTFETC1:\n format = 36196;\n break;\n case BASIS_FORMATS.cTFBC1:\n format = 33776;\n break;\n case BASIS_FORMATS.cTFBC4:\n format = 33779;\n break;\n case BASIS_FORMATS.cTFASTC_4x4:\n format = 37808;\n break;\n case BASIS_FORMATS.cTFETC2:\n format = 37496;\n break;\n case BASIS_FORMATS.cTFBC7:\n format = 36492;\n break;\n }\n if (format === undefined) {\n // eslint-disable-next-line no-throw-literal\n throw \"The chosen Basis transcoder format is not currently supported\";\n }\n return format;\n};\nlet WorkerPromise = null;\nlet LocalWorker = null;\nlet ActionId = 0;\nconst IgnoreSupportedFormats = false;\nconst CreateWorkerAsync = async () => {\n if (!WorkerPromise) {\n WorkerPromise = new Promise((res, reject) => {\n if (LocalWorker) {\n res(LocalWorker);\n }\n else {\n Tools.LoadFileAsync(Tools.GetBabylonScriptURL(BasisToolsOptions.WasmModuleURL))\n // eslint-disable-next-line github/no-then\n .then((wasmBinary) => {\n if (typeof URL !== \"function\") {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return reject(\"Basis transcoder requires an environment with a URL constructor\");\n }\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n const workerBlobUrl = URL.createObjectURL(new Blob([`(${workerFunction})()`], { type: \"application/javascript\" }));\n LocalWorker = new Worker(workerBlobUrl);\n // eslint-disable-next-line github/no-then\n initializeWebWorker(LocalWorker, wasmBinary, BasisToolsOptions.JSModuleURL).then(res, reject);\n })\n // eslint-disable-next-line github/no-then\n .catch(reject);\n }\n });\n }\n return await WorkerPromise;\n};\n/**\n * Set the worker to use for transcoding\n * @param worker The worker that will be used for transcoding\n */\nexport const SetBasisTranscoderWorker = (worker) => {\n LocalWorker = worker;\n};\n/**\n * Transcodes a loaded image file to compressed pixel data\n * @param data image data to transcode\n * @param config configuration options for the transcoding\n * @returns a promise resulting in the transcoded image\n */\nexport const TranscodeAsync = async (data, config) => {\n const dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;\n return await new Promise((res, rej) => {\n // eslint-disable-next-line github/no-then\n CreateWorkerAsync().then(() => {\n const actionId = ActionId++;\n const messageHandler = (msg) => {\n if (msg.data.action === \"transcode\" && msg.data.id === actionId) {\n LocalWorker.removeEventListener(\"message\", messageHandler);\n if (!msg.data.success) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n rej(\"Transcode is not supported on this device\");\n }\n else {\n res(msg.data);\n }\n }\n };\n LocalWorker.addEventListener(\"message\", messageHandler);\n const dataViewCopy = new Uint8Array(dataView.byteLength);\n dataViewCopy.set(new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength));\n LocalWorker.postMessage({ action: \"transcode\", id: actionId, imageData: dataViewCopy, config: config, ignoreSupportedFormats: IgnoreSupportedFormats }, [\n dataViewCopy.buffer,\n ]);\n }, (error) => {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n rej(error);\n });\n });\n};\n/**\n * Binds a texture according to its underlying target.\n * @param texture texture to bind\n * @param engine the engine to bind the texture in\n */\nconst BindTexture = (texture, engine) => {\n let target = engine._gl?.TEXTURE_2D;\n if (texture.isCube) {\n target = engine._gl?.TEXTURE_CUBE_MAP;\n }\n engine._bindTextureDirectly(target, texture, true);\n};\n/**\n * Loads a texture from the transcode result\n * @param texture texture load to\n * @param transcodeResult the result of transcoding the basis file to load from\n */\nexport const LoadTextureFromTranscodeResult = (texture, transcodeResult) => {\n const engine = texture.getEngine();\n for (let i = 0; i < transcodeResult.fileInfo.images.length; i++) {\n const rootImage = transcodeResult.fileInfo.images[i].levels[0];\n texture._invertVScale = texture.invertY;\n if (transcodeResult.format === -1 || transcodeResult.format === BASIS_FORMATS.cTFRGB565) {\n // No compatable compressed format found, fallback to RGB\n texture.type = 10;\n texture.format = 4;\n if (engine._features.basisNeedsPOT && (Math.log2(rootImage.width) % 1 !== 0 || Math.log2(rootImage.height) % 1 !== 0)) {\n // Create non power of two texture\n const source = new InternalTexture(engine, 2 /* InternalTextureSource.Temp */);\n texture._invertVScale = texture.invertY;\n source.type = 10;\n source.format = 4;\n // Fallback requires aligned width/height\n source.width = (rootImage.width + 3) & ~3;\n source.height = (rootImage.height + 3) & ~3;\n BindTexture(source, engine);\n engine._uploadDataToTextureDirectly(source, new Uint16Array(rootImage.transcodedPixels.buffer), i, 0, 4, true);\n // Resize to power of two\n engine._rescaleTexture(source, texture, engine.scenes[0], engine._getInternalFormat(4), () => {\n engine._releaseTexture(source);\n BindTexture(texture, engine);\n });\n }\n else {\n // Fallback is already inverted\n texture._invertVScale = !texture.invertY;\n // Upload directly\n texture.width = (rootImage.width + 3) & ~3;\n texture.height = (rootImage.height + 3) & ~3;\n texture.samplingMode = 2;\n BindTexture(texture, engine);\n engine._uploadDataToTextureDirectly(texture, new Uint16Array(rootImage.transcodedPixels.buffer), i, 0, 4, true);\n }\n }\n else {\n texture.width = rootImage.width;\n texture.height = rootImage.height;\n texture.generateMipMaps = transcodeResult.fileInfo.images[i].levels.length > 1;\n const format = BasisTools.GetInternalFormatFromBasisFormat(transcodeResult.format, engine);\n texture.format = format;\n BindTexture(texture, engine);\n // Upload all mip levels in the file\n const levels = transcodeResult.fileInfo.images[i].levels;\n for (let index = 0; index < levels.length; index++) {\n const level = levels[index];\n engine._uploadCompressedDataToTextureDirectly(texture, format, level.width, level.height, level.transcodedPixels, i, index);\n }\n if (engine._features.basisNeedsPOT && (Math.log2(texture.width) % 1 !== 0 || Math.log2(texture.height) % 1 !== 0)) {\n Tools.Warn(\"Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1.\");\n texture._cachedWrapU = Texture.CLAMP_ADDRESSMODE;\n texture._cachedWrapV = Texture.CLAMP_ADDRESSMODE;\n }\n }\n }\n};\n/**\n * Used to load .Basis files\n * See https://github.com/BinomialLLC/basis_universal/tree/master/webgl\n */\nexport const BasisTools = {\n /**\n * URL to use when loading the basis transcoder\n */\n JSModuleURL: BasisToolsOptions.JSModuleURL,\n /**\n * URL to use when loading the wasm module for the transcoder\n */\n WasmModuleURL: BasisToolsOptions.WasmModuleURL,\n /**\n * Get the internal format to be passed to texImage2D corresponding to the .basis format value\n * @param basisFormat format chosen from GetSupportedTranscodeFormat\n * @returns internal format corresponding to the Basis format\n */\n GetInternalFormatFromBasisFormat,\n /**\n * Transcodes a loaded image file to compressed pixel data\n * @param data image data to transcode\n * @param config configuration options for the transcoding\n * @returns a promise resulting in the transcoded image\n */\n TranscodeAsync,\n /**\n * Loads a texture from the transcode result\n * @param texture texture load to\n * @param transcodeResult the result of transcoding the basis file to load from\n */\n LoadTextureFromTranscodeResult,\n};\nObject.defineProperty(BasisTools, \"JSModuleURL\", {\n get: function () {\n return BasisToolsOptions.JSModuleURL;\n },\n set: function (value) {\n BasisToolsOptions.JSModuleURL = value;\n },\n});\nObject.defineProperty(BasisTools, \"WasmModuleURL\", {\n get: function () {\n return BasisToolsOptions.WasmModuleURL;\n },\n set: function (value) {\n BasisToolsOptions.WasmModuleURL = value;\n },\n});\n//# sourceMappingURL=basis.js.map","import { LoadTextureFromTranscodeResult, TranscodeAsync } from \"../../../Misc/basis.js\";\nimport { Tools } from \"../../../Misc/tools.js\";\n/**\n * Loader for .basis file format\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _BasisTextureLoader {\n constructor() {\n /**\n * Defines whether the loader supports cascade loading the different faces.\n */\n this.supportCascades = false;\n }\n /**\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param createPolynomials will be true if polynomials have been requested\n * @param onLoad defines the callback to trigger once the texture is ready\n * @param onError defines the callback to trigger in case of error\n */\n loadCubeData(data, texture, createPolynomials, onLoad, onError) {\n if (Array.isArray(data)) {\n return;\n }\n const caps = texture.getEngine().getCaps();\n const transcodeConfig = {\n supportedCompressionFormats: {\n etc1: caps.etc1 ? true : false,\n s3tc: caps.s3tc ? true : false,\n pvrtc: caps.pvrtc ? true : false,\n etc2: caps.etc2 ? true : false,\n astc: caps.astc ? true : false,\n bc7: caps.bptc ? true : false,\n },\n };\n TranscodeAsync(data, transcodeConfig)\n // eslint-disable-next-line github/no-then\n .then((result) => {\n const hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\n LoadTextureFromTranscodeResult(texture, result);\n texture.getEngine()._setCubeMapTextureParams(texture, hasMipmap);\n texture.isReady = true;\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n })\n // eslint-disable-next-line github/no-then\n .catch((err) => {\n const errorMessage = \"Failed to transcode Basis file, transcoding may not be supported on this device\";\n Tools.Warn(errorMessage);\n texture.isReady = true;\n if (onError) {\n onError(err);\n }\n });\n }\n /**\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param callback defines the method to call once ready to upload\n */\n loadData(data, texture, callback) {\n const caps = texture.getEngine().getCaps();\n const transcodeConfig = {\n supportedCompressionFormats: {\n etc1: caps.etc1 ? true : false,\n s3tc: caps.s3tc ? true : false,\n pvrtc: caps.pvrtc ? true : false,\n etc2: caps.etc2 ? true : false,\n astc: caps.astc ? true : false,\n bc7: caps.bptc ? true : false,\n },\n };\n TranscodeAsync(data, transcodeConfig)\n // eslint-disable-next-line github/no-then\n .then((result) => {\n const rootImage = result.fileInfo.images[0].levels[0];\n const hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\n callback(rootImage.width, rootImage.height, hasMipmap, result.format !== -1, () => {\n LoadTextureFromTranscodeResult(texture, result);\n });\n })\n // eslint-disable-next-line github/no-then\n .catch((err) => {\n Tools.Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\n Tools.Warn(`Failed to transcode Basis file: ${err}`);\n callback(0, 0, false, false, () => { }, true);\n });\n }\n}\n//# sourceMappingURL=basisTextureLoader.js.map"],"names":["workerFunction","_BASIS_FORMAT","transcoderModulePromise","event","e","m","config","imgData","loadedFile","fileInfo","GetFileInfo","format","GetSupportedTranscodeFormat","needsConversion","success","buffers","imageIndex","image","mipCount","levelIndex","levelInfo","pixels","TranscodeLevel","basisFile","hasAlpha","imageCount","images","i","imageInfo","levelCount","level","convertToRgb565","dstSize","dst","alignedWidth","alignedHeight","ConvertDxtToRgb565","src","srcByteOffset","width","height","c","blockWidth","blockHeight","blockY","blockX","row","dstI","initializeWebWorker","worker","wasmBinary","moduleUrl","res","reject","initHandler","msg","Tools","BASIS_FORMATS","BasisToolsOptions","GetInternalFormatFromBasisFormat","basisFormat","engine","WorkerPromise","LocalWorker","ActionId","IgnoreSupportedFormats","CreateWorkerAsync","workerBlobUrl","TranscodeAsync","data","dataView","rej","actionId","messageHandler","dataViewCopy","error","BindTexture","texture","target","_a","_b","LoadTextureFromTranscodeResult","transcodeResult","rootImage","source","InternalTexture","BasisTools","levels","index","Texture","value","_BasisTextureLoader","createPolynomials","onLoad","onError","caps","transcodeConfig","result","hasMipmap","err","callback"],"mappings":";AAKO,SAASA,IAAiB;AAC7B,QAAMC,IAAgB;AAAA,IAClB,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,IAGR,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,aAAa;AAAA,IAIb,WAAW;AAAA,EAQf;AACA,MAAIC,IAA0B;AAC9B,cAAY,CAACC,MAAU;AACnB,QAAIA,EAAM,KAAK,WAAW,QAAQ;AAE9B,UAAIA,EAAM,KAAK;AAEX,YAAI;AACA,wBAAcA,EAAM,KAAK,GAAG;AAAA,QAChD,SACuBC,GAAG;AACN,sBAAY,EAAE,QAAQ,SAAS,OAAOA,EAAC,CAAE;AAAA,QAC7D;AAEY,MAAKF,MACDA,IAA0B,MAAM;AAAA;AAAA,QAE5B,YAAYC,EAAM,KAAK;AAAA,MAC3C,CAAiB,IAEDD,MAA4B,QAE5BA,EAAwB,KAAK,CAACG,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AAAA,MAAA,GAAK,EAAI;AAAA,IACxD,CAAS;AAAA,EACT;AACA;","x_google_ignoreList":[0,1,2]}
@@ -0,0 +1 @@
1
+ {"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"src/graphty-element.ts","declarations":[{"kind":"class","description":"Graphty creates a graph","name":"Graphty","members":[{"kind":"field","name":"#graph","privacy":"private","type":{"text":"Graph"},"default":"new Graph(this.#element)"},{"kind":"field","name":"#element","privacy":"private","type":{"text":"Element"}},{"kind":"method","name":"asyncFirstUpdated","return":{"type":{"text":"Promise<void>"}},"parameters":[{"name":"changedProperties","type":{"text":"Map<string, unknown>"}}]},{"kind":"field","name":"nodeData","type":{"text":"Record<string, unknown>[] | undefined"},"description":"An array of objects describing the node data.\nThe path to the unique ID for the node is `.id` unless\notherwise specified in `known-properties`.","attribute":"node-data"},{"kind":"field","name":"edgeData","type":{"text":"Record<string, unknown>[] | undefined"},"description":"An array of objects describing the edge data.\nThe path to the source node ID and destination node ID are `src` and\n`dst` (respectively) unless otherwise specified in `known-properties`.","attribute":"edge-data"},{"kind":"field","name":"dataSource","type":{"text":"string | undefined"},"description":"The type of data source (e.g. \"json\"). See documentation for\ndata sources for more information.","attribute":"data-source"},{"kind":"field","name":"dataSourceConfig","type":{"text":"Record<string, unknown> | undefined"},"description":"The configuration for the data source. See documentation for\ndata sources for more information.","attribute":"data-source-config"},{"kind":"field","name":"nodeIdPath","type":{"text":"string | undefined"},"description":"A jmespath string that can be used to select the unique node identifier\nfor each node. Defaults to \"id\", as in `{id: 42}` is the identifier of\nthe node.","attribute":"node-id-path"},{"kind":"field","name":"edgeSrcIdPath","type":{"text":"string | undefined"},"description":"Similar to the nodeIdPath property / node-id-path attribute, this is a\njmespath that describes where to find the source node identifier for this edge.\nDefaults to \"src\", as in `{src: 42, dst: 31337}`","attribute":"edge-src-id-path"},{"kind":"field","name":"edgeDstIdPath","type":{"text":"string | undefined"},"description":"Similar to the nodeIdPath property / node-id-path attribute, this is a\njmespath that describes where to find the desination node identifier for this edge.\nDefaults to \"dst\", as in `{src: 42, dst: 31337}`","attribute":"edge-dst-id-path"},{"kind":"field","name":"layout","type":{"text":"string | undefined"},"description":"Specifies which type of layout to use. See the layout documentation for\nmore information.","attribute":"layout"},{"kind":"field","name":"layoutConfig","type":{"text":"Record<string, unknown> | undefined"},"description":"Specifies which type of layout to use. See the layout documentation for\nmore information.","attribute":"layout-config"},{"kind":"field","name":"layout2d","type":{"text":"boolean | undefined"},"description":"Specifies that the layout should be rendered in two dimensions (as\nopposed to 3D)","attribute":"layout-2d"},{"kind":"field","name":"styleTemplate","type":{"text":"StyleSchema | undefined"},"description":"Specifies that the layout should be rendered in two dimensions (as\nopposed to 3D)","attribute":"style-template"},{"kind":"field","name":"runAlgorithmsOnLoad","type":{"text":"boolean | undefined"},"description":"Whether or not to run all algorithims in a style template when the\ntemplate is loaded","attribute":"run-algorithms-on-load"}],"attributes":[{"name":"node-data","type":{"text":"Record<string, unknown>[] | undefined"},"description":"An array of objects describing the node data.\nThe path to the unique ID for the node is `.id` unless\notherwise specified in `known-properties`.","fieldName":"nodeData"},{"name":"edge-data","type":{"text":"Record<string, unknown>[] | undefined"},"description":"An array of objects describing the edge data.\nThe path to the source node ID and destination node ID are `src` and\n`dst` (respectively) unless otherwise specified in `known-properties`.","fieldName":"edgeData"},{"name":"data-source","type":{"text":"string | undefined"},"description":"The type of data source (e.g. \"json\"). See documentation for\ndata sources for more information.","fieldName":"dataSource"},{"name":"data-source-config","type":{"text":"Record<string, unknown> | undefined"},"description":"The configuration for the data source. See documentation for\ndata sources for more information.","fieldName":"dataSourceConfig"},{"name":"node-id-path","type":{"text":"string | undefined"},"description":"A jmespath string that can be used to select the unique node identifier\nfor each node. Defaults to \"id\", as in `{id: 42}` is the identifier of\nthe node.","fieldName":"nodeIdPath"},{"name":"edge-src-id-path","type":{"text":"string | undefined"},"description":"Similar to the nodeIdPath property / node-id-path attribute, this is a\njmespath that describes where to find the source node identifier for this edge.\nDefaults to \"src\", as in `{src: 42, dst: 31337}`","fieldName":"edgeSrcIdPath"},{"name":"edge-dst-id-path","type":{"text":"string | undefined"},"description":"Similar to the nodeIdPath property / node-id-path attribute, this is a\njmespath that describes where to find the desination node identifier for this edge.\nDefaults to \"dst\", as in `{src: 42, dst: 31337}`","fieldName":"edgeDstIdPath"},{"name":"layout","type":{"text":"string | undefined"},"description":"Specifies which type of layout to use. See the layout documentation for\nmore information.","fieldName":"layout"},{"name":"layout-config","type":{"text":"Record<string, unknown> | undefined"},"description":"Specifies which type of layout to use. See the layout documentation for\nmore information.","fieldName":"layoutConfig"},{"name":"layout-2d","type":{"text":"boolean | undefined"},"description":"Specifies that the layout should be rendered in two dimensions (as\nopposed to 3D)","fieldName":"layout2d"},{"name":"style-template","type":{"text":"StyleSchema | undefined"},"description":"Specifies that the layout should be rendered in two dimensions (as\nopposed to 3D)","fieldName":"styleTemplate"},{"name":"run-algorithms-on-load","type":{"text":"boolean | undefined"},"description":"Whether or not to run all algorithims in a style template when the\ntemplate is loaded","fieldName":"runAlgorithmsOnLoad"}],"superclass":{"name":"LitElement","package":"lit"},"tagName":"graphty-element","customElement":true}],"exports":[{"kind":"js","name":"Graphty","declaration":{"name":"Graphty","module":"src/graphty-element.ts"}},{"kind":"custom-element-definition","name":"graphty-element","declaration":{"name":"Graphty","module":"src/graphty-element.ts"}}]}]}