@shopware-ag/dive 2.0.1-beta.7 → 2.0.1-beta.9
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-CWeKL4PT.cjs +1 -0
- package/build/chunks/AssetCache-Y5G3mQU1.mjs +84 -0
- package/build/chunks/{AssetExporter-QnOue3VT.mjs → AssetExporter-CcSkkmZL.mjs} +4 -3
- package/build/chunks/{AssetExporter-TzKB2FHh.cjs → AssetExporter-Ds2dAfxL.cjs} +18 -18
- package/build/chunks/AssetLoader-CMKzMJ1u.cjs +4 -0
- package/build/chunks/{AssetLoader-Dqrg0Re8.mjs → AssetLoader-DjHz5xWK.mjs} +513 -516
- package/build/chunks/{FileTypes-Ca8pkRlQ.cjs → FileTypes-CKOjpHjz.cjs} +1 -1
- package/build/chunks/{FileTypes-CpKiTXEY.mjs → FileTypes-Cu4s3c_0.mjs} +1 -1
- package/build/chunks/{SelectTool-BizqI7_a.cjs → SelectTool-BD6Ccy_2.cjs} +1 -1
- package/build/chunks/{SelectTool-DVFL7BtX.mjs → SelectTool-w7sF1obN.mjs} +1 -1
- package/build/chunks/file-type-error-BsK7IJt7.cjs +1 -0
- package/build/chunks/file-type-error-aWHfMumr.mjs +8 -0
- package/build/chunks/isFileTypeSupported-BSpswPHU.mjs +12 -0
- package/build/chunks/isFileTypeSupported-CrEqYiv9.cjs +1 -0
- package/build/chunks/network-error-BONfHWQq.mjs +14 -0
- package/build/chunks/network-error-CdDXil5g.cjs +1 -0
- package/build/chunks/package-DXbIn_zz.mjs +39 -0
- package/build/chunks/package-DaKgG9tF.cjs +1 -0
- package/build/chunks/parse-error-IryNa_oq.mjs +8 -0
- package/build/chunks/parse-error-m5cNt1UV.cjs +1 -0
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +27 -24
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +59 -54
- package/build/plugins/assetcache/index.cjs +1 -0
- package/build/plugins/assetcache/index.d.ts +2 -0
- package/build/plugins/assetcache/index.mjs +5 -0
- package/build/plugins/assetexporter/index.cjs +1 -1
- package/build/plugins/assetexporter/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/axiscamera/index.cjs +1 -1
- package/build/plugins/axiscamera/index.mjs +1 -1
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +2 -2
- package/build/plugins/systeminfo/index.mjs +1 -1
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/build/src/error/file-content/file-content-error.d.ts +4 -0
- package/build/src/error/index.d.ts +4 -0
- package/build/src/error/network/network-error.d.ts +1 -1
- package/build/src/error/parse/parse-error.d.ts +2 -1
- package/build/src/events/dispatcher/EventDispatcher.d.ts +6 -0
- package/build/src/events/index.d.ts +1 -1
- package/build/src/index.d.ts +1 -3
- package/build/src/plugins/ar/src/error/ar-errors.d.ts +7 -1
- package/build/src/plugins/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +1 -1
- package/build/src/plugins/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/plugins/assetcache/index.d.ts +1 -0
- package/build/src/plugins/assetcache/src/cache/AssetCache.d.ts +11 -0
- package/build/src/plugins/assetcache/src/chunk/Chunk.d.ts +19 -0
- package/build/src/plugins/assetcache/src/index.d.ts +2 -0
- package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +0 -1
- package/build/src/plugins/systeminfo/src/SystemInfo.d.ts +1 -1
- package/package.json +11 -4
- package/build/chunks/AssetLoader-DCBiLwef.cjs +0 -4
- package/build/chunks/network-error-CHvryg-4.mjs +0 -18
- package/build/chunks/network-error-D_pq8VU6.cjs +0 -1
- package/build/chunks/package-CeZyVg2G.mjs +0 -39
- package/build/chunks/package-D_hIrGNz.cjs +0 -1
- package/build/chunks/parse-error-BFRJyIxM.mjs +0 -14
- package/build/chunks/parse-error-Bd09D_1L.cjs +0 -1
- package/build/src/events/EventExecutor.d.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var N=Object.defineProperty;var H=(a,i,e)=>i in a?N(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e;var r=(a,i,e)=>H(a,typeof i!="symbol"?i+"":i,e);const w=require("./OrbitController-rMX8EHvJ.cjs"),s=require("three"),p=require("three-spritetext"),l=require("./PerspectiveCamera-CONx93im.cjs");class L extends s.OrthographicCamera{constructor(e,t,n){super(-1,1,1,-1,.1,100);r(this,"axesHelper");r(this,"_renderer");r(this,"_scene");r(this,"_camera");r(this,"_restoreViewport",new s.Vector4);this.layers.mask=l.COORDINATE_LAYER_MASK,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(F),new s.Color(Y),new s.Color(W));const o=new p("X",.2,v),h=new p("Y",.2,b),d=new p("Z",.2,C);o.layers.mask=l.COORDINATE_LAYER_MASK,h.layers.mask=l.COORDINATE_LAYER_MASK,d.layers.mask=l.COORDINATE_LAYER_MASK,o.position.set(.7,0,0),h.position.set(0,.7,0),d.position.set(0,0,.7),this.axesHelper.add(o),this.axesHelper.add(h),this.axesHelper.add(d),this.add(this.axesHelper),this._renderer=e,this._scene=t,this._camera=n,this._scene.add(this)}tick(){const e=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.setFromCameraMatrix(this._camera.matrix),this._renderer.webglrenderer.render(this._scene,this),this._renderer.webglrenderer.setViewport(this._restoreViewport),this._renderer.webglrenderer.autoClear=!0,this._scene.background=e}dispose(){this._scene.remove(this)}setFromCameraMatrix(e){this.axesHelper.rotation.setFromRotationMatrix(new s.Matrix4().extractRotation(e).invert())}}class S extends s.Object3D{constructor(){super();r(this,"isDIVELight",!0);r(this,"isDIVEAmbientLight",!0);r(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 x extends s.Object3D{constructor(){super();r(this,"isDIVELight",!0);r(this,"isDIVEPointLight",!0);r(this,"isMovable",!0);r(this,"isSelectable",!0);r(this,"gizmo",null);r(this,"light");r(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),n=new s.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:s.FrontSide});this.mesh=new s.Mesh(t,n),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 f extends s.Object3D{constructor(){super();r(this,"isDIVELight",!0);r(this,"isDIVESceneLight",!0);r(this,"_hemiLight");r(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.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.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 m=a=>a.parent?m(a.parent):a;class g extends s.Object3D{constructor(){super();r(this,"isSelectable",!0);r(this,"isMovable",!0);r(this,"isDIVENode",!0);r(this,"gizmo",null);r(this,"_positionWorldBuffer");r(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 E extends g{constructor(){super(...arguments);r(this,"isDIVEModel",!0);r(this,"_mesh",null);r(this,"_material",null);r(this,"_assetLoader",null)}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await Promise.resolve().then(()=>require("../plugins/assetloader/index.cjs"))).AssetLoader),this._assetLoader}async setFromURL(e){const n=await(await this._getAssetLoader()).load(e);this.setFromGLTF(n),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:o})=>{var h;(h=o.get(this.userData.id))==null||h.performAction("MODEL_LOADED",{id:this.userData.id})})}setFromGLTF(e){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)}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 o,h,d,c;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(h=(o=this._mesh)==null?void 0:o.geometry)==null||h.computeBoundingBox();const n=(c=(d=this._mesh)==null?void 0:d.geometry)==null?void 0:c.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:_})=>{var u;(u=_.get(this.userData.id))==null||u.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 n=new s.Raycaster(t,new s.Vector3(0,-1,0));n.layers.mask=l.PRODUCT_LAYER_MASK;const o=n.intersectObjects(m(this).root.children,!0);if(o.length>0){const h=o[0].object;h.geometry.computeBoundingBox();const d=h.geometry.boundingBox,c=h.localToWorld(d.max.clone()),_=this.position.clone(),u=this.position.clone().setY(c.y).sub(new s.Vector3(0,e,0));if(this.position.copy(u),this.position.y===_.y)return;this.onMove()}}}class V extends g{constructor(){super();r(this,"isDIVEPrimitive",!0);r(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 o,h,d,c;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(h=(o=this._mesh)==null?void 0:o.geometry)==null||h.computeBoundingBox();const n=(c=(d=this._mesh)==null?void 0:d.geometry)==null?void 0:c.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:_})=>{var u;(u=_.get(this.userData.id))==null||u.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 n=new s.Raycaster(t,new s.Vector3(0,-1,0));n.layers.mask=l.PRODUCT_LAYER_MASK;const o=n.intersectObjects(m(this).root.children,!0);if(o.length>0){const h=o[0].object;h.geometry.computeBoundingBox();const d=h.geometry.boundingBox,c=h.localToWorld(d.max.clone()),_=this.position.clone(),u=this.position.clone().setY(c.y).sub(new s.Vector3(0,e,0));if(this.position.copy(u),this.position.y===_.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]),n=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),o=new s.BufferGeometry;return o.setAttribute("position",new s.BufferAttribute(t,3)),o.setIndex(new s.BufferAttribute(n,1)),o.computeVertexNormals(),o.computeBoundingBox(),o.computeBoundingSphere(),o}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 P extends g{constructor(){super();r(this,"isDIVEGroup",!0);r(this,"_members");r(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(o=>{o.visible=e});return}const n=this._members.indexOf(t);n!==-1&&(this._lines[n].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 n=this._lines[t];return super.remove(n),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}),n=new s.Line(e,t);return n.visible=!1,n}_updateLineTo(e,t){const n=[new s.Vector3(0,0,0),t.position.clone()];e.geometry.setFromPoints(n),e.computeLineDistances()}}class M 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);r(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 R extends s.Object3D{constructor(){super();r(this,"isDIVERoot",!0);r(this,"_floor");this.name="Root",this._floor=new M,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(n=>{"isObject3D"in n&&e.expandByObject(n)})}),e}getSceneObject(e){let t;return this.traverse(n=>{t||n.userData.id===e.id&&(t=n)}),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 f;break}case"ambient":{t=new S;break}case"point":{t=new x;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 E,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 V,t.name=e.name,t.userData.id=e.id,this.add(t),this._updatePrimitive(t,e);break}case"group":{t=new P,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 n=this.getSceneObject({id:e.parentId,entityType:e.entityType});if(!n)return;n.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 k="#888888",T="#dddddd";class A extends s.Object3D{constructor(){super(),this.name="Grid";const i=new s.GridHelper(100,100,k,T);i.material.depthTest=!1,i.layers.mask=l.HELPER_LAYER_MASK,this.add(i)}setVisibility(i){this.visible=i}}class B extends s.Scene{constructor(){super();r(this,"_root");r(this,"_grid");this.background=new s.Color(16777215),this._root=new R,this.add(this._root),this._grid=new A,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 D={canvas:void 0,antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp",stencil:!1,depth:!0,logarithmicDepthBuffer:!1,shadows:!0,shadowQuality:"high"};class O{constructor(i,e,t){r(this,"_webglrenderer");r(this,"_settings");this._scene=i,this._camera=e,this._settings={...D,...t??{}},this._webglrenderer=new s.WebGLRenderer(this._settings),this._webglrenderer.shadowMap.enabled=this._settings.shadows,this._webglrenderer.shadowMap.type=this._settings.shadowQuality==="high"?s.PCFSoftShadowMap:this._settings.shadowQuality==="medium"?s.PCFShadowMap:s.BasicShadowMap}get webglrenderer(){return this._webglrenderer}setCanvas(i){this._webglrenderer.dispose(),this._settings.canvas=i,this._webglrenderer=new s.WebGLRenderer(this._settings)}render(){this._webglrenderer.render(this._scene,this._camera)}onResize(i,e){this._webglrenderer.setSize(i,e,!1)}dispose(){this._webglrenderer.dispose()}}class G{constructor(){r(this,"_renderer",null);r(this,"_lastTime",0);r(this,"_isRunning",!1);r(this,"_tickers",[])}start(){this._isRunning||(this._isRunning=!0,this._lastTime=performance.now(),requestAnimationFrame(this._tick.bind(this)))}stop(){this._isRunning=!1}setRenderer(i){this._renderer=i}addTicker(i){this._tickers.find(e=>e.uuid===i.uuid)||this._tickers.push(i)}hasTicker(i){return this._tickers.find(e=>e.uuid===i.uuid)!==void 0}removeTicker(i){const e=this._tickers.findIndex(t=>t.uuid===i.uuid);e!==-1&&this._tickers.splice(e,1)}dispose(){this.stop(),this._tickers.forEach(i=>{var e;return(e=i.dispose)==null?void 0:e.call(i)}),this._tickers=[],this._isRunning=!1,this._lastTime=0}_tick(i){var t;if(!this._isRunning)return;const e=(i-this._lastTime)/1e3;this._lastTime=i,this._tickers.forEach(n=>n.tick(e)),(t=this._renderer)==null||t.render(),requestAnimationFrame(this._tick.bind(this))}}class z{constructor(i,e){r(this,"_resizeObserver");r(this,"_width",0);r(this,"_height",0);this._resizeObserver=new ResizeObserver(t=>{for(const n of t){const{width:o,height:h}=n.contentRect;o===this._width&&h===this._height||(i.onResize(o,h),e.onResize(o,h),this._width=o,this._height=h)}}),this._observeCanvas(i.webglrenderer.domElement)}setCanvas(i){this._resizeObserver.disconnect(),this._observeCanvas(i)}dispose(){this._resizeObserver.disconnect()}_observeCanvas(i){if(i.parentElement)this._resizeObserver.observe(i.parentElement);else{const e=setInterval(()=>{i.parentElement&&(this._resizeObserver.observe(i.parentElement),clearInterval(e))},16)}}}const y={autoStart:!0,displayAxes:!1,...l.DIVEPerspectiveCameraDefaultSettings,...D};class U{constructor(i){r(this,"_renderer");r(this,"_scene");r(this,"_camera");r(this,"_resizeManager");r(this,"_clock");r(this,"_settings");this._settings={...y,...i??{}},this._scene=new B,this._camera=new l.DIVEPerspectiveCamera(this._settings),this._renderer=new O(this._scene,this._camera,this._settings),this._resizeManager=new z(this._renderer,this._camera),this._clock=new G,this._clock.setRenderer(this._renderer),this._settings.autoStart&&this.start()}get scene(){return this._scene}get camera(){return this._camera}get renderer(){return this._renderer}setCanvas(i){this._renderer.setCanvas(i),this._resizeManager.setCanvas(i)}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}dispose(){this._clock.dispose(),this._resizeManager.dispose(),this._renderer.dispose()}}const v="#c20017",b="#00ab26",C="#0081d4",F=v,Y=b,W=C;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const q={...y,...w.OrbitControllerDefaultSettings};class I{constructor(i){r(this,"_instanceId",s.MathUtils.generateUUID());r(this,"_settings");r(this,"_engine");r(this,"orbitController");r(this,"axisCamera");this._settings={...q,...i??{}},this._engine=new U(i),this.orbitController=new w.OrbitController(this._engine.camera,this._engine.renderer.webglrenderer.domElement,this._settings),this._engine.clock.addTicker(this.orbitController),this._settings.displayAxes?(this.axisCamera=new L(this._engine.renderer,this._engine.scene,this._engine.camera),this._engine.clock.addTicker(this.axisCamera)):this.axisCamera=null,Promise.resolve().then(()=>require("./package-D_hIrGNz.cjs")).then(e=>{console.log(`DIVE ${e.default.version} initialized successfully!`),console.log(`
|
|
1
|
+
"use strict";var N=Object.defineProperty;var H=(a,i,e)=>i in a?N(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e;var r=(a,i,e)=>H(a,typeof i!="symbol"?i+"":i,e);const w=require("./OrbitController-rMX8EHvJ.cjs"),s=require("three"),p=require("three-spritetext"),l=require("./PerspectiveCamera-CONx93im.cjs");class L extends s.OrthographicCamera{constructor(e,t,n){super(-1,1,1,-1,.1,100);r(this,"axesHelper");r(this,"_renderer");r(this,"_scene");r(this,"_camera");r(this,"_restoreViewport",new s.Vector4);this.layers.mask=l.COORDINATE_LAYER_MASK,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(F),new s.Color(Y),new s.Color(W));const o=new p("X",.2,v),h=new p("Y",.2,b),d=new p("Z",.2,C);o.layers.mask=l.COORDINATE_LAYER_MASK,h.layers.mask=l.COORDINATE_LAYER_MASK,d.layers.mask=l.COORDINATE_LAYER_MASK,o.position.set(.7,0,0),h.position.set(0,.7,0),d.position.set(0,0,.7),this.axesHelper.add(o),this.axesHelper.add(h),this.axesHelper.add(d),this.add(this.axesHelper),this._renderer=e,this._scene=t,this._camera=n,this._scene.add(this)}tick(){const e=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.setFromCameraMatrix(this._camera.matrix),this._renderer.webglrenderer.render(this._scene,this),this._renderer.webglrenderer.setViewport(this._restoreViewport),this._renderer.webglrenderer.autoClear=!0,this._scene.background=e}dispose(){this._scene.remove(this)}setFromCameraMatrix(e){this.axesHelper.rotation.setFromRotationMatrix(new s.Matrix4().extractRotation(e).invert())}}class S extends s.Object3D{constructor(){super();r(this,"isDIVELight",!0);r(this,"isDIVEAmbientLight",!0);r(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 x extends s.Object3D{constructor(){super();r(this,"isDIVELight",!0);r(this,"isDIVEPointLight",!0);r(this,"isMovable",!0);r(this,"isSelectable",!0);r(this,"gizmo",null);r(this,"light");r(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),n=new s.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:s.FrontSide});this.mesh=new s.Mesh(t,n),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 f extends s.Object3D{constructor(){super();r(this,"isDIVELight",!0);r(this,"isDIVESceneLight",!0);r(this,"_hemiLight");r(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.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.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 m=a=>a.parent?m(a.parent):a;class g extends s.Object3D{constructor(){super();r(this,"isSelectable",!0);r(this,"isMovable",!0);r(this,"isDIVENode",!0);r(this,"gizmo",null);r(this,"_positionWorldBuffer");r(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 E extends g{constructor(){super(...arguments);r(this,"isDIVEModel",!0);r(this,"_mesh",null);r(this,"_material",null);r(this,"_assetLoader",null)}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await Promise.resolve().then(()=>require("../plugins/assetloader/index.cjs"))).AssetLoader),this._assetLoader}async setFromURL(e){const n=await(await this._getAssetLoader()).load(e);this.setFromGLTF(n),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:o})=>{var h;(h=o.get(this.userData.id))==null||h.performAction("MODEL_LOADED",{id:this.userData.id})})}setFromGLTF(e){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)}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 o,h,d,c;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(h=(o=this._mesh)==null?void 0:o.geometry)==null||h.computeBoundingBox();const n=(c=(d=this._mesh)==null?void 0:d.geometry)==null?void 0:c.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:_})=>{var u;(u=_.get(this.userData.id))==null||u.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 n=new s.Raycaster(t,new s.Vector3(0,-1,0));n.layers.mask=l.PRODUCT_LAYER_MASK;const o=n.intersectObjects(m(this).root.children,!0);if(o.length>0){const h=o[0].object;h.geometry.computeBoundingBox();const d=h.geometry.boundingBox,c=h.localToWorld(d.max.clone()),_=this.position.clone(),u=this.position.clone().setY(c.y).sub(new s.Vector3(0,e,0));if(this.position.copy(u),this.position.y===_.y)return;this.onMove()}}}class V extends g{constructor(){super();r(this,"isDIVEPrimitive",!0);r(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 o,h,d,c;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(h=(o=this._mesh)==null?void 0:o.geometry)==null||h.computeBoundingBox();const n=(c=(d=this._mesh)==null?void 0:d.geometry)==null?void 0:c.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:_})=>{var u;(u=_.get(this.userData.id))==null||u.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 n=new s.Raycaster(t,new s.Vector3(0,-1,0));n.layers.mask=l.PRODUCT_LAYER_MASK;const o=n.intersectObjects(m(this).root.children,!0);if(o.length>0){const h=o[0].object;h.geometry.computeBoundingBox();const d=h.geometry.boundingBox,c=h.localToWorld(d.max.clone()),_=this.position.clone(),u=this.position.clone().setY(c.y).sub(new s.Vector3(0,e,0));if(this.position.copy(u),this.position.y===_.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]),n=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),o=new s.BufferGeometry;return o.setAttribute("position",new s.BufferAttribute(t,3)),o.setIndex(new s.BufferAttribute(n,1)),o.computeVertexNormals(),o.computeBoundingBox(),o.computeBoundingSphere(),o}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 P extends g{constructor(){super();r(this,"isDIVEGroup",!0);r(this,"_members");r(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(o=>{o.visible=e});return}const n=this._members.indexOf(t);n!==-1&&(this._lines[n].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 n=this._lines[t];return super.remove(n),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}),n=new s.Line(e,t);return n.visible=!1,n}_updateLineTo(e,t){const n=[new s.Vector3(0,0,0),t.position.clone()];e.geometry.setFromPoints(n),e.computeLineDistances()}}class M 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);r(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 R extends s.Object3D{constructor(){super();r(this,"isDIVERoot",!0);r(this,"_floor");this.name="Root",this._floor=new M,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(n=>{"isObject3D"in n&&e.expandByObject(n)})}),e}getSceneObject(e){let t;return this.traverse(n=>{t||n.userData.id===e.id&&(t=n)}),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 f;break}case"ambient":{t=new S;break}case"point":{t=new x;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 E,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 V,t.name=e.name,t.userData.id=e.id,this.add(t),this._updatePrimitive(t,e);break}case"group":{t=new P,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 n=this.getSceneObject({id:e.parentId,entityType:e.entityType});if(!n)return;n.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 k="#888888",T="#dddddd";class A extends s.Object3D{constructor(){super(),this.name="Grid";const i=new s.GridHelper(100,100,k,T);i.material.depthTest=!1,i.layers.mask=l.HELPER_LAYER_MASK,this.add(i)}setVisibility(i){this.visible=i}}class B extends s.Scene{constructor(){super();r(this,"_root");r(this,"_grid");this.background=new s.Color(16777215),this._root=new R,this.add(this._root),this._grid=new A,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 D={canvas:void 0,antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp",stencil:!1,depth:!0,logarithmicDepthBuffer:!1,shadows:!0,shadowQuality:"high"};class O{constructor(i,e,t){r(this,"_webglrenderer");r(this,"_settings");this._scene=i,this._camera=e,this._settings={...D,...t??{}},this._webglrenderer=new s.WebGLRenderer(this._settings),this._webglrenderer.shadowMap.enabled=this._settings.shadows,this._webglrenderer.shadowMap.type=this._settings.shadowQuality==="high"?s.PCFSoftShadowMap:this._settings.shadowQuality==="medium"?s.PCFShadowMap:s.BasicShadowMap}get webglrenderer(){return this._webglrenderer}setCanvas(i){this._webglrenderer.dispose(),this._settings.canvas=i,this._webglrenderer=new s.WebGLRenderer(this._settings)}render(){this._webglrenderer.render(this._scene,this._camera)}onResize(i,e){this._webglrenderer.setSize(i,e,!1)}dispose(){this._webglrenderer.dispose()}}class G{constructor(){r(this,"_renderer",null);r(this,"_lastTime",0);r(this,"_isRunning",!1);r(this,"_tickers",[])}start(){this._isRunning||(this._isRunning=!0,this._lastTime=performance.now(),requestAnimationFrame(this._tick.bind(this)))}stop(){this._isRunning=!1}setRenderer(i){this._renderer=i}addTicker(i){this._tickers.find(e=>e.uuid===i.uuid)||this._tickers.push(i)}hasTicker(i){return this._tickers.find(e=>e.uuid===i.uuid)!==void 0}removeTicker(i){const e=this._tickers.findIndex(t=>t.uuid===i.uuid);e!==-1&&this._tickers.splice(e,1)}dispose(){this.stop(),this._tickers.forEach(i=>{var e;return(e=i.dispose)==null?void 0:e.call(i)}),this._tickers=[],this._isRunning=!1,this._lastTime=0}_tick(i){var t;if(!this._isRunning)return;const e=(i-this._lastTime)/1e3;this._lastTime=i,this._tickers.forEach(n=>n.tick(e)),(t=this._renderer)==null||t.render(),requestAnimationFrame(this._tick.bind(this))}}class z{constructor(i,e){r(this,"_resizeObserver");r(this,"_width",0);r(this,"_height",0);this._resizeObserver=new ResizeObserver(t=>{for(const n of t){const{width:o,height:h}=n.contentRect;o===this._width&&h===this._height||(i.onResize(o,h),e.onResize(o,h),this._width=o,this._height=h)}}),this._observeCanvas(i.webglrenderer.domElement)}setCanvas(i){this._resizeObserver.disconnect(),this._observeCanvas(i)}dispose(){this._resizeObserver.disconnect()}_observeCanvas(i){if(i.parentElement)this._resizeObserver.observe(i.parentElement);else{const e=setInterval(()=>{i.parentElement&&(this._resizeObserver.observe(i.parentElement),clearInterval(e))},16)}}}const y={autoStart:!0,displayAxes:!1,...l.DIVEPerspectiveCameraDefaultSettings,...D};class U{constructor(i){r(this,"_renderer");r(this,"_scene");r(this,"_camera");r(this,"_resizeManager");r(this,"_clock");r(this,"_settings");this._settings={...y,...i??{}},this._scene=new B,this._camera=new l.DIVEPerspectiveCamera(this._settings),this._renderer=new O(this._scene,this._camera,this._settings),this._resizeManager=new z(this._renderer,this._camera),this._clock=new G,this._clock.setRenderer(this._renderer),this._settings.autoStart&&this.start()}get scene(){return this._scene}get camera(){return this._camera}get renderer(){return this._renderer}setCanvas(i){this._renderer.setCanvas(i),this._resizeManager.setCanvas(i)}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}dispose(){this._clock.dispose(),this._resizeManager.dispose(),this._renderer.dispose()}}const v="#c20017",b="#00ab26",C="#0081d4",F=v,Y=b,W=C;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const q={...y,...w.OrbitControllerDefaultSettings};class I{constructor(i){r(this,"_instanceId",s.MathUtils.generateUUID());r(this,"_settings");r(this,"_engine");r(this,"orbitController");r(this,"axisCamera");this._settings={...q,...i??{}},this._engine=new U(i),this.orbitController=new w.OrbitController(this._engine.camera,this._engine.renderer.webglrenderer.domElement,this._settings),this._engine.clock.addTicker(this.orbitController),this._settings.displayAxes?(this.axisCamera=new L(this._engine.renderer,this._engine.scene,this._engine.camera),this._engine.clock.addTicker(this.axisCamera)):this.axisCamera=null,Promise.resolve().then(()=>require("./package-DaKgG9tF.cjs")).then(e=>{console.log(`DIVE ${e.default.version} initialized successfully!`),console.log(`
|
|
2
2
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
3
3
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
4
4
|
@@%=::::.......::---------------------------------------------------------+@@
|
|
@@ -991,7 +991,7 @@ class O {
|
|
|
991
991
|
this._engine.renderer,
|
|
992
992
|
this._engine.scene,
|
|
993
993
|
this._engine.camera
|
|
994
|
-
), this._engine.clock.addTicker(this.axisCamera)) : this.axisCamera = null, import("./package-
|
|
994
|
+
), this._engine.clock.addTicker(this.axisCamera)) : this.axisCamera = null, import("./package-DXbIn_zz.mjs").then((e) => {
|
|
995
995
|
console.log(
|
|
996
996
|
`DIVE ${e.default.version} initialized successfully!`
|
|
997
997
|
), console.log(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var wt=Object.defineProperty;var gt=(r,n,e)=>n in r?wt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>gt(r,typeof n!="symbol"?n+"":n,e);const Q=require("./FileTypes-Ca8pkRlQ.cjs"),t=require("three"),j=require("./findInterface-C6mrvf_t.cjs"),$=require("./PerspectiveCamera-CONx93im.cjs"),D=new t.Raycaster,p=new t.Vector3,P=new t.Vector3,c=new t.Quaternion,tt={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},U={type:"change"},et={type:"mouseDown"},it={type:"mouseUp",mode:null},nt={type:"objectChange"};class bt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new xt;this._gizmo=o,this.add(o);const s=new Dt;this._plane=s,this.add(s);const a=this;function i(m,y){let A=y;Object.defineProperty(a,m,{get:function(){return A!==void 0?A:y},set:function(x){A!==x&&(A=x,s[m]=x,o[m]=x,a.dispatchEvent({type:m+"-changed",value:x}),a.dispatchEvent(U))}}),a[m]=y,s[m]=y,o[m]=y}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,E=new t.Quaternion,T=new t.Quaternion,z=new t.Vector3,C=new t.Quaternion,K=new t.Vector3,H=new t.Vector3,M=new t.Vector3,S=0,g=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",E),i("worldQuaternionStart",T),i("cameraPosition",z),i("cameraQuaternion",C),i("pointStart",K),i("pointEnd",H),i("rotationAxis",M),i("rotationAngle",S),i("eye",g),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=Mt.bind(this),this._onPointerDown=vt.bind(this),this._onPointerHover=St.bind(this),this._onPointerMove=Pt.bind(this),this._onPointerUp=Et.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&D.setFromCamera(n,this.camera);const e=N(this._gizmo.picker[this.mode],D);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&D.setFromCamera(n,this.camera);const e=N(this._plane,D,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,et.mode=this.mode,this.dispatchEvent(et)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&D.setFromCamera(n,this.camera);const i=N(this._plane,D,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),P.set(d,d,d)}else p.copy(this.pointStart),P.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),P.applyQuaternion(this._worldQuaternionInv),P.divide(p),e.search("X")===-1&&(P.x=1),e.search("Y")===-1&&(P.y=1),e.search("Z")===-1&&(P.z=1);s.scale.copy(this._scaleStart).multiply(P),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(tt[e]),p.copy(tt[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(U),this.dispatchEvent(nt)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(it.mode=this.mode,this.dispatchEvent(it)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(U),this.dispatchEvent(nt),this.pointStart.copy(this.pointEnd))}getRaycaster(){return D}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function Mt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function St(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function vt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Pt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function Et(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function N(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const q=new t.Euler,l=new t.Vector3(0,1,0),ot=new t.Vector3(0,0,0),st=new t.Matrix4,B=new t.Quaternion,F=new t.Quaternion,b=new t.Vector3,rt=new t.Matrix4,O=new t.Vector3(1,0,0),I=new t.Vector3(0,1,0),Z=new t.Vector3(0,0,1),W=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class xt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const E=n.clone();E.color.setHex(65280),E.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const z=n.clone();z.opacity=.25;const C=n.clone();C.color.setHex(16776960),C.opacity=.25,n.clone().color.setHex(16776960);const H=n.clone();H.color.setHex(7895160);const M=new t.CylinderGeometry(0,.04,.1,12);M.translate(0,.05,0);const S=new t.BoxGeometry(.08,.08,.08);S.translate(0,.04,0);const g=new t.BufferGeometry;g.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new t.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function y(_,V){const w=new t.TorusGeometry(_,.0075,3,64,V*Math.PI*2);return w.rotateY(Math.PI/2),w.rotateX(Math.PI/2),w}function A(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const x={X:[[new t.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(M,i),[0,.5,0]],[new t.Mesh(M,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(m,i)]],Z:[[new t.Mesh(M,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(M,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(m,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),z.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},ht={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},ct={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(A(),s),null,null,null,"helper"]],X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},dt={XYZE:[[new t.Mesh(y(.5,1),H),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(y(.5,.5),a)]],Y:[[new t.Mesh(y(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(y(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(y(.75,1),C),null,[0,Math.PI/2,0]]]},pt={AXIS:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},ut={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(m,i)],[new t.Mesh(S,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(m,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),z.clone())]]},ft={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},_t={X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function v(_){const V=new t.Object3D;for(const w in _)for(let G=_[w].length;G--;){const u=_[w][G][0].clone(),L=_[w][G][1],R=_[w][G][2],k=_[w][G][3],yt=_[w][G][4];u.name=w,u.tag=yt,L&&u.position.set(L[0],L[1],L[2]),R&&u.rotation.set(R[0],R[1],R[2]),k&&u.scale.set(k[0],k[1],k[2]),u.updateMatrix();const J=u.geometry.clone();J.applyMatrix4(u.matrix),u.geometry=J,u.renderOrder=1/0,u.position.set(0,0,0),u.rotation.set(0,0,0),u.scale.set(1,1,1),V.add(u)}return V}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=v(x)),this.add(this.gizmo.rotate=v(dt)),this.add(this.gizmo.scale=v(ut)),this.add(this.picker.translate=v(ht)),this.add(this.picker.rotate=v(mt)),this.add(this.picker.scale=v(ft)),this.add(this.helper.translate=v(ct)),this.add(this.helper.rotate=v(pt)),this.add(this.helper.scale=v(_t)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:F;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(q.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(q.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(st.lookAt(ot,l,I)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(B.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(st.lookAt(this.eye,ot,I)),i.name==="X"&&(c.setFromAxisAngle(O,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(I,Math.atan2(l.x,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(Z,Math.atan2(l.y,l.x)),c.multiplyQuaternions(B,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Dt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),W.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),X.copy(I).applyQuaternion(e==="local"?this.worldQuaternion:F),Y.copy(Z).applyQuaternion(e==="local"?this.worldQuaternion:F),l.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(W),b.copy(W).cross(l);break;case"Y":l.copy(this.eye).cross(X),b.copy(X).cross(l);break;case"Z":l.copy(this.eye).cross(Y),b.copy(Y).cross(l);break;case"XY":b.copy(Y);break;case"YZ":b.copy(W);break;case"XZ":l.copy(Y),b.copy(X);break;case"XYZ":case"E":b.set(0,0,0);break}break;case"rotate":default:b.set(0,0,0)}b.length()===0?this.quaternion.copy(this.cameraQuaternion):(rt.lookAt(p.set(0,0,0),b,l),this.quaternion.setFromRotationMatrix(rt)),super.updateMatrixWorld(n)}}class at{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=$.PRODUCT_LAYER_MASK|$.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=j.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=j.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const It=r=>r.isTransformTool!==void 0;class lt extends at{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisibility(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new bt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(Q.AxesColorRed),o.name==="Y"&&s.color.set(Q.AxesColorGreen),o.name==="Z"&&s.color.set(Q.AxesColorBlue),o.name==="XY"&&s.color.set(Q.AxesColorBlue),o.name==="YZ"&&s.color.set(Q.AxesColorRed),o.name==="XZ"&&s.color.set(Q.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(j.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tt=r=>r.isSelectTool!==void 0;class At extends lt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisibility(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=j.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVEBaseTool=at;exports.DIVESelectTool=At;exports.DIVETransformTool=lt;exports.isSelectTool=Tt;exports.isTransformTool=It;
|
|
1
|
+
"use strict";var wt=Object.defineProperty;var gt=(r,n,e)=>n in r?wt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>gt(r,typeof n!="symbol"?n+"":n,e);const Q=require("./FileTypes-CKOjpHjz.cjs"),t=require("three"),j=require("./findInterface-C6mrvf_t.cjs"),$=require("./PerspectiveCamera-CONx93im.cjs"),D=new t.Raycaster,p=new t.Vector3,P=new t.Vector3,c=new t.Quaternion,tt={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},U={type:"change"},et={type:"mouseDown"},it={type:"mouseUp",mode:null},nt={type:"objectChange"};class bt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new xt;this._gizmo=o,this.add(o);const s=new Dt;this._plane=s,this.add(s);const a=this;function i(m,y){let A=y;Object.defineProperty(a,m,{get:function(){return A!==void 0?A:y},set:function(x){A!==x&&(A=x,s[m]=x,o[m]=x,a.dispatchEvent({type:m+"-changed",value:x}),a.dispatchEvent(U))}}),a[m]=y,s[m]=y,o[m]=y}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,E=new t.Quaternion,T=new t.Quaternion,z=new t.Vector3,C=new t.Quaternion,K=new t.Vector3,H=new t.Vector3,M=new t.Vector3,S=0,g=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",E),i("worldQuaternionStart",T),i("cameraPosition",z),i("cameraQuaternion",C),i("pointStart",K),i("pointEnd",H),i("rotationAxis",M),i("rotationAngle",S),i("eye",g),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=Mt.bind(this),this._onPointerDown=vt.bind(this),this._onPointerHover=St.bind(this),this._onPointerMove=Pt.bind(this),this._onPointerUp=Et.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&D.setFromCamera(n,this.camera);const e=N(this._gizmo.picker[this.mode],D);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&D.setFromCamera(n,this.camera);const e=N(this._plane,D,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,et.mode=this.mode,this.dispatchEvent(et)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&D.setFromCamera(n,this.camera);const i=N(this._plane,D,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),P.set(d,d,d)}else p.copy(this.pointStart),P.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),P.applyQuaternion(this._worldQuaternionInv),P.divide(p),e.search("X")===-1&&(P.x=1),e.search("Y")===-1&&(P.y=1),e.search("Z")===-1&&(P.z=1);s.scale.copy(this._scaleStart).multiply(P),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(tt[e]),p.copy(tt[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(U),this.dispatchEvent(nt)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(it.mode=this.mode,this.dispatchEvent(it)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(U),this.dispatchEvent(nt),this.pointStart.copy(this.pointEnd))}getRaycaster(){return D}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function Mt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function St(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function vt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Pt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function Et(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function N(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const q=new t.Euler,l=new t.Vector3(0,1,0),ot=new t.Vector3(0,0,0),st=new t.Matrix4,B=new t.Quaternion,F=new t.Quaternion,b=new t.Vector3,rt=new t.Matrix4,O=new t.Vector3(1,0,0),I=new t.Vector3(0,1,0),Z=new t.Vector3(0,0,1),W=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class xt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const E=n.clone();E.color.setHex(65280),E.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const z=n.clone();z.opacity=.25;const C=n.clone();C.color.setHex(16776960),C.opacity=.25,n.clone().color.setHex(16776960);const H=n.clone();H.color.setHex(7895160);const M=new t.CylinderGeometry(0,.04,.1,12);M.translate(0,.05,0);const S=new t.BoxGeometry(.08,.08,.08);S.translate(0,.04,0);const g=new t.BufferGeometry;g.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new t.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function y(_,V){const w=new t.TorusGeometry(_,.0075,3,64,V*Math.PI*2);return w.rotateY(Math.PI/2),w.rotateX(Math.PI/2),w}function A(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const x={X:[[new t.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(M,i),[0,.5,0]],[new t.Mesh(M,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(m,i)]],Z:[[new t.Mesh(M,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(M,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(m,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),z.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},ht={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},ct={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(A(),s),null,null,null,"helper"]],X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},dt={XYZE:[[new t.Mesh(y(.5,1),H),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(y(.5,.5),a)]],Y:[[new t.Mesh(y(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(y(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(y(.75,1),C),null,[0,Math.PI/2,0]]]},pt={AXIS:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},ut={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(m,i)],[new t.Mesh(S,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(m,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),z.clone())]]},ft={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},_t={X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function v(_){const V=new t.Object3D;for(const w in _)for(let G=_[w].length;G--;){const u=_[w][G][0].clone(),L=_[w][G][1],R=_[w][G][2],k=_[w][G][3],yt=_[w][G][4];u.name=w,u.tag=yt,L&&u.position.set(L[0],L[1],L[2]),R&&u.rotation.set(R[0],R[1],R[2]),k&&u.scale.set(k[0],k[1],k[2]),u.updateMatrix();const J=u.geometry.clone();J.applyMatrix4(u.matrix),u.geometry=J,u.renderOrder=1/0,u.position.set(0,0,0),u.rotation.set(0,0,0),u.scale.set(1,1,1),V.add(u)}return V}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=v(x)),this.add(this.gizmo.rotate=v(dt)),this.add(this.gizmo.scale=v(ut)),this.add(this.picker.translate=v(ht)),this.add(this.picker.rotate=v(mt)),this.add(this.picker.scale=v(ft)),this.add(this.helper.translate=v(ct)),this.add(this.helper.rotate=v(pt)),this.add(this.helper.scale=v(_t)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:F;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(q.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(q.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(st.lookAt(ot,l,I)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(B.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(st.lookAt(this.eye,ot,I)),i.name==="X"&&(c.setFromAxisAngle(O,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(I,Math.atan2(l.x,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(Z,Math.atan2(l.y,l.x)),c.multiplyQuaternions(B,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Dt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),W.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),X.copy(I).applyQuaternion(e==="local"?this.worldQuaternion:F),Y.copy(Z).applyQuaternion(e==="local"?this.worldQuaternion:F),l.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(W),b.copy(W).cross(l);break;case"Y":l.copy(this.eye).cross(X),b.copy(X).cross(l);break;case"Z":l.copy(this.eye).cross(Y),b.copy(Y).cross(l);break;case"XY":b.copy(Y);break;case"YZ":b.copy(W);break;case"XZ":l.copy(Y),b.copy(X);break;case"XYZ":case"E":b.set(0,0,0);break}break;case"rotate":default:b.set(0,0,0)}b.length()===0?this.quaternion.copy(this.cameraQuaternion):(rt.lookAt(p.set(0,0,0),b,l),this.quaternion.setFromRotationMatrix(rt)),super.updateMatrixWorld(n)}}class at{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=$.PRODUCT_LAYER_MASK|$.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=j.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=j.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const It=r=>r.isTransformTool!==void 0;class lt extends at{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisibility(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new bt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(Q.AxesColorRed),o.name==="Y"&&s.color.set(Q.AxesColorGreen),o.name==="Z"&&s.color.set(Q.AxesColorBlue),o.name==="XY"&&s.color.set(Q.AxesColorBlue),o.name==="YZ"&&s.color.set(Q.AxesColorRed),o.name==="XZ"&&s.color.set(Q.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(j.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tt=r=>r.isSelectTool!==void 0;class At extends lt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisibility(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=j.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVEBaseTool=at;exports.DIVESelectTool=At;exports.DIVETransformTool=lt;exports.isSelectTool=Tt;exports.isTransformTool=It;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var jt = Object.defineProperty;
|
|
2
2
|
var Xt = (r, i, t) => i in r ? jt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
3
3
|
var c = (r, i, t) => Xt(r, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { A as lt, a as ht, b as ct } from "./FileTypes-
|
|
4
|
+
import { A as lt, a as ht, b as ct } from "./FileTypes-Cu4s3c_0.mjs";
|
|
5
5
|
import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as dt, Float32BufferAttribute as pt, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
|
|
6
6
|
import { f as ot, i as et } from "./findInterface-DbJ5qzbc.mjs";
|
|
7
7
|
import { P as Ct, U as kt } from "./PerspectiveCamera-DUiWJJIj.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class s extends Error{constructor(r,e){super(r),this.requestedFileType=e,this.name="FileTypeError"}}exports.FileTypeError=s;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function o(e) {
|
|
2
|
+
var i;
|
|
3
|
+
const t = e.split("/").pop() || "";
|
|
4
|
+
return !t.includes(".") || t.endsWith(".") ? "" : ((i = t.split(".").pop()) == null ? void 0 : i.toLowerCase().split("?")[0]) || "";
|
|
5
|
+
}
|
|
6
|
+
function r(e) {
|
|
7
|
+
return e.toLowerCase() in { glb: !0, gltf: !0, usdz: !0 };
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
o as g,
|
|
11
|
+
r as i
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function r(e){var i;const t=e.split("/").pop()||"";return!t.includes(".")||t.endsWith(".")?"":((i=t.split(".").pop())==null?void 0:i.toLowerCase().split("?")[0])||""}function n(e){return e.toLowerCase()in{glb:!0,gltf:!0,usdz:!0}}exports.getFileTypeFromUri=r;exports.isFileTypeSupported=n;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class o extends Error {
|
|
2
|
+
constructor(r) {
|
|
3
|
+
super(`Failed to create array buffer from fetched file! (Uri: ${r})`), this.uri = r, this.name = "FileContentError";
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
class s extends Error {
|
|
7
|
+
constructor(r, t) {
|
|
8
|
+
super(`Failed to fetch file from ${r}`), this.url = r, this.cause = t, this.name = "NetworkError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
o as F,
|
|
13
|
+
s as N
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class o extends Error{constructor(r){super(`Failed to create array buffer from fetched file! (Uri: ${r})`),this.uri=r,this.name="FileContentError"}}class s extends Error{constructor(r,t){super(`Failed to fetch file from ${r}`),this.url=r,this.cause=t,this.name="NetworkError"}}exports.FileContentError=o;exports.NetworkError=s;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const e = "@shopware-ag/dive", i = "2.0.1-beta.9", s = "Shopware Spatial Framework", t = "module", n = "build/dive.cjs", r = "build/dive.mjs", d = "build/dive.d.ts", o = { ".": { types: "./build/dive.d.ts", import: "./build/dive.mjs", require: "./build/dive.cjs" }, "./animation": { types: "./build/plugins/animation/index.d.ts", import: "./build/plugins/animation/index.mjs", require: "./build/plugins/animation/index.cjs" }, "./ar": { types: "./build/plugins/ar/index.d.ts", import: "./build/plugins/ar/index.mjs", require: "./build/plugins/ar/index.cjs" }, "./assetcache": { types: "./build/plugins/assetcache/index.d.ts", import: "./build/plugins/assetcache/index.mjs", require: "./build/plugins/assetcache/index.cjs" }, "./assetconverter": { types: "./build/plugins/assetconverter/index.d.ts", import: "./build/plugins/assetconverter/index.mjs", require: "./build/plugins/assetconverter/index.cjs" }, "./assetexporter": { types: "./build/plugins/assetexporter/index.d.ts", import: "./build/plugins/assetexporter/index.mjs", require: "./build/plugins/assetexporter/index.cjs" }, "./assetloader": { types: "./build/plugins/assetloader/index.d.ts", import: "./build/plugins/assetloader/index.mjs", require: "./build/plugins/assetloader/index.cjs" }, "./axiscamera": { types: "./build/plugins/axiscamera/index.d.ts", import: "./build/plugins/axiscamera/index.mjs", require: "./build/plugins/axiscamera/index.cjs" }, "./mediacreator": { types: "./build/plugins/mediacreator/index.d.ts", import: "./build/plugins/mediacreator/index.mjs", require: "./build/plugins/mediacreator/index.cjs" }, "./orbitcontroller": { types: "./build/plugins/orbitcontroller/index.d.ts", import: "./build/plugins/orbitcontroller/index.mjs", require: "./build/plugins/orbitcontroller/index.cjs" }, "./state": { types: "./build/plugins/state/index.d.ts", import: "./build/plugins/state/index.mjs", require: "./build/plugins/state/index.cjs" }, "./systeminfo": { types: "./build/plugins/systeminfo/index.d.ts", import: "./build/plugins/systeminfo/index.mjs", require: "./build/plugins/systeminfo/index.cjs" }, "./toolbox": { types: "./build/plugins/toolbox/index.d.ts", import: "./build/plugins/toolbox/index.mjs", require: "./build/plugins/toolbox/index.cjs" } }, l = ["build", "LICENSE", "package.json"], a = ["dive", "shopware", "sw6", "three", "three.js", "3d", "typescript"], u = "git@github.com:shopware/dive.git", p = "ffrank <f.frank@shopware.com>", c = "MIT", b = ["> 1%, not dead, not ie 11, not op_mini all"], g = { three: "^0.163.0", "@tweenjs/tween.js": "^23.1.1", "three-spritetext": "^1.8.2", lodash: "^4.17.21" }, m = { "@eslint/js": "^9.1.1", "@testing-library/jest-dom": "^6.6.3", "@types/jest": "^29.5.12", "@types/lodash": "^4.17.12", "@types/node": "^20.12.7", "@types/three": "^0.163.0", "@vitest/coverage-v8": "3.1.2", acorn: "^8.14.1", "acorn-walk": "^8.3.4", eslint: "^9.1.1", glob: "^11.0.1", globals: "^15.0.0", jsdom: "^26.1.0", "log-update": "^6.1.0", "magic-string": "^0.30.17", prettier: "^3.3.3", "prettier-plugin-multiline-arrays": "^3.0.6", "rollup-plugin-copy": "^3.5.0", "ts-jest": "^29.1.2", "ts-morph": "^25.0.1", "ts-node": "^10.9.2", tsc: "^2.0.4", tsx: "^4.19.4", typescript: "^5.8.2", "typescript-eslint": "^7.7.1", vite: "^6.2.1", "vite-plugin-dts": "^4.5.3", "vite-plugin-wasm": "^3.4.1", "vite-tsconfig-paths": "^5.1.4", vitest: "^3.1.2" }, x = { "validate-build-paths": "NODE_OPTIONS='--loader ts-node/esm' ts-node ci/build/validate-build-paths.ts", build: "vite build", dev: "vite build --watch", lint: "eslint", "prettier:check": "prettier --check .", "prettier:fix": "prettier --write .", unit: "vitest --run", coverage: "vitest --coverage --run", docs: "yarn docs:actions && yarn docs:modules", "docs:actions": "tsx docs/generators/generate-actions-docs.ts", "docs:modules": "tsx docs/generators/generate-modules-docs.ts", ci: "yarn && yarn lint && yarn prettier:check && yarn coverage && yarn build" }, y = {
|
|
2
|
+
name: e,
|
|
3
|
+
version: i,
|
|
4
|
+
description: s,
|
|
5
|
+
type: t,
|
|
6
|
+
main: n,
|
|
7
|
+
module: r,
|
|
8
|
+
types: d,
|
|
9
|
+
exports: o,
|
|
10
|
+
files: l,
|
|
11
|
+
keywords: a,
|
|
12
|
+
repository: u,
|
|
13
|
+
author: p,
|
|
14
|
+
license: c,
|
|
15
|
+
browserslist: b,
|
|
16
|
+
dependencies: g,
|
|
17
|
+
devDependencies: m,
|
|
18
|
+
scripts: x
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
p as author,
|
|
22
|
+
b as browserslist,
|
|
23
|
+
y as default,
|
|
24
|
+
g as dependencies,
|
|
25
|
+
s as description,
|
|
26
|
+
m as devDependencies,
|
|
27
|
+
o as exports,
|
|
28
|
+
l as files,
|
|
29
|
+
a as keywords,
|
|
30
|
+
c as license,
|
|
31
|
+
n as main,
|
|
32
|
+
r as module,
|
|
33
|
+
e as name,
|
|
34
|
+
u as repository,
|
|
35
|
+
x as scripts,
|
|
36
|
+
t as type,
|
|
37
|
+
d as types,
|
|
38
|
+
i as version
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="@shopware-ag/dive",s="2.0.1-beta.9",i="Shopware Spatial Framework",t="module",n="build/dive.cjs",r="build/dive.mjs",d="build/dive.d.ts",o={".":{types:"./build/dive.d.ts",import:"./build/dive.mjs",require:"./build/dive.cjs"},"./animation":{types:"./build/plugins/animation/index.d.ts",import:"./build/plugins/animation/index.mjs",require:"./build/plugins/animation/index.cjs"},"./ar":{types:"./build/plugins/ar/index.d.ts",import:"./build/plugins/ar/index.mjs",require:"./build/plugins/ar/index.cjs"},"./assetcache":{types:"./build/plugins/assetcache/index.d.ts",import:"./build/plugins/assetcache/index.mjs",require:"./build/plugins/assetcache/index.cjs"},"./assetconverter":{types:"./build/plugins/assetconverter/index.d.ts",import:"./build/plugins/assetconverter/index.mjs",require:"./build/plugins/assetconverter/index.cjs"},"./assetexporter":{types:"./build/plugins/assetexporter/index.d.ts",import:"./build/plugins/assetexporter/index.mjs",require:"./build/plugins/assetexporter/index.cjs"},"./assetloader":{types:"./build/plugins/assetloader/index.d.ts",import:"./build/plugins/assetloader/index.mjs",require:"./build/plugins/assetloader/index.cjs"},"./axiscamera":{types:"./build/plugins/axiscamera/index.d.ts",import:"./build/plugins/axiscamera/index.mjs",require:"./build/plugins/axiscamera/index.cjs"},"./mediacreator":{types:"./build/plugins/mediacreator/index.d.ts",import:"./build/plugins/mediacreator/index.mjs",require:"./build/plugins/mediacreator/index.cjs"},"./orbitcontroller":{types:"./build/plugins/orbitcontroller/index.d.ts",import:"./build/plugins/orbitcontroller/index.mjs",require:"./build/plugins/orbitcontroller/index.cjs"},"./state":{types:"./build/plugins/state/index.d.ts",import:"./build/plugins/state/index.mjs",require:"./build/plugins/state/index.cjs"},"./systeminfo":{types:"./build/plugins/systeminfo/index.d.ts",import:"./build/plugins/systeminfo/index.mjs",require:"./build/plugins/systeminfo/index.cjs"},"./toolbox":{types:"./build/plugins/toolbox/index.d.ts",import:"./build/plugins/toolbox/index.mjs",require:"./build/plugins/toolbox/index.cjs"}},l=["build","LICENSE","package.json"],a=["dive","shopware","sw6","three","three.js","3d","typescript"],u="git@github.com:shopware/dive.git",p="ffrank <f.frank@shopware.com>",c="MIT",b=["> 1%, not dead, not ie 11, not op_mini all"],m={three:"^0.163.0","@tweenjs/tween.js":"^23.1.1","three-spritetext":"^1.8.2",lodash:"^4.17.21"},g={"@eslint/js":"^9.1.1","@testing-library/jest-dom":"^6.6.3","@types/jest":"^29.5.12","@types/lodash":"^4.17.12","@types/node":"^20.12.7","@types/three":"^0.163.0","@vitest/coverage-v8":"3.1.2",acorn:"^8.14.1","acorn-walk":"^8.3.4",eslint:"^9.1.1",glob:"^11.0.1",globals:"^15.0.0",jsdom:"^26.1.0","log-update":"^6.1.0","magic-string":"^0.30.17",prettier:"^3.3.3","prettier-plugin-multiline-arrays":"^3.0.6","rollup-plugin-copy":"^3.5.0","ts-jest":"^29.1.2","ts-morph":"^25.0.1","ts-node":"^10.9.2",tsc:"^2.0.4",tsx:"^4.19.4",typescript:"^5.8.2","typescript-eslint":"^7.7.1",vite:"^6.2.1","vite-plugin-dts":"^4.5.3","vite-plugin-wasm":"^3.4.1","vite-tsconfig-paths":"^5.1.4",vitest:"^3.1.2"},x={"validate-build-paths":"NODE_OPTIONS='--loader ts-node/esm' ts-node ci/build/validate-build-paths.ts",build:"vite build",dev:"vite build --watch",lint:"eslint","prettier:check":"prettier --check .","prettier:fix":"prettier --write .",unit:"vitest --run",coverage:"vitest --coverage --run",docs:"yarn docs:actions && yarn docs:modules","docs:actions":"tsx docs/generators/generate-actions-docs.ts","docs:modules":"tsx docs/generators/generate-modules-docs.ts",ci:"yarn && yarn lint && yarn prettier:check && yarn coverage && yarn build"},y={name:e,version:s,description:i,type:t,main:n,module:r,types:d,exports:o,files:l,keywords:a,repository:u,author:p,license:c,browserslist:b,dependencies:m,devDependencies:g,scripts:x};exports.author=p;exports.browserslist=b;exports.default=y;exports.dependencies=m;exports.description=i;exports.devDependencies=g;exports.exports=o;exports.files=l;exports.keywords=a;exports.license=c;exports.main=n;exports.module=r;exports.name=e;exports.repository=u;exports.scripts=x;exports.type=t;exports.types=d;exports.version=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class e extends Error{constructor(r,s){super(`Failed to parse array buffer from ${r}`),this.uri=r,this.cause=s,this.name="ParseError"}}exports.ParseError=e;
|
package/build/dive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var x=(i,n,e)=>n in i?w(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e;var s=(i,n,e)=>x(i,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunks/FileTypes-Ca8pkRlQ.cjs"),d=require("./chunks/PerspectiveCamera-CONx93im.cjs"),r=require("three"),M=require("./chunks/network-error-D_pq8VU6.cjs"),I=require("./chunks/findInterface-C6mrvf_t.cjs"),V=require("./chunks/parse-error-Bd09D_1L.cjs"),b=require("./chunks/PovSchema-Co9FznEz.cjs");class f extends r.Object3D{constructor(e,t,o,h,l){super();s(this,"isHoverable",!0);s(this,"isDraggable",!0);s(this,"parent",null);s(this,"axis");s(this,"_color",new r.Color(16711935));s(this,"_colorHover");s(this,"_hovered");s(this,"_highlight");s(this,"_lineMaterial");s(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(l),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const _=new r.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new r.MeshBasicMaterial({color:l,depthTest:!1,depthWrite:!1});const c=new r.Mesh(_,this._lineMaterial);c.layers.mask=d.UI_LAYER_MASK,c.renderOrder=1/0,this.add(c);const p=new r.TorusGeometry(t,.1,3,48,o),g=new r.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new r.Mesh(p,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=d.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new r.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new r.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new r.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function u(i,n){const e=(i+"e").split("e");return+(e[0]+"e"+(+e[1]+(n||0)))}function P(i,n=0){const e=u(i,+n);return u(Math.ceil(e),-n)}function S(i,n=0){const e=u(i,+n);return u(Math.floor(e),-n)}function y(i,n=0){if(i<0)return-y(-i,n);const e=u(i,+n);return u(Math.round(e),-n)}function R(i,n,e){return Math.atan2(i.clone().cross(n).dot(e),n.clone().dot(i))}function v(i,n=0){const e=u(i,+n);return u(Math.round(e),-n).toFixed(n)}function H(i,n=0){const e=u(i,+n);return u(Math.trunc(e),-n)}function z(i){return(r.MathUtils.radToDeg(i)+360)%360}function G(i){return r.MathUtils.degToRad(i)}const A={ceilExp:P,floorExp:S,roundExp:y,toFixedExp:v,truncateExp:H,signedAngleTo:R,radToDeg:z,degToRad:G};class L extends r.Object3D{constructor(e){super();s(this,"children");s(this,"_controller");s(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new f("x",1,Math.PI/2,new r.Vector3(1,0,0),a.AxesColorRed)),this.add(new f("y",1,-Math.PI/2,new r.Vector3(0,1,0),a.AxesColorGreen)),this.add(new f("z",1,Math.PI/2,new r.Vector3(0,0,1),a.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),l=A.signedAngleTo(h,o,e.forwardVector),_=new r.Euler(this._startRot.x+e.forwardVector.x*l,this._startRot.y+e.forwardVector.y*l,this._startRot.z+e.forwardVector.z*l);this.parent.parent.onChange(void 0,_)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class E extends r.Object3D{constructor(e,t,o,h){super();s(this,"isHoverable",!0);s(this,"isDraggable",!0);s(this,"parent",null);s(this,"axis");s(this,"_color",new r.Color(16711935));s(this,"_colorHover");s(this,"_hovered");s(this,"_highlight");s(this,"_lineMaterial");s(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const l=new r.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new r.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const _=new r.Mesh(l,this._lineMaterial);_.layers.mask=d.UI_LAYER_MASK,_.renderOrder=1/0,_.rotateX(Math.PI/2),_.translateY(t/2),this.add(_);const c=new r.CylinderGeometry(.1,.1,t,3),p=new r.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new r.Mesh(c,p),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=d.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new r.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new r.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new r.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class O extends r.Object3D{constructor(e){super();s(this,"_controller");s(this,"children");s(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new E("x",1,new r.Vector3(1,0,0),a.AxesColorRed)),this.add(new E("y",1,new r.Vector3(0,1,0),a.AxesColorGreen)),this.add(new E("z",1,new r.Vector3(0,0,1),a.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class m extends r.Object3D{constructor(e,t,o,h,l=.05){super();s(this,"isHoverable",!0);s(this,"isDraggable",!0);s(this,"parent",null);s(this,"axis");s(this,"_color",new r.Color(16711935));s(this,"_colorHover");s(this,"_hovered");s(this,"_highlight");s(this,"_lineMaterial");s(this,"_colliderMesh");s(this,"_box");s(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=l;const _=new r.CylinderGeometry(.01,.01,t-l/2,13);this._lineMaterial=new r.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const c=new r.Mesh(_,this._lineMaterial);c.layers.mask=d.UI_LAYER_MASK,c.renderOrder=1/0,c.rotateX(Math.PI/2),c.translateY(t/2-l/4),this.add(c),this._box=new r.Mesh(new r.BoxGeometry(l,l,l),this._lineMaterial),this._box.layers.mask=d.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-l/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const p=new r.CylinderGeometry(.1,.1,t+l/2,3),g=new r.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new r.Mesh(p,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=d.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new r.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new r.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new r.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new r.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class j extends r.Object3D{constructor(e){super();s(this,"isHoverable",!0);s(this,"children");s(this,"_controller");s(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new m("x",1,new r.Vector3(1,0,0),a.AxesColorRed)),this.add(new m("y",1,new r.Vector3(0,1,0),a.AxesColorGreen)),this.add(new m("z",1,new r.Vector3(0,0,1),a.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class C extends r.Object3D{constructor(){super();s(this,"_meshX");s(this,"_meshY");s(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new r.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new r.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new r.Mesh(t,o),this._meshX.layers.mask=d.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new r.PlaneGeometry(100,100,2,2),l=e.clone();l.color.set(65280),this._meshY=new r.Mesh(h,l),this._meshY.layers.mask=d.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const _=new r.PlaneGeometry(100,100,2,2),c=e.clone();c.color.set(255),this._meshZ=new r.Mesh(_,c),this._meshZ.layers.mask=d.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class Y extends r.Object3D{constructor(e){super();s(this,"_mode");s(this,"_gizmoNode");s(this,"_translateGizmo");s(this,"_rotateGizmo");s(this,"_scaleGizmo");s(this,"_gizmoPlane");s(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new r.Object3D,this.add(this._gizmoNode),this._translateGizmo=new O(e),this._rotateGizmo=new L(e),this._scaleGizmo=new j(e),this._gizmoPlane=new C,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class T{constructor(){s(this,"isMovable",!0)}}class N{constructor(){s(this,"isSelectable",!0)}}const D=(i,n)=>{if(Object.keys(i).length===0&&Object.keys(n).length===0)return{};if(typeof i!="object"||typeof n!="object")return n;let e={};return Object.keys(n).forEach(t=>{if(!Object.keys(i).includes(t)){e={...e,[t]:n[t]};return}if(Array.isArray(n[t])){if(!Array.isArray(i[t])){e={...e,[t]:n[t]};return}const o=i[t],h=n[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:n[t]};return}const l=[];if(h.forEach((_,c)=>{const p=D(o[c],h[c]);Object.keys(p).length&&l.push(h[c])}),Object.keys(l).length){e={...e,[t]:l};return}return}if(typeof n[t]=="object"){if(typeof i[t]!="object"){e={...e,[t]:n[t]};return}const o=D(i[t],n[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}i[t]!==n[t]&&(e={...e,[t]:n[t]})}),e};function U(i,n){return n.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(i.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(i.prototype,o,h)})}),i}function K(i){return i.entityType==="group"}function X(i){return i.entityType==="light"}function F(i){return i.entityType==="primitive"}exports.AxesColorBlue=a.AxesColorBlue;exports.AxesColorBlueLetter=a.AxesColorBlueLetter;exports.AxesColorGreen=a.AxesColorGreen;exports.AxesColorGreenLetter=a.AxesColorGreenLetter;exports.AxesColorRed=a.AxesColorRed;exports.AxesColorRedLetter=a.AxesColorRedLetter;exports.DIVE=a.DIVE;exports.DIVEAmbientLight=a.DIVEAmbientLight;exports.DIVEClock=a.DIVEClock;exports.DIVEDefaultSettings=a.DIVEDefaultSettings;exports.DIVEEngine=a.DIVEEngine;exports.DIVEFloor=a.DIVEFloor;exports.DIVEGrid=a.DIVEGrid;exports.DIVEGroup=a.DIVEGroup;exports.DIVEModel=a.DIVEModel;exports.DIVENode=a.DIVENode;exports.DIVEPointLight=a.DIVEPointLight;exports.DIVEPrimitive=a.DIVEPrimitive;exports.DIVERenderPipeline=a.DIVERenderPipeline;exports.DIVERenderPipelineDefaultSettings=a.DIVERenderPipelineDefaultSettings;exports.DIVEResizeManager=a.DIVEResizeManager;exports.DIVERoot=a.DIVERoot;exports.DIVEScene=a.DIVEScene;exports.DIVESceneLight=a.DIVESceneLight;exports.EngineDefaultSettings=a.EngineDefaultSettings;exports.FILE_TYPES=a.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=a.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=a.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=a.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=a.findSceneRecursive;exports.COORDINATE_LAYER_MASK=d.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=d.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=d.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=d.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=d.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=d.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=d.UI_LAYER_MASK;exports.NetworkError=M.NetworkError;exports.getFileTypeFromUri=M.getFileTypeFromUri;exports.isFileTypeSupported=M.isFileTypeSupported;exports.findInterface=I.findInterface;exports.implementsInterface=I.implementsInterface;exports.FileTypeError=V.FileTypeError;exports.ParseError=V.ParseError;exports.isModelSchema=b.isModelSchema;exports.isPovSchema=b.isPovSchema;exports.DIVEGizmo=Y;exports.DIVEMath=A;exports.DIVEMovable=T;exports.DIVESelectable=N;exports.applyMixins=U;exports.getObjectDelta=D;exports.isGroupSchema=K;exports.isLightSchema=X;exports.isPrimitiveSchema=F;
|
|
1
|
+
"use strict";var w=Object.defineProperty;var x=(i,n,e)=>n in i?w(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e;var s=(i,n,e)=>x(i,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunks/FileTypes-CKOjpHjz.cjs"),d=require("./chunks/PerspectiveCamera-CONx93im.cjs"),r=require("three"),M=require("./chunks/isFileTypeSupported-CrEqYiv9.cjs"),I=require("./chunks/findInterface-C6mrvf_t.cjs"),V=require("./chunks/network-error-CdDXil5g.cjs"),P=require("./chunks/file-type-error-BsK7IJt7.cjs"),S=require("./chunks/parse-error-m5cNt1UV.cjs"),y=require("./chunks/PovSchema-Co9FznEz.cjs");class f extends r.Object3D{constructor(e,t,o,h,l){super();s(this,"isHoverable",!0);s(this,"isDraggable",!0);s(this,"parent",null);s(this,"axis");s(this,"_color",new r.Color(16711935));s(this,"_colorHover");s(this,"_hovered");s(this,"_highlight");s(this,"_lineMaterial");s(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(l),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const _=new r.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new r.MeshBasicMaterial({color:l,depthTest:!1,depthWrite:!1});const c=new r.Mesh(_,this._lineMaterial);c.layers.mask=d.UI_LAYER_MASK,c.renderOrder=1/0,this.add(c);const p=new r.TorusGeometry(t,.1,3,48,o),g=new r.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new r.Mesh(p,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=d.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new r.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new r.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new r.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function u(i,n){const e=(i+"e").split("e");return+(e[0]+"e"+(+e[1]+(n||0)))}function R(i,n=0){const e=u(i,+n);return u(Math.ceil(e),-n)}function v(i,n=0){const e=u(i,+n);return u(Math.floor(e),-n)}function b(i,n=0){if(i<0)return-b(-i,n);const e=u(i,+n);return u(Math.round(e),-n)}function H(i,n,e){return Math.atan2(i.clone().cross(n).dot(e),n.clone().dot(i))}function z(i,n=0){const e=u(i,+n);return u(Math.round(e),-n).toFixed(n)}function G(i,n=0){const e=u(i,+n);return u(Math.trunc(e),-n)}function L(i){return(r.MathUtils.radToDeg(i)+360)%360}function O(i){return r.MathUtils.degToRad(i)}const A={ceilExp:R,floorExp:v,roundExp:b,toFixedExp:z,truncateExp:G,signedAngleTo:H,radToDeg:L,degToRad:O};class C extends r.Object3D{constructor(e){super();s(this,"children");s(this,"_controller");s(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new f("x",1,Math.PI/2,new r.Vector3(1,0,0),a.AxesColorRed)),this.add(new f("y",1,-Math.PI/2,new r.Vector3(0,1,0),a.AxesColorGreen)),this.add(new f("z",1,Math.PI/2,new r.Vector3(0,0,1),a.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),l=A.signedAngleTo(h,o,e.forwardVector),_=new r.Euler(this._startRot.x+e.forwardVector.x*l,this._startRot.y+e.forwardVector.y*l,this._startRot.z+e.forwardVector.z*l);this.parent.parent.onChange(void 0,_)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class E extends r.Object3D{constructor(e,t,o,h){super();s(this,"isHoverable",!0);s(this,"isDraggable",!0);s(this,"parent",null);s(this,"axis");s(this,"_color",new r.Color(16711935));s(this,"_colorHover");s(this,"_hovered");s(this,"_highlight");s(this,"_lineMaterial");s(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const l=new r.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new r.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const _=new r.Mesh(l,this._lineMaterial);_.layers.mask=d.UI_LAYER_MASK,_.renderOrder=1/0,_.rotateX(Math.PI/2),_.translateY(t/2),this.add(_);const c=new r.CylinderGeometry(.1,.1,t,3),p=new r.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new r.Mesh(c,p),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=d.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new r.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new r.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new r.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class j extends r.Object3D{constructor(e){super();s(this,"_controller");s(this,"children");s(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new E("x",1,new r.Vector3(1,0,0),a.AxesColorRed)),this.add(new E("y",1,new r.Vector3(0,1,0),a.AxesColorGreen)),this.add(new E("z",1,new r.Vector3(0,0,1),a.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class m extends r.Object3D{constructor(e,t,o,h,l=.05){super();s(this,"isHoverable",!0);s(this,"isDraggable",!0);s(this,"parent",null);s(this,"axis");s(this,"_color",new r.Color(16711935));s(this,"_colorHover");s(this,"_hovered");s(this,"_highlight");s(this,"_lineMaterial");s(this,"_colliderMesh");s(this,"_box");s(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=l;const _=new r.CylinderGeometry(.01,.01,t-l/2,13);this._lineMaterial=new r.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const c=new r.Mesh(_,this._lineMaterial);c.layers.mask=d.UI_LAYER_MASK,c.renderOrder=1/0,c.rotateX(Math.PI/2),c.translateY(t/2-l/4),this.add(c),this._box=new r.Mesh(new r.BoxGeometry(l,l,l),this._lineMaterial),this._box.layers.mask=d.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-l/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const p=new r.CylinderGeometry(.1,.1,t+l/2,3),g=new r.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new r.Mesh(p,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=d.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new r.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new r.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new r.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new r.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class T extends r.Object3D{constructor(e){super();s(this,"isHoverable",!0);s(this,"children");s(this,"_controller");s(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new m("x",1,new r.Vector3(1,0,0),a.AxesColorRed)),this.add(new m("y",1,new r.Vector3(0,1,0),a.AxesColorGreen)),this.add(new m("z",1,new r.Vector3(0,0,1),a.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class Y extends r.Object3D{constructor(){super();s(this,"_meshX");s(this,"_meshY");s(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new r.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new r.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new r.Mesh(t,o),this._meshX.layers.mask=d.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new r.PlaneGeometry(100,100,2,2),l=e.clone();l.color.set(65280),this._meshY=new r.Mesh(h,l),this._meshY.layers.mask=d.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const _=new r.PlaneGeometry(100,100,2,2),c=e.clone();c.color.set(255),this._meshZ=new r.Mesh(_,c),this._meshZ.layers.mask=d.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class N extends r.Object3D{constructor(e){super();s(this,"_mode");s(this,"_gizmoNode");s(this,"_translateGizmo");s(this,"_rotateGizmo");s(this,"_scaleGizmo");s(this,"_gizmoPlane");s(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new r.Object3D,this.add(this._gizmoNode),this._translateGizmo=new j(e),this._rotateGizmo=new C(e),this._scaleGizmo=new T(e),this._gizmoPlane=new Y,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class F{constructor(){s(this,"isMovable",!0)}}class U{constructor(){s(this,"isSelectable",!0)}}const D=(i,n)=>{if(Object.keys(i).length===0&&Object.keys(n).length===0)return{};if(typeof i!="object"||typeof n!="object")return n;let e={};return Object.keys(n).forEach(t=>{if(!Object.keys(i).includes(t)){e={...e,[t]:n[t]};return}if(Array.isArray(n[t])){if(!Array.isArray(i[t])){e={...e,[t]:n[t]};return}const o=i[t],h=n[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:n[t]};return}const l=[];if(h.forEach((_,c)=>{const p=D(o[c],h[c]);Object.keys(p).length&&l.push(h[c])}),Object.keys(l).length){e={...e,[t]:l};return}return}if(typeof n[t]=="object"){if(typeof i[t]!="object"){e={...e,[t]:n[t]};return}const o=D(i[t],n[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}i[t]!==n[t]&&(e={...e,[t]:n[t]})}),e};function K(i,n){return n.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(i.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(i.prototype,o,h)})}),i}function X(i){return i.entityType==="group"}function q(i){return i.entityType==="light"}function B(i){return i.entityType==="primitive"}exports.AxesColorBlue=a.AxesColorBlue;exports.AxesColorBlueLetter=a.AxesColorBlueLetter;exports.AxesColorGreen=a.AxesColorGreen;exports.AxesColorGreenLetter=a.AxesColorGreenLetter;exports.AxesColorRed=a.AxesColorRed;exports.AxesColorRedLetter=a.AxesColorRedLetter;exports.DIVE=a.DIVE;exports.DIVEAmbientLight=a.DIVEAmbientLight;exports.DIVEClock=a.DIVEClock;exports.DIVEDefaultSettings=a.DIVEDefaultSettings;exports.DIVEEngine=a.DIVEEngine;exports.DIVEFloor=a.DIVEFloor;exports.DIVEGrid=a.DIVEGrid;exports.DIVEGroup=a.DIVEGroup;exports.DIVEModel=a.DIVEModel;exports.DIVENode=a.DIVENode;exports.DIVEPointLight=a.DIVEPointLight;exports.DIVEPrimitive=a.DIVEPrimitive;exports.DIVERenderPipeline=a.DIVERenderPipeline;exports.DIVERenderPipelineDefaultSettings=a.DIVERenderPipelineDefaultSettings;exports.DIVEResizeManager=a.DIVEResizeManager;exports.DIVERoot=a.DIVERoot;exports.DIVEScene=a.DIVEScene;exports.DIVESceneLight=a.DIVESceneLight;exports.EngineDefaultSettings=a.EngineDefaultSettings;exports.FILE_TYPES=a.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=a.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=a.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=a.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=a.findSceneRecursive;exports.COORDINATE_LAYER_MASK=d.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=d.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=d.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=d.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=d.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=d.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=d.UI_LAYER_MASK;exports.getFileTypeFromUri=M.getFileTypeFromUri;exports.isFileTypeSupported=M.isFileTypeSupported;exports.findInterface=I.findInterface;exports.implementsInterface=I.implementsInterface;exports.FileContentError=V.FileContentError;exports.NetworkError=V.NetworkError;exports.FileTypeError=P.FileTypeError;exports.ParseError=S.ParseError;exports.isModelSchema=y.isModelSchema;exports.isPovSchema=y.isPovSchema;exports.DIVEGizmo=N;exports.DIVEMath=A;exports.DIVEMovable=F;exports.DIVESelectable=U;exports.applyMixins=K;exports.getObjectDelta=D;exports.isGroupSchema=X;exports.isLightSchema=q;exports.isPrimitiveSchema=B;
|