@shopware-ag/dive 2.2.15 → 2.2.16

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 (34) hide show
  1. package/build/chunks/{AssetCache-CQgIwNwG.mjs → AssetCache-BkU-YbyI.mjs} +1 -1
  2. package/build/chunks/{AssetCache-BdosDtkN.cjs → AssetCache-PycNkZlv.cjs} +1 -1
  3. package/build/chunks/{AssetLoader-BCFFDoEG.mjs → AssetLoader-2zJQGAPS.mjs} +2 -2
  4. package/build/chunks/{AssetLoader-DnrCdOgm.cjs → AssetLoader-CgeC94PN.cjs} +1 -1
  5. package/build/chunks/{FileTypes-D5y7I8ff.cjs → FileTypes-Bf3Ffk3D.cjs} +1 -1
  6. package/build/chunks/{FileTypes-DTT9oIRm.mjs → FileTypes-Qg_Zc7TF.mjs} +1 -1
  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-CwFPCf-b.cjs} +1 -1
  10. package/build/chunks/{SelectTool-BIzbqC0O.mjs → SelectTool-DujSa1r0.mjs} +1 -1
  11. package/build/dive.cjs +1 -1
  12. package/build/dive.mjs +1 -1
  13. package/build/plugins/ar/index.cjs +1 -1
  14. package/build/plugins/ar/index.mjs +1 -1
  15. package/build/plugins/assetcache/index.cjs +1 -1
  16. package/build/plugins/assetcache/index.mjs +1 -1
  17. package/build/plugins/assetloader/index.cjs +1 -1
  18. package/build/plugins/assetloader/index.mjs +1 -1
  19. package/build/plugins/hdr/index.cjs +1 -1
  20. package/build/plugins/hdr/index.mjs +1 -1
  21. package/build/plugins/hdr/src/HDREnvorinment.d.ts +2 -0
  22. package/build/plugins/orbitcontroller/index.cjs +1 -1
  23. package/build/plugins/orbitcontroller/index.mjs +1 -1
  24. package/build/plugins/orientationdisplay/index.cjs +1 -1
  25. package/build/plugins/orientationdisplay/index.mjs +1 -1
  26. package/build/plugins/quickview/index.cjs +1 -1
  27. package/build/plugins/quickview/index.mjs +21 -19
  28. package/build/plugins/state/index.cjs +1 -1
  29. package/build/plugins/state/index.mjs +2 -2
  30. package/build/plugins/toolbox/index.cjs +1 -1
  31. package/build/plugins/toolbox/index.mjs +2 -2
  32. package/package.json +1 -1
  33. package/build/chunks/HDREnvorinment-BB0e9RQL.mjs +0 -255
  34. package/build/chunks/HDREnvorinment-BBSbZzgm.cjs +0 -5
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var p=(s,e,r)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var a=(s,e,r)=>p(s,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three");require("../../chunks/FileTypes-D5y7I8ff.cjs");const n=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),i=require("../../chunks/AxisHelperColors-BrGqktN5.cjs"),l=require("three-spritetext");class _ extends t.Object3D{constructor(){super();a(this,"_axesHelper");this._axesHelper=new t.AxesHelper(.5),this._axesHelper.layers.mask=n.COORDINATE_LAYER_MASK,this._axesHelper.material.depthTest=!1,this._axesHelper.position.set(0,0,-1),this._axesHelper.setColors(new t.Color(i.AxesColorRed),new t.Color(i.AxesColorGreen),new t.Color(i.AxesColorBlue));const r=new l("X",.2,i.AxesColorRedLetter),o=new l("Y",.2,i.AxesColorGreenLetter),h=new l("Z",.2,i.AxesColorBlueLetter);r.layers.mask=n.COORDINATE_LAYER_MASK,o.layers.mask=n.COORDINATE_LAYER_MASK,h.layers.mask=n.COORDINATE_LAYER_MASK,r.position.set(.7,0,0),o.position.set(0,.7,0),h.position.set(0,0,.7),this._axesHelper.add(r),this._axesHelper.add(o),this._axesHelper.add(h),this.add(this._axesHelper)}setFromCameraMatrix(r){this._axesHelper.rotation.setFromRotationMatrix(new t.Matrix4().extractRotation(r).invert())}}class d{constructor(e,r,o){a(this,"uuid",t.MathUtils.generateUUID());a(this,"_axes");a(this,"_orthographicCamera");a(this,"_restoreViewport",new t.Vector4);this._renderer=e,this._scene=r,this._camera=o,this._orthographicCamera=new t.OrthographicCamera(-1,1,1,-1,.1,100),this._orthographicCamera.name="OrientationDisplayCamera",this._orthographicCamera.layers.mask=n.COORDINATE_LAYER_MASK,this._scene.add(this._orthographicCamera),this._axes=new _,this._axes.name="OrientationDisplayAxes",this._scene.add(this._axes)}tick(){const e=this._scene.background??null;this._scene.background=null,this._renderer.webglrenderer.getViewport(this._restoreViewport),this._renderer.webglrenderer.setViewport(0,0,150,150),this._renderer.webglrenderer.autoClear=!1,this._axes.setFromCameraMatrix(this._camera.matrix),this._renderer.webglrenderer.render(this._scene,this._orthographicCamera),this._renderer.webglrenderer.setViewport(this._restoreViewport),this._renderer.webglrenderer.autoClear=!0,this._scene.background=e}dispose(){this._scene.remove(this._axes),this._scene.remove(this._orthographicCamera)}}exports.OrientationDisplay=d;exports.OrientationDisplayAxes=_;
1
+ "use strict";var c=Object.defineProperty;var p=(s,e,r)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var a=(s,e,r)=>p(s,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three");require("../../chunks/FileTypes-Bf3Ffk3D.cjs");const n=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),i=require("../../chunks/AxisHelperColors-BrGqktN5.cjs"),l=require("three-spritetext");class _ extends t.Object3D{constructor(){super();a(this,"_axesHelper");this._axesHelper=new t.AxesHelper(.5),this._axesHelper.layers.mask=n.COORDINATE_LAYER_MASK,this._axesHelper.material.depthTest=!1,this._axesHelper.position.set(0,0,-1),this._axesHelper.setColors(new t.Color(i.AxesColorRed),new t.Color(i.AxesColorGreen),new t.Color(i.AxesColorBlue));const r=new l("X",.2,i.AxesColorRedLetter),o=new l("Y",.2,i.AxesColorGreenLetter),h=new l("Z",.2,i.AxesColorBlueLetter);r.layers.mask=n.COORDINATE_LAYER_MASK,o.layers.mask=n.COORDINATE_LAYER_MASK,h.layers.mask=n.COORDINATE_LAYER_MASK,r.position.set(.7,0,0),o.position.set(0,.7,0),h.position.set(0,0,.7),this._axesHelper.add(r),this._axesHelper.add(o),this._axesHelper.add(h),this.add(this._axesHelper)}setFromCameraMatrix(r){this._axesHelper.rotation.setFromRotationMatrix(new t.Matrix4().extractRotation(r).invert())}}class d{constructor(e,r,o){a(this,"uuid",t.MathUtils.generateUUID());a(this,"_axes");a(this,"_orthographicCamera");a(this,"_restoreViewport",new t.Vector4);this._renderer=e,this._scene=r,this._camera=o,this._orthographicCamera=new t.OrthographicCamera(-1,1,1,-1,.1,100),this._orthographicCamera.name="OrientationDisplayCamera",this._orthographicCamera.layers.mask=n.COORDINATE_LAYER_MASK,this._scene.add(this._orthographicCamera),this._axes=new _,this._axes.name="OrientationDisplayAxes",this._scene.add(this._axes)}tick(){const e=this._scene.background??null;this._scene.background=null,this._renderer.webglrenderer.getViewport(this._restoreViewport),this._renderer.webglrenderer.setViewport(0,0,150,150),this._renderer.webglrenderer.autoClear=!1,this._axes.setFromCameraMatrix(this._camera.matrix),this._renderer.webglrenderer.render(this._scene,this._orthographicCamera),this._renderer.webglrenderer.setViewport(this._restoreViewport),this._renderer.webglrenderer.autoClear=!0,this._scene.background=e}dispose(){this._scene.remove(this._axes),this._scene.remove(this._orthographicCamera)}}exports.OrientationDisplay=d;exports.OrientationDisplayAxes=_;
@@ -2,7 +2,7 @@ var l = Object.defineProperty;
2
2
  var _ = (s, e, r) => e in s ? l(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
3
  var t = (s, e, r) => _(s, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { Object3D as p, AxesHelper as c, Color as n, Matrix4 as d, OrthographicCamera as m, MathUtils as x, Vector4 as w } from "three";
5
- import "../../chunks/FileTypes-DTT9oIRm.mjs";
5
+ import "../../chunks/FileTypes-Qg_Zc7TF.mjs";
6
6
  import { C as i } from "../../chunks/PerspectiveCamera-BFzE2TQU.mjs";
7
7
  import { A as C, a as g, b as u, c as A, d as H, e as b } from "../../chunks/AxisHelperColors-JLBHYQDi.mjs";
8
8
  import h from "three-spritetext";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../chunks/FileTypes-D5y7I8ff.cjs");require("three");const c=require("../../chunks/HDREnvorinment-BBSbZzgm.cjs"),a={...r.DIVEDefaultSettings,lightIntensity:1,hdr:c.HDREnvironmentDefaultSettings},u=async(l,n)=>{const e=new r.DIVE(n);e.mainView.camera.position.set(0,1,2);const t=new r.DIVESceneLight;t.setIntensity((n==null?void 0:n.lightIntensity)??1),e.scene.root.add(t);const i=await new r.DIVEModel().setFromURL(l);e.scene.root.add(i),i.placeOnFloor();const o=new r.OrbitController(e.mainView.camera,e.mainView.canvas);o.focusObject(i),e.clock.addTicker(o);const d=new c.HDREnvironment(e.mainView.renderer.webglrenderer,e.scene,(n==null?void 0:n.hdr)??a.hdr);return Object.assign(e,{orbitController:o,hdr:d})};exports.QuickView=u;exports.QuickViewDefaultSettings=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../chunks/FileTypes-Bf3Ffk3D.cjs");require("three");const s=require("../../chunks/HDREnvorinment-CP2Uvq4_.cjs"),d={...i.DIVEDefaultSettings,lightIntensity:1,hdr:s.HDREnvironmentDefaultSettings},w=async(l,n)=>{const e=new i.DIVE(n);e.mainView.camera.position.set(0,1,2);const t=new i.DIVESceneLight;t.setIntensity((n==null?void 0:n.lightIntensity)??1),e.scene.root.add(t);const r=await new i.DIVEModel().setFromURL(l);e.scene.root.add(r),r.placeOnFloor();const o=new i.OrbitController(e.mainView.camera,e.mainView.canvas);o.focusObject(r),e.clock.addTicker(o);const c=new s.HDREnvironment(e.mainView.renderer.webglrenderer,e.scene,(n==null?void 0:n.hdr)??d.hdr),a=Object.assign(e,{orbitController:o,hdr:c}),u=e.dispose.bind(e);return a.dispose=async()=>{o.dispose(),c.dispose(),await u()},a};exports.QuickView=w;exports.QuickViewDefaultSettings=d;
@@ -1,30 +1,32 @@
1
- import { D as i, b as d, c as l, d as m, a as w } from "../../chunks/FileTypes-DTT9oIRm.mjs";
1
+ import { D as d, b as l, c as m, d as w, a as p } from "../../chunks/FileTypes-Qg_Zc7TF.mjs";
2
2
  import "three";
3
- import { H as s, a as D } from "../../chunks/HDREnvorinment-BB0e9RQL.mjs";
4
- const V = {
5
- ...i,
3
+ import { H as D, a as V } from "../../chunks/HDREnvorinment-DKzwfsKr.mjs";
4
+ const h = {
5
+ ...d,
6
6
  lightIntensity: 1,
7
- hdr: s
8
- }, b = async (t, n) => {
9
- const e = new d(n);
7
+ hdr: D
8
+ }, f = async (t, o) => {
9
+ const e = new l(o);
10
10
  e.mainView.camera.position.set(0, 1, 2);
11
- const a = new l();
12
- a.setIntensity((n == null ? void 0 : n.lightIntensity) ?? 1), e.scene.root.add(a);
13
- const o = await new m().setFromURL(t);
14
- e.scene.root.add(o), o.placeOnFloor();
15
- const r = new w(
11
+ const a = new m();
12
+ a.setIntensity((o == null ? void 0 : o.lightIntensity) ?? 1), e.scene.root.add(a);
13
+ const i = await new w().setFromURL(t);
14
+ e.scene.root.add(i), i.placeOnFloor();
15
+ const n = new p(
16
16
  e.mainView.camera,
17
17
  e.mainView.canvas
18
18
  );
19
- r.focusObject(o), e.clock.addTicker(r);
20
- const c = new D(
19
+ n.focusObject(i), e.clock.addTicker(n);
20
+ const r = new V(
21
21
  e.mainView.renderer.webglrenderer,
22
22
  e.scene,
23
- (n == null ? void 0 : n.hdr) ?? V.hdr
24
- );
25
- return Object.assign(e, { orbitController: r, hdr: c });
23
+ (o == null ? void 0 : o.hdr) ?? h.hdr
24
+ ), c = Object.assign(e, { orbitController: n, hdr: r }), s = e.dispose.bind(e);
25
+ return c.dispose = async () => {
26
+ n.dispose(), r.dispose(), await s();
27
+ }, c;
26
28
  };
27
29
  export {
28
- b as QuickView,
29
- V as QuickViewDefaultSettings
30
+ f as QuickView,
31
+ h as QuickViewDefaultSettings
30
32
  };
@@ -1,4 +1,4 @@
1
- "use strict";var $d=Object.defineProperty;var Hd=(d,g,o)=>g in d?$d(d,g,{enumerable:!0,configurable:!0,writable:!0,value:o}):d[g]=o;var fn=(d,g,o)=>Hd(d,typeof g!="symbol"?g+"":g,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qd=require("three"),zd=require("../../chunks/FileTypes-D5y7I8ff.cjs"),Mi=require("../../chunks/PovSchema-Co9FznEz.cjs"),vo=require("../../chunks/SelectTool-kFQjecRm.cjs"),wo={};function G(d,g){wo[d]=g}function Ao(d){return wo[d]}class W{constructor(g,o){fn(this,"_payload");fn(this,"_dependencies");this._payload=g,this._dependencies=o}static define({description:g,execute:o}){return class extends W{constructor(E,$){super(E,$);fn(this,"_description",g);fn(this,"_payload");this._payload=E}execute(){return o(this._payload,this._dependencies)}}}}const xo=W.define({description:"Launches AR mode in native capabilities. (iOS: AR Quick Look, Android: Google Scene Viewer)",execute:async(d,{getARSystem:g})=>g().then(o=>{o.launch(d.uri,d.options)})});G("LAUNCH_AR",xo);const Eo=W.define({description:"Calculates the camera position and target to view the whole scene. (experimental).",execute:(d,{engine:g,controller:o})=>{const S=new zd.BoundingBox(g.scene.root,!1,65280);return o.computeEncompassingView(S)}});G("COMPUTE_ENCOMPASSING_VIEW",Eo);const mo=W.define({description:"Gets the current camera position and target.",execute:(d,{controller:g})=>({position:g.object.position.clone(),target:g.target.clone()})});G("GET_CAMERA_TRANSFORM",mo);const So=W.define({description:"Moves the camera to a new position and target.",execute:async(d,{controller:g,registered:o,getAnimationSystem:S,engine:E})=>{let $={x:0,y:0,z:0},q={x:0,y:0,z:0};if("id"in d){const Y=o.get(d.id);if(!Y)throw new Error(`POV with id ${d.id} not registered. Registered: ${o}`);if(!Mi.isPovSchema(Y))throw new Error(`Object with id ${d.id} is not a POV. Object: ${Y}`);$=Y.position,q=Y.target}else $=d.position,q=d.target;const X=await S().then(Y=>{E.clock.hasTicker(Y)||E.clock.addTicker(Y),g.enabled=!0;const sr=Y.animate(g.object.position,$,d.duration,{easing:Y.TWEEN.Easing.Quadratic.Out}).play(),ve=Y.animate(g.target,q,d.duration,{easing:Y.TWEEN.Easing.Quadratic.Out,onUpdate:()=>{g.object.lookAt(g.target)},onComplete:()=>{g.enabled=!d.locked}}).play();return[sr,ve]});return{stop:()=>X.forEach(Y=>Y.stop())}}});G("MOVE_CAMERA",So);const bo=W.define({description:"Sets the camera layer to a certain layer.",execute:(d,{controller:g})=>{"setCameraLayer"in g.object&&g.object.setCameraLayer(d.layer)}});G("SET_CAMERA_LAYER",bo);const Oo=W.define({description:"Sets the camera position and target.",execute:(d,{controller:g})=>{g.object.position.copy(d.position),g.target.copy(d.target),g.update()}});G("SET_CAMERA_TRANSFORM",Oo);const To=W.define({description:"Zooms the camera in or out by a certain amount.",execute:(d,{controller:g})=>{d.direction==="IN"&&g.zoomIn(d.by),d.direction==="OUT"&&g.zoomOut(d.by)}});G("ZOOM_CAMERA",To);const Co=W.define({description:"Generates a screenshot, stores it in a Blob and returns a Promise of a valid URI.",execute:async(d,{registered:g,getMediaCreator:o})=>{const S=await o();if("id"in d){const E=g.get(d.id);if(!E)throw new Error(`Object with id ${d.id} not registered. Registered: ${g}`);if(!Mi.isPovSchema(E))throw new Error(`Object with id ${d.id} is not a POV. Object: ${E}`);const{resolution:$}=d,{position:q,target:X}=E;return S.generateMedia({position:q,target:X,resolution:$})}return S.generateMedia(d)}});G("GENERATE_MEDIA",Co);const Io=W.define({description:"Adds an object to the scene.",execute:(d,{engine:g,registered:o})=>{o.get(d.id)||(d.parentId===void 0&&(d.parentId=null),o.set(d.id,d),g.scene.root.addSceneObject(d))}});G("ADD_OBJECT",Io);var or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},at={exports:{}};/**
1
+ "use strict";var $d=Object.defineProperty;var Hd=(d,g,o)=>g in d?$d(d,g,{enumerable:!0,configurable:!0,writable:!0,value:o}):d[g]=o;var fn=(d,g,o)=>Hd(d,typeof g!="symbol"?g+"":g,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qd=require("three"),zd=require("../../chunks/FileTypes-Bf3Ffk3D.cjs"),Mi=require("../../chunks/PovSchema-Co9FznEz.cjs"),vo=require("../../chunks/SelectTool-CwFPCf-b.cjs"),wo={};function G(d,g){wo[d]=g}function Ao(d){return wo[d]}class W{constructor(g,o){fn(this,"_payload");fn(this,"_dependencies");this._payload=g,this._dependencies=o}static define({description:g,execute:o}){return class extends W{constructor(E,$){super(E,$);fn(this,"_description",g);fn(this,"_payload");this._payload=E}execute(){return o(this._payload,this._dependencies)}}}}const xo=W.define({description:"Launches AR mode in native capabilities. (iOS: AR Quick Look, Android: Google Scene Viewer)",execute:async(d,{getARSystem:g})=>g().then(o=>{o.launch(d.uri,d.options)})});G("LAUNCH_AR",xo);const Eo=W.define({description:"Calculates the camera position and target to view the whole scene. (experimental).",execute:(d,{engine:g,controller:o})=>{const S=new zd.BoundingBox(g.scene.root,!1,65280);return o.computeEncompassingView(S)}});G("COMPUTE_ENCOMPASSING_VIEW",Eo);const mo=W.define({description:"Gets the current camera position and target.",execute:(d,{controller:g})=>({position:g.object.position.clone(),target:g.target.clone()})});G("GET_CAMERA_TRANSFORM",mo);const So=W.define({description:"Moves the camera to a new position and target.",execute:async(d,{controller:g,registered:o,getAnimationSystem:S,engine:E})=>{let $={x:0,y:0,z:0},q={x:0,y:0,z:0};if("id"in d){const Y=o.get(d.id);if(!Y)throw new Error(`POV with id ${d.id} not registered. Registered: ${o}`);if(!Mi.isPovSchema(Y))throw new Error(`Object with id ${d.id} is not a POV. Object: ${Y}`);$=Y.position,q=Y.target}else $=d.position,q=d.target;const X=await S().then(Y=>{E.clock.hasTicker(Y)||E.clock.addTicker(Y),g.enabled=!0;const sr=Y.animate(g.object.position,$,d.duration,{easing:Y.TWEEN.Easing.Quadratic.Out}).play(),ve=Y.animate(g.target,q,d.duration,{easing:Y.TWEEN.Easing.Quadratic.Out,onUpdate:()=>{g.object.lookAt(g.target)},onComplete:()=>{g.enabled=!d.locked}}).play();return[sr,ve]});return{stop:()=>X.forEach(Y=>Y.stop())}}});G("MOVE_CAMERA",So);const bo=W.define({description:"Sets the camera layer to a certain layer.",execute:(d,{controller:g})=>{"setCameraLayer"in g.object&&g.object.setCameraLayer(d.layer)}});G("SET_CAMERA_LAYER",bo);const Oo=W.define({description:"Sets the camera position and target.",execute:(d,{controller:g})=>{g.object.position.copy(d.position),g.target.copy(d.target),g.update()}});G("SET_CAMERA_TRANSFORM",Oo);const To=W.define({description:"Zooms the camera in or out by a certain amount.",execute:(d,{controller:g})=>{d.direction==="IN"&&g.zoomIn(d.by),d.direction==="OUT"&&g.zoomOut(d.by)}});G("ZOOM_CAMERA",To);const Co=W.define({description:"Generates a screenshot, stores it in a Blob and returns a Promise of a valid URI.",execute:async(d,{registered:g,getMediaCreator:o})=>{const S=await o();if("id"in d){const E=g.get(d.id);if(!E)throw new Error(`Object with id ${d.id} not registered. Registered: ${g}`);if(!Mi.isPovSchema(E))throw new Error(`Object with id ${d.id} is not a POV. Object: ${E}`);const{resolution:$}=d,{position:q,target:X}=E;return S.generateMedia({position:q,target:X,resolution:$})}return S.generateMedia(d)}});G("GENERATE_MEDIA",Co);const Io=W.define({description:"Adds an object to the scene.",execute:(d,{engine:g,registered:o})=>{o.get(d.id)||(d.parentId===void 0&&(d.parentId=null),o.set(d.id,d),g.scene.root.addSceneObject(d))}});G("ADD_OBJECT",Io);var or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},at={exports:{}};/**
2
2
  * @license
3
3
  * Lodash <https://lodash.com/>
4
4
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -2,9 +2,9 @@ var _d = Object.defineProperty;
2
2
  var dd = (d, g, o) => g in d ? _d(d, g, { enumerable: !0, configurable: !0, writable: !0, value: o }) : d[g] = o;
3
3
  var fn = (d, g, o) => dd(d, typeof g != "symbol" ? g + "" : g, o);
4
4
  import { MathUtils as pd } from "three";
5
- import { B as vd } from "../../chunks/FileTypes-DTT9oIRm.mjs";
5
+ import { B as vd } from "../../chunks/FileTypes-Qg_Zc7TF.mjs";
6
6
  import { a as _o, i as wd } from "../../chunks/PovSchema-DWWvr_ED.mjs";
7
- import { i as po } from "../../chunks/SelectTool-BIzbqC0O.mjs";
7
+ import { i as po } from "../../chunks/SelectTool-DujSa1r0.mjs";
8
8
  const vo = {};
9
9
  function N(d, g) {
10
10
  vo[d] = g;
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var r=(t,e,o)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var l=(t,e,o)=>r(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../chunks/SelectTool-kFQjecRm.cjs");class i{constructor(e,o){l(this,"_scene");l(this,"_controller");l(this,"_activeTool");l(this,"_selectTool");this._scene=e,this._controller=o,this._selectTool=null,this._activeTool=null}get selectTool(){return this._selectTool||(this._selectTool=new n.DIVESelectTool(this._scene,this._controller)),this._selectTool}dispose(){this.removeEventListeners()}getActiveTool(){return this._activeTool}useTool(e){var o;switch((o=this._activeTool)==null||o.deactivate(),e){case"select":{this.addEventListeners(),this.selectTool.activate(),this._activeTool=this.selectTool;break}case"none":{this.removeEventListeners(),this._activeTool=null;break}default:console.warn(`DIVEToolBox.useTool: Unknown tool: ${e}`)}}setGizmoMode(e){this.selectTool.setGizmoMode(e)}setGizmoVisible(e){this.selectTool.setGizmoVisible(e)}setGizmoScaleLinked(e){this.selectTool.setGizmoScaleLinked(e)}onPointerMove(e){var o;(o=this._activeTool)==null||o.onPointerMove(e)}onPointerDown(e){var o;(o=this._activeTool)==null||o.onPointerDown(e)}onPointerUp(e){var o;(o=this._activeTool)==null||o.onPointerUp(e)}onWheel(e){var o;(o=this._activeTool)==null||o.onWheel(e)}addEventListeners(){this._controller.domElement.addEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.addEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.addEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.addEventListener("wheel",e=>this.onWheel(e))}removeEventListeners(){this._controller.domElement.removeEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.removeEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.removeEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.removeEventListener("wheel",e=>this.onWheel(e))}}l(i,"DefaultTool","select");exports.DIVEBaseTool=n.DIVEBaseTool;exports.DIVESelectTool=n.DIVESelectTool;exports.DIVETransformTool=n.DIVETransformTool;exports.isSelectTool=n.isSelectTool;exports.isTransformTool=n.isTransformTool;exports.Toolbox=i;
1
+ "use strict";var s=Object.defineProperty;var r=(t,e,o)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var l=(t,e,o)=>r(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../chunks/SelectTool-CwFPCf-b.cjs");class i{constructor(e,o){l(this,"_scene");l(this,"_controller");l(this,"_activeTool");l(this,"_selectTool");this._scene=e,this._controller=o,this._selectTool=null,this._activeTool=null}get selectTool(){return this._selectTool||(this._selectTool=new n.DIVESelectTool(this._scene,this._controller)),this._selectTool}dispose(){this.removeEventListeners()}getActiveTool(){return this._activeTool}useTool(e){var o;switch((o=this._activeTool)==null||o.deactivate(),e){case"select":{this.addEventListeners(),this.selectTool.activate(),this._activeTool=this.selectTool;break}case"none":{this.removeEventListeners(),this._activeTool=null;break}default:console.warn(`DIVEToolBox.useTool: Unknown tool: ${e}`)}}setGizmoMode(e){this.selectTool.setGizmoMode(e)}setGizmoVisible(e){this.selectTool.setGizmoVisible(e)}setGizmoScaleLinked(e){this.selectTool.setGizmoScaleLinked(e)}onPointerMove(e){var o;(o=this._activeTool)==null||o.onPointerMove(e)}onPointerDown(e){var o;(o=this._activeTool)==null||o.onPointerDown(e)}onPointerUp(e){var o;(o=this._activeTool)==null||o.onPointerUp(e)}onWheel(e){var o;(o=this._activeTool)==null||o.onWheel(e)}addEventListeners(){this._controller.domElement.addEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.addEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.addEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.addEventListener("wheel",e=>this.onWheel(e))}removeEventListeners(){this._controller.domElement.removeEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.removeEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.removeEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.removeEventListener("wheel",e=>this.onWheel(e))}}l(i,"DefaultTool","select");exports.DIVEBaseTool=n.DIVEBaseTool;exports.DIVESelectTool=n.DIVESelectTool;exports.DIVETransformTool=n.DIVETransformTool;exports.isSelectTool=n.isSelectTool;exports.isTransformTool=n.isTransformTool;exports.Toolbox=i;
@@ -1,8 +1,8 @@
1
1
  var i = Object.defineProperty;
2
2
  var s = (t, e, o) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
3
  var n = (t, e, o) => s(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { D as l } from "../../chunks/SelectTool-BIzbqC0O.mjs";
5
- import { a as m, c as T, i as d, b as _ } from "../../chunks/SelectTool-BIzbqC0O.mjs";
4
+ import { D as l } from "../../chunks/SelectTool-DujSa1r0.mjs";
5
+ import { a as m, c as T, i as d, b as _ } from "../../chunks/SelectTool-DujSa1r0.mjs";
6
6
  class r {
7
7
  constructor(e, o) {
8
8
  n(this, "_scene");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/dive",
3
- "version": "2.2.15",
3
+ "version": "2.2.16",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
6
  "main": "build/dive.cjs",
@@ -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;