schematic-renderer 1.4.3 → 1.4.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraManager.d.ts","sourceRoot":"","sources":["../../src/managers/CameraManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChE,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,mBAAmB,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,iBAAiB,CAAC;IACtE,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC;IACtB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CACj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AM,EACpB,UAAU,GAAE,MAAW,EACvB,OAAO,GAAE,OAAc,GACrB,IAAI;IAqCP;;;OAGG;IACI,oBAAoB,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;IAK1D;;;OAGG;IACI,kBAAkB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAc3D,OAAO,IAAI,IAAI;IA0BtB,+BAA+B;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAmBxB;IAEX;;;;;;OAMG;IACI,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,OAAc,GAAG,IAAI;IAgChE;;;;OAIG;IACI,eAAe,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAE,OAAc,GAAG,IAAI;IAgC1F,4CAA4C;IAC5C,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;WACW,aAAa,IAAI,MAAM,EAAE;IAMvC;;;;;;;OAOG;IACI,wBAAwB,CAC9B,SAAS,EAAE,KAAK,CAAC,OAAO,EACxB,WAAW,EAAE,KAAK,CAAC,IAAI,EACvB,OAAO,GAAE,MAAa,GACpB,MAAM;CA2CT"}
|
|
@@ -2828,18 +2828,16 @@ ${C || "(no log captured)"}`);
|
|
|
2828
2828
|
}
|
|
2829
2829
|
}
|
|
2830
2830
|
snapToDirection(A, I = true) {
|
|
2831
|
-
var _a2;
|
|
2832
|
-
const C = this.
|
|
2833
|
-
if (
|
|
2831
|
+
var _a2, _b3, _c3;
|
|
2832
|
+
const C = this.activeCamera.camera, i = new Q.Vector3(A[0], A[1], A[2]);
|
|
2833
|
+
if (i.lengthSq() < 1e-6)
|
|
2834
2834
|
return;
|
|
2835
|
-
|
|
2836
|
-
const
|
|
2837
|
-
|
|
2835
|
+
i.normalize();
|
|
2836
|
+
const w = this.calculateSchematicBounds(), Z = w ? w.center.clone() : this.getControlsTarget();
|
|
2837
|
+
let l = C.position.distanceTo(Z);
|
|
2838
|
+
I && w && C instanceof Q.PerspectiveCamera && (l = this.calculateFramingDistance(i, w.boundingBox, 0.05)), C.position.copy(Z.clone().add(i.clone().multiplyScalar(l))), C.lookAt(Z);
|
|
2838
2839
|
const j = this.controls.get(this.activeControlKey);
|
|
2839
|
-
j && "target" in j && (j.target.copy(
|
|
2840
|
-
padding: 0.05,
|
|
2841
|
-
animationDuration: 0
|
|
2842
|
-
});
|
|
2840
|
+
j && "target" in j && (j.target.copy(Z), (_a2 = j.update) == null ? void 0 : _a2.call(j)), (_c3 = (_b3 = this.schematicRenderer).invalidate) == null ? void 0 : _c3.call(_b3);
|
|
2843
2841
|
}
|
|
2844
2842
|
getControlsTarget() {
|
|
2845
2843
|
const A = this.controls.get(this.activeControlKey);
|
|
@@ -10,7 +10,7 @@ ${i||"(no log captured)"}`);return console.error(l.message),l}cleanup(){if(this.
|
|
|
10
10
|
<div>Shift - Sprint</div>
|
|
11
11
|
<div>ESC - Exit</div>
|
|
12
12
|
</div>
|
|
13
|
-
`,this.overlayElement.appendChild(A),this.overlayElement.addEventListener("click",this.onOverlayClick);const I=this.domElement.parentElement;I&&(I.style.position="relative",I.appendChild(this.overlayElement)),this.showOverlay(!1)}showOverlay(A){this.overlayElement&&(this.overlayElement.style.opacity=A?"1":"0",this.overlayElement.style.pointerEvents=A?"auto":"none")}setOverlayVisible(A){this.showOverlay(A)}lock(){this.enabled&&this.pointerLockControls.lock()}unlock(){this.pointerLockControls.unlock()}toggle(){this.isLocked?this.unlock():this.lock()}update(A){if(!this.enabled||!this.isLocked)return;this.direction.set(0,0,0),this.pressedKeys.has(this.keybinds.forward)&&(this.direction.z-=1),this.pressedKeys.has(this.keybinds.backward)&&(this.direction.z+=1),this.pressedKeys.has(this.keybinds.left)&&(this.direction.x-=1),this.pressedKeys.has(this.keybinds.right)&&(this.direction.x+=1),this.pressedKeys.has(this.keybinds.up)&&(this.direction.y+=1),this.pressedKeys.has(this.keybinds.down)&&(this.direction.y-=1),this.direction.length()>0&&this.direction.normalize();let I=this.moveSpeed;this.pressedKeys.has(this.keybinds.sprint)&&(I*=this.sprintMultiplier),this.velocity.copy(this.direction).multiplyScalar(I*A);const i=new b.Vector3;this.camera.getWorldDirection(i);const C=new b.Vector3(i.x,0,i.z).normalize(),l=new b.Vector3().crossVectors(new b.Vector3(0,1,0),C).normalize(),w=new b.Vector3;w.addScaledVector(C,-this.velocity.z),w.addScaledVector(l,-this.velocity.x),w.y+=this.velocity.y,this.camera.position.add(w),w.length()>0&&this.emit("change")}getMoveSpeed(){return this.moveSpeed}setMoveSpeed(A){this.moveSpeed=A}getSprintMultiplier(){return this.sprintMultiplier}setSprintMultiplier(A){this.sprintMultiplier=A}getKeybinds(){return{...this.keybinds}}setKeybinds(A){this.keybinds={...this.keybinds,...A}}getPointerLockControls(){return this.pointerLockControls}dispose(){this.domElement.removeEventListener("click",this.onCanvasClick),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),this.isLocked&&this.unlock(),this.overlayElement&&(this.overlayElement.removeEventListener("click",this.onOverlayClick),this.overlayElement.parentElement&&this.overlayElement.parentElement.removeChild(this.overlayElement)),this.overlayElement=null,this.pointerLockControls.dispose(),this.pressedKeys.clear(),this.removeAllListeners()}}const Ob=5,sh=5;class $C extends Ds.EventEmitter{schematicRenderer;cameras=new Map;cameraOptions;activeCameraKey;controls=new Map;activeControlKey;rendererDomElement;animationRequestId=null;isAnimating=!1;animationStartPosition=new b.Vector3;animationStartRotation=new b.Euler;recordingManager;flyControls=null;flyControlsEnabled=!1;autoOrbitEnabled=!1;autoOrbitAnimationId=null;autoOrbitStartTime=0;autoOrbitDuration=30;cameraPathManager;static CAMERA_PRESETS={isometric:{type:"orthographic",position:[0,0,20],rotation:[-Math.atan(1/Math.sqrt(2)),45*Math.PI/180,0],controlType:"orbit",fov:45,controlSettings:{enableDamping:!0,dampingFactor:.08,minDistance:5,maxDistance:500,enableZoom:!0,enableRotate:!0,enablePan:!0,panSpeed:1,rotateSpeed:.8,zoomSpeed:1.2,minPolarAngle:Math.PI/8,maxPolarAngle:Math.PI/2.1}},perspective:{type:"perspective",position:[0,20,20],rotation:[-20*Math.PI/180,0,0],controlType:"orbit",fov:60,controlSettings:{enableDamping:!0,dampingFactor:.08,minDistance:1,maxDistance:1e3,enableZoom:!0,enableRotate:!0,enablePan:!0,panSpeed:1,rotateSpeed:.8,zoomSpeed:1.2}},perspective_fpv:{type:"perspective",position:[0,2,0],rotation:[0,0,0],fov:90,controlType:"creative",controlSettings:{movementSpeed:new b.Vector3(200,200,200)}}};constructor(A,I={}){super(),this.schematicRenderer=A,this.rendererDomElement=this.schematicRenderer.canvas,this.cameraOptions={enableZoomInOnLoad:I.enableZoomInOnLoad||!1,zoomInDuration:I.zoomInDuration||2,autoOrbitAfterZoom:I.autoOrbitAfterZoom||!1,...I},this.recordingManager=new VD(A),this.activeCameraKey="perspective";const i=I.defaultCameraPreset||"perspective",C=$C.CAMERA_PRESETS[i]||$C.CAMERA_PRESETS.perspective;this.activeControlKey=`${i}-${C.controlType}`,I.defaultCameraPreset&&(console.log(`Switching to default camera preset: ${I.defaultCameraPreset}`),this.activeCameraKey=I.defaultCameraPreset,this.switchCameraPreset(I.defaultCameraPreset)),Object.entries($C.CAMERA_PRESETS).forEach(([w,Z])=>{const M={position:I.position||Z.position,size:Z.type==="orthographic"?20:void 0,fov:Z.fov};"rotation"in Z&&(M.rotation=Z.rotation);const m=this.createCamera(Z.type,M);this.cameras.set(w,m);const e=`${w}-${Z.controlType}`,t=this.createControls(Z.controlType,m);t&&Z.controlSettings&&(Object.assign(t,Z.controlSettings),w==="isometric"&&this.setupIsometricControls(t)),t&&(this.controls.set(e,t),this.setupControlEvents(t))}),this.cameras.has(this.activeCameraKey)||(this.activeCameraKey="perspective");const l=$C.CAMERA_PRESETS[this.activeCameraKey];this.activeControlKey=`${this.activeCameraKey}-${l.controlType}`,this.controls.forEach((w,Z)=>{w.enabled=Z===this.activeControlKey}),this.cameraPathManager=new KE(this.schematicRenderer,{showVisualization:I.showCameraPathVisualization||!1}),this.schematicRenderer.options.autoOrbitDuration&&(this.autoOrbitDuration=this.schematicRenderer.options.autoOrbitDuration),this.schematicRenderer.eventEmitter&&this.schematicRenderer.eventEmitter.on("schematicAdded",async()=>{await this.handleSchematicLoaded(this.cameraOptions.enableZoomInOnLoad)}),this.schematicRenderer.options.enableAutoOrbit&&!this.cameraOptions.enableZoomInOnLoad&&this.startAutoOrbit()}createCamera(A,I){let i;return A==="perspective"?i=new Lb("perspective",this.rendererDomElement,this.schematicRenderer,I):i=new Lb("orthographic",this.rendererDomElement,this.schematicRenderer,I),i}getDefaultCameraPath(){const A=Array.from(this.cameraPathManager.paths.entries());return A.length>0?{path:A[0][1],name:A[0][0]}:null}async animateCameraAlongPath(A){let I,i={};if(A instanceof ob?I=A:typeof A=="object"&&(i=A,i.pathName&&(I=this.cameraPathManager.getPath(i.pathName))),!I){const n=this.getDefaultCameraPath();if(!n)return Promise.reject(new Error("No camera path available"));I=n.path,console.log(`Using default camera path: ${n.name}`)}const{totalFrames:C=300,targetFps:l=60,easing:w=_E.linear,lookAtTarget:Z=!0,updateControls:M=!0,onStart:m,onUpdate:e,onComplete:t}=i,j=1e3/l;this.stopAnimation();try{return new Promise((n,D)=>{this.isAnimating=!0;let d=0,c=performance.now();if(this.animationStartPosition.copy(this.activeCamera.position),this.animationStartRotation.copy(this.activeCamera.rotation),M){const a=this.controls.get(this.activeControlKey);a&&a.enabled&&(a.enabled=!1)}const{position:J,rotation:L,target:o}=I.getPoint(0);this.activeCamera.position.copy(J),this.activeCamera.rotation.copy(L),Z&&this.activeCamera.lookAt(o);const Q=async()=>{let a=d/C;a=w(a);const{position:z,rotation:R,target:O}=I.getPoint(a);if(this.activeCamera.position.copy(z),Z?this.activeCamera.lookAt(O):this.activeCamera.rotation.copy(R),this.emit("cameraMove",{position:this.activeCamera.position.clone(),rotation:this.activeCamera.rotation.clone(),progress:a}),e&&await e(a),d++,d<=C){const B=performance.now(),X=B-c,v=Math.max(0,j-X);c=B,setTimeout(()=>{this.animationRequestId=requestAnimationFrame(Q)},v)}else{if(this.isAnimating=!1,M){const B=this.controls.get(this.activeControlKey);B&&(B.enabled=!0)}t&&t(),n()}};m&&m(),this.animationRequestId=requestAnimationFrame(Q)})}catch(n){throw this.stopAnimation(),n}}isCurrentlyAnimating(){return this.isAnimating}stopAnimation(){if(this.animationRequestId!==null){cancelAnimationFrame(this.animationRequestId),this.animationRequestId=null,this.isAnimating=!1;const A=this.controls.get(this.activeControlKey);A&&(A.enabled=!0)}}switchCameraPreset(A){const I=$C.CAMERA_PRESETS[A];if(!I){console.warn(`Preset ${A} not found`);return}const i=this.activeCameraKey;this.schematicRenderer.uiManager?.hideFPVOverlay(),this.activeCameraKey=A;const C=`${A}-${I.controlType}`;this.controls.forEach((w,Z)=>{w.enabled=Z===C}),this.activeControlKey=C;const l=this.controls.get(this.activeControlKey);l&&(l.object=this.activeCamera.camera,I.controlType==="orbit"&&l.update&&l.update()),I.controlType==="creative"&&this.schematicRenderer.uiManager?.showFPVOverlay(),this.schematicRenderer.renderManager&&this.schematicRenderer.renderManager.updateCamera(this.activeCamera.camera),this.emit("cameraChanged",{previousCamera:i,newCamera:A,controlType:I.controlType}),this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.focusOnSchematics()}updatePathParameters(A,I){this.cameraPathManager.updatePathParameters(A,I)}showPathVisualization(A){this.cameraPathManager.showPathVisualization(A)}hidePathVisualization(A){this.cameraPathManager.hidePathVisualization(A)}getCameraPath(A){return this.cameraPathManager.getPath(A)}createControls(A,I){return I.createControls(A)}switchControls(A){const I=this.controls.get(this.activeControlKey);I&&I.dispose&&I.dispose();const i=this.activeCamera,C=this.createControls(A,i);this.controls.set(A,C),this.activeControlKey=A,C&&this.setupControlEvents(C)}setupControlEvents(A){A.addEventListener("change",()=>{this.schematicRenderer.invalidate(),this.emit("propertyChanged",{property:"position",value:this.activeCamera.position.clone()}),this.emit("propertyChanged",{property:"rotation",value:this.activeCamera.rotation.clone()})})}setupIsometricControls(A){A.enableDamping=!0,A.dampingFactor=.1,A.minDistance=10,A.maxDistance=100,A.enableZoom=!0,A.enableRotate=!0,A.enablePan=!0,A.minPolarAngle=Math.PI/6,A.maxPolarAngle=Math.PI/2.2}update(A=0){if(this.flyControlsEnabled&&this.flyControls){this.flyControls.update(A);return}const I=this.controls.get(this.activeControlKey);if(I)if(this.activeControlKey.includes("creative")){const i=$C.CAMERA_PRESETS.perspective_fpv.controlSettings?.movementSpeed;i&&HA.update(I,i)}else I.update&&I.update(A)}initializeFlyControls(A){return this.flyControls&&this.flyControls.dispose(),this.flyControls=new Pb(this.activeCamera.camera,this.rendererDomElement,A),this.flyControls.on("lock",()=>{this.schematicRenderer.uiManager?.hideFPVOverlay(),this.emit("flyControlsLocked")}),this.flyControls.on("unlock",()=>{this.flyControlsEnabled&&this.schematicRenderer.uiManager?.hideFPVOverlay(),this.emit("flyControlsUnlocked")}),this.flyControls.on("change",()=>{this.emit("cameraMove",{position:this.activeCamera.position.clone(),rotation:this.activeCamera.rotation.clone()})}),this.flyControls}enableFlyControls(){this.flyControls||this.initializeFlyControls(),this.controls.forEach(A=>{A.enabled=!1}),this.flyControlsEnabled=!0,this.flyControls&&(this.flyControls.enabled=!0,this.flyControls.setOverlayVisible(!0)),this.schematicRenderer.uiManager?.hideFPVOverlay(),this.emit("controlModeChanged",{mode:"fly"})}disableFlyControls(){this.flyControls?.isLocked&&this.flyControls.unlock(),this.flyControlsEnabled=!1,this.flyControls&&(this.flyControls.enabled=!1,this.flyControls.setOverlayVisible(!1));const A=this.controls.get(this.activeControlKey);A&&(A.enabled=!0),this.emit("controlModeChanged",{mode:"orbit"})}toggleFlyControls(){return this.flyControlsEnabled?(this.disableFlyControls(),!1):(this.enableFlyControls(),!0)}isFlyControlsEnabled(){return this.flyControlsEnabled}isFlyControlsLocked(){return this.flyControls?.isLocked??!1}getFlyControlsSettings(){return this.flyControls?{moveSpeed:this.flyControls.getMoveSpeed(),sprintMultiplier:this.flyControls.getSprintMultiplier(),keybinds:this.flyControls.getKeybinds()}:null}setFlyControlsSettings(A){this.flyControls&&(A.moveSpeed!==void 0&&this.flyControls.setMoveSpeed(A.moveSpeed),A.sprintMultiplier!==void 0&&this.flyControls.setSprintMultiplier(A.sprintMultiplier),A.keybinds!==void 0&&this.flyControls.setKeybinds(A.keybinds))}get activeCamera(){return this.cameras.get(this.activeCameraKey)}updateAspectRatio(A){this.cameras.forEach(I=>{if(I.camera instanceof b.PerspectiveCamera)I.camera.aspect=A,I.camera.updateProjectionMatrix();else if(I.camera instanceof b.OrthographicCamera){const i=I.camera.top-I.camera.bottom;I.camera.left=-i*A/2,I.camera.right=i*A/2,I.camera.updateProjectionMatrix()}}),this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.focusOnSchematics({animationDuration:0})}lookAt(A){Array.isArray(A)?this.activeCamera.lookAt(new b.Vector3(...A)):this.activeCamera.lookAt(A)}lookAtSchematicsCenter(){if(!this.schematicRenderer.schematicManager)return;const A=this.schematicRenderer.schematicManager.getSchematicsAveragePosition();this.activeCamera.lookAt(A)}async focusOnSchematics(A={}){if(!this.schematicRenderer?.schematicManager||this.schematicRenderer.schematicManager.isEmpty())return;if(A.preserveCamera??this.cameraOptions.preserveCameraOnUpdate??!1){console.log("Camera preservation enabled, skipping focus");return}const{padding:i=.05,animationDuration:C=0,easing:l=o=>o*o*(3-2*o),skipPathFitting:w=!1}=A,Z=this.controls.get(this.activeControlKey);Z&&(Z.enabled=!1);const M=this.calculateSchematicBounds();if(!M){console.warn("No valid schematic bounds found"),Z&&(Z.enabled=!0);return}const{center:m,size:e}=M,t=this.schematicRenderer.canvas,j=t.width/t.height,n=new b.Vector3().copy(this.activeCamera.position),D=new b.Euler().copy(this.activeCamera.rotation);let d,c=null,J=m.clone();if(this.activeCamera.camera.type==="OrthographicCamera"){const o=this.calculateIsometricFraming(m,e,j,i);d=o.position,c=o.rotation;const Q=this.activeCamera.camera,a=this.calculateOrthographicSize(e,j,i);Q.left=-a*j/2,Q.right=a*j/2,Q.top=a/2,Q.bottom=-a/2,Q.updateProjectionMatrix()}else{const o=this.calculatePerspectiveFraming(m,e,j,i);d=o.position,J=o.target}if(C>0?await this.animateToPosition(n,D,d,c,J,C,l):(this.activeCamera.setPosition([d.x,d.y,d.z]),c?this.activeCamera.rotation=[c.x,c.y,c.z]:this.activeCamera.lookAt(J)),Z&&"target"in Z&&(Z.target.copy(J),Z.update()),Z&&(Z.enabled=!0),!w){const o=Math.max(e.x,e.y,e.z);this.cameraPathManager.fitCircularPathToSchematics("circularPath",{padding:i,minRadius:o*.8,maxRadius:o*2.5})}const L=this.autoOrbitEnabled;if(L&&this.stopAutoOrbit(),L||this.cameraOptions.autoOrbitAfterZoom&&C>0){const o=C>0?100:0;setTimeout(()=>this.startAutoOrbitFromOptimalPosition(),o)}else this.schematicRenderer.options.enableAutoOrbit&&C===0&&!this.cameraOptions.enableZoomInOnLoad&&setTimeout(()=>this.startAutoOrbitFromOptimalPosition(),100)}calculateOrthographicSize(A,I,i){const C=1+i*2;let l,w;if(this.activeCamera.camera instanceof b.OrthographicCamera){const M=this.activeCamera.camera.matrixWorldInverse,m=A.clone().multiplyScalar(.5),e=this.schematicRenderer.schematicManager.getSchematicsAveragePosition(),t=[new b.Vector3(e.x-m.x,e.y-m.y,e.z-m.z),new b.Vector3(e.x+m.x,e.y-m.y,e.z-m.z),new b.Vector3(e.x-m.x,e.y+m.y,e.z-m.z),new b.Vector3(e.x+m.x,e.y+m.y,e.z-m.z),new b.Vector3(e.x-m.x,e.y-m.y,e.z+m.z),new b.Vector3(e.x+m.x,e.y-m.y,e.z+m.z),new b.Vector3(e.x-m.x,e.y+m.y,e.z+m.z),new b.Vector3(e.x+m.x,e.y+m.y,e.z+m.z)];let j=1/0,n=-1/0,D=1/0,d=-1/0;for(const c of t){const J=c.clone().applyMatrix4(M);j=Math.min(j,J.x),n=Math.max(n,J.x),D=Math.min(D,J.y),d=Math.max(d,J.y)}l=(n-j)*C,w=(d-D)*C}else l=A.x*C,w=A.y*C;let Z;return l/I>w?Z=l/I:Z=w,Math.max(Z,Ob)}async startAutoOrbitWithZoomIn(A={}){const{zoomIn:I=!0,zoomDuration:i=2,orbitDelay:C=.5,orbitTransitionDuration:l=1}=A;if(I&&!this.schematicRenderer?.schematicManager?.isEmpty()){console.log("Starting cinematic zoom-in followed by auto-orbit"),await this.zoomInToSchematics({duration:i,padding:.08,skipPathFitting:!0}),C>0&&await new Promise(Z=>setTimeout(Z,C*1e3));const w=this.cameraPathManager.getFirstPath();w&&this.cameraPathManager.fitCircularPathToSchematics(w.name),this.startAutoOrbitSmooth({transitionDuration:l,startFromCurrentPosition:!0,skipPathFitting:!0})}else this.startAutoOrbitSmooth({transitionDuration:l,startFromCurrentPosition:!0})}setZoomInOnLoad(A,I=2){this.cameraOptions.enableZoomInOnLoad=A,this.cameraOptions.zoomInDuration=I}setAutoOrbitAfterZoom(A){this.cameraOptions.autoOrbitAfterZoom=A}getCameraSettings(){return{enableZoomInOnLoad:this.cameraOptions.enableZoomInOnLoad||!1,zoomInDuration:this.cameraOptions.zoomInDuration||2,autoOrbitAfterZoom:this.cameraOptions.autoOrbitAfterZoom||!1,autoOrbitEnabled:this.autoOrbitEnabled}}async handleSchematicLoaded(A=!1){if(A){const I=this.cameraPathManager.getFirstPath();I&&this.cameraPathManager.fitCircularPathToSchematics(I.name),await this.zoomToOrbitPosition({duration:this.cameraOptions.zoomInDuration||2,padding:.08,startFromCurrentPosition:!0,startOrbitAfterZoom:this.cameraOptions.autoOrbitAfterZoom||!1})}else await this.focusOnSchematics({animationDuration:0,padding:.08,skipPathFitting:!1})}startAutoOrbitFromOptimalPosition(){this.autoOrbitEnabled&&this.stopAutoOrbit();const A=this.cameraPathManager.getFirstPath();if(!A||!(A.path instanceof je)){console.warn("Cannot start auto-orbit: No circular camera path available");return}const I=A.path,i=new b.Vector3().copy(this.activeCamera.position),C=this.findClosestOrbitPoint(I,i);I.setStartAngle(C.angle),this.activeCamera.setPosition([C.position.x,C.position.y,C.position.z]),this.activeCamera.lookAt(I.getTargetPosition());const l=this.controls.get(this.activeControlKey);l&&"target"in l&&(l.target.copy(I.getTargetPosition()),l.update&&l.update()),this.startAutoOrbit()}startAutoOrbitSmooth(A={}){if(this.autoOrbitEnabled)return;const{transitionDuration:I=1,startFromCurrentPosition:i=!0,easing:C=M=>M*M*(3-2*M),skipPathFitting:l=!1}=A;this.stopAnimation();const w=this.cameraPathManager.getFirstPath();if(!w||!(w.path instanceof je)){console.warn("Cannot start auto-orbit: No (circular) camera path available.");return}!l&&this.schematicRenderer?.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.cameraPathManager.fitCircularPathToSchematics(w.name);const Z=w.path;if(i&&I>0)this.transitionToOrbit(Z,I,C);else{const M=Z.getPoint(0);this.activeCamera.setPosition([M.position.x,M.position.y,M.position.z]),this.activeCamera.lookAt(M.target);const m=this.controls.get(this.activeControlKey);m&&"target"in m&&(m.target.copy(M.target),m.update&&m.update()),this.startAutoOrbit()}}async zoomInToSchematics(A={}){const{padding:I=.08,duration:i=2,easing:C=o=>o*o*(3-2*o),startDistance:l=3,startFromCurrentPosition:w=!1,skipPathFitting:Z=!1}=A;if(this.schematicRenderer?.schematicManager?.isEmpty())return;console.log("Starting cinematic zoom-in to schematics");const M=this.calculateSchematicBounds();if(!M)return;const{center:m,size:e}=M,t=this.schematicRenderer.canvas,j=t.width/t.height;let n,D=null,d=m;if(this.activeCamera.camera.type==="OrthographicCamera"){const o=this.calculateIsometricFraming(m,e,j,I);n=o.position,D=o.rotation;const Q=this.activeCamera.camera,a=this.calculateOrthographicSize(e,j,I);Q.left=-a*j/2,Q.right=a*j/2,Q.top=a/2,Q.bottom=-a/2}else{const o=this.calculatePerspectiveFraming(m,e,j,I);n=o.position,d=o.target}let c;const J=this.activeCamera.rotation?this.activeCamera.rotation.clone():new b.Euler;if(w)c=this.activeCamera.position.clone();else{const o=n.clone().sub(m).normalize();o.lengthSq()===0&&o.set(0,0,1),c=m.clone().add(o.multiplyScalar(n.distanceTo(m)*l))}const L=this.controls.get(this.activeControlKey);if(L&&(L.enabled=!1),await this.animateToPosition(c,J,n,D,d,i,C),this.activeCamera.camera.type==="OrthographicCamera"&&this.activeCamera.camera.updateProjectionMatrix(),L&&"target"in L&&(L.target.copy(d),L.update&&L.update()),L&&(L.enabled=!0),!Z){const o=Math.max(e.x,e.y,e.z);this.cameraPathManager.fitCircularPathToSchematics("circularPath",{padding:I,minRadius:o*.8,maxRadius:o*2.5})}}async transitionToOrbit(A,I,i){const C=this.activeCamera.position.clone(),l=this.activeCamera.rotation.clone(),w=A.getTargetPosition(),Z=this.findClosestOrbitPoint(A,C),M=Z.position;A.setStartAngle(Z.angle);const m=this.controls.get(this.activeControlKey);m&&(m.enabled=!1),await this.animateToPosition(C,l,M,null,w,I,i),this.startAutoOrbit()}findClosestOrbitPoint(A,I){const i=A.getCenter(),C=A.getRadius(),l=A.getHeight(),Z=new b.Vector3(I.x,i.y+l,I.z).clone().sub(i);if(Z.lengthSq()===0){const e=A.getStartAngle()!==void 0?A.getStartAngle():0;return{position:new b.Vector3(i.x+C*Math.cos(e),i.y+l,i.z+C*Math.sin(e)),angle:e}}Z.normalize();const M=Math.atan2(Z.z,Z.x);return{position:new b.Vector3(i.x+C*Math.cos(M),i.y+l,i.z+C*Math.sin(M)),angle:M}}async animateToPosition(A,I,i,C,l,w,Z){return new Promise(M=>{const m=performance.now(),e=new b.Quaternion().setFromEuler(I);let t=null;C&&(t=new b.Quaternion().setFromEuler(C));const j=()=>{const n=(performance.now()-m)/1e3;let D=Math.min(n/w,1);D=Z(D);const d=A.clone().lerp(i,D);if(this.activeCamera.setPosition([d.x,d.y,d.z]),this.activeCamera.camera.type==="OrthographicCamera"&&t){const c=new b.Quaternion;c.slerpQuaternions(e,t,D);const J=new b.Euler().setFromQuaternion(c,this.activeCamera.camera.rotation.order);this.activeCamera.rotation=[J.x,J.y,J.z]}else this.activeCamera.lookAt(l);D<1?requestAnimationFrame(j):(this.activeCamera.setPosition([i.x,i.y,i.z]),this.activeCamera.camera.type==="OrthographicCamera"&&C?this.activeCamera.rotation=[C.x,C.y,C.z]:this.activeCamera.lookAt(l),M())};requestAnimationFrame(j)})}calculateSchematicBounds(){if(!this.schematicRenderer.schematicManager||this.schematicRenderer.schematicManager.isEmpty())return null;const A=this.schematicRenderer.schematicManager.getGlobalTightWorldBox();if(A.isEmpty())return null;const I=A.getCenter(new b.Vector3),i=A.getSize(new b.Vector3);return{center:I,size:i,boundingBox:A}}calculateOptimalViewingAngles(A,I=1){const{x:i,y:C,z:l}=A,w=Math.max(i,l),Z=w/(C+w+.001),M=Math.PI/6,m=11*Math.PI/36,e=b.MathUtils.lerp(M,m,Z),t=l/(i+l+.001),j=Math.min(Math.max((I-1)*.2,-.1),.1),n=Math.PI/6-j,D=Math.PI/3+j;return{yaw:b.MathUtils.lerp(n,D,t),pitch:e}}calculatePerspectiveFraming(A,I,i,C){const l=this.activeCamera.camera,w=b.MathUtils.degToRad(l.fov),Z=Math.tan(w/2),M=1+C*2,{yaw:m,pitch:e}=this.calculateOptimalViewingAngles(I,i),t=Math.cos(m),j=Math.sin(m),n=Math.cos(e),D=Math.sin(e),d=new b.Vector3(n*j,D,n*t).normalize(),c=new b.Vector3(0,1,0),J=new b.Vector3().crossVectors(c,d).normalize();J.lengthSq()<.001&&J.set(1,0,0);const L=new b.Vector3().crossVectors(d,J).normalize(),o=I.clone().multiplyScalar(.5),a=[new b.Vector3(o.x,o.y,o.z),new b.Vector3(o.x,o.y,-o.z),new b.Vector3(o.x,-o.y,o.z),new b.Vector3(o.x,-o.y,-o.z),new b.Vector3(-o.x,o.y,o.z),new b.Vector3(-o.x,o.y,-o.z),new b.Vector3(-o.x,-o.y,o.z),new b.Vector3(-o.x,-o.y,-o.z)].map(Y=>new b.Vector3(Y.dot(J),Y.dot(L),Y.dot(d)));let z=0,R=0,O=0;for(let Y=0;Y<3;Y++){let S=0;for(const AA of a){const $=Math.abs(AA.x-z),cA=Math.abs(AA.y-R),PA=$*M/(Z*i),UA=cA*M/Z,mI=AA.z+Math.max(PA,UA);S=Math.max(S,mI)}const T=Math.max(I.x,I.y,I.z);O=Math.max(S,T*.1,sh);let p=1/0,eA=-1/0,CA=1/0,zA=-1/0;for(const AA of a){const $=O-AA.z;if($<.001)continue;const cA=(AA.x-z)/$,PA=(AA.y-R)/$;p=Math.min(p,cA),eA=Math.max(eA,cA),CA=Math.min(CA,PA),zA=Math.max(zA,PA)}const mA=(p+eA)/2,LA=(CA+zA)/2;if(z+=mA*O,R+=LA*O,Math.abs(mA)<.001&&Math.abs(LA)<.001)break}const B=J.clone().multiplyScalar(z).add(L.clone().multiplyScalar(R)),X=A.clone().add(B);return{position:X.clone().add(d.multiplyScalar(O)),target:X}}calculateIsometricFraming(A,I,i,C){const l=this.activeCameraKey,Z=($C.CAMERA_PRESETS[l]||$C.CAMERA_PRESETS.isometric).rotation||$C.CAMERA_PRESETS.isometric.rotation,M=new b.Euler(Z[0],Z[1],Z[2]??0,"YXZ"),e=Math.max(I.x,I.y,I.z)*1.5+Ob*2,t=new b.Vector3(0,0,1);return t.applyEuler(M),t.multiplyScalar(e),{position:A.clone().add(t),rotation:M}}async zoomToOrbitPosition(A={}){const{duration:I=2,padding:i=.08,startFromCurrentPosition:C=!0,startOrbitAfterZoom:l=!1,easing:w=n=>n*n*(3-2*n)}=A;if(this.schematicRenderer?.schematicManager?.isEmpty())return;console.log("Starting zoom directly to orbit position");const Z=this.cameraPathManager.getFirstPath();if(!Z||!(Z.path instanceof je)){console.warn("No circular camera path available for zoom to orbit"),l&&this.startAutoOrbitFromOptimalPosition();return}const M=Z.path;this.cameraPathManager.fitCircularPathToSchematics(Z.name,{padding:i});let m;const e=this.activeCamera.rotation.clone(),t=this.findClosestOrbitPoint(M,C?this.activeCamera.position.clone():M.getPoint(0).position);if(C)m=this.activeCamera.position.clone();else{const n=M.getTargetPosition().clone().sub(t.position).normalize(),D=M.getRadius()*2;m=t.position.clone().add(n.multiplyScalar(D))}M.setStartAngle(t.angle);const j=this.controls.get(this.activeControlKey);j&&(j.enabled=!1),await this.animateToPosition(m,e,t.position,null,M.getTargetPosition(),I,w),j&&"target"in j&&(j.target.copy(M.getTargetPosition()),j.update&&j.update()),j&&(j.enabled=!0),l&&setTimeout(()=>{this.startAutoOrbitFromOptimalPosition()},100)}startAutoOrbit(){if(this.autoOrbitEnabled)return;this.stopAnimation();const A=this.cameraPathManager.getFirstPath();if(!A||!(A.path instanceof je)){console.warn("Cannot start auto-orbit: No circular camera path or path not found.");return}console.log("🎬 Starting auto-orbit animation.");const I=this.controls.get(this.activeControlKey);I&&(I.enabled=!1),this.autoOrbitEnabled=!0,this.autoOrbitStartTime=performance.now();const i=()=>{if(!this.autoOrbitEnabled)return;const l=(performance.now()-this.autoOrbitStartTime)/1e3%this.autoOrbitDuration/this.autoOrbitDuration,{position:w,rotation:Z,target:M}=A.path.getPoint(l);this.activeCamera.position.copy(w),this.activeCamera.lookAt(M),this.emit("cameraMove",{position:this.activeCamera.position.clone(),rotation:this.activeCamera.rotation.clone(),progress:l}),this.autoOrbitAnimationId=requestAnimationFrame(i)};this.autoOrbitAnimationId=requestAnimationFrame(i)}stopAutoOrbit(){if(!this.autoOrbitEnabled)return;this.autoOrbitEnabled=!1,this.autoOrbitAnimationId!==null&&(cancelAnimationFrame(this.autoOrbitAnimationId),this.autoOrbitAnimationId=null);const A=this.controls.get(this.activeControlKey);A&&(A.enabled=!0)}toggleAutoOrbit(){if(this.autoOrbitEnabled)return this.stopAutoOrbit(),!1;{const A=this.cameraPathManager.getFirstPath();return A&&this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.cameraPathManager.fitCircularPathToSchematics(A.name),this.startAutoOrbitFromOptimalPosition(),!0}}setAutoOrbitDuration(A){this.autoOrbitDuration=Math.max(1,A),this.autoOrbitEnabled&&(this.stopAutoOrbit(),this.startAutoOrbitFromOptimalPosition())}isAutoOrbitEnabled(){return this.autoOrbitEnabled}setIsometricAngles(A,I=45,i=!0){A=Math.max(0,Math.min(89,A));const C=-(A*Math.PI)/180,l=I*Math.PI/180,w=$C.CAMERA_PRESETS.isometric;if(w.rotation=[C,l,0],this.activeCameraKey==="isometric"){const Z=new b.Euler(C,l,0,"YXZ");this.activeCamera.camera.rotation.order="YXZ",this.activeCamera.rotation=[Z.x,Z.y,Z.z],i&&this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.focusOnSchematics({animationDuration:.5,easing:M=>M*M*(3-2*M)}),console.log(`Isometric angles updated: pitch=${A}°, yaw=${I}°`)}}resetIsometricAngles(A=!0){const I=Math.atan(1/Math.sqrt(2))*(180/Math.PI);this.setIsometricAngles(I,45,A)}getIsometricAngles(){if(this.activeCameraKey!=="isometric")return null;const A=$C.CAMERA_PRESETS.isometric;return A.rotation?{pitch:-(A.rotation[0]*180)/Math.PI,yaw:A.rotation[1]*180/Math.PI}:null}dispose(){this.recordingManager.dispose(),this.stopAnimation(),this.stopAutoOrbit(),this.flyControls&&(this.flyControls.dispose(),this.flyControls=null),this.controls.forEach(A=>{A.dispose&&A.dispose()}),this.controls.clear(),this.cameras.clear(),this.removeAllListeners()}static SNAP_ANGLES={front:{dir:[0,0,1]},back:{dir:[0,0,-1]},right:{dir:[1,0,0]},left:{dir:[-1,0,0]},top:{dir:[0,1,0]},bottom:{dir:[0,-1,0]},"3/4":{dir:[1,.7,1]},"iso-ne":{iso:[35.264,45]},"iso-nw":{iso:[35.264,135]},"iso-sw":{iso:[35.264,225]},"iso-se":{iso:[35.264,315]},"iso-top":{iso:[89,45]},"iso-front":{iso:[10,0]},"iso-right":{iso:[10,90]},"iso-back":{iso:[10,180]},"iso-left":{iso:[10,270]}};snapToAngle(A,I=!0){const i=$C.SNAP_ANGLES[A];if(!i){console.warn(`Unknown snap angle: ${A}`);return}if("iso"in i)this.setIsometricAngles(i.iso[0],i.iso[1],I);else if("dir"in i){const C=this.getControlsTarget(),l=this.activeCamera.camera,w=l.position.distanceTo(C),Z=new b.Vector3(i.dir[0],i.dir[1],i.dir[2]).normalize(),M=C.clone().add(Z.multiplyScalar(w));l.position.copy(M),l.lookAt(C);const m=this.controls.get(this.activeControlKey);m&&"target"in m&&(m.target.copy(C),m.update?.()),I&&this.focusOnSchematics({padding:.05,animationDuration:0})}}snapToDirection(A,I=!0){const i=this.getControlsTarget(),C=this.activeCamera.camera,l=C.position.distanceTo(i),w=new b.Vector3(A[0],A[1],A[2]);if(w.lengthSq()<1e-6)return;w.normalize();const Z=i.clone().add(w.multiplyScalar(l));C.position.copy(Z),C.lookAt(i);const M=this.controls.get(this.activeControlKey);M&&"target"in M&&(M.target.copy(i),M.update?.()),I&&this.focusOnSchematics({padding:.05,animationDuration:0})}getControlsTarget(){const A=this.controls.get(this.activeControlKey);return A&&"target"in A?A.target.clone():new b.Vector3(0,0,0)}static getSnapAngles(){return Object.keys($C.SNAP_ANGLES)}calculateFramingDistance(A,I,i=.05){const C=this.activeCamera.camera,l=b.MathUtils.degToRad(C.fov),w=this.schematicRenderer.canvas.width/this.schematicRenderer.canvas.height,Z=Math.tan(l/2),M=1+i*2,e=I.getSize(new b.Vector3).clone().multiplyScalar(.5),t=new b.Vector3(0,1,0),j=new b.Vector3().crossVectors(t,A).normalize();j.lengthSq()<.001&&j.set(1,0,0);const n=new b.Vector3().crossVectors(A,j).normalize(),D=[new b.Vector3(e.x,e.y,e.z),new b.Vector3(e.x,e.y,-e.z),new b.Vector3(e.x,-e.y,e.z),new b.Vector3(e.x,-e.y,-e.z),new b.Vector3(-e.x,e.y,e.z),new b.Vector3(-e.x,e.y,-e.z),new b.Vector3(-e.x,-e.y,e.z),new b.Vector3(-e.x,-e.y,-e.z)];let d=0,c=0;for(const o of D)d=Math.max(d,Math.abs(o.dot(j))),c=Math.max(c,Math.abs(o.dot(n)));d*=M,c*=M;const J=d/(Z*w),L=c/Z;return Math.max(J,L)}}N.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new N.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},N.ShaderLib.line={uniforms:N.UniformsUtils.merge([N.UniformsLib.common,N.UniformsLib.fog,N.UniformsLib.line]),vertexShader:`
|
|
13
|
+
`,this.overlayElement.appendChild(A),this.overlayElement.addEventListener("click",this.onOverlayClick);const I=this.domElement.parentElement;I&&(I.style.position="relative",I.appendChild(this.overlayElement)),this.showOverlay(!1)}showOverlay(A){this.overlayElement&&(this.overlayElement.style.opacity=A?"1":"0",this.overlayElement.style.pointerEvents=A?"auto":"none")}setOverlayVisible(A){this.showOverlay(A)}lock(){this.enabled&&this.pointerLockControls.lock()}unlock(){this.pointerLockControls.unlock()}toggle(){this.isLocked?this.unlock():this.lock()}update(A){if(!this.enabled||!this.isLocked)return;this.direction.set(0,0,0),this.pressedKeys.has(this.keybinds.forward)&&(this.direction.z-=1),this.pressedKeys.has(this.keybinds.backward)&&(this.direction.z+=1),this.pressedKeys.has(this.keybinds.left)&&(this.direction.x-=1),this.pressedKeys.has(this.keybinds.right)&&(this.direction.x+=1),this.pressedKeys.has(this.keybinds.up)&&(this.direction.y+=1),this.pressedKeys.has(this.keybinds.down)&&(this.direction.y-=1),this.direction.length()>0&&this.direction.normalize();let I=this.moveSpeed;this.pressedKeys.has(this.keybinds.sprint)&&(I*=this.sprintMultiplier),this.velocity.copy(this.direction).multiplyScalar(I*A);const i=new b.Vector3;this.camera.getWorldDirection(i);const C=new b.Vector3(i.x,0,i.z).normalize(),l=new b.Vector3().crossVectors(new b.Vector3(0,1,0),C).normalize(),w=new b.Vector3;w.addScaledVector(C,-this.velocity.z),w.addScaledVector(l,-this.velocity.x),w.y+=this.velocity.y,this.camera.position.add(w),w.length()>0&&this.emit("change")}getMoveSpeed(){return this.moveSpeed}setMoveSpeed(A){this.moveSpeed=A}getSprintMultiplier(){return this.sprintMultiplier}setSprintMultiplier(A){this.sprintMultiplier=A}getKeybinds(){return{...this.keybinds}}setKeybinds(A){this.keybinds={...this.keybinds,...A}}getPointerLockControls(){return this.pointerLockControls}dispose(){this.domElement.removeEventListener("click",this.onCanvasClick),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),this.isLocked&&this.unlock(),this.overlayElement&&(this.overlayElement.removeEventListener("click",this.onOverlayClick),this.overlayElement.parentElement&&this.overlayElement.parentElement.removeChild(this.overlayElement)),this.overlayElement=null,this.pointerLockControls.dispose(),this.pressedKeys.clear(),this.removeAllListeners()}}const Ob=5,sh=5;class $C extends Ds.EventEmitter{schematicRenderer;cameras=new Map;cameraOptions;activeCameraKey;controls=new Map;activeControlKey;rendererDomElement;animationRequestId=null;isAnimating=!1;animationStartPosition=new b.Vector3;animationStartRotation=new b.Euler;recordingManager;flyControls=null;flyControlsEnabled=!1;autoOrbitEnabled=!1;autoOrbitAnimationId=null;autoOrbitStartTime=0;autoOrbitDuration=30;cameraPathManager;static CAMERA_PRESETS={isometric:{type:"orthographic",position:[0,0,20],rotation:[-Math.atan(1/Math.sqrt(2)),45*Math.PI/180,0],controlType:"orbit",fov:45,controlSettings:{enableDamping:!0,dampingFactor:.08,minDistance:5,maxDistance:500,enableZoom:!0,enableRotate:!0,enablePan:!0,panSpeed:1,rotateSpeed:.8,zoomSpeed:1.2,minPolarAngle:Math.PI/8,maxPolarAngle:Math.PI/2.1}},perspective:{type:"perspective",position:[0,20,20],rotation:[-20*Math.PI/180,0,0],controlType:"orbit",fov:60,controlSettings:{enableDamping:!0,dampingFactor:.08,minDistance:1,maxDistance:1e3,enableZoom:!0,enableRotate:!0,enablePan:!0,panSpeed:1,rotateSpeed:.8,zoomSpeed:1.2}},perspective_fpv:{type:"perspective",position:[0,2,0],rotation:[0,0,0],fov:90,controlType:"creative",controlSettings:{movementSpeed:new b.Vector3(200,200,200)}}};constructor(A,I={}){super(),this.schematicRenderer=A,this.rendererDomElement=this.schematicRenderer.canvas,this.cameraOptions={enableZoomInOnLoad:I.enableZoomInOnLoad||!1,zoomInDuration:I.zoomInDuration||2,autoOrbitAfterZoom:I.autoOrbitAfterZoom||!1,...I},this.recordingManager=new VD(A),this.activeCameraKey="perspective";const i=I.defaultCameraPreset||"perspective",C=$C.CAMERA_PRESETS[i]||$C.CAMERA_PRESETS.perspective;this.activeControlKey=`${i}-${C.controlType}`,I.defaultCameraPreset&&(console.log(`Switching to default camera preset: ${I.defaultCameraPreset}`),this.activeCameraKey=I.defaultCameraPreset,this.switchCameraPreset(I.defaultCameraPreset)),Object.entries($C.CAMERA_PRESETS).forEach(([w,Z])=>{const M={position:I.position||Z.position,size:Z.type==="orthographic"?20:void 0,fov:Z.fov};"rotation"in Z&&(M.rotation=Z.rotation);const m=this.createCamera(Z.type,M);this.cameras.set(w,m);const e=`${w}-${Z.controlType}`,t=this.createControls(Z.controlType,m);t&&Z.controlSettings&&(Object.assign(t,Z.controlSettings),w==="isometric"&&this.setupIsometricControls(t)),t&&(this.controls.set(e,t),this.setupControlEvents(t))}),this.cameras.has(this.activeCameraKey)||(this.activeCameraKey="perspective");const l=$C.CAMERA_PRESETS[this.activeCameraKey];this.activeControlKey=`${this.activeCameraKey}-${l.controlType}`,this.controls.forEach((w,Z)=>{w.enabled=Z===this.activeControlKey}),this.cameraPathManager=new KE(this.schematicRenderer,{showVisualization:I.showCameraPathVisualization||!1}),this.schematicRenderer.options.autoOrbitDuration&&(this.autoOrbitDuration=this.schematicRenderer.options.autoOrbitDuration),this.schematicRenderer.eventEmitter&&this.schematicRenderer.eventEmitter.on("schematicAdded",async()=>{await this.handleSchematicLoaded(this.cameraOptions.enableZoomInOnLoad)}),this.schematicRenderer.options.enableAutoOrbit&&!this.cameraOptions.enableZoomInOnLoad&&this.startAutoOrbit()}createCamera(A,I){let i;return A==="perspective"?i=new Lb("perspective",this.rendererDomElement,this.schematicRenderer,I):i=new Lb("orthographic",this.rendererDomElement,this.schematicRenderer,I),i}getDefaultCameraPath(){const A=Array.from(this.cameraPathManager.paths.entries());return A.length>0?{path:A[0][1],name:A[0][0]}:null}async animateCameraAlongPath(A){let I,i={};if(A instanceof ob?I=A:typeof A=="object"&&(i=A,i.pathName&&(I=this.cameraPathManager.getPath(i.pathName))),!I){const n=this.getDefaultCameraPath();if(!n)return Promise.reject(new Error("No camera path available"));I=n.path,console.log(`Using default camera path: ${n.name}`)}const{totalFrames:C=300,targetFps:l=60,easing:w=_E.linear,lookAtTarget:Z=!0,updateControls:M=!0,onStart:m,onUpdate:e,onComplete:t}=i,j=1e3/l;this.stopAnimation();try{return new Promise((n,D)=>{this.isAnimating=!0;let d=0,c=performance.now();if(this.animationStartPosition.copy(this.activeCamera.position),this.animationStartRotation.copy(this.activeCamera.rotation),M){const a=this.controls.get(this.activeControlKey);a&&a.enabled&&(a.enabled=!1)}const{position:J,rotation:L,target:o}=I.getPoint(0);this.activeCamera.position.copy(J),this.activeCamera.rotation.copy(L),Z&&this.activeCamera.lookAt(o);const Q=async()=>{let a=d/C;a=w(a);const{position:z,rotation:R,target:O}=I.getPoint(a);if(this.activeCamera.position.copy(z),Z?this.activeCamera.lookAt(O):this.activeCamera.rotation.copy(R),this.emit("cameraMove",{position:this.activeCamera.position.clone(),rotation:this.activeCamera.rotation.clone(),progress:a}),e&&await e(a),d++,d<=C){const B=performance.now(),X=B-c,v=Math.max(0,j-X);c=B,setTimeout(()=>{this.animationRequestId=requestAnimationFrame(Q)},v)}else{if(this.isAnimating=!1,M){const B=this.controls.get(this.activeControlKey);B&&(B.enabled=!0)}t&&t(),n()}};m&&m(),this.animationRequestId=requestAnimationFrame(Q)})}catch(n){throw this.stopAnimation(),n}}isCurrentlyAnimating(){return this.isAnimating}stopAnimation(){if(this.animationRequestId!==null){cancelAnimationFrame(this.animationRequestId),this.animationRequestId=null,this.isAnimating=!1;const A=this.controls.get(this.activeControlKey);A&&(A.enabled=!0)}}switchCameraPreset(A){const I=$C.CAMERA_PRESETS[A];if(!I){console.warn(`Preset ${A} not found`);return}const i=this.activeCameraKey;this.schematicRenderer.uiManager?.hideFPVOverlay(),this.activeCameraKey=A;const C=`${A}-${I.controlType}`;this.controls.forEach((w,Z)=>{w.enabled=Z===C}),this.activeControlKey=C;const l=this.controls.get(this.activeControlKey);l&&(l.object=this.activeCamera.camera,I.controlType==="orbit"&&l.update&&l.update()),I.controlType==="creative"&&this.schematicRenderer.uiManager?.showFPVOverlay(),this.schematicRenderer.renderManager&&this.schematicRenderer.renderManager.updateCamera(this.activeCamera.camera),this.emit("cameraChanged",{previousCamera:i,newCamera:A,controlType:I.controlType}),this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.focusOnSchematics()}updatePathParameters(A,I){this.cameraPathManager.updatePathParameters(A,I)}showPathVisualization(A){this.cameraPathManager.showPathVisualization(A)}hidePathVisualization(A){this.cameraPathManager.hidePathVisualization(A)}getCameraPath(A){return this.cameraPathManager.getPath(A)}createControls(A,I){return I.createControls(A)}switchControls(A){const I=this.controls.get(this.activeControlKey);I&&I.dispose&&I.dispose();const i=this.activeCamera,C=this.createControls(A,i);this.controls.set(A,C),this.activeControlKey=A,C&&this.setupControlEvents(C)}setupControlEvents(A){A.addEventListener("change",()=>{this.schematicRenderer.invalidate(),this.emit("propertyChanged",{property:"position",value:this.activeCamera.position.clone()}),this.emit("propertyChanged",{property:"rotation",value:this.activeCamera.rotation.clone()})})}setupIsometricControls(A){A.enableDamping=!0,A.dampingFactor=.1,A.minDistance=10,A.maxDistance=100,A.enableZoom=!0,A.enableRotate=!0,A.enablePan=!0,A.minPolarAngle=Math.PI/6,A.maxPolarAngle=Math.PI/2.2}update(A=0){if(this.flyControlsEnabled&&this.flyControls){this.flyControls.update(A);return}const I=this.controls.get(this.activeControlKey);if(I)if(this.activeControlKey.includes("creative")){const i=$C.CAMERA_PRESETS.perspective_fpv.controlSettings?.movementSpeed;i&&HA.update(I,i)}else I.update&&I.update(A)}initializeFlyControls(A){return this.flyControls&&this.flyControls.dispose(),this.flyControls=new Pb(this.activeCamera.camera,this.rendererDomElement,A),this.flyControls.on("lock",()=>{this.schematicRenderer.uiManager?.hideFPVOverlay(),this.emit("flyControlsLocked")}),this.flyControls.on("unlock",()=>{this.flyControlsEnabled&&this.schematicRenderer.uiManager?.hideFPVOverlay(),this.emit("flyControlsUnlocked")}),this.flyControls.on("change",()=>{this.emit("cameraMove",{position:this.activeCamera.position.clone(),rotation:this.activeCamera.rotation.clone()})}),this.flyControls}enableFlyControls(){this.flyControls||this.initializeFlyControls(),this.controls.forEach(A=>{A.enabled=!1}),this.flyControlsEnabled=!0,this.flyControls&&(this.flyControls.enabled=!0,this.flyControls.setOverlayVisible(!0)),this.schematicRenderer.uiManager?.hideFPVOverlay(),this.emit("controlModeChanged",{mode:"fly"})}disableFlyControls(){this.flyControls?.isLocked&&this.flyControls.unlock(),this.flyControlsEnabled=!1,this.flyControls&&(this.flyControls.enabled=!1,this.flyControls.setOverlayVisible(!1));const A=this.controls.get(this.activeControlKey);A&&(A.enabled=!0),this.emit("controlModeChanged",{mode:"orbit"})}toggleFlyControls(){return this.flyControlsEnabled?(this.disableFlyControls(),!1):(this.enableFlyControls(),!0)}isFlyControlsEnabled(){return this.flyControlsEnabled}isFlyControlsLocked(){return this.flyControls?.isLocked??!1}getFlyControlsSettings(){return this.flyControls?{moveSpeed:this.flyControls.getMoveSpeed(),sprintMultiplier:this.flyControls.getSprintMultiplier(),keybinds:this.flyControls.getKeybinds()}:null}setFlyControlsSettings(A){this.flyControls&&(A.moveSpeed!==void 0&&this.flyControls.setMoveSpeed(A.moveSpeed),A.sprintMultiplier!==void 0&&this.flyControls.setSprintMultiplier(A.sprintMultiplier),A.keybinds!==void 0&&this.flyControls.setKeybinds(A.keybinds))}get activeCamera(){return this.cameras.get(this.activeCameraKey)}updateAspectRatio(A){this.cameras.forEach(I=>{if(I.camera instanceof b.PerspectiveCamera)I.camera.aspect=A,I.camera.updateProjectionMatrix();else if(I.camera instanceof b.OrthographicCamera){const i=I.camera.top-I.camera.bottom;I.camera.left=-i*A/2,I.camera.right=i*A/2,I.camera.updateProjectionMatrix()}}),this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.focusOnSchematics({animationDuration:0})}lookAt(A){Array.isArray(A)?this.activeCamera.lookAt(new b.Vector3(...A)):this.activeCamera.lookAt(A)}lookAtSchematicsCenter(){if(!this.schematicRenderer.schematicManager)return;const A=this.schematicRenderer.schematicManager.getSchematicsAveragePosition();this.activeCamera.lookAt(A)}async focusOnSchematics(A={}){if(!this.schematicRenderer?.schematicManager||this.schematicRenderer.schematicManager.isEmpty())return;if(A.preserveCamera??this.cameraOptions.preserveCameraOnUpdate??!1){console.log("Camera preservation enabled, skipping focus");return}const{padding:i=.05,animationDuration:C=0,easing:l=o=>o*o*(3-2*o),skipPathFitting:w=!1}=A,Z=this.controls.get(this.activeControlKey);Z&&(Z.enabled=!1);const M=this.calculateSchematicBounds();if(!M){console.warn("No valid schematic bounds found"),Z&&(Z.enabled=!0);return}const{center:m,size:e}=M,t=this.schematicRenderer.canvas,j=t.width/t.height,n=new b.Vector3().copy(this.activeCamera.position),D=new b.Euler().copy(this.activeCamera.rotation);let d,c=null,J=m.clone();if(this.activeCamera.camera.type==="OrthographicCamera"){const o=this.calculateIsometricFraming(m,e,j,i);d=o.position,c=o.rotation;const Q=this.activeCamera.camera,a=this.calculateOrthographicSize(e,j,i);Q.left=-a*j/2,Q.right=a*j/2,Q.top=a/2,Q.bottom=-a/2,Q.updateProjectionMatrix()}else{const o=this.calculatePerspectiveFraming(m,e,j,i);d=o.position,J=o.target}if(C>0?await this.animateToPosition(n,D,d,c,J,C,l):(this.activeCamera.setPosition([d.x,d.y,d.z]),c?this.activeCamera.rotation=[c.x,c.y,c.z]:this.activeCamera.lookAt(J)),Z&&"target"in Z&&(Z.target.copy(J),Z.update()),Z&&(Z.enabled=!0),!w){const o=Math.max(e.x,e.y,e.z);this.cameraPathManager.fitCircularPathToSchematics("circularPath",{padding:i,minRadius:o*.8,maxRadius:o*2.5})}const L=this.autoOrbitEnabled;if(L&&this.stopAutoOrbit(),L||this.cameraOptions.autoOrbitAfterZoom&&C>0){const o=C>0?100:0;setTimeout(()=>this.startAutoOrbitFromOptimalPosition(),o)}else this.schematicRenderer.options.enableAutoOrbit&&C===0&&!this.cameraOptions.enableZoomInOnLoad&&setTimeout(()=>this.startAutoOrbitFromOptimalPosition(),100)}calculateOrthographicSize(A,I,i){const C=1+i*2;let l,w;if(this.activeCamera.camera instanceof b.OrthographicCamera){const M=this.activeCamera.camera.matrixWorldInverse,m=A.clone().multiplyScalar(.5),e=this.schematicRenderer.schematicManager.getSchematicsAveragePosition(),t=[new b.Vector3(e.x-m.x,e.y-m.y,e.z-m.z),new b.Vector3(e.x+m.x,e.y-m.y,e.z-m.z),new b.Vector3(e.x-m.x,e.y+m.y,e.z-m.z),new b.Vector3(e.x+m.x,e.y+m.y,e.z-m.z),new b.Vector3(e.x-m.x,e.y-m.y,e.z+m.z),new b.Vector3(e.x+m.x,e.y-m.y,e.z+m.z),new b.Vector3(e.x-m.x,e.y+m.y,e.z+m.z),new b.Vector3(e.x+m.x,e.y+m.y,e.z+m.z)];let j=1/0,n=-1/0,D=1/0,d=-1/0;for(const c of t){const J=c.clone().applyMatrix4(M);j=Math.min(j,J.x),n=Math.max(n,J.x),D=Math.min(D,J.y),d=Math.max(d,J.y)}l=(n-j)*C,w=(d-D)*C}else l=A.x*C,w=A.y*C;let Z;return l/I>w?Z=l/I:Z=w,Math.max(Z,Ob)}async startAutoOrbitWithZoomIn(A={}){const{zoomIn:I=!0,zoomDuration:i=2,orbitDelay:C=.5,orbitTransitionDuration:l=1}=A;if(I&&!this.schematicRenderer?.schematicManager?.isEmpty()){console.log("Starting cinematic zoom-in followed by auto-orbit"),await this.zoomInToSchematics({duration:i,padding:.08,skipPathFitting:!0}),C>0&&await new Promise(Z=>setTimeout(Z,C*1e3));const w=this.cameraPathManager.getFirstPath();w&&this.cameraPathManager.fitCircularPathToSchematics(w.name),this.startAutoOrbitSmooth({transitionDuration:l,startFromCurrentPosition:!0,skipPathFitting:!0})}else this.startAutoOrbitSmooth({transitionDuration:l,startFromCurrentPosition:!0})}setZoomInOnLoad(A,I=2){this.cameraOptions.enableZoomInOnLoad=A,this.cameraOptions.zoomInDuration=I}setAutoOrbitAfterZoom(A){this.cameraOptions.autoOrbitAfterZoom=A}getCameraSettings(){return{enableZoomInOnLoad:this.cameraOptions.enableZoomInOnLoad||!1,zoomInDuration:this.cameraOptions.zoomInDuration||2,autoOrbitAfterZoom:this.cameraOptions.autoOrbitAfterZoom||!1,autoOrbitEnabled:this.autoOrbitEnabled}}async handleSchematicLoaded(A=!1){if(A){const I=this.cameraPathManager.getFirstPath();I&&this.cameraPathManager.fitCircularPathToSchematics(I.name),await this.zoomToOrbitPosition({duration:this.cameraOptions.zoomInDuration||2,padding:.08,startFromCurrentPosition:!0,startOrbitAfterZoom:this.cameraOptions.autoOrbitAfterZoom||!1})}else await this.focusOnSchematics({animationDuration:0,padding:.08,skipPathFitting:!1})}startAutoOrbitFromOptimalPosition(){this.autoOrbitEnabled&&this.stopAutoOrbit();const A=this.cameraPathManager.getFirstPath();if(!A||!(A.path instanceof je)){console.warn("Cannot start auto-orbit: No circular camera path available");return}const I=A.path,i=new b.Vector3().copy(this.activeCamera.position),C=this.findClosestOrbitPoint(I,i);I.setStartAngle(C.angle),this.activeCamera.setPosition([C.position.x,C.position.y,C.position.z]),this.activeCamera.lookAt(I.getTargetPosition());const l=this.controls.get(this.activeControlKey);l&&"target"in l&&(l.target.copy(I.getTargetPosition()),l.update&&l.update()),this.startAutoOrbit()}startAutoOrbitSmooth(A={}){if(this.autoOrbitEnabled)return;const{transitionDuration:I=1,startFromCurrentPosition:i=!0,easing:C=M=>M*M*(3-2*M),skipPathFitting:l=!1}=A;this.stopAnimation();const w=this.cameraPathManager.getFirstPath();if(!w||!(w.path instanceof je)){console.warn("Cannot start auto-orbit: No (circular) camera path available.");return}!l&&this.schematicRenderer?.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.cameraPathManager.fitCircularPathToSchematics(w.name);const Z=w.path;if(i&&I>0)this.transitionToOrbit(Z,I,C);else{const M=Z.getPoint(0);this.activeCamera.setPosition([M.position.x,M.position.y,M.position.z]),this.activeCamera.lookAt(M.target);const m=this.controls.get(this.activeControlKey);m&&"target"in m&&(m.target.copy(M.target),m.update&&m.update()),this.startAutoOrbit()}}async zoomInToSchematics(A={}){const{padding:I=.08,duration:i=2,easing:C=o=>o*o*(3-2*o),startDistance:l=3,startFromCurrentPosition:w=!1,skipPathFitting:Z=!1}=A;if(this.schematicRenderer?.schematicManager?.isEmpty())return;console.log("Starting cinematic zoom-in to schematics");const M=this.calculateSchematicBounds();if(!M)return;const{center:m,size:e}=M,t=this.schematicRenderer.canvas,j=t.width/t.height;let n,D=null,d=m;if(this.activeCamera.camera.type==="OrthographicCamera"){const o=this.calculateIsometricFraming(m,e,j,I);n=o.position,D=o.rotation;const Q=this.activeCamera.camera,a=this.calculateOrthographicSize(e,j,I);Q.left=-a*j/2,Q.right=a*j/2,Q.top=a/2,Q.bottom=-a/2}else{const o=this.calculatePerspectiveFraming(m,e,j,I);n=o.position,d=o.target}let c;const J=this.activeCamera.rotation?this.activeCamera.rotation.clone():new b.Euler;if(w)c=this.activeCamera.position.clone();else{const o=n.clone().sub(m).normalize();o.lengthSq()===0&&o.set(0,0,1),c=m.clone().add(o.multiplyScalar(n.distanceTo(m)*l))}const L=this.controls.get(this.activeControlKey);if(L&&(L.enabled=!1),await this.animateToPosition(c,J,n,D,d,i,C),this.activeCamera.camera.type==="OrthographicCamera"&&this.activeCamera.camera.updateProjectionMatrix(),L&&"target"in L&&(L.target.copy(d),L.update&&L.update()),L&&(L.enabled=!0),!Z){const o=Math.max(e.x,e.y,e.z);this.cameraPathManager.fitCircularPathToSchematics("circularPath",{padding:I,minRadius:o*.8,maxRadius:o*2.5})}}async transitionToOrbit(A,I,i){const C=this.activeCamera.position.clone(),l=this.activeCamera.rotation.clone(),w=A.getTargetPosition(),Z=this.findClosestOrbitPoint(A,C),M=Z.position;A.setStartAngle(Z.angle);const m=this.controls.get(this.activeControlKey);m&&(m.enabled=!1),await this.animateToPosition(C,l,M,null,w,I,i),this.startAutoOrbit()}findClosestOrbitPoint(A,I){const i=A.getCenter(),C=A.getRadius(),l=A.getHeight(),Z=new b.Vector3(I.x,i.y+l,I.z).clone().sub(i);if(Z.lengthSq()===0){const e=A.getStartAngle()!==void 0?A.getStartAngle():0;return{position:new b.Vector3(i.x+C*Math.cos(e),i.y+l,i.z+C*Math.sin(e)),angle:e}}Z.normalize();const M=Math.atan2(Z.z,Z.x);return{position:new b.Vector3(i.x+C*Math.cos(M),i.y+l,i.z+C*Math.sin(M)),angle:M}}async animateToPosition(A,I,i,C,l,w,Z){return new Promise(M=>{const m=performance.now(),e=new b.Quaternion().setFromEuler(I);let t=null;C&&(t=new b.Quaternion().setFromEuler(C));const j=()=>{const n=(performance.now()-m)/1e3;let D=Math.min(n/w,1);D=Z(D);const d=A.clone().lerp(i,D);if(this.activeCamera.setPosition([d.x,d.y,d.z]),this.activeCamera.camera.type==="OrthographicCamera"&&t){const c=new b.Quaternion;c.slerpQuaternions(e,t,D);const J=new b.Euler().setFromQuaternion(c,this.activeCamera.camera.rotation.order);this.activeCamera.rotation=[J.x,J.y,J.z]}else this.activeCamera.lookAt(l);D<1?requestAnimationFrame(j):(this.activeCamera.setPosition([i.x,i.y,i.z]),this.activeCamera.camera.type==="OrthographicCamera"&&C?this.activeCamera.rotation=[C.x,C.y,C.z]:this.activeCamera.lookAt(l),M())};requestAnimationFrame(j)})}calculateSchematicBounds(){if(!this.schematicRenderer.schematicManager||this.schematicRenderer.schematicManager.isEmpty())return null;const A=this.schematicRenderer.schematicManager.getGlobalTightWorldBox();if(A.isEmpty())return null;const I=A.getCenter(new b.Vector3),i=A.getSize(new b.Vector3);return{center:I,size:i,boundingBox:A}}calculateOptimalViewingAngles(A,I=1){const{x:i,y:C,z:l}=A,w=Math.max(i,l),Z=w/(C+w+.001),M=Math.PI/6,m=11*Math.PI/36,e=b.MathUtils.lerp(M,m,Z),t=l/(i+l+.001),j=Math.min(Math.max((I-1)*.2,-.1),.1),n=Math.PI/6-j,D=Math.PI/3+j;return{yaw:b.MathUtils.lerp(n,D,t),pitch:e}}calculatePerspectiveFraming(A,I,i,C){const l=this.activeCamera.camera,w=b.MathUtils.degToRad(l.fov),Z=Math.tan(w/2),M=1+C*2,{yaw:m,pitch:e}=this.calculateOptimalViewingAngles(I,i),t=Math.cos(m),j=Math.sin(m),n=Math.cos(e),D=Math.sin(e),d=new b.Vector3(n*j,D,n*t).normalize(),c=new b.Vector3(0,1,0),J=new b.Vector3().crossVectors(c,d).normalize();J.lengthSq()<.001&&J.set(1,0,0);const L=new b.Vector3().crossVectors(d,J).normalize(),o=I.clone().multiplyScalar(.5),a=[new b.Vector3(o.x,o.y,o.z),new b.Vector3(o.x,o.y,-o.z),new b.Vector3(o.x,-o.y,o.z),new b.Vector3(o.x,-o.y,-o.z),new b.Vector3(-o.x,o.y,o.z),new b.Vector3(-o.x,o.y,-o.z),new b.Vector3(-o.x,-o.y,o.z),new b.Vector3(-o.x,-o.y,-o.z)].map(Y=>new b.Vector3(Y.dot(J),Y.dot(L),Y.dot(d)));let z=0,R=0,O=0;for(let Y=0;Y<3;Y++){let S=0;for(const AA of a){const $=Math.abs(AA.x-z),cA=Math.abs(AA.y-R),PA=$*M/(Z*i),UA=cA*M/Z,mI=AA.z+Math.max(PA,UA);S=Math.max(S,mI)}const T=Math.max(I.x,I.y,I.z);O=Math.max(S,T*.1,sh);let p=1/0,eA=-1/0,CA=1/0,zA=-1/0;for(const AA of a){const $=O-AA.z;if($<.001)continue;const cA=(AA.x-z)/$,PA=(AA.y-R)/$;p=Math.min(p,cA),eA=Math.max(eA,cA),CA=Math.min(CA,PA),zA=Math.max(zA,PA)}const mA=(p+eA)/2,LA=(CA+zA)/2;if(z+=mA*O,R+=LA*O,Math.abs(mA)<.001&&Math.abs(LA)<.001)break}const B=J.clone().multiplyScalar(z).add(L.clone().multiplyScalar(R)),X=A.clone().add(B);return{position:X.clone().add(d.multiplyScalar(O)),target:X}}calculateIsometricFraming(A,I,i,C){const l=this.activeCameraKey,Z=($C.CAMERA_PRESETS[l]||$C.CAMERA_PRESETS.isometric).rotation||$C.CAMERA_PRESETS.isometric.rotation,M=new b.Euler(Z[0],Z[1],Z[2]??0,"YXZ"),e=Math.max(I.x,I.y,I.z)*1.5+Ob*2,t=new b.Vector3(0,0,1);return t.applyEuler(M),t.multiplyScalar(e),{position:A.clone().add(t),rotation:M}}async zoomToOrbitPosition(A={}){const{duration:I=2,padding:i=.08,startFromCurrentPosition:C=!0,startOrbitAfterZoom:l=!1,easing:w=n=>n*n*(3-2*n)}=A;if(this.schematicRenderer?.schematicManager?.isEmpty())return;console.log("Starting zoom directly to orbit position");const Z=this.cameraPathManager.getFirstPath();if(!Z||!(Z.path instanceof je)){console.warn("No circular camera path available for zoom to orbit"),l&&this.startAutoOrbitFromOptimalPosition();return}const M=Z.path;this.cameraPathManager.fitCircularPathToSchematics(Z.name,{padding:i});let m;const e=this.activeCamera.rotation.clone(),t=this.findClosestOrbitPoint(M,C?this.activeCamera.position.clone():M.getPoint(0).position);if(C)m=this.activeCamera.position.clone();else{const n=M.getTargetPosition().clone().sub(t.position).normalize(),D=M.getRadius()*2;m=t.position.clone().add(n.multiplyScalar(D))}M.setStartAngle(t.angle);const j=this.controls.get(this.activeControlKey);j&&(j.enabled=!1),await this.animateToPosition(m,e,t.position,null,M.getTargetPosition(),I,w),j&&"target"in j&&(j.target.copy(M.getTargetPosition()),j.update&&j.update()),j&&(j.enabled=!0),l&&setTimeout(()=>{this.startAutoOrbitFromOptimalPosition()},100)}startAutoOrbit(){if(this.autoOrbitEnabled)return;this.stopAnimation();const A=this.cameraPathManager.getFirstPath();if(!A||!(A.path instanceof je)){console.warn("Cannot start auto-orbit: No circular camera path or path not found.");return}console.log("🎬 Starting auto-orbit animation.");const I=this.controls.get(this.activeControlKey);I&&(I.enabled=!1),this.autoOrbitEnabled=!0,this.autoOrbitStartTime=performance.now();const i=()=>{if(!this.autoOrbitEnabled)return;const l=(performance.now()-this.autoOrbitStartTime)/1e3%this.autoOrbitDuration/this.autoOrbitDuration,{position:w,rotation:Z,target:M}=A.path.getPoint(l);this.activeCamera.position.copy(w),this.activeCamera.lookAt(M),this.emit("cameraMove",{position:this.activeCamera.position.clone(),rotation:this.activeCamera.rotation.clone(),progress:l}),this.autoOrbitAnimationId=requestAnimationFrame(i)};this.autoOrbitAnimationId=requestAnimationFrame(i)}stopAutoOrbit(){if(!this.autoOrbitEnabled)return;this.autoOrbitEnabled=!1,this.autoOrbitAnimationId!==null&&(cancelAnimationFrame(this.autoOrbitAnimationId),this.autoOrbitAnimationId=null);const A=this.controls.get(this.activeControlKey);A&&(A.enabled=!0)}toggleAutoOrbit(){if(this.autoOrbitEnabled)return this.stopAutoOrbit(),!1;{const A=this.cameraPathManager.getFirstPath();return A&&this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.cameraPathManager.fitCircularPathToSchematics(A.name),this.startAutoOrbitFromOptimalPosition(),!0}}setAutoOrbitDuration(A){this.autoOrbitDuration=Math.max(1,A),this.autoOrbitEnabled&&(this.stopAutoOrbit(),this.startAutoOrbitFromOptimalPosition())}isAutoOrbitEnabled(){return this.autoOrbitEnabled}setIsometricAngles(A,I=45,i=!0){A=Math.max(0,Math.min(89,A));const C=-(A*Math.PI)/180,l=I*Math.PI/180,w=$C.CAMERA_PRESETS.isometric;if(w.rotation=[C,l,0],this.activeCameraKey==="isometric"){const Z=new b.Euler(C,l,0,"YXZ");this.activeCamera.camera.rotation.order="YXZ",this.activeCamera.rotation=[Z.x,Z.y,Z.z],i&&this.schematicRenderer.schematicManager&&!this.schematicRenderer.schematicManager.isEmpty()&&this.focusOnSchematics({animationDuration:.5,easing:M=>M*M*(3-2*M)}),console.log(`Isometric angles updated: pitch=${A}°, yaw=${I}°`)}}resetIsometricAngles(A=!0){const I=Math.atan(1/Math.sqrt(2))*(180/Math.PI);this.setIsometricAngles(I,45,A)}getIsometricAngles(){if(this.activeCameraKey!=="isometric")return null;const A=$C.CAMERA_PRESETS.isometric;return A.rotation?{pitch:-(A.rotation[0]*180)/Math.PI,yaw:A.rotation[1]*180/Math.PI}:null}dispose(){this.recordingManager.dispose(),this.stopAnimation(),this.stopAutoOrbit(),this.flyControls&&(this.flyControls.dispose(),this.flyControls=null),this.controls.forEach(A=>{A.dispose&&A.dispose()}),this.controls.clear(),this.cameras.clear(),this.removeAllListeners()}static SNAP_ANGLES={front:{dir:[0,0,1]},back:{dir:[0,0,-1]},right:{dir:[1,0,0]},left:{dir:[-1,0,0]},top:{dir:[0,1,0]},bottom:{dir:[0,-1,0]},"3/4":{dir:[1,.7,1]},"iso-ne":{iso:[35.264,45]},"iso-nw":{iso:[35.264,135]},"iso-sw":{iso:[35.264,225]},"iso-se":{iso:[35.264,315]},"iso-top":{iso:[89,45]},"iso-front":{iso:[10,0]},"iso-right":{iso:[10,90]},"iso-back":{iso:[10,180]},"iso-left":{iso:[10,270]}};snapToAngle(A,I=!0){const i=$C.SNAP_ANGLES[A];if(!i){console.warn(`Unknown snap angle: ${A}`);return}if("iso"in i)this.setIsometricAngles(i.iso[0],i.iso[1],I);else if("dir"in i){const C=this.getControlsTarget(),l=this.activeCamera.camera,w=l.position.distanceTo(C),Z=new b.Vector3(i.dir[0],i.dir[1],i.dir[2]).normalize(),M=C.clone().add(Z.multiplyScalar(w));l.position.copy(M),l.lookAt(C);const m=this.controls.get(this.activeControlKey);m&&"target"in m&&(m.target.copy(C),m.update?.()),I&&this.focusOnSchematics({padding:.05,animationDuration:0})}}snapToDirection(A,I=!0){const i=this.activeCamera.camera,C=new b.Vector3(A[0],A[1],A[2]);if(C.lengthSq()<1e-6)return;C.normalize();const l=this.calculateSchematicBounds(),w=l?l.center.clone():this.getControlsTarget();let Z=i.position.distanceTo(w);I&&l&&i instanceof b.PerspectiveCamera&&(Z=this.calculateFramingDistance(C,l.boundingBox,.05)),i.position.copy(w.clone().add(C.clone().multiplyScalar(Z))),i.lookAt(w);const M=this.controls.get(this.activeControlKey);M&&"target"in M&&(M.target.copy(w),M.update?.()),this.schematicRenderer.invalidate?.()}getControlsTarget(){const A=this.controls.get(this.activeControlKey);return A&&"target"in A?A.target.clone():new b.Vector3(0,0,0)}static getSnapAngles(){return Object.keys($C.SNAP_ANGLES)}calculateFramingDistance(A,I,i=.05){const C=this.activeCamera.camera,l=b.MathUtils.degToRad(C.fov),w=this.schematicRenderer.canvas.width/this.schematicRenderer.canvas.height,Z=Math.tan(l/2),M=1+i*2,e=I.getSize(new b.Vector3).clone().multiplyScalar(.5),t=new b.Vector3(0,1,0),j=new b.Vector3().crossVectors(t,A).normalize();j.lengthSq()<.001&&j.set(1,0,0);const n=new b.Vector3().crossVectors(A,j).normalize(),D=[new b.Vector3(e.x,e.y,e.z),new b.Vector3(e.x,e.y,-e.z),new b.Vector3(e.x,-e.y,e.z),new b.Vector3(e.x,-e.y,-e.z),new b.Vector3(-e.x,e.y,e.z),new b.Vector3(-e.x,e.y,-e.z),new b.Vector3(-e.x,-e.y,e.z),new b.Vector3(-e.x,-e.y,-e.z)];let d=0,c=0;for(const o of D)d=Math.max(d,Math.abs(o.dot(j))),c=Math.max(c,Math.abs(o.dot(n)));d*=M,c*=M;const J=d/(Z*w),L=c/Z;return Math.max(J,L)}}N.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new N.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},N.ShaderLib.line={uniforms:N.UniformsUtils.merge([N.UniformsLib.common,N.UniformsLib.fog,N.UniformsLib.line]),vertexShader:`
|
|
14
14
|
#include <common>
|
|
15
15
|
#include <color_pars_vertex>
|
|
16
16
|
#include <fog_pars_vertex>
|