@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
@@ -0,0 +1,238 @@
1
+ import { c as B, a as z, V as m, I as O, B as S, e as G, g as V, P as k } from "./index-ChGTkj2q.js";
2
+ import "./dumpTools-DA1xMSIZ.js";
3
+ const R = "image/png", F = 2, D = [134, 22, 135, 150, 246, 214, 150, 54];
4
+ function H(e) {
5
+ const t = new DataView(e.buffer, e.byteOffset, e.byteLength);
6
+ let n = 0;
7
+ for (let r = 0; r < D.length; r++)
8
+ if (t.getUint8(n++) !== D[r])
9
+ return B.Error("Not a babylon environment map"), null;
10
+ let i = "", o = 0;
11
+ for (; o = t.getUint8(n++); )
12
+ i += String.fromCharCode(o);
13
+ let a = JSON.parse(i);
14
+ return a = A(a), a.binaryDataPosition = n, a.specular && (a.specular.lodGenerationScale = a.specular.lodGenerationScale || 0.8), a;
15
+ }
16
+ function A(e) {
17
+ if (e.version > F)
18
+ throw new Error(`Unsupported babylon environment map version "${e.version}". Latest supported version is "${F}".`);
19
+ return e.version === 2 || (e = { ...e, version: 2, imageType: R }), e;
20
+ }
21
+ function E(e, t) {
22
+ t = A(t);
23
+ const n = t.specular;
24
+ let i = Math.log2(t.width);
25
+ if (i = Math.round(i) + 1, n.mipmaps.length !== 6 * i)
26
+ throw new Error(`Unsupported specular mipmaps number "${n.mipmaps.length}"`);
27
+ const o = new Array(i);
28
+ for (let a = 0; a < i; a++) {
29
+ o[a] = new Array(6);
30
+ for (let r = 0; r < 6; r++) {
31
+ const s = n.mipmaps[a * 6 + r];
32
+ o[a][r] = new Uint8Array(e.buffer, e.byteOffset + t.binaryDataPosition + s.position, s.length);
33
+ }
34
+ }
35
+ return o;
36
+ }
37
+ function N(e, t) {
38
+ var o;
39
+ t = A(t);
40
+ const n = new Array(6), i = (o = t.irradiance) == null ? void 0 : o.irradianceTexture;
41
+ if (i) {
42
+ if (i.faces.length !== 6)
43
+ throw new Error(`Incorrect irradiance texture faces number "${i.faces.length}"`);
44
+ for (let a = 0; a < 6; a++) {
45
+ const r = i.faces[a];
46
+ n[a] = new Uint8Array(e.buffer, e.byteOffset + t.binaryDataPosition + r.position, r.length);
47
+ }
48
+ }
49
+ return n;
50
+ }
51
+ function P(e, t, n) {
52
+ var s, f, c;
53
+ n = A(n);
54
+ const i = n.specular;
55
+ if (!i)
56
+ return Promise.resolve([]);
57
+ e._lodGenerationScale = i.lodGenerationScale;
58
+ const o = [], a = E(t, n);
59
+ o.push($(e, a, n.imageType));
60
+ const r = (s = n.irradiance) == null ? void 0 : s.irradianceTexture;
61
+ if (r) {
62
+ const g = N(t, n);
63
+ let d = null;
64
+ (c = (f = n.irradiance) == null ? void 0 : f.irradianceTexture) != null && c.dominantDirection && (d = m.FromArray(n.irradiance.irradianceTexture.dominantDirection)), o.push(Y(e, g, r.size, n.imageType, d));
65
+ }
66
+ return Promise.all(o);
67
+ }
68
+ async function C(e, t, n, i, o, a, r, s, f, c, g) {
69
+ return await new Promise((d, I) => {
70
+ if (n) {
71
+ const h = t.createTexture(null, !0, !0, null, 1, null, (l) => {
72
+ I(l);
73
+ }, e);
74
+ i == null || i.onEffectCreatedObservable.addOnce((l) => {
75
+ l.executeWhenCompiled(() => {
76
+ i.externalTextureSamplerBinding = !0, i.onApply = (u) => {
77
+ u._bindTexture("textureSampler", h), u.setFloat2("scale", 1, t._features.needsInvertingBitmap && e instanceof ImageBitmap ? -1 : 1);
78
+ }, t.scenes.length && (t.scenes[0].postProcessManager.directRender([i], c, !0, a, r), t.restoreDefaultFramebuffer(), h.dispose(), URL.revokeObjectURL(o), d());
79
+ });
80
+ });
81
+ } else {
82
+ if (t._uploadImageToTexture(g, e, a, r), s) {
83
+ const h = f[r];
84
+ h && t._uploadImageToTexture(h._texture, e, a, 0);
85
+ }
86
+ d();
87
+ }
88
+ });
89
+ }
90
+ async function $(e, t, n = R) {
91
+ const i = e.getEngine();
92
+ e.format = 5, e.type = 0, e.generateMipMaps = !0, e._cachedAnisotropicFilteringLevel = null, i.updateTextureSamplingMode(3, e), await U(e, t, !0, n), e.isReady = !0;
93
+ }
94
+ async function Y(e, t, n, i = R, o = null) {
95
+ const a = e.getEngine(), r = new O(
96
+ a,
97
+ 5
98
+ /* InternalTextureSource.RenderTarget */
99
+ ), s = new S(a, r);
100
+ e._irradianceTexture = s, s._dominantDirection = o, r.isCube = !0, r.format = 5, r.type = 0, r.generateMipMaps = !0, r._cachedAnisotropicFilteringLevel = null, r.generateMipMaps = !0, r.width = n, r.height = n, a.updateTextureSamplingMode(3, r), await U(r, [t], !1, i), a.generateMipMapsForCubemap(r), r.isReady = !0;
101
+ }
102
+ async function U(e, t, n, i = R) {
103
+ if (!G.IsExponentOfTwo(e.width))
104
+ throw new Error("Texture size must be a power of two");
105
+ const o = V(e.width) + 1, a = e.getEngine();
106
+ let r = !1, s = !1, f = null, c = null, g = null;
107
+ const d = a.getCaps();
108
+ d.textureLOD ? a._features.supportRenderAndCopyToLodForFloatTextures ? d.textureHalfFloatRender && d.textureHalfFloatLinearFiltering ? (r = !0, e.type = 2) : d.textureFloatRender && d.textureFloatLinearFiltering && (r = !0, e.type = 1) : r = !1 : (r = !1, s = n);
109
+ let I = 0;
110
+ if (r)
111
+ a.isWebGPU ? (I = 1, await import("./rgbdDecode.fragment-bNaGtQ-x.js")) : await import("./rgbdDecode.fragment-koAcppx0.js"), f = new k("rgbdDecode", "rgbdDecode", null, null, 1, null, 3, a, !1, void 0, e.type, void 0, null, !1, void 0, I), e._isRGBD = !1, e.invertY = !1, c = a.createRenderTargetCubeTexture(e.width, {
112
+ generateDepthBuffer: !1,
113
+ generateMipMaps: !0,
114
+ generateStencilBuffer: !1,
115
+ samplingMode: 3,
116
+ type: e.type,
117
+ format: 5
118
+ });
119
+ else if (e._isRGBD = !0, e.invertY = !0, s) {
120
+ g = {};
121
+ const u = e._lodGenerationScale, T = e._lodGenerationOffset;
122
+ for (let p = 0; p < 3; p++) {
123
+ const x = 1 - p / 2, y = T, L = (o - 1) * u + T, M = y + (L - y) * x, b = Math.round(Math.min(Math.max(M, 0), L)), v = new O(
124
+ a,
125
+ 2
126
+ /* InternalTextureSource.Temp */
127
+ );
128
+ v.isCube = !0, v.invertY = !0, v.generateMipMaps = !1, a.updateTextureSamplingMode(2, v);
129
+ const _ = new S(null);
130
+ switch (_._isCube = !0, _._texture = v, g[b] = _, p) {
131
+ case 0:
132
+ e._lodTextureLow = _;
133
+ break;
134
+ case 1:
135
+ e._lodTextureMid = _;
136
+ break;
137
+ case 2:
138
+ e._lodTextureHigh = _;
139
+ break;
140
+ }
141
+ }
142
+ }
143
+ const h = [];
144
+ for (let l = 0; l < t.length; l++)
145
+ for (let u = 0; u < 6; u++) {
146
+ const T = t[l][u], p = new Blob([T], { type: i }), w = URL.createObjectURL(p);
147
+ let x;
148
+ if (a._features.forceBitmapOverHTMLImageElement)
149
+ x = a.createImageBitmap(p, { premultiplyAlpha: "none" }).then(async (y) => await C(y, a, r, f, w, u, l, s, g, c, e));
150
+ else {
151
+ const y = new Image();
152
+ y.src = w, x = new Promise((L, M) => {
153
+ y.onload = () => {
154
+ C(y, a, r, f, w, u, l, s, g, c, e).then(() => L()).catch((b) => {
155
+ M(b);
156
+ });
157
+ }, y.onerror = (b) => {
158
+ M(b);
159
+ };
160
+ });
161
+ }
162
+ h.push(x);
163
+ }
164
+ if (await Promise.all(h), t.length < o) {
165
+ let l;
166
+ const u = Math.pow(2, o - 1 - t.length), T = u * u * 4;
167
+ switch (e.type) {
168
+ case 0: {
169
+ l = new Uint8Array(T);
170
+ break;
171
+ }
172
+ case 2: {
173
+ l = new Uint16Array(T);
174
+ break;
175
+ }
176
+ case 1: {
177
+ l = new Float32Array(T);
178
+ break;
179
+ }
180
+ }
181
+ for (let p = t.length; p < o; p++)
182
+ for (let w = 0; w < 6; w++)
183
+ a._uploadArrayBufferViewToTexture((c == null ? void 0 : c.texture) || e, l, w, p);
184
+ }
185
+ if (c) {
186
+ const l = e._irradianceTexture;
187
+ e._irradianceTexture = null, a._releaseTexture(e), c._swapAndDie(e), e._irradianceTexture = l;
188
+ }
189
+ f && f.dispose(), s && (e._lodTextureHigh && e._lodTextureHigh._texture && (e._lodTextureHigh._texture.isReady = !0), e._lodTextureMid && e._lodTextureMid._texture && (e._lodTextureMid._texture.isReady = !0), e._lodTextureLow && e._lodTextureLow._texture && (e._lodTextureLow._texture.isReady = !0));
190
+ }
191
+ function W(e, t) {
192
+ t = A(t);
193
+ const n = t.irradiance;
194
+ if (!n)
195
+ return;
196
+ const i = new z();
197
+ m.FromArrayToRef(n.x, 0, i.x), m.FromArrayToRef(n.y, 0, i.y), m.FromArrayToRef(n.z, 0, i.z), m.FromArrayToRef(n.xx, 0, i.xx), m.FromArrayToRef(n.yy, 0, i.yy), m.FromArrayToRef(n.zz, 0, i.zz), m.FromArrayToRef(n.yz, 0, i.yz), m.FromArrayToRef(n.zx, 0, i.zx), m.FromArrayToRef(n.xy, 0, i.xy), e._sphericalPolynomial = i;
198
+ }
199
+ class q {
200
+ constructor() {
201
+ this.supportCascades = !1;
202
+ }
203
+ /**
204
+ * Uploads the cube texture data to the WebGL texture. It has already been bound.
205
+ * @param data contains the texture data
206
+ * @param texture defines the BabylonJS internal texture
207
+ * @param createPolynomials will be true if polynomials have been requested
208
+ * @param onLoad defines the callback to trigger once the texture is ready
209
+ * @param onError defines the callback to trigger in case of error
210
+ */
211
+ loadCubeData(t, n, i, o, a) {
212
+ if (Array.isArray(t))
213
+ return;
214
+ const r = H(t);
215
+ if (r) {
216
+ n.width = r.width, n.height = r.width;
217
+ try {
218
+ W(n, r), P(n, t, r).then(() => {
219
+ n.isReady = !0, n.onLoadedObservable.notifyObservers(n), n.onLoadedObservable.clear(), o && o();
220
+ }, (s) => {
221
+ a == null || a("Can not upload environment levels", s);
222
+ });
223
+ } catch (s) {
224
+ a == null || a("Can not upload environment file", s);
225
+ }
226
+ } else a && a("Can not parse the environment file", null);
227
+ }
228
+ /**
229
+ * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.
230
+ */
231
+ loadData() {
232
+ throw ".env not supported in 2d.";
233
+ }
234
+ }
235
+ export {
236
+ q as _ENVTextureLoader
237
+ };
238
+ //# sourceMappingURL=envTextureLoader-DdCLpySN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envTextureLoader-DdCLpySN.js","sources":["../node_modules/@babylonjs/core/Misc/environmentTextureTools.js","../node_modules/@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js"],"sourcesContent":["import { Tools } from \"./tools.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { ILog2 } from \"../Maths/math.scalar.functions.js\";\nimport { SphericalPolynomial } from \"../Maths/sphericalPolynomial.js\";\nimport { InternalTexture } from \"../Materials/Textures/internalTexture.js\";\nimport { BaseTexture } from \"../Materials/Textures/baseTexture.js\";\n\nimport { Scene } from \"../scene.js\";\nimport { PostProcess } from \"../PostProcesses/postProcess.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { RGBDTextureTools } from \"./rgbdTextureTools.js\";\nimport { DumpDataAsync } from \"../Misc/dumpTools.js\";\nimport \"../Materials/Textures/baseTexture.polynomial.js\";\nconst DefaultEnvironmentTextureImageType = \"image/png\";\nconst CurrentVersion = 2;\n/**\n * Magic number identifying the env file.\n */\nconst MagicBytes = [0x86, 0x16, 0x87, 0x96, 0xf6, 0xd6, 0x96, 0x36];\n/**\n * Gets the environment info from an env file.\n * @param data The array buffer containing the .env bytes.\n * @returns the environment file info (the json header) if successfully parsed, normalized to the latest supported version.\n */\nexport function GetEnvInfo(data) {\n const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\n let pos = 0;\n for (let i = 0; i < MagicBytes.length; i++) {\n if (dataView.getUint8(pos++) !== MagicBytes[i]) {\n Logger.Error(\"Not a babylon environment map\");\n return null;\n }\n }\n // Read json manifest - collect characters up to null terminator\n let manifestString = \"\";\n let charCode = 0x00;\n while ((charCode = dataView.getUint8(pos++))) {\n manifestString += String.fromCharCode(charCode);\n }\n let manifest = JSON.parse(manifestString);\n manifest = normalizeEnvInfo(manifest);\n // Extend the header with the position of the payload.\n manifest.binaryDataPosition = pos;\n if (manifest.specular) {\n // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.\n manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;\n }\n return manifest;\n}\n/**\n * Normalizes any supported version of the environment file info to the latest version\n * @param info environment file info on any supported version\n * @returns environment file info in the latest supported version\n * @private\n */\nexport function normalizeEnvInfo(info) {\n if (info.version > CurrentVersion) {\n throw new Error(`Unsupported babylon environment map version \"${info.version}\". Latest supported version is \"${CurrentVersion}\".`);\n }\n if (info.version === 2) {\n return info;\n }\n // Migrate a v1 info to v2\n info = { ...info, version: 2, imageType: DefaultEnvironmentTextureImageType };\n return info;\n}\n/**\n * Creates an environment texture from a loaded cube texture.\n * @param texture defines the cube texture to convert in env file\n * @param options options for the conversion process\n * @returns a promise containing the environment data if successful.\n */\nexport async function CreateEnvTextureAsync(texture, options = {}) {\n const internalTexture = texture.getInternalTexture();\n if (!internalTexture) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return await Promise.reject(\"The cube texture is invalid.\");\n }\n const engine = internalTexture.getEngine();\n if (texture.textureType !== 2 &&\n texture.textureType !== 1 &&\n texture.textureType !== 0 &&\n texture.textureType !== 0 &&\n texture.textureType !== 7 &&\n texture.textureType !== -1) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return await Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\");\n }\n let textureType = 1;\n if (!engine.getCaps().textureFloatRender) {\n textureType = 2;\n if (!engine.getCaps().textureHalfFloatRender) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n return await Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\");\n }\n }\n // sphericalPolynomial is lazy loaded so simply accessing it should trigger the computation.\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n texture.sphericalPolynomial;\n // Lets keep track of the polynomial promise so we can wait for it to be ready before generating the pixels.\n const sphericalPolynomialPromise = texture.getInternalTexture()?._sphericalPolynomialPromise;\n const cubeWidth = internalTexture.width;\n const hostingScene = new Scene(engine);\n const specularTextures = {};\n const diffuseTextures = {};\n // As we are going to readPixels the faces of the cube, make sure the drawing/update commands for the cube texture are fully sent to the GPU in case it is drawn for the first time in this very frame!\n engine.flushFramebuffer();\n const imageType = options.imageType ?? DefaultEnvironmentTextureImageType;\n // Read and collect all mipmaps data from the cube.\n const mipmapsCount = ILog2(internalTexture.width);\n for (let i = 0; i <= mipmapsCount; i++) {\n const faceWidth = Math.pow(2, mipmapsCount - i);\n // All faces of the cube.\n for (let face = 0; face < 6; face++) {\n // eslint-disable-next-line no-await-in-loop\n specularTextures[i * 6 + face] = await _GetTextureEncodedDataAsync(hostingScene, texture, textureType, face, i, faceWidth, imageType, options.imageQuality);\n }\n }\n // Read and collect all irradiance data from the cube.\n const irradianceTexture = options.disableIrradianceTexture ? null : texture.irradianceTexture;\n if (irradianceTexture) {\n const faceWidth = irradianceTexture.getSize().width;\n // All faces of the cube.\n for (let face = 0; face < 6; face++) {\n // eslint-disable-next-line no-await-in-loop\n diffuseTextures[face] = await _GetTextureEncodedDataAsync(hostingScene, irradianceTexture, textureType, face, 0, faceWidth, imageType, options.imageQuality);\n }\n }\n // We can delete the hosting scene keeping track of all the creation objects\n hostingScene.dispose();\n // Ensure completion of the polynomial creation promise.\n if (sphericalPolynomialPromise) {\n await sphericalPolynomialPromise;\n }\n // Creates the json header for the env texture\n const info = {\n version: CurrentVersion,\n width: cubeWidth,\n imageType,\n irradiance: CreateEnvTextureIrradiance(texture),\n specular: {\n mipmaps: [],\n lodGenerationScale: texture.lodGenerationScale,\n },\n };\n // Sets the specular image data information\n let position = 0;\n for (let i = 0; i <= mipmapsCount; i++) {\n for (let face = 0; face < 6; face++) {\n const byteLength = specularTextures[i * 6 + face].byteLength;\n info.specular.mipmaps.push({\n length: byteLength,\n position: position,\n });\n position += byteLength;\n }\n }\n // Sets the irradiance image data information\n if (irradianceTexture) {\n info.irradiance = info.irradiance || {\n x: [0, 0, 0],\n xx: [0, 0, 0],\n y: [0, 0, 0],\n yy: [0, 0, 0],\n z: [0, 0, 0],\n zz: [0, 0, 0],\n yz: [0, 0, 0],\n zx: [0, 0, 0],\n xy: [0, 0, 0],\n };\n info.irradiance.irradianceTexture = {\n size: irradianceTexture.getSize().width,\n faces: [],\n dominantDirection: irradianceTexture._dominantDirection?.asArray(),\n };\n for (let face = 0; face < 6; face++) {\n const byteLength = diffuseTextures[face].byteLength;\n info.irradiance.irradianceTexture.faces.push({\n length: byteLength,\n position: position,\n });\n position += byteLength;\n }\n }\n // Encode the JSON as an array buffer\n const infoString = JSON.stringify(info);\n const infoBuffer = new ArrayBuffer(infoString.length + 1);\n const infoView = new Uint8Array(infoBuffer); // Limited to ascii subset matching unicode.\n for (let i = 0, strLen = infoString.length; i < strLen; i++) {\n infoView[i] = infoString.charCodeAt(i);\n }\n // Ends up with a null terminator for easier parsing\n infoView[infoString.length] = 0x00;\n // Computes the final required size and creates the storage\n const totalSize = MagicBytes.length + position + infoBuffer.byteLength;\n const finalBuffer = new ArrayBuffer(totalSize);\n const finalBufferView = new Uint8Array(finalBuffer);\n const dataView = new DataView(finalBuffer);\n // Copy the magic bytes identifying the file in\n let pos = 0;\n for (let i = 0; i < MagicBytes.length; i++) {\n dataView.setUint8(pos++, MagicBytes[i]);\n }\n // Add the json info\n finalBufferView.set(new Uint8Array(infoBuffer), pos);\n pos += infoBuffer.byteLength;\n // Finally inserts the radiance texture data\n for (let i = 0; i <= mipmapsCount; i++) {\n for (let face = 0; face < 6; face++) {\n const dataBuffer = specularTextures[i * 6 + face];\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\n pos += dataBuffer.byteLength;\n }\n }\n // Finally inserts the irradiance texture data\n if (irradianceTexture) {\n for (let face = 0; face < 6; face++) {\n const dataBuffer = diffuseTextures[face];\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\n pos += dataBuffer.byteLength;\n }\n }\n // Voila\n return finalBuffer;\n}\n/**\n * Get the texture encoded data from the current texture\n * @internal\n */\nasync function _GetTextureEncodedDataAsync(hostingScene, texture, textureType, face, i, size, imageType, imageQuality) {\n let faceData = await texture.readPixels(face, i, undefined, false);\n if (faceData && faceData.byteLength === faceData.length) {\n const faceDataFloat = new Float32Array(faceData.byteLength * 4);\n for (let i = 0; i < faceData.byteLength; i++) {\n faceDataFloat[i] = faceData[i] / 255;\n // Gamma to linear\n faceDataFloat[i] = Math.pow(faceDataFloat[i], 2.2);\n }\n faceData = faceDataFloat;\n }\n else if (faceData && texture.gammaSpace) {\n const floatData = faceData;\n for (let i = 0; i < floatData.length; i++) {\n // Gamma to linear\n floatData[i] = Math.pow(floatData[i], 2.2);\n }\n }\n const engine = hostingScene.getEngine();\n const tempTexture = engine.createRawTexture(faceData, size, size, 5, false, true, 1, null, textureType);\n await RGBDTextureTools.EncodeTextureToRGBD(tempTexture, hostingScene, textureType);\n const rgbdEncodedData = await engine._readTexturePixels(tempTexture, size, size);\n const imageEncodedData = await DumpDataAsync(size, size, rgbdEncodedData, imageType, undefined, false, true, imageQuality);\n tempTexture.dispose();\n return imageEncodedData;\n}\n/**\n * Creates a JSON representation of the spherical data.\n * @param texture defines the texture containing the polynomials\n * @returns the JSON representation of the spherical info\n */\nfunction CreateEnvTextureIrradiance(texture) {\n const polynmials = texture.sphericalPolynomial;\n if (polynmials == null) {\n return null;\n }\n return {\n x: [polynmials.x.x, polynmials.x.y, polynmials.x.z],\n y: [polynmials.y.x, polynmials.y.y, polynmials.y.z],\n z: [polynmials.z.x, polynmials.z.y, polynmials.z.z],\n xx: [polynmials.xx.x, polynmials.xx.y, polynmials.xx.z],\n yy: [polynmials.yy.x, polynmials.yy.y, polynmials.yy.z],\n zz: [polynmials.zz.x, polynmials.zz.y, polynmials.zz.z],\n yz: [polynmials.yz.x, polynmials.yz.y, polynmials.yz.z],\n zx: [polynmials.zx.x, polynmials.zx.y, polynmials.zx.z],\n xy: [polynmials.xy.x, polynmials.xy.y, polynmials.xy.z],\n };\n}\n/**\n * Creates the ArrayBufferViews used for initializing environment texture image data.\n * @param data the image data\n * @param info parameters that determine what views will be created for accessing the underlying buffer\n * @returns the views described by info providing access to the underlying buffer\n */\nexport function CreateRadianceImageDataArrayBufferViews(data, info) {\n info = normalizeEnvInfo(info);\n const specularInfo = info.specular;\n // Double checks the enclosed info\n let mipmapsCount = Math.log2(info.width);\n mipmapsCount = Math.round(mipmapsCount) + 1;\n if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {\n throw new Error(`Unsupported specular mipmaps number \"${specularInfo.mipmaps.length}\"`);\n }\n const imageData = new Array(mipmapsCount);\n for (let i = 0; i < mipmapsCount; i++) {\n imageData[i] = new Array(6);\n for (let face = 0; face < 6; face++) {\n const imageInfo = specularInfo.mipmaps[i * 6 + face];\n imageData[i][face] = new Uint8Array(data.buffer, data.byteOffset + info.binaryDataPosition + imageInfo.position, imageInfo.length);\n }\n }\n return imageData;\n}\n/**\n * Creates the ArrayBufferViews used for initializing environment texture image data.\n * @param data the image data\n * @param info parameters that determine what views will be created for accessing the underlying buffer\n * @returns the views described by info providing access to the underlying buffer\n */\nexport function CreateIrradianceImageDataArrayBufferViews(data, info) {\n info = normalizeEnvInfo(info);\n const imageData = new Array(6);\n const irradianceTexture = info.irradiance?.irradianceTexture;\n if (irradianceTexture) {\n if (irradianceTexture.faces.length !== 6) {\n throw new Error(`Incorrect irradiance texture faces number \"${irradianceTexture.faces.length}\"`);\n }\n for (let face = 0; face < 6; face++) {\n const imageInfo = irradianceTexture.faces[face];\n imageData[face] = new Uint8Array(data.buffer, data.byteOffset + info.binaryDataPosition + imageInfo.position, imageInfo.length);\n }\n }\n return imageData;\n}\n/**\n * Uploads the texture info contained in the env file to the GPU.\n * @param texture defines the internal texture to upload to\n * @param data defines the data to load\n * @param info defines the texture info retrieved through the GetEnvInfo method\n * @returns a promise\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function UploadEnvLevelsAsync(texture, data, info) {\n info = normalizeEnvInfo(info);\n const specularInfo = info.specular;\n if (!specularInfo) {\n // Nothing else parsed so far\n return Promise.resolve([]);\n }\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\n const promises = [];\n const radianceImageData = CreateRadianceImageDataArrayBufferViews(data, info);\n promises.push(UploadRadianceLevelsAsync(texture, radianceImageData, info.imageType));\n const irradianceTexture = info.irradiance?.irradianceTexture;\n if (irradianceTexture) {\n const irradianceImageData = CreateIrradianceImageDataArrayBufferViews(data, info);\n let dominantDirection = null;\n if (info.irradiance?.irradianceTexture?.dominantDirection) {\n dominantDirection = Vector3.FromArray(info.irradiance.irradianceTexture.dominantDirection);\n }\n promises.push(UploadIrradianceLevelsAsync(texture, irradianceImageData, irradianceTexture.size, info.imageType, dominantDirection));\n }\n return Promise.all(promises);\n}\nasync function _OnImageReadyAsync(image, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture) {\n return await new Promise((resolve, reject) => {\n if (expandTexture) {\n const tempTexture = engine.createTexture(null, true, true, null, 1, null, (message) => {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(message);\n }, image);\n rgbdPostProcess?.onEffectCreatedObservable.addOnce((effect) => {\n effect.executeWhenCompiled(() => {\n // Uncompress the data to a RTT\n rgbdPostProcess.externalTextureSamplerBinding = true;\n rgbdPostProcess.onApply = (effect) => {\n effect._bindTexture(\"textureSampler\", tempTexture);\n effect.setFloat2(\"scale\", 1, engine._features.needsInvertingBitmap && image instanceof ImageBitmap ? -1 : 1);\n };\n if (!engine.scenes.length) {\n return;\n }\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess], cubeRtt, true, face, i);\n // Cleanup\n engine.restoreDefaultFramebuffer();\n tempTexture.dispose();\n URL.revokeObjectURL(url);\n resolve();\n });\n });\n }\n else {\n engine._uploadImageToTexture(texture, image, face, i);\n // Upload the face to the non lod texture support\n if (generateNonLODTextures) {\n const lodTexture = lodTextures[i];\n if (lodTexture) {\n engine._uploadImageToTexture(lodTexture._texture, image, face, 0);\n }\n }\n resolve();\n }\n });\n}\n/**\n * Uploads the levels of image data to the GPU.\n * @param texture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param imageType the mime type of the image data\n * @returns a promise\n */\nexport async function UploadRadianceLevelsAsync(texture, imageData, imageType = DefaultEnvironmentTextureImageType) {\n const engine = texture.getEngine();\n texture.format = 5;\n texture.type = 0;\n texture.generateMipMaps = true;\n texture._cachedAnisotropicFilteringLevel = null;\n engine.updateTextureSamplingMode(3, texture);\n await _UploadLevelsAsync(texture, imageData, true, imageType);\n // Flag internal texture as ready in case they are in use.\n texture.isReady = true;\n}\n/**\n * Uploads the levels of image data to the GPU.\n * @param mainTexture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param size defines the size of the texture faces\n * @param imageType the mime type of the image data\n * @param dominantDirection the dominant direction of light in the environment texture, if available\n * @returns a promise\n */\nexport async function UploadIrradianceLevelsAsync(mainTexture, imageData, size, imageType = DefaultEnvironmentTextureImageType, dominantDirection = null) {\n // Gets everything ready.\n const engine = mainTexture.getEngine();\n const texture = new InternalTexture(engine, 5 /* InternalTextureSource.RenderTarget */);\n const baseTexture = new BaseTexture(engine, texture);\n mainTexture._irradianceTexture = baseTexture;\n baseTexture._dominantDirection = dominantDirection;\n texture.isCube = true;\n texture.format = 5;\n texture.type = 0;\n texture.generateMipMaps = true;\n texture._cachedAnisotropicFilteringLevel = null;\n texture.generateMipMaps = true;\n texture.width = size;\n texture.height = size;\n engine.updateTextureSamplingMode(3, texture);\n await _UploadLevelsAsync(texture, [imageData], false, imageType);\n engine.generateMipMapsForCubemap(texture);\n // Flag internal texture as ready in case they are in use.\n texture.isReady = true;\n}\n/**\n * Uploads the levels of image data to the GPU.\n * @param texture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param canGenerateNonLODTextures defines whether or not to generate non lod textures\n * @param imageType the mime type of the image data\n * @returns a promise\n */\nasync function _UploadLevelsAsync(texture, imageData, canGenerateNonLODTextures, imageType = DefaultEnvironmentTextureImageType) {\n if (!Tools.IsExponentOfTwo(texture.width)) {\n throw new Error(\"Texture size must be a power of two\");\n }\n const mipmapsCount = ILog2(texture.width) + 1;\n // Gets everything ready.\n const engine = texture.getEngine();\n let expandTexture = false;\n let generateNonLODTextures = false;\n let rgbdPostProcess = null;\n let cubeRtt = null;\n let lodTextures = null;\n const caps = engine.getCaps();\n if (!caps.textureLOD) {\n expandTexture = false;\n generateNonLODTextures = canGenerateNonLODTextures;\n }\n else if (!engine._features.supportRenderAndCopyToLodForFloatTextures) {\n expandTexture = false;\n }\n // If half float available we can uncompress the texture\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\n expandTexture = true;\n texture.type = 2;\n }\n // If full float available we can uncompress the texture\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\n expandTexture = true;\n texture.type = 1;\n }\n // Expand the texture if possible\n let shaderLanguage = 0 /* ShaderLanguage.GLSL */;\n if (expandTexture) {\n if (engine.isWebGPU) {\n shaderLanguage = 1 /* ShaderLanguage.WGSL */;\n await import(\"../ShadersWGSL/rgbdDecode.fragment.js\");\n }\n else {\n await import(\"../Shaders/rgbdDecode.fragment.js\");\n }\n // Simply run through the decode PP\n rgbdPostProcess = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, texture.type, undefined, null, false, undefined, shaderLanguage);\n texture._isRGBD = false;\n texture.invertY = false;\n cubeRtt = engine.createRenderTargetCubeTexture(texture.width, {\n generateDepthBuffer: false,\n generateMipMaps: true,\n generateStencilBuffer: false,\n samplingMode: 3,\n type: texture.type,\n format: 5,\n });\n }\n else {\n texture._isRGBD = true;\n texture.invertY = true;\n // In case of missing support, applies the same patch than DDS files.\n if (generateNonLODTextures) {\n const mipSlices = 3;\n lodTextures = {};\n const scale = texture._lodGenerationScale;\n const offset = texture._lodGenerationOffset;\n for (let i = 0; i < mipSlices; i++) {\n //compute LOD from even spacing in smoothness (matching shader calculation)\n const smoothness = i / (mipSlices - 1);\n const roughness = 1 - smoothness;\n const minLODIndex = offset; // roughness = 0\n const maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)\n const lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\n const mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\n //compute LOD from even spacing in smoothness (matching shader calculation)\n const glTextureFromLod = new InternalTexture(engine, 2 /* InternalTextureSource.Temp */);\n glTextureFromLod.isCube = true;\n glTextureFromLod.invertY = true;\n glTextureFromLod.generateMipMaps = false;\n engine.updateTextureSamplingMode(2, glTextureFromLod);\n // Wrap in a base texture for easy binding.\n const lodTexture = new BaseTexture(null);\n lodTexture._isCube = true;\n lodTexture._texture = glTextureFromLod;\n lodTextures[mipmapIndex] = lodTexture;\n switch (i) {\n case 0:\n texture._lodTextureLow = lodTexture;\n break;\n case 1:\n texture._lodTextureMid = lodTexture;\n break;\n case 2:\n texture._lodTextureHigh = lodTexture;\n break;\n }\n }\n }\n }\n const promises = [];\n // All mipmaps up to provided number of images\n for (let i = 0; i < imageData.length; i++) {\n // All faces\n for (let face = 0; face < 6; face++) {\n // Constructs an image element from image data\n const bytes = imageData[i][face];\n const blob = new Blob([bytes], { type: imageType });\n const url = URL.createObjectURL(blob);\n let promise;\n if (engine._features.forceBitmapOverHTMLImageElement) {\n // eslint-disable-next-line github/no-then\n promise = engine.createImageBitmap(blob, { premultiplyAlpha: \"none\" }).then(async (img) => {\n return await _OnImageReadyAsync(img, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture);\n });\n }\n else {\n const image = new Image();\n image.src = url;\n // Enqueue promise to upload to the texture.\n promise = new Promise((resolve, reject) => {\n image.onload = () => {\n _OnImageReadyAsync(image, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture)\n // eslint-disable-next-line github/no-then\n .then(() => resolve())\n // eslint-disable-next-line github/no-then\n .catch((reason) => {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(reason);\n });\n };\n image.onerror = (error) => {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n };\n });\n }\n promises.push(promise);\n }\n }\n await Promise.all(promises);\n // Fill remaining mipmaps with black textures.\n if (imageData.length < mipmapsCount) {\n let data;\n const size = Math.pow(2, mipmapsCount - 1 - imageData.length);\n const dataLength = size * size * 4;\n switch (texture.type) {\n case 0: {\n data = new Uint8Array(dataLength);\n break;\n }\n case 2: {\n data = new Uint16Array(dataLength);\n break;\n }\n case 1: {\n data = new Float32Array(dataLength);\n break;\n }\n }\n for (let i = imageData.length; i < mipmapsCount; i++) {\n for (let face = 0; face < 6; face++) {\n engine._uploadArrayBufferViewToTexture(cubeRtt?.texture || texture, data, face, i);\n }\n }\n }\n // Release temp RTT.\n if (cubeRtt) {\n const irradiance = texture._irradianceTexture;\n texture._irradianceTexture = null;\n engine._releaseTexture(texture);\n cubeRtt._swapAndDie(texture);\n texture._irradianceTexture = irradiance;\n }\n // Release temp Post Process.\n if (rgbdPostProcess) {\n rgbdPostProcess.dispose();\n }\n // Flag internal texture as ready in case they are in use.\n if (generateNonLODTextures) {\n if (texture._lodTextureHigh && texture._lodTextureHigh._texture) {\n texture._lodTextureHigh._texture.isReady = true;\n }\n if (texture._lodTextureMid && texture._lodTextureMid._texture) {\n texture._lodTextureMid._texture.isReady = true;\n }\n if (texture._lodTextureLow && texture._lodTextureLow._texture) {\n texture._lodTextureLow._texture.isReady = true;\n }\n }\n}\n/**\n * Uploads spherical polynomials information to the texture.\n * @param texture defines the texture we are trying to upload the information to\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\n */\nexport function UploadEnvSpherical(texture, info) {\n info = normalizeEnvInfo(info);\n const irradianceInfo = info.irradiance;\n if (!irradianceInfo) {\n return;\n }\n const sp = new SphericalPolynomial();\n Vector3.FromArrayToRef(irradianceInfo.x, 0, sp.x);\n Vector3.FromArrayToRef(irradianceInfo.y, 0, sp.y);\n Vector3.FromArrayToRef(irradianceInfo.z, 0, sp.z);\n Vector3.FromArrayToRef(irradianceInfo.xx, 0, sp.xx);\n Vector3.FromArrayToRef(irradianceInfo.yy, 0, sp.yy);\n Vector3.FromArrayToRef(irradianceInfo.zz, 0, sp.zz);\n Vector3.FromArrayToRef(irradianceInfo.yz, 0, sp.yz);\n Vector3.FromArrayToRef(irradianceInfo.zx, 0, sp.zx);\n Vector3.FromArrayToRef(irradianceInfo.xy, 0, sp.xy);\n texture._sphericalPolynomial = sp;\n}\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function _UpdateRGBDAsync(internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\n const proxy = internalTexture\n .getEngine()\n .createRawCubeTexture(null, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\n // eslint-disable-next-line github/no-then\n const proxyPromise = UploadRadianceLevelsAsync(proxy, data).then(() => internalTexture);\n internalTexture.onRebuildCallback = (_internalTexture) => {\n return {\n proxy: proxyPromise,\n isReady: true,\n isAsync: true,\n };\n };\n internalTexture._source = 13 /* InternalTextureSource.CubeRawRGBD */;\n internalTexture._bufferViewArrayArray = data;\n internalTexture._lodGenerationScale = lodScale;\n internalTexture._lodGenerationOffset = lodOffset;\n internalTexture._sphericalPolynomial = sphericalPolynomial;\n // eslint-disable-next-line github/no-then\n return UploadRadianceLevelsAsync(internalTexture, data).then(() => {\n internalTexture.isReady = true;\n return internalTexture;\n });\n}\n/**\n * Sets of helpers addressing the serialization and deserialization of environment texture\n * stored in a BabylonJS env file.\n * Those files are usually stored as .env files.\n */\nexport const EnvironmentTextureTools = {\n /**\n * Gets the environment info from an env file.\n * @param data The array buffer containing the .env bytes.\n * @returns the environment file info (the json header) if successfully parsed, normalized to the latest supported version.\n */\n GetEnvInfo,\n /**\n * Creates an environment texture from a loaded cube texture.\n * @param texture defines the cube texture to convert in env file\n * @param options options for the conversion process\n * @param options.imageType the mime type for the encoded images, with support for \"image/png\" (default) and \"image/webp\"\n * @param options.imageQuality the image quality of encoded WebP images.\n * @returns a promise containing the environment data if successful.\n */\n CreateEnvTextureAsync,\n /**\n * Creates the ArrayBufferViews used for initializing environment texture image data.\n * @param data the image data\n * @param info parameters that determine what views will be created for accessing the underlying buffer\n * @returns the views described by info providing access to the underlying buffer\n */\n CreateRadianceImageDataArrayBufferViews,\n /**\n * Creates the ArrayBufferViews used for initializing environment texture image data.\n * @param data the image data\n * @param info parameters that determine what views will be created for accessing the underlying buffer\n * @returns the views described by info providing access to the underlying buffer\n */\n CreateIrradianceImageDataArrayBufferViews,\n /**\n * Uploads the texture info contained in the env file to the GPU.\n * @param texture defines the internal texture to upload to\n * @param data defines the data to load\n * @param info defines the texture info retrieved through the GetEnvInfo method\n * @returns a promise\n */\n UploadEnvLevelsAsync,\n /**\n * Uploads the levels of image data to the GPU.\n * @param texture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param imageType the mime type of the image data\n * @returns a promise\n */\n UploadRadianceLevelsAsync,\n /**\n * Uploads the levels of image data to the GPU.\n * @param texture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param imageType the mime type of the image data\n * @param dominantDirection the dominant direction of light in the environment texture, if available\n * @returns a promise\n */\n UploadIrradianceLevelsAsync,\n /**\n * Uploads spherical polynomials information to the texture.\n * @param texture defines the texture we are trying to upload the information to\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\n */\n UploadEnvSpherical,\n};\n//# sourceMappingURL=environmentTextureTools.js.map","import { GetEnvInfo, UploadEnvLevelsAsync, UploadEnvSpherical } from \"../../../Misc/environmentTextureTools.js\";\n/**\n * Implementation of the ENV Texture Loader.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _ENVTextureLoader {\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 info = GetEnvInfo(data);\n if (info) {\n texture.width = info.width;\n texture.height = info.width;\n try {\n UploadEnvSpherical(texture, info);\n // eslint-disable-next-line github/no-then\n UploadEnvLevelsAsync(texture, data, info).then(() => {\n texture.isReady = true;\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n }, (reason) => {\n onError?.(\"Can not upload environment levels\", reason);\n });\n }\n catch (e) {\n onError?.(\"Can not upload environment file\", e);\n }\n }\n else if (onError) {\n onError(\"Can not parse the environment file\", null);\n }\n }\n /**\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\n */\n loadData() {\n // eslint-disable-next-line no-throw-literal\n throw \".env not supported in 2d.\";\n }\n}\n//# sourceMappingURL=envTextureLoader.js.map"],"names":["DefaultEnvironmentTextureImageType","CurrentVersion","MagicBytes","GetEnvInfo","data","dataView","pos","i","Logger","manifestString","charCode","manifest","normalizeEnvInfo","info","CreateRadianceImageDataArrayBufferViews","specularInfo","mipmapsCount","imageData","face","imageInfo","CreateIrradianceImageDataArrayBufferViews","irradianceTexture","_a","UploadEnvLevelsAsync","texture","promises","radianceImageData","UploadRadianceLevelsAsync","irradianceImageData","dominantDirection","_c","_b","Vector3","UploadIrradianceLevelsAsync","_OnImageReadyAsync","image","engine","expandTexture","rgbdPostProcess","url","generateNonLODTextures","lodTextures","cubeRtt","resolve","reject","tempTexture","message","effect","lodTexture","imageType","_UploadLevelsAsync","mainTexture","size","InternalTexture","baseTexture","BaseTexture","canGenerateNonLODTextures","Tools","ILog2","caps","shaderLanguage","PostProcess","scale","offset","roughness","minLODIndex","maxLODIndex","lodIndex","mipmapIndex","glTextureFromLod","bytes","blob","promise","img","reason","error","dataLength","irradiance","UploadEnvSpherical","irradianceInfo","sp","SphericalPolynomial","_ENVTextureLoader","createPolynomials","onLoad","onError","e"],"mappings":";;AAaA,MAAMA,IAAqC,aACrCC,IAAiB,GAIjBC,IAAa,CAAC,KAAM,IAAM,KAAM,KAAM,KAAM,KAAM,KAAM,EAAI;AAM3D,SAASC,EAAWC,GAAM;AAC7B,QAAMC,IAAW,IAAI,SAASD,EAAK,QAAQA,EAAK,YAAYA,EAAK,UAAU;AAC3E,MAAIE,IAAM;AACV,WAASC,IAAI,GAAGA,IAAIL,EAAW,QAAQK;AACnC,QAAIF,EAAS,SAASC,GAAK,MAAMJ,EAAWK,CAAC;AACzC,aAAAC,EAAO,MAAM,+BAA+B,GACrC;AAIf,MAAIC,IAAiB,IACjBC,IAAW;AACf,SAAQA,IAAWL,EAAS,SAASC,GAAK;AACtC,IAAAG,KAAkB,OAAO,aAAaC,CAAQ;AAElD,MAAIC,IAAW,KAAK,MAAMF,CAAc;AACxC,SAAAE,IA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