@shopware-ag/dive 2.2.15 → 2.2.17

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 (38) hide show
  1. package/build/chunks/{AssetCache-CQgIwNwG.mjs → AssetCache-Ba-m-7zA.mjs} +1 -1
  2. package/build/chunks/{AssetCache-BdosDtkN.cjs → AssetCache-CpKF1NzV.cjs} +1 -1
  3. package/build/chunks/AssetLoader-B03j7xvX.cjs +4 -0
  4. package/build/chunks/{AssetLoader-BCFFDoEG.mjs → AssetLoader-C2NGPDLw.mjs} +705 -677
  5. package/build/chunks/FileTypes-D5A0_pG_.cjs +29 -0
  6. package/build/chunks/{FileTypes-DTT9oIRm.mjs → FileTypes-Djlx9wth.mjs} +101 -99
  7. package/build/chunks/HDREnvorinment-CP2Uvq4_.cjs +5 -0
  8. package/build/chunks/HDREnvorinment-DKzwfsKr.mjs +257 -0
  9. package/build/chunks/{SelectTool-kFQjecRm.cjs → SelectTool-ClSKQ893.cjs} +1 -1
  10. package/build/chunks/{SelectTool-BIzbqC0O.mjs → SelectTool-D-StWurg.mjs} +1 -1
  11. package/build/dive.cjs +1 -1
  12. package/build/dive.mjs +1 -1
  13. package/build/engine/scene/Scene.d.ts +1 -0
  14. package/build/plugins/ar/index.cjs +1 -1
  15. package/build/plugins/ar/index.mjs +1 -1
  16. package/build/plugins/assetcache/index.cjs +1 -1
  17. package/build/plugins/assetcache/index.mjs +1 -1
  18. package/build/plugins/assetloader/index.cjs +1 -1
  19. package/build/plugins/assetloader/index.mjs +1 -1
  20. package/build/plugins/assetloader/src/loader/AssetLoader.d.ts +8 -1
  21. package/build/plugins/hdr/index.cjs +1 -1
  22. package/build/plugins/hdr/index.mjs +1 -1
  23. package/build/plugins/hdr/src/HDREnvorinment.d.ts +2 -0
  24. package/build/plugins/orbitcontroller/index.cjs +1 -1
  25. package/build/plugins/orbitcontroller/index.mjs +1 -1
  26. package/build/plugins/orientationdisplay/index.cjs +1 -1
  27. package/build/plugins/orientationdisplay/index.mjs +1 -1
  28. package/build/plugins/quickview/index.cjs +1 -1
  29. package/build/plugins/quickview/index.mjs +21 -19
  30. package/build/plugins/state/index.cjs +1 -1
  31. package/build/plugins/state/index.mjs +2 -2
  32. package/build/plugins/toolbox/index.cjs +1 -1
  33. package/build/plugins/toolbox/index.mjs +2 -2
  34. package/package.json +1 -1
  35. package/build/chunks/AssetLoader-DnrCdOgm.cjs +0 -4
  36. package/build/chunks/FileTypes-D5y7I8ff.cjs +0 -29
  37. package/build/chunks/HDREnvorinment-BB0e9RQL.mjs +0 -255
  38. package/build/chunks/HDREnvorinment-BBSbZzgm.cjs +0 -5
