diff --git a/examples/AngleMeasurement/index.html b/examples/AngleMeasurement/index.html index 2ce2ccfe5..e4def9f92 100644 --- a/examples/AngleMeasurement/index.html +++ b/examples/AngleMeasurement/index.html @@ -26,14 +26,14 @@ - + - - + + - + - +
diff --git a/examples/AreaMeasurement/index.html b/examples/AreaMeasurement/index.html index e8353f869..5feb9eab8 100644 --- a/examples/AreaMeasurement/index.html +++ b/examples/AreaMeasurement/index.html @@ -26,14 +26,14 @@ - + - - - + + + - - + + diff --git a/examples/BoundingBoxer/index.html b/examples/BoundingBoxer/index.html index b2b9fef10..6a013bd65 100644 --- a/examples/BoundingBoxer/index.html +++ b/examples/BoundingBoxer/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Civil3DNavigator/index.html b/examples/Civil3DNavigator/index.html index 6d88290d8..28676e357 100644 --- a/examples/Civil3DNavigator/index.html +++ b/examples/Civil3DNavigator/index.html @@ -25,14 +25,14 @@ - + - - + + - + diff --git a/examples/CivilCrossSectionNavigator/index.html b/examples/CivilCrossSectionNavigator/index.html index a41b56793..f8f6070dc 100644 --- a/examples/CivilCrossSectionNavigator/index.html +++ b/examples/CivilCrossSectionNavigator/index.html @@ -43,19 +43,19 @@ - + - - + + - + - - - - + + + + diff --git a/examples/CivilElevationNavigator/index.html b/examples/CivilElevationNavigator/index.html index 445021517..d77fe3c37 100644 --- a/examples/CivilElevationNavigator/index.html +++ b/examples/CivilElevationNavigator/index.html @@ -44,17 +44,17 @@ - + - - + + - + - - + + diff --git a/examples/CivilPlanNavigator/index.html b/examples/CivilPlanNavigator/index.html index 30615483d..17fd08a22 100644 --- a/examples/CivilPlanNavigator/index.html +++ b/examples/CivilPlanNavigator/index.html @@ -33,17 +33,17 @@ - + - - + + - + - - + + diff --git a/examples/Classifier/index.html b/examples/Classifier/index.html index ff54734a2..ab22e3da4 100644 --- a/examples/Classifier/index.html +++ b/examples/Classifier/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Clipper/index.html b/examples/Clipper/index.html index 96327cc7f..45000107e 100644 --- a/examples/Clipper/index.html +++ b/examples/Clipper/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Cullers/index.html b/examples/Cullers/index.html index 5abd9b4d9..5a016bc26 100644 --- a/examples/Cullers/index.html +++ b/examples/Cullers/index.html @@ -61,9 +61,9 @@ - + - + diff --git a/examples/EdgeMeasurement/index.html b/examples/EdgeMeasurement/index.html index 1e6f6a8d6..44c1783f1 100644 --- a/examples/EdgeMeasurement/index.html +++ b/examples/EdgeMeasurement/index.html @@ -28,15 +28,15 @@ - + - - - + + + - - - + + + diff --git a/examples/EdgesClipper/index.html b/examples/EdgesClipper/index.html index f0f564d17..e28c4d4c2 100644 --- a/examples/EdgesClipper/index.html +++ b/examples/EdgesClipper/index.html @@ -29,11 +29,11 @@ - + - - - + + + diff --git a/examples/Exploder/index.html b/examples/Exploder/index.html index a83a75bc3..8835c4139 100644 --- a/examples/Exploder/index.html +++ b/examples/Exploder/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/FaceMeasurement/index.html b/examples/FaceMeasurement/index.html index 5de193dc5..d9e07af6f 100644 --- a/examples/FaceMeasurement/index.html +++ b/examples/FaceMeasurement/index.html @@ -51,11 +51,11 @@ - + - - - + + + diff --git a/examples/FragmentsManager/index.html b/examples/FragmentsManager/index.html index 91dc04be0..67ecb9717 100644 --- a/examples/FragmentsManager/index.html +++ b/examples/FragmentsManager/index.html @@ -61,7 +61,7 @@ - + diff --git a/examples/Grids/index.html b/examples/Grids/index.html index 19e201d77..7e47fbc05 100644 --- a/examples/Grids/index.html +++ b/examples/Grids/index.html @@ -65,7 +65,7 @@ - + diff --git a/examples/Hider/index.html b/examples/Hider/index.html index 5a28d1b35..8685e591a 100644 --- a/examples/Hider/index.html +++ b/examples/Hider/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Highlighter/index.html b/examples/Highlighter/index.html index 40e7a6208..afb68a338 100644 --- a/examples/Highlighter/index.html +++ b/examples/Highlighter/index.html @@ -26,9 +26,9 @@ - + - + diff --git a/examples/IfcGeometryTiler/index.html b/examples/IfcGeometryTiler/index.html index a35f6fc51..60589d746 100644 --- a/examples/IfcGeometryTiler/index.html +++ b/examples/IfcGeometryTiler/index.html @@ -29,7 +29,7 @@ - + diff --git a/examples/IfcJsonExporter/index.html b/examples/IfcJsonExporter/index.html index 980dcd615..29e2b8579 100644 --- a/examples/IfcJsonExporter/index.html +++ b/examples/IfcJsonExporter/index.html @@ -29,10 +29,10 @@ - + - - + + diff --git a/examples/IfcLoader/index.html b/examples/IfcLoader/index.html index 733a74495..8c17dabcb 100644 --- a/examples/IfcLoader/index.html +++ b/examples/IfcLoader/index.html @@ -29,13 +29,13 @@ - - + + - - + + diff --git a/examples/IfcPropertiesTiler/index.html b/examples/IfcPropertiesTiler/index.html index 6197c5ce2..ff40dbe18 100644 --- a/examples/IfcPropertiesTiler/index.html +++ b/examples/IfcPropertiesTiler/index.html @@ -29,8 +29,8 @@ - - + + diff --git a/examples/IfcRelationsIndexer/index.html b/examples/IfcRelationsIndexer/index.html index 7fa0b4a7e..72209aa0a 100644 --- a/examples/IfcRelationsIndexer/index.html +++ b/examples/IfcRelationsIndexer/index.html @@ -27,13 +27,13 @@ - - + + - - + + diff --git a/examples/IfcStreamer/index.html b/examples/IfcStreamer/index.html index 59cc96c2d..864602150 100644 --- a/examples/IfcStreamer/index.html +++ b/examples/IfcStreamer/index.html @@ -27,7 +27,7 @@ - + diff --git a/examples/LengthMeasurement/index.html b/examples/LengthMeasurement/index.html index 1edd79c9b..458e12a77 100644 --- a/examples/LengthMeasurement/index.html +++ b/examples/LengthMeasurement/index.html @@ -28,16 +28,16 @@ - + - - - + + + - - - + + + diff --git a/examples/Marker/index.html b/examples/Marker/index.html index 9795966a9..1c9794aec 100644 --- a/examples/Marker/index.html +++ b/examples/Marker/index.html @@ -25,10 +25,10 @@ - - - - + + + + diff --git a/examples/MiniMap/index.html b/examples/MiniMap/index.html index d2983109c..2919c88e8 100644 --- a/examples/MiniMap/index.html +++ b/examples/MiniMap/index.html @@ -68,7 +68,7 @@ - + diff --git a/examples/OrthoPerspectiveCamera/index.html b/examples/OrthoPerspectiveCamera/index.html index 9fc57f6fa..92bd88eae 100644 --- a/examples/OrthoPerspectiveCamera/index.html +++ b/examples/OrthoPerspectiveCamera/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Plans/index.html b/examples/Plans/index.html index 56d6f7b45..733771160 100644 --- a/examples/Plans/index.html +++ b/examples/Plans/index.html @@ -28,13 +28,13 @@ - + - - - - + + + + diff --git a/examples/PostproductionRenderer/index.html b/examples/PostproductionRenderer/index.html index 73930a112..fa33f7284 100644 --- a/examples/PostproductionRenderer/index.html +++ b/examples/PostproductionRenderer/index.html @@ -62,10 +62,10 @@ - + - - + + diff --git a/examples/Raycasters/index.html b/examples/Raycasters/index.html index 65d1ee309..b4907b887 100644 --- a/examples/Raycasters/index.html +++ b/examples/Raycasters/index.html @@ -61,7 +61,7 @@ - + diff --git a/examples/ShadowDropper/index.html b/examples/ShadowDropper/index.html index cbad346a4..e994ff023 100644 --- a/examples/ShadowDropper/index.html +++ b/examples/ShadowDropper/index.html @@ -26,11 +26,11 @@ - + - + diff --git a/examples/Utils/index.html b/examples/Utils/index.html index 6dcce724d..bd2dae3dc 100644 --- a/examples/Utils/index.html +++ b/examples/Utils/index.html @@ -28,10 +28,10 @@ - + - - + + diff --git a/examples/VolumeMeasurement/index.html b/examples/VolumeMeasurement/index.html index 0d4a8cf75..38e4def81 100644 --- a/examples/VolumeMeasurement/index.html +++ b/examples/VolumeMeasurement/index.html @@ -51,13 +51,13 @@ - + - - - + + + - + diff --git a/examples/Worlds/index.html b/examples/Worlds/index.html index c18931ac7..982931c17 100644 --- a/examples/Worlds/index.html +++ b/examples/Worlds/index.html @@ -60,7 +60,7 @@ - + diff --git a/examples/assets/angleMeasurement.js b/examples/assets/angleMeasurement.js index 9e4b65927..d7b9729ce 100644 --- a/examples/assets/angleMeasurement.js +++ b/examples/assets/angleMeasurement.js @@ -1 +1 @@ -var k=Object.defineProperty;var M=(o,n,e)=>n in o?k(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var t=(o,n,e)=>(M(o,typeof n!="symbol"?n+"":n,e),e);import{V as m,h as b,B as E,b as A,M as v}from"./web-ifc-api-BC8YMRiS.js";import{S as P}from"./stats.min-GTpOrGrX.js";import{U as d,J as y,f as C,p as x,s as D,k as L,N as G}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as B}from"./index-CwA6v-S5.js";import{L as _,a as V,b as N}from"./Line2-7GsqoD5b.js";import{M as K}from"./mark-Cj_PmUva.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as U}from"./graphic-vertex-picker-CEs1V3AG.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";class S{constructor(n,e){t(this,"enabled",!0);t(this,"visible",!0);t(this,"points",[]);t(this,"world");t(this,"onDisposed",new d);t(this,"_lineMaterial",new _({color:6629591,linewidth:2}));t(this,"_lineGeometry",new V);t(this,"_line",new N(this._lineGeometry,this._lineMaterial));t(this,"_labelMarker");t(this,"onAngleComputed",new d);t(this,"onPointAdded",new d);this.world=n;const i=T();this._labelMarker=new K(n,i),this.labelMarker.visible=!0,this.onPointAdded.add(()=>{this.points.length===1&&n.scene.three.add(this._line),this.points.length===3&&(this.labelMarker.visible=!0)}),this.onAngleComputed.add(s=>{this.labelMarker.three.element.textContent=`${s.toFixed(2)}°`,this.labelMarker.three.position.copy(this.points[1]??new m)}),e==null||e.forEach(s=>this.setPoint(s))}set lineMaterial(n){this._lineMaterial.dispose(),this._lineMaterial=n,this._line.material=n,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set labelMarker(n){this._labelMarker.dispose(),this._labelMarker=n}get labelMarker(){return this._labelMarker}get angle(){return{points:this.points,angle:this.computeAngle()}}setPoint(n,e){let i;if(e?i=e:i=this.points.length===0?0:this.points.length,![0,1,2].includes(i))return;this.points[i]=n,this.onPointAdded.trigger(n);const s=this.points.map(a=>[a.x,a.y,a.z]);this._lineGeometry.setPositions(s.flat())}toggleLabel(){this.labelMarker.toggleVisibility()}computeAngle(){const n=this.points[0],e=this.points[1],i=this.points[2];if(!(n&&e&&i))return 0;const s=new m().subVectors(e,n),a=new m().subVectors(e,i),w=b.radToDeg(s.angleTo(a));return this.onAngleComputed.trigger(w),w}dispose(){this.points=[],this.labelMarker.dispose(),this.onAngleComputed.reset(),this.onPointAdded.reset(),this.labelMarker.dispose(),this._line.removeFromParent(),this._lineMaterial.dispose(),this._lineGeometry.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}}const h=class h extends y{constructor(e){super(e);t(this,"onDisposed",new d);t(this,"world");t(this,"list",[]);t(this,"_lineMaterial");t(this,"_enabled",!1);t(this,"_vertexPicker");t(this,"_currentAngleElement",null);t(this,"_clickCount",0);t(this,"create",()=>{if(!this.enabled)return;if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAngleElement){const i=new S(this.world);i.lineMaterial=this.lineMaterial,this._currentAngleElement=i}this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.setPoint(e,this._clickCount+1),this._currentAngleElement.setPoint(e,this._clickCount+2),this._currentAngleElement.computeAngle(),this._clickCount++,this._clickCount===3&&this.endCreation()}});t(this,"onMouseMove",()=>{if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAngleElement&&(this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.computeAngle())});t(this,"onKeyDown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAngleElement,e.key==="Escape"&&(this._clickCount===0&&!this._currentAngleElement?this.enabled=!1:this.cancelCreation()))});this.components.add(h.uuid,this),this._vertexPicker=new U(e),this._lineMaterial=new _({color:6629591,linewidth:2})}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set enabled(e){this._enabled=e,this.setupEvents(e),this._vertexPicker.enabled=e,e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._lineMaterial.dispose(),this._vertexPicker.dispose();for(const e of this.list)e.dispose();this._currentAngleElement&&this._currentAngleElement.dispose(),this.components=null,this.onDisposed.trigger(h.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAngleElement&&(this.list.push(this._currentAngleElement),this._currentAngleElement.computeAngle(),this._currentAngleElement=null),this._clickCount=0}cancelCreation(){this._currentAngleElement&&(this._currentAngleElement.dispose(),this._currentAngleElement=null),this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("No world selected for angle measurement!");if(!this.world.renderer)throw new Error("The given world doesn't have a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeyDown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeyDown))}};t(h,"uuid","622fb2c9-528c-4b0a-8a0e-6a1375f0a3aa");let g=h;const f=document.getElementById("container"),l=new C,z=l.get(x),r=z.create();r.scene=new D(l);r.renderer=new B(l,f);r.camera=new L(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const F=l.get(G);F.create(r);const H=new E(3,3,3),W=new A({color:"#6528D7"}),p=new v(H,W);p.position.set(0,1.5,0);r.scene.three.add(p);r.meshes.add(p);const u=l.get(g);u.world=r;u.enabled=!0;f.ondblclick=()=>u.create();window.onkeydown=o=>{(o.code==="Delete"||o.code==="Backspace")&&u.delete()};const c=new P;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); +var k=Object.defineProperty;var M=(o,n,e)=>n in o?k(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var t=(o,n,e)=>(M(o,typeof n!="symbol"?n+"":n,e),e);import{V as m,h as b,B as E,b as A,M as v}from"./web-ifc-api-BC8YMRiS.js";import{S as P}from"./stats.min-GTpOrGrX.js";import{D as d,J as y,f as C,p as x,s as D,k as L,N as G}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as B}from"./index-q_Y48tt2.js";import{L as _,a as V,b as N}from"./Line2-7GsqoD5b.js";import{M as K}from"./mark-Dwn_ERVH.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as S}from"./graphic-vertex-picker-BH9d5rBm.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";class U{constructor(n,e){t(this,"enabled",!0);t(this,"visible",!0);t(this,"points",[]);t(this,"world");t(this,"onDisposed",new d);t(this,"_lineMaterial",new _({color:6629591,linewidth:2}));t(this,"_lineGeometry",new V);t(this,"_line",new N(this._lineGeometry,this._lineMaterial));t(this,"_labelMarker");t(this,"onAngleComputed",new d);t(this,"onPointAdded",new d);this.world=n;const i=T();this._labelMarker=new K(n,i),this.labelMarker.visible=!0,this.onPointAdded.add(()=>{this.points.length===1&&n.scene.three.add(this._line),this.points.length===3&&(this.labelMarker.visible=!0)}),this.onAngleComputed.add(s=>{this.labelMarker.three.element.textContent=`${s.toFixed(2)}°`,this.labelMarker.three.position.copy(this.points[1]??new m)}),e==null||e.forEach(s=>this.setPoint(s))}set lineMaterial(n){this._lineMaterial.dispose(),this._lineMaterial=n,this._line.material=n,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set labelMarker(n){this._labelMarker.dispose(),this._labelMarker=n}get labelMarker(){return this._labelMarker}get angle(){return{points:this.points,angle:this.computeAngle()}}setPoint(n,e){let i;if(e?i=e:i=this.points.length===0?0:this.points.length,![0,1,2].includes(i))return;this.points[i]=n,this.onPointAdded.trigger(n);const s=this.points.map(a=>[a.x,a.y,a.z]);this._lineGeometry.setPositions(s.flat())}toggleLabel(){this.labelMarker.toggleVisibility()}computeAngle(){const n=this.points[0],e=this.points[1],i=this.points[2];if(!(n&&e&&i))return 0;const s=new m().subVectors(e,n),a=new m().subVectors(e,i),w=b.radToDeg(s.angleTo(a));return this.onAngleComputed.trigger(w),w}dispose(){this.points=[],this.labelMarker.dispose(),this.onAngleComputed.reset(),this.onPointAdded.reset(),this.labelMarker.dispose(),this._line.removeFromParent(),this._lineMaterial.dispose(),this._lineGeometry.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}}const h=class h extends y{constructor(e){super(e);t(this,"onDisposed",new d);t(this,"world");t(this,"list",[]);t(this,"_lineMaterial");t(this,"_enabled",!1);t(this,"_vertexPicker");t(this,"_currentAngleElement",null);t(this,"_clickCount",0);t(this,"create",()=>{if(!this.enabled)return;if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAngleElement){const i=new U(this.world);i.lineMaterial=this.lineMaterial,this._currentAngleElement=i}this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.setPoint(e,this._clickCount+1),this._currentAngleElement.setPoint(e,this._clickCount+2),this._currentAngleElement.computeAngle(),this._clickCount++,this._clickCount===3&&this.endCreation()}});t(this,"onMouseMove",()=>{if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAngleElement&&(this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.computeAngle())});t(this,"onKeyDown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAngleElement,e.key==="Escape"&&(this._clickCount===0&&!this._currentAngleElement?this.enabled=!1:this.cancelCreation()))});this.components.add(h.uuid,this),this._vertexPicker=new S(e),this._lineMaterial=new _({color:6629591,linewidth:2})}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set enabled(e){this._enabled=e,this.setupEvents(e),this._vertexPicker.enabled=e,e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._lineMaterial.dispose(),this._vertexPicker.dispose();for(const e of this.list)e.dispose();this._currentAngleElement&&this._currentAngleElement.dispose(),this.components=null,this.onDisposed.trigger(h.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAngleElement&&(this.list.push(this._currentAngleElement),this._currentAngleElement.computeAngle(),this._currentAngleElement=null),this._clickCount=0}cancelCreation(){this._currentAngleElement&&(this._currentAngleElement.dispose(),this._currentAngleElement=null),this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("No world selected for angle measurement!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The given world doesn't have a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeyDown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeyDown))}};t(h,"uuid","622fb2c9-528c-4b0a-8a0e-6a1375f0a3aa");let g=h;const f=document.getElementById("container"),l=new C,z=l.get(x),r=z.create();r.scene=new D(l);r.renderer=new B(l,f);r.camera=new L(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const F=l.get(G);F.create(r);const H=new E(3,3,3),W=new A({color:"#6528D7"}),p=new v(H,W);p.position.set(0,1.5,0);r.scene.three.add(p);r.meshes.add(p);const u=l.get(g);u.world=r;u.enabled=!0;f.ondblclick=()=>u.create();window.onkeydown=o=>{(o.code==="Delete"||o.code==="Backspace")&&u.delete()};const c=new P;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); diff --git a/examples/assets/areaMeasurement.js b/examples/assets/areaMeasurement.js index 017eea14b..b0312fef6 100644 --- a/examples/assets/areaMeasurement.js +++ b/examples/assets/areaMeasurement.js @@ -1 +1 @@ -var P=Object.defineProperty;var v=(a,n,e)=>n in a?P(a,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[n]=e;var i=(a,n,e)=>(v(a,typeof n!="symbol"?n+"":n,e),e);import{L as E,P as A,V as _,a as L,f as x,S as M,B as b,b as C,M as y}from"./web-ifc-api-BC8YMRiS.js";import{S as D}from"./stats.min-GTpOrGrX.js";import{U as h,J as S,f as B,p as V,s as W,k as I,N as R}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as G}from"./index-CwA6v-S5.js";import{S as K}from"./index-MPPnu1_m.js";import{M as N}from"./mark-Cj_PmUva.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as U}from"./graphic-vertex-picker-CEs1V3AG.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";class z{constructor(n,e,t){i(this,"enabled",!0);i(this,"visible",!0);i(this,"points",[]);i(this,"workingPlane",null);i(this,"labelMarker");i(this,"world");i(this,"components");i(this,"onDisposed",new h);i(this,"_rotationMatrix",null);i(this,"_dimensionLines",[]);i(this,"_defaultLineMaterial",new E({color:"red"}));i(this,"onAreaComputed",new h);i(this,"onWorkingPlaneComputed",new h);i(this,"onPointAdded",new h);i(this,"onPointRemoved",new h);this.world=e,this.components=n;const s=T();this.labelMarker=new N(e,s),this.labelMarker.visible=!1,this.onPointAdded.add(o=>{this.points.length===3&&!this._dimensionLines[2]&&(this.addDimensionLine(o,this.points[0]),this.labelMarker.visible=!0)}),t==null||t.forEach(o=>this.setPoint(o))}setPoint(n,e){let t;if(e?t=e:t=this.points.length===0?0:this.points.length,t===0){this.points[0]=n;return}if(t<0||t>this.points.length)return;const s=this.points.length>t;this.points[t]=n,this.onPointAdded.trigger(n),s||this.addDimensionLine(this.points[t-1],n);const{previousLine:o,nextLine:m}=this.getLinesBetweenIndex(t);o&&(o.endPoint=n),m&&(m.startPoint=n)}removePoint(n){if(this.points.length===3)return;this.points.splice(n,1);const{previousLine:e,nextLine:t}=this.getLinesBetweenIndex(n);t&&(e.endPoint=t.endPoint),t==null||t.dispose(),this._dimensionLines.splice(n,1),this.onPointRemoved.trigger()}toggleLabel(){this.labelMarker.toggleVisibility()}addDimensionLine(n,e){const t=document.createElement("div");t.className="w-2 h-2 bg-red-600 rounded-full";const s=new K(this.components,this.world,{start:n,end:e,lineMaterial:this._defaultLineMaterial,endpointElement:t});return s.toggleLabel(),this._dimensionLines.length>1?this._dimensionLines.splice(this._dimensionLines.length-1,0,s):this._dimensionLines.push(s),s}getLinesBetweenIndex(n){const e=n===0?this._dimensionLines.length-1:n-1,t=this._dimensionLines[e],s=this._dimensionLines[n];return{previousLine:t,nextLine:s}}computeWorkingPlane(){this.workingPlane=new A().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]);const n=new _(0,1,0),e=this.workingPlane.normal.angleTo(n),t=new _().crossVectors(this.workingPlane.normal,n).normalize();this._rotationMatrix=new L().makeRotationAxis(t,e),this.onWorkingPlaneComputed.trigger(this.workingPlane)}computeArea(){if(!(this._rotationMatrix&&this.workingPlane))return this.onAreaComputed.trigger(0),0;let n=0,e=0;const t=this._rotationMatrix,s=this.points.map(m=>{const f=m.clone().applyMatrix4(t),p=new x(f.x,f.z);return n+=p.x,e+=p.y,p}),o=Math.abs(M.area(s));return this.labelMarker.three.element.textContent=`${o.toFixed(2)} m²`,this.labelMarker.three.position.set(n/s.length,-this.workingPlane.constant,e/s.length).applyMatrix4(t.clone().invert()),this.onAreaComputed.trigger(o),o}dispose(){this.onAreaComputed.reset(),this.onWorkingPlaneComputed.reset(),this.onPointAdded.reset(),this.onPointRemoved.reset();for(const n of this._dimensionLines)n.dispose();this.labelMarker.dispose(),this._dimensionLines=[],this.points=[],this._rotationMatrix=null,this.workingPlane=null,this._defaultLineMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return{points:this.points,workingPlane:this.workingPlane,area:this.computeArea()}}}const d=class d extends S{constructor(e){super(e);i(this,"onDisposed",new h);i(this,"list",[]);i(this,"world");i(this,"_enabled",!1);i(this,"_vertexPicker");i(this,"_currentAreaElement",null);i(this,"_clickCount",0);i(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World not defined for the area measurement!");const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAreaElement){const t=new z(this.components,this.world);t.onPointAdded.add(()=>{this._clickCount===3&&!t.workingPlane&&(t.computeWorkingPlane(),this._vertexPicker.workingPlane=t.workingPlane)}),t.onPointRemoved.add(()=>this._clickCount--),this._currentAreaElement=t}this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea(),this._clickCount++}});i(this,"onMouseMove",()=>{if(!this.world){console.log("No world given for the area measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAreaElement&&(this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea())});i(this,"onKeydown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAreaElement&&this._currentAreaElement.removePoint(this._clickCount-1),e.key==="Enter"&&this._currentAreaElement&&this.endCreation(),e.key==="Escape"&&(this._clickCount===0&&!this._currentAreaElement?this.enabled=!1:this.cancelCreation()))});this.components.add(d.uuid,this),this._vertexPicker=new U(e)}set enabled(e){this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._vertexPicker.dispose(),this._currentAreaElement&&this._currentAreaElement.dispose();for(const e of this.list)e.dispose();this.components=null,this.onDisposed.trigger(d.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAreaElement&&(this.list.push(this._currentAreaElement),this._currentAreaElement.removePoint(this._clickCount),this._currentAreaElement.computeWorkingPlane(),this._currentAreaElement.computeArea(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}cancelCreation(){this._currentAreaElement&&(this._currentAreaElement.dispose(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("The area measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the area measurement needs a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}};i(d,"uuid","c453a99e-f054-4781-9060-33df617db4a5");let w=d;const g=document.getElementById("container"),l=new B,F=l.get(V),r=F.create();r.scene=new W(l);r.renderer=new G(l,g);r.camera=new I(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const J=l.get(R);J.create(r);const $=new b(3,3,3),j=new C({color:"#6528D7"}),k=new y($,j);k.position.set(0,1.5,0);r.scene.three.add(k);r.meshes.add(k);const u=new w(l);u.world=r;u.enabled=!0;g.ondblclick=()=>u.create();g.oncontextmenu=()=>u.endCreation();window.onkeydown=a=>{a.code==="Delete"||a.code};const c=new D;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); +var P=Object.defineProperty;var v=(a,n,e)=>n in a?P(a,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[n]=e;var i=(a,n,e)=>(v(a,typeof n!="symbol"?n+"":n,e),e);import{L as E,P as A,V as _,a as L,f as x,S as M,B as b,b as C,M as y}from"./web-ifc-api-BC8YMRiS.js";import{S as D}from"./stats.min-GTpOrGrX.js";import{D as h,J as S,f as B,p as V,s as W,k as I,N as R}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as G}from"./index-q_Y48tt2.js";import{S as K}from"./index-CYkvDr46.js";import{M as N}from"./mark-Dwn_ERVH.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as z}from"./graphic-vertex-picker-BH9d5rBm.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";class U{constructor(n,e,t){i(this,"enabled",!0);i(this,"visible",!0);i(this,"points",[]);i(this,"workingPlane",null);i(this,"labelMarker");i(this,"world");i(this,"components");i(this,"onDisposed",new h);i(this,"_rotationMatrix",null);i(this,"_dimensionLines",[]);i(this,"_defaultLineMaterial",new E({color:"red"}));i(this,"onAreaComputed",new h);i(this,"onWorkingPlaneComputed",new h);i(this,"onPointAdded",new h);i(this,"onPointRemoved",new h);this.world=e,this.components=n;const s=T();this.labelMarker=new N(e,s),this.labelMarker.visible=!1,this.onPointAdded.add(o=>{this.points.length===3&&!this._dimensionLines[2]&&(this.addDimensionLine(o,this.points[0]),this.labelMarker.visible=!0)}),t==null||t.forEach(o=>this.setPoint(o))}setPoint(n,e){let t;if(e?t=e:t=this.points.length===0?0:this.points.length,t===0){this.points[0]=n;return}if(t<0||t>this.points.length)return;const s=this.points.length>t;this.points[t]=n,this.onPointAdded.trigger(n),s||this.addDimensionLine(this.points[t-1],n);const{previousLine:o,nextLine:m}=this.getLinesBetweenIndex(t);o&&(o.endPoint=n),m&&(m.startPoint=n)}removePoint(n){if(this.points.length===3)return;this.points.splice(n,1);const{previousLine:e,nextLine:t}=this.getLinesBetweenIndex(n);t&&(e.endPoint=t.endPoint),t==null||t.dispose(),this._dimensionLines.splice(n,1),this.onPointRemoved.trigger()}toggleLabel(){this.labelMarker.toggleVisibility()}addDimensionLine(n,e){const t=document.createElement("div");t.className="w-2 h-2 bg-red-600 rounded-full";const s=new K(this.components,this.world,{start:n,end:e,lineMaterial:this._defaultLineMaterial,endpointElement:t});return s.toggleLabel(),this._dimensionLines.length>1?this._dimensionLines.splice(this._dimensionLines.length-1,0,s):this._dimensionLines.push(s),s}getLinesBetweenIndex(n){const e=n===0?this._dimensionLines.length-1:n-1,t=this._dimensionLines[e],s=this._dimensionLines[n];return{previousLine:t,nextLine:s}}computeWorkingPlane(){this.workingPlane=new A().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]);const n=new _(0,1,0),e=this.workingPlane.normal.angleTo(n),t=new _().crossVectors(this.workingPlane.normal,n).normalize();this._rotationMatrix=new L().makeRotationAxis(t,e),this.onWorkingPlaneComputed.trigger(this.workingPlane)}computeArea(){if(!(this._rotationMatrix&&this.workingPlane))return this.onAreaComputed.trigger(0),0;let n=0,e=0;const t=this._rotationMatrix,s=this.points.map(m=>{const f=m.clone().applyMatrix4(t),p=new x(f.x,f.z);return n+=p.x,e+=p.y,p}),o=Math.abs(M.area(s));return this.labelMarker.three.element.textContent=`${o.toFixed(2)} m²`,this.labelMarker.three.position.set(n/s.length,-this.workingPlane.constant,e/s.length).applyMatrix4(t.clone().invert()),this.onAreaComputed.trigger(o),o}dispose(){this.onAreaComputed.reset(),this.onWorkingPlaneComputed.reset(),this.onPointAdded.reset(),this.onPointRemoved.reset();for(const n of this._dimensionLines)n.dispose();this.labelMarker.dispose(),this._dimensionLines=[],this.points=[],this._rotationMatrix=null,this.workingPlane=null,this._defaultLineMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return{points:this.points,workingPlane:this.workingPlane,area:this.computeArea()}}}const d=class d extends S{constructor(e){super(e);i(this,"onDisposed",new h);i(this,"list",[]);i(this,"world");i(this,"_enabled",!1);i(this,"_vertexPicker");i(this,"_currentAreaElement",null);i(this,"_clickCount",0);i(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World not defined for the area measurement!");const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAreaElement){const t=new U(this.components,this.world);t.onPointAdded.add(()=>{this._clickCount===3&&!t.workingPlane&&(t.computeWorkingPlane(),this._vertexPicker.workingPlane=t.workingPlane)}),t.onPointRemoved.add(()=>this._clickCount--),this._currentAreaElement=t}this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea(),this._clickCount++}});i(this,"onMouseMove",()=>{if(!this.world){console.log("No world given for the area measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAreaElement&&(this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea())});i(this,"onKeydown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAreaElement&&this._currentAreaElement.removePoint(this._clickCount-1),e.key==="Enter"&&this._currentAreaElement&&this.endCreation(),e.key==="Escape"&&(this._clickCount===0&&!this._currentAreaElement?this.enabled=!1:this.cancelCreation()))});this.components.add(d.uuid,this),this._vertexPicker=new z(e)}set enabled(e){this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._vertexPicker.dispose(),this._currentAreaElement&&this._currentAreaElement.dispose();for(const e of this.list)e.dispose();this.components=null,this.onDisposed.trigger(d.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAreaElement&&(this.list.push(this._currentAreaElement),this._currentAreaElement.removePoint(this._clickCount),this._currentAreaElement.computeWorkingPlane(),this._currentAreaElement.computeArea(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}cancelCreation(){this._currentAreaElement&&(this._currentAreaElement.dispose(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("The area measurement needs a world to work!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The world of the area measurement needs a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}};i(d,"uuid","c453a99e-f054-4781-9060-33df617db4a5");let w=d;const g=document.getElementById("container"),l=new B,F=l.get(V),r=F.create();r.scene=new W(l);r.renderer=new G(l,g);r.camera=new I(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const J=l.get(R);J.create(r);const $=new b(3,3,3),j=new C({color:"#6528D7"}),k=new y($,j);k.position.set(0,1.5,0);r.scene.three.add(k);r.meshes.add(k);const u=new w(l);u.world=r;u.enabled=!0;g.ondblclick=()=>u.create();g.oncontextmenu=()=>u.endCreation();window.onkeydown=a=>{a.code==="Delete"||a.code};const c=new D;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); diff --git a/examples/assets/boundingBoxer.js b/examples/assets/boundingBoxer.js index ca6a46293..7e0686dbe 100644 --- a/examples/assets/boundingBoxer.js +++ b/examples/assets/boundingBoxer.js @@ -1,4 +1,4 @@ -import"./web-ifc-api-BC8YMRiS.js";import{S as c}from"./stats.min-GTpOrGrX.js";import{p as l,a,m as r}from"./index-DyM33b1I.js";import{f as d,p as m,s as p,i as b,k as u,N as f,u as g,A as w}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),t=new d,y=t.get(m),e=y.create();e.scene=new p(t);e.renderer=new b(t,h);e.camera=new u(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(f);B.create(e);e.scene.three.background=null;const k=t.get(g),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),x=await v.arrayBuffer(),A=new Uint8Array(x),i=k.load(A);e.scene.three.add(i);const s=t.get(w);s.add(i);const L=s.getMesh();s.reset();const n=new c;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());l.init();const o=a.create(()=>r` +import"./web-ifc-api-BC8YMRiS.js";import{S as c}from"./stats.min-GTpOrGrX.js";import{p as l,a,m as r}from"./index-DyM33b1I.js";import{f as d,p as m,s as p,i as b,k as u,N as f,u as g,A as w}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),t=new d,y=t.get(m),e=y.create();e.scene=new p(t);e.renderer=new b(t,h);e.camera=new u(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(f);B.create(e);e.scene.three.background=null;const k=t.get(g),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),x=await v.arrayBuffer(),A=new Uint8Array(x),i=k.load(A);e.scene.three.add(i);const s=t.get(w);s.add(i);const L=s.getMesh();s.reset();const n=new c;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());l.init();const o=a.create(()=>r`v&&(v=I);const V=s[S+2],W=s[S+3],j=V-W,Q=V+W;j a&&(a=f);const g=s[d+2];g l.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:n,index:o.array,indirectBuffer:r},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:n,roots:r,indirectBuffer:o}=e,a=new Df(t,{...i,[bc]:!0});if(a._roots=r,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const h=new gt(e.index,1,!1);t.setIndex(h)}else l.array!==n&&(l.array.set(n),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Of,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[bc]:!1},t),t.useSharedArrayBuffer&&!o1())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[bc]||(Ty(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Ke)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?n=>i[n]:n=>n}refit(e=null){return(this.indirect?Zy:Uy)(this,e)}traverse(e,t=0){const i=this._roots[t],n=new Uint32Array(i),r=new Uint16Array(i);o(0);function o(a,l=0){const h=a*2,d=r[h+15]===fl;if(d){const p=n[a+6],f=r[h+14];e(l,d,new Float32Array(i,a*4,6),p,f)}else{const p=a+Ma/4,f=n[a+6],g=n[a+7];e(l,d,new Float32Array(i,a*4,6),g)||(o(p,l+1),o(f,l+1))}}}raycast(e,t=ad){const i=this._roots,n=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),l=n.groups,h=o?t.side:t,d=this.indirect?qy:Vy;for(let p=0,f=i.length;p v&&(v=I);const V=s[S+2],W=s[S+3],j=V-W,Q=V+W;j a&&(a=f);const g=s[d+2];g l.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:n,index:o.array,indirectBuffer:r},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:n,roots:r,indirectBuffer:o}=e,a=new Df(t,{...i,[bc]:!0});if(a._roots=r,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const h=new gt(e.index,1,!1);t.setIndex(h)}else l.array!==n&&(l.array.set(n),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Of,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[bc]:!1},t),t.useSharedArrayBuffer&&!o1())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[bc]||(Ty(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Ke)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?n=>i[n]:n=>n}refit(e=null){return(this.indirect?Zy:Uy)(this,e)}traverse(e,t=0){const i=this._roots[t],n=new Uint32Array(i),r=new Uint16Array(i);o(0);function o(a,l=0){const h=a*2,d=r[h+15]===fl;if(d){const p=n[a+6],f=r[h+14];e(l,d,new Float32Array(i,a*4,6),p,f)}else{const p=a+Ma/4,f=n[a+6],g=n[a+7];e(l,d,new Float32Array(i,a*4,6),g)||(o(p,l+1),o(f,l+1))}}}raycast(e,t=ad){const i=this._roots,n=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),l=n.groups,h=o?t.side:t,d=this.indirect?qy:Vy;for(let p=0,f=i.length;p {var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof jn){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:t,world:i})=>{if(t==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(t==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(e){this.controls.enabled=e}dispose(){this.setupEvents(!1),this.enabled=!1,this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new Ov(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new O(0,0,0)),t}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");Mt.install({THREE:jf.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new Mt(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:Fv,Vector2:Ve,Vector3:O,Vector4:Vs,Quaternion:Vt,Matrix4:Ee,Spherical:Mv,Box3:Ke,Sphere:Gn,Raycaster:io,MathUtils:so}}};const Wf=class Xf extends Re{constructor(e){super(e),A(this,"onAfterUpdate",new ee),A(this,"onBeforeUpdate",new ee),A(this,"onDisposed",new ee),A(this,"list",new Map),A(this,"enabled",!0),e.add(Xf.uuid,this)}create(){const e=new R1(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),e}delete(e){this.list.delete(e.uuid),e.dispose()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,i]of this.list)i.update(e)}};A(Wf,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let D1=Wf;class N1{constructor(e,t,i){A(this,"onDisposed",new ee),A(this,"world"),A(this,"components"),A(this,"three"),A(this,"_fade",3),A(this,"updateZoom",()=>{this.world.camera instanceof ch&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=t;const{color:n,size1:r,size2:o,distance:a}=i;this.components=e;const l=new ul(2,2,1,1),h=new wt({side:no,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:n},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
+ */const Ce={LEFT:1,RIGHT:2,MIDDLE:4},J=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),gs={NONE:0,IN:1,OUT:-1};function Cn(s){return s.isPerspectiveCamera}function Qi(s){return s.isOrthographicCamera}const vs=Math.PI*2,Md=Math.PI/2,Yf=1e-5,wr=Math.PI/180;function ti(s,e,t){return Math.max(e,Math.min(t,s))}function Ye(s,e=Yf){return Math.abs(s) {var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof jn){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:t,world:i})=>{if(t==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(t==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(e){this.controls.enabled=e}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new Ov(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new O(0,0,0)),t}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");Mt.install({THREE:jf.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new Mt(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:Fv,Vector2:Ve,Vector3:O,Vector4:Vs,Quaternion:Vt,Matrix4:Ee,Spherical:Mv,Box3:Ke,Sphere:Gn,Raycaster:io,MathUtils:so}}};const Wf=class Xf extends Re{constructor(e){super(e),A(this,"onAfterUpdate",new $),A(this,"onBeforeUpdate",new $),A(this,"onDisposed",new $),A(this,"onWorldCreated",new $),A(this,"onWorldDeleted",new $),A(this,"list",new Map),A(this,"enabled",!0),e.add(Xf.uuid,this)}create(){const e=new R1(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),this.onWorldCreated.trigger(e),e}delete(e){const t=e.uuid;this.list.delete(e.uuid),e.dispose(),this.onWorldDeleted.trigger(t)}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,i]of this.list)i.update(e)}};A(Wf,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let D1=Wf;class N1{constructor(e,t,i){A(this,"onDisposed",new $),A(this,"world"),A(this,"components"),A(this,"three"),A(this,"_fade",3),A(this,"updateZoom",()=>{this.world.camera instanceof ch&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=t;const{color:n,size1:r,size2:o,distance:a}=i;this.components=e;const l=new ul(2,2,1,1),h=new wt({side:no,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:n},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
varying vec3 worldPosition;
@@ -68,7 +68,7 @@ var gv=Object.defineProperty;var vv=(s,e,t)=>e in s?gv(s,e,{enumerable:!0,config
}
- `,extensions:{derivatives:!0}});this.three=new le(l,h),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(Fi).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(!(this.world.camera instanceof ch))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}class U1 extends Re{constructor(){super(...arguments),A(this,"list",new Map),A(this,"onDisposed",new ee),A(this,"config",{color:new Rt(12303291),size1:1,size2:10,distance:500}),A(this,"enabled",!0)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new N1(this.components,e,this.config);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}}A(U1,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const xn=new io,bt=new O,Ki=new O,qe=new Vt,Vd={X:new O(1,0,0),Y:new O(0,1,0),Z:new O(0,0,1)},kc={type:"change"},Hd={type:"mouseDown"},Yd={type:"mouseUp",mode:null},Gd={type:"objectChange"};class k1 extends kn{constructor(e,t){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";const i=new G1;this._gizmo=i,this.add(i);const n=new j1;this._plane=n,this.add(n);const r=this;function o(S,_){let I=_;Object.defineProperty(r,S,{get:function(){return I!==void 0?I:_},set:function(P){I!==P&&(I=P,n[S]=P,i[S]=P,r.dispatchEvent({type:S+"-changed",value:P}),r.dispatchEvent(kc))}}),r[S]=_,n[S]=_,i[S]=_}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new O,l=new O,h=new Vt,d=new Vt,p=new O,f=new Vt,g=new O,v=new O,b=new O,w=0,T=new O;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",h),o("worldQuaternionStart",d),o("cameraPosition",p),o("cameraQuaternion",f),o("pointStart",g),o("pointEnd",v),o("rotationAxis",b),o("rotationAngle",w),o("eye",T),this._offset=new O,this._startNorm=new O,this._endNorm=new O,this._cameraScale=new O,this._parentPosition=new O,this._parentQuaternion=new Vt,this._parentQuaternionInv=new Vt,this._parentScale=new O,this._worldScaleStart=new O,this._worldQuaternionInv=new Vt,this._worldScale=new O,this._positionStart=new O,this._quaternionStart=new Vt,this._scaleStart=new O,this._getPointer=B1.bind(this),this._onPointerDown=V1.bind(this),this._onPointerHover=z1.bind(this),this._onPointerMove=H1.bind(this),this._onPointerUp=Y1.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){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(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;xn.setFromCamera(e,this.camera);const t=Bc(this._gizmo.picker[this.mode],xn);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){xn.setFromCamera(e,this.camera);const t=Bc(this._plane,xn,!0);t&&(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(t.point).sub(this.worldPositionStart)),this.dragging=!0,Hd.mode=this.mode,this.dispatchEvent(Hd)}}pointerMove(e){const t=this.axis,i=this.mode,n=this.object;let r=this.space;if(i==="scale"?r="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(r="world"),n===void 0||t===null||this.dragging===!1||e.button!==-1)return;xn.setFromCamera(e,this.camera);const o=Bc(this._plane,xn,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),r==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(n.position.applyQuaternion(qe.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),r==="world"&&(n.parent&&n.position.add(bt.setFromMatrixPosition(n.parent.matrixWorld)),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(bt.setFromMatrixPosition(n.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Ki.set(a,a,a)}else bt.copy(this.pointStart),Ki.copy(this.pointEnd),bt.applyQuaternion(this._worldQuaternionInv),Ki.applyQuaternion(this._worldQuaternionInv),Ki.divide(bt),t.search("X")===-1&&(Ki.x=1),t.search("Y")===-1&&(Ki.y=1),t.search("Z")===-1&&(Ki.z=1);n.scale.copy(this._scaleStart).multiply(Ki),this.scaleSnap&&(t.search("X")!==-1&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(bt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(bt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Vd[t]),bt.copy(Vd[t]),r==="local"&&bt.applyQuaternion(this.worldQuaternion),bt.cross(this.eye),bt.length()===0?l=!0:this.rotationAngle=this._offset.dot(bt.normalize())*a),(t==="E"||l)&&(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),r==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(qe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(qe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(kc),this.dispatchEvent(Gd)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Yd.mode=this.mode,this.dispatchEvent(Yd)),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(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,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(kc),this.dispatchEvent(Gd),this.pointStart.copy(this.pointEnd))}getRaycaster(){return xn}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function B1(s){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:s.button};{const e=this.domElement.getBoundingClientRect();return{x:(s.clientX-e.left)/e.width*2-1,y:-(s.clientY-e.top)/e.height*2+1,button:s.button}}}function z1(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function V1(s){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(s)),this.pointerDown(this._getPointer(s)))}function H1(s){this.enabled&&this.pointerMove(this._getPointer(s))}function Y1(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function Bc(s,e,t){const i=e.intersectObject(s,!0);for(let n=0;nTc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:k=>yr.distanceToBox(k),intersectsBounds:(k,V,W)=>W{for(let W=k,j=k+V;Wxc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree){const k=e.boundsTree;return k.shapecast({boundsTraverseOrder:V=>br.distanceToBox(V),intersectsBounds:(V,W,j)=>j{for(let j=V,Q=V+W;jnew Ke),fs=new Ke,ms=new Ke,Ac=new Ke,Sc=new Ke;let _c=!1;function a1(s,e,t,i){if(_c)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_c=!0;const n=s._roots,r=e._roots;let o,a=0,l=0;const h=new Ee().copy(t).invert();for(let d=0,p=n.length;d
Tc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:k=>yr.distanceToBox(k),intersectsBounds:(k,V,W)=>W{for(let W=k,j=k+V;Wxc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree){const k=e.boundsTree;return k.shapecast({boundsTraverseOrder:V=>br.distanceToBox(V),intersectsBounds:(V,W,j)=>j{for(let j=V,Q=V+W;jnew Ke),fs=new Ke,ms=new Ke,Ac=new Ke,Sc=new Ke;let _c=!1;function a1(s,e,t,i){if(_c)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_c=!0;const n=s._roots,r=e._roots;let o,a=0,l=0;const h=new Ee().copy(t).invert();for(let d=0,p=n.length;d