@roomle/web-sdk 2.76.0 → 2.77.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{banana-for-scale-00c51c97.nomodule.js → banana-for-scale-747faad0.nomodule.js} +2 -2
- package/lib/{banana-for-scale-00c51c97.nomodule.js.map → banana-for-scale-747faad0.nomodule.js.map} +1 -1
- package/lib/{banana-for-scale-6bb1ee7e.js → banana-for-scale-9b1f01e9.js} +2 -2
- package/lib/{banana-for-scale-6bb1ee7e.js.map → banana-for-scale-9b1f01e9.js.map} +1 -1
- package/lib/{camera-behaviour-c7eaa412.js → camera-behaviour-d6af6d09.js} +2 -2
- package/lib/{camera-behaviour-c7eaa412.js.map → camera-behaviour-d6af6d09.js.map} +1 -1
- package/lib/{camera-behaviour-35b9043c.nomodule.js → camera-behaviour-eee26e60.nomodule.js} +2 -2
- package/lib/{camera-behaviour-35b9043c.nomodule.js.map → camera-behaviour-eee26e60.nomodule.js.map} +1 -1
- package/lib/{component-dimensioning-be6f4978.nomodule.js → component-dimensioning-505e3be3.nomodule.js} +2 -2
- package/lib/component-dimensioning-505e3be3.nomodule.js.map +1 -0
- package/lib/{component-dimensioning-b340ff88.js → component-dimensioning-a87836c0.js} +2 -2
- package/lib/component-dimensioning-a87836c0.js.map +1 -0
- package/lib/{component-raycast-helper-fbc6ea71.js → component-raycast-helper-357d58fb.js} +2 -2
- package/lib/component-raycast-helper-357d58fb.js.map +1 -0
- package/lib/{component-raycast-helper-b5e775b6.nomodule.js → component-raycast-helper-4260f5f3.nomodule.js} +2 -2
- package/lib/component-raycast-helper-4260f5f3.nomodule.js.map +1 -0
- package/lib/{configurator-0545dd74.nomodule.js → configurator-28c8e5dc.nomodule.js} +2 -2
- package/lib/configurator-28c8e5dc.nomodule.js.map +1 -0
- package/lib/{configurator-e8e7249b.js → configurator-7be15b5d.js} +2 -2
- package/lib/configurator-7be15b5d.js.map +1 -0
- package/lib/configurator-main-9627b78d.js +2 -0
- package/lib/configurator-main-9627b78d.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{continuous-drawing-helper-3bf27c77.js → continuous-drawing-helper-51677944.js} +2 -2
- package/lib/continuous-drawing-helper-51677944.js.map +1 -0
- package/lib/{continuous-drawing-helper-c48a8810.nomodule.js → continuous-drawing-helper-ecb99fa7.nomodule.js} +2 -2
- package/lib/continuous-drawing-helper-ecb99fa7.nomodule.js.map +1 -0
- package/lib/{default-light-setting-50a8aae2.js → default-light-setting-432c00f7.js} +2 -2
- package/lib/default-light-setting-432c00f7.js.map +1 -0
- package/lib/{default-light-setting-4b8e7ee6.nomodule.js → default-light-setting-8492f1aa.nomodule.js} +2 -2
- package/lib/default-light-setting-8492f1aa.nomodule.js.map +1 -0
- package/lib/definitions/common-core/src/configurator-kernel-access.d.ts +1 -0
- package/lib/definitions/common-core/src/utils/shims.d.ts +2 -2
- package/lib/definitions/configurator-core/src/roomle-configurator.d.ts +4 -4
- package/lib/definitions/configurator-core/src/services/configurator-ui-callback.d.ts +2 -2
- package/lib/definitions/glb-viewer-core/src/roomle-glb-viewer.d.ts +1 -1
- package/lib/definitions/material-viewer/src/roomle-material-viewer.d.ts +1 -1
- package/lib/definitions/planner-core/src/roomle-planner-ui-callback.d.ts +5 -0
- package/lib/definitions/typings/kernel.d.ts +1 -0
- package/lib/{dimensioning-helper-ab6b7f69.js → dimensioning-helper-02499f1a.js} +2 -2
- package/lib/{dimensioning-helper-ab6b7f69.js.map → dimensioning-helper-02499f1a.js.map} +1 -1
- package/lib/{dimensioning-helper-c84c6aa3.nomodule.js → dimensioning-helper-be6a25b7.nomodule.js} +2 -2
- package/lib/{dimensioning-helper-c84c6aa3.nomodule.js.map → dimensioning-helper-be6a25b7.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-622cb79a.nomodule.js → glb-viewer-7282caf7.nomodule.js} +2 -2
- package/lib/{glb-viewer-622cb79a.nomodule.js.map → glb-viewer-7282caf7.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-camera-behaviour-6088e966.js → glb-viewer-camera-behaviour-94516099.js} +2 -2
- package/lib/glb-viewer-camera-behaviour-94516099.js.map +1 -0
- package/lib/{glb-viewer-camera-behaviour-8633618f.nomodule.js → glb-viewer-camera-behaviour-bee9e036.nomodule.js} +2 -2
- package/lib/glb-viewer-camera-behaviour-bee9e036.nomodule.js.map +1 -0
- package/lib/{glb-viewer-4a506f4e.js → glb-viewer-f88249d7.js} +2 -2
- package/lib/{glb-viewer-4a506f4e.js.map → glb-viewer-f88249d7.js.map} +1 -1
- package/lib/glb-viewer-main-42ec8932.js +2 -0
- package/lib/glb-viewer-main-42ec8932.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/legacy/{banana-for-scale-ebedc20c.legacy.js → banana-for-scale-adf89519.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-ebedc20c.legacy.js.map → banana-for-scale-adf89519.legacy.js.map} +1 -1
- package/lib/legacy/{camera-behaviour-022aa24e.legacy.js → camera-behaviour-529c19c2.legacy.js} +2 -2
- package/lib/legacy/{camera-behaviour-022aa24e.legacy.js.map → camera-behaviour-529c19c2.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-5e8990a3.legacy.js → component-dimensioning-480dad60.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-480dad60.legacy.js.map +1 -0
- package/lib/legacy/{component-raycast-helper-e04ecdef.legacy.js → component-raycast-helper-a732cc57.legacy.js} +2 -2
- package/lib/legacy/component-raycast-helper-a732cc57.legacy.js.map +1 -0
- package/lib/legacy/{configurator-a4557504.legacy.js → configurator-0ee3fb6e.legacy.js} +2 -2
- package/lib/legacy/configurator-0ee3fb6e.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{continuous-drawing-helper-605724b0.legacy.js → continuous-drawing-helper-1c6ee6c9.legacy.js} +2 -2
- package/lib/legacy/continuous-drawing-helper-1c6ee6c9.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-4bfdc4a5.legacy.js → default-light-setting-e546d92d.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-e546d92d.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-d2bd342f.legacy.js → dimensioning-helper-d367a9ae.legacy.js} +2 -2
- package/lib/legacy/{dimensioning-helper-d2bd342f.legacy.js.map → dimensioning-helper-d367a9ae.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-c3cdd113.legacy.js → glb-viewer-32520b42.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-c3cdd113.legacy.js.map → glb-viewer-32520b42.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-camera-behaviour-db58cf5d.legacy.js → glb-viewer-camera-behaviour-e7544c90.legacy.js} +2 -2
- package/lib/legacy/glb-viewer-camera-behaviour-e7544c90.legacy.js.map +1 -0
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{material-viewer-8323195c.legacy.js → material-viewer-9f4642e2.legacy.js} +2 -2
- package/lib/legacy/material-viewer-9f4642e2.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/planner-ca9be806.legacy.js +2 -0
- package/lib/legacy/{planner-b5bb8ed7.legacy.js.map → planner-ca9be806.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/roomle-configurator-35ccd5e3.legacy.js +2 -0
- package/lib/legacy/roomle-configurator-35ccd5e3.legacy.js.map +1 -0
- package/lib/legacy/{roomle-dependency-injection-d61f4763.legacy.js → roomle-dependency-injection-32a7ed2e.legacy.js} +3 -3
- package/lib/legacy/{roomle-dependency-injection-d61f4763.legacy.js.map → roomle-dependency-injection-32a7ed2e.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/{script-loader-0d8dab5c.legacy.js → script-loader-d14aa469.legacy.js} +2 -2
- package/lib/legacy/script-loader-d14aa469.legacy.js.map +1 -0
- package/lib/legacy/static/ConfiguratorKernel-c4372bbeb5743db2.wasm +0 -0
- package/lib/legacy/static/RoomleCore-0a87ce9a99621bd9.wasm +0 -0
- package/lib/{static/RoomleToolsCore-3ed4fcaccf294e37.wasm → legacy/static/RoomleToolsCore-61c01f70818028fb.wasm} +0 -0
- package/lib/legacy/{stats-helper-3a7e4556.legacy.js → stats-helper-048249dd.legacy.js} +2 -2
- package/lib/legacy/stats-helper-048249dd.legacy.js.map +1 -0
- package/lib/legacy/{tools-core-6800c7b7.legacy.js → tools-core-bef6b8f0.legacy.js} +2 -2
- package/lib/legacy/tools-core-bef6b8f0.legacy.js.map +1 -0
- package/lib/{material-viewer-ea6dba3f.js → material-viewer-561c5edf.js} +2 -2
- package/lib/material-viewer-561c5edf.js.map +1 -0
- package/lib/{material-viewer-ac971800.nomodule.js → material-viewer-da069f1a.nomodule.js} +2 -2
- package/lib/material-viewer-da069f1a.nomodule.js.map +1 -0
- package/lib/material-viewer-main-36f6466f.js +2 -0
- package/lib/material-viewer-main-36f6466f.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/planner-2128f72c.js +2 -0
- package/lib/{planner-e8b990fe.js.map → planner-2128f72c.js.map} +1 -1
- package/lib/planner-948239c6.nomodule.js +2 -0
- package/lib/{planner-7f1380f3.nomodule.js.map → planner-948239c6.nomodule.js.map} +1 -1
- package/lib/planner-main-feee1b27.js +2 -0
- package/lib/planner-main-feee1b27.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/roomle-configurator-760afe57.nomodule.js +2 -0
- package/lib/roomle-configurator-760afe57.nomodule.js.map +1 -0
- package/lib/roomle-configurator-b8abfbd1.js +2 -0
- package/lib/roomle-configurator-b8abfbd1.js.map +1 -0
- package/lib/{roomle-dependency-injection-a1a06d1e.nomodule.js → roomle-dependency-injection-b567df3a.nomodule.js} +3 -3
- package/lib/{roomle-dependency-injection-a1a06d1e.nomodule.js.map → roomle-dependency-injection-b567df3a.nomodule.js.map} +1 -1
- package/lib/{roomle-dependency-injection-ae5fa28d.js → roomle-dependency-injection-d3a8c907.js} +3 -3
- package/lib/{roomle-dependency-injection-ae5fa28d.js.map → roomle-dependency-injection-d3a8c907.js.map} +1 -1
- package/lib/{roomle-sdk-2ab19e90.js → roomle-sdk-7a4f6fc0.js} +2 -2
- package/lib/roomle-sdk-7a4f6fc0.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{script-loader-234d078e.js → script-loader-3c5eb130.js} +2 -2
- package/lib/script-loader-3c5eb130.js.map +1 -0
- package/lib/{script-loader-687f7fbc.nomodule.js → script-loader-ed493cd8.nomodule.js} +2 -2
- package/lib/script-loader-ed493cd8.nomodule.js.map +1 -0
- package/lib/static/ConfiguratorKernel-c4372bbeb5743db2.wasm +0 -0
- package/lib/static/RoomleCore-0a87ce9a99621bd9.wasm +0 -0
- package/lib/{legacy/static/RoomleToolsCore-3ed4fcaccf294e37.wasm → static/RoomleToolsCore-61c01f70818028fb.wasm} +0 -0
- package/lib/{stats-helper-b09eb905.js → stats-helper-92c35a95.js} +2 -2
- package/lib/stats-helper-92c35a95.js.map +1 -0
- package/lib/{stats-helper-e97ec5e1.nomodule.js → stats-helper-9bdccb5b.nomodule.js} +2 -2
- package/lib/stats-helper-9bdccb5b.nomodule.js.map +1 -0
- package/lib/{tools-core-33ca2cb1.js → tools-core-86b0b79b.js} +2 -2
- package/lib/tools-core-86b0b79b.js.map +1 -0
- package/lib/{tools-core-fd03b0a0.nomodule.js → tools-core-9e4e23dc.nomodule.js} +2 -2
- package/lib/tools-core-9e4e23dc.nomodule.js.map +1 -0
- package/package.json +2 -2
- package/lib/component-dimensioning-b340ff88.js.map +0 -1
- package/lib/component-dimensioning-be6f4978.nomodule.js.map +0 -1
- package/lib/component-raycast-helper-b5e775b6.nomodule.js.map +0 -1
- package/lib/component-raycast-helper-fbc6ea71.js.map +0 -1
- package/lib/configurator-0545dd74.nomodule.js.map +0 -1
- package/lib/configurator-e8e7249b.js.map +0 -1
- package/lib/configurator-main-422f9df6.js +0 -2
- package/lib/configurator-main-422f9df6.js.map +0 -1
- package/lib/continuous-drawing-helper-3bf27c77.js.map +0 -1
- package/lib/continuous-drawing-helper-c48a8810.nomodule.js.map +0 -1
- package/lib/default-light-setting-4b8e7ee6.nomodule.js.map +0 -1
- package/lib/default-light-setting-50a8aae2.js.map +0 -1
- package/lib/glb-viewer-camera-behaviour-6088e966.js.map +0 -1
- package/lib/glb-viewer-camera-behaviour-8633618f.nomodule.js.map +0 -1
- package/lib/glb-viewer-main-06539243.js +0 -2
- package/lib/glb-viewer-main-06539243.js.map +0 -1
- package/lib/legacy/component-dimensioning-5e8990a3.legacy.js.map +0 -1
- package/lib/legacy/component-raycast-helper-e04ecdef.legacy.js.map +0 -1
- package/lib/legacy/configurator-a4557504.legacy.js.map +0 -1
- package/lib/legacy/continuous-drawing-helper-605724b0.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-4bfdc4a5.legacy.js.map +0 -1
- package/lib/legacy/glb-viewer-camera-behaviour-db58cf5d.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-8323195c.legacy.js.map +0 -1
- package/lib/legacy/planner-b5bb8ed7.legacy.js +0 -2
- package/lib/legacy/roomle-configurator-876d1ced.legacy.js +0 -2
- package/lib/legacy/roomle-configurator-876d1ced.legacy.js.map +0 -1
- package/lib/legacy/script-loader-0d8dab5c.legacy.js.map +0 -1
- package/lib/legacy/static/ConfiguratorKernel-031e65eaee5cacde.wasm +0 -0
- package/lib/legacy/static/RoomleCore-55c9812f52948f19.wasm +0 -0
- package/lib/legacy/stats-helper-3a7e4556.legacy.js.map +0 -1
- package/lib/legacy/tools-core-6800c7b7.legacy.js.map +0 -1
- package/lib/material-viewer-ac971800.nomodule.js.map +0 -1
- package/lib/material-viewer-ea6dba3f.js.map +0 -1
- package/lib/material-viewer-main-2d9d0a22.js +0 -2
- package/lib/material-viewer-main-2d9d0a22.js.map +0 -1
- package/lib/planner-7f1380f3.nomodule.js +0 -2
- package/lib/planner-e8b990fe.js +0 -2
- package/lib/planner-main-39d3166e.js +0 -2
- package/lib/planner-main-39d3166e.js.map +0 -1
- package/lib/roomle-configurator-4136c482.js +0 -2
- package/lib/roomle-configurator-4136c482.js.map +0 -1
- package/lib/roomle-configurator-e97356ed.nomodule.js +0 -2
- package/lib/roomle-configurator-e97356ed.nomodule.js.map +0 -1
- package/lib/roomle-sdk-2ab19e90.js.map +0 -1
- package/lib/script-loader-234d078e.js.map +0 -1
- package/lib/script-loader-687f7fbc.nomodule.js.map +0 -1
- package/lib/static/ConfiguratorKernel-031e65eaee5cacde.wasm +0 -0
- package/lib/static/RoomleCore-55c9812f52948f19.wasm +0 -0
- package/lib/stats-helper-b09eb905.js.map +0 -1
- package/lib/stats-helper-e97ec5e1.nomodule.js.map +0 -1
- package/lib/tools-core-33ca2cb1.js.map +0 -1
- package/lib/tools-core-fd03b0a0.nomodule.js.map +0 -1
package/lib/legacy/{camera-behaviour-022aa24e.legacy.js → camera-behaviour-529c19c2.legacy.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-d61f4763.legacy.js","./main-thread-to-worker-63c62382.legacy.js"],(function(e,t){var i,s,n,a,r,o,h,d,c,_,l,m,u,g,p,v,y,w,f,C,b,S,x,P,M,L,E,D,I,k,T,R,B,A,z,O,F,U,G,H,q,N,Z,j,K,W,Y,V,X,J,Q,$,ee,te,ie,se,ne,ae,re,oe,he,de,ce,_e,le,me,ue,ge,pe,ve,ye,we,fe,Ce,be;return{setters:[function(e){i=e._,s=e.i,n=e.E,a=e.t,r=e.X,o=e.Y,h=e.g,d=e.y,c=e.H,_=e.Z,l=e.$,m=e.a0,u=e.a1,g=e.a2,p=e.a3,v=e.a4,y=e.a5,w=e.a6,f=e.a7,C=e.a8,b=e.a9,S=e.w,x=e.q,P=e.G},function(e){M=e.a,L=e.bN,E=e.Y,D=e.V,I=e.bO,k=e.al,T=e.ap,R=e.Q,B=e.aL,A=e.O,z=e.J,O=e.bQ,F=e.bR,U=e.bS,G=e.ad,H=e.bT,q=e.C,N=e.v,Z=e.E,j=e.b5,K=e.S,W=e.A,Y=e.D,V=e.R,X=e._,J=e.e,Q=e.f,$=e.bb,ee=e.k,te=e.h,ie=e.bm,se=e.bd,ne=e.y,ae=e.B,re=e.K,oe=e.bU,he=e.ay,de=e.ax,ce=e.aA,_e=e.aq,le=e.ag,me=e.au,ue=e.aZ,ge=e.b9,pe=e.bV,ve=e.bP,ye=e.bJ,we=e.l,fe=e.bA,Ce=e.bW,be=e.bX}],execute:function(){e("T","static/Tween-d57ee5d181fce582.js");class Se extends n{constructor(e,t,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=a(10),this._yaw=a(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new M,this._targetPosition=new M,i?this._cameraPosition.copy(i):this._cameraPosition=new M(0,.5,3),this._initData.debug){const e=this.getDebugCameraPosition();e&&this._setCurrentCameraParameters(e)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=L(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||r(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const s=Math.min(10*e,1);i.lerp(t,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new M(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(s=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new M(e.targetX,e.targetY,e.targetZ),i)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof E){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}_setCurrentCameraParameters(e){this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._targetPosition.copy(new M(e.targetX,e.targetY,e.targetZ))}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}setToState(e,t){this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new M(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof E&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}e("a",Se),i([s],Se.prototype,"_domHelper",void 0),i([s],Se.prototype,"_initData",void 0),i([s],Se.prototype,"_globalInitData",void 0);class xe{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}e("Z",xe),e("D",2.725);class Pe extends Se{constructor(e,t,i,s){super(e,t,i),this._bounds=new M,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=a(0),this.maxPolarAngle=a(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:r,minVerticalCameraAngle:o,maxVerticalCameraAngle:h,minHorizontalCameraAngle:d,maxHorizontalCameraAngle:c}=this._initData;if(r&&(this._zoomDistance=r/100),void 0!==o&&(this.minPolarAngle=a(o<0?o:-1*o)),void 0!==h&&(this.maxPolarAngle=a(h)),void 0!==d&&(this.minAzimuthAngle=a(d<0?d:-1*d)),void 0!==c&&(this.maxAzimuthAngle=a(c)),void 0!==n){let e=Math.abs(a(n));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,a(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new E,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e){this._objectRotation=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new D(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new D(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-t.x/i.clientHeight*n,s.y=s.y+t.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),o(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),o(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&h(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new M);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),s=e.getCenter(new M);this._setDistanceAndRangesBasedOnBounds(t,!1);const n={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};I(i,n)||this._tweenCameraParameter(i,n,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new M);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=e.getCenter(new M),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,a);const r={yaw:t?this._yaw:s.yaw,pitch:t?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};I(s,r)||this._tweenCameraParameter(s,r,!1)}updateToBounds(e,t,i=!0,s){if(this.setBounds(e),this._initData.debug)return;const n=e.getCenter(new M);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new M(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),r=e.getSize(new M);if(i){const i=this._setDistanceAndRangesBasedOnBounds(r);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(r,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new k);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:n}=this._initData;e.addScalar(n/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const a=Math.max(e.x,e.y),{x:r,y:o}=this._getMargin(i,s),h=d(e.x+r,e.y+o,e.z,this._camera.fov,i,s);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:s}=this._getMargin(e,t);return d(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){let i=this._bounds.x/2,s=this._bounds.y/2;return e>1080&&(i+=this._bounds.x<.3?.1:0,i+=this._bounds.x*(e/1080-1)),t>1080&&(i+=this._bounds.y<.3?.1:0,s+=this._bounds.y*(t/1080-1)),{x:i,y:s}}reset(e,t,i,s,n=!0){const r=e.getSize(new M);if(r){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new M);this._targetPosition.copy(t)}const o=this.getCurrentCameraParameters();if(i||(i=-30),s||(s=10),i+=c(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(r),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(r);const h=this._setDistanceAndRangesBasedOnBounds(r),d=a(s),_=a(i);let l=this._targetPosition.clone();n?this._tweenCameraParameter(o,{yaw:_,pitch:d,distance:h,targetX:l.x,targetY:l.y,targetZ:l.z},!0):(this._pitch=d,this._yaw=_,this._distance=h,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateAndReset(e,t=!0){const i=e.getSize(new M),s=e.getCenter(new M);this.setBounds(e),this._targetPosition.copy(s),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(i));const n=this.getCurrentCameraParameters();this._pitch=a(10),this._yaw=a(-30+c(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(i);let r=this._targetPosition.clone();t?this._tweenCameraParameter(n,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:r.x,targetY:r.y,targetZ:r.z},!0):this._update(this._targetPosition)}_update(e,t){this._initData.debug?this._pitch=Math.max(a(-89),Math.min(a(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const i=new T(-this._pitch,this._yaw,0,"ZYX"),s=(new R).setFromEuler(i),n=new M(0,0,-1);n.applyQuaternion(s),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),e&&this._targetPosition.copy(e);const r=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(r),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(r);else{const e=this._getCameraSphere(r);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(r),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(e,t){let i=e+""+t;0===this._currentZoomHash.length||this._currentZoomHash!==i?(this.dispatchEvent(5,new xe(e,t)),this._currentZoomHash=i):e||t||this.dispatchEvent(5,new xe(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new k(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:s}=this._boundingBox.getCenter(new M);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||s,e.distance=e.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=B(JSON.parse(JSON.stringify(n)),e);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}e("C",Pe);class Me{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class Le{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new A,this._plane.rotation.x=-Math.PI/2;const t=_.createMeshStandardMaterial({});this._innerPlaneMesh=new z,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new z,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new O;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const s=new O;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2);const n=new F;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2),s.holes.push(n);const a=new U(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const r=new U(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=r;const o=a.attributes.uv.clone();a.setAttribute("uv2",o);const h=a.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class Ee extends Me{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new Le(100),this._fog=i||!1,this._textureLoader=new G,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new M(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new H(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new q(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=N,this._floorTexture.wrapT=N,this._floorTexture.repeat.set(100/e,100/t));let i=_.createMeshStandardMaterial({map:this._floorTexture,side:Z});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,s){return this._width=t,this._height=i,this._repeatable=s,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=l(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let n=[];e.forEach(e=>{n.push(m(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=u();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}e("F",Ee),i([s],Ee.prototype,"_rapiAccess",void 0),i([s],Ee.prototype,"_dataSyncer",void 0);const De=Math.PI/4;class Ie extends Se{constructor(e,t,i,s){super(e,t,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=a(-60),this.maxPolarAngle=a(60),this._camera=s||new E,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new M,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new R,this._pitch=0,this._yaw=0;let n=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*De*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*De*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=r(t,s.position),a=g(i,s.quaternion);if(!t||n&&a)return!1;let o=this.getCamera().position.clone(),h=Math.min(10*e,1);o.lerp(t,h),this.getCamera().position.copy(o);let d=this.getCamera().quaternion.clone(),c=Math.min(5*e,1);d.slerp(i,c),this.getCamera().setRotationFromQuaternion(d);let _=!1;return this._keyMap.forEach(e=>{e&&(_=!0)}),_&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new D(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new D(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){p(this._downPosition,this._position)<v&&1===this._state&&(this._state=2,this._orbit(new D(this._position.x,this._position.y)),this._moveForward())}_update(e){let t=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(t)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new M(0,0,0),s=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1*t),e.get(68)&&(i.x=1*t),e.get(37)&&(this._rotateHorizontal(-De*this._rotationSpeed*t),s=!0),e.get(39)&&(this._rotateHorizontal(De*this._rotationSpeed*t),s=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new M(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1*i),(e.get(83)||e.get(40))&&(t.z=1*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),o(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){super.cleanUp(),this._removeInputListener()}}e("c",Ie);class ke extends Me{constructor(e,t,i,s,n){if(super(e,t),this._color=i,this._oldBackground=e.background,s&&n){this._canvas=s,this._style=document.createElement("style");let e='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}e("B",ke);class Te{parse(e,t,i,s,n){let a=JSON.parse(s);return a.environment?this.load(e,t,i,a,n):null}load(e,t,i,s,n){let a,r=s.environment;if(!r)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(r.type){case"color":a=new Promise(t=>t(new ke(e,i,new q(r.details.color))));break;case"image":a=new Promise(s=>s(new ke(e,i,null,t,r.details.imageUrl)));break;case"floor":a=new Promise(t=>{this._rapiAccess.getMaterial(r.details.material).then(s=>{let a=void 0===r.details.fog||r.details.fog,o=new Ee(e,i,a);o.changeFloorMaterial(s,n).then(()=>{t(o)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(e=>e(i))}return a}}i([s],Te.prototype,"_rapiAccess",void 0);class Re{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new A),this._cameraContainer}}e("L",Re);class Be extends Re{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new M;e.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,t.shadow.camera.top=s/2,t.shadow.camera.bottom=-s/2,t.shadow.camera.left=-s/2,t.shadow.camera.right=s/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(j).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new M;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=t.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=u();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof K&&this._addSpotLightToGUI(e,t),t instanceof W&&this._addAmbientLightToGUI(e,t),t instanceof Y&&this._addDirectionalLightToGUI(e,t),t instanceof V&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(s,"color").onChange(e=>{t.color=new q(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new q(e)}),i.add(s,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},s=e.addFolder(t.name);s.add(t,"visible"),s.add(t,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(e=>{t.color=new q(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new q(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}}i([s],Be.prototype,"_dynamicLightSettingLoader",void 0);var Ae=function(e){X(i,e);var t=J(i);function i(e,s,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:128;if(Q(this,i),s<=0||n<=0||a<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");var r=new $(n,2*a,a);r.scale(1,1,-1);for(var o=r.getAttribute("position"),h=new M,d=0;d<o.count;++d)if(h.fromBufferAttribute(o,d),h.y<0){var c=3*-s/2,_=h.y<c?-s/h.y:1-h.y*h.y/(3*c*c);h.multiplyScalar(_),h.toArray(o.array,3*d)}return o.needsUpdate=!0,t.call(this,r,new ee({map:e,depthWrite:!1}))}return te(i)}(z);class ze extends Me{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new Ae(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=u();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class Oe{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new ie(2,1),s=null!=t?t:new ee({color:12632256,side:Z}),n=new z(i,s);return n.position.z=-.1,e.add(n),n}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,s){const n=[],a=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?n.push(t[e]):a.push(t[e]);const r=n.map(e=>e.uv),o=a.map(e=>e.uv),h=e.filter(e=>!r.includes(e)&&!o.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(r,.01,255),this._createSamplePointsInMap(o,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const d=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(d,.015,16776960);let c=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<c.length&&(c=c.slice(0,s)),this._createCirclesInMap(c,8421376)}_createSamplePointsInMap(e,t,i){const s=new se(t,8,4),n=new ee({color:i});e.forEach(e=>{var t;const i=new z(s,n);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new ee({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const s=new se(e.size,8,4),n=new z(s,i);n.position.copy(this._uvToMapPosition(e.uv)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)})}_createClusterLinesInMap(e,t,i){var s;const n=new ne({color:i}),a=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const s=e[t[0]].uv,n=e[t[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const e=(s.y+n.y)/2,t=s.x<n.x?0:1;a.push(this._uvToMapPosition(new D(t,e))),a.push(this._uvToMapPosition(new D(1-t,e)))}a.push(this._uvToMapPosition(n))}});const r=(new ae).setFromPoints(a),o=new re(r,n);o.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(o)}_uvToMapPosition(e){return new M(2*e.x-1,e.y-.5,0)}}class Fe extends oe{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,s;const n=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,a=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new he({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new de}},vertexShader:Ue,fragmentShader:Ge,blending:ce,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const Ue="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",Ge="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class He{}class qe{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,s;this.needsUpdate=!0,this._lightSources=[],e instanceof He?this.environmentSceneGenerator=e:e instanceof _e?this.cubeTexture=e:e instanceof le&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new qe(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new D(e,0)}_createPmremTexture(e){const t=new Fe(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new y;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new me;const n=new w(!0,!1);n.setSourceTexture(t.environment),Oe.createPlane(this._debugScene,n);const a=this._detectLightSources(e,t.environment);return new Oe(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class Ne extends He{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new Ze({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class Ze extends me{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new ue,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new ge(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new q(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);t%2==0?this._createReflector(e,new D(s,n),3,1,.8,.2):this._createSideLight(e,new D(s,n),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new q(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===t){this._createReflector(e,new D(s,n),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const s=(t-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(e,new D(n,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new D(s,n),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const s=new ee;return s.color.set(e,null!=t?t:e,null!=i?i:e),s}_createTopLight(e,t,i){const s=new z(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),e.add(s)}_createSideLight(e,t,i,s,n,a,r){for(let o=0;o<3;o++){const h=s*this._sideLightIntensity,d=new z(this._lightGeometry,this._createAreaLightMaterial((o+i)%3==0?h:h*(1-this._colorVariation),(o+i)%3==1?h:h*(1-this._colorVariation),(o+i)%3==2?h:h*(1-this._colorVariation))),c=(1===o?-t.y:2===o?t.y:0)/Math.sqrt(2),_=0===o?0:1,l=(1===o?t.x:2===o?-t.x:0)/Math.sqrt(2);d.position.set(t.x*r*15+1.1*c*n,15*a+1.1*_*n,t.y*r*15+1.1*l*n),d.rotation.set(0,Math.atan2(t.x,t.y),0),d.scale.setScalar(n),e.add(d)}}_createReflector(e,t,i,s,n,a){const r=new z(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));r.position.set(15*t.x,10*a,15*t.y),r.scale.set(10*s,10*n,10*s),e.add(r)}}class je{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,s){this._depthWriteMaterial=new ee({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new pe,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(ve(s),t),this._setupScene(t,!1),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&(this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this.cameraBehaviour.cameraControl instanceof Ie&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener))),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof Ie&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof Be&&this.cameraBehaviour.cameraControl.getCamera()instanceof E&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof Pe&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i;const{x:s,y:n}=this._domHelper.getClientDimensions();this._scene=new me,this._uiScene=new me,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new ye({antialias:!this._globalInitData.e2e,alpha:!0});const a=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(a),this._renderer.setSize(s,n),this._renderer.outputColorSpace=we,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=fe,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new f(this._renderer,s,n),this._roomleRenderer.setQualityMap(C),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(i=this._roomleRenderer)||void 0===i||i.setSize(s,n)),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight;this._scene.userData.environmentDefinition=new qe(new Ne({type:e}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e;this._scene.environment=i,this._scene.userData.environmentDefinition=new qe(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof ze&&this._environment.updateEnvironmentTexture(i),t!==b||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,s),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{S(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,s,n,a,r){return new Promise((o,h)=>{this._staticItemLoader.loadGLTF(e,t,i,s,n,a,null,r).then(e=>{o(e.scene)},h)})}_loadGLB(e,t,i,s,n,a,r,o){return new Promise((h,d)=>{this._staticItemLoader.loadGLB(e,t,i,s,n,a,r,o).then(e=>{h(e.scene)},d)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=u(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())}_guiLoaded(){let e=u();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){t.import("./stats-helper-3a7e4556.legacy.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new Te).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new Be(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,s)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},s)})}setBackgroundColor(e){this._setEnvironment(new ke(this._scene,this._environment,new q(e)))}setBackgroundImage(e){this._setEnvironment(new ke(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new Be(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const i=x.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var s;if(!e)return;const n=null!=t?t:e;this.updateEnvironment(n,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(s=this._roomleRenderer)||void 0===s||s.updateBounds(n),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),s=i||i;return(null==s?void 0:s.offset)?JSON.parse(JSON.stringify(s.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=5;let s=t.x/t.y*i,n=i;const a=P();this._orthographicOffsetCamera=a.createOrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new M(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,s=t.y,n=P();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new M);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new M),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{const s=this._renderer.domElement.toDataURL("image/jpeg",1),{left:n,right:a,top:r,bottom:o}=this.getCameraOffset(),h=a-n,d=r-o;if(1===h&&1===d)return Ce(e,s),this._onAfterRender=()=>{},void t();const c=new Image;c.src=s,c.onload=()=>{const{naturalWidth:i,naturalHeight:s}=c,a=document.createElement("canvas");a.width=i*h,a.height=s*d;const o=a.getContext("2d"),_=i*n*-1,l=s*(1-r)*-1;o.drawImage(c,_,l),o.save(),Ce(e,a.toDataURL("image/jpeg",1)),t(),this._onAfterRender=()=>{}},c.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,s){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}}e("S",je),i([s],je.prototype,"_domHelper",void 0),i([s],je.prototype,"_scriptLoader",void 0),i([s],je.prototype,"_lifeCycleManager",void 0),i([s],je.prototype,"_staticItemLoader",void 0),i([s],je.prototype,"_hdrEnvironmentLoader",void 0),i([s],je.prototype,"_initData",void 0),i([s],je.prototype,"_globalInitData",void 0),i([s],je.prototype,"_idbManager",void 0),i([s],je.prototype,"_pluginSystem",void 0),i([s],je.prototype,"_imageRenderer",void 0),i([s],je.prototype,"_cameraBehaviourState",void 0),e("b",class{constructor(e,t){return this._debug=!1,this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,this._debug?be(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}})}}}));
|
|
2
|
-
//# sourceMappingURL=camera-behaviour-
|
|
1
|
+
System.register(["./roomle-dependency-injection-32a7ed2e.legacy.js","./main-thread-to-worker-63c62382.legacy.js"],(function(e,t){var i,s,n,a,r,o,h,d,c,_,l,m,u,g,p,v,y,w,f,C,b,S,x,P,M,L,E,D,I,k,T,R,B,A,z,O,F,U,G,H,q,N,Z,j,K,W,Y,V,X,J,Q,$,ee,te,ie,se,ne,ae,re,oe,he,de,ce,_e,le,me,ue,ge,pe,ve,ye,we,fe,Ce,be;return{setters:[function(e){i=e._,s=e.i,n=e.E,a=e.t,r=e.X,o=e.Y,h=e.g,d=e.y,c=e.H,_=e.Z,l=e.$,m=e.a0,u=e.a1,g=e.a2,p=e.a3,v=e.a4,y=e.a5,w=e.a6,f=e.a7,C=e.a8,b=e.a9,S=e.w,x=e.q,P=e.G},function(e){M=e.a,L=e.bN,E=e.Y,D=e.V,I=e.bO,k=e.al,T=e.ap,R=e.Q,B=e.aL,A=e.O,z=e.J,O=e.bQ,F=e.bR,U=e.bS,G=e.ad,H=e.bT,q=e.C,N=e.v,Z=e.E,j=e.b5,K=e.S,W=e.A,Y=e.D,V=e.R,X=e._,J=e.e,Q=e.f,$=e.bb,ee=e.k,te=e.h,ie=e.bm,se=e.bd,ne=e.y,ae=e.B,re=e.K,oe=e.bU,he=e.ay,de=e.ax,ce=e.aA,_e=e.aq,le=e.ag,me=e.au,ue=e.aZ,ge=e.b9,pe=e.bV,ve=e.bP,ye=e.bJ,we=e.l,fe=e.bA,Ce=e.bW,be=e.bX}],execute:function(){e("T","static/Tween-d57ee5d181fce582.js");class Se extends n{constructor(e,t,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=a(10),this._yaw=a(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new M,this._targetPosition=new M,i?this._cameraPosition.copy(i):this._cameraPosition=new M(0,.5,3),this._initData.debug){const e=this.getDebugCameraPosition();e&&this._setCurrentCameraParameters(e)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=L(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||r(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const s=Math.min(10*e,1);i.lerp(t,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new M(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(s=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new M(e.targetX,e.targetY,e.targetZ),i)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof E){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}_setCurrentCameraParameters(e){this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._targetPosition.copy(new M(e.targetX,e.targetY,e.targetZ))}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}setToState(e,t){this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new M(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof E&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}e("a",Se),i([s],Se.prototype,"_domHelper",void 0),i([s],Se.prototype,"_initData",void 0),i([s],Se.prototype,"_globalInitData",void 0);class xe{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}e("Z",xe),e("D",2.725);class Pe extends Se{constructor(e,t,i,s){super(e,t,i),this._bounds=new M,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=a(0),this.maxPolarAngle=a(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:r,minVerticalCameraAngle:o,maxVerticalCameraAngle:h,minHorizontalCameraAngle:d,maxHorizontalCameraAngle:c}=this._initData;if(r&&(this._zoomDistance=r/100),void 0!==o&&(this.minPolarAngle=a(o<0?o:-1*o)),void 0!==h&&(this.maxPolarAngle=a(h)),void 0!==d&&(this.minAzimuthAngle=a(d<0?d:-1*d)),void 0!==c&&(this.maxAzimuthAngle=a(c)),void 0!==n){let e=Math.abs(a(n));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,a(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new E,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e){this._objectRotation=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new D(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new D(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-t.x/i.clientHeight*n,s.y=s.y+t.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),o(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),o(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&h(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new M);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),s=e.getCenter(new M);this._setDistanceAndRangesBasedOnBounds(t,!1);const n={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};I(i,n)||this._tweenCameraParameter(i,n,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new M);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=e.getCenter(new M),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,a);const r={yaw:t?this._yaw:s.yaw,pitch:t?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};I(s,r)||this._tweenCameraParameter(s,r,!1)}updateToBounds(e,t,i=!0,s){if(this.setBounds(e),this._initData.debug)return;const n=e.getCenter(new M);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new M(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),r=e.getSize(new M);if(i){const i=this._setDistanceAndRangesBasedOnBounds(r);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(r,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new k);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:n}=this._initData;e.addScalar(n/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const a=Math.max(e.x,e.y),{x:r,y:o}=this._getMargin(i,s),h=d(e.x+r,e.y+o,e.z,this._camera.fov,i,s);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:s}=this._getMargin(e,t);return d(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){let i=this._bounds.x/2,s=this._bounds.y/2;return e>1080&&(i+=this._bounds.x<.3?.1:0,i+=this._bounds.x*(e/1080-1)),t>1080&&(i+=this._bounds.y<.3?.1:0,s+=this._bounds.y*(t/1080-1)),{x:i,y:s}}reset(e,t,i,s,n=!0){const r=e.getSize(new M);if(r){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new M);this._targetPosition.copy(t)}const o=this.getCurrentCameraParameters();if(i||(i=-30),s||(s=10),i+=c(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(r),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(r);const h=this._setDistanceAndRangesBasedOnBounds(r),d=a(s),_=a(i);let l=this._targetPosition.clone();n?this._tweenCameraParameter(o,{yaw:_,pitch:d,distance:h,targetX:l.x,targetY:l.y,targetZ:l.z},!0):(this._pitch=d,this._yaw=_,this._distance=h,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateAndReset(e,t=!0){const i=e.getSize(new M),s=e.getCenter(new M);this.setBounds(e),this._targetPosition.copy(s),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(i));const n=this.getCurrentCameraParameters();this._pitch=a(10),this._yaw=a(-30+c(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(i);let r=this._targetPosition.clone();t?this._tweenCameraParameter(n,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:r.x,targetY:r.y,targetZ:r.z},!0):this._update(this._targetPosition)}_update(e,t){this._initData.debug?this._pitch=Math.max(a(-89),Math.min(a(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const i=new T(-this._pitch,this._yaw,0,"ZYX"),s=(new R).setFromEuler(i),n=new M(0,0,-1);n.applyQuaternion(s),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),e&&this._targetPosition.copy(e);const r=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(r),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(r);else{const e=this._getCameraSphere(r);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(r),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(e,t){let i=e+""+t;0===this._currentZoomHash.length||this._currentZoomHash!==i?(this.dispatchEvent(5,new xe(e,t)),this._currentZoomHash=i):e||t||this.dispatchEvent(5,new xe(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new k(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:s}=this._boundingBox.getCenter(new M);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||s,e.distance=e.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=B(JSON.parse(JSON.stringify(n)),e);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}e("C",Pe);class Me{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class Le{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new A,this._plane.rotation.x=-Math.PI/2;const t=_.createMeshStandardMaterial({});this._innerPlaneMesh=new z,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new z,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new O;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const s=new O;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2);const n=new F;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2),s.holes.push(n);const a=new U(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const r=new U(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=r;const o=a.attributes.uv.clone();a.setAttribute("uv2",o);const h=a.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class Ee extends Me{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new Le(100),this._fog=i||!1,this._textureLoader=new G,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new M(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new H(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new q(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=N,this._floorTexture.wrapT=N,this._floorTexture.repeat.set(100/e,100/t));let i=_.createMeshStandardMaterial({map:this._floorTexture,side:Z});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,s){return this._width=t,this._height=i,this._repeatable=s,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=l(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let n=[];e.forEach(e=>{n.push(m(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=u();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}e("F",Ee),i([s],Ee.prototype,"_rapiAccess",void 0),i([s],Ee.prototype,"_dataSyncer",void 0);const De=Math.PI/4;class Ie extends Se{constructor(e,t,i,s){super(e,t,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=a(-60),this.maxPolarAngle=a(60),this._camera=s||new E,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new M,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new R,this._pitch=0,this._yaw=0;let n=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*De*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*De*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=r(t,s.position),a=g(i,s.quaternion);if(!t||n&&a)return!1;let o=this.getCamera().position.clone(),h=Math.min(10*e,1);o.lerp(t,h),this.getCamera().position.copy(o);let d=this.getCamera().quaternion.clone(),c=Math.min(5*e,1);d.slerp(i,c),this.getCamera().setRotationFromQuaternion(d);let _=!1;return this._keyMap.forEach(e=>{e&&(_=!0)}),_&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new D(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new D(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){p(this._downPosition,this._position)<v&&1===this._state&&(this._state=2,this._orbit(new D(this._position.x,this._position.y)),this._moveForward())}_update(e){let t=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(t)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new M(0,0,0),s=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1*t),e.get(68)&&(i.x=1*t),e.get(37)&&(this._rotateHorizontal(-De*this._rotationSpeed*t),s=!0),e.get(39)&&(this._rotateHorizontal(De*this._rotationSpeed*t),s=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new M(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1*i),(e.get(83)||e.get(40))&&(t.z=1*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),o(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){super.cleanUp(),this._removeInputListener()}}e("c",Ie);class ke extends Me{constructor(e,t,i,s,n){if(super(e,t),this._color=i,this._oldBackground=e.background,s&&n){this._canvas=s,this._style=document.createElement("style");let e='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}e("B",ke);class Te{parse(e,t,i,s,n){let a=JSON.parse(s);return a.environment?this.load(e,t,i,a,n):null}load(e,t,i,s,n){let a,r=s.environment;if(!r)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(r.type){case"color":a=new Promise(t=>t(new ke(e,i,new q(r.details.color))));break;case"image":a=new Promise(s=>s(new ke(e,i,null,t,r.details.imageUrl)));break;case"floor":a=new Promise(t=>{this._rapiAccess.getMaterial(r.details.material).then(s=>{let a=void 0===r.details.fog||r.details.fog,o=new Ee(e,i,a);o.changeFloorMaterial(s,n).then(()=>{t(o)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(e=>e(i))}return a}}i([s],Te.prototype,"_rapiAccess",void 0);class Re{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new A),this._cameraContainer}}e("L",Re);class Be extends Re{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new M;e.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,t.shadow.camera.top=s/2,t.shadow.camera.bottom=-s/2,t.shadow.camera.left=-s/2,t.shadow.camera.right=s/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(j).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new M;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=t.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=u();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof K&&this._addSpotLightToGUI(e,t),t instanceof W&&this._addAmbientLightToGUI(e,t),t instanceof Y&&this._addDirectionalLightToGUI(e,t),t instanceof V&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(s,"color").onChange(e=>{t.color=new q(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new q(e)}),i.add(s,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},s=e.addFolder(t.name);s.add(t,"visible"),s.add(t,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(e=>{t.color=new q(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new q(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}}i([s],Be.prototype,"_dynamicLightSettingLoader",void 0);var Ae=function(e){X(i,e);var t=J(i);function i(e,s,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:128;if(Q(this,i),s<=0||n<=0||a<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");var r=new $(n,2*a,a);r.scale(1,1,-1);for(var o=r.getAttribute("position"),h=new M,d=0;d<o.count;++d)if(h.fromBufferAttribute(o,d),h.y<0){var c=3*-s/2,_=h.y<c?-s/h.y:1-h.y*h.y/(3*c*c);h.multiplyScalar(_),h.toArray(o.array,3*d)}return o.needsUpdate=!0,t.call(this,r,new ee({map:e,depthWrite:!1}))}return te(i)}(z);class ze extends Me{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new Ae(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=u();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class Oe{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new ie(2,1),s=null!=t?t:new ee({color:12632256,side:Z}),n=new z(i,s);return n.position.z=-.1,e.add(n),n}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,s){const n=[],a=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?n.push(t[e]):a.push(t[e]);const r=n.map(e=>e.uv),o=a.map(e=>e.uv),h=e.filter(e=>!r.includes(e)&&!o.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(r,.01,255),this._createSamplePointsInMap(o,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const d=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(d,.015,16776960);let c=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<c.length&&(c=c.slice(0,s)),this._createCirclesInMap(c,8421376)}_createSamplePointsInMap(e,t,i){const s=new se(t,8,4),n=new ee({color:i});e.forEach(e=>{var t;const i=new z(s,n);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new ee({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const s=new se(e.size,8,4),n=new z(s,i);n.position.copy(this._uvToMapPosition(e.uv)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)})}_createClusterLinesInMap(e,t,i){var s;const n=new ne({color:i}),a=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const s=e[t[0]].uv,n=e[t[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const e=(s.y+n.y)/2,t=s.x<n.x?0:1;a.push(this._uvToMapPosition(new D(t,e))),a.push(this._uvToMapPosition(new D(1-t,e)))}a.push(this._uvToMapPosition(n))}});const r=(new ae).setFromPoints(a),o=new re(r,n);o.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(o)}_uvToMapPosition(e){return new M(2*e.x-1,e.y-.5,0)}}class Fe extends oe{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,s;const n=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,a=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new he({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new de}},vertexShader:Ue,fragmentShader:Ge,blending:ce,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const Ue="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",Ge="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class He{}class qe{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,s;this.needsUpdate=!0,this._lightSources=[],e instanceof He?this.environmentSceneGenerator=e:e instanceof _e?this.cubeTexture=e:e instanceof le&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new qe(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new D(e,0)}_createPmremTexture(e){const t=new Fe(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new y;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new me;const n=new w(!0,!1);n.setSourceTexture(t.environment),Oe.createPlane(this._debugScene,n);const a=this._detectLightSources(e,t.environment);return new Oe(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class Ne extends He{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new Ze({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class Ze extends me{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new ue,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new ge(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new q(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);t%2==0?this._createReflector(e,new D(s,n),3,1,.8,.2):this._createSideLight(e,new D(s,n),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new q(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===t){this._createReflector(e,new D(s,n),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const s=(t-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(e,new D(n,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new D(s,n),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const s=new ee;return s.color.set(e,null!=t?t:e,null!=i?i:e),s}_createTopLight(e,t,i){const s=new z(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),e.add(s)}_createSideLight(e,t,i,s,n,a,r){for(let o=0;o<3;o++){const h=s*this._sideLightIntensity,d=new z(this._lightGeometry,this._createAreaLightMaterial((o+i)%3==0?h:h*(1-this._colorVariation),(o+i)%3==1?h:h*(1-this._colorVariation),(o+i)%3==2?h:h*(1-this._colorVariation))),c=(1===o?-t.y:2===o?t.y:0)/Math.sqrt(2),_=0===o?0:1,l=(1===o?t.x:2===o?-t.x:0)/Math.sqrt(2);d.position.set(t.x*r*15+1.1*c*n,15*a+1.1*_*n,t.y*r*15+1.1*l*n),d.rotation.set(0,Math.atan2(t.x,t.y),0),d.scale.setScalar(n),e.add(d)}}_createReflector(e,t,i,s,n,a){const r=new z(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));r.position.set(15*t.x,10*a,15*t.y),r.scale.set(10*s,10*n,10*s),e.add(r)}}class je{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,s){this._depthWriteMaterial=new ee({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new pe,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(ve(s),t),this._setupScene(t,!1),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&(this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this.cameraBehaviour.cameraControl instanceof Ie&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener))),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof Ie&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof Be&&this.cameraBehaviour.cameraControl.getCamera()instanceof E&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof Pe&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i;const{x:s,y:n}=this._domHelper.getClientDimensions();this._scene=new me,this._uiScene=new me,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new ye({antialias:!this._globalInitData.e2e,alpha:!0});const a=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(a),this._renderer.setSize(s,n),this._renderer.outputColorSpace=we,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=fe,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new f(this._renderer,s,n),this._roomleRenderer.setQualityMap(C),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(i=this._roomleRenderer)||void 0===i||i.setSize(s,n)),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight;this._scene.userData.environmentDefinition=new qe(new Ne({type:e}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e;this._scene.environment=i,this._scene.userData.environmentDefinition=new qe(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof ze&&this._environment.updateEnvironmentTexture(i),t!==b||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,s),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{S(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,s,n,a,r){return new Promise((o,h)=>{this._staticItemLoader.loadGLTF(e,t,i,s,n,a,null,r).then(e=>{o(e.scene)},h)})}_loadGLB(e,t,i,s,n,a,r,o){return new Promise((h,d)=>{this._staticItemLoader.loadGLB(e,t,i,s,n,a,r,o).then(e=>{h(e.scene)},d)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=u(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())}_guiLoaded(){let e=u();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){t.import("./stats-helper-048249dd.legacy.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new Te).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new Be(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,s)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},s)})}setBackgroundColor(e){this._setEnvironment(new ke(this._scene,this._environment,new q(e)))}setBackgroundImage(e){this._setEnvironment(new ke(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new Be(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const i=x.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var s;if(!e)return;const n=null!=t?t:e;this.updateEnvironment(n,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(s=this._roomleRenderer)||void 0===s||s.updateBounds(n),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),s=i||i;return(null==s?void 0:s.offset)?JSON.parse(JSON.stringify(s.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=5;let s=t.x/t.y*i,n=i;const a=P();this._orthographicOffsetCamera=a.createOrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new M(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,s=t.y,n=P();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new M);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new M),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{const s=this._renderer.domElement.toDataURL("image/jpeg",1),{left:n,right:a,top:r,bottom:o}=this.getCameraOffset(),h=a-n,d=r-o;if(1===h&&1===d)return Ce(e,s),this._onAfterRender=()=>{},void t();const c=new Image;c.src=s,c.onload=()=>{const{naturalWidth:i,naturalHeight:s}=c,a=document.createElement("canvas");a.width=i*h,a.height=s*d;const o=a.getContext("2d"),_=i*n*-1,l=s*(1-r)*-1;o.drawImage(c,_,l),o.save(),Ce(e,a.toDataURL("image/jpeg",1)),t(),this._onAfterRender=()=>{}},c.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,s){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}}e("S",je),i([s],je.prototype,"_domHelper",void 0),i([s],je.prototype,"_scriptLoader",void 0),i([s],je.prototype,"_lifeCycleManager",void 0),i([s],je.prototype,"_staticItemLoader",void 0),i([s],je.prototype,"_hdrEnvironmentLoader",void 0),i([s],je.prototype,"_initData",void 0),i([s],je.prototype,"_globalInitData",void 0),i([s],je.prototype,"_idbManager",void 0),i([s],je.prototype,"_pluginSystem",void 0),i([s],je.prototype,"_imageRenderer",void 0),i([s],je.prototype,"_cameraBehaviourState",void 0),e("b",class{constructor(e,t){return this._debug=!1,this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,this._debug?be(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}})}}}));
|
|
2
|
+
//# sourceMappingURL=camera-behaviour-529c19c2.legacy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-behaviour-
|
|
1
|
+
{"version":3,"file":"camera-behaviour-529c19c2.legacy.js","sources":["../../../packages/three-build/src/Tween.js","../../../node_modules/three/examples/jsm/objects/GroundedSkybox.js","../../../packages/common-core/public/textures/env/legacy_env.exr","../../../packages/common-core/public/textures/env/default_1k.exr"],"sourcesContent":["export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, MeshBasicMaterial, SphereGeometry, Vector3 } from 'three';\n\n/**\n * A ground-projected skybox. The height is how far the camera that took the photo was above the ground - \n * a larger value will magnify the downward part of the image. By default the object is centered at the camera, \n * so it is often helpful to set skybox.position.y = height to put the ground at the origin. Set the radius \n * large enough to ensure your user's camera stays inside.\n */\n\nclass GroundedSkybox extends Mesh {\n\n\tconstructor( map, height, radius, resolution = 128 ) {\n\n\t\tif ( height <= 0 || radius <= 0 || resolution <= 0 ) {\n\n\t\t\tthrow new Error( 'GroundedSkybox height, radius, and resolution must be positive.' );\n\n\t\t}\n\n\t\tconst geometry = new SphereGeometry( radius, 2 * resolution, resolution );\n\t\tgeometry.scale( 1, 1, -1 );\n\n\t\tconst pos = geometry.getAttribute( 'position' );\n\t\tconst tmp = new Vector3();\n\n\t\tfor ( let i = 0; i < pos.count; ++ i ) {\n\n\t\t\ttmp.fromBufferAttribute( pos, i );\n\t\t\tif ( tmp.y < 0 ) {\n\n\t\t\t\t// Smooth out the transition from flat floor to sphere:\n\t\t\t\tconst y1 = - height * 3 / 2;\n\t\t\t\tconst f =\n\t\t\t\t\t\ttmp.y < y1 ? - height / tmp.y : ( 1 - tmp.y * tmp.y / ( 3 * y1 * y1 ) );\n\t\t\t\ttmp.multiplyScalar( f );\n\t\t\t\ttmp.toArray( pos.array, 3 * i );\n\n\t\t\t}\n\n\t\t}\n\n\t\tpos.needsUpdate = true;\n\n\t\tsuper( geometry, new MeshBasicMaterial( { map, depthWrite: false } ) );\n\n\t}\n\n}\n\nexport { GroundedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\"","export default \"static/default_1k-2aa6d42244d30fb1.exr\""],"names":["exports","GroundedSkybox","_Mesh","_inherits","_super","_createSuper","map","height","radius","resolution","arguments","length","undefined","_classCallCheck","Error","geometry","SphereGeometry","scale","pos","getAttribute","tmp","Vector3","i","count","fromBufferAttribute","y","y1","f","multiplyScalar","toArray","array","needsUpdate","call","this","MeshBasicMaterial","depthWrite","_createClass","Mesh"],"mappings":"g3BAAAA,EAAA,IAAe,+q9BCEf,IAOMC,YAAcC,GAAAC,EAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GAEnB,SAAAA,EAAaK,EAAKC,EAAQC,GAA2B,IAAnBC,EAAUC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,IAE9C,GAFiDG,OAAAZ,GAE5CM,GAAU,GAAKC,GAAU,GAAKC,GAAc,EAEhD,MAAM,IAAIK,MAAO,mEAIlB,IAAMC,EAAW,IAAIC,EAAgBR,EAAQ,EAAIC,EAAYA,GAC7DM,EAASE,MAAO,EAAG,GAAI,GAKvB,IAHA,IAAMC,EAAMH,EAASI,aAAc,YAC7BC,EAAM,IAAIC,EAENC,EAAI,EAAGA,EAAIJ,EAAIK,QAAUD,EAGlC,GADAF,EAAII,oBAAqBN,EAAKI,GACzBF,EAAIK,EAAI,EAAI,CAGhB,IAAMC,EAAgB,GAATnB,EAAa,EACpBoB,EACJP,EAAIK,EAAIC,GAAOnB,EAASa,EAAIK,EAAM,EAAIL,EAAIK,EAAIL,EAAIK,GAAM,EAAIC,EAAKA,GACnEN,EAAIQ,eAAgBD,GACpBP,EAAIS,QAASX,EAAIY,MAAO,EAAIR,GAMP,OAAvBJ,EAAIa,aAAc,EAAK3B,EAAA4B,KAAAC,KAEhBlB,EAAU,IAAImB,GAAmB,CAAE5B,IAAAA,EAAK6B,YAAY,KAE3D,OAAAC,GAAAnC,IApC2BoC,6igBCTd,g6CCAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-dimensioning-
|
|
1
|
+
System.register(["./roomle-dependency-injection-32a7ed2e.legacy.js","./main-thread-to-worker-63c62382.legacy.js","./TextGeometry-8862f872.legacy.js"],(function(e){var i,t,n,s,o,a,h,_,d,l,r,g,c,m,w,p;return{setters:[function(e){i=e._,t=e.i},function(e){n=e.O,s=e.a,o=e.y,a=e.k,h=e.E,_=e.bx,d=e.B,l=e.N,r=e.J,g=e.b,c=e.Q,m=e.ba,w=e.bm},function(e){p=e.T}],execute:function(){const y="component_dimensioning_line_material",x="component_dimensioning_plane_material",u="component_dimensioning_text_material";class v extends n{constructor(e,i,t,n){super(),this._center=i.getCenter(new s),this._size=i.getSize(new s),this._origin=this._center.clone().sub(this._size.clone().multiplyScalar(.5)),this._dimensioning=e,this._level=this._dimensioning.maxLevel-this._dimensioning.level,this._font=t,this._cameraPosition=n,this._init()}_initMaterials(){this._cacheHolder.materialCache.has(y)?this._lineMaterial=this._cacheHolder.materialCache.get(y):(this._lineMaterial=new o({color:3618615}),this._cacheHolder.materialCache.set(y,this._lineMaterial)),this._cacheHolder.materialCache.has(x)?this._planeMaterial=this._cacheHolder.materialCache.get(x):(this._planeMaterial=new a({color:16777215,side:h,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(x,this._planeMaterial)),this._cacheHolder.materialCache.has(u)?this._textMaterial=this._cacheHolder.materialCache.get(u):(this._textMaterial=new _({color:3618615}),this._cacheHolder.materialCache.set(u,this._textMaterial))}_init(){this._initMaterials();let e=new d;this._line=new l(e,this._lineMaterial),this._line.name="component dimension line "+this._dimensioning.type.value,this._text=new r(e,this._textMaterial),this._text.name="component dimension text "+this._dimensioning.type.value,this._plane=new r(e,this._planeMaterial),this._plane.name="component dimension plane "+this._dimensioning.type.value;let i,t=new d,n=Math.round(Math.max(this._size.y,this._size.x,this._size.z)),o=Math.abs(this._dimensioning.to-this._dimensioning.from),a=.025+(n<4?0:.005*n);o<.3&&(a*=.5+o);let h={font:this._font,size:a,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},_=this._dimensioning.label?this._dimensioning.label:this._unitFormatter.formatMMValueToUnitString(1e3*o),m=new p(_,h);m.computeBoundingBox();let w=m.boundingBox.getSize(new s).y;0===this._dimensioning.type.value&&(i=this._getXEdge(w),this._addXEdgeSideLines(w)),1===this._dimensioning.type.value&&(i=this._getYEdge(w),this._addYEdgeSideLines(w)),2===this._dimensioning.type.value&&(i=this._getZEdge(w),this._addZEdgeSideLines(w));let y=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];if(t.setAttribute("position",new g(new Float32Array(y),3)),this._line.geometry.dispose(),this._line.geometry=t,this.add(this._line),this._text.geometry=m,0===this._dimensioning.type.value&&this._addText(i,m,new c,new s(0,.04,0)),1===this._dimensioning.type.value){let e=new c,t=this._getXSign()>0?Math.PI/2:Math.PI/2*3;e.setFromAxisAngle(new s(0,0,1),t),this._addText(i,m,e,new s(.04,0,0))}if(2===this._dimensioning.type.value){let e=this._getXSign()>0?Math.PI/2:Math.PI/2*3,t=(new c).setFromAxisAngle(new s(-1,0,0),Math.PI/2),n=(new c).setFromAxisAngle(new s(0,0,1),e);this._addText(i,m,t.multiply(n),new s(.04,0,0))}}_getXEdge(e){let i=this._size.y+.05+(.06+e)*this._level;const t=new s(0,this._origin.y,this._origin.z);let n=t.clone().add(new s(this._dimensioning.from,i,0)),o=t.clone().add(new s(this._dimensioning.to,i,0));return new m(n,o)}_addXEdgeSideLines(e){let i=this._size.y+.05+(.06+e)*(this._level-.5),t=this._size.y+.05+(.06+e)*this._level;const n=new s(0,this._origin.y,this._origin.z);let o=n.clone().add(new s(this._dimensioning.from,i,0)),a=n.clone().add(new s(this._dimensioning.from,t,0)),h=n.clone().add(new s(this._dimensioning.to,i,0)),_=n.clone().add(new s(this._dimensioning.to,t,0));this._addLine(o,a),this._addLine(h,_)}_getZEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new s(this._origin.x,this._origin.y,0);let n=t.clone().add(new s(i,0,this._dimensioning.from)),o=t.clone().add(new s(i,0,this._dimensioning.to));return new m(n,o)}_addZEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const o=new s(this._origin.x,this._origin.y,0);let a=o.clone().add(new s(t,0,this._dimensioning.from)),h=o.clone().add(new s(n,0,this._dimensioning.from)),_=o.clone().add(new s(t,0,this._dimensioning.to)),d=o.clone().add(new s(n,0,this._dimensioning.to));this._addLine(a,h),this._addLine(_,d)}_getYEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new s(this._origin.x,0,this._origin.z);let n=t.clone().add(new s(i,this._dimensioning.from,0)),o=t.clone().add(new s(i,this._dimensioning.to,0));return new m(n,o)}_addYEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const o=new s(this._origin.x,0,this._origin.z);let a=o.clone().add(new s(t,this._dimensioning.from,0)),h=o.clone().add(new s(n,this._dimensioning.from,0)),_=o.clone().add(new s(t,this._dimensioning.to,0)),d=o.clone().add(new s(n,this._dimensioning.to,0));this._addLine(a,h),this._addLine(_,d)}_addLine(e,i){let t=new d,n=[e.x,e.y,e.z,i.x,i.y,i.z];t.setAttribute("position",new g(new Float32Array(n),3)),this.add(new l(t,this._lineMaterial))}_addText(e,i,t,n){let o=e.getCenter(new s);n.x*=this._getXSign(),o.add(n);let a=i.boundingBox.getSize(new s);i.center(),this._text.position.copy(o),this._text.quaternion.copy(t),this.add(this._text);let h=new w(a.x+.02,a.y+.02,32);h.center(),this._plane.geometry=h,this._plane.position.copy(o),this._plane.quaternion.copy(t),this.add(this._plane)}_getXSign(){return this._cameraPosition.x>=0?1:-1}}e("default",v),i([t],v.prototype,"_cacheHolder",void 0),i([t],v.prototype,"_unitFormatter",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=component-dimensioning-480dad60.legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-dimensioning-480dad60.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./main-thread-to-worker-63c62382.legacy.js","./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-raycast-helper-
|
|
1
|
+
System.register(["./main-thread-to-worker-63c62382.legacy.js","./roomle-dependency-injection-32a7ed2e.legacy.js"],(function(e){var t,i,a,n,s,r,c,o,l;return{setters:[function(e){t=e.bK,i=e.bY,a=e.J,n=e.z,s=e.ak,r=e.a,c=e.av,o=e.o},function(e){l=e.aa}],execute:function(){e("default",class{constructor(){this._nonTransparentComponent=null,this._raycaster=new t,this._raycaster.near=.1,this._raycaster.layers.enable(3),this._raycaster.layers.enable(4),this._raycaster.layers.enable(5),this._raycaster.layers.enable(6)}init(e,t){this._object=e,this._camera=t,this.checkComponentVisibility=i(this.checkComponentVisibility,100).bind(this),this.checkPreviewVisibility=i(this.checkPreviewVisibility,100).bind(this)}setCamera(e){this._camera=e}setObject(e){this._object=e}changeMaterialsOnSelect(e,t,i=!1){t!==this._nonTransparentComponent&&(this._nonTransparentComponent=t,this._changeMaterialsOnSelect(e,t,i))}_changeMaterialsOnSelect(e,t,i=!1){if(e.children.length>0&&e.children.forEach(n=>{const s=t&&e.id===t.id||i,r=!(n instanceof a);this._changeMaterialsOnSelect(n,t,(!s||!r)&&s)}),t)e instanceof a&&e.material instanceof n&&!e.userData.oldMaterial&&(e.userData.oldMaterial=e.material,e.material=e.material.clone(),i||l(e,{opacity:.2,transparent:!0}));else if(e.userData.oldMaterial&&e instanceof a&&e.material instanceof n){const{opacity:t,transparent:i}=e.userData.oldMaterial;l(e,{opacity:t,transparent:i}),e.userData.oldMaterial=void 0}}isComponentVisible(e){const t=[];e.traverse(e=>t.push(e.uuid));const i=(new s).setFromObject(e).getCenter(new r),a=(new r).subVectors(i,this._camera.position).normalize();this._raycaster.set(this._camera.position,a),this._raycaster.far=this._camera.position.distanceTo(i);const n=[];return this._raycaster.intersectObjects(this._object.children,!0).forEach(e=>{e.object.material.visible&&(t.includes(e.object.uuid)||e.object.userData.ignoreComponentRaycast||n.push(e))}),0===n.length}checkComponentAndPreviewVisibility(e,t){e.hasSelection()?this.checkComponentVisibility(e,t):t.hasPreviews()?this.checkPreviewVisibility(t):this.changeMaterialsOnSelect(this._object,null)}checkComponentVisibility(e,t){if(!e.hasSelection())return;const i=t.getComponentsForIds(e.getSelectedRuntimeComponentIds());if(i.length>1)return;const a=i[0];this.isComponentVisible(a)?this.changeMaterialsOnSelect(this._object,null):this.changeMaterialsOnSelect(this._object,a)}areAllPreviewsVisible(e){if(!e.hasPreviews())return!0;const t=e.getPreviews();return 0===t.length||t.map(e=>this.isComponentVisible(e)).reduce((e,t)=>e&&t)}areAllComponentsInFrustum(e){if(0===e.length)return!0;const t=new c,i=(new o).multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse),a=new s;return t.setFromProjectionMatrix(i),e.map(e=>(e=>{const i=a.setFromObject(e).getCenter(new r);return t.containsPoint(i)})(e)).reduce((e,t)=>e&&t)}checkPreviewVisibility(e){e.hasPreviewLines()||(this.areAllPreviewsVisible(e)?this.changeMaterialsOnSelect(this._object,null):this.changeMaterialsOnSelect(this._object,{id:-1}))}})}}}));
|
|
2
|
+
//# sourceMappingURL=component-raycast-helper-a732cc57.legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-raycast-helper-a732cc57.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./script-loader-
|
|
2
|
-
//# sourceMappingURL=configurator-
|
|
1
|
+
System.register(["./script-loader-d14aa469.legacy.js","./roomle-dependency-injection-32a7ed2e.legacy.js","./camera-behaviour-529c19c2.legacy.js","./component-raycast-helper-a732cc57.legacy.js","./roomle-configurator-35ccd5e3.legacy.js","./query-params-helper-a1e70858.legacy.js","./main-thread-to-worker-63c62382.legacy.js","./default-light-setting-e546d92d.legacy.js"],(function(e){var n,o,t,c,a,r,i,s,l,u,p,g,d,h;return{setters:[function(e){n=e.S,o=e.M},function(e){t=e.D,c=e.L,a=e.R,r=e.a,i=e.C,s=e.b,l=e.A},function(e){u=e.C,p=e.a},function(e){g=e.default},function(e){d=e.C,h=e.R},function(){},function(){},function(){}],execute:function(){const f=[new t("logger",c),new t("rapi-access",a),new t("script-loader",n),new t("camera-control-3d",u),new t("camera-control",p),new t("data-syncer",r),new t("configurator-scene-manager",d,1),new t("configurator-view-model",i,1),new t("component-raycast-helper",g,0)];e("Configurator",class extends o{setupDependencies(){s.setup(f),this.lookup("planner-kernel-access",this._context).init(1),this.lookup("rapi-access",this._context),this.lookup("script-loader",this._context),this.lookup("logger",this._context)}cleanUpGlobals(){delete window.RoomleConfigurator}cleanUpDependencies(){const e=this.lookup("script-loader"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};l.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new h(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
|
|
2
|
+
//# sourceMappingURL=configurator-0ee3fb6e.legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurator-0ee3fb6e.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./configurator-
|
|
1
|
+
System.register(["./configurator-0ee3fb6e.legacy.js","./script-loader-d14aa469.legacy.js","./query-params-helper-a1e70858.legacy.js","./main-thread-to-worker-63c62382.legacy.js","./roomle-dependency-injection-32a7ed2e.legacy.js","./camera-behaviour-529c19c2.legacy.js","./component-raycast-helper-a732cc57.legacy.js","./roomle-configurator-35ccd5e3.legacy.js","./default-light-setting-e546d92d.legacy.js"],(function(){var e;return{setters:[function(c){e=c.Configurator},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let c=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-c))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
|
|
2
2
|
//# sourceMappingURL=configurator-main.legacy.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=continuous-drawing-helper-
|
|
1
|
+
System.register(["./roomle-dependency-injection-32a7ed2e.legacy.js","./main-thread-to-worker-63c62382.legacy.js"],(function(e){var i,t,r,s,n;return{setters:[function(e){i=e.ad},function(e){t=e.bc,r=e.k,s=e.E,n=e.J}],execute:function(){e("default",class{constructor(){this._currentInnerRadius=0}init(e,i,t){this._drawingGroup=e,this._continuousDrawingManager=i,this._kernelZoomFactor=t,this.update()}update(){this._initCircle(),this._updateCircle()}_initCircle(){if(this._circleMesh)return;const e=70/this._kernelZoomFactor/1e3,i=new t(e,e+e/50,32),c=new r({color:10066329,side:s});this._circleMesh=new n(i,c),this._circleMesh.name="Circle",this._circleMesh.rotation.set(Math.PI/2,0,0),this._circleMesh.visible=this._continuousDrawingManager.shouldShowCircle(),this._drawingGroup.add(this._circleMesh)}_updateCircle(){if(!this._circleMesh)return;const e=70/this._kernelZoomFactor/1e3;if(e!==this._currentInnerRadius){const i=e+e/50;this._circleMesh.geometry=new t(e,i,32)}const r=i(this._continuousDrawingManager.getStartPoint());r.y=5,this._circleMesh.position.copy(r),this._circleMesh.visible=this._continuousDrawingManager.shouldShowCircle(),this._currentInnerRadius=e}setKernelZoomFactor(e){this._kernelZoomFactor=e}endDrawing(){this._drawingGroup.remove(this._circleMesh),this._circleMesh=null}})}}}));
|
|
2
|
+
//# sourceMappingURL=continuous-drawing-helper-1c6ee6c9.legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuous-drawing-helper-1c6ee6c9.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./camera-behaviour-
|
|
2
|
-
//# sourceMappingURL=default-light-setting-
|
|
1
|
+
System.register(["./camera-behaviour-529c19c2.legacy.js","./roomle-dependency-injection-32a7ed2e.legacy.js","./main-thread-to-worker-63c62382.legacy.js"],(function(i){var t,a,e,n,o,s,h;return{setters:[function(i){t=i.L},function(i){a=i.a1},function(i){e=i.D,n=i.C,o=i.V,s=i.a,h=i.A}],execute:function(){i("D",class extends t{constructor(i,t){super(i,t),this._params={ambientLight:{color:"#ffffff"},mainDirLight:{position:{x:-3,y:4,z:4},color:"#ffffff"},secondDirLight:{position:{x:3,y:4,z:3},color:"#ffffff"}},this._mainDirectionalLight=new e(new n(this._params.mainDirLight.color),.8),this._mainDirectionalLight.position.set(this._params.mainDirLight.position.x,this._params.mainDirLight.position.y,this._params.mainDirLight.position.z),this._mainDirectionalLight.layers.set(1),this._mainDirectionalLight.castShadow=!0,this._mainDirectionalLight.shadow.camera.near=.1,this._mainDirectionalLight.shadow.camera.far=100,this._mainDirectionalLight.shadow.mapSize=new o(1024,1024),this._mainDirectionalLight.visible=!0,this._mainDirectionalLight.lookAt(new s(0,0,0)),this._secondDirectionalLight=new e(new n(this._params.secondDirLight.color),.2),this._secondDirectionalLight.position.set(this._params.secondDirLight.position.x,this._params.secondDirLight.position.y,this._params.secondDirLight.position.z),this._secondDirectionalLight.layers.set(1),this._secondDirectionalLight.castShadow=!1,this._secondDirectionalLight.shadow.camera.near=.1,this._secondDirectionalLight.shadow.camera.far=100,this._secondDirectionalLight.shadow.mapSize=new o(1024,1024),this._secondDirectionalLight.visible=!0,this._secondDirectionalLight.lookAt(new s(0,0,0)),this._ambientLight=new h(new n(this._params.ambientLight.color),.5),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!0}updateBounds(i){const t=i.getSize(new s),a=Math.max(Math.max(t.x,t.y),t.z)+1,e=a/2;this._mainDirectionalLight.shadow.camera.top=e,this._mainDirectionalLight.shadow.camera.bottom=-e,this._mainDirectionalLight.shadow.camera.left=-e,this._mainDirectionalLight.shadow.camera.right=e,this._mainDirectionalLight.shadow.camera.near=.01,this._mainDirectionalLight.shadow.camera.far=4*a,this._mainDirectionalLight.shadow.camera.updateProjectionMatrix(),this._secondDirectionalLight.shadow.camera.top=e,this._secondDirectionalLight.shadow.camera.bottom=-e,this._secondDirectionalLight.shadow.camera.left=-e,this._secondDirectionalLight.shadow.camera.right=e,this._secondDirectionalLight.shadow.camera.near=.01,this._secondDirectionalLight.shadow.camera.far=4*a,this._secondDirectionalLight.shadow.camera.updateProjectionMatrix()}addToScene(){this._scene.add(this._mainDirectionalLight),this._scene.add(this._secondDirectionalLight),this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._mainDirectionalLight),this._scene.remove(this._secondDirectionalLight),this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let i=a();if(i){if(this._ambientLight){let t=i.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(i=>this._ambientLight.color=new n(i))}if(this._mainDirectionalLight){let t=i.addFolder("Main Directional Light");t.add(this._mainDirectionalLight,"visible"),t.add(this._mainDirectionalLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirectionalLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(i=>this._mainDirectionalLight.color=new n(i)),t.add(this._mainDirectionalLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._mainDirectionalLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._mainDirectionalLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0)))}if(this._secondDirectionalLight){let t=i.addFolder("Second Directional Light");t.add(this._secondDirectionalLight,"visible"),t.add(this._secondDirectionalLight,"intensity").min(0).max(10).step(.1),t.add(this._secondDirectionalLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(i=>this._mainDirectionalLight.color=new n(i)),t.add(this._secondDirectionalLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._secondDirectionalLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._secondDirectionalLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0)))}}}})}}}));
|
|
2
|
+
//# sourceMappingURL=default-light-setting-e546d92d.legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-light-setting-e546d92d.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/lib/legacy/{dimensioning-helper-d2bd342f.legacy.js → dimensioning-helper-d367a9ae.legacy.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=dimensioning-helper-
|
|
1
|
+
System.register(["./roomle-dependency-injection-32a7ed2e.legacy.js","./main-thread-to-worker-63c62382.legacy.js","./TextGeometry-8862f872.legacy.js"],(function(t){var i,e,s,n,h,o,a,_,d,r,p,m,l,c,x,g,u,w,b,y,T,L,G;return{setters:[function(t){i=t.aG,e=t.w,s=t._,n=t.i,h=t.ah,o=t.aH,a=t.ad},function(t){_=t.O,d=t.a,r=t.k,p=t.E,m=t.bx,l=t.B,c=t.J,x=t.Q,g=t.bm,u=t.X,w=t.y,b=t.N,y=t.b,T=t.ba,L=t.ak},function(t){G=t.T}],execute:function(){const z="component_dimensioning_plane_material",M="component_dimensioning_text_material";class j extends _{constructor(t){super(),this._label="",this._parameters={font:null,size:.1,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},this.topDown=!1,this._parameters.font=t,this._position=new d,this._initMaterials(),this._init(),this._update()}_initMaterials(){this._cacheHolder.materialCache.has(z)?this._planeMaterial=this._cacheHolder.materialCache.get(z):(this._planeMaterial=new r({color:16777215,side:p,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(z,this._planeMaterial)),this._cacheHolder.materialCache.has(M)?this._textMaterial=this._cacheHolder.materialCache.get(M):(this._textMaterial=new m({color:3618615}),this._cacheHolder.materialCache.set(M,this._textMaterial))}_init(){let t=new l;this._text=new c(t,this._textMaterial),this._text.userData.ignoreComponentRaycast=!0,this._text.name="text with background text "+this._label,this._plane=new c(t,this._planeMaterial),this._plane.userData.ignoreComponentRaycast=!0,this._plane.name="text with background plane "+this._label,this._textGeometry=new G(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this.add(this._text),this.add(this._plane)}update(t,i,e){this._position.copy(t),this._cameraPosition=e,this._label=i;const s=this.getWorldPosition(new d),n=this._cameraPosition.distanceTo(s),h=Math.max(.01,n/150),o=Math.max(5e-4,n/5e3);this._parameters.bevelThickness=o,this._parameters.bevelSize=o,this._parameters.size=h,this._textGeometry=new G(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this._update()}_update(){if(this.topDown){let t=new x;t.setFromAxisAngle(new d(-1,0,0),Math.PI/2),this._updateText(this._textGeometry,t,new d)}else if(this._updateText(this._textGeometry,new x,new d),this._cameraPosition){const t=this.getWorldPosition(new d),e=i(Math.atan2(this._cameraPosition.x-t.x,this._cameraPosition.z-t.z)-this.parent.rotation.y);this._text.rotation.y=e,this._plane.rotation.y=e}}_updateText(t,i,e){let s=new d;s.copy(this._position),e.x*=this._getXSign(),s.add(e);let n=t.boundingBox.getSize(new d);t.center(),this._text.position.copy(s),i&&this._text.quaternion.copy(i);let h=new g(n.x+.02,n.y+.02,32);h.center(),this._plane.geometry=h,this._plane.position.copy(s),i&&this._plane.quaternion.copy(i)}_getXSign(){return!this._cameraPosition||this._cameraPosition.x>=0?1:-1}dispose(){e(this)}}s([n],j.prototype,"_cacheHolder",void 0);class D{constructor(t){this._objectRotation=0,this._cameraPosition=new d,this._topDimensions=!1,this._initialized=new h,this._enabled=!1,this._dimensionsVisible=!1,this._dimensionLineGroup=new u,this._dimensionTextGroup=new _,this._creator_=t,this._lineMaterial=new w({color:3618615,linewidth:2});let i=new l;this._widthLine=new b(i,this._lineMaterial),this._widthLine.userData.ignoreComponentRaycast=!0,this._widthLine.name="dimension width line",this._dimensionLineGroup.add(this._widthLine),this._heightLine=new b(i,this._lineMaterial),this._heightLine.userData.ignoreComponentRaycast=!0,this._heightLine.name="dimension height line",this._dimensionLineGroup.add(this._heightLine),this._depthLine=new b(i,this._lineMaterial),this._depthLine.userData.ignoreComponentRaycast=!0,this._depthLine.name="dimension depth line",this._dimensionLineGroup.add(this._depthLine),this._planeMaterial=new r({color:16777215,side:p,opacity:.8,transparent:!0}),o.loadFont("static/rubik_regular_sub-2dd2d5cca49018c5.json").then(t=>{this._font=t,this._loaded()})}_loaded(){this.update(!1),this.addToObject(this._object),this.addToUiScene(this._uiScene),this._initialized.resolve()}_performUpdate(t){this._enabled&&(this._dimensions||t)&&this._font&&(this._updateHeight(),this._updateWidth(),this._updateDepth())}_updateWidth(){let t=new l,i=this._getWidthEdge(),e=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];t.setAttribute("position",new y(new Float32Array(e),3)),this._widthLine.geometry.dispose(),this._widthLine.geometry=t;let s=i.getCenter(new d);this._widthText||(this._widthText=new j(this._font),this._dimensionTextGroup.add(this._widthText)),this._widthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.x);this._widthText.update(s,n,this._cameraPosition)}_updateHeight(){let t=new l,i=this._getHeightEdge(),e=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];t.setAttribute("position",new y(new Float32Array(e),3)),this._heightLine.geometry.dispose(),this._heightLine.geometry=t;let s=i.getCenter(new d);this._heightText||(this._heightText=new j(this._font),this._dimensionTextGroup.add(this._heightText)),this._heightText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.y);this._heightText.update(s,n,this._cameraPosition)}_updateDepth(){let t=new l,i=this._getDepthEdge(),e=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];t.setAttribute("position",new y(new Float32Array(e),3)),this._depthLine.geometry.dispose(),this._depthLine.geometry=t;let s=i.getCenter(new d);this._depthText||(this._depthText=new j(this._font),this._dimensionTextGroup.add(this._depthText)),this._depthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(-1e3*this._dimensions.z);this._depthText.update(s,n,this._cameraPosition)}updateSize(t){this._origin=a(t.origin),this._dimensionLineGroup.position.x=this._origin.x-this._object.position.x,this._dimensionLineGroup.position.y=this._origin.y-this._object.position.y,this._dimensionLineGroup.position.z=this._origin.z-this._object.position.z,this._dimensions=a(t.size);const i=this._dimensionLineGroup.localToWorld(new d);this._dimensionTextGroup.position.copy(i),this.update()}update(t=!1){this._enabled&&!this._dimensionsVisible&&(this._dimensionsVisible=!0,this._visibilityChangedCallback()),this._performUpdate(t)}addToObject(t){this._widthText&&this._widthLine&&this._heightText&&this._heightLine&&this._heightText&&this._heightLine&&t.add(this._dimensionLineGroup)}removeFromObject(t){t.remove(this._dimensionLineGroup),this.update()}addToUiScene(t){if(!(this._widthText&&this._heightText&&this._depthText&&this._object))return;const i=this._dimensionLineGroup.localToWorld(new d);this._dimensionTextGroup.position.copy(i),this._dimensionTextGroup.rotation.y=this._objectRotation,t.add(this._dimensionTextGroup),this.update()}removeFromUiScene(t){t.remove(this._dimensionTextGroup),this.update()}_getWidthEdge(){const t=this._getRotation();return t>Math.PI/2||t<-Math.PI/2?new T(new d(-.05,0,this._dimensions.z-.05),new d(this._dimensions.x+.05,0,this._dimensions.z-.05)):new T(new d(-.05,0,.05),new d(this._dimensions.x+.05,0,.05))}_getDepthEdge(){return this._getRotation()>0?new T(new d(.05+this._dimensions.x,0,.05),new d(.05+this._dimensions.x,0,this._dimensions.z-.05)):new T(new d(-.05,0,.05),new d(-.05,0,this._dimensions.z-.05))}_getHeightEdge(){const t=this._getRotation();return t>0&&t<Math.PI/2?new T(new d(-.05,0,.05),new d(-.05,this._dimensions.y+.05,.05)):t>Math.PI/2?new T(new d(-.05,0,this._dimensions.z-.05),new d(-.05,this._dimensions.y+.05,this._dimensions.z-.05)):t<-Math.PI/2?new T(new d(.05+this._dimensions.x,0,this._dimensions.z-.05),new d(.05+this._dimensions.x,this._dimensions.y+.05,this._dimensions.z-.05)):new T(new d(.05+this._dimensions.x,0,.05),new d(.05+this._dimensions.x,this._dimensions.y+.05,.05))}onDimensionsVisibilityChanged(t){this._onChange=t}enableTopDimensions(){this.enableDimensions(),this._topDimensions=!0,this._heightLine.visible=!1,this._heightText.visible=!1,this.update(!0)}disableTopDimensions(){this._topDimensions=!1,this._heightLine.visible=!0,this._heightText.visible=!0,this.disableDimensions()}enableDimensions(){this._enabled=!0,this.update(!0),this.addToUiScene(this._uiScene),this.addToObject(this._object)}disableDimensions(){this._enabled=!1,this._dimensionsVisible&&(this._dimensionsVisible=!1,this._visibilityChangedCallback()),this.removeFromUiScene(this._uiScene),this.removeFromObject(this._object)}_visibilityChangedCallback(){this._onChange&&this._onChange(this._dimensionsVisible)}_clear(){this._lineMaterial.dispose(),this._planeMaterial.dispose(),this._widthLine.geometry.dispose(),this._heightLine.geometry.dispose(),this._depthLine.geometry.dispose(),this._heightText.dispose(),this._heightText.dispose(),this._depthText.dispose()}getBoundingBox(){const t=new L;return t.expandByObject(this._widthLine),t.expandByObject(this._widthText),t.expandByObject(this._heightLine),t.expandByObject(this._heightText),t.expandByObject(this._depthLine),t.expandByObject(this._depthText),t}setVisibility(t){this._dimensionLineGroup&&this._dimensionTextGroup&&(this._dimensionLineGroup.visible=t,this._dimensionTextGroup.visible=t)}moveCameraStart(t){this.setVisibility(!1),this._cameraPosition=t,this.update()}moveCameraEnd(t){this.setVisibility(!0),this._cameraPosition=t,this.update()}clearScene(t){this._clear()}setObject(t,i=0){this._object=t,this._objectRotation=i}setUiScene(t){this._uiScene=t}isInitialized(){return this._initialized.wait()}areDimensionsEnabled(){return this._enabled}_getRotation(){const t=this._object.getWorldPosition(new d);return i(Math.atan2(this._cameraPosition.x-t.x,this._cameraPosition.z-t.z)-this._objectRotation)}}t("default",D),s([n],D.prototype,"_unitFormatter",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=dimensioning-helper-d367a9ae.legacy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimensioning-helper-
|
|
1
|
+
{"version":3,"file":"dimensioning-helper-d367a9ae.legacy.js","sources":["../../../packages/configurator-core/public/fonts/rubik_regular_sub.json"],"sourcesContent":["export default \"static/rubik_regular_sub-2dd2d5cca49018c5.json\""],"names":[],"mappings":"m4HAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./script-loader-
|
|
2
|
-
//# sourceMappingURL=glb-viewer-
|
|
1
|
+
System.register(["./script-loader-d14aa469.legacy.js","./roomle-dependency-injection-32a7ed2e.legacy.js","./camera-behaviour-529c19c2.legacy.js","./main-thread-to-worker-63c62382.legacy.js","./default-light-setting-e546d92d.legacy.js","./glb-viewer-camera-behaviour-e7544c90.legacy.js","./query-params-helper-a1e70858.legacy.js"],(function(e){var t,r,i,a,n,s,o,h,c,l,d,u,_,m,g,p,w,v,b,f,C,S,L,B,y,M,I,x,G,j,E,O,F;return{setters:[function(e){t=e.S,r=e.M},function(e){i=e.aw,a=e.D,n=e.L,s=e.R,o=e.a1,h=e._,c=e.i,l=e.m,d=e.q,u=e.r,_=e.w,m=e.b},function(e){g=e.C,p=e.L,w=e.S,v=e.T},function(e){b=e.a,f=e.ak,C=e.ap,S=e.Q,L=e.A,B=e.C,y=e.aN,M=e.a$,I=e.bJ,x=e.l,G=e.bz,j=e.Y,E=e.bW},function(e){O=e.D},function(e){F=e.G},function(){}],execute:function(){const D=[new a("script-loader",t),new a("glb-input-manager",class extends i{},1),new a("logger",n),new a("rapi-access",s)];class P extends g{constructor(){super(...arguments),this.shouldIgnoreStandardBehavior=!1}adjust(e,t,r,i,a){let n=new b(-e.x/2,0,-e.z/2),s=new b(e.x/2,e.y,e.z/2);this._boundingBox=new f(n,s);let o=new C(-Math.PI/2+i,r,0,"ZYX"),h=(new S).setFromEuler(o);this._camera.updateProjectionMatrix(),this._camera.quaternion.copy(h),this._camera.position.copy(t)}_update(e){this.shouldIgnoreStandardBehavior?this._saveYawAndPitch():super._update(e)}animateCamera(e){return!!this.shouldIgnoreStandardBehavior||super.animateCamera(e)}}class z extends p{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new L(new B(this._params.ambientLight.color),.5),this.addToScene()}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=o();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>{this._ambientLight.color=new B(e)})}}}class A extends w{constructor(e,t){super(e,t,l.GLB,y.CAMERA_3D),this._itemsCount=0,this._standardSceneBackgroundColor=this._scene.background,this._initData.legacyLight&&(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(d.createDynamicLightSettingSource(null,u.CAMERA)):(console.warn("this device has a maximum of 8 texture units thus we are using a simpler light setting"),this._lightSetting=new z(this._scene)))}createCameraControl(e,t){this._changeCameraBehaviour(new F(new P(this._creator_,this._getInputManager(),new b(-1,1,1)),this._cameraBehaviourState))}_getInputManager(){return this._glbInputManager}async loadStaticItem(e,t){const r=await this._rapiAccess.getItem(e);if(r.configuration)return Promise.reject();const i=M(r);return i?this.loadGLB(i,!0,void 0,t):Promise.reject(new Error("GLB Url not detected"))}loadGLB(e,t=!0,r=new b(1,1,1),i){return this.clearScene(),new Promise((a,n)=>{this._loadGLB(e,new b(0,0,0),0,void 0,r,void 0,void 0,i).then(e=>{this._currentGLB=e,this._scene.add(this._currentGLB);let r=(new f).setFromObject(this._currentGLB);t&&this.cameraBehaviour.cameraControl instanceof P&&this.glbViewerCameraBehaviour.updateCameraOnItemLoaded(r),this._updateBounds(r,null,!0),a()},n)})}preparePerspectiveImage(e,t,r){return new Promise(i=>{var a,n;t||(t=1e3),r||(r=1e3),e||((e=new I({antialias:!0})).setSize(t,r),e.outputColorSpace=x,e.autoClear=!1,e.shadowMap.enabled=!0,e.shadowMap.type=G);let s=this.cameraBehaviour.cameraControl.getCamera().clone();s instanceof j&&(s.aspect=t/r,s.updateProjectionMatrix()),null===(a=this._lightSetting)||void 0===a||a.removeFromScene();let o=new O(this._scene);e.render(this._scene,s);let h=e.domElement.toDataURL();e.domElement.toBlob(e=>{i({image:h,width:t,height:r,blob:e})},"image/png"),o.removeFromScene(),null===(n=this._lightSetting)||void 0===n||n.addToScene()})}adjustCamera(e,t,r,i){if(this.cameraBehaviour.cameraControl instanceof P){let a=(new f).setFromObject(this._scene).getSize(new b);this.cameraBehaviour.cameraControl.adjust(a,e,t,r,i),this._requestRender()}}onStart(e){this._itemsCount=e,this._scene.background=null,this.cameraBehaviour.cameraControl instanceof P&&(this.cameraBehaviour.cameraControl.shouldIgnoreStandardBehavior=!0)}onElementFinished(e){this._itemsCount,Math.round(100/this._itemsCount*e)}onFinished(e){this._scene.background=this._standardSceneBackgroundColor,this.cameraBehaviour.cameraControl instanceof P&&(this.cameraBehaviour.cameraControl.shouldIgnoreStandardBehavior=!1)}clearScene(){this._currentGLB&&(this._scene.remove(this._currentGLB),_(this._currentGLB),this._currentGLB=null),super.clearScene()}enableHD(){super.enableHD()}sceneChanged(){}getBounds(){return this._currentGLB?(new f).setFromObject(this._currentGLB):null}get glbViewerCameraBehaviour(){return this.cameraBehaviour}getGeometryBounds(){return null}cameraBehaviourChanged(){super.cameraBehaviourChanged(),this.cameraBehaviour.cameraControl.addEventListener(3,()=>{this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(4,()=>{this._requestRender()},this)}}h([c],A.prototype,"_glbInputManager",void 0),h([c],A.prototype,"_rapiAccess",void 0);class U{constructor(e,t,r){this._prefix="https://furniture.roomle.com/3d/glb/",this._listeners=new Set,this._finishedItems=0,this._sceneManager=e,this._renderer=new I({antialias:!0,alpha:!0}),this._width=t,this._height=r,this._renderer.setSize(t,r),this._renderer.setClearColor(16777215,0),this._renderer.outputColorSpace=x}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}start(e){return this._entries=[],e.forEach(e=>{this._entries.push(this._transform(e))}),this._finishedItems=0,this._listeners.forEach(e=>e.onStart(this._entries.length)),this._zip=new window.JSZip,this._doNextEntry(),new Promise(e=>{this._resolve=e})}_transform(e){return{name:e.path.replace(".glb",".png"),url:this._prefix+e.path,position:new b(e.camera.position.x,e.camera.position.z,-e.camera.position.y),fov:2*e.camera.fieldOfView,yaw:e.camera.rotation.z,pitch:e.camera.rotation.x}}_doNextEntry(){0===this._entries.length?(this._listeners.forEach(e=>e.onFinished(this._zip)),this._resolve(this._zip)):this._processEntry(this._entries[0])}_processEntry(e){this._sceneManager.loadGLB(e.url,!1,void 0).then(()=>{this._sceneManager.adjustCamera(e.position,e.yaw,e.pitch,e.fov),this._sceneManager.preparePerspectiveImage(this._renderer,this._width,this._height).then(t=>{this._entryFinished(e,t)})})}_entryFinished(e,t){let r=this._entries.indexOf(e);r>-1&&this._entries.splice(r,1),this._finishedItems++,this._listeners.forEach(e=>e.onElementFinished(this._finishedItems)),this._zip.file(e.name,t.blob),this._doNextEntry()}}class k{constructor(e){this._currentIdOrUrl=null,this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e,t){return this.setOverrides(t),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(v,{id:"tween-js"})]).then(()=>{this._sceneManager=new A(this._creator_,{left:0,top:1,right:1,bottom:0}),this._sceneManager.enableHD(),e()})}clearScene(){this._sceneManager.clearScene()}loadGLB(e,t=1,r){return this._currentIdOrUrl=e,this._rapiAccess.trackView(e),this._sceneManager.loadGLB(e,!0,new b(t,t,t),r)}loadStaticItem(e,t){return this._currentIdOrUrl=e,this._rapiAccess.trackView(e),this._sceneManager.loadStaticItem(e,t)}getCurrentId(){return this._currentIdOrUrl}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}preparePerspectiveImage(){return this._sceneManager.preparePerspectiveImage()}processRenderList(e,t=320,r=320){let i=JSON.parse(e);this._scriptLoader.fetch("static/jszip.min-c96375d50e72b199.js",{id:"jszip-js"}).then(()=>{let e=new U(this._sceneManager,t,r);e.addListener(this._sceneManager),e.start(i.items).then(t=>{t.generateAsync({type:"blob"}).then(t=>{E("content.zip",URL.createObjectURL(t)),e.removeListener(this._sceneManager)})})})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}get callbacks(){return{}}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getUnitFormatter(){return this._unitFormatter}getStorage(){return this._idbManager}setEnvironmentMap(e){const{url:t,intensity:r,rotation:i,maxLightSources:a}=e;this._sceneManager.setEnvironmentMap(t,r,i,a)}}h([c],k.prototype,"_rapiAccess",void 0),h([c],k.prototype,"_domHelper",void 0),h([c],k.prototype,"_scriptLoader",void 0),h([c],k.prototype,"_lifeCycleManager",void 0),h([c],k.prototype,"_initData",void 0),h([c],k.prototype,"_globalInitData",void 0),h([c],k.prototype,"_unitFormatter",void 0),h([c],k.prototype,"_idbManager",void 0),e("GlbViewer",class extends r{setupGlobals(){}setupDependencies(){m.setup(D),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new k(this._context),window.RoomleGLBViewer||(window.RoomleGLBViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"glb-viewer"}})}}}));
|
|
2
|
+
//# sourceMappingURL=glb-viewer-32520b42.legacy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glb-viewer-
|
|
1
|
+
{"version":3,"file":"glb-viewer-32520b42.legacy.js","sources":["../../../node_modules/jszip/dist/jszip.min.js"],"sourcesContent":["export default \"static/jszip.min-c96375d50e72b199.js\""],"names":[],"mappings":"2pPAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./camera-behaviour-
|
|
2
|
-
//# sourceMappingURL=glb-viewer-camera-behaviour-
|
|
1
|
+
System.register(["./camera-behaviour-529c19c2.legacy.js"],(function(e){var t;return{setters:[function(e){t=e.b}],execute:function(){e("G",class extends t{get cameraControl(){return this._cameraControl}updateCameraOnItemLoaded(e){this.cameraControl.updateAndReset(e,!1)}})}}}));
|
|
2
|
+
//# sourceMappingURL=glb-viewer-camera-behaviour-e7544c90.legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glb-viewer-camera-behaviour-e7544c90.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|