@shopware-ag/dive 2.1.1 → 2.1.2
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.
- package/build/chunks/{AssetCache-B02vAmfm.cjs → AssetCache-TvwR2H4n.cjs} +1 -1
- package/build/chunks/{AssetCache-DP95DtBA.mjs → AssetCache-nWe2kXVH.mjs} +1 -1
- package/build/chunks/{AssetLoader-BOnrkFcl.mjs → AssetLoader-BUfmW1RY.mjs} +2 -2
- package/build/chunks/{AssetLoader-C6MLrKu2.cjs → AssetLoader-CX9EEQuM.cjs} +1 -1
- package/build/chunks/{FileTypes-D5zw1toN.mjs → FileTypes-BIdZgVcQ.mjs} +123 -167
- package/build/chunks/FileTypes-CfyYHJWw.cjs +29 -0
- package/build/chunks/{SelectTool-BNZdhIaO.mjs → SelectTool-CwQY2P8A.mjs} +1 -1
- package/build/chunks/{SelectTool-J55L_APQ.cjs → SelectTool-LE2592aq.cjs} +1 -1
- package/build/components/model/Model.d.ts +3 -3
- package/build/components/primitive/Primitive.d.ts +6 -7
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +1 -1
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +2 -2
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +1 -1
- package/build/chunks/FileTypes-BobMthbh.cjs +0 -29
|
@@ -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 { F as vd } from "../../chunks/FileTypes-
|
|
5
|
+
import { F as vd } from "../../chunks/FileTypes-BIdZgVcQ.mjs";
|
|
6
6
|
import { a as _o, i as wd } from "../../chunks/PovSchema-DWWvr_ED.mjs";
|
|
7
|
-
import { i as po } from "../../chunks/SelectTool-
|
|
7
|
+
import { i as po } from "../../chunks/SelectTool-CwQY2P8A.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-
|
|
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-LE2592aq.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-
|
|
5
|
-
import { a as m, c as T, i as d, b as _ } from "../../chunks/SelectTool-
|
|
4
|
+
import { D as l } from "../../chunks/SelectTool-CwQY2P8A.mjs";
|
|
5
|
+
import { a as m, c as T, i as d, b as _ } from "../../chunks/SelectTool-CwQY2P8A.mjs";
|
|
6
6
|
class r {
|
|
7
7
|
constructor(e, o) {
|
|
8
8
|
n(this, "_scene");
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var ie=(h,o,e)=>o in h?te(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e;var i=(h,o,e)=>ie(h,typeof o!="symbol"?o+"":o,e);const s=require("three"),l=require("./PerspectiveCamera-Dp8ElZGj.cjs"),w=require("three-spritetext");class T{constructor(){i(this,"isDIVEClock",!0);i(this,"_lastTime",0);i(this,"_isRunning",!1);i(this,"_tickers",[])}start(){this._isRunning||(this._isRunning=!0,this._lastTime=performance.now(),requestAnimationFrame(this._tick.bind(this)))}stop(){this._isRunning=!1}addTicker(o){this._tickers.find(e=>e.uuid===o.uuid)||this._tickers.push(o)}hasTicker(o){return this._tickers.find(e=>e.uuid===o.uuid)!==void 0}removeTicker(o){const e=this._tickers.findIndex(t=>t.uuid===o.uuid);e!==-1&&this._tickers.splice(e,1)}dispose(){this.stop(),this._tickers=[],this._isRunning=!1,this._lastTime=0}_tick(o){if(!this._isRunning)return;const e=(o-this._lastTime)/1e3;this._lastTime=o,this._tickers.forEach(t=>t.tick(e)),requestAnimationFrame(this._tick.bind(this))}}const E={canvas:void 0,antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp",stencil:!1,depth:!0,logarithmicDepthBuffer:!1,shadows:!0,shadowQuality:"high"};class S{constructor(o,e,t){i(this,"isDIVERenderer",!0);i(this,"_webglrenderer");i(this,"_settings");this._scene=o,this._camera=e,this._settings={...E,...t??{}},this._webglrenderer=this._createWebGLRenderer()}get webglrenderer(){return this._webglrenderer}get canvas(){return this._webglrenderer.domElement}render(){this._webglrenderer.render(this._scene,this._camera)}onResize(o,e){this._webglrenderer.setSize(o,e,!1)}dispose(){this._webglrenderer.dispose()}setCanvas(o){this._webglrenderer.dispose(),this._settings.canvas=o,this._webglrenderer=this._createWebGLRenderer()}_createWebGLRenderer(){const o=new s.WebGLRenderer(this._settings);return o.shadowMap.enabled=this._settings.shadows,o.shadowMap.type=this._settings.shadowQuality==="high"?s.PCFSoftShadowMap:this._settings.shadowQuality==="medium"?s.PCFShadowMap:s.BasicShadowMap,o.setPixelRatio(window.devicePixelRatio),o}}const se=S;class L{constructor(o,e){i(this,"isDIVEResizeManager",!0);i(this,"_resizeObserver");i(this,"_width",0);i(this,"_height",0);this._renderer=o,this._camera=e,this._resizeObserver=new ResizeObserver(t=>{const r=t[0],{width:n,height:a}=r.contentRect;n===this._width&&a===this._height||(this._renderer.onResize(n,a),this._camera.onResize(n,a),this._width=n,this._height=a)}),this._observeCanvas(this._renderer.canvas)}setCanvas(o){this._resizeObserver.disconnect(),this._observeCanvas(o);const{width:e,height:t}=o.getBoundingClientRect();this._renderer.onResize(e,t),this._camera.onResize(e,t),this._width=e,this._height=t}dispose(){this._resizeObserver.disconnect()}_observeCanvas(o){if(o.parentElement)this._resizeObserver.observe(o.parentElement);else{const e=setInterval(()=>{o.parentElement&&(this._resizeObserver.observe(o.parentElement),clearInterval(e))},16)}}}class D{constructor(o,e,t){i(this,"isDIVEView",!0);i(this,"uuid",s.MathUtils.generateUUID());i(this,"_paused",!1);i(this,"_renderer");i(this,"_resizeManager");this._scene=o,this._camera=e,this._settings=t,this._renderer=new S(this._scene,this._camera,this._settings),this._resizeManager=new L(this._renderer,this._camera)}get renderer(){return this._renderer}get camera(){return this._camera}get canvas(){return this._renderer.canvas}tick(){this._paused||this._renderer.render()}dispose(){this._resizeManager.dispose(),this._renderer.dispose()}onResize(o,e){this._renderer.onResize(o,e),this._camera.onResize(o,e)}setCanvas(o){this._renderer.setCanvas(o),this._resizeManager.setCanvas(o),this.onResize(this._renderer.canvas.clientWidth,this._renderer.canvas.clientHeight)}pause(){this._paused=!0}resume(){this._paused=!1}}class x extends s.Object3D{constructor(){super();i(this,"isDIVELight",!0);i(this,"isDIVEAmbientLight",!0);i(this,"isSelectable",!0);i(this,"_light");this.name="DIVEAmbientLight",this._light=new s.AmbientLight(16777215,1),this._light.layers.mask=l.PRODUCT_LAYER_MASK,this.add(this._light)}setColor(e){this._light.color=e}setIntensity(e){this._light.intensity=e}setEnabled(e){this._light.visible=e}}class V extends s.Object3D{constructor(){super();i(this,"isDIVELight",!0);i(this,"isDIVEPointLight",!0);i(this,"isMovable",!0);i(this,"isSelectable",!0);i(this,"gizmo",null);i(this,"light");i(this,"mesh");this.name="DIVEPointLight",this.light=new s.PointLight(16777215,1),this.light.layers.mask=l.PRODUCT_LAYER_MASK,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const e=.1,t=new s.SphereGeometry(e,e*320,e*320),r=new s.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:s.FrontSide});this.mesh=new s.Mesh(t,r),this.mesh.layers.mask=l.UI_LAYER_MASK,this.add(this.mesh)}setColor(e){this.light.color=e,this.mesh.material.color=e}setIntensity(e){this.light.intensity=e,this.mesh.material.opacity=e>.8?.8:e*.8}setEnabled(e){this.light.visible=e}onMove(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})})}onSelect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class R extends s.Object3D{constructor(){super();i(this,"isDIVELight",!0);i(this,"isDIVESceneLight",!0);i(this,"isSelectable",!0);i(this,"_hemiLight");i(this,"_dirLight");this.name="DIVESceneLight",this._hemiLight=new s.HemisphereLight(16777215,16777215,2),this._hemiLight.layers.mask=l.PRODUCT_LAYER_MASK,this._hemiLight.position.set(0,50,0),this._hemiLight.visible=!0,this.add(this._hemiLight),this._dirLight=new s.DirectionalLight(16777215,3),this._dirLight.layers.mask=l.PRODUCT_LAYER_MASK,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.visible=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const e=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=e,this._dirLight.shadow.camera.top=e,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}setColor(e){this._hemiLight.color=e,this._dirLight.color=e}setIntensity(e){this._hemiLight.intensity=e*2,this._dirLight.intensity=e*3}setEnabled(e){this._hemiLight.visible=e,this._dirLight.visible=e}}const y=h=>h.parent?y(h.parent):h;class f extends s.Object3D{constructor(){super();i(this,"isSelectable",!0);i(this,"isMovable",!0);i(this,"isDIVENode",!0);i(this,"gizmo",null);i(this,"_positionWorldBuffer");i(this,"_boundingBox");this.layers.mask=l.PRODUCT_LAYER_MASK,this._positionWorldBuffer=new s.Vector3,this._boundingBox=new s.Box3}setPosition(e){if(!this.parent){this.position.set(e.x,e.y,e.z);return}const t=new s.Vector3(e.x,e.y,e.z);this.position.copy(this.parent.worldToLocal(t)),"isDIVEGroup"in this.parent&&this.parent.updateLineTo(this)}setRotation(e){this.rotation.set(e.x,e.y,e.z)}setScale(e){this.scale.set(e.x,e.y,e.z)}setVisibility(e){this.visible=e}setToWorldOrigin(){this.position.set(0,0,0),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onMove(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onSelect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class C extends f{constructor(){super();i(this,"isDIVEModel",!0);i(this,"_mesh",null);i(this,"_material",null);i(this,"_assetLoader",null);this.name="DIVEModel"}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await Promise.resolve().then(()=>require("../plugins/assetloader/index.cjs"))).AssetLoader),this._assetLoader}async setFromURL(e){const r=await(await this._getAssetLoader()).load(e);return this.setFromGLTF(r),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:n})=>{var a;(a=n.get(this.userData.id))==null||a.performAction("MODEL_LOADED",{id:this.userData.id})}),this}setFromGLTF(e){return this.clear(),this._boundingBox.makeEmpty(),e.traverse(t=>{t.castShadow=!0,t.receiveShadow=!0,t.layers.mask=this.layers.mask,this._boundingBox.expandByObject(t),!this._mesh&&"isMesh"in t&&(this._mesh=t,this._material?this._mesh.material=this._material:this._material=t.material)}),this.add(e),this}setMaterial(e){this._material||(this._material=new s.MeshStandardMaterial),e.vertexColors!==void 0&&(this._material.vertexColors=e.vertexColors),e.color!==void 0&&this._material.color.set(e.color),e.map!==void 0&&(this._material.map=e.map),e.normalMap!==void 0&&(this._material.normalMap=e.normalMap),e.roughness!==void 0&&(this._material.roughness=e.roughness),e.roughnessMap!==void 0&&(this._material.roughnessMap=e.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),e.metalness!==void 0&&(this._material.metalness=e.metalness),e.metalnessMap!==void 0&&(this._material.metalnessMap=e.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}placeOnFloor(){var n,a,c,u;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(a=(n=this._mesh)==null?void 0:n.geometry)==null||a.computeBoundingBox();const r=(u=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:u.boundingBox;!r||!this._mesh||(e.y=e.y-this._mesh.localToWorld(r.min.clone()).y,e.y!==t.y&&Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:d})=>{var p;(p=d.get(this.userData.id))==null||p.performAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})}))}dropIt(){if(!this.parent){console.warn("DIVEModel: dropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new s.Vector3).multiply(this.scale));t.y=e+this.position.y;const r=new s.Raycaster(t,new s.Vector3(0,-1,0));r.layers.mask=l.PRODUCT_LAYER_MASK;const n=r.intersectObjects(y(this).root.children,!0);if(n.length>0){const a=n[0].object;a.geometry.computeBoundingBox();const c=a.geometry.boundingBox,u=a.localToWorld(c.max.clone()),d=this.position.clone(),p=this.position.clone().setY(u.y).sub(new s.Vector3(0,e,0));if(this.position.copy(p),this.position.y===d.y)return;this.onMove()}}}class A extends f{constructor(){super();i(this,"isDIVEPrimitive",!0);i(this,"_mesh");this._mesh=new s.Mesh,this._mesh.layers.mask=l.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new s.MeshStandardMaterial,this.add(this._mesh)}setGeometry(e){const t=this.assembleGeometry(e);t&&(this._mesh.geometry=t,this._boundingBox.setFromObject(this._mesh))}setMaterial(e){const t=this._mesh.material;e.vertexColors!==void 0&&(t.vertexColors=e.vertexColors),e.color!==void 0&&(t.color=new s.Color(e.color)),e.map!==void 0&&(t.map=e.map),e.normalMap!==void 0&&(t.normalMap=e.normalMap),e.roughness!==void 0&&(t.roughness=e.roughness),e.roughnessMap!==void 0&&(t.roughnessMap=e.roughnessMap,t.roughnessMap&&(t.roughness=1)),e.metalness!==void 0&&(t.metalness=e.metalness),e.metalnessMap!==void 0&&(t.metalnessMap=e.metalnessMap,t.metalnessMap&&(t.metalness=0)),this._mesh&&(this._mesh.material=t)}placeOnFloor(){var n,a,c,u;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(a=(n=this._mesh)==null?void 0:n.geometry)==null||a.computeBoundingBox();const r=(u=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:u.boundingBox;!r||!this._mesh||(e.y=e.y-this._mesh.localToWorld(r.min.clone()).y,e.y!==t.y&&Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:d})=>{var p;(p=d.get(this.userData.id))==null||p.performAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})}))}dropIt(){if(!this.parent){console.warn("DIVEPrimitive: dropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new s.Vector3).multiply(this.scale));t.y=e+this.position.y;const r=new s.Raycaster(t,new s.Vector3(0,-1,0));r.layers.mask=l.PRODUCT_LAYER_MASK;const n=r.intersectObjects(y(this).root.children,!0);if(n.length>0){const a=n[0].object;a.geometry.computeBoundingBox();const c=a.geometry.boundingBox,u=a.localToWorld(c.max.clone()),d=this.position.clone(),p=this.position.clone().setY(u.y).sub(new s.Vector3(0,e,0));if(this.position.copy(p),this.position.y===d.y)return;this.onMove()}}assembleGeometry(e){switch(this._mesh.material.flatShading=!1,e.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(e);case"sphere":return this.createSphereGeometry(e);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(e);case"cube":case"box":return this.createBoxGeometry(e);case"cone":return this.createConeGeometry(e);case"wall":return this.createWallGeometry(e);case"plane":return this.createPlaneGeometry(e);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",e.name.toLowerCase()),null}}createCylinderGeometry(e){const t=new s.CylinderGeometry(e.width/2,e.width/2,e.height,64);return t.translate(0,e.height/2,0),t}createSphereGeometry(e){return new s.SphereGeometry(e.width/2,256,256)}createPyramidGeometry(e){const t=new Float32Array([-e.width/2,0,-e.depth/2,e.width/2,0,-e.depth/2,e.width/2,0,e.depth/2,-e.width/2,0,e.depth/2,0,e.height,0]),r=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),n=new s.BufferGeometry;return n.setAttribute("position",new s.BufferAttribute(t,3)),n.setIndex(new s.BufferAttribute(r,1)),n.computeVertexNormals(),n.computeBoundingBox(),n.computeBoundingSphere(),n}createBoxGeometry(e){const t=new s.BoxGeometry(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}createConeGeometry(e){const t=new s.ConeGeometry(e.width/2,e.height,256);return t.translate(0,e.height/2,0),t}createWallGeometry(e){const t=new s.BoxGeometry(e.width,e.height,e.depth||.05,16);return t.translate(0,e.height/2,0),t}createPlaneGeometry(e){const t=new s.BoxGeometry(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}}class k extends f{constructor(){super();i(this,"isDIVEGroup",!0);i(this,"_members");i(this,"_lines");this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}setPosition(e){super.setPosition(e),this._members.forEach(t=>{"isDIVENode"in t&&t.onMove()})}setLinesVisibility(e,t){if(!t){this._lines.forEach(n=>{n.visible=e});return}const r=this._members.indexOf(t);r!==-1&&(this._lines[r].visible=e)}attach(e){if(this._members.includes(e))return this;const t=this.createLine();return this.add(t),this._lines.push(t),super.attach(e),this._members.push(e),this._updateLineTo(t,e),this.setLinesVisibility(!0,e),this}remove(e){const t=this._members.indexOf(e);if(t===-1)return this;const r=this._lines[t];return super.remove(r),this._lines.splice(t,1),super.remove(e),this._members.splice(t,1),this}updateLineTo(e){const t=this._members.indexOf(e);t!==-1&&this._updateLineTo(this._lines[t],e)}createLine(){const e=new s.BufferGeometry,t=new s.LineDashedMaterial({color:6710886,dashSize:.05,gapSize:.025}),r=new s.Line(e,t);return r.visible=!1,r}_updateLineTo(e,t){const r=[new s.Vector3(0,0,0),t.position.clone()];e.geometry.setFromPoints(r),e.computeLineDistances()}}class O extends s.Mesh{constructor(){const e=new s.PlaneGeometry(1,1);e.scale(1e3,1e3,1),e.rotateX(-Math.PI/2);const t=new s.MeshStandardMaterial({color:new s.Color(16777215),side:s.FrontSide});super(e,t);i(this,"isDIVEFloor",!0);this.name="Floor",this.layers.mask=l.PRODUCT_LAYER_MASK,this.receiveShadow=!0}setVisibility(e){this.visible=e}setColor(e){this.material.color=new s.Color(e)}}class B extends s.Object3D{constructor(){super();i(this,"isDIVERoot",!0);i(this,"_floor");this.name="Root",this._floor=new O,this.add(this._floor)}get floor(){return this._floor}computeSceneBB(){const e=new s.Box3;return this.children.forEach(t=>{"isDIVEFloor"in t||t.traverse(r=>{"isObject3D"in r&&e.expandByObject(r)})}),e}getSceneObject(e){let t;return this.traverse(r=>{t||r.userData.id===e.id&&(t=r)}),t}addSceneObject(e){let t=this.getSceneObject(e);if(t)return console.warn(`DIVERoot.addSceneObject: Scene object with id ${e.id} already exists`),t;switch(e.entityType){case"pov":break;case"light":{switch(e.type){case"scene":{t=new R;break}case"ambient":{t=new x;break}case"point":{t=new V;break}default:throw new Error(`DIVERoot.addSceneObject: Unknown light type: ${e.type}`)}t.name=e.name,t.userData.id=e.id,this.add(t),this._updateLight(t,e);break}case"model":{t=new C,t.name=e.name,t.userData.id=e.id,t.userData.uri=e.uri,this.add(t),this._updateModel(t,e);break}case"primitive":{t=new A,t.name=e.name,t.userData.id=e.id,this.add(t),this._updatePrimitive(t,e);break}case"group":{t=new k,t.name=e.name,t.userData.id=e.id,this.add(t),this._updateGroup(t,e);break}default:throw new Error(`DIVERoot.addSceneObject: Unknown entity type: ${e.entityType}`)}return t}updateSceneObject(e){const t=this.getSceneObject(e);if(!t){console.warn(`DIVERoot.updateSceneObject: Scene object with id ${e.id} does not exist`);return}switch(e.entityType){case"pov":break;case"light":{this._updateLight(t,e);break}case"model":{this._updateModel(t,e);break}case"primitive":{this._updatePrimitive(t,e);break}case"group":{this._updateGroup(t,e);break}default:throw new Error(`DIVERoot.updateSceneObject: Unknown entity type: ${e.entityType}`)}}deleteSceneObject(e){const t=this.getSceneObject(e);if(!t){console.warn(`DIVERoot.deleteSceneObject: Object with id ${e.id} not found`);return}switch(e.entityType){case"pov":break;case"light":{this._deleteLight(t);break}case"model":{this._deleteModel(t);break}case"primitive":{this._deletePrimitive(t);break}case"group":{this._deleteGroup(t);break}default:throw new Error(`DIVERoot.deleteSceneObject: Unknown entity type: ${e.entityType}`)}}_updateLight(e,t){t.name!==void 0&&t.name!==null&&(e.name=t.name),t.position!==void 0&&t.position!==null&&e.position.set(t.position.x,t.position.y,t.position.z),t.intensity!==void 0&&t.intensity!==null&&e.setIntensity(t.intensity),t.enabled!==void 0&&t.enabled!==null&&e.setEnabled(t.enabled),t.color!==void 0&&t.color!==null&&e.setColor(new s.Color(t.color)),t.visible!==void 0&&t.visible!==null&&(e.visible=t.visible),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_updateModel(e,t){t.uri!==void 0&&e.setFromURL(t.uri),t.name!==void 0&&(e.name=t.name),t.position!==void 0&&e.setPosition(t.position),t.rotation!==void 0&&e.setRotation(t.rotation),t.scale!==void 0&&e.setScale(t.scale),t.visible!==void 0&&e.setVisibility(t.visible),t.material!==void 0&&e.setMaterial(t.material),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_updatePrimitive(e,t){t.name!==void 0&&(e.name=t.name),t.geometry!==void 0&&e.setGeometry(t.geometry),t.position!==void 0&&e.setPosition(t.position),t.rotation!==void 0&&e.setRotation(t.rotation),t.scale!==void 0&&e.setScale(t.scale),t.visible!==void 0&&e.setVisibility(t.visible),t.material!==void 0&&e.setMaterial(t.material),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_updateGroup(e,t){t.name!==void 0&&(e.name=t.name),t.position!==void 0&&e.setPosition(t.position),t.rotation!==void 0&&e.setRotation(t.rotation),t.scale!==void 0&&e.setScale(t.scale),t.visible!==void 0&&e.setVisibility(t.visible),t.bbVisible!==void 0&&e.setLinesVisibility(t.bbVisible),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_deleteLight(e){this._detachTransformControls(e),e.parent.remove(e)}_deleteModel(e){this._detachTransformControls(e),e.parent.remove(e)}_deletePrimitive(e){this._detachTransformControls(e),e.parent.remove(e)}_deleteGroup(e){this._detachTransformControls(e);for(let t=e.members.length-1;t>=0;t--)this.attach(e.members[t]);e.parent.remove(e)}_setParent(e){const t=this.getSceneObject(e);if(e.parentId!==null){const r=this.getSceneObject({id:e.parentId,entityType:e.entityType});if(!r)return;r.attach(t)}else this.attach(t)}_detachTransformControls(e){this._findScene(e).children.find(t=>{"isTransformControls"in t&&t.detach()})}_findScene(e){return e.parent!==null?this._findScene(e.parent):e}}const z="#888888",G="#dddddd";class U extends s.Object3D{constructor(){super(),this.name="Grid";const o=new s.GridHelper(100,100,z,G);o.material.depthTest=!1,o.layers.mask=l.HELPER_LAYER_MASK,this.add(o)}setVisibility(o){this.visible=o}}const _={displayFloor:!1,displayGrid:!1,backgroundColor:"#ffffff"};class F extends s.Scene{constructor(e){super();i(this,"isDIVEScene",!0);i(this,"_root");i(this,"_grid");this.background=new s.Color((e==null?void 0:e.backgroundColor)??_.backgroundColor),this._root=new B,this._root.floor.setVisibility((e==null?void 0:e.displayFloor)??_.displayFloor),this.add(this._root),this._grid=new U,this._grid.setVisibility((e==null?void 0:e.displayGrid)??_.displayGrid),this.add(this._grid)}get root(){return this._root}get grid(){return this._grid}setBackground(e){this.background=new s.Color(e)}computeSceneBB(){return this._root.computeSceneBB()}}const Y={enableDamping:!0,dampingFactor:.05,enabled:!0,target:new s.Vector3,minDistance:0,maxDistance:1/0,minZoom:0,maxZoom:1/0,minPolarAngle:0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,maxAzimuthAngle:1/0,enableZoom:!0,zoomSpeed:1,enableRotate:!0,rotateSpeed:1,enablePan:!0,panSpeed:1,screenSpacePanning:!0,keyPanSpeed:7,autoRotate:!1,autoRotateSpeed:2,keys:{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},mouseButtons:{LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},touches:{ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN}},g=class g extends s.EventDispatcher{constructor(e,t,r){super();i(this,"object");i(this,"domElements");i(this,"enabled",!0);i(this,"target",new s.Vector3);i(this,"minDistance",0);i(this,"maxDistance",1/0);i(this,"minZoom",0);i(this,"maxZoom",1/0);i(this,"minPolarAngle",0);i(this,"maxPolarAngle",Math.PI);i(this,"minAzimuthAngle",-1/0);i(this,"maxAzimuthAngle",1/0);i(this,"enableDamping",!0);i(this,"dampingFactor",.05);i(this,"enableZoom",!0);i(this,"zoomSpeed",1);i(this,"enableRotate",!0);i(this,"rotateSpeed",1);i(this,"enablePan",!0);i(this,"panSpeed",1);i(this,"screenSpacePanning",!0);i(this,"keyPanSpeed",7);i(this,"autoRotate",!1);i(this,"autoRotateSpeed",2);i(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"});i(this,"mouseButtons",{LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN});i(this,"touches",{ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN});i(this,"target0");i(this,"position0");i(this,"zoom0");i(this,"uuid",s.MathUtils.generateUUID());i(this,"state",-1);i(this,"EPS",1e-6);i(this,"spherical",new s.Spherical);i(this,"sphericalDelta",new s.Spherical);i(this,"scale",1);i(this,"panOffset",new s.Vector3);i(this,"zoomChanged",!1);i(this,"rotateStart",new s.Vector2);i(this,"rotateEnd",new s.Vector2);i(this,"rotateDelta",new s.Vector2);i(this,"panStart",new s.Vector2);i(this,"panEnd",new s.Vector2);i(this,"panDelta",new s.Vector2);i(this,"dollyStart",new s.Vector2);i(this,"dollyEnd",new s.Vector2);i(this,"dollyDelta",new s.Vector2);i(this,"pointers",[]);i(this,"pointerPositions",{});i(this,"offset",new s.Vector3);i(this,"quat");i(this,"quatInverse");i(this,"lastPosition",new s.Vector3);i(this,"lastQuaternion",new s.Quaternion);i(this,"lastTarget",new s.Vector3);i(this,"panLeft",(()=>{const e=new s.Vector3;return(t,r)=>{e.setFromMatrixColumn(r,0),e.multiplyScalar(-t),this.panOffset.add(e)}})());i(this,"panUp",(()=>{const e=new s.Vector3;return(t,r)=>{this.screenSpacePanning===!0?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(this.object.up,e)),e.multiplyScalar(t),this.panOffset.add(e)}})());i(this,"onMouseDown",e=>{let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case s.MOUSE.DOLLY:if(this.enableZoom===!1)return;this.handleMouseDownDolly(e),this.state=1;break;case s.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(e),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}break;case s.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(e),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent({type:"start"})});i(this,"onMouseMove",e=>{if(this.enabled!==!1)switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(e);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(e);break}});i(this,"onMouseWheel",e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1||(e.preventDefault(),this.dispatchEvent({type:"start"}),this.handleMouseWheel(e),this.dispatchEvent({type:"end"}))});i(this,"onKeyDown",e=>{this.enabled===!1||this.enablePan===!1||this.handleKeyDown(e)});i(this,"onTouchStart",e=>{switch(this.trackPointer(e),this.pointers.length){case 1:switch(this.touches.ONE){case s.TOUCH.ROTATE:if(this.enableRotate===!1)return;this.handleTouchStartRotate(e),this.state=3;break;case s.TOUCH.PAN:if(this.enablePan===!1)return;this.handleTouchStartPan(e),this.state=4;break;default:this.state=-1}break;case 2:switch(this.touches.TWO){case s.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(e),this.state=5;break;case s.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(e),this.state=6;break;default:this.state=-1}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent({type:"start"})});i(this,"onTouchMove",e=>{switch(this.trackPointer(e),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(e),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(e),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(e),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:this.state=-1}});i(this,"onPointerDown",e=>{if(this.enabled!==!1){if(this.pointers.length===0){const t=e.currentTarget;t.setPointerCapture(e.pointerId),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp)}this.isTrackingPointer(e)||(this.addPointer(e),e.pointerType==="touch"?this.onTouchStart(e):this.onMouseDown(e))}});i(this,"onPointerMove",e=>{this.enabled!==!1&&(e.pointerType==="touch"?this.onTouchMove(e):this.onMouseMove(e))});i(this,"onPointerUp",e=>{if(this.removePointer(e),this.pointers.length===0){const t=e.currentTarget;t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),this.dispatchEvent({type:"end"}),this.state=-1}});i(this,"onPointerCancel",e=>{this.removePointer(e)});i(this,"onContextMenu",e=>{this.enabled!==!1&&e.preventDefault()});this.object=e,this.domElements=Array.isArray(t)?t:[t],Object.assign(this,r),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat=new s.Quaternion().setFromUnitVectors(e.up,new s.Vector3(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.domElements.forEach(n=>this.addEventListeners(n)),this.update()}get domElement(){return this.domElements[0]}tick(){this.enabled&&this.update()}getPolarAngle(){return this.spherical.phi}getAzimuthalAngle(){return this.spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent({type:"change"}),this.update(),this.state=-1}update(){return this.offset.copy(this.object.position).sub(this.target),this.offset.applyQuaternion(this.quat),this.spherical.setFromVector3(this.offset),this.autoRotate&&this.state===-1&&this.rotateLeft(this.getAutoRotationAngle()),this.enableDamping?(this.spherical.theta+=this.sphericalDelta.theta*this.dampingFactor,this.spherical.phi+=this.sphericalDelta.phi*this.dampingFactor):(this.spherical.theta+=this.sphericalDelta.theta,this.spherical.phi+=this.sphericalDelta.phi),this.spherical.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this.spherical.theta)),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),this.spherical.radius*=this.scale,this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius)),this.enableDamping===!0?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),this.offset.setFromSpherical(this.spherical),this.offset.applyQuaternion(this.quatInverse),this.object.position.copy(this.target).add(this.offset),this.object.lookAt(this.target),this.enableDamping===!0?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor,this.panOffset.multiplyScalar(1-this.dampingFactor)):(this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0)),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>this.EPS||8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS||this.lastTarget.distanceToSquared(this.target)>this.EPS?(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.lastTarget.copy(this.target),this.zoomChanged=!1,!0):!1}dispose(){this.domElements.forEach(e=>this.removeEventListeners(e)),this.dispatchEvent({type:"dispose"})}addDomElements(...e){e.forEach(t=>{this.domElements.includes(t)||(this.domElements.push(t),this.addEventListeners(t))})}removeDomElements(...e){e.forEach(t=>{const r=this.domElements.indexOf(t);r>-1&&(this.removeEventListeners(t),this.domElements.splice(r,1))})}setDomElements(...e){this.removeDomElements(...this.domElements),this.domElements=[],this.addDomElements(...e)}computeEncompassingView(e,t=0){const r=e.center,a=e.sphere.radius,c=this.object.fov*(Math.PI/180),u=this.object.aspect,d=c/2,p=Math.atan(Math.tan(d)*u),J=a/Math.sin(d),j=a/Math.sin(p),$=Math.max(J,j)*(1+t),I=this.object.position.clone().sub(this.target).normalize(),ee=I.length()>.001?I:new s.Vector3(0,0,1);return{position:r.clone().add(ee.multiplyScalar($)),target:r}}focusObject(e,t=0){const r=new X(e),n=this.computeEncompassingView(r,t);this.object.position.copy(n.position),this.target.copy(n.target),this.update()}zoomIn(e){this.dollyIn(Math.pow(.95,e??g.DEFAULT_ZOOM_FACTOR)),this.update()}zoomOut(e){this.dollyOut(Math.pow(.95,e??g.DEFAULT_ZOOM_FACTOR)),this.update()}getState(){return{target:this.target.clone(),azimuthalAngle:this.getAzimuthalAngle(),polarAngle:this.getPolarAngle(),distance:this.getDistance(),position:this.object.position.clone(),quaternion:this.object.quaternion.clone()}}setState(e){this.target.copy(e.target),this.object.position.copy(e.position),this.object.quaternion.copy(e.quaternion),this.update()}addEventListeners(e){e.style.touchAction="none",e.addEventListener("contextmenu",this.onContextMenu),e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerCancel),e.addEventListener("wheel",this.onMouseWheel,{passive:!1}),e.addEventListener("keydown",this.onKeyDown)}removeEventListeners(e){e.removeEventListener("contextmenu",this.onContextMenu),e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointercancel",this.onPointerCancel),e.removeEventListener("wheel",this.onMouseWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(e){this.sphericalDelta.theta-=e}rotateUp(e){this.sphericalDelta.phi-=e}pan(e,t,r){const n=new s.Vector3;if("isPerspectiveCamera"in this.object){const a=this.object.position;n.copy(a).sub(this.target);let c=n.length();c*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*c/r.clientHeight,this.object.matrix),this.panUp(2*t*c/r.clientHeight,this.object.matrix)}else"isOrthographicCamera"in this.object?(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitController encountered an unknown camera type - pan disabled."),this.enablePan=!1)}dollyIn(e){"isPerspectiveCamera"in this.object||"isOrthographicCamera"in this.object?this.scale*=e:(console.warn("WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}dollyOut(e){"isPerspectiveCamera"in this.object||"isOrthographicCamera"in this.object?this.scale/=e:(console.warn("WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}handleMouseDownRotate(e){this.rotateStart.set(e.clientX,e.clientY)}handleMouseDownDolly(e){this.dollyStart.set(e.clientX,e.clientY)}handleMouseDownPan(e){this.panStart.set(e.clientX,e.clientY)}handleMouseMoveRotate(e){this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const t=e.currentTarget;this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(e){this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyIn(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyOut(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(e){const t=e.currentTarget;this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y,t),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(e){e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update()}handleKeyDown(e){let t=!1;const r=e.currentTarget;switch(e.code){case this.keys.UP:this.pan(0,this.keyPanSpeed,r),t=!0;break;case this.keys.BOTTOM:this.pan(0,-this.keyPanSpeed,r),t=!0;break;case this.keys.LEFT:this.pan(this.keyPanSpeed,0,r),t=!0;break;case this.keys.RIGHT:this.pan(-this.keyPanSpeed,0,r),t=!0;break}t&&(e.preventDefault(),this.update())}handleTouchStartRotate(e){if(this.pointers.length===1)this.rotateStart.set(e.pageX,e.pageY);else{const t=this.getSecondPointer(e),r=.5*(e.pageX+t.pageX),n=.5*(e.pageY+t.pageY);this.rotateStart.set(r,n)}}handleTouchStartPan(e){if(this.pointers.length===1)this.panStart.set(e.pageX,e.pageY);else{const t=this.getSecondPointer(e),r=.5*(e.pageX+t.pageX),n=.5*(e.pageY+t.pageY);this.panStart.set(r,n)}}handleTouchStartDolly(e){const t=this.getSecondPointer(e),r=e.pageX-t.pageX,n=e.pageY-t.pageY,a=Math.sqrt(r*r+n*n);this.dollyStart.set(0,a)}handleTouchStartDollyPan(e){this.enableZoom&&this.handleTouchStartDolly(e),this.enablePan&&this.handleTouchStartPan(e)}handleTouchStartDollyRotate(e){this.enableZoom&&this.handleTouchStartDolly(e),this.enableRotate&&this.handleTouchStartRotate(e)}handleTouchMoveRotate(e){if(this.pointers.length===1)this.rotateEnd.set(e.pageX,e.pageY);else{const r=this.getSecondPointer(e),n=.5*(e.pageX+r.pageX),a=.5*(e.pageY+r.pageY);this.rotateEnd.set(n,a)}const t=e.currentTarget;this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed),this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(e){if(this.pointers.length===1)this.panEnd.set(e.pageX,e.pageY);else{const r=this.getSecondPointer(e),n=.5*(e.pageX+r.pageX),a=.5*(e.pageY+r.pageY);this.panEnd.set(n,a)}const t=e.currentTarget;this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y,t),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(e){const t=this.getSecondPointer(e),r=e.pageX-t.pageX,n=e.pageY-t.pageY,a=Math.sqrt(r*r+n*n);this.dollyEnd.set(0,a),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}addPointer(e){this.pointers.push(e)}removePointer(e){delete this.pointerPositions[e.pointerId];for(let t=0;t<this.pointers.length;t++)if(this.pointers[t].pointerId==e.pointerId){this.pointers.splice(t,1);return}}trackPointer(e){let t=this.pointerPositions[e.pointerId];t===void 0&&(t=new s.Vector2,this.pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}getSecondPointer(e){return this.pointers[0].pointerId===e.pointerId?this.pointers[1]:this.pointers[0]}isTrackingPointer(e){return this.pointers.some(t=>t.pointerId===e.pointerId)}};i(g,"DEFAULT_ZOOM_FACTOR",1);let b=g;class H extends s.Object3D{constructor(){super();i(this,"_axesHelper");this._axesHelper=new s.AxesHelper(.5),this._axesHelper.layers.mask=l.COORDINATE_LAYER_MASK,this._axesHelper.material.depthTest=!1,this._axesHelper.position.set(0,0,-1),this._axesHelper.setColors(new s.Color(N),new s.Color(Z),new s.Color(K));const e=new w("X",.2,P),t=new w("Y",.2,M),r=new w("Z",.2,v);e.layers.mask=l.COORDINATE_LAYER_MASK,t.layers.mask=l.COORDINATE_LAYER_MASK,r.layers.mask=l.COORDINATE_LAYER_MASK,e.position.set(.7,0,0),t.position.set(0,.7,0),r.position.set(0,0,.7),this._axesHelper.add(e),this._axesHelper.add(t),this._axesHelper.add(r)}setFromCameraMatrix(e){this._axesHelper.rotation.setFromRotationMatrix(new s.Matrix4().extractRotation(e).invert())}}class W{constructor(o,e,t){i(this,"uuid",s.MathUtils.generateUUID());i(this,"_axes");i(this,"_orthographicCamera");i(this,"_restoreViewport",new s.Vector4);this._renderer=o,this._scene=e,this._camera=t,this._orthographicCamera=new s.OrthographicCamera(-1,1,1,-1,.1,100),this._orthographicCamera.layers.mask=l.COORDINATE_LAYER_MASK,this._scene.add(this._orthographicCamera),this._axes=new H,this._scene.add(this._axes)}tick(){const o=this._scene.background;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=o}dispose(){this._scene.remove(this._axes),this._scene.remove(this._orthographicCamera)}}const oe=`
|
|
2
|
-
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
3
|
-
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
4
|
-
@@%=::::.......::---------------------------------------------------------+@@
|
|
5
|
-
@@+:::...........::-----------------------------------------------------------#@@
|
|
6
|
-
@@=:::.........::::::-------------------------------------------------------------%@
|
|
7
|
-
@%:::.......:::::::-----------------------------------------------------------------#@
|
|
8
|
-
@*:::.....:::::-----------------------------------------------------------------------*@
|
|
9
|
-
@%::::::.::::---------------------------------------------------------------------------@@
|
|
10
|
-
@@-:::::::::-----------------------------------------------------------------------------=@
|
|
11
|
-
@%::::::::--------------------------------------------------------------------------------%@
|
|
12
|
-
@+::::::::--------------------------------=@@@@@%-----------------------------------------%@
|
|
13
|
-
@=:::::::--------------------------------*@@ @@+---------------------------------------#@
|
|
14
|
-
@+:::::::-------------------------------*@ @*--------------------------------------%@
|
|
15
|
-
@#::::::::-----------------------------=@@ @@=-------------------------------------%@
|
|
16
|
-
@@-::::::::----------------------------@@ @@------------------------------------=@
|
|
17
|
-
@%:::::::::--------------------------*@ @*-----------------------------------@@
|
|
18
|
-
@*:::::::::-------------------------@@ @@----------------------------------%@
|
|
19
|
-
@#::::::::::----------------------%@ @%--------------------------------%@
|
|
20
|
-
@#:::::::::::-------------------=@@ @@=------------------------------%@
|
|
21
|
-
@@-::::::::::::----------------%@ @%----------------------------=@@
|
|
22
|
-
@@#::::::::::::::------------*@ @*--------------------------#@@
|
|
23
|
-
@@+::::::::::::::::--------@@ @@------------------------+@@
|
|
24
|
-
@@*:::::::::::::::::----@@ @@---------------------+@@
|
|
25
|
-
@@@-:::::::::::::::--#@ @#-----------------=%@@
|
|
26
|
-
@@%-::::::::::::-%@ @%-------------=%@@
|
|
27
|
-
@@@@+:::::::#@@ @@*-------*@@@@
|
|
28
|
-
@@@@@@@ @@@@@@
|
|
29
|
-
`;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const m={autoStart:!0,displayAxes:!1,..._,...l.DIVEPerspectiveCameraDefaultSettings,...E,...Y};class q{constructor(o){i(this,"_instanceId",s.MathUtils.generateUUID());i(this,"_settings");i(this,"_views");i(this,"_mainView");i(this,"_scene");i(this,"_clock");i(this,"orientationDisplay");this._settings={...m,...o??{}},this._clock=new T,this._scene=new F,this.scene.setBackground((o==null?void 0:o.backgroundColor)??m.backgroundColor),this.scene.grid.setVisibility((o==null?void 0:o.displayGrid)??m.displayGrid),this.scene.root.floor.setVisibility((o==null?void 0:o.displayFloor)??m.displayFloor);const e=new D(this._scene,new l.DIVEPerspectiveCamera,this._settings);this._clock.addTicker(e),this._views=[e],this._mainView=e,this._settings.autoStart&&this.start(),this._settings.displayAxes?(console.log("displayAxes",this._settings.displayAxes),this.orientationDisplay=new W(this.mainView.renderer,this.scene,this.mainView.camera),this.clock.addTicker(this.orientationDisplay)):this.orientationDisplay=null,console.log("DIVE 2.1.1 initialized successfully!"),console.log(oe),window.DIVE.instances.push(this)}static async QuickView(o,e){return Promise.resolve().then(()=>require("../plugins/quickview/index.cjs")).then(({QuickView:t})=>t(o,e))}get engine(){return Object.assign(this,{camera:this.mainView.camera,renderer:this.mainView.renderer,setCanvas:o=>{this.mainView.setCanvas(o)},start:()=>{this.start()},stop:()=>{this.stop()},dispose:()=>{this.dispose()}})}get views(){return this._views}get mainView(){return this._mainView}get canvas(){return this.mainView.canvas}get scene(){return this._scene}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}async dispose(){return new Promise(o=>{this._views.forEach(e=>{e.dispose()}),this._views=[],this.orientationDisplay&&(this._clock.removeTicker(this.orientationDisplay),this.orientationDisplay.dispose()),window.DIVE.instances=window.DIVE.instances.filter(e=>e._instanceId!==this._instanceId),o()})}createView(o){const e=new D(this._scene,o??new l.DIVEPerspectiveCamera,{...this._settings,canvas:void 0});return this._views.push(e),this._clock.addTicker(e),this._views.length===1&&(this._mainView=e),e}disposeView(o){this._views=this._views.filter(e=>e!==o),this._clock.removeTicker(o),this._mainView===o&&(this._mainView=this._views[0]),o.dispose()}}const re=q,P="#c20017",M="#00ab26",v="#0081d4",N=P,Z=M,K=v;class X extends f{constructor(e,t=!1,r=65280){super();i(this,"_box");i(this,"_sphere");i(this,"_center");i(this,"_radius");i(this,"_boxHelper");i(this,"_sphereHelper");i(this,"_size");const n=new s.Box3;t?n.setFromObject(e):(e.updateWorldMatrix(!0,!0),e.traverse(c=>{if(c.isMesh){const u=c,d=u.geometry.clone();d.applyMatrix4(u.matrixWorld);const p=u.getWorldQuaternion(new s.Quaternion).invert();d.applyQuaternion(p),d.computeBoundingBox(),d.boundingBox&&n.union(d.boundingBox)}})),this.rotation.copy(e.rotation),this._box=n,this._size=n.getSize(new s.Vector3),this._center=n.getCenter(new s.Vector3),this._boxHelper=new s.Box3Helper(this._box,r),this._boxHelper.visible=!1,this.add(this._boxHelper),this._sphere=n.getBoundingSphere(new s.Sphere),this._radius=this._sphere.radius;const a=new s.SphereGeometry(this._radius,32,32);a.translate(this._center.x,this._center.y,this._center.z),this._sphereHelper=new s.Mesh(a,new s.MeshBasicMaterial({color:r,wireframe:!0})),this._sphereHelper.visible=!1,this.add(this._sphereHelper)}get box(){return this._box}get sphere(){return this._sphere}get center(){return this._center}get radius(){return this._radius}get size(){return this._size}setBoxHelperVisible(e){this._boxHelper.visible=e}setSphereHelperVisible(e){this._sphereHelper.visible=e}}const Q={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"}},ne=Object.values(Q).map(h=>h.extension);exports.AxesColorBlue=K;exports.AxesColorBlueLetter=v;exports.AxesColorGreen=Z;exports.AxesColorGreenLetter=M;exports.AxesColorRed=N;exports.AxesColorRedLetter=P;exports.BoundingBox=X;exports.DIVE=q;exports.DIVEAmbientLight=x;exports.DIVEClock=T;exports.DIVEDefaultSettings=m;exports.DIVEEngine=re;exports.DIVEFloor=O;exports.DIVEGrid=U;exports.DIVEGroup=k;exports.DIVEModel=C;exports.DIVENode=f;exports.DIVEPointLight=V;exports.DIVEPrimitive=A;exports.DIVERenderPipeline=se;exports.DIVERenderer=S;exports.DIVERendererDefaultSettings=E;exports.DIVEResizeManager=L;exports.DIVERoot=B;exports.DIVEScene=F;exports.DIVESceneDefaultSettings=_;exports.DIVESceneLight=R;exports.DIVEView=D;exports.FILE_TYPES=Q;exports.GRID_CENTER_LINE_COLOR=z;exports.GRID_SIDE_LINE_COLOR=G;exports.OrbitController=b;exports.OrbitControllerDefaultSettings=Y;exports.OrientationDisplay=W;exports.OrientationDisplayAxes=H;exports.SUPPORTED_FILE_TYPES=ne;exports.findSceneRecursive=y;
|