@@ -1,255 +0,0 @@
1
- var J = Object.defineProperty;
2
- var K = (b, t, l) => t in b ? J(b, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : b[t] = l;
3
- var y = (b, t, l) => K(b, typeof t != "symbol" ? t + "" : t, l);
4
- import { DataTextureLoader as Q, HalfFloatType as L, FloatType as x, DataUtils as G, LinearSRGBColorSpace as z, LinearFilter as V, PMREMGenerator as Z, SRGBColorSpace as Y, ACESFilmicToneMapping as ee, EquirectangularReflectionMapping as P, Scene as te, SphereGeometry as ne, MeshBasicMaterial as re, BackSide as ie, Mesh as se, NoToneMapping as oe, WebGLCubeRenderTarget as ae, CubeCamera as le } from "three";
5
- class j extends Q {
6
- constructor(t) {
7
- super(t), this.type = L;
8
- }
9
- // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
10
- parse(t) {
11
- const o = function(e, r) {
12
- switch (e) {
13
- case 1:
14
- throw new Error("THREE.RGBELoader: Read Error: " + (r || ""));
15
- case 2:
16
- throw new Error("THREE.RGBELoader: Write Error: " + (r || ""));
17
- case 3:
18
- throw new Error("THREE.RGBELoader: Bad File Format: " + (r || ""));
19
- default:
20
- case 4:
21
- throw new Error("THREE.RGBELoader: Memory Error: " + (r || ""));
22
- }
23
- }, F = `
24
- `, f = function(e, r, s) {
25
- r = r || 1024;
26
- let h = e.pos, c = -1, n = 0, p = "", i = String.fromCharCode.apply(null, new Uint16Array(e.subarray(h, h + 128)));
27
- for (; 0 > (c = i.indexOf(F)) && n < r && h < e.byteLength; )
28
- p += i, n += i.length, h += 128, i += String.fromCharCode.apply(null, new Uint16Array(e.subarray(h, h + 128)));
29
- return -1 < c ? (e.pos += n + c + 1, p + i.slice(0, c)) : !1;
30
- }, O = function(e) {
31
- const r = /^#\?(\S+)/, s = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, a = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, h = /^\s*FORMAT=(\S+)\s*$/, c = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, n = {
32
- valid: 0,
33
- /* indicate which fields are valid */
34
- string: "",
35
- /* the actual header string */
36
- comments: "",
37
- /* comments found in header */
38
- programtype: "RGBE",
39
- /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */
40
- format: "",
41
- /* RGBE format, default 32-bit_rle_rgbe */
42
- gamma: 1,
43
- /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */
44
- exposure: 1,
45
- /* a value of 1.0 in an image corresponds to <exposure> watts/steradian/m^2. defaults to 1.0 */
46
- width: 0,
47
- height: 0
48
- /* image dimensions, width/height */
49
- };
50
- let p, i;
51
- for ((e.pos >= e.byteLength || !(p = f(e))) && o(1, "no header found"), (i = p.match(r)) || o(3, "bad initial token"), n.valid |= 1, n.programtype = i[1], n.string += p + `
52
- `; p = f(e), p !== !1; ) {
53
- if (n.string += p + `
54
- `, p.charAt(0) === "#") {
55
- n.comments += p + `
56
- `;
57
- continue;
58
- }
59
- if ((i = p.match(s)) && (n.gamma = parseFloat(i[1])), (i = p.match(a)) && (n.exposure = parseFloat(i[1])), (i = p.match(h)) && (n.valid |= 2, n.format = i[1]), (i = p.match(c)) && (n.valid |= 4, n.height = parseInt(i[1], 10), n.width = parseInt(i[2], 10)), n.valid & 2 && n.valid & 4) break;
60
- }
61
- return n.valid & 2 || o(3, "missing format specifier"), n.valid & 4 || o(3, "missing image size specifier"), n;
62
- }, $ = function(e, r, s) {
63
- const a = r;
64
- if (
65
- // run length encoding is not allowed so read flat
66
- a < 8 || a > 32767 || // this file is not run length encoded
67
- e[0] !== 2 || e[1] !== 2 || e[2] & 128
68
- )
69
- return new Uint8Array(e);
70
- a !== (e[2] << 8 | e[3]) && o(3, "wrong scanline width");
71
- const h = new Uint8Array(4 * r * s);
72
- h.length || o(4, "unable to allocate buffer space");
73
- let c = 0, n = 0;
74
- const p = 4 * a, i = new Uint8Array(4), v = new Uint8Array(p);
75
- let H = s;
76
- for (; H > 0 && n < e.byteLength; ) {
77
- n + 4 > e.byteLength && o(1), i[0] = e[n++], i[1] = e[n++], i[2] = e[n++], i[3] = e[n++], (i[0] != 2 || i[1] != 2 || (i[2] << 8 | i[3]) != a) && o(3, "bad rgbe scanline format");
78
- let S = 0, d;
79
- for (; S < p && n < e.byteLength; ) {
80
- d = e[n++];
81
- const E = d > 128;
82
- if (E && (d -= 128), (d === 0 || S + d > p) && o(3, "bad scanline data"), E) {
83
- const _ = e[n++];
84
- for (let N = 0; N < d; N++)
85
- v[S++] = _;
86
- } else
87
- v.set(e.subarray(n, n + d), S), S += d, n += d;
88
- }
89
- const X = a;
90
- for (let E = 0; E < X; E++) {
91
- let _ = 0;
92
- h[c] = v[E + _], _ += a, h[c + 1] = v[E + _], _ += a, h[c + 2] = v[E + _], _ += a, h[c + 3] = v[E + _], c += 4;
93
- }
94
- H--;
95
- }
96
- return h;
97
- }, W = function(e, r, s, a) {
98
- const h = e[r + 3], c = Math.pow(2, h - 128) / 255;
99
- s[a + 0] = e[r + 0] * c, s[a + 1] = e[r + 1] * c, s[a + 2] = e[r + 2] * c, s[a + 3] = 1;
100
- }, q = function(e, r, s, a) {
101
- const h = e[r + 3], c = Math.pow(2, h - 128) / 255;
102
- s[a + 0] = G.toHalfFloat(Math.min(e[r + 0] * c, 65504)), s[a + 1] = G.toHalfFloat(Math.min(e[r + 1] * c, 65504)), s[a + 2] = G.toHalfFloat(Math.min(e[r + 2] * c, 65504)), s[a + 3] = G.toHalfFloat(1);
103
- }, k = new Uint8Array(t);
104
- k.pos = 0;
105
- const M = O(k), D = M.width, U = M.height, A = $(k.subarray(k.pos), D, U);
106
- let T, C, I;
107
- switch (this.type) {
108
- case x:
109
- I = A.length / 4;
110
- const e = new Float32Array(I * 4);
111
- for (let s = 0; s < I; s++)
112
- W(A, s * 4, e, s * 4);
113
- T = e, C = x;
114
- break;
115
- case L:
116
- I = A.length / 4;
117
- const r = new Uint16Array(I * 4);
118
- for (let s = 0; s < I; s++)
119
- q(A, s * 4, r, s * 4);
120
- T = r, C = L;
121
- break;
122
- default:
123
- throw new Error("THREE.RGBELoader: Unsupported type: " + this.type);
124
- }
125
- return {
126
- width: D,
127
- height: U,
128
- data: T,
129
- header: M.string,
130
- gamma: M.gamma,
131
- exposure: M.exposure,
132
- type: C
133
- };
134
- }
135
- setDataType(t) {
136
- return this.type = t, this;
137
- }
138
- load(t, l, u, B) {
139
- function m(o, w) {
140
- switch (o.type) {
141
- case x:
142
- case L:
143
- o.colorSpace = z, o.minFilter = V, o.magFilter = V, o.generateMipmaps = !1, o.flipY = !0;
144
- break;
145
- }
146
- l && l(o, w);
147
- }
148
- return super.load(t, m, u, B);
149
- }
150
- }
151
- const pe = {
152
- enabled: !0,
153
- imageUrl: void 0,
154
- useAsBackground: !0,
155
- globalEnvIntensity: 1,
156
- exposure: 1,
157
- rotateY: 0,
158
- replaceLights: !0
159
- };
160
- class ue {
161
- constructor(t, l, u = {}) {
162
- y(this, "renderer");
163
- y(this, "scene");
164
- y(this, "pmrem");
165
- y(this, "currentEnvRT", null);
166
- y(this, "currentBackgroundCube", null);
167
- y(this, "sourceImage", null);
168
- y(this, "originalLights", []);
169
- y(this, "options");
170
- this.renderer = t, this.scene = l, this.pmrem = new Z(t), this.options = u, this.options.imageUrl && (this.sourceImage = new j().loadAsync(
171
- this.options.imageUrl
172
- )), this.options.enabled && this.enable();
173
- }
174
- async enable(t) {
175
- if (this.options = { ...this.options, enabled: !0, ...t }, !this.options.imageUrl) return;
176
- this.renderer.outputColorSpace = Y, this.renderer.toneMapping = ee, this.options.exposure != null && (this.renderer.toneMappingExposure = this.options.exposure), this.sourceImage || (this.sourceImage = new j().loadAsync(
177
- this.options.imageUrl
178
- ));
179
- const l = await this.sourceImage;
180
- if (l.mapping = P, this.scene.background = this.options.useAsBackground ? l : null, this.options.rotateY)
181
- await this.applyRotationAndSetEnvironment(this.options.rotateY);
182
- else {
183
- const u = this.pmrem.fromEquirectangular(l);
184
- this.cleanupEnv(), this.currentEnvRT = u, this.scene.environment = u.texture;
185
- }
186
- this.applyEnvIntensity(
187
- this.scene,
188
- this.options.globalEnvIntensity ?? 1
189
- ), this.options.replaceLights && this.disableExistingLights();
190
- }
191
- async setImageUrl(t) {
192
- this.options.imageUrl = t, this.sourceImage = null, this.options.enabled && await this.enable();
193
- }
194
- async setRotationY(t) {
195
- this.options.rotateY = t, this.sourceImage && await this.applyRotationAndSetEnvironment(t);
196
- }
197
- setExposure(t) {
198
- this.options.exposure = t, this.renderer.toneMappingExposure = t;
199
- }
200
- setGlobalEnvIntensity(t) {
201
- this.options.globalEnvIntensity = t, this.applyEnvIntensity(this.scene, t);
202
- }
203
- disable() {
204
- this.options.enabled = !1, this.scene.environment = null, this.restoreLights(), this.cleanupEnv();
205
- }
206
- async dispose() {
207
- this.disable(), this.pmrem.dispose(), this.sourceImage && ((await this.sourceImage).dispose(), this.sourceImage = null);
208
- }
209
- async applyRotationAndSetEnvironment(t) {
210
- if (!this.sourceImage) return;
211
- const l = await this.sourceImage, u = new te(), B = new ne(10, 60, 40);
212
- l.mapping = P;
213
- const m = new re({ map: l, side: ie }), o = new se(B, m);
214
- o.scale.set(1, 1, -1), o.rotation.y = t, u.add(o);
215
- const w = this.renderer.toneMapping, g = this.renderer.outputColorSpace;
216
- this.renderer.toneMapping = oe, this.renderer.outputColorSpace = z;
217
- const R = new ae(1024, { type: L });
218
- new le(0.1, 1e3, R).update(this.renderer, u), this.renderer.toneMapping = w, this.renderer.outputColorSpace = g;
219
- const f = this.pmrem.fromCubemap(R.texture);
220
- this.cleanupEnv(), this.currentEnvRT = f, this.scene.environment = f.texture, this.options.useAsBackground && (this.scene.background = R.texture, this.currentBackgroundCube && (this.currentBackgroundCube.texture.dispose(), this.currentBackgroundCube.dispose()), this.currentBackgroundCube = R), this.applyEnvIntensity(
221
- this.scene,
222
- this.options.globalEnvIntensity ?? 1
223
- ), this.options.useAsBackground || (R.texture.dispose(), R.dispose());
224
- }
225
- applyEnvIntensity(t, l) {
226
- t.traverse((u) => {
227
- const m = u.material;
228
- if (!m) return;
229
- const o = Array.isArray(m) ? m : [m];
230
- for (const w of o) {
231
- const g = w;
232
- g && "envMapIntensity" in g && (g.envMapIntensity = l, g.needsUpdate = !0), g && g.map && "colorSpace" in g.map && (g.map.colorSpace = Y);
233
- }
234
- });
235
- }
236
- disableExistingLights() {
237
- const t = [];
238
- this.scene.traverse((l) => {
239
- const u = l;
240
- u.isLight && (u.visible = !1, t.push(u));
241
- }), this.originalLights = t;
242
- }
243
- restoreLights() {
244
- for (const t of this.originalLights)
245
- t.visible = !0;
246
- this.originalLights = [];
247
- }
248
- cleanupEnv() {
249
- this.currentEnvRT && (this.currentEnvRT.texture.dispose(), this.currentEnvRT.dispose(), this.currentEnvRT = null), this.currentBackgroundCube && (this.currentBackgroundCube.texture.dispose(), this.currentBackgroundCube.dispose(), this.currentBackgroundCube = null);
250
- }
251
- }
252
- export {
253
- pe as H,
254
- ue as a
255
- };
@@ -1,5 +0,0 @@
1
- "use strict";var z=Object.defineProperty;var O=(b,t,c)=>t in b?z(b,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):b[t]=c;var R=(b,t,c)=>O(b,typeof t!="symbol"?t+"":t,c);const r=require("three");class H extends r.DataTextureLoader{constructor(t){super(t),this.type=r.HalfFloatType}parse(t){const o=function(e,i){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(i||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(i||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(i||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(i||""))}},C=`
2
- `,S=function(e,i,s){i=i||1024;let h=e.pos,p=-1,n=0,u="",a=String.fromCharCode.apply(null,new Uint16Array(e.subarray(h,h+128)));for(;0>(p=a.indexOf(C))&&n<i&&h<e.byteLength;)u+=a,n+=a.length,h+=128,a+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(h,h+128)));return-1<p?(e.pos+=n+p+1,u+a.slice(0,p)):!1},N=function(e){const i=/^#\?(\S+)/,s=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,l=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,h=/^\s*FORMAT=(\S+)\s*$/,p=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,n={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let u,a;for((e.pos>=e.byteLength||!(u=S(e)))&&o(1,"no header found"),(a=u.match(i))||o(3,"bad initial token"),n.valid|=1,n.programtype=a[1],n.string+=u+`
3
- `;u=S(e),u!==!1;){if(n.string+=u+`
4
- `,u.charAt(0)==="#"){n.comments+=u+`
5
- `;continue}if((a=u.match(s))&&(n.gamma=parseFloat(a[1])),(a=u.match(l))&&(n.exposure=parseFloat(a[1])),(a=u.match(h))&&(n.valid|=2,n.format=a[1]),(a=u.match(p))&&(n.valid|=4,n.height=parseInt(a[1],10),n.width=parseInt(a[2],10)),n.valid&2&&n.valid&4)break}return n.valid&2||o(3,"missing format specifier"),n.valid&4||o(3,"missing image size specifier"),n},V=function(e,i,s){const l=i;if(l<8||l>32767||e[0]!==2||e[1]!==2||e[2]&128)return new Uint8Array(e);l!==(e[2]<<8|e[3])&&o(3,"wrong scanline width");const h=new Uint8Array(4*i*s);h.length||o(4,"unable to allocate buffer space");let p=0,n=0;const u=4*l,a=new Uint8Array(4),B=new Uint8Array(u);let U=s;for(;U>0&&n<e.byteLength;){n+4>e.byteLength&&o(1),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],(a[0]!=2||a[1]!=2||(a[2]<<8|a[3])!=l)&&o(3,"bad rgbe scanline format");let T=0,E;for(;T<u&&n<e.byteLength;){E=e[n++];const y=E>128;if(y&&(E-=128),(E===0||T+E>u)&&o(3,"bad scanline data"),y){const _=e[n++];for(let x=0;x<E;x++)B[T++]=_}else B.set(e.subarray(n,n+E),T),T+=E,n+=E}const j=l;for(let y=0;y<j;y++){let _=0;h[p]=B[y+_],_+=l,h[p+1]=B[y+_],_+=l,h[p+2]=B[y+_],_+=l,h[p+3]=B[y+_],p+=4}U--}return h},Y=function(e,i,s,l){const h=e[i+3],p=Math.pow(2,h-128)/255;s[l+0]=e[i+0]*p,s[l+1]=e[i+1]*p,s[l+2]=e[i+2]*p,s[l+3]=1},P=function(e,i,s,l){const h=e[i+3],p=Math.pow(2,h-128)/255;s[l+0]=r.DataUtils.toHalfFloat(Math.min(e[i+0]*p,65504)),s[l+1]=r.DataUtils.toHalfFloat(Math.min(e[i+1]*p,65504)),s[l+2]=r.DataUtils.toHalfFloat(Math.min(e[i+2]*p,65504)),s[l+3]=r.DataUtils.toHalfFloat(1)},L=new Uint8Array(t);L.pos=0;const M=N(L),F=M.width,D=M.height,G=V(L.subarray(L.pos),F,D);let k,A,v;switch(this.type){case r.FloatType:v=G.length/4;const e=new Float32Array(v*4);for(let s=0;s<v;s++)Y(G,s*4,e,s*4);k=e,A=r.FloatType;break;case r.HalfFloatType:v=G.length/4;const i=new Uint16Array(v*4);for(let s=0;s<v;s++)P(G,s*4,i,s*4);k=i,A=r.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:F,height:D,data:k,header:M.string,gamma:M.gamma,exposure:M.exposure,type:A}}setDataType(t){return this.type=t,this}load(t,c,g,I){function d(o,f){switch(o.type){case r.FloatType:case r.HalfFloatType:o.colorSpace=r.LinearSRGBColorSpace,o.minFilter=r.LinearFilter,o.magFilter=r.LinearFilter,o.generateMipmaps=!1,o.flipY=!0;break}c&&c(o,f)}return super.load(t,d,g,I)}}const q={enabled:!0,imageUrl:void 0,useAsBackground:!0,globalEnvIntensity:1,exposure:1,rotateY:0,replaceLights:!0};class ${constructor(t,c,g={}){R(this,"renderer");R(this,"scene");R(this,"pmrem");R(this,"currentEnvRT",null);R(this,"currentBackgroundCube",null);R(this,"sourceImage",null);R(this,"originalLights",[]);R(this,"options");this.renderer=t,this.scene=c,this.pmrem=new r.PMREMGenerator(t),this.options=g,this.options.imageUrl&&(this.sourceImage=new H().loadAsync(this.options.imageUrl)),this.options.enabled&&this.enable()}async enable(t){if(this.options={...this.options,enabled:!0,...t},!this.options.imageUrl)return;this.renderer.outputColorSpace=r.SRGBColorSpace,this.renderer.toneMapping=r.ACESFilmicToneMapping,this.options.exposure!=null&&(this.renderer.toneMappingExposure=this.options.exposure),this.sourceImage||(this.sourceImage=new H().loadAsync(this.options.imageUrl));const c=await this.sourceImage;if(c.mapping=r.EquirectangularReflectionMapping,this.scene.background=this.options.useAsBackground?c:null,this.options.rotateY)await this.applyRotationAndSetEnvironment(this.options.rotateY);else{const g=this.pmrem.fromEquirectangular(c);this.cleanupEnv(),this.currentEnvRT=g,this.scene.environment=g.texture}this.applyEnvIntensity(this.scene,this.options.globalEnvIntensity??1),this.options.replaceLights&&this.disableExistingLights()}async setImageUrl(t){this.options.imageUrl=t,this.sourceImage=null,this.options.enabled&&await this.enable()}async setRotationY(t){this.options.rotateY=t,this.sourceImage&&await this.applyRotationAndSetEnvironment(t)}setExposure(t){this.options.exposure=t,this.renderer.toneMappingExposure=t}setGlobalEnvIntensity(t){this.options.globalEnvIntensity=t,this.applyEnvIntensity(this.scene,t)}disable(){this.options.enabled=!1,this.scene.environment=null,this.restoreLights(),this.cleanupEnv()}async dispose(){this.disable(),this.pmrem.dispose(),this.sourceImage&&((await this.sourceImage).dispose(),this.sourceImage=null)}async applyRotationAndSetEnvironment(t){if(!this.sourceImage)return;const c=await this.sourceImage,g=new r.Scene,I=new r.SphereGeometry(10,60,40);c.mapping=r.EquirectangularReflectionMapping;const d=new r.MeshBasicMaterial({map:c,side:r.BackSide}),o=new r.Mesh(I,d);o.scale.set(1,1,-1),o.rotation.y=t,g.add(o);const f=this.renderer.toneMapping,m=this.renderer.outputColorSpace;this.renderer.toneMapping=r.NoToneMapping,this.renderer.outputColorSpace=r.LinearSRGBColorSpace;const w=new r.WebGLCubeRenderTarget(1024,{type:r.HalfFloatType});new r.CubeCamera(.1,1e3,w).update(this.renderer,g),this.renderer.toneMapping=f,this.renderer.outputColorSpace=m;const S=this.pmrem.fromCubemap(w.texture);this.cleanupEnv(),this.currentEnvRT=S,this.scene.environment=S.texture,this.options.useAsBackground&&(this.scene.background=w.texture,this.currentBackgroundCube&&(this.currentBackgroundCube.texture.dispose(),this.currentBackgroundCube.dispose()),this.currentBackgroundCube=w),this.applyEnvIntensity(this.scene,this.options.globalEnvIntensity??1),this.options.useAsBackground||(w.texture.dispose(),w.dispose())}applyEnvIntensity(t,c){t.traverse(g=>{const d=g.material;if(!d)return;const o=Array.isArray(d)?d:[d];for(const f of o){const m=f;m&&"envMapIntensity"in m&&(m.envMapIntensity=c,m.needsUpdate=!0),m&&m.map&&"colorSpace"in m.map&&(m.map.colorSpace=r.SRGBColorSpace)}})}disableExistingLights(){const t=[];this.scene.traverse(c=>{const g=c;g.isLight&&(g.visible=!1,t.push(g))}),this.originalLights=t}restoreLights(){for(const t of this.originalLights)t.visible=!0;this.originalLights=[]}cleanupEnv(){this.currentEnvRT&&(this.currentEnvRT.texture.dispose(),this.currentEnvRT.dispose(),this.currentEnvRT=null),this.currentBackgroundCube&&(this.currentBackgroundCube.texture.dispose(),this.currentBackgroundCube.dispose(),this.currentBackgroundCube=null)}}exports.HDREnvironment=$;exports.HDREnvironmentDefaultSettings=q;