@shopware-ag/dive 2.0.1-beta.0 → 2.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/chunks/{SelectTool-BRKko7uz.cjs → SelectTool-BAXTVyWs.cjs} +1 -1
- package/build/chunks/{SelectTool-mTRiZYaC.mjs → SelectTool-Bd8cC9nb.mjs} +15 -15
- package/build/chunks/{package-BvoZkrge.mjs → package-BHjZWYD6.mjs} +1 -1
- package/build/chunks/{package-BFpY3sIj.cjs → package-JHvTSNgQ.cjs} +1 -1
- package/build/dive.cjs +2 -2
- package/build/dive.mjs +471 -565
- package/build/src/components/floor/Floor.d.ts +2 -2
- package/build/src/components/grid/Grid.d.ts +1 -1
- package/build/src/components/light/AmbientLight.d.ts +3 -3
- package/build/src/components/light/PointLight.d.ts +3 -3
- package/build/src/components/light/SceneLight.d.ts +3 -3
- package/build/src/components/model/Model.d.ts +7 -4
- package/build/src/components/node/Node.d.ts +2 -2
- package/build/src/components/primitive/Primitive.d.ts +3 -3
- package/build/src/components/root/Root.d.ts +19 -29
- package/build/src/core/Dive.d.ts +4 -4
- package/build/src/engine/Engine.d.ts +2 -6
- package/build/src/engine/scene/Scene.d.ts +4 -22
- package/build/src/modules/asset/draco/README.md +32 -0
- package/build/src/modules/asset/draco/draco_decoder.js +33 -0
- package/build/src/modules/asset/draco/draco_decoder.wasm +0 -0
- package/build/src/modules/asset/draco/draco_encoder.js +33 -0
- package/build/src/modules/asset/draco/draco_wasm_wrapper.js +116 -0
- package/build/src/modules/asset/draco/gltf/draco_decoder.js +33 -0
- package/build/src/modules/asset/draco/gltf/draco_decoder.wasm +0 -0
- package/build/src/modules/asset/draco/gltf/draco_encoder.js +33 -0
- package/build/src/modules/asset/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/build/src/modules/asset/loader/AssetLoader.cjs +3 -2
- package/build/src/modules/asset/loader/AssetLoader.mjs +1274 -1039
- package/build/src/modules/state/State.cjs +9 -9
- package/build/src/modules/state/State.mjs +579 -554
- package/build/src/modules/state/actions/camera/movecamera.d.ts +2 -2
- package/build/src/modules/state/actions/object/addobject.d.ts +1 -1
- package/build/src/modules/state/actions/object/deleteobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/deselectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/dropit.d.ts +2 -2
- package/build/src/modules/state/actions/object/getobjects.d.ts +2 -2
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +2 -2
- package/build/src/modules/state/actions/object/selectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/setparent.d.ts +2 -2
- package/build/src/modules/state/actions/object/updateobject.d.ts +2 -2
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +5 -0
- package/build/src/modules/state/types/COMGroup.d.ts +1 -0
- package/build/src/modules/state/types/COMLight.d.ts +18 -2
- package/build/src/modules/state/types/COMModel.d.ts +1 -0
- package/build/src/modules/state/types/COMPov.d.ts +1 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +1 -0
- package/build/src/modules/toolbox/Toolbox.cjs +1 -1
- package/build/src/modules/toolbox/Toolbox.mjs +1 -1
- package/build/src/types/SceneObjects.d.ts +3 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ft=Object.defineProperty;var _t=(r,n,e)=>n in r?ft(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>_t(r,typeof n!="symbol"?n+"":n,e);const t=require("three"),J=require("./VisibilityLayerMask-BI7jPKdx.cjs"),y=require("./findInterface-BEdL2iUQ.cjs"),I=new t.Raycaster,p=new t.Vector3,E=new t.Vector3,c=new t.Quaternion,$={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},F={type:"change"},tt={type:"mouseDown"},et={type:"mouseUp",mode:null},it={type:"objectChange"};class yt 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 vt;this._gizmo=o,this.add(o);const s=new Pt;this._plane=s,this.add(s);const a=this;function i(u,w){let G=w;Object.defineProperty(a,u,{get:function(){return G!==void 0?G:w},set:function(D){G!==D&&(G=D,s[u]=D,o[u]=D,a.dispatchEvent({type:u+"-changed",value:D}),a.dispatchEvent(F))}}),a[u]=w,s[u]=w,o[u]=w}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,x=new t.Quaternion,T=new t.Quaternion,j=new t.Vector3,z=new t.Quaternion,N=new t.Vector3,Z=new t.Vector3,S=new t.Vector3,v=0,b=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",x),i("worldQuaternionStart",T),i("cameraPosition",j),i("cameraQuaternion",z),i("pointStart",N),i("pointEnd",Z),i("rotationAxis",S),i("rotationAngle",v),i("eye",b),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=wt.bind(this),this._onPointerDown=bt.bind(this),this._onPointerHover=gt.bind(this),this._onPointerMove=Mt.bind(this),this._onPointerUp=St.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&&I.setFromCamera(n,this.camera);const e=U(this._gizmo.picker[this.mode],I);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&&I.setFromCamera(n,this.camera);const e=U(this._plane,I,!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,tt.mode=this.mode,this.dispatchEvent(tt)}}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&&I.setFromCamera(n,this.camera);const i=U(this._plane,I,!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),E.set(d,d,d)}else p.copy(this.pointStart),E.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),E.applyQuaternion(this._worldQuaternionInv),E.divide(p),e.search("X")===-1&&(E.x=1),e.search("Y")===-1&&(E.y=1),e.search("Z")===-1&&(E.z=1);s.scale.copy(this._scaleStart).multiply(E),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($[e]),p.copy($[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(F),this.dispatchEvent(it)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(et.mode=this.mode,this.dispatchEvent(et)),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(F),this.dispatchEvent(it),this.pointStart.copy(this.pointEnd))}getRaycaster(){return I}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 wt(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 gt(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function bt(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 Mt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function St(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function U(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 k=new t.Euler,l=new t.Vector3(0,1,0),nt=new t.Vector3(0,0,0),ot=new t.Matrix4,q=new t.Quaternion,W=new t.Quaternion,M=new t.Vector3,st=new t.Matrix4,Y=new t.Vector3(1,0,0),A=new t.Vector3(0,1,0),O=new t.Vector3(0,0,1),B=new t.Vector3,C=new t.Vector3,X=new t.Vector3;class vt 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 x=n.clone();x.color.setHex(65280),x.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const j=n.clone();j.opacity=.25;const z=n.clone();z.color.setHex(16776960),z.opacity=.25,n.clone().color.setHex(16776960);const Z=n.clone();Z.color.setHex(7895160);const S=new t.CylinderGeometry(0,.04,.1,12);S.translate(0,.05,0);const v=new t.BoxGeometry(.08,.08,.08);v.translate(0,.04,0);const b=new t.BufferGeometry;b.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const u=new t.CylinderGeometry(.0075,.0075,.5,3);u.translate(0,.25,0);function w(_,H){const g=new t.TorusGeometry(_,.0075,3,64,H*Math.PI*2);return g.rotateY(Math.PI/2),g.rotateX(Math.PI/2),g}function G(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const D={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(S,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(u,i)]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(u,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),j.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),x.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},rt={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]]]},at={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(G(),s),null,null,null,"helper"]],X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},lt={XYZE:[[new t.Mesh(w(.5,1),Z),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(w(.5,.5),a)]],Y:[[new t.Mesh(w(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(w(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(w(.75,1),z),null,[0,Math.PI/2,0]]]},ht={AXIS:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},ct={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)]]},dt={X:[[new t.Mesh(v,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(v,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(v,i),[0,.5,0]],[new t.Mesh(u,i)],[new t.Mesh(v,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(v,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(u,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(v,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),x),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),j.clone())]]},pt={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]]]},ut={X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function P(_){const H=new t.Object3D;for(const g in _)for(let Q=_[g].length;Q--;){const m=_[g][Q][0].clone(),L=_[g][Q][1],V=_[g][Q][2],R=_[g][Q][3],mt=_[g][Q][4];m.name=g,m.tag=mt,L&&m.position.set(L[0],L[1],L[2]),V&&m.rotation.set(V[0],V[1],V[2]),R&&m.scale.set(R[0],R[1],R[2]),m.updateMatrix();const K=m.geometry.clone();K.applyMatrix4(m.matrix),m.geometry=K,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),H.add(m)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=P(D)),this.add(this.gizmo.rotate=P(lt)),this.add(this.gizmo.scale=P(dt)),this.add(this.picker.translate=P(rt)),this.add(this.picker.rotate=P(ct)),this.add(this.picker.scale=P(pt)),this.add(this.helper.translate=P(at)),this.add(this.helper.rotate=P(ht)),this.add(this.helper.scale=P(ut)),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:W;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(k.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(k.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(A).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(ot.lookAt(nt,l,A)),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(Y).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(A).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(O).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(O).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(Y).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(A).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(q.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(ot.lookAt(this.eye,nt,A)),i.name==="X"&&(c.setFromAxisAngle(Y,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(A,Math.atan2(l.x,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(O,Math.atan2(l.y,l.x)),c.multiplyQuaternions(q,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 Pt 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"),B.copy(Y).applyQuaternion(e==="local"?this.worldQuaternion:W),C.copy(A).applyQuaternion(e==="local"?this.worldQuaternion:W),X.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:W),l.copy(C),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(B),M.copy(B).cross(l);break;case"Y":l.copy(this.eye).cross(C),M.copy(C).cross(l);break;case"Z":l.copy(this.eye).cross(X),M.copy(X).cross(l);break;case"XY":M.copy(X);break;case"YZ":M.copy(B);break;case"XZ":l.copy(X),M.copy(C);break;case"XYZ":case"E":M.set(0,0,0);break}break;case"rotate":default:M.set(0,0,0)}M.length()===0?this.quaternion.copy(this.cameraQuaternion):(st.lookAt(p.set(0,0,0),M,l),this.quaternion.setFromRotationMatrix(st)),super.updateMatrixWorld(n)}}class Et{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=J.PRODUCT_LAYER_MASK|J.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=y.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=y.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}}class xt extends Et{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 yt(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(y.AxesColorRed),o.name==="Y"&&s.color.set(y.AxesColorGreen),o.name==="Z"&&s.color.set(y.AxesColorBlue),o.name==="XY"&&s.color.set(y.AxesColorBlue),o.name==="YZ"&&s.color.set(y.AxesColorRed),o.name==="XZ"&&s.color.set(y.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(y.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,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Dt=r=>r.isSelectTool!==void 0;class It extends xt{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=y.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.DIVESelectTool=It;exports.isSelectTool=Dt;
|
|
1
|
+
"use strict";var ft=Object.defineProperty;var _t=(r,n,e)=>n in r?ft(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>_t(r,typeof n!="symbol"?n+"":n,e);const t=require("three"),J=require("./VisibilityLayerMask-BI7jPKdx.cjs"),y=require("./findInterface-BEdL2iUQ.cjs"),I=new t.Raycaster,p=new t.Vector3,E=new t.Vector3,c=new t.Quaternion,$={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},F={type:"change"},tt={type:"mouseDown"},et={type:"mouseUp",mode:null},it={type:"objectChange"};class yt 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 vt;this._gizmo=o,this.add(o);const s=new Pt;this._plane=s,this.add(s);const a=this;function i(u,w){let G=w;Object.defineProperty(a,u,{get:function(){return G!==void 0?G:w},set:function(D){G!==D&&(G=D,s[u]=D,o[u]=D,a.dispatchEvent({type:u+"-changed",value:D}),a.dispatchEvent(F))}}),a[u]=w,s[u]=w,o[u]=w}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,x=new t.Quaternion,T=new t.Quaternion,j=new t.Vector3,z=new t.Quaternion,N=new t.Vector3,Z=new t.Vector3,S=new t.Vector3,v=0,b=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",x),i("worldQuaternionStart",T),i("cameraPosition",j),i("cameraQuaternion",z),i("pointStart",N),i("pointEnd",Z),i("rotationAxis",S),i("rotationAngle",v),i("eye",b),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=wt.bind(this),this._onPointerDown=bt.bind(this),this._onPointerHover=gt.bind(this),this._onPointerMove=Mt.bind(this),this._onPointerUp=St.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&&I.setFromCamera(n,this.camera);const e=U(this._gizmo.picker[this.mode],I);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&&I.setFromCamera(n,this.camera);const e=U(this._plane,I,!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,tt.mode=this.mode,this.dispatchEvent(tt)}}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&&I.setFromCamera(n,this.camera);const i=U(this._plane,I,!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),E.set(d,d,d)}else p.copy(this.pointStart),E.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),E.applyQuaternion(this._worldQuaternionInv),E.divide(p),e.search("X")===-1&&(E.x=1),e.search("Y")===-1&&(E.y=1),e.search("Z")===-1&&(E.z=1);s.scale.copy(this._scaleStart).multiply(E),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($[e]),p.copy($[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(F),this.dispatchEvent(it)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(et.mode=this.mode,this.dispatchEvent(et)),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(F),this.dispatchEvent(it),this.pointStart.copy(this.pointEnd))}getRaycaster(){return I}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 wt(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 gt(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function bt(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 Mt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function St(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function U(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 k=new t.Euler,l=new t.Vector3(0,1,0),nt=new t.Vector3(0,0,0),ot=new t.Matrix4,q=new t.Quaternion,W=new t.Quaternion,M=new t.Vector3,st=new t.Matrix4,Y=new t.Vector3(1,0,0),A=new t.Vector3(0,1,0),O=new t.Vector3(0,0,1),B=new t.Vector3,C=new t.Vector3,X=new t.Vector3;class vt 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 x=n.clone();x.color.setHex(65280),x.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const j=n.clone();j.opacity=.25;const z=n.clone();z.color.setHex(16776960),z.opacity=.25,n.clone().color.setHex(16776960);const Z=n.clone();Z.color.setHex(7895160);const S=new t.CylinderGeometry(0,.04,.1,12);S.translate(0,.05,0);const v=new t.BoxGeometry(.08,.08,.08);v.translate(0,.04,0);const b=new t.BufferGeometry;b.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const u=new t.CylinderGeometry(.0075,.0075,.5,3);u.translate(0,.25,0);function w(_,H){const g=new t.TorusGeometry(_,.0075,3,64,H*Math.PI*2);return g.rotateY(Math.PI/2),g.rotateX(Math.PI/2),g}function G(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const D={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(S,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(u,i)]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(u,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),j.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),x.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},rt={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]]]},at={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(G(),s),null,null,null,"helper"]],X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},lt={XYZE:[[new t.Mesh(w(.5,1),Z),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(w(.5,.5),a)]],Y:[[new t.Mesh(w(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(w(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(w(.75,1),z),null,[0,Math.PI/2,0]]]},ht={AXIS:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},ct={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)]]},dt={X:[[new t.Mesh(v,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(v,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(v,i),[0,.5,0]],[new t.Mesh(u,i)],[new t.Mesh(v,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(v,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(u,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(v,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),x),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),j.clone())]]},pt={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]]]},ut={X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function P(_){const H=new t.Object3D;for(const g in _)for(let Q=_[g].length;Q--;){const m=_[g][Q][0].clone(),L=_[g][Q][1],V=_[g][Q][2],R=_[g][Q][3],mt=_[g][Q][4];m.name=g,m.tag=mt,L&&m.position.set(L[0],L[1],L[2]),V&&m.rotation.set(V[0],V[1],V[2]),R&&m.scale.set(R[0],R[1],R[2]),m.updateMatrix();const K=m.geometry.clone();K.applyMatrix4(m.matrix),m.geometry=K,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),H.add(m)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=P(D)),this.add(this.gizmo.rotate=P(lt)),this.add(this.gizmo.scale=P(dt)),this.add(this.picker.translate=P(rt)),this.add(this.picker.rotate=P(ct)),this.add(this.picker.scale=P(pt)),this.add(this.helper.translate=P(at)),this.add(this.helper.rotate=P(ht)),this.add(this.helper.scale=P(ut)),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:W;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(k.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(k.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(A).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(ot.lookAt(nt,l,A)),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(Y).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(A).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(O).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(O).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(Y).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(A).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(q.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(ot.lookAt(this.eye,nt,A)),i.name==="X"&&(c.setFromAxisAngle(Y,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(A,Math.atan2(l.x,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(O,Math.atan2(l.y,l.x)),c.multiplyQuaternions(q,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 Pt 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"),B.copy(Y).applyQuaternion(e==="local"?this.worldQuaternion:W),C.copy(A).applyQuaternion(e==="local"?this.worldQuaternion:W),X.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:W),l.copy(C),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(B),M.copy(B).cross(l);break;case"Y":l.copy(this.eye).cross(C),M.copy(C).cross(l);break;case"Z":l.copy(this.eye).cross(X),M.copy(X).cross(l);break;case"XY":M.copy(X);break;case"YZ":M.copy(B);break;case"XZ":l.copy(X),M.copy(C);break;case"XYZ":case"E":M.set(0,0,0);break}break;case"rotate":default:M.set(0,0,0)}M.length()===0?this.quaternion.copy(this.cameraQuaternion):(st.lookAt(p.set(0,0,0),M,l),this.quaternion.setFromRotationMatrix(st)),super.updateMatrixWorld(n)}}class Et{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=J.PRODUCT_LAYER_MASK|J.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=y.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=y.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}}class xt extends Et{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 yt(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(y.AxesColorRed),o.name==="Y"&&s.color.set(y.AxesColorGreen),o.name==="Z"&&s.color.set(y.AxesColorBlue),o.name==="XY"&&s.color.set(y.AxesColorBlue),o.name==="YZ"&&s.color.set(y.AxesColorRed),o.name==="XZ"&&s.color.set(y.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(y.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,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Dt=r=>r.isSelectTool!==void 0;class It extends xt{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=y.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.DIVESelectTool=It;exports.isSelectTool=Dt;
|
|
@@ -2,14 +2,14 @@ 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
4
|
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 lt, Float32BufferAttribute as ht, 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";
|
|
5
|
-
import { P as Ct, U as
|
|
5
|
+
import { P as Ct, U as kt } from "./VisibilityLayerMask-CXgt1fJc.mjs";
|
|
6
6
|
import { f as ot, A as ct, a as dt, b as pt, i as et } from "./findInterface-OrXgmwxj.mjs";
|
|
7
7
|
const j = new bt(), u = new a(), A = new a(), d = new E(), ut = {
|
|
8
8
|
X: new a(1, 0, 0),
|
|
9
9
|
Y: new a(0, 1, 0),
|
|
10
10
|
Z: new a(0, 0, 1)
|
|
11
11
|
}, it = { type: "change" }, mt = { type: "mouseDown" }, ft = { type: "mouseUp", mode: null }, _t = { type: "objectChange" };
|
|
12
|
-
class
|
|
12
|
+
class Lt extends st {
|
|
13
13
|
constructor(i, t) {
|
|
14
14
|
super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
|
|
15
15
|
const n = new Ut();
|
|
@@ -30,7 +30,7 @@ class kt extends st {
|
|
|
30
30
|
}
|
|
31
31
|
e("camera", i), e("object", void 0), e("enabled", !0), e("axis", null), e("mode", "translate"), e("translationSnap", null), e("rotationSnap", null), e("scaleSnap", null), e("space", "world"), e("size", 1), e("dragging", !1), e("showX", !0), e("showY", !0), e("showZ", !0);
|
|
32
32
|
const p = new a(), g = new a(), z = new E(), Y = new E(), H = new a(), O = new E(), at = new a(), q = new a(), M = new a(), x = 0, v = new a();
|
|
33
|
-
e("worldPosition", p), e("worldPositionStart", g), e("worldQuaternion", z), e("worldQuaternionStart", Y), e("cameraPosition", H), e("cameraQuaternion", O), e("pointStart", at), e("pointEnd", q), e("rotationAxis", M), e("rotationAngle", x), e("eye", v), this._offset = new a(), this._startNorm = new a(), this._endNorm = new a(), this._cameraScale = new a(), this._parentPosition = new a(), this._parentQuaternion = new E(), this._parentQuaternionInv = new E(), this._parentScale = new a(), this._worldScaleStart = new a(), this._worldQuaternionInv = new E(), this._worldScale = new a(), this._positionStart = new a(), this._quaternionStart = new E(), this._scaleStart = new a(), this._getPointer =
|
|
33
|
+
e("worldPosition", p), e("worldPositionStart", g), e("worldQuaternion", z), e("worldQuaternionStart", Y), e("cameraPosition", H), e("cameraQuaternion", O), e("pointStart", at), e("pointEnd", q), e("rotationAxis", M), e("rotationAngle", x), e("eye", v), this._offset = new a(), this._startNorm = new a(), this._endNorm = new a(), this._cameraScale = new a(), this._parentPosition = new a(), this._parentQuaternion = new E(), this._parentQuaternionInv = new E(), this._parentScale = new a(), this._worldScaleStart = new a(), this._worldQuaternionInv = new E(), this._worldScale = new a(), this._positionStart = new a(), this._quaternionStart = new E(), this._scaleStart = new a(), this._getPointer = Rt.bind(this), this._onPointerDown = qt.bind(this), this._onPointerHover = Gt.bind(this), this._onPointerMove = Wt.bind(this), this._onPointerUp = Ft.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
34
34
|
}
|
|
35
35
|
// updateMatrixWorld updates key transformation variables
|
|
36
36
|
updateMatrixWorld(i) {
|
|
@@ -119,7 +119,7 @@ class kt extends st {
|
|
|
119
119
|
this.space = i;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function Rt(r) {
|
|
123
123
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
124
124
|
return {
|
|
125
125
|
x: 0,
|
|
@@ -160,7 +160,7 @@ function nt(r, i, t) {
|
|
|
160
160
|
return n[s];
|
|
161
161
|
return !1;
|
|
162
162
|
}
|
|
163
|
-
const N = new Zt(), h = new a(0, 1, 0), wt = new a(0, 0, 0), gt = new vt(), K = new E(), $ = new E(), P = new a(), yt = new vt(),
|
|
163
|
+
const N = new Zt(), h = new a(0, 1, 0), wt = new a(0, 0, 0), gt = new vt(), K = new E(), $ = new E(), P = new a(), yt = new vt(), R = new a(1, 0, 0), X = new a(0, 1, 0), G = new a(0, 0, 1), J = new a(), k = new a(), L = new a();
|
|
164
164
|
class Ut extends st {
|
|
165
165
|
constructor() {
|
|
166
166
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
@@ -410,10 +410,10 @@ class Ut extends st {
|
|
|
410
410
|
e.visible = !0, e.rotation.set(0, 0, 0), e.position.copy(this.worldPosition);
|
|
411
411
|
let p;
|
|
412
412
|
if (this.camera.isOrthographicCamera ? p = (this.camera.top - this.camera.bottom) / this.camera.zoom : p = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), e.scale.set(1, 1, 1).multiplyScalar(p * this.size / 4), e.tag === "helper") {
|
|
413
|
-
e.visible = !1, e.name === "AXIS" ? (e.visible = !!this.axis, this.axis === "X" && (d.setFromEuler(N.set(0, 0, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(
|
|
413
|
+
e.visible = !1, e.name === "AXIS" ? (e.visible = !!this.axis, this.axis === "X" && (d.setFromEuler(N.set(0, 0, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(R).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "Y" && (d.setFromEuler(N.set(0, 0, Math.PI / 2)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "Z" && (d.setFromEuler(N.set(0, Math.PI / 2, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "XYZE" && (d.setFromEuler(N.set(0, Math.PI / 2, 0)), h.copy(this.rotationAxis), e.quaternion.setFromRotationMatrix(gt.lookAt(wt, h, X)), e.quaternion.multiply(d), e.visible = this.dragging), this.axis === "E" && (e.visible = !1)) : e.name === "START" ? (e.position.copy(this.worldPositionStart), e.visible = this.dragging) : e.name === "END" ? (e.position.copy(this.worldPosition), e.visible = this.dragging) : e.name === "DELTA" ? (e.position.copy(this.worldPositionStart), e.quaternion.copy(this.worldQuaternionStart), u.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), u.applyQuaternion(this.worldQuaternionStart.clone().invert()), e.scale.copy(u), e.visible = this.dragging) : (e.quaternion.copy(n), this.dragging ? e.position.copy(this.worldPositionStart) : e.position.copy(this.worldPosition), this.axis && (e.visible = this.axis.search(e.name) !== -1));
|
|
414
414
|
continue;
|
|
415
415
|
}
|
|
416
|
-
e.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (e.name === "X" && Math.abs(h.copy(
|
|
416
|
+
e.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (e.name === "X" && Math.abs(h.copy(R).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "Y" && Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "Z" && Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "XY" && Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "YZ" && Math.abs(h.copy(R).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "XZ" && Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1)) : this.mode === "rotate" && (K.copy(n), h.copy(this.eye).applyQuaternion(d.copy(n).invert()), e.name.search("E") !== -1 && e.quaternion.setFromRotationMatrix(gt.lookAt(this.eye, wt, X)), e.name === "X" && (d.setFromAxisAngle(R, Math.atan2(-h.y, h.z)), d.multiplyQuaternions(K, d), e.quaternion.copy(d)), e.name === "Y" && (d.setFromAxisAngle(X, Math.atan2(h.x, h.z)), d.multiplyQuaternions(K, d), e.quaternion.copy(d)), e.name === "Z" && (d.setFromAxisAngle(G, Math.atan2(h.y, h.x)), d.multiplyQuaternions(K, d), e.quaternion.copy(d))), e.visible = e.visible && (e.name.indexOf("X") === -1 || this.showX), e.visible = e.visible && (e.name.indexOf("Y") === -1 || this.showY), e.visible = e.visible && (e.name.indexOf("Z") === -1 || this.showZ), e.visible = e.visible && (e.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), e.material._color = e.material._color || e.material.color.clone(), e.material._opacity = e.material._opacity || e.material.opacity, e.material.color.copy(e.material._color), e.material.opacity = e.material._opacity, this.enabled && this.axis && (e.name === this.axis || this.axis.split("").some(function(g) {
|
|
417
417
|
return e.name === g;
|
|
418
418
|
})) && (e.material.color.setHex(16776960), e.material.opacity = 1);
|
|
419
419
|
}
|
|
@@ -429,7 +429,7 @@ class Vt extends o {
|
|
|
429
429
|
}
|
|
430
430
|
updateMatrixWorld(i) {
|
|
431
431
|
let t = this.space;
|
|
432
|
-
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), J.copy(
|
|
432
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), J.copy(R).applyQuaternion(t === "local" ? this.worldQuaternion : $), k.copy(X).applyQuaternion(t === "local" ? this.worldQuaternion : $), L.copy(G).applyQuaternion(t === "local" ? this.worldQuaternion : $), h.copy(k), this.mode) {
|
|
433
433
|
case "translate":
|
|
434
434
|
case "scale":
|
|
435
435
|
switch (this.axis) {
|
|
@@ -437,19 +437,19 @@ class Vt extends o {
|
|
|
437
437
|
h.copy(this.eye).cross(J), P.copy(J).cross(h);
|
|
438
438
|
break;
|
|
439
439
|
case "Y":
|
|
440
|
-
h.copy(this.eye).cross(
|
|
440
|
+
h.copy(this.eye).cross(k), P.copy(k).cross(h);
|
|
441
441
|
break;
|
|
442
442
|
case "Z":
|
|
443
|
-
h.copy(this.eye).cross(
|
|
443
|
+
h.copy(this.eye).cross(L), P.copy(L).cross(h);
|
|
444
444
|
break;
|
|
445
445
|
case "XY":
|
|
446
|
-
P.copy(
|
|
446
|
+
P.copy(L);
|
|
447
447
|
break;
|
|
448
448
|
case "YZ":
|
|
449
449
|
P.copy(J);
|
|
450
450
|
break;
|
|
451
451
|
case "XZ":
|
|
452
|
-
h.copy(
|
|
452
|
+
h.copy(L), P.copy(k);
|
|
453
453
|
break;
|
|
454
454
|
case "XYZ":
|
|
455
455
|
case "E":
|
|
@@ -491,7 +491,7 @@ class Bt {
|
|
|
491
491
|
c(this, "_dragDelta");
|
|
492
492
|
c(this, "_draggable");
|
|
493
493
|
c(this, "_dragRaycastOnObjects");
|
|
494
|
-
this.name = "BaseTool", this._canvas = t.domElement, this._scene = i, this._controller = t, this._pointer = new tt(), this._pointerPrimaryDown = !1, this._pointerMiddleDown = !1, this._pointerSecondaryDown = !1, this._lastPointerDown = new tt(), this._lastPointerUp = new tt(), this._raycaster = new bt(), this._raycaster.layers.mask = Ct |
|
|
494
|
+
this.name = "BaseTool", this._canvas = t.domElement, this._scene = i, this._controller = t, this._pointer = new tt(), this._pointerPrimaryDown = !1, this._pointerMiddleDown = !1, this._pointerSecondaryDown = !1, this._lastPointerDown = new tt(), this._lastPointerUp = new tt(), this._raycaster = new bt(), this._raycaster.layers.mask = Ct | kt, this._intersects = [], this._hovered = null, this._dragging = !1, this._dragStart = new a(), this._dragCurrent = new a(), this._dragEnd = new a(), this._dragDelta = new a(), this._draggable = null, this._dragRaycastOnObjects = null;
|
|
495
495
|
}
|
|
496
496
|
get _pointerAnyDown() {
|
|
497
497
|
return this._pointerPrimaryDown || this._pointerMiddleDown || this._pointerSecondaryDown;
|
|
@@ -644,7 +644,7 @@ class Nt extends Bt {
|
|
|
644
644
|
// return super.raycast((this._gizmo as DIVEGizmo).gizmoNode.children);
|
|
645
645
|
// }
|
|
646
646
|
initGizmo() {
|
|
647
|
-
const t = new
|
|
647
|
+
const t = new Lt(
|
|
648
648
|
// this._controller,
|
|
649
649
|
this._controller.object,
|
|
650
650
|
this._controller.domElement
|
|
@@ -691,7 +691,7 @@ class ie extends Nt {
|
|
|
691
691
|
}
|
|
692
692
|
onClick(t) {
|
|
693
693
|
super.onClick(t);
|
|
694
|
-
const n = this._raycaster.intersectObjects(this._scene.
|
|
694
|
+
const n = this._raycaster.intersectObjects(this._scene.root.children, !0).filter((l) => l.object.visible)[0], s = ot(
|
|
695
695
|
n == null ? void 0 : n.object,
|
|
696
696
|
"isSelectable"
|
|
697
697
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = "@shopware-ag/dive", s = "2.0.1-beta.
|
|
1
|
+
const e = "@shopware-ag/dive", s = "2.0.1-beta.1", t = "Shopware Spatial Framework", o = "module", r = "build/dive.cjs", i = "build/dive.mjs", d = "build/dive.d.ts", l = { ".": { types: "./build/dive.d.ts", import: "./build/dive.mjs", require: "./build/dive.cjs" }, "./modules/AnimationSystem": { types: "./build/src/modules/animation/AnimationSystem.d.ts", import: "./build/src/modules/animation/AnimationSystem.mjs", require: "./build/src/modules/animation/AnimationSystem.cjs" }, "./modules/ARSystem": { types: "./build/src/modules/ar/ARSystem.d.ts", import: "./build/src/modules/ar/ARSystem.mjs", require: "./build/src/modules/ar/ARSystem.cjs" }, "./modules/AssetConverter": { types: "./build/src/modules/asset/converter/AssetConverter.d.ts", import: "./build/src/modules/asset/converter/AssetConverter.mjs", require: "./build/src/modules/asset/converter/AssetConverter.cjs" }, "./modules/AssetExporter": { types: "./build/src/modules/asset/exporter/AssetExporter.d.ts", import: "./build/src/modules/asset/exporter/AssetExporter.mjs", require: "./build/src/modules/asset/exporter/AssetExporter.cjs" }, "./modules/AssetLoader": { types: "./build/src/modules/asset/loader/AssetLoader.d.ts", import: "./build/src/modules/asset/loader/AssetLoader.mjs", require: "./build/src/modules/asset/loader/AssetLoader.cjs" }, "./modules/MediaCreator": { types: "./build/src/modules/mediacreator/MediaCreator.d.ts", import: "./build/src/modules/mediacreator/MediaCreator.mjs", require: "./build/src/modules/mediacreator/MediaCreator.cjs" }, "./modules/State": { types: "./build/src/modules/state/State.d.ts", import: "./build/src/modules/state/State.mjs", require: "./build/src/modules/state/State.cjs" }, "./modules/SystemInfo": { types: "./build/src/modules/systeminfo/SystemInfo.d.ts", import: "./build/src/modules/systeminfo/SystemInfo.mjs", require: "./build/src/modules/systeminfo/SystemInfo.cjs" }, "./modules/Toolbox": { types: "./build/src/modules/toolbox/Toolbox.d.ts", import: "./build/src/modules/toolbox/Toolbox.mjs", require: "./build/src/modules/toolbox/Toolbox.cjs" } }, a = ["build", "LICENSE", "package.json"], c = ["dive", "shopware", "sw6", "three", "three.js", "3d", "typescript"], u = "git@github.com:shopware/dive.git", m = "ffrank <f.frank@shopware.com>", n = "MIT", p = ["> 1%, not dead, not ie 11, not op_mini all"], b = { "@tweenjs/tween.js": "^23.1.1", lodash: "^4.17.21", three: "^0.163.0", "three-spritetext": "^1.8.2" }, y = { "@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", "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", vitest: "^3.1.2" }, v = { "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 lint && yarn prettier:check && yarn docs && yarn coverage && yarn build" }, j = {
|
|
2
2
|
name: e,
|
|
3
3
|
version: s,
|
|
4
4
|
description: t,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="@shopware-ag/dive",s="2.0.1-beta.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="@shopware-ag/dive",s="2.0.1-beta.1",t="Shopware Spatial Framework",o="module",r="build/dive.cjs",i="build/dive.mjs",d="build/dive.d.ts",l={".":{types:"./build/dive.d.ts",import:"./build/dive.mjs",require:"./build/dive.cjs"},"./modules/AnimationSystem":{types:"./build/src/modules/animation/AnimationSystem.d.ts",import:"./build/src/modules/animation/AnimationSystem.mjs",require:"./build/src/modules/animation/AnimationSystem.cjs"},"./modules/ARSystem":{types:"./build/src/modules/ar/ARSystem.d.ts",import:"./build/src/modules/ar/ARSystem.mjs",require:"./build/src/modules/ar/ARSystem.cjs"},"./modules/AssetConverter":{types:"./build/src/modules/asset/converter/AssetConverter.d.ts",import:"./build/src/modules/asset/converter/AssetConverter.mjs",require:"./build/src/modules/asset/converter/AssetConverter.cjs"},"./modules/AssetExporter":{types:"./build/src/modules/asset/exporter/AssetExporter.d.ts",import:"./build/src/modules/asset/exporter/AssetExporter.mjs",require:"./build/src/modules/asset/exporter/AssetExporter.cjs"},"./modules/AssetLoader":{types:"./build/src/modules/asset/loader/AssetLoader.d.ts",import:"./build/src/modules/asset/loader/AssetLoader.mjs",require:"./build/src/modules/asset/loader/AssetLoader.cjs"},"./modules/MediaCreator":{types:"./build/src/modules/mediacreator/MediaCreator.d.ts",import:"./build/src/modules/mediacreator/MediaCreator.mjs",require:"./build/src/modules/mediacreator/MediaCreator.cjs"},"./modules/State":{types:"./build/src/modules/state/State.d.ts",import:"./build/src/modules/state/State.mjs",require:"./build/src/modules/state/State.cjs"},"./modules/SystemInfo":{types:"./build/src/modules/systeminfo/SystemInfo.d.ts",import:"./build/src/modules/systeminfo/SystemInfo.mjs",require:"./build/src/modules/systeminfo/SystemInfo.cjs"},"./modules/Toolbox":{types:"./build/src/modules/toolbox/Toolbox.d.ts",import:"./build/src/modules/toolbox/Toolbox.mjs",require:"./build/src/modules/toolbox/Toolbox.cjs"}},a=["build","LICENSE","package.json"],c=["dive","shopware","sw6","three","three.js","3d","typescript"],n="git@github.com:shopware/dive.git",u="ffrank <f.frank@shopware.com>",m="MIT",p=["> 1%, not dead, not ie 11, not op_mini all"],b={"@tweenjs/tween.js":"^23.1.1",lodash:"^4.17.21",three:"^0.163.0","three-spritetext":"^1.8.2"},y={"@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","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",vitest:"^3.1.2"},v={"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 lint && yarn prettier:check && yarn docs && yarn coverage && yarn build"},j={name:e,version:s,description:t,type:o,main:r,module:i,types:d,exports:l,files:a,keywords:c,repository:n,author:u,license:m,browserslist:p,dependencies:b,devDependencies:y,scripts:v};exports.author=u;exports.browserslist=p;exports.default=j;exports.dependencies=b;exports.description=t;exports.devDependencies=y;exports.exports=l;exports.files=a;exports.keywords=c;exports.license=m;exports.main=r;exports.module=i;exports.name=e;exports.repository=n;exports.scripts=v;exports.type=o;exports.types=d;exports.version=s;
|
package/build/dive.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ct=Object.defineProperty;var lt=(l,n,t)=>n in l?ct(l,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[n]=t;var c=(l,n,t)=>lt(l,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("three"),ae=require("three-spritetext"),b=require("./chunks/VisibilityLayerMask-BI7jPKdx.cjs"),C=require("./chunks/findInterface-BEdL2iUQ.cjs"),E=require("./chunks/ModuleRegistry-NyNtjHb2.cjs"),ke=require("./chunks/PerspectiveCamera-BByyG5R4.cjs"),Q=require("./chunks/FileTypes-BjZ0rrIV.cjs"),je=require("./chunks/index-DAwIH9xh.cjs"),Re={type:"change"},ce={type:"start"},ve={type:"end"},q=new s.Ray,Ve=new s.Plane,ht=Math.cos(70*s.MathUtils.DEG2RAD);class dt extends s.EventDispatcher{constructor(n,t){super(),this.object=n,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new s.Vector3,this.cursor=new s.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},this.touches={ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return h.phi},this.getAzimuthalAngle=function(){return h.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(i){i.addEventListener("keydown",re),this._domElementKeyEvents=i},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(Re),e.update(),r=o.NONE},this.update=function(){const i=new s.Vector3,a=new s.Quaternion().setFromUnitVectors(n.up,new s.Vector3(0,1,0)),u=a.clone().invert(),p=new s.Vector3,y=new s.Quaternion,P=new s.Vector3,w=2*Math.PI;return function(at=null){const Ae=e.object.position;i.copy(Ae).sub(e.target),i.applyQuaternion(a),h.setFromVector3(i),e.autoRotate&&r===o.NONE&&G(Ye(at)),e.enableDamping?(h.theta+=m.theta*e.dampingFactor,h.phi+=m.phi*e.dampingFactor):(h.theta+=m.theta,h.phi+=m.phi);let S=e.minAzimuthAngle,O=e.maxAzimuthAngle;isFinite(S)&&isFinite(O)&&(S<-Math.PI?S+=w:S>Math.PI&&(S-=w),O<-Math.PI?O+=w:O>Math.PI&&(O-=w),S<=O?h.theta=Math.max(S,Math.min(O,h.theta)):h.theta=h.theta>(S+O)/2?Math.max(S,h.theta):Math.min(O,h.theta)),h.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,h.phi)),h.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(_,e.dampingFactor):e.target.add(_),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor);let Y=!1;if(e.zoomToCursor&&K||e.object.isOrthographicCamera)h.radius=ne(h.radius);else{const M=h.radius;h.radius=ne(h.radius*f),Y=M!=h.radius}if(i.setFromSpherical(h),i.applyQuaternion(u),Ae.copy(e.target).add(i),e.object.lookAt(e.target),e.enableDamping===!0?(m.theta*=1-e.dampingFactor,m.phi*=1-e.dampingFactor,_.multiplyScalar(1-e.dampingFactor)):(m.set(0,0,0),_.set(0,0,0)),e.zoomToCursor&&K){let M=null;if(e.object.isPerspectiveCamera){const F=i.length();M=ne(F*f);const X=F-M;e.object.position.addScaledVector(ue,X),e.object.updateMatrixWorld(),Y=!!X}else if(e.object.isOrthographicCamera){const F=new s.Vector3(T.x,T.y,0);F.unproject(e.object);const X=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/f)),e.object.updateProjectionMatrix(),Y=X!==e.object.zoom;const Ie=new s.Vector3(T.x,T.y,0);Ie.unproject(e.object),e.object.position.sub(Ie).add(F),e.object.updateMatrixWorld(),M=i.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;M!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(M).add(e.object.position):(q.origin.copy(e.object.position),q.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(q.direction))<ht?n.lookAt(e.target):(Ve.setFromNormalAndCoplanarPoint(e.object.up,e.target),q.intersectPlane(Ve,e.target))))}else if(e.object.isOrthographicCamera){const M=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/f)),M!==e.object.zoom&&(e.object.updateProjectionMatrix(),Y=!0)}return f=1,K=!1,Y||p.distanceToSquared(e.object.position)>d||8*(1-y.dot(e.object.quaternion))>d||P.distanceToSquared(e.target)>d?(e.dispatchEvent(Re),p.copy(e.object.position),y.copy(e.object.quaternion),P.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",xe),e.domElement.removeEventListener("pointerdown",Oe),e.domElement.removeEventListener("pointercancel",N),e.domElement.removeEventListener("wheel",Me),e.domElement.removeEventListener("pointermove",oe),e.domElement.removeEventListener("pointerup",N),e.domElement.getRootNode().removeEventListener("keydown",Te,{capture:!0}),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",re),e._domElementKeyEvents=null)};const e=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=o.NONE;const d=1e-6,h=new s.Spherical,m=new s.Spherical;let f=1;const _=new s.Vector3,x=new s.Vector2,L=new s.Vector2,v=new s.Vector2,A=new s.Vector2,I=new s.Vector2,V=new s.Vector2,k=new s.Vector2,j=new s.Vector2,R=new s.Vector2,ue=new s.Vector3,T=new s.Vector2;let K=!1;const g=[],z={};let te=!1;function Ye(i){return i!==null?2*Math.PI/60*e.autoRotateSpeed*i:2*Math.PI/60/60*e.autoRotateSpeed}function W(i){const a=Math.abs(i*.01);return Math.pow(.95,e.zoomSpeed*a)}function G(i){m.theta-=i}function Z(i){m.phi-=i}const pe=function(){const i=new s.Vector3;return function(u,p){i.setFromMatrixColumn(p,0),i.multiplyScalar(-u),_.add(i)}}(),me=function(){const i=new s.Vector3;return function(u,p){e.screenSpacePanning===!0?i.setFromMatrixColumn(p,1):(i.setFromMatrixColumn(p,0),i.crossVectors(e.object.up,i)),i.multiplyScalar(u),_.add(i)}}(),B=function(){const i=new s.Vector3;return function(u,p){const y=e.domElement;if(e.object.isPerspectiveCamera){const P=e.object.position;i.copy(P).sub(e.target);let w=i.length();w*=Math.tan(e.object.fov/2*Math.PI/180),pe(2*u*w/y.clientHeight,e.object.matrix),me(2*p*w/y.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(pe(u*(e.object.right-e.object.left)/e.object.zoom/y.clientWidth,e.object.matrix),me(p*(e.object.top-e.object.bottom)/e.object.zoom/y.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function ie(i){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?f/=i:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function fe(i){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?f*=i:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function se(i,a){if(!e.zoomToCursor)return;K=!0;const u=e.domElement.getBoundingClientRect(),p=i-u.left,y=a-u.top,P=u.width,w=u.height;T.x=p/P*2-1,T.y=-(y/w)*2+1,ue.set(T.x,T.y,1).unproject(e.object).sub(e.object.position).normalize()}function ne(i){return Math.max(e.minDistance,Math.min(e.maxDistance,i))}function ge(i){x.set(i.clientX,i.clientY)}function Fe(i){se(i.clientX,i.clientX),k.set(i.clientX,i.clientY)}function _e(i){A.set(i.clientX,i.clientY)}function He(i){L.set(i.clientX,i.clientY),v.subVectors(L,x).multiplyScalar(e.rotateSpeed);const a=e.domElement;G(2*Math.PI*v.x/a.clientHeight),Z(2*Math.PI*v.y/a.clientHeight),x.copy(L),e.update()}function Ke(i){j.set(i.clientX,i.clientY),R.subVectors(j,k),R.y>0?ie(W(R.y)):R.y<0&&fe(W(R.y)),k.copy(j),e.update()}function We(i){I.set(i.clientX,i.clientY),V.subVectors(I,A).multiplyScalar(e.panSpeed),B(V.x,V.y),A.copy(I),e.update()}function Ze(i){se(i.clientX,i.clientY),i.deltaY<0?fe(W(i.deltaY)):i.deltaY>0&&ie(W(i.deltaY)),e.update()}function Xe(i){let a=!1;switch(i.code){case e.keys.UP:i.ctrlKey||i.metaKey||i.shiftKey?Z(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):B(0,e.keyPanSpeed),a=!0;break;case e.keys.BOTTOM:i.ctrlKey||i.metaKey||i.shiftKey?Z(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):B(0,-e.keyPanSpeed),a=!0;break;case e.keys.LEFT:i.ctrlKey||i.metaKey||i.shiftKey?G(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):B(e.keyPanSpeed,0),a=!0;break;case e.keys.RIGHT:i.ctrlKey||i.metaKey||i.shiftKey?G(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):B(-e.keyPanSpeed,0),a=!0;break}a&&(i.preventDefault(),e.update())}function be(i){if(g.length===1)x.set(i.pageX,i.pageY);else{const a=U(i),u=.5*(i.pageX+a.x),p=.5*(i.pageY+a.y);x.set(u,p)}}function ye(i){if(g.length===1)A.set(i.pageX,i.pageY);else{const a=U(i),u=.5*(i.pageX+a.x),p=.5*(i.pageY+a.y);A.set(u,p)}}function Ee(i){const a=U(i),u=i.pageX-a.x,p=i.pageY-a.y,y=Math.sqrt(u*u+p*p);k.set(0,y)}function qe(i){e.enableZoom&&Ee(i),e.enablePan&&ye(i)}function Je(i){e.enableZoom&&Ee(i),e.enableRotate&&be(i)}function we(i){if(g.length==1)L.set(i.pageX,i.pageY);else{const u=U(i),p=.5*(i.pageX+u.x),y=.5*(i.pageY+u.y);L.set(p,y)}v.subVectors(L,x).multiplyScalar(e.rotateSpeed);const a=e.domElement;G(2*Math.PI*v.x/a.clientHeight),Z(2*Math.PI*v.y/a.clientHeight),x.copy(L)}function De(i){if(g.length===1)I.set(i.pageX,i.pageY);else{const a=U(i),u=.5*(i.pageX+a.x),p=.5*(i.pageY+a.y);I.set(u,p)}V.subVectors(I,A).multiplyScalar(e.panSpeed),B(V.x,V.y),A.copy(I)}function Se(i){const a=U(i),u=i.pageX-a.x,p=i.pageY-a.y,y=Math.sqrt(u*u+p*p);j.set(0,y),R.set(0,Math.pow(j.y/k.y,e.zoomSpeed)),ie(R.y),k.copy(j);const P=(i.pageX+a.x)*.5,w=(i.pageY+a.y)*.5;se(P,w)}function $e(i){e.enableZoom&&Se(i),e.enablePan&&De(i)}function Qe(i){e.enableZoom&&Se(i),e.enableRotate&&we(i)}function Oe(i){e.enabled!==!1&&(g.length===0&&(e.domElement.setPointerCapture(i.pointerId),e.domElement.addEventListener("pointermove",oe),e.domElement.addEventListener("pointerup",N)),!rt(i)&&(nt(i),i.pointerType==="touch"?Ce(i):et(i)))}function oe(i){e.enabled!==!1&&(i.pointerType==="touch"?st(i):tt(i))}function N(i){switch(ot(i),g.length){case 0:e.domElement.releasePointerCapture(i.pointerId),e.domElement.removeEventListener("pointermove",oe),e.domElement.removeEventListener("pointerup",N),e.dispatchEvent(ve),r=o.NONE;break;case 1:const a=g[0],u=z[a];Ce({pointerId:a,pageX:u.x,pageY:u.y});break}}function et(i){let a;switch(i.button){case 0:a=e.mouseButtons.LEFT;break;case 1:a=e.mouseButtons.MIDDLE;break;case 2:a=e.mouseButtons.RIGHT;break;default:a=-1}switch(a){case s.MOUSE.DOLLY:if(e.enableZoom===!1)return;Fe(i),r=o.DOLLY;break;case s.MOUSE.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(e.enablePan===!1)return;_e(i),r=o.PAN}else{if(e.enableRotate===!1)return;ge(i),r=o.ROTATE}break;case s.MOUSE.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(e.enableRotate===!1)return;ge(i),r=o.ROTATE}else{if(e.enablePan===!1)return;_e(i),r=o.PAN}break;default:r=o.NONE}r!==o.NONE&&e.dispatchEvent(ce)}function tt(i){switch(r){case o.ROTATE:if(e.enableRotate===!1)return;He(i);break;case o.DOLLY:if(e.enableZoom===!1)return;Ke(i);break;case o.PAN:if(e.enablePan===!1)return;We(i);break}}function Me(i){e.enabled===!1||e.enableZoom===!1||r!==o.NONE||(i.preventDefault(),e.dispatchEvent(ce),Ze(it(i)),e.dispatchEvent(ve))}function it(i){const a=i.deltaMode,u={clientX:i.clientX,clientY:i.clientY,deltaY:i.deltaY};switch(a){case 1:u.deltaY*=16;break;case 2:u.deltaY*=100;break}return i.ctrlKey&&!te&&(u.deltaY*=10),u}function Te(i){i.key==="Control"&&(te=!0,e.domElement.getRootNode().addEventListener("keyup",Pe,{passive:!0,capture:!0}))}function Pe(i){i.key==="Control"&&(te=!1,e.domElement.getRootNode().removeEventListener("keyup",Pe,{passive:!0,capture:!0}))}function re(i){e.enabled===!1||e.enablePan===!1||Xe(i)}function Ce(i){switch(Le(i),g.length){case 1:switch(e.touches.ONE){case s.TOUCH.ROTATE:if(e.enableRotate===!1)return;be(i),r=o.TOUCH_ROTATE;break;case s.TOUCH.PAN:if(e.enablePan===!1)return;ye(i),r=o.TOUCH_PAN;break;default:r=o.NONE}break;case 2:switch(e.touches.TWO){case s.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;qe(i),r=o.TOUCH_DOLLY_PAN;break;case s.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Je(i),r=o.TOUCH_DOLLY_ROTATE;break;default:r=o.NONE}break;default:r=o.NONE}r!==o.NONE&&e.dispatchEvent(ce)}function st(i){switch(Le(i),r){case o.TOUCH_ROTATE:if(e.enableRotate===!1)return;we(i),e.update();break;case o.TOUCH_PAN:if(e.enablePan===!1)return;De(i),e.update();break;case o.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;$e(i),e.update();break;case o.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Qe(i),e.update();break;default:r=o.NONE}}function xe(i){e.enabled!==!1&&i.preventDefault()}function nt(i){g.push(i.pointerId)}function ot(i){delete z[i.pointerId];for(let a=0;a<g.length;a++)if(g[a]==i.pointerId){g.splice(a,1);return}}function rt(i){for(let a=0;a<g.length;a++)if(g[a]==i.pointerId)return!0;return!1}function Le(i){let a=z[i.pointerId];a===void 0&&(a=new s.Vector2,z[i.pointerId]=a),a.set(i.pageX,i.pageY)}function U(i){const a=i.pointerId===g[0]?g[1]:g[0];return z[a]}e.domElement.addEventListener("contextmenu",xe),e.domElement.addEventListener("pointerdown",Oe),e.domElement.addEventListener("pointercancel",N),e.domElement.addEventListener("wheel",Me,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",Te,{passive:!0,capture:!0}),this.update()}}const J={enableDamping:!0,dampingFactor:.05},H=class H extends dt{constructor(t,e,o=J){super(t,e);c(this,"uuid",s.MathUtils.generateUUID());c(this,"object");this.domElement=e,this.domElement=e,this.object=t,this.enableDamping=o.enableDamping??J.enableDamping,this.dampingFactor=o.dampingFactor??J.dampingFactor,this.object.position.set(0,2,2),this.target.copy({x:0,y:.5,z:0}),this.update()}tick(){this.enabled&&this.update()}computeEncompassingView(t){const e=t.getCenter(new s.Vector3),o=t.getSize(new s.Vector3),r=Math.max(o.x,o.y,o.z)*1.25;return{position:this.object.position.clone().normalize().clone().multiplyScalar(r),target:e.clone()}}zoomIn(t){const e=t||H.DEFAULT_ZOOM_FACTOR,{minDistance:o,maxDistance:r}=this;this.minDistance=this.maxDistance=s.MathUtils.clamp(this.getDistance()-e,o+e,r-e),this.update(),this.minDistance=o,this.maxDistance=r}zoomOut(t){const e=t||H.DEFAULT_ZOOM_FACTOR,{minDistance:o,maxDistance:r}=this;this.minDistance=this.maxDistance=s.MathUtils.clamp(this.getDistance()+e,o+e,r-e),this.update(),this.minDistance=o,this.maxDistance=r}};c(H,"DEFAULT_ZOOM_FACTOR",1);let $=H;class ut extends s.OrthographicCamera{constructor(t,e,o){super(-1,1,1,-1,.1,100);c(this,"axesHelper");c(this,"_renderer");c(this,"_scene");c(this,"_camera");c(this,"_restoreViewport",new s.Vector4);this.layers.mask=b.COORDINATE_LAYER_MASK,this.axesHelper=new s.AxesHelper(.5),this.axesHelper.layers.mask=b.COORDINATE_LAYER_MASK,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new s.Color(C.AxesColorRed),new s.Color(C.AxesColorGreen),new s.Color(C.AxesColorBlue));const r=new ae("X",.2,C.AxesColorRedLetter),d=new ae("Y",.2,C.AxesColorGreenLetter),h=new ae("Z",.2,C.AxesColorBlueLetter);r.layers.mask=b.COORDINATE_LAYER_MASK,d.layers.mask=b.COORDINATE_LAYER_MASK,h.layers.mask=b.COORDINATE_LAYER_MASK,r.position.set(.7,0,0),d.position.set(0,.7,0),h.position.set(0,0,.7),this.axesHelper.add(r),this.axesHelper.add(d),this.axesHelper.add(h),this.add(this.axesHelper),this._renderer=t,this._scene=e,this._camera=o,this._scene.add(this)}tick(){const t=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=t}Dispose(){this._scene.remove(this)}SetFromCameraMatrix(t){this.axesHelper.rotation.setFromRotationMatrix(new s.Matrix4().extractRotation(t).invert())}}class pt extends s.Object3D{constructor(){super();c(this,"isDIVELight",!0);c(this,"isDIVEAmbientLight",!0);c(this,"_light");this.name="DIVEAmbientLight",this._light=new s.AmbientLight(16777215,1),this._light.layers.mask=b.PRODUCT_LAYER_MASK,this.add(this._light)}SetColor(t){this._light.color=t}SetIntensity(t){this._light.intensity=t}SetEnabled(t){this._light.visible=t}}class mt extends s.Object3D{constructor(){super();c(this,"isDIVELight",!0);c(this,"isDIVEPointLight",!0);c(this,"isMovable",!0);c(this,"isSelectable",!0);c(this,"gizmo",null);c(this,"light");c(this,"mesh");this.name="DIVEPointLight",this.light=new s.PointLight(16777215,1),this.light.layers.mask=b.PRODUCT_LAYER_MASK,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const t=.1,e=new s.SphereGeometry(t,t*320,t*320),o=new s.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:s.FrontSide});this.mesh=new s.Mesh(e,o),this.mesh.layers.mask=b.UI_LAYER_MASK,this.add(this.mesh)}SetColor(t){this.light.color=t,this.mesh.material.color=t}SetIntensity(t){this.light.intensity=t,this.mesh.material.opacity=t>.8?.8:t*.8}SetEnabled(t){this.light.visible=t}onMove(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})})}onSelect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class ft extends s.Object3D{constructor(){super();c(this,"isDIVELight",!0);c(this,"isDIVESceneLight",!0);c(this,"_hemiLight");c(this,"_dirLight");this.name="DIVESceneLight",this._hemiLight=new s.HemisphereLight(16777215,16777215,2),this._hemiLight.layers.mask=b.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=b.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 t=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=t,this._dirLight.shadow.camera.top=t,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(t){this._hemiLight.color=t,this._dirLight.color=t}SetIntensity(t){this._hemiLight.intensity=t*2,this._dirLight.intensity=t*3}SetEnabled(t){this._hemiLight.visible=t,this._dirLight.visible=t}}const ee=l=>l.parent?ee(l.parent):l;class gt{constructor(){c(this,"isMovable",!0)}}class _t{constructor(){c(this,"isSelectable",!0)}}function Be(l,n){return n.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(l.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),l}class he extends Be(s.Object3D,[_t,gt]){constructor(){super();c(this,"isDIVENode",!0);c(this,"gizmo",null);c(this,"_positionWorldBuffer");c(this,"_boundingBox");this.layers.mask=b.PRODUCT_LAYER_MASK,this._positionWorldBuffer=new s.Vector3,this._boundingBox=new s.Box3}SetPosition(t){if(!this.parent){this.position.set(t.x,t.y,t.z);return}const e=new s.Vector3(t.x,t.y,t.z);this.position.copy(this.parent.worldToLocal(e)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(t){this.rotation.set(t.x,t.y,t.z)}SetScale(t){this.scale.set(t.x,t.y,t.z)}SetVisibility(t){this.visible=t}SetToWorldOrigin(){this.position.set(0,0,0),E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onMove(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onSelect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class bt extends he{constructor(){super(...arguments);c(this,"isDIVEModel",!0);c(this,"_mesh",null);c(this,"_material",null)}SetModel(t){this.clear(),this._boundingBox.makeEmpty(),t.traverse(e=>{e.castShadow=!0,e.receiveShadow=!0,e.layers.mask=this.layers.mask,this._boundingBox.expandByObject(e),!this._mesh&&"isMesh"in e&&(this._mesh=e,this._material?this._mesh.material=this._material:this._material=e.material)}),this.add(t)}SetMaterial(t){this._material||(this._material=new s.MeshStandardMaterial),t.vertexColors!==void 0&&(this._material.vertexColors=t.vertexColors),t.color!==void 0&&this._material.color.set(t.color),t.map!==void 0&&(this._material.map=t.map),t.normalMap!==void 0&&(this._material.normalMap=t.normalMap),t.roughness!==void 0&&(this._material.roughness=t.roughness),t.roughnessMap!==void 0&&(this._material.roughnessMap=t.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),t.metalness!==void 0&&(this._material.metalness=t.metalness),t.metalnessMap!==void 0&&(this._material.metalnessMap=t.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){var r,d,h,m;const t=this.getWorldPosition(this._positionWorldBuffer),e=t.clone();(d=(r=this._mesh)==null?void 0:r.geometry)==null||d.computeBoundingBox();const o=(m=(h=this._mesh)==null?void 0:h.geometry)==null?void 0:m.boundingBox;!o||!this._mesh||(t.y=t.y-this._mesh.localToWorld(o.min.clone()).y,t.y!==e.y&&E.getModule("State").then(f=>{var _;(_=f.get(this.userData.id))==null||_.performAction("UPDATE_OBJECT",{id:this.userData.id,position:t,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 t=this._boundingBox.min.y*this.scale.y,e=this.localToWorld(this._boundingBox.getCenter(new s.Vector3).multiply(this.scale));e.y=t+this.position.y;const o=new s.Raycaster(e,new s.Vector3(0,-1,0));o.layers.mask=b.PRODUCT_LAYER_MASK;const r=o.intersectObjects(ee(this).Root.children,!0);if(r.length>0){const d=r[0].object;d.geometry.computeBoundingBox();const h=d.geometry.boundingBox,m=d.localToWorld(h.max.clone()),f=this.position.clone(),_=this.position.clone().setY(m.y).sub(new s.Vector3(0,t,0));if(this.position.copy(_),this.position.y===f.y)return;this.onMove()}}}class yt extends he{constructor(){super();c(this,"isDIVEPrimitive",!0);c(this,"_mesh");this._mesh=new s.Mesh,this._mesh.layers.mask=b.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new s.MeshStandardMaterial,this.add(this._mesh)}SetGeometry(t){const e=this.assembleGeometry(t);e&&(this._mesh.geometry=e,this._boundingBox.setFromObject(this._mesh))}SetMaterial(t){const e=this._mesh.material;t.vertexColors!==void 0&&(e.vertexColors=t.vertexColors),t.color!==void 0&&(e.color=new s.Color(t.color)),t.map!==void 0&&(e.map=t.map),t.normalMap!==void 0&&(e.normalMap=t.normalMap),t.roughness!==void 0&&(e.roughness=t.roughness),t.roughnessMap!==void 0&&(e.roughnessMap=t.roughnessMap,e.roughnessMap&&(e.roughness=1)),t.metalness!==void 0&&(e.metalness=t.metalness),t.metalnessMap!==void 0&&(e.metalnessMap=t.metalnessMap,e.metalnessMap&&(e.metalness=0)),this._mesh&&(this._mesh.material=e)}PlaceOnFloor(){var r,d,h,m;const t=this.getWorldPosition(this._positionWorldBuffer),e=t.clone();(d=(r=this._mesh)==null?void 0:r.geometry)==null||d.computeBoundingBox();const o=(m=(h=this._mesh)==null?void 0:h.geometry)==null?void 0:m.boundingBox;!o||!this._mesh||(t.y=t.y-this._mesh.localToWorld(o.min.clone()).y,t.y!==e.y&&E.getModule("State").then(f=>{var _;(_=f.get(this.userData.id))==null||_.performAction("UPDATE_OBJECT",{id:this.userData.id,position:t,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 t=this._boundingBox.min.y*this.scale.y,e=this.localToWorld(this._boundingBox.getCenter(new s.Vector3).multiply(this.scale));e.y=t+this.position.y;const o=new s.Raycaster(e,new s.Vector3(0,-1,0));o.layers.mask=b.PRODUCT_LAYER_MASK;const r=o.intersectObjects(ee(this).Root.children,!0);if(r.length>0){const d=r[0].object;d.geometry.computeBoundingBox();const h=d.geometry.boundingBox,m=d.localToWorld(h.max.clone()),f=this.position.clone(),_=this.position.clone().setY(m.y).sub(new s.Vector3(0,t,0));if(this.position.copy(_),this.position.y===f.y)return;this.onMove()}}assembleGeometry(t){switch(this._mesh.material.flatShading=!1,t.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(t);case"sphere":return this.createSphereGeometry(t);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(t);case"cube":case"box":return this.createBoxGeometry(t);case"cone":return this.createConeGeometry(t);case"wall":return this.createWallGeometry(t);case"plane":return this.createPlaneGeometry(t);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",t.name.toLowerCase()),null}}createCylinderGeometry(t){const e=new s.CylinderGeometry(t.width/2,t.width/2,t.height,64);return e.translate(0,t.height/2,0),e}createSphereGeometry(t){return new s.SphereGeometry(t.width/2,256,256)}createPyramidGeometry(t){const e=new Float32Array([-t.width/2,0,-t.depth/2,t.width/2,0,-t.depth/2,t.width/2,0,t.depth/2,-t.width/2,0,t.depth/2,0,t.height,0]),o=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),r=new s.BufferGeometry;return r.setAttribute("position",new s.BufferAttribute(e,3)),r.setIndex(new s.BufferAttribute(o,1)),r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}createBoxGeometry(t){const e=new s.BoxGeometry(t.width,t.height,t.depth);return e.translate(0,t.height/2,0),e}createConeGeometry(t){const e=new s.ConeGeometry(t.width/2,t.height,256);return e.translate(0,t.height/2,0),e}createWallGeometry(t){const e=new s.BoxGeometry(t.width,t.height,t.depth||.05,16);return e.translate(0,t.height/2,0),e}createPlaneGeometry(t){const e=new s.BoxGeometry(t.width,t.height,t.depth);return e.translate(0,t.height/2,0),e}}class Et extends he{constructor(){super();c(this,"isDIVEGroup",!0);c(this,"_members");c(this,"_lines");this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}SetPosition(t){super.SetPosition(t),this._members.forEach(e=>{"isDIVENode"in e&&e.onMove()})}SetLinesVisibility(t,e){if(!e){this._lines.forEach(r=>{r.visible=t});return}const o=this._members.indexOf(e);o!==-1&&(this._lines[o].visible=t)}attach(t){if(this._members.includes(t))return this;const e=this.createLine();return this.add(e),this._lines.push(e),super.attach(t),this._members.push(t),this.updateLineTo(e,t),this.SetLinesVisibility(!0,t),this}remove(t){const e=this._members.indexOf(t);if(e===-1)return this;const o=this._lines[e];return super.remove(o),this._lines.splice(e,1),super.remove(t),this._members.splice(e,1),this}UpdateLineTo(t){const e=this._members.indexOf(t);e!==-1&&this.updateLineTo(this._lines[e],t)}createLine(){const t=new s.BufferGeometry,e=new s.LineDashedMaterial({color:6710886,dashSize:.05,gapSize:.025}),o=new s.Line(t,e);return o.visible=!1,o}updateLineTo(t,e){const o=[new s.Vector3(0,0,0),e.position.clone()];t.geometry.setFromPoints(o),t.computeLineDistances()}}class wt extends s.Mesh{constructor(){super(new s.PlaneGeometry(1e4,1e4),new s.MeshStandardMaterial({color:new s.Color(150/255,150/255,150/255)}));c(this,"isDIVEFloor",!0);this.name="Floor",this.layers.mask=b.PRODUCT_LAYER_MASK,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}SetVisibility(t){this.visible=t}SetColor(t){this.material.color=new s.Color(t)}}class Dt extends s.Object3D{constructor(){super();c(this,"isDIVERoot",!0);c(this,"_floor");c(this,"_assetLoader",null);this.name="Root",this._floor=new wt,this.add(this._floor)}get floor(){return this._floor}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await E.getModule("AssetLoader"))),this._assetLoader}ComputeSceneBB(){const t=new s.Box3;return this.children.forEach(e=>{"isDIVEFloor"in e||e.traverse(o=>{"isObject3D"in o&&t.expandByObject(o)})}),t}GetSceneObject(t){let e;return this.traverse(o=>{e||o.userData.id===t.id&&(e=o)}),e}AddSceneObject(t){switch(t.entityType){case"pov":break;case"light":{this.updateLight(t);break}case"model":{this.updateModel(t);break}case"primitive":{this.updatePrimitive(t);break}case"group":{this.updateGroup(t);break}default:console.warn(`DIVERoot.AddSceneObject: Unknown entity type: ${t.entityType}`)}}UpdateSceneObject(t){switch(t.entityType){case"pov":break;case"light":{this.updateLight(t);break}case"model":{this.updateModel(t);break}case"primitive":{this.updatePrimitive(t);break}case"group":{this.updateGroup(t);break}default:console.warn(`DIVERoot.UpdateSceneObject: Unknown entity type: ${t.entityType}`)}}DeleteSceneObject(t){switch(t.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:console.warn(`DIVERoot.DeleteSceneObject: Unknown entity type: ${t.entityType}`)}}PlaceOnFloor(t){switch(t.entityType){case"pov":case"light":break;case"model":case"primitive":{this.placeOnFloor(t);break}default:console.warn(`DIVERoot.PlaceOnFloor: Unknown entity type: ${t.entityType}`)}}updateLight(t){let e=this.GetSceneObject(t);if(!e){switch(t.type){case"scene":{e=new ft;break}case"ambient":{e=new pt;break}case"point":{e=new mt;break}default:{console.warn(`DIVERoot.updateLight: Unknown light type: ${t.type}`);return}}e.userData.id=t.id,this.add(e)}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(t){let e=this.GetSceneObject(t);e||(e=new bt,e.userData.id=t.id,e.userData.uri=t.uri,this.add(e)),t.uri!==void 0&&this._getAssetLoader().then(o=>o.load(t.uri)).then(o=>{e.SetModel(o),E.getModule("State").then(r=>{var d;(d=r.get(t.id))==null||d.performAction("MODEL_LOADED",{id:t.id})})}),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(t){let e=this.GetSceneObject(t);e||(e=new yt,e.userData.id=t.id,this.add(e)),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(t){let e=this.GetSceneObject(t);e||(e=new Et,e.userData.id=t.id,this.add(e)),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(t){const e=this.GetSceneObject(t);if(!e){console.warn(`DIVERoot.deleteLight: Light with id ${t.id} not found`);return}this.detachTransformControls(e),e.parent.remove(e)}deleteModel(t){const e=this.GetSceneObject(t);if(!e){console.warn(`DIVERoot.deleteModel: Model with id ${t.id} not found`);return}this.detachTransformControls(e),e.parent.remove(e)}deletePrimitive(t){const e=this.GetSceneObject(t);if(!e){console.warn(`DIVERoot.deletePrimitive: Primitive with id ${t.id} not found`);return}this.detachTransformControls(e),e.parent.remove(e)}deleteGroup(t){const e=this.GetSceneObject(t);if(!e){console.warn(`DIVERoot.deleteGroup: Group with id ${t.id} not found`);return}this.detachTransformControls(e);for(let o=e.members.length-1;o>=0;o--)this.attach(e.members[o]);e.parent.remove(e)}placeOnFloor(t){const e=this.GetSceneObject(t);e&&e.PlaceOnFloor()}setParent(t){const e=this.GetSceneObject(t);if(t.parentId!==null){const o=this.GetSceneObject({id:t.parentId});if(!o)return;o.attach(e)}else this.attach(e)}detachTransformControls(t){this.findScene(t).children.find(e=>{"isTransformControls"in e&&e.detach()})}findScene(t){return t.parent!==null?this.findScene(t.parent):t}}const St="#888888",Ot="#dddddd";class Mt extends s.Object3D{constructor(){super(),this.name="Grid";const n=new s.GridHelper(100,100,St,Ot);n.material.depthTest=!1,n.layers.mask=b.HELPER_LAYER_MASK,this.add(n)}SetVisibility(n){this.visible=n}}class Tt extends s.Scene{constructor(){super();c(this,"_root");c(this,"_grid");this.background=new s.Color(16777215),this._root=new Dt,this.add(this._root),this._grid=new Mt,this.add(this._grid)}get Root(){return this._root}get Grid(){return this._grid}SetBackground(t){this.background=new s.Color(t)}ComputeSceneBB(){return this.Root.ComputeSceneBB()}GetSceneObject(t){return this.Root.GetSceneObject(t)}AddSceneObject(t){this.Root.AddSceneObject(t)}UpdateSceneObject(t){this.Root.UpdateSceneObject(t)}DeleteSceneObject(t){this.Root.DeleteSceneObject(t)}PlaceOnFloor(t){this.Root.PlaceOnFloor(t)}}const Ue={canvas:void 0,antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp",stencil:!1,depth:!0,logarithmicDepthBuffer:!1};class Pt{constructor(n,t,e){c(this,"_webglrenderer");c(this,"_settings");this._scene=n,this._camera=t,this._settings={...Ue,...e??{}},this._webglrenderer=new s.WebGLRenderer({canvas:this._settings.canvas,antialias:this._settings.antialias,alpha:this._settings.alpha,powerPreference:this._settings.powerPreference,precision:this._settings.precision,stencil:this._settings.stencil,depth:this._settings.depth,logarithmicDepthBuffer:this._settings.logarithmicDepthBuffer})}get webglrenderer(){return this._webglrenderer}setCanvas(n){this._webglrenderer.dispose(),this._settings.canvas=n,this._webglrenderer=new s.WebGLRenderer(this._settings)}render(){this._webglrenderer.render(this._scene,this._camera)}onResize(n,t){this._webglrenderer.setSize(n,t,!1)}dispose(){this._webglrenderer.dispose()}}class Ct{constructor(){c(this,"_renderer",null);c(this,"_lastTime",0);c(this,"_isRunning",!1);c(this,"_tickers",[])}start(){this._isRunning||(this._isRunning=!0,this._lastTime=performance.now(),requestAnimationFrame(this._tick.bind(this)))}stop(){this._isRunning=!1}setRenderer(n){this._renderer=n}addTicker(n){this._tickers.find(t=>t.uuid===n.uuid)||this._tickers.push(n)}removeTicker(n){const t=this._tickers.findIndex(e=>e.uuid===n.uuid);t!==-1&&this._tickers.splice(t,1)}dispose(){this.stop(),this._tickers.forEach(n=>{var t;return(t=n.dispose)==null?void 0:t.call(n)}),this._tickers=[],this._isRunning=!1,this._lastTime=0}_tick(n){var e;if(!this._isRunning)return;const t=(n-this._lastTime)/1e3;this._lastTime=n,this._tickers.forEach(o=>o.tick(t)),(e=this._renderer)==null||e.render(),requestAnimationFrame(this._tick.bind(this))}}class xt{constructor(n,t){c(this,"_resizeObserver");c(this,"_width",0);c(this,"_height",0);this._resizeObserver=new ResizeObserver(e=>{for(const o of e){const{width:r,height:d}=o.contentRect;r===this._width&&d===this._height||(n.onResize(r,d),t.onResize(r,d),this._width=r,this._height=d)}}),this._observeCanvas(n.webglrenderer.domElement)}setCanvas(n){this._resizeObserver.disconnect(),this._observeCanvas(n)}dispose(){this._resizeObserver.disconnect()}_observeCanvas(n){if(n.parentElement)this._resizeObserver.observe(n.parentElement);else{const t=setInterval(()=>{n.parentElement&&(this._resizeObserver.observe(n.parentElement),clearInterval(t))},16)}}}const ze={autoStart:!0,displayAxes:!1,perspectiveCamera:ke.DIVEPerspectiveCameraDefaultSettings,renderer:Ue};class Lt{constructor(n){c(this,"_renderer");c(this,"_scene");c(this,"_camera");c(this,"_resizeManager");c(this,"_clock");c(this,"_settings");this._settings={...ze,...n??{}},this._scene=new Tt,this._camera=new ke.DIVEPerspectiveCamera(this._settings.perspectiveCamera),this._renderer=new Pt(this._scene,this._camera,this._settings.renderer),this._resizeManager=new xt(this._renderer,this._camera),this._clock=new Ct,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(n){this._renderer.setCanvas(n),this._resizeManager.setCanvas(n)}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}dispose(){this._clock.dispose(),this._resizeManager.dispose(),this._renderer.dispose()}}window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const Ge={...ze,orbitController:J};class de{constructor(n){c(this,"_settings");c(this,"_engine");c(this,"orbitController");c(this,"axisCamera");this._settings={...Ge,...n??{}},this._engine=new Lt(n),this.orbitController=new $(this._engine.camera,this._engine.renderer.webglrenderer.domElement,this._settings.orbitController),this._engine.clock.addTicker(this.orbitController),this._settings.displayAxes?(this.axisCamera=new ut(this._engine.renderer,this._engine.scene,this._engine.camera),this._engine.clock.addTicker(this.axisCamera)):this.axisCamera=null,Promise.resolve().then(()=>require("./chunks/package-BFpY3sIj.cjs")).then(t=>{console.log(`DIVE ${t.default.version} initialized successfully!`),console.log(`
|
|
1
|
+
"use strict";var ht=Object.defineProperty;var dt=(c,n,t)=>n in c?ht(c,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[n]=t;var l=(c,n,t)=>dt(c,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("three"),ae=require("three-spritetext"),y=require("./chunks/VisibilityLayerMask-BI7jPKdx.cjs"),P=require("./chunks/findInterface-BEdL2iUQ.cjs"),E=require("./chunks/ModuleRegistry-NyNtjHb2.cjs"),ke=require("./chunks/PerspectiveCamera-BByyG5R4.cjs"),Q=require("./chunks/FileTypes-BjZ0rrIV.cjs"),Be=require("./chunks/index-DAwIH9xh.cjs"),Re={type:"change"},le={type:"start"},ve={type:"end"},q=new s.Ray,Ve=new s.Plane,ut=Math.cos(70*s.MathUtils.DEG2RAD);class mt extends s.EventDispatcher{constructor(n,t){super(),this.object=n,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new s.Vector3,this.cursor=new s.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},this.touches={ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return h.phi},this.getAzimuthalAngle=function(){return h.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(i){i.addEventListener("keydown",re),this._domElementKeyEvents=i},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",re),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(Re),e.update(),r=o.NONE},this.update=function(){const i=new s.Vector3,a=new s.Quaternion().setFromUnitVectors(n.up,new s.Vector3(0,1,0)),u=a.clone().invert(),m=new s.Vector3,b=new s.Quaternion,x=new s.Vector3,w=2*Math.PI;return function(ct=null){const Oe=e.object.position;i.copy(Oe).sub(e.target),i.applyQuaternion(a),h.setFromVector3(i),e.autoRotate&&r===o.NONE&&N(He(ct)),e.enableDamping?(h.theta+=p.theta*e.dampingFactor,h.phi+=p.phi*e.dampingFactor):(h.theta+=p.theta,h.phi+=p.phi);let S=e.minAzimuthAngle,M=e.maxAzimuthAngle;isFinite(S)&&isFinite(M)&&(S<-Math.PI?S+=w:S>Math.PI&&(S-=w),M<-Math.PI?M+=w:M>Math.PI&&(M-=w),S<=M?h.theta=Math.max(S,Math.min(M,h.theta)):h.theta=h.theta>(S+M)/2?Math.max(S,h.theta):Math.min(M,h.theta)),h.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,h.phi)),h.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(_,e.dampingFactor):e.target.add(_),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor);let G=!1;if(e.zoomToCursor&&K||e.object.isOrthographicCamera)h.radius=ne(h.radius);else{const T=h.radius;h.radius=ne(h.radius*f),G=T!=h.radius}if(i.setFromSpherical(h),i.applyQuaternion(u),Oe.copy(e.target).add(i),e.object.lookAt(e.target),e.enableDamping===!0?(p.theta*=1-e.dampingFactor,p.phi*=1-e.dampingFactor,_.multiplyScalar(1-e.dampingFactor)):(p.set(0,0,0),_.set(0,0,0)),e.zoomToCursor&&K){let T=null;if(e.object.isPerspectiveCamera){const j=i.length();T=ne(j*f);const X=j-T;e.object.position.addScaledVector(ue,X),e.object.updateMatrixWorld(),G=!!X}else if(e.object.isOrthographicCamera){const j=new s.Vector3(L.x,L.y,0);j.unproject(e.object);const X=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/f)),e.object.updateProjectionMatrix(),G=X!==e.object.zoom;const Ae=new s.Vector3(L.x,L.y,0);Ae.unproject(e.object),e.object.position.sub(Ae).add(j),e.object.updateMatrixWorld(),T=i.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;T!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(T).add(e.object.position):(q.origin.copy(e.object.position),q.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(q.direction))<ut?n.lookAt(e.target):(Ve.setFromNormalAndCoplanarPoint(e.object.up,e.target),q.intersectPlane(Ve,e.target))))}else if(e.object.isOrthographicCamera){const T=e.object.zoom;e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/f)),T!==e.object.zoom&&(e.object.updateProjectionMatrix(),G=!0)}return f=1,K=!1,G||m.distanceToSquared(e.object.position)>d||8*(1-b.dot(e.object.quaternion))>d||x.distanceToSquared(e.target)>d?(e.dispatchEvent(Re),m.copy(e.object.position),b.copy(e.object.quaternion),x.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Ce),e.domElement.removeEventListener("pointerdown",Me),e.domElement.removeEventListener("pointercancel",F),e.domElement.removeEventListener("wheel",Te),e.domElement.removeEventListener("pointermove",oe),e.domElement.removeEventListener("pointerup",F),e.domElement.getRootNode().removeEventListener("keydown",Le,{capture:!0}),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",re),e._domElementKeyEvents=null)};const e=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=o.NONE;const d=1e-6,h=new s.Spherical,p=new s.Spherical;let f=1;const _=new s.Vector3,C=new s.Vector2,I=new s.Vector2,v=new s.Vector2,O=new s.Vector2,A=new s.Vector2,V=new s.Vector2,k=new s.Vector2,B=new s.Vector2,R=new s.Vector2,ue=new s.Vector3,L=new s.Vector2;let K=!1;const g=[],Y={};let te=!1;function He(i){return i!==null?2*Math.PI/60*e.autoRotateSpeed*i:2*Math.PI/60/60*e.autoRotateSpeed}function W(i){const a=Math.abs(i*.01);return Math.pow(.95,e.zoomSpeed*a)}function N(i){p.theta-=i}function Z(i){p.phi-=i}const me=function(){const i=new s.Vector3;return function(u,m){i.setFromMatrixColumn(m,0),i.multiplyScalar(-u),_.add(i)}}(),pe=function(){const i=new s.Vector3;return function(u,m){e.screenSpacePanning===!0?i.setFromMatrixColumn(m,1):(i.setFromMatrixColumn(m,0),i.crossVectors(e.object.up,i)),i.multiplyScalar(u),_.add(i)}}(),U=function(){const i=new s.Vector3;return function(u,m){const b=e.domElement;if(e.object.isPerspectiveCamera){const x=e.object.position;i.copy(x).sub(e.target);let w=i.length();w*=Math.tan(e.object.fov/2*Math.PI/180),me(2*u*w/b.clientHeight,e.object.matrix),pe(2*m*w/b.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(me(u*(e.object.right-e.object.left)/e.object.zoom/b.clientWidth,e.object.matrix),pe(m*(e.object.top-e.object.bottom)/e.object.zoom/b.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function ie(i){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?f/=i:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function fe(i){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?f*=i:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function se(i,a){if(!e.zoomToCursor)return;K=!0;const u=e.domElement.getBoundingClientRect(),m=i-u.left,b=a-u.top,x=u.width,w=u.height;L.x=m/x*2-1,L.y=-(b/w)*2+1,ue.set(L.x,L.y,1).unproject(e.object).sub(e.object.position).normalize()}function ne(i){return Math.max(e.minDistance,Math.min(e.maxDistance,i))}function ge(i){C.set(i.clientX,i.clientY)}function Ke(i){se(i.clientX,i.clientX),k.set(i.clientX,i.clientY)}function _e(i){O.set(i.clientX,i.clientY)}function We(i){I.set(i.clientX,i.clientY),v.subVectors(I,C).multiplyScalar(e.rotateSpeed);const a=e.domElement;N(2*Math.PI*v.x/a.clientHeight),Z(2*Math.PI*v.y/a.clientHeight),C.copy(I),e.update()}function Ze(i){B.set(i.clientX,i.clientY),R.subVectors(B,k),R.y>0?ie(W(R.y)):R.y<0&&fe(W(R.y)),k.copy(B),e.update()}function Xe(i){A.set(i.clientX,i.clientY),V.subVectors(A,O).multiplyScalar(e.panSpeed),U(V.x,V.y),O.copy(A),e.update()}function qe(i){se(i.clientX,i.clientY),i.deltaY<0?fe(W(i.deltaY)):i.deltaY>0&&ie(W(i.deltaY)),e.update()}function Je(i){let a=!1;switch(i.code){case e.keys.UP:i.ctrlKey||i.metaKey||i.shiftKey?Z(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):U(0,e.keyPanSpeed),a=!0;break;case e.keys.BOTTOM:i.ctrlKey||i.metaKey||i.shiftKey?Z(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):U(0,-e.keyPanSpeed),a=!0;break;case e.keys.LEFT:i.ctrlKey||i.metaKey||i.shiftKey?N(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):U(e.keyPanSpeed,0),a=!0;break;case e.keys.RIGHT:i.ctrlKey||i.metaKey||i.shiftKey?N(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):U(-e.keyPanSpeed,0),a=!0;break}a&&(i.preventDefault(),e.update())}function ye(i){if(g.length===1)C.set(i.pageX,i.pageY);else{const a=z(i),u=.5*(i.pageX+a.x),m=.5*(i.pageY+a.y);C.set(u,m)}}function be(i){if(g.length===1)O.set(i.pageX,i.pageY);else{const a=z(i),u=.5*(i.pageX+a.x),m=.5*(i.pageY+a.y);O.set(u,m)}}function Ee(i){const a=z(i),u=i.pageX-a.x,m=i.pageY-a.y,b=Math.sqrt(u*u+m*m);k.set(0,b)}function $e(i){e.enableZoom&&Ee(i),e.enablePan&&be(i)}function Qe(i){e.enableZoom&&Ee(i),e.enableRotate&&ye(i)}function we(i){if(g.length==1)I.set(i.pageX,i.pageY);else{const u=z(i),m=.5*(i.pageX+u.x),b=.5*(i.pageY+u.y);I.set(m,b)}v.subVectors(I,C).multiplyScalar(e.rotateSpeed);const a=e.domElement;N(2*Math.PI*v.x/a.clientHeight),Z(2*Math.PI*v.y/a.clientHeight),C.copy(I)}function De(i){if(g.length===1)A.set(i.pageX,i.pageY);else{const a=z(i),u=.5*(i.pageX+a.x),m=.5*(i.pageY+a.y);A.set(u,m)}V.subVectors(A,O).multiplyScalar(e.panSpeed),U(V.x,V.y),O.copy(A)}function Se(i){const a=z(i),u=i.pageX-a.x,m=i.pageY-a.y,b=Math.sqrt(u*u+m*m);B.set(0,b),R.set(0,Math.pow(B.y/k.y,e.zoomSpeed)),ie(R.y),k.copy(B);const x=(i.pageX+a.x)*.5,w=(i.pageY+a.y)*.5;se(x,w)}function et(i){e.enableZoom&&Se(i),e.enablePan&&De(i)}function tt(i){e.enableZoom&&Se(i),e.enableRotate&&we(i)}function Me(i){e.enabled!==!1&&(g.length===0&&(e.domElement.setPointerCapture(i.pointerId),e.domElement.addEventListener("pointermove",oe),e.domElement.addEventListener("pointerup",F)),!lt(i)&&(rt(i),i.pointerType==="touch"?Pe(i):it(i)))}function oe(i){e.enabled!==!1&&(i.pointerType==="touch"?ot(i):st(i))}function F(i){switch(at(i),g.length){case 0:e.domElement.releasePointerCapture(i.pointerId),e.domElement.removeEventListener("pointermove",oe),e.domElement.removeEventListener("pointerup",F),e.dispatchEvent(ve),r=o.NONE;break;case 1:const a=g[0],u=Y[a];Pe({pointerId:a,pageX:u.x,pageY:u.y});break}}function it(i){let a;switch(i.button){case 0:a=e.mouseButtons.LEFT;break;case 1:a=e.mouseButtons.MIDDLE;break;case 2:a=e.mouseButtons.RIGHT;break;default:a=-1}switch(a){case s.MOUSE.DOLLY:if(e.enableZoom===!1)return;Ke(i),r=o.DOLLY;break;case s.MOUSE.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(e.enablePan===!1)return;_e(i),r=o.PAN}else{if(e.enableRotate===!1)return;ge(i),r=o.ROTATE}break;case s.MOUSE.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(e.enableRotate===!1)return;ge(i),r=o.ROTATE}else{if(e.enablePan===!1)return;_e(i),r=o.PAN}break;default:r=o.NONE}r!==o.NONE&&e.dispatchEvent(le)}function st(i){switch(r){case o.ROTATE:if(e.enableRotate===!1)return;We(i);break;case o.DOLLY:if(e.enableZoom===!1)return;Ze(i);break;case o.PAN:if(e.enablePan===!1)return;Xe(i);break}}function Te(i){e.enabled===!1||e.enableZoom===!1||r!==o.NONE||(i.preventDefault(),e.dispatchEvent(le),qe(nt(i)),e.dispatchEvent(ve))}function nt(i){const a=i.deltaMode,u={clientX:i.clientX,clientY:i.clientY,deltaY:i.deltaY};switch(a){case 1:u.deltaY*=16;break;case 2:u.deltaY*=100;break}return i.ctrlKey&&!te&&(u.deltaY*=10),u}function Le(i){i.key==="Control"&&(te=!0,e.domElement.getRootNode().addEventListener("keyup",xe,{passive:!0,capture:!0}))}function xe(i){i.key==="Control"&&(te=!1,e.domElement.getRootNode().removeEventListener("keyup",xe,{passive:!0,capture:!0}))}function re(i){e.enabled===!1||e.enablePan===!1||Je(i)}function Pe(i){switch(Ie(i),g.length){case 1:switch(e.touches.ONE){case s.TOUCH.ROTATE:if(e.enableRotate===!1)return;ye(i),r=o.TOUCH_ROTATE;break;case s.TOUCH.PAN:if(e.enablePan===!1)return;be(i),r=o.TOUCH_PAN;break;default:r=o.NONE}break;case 2:switch(e.touches.TWO){case s.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;$e(i),r=o.TOUCH_DOLLY_PAN;break;case s.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Qe(i),r=o.TOUCH_DOLLY_ROTATE;break;default:r=o.NONE}break;default:r=o.NONE}r!==o.NONE&&e.dispatchEvent(le)}function ot(i){switch(Ie(i),r){case o.TOUCH_ROTATE:if(e.enableRotate===!1)return;we(i),e.update();break;case o.TOUCH_PAN:if(e.enablePan===!1)return;De(i),e.update();break;case o.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;et(i),e.update();break;case o.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;tt(i),e.update();break;default:r=o.NONE}}function Ce(i){e.enabled!==!1&&i.preventDefault()}function rt(i){g.push(i.pointerId)}function at(i){delete Y[i.pointerId];for(let a=0;a<g.length;a++)if(g[a]==i.pointerId){g.splice(a,1);return}}function lt(i){for(let a=0;a<g.length;a++)if(g[a]==i.pointerId)return!0;return!1}function Ie(i){let a=Y[i.pointerId];a===void 0&&(a=new s.Vector2,Y[i.pointerId]=a),a.set(i.pageX,i.pageY)}function z(i){const a=i.pointerId===g[0]?g[1]:g[0];return Y[a]}e.domElement.addEventListener("contextmenu",Ce),e.domElement.addEventListener("pointerdown",Me),e.domElement.addEventListener("pointercancel",F),e.domElement.addEventListener("wheel",Te,{passive:!1}),e.domElement.getRootNode().addEventListener("keydown",Le,{passive:!0,capture:!0}),this.update()}}const J={enableDamping:!0,dampingFactor:.05},H=class H extends mt{constructor(t,e,o=J){super(t,e);l(this,"uuid",s.MathUtils.generateUUID());l(this,"object");this.domElement=e,this.domElement=e,this.object=t,this.enableDamping=o.enableDamping??J.enableDamping,this.dampingFactor=o.dampingFactor??J.dampingFactor,this.object.position.set(0,2,2),this.target.copy({x:0,y:.5,z:0}),this.update()}tick(){this.enabled&&this.update()}computeEncompassingView(t){const e=t.getCenter(new s.Vector3),o=t.getSize(new s.Vector3),r=Math.max(o.x,o.y,o.z)*1.25;return{position:this.object.position.clone().normalize().clone().multiplyScalar(r),target:e.clone()}}zoomIn(t){const e=t||H.DEFAULT_ZOOM_FACTOR,{minDistance:o,maxDistance:r}=this;this.minDistance=this.maxDistance=s.MathUtils.clamp(this.getDistance()-e,o+e,r-e),this.update(),this.minDistance=o,this.maxDistance=r}zoomOut(t){const e=t||H.DEFAULT_ZOOM_FACTOR,{minDistance:o,maxDistance:r}=this;this.minDistance=this.maxDistance=s.MathUtils.clamp(this.getDistance()+e,o+e,r-e),this.update(),this.minDistance=o,this.maxDistance=r}};l(H,"DEFAULT_ZOOM_FACTOR",1);let $=H;class pt extends s.OrthographicCamera{constructor(t,e,o){super(-1,1,1,-1,.1,100);l(this,"axesHelper");l(this,"_renderer");l(this,"_scene");l(this,"_camera");l(this,"_restoreViewport",new s.Vector4);this.layers.mask=y.COORDINATE_LAYER_MASK,this.axesHelper=new s.AxesHelper(.5),this.axesHelper.layers.mask=y.COORDINATE_LAYER_MASK,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new s.Color(P.AxesColorRed),new s.Color(P.AxesColorGreen),new s.Color(P.AxesColorBlue));const r=new ae("X",.2,P.AxesColorRedLetter),d=new ae("Y",.2,P.AxesColorGreenLetter),h=new ae("Z",.2,P.AxesColorBlueLetter);r.layers.mask=y.COORDINATE_LAYER_MASK,d.layers.mask=y.COORDINATE_LAYER_MASK,h.layers.mask=y.COORDINATE_LAYER_MASK,r.position.set(.7,0,0),d.position.set(0,.7,0),h.position.set(0,0,.7),this.axesHelper.add(r),this.axesHelper.add(d),this.axesHelper.add(h),this.add(this.axesHelper),this._renderer=t,this._scene=e,this._camera=o,this._scene.add(this)}tick(){const t=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=t}Dispose(){this._scene.remove(this)}SetFromCameraMatrix(t){this.axesHelper.rotation.setFromRotationMatrix(new s.Matrix4().extractRotation(t).invert())}}class ft extends s.Object3D{constructor(){super();l(this,"isDIVELight",!0);l(this,"isDIVEAmbientLight",!0);l(this,"_light");this.name="DIVEAmbientLight",this._light=new s.AmbientLight(16777215,1),this._light.layers.mask=y.PRODUCT_LAYER_MASK,this.add(this._light)}setColor(t){this._light.color=t}setIntensity(t){this._light.intensity=t}setEnabled(t){this._light.visible=t}}class gt extends s.Object3D{constructor(){super();l(this,"isDIVELight",!0);l(this,"isDIVEPointLight",!0);l(this,"isMovable",!0);l(this,"isSelectable",!0);l(this,"gizmo",null);l(this,"light");l(this,"mesh");this.name="DIVEPointLight",this.light=new s.PointLight(16777215,1),this.light.layers.mask=y.PRODUCT_LAYER_MASK,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const t=.1,e=new s.SphereGeometry(t,t*320,t*320),o=new s.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:s.FrontSide});this.mesh=new s.Mesh(e,o),this.mesh.layers.mask=y.UI_LAYER_MASK,this.add(this.mesh)}setColor(t){this.light.color=t,this.mesh.material.color=t}setIntensity(t){this.light.intensity=t,this.mesh.material.opacity=t>.8?.8:t*.8}setEnabled(t){this.light.visible=t}onMove(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})})}onSelect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class Ue extends s.Object3D{constructor(){super();l(this,"isDIVELight",!0);l(this,"isDIVESceneLight",!0);l(this,"_hemiLight");l(this,"_dirLight");this.name="DIVESceneLight",this._hemiLight=new s.HemisphereLight(16777215,16777215,2),this._hemiLight.layers.mask=y.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=y.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 t=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=t,this._dirLight.shadow.camera.top=t,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}setColor(t){this._hemiLight.color=t,this._dirLight.color=t}setIntensity(t){this._hemiLight.intensity=t*2,this._dirLight.intensity=t*3}setEnabled(t){this._hemiLight.visible=t,this._dirLight.visible=t}}const ee=c=>c.parent?ee(c.parent):c;class _t{constructor(){l(this,"isMovable",!0)}}class yt{constructor(){l(this,"isSelectable",!0)}}function ze(c,n){return n.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(e=>{Object.defineProperty(c.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e))})}),c}class he extends ze(s.Object3D,[yt,_t]){constructor(){super();l(this,"isDIVENode",!0);l(this,"gizmo",null);l(this,"_positionWorldBuffer");l(this,"_boundingBox");this.layers.mask=y.PRODUCT_LAYER_MASK,this._positionWorldBuffer=new s.Vector3,this._boundingBox=new s.Box3}SetPosition(t){if(!this.parent){this.position.set(t.x,t.y,t.z);return}const e=new s.Vector3(t.x,t.y,t.z);this.position.copy(this.parent.worldToLocal(e)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(t){this.rotation.set(t.x,t.y,t.z)}SetScale(t){this.scale.set(t.x,t.y,t.z)}setVisibility(t){this.visible=t}SetToWorldOrigin(){this.position.set(0,0,0),E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onMove(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onSelect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){E.getModule("State").then(t=>{var e;(e=t.get(this.userData.id))==null||e.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class Ye extends he{constructor(){super(...arguments);l(this,"isDIVEModel",!0);l(this,"_mesh",null);l(this,"_material",null);l(this,"_assetLoader",null)}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await E.getModule("AssetLoader"))),this._assetLoader}async setFromURL(t){const o=await(await this._getAssetLoader()).load(t);this.setFromGLTF(o),E.getModule("State").then(r=>{var d;(d=r.get(this.userData.id))==null||d.performAction("MODEL_LOADED",{id:this.userData.id})})}setFromGLTF(t){this.clear(),this._boundingBox.makeEmpty(),t.traverse(e=>{e.castShadow=!0,e.receiveShadow=!0,e.layers.mask=this.layers.mask,this._boundingBox.expandByObject(e),!this._mesh&&"isMesh"in e&&(this._mesh=e,this._material?this._mesh.material=this._material:this._material=e.material)}),this.add(t)}setMaterial(t){this._material||(this._material=new s.MeshStandardMaterial),t.vertexColors!==void 0&&(this._material.vertexColors=t.vertexColors),t.color!==void 0&&this._material.color.set(t.color),t.map!==void 0&&(this._material.map=t.map),t.normalMap!==void 0&&(this._material.normalMap=t.normalMap),t.roughness!==void 0&&(this._material.roughness=t.roughness),t.roughnessMap!==void 0&&(this._material.roughnessMap=t.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),t.metalness!==void 0&&(this._material.metalness=t.metalness),t.metalnessMap!==void 0&&(this._material.metalnessMap=t.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}placeOnFloor(){var r,d,h,p;const t=this.getWorldPosition(this._positionWorldBuffer),e=t.clone();(d=(r=this._mesh)==null?void 0:r.geometry)==null||d.computeBoundingBox();const o=(p=(h=this._mesh)==null?void 0:h.geometry)==null?void 0:p.boundingBox;!o||!this._mesh||(t.y=t.y-this._mesh.localToWorld(o.min.clone()).y,t.y!==e.y&&E.getModule("State").then(f=>{var _;(_=f.get(this.userData.id))==null||_.performAction("UPDATE_OBJECT",{id:this.userData.id,position:t,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 t=this._boundingBox.min.y*this.scale.y,e=this.localToWorld(this._boundingBox.getCenter(new s.Vector3).multiply(this.scale));e.y=t+this.position.y;const o=new s.Raycaster(e,new s.Vector3(0,-1,0));o.layers.mask=y.PRODUCT_LAYER_MASK;const r=o.intersectObjects(ee(this).root.children,!0);if(r.length>0){const d=r[0].object;d.geometry.computeBoundingBox();const h=d.geometry.boundingBox,p=d.localToWorld(h.max.clone()),f=this.position.clone(),_=this.position.clone().setY(p.y).sub(new s.Vector3(0,t,0));if(this.position.copy(_),this.position.y===f.y)return;this.onMove()}}}class bt extends he{constructor(){super();l(this,"isDIVEPrimitive",!0);l(this,"_mesh");this._mesh=new s.Mesh,this._mesh.layers.mask=y.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new s.MeshStandardMaterial,this.add(this._mesh)}SetGeometry(t){const e=this.assembleGeometry(t);e&&(this._mesh.geometry=e,this._boundingBox.setFromObject(this._mesh))}setMaterial(t){const e=this._mesh.material;t.vertexColors!==void 0&&(e.vertexColors=t.vertexColors),t.color!==void 0&&(e.color=new s.Color(t.color)),t.map!==void 0&&(e.map=t.map),t.normalMap!==void 0&&(e.normalMap=t.normalMap),t.roughness!==void 0&&(e.roughness=t.roughness),t.roughnessMap!==void 0&&(e.roughnessMap=t.roughnessMap,e.roughnessMap&&(e.roughness=1)),t.metalness!==void 0&&(e.metalness=t.metalness),t.metalnessMap!==void 0&&(e.metalnessMap=t.metalnessMap,e.metalnessMap&&(e.metalness=0)),this._mesh&&(this._mesh.material=e)}placeOnFloor(){var r,d,h,p;const t=this.getWorldPosition(this._positionWorldBuffer),e=t.clone();(d=(r=this._mesh)==null?void 0:r.geometry)==null||d.computeBoundingBox();const o=(p=(h=this._mesh)==null?void 0:h.geometry)==null?void 0:p.boundingBox;!o||!this._mesh||(t.y=t.y-this._mesh.localToWorld(o.min.clone()).y,t.y!==e.y&&E.getModule("State").then(f=>{var _;(_=f.get(this.userData.id))==null||_.performAction("UPDATE_OBJECT",{id:this.userData.id,position:t,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 t=this._boundingBox.min.y*this.scale.y,e=this.localToWorld(this._boundingBox.getCenter(new s.Vector3).multiply(this.scale));e.y=t+this.position.y;const o=new s.Raycaster(e,new s.Vector3(0,-1,0));o.layers.mask=y.PRODUCT_LAYER_MASK;const r=o.intersectObjects(ee(this).root.children,!0);if(r.length>0){const d=r[0].object;d.geometry.computeBoundingBox();const h=d.geometry.boundingBox,p=d.localToWorld(h.max.clone()),f=this.position.clone(),_=this.position.clone().setY(p.y).sub(new s.Vector3(0,t,0));if(this.position.copy(_),this.position.y===f.y)return;this.onMove()}}assembleGeometry(t){switch(this._mesh.material.flatShading=!1,t.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(t);case"sphere":return this.createSphereGeometry(t);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(t);case"cube":case"box":return this.createBoxGeometry(t);case"cone":return this.createConeGeometry(t);case"wall":return this.createWallGeometry(t);case"plane":return this.createPlaneGeometry(t);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",t.name.toLowerCase()),null}}createCylinderGeometry(t){const e=new s.CylinderGeometry(t.width/2,t.width/2,t.height,64);return e.translate(0,t.height/2,0),e}createSphereGeometry(t){return new s.SphereGeometry(t.width/2,256,256)}createPyramidGeometry(t){const e=new Float32Array([-t.width/2,0,-t.depth/2,t.width/2,0,-t.depth/2,t.width/2,0,t.depth/2,-t.width/2,0,t.depth/2,0,t.height,0]),o=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),r=new s.BufferGeometry;return r.setAttribute("position",new s.BufferAttribute(e,3)),r.setIndex(new s.BufferAttribute(o,1)),r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}createBoxGeometry(t){const e=new s.BoxGeometry(t.width,t.height,t.depth);return e.translate(0,t.height/2,0),e}createConeGeometry(t){const e=new s.ConeGeometry(t.width/2,t.height,256);return e.translate(0,t.height/2,0),e}createWallGeometry(t){const e=new s.BoxGeometry(t.width,t.height,t.depth||.05,16);return e.translate(0,t.height/2,0),e}createPlaneGeometry(t){const e=new s.BoxGeometry(t.width,t.height,t.depth);return e.translate(0,t.height/2,0),e}}class Et extends he{constructor(){super();l(this,"isDIVEGroup",!0);l(this,"_members");l(this,"_lines");this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}SetPosition(t){super.SetPosition(t),this._members.forEach(e=>{"isDIVENode"in e&&e.onMove()})}SetLinesVisibility(t,e){if(!e){this._lines.forEach(r=>{r.visible=t});return}const o=this._members.indexOf(e);o!==-1&&(this._lines[o].visible=t)}attach(t){if(this._members.includes(t))return this;const e=this.createLine();return this.add(e),this._lines.push(e),super.attach(t),this._members.push(t),this.updateLineTo(e,t),this.SetLinesVisibility(!0,t),this}remove(t){const e=this._members.indexOf(t);if(e===-1)return this;const o=this._lines[e];return super.remove(o),this._lines.splice(e,1),super.remove(t),this._members.splice(e,1),this}UpdateLineTo(t){const e=this._members.indexOf(t);e!==-1&&this.updateLineTo(this._lines[e],t)}createLine(){const t=new s.BufferGeometry,e=new s.LineDashedMaterial({color:6710886,dashSize:.05,gapSize:.025}),o=new s.Line(t,e);return o.visible=!1,o}updateLineTo(t,e){const o=[new s.Vector3(0,0,0),e.position.clone()];t.geometry.setFromPoints(o),t.computeLineDistances()}}class wt extends s.Mesh{constructor(){super(new s.PlaneGeometry(1e4,1e4),new s.MeshStandardMaterial({color:new s.Color(150/255,150/255,150/255)}));l(this,"isDIVEFloor",!0);this.name="Floor",this.layers.mask=y.PRODUCT_LAYER_MASK,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}setVisibility(t){this.visible=t}setColor(t){this.material.color=new s.Color(t)}}class Dt extends s.Object3D{constructor(){super();l(this,"isDIVERoot",!0);l(this,"_floor");l(this,"_assetLoader",null);this.name="Root",this._floor=new wt,this.add(this._floor)}get floor(){return this._floor}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await E.getModule("AssetLoader"))),this._assetLoader}computeSceneBB(){const t=new s.Box3;return this.children.forEach(e=>{"isDIVEFloor"in e||e.traverse(o=>{"isObject3D"in o&&t.expandByObject(o)})}),t}getSceneObject(t){let e;return this.traverse(o=>{e||o.userData.id===t.id&&(e=o)}),e}addSceneObject(t){let e=this.getSceneObject(t);if(e)return console.warn(`DIVERoot.addSceneObject: Scene object with id ${t.id} already exists`),e;switch(t.entityType){case"pov":break;case"light":{switch(t.type){case"scene":{e=new Ue;break}case"ambient":{e=new ft;break}case"point":{e=new gt;break}default:throw new Error(`DIVERoot.addSceneObject: Unknown light type: ${t.type}`)}e.name=t.name,e.userData.id=t.id,this.add(e),this._updateLight(e,t);break}case"model":{e=new Ye,e.name=t.name,e.userData.id=t.id,e.userData.uri=t.uri,this.add(e),this._updateModel(e,t);break}case"primitive":{e=new bt,e.name=t.name,e.userData.id=t.id,this.add(e),this._updatePrimitive(e,t);break}case"group":{e=new Et,e.name=t.name,e.userData.id=t.id,this.add(e),this._updateGroup(e,t);break}default:throw new Error(`DIVERoot.addSceneObject: Unknown entity type: ${t.entityType}`)}return e}updateSceneObject(t){const e=this.getSceneObject(t);if(!e){console.warn(`DIVERoot.updateSceneObject: Scene object with id ${t.id} does not exist`);return}switch(t.entityType){case"pov":break;case"light":{this._updateLight(e,t);break}case"model":{this._updateModel(e,t);break}case"primitive":{this._updatePrimitive(e,t);break}case"group":{this._updateGroup(e,t);break}default:throw new Error(`DIVERoot.updateSceneObject: Unknown entity type: ${t.entityType}`)}}deleteSceneObject(t){const e=this.getSceneObject(t);if(!e){console.warn(`DIVERoot.deleteSceneObject: Object with id ${t.id} not found`);return}switch(t.entityType){case"pov":break;case"light":{this._deleteLight(e);break}case"model":{this._deleteModel(e);break}case"primitive":{this._deletePrimitive(e);break}case"group":{this._deleteGroup(e);break}default:throw new Error(`DIVERoot.deleteSceneObject: Unknown entity type: ${t.entityType}`)}}_updateLight(t,e){e.name!==void 0&&e.name!==null&&(t.name=e.name),e.position!==void 0&&e.position!==null&&t.position.set(e.position.x,e.position.y,e.position.z),e.intensity!==void 0&&e.intensity!==null&&t.setIntensity(e.intensity),e.enabled!==void 0&&e.enabled!==null&&t.setEnabled(e.enabled),e.color!==void 0&&e.color!==null&&t.setColor(new s.Color(e.color)),e.visible!==void 0&&e.visible!==null&&(t.visible=e.visible),e.parentId!==void 0&&this._setParent({...e,parentId:e.parentId})}_updateModel(t,e){e.uri!==void 0&&t.setFromURL(e.uri),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.setVisibility(e.visible),e.material!==void 0&&t.setMaterial(e.material),e.parentId!==void 0&&this._setParent({...e,parentId:e.parentId})}_updatePrimitive(t,e){e.name!==void 0&&(t.name=e.name),e.geometry!==void 0&&t.SetGeometry(e.geometry),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.setVisibility(e.visible),e.material!==void 0&&t.setMaterial(e.material),e.parentId!==void 0&&this._setParent({...e,parentId:e.parentId})}_updateGroup(t,e){e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.setVisibility(e.visible),e.bbVisible!==void 0&&t.SetLinesVisibility(e.bbVisible),e.parentId!==void 0&&this._setParent({...e,parentId:e.parentId})}_deleteLight(t){this._detachTransformControls(t),t.parent.remove(t)}_deleteModel(t){this._detachTransformControls(t),t.parent.remove(t)}_deletePrimitive(t){this._detachTransformControls(t),t.parent.remove(t)}_deleteGroup(t){this._detachTransformControls(t);for(let e=t.members.length-1;e>=0;e--)this.attach(t.members[e]);t.parent.remove(t)}_setParent(t){const e=this.getSceneObject(t);if(t.parentId!==null){const o=this.getSceneObject({id:t.parentId,entityType:t.entityType});if(!o)return;o.attach(e)}else this.attach(e)}_detachTransformControls(t){this._findScene(t).children.find(e=>{"isTransformControls"in e&&e.detach()})}_findScene(t){return t.parent!==null?this._findScene(t.parent):t}}const St="#888888",Mt="#dddddd";class Tt extends s.Object3D{constructor(){super(),this.name="Grid";const n=new s.GridHelper(100,100,St,Mt);n.material.depthTest=!1,n.layers.mask=y.HELPER_LAYER_MASK,this.add(n)}setVisibility(n){this.visible=n}}class Lt extends s.Scene{constructor(){super();l(this,"_root");l(this,"_grid");this.background=new s.Color(16777215),this._root=new Dt,this.add(this._root),this._grid=new Tt,this.add(this._grid)}get root(){return this._root}get grid(){return this._grid}setBackground(t){this.background=new s.Color(t)}computeSceneBB(){return this.root.computeSceneBB()}}const Ne={canvas:void 0,antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp",stencil:!1,depth:!0,logarithmicDepthBuffer:!1};class xt{constructor(n,t,e){l(this,"_webglrenderer");l(this,"_settings");this._scene=n,this._camera=t,this._settings={...Ne,...e??{}},this._webglrenderer=new s.WebGLRenderer({canvas:this._settings.canvas,antialias:this._settings.antialias,alpha:this._settings.alpha,powerPreference:this._settings.powerPreference,precision:this._settings.precision,stencil:this._settings.stencil,depth:this._settings.depth,logarithmicDepthBuffer:this._settings.logarithmicDepthBuffer})}get webglrenderer(){return this._webglrenderer}setCanvas(n){this._webglrenderer.dispose(),this._settings.canvas=n,this._webglrenderer=new s.WebGLRenderer(this._settings)}render(){this._webglrenderer.render(this._scene,this._camera)}onResize(n,t){this._webglrenderer.setSize(n,t,!1)}dispose(){this._webglrenderer.dispose()}}class Pt{constructor(){l(this,"_renderer",null);l(this,"_lastTime",0);l(this,"_isRunning",!1);l(this,"_tickers",[])}start(){this._isRunning||(this._isRunning=!0,this._lastTime=performance.now(),requestAnimationFrame(this._tick.bind(this)))}stop(){this._isRunning=!1}setRenderer(n){this._renderer=n}addTicker(n){this._tickers.find(t=>t.uuid===n.uuid)||this._tickers.push(n)}removeTicker(n){const t=this._tickers.findIndex(e=>e.uuid===n.uuid);t!==-1&&this._tickers.splice(t,1)}dispose(){this.stop(),this._tickers.forEach(n=>{var t;return(t=n.dispose)==null?void 0:t.call(n)}),this._tickers=[],this._isRunning=!1,this._lastTime=0}_tick(n){var e;if(!this._isRunning)return;const t=(n-this._lastTime)/1e3;this._lastTime=n,this._tickers.forEach(o=>o.tick(t)),(e=this._renderer)==null||e.render(),requestAnimationFrame(this._tick.bind(this))}}class Ct{constructor(n,t){l(this,"_resizeObserver");l(this,"_width",0);l(this,"_height",0);this._resizeObserver=new ResizeObserver(e=>{for(const o of e){const{width:r,height:d}=o.contentRect;r===this._width&&d===this._height||(n.onResize(r,d),t.onResize(r,d),this._width=r,this._height=d)}}),this._observeCanvas(n.webglrenderer.domElement)}setCanvas(n){this._resizeObserver.disconnect(),this._observeCanvas(n)}dispose(){this._resizeObserver.disconnect()}_observeCanvas(n){if(n.parentElement)this._resizeObserver.observe(n.parentElement);else{const t=setInterval(()=>{n.parentElement&&(this._resizeObserver.observe(n.parentElement),clearInterval(t))},16)}}}const Fe={autoStart:!0,displayAxes:!1,...ke.DIVEPerspectiveCameraDefaultSettings,...Ne};class It{constructor(n){l(this,"_renderer");l(this,"_scene");l(this,"_camera");l(this,"_resizeManager");l(this,"_clock");l(this,"_settings");this._settings={...Fe,...n??{}},this._scene=new Lt,this._camera=new ke.DIVEPerspectiveCamera(this._settings),this._renderer=new xt(this._scene,this._camera,this._settings),this._resizeManager=new Ct(this._renderer,this._camera),this._clock=new Pt,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(n){this._renderer.setCanvas(n),this._resizeManager.setCanvas(n)}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}dispose(){this._clock.dispose(),this._resizeManager.dispose(),this._renderer.dispose()}}function D(c,n){const t=(c+"e").split("e");return+(t[0]+"e"+(+t[1]+(n||0)))}function Ot(c,n=0){const t=D(c,+n);return D(Math.ceil(t),-n)}function At(c,n=0){const t=D(c,+n);return D(Math.floor(t),-n)}function Ge(c,n=0){if(c<0)return-Ge(-c,n);const t=D(c,+n);return D(Math.round(t),-n)}function Rt(c,n,t){return Math.atan2(c.clone().cross(n).dot(t),n.clone().dot(c))}function vt(c,n=0){const t=D(c,+n);return D(Math.round(t),-n).toFixed(n)}function Vt(c,n=0){const t=D(c,+n);return D(Math.trunc(t),-n)}function kt(c){return(s.MathUtils.radToDeg(c)+360)%360}function Bt(c){return s.MathUtils.degToRad(c)}const Ut={ceilExp:Ot,floorExp:At,roundExp:Ge,toFixedExp:vt,truncateExp:Vt,signedAngleTo:Rt,radToDeg:kt,degToRad:Bt};window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const je={...Fe,...J};class de{constructor(n){l(this,"_settings");l(this,"_engine");l(this,"orbitController");l(this,"axisCamera");this._settings={...je,...n??{}},this._engine=new It(n),this.orbitController=new $(this._engine.camera,this._engine.renderer.webglrenderer.domElement,this._settings),this._engine.clock.addTicker(this.orbitController),this._settings.displayAxes?(this.axisCamera=new pt(this._engine.renderer,this._engine.scene,this._engine.camera),this._engine.clock.addTicker(this.axisCamera)):this.axisCamera=null,Promise.resolve().then(()=>require("./chunks/package-JHvTSNgQ.cjs")).then(t=>{console.log(`DIVE ${t.default.version} initialized successfully!`),console.log(`
|
|
2
2
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
3
3
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
4
4
|
@@%=::::.......::---------------------------------------------------------+@@
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
@@@@+:::::::#@@ @@*-------*@@@@
|
|
28
28
|
@@@@@@@ @@@@@@
|
|
29
29
|
|
|
30
|
-
`)})}static async QuickView(n,t){const e=new de(t);window.DIVE.instances.push(e)
|
|
30
|
+
`)})}static async QuickView(n,t){const e=new de(t);window.DIVE.instances.push(e),e.engine.scene.background=new s.Color(16777215),e.engine.scene.grid.setVisibility(!1),e.engine.scene.root.floor.setVisibility(!1),e.engine.scene.root.floor.setColor(16777215),e.engine.camera.position.set(0,2,2),e.orbitController.target.set(0,.5,0);const o=new Ue;o.name="SceneLight",o.userData.id=s.MathUtils.generateUUID(),o.setEnabled(!0),o.visible=!0,o.setIntensity((t==null?void 0:t.lightIntensity)??1),o.setColor(new s.Color(16777215)),e.engine.scene.root.add(o);const r=new Ye;r.name="object",r.userData.id=s.MathUtils.generateUUID(),r.userData.uri=n,r.visible=!0,e.engine.scene.root.add(r),await r.setFromURL(n);const d=e.engine.scene.computeSceneBB(),h=e.orbitController.computeEncompassingView(d);return e.engine.camera.position.copy(h.position),e.orbitController.target.copy(h.target),e}get engine(){return this._engine}get canvas(){return this._engine.renderer.webglrenderer.domElement}setCanvas(n){this._engine.setCanvas(n),this._engine.clock.removeTicker(this.orbitController),this.orbitController.dispose(),this.orbitController=new $(this._engine.camera,n,this._settings),this._engine.clock.addTicker(this.orbitController)}async Dispose(){return new Promise(n=>{this._engine.clock.removeTicker(this.orbitController),this.orbitController.dispose(),this.axisCamera&&(this._engine.clock.removeTicker(this.axisCamera),this.axisCamera.Dispose()),n()})}}const ce=(c,n)=>{if(Object.keys(c).length===0&&Object.keys(n).length===0)return{};if(typeof c!="object"||typeof n!="object")return n;let t={};return Object.keys(n).forEach(e=>{if(!Object.keys(c).includes(e)){t={...t,[e]:n[e]};return}if(Array.isArray(n[e])){if(!Array.isArray(c[e])){t={...t,[e]:n[e]};return}const o=c[e],r=n[e];if(o.length===0&&r.length===0){t={...t};return}if(o.length!==r.length){t={...t,[e]:n[e]};return}const d=[];if(r.forEach((h,p)=>{const f=ce(o[p],r[p]);Object.keys(f).length&&d.push(r[p])}),Object.keys(d).length){t={...t,[e]:d};return}return}if(typeof n[e]=="object"){if(typeof c[e]!="object"){t={...t,[e]:n[e]};return}const o=ce(c[e],n[e]);if(Object.keys(o).length){t={...t,[e]:o};return}}c[e]!==n[e]&&(t={...t,[e]:n[e]})}),t};exports.findInterface=P.findInterface;exports.implementsInterface=P.implementsInterface;exports.getModule=E.getModule;exports.FILE_TYPES=Q.FILE_TYPES;exports.SUPPORTED_FILE_TYPES=Q.SUPPORTED_FILE_TYPES;exports.getFileTypeFromUri=Q.getFileTypeFromUri;exports.isFileTypeSupported=Q.isFileTypeSupported;exports.ESystem=Be.ESystem;exports.EWebXRUnsupportedReason=Be.EWebXRUnsupportedReason;exports.DIVE=de;exports.DIVEDefaultSettings=je;exports.DIVEMath=Ut;exports.applyMixins=ze;exports.findSceneRecursive=ee;exports.getObjectDelta=ce;
|